@coxwave/tap-sdk 0.0.1 → 0.0.2

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.js CHANGED
@@ -11,14 +11,14 @@
11
11
  }
12
12
  })();
13
13
 
14
- 'use strict';var tapMessages=require('@coxwave/tap-messages'),oe=require('valibot');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var oe__namespace=/*#__PURE__*/_interopNamespace(oe);var fe=Object.defineProperty;var z=s=>{throw TypeError(s)};var ye=(s,t,e)=>t in s?fe(s,t,{enumerable:true,configurable:true,writable:true,value:e}):s[t]=e;var r=(s,t,e)=>ye(s,typeof t!="symbol"?t+"":t,e),D=(s,t,e)=>t.has(s)||z("Cannot "+e);var R=(s,t,e)=>(D(s,t,"read from private field"),e?e.call(s):t.get(s)),y=(s,t,e)=>t.has(s)?z("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e);var m=(s,t,e)=>(D(s,t,"access private method"),e);var K="_1mlv4me2",w="_1mlv4me4";var k="_1mlv4me3";var _=class{constructor(){r(this,"chatBody",null);this.chatBody=null;}createChatBody({customChatBody:t}){return this.chatBody?this.chatBody:(this.chatBody=document.createElement("div"),this.chatBody.id="cw-chat-body",this.chatBody.className=K,this.chatBody.style.setProperty("z-index","10000001","important"),this.chatBody.style.setProperty("position","fixed","important"),Object.assign(this.chatBody.style,{top:t?.position?.top??"50px",right:t?.position?.right??"24px",left:t?.position?.left??"unset",bottom:t?.position?.bottom??"unset",width:t?.width??"340px",height:t?.height??"calc(100% - 116px)",overflow:"hidden",backgroundColor:"transparent",borderRadius:t?.borderRadius??"16px",boxShadow:`
14
+ 'use strict';var d=require('valibot');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var d__namespace=/*#__PURE__*/_interopNamespace(d);var xe=Object.defineProperty;var R=s=>{throw TypeError(s)};var Te=(s,t,e)=>t in s?xe(s,t,{enumerable:true,configurable:true,writable:true,value:e}):s[t]=e;var r=(s,t,e)=>Te(s,typeof t!="symbol"?t+"":t,e),z=(s,t,e)=>t.has(s)||R("Cannot "+e);var K=(s,t,e)=>(z(s,t,"read from private field"),e?e.call(s):t.get(s)),v=(s,t,e)=>t.has(s)?R("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e);var g=(s,t,e)=>(z(s,t,"access private method"),e);var V="_1mlv4me2",w="_1mlv4me4";var _="_1mlv4me3";var A=class{constructor(){r(this,"chatBody",null);this.chatBody=null;}createChatBody({customChatBody:t}){return this.chatBody?this.chatBody:(this.chatBody=document.createElement("div"),this.chatBody.id="cw-chat-body",this.chatBody.className=V,this.chatBody.style.setProperty("z-index","10000001","important"),this.chatBody.style.setProperty("position","fixed","important"),Object.assign(this.chatBody.style,{top:t?.position?.top??"50px",right:t?.position?.right??"24px",left:t?.position?.left??"unset",bottom:t?.position?.bottom??"unset",width:t?.width??"340px",height:t?.height??"calc(100% - 116px)",overflow:"hidden",backgroundColor:"transparent",borderRadius:t?.borderRadius??"16px",boxShadow:`
15
15
  rgba(255, 255, 255, 0.12) 0px 0px 2px 0px inset,
16
16
  rgba(0, 0, 0, 0.05) 0px 0px 2px 1px,
17
17
  rgba(0, 0, 0, 0.3) 0px 12px 60px
18
- `,willChange:"transform, opacity, width, max-height, max-width"}),document.body.appendChild(this.chatBody),this.chatBody)}toggleVisibility(t){if(!this.chatBody)return;this.chatBody.classList.remove(k,w),this.chatBody.style.display="block";let e=()=>{this.chatBody&&(this.chatBody.classList.contains(w)&&(this.chatBody.style.display="none"),this.chatBody.removeEventListener("animationend",e));};this.chatBody.addEventListener("animationend",e),requestAnimationFrame(()=>{this.chatBody?.classList.add(t?k:w);});}removeChatBody(){this.chatBody&&(this.chatBody.remove(),this.chatBody=null);}resizeChatBody(t,e){if(!this.chatBody)return;let i=e?.width??"340px",a=parseInt(i,10),o=a/3*10-a,n=t?`${a+o}px`:`${a}px`;this.chatBody.style.width=n;}},W=_;var V="_6j1ub51",L={default:"_6j1ub5b _6j1ub5a","call-to-action":"_6j1ub5c _6j1ub5a"},$="_6j1ub5a",G="_6j1ub59",A={default:"_6j1ub5e _6j1ub5d","call-to-action":"_6j1ub5f _6j1ub5d"},q="_6j1ub5d",Y="_6j1ub5h",X="_6j1ub5g",P="_6j1ub53",J="_6j1ub58",O={default:"_6j1ub56 _6j1ub55","call-to-action":"_6j1ub57 _6j1ub55"},Z="_6j1ub55",j="_6j1ub52",Q="_6j1ub54";var p,ee,te,ae,ie,re,H=class{constructor(){y(this,p);r(this,"container");r(this,"alarmTimeout");r(this,"alarmCornerSVG");r(this,"textContainer");r(this,"circleElement");r(this,"textInTextContainer");r(this,"messageInfo");}render({rootElement:t}){this.container=document.createElement("div"),this.container.id="alarm-container",this.container.className=V,this.container.addEventListener("click",i=>{i.stopPropagation();}),t.appendChild(this.container),m(this,p,ee).call(this,this.container);let e=m(this,p,te).call(this,this.container);m(this,p,ie).call(this,e),m(this,p,ae).call(this,e);}fadeIn(t){t.type==="default"||t.type==="hourSpent"?(this.textContainer.className=O.default,this.alarmCornerSVG.setAttribute("class",L.default),this.circleElement.className=A.default):(this.textContainer.className=O["call-to-action"],this.alarmCornerSVG.setAttribute("class",L["call-to-action"]),this.circleElement.className=A["call-to-action"]),this.messageInfo=t,this.textInTextContainer.textContent=t.message,this.toggleVisibility(true),this.alarmTimeout=setTimeout(()=>{this.toggleVisibility(false);},18*1e3);}addClickEvent({callback:t}){this.container.addEventListener("click",()=>{this.toggleVisibility(false),t(this.messageInfo);});}toggleVisibility(t){this.container.classList.remove(j,P),requestAnimationFrame(()=>{this.container?.classList.add(t?j:P);});}remove(){this.container&&this.toggleVisibility(false),this.alarmTimeout&&clearTimeout(this.alarmTimeout);}};p=new WeakSet,ee=function(t){let e=document.createElement("div");e.className=G,t.appendChild(e);let i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("width","11"),i.setAttribute("height","8"),i.setAttribute("viewBox","0 0 11 8"),i.setAttribute("fill","currentColor"),i.setAttribute("class",$);let a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d","M5.5 0L11.1292 8.25H-0.129165L5.5 0Z"),a.setAttribute("fill","currentColor"),i.appendChild(a),this.alarmCornerSVG=i,e.appendChild(i);},te=function(t){let e=document.createElement("div");return e.className=Q,t.appendChild(e),e},ae=function(t){this.textContainer=document.createElement("div"),this.textContainer.className=Z,t.appendChild(this.textContainer),this.textInTextContainer=document.createElement("span"),this.textInTextContainer.className=J,this.textContainer.appendChild(this.textInTextContainer);},ie=function(t){let e=document.createElement("div");e.className=q,t.appendChild(e),e.addEventListener("click",a=>{a.stopPropagation(),this.remove();});let i=document.createElement("span");i.className=Y,e.appendChild(i),i.textContent="\uC54C\uB9BC \uB044\uAE30",m(this,p,re).call(this,e),this.circleElement=e;},re=function(t){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("width","10"),e.setAttribute("height","10"),e.setAttribute("viewBox","0 0 14 14"),e.setAttribute("fill","none"),e.setAttribute("class",X);let i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttribute("d","M1 1L13 13M13 1L1 13"),i.setAttribute("stroke","currentColor"),i.setAttribute("stroke-width","2"),i.setAttribute("stroke-linecap","round"),e.appendChild(i),t.appendChild(e);};var se=H;var T,S=class{constructor(){r(this,"customFloatingButton");r(this,"floatingButton");r(this,"alarm");y(this,T,(t,e)=>t.key===e?true:t.code.startsWith("Key")?t.code.slice(3).toLowerCase()===e:false);this.alarm=new se;}render({customFloatingButton:t}){if(this.customFloatingButton=t,this.customFloatingButton?.isInElement&&this.customFloatingButton?.parentElementId){let e=document.getElementById(this.customFloatingButton.parentElementId);e?.style.setProperty("position","relative","important"),e?.style.setProperty("z-index","10000001","important"),this.floatingButton=e;}else {let e=document.getElementById("cw-plugin");e||(e=document.createElement("button"),e.id="cw-plugin",e.style.zIndex="10000001",e.style.setProperty("z-index","10000001","important"),e.style.setProperty("position","fixed","important"),e.style.width="50px",e.style.height="50px",e.style.borderRadius="50%",e.style.backgroundColor="#000",document.body.appendChild(e),this.floatingButton=e);}return this.alarm.render({rootElement:this.floatingButton}),this.floatingButton}addClickEvent({callback:t}){if(!this.floatingButton)throw new Error("not initialized");this.floatingButton.addEventListener("click",()=>{t();});}addAlarmClickEvent({callback:t}){this.alarm.addClickEvent({callback:t});}addShortCutEvent({openChatShortcutKey:t,callback:e}){if(!this.floatingButton)throw new Error("not initialized");window.addEventListener("keydown",i=>{R(this,T).call(this,i,t.key)&&(!t.modifier||i[t.modifier])&&e();});}alarmFadeIn(t){this.alarm.fadeIn(t);}alarmRemove(){this.alarm.remove();}};T=new WeakMap;var ne=S;var C=class{constructor(){r(this,"listeners",new Map);r(this,"unifiedMessageHandler",null);}on(t,e){let i=o=>{if(this.isValidOrigin(o))try{let n=o.data,d=typeof n=="string"?JSON.parse(n):n,{type:g}=d;g===t&&e(d);}catch(n){console.warn("Messenger: Failed to parse message data",n);}},a=this.listeners.get(t)||[];return a.push(i),this.listeners.set(t,a),this.unifiedMessageHandler||(this.unifiedMessageHandler=o=>{this.listeners.forEach(n=>n.forEach(d=>d(o)));},window.addEventListener("message",this.unifiedMessageHandler)),()=>{this.unifiedMessageHandler&&(window.removeEventListener("message",this.unifiedMessageHandler),this.unifiedMessageHandler=null);}}removeListener(t){this.listeners.delete(t);}removeAllListeners(){this.listeners.clear(),this.unifiedMessageHandler&&(window.removeEventListener("message",this.unifiedMessageHandler),this.unifiedMessageHandler=null);}postMessage(t){try{let e=this.getMessageTarget();return e?(e.postMessage(t,this.getTargetOrigin()),!0):(console.warn("Messenger: Message target not available"),!1)}catch(e){return console.error("Messenger: postMessage failed",e),false}}};var u=class extends Error{constructor(e,i,a){super(`Handshake failed: ${e}${i?` - ${i}`:""}`);this.reason=e;this.details=i;this.originalError=a;this.name="HandshakeError";}},M=class{constructor(t,e,i){this.getTargetWindow=t;this.getTargetOrigin=e;this.isValidOrigin=i;r(this,"abortController",null);r(this,"messageListener",null);}async execute(t,e={}){let{timeout:i=1e4,maxRetries:a=10,retryInterval:o=500}=e;return this.cancel(),this.abortController=new AbortController,new Promise((n,d)=>{let g=0,f,h=()=>{f&&clearTimeout(f),this.messageListener&&(window.removeEventListener("message",this.messageListener),this.messageListener=null);},v=()=>{h(),d(new u("TIMEOUT","Handshake was cancelled"));};this.abortController?.signal.addEventListener("abort",v),this.messageListener=l=>{if(this.isValidOrigin(l))try{let b=l.data,ue=typeof b=="string"?JSON.parse(b):b;try{let U=oe__namespace.safeParse(tapMessages.ChatInitiatedSchema,ue);h(),this.abortController=null,n(U.output);return}catch{}}catch(b){console.warn("Failed to parse handshake message:",b);}},window.addEventListener("message",this.messageListener),f=setTimeout(()=>{h(),this.abortController=null,d(new u("TIMEOUT",`No valid response received within ${i}ms`));},i);let c=()=>{if(!this.abortController?.signal.aborted)try{let l=this.getTargetWindow();if(!l)throw new u("NO_TARGET_WINDOW","Target iframe window is not available");l.postMessage(t,this.getTargetOrigin()),g++,g<a&&setTimeout(()=>{this.abortController?.signal.aborted||c();},o);}catch(l){h(),this.abortController=null,l instanceof u?d(l):d(new u("MESSAGE_SEND_FAILED","Failed to send handshake message",l));}};c();})}cancel(){this.abortController&&(this.abortController.abort(),this.abortController=null),this.messageListener&&(window.removeEventListener("message",this.messageListener),this.messageListener=null);}isActive(){return this.abortController!==null&&!this.abortController.signal.aborted}};var B=class extends C{constructor({hostClientUrl:e,pluginKey:i}){super();r(this,"hostClientUrl");r(this,"pluginKey");r(this,"iframe");r(this,"listenToTap",super.on);this.hostClientUrl=e,this.pluginKey=i;}isValidOrigin(e){if(!this.iframe)return false;let i=e.origin,a=new URL(this.iframe.src).origin;return !!(i===a||i.includes("vercel.app")&&a.includes("vercel.app")||i.includes("localhost")&&a.includes("localhost"))}getMessageTarget(){return this.iframe?.contentWindow||null}getTargetOrigin(){if(!this.iframe?.src)return "*";try{return new URL(this.iframe.src).origin}catch{return "*"}}renderIframe({chatBody:e,isProd:i,isLocal:a}){return new Promise(o=>{this.iframe=document.createElement("iframe"),this.iframe.style.setProperty("display","flex","important"),this.iframe.style.setProperty("border","none","important"),a?this.iframe.src=`${this.hostClientUrl}/chat`:this.iframe.src="https://ax-tap-fe-staging.vercel.app/chat",this.iframe.style.width="100%",this.iframe.style.height="100%",this.iframe.onload=()=>o(this.iframe),e.appendChild(this.iframe);})}hasIframe(){return !!this.iframe}removeIframe(){this.iframe?.remove(),this.iframe=null,this.removeAllListeners();}get postToTap(){return this.iframe||console.warn("TapIframeBridge: iframe not found"),super.postMessage}async performHandshake(e,i){if(!this.iframe)throw new Error("TapIframeBridge: iframe not available for handshake");let a=new M(()=>this.getMessageTarget(),()=>this.getTargetOrigin(),n=>this.isValidOrigin(n)),o={type:tapMessages.CHAT_INIT,hostClientUrl:this.hostClientUrl,pluginKey:this.pluginKey,chatApiParams:e.chatApiParams,theme:e.customStyles};try{return await a.execute(o,i)}catch(n){throw n instanceof Error?new Error(`TapIframeBridge handshake failed: ${n.message}`):n}}};var E=class{constructor(t){this.iframeBridge=t;}onTimelineSeek(t){this.iframeBridge.listenToTap("timeline:seek",e=>t(e.clipPlayHead,e.clipId));}onChatOpened(t){this.iframeBridge.listenToTap("chat:opened",t);}onChatClosed(t){this.iframeBridge.listenToTap("chat:closed",t);}onChatInitiated(t){this.iframeBridge.listenToTap("chat:initiated",t);}onAlarmFadeIn(t){this.iframeBridge.listenToTap("alarm:fadeIn",e=>{t(e.messageInfo);});}onPopUpOpen(t){this.iframeBridge.listenToTap("popUp:open",e=>{t(e.popUpInfo);});}onPdfOpen(t){this.iframeBridge.listenToTap("pdf:open",t);}onPdfClose(t){this.iframeBridge.listenToTap("pdf:close",t);}};var le="wu2gm66",de="wu2gm67",pe="wu2gm68";function Ce({htmlString:s,callback:t,customStyles:e}){let i=document.createElement("div");i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.width="100vw",i.style.height="100vh",i.style.background="rgba(0, 0, 0, 0.4)",i.style.zIndex="10000002";let a=document.createElement("div");a.style.position="fixed",a.style.display="flex",a.style.flexDirection="column";let n=15;if(e?.width){let c=parseFloat(e.width),l=e.width.match(/[a-zA-Z%]+/)?.[0];!isNaN(c)&&l==="px"&&(n+=c);}else n+=340;if(e?.position?.right){let c=parseFloat(e?.position?.right),l=e?.position?.right.match(/[a-zA-Z%]+/)?.[0];!isNaN(c)&&l==="px"&&(n+=c);}else n=n+24;a.style.top=e?.position?.top??"50px",a.style.right=`${n}px`,a.style.left=e?.position?.left??"unset",a.style.bottom=e?.position?.bottom??"unset",a.style.maxWidth="calc(100vw - 100px)",a.style.maxHeight=e?.height??"calc(100vh - 116px)",a.style.overflow="auto",a.style.background="#fff",a.style.padding="20px",a.style.border="1px solid #ccc",a.style.boxShadow="0 4px 20px rgba(0,0,0,0.2)",a.style.zIndex="10000003",a.style.borderRadius="8px";let d=document.createElement("div");d.innerHTML=s,i.addEventListener("click",()=>{document.body.removeChild(i),document.body.removeChild(a),t();}),a.addEventListener("click",c=>{c.stopPropagation();}),a.appendChild(d),document.body.appendChild(i),document.body.appendChild(a);let g=document.querySelector(`.${le}`),f=document.querySelector(".cw-plugin-code-block"),h=document.querySelector(`.${pe}`),v=document.querySelector(`.${de}`);g&&f&&h&&v&&g.addEventListener("click",()=>{navigator.clipboard.writeText(f.textContent??""),h.style.display="none",v.textContent="\uBCF5\uC0AC\uB428",setTimeout(()=>{v.textContent="\uBCF5\uC0AC",h.style.display="inline";},1e3);});}var ce=Ce;var x=class x{constructor({gaId:t}){x.isInitialized||(this.init(t),x.isInitialized=true);}init(t){if(!document.querySelector(`script[src="https://www.googletagmanager.com/gtag/js?id=${t}"]`)){let e=document.createElement("script");e.async=true,e.src=`https://www.googletagmanager.com/gtag/js?id=${t}`,document.head.appendChild(e);}if(typeof window.gtag!="function"){let e=document.createElement("script");e.innerHTML=`
18
+ `,willChange:"transform, opacity, width, max-height, max-width"}),document.body.appendChild(this.chatBody),this.chatBody)}toggleVisibility(t){if(!this.chatBody)return;this.chatBody.classList.remove(_,w),this.chatBody.style.display="block";let e=()=>{this.chatBody&&(this.chatBody.classList.contains(w)&&(this.chatBody.style.display="none"),this.chatBody.removeEventListener("animationend",e));};this.chatBody.addEventListener("animationend",e),requestAnimationFrame(()=>{this.chatBody?.classList.add(t?_:w);});}removeChatBody(){this.chatBody&&(this.chatBody.remove(),this.chatBody=null);}resizeChatBody(t,e){if(!this.chatBody)return;let i=e?.width??"340px",a=parseInt(i,10),o=a/3*10-a,n=t?`${a+o}px`:`${a}px`;this.chatBody.style.width=n;}},W=A;var G="_6j1ub51",L={default:"_6j1ub5b _6j1ub5a","call-to-action":"_6j1ub5c _6j1ub5a"},$="_6j1ub5a",q="_6j1ub59",P={default:"_6j1ub5e _6j1ub5d","call-to-action":"_6j1ub5f _6j1ub5d"},Y="_6j1ub5d",X="_6j1ub5h",J="_6j1ub5g",O="_6j1ub53",Z="_6j1ub58",S={default:"_6j1ub56 _6j1ub55","call-to-action":"_6j1ub57 _6j1ub55"},Q="_6j1ub55",H="_6j1ub52",ee="_6j1ub54";var c,te,ae,ie,re,se,j=class{constructor(){v(this,c);r(this,"container");r(this,"alarmTimeout");r(this,"alarmCornerSVG");r(this,"textContainer");r(this,"circleElement");r(this,"textInTextContainer");r(this,"messageInfo");}render({rootElement:t}){this.container=document.createElement("div"),this.container.id="alarm-container",this.container.className=G,this.container.addEventListener("click",i=>{i.stopPropagation();}),t.appendChild(this.container),g(this,c,te).call(this,this.container);let e=g(this,c,ae).call(this,this.container);g(this,c,re).call(this,e),g(this,c,ie).call(this,e);}fadeIn(t){t.type==="default"||t.type==="hourSpent"?(this.textContainer.className=S.default,this.alarmCornerSVG.setAttribute("class",L.default),this.circleElement.className=P.default):(this.textContainer.className=S["call-to-action"],this.alarmCornerSVG.setAttribute("class",L["call-to-action"]),this.circleElement.className=P["call-to-action"]),this.messageInfo=t,this.textInTextContainer.textContent=t.message,this.toggleVisibility(true),this.alarmTimeout=setTimeout(()=>{this.toggleVisibility(false);},18*1e3);}addClickEvent({callback:t}){this.container.addEventListener("click",()=>{this.toggleVisibility(false),t(this.messageInfo);});}toggleVisibility(t){this.container.classList.remove(H,O),requestAnimationFrame(()=>{this.container?.classList.add(t?H:O);});}remove(){this.container&&this.toggleVisibility(false),this.alarmTimeout&&clearTimeout(this.alarmTimeout);}};c=new WeakSet,te=function(t){let e=document.createElement("div");e.className=q,t.appendChild(e);let i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("width","11"),i.setAttribute("height","8"),i.setAttribute("viewBox","0 0 11 8"),i.setAttribute("fill","currentColor"),i.setAttribute("class",$);let a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d","M5.5 0L11.1292 8.25H-0.129165L5.5 0Z"),a.setAttribute("fill","currentColor"),i.appendChild(a),this.alarmCornerSVG=i,e.appendChild(i);},ae=function(t){let e=document.createElement("div");return e.className=ee,t.appendChild(e),e},ie=function(t){this.textContainer=document.createElement("div"),this.textContainer.className=Q,t.appendChild(this.textContainer),this.textInTextContainer=document.createElement("span"),this.textInTextContainer.className=Z,this.textContainer.appendChild(this.textInTextContainer);},re=function(t){let e=document.createElement("div");e.className=Y,t.appendChild(e),e.addEventListener("click",a=>{a.stopPropagation(),this.remove();});let i=document.createElement("span");i.className=X,e.appendChild(i),i.textContent="\uC54C\uB9BC \uB044\uAE30",g(this,c,se).call(this,e),this.circleElement=e;},se=function(t){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("width","10"),e.setAttribute("height","10"),e.setAttribute("viewBox","0 0 14 14"),e.setAttribute("fill","none"),e.setAttribute("class",J);let i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttribute("d","M1 1L13 13M13 1L1 13"),i.setAttribute("stroke","currentColor"),i.setAttribute("stroke-width","2"),i.setAttribute("stroke-linecap","round"),e.appendChild(i),t.appendChild(e);};var ne=j;var C,F=class{constructor(){r(this,"customFloatingButton");r(this,"floatingButton");r(this,"alarm");v(this,C,(t,e)=>t.key===e?true:t.code.startsWith("Key")?t.code.slice(3).toLowerCase()===e:false);this.alarm=new ne;}render({customFloatingButton:t}){if(this.customFloatingButton=t,this.customFloatingButton?.isInElement&&this.customFloatingButton?.parentElementId){let e=document.getElementById(this.customFloatingButton.parentElementId);e?.style.setProperty("position","relative","important"),e?.style.setProperty("z-index","10000001","important"),this.floatingButton=e;}else {let e=document.getElementById("cw-plugin");e||(e=document.createElement("button"),e.id="cw-plugin",e.style.zIndex="10000001",e.style.setProperty("z-index","10000001","important"),e.style.setProperty("position","fixed","important"),e.style.width="50px",e.style.height="50px",e.style.borderRadius="50%",e.style.backgroundColor="#000",document.body.appendChild(e),this.floatingButton=e);}return this.alarm.render({rootElement:this.floatingButton}),this.floatingButton}addClickEvent({callback:t}){if(!this.floatingButton)throw new Error("not initialized");this.floatingButton.addEventListener("click",()=>{t();});}addAlarmClickEvent({callback:t}){this.alarm.addClickEvent({callback:t});}addShortCutEvent({openChatShortcutKey:t,callback:e}){if(!this.floatingButton)throw new Error("not initialized");window.addEventListener("keydown",i=>{K(this,C).call(this,i,t.key)&&(!t.modifier||i[t.modifier])&&e();});}alarmFadeIn(t){this.alarm.fadeIn(t);}alarmRemove(){this.alarm.remove();}};C=new WeakMap;var oe=F;var le="chat:init",Ee="chat:initiated";var de=d__namespace.object({type:d__namespace.literal(Ee),gaId:d__namespace.string()}),pe=d__namespace.object({type:d__namespace.literal("GA_EVENT"),payload:d__namespace.record(d__namespace.string(),d__namespace.any())});var E=class{constructor(){r(this,"listeners",new Map);r(this,"unifiedMessageHandler",null);}on(t,e){let i=o=>{if(this.isValidOrigin(o))try{let n=o.data,p=typeof n=="string"?JSON.parse(n):n,{type:u}=p;u===t&&e(p);}catch(n){console.warn("Messenger: Failed to parse message data",n);}},a=this.listeners.get(t)||[];return a.push(i),this.listeners.set(t,a),this.unifiedMessageHandler||(this.unifiedMessageHandler=o=>{this.listeners.forEach(n=>n.forEach(p=>p(o)));},window.addEventListener("message",this.unifiedMessageHandler)),()=>{this.unifiedMessageHandler&&(window.removeEventListener("message",this.unifiedMessageHandler),this.unifiedMessageHandler=null);}}removeListener(t){this.listeners.delete(t);}removeAllListeners(){this.listeners.clear(),this.unifiedMessageHandler&&(window.removeEventListener("message",this.unifiedMessageHandler),this.unifiedMessageHandler=null);}postMessage(t){try{let e=this.getMessageTarget();return e?(e.postMessage(t,this.getTargetOrigin()),!0):(console.warn("Messenger: Message target not available"),!1)}catch(e){return console.error("Messenger: postMessage failed",e),false}}};var f=class extends Error{constructor(e,i,a){super(`Handshake failed: ${e}${i?` - ${i}`:""}`);this.reason=e;this.details=i;this.originalError=a;this.name="HandshakeError";}},M=class{constructor(t,e,i){this.getTargetWindow=t;this.getTargetOrigin=e;this.isValidOrigin=i;r(this,"abortController",null);r(this,"messageListener",null);}async execute(t,e={}){let{timeout:i=1e4,maxRetries:a=10,retryInterval:o=500}=e;return this.cancel(),this.abortController=new AbortController,new Promise((n,p)=>{let u=0,y,m=()=>{y&&clearTimeout(y),this.messageListener&&(window.removeEventListener("message",this.messageListener),this.messageListener=null);},b=()=>{m(),p(new f("TIMEOUT","Handshake was cancelled"));};this.abortController?.signal.addEventListener("abort",b),this.messageListener=l=>{if(this.isValidOrigin(l))try{let x=l.data,be=typeof x=="string"?JSON.parse(x):x;try{let U=d__namespace.safeParse(de,be);m(),this.abortController=null,n(U.output);return}catch{}}catch(x){console.warn("Failed to parse handshake message:",x);}},window.addEventListener("message",this.messageListener),y=setTimeout(()=>{m(),this.abortController=null,p(new f("TIMEOUT",`No valid response received within ${i}ms`));},i);let h=()=>{if(!this.abortController?.signal.aborted)try{let l=this.getTargetWindow();if(!l)throw new f("NO_TARGET_WINDOW","Target iframe window is not available");l.postMessage(t,this.getTargetOrigin()),u++,u<a&&setTimeout(()=>{this.abortController?.signal.aborted||h();},o);}catch(l){m(),this.abortController=null,l instanceof f?p(l):p(new f("MESSAGE_SEND_FAILED","Failed to send handshake message",l));}};h();})}cancel(){this.abortController&&(this.abortController.abort(),this.abortController=null),this.messageListener&&(window.removeEventListener("message",this.messageListener),this.messageListener=null);}isActive(){return this.abortController!==null&&!this.abortController.signal.aborted}};var B=class extends E{constructor({hostClientUrl:e,pluginKey:i}){super();r(this,"hostClientUrl");r(this,"pluginKey");r(this,"iframe");r(this,"listenToTap",super.on);this.hostClientUrl=e,this.pluginKey=i;}isValidOrigin(e){if(!this.iframe)return false;let i=e.origin,a=new URL(this.iframe.src).origin;return !!(i===a||i.includes("vercel.app")&&a.includes("vercel.app")||i.includes("localhost")&&a.includes("localhost"))}getMessageTarget(){return this.iframe?.contentWindow||null}getTargetOrigin(){if(!this.iframe?.src)return "*";try{return new URL(this.iframe.src).origin}catch{return "*"}}renderIframe({chatBody:e,isProd:i,isLocal:a}){return new Promise(o=>{this.iframe=document.createElement("iframe"),this.iframe.style.setProperty("display","flex","important"),this.iframe.style.setProperty("border","none","important"),a?this.iframe.src=`${this.hostClientUrl}/chat`:this.iframe.src="https://ax-tap-fe-staging.vercel.app/chat",this.iframe.style.width="100%",this.iframe.style.height="100%",this.iframe.onload=()=>o(this.iframe),e.appendChild(this.iframe);})}hasIframe(){return !!this.iframe}removeIframe(){this.iframe?.remove(),this.iframe=null,this.removeAllListeners();}get postToTap(){return this.iframe||console.warn("TapIframeBridge: iframe not found"),super.postMessage}async performHandshake(e,i){if(!this.iframe)throw new Error("TapIframeBridge: iframe not available for handshake");let a=new M(()=>this.getMessageTarget(),()=>this.getTargetOrigin(),n=>this.isValidOrigin(n)),o={type:le,hostClientUrl:this.hostClientUrl,pluginKey:this.pluginKey,chatApiParams:e.chatApiParams,theme:e.customStyles};try{return await a.execute(o,i)}catch(n){throw n instanceof Error?new Error(`TapIframeBridge handshake failed: ${n.message}`):n}}};var I=class{constructor(t){this.iframeBridge=t;}onTimelineSeek(t){this.iframeBridge.listenToTap("timeline:seek",e=>t(e.clipPlayHead,e.clipId));}onChatOpened(t){this.iframeBridge.listenToTap("chat:opened",t);}onChatClosed(t){this.iframeBridge.listenToTap("chat:closed",t);}onChatInitiated(t){this.iframeBridge.listenToTap("chat:initiated",t);}onAlarmFadeIn(t){this.iframeBridge.listenToTap("alarm:fadeIn",e=>{t(e.messageInfo);});}onPopUpOpen(t){this.iframeBridge.listenToTap("popUp:open",e=>{t(e.popUpInfo);});}onPdfOpen(t){this.iframeBridge.listenToTap("pdf:open",t);}onPdfClose(t){this.iframeBridge.listenToTap("pdf:close",t);}};var he="wu2gm66",me="wu2gm67",ge="wu2gm68";function Be({htmlString:s,callback:t,customStyles:e}){let i=document.createElement("div");i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.width="100vw",i.style.height="100vh",i.style.background="rgba(0, 0, 0, 0.4)",i.style.zIndex="10000002";let a=document.createElement("div");a.style.position="fixed",a.style.display="flex",a.style.flexDirection="column";let n=15;if(e?.width){let h=parseFloat(e.width),l=e.width.match(/[a-zA-Z%]+/)?.[0];!isNaN(h)&&l==="px"&&(n+=h);}else n+=340;if(e?.position?.right){let h=parseFloat(e?.position?.right),l=e?.position?.right.match(/[a-zA-Z%]+/)?.[0];!isNaN(h)&&l==="px"&&(n+=h);}else n=n+24;a.style.top=e?.position?.top??"50px",a.style.right=`${n}px`,a.style.left=e?.position?.left??"unset",a.style.bottom=e?.position?.bottom??"unset",a.style.maxWidth="calc(100vw - 100px)",a.style.maxHeight=e?.height??"calc(100vh - 116px)",a.style.overflow="auto",a.style.background="#fff",a.style.padding="20px",a.style.border="1px solid #ccc",a.style.boxShadow="0 4px 20px rgba(0,0,0,0.2)",a.style.zIndex="10000003",a.style.borderRadius="8px";let p=document.createElement("div");p.innerHTML=s,i.addEventListener("click",()=>{document.body.removeChild(i),document.body.removeChild(a),t();}),a.addEventListener("click",h=>{h.stopPropagation();}),a.appendChild(p),document.body.appendChild(i),document.body.appendChild(a);let u=document.querySelector(`.${he}`),y=document.querySelector(".cw-plugin-code-block"),m=document.querySelector(`.${ge}`),b=document.querySelector(`.${me}`);u&&y&&m&&b&&u.addEventListener("click",()=>{navigator.clipboard.writeText(y.textContent??""),m.style.display="none",b.textContent="\uBCF5\uC0AC\uB428",setTimeout(()=>{b.textContent="\uBCF5\uC0AC",m.style.display="inline";},1e3);});}var ue=Be;var T=class T{constructor({gaId:t}){T.isInitialized||(this.init(t),T.isInitialized=true);}init(t){if(!document.querySelector(`script[src="https://www.googletagmanager.com/gtag/js?id=${t}"]`)){let e=document.createElement("script");e.async=true,e.src=`https://www.googletagmanager.com/gtag/js?id=${t}`,document.head.appendChild(e);}if(typeof window.gtag!="function"){let e=document.createElement("script");e.innerHTML=`
19
19
  window.dataLayer = window.dataLayer || [];
20
20
  function gtag(){dataLayer.push(arguments);}
21
21
  gtag('js', new Date());
22
22
  gtag('config', '${t}');
23
- `,document.head.appendChild(e);}window.addEventListener("message",e=>{try{let i=typeof e.data=="string"?JSON.parse(e.data):e.data,a=oe__namespace.parse(tapMessages.GAEventSchema,i);typeof window.gtag=="function"&&window.gtag("event",a.payload.action??"click",{event_category:a.payload.category??"Default",event_label:a.payload.label,value:a.payload.value,fastCampus_user_id:a.payload.fastCampus_user_id,course_id:a.payload.course_id,...a.payload});}catch{}});}};r(x,"isInitialized",false);var F=x,me=F;var I,ge,N=class{constructor({pluginKey:t,isProd:e=false,isLocal:i=false}){y(this,I);r(this,"pluginKey");r(this,"iframeBridge");r(this,"events");r(this,"chatBody",null);r(this,"chatBodyMaker");r(this,"floatingButtonMaker");r(this,"shortcutKey",{openChat:{key:"/",modifier:""},sendChat:{key:"Enter",modifier:""}});r(this,"isProd");r(this,"isLocal");r(this,"isOpen");r(this,"isPdfOpen");this.pluginKey=t,this.iframeBridge=new B({hostClientUrl:window.location.origin,pluginKey:this.pluginKey}),this.events=new E(this.iframeBridge),this.floatingButtonMaker=new ne,this.chatBodyMaker=new W,this.isProd=e,this.isLocal=i,this.isOpen=false,this.isPdfOpen=false;}setIsOpen(t){this.isOpen=t;}setIsPdfOpen(t){this.isPdfOpen=t;}seekTimeline({clipId:t,clipPlayHead:e}){this.iframeBridge.postToTap({type:"timeline:seek",clipId:t,clipPlayHead:e});}async initChat({chatApiParams:t,customStyles:e,shortcutKey:i}){if(!m(this,I,ge).call(this))throw new Error("not client");this.shortcutKey={openChat:i?.openChat??this.shortcutKey.openChat,sendChat:i?.sendChat??this.shortcutKey.sendChat},this.chatBody||(this.chatBody=this.chatBodyMaker.createChatBody({...e?.chatBody&&{customChatBody:e.chatBody}})),this.iframeBridge.hasIframe()||await this.iframeBridge.renderIframe({chatBody:this.chatBody,isProd:this.isProd,isLocal:this.isLocal});try{let a=await this.iframeBridge.performHandshake({chatApiParams:t,customStyles:e},{retryInterval:500,maxRetries:10,timeout:1e4});new me({gaId:a.gaId});}catch(a){throw console.error("Handshake failed:",a),new Error(`Chat initialization failed: ${a instanceof Error?a.message:"Unknown error"}`)}this.floatingButtonMaker.render({...e?.floatingButton&&{customFloatingButton:e.floatingButton}}),this.floatingButtonMaker.addClickEvent({callback:()=>{this.iframeBridge.postToTap({type:this.isOpen?"chat:close":"chat:open"});}}),this.floatingButtonMaker.addAlarmClickEvent({callback:a=>{this.iframeBridge.postToTap({type:"chat:open",isAlarm:true}),this.iframeBridge.postToTap({type:"alarm:click",messageInfo:a});}}),this.iframeBridge.listenToTap("chat:opened",()=>{this.setIsOpen(true),this.chatBodyMaker.toggleVisibility(this.isOpen),this.floatingButtonMaker.alarmRemove();}),this.iframeBridge.listenToTap("chat:closed",()=>{this.setIsOpen(false),this.chatBodyMaker.toggleVisibility(this.isOpen);}),this.iframeBridge.listenToTap("alarm:fadeIn",a=>{this.isOpen||this.floatingButtonMaker.alarmFadeIn(a.messageInfo);}),this.iframeBridge.listenToTap("popUp:open",a=>{ce({htmlString:a.popUpInfo.html,callback:()=>this.iframeBridge.postToTap({type:"popUp:close"}),...e?.chatBody&&{customStyles:e.chatBody}});}),this.iframeBridge.listenToTap("pdf:open",()=>{this.setIsPdfOpen(true),this.chatBodyMaker.resizeChatBody(this.isPdfOpen,e?.chatBody),this.iframeBridge.postToTap({type:"pdf:enlarged"});}),this.iframeBridge.listenToTap("pdf:close",()=>{this.setIsPdfOpen(false),this.chatBodyMaker.resizeChatBody(this.isPdfOpen,e?.chatBody),this.iframeBridge.postToTap({type:"pdf:shrinked"});}),this.isLocal&&this.iframeBridge.listenToTap("alarm:fadeIn",a=>{this.floatingButtonMaker.alarmFadeIn(a.messageInfo);});}removeChat(){if(!this.chatBody)throw new Error("chatBody is not initialized");this.chatBodyMaker.removeChatBody(),this.floatingButtonMaker.alarmRemove(),this.iframeBridge.removeIframe(),this.chatBody=null,this.isOpen=false;}postChatInfo({clipId:t,clipPlayHead:e}){this.seekTimeline({clipId:t,clipPlayHead:e});}getTimelineInfo({callback:t}){this.events.onTimelineSeek(t);}};I=new WeakSet,ge=function(){return typeof window<"u"&&typeof document<"u"};var Mt=N;module.exports=Mt;//# sourceMappingURL=index.js.map
23
+ `,document.head.appendChild(e);}window.addEventListener("message",e=>{try{let i=typeof e.data=="string"?JSON.parse(e.data):e.data,a=d__namespace.parse(pe,i);typeof window.gtag=="function"&&window.gtag("event",a.payload.action??"click",{event_category:a.payload.category??"Default",event_label:a.payload.label,value:a.payload.value,fastCampus_user_id:a.payload.fastCampus_user_id,course_id:a.payload.course_id,...a.payload});}catch{}});}};r(T,"isInitialized",false);var N=T,ye=N;var k,ve,D=class{constructor({pluginKey:t,isProd:e=false,isLocal:i=false}){v(this,k);r(this,"pluginKey");r(this,"iframeBridge");r(this,"events");r(this,"chatBody",null);r(this,"chatBodyMaker");r(this,"floatingButtonMaker");r(this,"shortcutKey",{openChat:{key:"/",modifier:""},sendChat:{key:"Enter",modifier:""}});r(this,"isProd");r(this,"isLocal");r(this,"isOpen");r(this,"isPdfOpen");this.pluginKey=t,this.iframeBridge=new B({hostClientUrl:window.location.origin,pluginKey:this.pluginKey}),this.events=new I(this.iframeBridge),this.floatingButtonMaker=new oe,this.chatBodyMaker=new W,this.isProd=e,this.isLocal=i,this.isOpen=false,this.isPdfOpen=false;}setIsOpen(t){this.isOpen=t;}setIsPdfOpen(t){this.isPdfOpen=t;}seekTimeline({clipId:t,clipPlayHead:e}){this.iframeBridge.postToTap({type:"timeline:seek",clipId:t,clipPlayHead:e});}async initChat({chatApiParams:t,customStyles:e,shortcutKey:i}){if(!g(this,k,ve).call(this))throw new Error("not client");this.shortcutKey={openChat:i?.openChat??this.shortcutKey.openChat,sendChat:i?.sendChat??this.shortcutKey.sendChat},this.chatBody||(this.chatBody=this.chatBodyMaker.createChatBody({...e?.chatBody&&{customChatBody:e.chatBody}})),this.iframeBridge.hasIframe()||await this.iframeBridge.renderIframe({chatBody:this.chatBody,isProd:this.isProd,isLocal:this.isLocal});try{let a=await this.iframeBridge.performHandshake({chatApiParams:t,customStyles:e},{retryInterval:500,maxRetries:10,timeout:1e4});new ye({gaId:a.gaId});}catch(a){throw console.error("Handshake failed:",a),new Error(`Chat initialization failed: ${a instanceof Error?a.message:"Unknown error"}`)}this.floatingButtonMaker.render({...e?.floatingButton&&{customFloatingButton:e.floatingButton}}),this.floatingButtonMaker.addClickEvent({callback:()=>{this.iframeBridge.postToTap({type:this.isOpen?"chat:close":"chat:open"});}}),this.floatingButtonMaker.addAlarmClickEvent({callback:a=>{this.iframeBridge.postToTap({type:"chat:open",isAlarm:true}),this.iframeBridge.postToTap({type:"alarm:click",messageInfo:a});}}),this.iframeBridge.listenToTap("chat:opened",()=>{this.setIsOpen(true),this.chatBodyMaker.toggleVisibility(this.isOpen),this.floatingButtonMaker.alarmRemove();}),this.iframeBridge.listenToTap("chat:closed",()=>{this.setIsOpen(false),this.chatBodyMaker.toggleVisibility(this.isOpen);}),this.iframeBridge.listenToTap("alarm:fadeIn",a=>{this.isOpen||this.floatingButtonMaker.alarmFadeIn(a.messageInfo);}),this.iframeBridge.listenToTap("popUp:open",a=>{ue({htmlString:a.popUpInfo.html,callback:()=>this.iframeBridge.postToTap({type:"popUp:close"}),...e?.chatBody&&{customStyles:e.chatBody}});}),this.iframeBridge.listenToTap("pdf:open",()=>{this.setIsPdfOpen(true),this.chatBodyMaker.resizeChatBody(this.isPdfOpen,e?.chatBody),this.iframeBridge.postToTap({type:"pdf:enlarged"});}),this.iframeBridge.listenToTap("pdf:close",()=>{this.setIsPdfOpen(false),this.chatBodyMaker.resizeChatBody(this.isPdfOpen,e?.chatBody),this.iframeBridge.postToTap({type:"pdf:shrinked"});}),this.isLocal&&this.iframeBridge.listenToTap("alarm:fadeIn",a=>{this.floatingButtonMaker.alarmFadeIn(a.messageInfo);});}removeChat(){if(!this.chatBody)throw new Error("chatBody is not initialized");this.chatBodyMaker.removeChatBody(),this.floatingButtonMaker.alarmRemove(),this.iframeBridge.removeIframe(),this.chatBody=null,this.isOpen=false;}postChatInfo({clipId:t,clipPlayHead:e}){this.seekTimeline({clipId:t,clipPlayHead:e});}getTimelineInfo({callback:t}){this.events.onTimelineSeek(t);}};k=new WeakSet,ve=function(){return typeof window<"u"&&typeof document<"u"};var It=D;module.exports=It;//# sourceMappingURL=index.js.map
24
24
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../chatBody/chatBody.css.ts","../chatBody/index.ts","../floatingButton/alarm/styles/alarm.css.ts","../floatingButton/alarm/index.ts","../floatingButton/index.ts","../services/common/messenger.ts","../services/iframe-handshake/index.ts","../services/tap-iframe-bridge/index.ts","../services/event-manager/index.ts","../popUpImage/popUpImage.css.ts","../popUpImage/index.ts","../ga/index.ts","../index.ts"],"names":["chatBody","hidden","visible","ChatBodyMaker","__publicField","customChatBody","show","handleAnimationEnd","isEnlarged","baseWidthPx","baseWidth","enlargedWidth","newWidth","chatBody_default","alarmContainer","alarmCorner","alarmCornerBase","alarmCornerContainer","circle","circleBase","circleText","closeIcon","text","textContainer","textContainerBase","wrapper","_Alarm_instances","renderCornerSvg_fn","renderTextAndCloseContainer_fn","renderTextContainer_fn","appendCloseButton_fn","renderCloseIconSvg_fn","Alarm","__privateAdd","rootElement","e","__privateMethod","textAndCloseContainer","messageInfo","callback","parentElement","svg","path","textInCircle","alarm_default","_isSameKeyboardKey","FloatingButtonMaker","event","targetKey","customFloatingButton","openChatShortcutKey","__privateGet","floatingButton_default","Messenger","messageType","listenerCallback","data","messageData","type","error","existingListeners","ls","l","message","target","HandshakeError","reason","details","originalError","IframeHandshake","getTargetWindow","getTargetOrigin","isValidOrigin","options","timeout","maxRetries","retryInterval","resolve","reject","retryCount","timeoutId","cleanup","handleAbort","validated","oe","ChatInitiatedSchema","attemptHandshake","targetWindow","TapIframeBridge","hostClientUrl","pluginKey","eventOrigin","iframeSrcOrigin","isProd","isLocal","config","handshake","chatInitMessage","CHAT_INIT","EventManager","iframeBridge","handler","copyButton","copyButtonText","defaultIcon","showPopupWithHtml","htmlString","customStyles","overlay","popup","computedRight","numericWidth","unit","numericRight","button","codeBlock","popUpImage_default","_InitGA","gaId","gtagScript","inlineScript","gaEvent","he","GAEventSchema","InitGA","ga_default","_TapSDK_instances","isClient_fn","TapSDK","isOpen","isPdfOpen","clipId","clipPlayHead","chatApiParams","shortcutKey","initiatedMessage","index_default"],"mappings":"y5BACO,IAAIA,CAAAA,CAAW,YACXC,CAAAA,CAAS,WAAA,CAEb,IAAIC,CAAAA,CAAU,WAAA,CCDrB,IAAMC,CAAAA,CAAN,KAAoB,CAGlB,aAAc,CAFdC,CAAAA,CAAA,IAAA,CAAQ,UAAA,CAA+B,IAAA,CAAA,CAGrC,IAAA,CAAK,SAAW,KAClB,CAEA,cAAA,CAAe,CAAE,cAAA,CAAAC,CAAe,EAAsC,CACpE,OAAI,KAAK,QAAA,CAAiB,IAAA,CAAK,UAE/B,IAAA,CAAK,QAAA,CAAW,QAAA,CAAS,a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W5zZm9ybTogdHJhbnNsYXRlWSgwKTsKICB9CiAgdG8gewogICAgb3BhY2l0eTogMDsKICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlWSgzMHB4KTsKICAgIGRpc3BsYXk6IG5vbmU7CiAgfQp9Ci5fMW1sdjRtZTIgewogIG9wYWNpdHk6IDA7CiAgdHJhbnNmb3JtOiB0cmFuc2xhdGVZKDMwcHgpOwogIHRyYW5zaXRpb246IG9wYWNpdHkgMC40cyBlYXNlLCB0cmFuc2Zvcm0gMC40cyBlYXNlOwogIHBvaW50ZXItZXZlbnRzOiBub25lOwogIGRpc3BsYXk6IG5vbmU7Cn0KLl8xbWx2NG1lMyB7CiAgYW5pbWF0aW9uOiBfMW1sdjRtZTAgMC40cyBlYXNlIGZvcndhcmRzOwogIHBvaW50ZXItZXZlbnRzOiBhdXRvOwp9Ci5fMW1sdjRtZTQgewogIGFuaW1hdGlvbjogXzFtbHY0bWUxIDAuNHMgZWFzZSBmb3J3YXJkczsKICBwb2ludGVyLWV2ZW50czogbm9uZTsKfQouXzFtbHY0bWU1IHsKICBib3JkZXI6IG5vbmUgIWltcG9ydGFudDsKfQ==';\nexport var chatBody = '_1mlv4me2';\nexport var hidden = '_1mlv4me4';\nexport var iframe = '_1mlv4me5';\nexport var visible = '_1mlv4me3';","import { ChatBodyType } from \"../types\";\nimport * as styles from \"./chatBody.css\";\n\nclass ChatBodyMaker {\n private chatBody: HTMLElement | null = null;\n\n constructor() {\n this.chatBody = null;\n }\n\n createChatBody({ customChatBody }: { customChatBody?: ChatBodyType }) {\n if (this.chatBody) return this.chatBody;\n\n this.chatBody = document.createElement(\"div\");\n this.chatBody.id = \"cw-chat-body\";\n this.chatBody.className = styles.chatBody;\n this.chatBody.style.setProperty(\"z-index\", \"10000001\", \"important\");\n this.chatBody.style.setProperty(\"position\", \"fixed\", \"important\");\n\n Object.assign(this.chatBody.style, {\n top: customChatBody?.position?.top ?? \"50px\",\n right: customChatBody?.position?.right ?? \"24px\",\n left: customChatBody?.position?.left ?? \"unset\",\n bottom: customChatBody?.position?.bottom ?? \"unset\",\n width: customChatBody?.width ?? \"340px\",\n height: customChatBody?.height ?? \"calc(100% - 116px)\",\n overflow: \"hidden\",\n backgroundColor: \"transparent\",\n borderRadius: customChatBody?.borderRadius ?? \"16px\",\n boxShadow: `\n rgba(255, 255, 255, 0.12) 0px 0px 2px 0px inset,\n rgba(0, 0, 0, 0.05) 0px 0px 2px 1px,\n rgba(0, 0, 0, 0.3) 0px 12px 60px\n `,\n willChange: \"transform, opacity, width, max-height, max-width\",\n });\n\n document.body.appendChild(this.chatBody);\n return this.chatBody;\n }\n\n toggleVisibility(show: boolean) {\n if (!this.chatBody) return;\n\n // 기존 클래스 제거\n this.chatBody.classList.remove(styles.visible, styles.hidden);\n\n // display 초기화\n this.chatBody.style.display = \"block\";\n\n // animationend 핸들러 정의\n const handleAnimationEnd = () => {\n if (!this.chatBody) return;\n\n // hidden 상태일 경우 display: none 설정\n if (this.chatBody.classList.contains(styles.hidden)) {\n this.chatBody.style.display = \"none\";\n }\n\n // 이벤트 리스너 제거 (한 번만 실행되도록)\n this.chatBody.removeEventListener(\"animationend\", handleAnimationEnd);\n };\n\n // 애니메이션 종료 시 display 제어\n this.chatBody.addEventListener(\"animationend\", handleAnimationEnd);\n\n // requestAnimationFrame을 통해 다음 프레임에서 클래스 적용\n requestAnimationFrame(() => {\n this.chatBody?.classList.add(show ? styles.visible : styles.hidden);\n });\n }\n\n removeChatBody() {\n if (this.chatBody) {\n this.chatBody.remove();\n this.chatBody = null;\n }\n }\n\n resizeChatBody(isEnlarged: boolean, customChatBody?: ChatBodyType) {\n if (!this.chatBody) return;\n\n const baseWidthPx = customChatBody?.width ?? \"340px\";\n const baseWidth = parseInt(baseWidthPx, 10);\n\n const enlargedWidth = (baseWidth / 3) * 10 - baseWidth;\n const newWidth = isEnlarged\n ? `${baseWidth + enlargedWidth}px`\n : `${baseWidth}px`;\n\n this.chatBody.style.width = newWidth;\n }\n}\n\nexport default ChatBodyMaker;\n","import 'floatingButton/alarm/styles/alarm.css.ts.vanilla.css?source=#H4sIAAAAAAAAE61Uy27bMBC8+ysWKAqkaBlI8iMxfWlzyK1A0X5AQYsrizFNCiQVyyny7wUpOtbDblK0J1s7u8vZmSU/b/FQGLZDCz8XD2m9nifwawKQvA8/ALpiuXAHCukqfFdaKIeG4CMqZymw2mmPPE8A5heqPJYmYzBpwefJdTw7DRnDI5RW6DP7dVzYSrIDhUJiswplVjihFQW2tlrWLhTtBXclhR1rSK6VQ+V81OmKQs5kfhV4fYR51XzwgBGb0sUTfGPChcG8bZtrWe+URx5q60RxOHakkKNn7CEmxUYR4XBnW2oEFQ/0GOdCbUg4OqsC5bw2Vht6nNiHnohQHBsKy+UyMDVMHeeKAkByPbWAzOKqo112VrujPUyJHWu7vPic3lootNkzw2230zR06qt9yZNO3zZ0ajMLbUY2jbTrirTWhqMhhnFRWwqPzFwR8j18xeCPr5/gNpp13tsNq6j3s8tlfp5L9IT6jpBmVQOL+OdVpj2fT/b/3QCeeRxiOkv6lBeB8prl243RteIk19Lvyrv0Jr1L77upN5dS778s7mZ33dTbkHrEi6IIO4aNI2Eg2l6AsP1aOVKwnZAHCt8MOlScGf4CWfGEFNJZq1UbcgeJfhHMjsmX6B7bOzVLwiZJoZCUMZYlbfm+FA6JrViOFCqDZG9YFQBtOFkbZFsKW8SKMBk660c0hdT7kEghZBCf3B12+YrrSdVANm0ZjO+tdcycFiod2MNC72heOli3dU/lsWF5Dx+7xFt8/Dq89eE5hSPDo9BD4Qf7miYx/qdniEkJyXU2foI4Lb0vXWUWUV6JhaNAbrK+ULNY0R984NgpHfvw8RF60yUp/qF20/Ur7Oq5sfvZg5NO6eVrV/Bk3hvvYPZf7uBFwsP5yv58a6nz7Wry/Bv1tBtfSwgAAA==';\nexport var alarmContainer = '_6j1ub51';\nexport var alarmCorner = {'default':'_6j1ub5b _6j1ub5a','call-to-action':'_6j1ub5c _6j1ub5a'};\nexport var alarmCornerBase = '_6j1ub5a';\nexport var alarmCornerContainer = '_6j1ub59';\nexport var circle = {'default':'_6j1ub5e _6j1ub5d','call-to-action':'_6j1ub5f _6j1ub5d'};\nexport var circleBase = '_6j1ub5d';\nexport var circleText = '_6j1ub5h';\nexport var closeIcon = '_6j1ub5g';\nexport var hidden = '_6j1ub53';\nexport var text = '_6j1ub58';\nexport var textContainer = {'default':'_6j1ub56 _6j1ub55','call-to-action':'_6j1ub57 _6j1ub55'};\nexport var textContainerBase = '_6j1ub55';\nexport var visible = '_6j1ub52';\nexport var wrapper = '_6j1ub54';","import * as styles from \"./styles/alarm.css\";\n\nimport { AlarmMessageInstanceType } from \"../../types\";\n\nclass Alarm {\n // 전체 fade in & out\n private container!: HTMLDivElement;\n private alarmTimeout!: ReturnType<typeof setTimeout>;\n\n // 색상\n private alarmCornerSVG!: HTMLImageElement | SVGElement;\n private textContainer!: HTMLDivElement;\n private circleElement!: HTMLDivElement;\n\n // 텍스트 내용\n private textInTextContainer!: HTMLSpanElement;\n private messageInfo!: AlarmMessageInstanceType;\n\n constructor() {}\n\n render({ rootElement }: { rootElement: HTMLElement }) {\n this.container = document.createElement(\"div\");\n this.container.id = \"alarm-container\";\n this.container.className = styles.alarmContainer;\n this.container.addEventListener(\"click\", (e) => {\n e.stopPropagation();\n });\n rootElement.appendChild(this.container);\n\n // 코너 아이콘 렌더링\n this.#renderCornerSvg(this.container);\n\n // 텍스트 컨테이너 렌더링\n const textAndCloseContainer = this.#renderTextAndCloseContainer(\n this.container,\n );\n\n // 닫기 버튼 렌더링\n this.#appendCloseButton(textAndCloseContainer);\n\n // 텍스트 컨테이너 렌더링\n this.#renderTextContainer(textAndCloseContainer);\n }\n\n fadeIn(messageInfo: AlarmMessageInstanceType) {\n // 타입에 따라 적절한 클래스 설정\n if (messageInfo.type === \"default\" || messageInfo.type === \"hourSpent\") {\n this.textContainer.className = styles.textContainer.default;\n this.alarmCornerSVG.setAttribute(\"class\", styles.alarmCorner.default);\n this.circleElement.className = styles.circle.default;\n } else {\n this.textContainer.className = styles.textContainer[\"call-to-action\"];\n this.alarmCornerSVG.setAttribute(\n \"class\",\n styles.alarmCorner[\"call-to-action\"],\n );\n this.circleElement.className = styles.circle[\"call-to-action\"];\n } // 스타일 제거 및 적용\n this.messageInfo = messageInfo;\n\n this.textInTextContainer.textContent = messageInfo.message;\n\n this.toggleVisibility(true);\n\n this.alarmTimeout = setTimeout(() => {\n this.toggleVisibility(false);\n }, 18 * 1000);\n }\n\n addClickEvent({\n callback,\n }: {\n callback: (messageInfo: AlarmMessageInstanceType) => void;\n }) {\n this.container.addEventListener(\"click\", () => {\n this.toggleVisibility(false);\n callback(this.messageInfo);\n });\n }\n\n toggleVisibility(show: boolean) {\n this.container.classList.remove(styles.visible, styles.hidden);\n\n requestAnimationFrame(() => {\n this.container?.classList.add(show ? styles.visible : styles.hidden);\n });\n }\n\n remove() {\n if (this.container) {\n this.toggleVisibility(false);\n }\n if (this.alarmTimeout) {\n clearTimeout(this.alarmTimeout);\n }\n }\n\n #renderCornerSvg(parentElement: HTMLElement) {\n const alarmCornerContainer = document.createElement(\"div\");\n alarmCornerContainer.className = styles.alarmCornerContainer;\n parentElement.appendChild(alarmCornerContainer);\n\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n svg.setAttribute(\"width\", \"11\");\n svg.setAttribute(\"height\", \"8\");\n svg.setAttribute(\"viewBox\", \"0 0 11 8\");\n svg.setAttribute(\"fill\", \"currentColor\");\n svg.setAttribute(\"class\", styles.alarmCornerBase);\n const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\n path.setAttribute(\"d\", \"M5.5 0L11.1292 8.25H-0.129165L5.5 0Z\");\n path.setAttribute(\"fill\", \"currentColor\");\n svg.appendChild(path);\n\n this.alarmCornerSVG = svg;\n\n alarmCornerContainer.appendChild(svg);\n }\n\n #renderTextAndCloseContainer(parentElement: HTMLElement) {\n const textAndCloseContainer = document.createElement(\"div\");\n textAndCloseContainer.className = styles.wrapper;\n parentElement.appendChild(textAndCloseContainer);\n\n return textAndCloseContainer;\n }\n\n #renderTextContainer(parentElement: HTMLDivElement) {\n this.textContainer = document.createElement(\"div\");\n this.textContainer.className = styles.textContainerBase;\n parentElement.appendChild(this.textContainer);\n\n this.textInTextContainer = document.createElement(\"span\");\n this.textInTextContainer.className = styles.text;\n this.textContainer.appendChild(this.textInTextContainer);\n }\n\n #appendCloseButton(parentElement: HTMLDivElement) {\n const circle = document.createElement(\"div\");\n circle.className = styles.circleBase;\n parentElement.appendChild(circle);\n\n circle.addEventListener(\"click\", (e) => {\n e.stopPropagation();\n this.remove();\n });\n\n const textInCircle = document.createElement(\"span\");\n textInCircle.className = styles.circleText;\n circle.appendChild(textInCircle);\n textInCircle.textContent = \"알림 끄기\";\n\n this.#renderCloseIconSvg(circle);\n\n this.circleElement = circle;\n }\n\n #renderCloseIconSvg(parentElement: HTMLDivElement) {\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n svg.setAttribute(\"width\", \"10\");\n svg.setAttribute(\"height\", \"10\");\n svg.setAttribute(\"viewBox\", \"0 0 14 14\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"class\", styles.closeIcon);\n\n const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\n path.setAttribute(\"d\", \"M1 1L13 13M13 1L1 13\");\n path.setAttribute(\"stroke\", \"currentColor\");\n path.setAttribute(\"stroke-width\", \"2\");\n path.setAttribute(\"stroke-linecap\", \"round\");\n svg.appendChild(path);\n\n parentElement.appendChild(svg);\n }\n}\n\nexport default Alarm;\n","import Alarm from \"./alarm\";\n\nimport {\n AlarmMessageInstanceType,\n FloatingButtonType,\n ShortcutKeyPropertiesType,\n} from \"../types\";\n\nclass FloatingButtonMaker {\n private customFloatingButton: FloatingButtonType | undefined;\n private floatingButton!: HTMLElement;\n private alarm: Alarm;\n\n constructor() {\n this.alarm = new Alarm();\n }\n\n render({\n customFloatingButton,\n }: {\n customFloatingButton?: FloatingButtonType;\n }) {\n this.customFloatingButton = customFloatingButton;\n\n if (\n this.customFloatingButton?.isInElement &&\n this.customFloatingButton?.parentElementId\n ) {\n const parentElement = document.getElementById(\n this.customFloatingButton.parentElementId,\n );\n parentElement?.style.setProperty(\"position\", \"relative\", \"important\");\n parentElement?.style.setProperty(\"z-index\", \"10000001\", \"important\");\n\n this.floatingButton = parentElement as HTMLElement; // 부모 엘리먼트 저장\n } else {\n let rootElement = document.getElementById(\"cw-plugin\");\n\n if (!rootElement) {\n rootElement = document.createElement(\"button\");\n rootElement.id = \"cw-plugin\";\n\n rootElement.style.zIndex = \"10000001\";\n rootElement.style.setProperty(\"z-index\", \"10000001\", \"important\");\n rootElement.style.setProperty(\"position\", \"fixed\", \"important\");\n rootElement.style.width = \"50px\";\n rootElement.style.height = \"50px\";\n rootElement.style.borderRadius = \"50%\";\n rootElement.style.backgroundColor = \"#000\";\n\n document.body.appendChild(rootElement);\n\n this.floatingButton = rootElement; // 루트 엘리먼트 저장\n }\n }\n\n this.alarm.render({ rootElement: this.floatingButton });\n return this.floatingButton;\n }\n\n addClickEvent({ callback }: { callback: () => void }) {\n if (!this.floatingButton) throw new Error(\"not initialized\");\n\n this.floatingButton.addEventListener(\"click\", () => {\n callback();\n });\n }\n\n addAlarmClickEvent({\n callback,\n }: {\n callback: (messageInfo: AlarmMessageInstanceType) => void;\n }) {\n this.alarm.addClickEvent({ callback });\n }\n\n addShortCutEvent({\n openChatShortcutKey,\n callback,\n }: {\n openChatShortcutKey: ShortcutKeyPropertiesType;\n callback: () => void;\n }) {\n if (!this.floatingButton) throw new Error(\"not initialized\");\n\n window.addEventListener(\"keydown\", (event) => {\n if (\n this.#isSameKeyboardKey(event, openChatShortcutKey.key) &&\n (openChatShortcutKey.modifier\n ? event[openChatShortcutKey.modifier]\n : true)\n ) {\n callback();\n }\n });\n }\n\n alarmFadeIn(messageInfo: AlarmMessageInstanceType) {\n this.alarm.fadeIn(messageInfo);\n }\n\n alarmRemove() {\n this.alarm.remove();\n }\n\n #isSameKeyboardKey = (event: KeyboardEvent, targetKey: string): boolean => {\n if (event.key === targetKey) {\n return true;\n }\n\n if (!event.code.startsWith(\"Key\")) {\n return false;\n }\n\n const physicalKey = event.code.slice(3).toLowerCase();\n\n return physicalKey === targetKey;\n };\n}\n\nexport default FloatingButtonMaker;\n","// 통합 메시지 송수신 관리 기본 클래스\ntype Unsubscribe = () => void;\n\ntype Message = {\n type: string;\n [key: string]: any;\n};\n\nexport abstract class Messenger<\n TToTargetMessages extends Message = Message,\n TFromTargetMessage extends Message = Message,\n> {\n protected listeners: Map<\n TFromTargetMessage[\"type\"],\n ((event: MessageEvent) => void)[]\n > = new Map();\n protected unifiedMessageHandler: ((event: MessageEvent) => void) | null =\n null;\n\n // 통합 리스너 등록/해지 API\n protected on<T extends TFromTargetMessage[\"type\"]>(\n messageType: T,\n callback: (data: Extract<TFromTargetMessage, { type: T }>) => void\n ): Unsubscribe {\n const listenerCallback = (event: MessageEvent) => {\n if (!this.isValidOrigin(event)) return;\n\n try {\n const data = event.data;\n\n // Handle both direct objects and JSON strings for backward compatibility\n const messageData = typeof data === 'string' ? JSON.parse(data) : data;\n const { type } = messageData;\n\n if (type === messageType) {\n callback(messageData);\n }\n } catch (error) {\n console.warn(\"Messenger: Failed to parse message data\", error);\n }\n };\n\n // 해당 메시지 타입의 리스너 배열 가져오거나 생성\n const existingListeners = this.listeners.get(messageType) || [];\n existingListeners.push(listenerCallback);\n this.listeners.set(messageType, existingListeners);\n\n // 통합 메시지 핸들러가 없으면 등록\n if (!this.unifiedMessageHandler) {\n this.unifiedMessageHandler = (event: MessageEvent) => {\n this.listeners.forEach((ls) => ls.forEach((l) => l(event)));\n };\n window.addEventListener(\"message\", this.unifiedMessageHandler);\n }\n\n return () => {\n if (this.unifiedMessageHandler) {\n window.removeEventListener(\"message\", this.unifiedMessageHandler);\n this.unifiedMessageHandler = null;\n }\n };\n }\n\n public removeListener(messageType: TFromTargetMessage[\"type\"]): void {\n this.listeners.delete(messageType);\n }\n\n public removeAllListeners(): void {\n this.listeners.clear();\n\n if (this.unifiedMessageHandler) {\n window.removeEventListener(\"message\", this.unifiedMessageHandler);\n this.unifiedMessageHandler = null;\n }\n }\n\n // 통합 메시지 전송 API\n public postMessage(message: TToTargetMessages): boolean {\n try {\n const target = this.getMessageTarget();\n if (!target) {\n console.warn(\"Messenger: Message target not available\");\n return false;\n }\n\n target.postMessage(message, this.getTargetOrigin());\n return true;\n } catch (error) {\n console.error(\"Messenger: postMessage failed\", error);\n return false;\n }\n }\n\n // 하위 클래스에서 구현해야 하는 추상 메서드들\n protected abstract isValidOrigin(event: MessageEvent): boolean;\n protected abstract getMessageTarget(): Window | null;\n protected abstract getTargetOrigin(): string;\n}\n","import * as v from \"valibot\";\nimport type {\n ChatInitiatedMessage,\n} from \"@coxwave/tap-messages\";\nimport { ChatInitiatedSchema } from \"@coxwave/tap-messages\";\n\nexport interface HandshakeOptions {\n timeout?: number;\n maxRetries?: number;\n retryInterval?: number;\n}\n\nexport enum HandshakeFailureReason {\n TIMEOUT = \"TIMEOUT\",\n MAX_RETRIES_EXCEEDED = \"MAX_RETRIES_EXCEEDED\",\n INVALID_MESSAGE = \"INVALID_MESSAGE\",\n NO_TARGET_WINDOW = \"NO_TARGET_WINDOW\",\n MESSAGE_SEND_FAILED = \"MESSAGE_SEND_FAILED\",\n}\n\nexport class HandshakeError extends Error {\n constructor(\n public reason: HandshakeFailureReason,\n public details?: string,\n public originalError?: Error\n ) {\n super(`Handshake failed: ${reason}${details ? ` - ${details}` : \"\"}`);\n this.name = \"HandshakeError\";\n }\n}\n\nexport class IframeHandshake {\n private abortController: AbortController | null = null;\n private messageListener: ((event: MessageEvent) => void) | null = null;\n\n constructor(\n private getTargetWindow: () => Window | null,\n private getTargetOrigin: () => string,\n private isValidOrigin: (event: MessageEvent) => boolean\n ) {}\n\n async execute(\n message: any,\n options: HandshakeOptions = {}\n ): Promise<ChatInitiatedMessage> {\n const { timeout = 10000, maxRetries = 10, retryInterval = 500 } = options;\n\n // Cancel any existing handshake\n this.cancel();\n\n this.abortController = new AbortController();\n\n return new Promise((resolve, reject) => {\n let retryCount = 0;\n let timeoutId: ReturnType<typeof setTimeout>;\n\n const cleanup = () => {\n if (timeoutId) clearTimeout(timeoutId);\n if (this.messageListener) {\n window.removeEventListener(\"message\", this.messageListener);\n this.messageListener = null;\n }\n };\n\n const handleAbort = () => {\n cleanup();\n reject(\n new HandshakeError(\n HandshakeFailureReason.TIMEOUT,\n \"Handshake was cancelled\"\n )\n );\n };\n\n // Set up abort handling\n this.abortController?.signal.addEventListener(\"abort\", handleAbort);\n\n // Set up message listener\n this.messageListener = (event: MessageEvent) => {\n if (!this.isValidOrigin(event)) return;\n\n try {\n const data = event.data;\n\n // Handle both direct objects and JSON strings for backward compatibility\n const messageData =\n typeof data === \"string\" ? JSON.parse(data) : data;\n\n // Validate the message\n try {\n const validated = v.safeParse(ChatInitiatedSchema, messageData);\n cleanup();\n this.abortController = null;\n resolve(validated.output as ChatInitiatedMessage);\n return;\n } catch (validationError) {\n // Invalid message - continue waiting\n }\n } catch (error) {\n // Invalid JSON or parsing error - continue waiting\n console.warn(\"Failed to parse handshake message:\", error);\n }\n };\n\n window.addEventListener(\"message\", this.messageListener);\n\n // Set overall timeout\n timeoutId = setTimeout(() => {\n cleanup();\n this.abortController = null;\n reject(\n new HandshakeError(\n HandshakeFailureReason.TIMEOUT,\n `No valid response received within ${timeout}ms`\n )\n );\n }, timeout);\n\n // Retry mechanism\n const attemptHandshake = () => {\n if (this.abortController?.signal.aborted) return;\n\n try {\n const targetWindow = this.getTargetWindow();\n\n if (!targetWindow) {\n throw new HandshakeError(\n HandshakeFailureReason.NO_TARGET_WINDOW,\n \"Target iframe window is not available\"\n );\n }\n\n targetWindow.postMessage(message, this.getTargetOrigin());\n\n retryCount++;\n\n // Schedule next retry if not at max\n if (retryCount < maxRetries) {\n setTimeout(() => {\n if (!this.abortController?.signal.aborted) {\n attemptHandshake();\n }\n }, retryInterval);\n } else {\n // Max retries exceeded, but don't reject immediately\n // Let the timeout handle the final rejection\n }\n } catch (error) {\n cleanup();\n this.abortController = null;\n\n if (error instanceof HandshakeError) {\n reject(error);\n } else {\n reject(\n new HandshakeError(\n HandshakeFailureReason.MESSAGE_SEND_FAILED,\n \"Failed to send handshake message\",\n error as Error\n )\n );\n }\n }\n };\n\n // Start the handshake process\n attemptHandshake();\n });\n }\n\n cancel(): void {\n if (this.abortController) {\n this.abortController.abort();\n this.abortController = null;\n }\n\n if (this.messageListener) {\n window.removeEventListener(\"message\", this.messageListener);\n this.messageListener = null;\n }\n }\n\n isActive(): boolean {\n return (\n this.abortController !== null && !this.abortController.signal.aborted\n );\n }\n}\n","import {\n ChatInitMessage,\n ChatOpenMessage,\n ChatCloseMessage,\n TimelineSeekMessage,\n AlarmClickMessage,\n PopUpCloseMessage,\n PdfEnlargedMessage,\n PdfShrinkedMessage,\n ChatInitiatedMessage,\n ChatOpenedMessage,\n ChatClosedMessage,\n AlarmFadeInMessage,\n PopUpOpenMessage,\n PdfOpenMessage,\n PdfCloseMessage,\n CHAT_INIT,\n} from \"@coxwave/tap-messages\";\nimport { Messenger } from \"../common/messenger\";\nimport { IframeHandshake, type HandshakeOptions } from \"../iframe-handshake\";\n\nexport type ToTapMessage =\n | ChatInitMessage\n | ChatOpenMessage\n | ChatCloseMessage\n | TimelineSeekMessage\n | AlarmClickMessage\n | PopUpCloseMessage\n | PdfEnlargedMessage\n | PdfShrinkedMessage;\n\nexport type FromTapMessage =\n | ChatInitiatedMessage\n | ChatOpenedMessage\n | ChatClosedMessage\n | AlarmFadeInMessage\n | PopUpOpenMessage\n | PdfOpenMessage\n | PdfCloseMessage\n | TimelineSeekMessage;\n\nexport interface ChatInitConfig {\n chatApiParams: any;\n customStyles?: any;\n gaId?: string;\n}\n\nexport class TapIframeBridge extends Messenger<ToTapMessage, FromTapMessage> {\n protected hostClientUrl: string;\n protected pluginKey: string;\n protected iframe!: HTMLIFrameElement | null;\n\n constructor({\n hostClientUrl,\n pluginKey,\n }: {\n hostClientUrl: string;\n pluginKey: string;\n }) {\n super();\n this.hostClientUrl = hostClientUrl;\n this.pluginKey = pluginKey;\n }\n\n // Messenger 추상 메서드 구현\n protected isValidOrigin(event: MessageEvent): boolean {\n if (!this.iframe) return false;\n\n const eventOrigin = event.origin;\n const iframeSrcOrigin = new URL(this.iframe.src).origin;\n\n // 정확한 매칭\n if (eventOrigin === iframeSrcOrigin) return true;\n\n // Vercel 도메인 패턴 매칭 (preview 배포 등)\n if (\n eventOrigin.includes(\"vercel.app\") &&\n iframeSrcOrigin.includes(\"vercel.app\")\n ) {\n return true;\n }\n\n // localhost 개발 환경\n if (\n eventOrigin.includes(\"localhost\") &&\n iframeSrcOrigin.includes(\"localhost\")\n ) {\n return true;\n }\n\n return false;\n }\n\n protected getMessageTarget(): Window | null {\n return this.iframe?.contentWindow || null;\n }\n\n protected getTargetOrigin(): string {\n if (!this.iframe?.src) return \"*\";\n\n try {\n return new URL(this.iframe.src).origin;\n } catch {\n // URL 파싱 실패 시 모든 origin 허용 (유연성 확보)\n return \"*\";\n }\n }\n\n renderIframe({\n chatBody,\n isProd,\n isLocal,\n }: {\n chatBody: HTMLElement;\n isProd: boolean;\n isLocal?: boolean;\n }) {\n return new Promise<HTMLIFrameElement>((resolve) => {\n this.iframe = document.createElement(\"iframe\");\n this.iframe.style.setProperty(\"display\", \"flex\", \"important\");\n this.iframe.style.setProperty(\"border\", \"none\", \"important\");\n\n if (isLocal) {\n this.iframe.src = `${this.hostClientUrl}/chat`;\n } else {\n this.iframe.src = isProd\n ? \"https://ax-tap-fe-staging.vercel.app/chat\"\n : \"https://ax-tap-fe-staging.vercel.app/chat\";\n }\n\n this.iframe.style.width = \"100%\";\n this.iframe.style.height = \"100%\";\n\n this.iframe.onload = () => resolve(this.iframe as HTMLIFrameElement);\n\n chatBody.appendChild(this.iframe);\n });\n }\n\n hasIframe() {\n if (!this.iframe) {\n return false;\n }\n return true;\n }\n\n removeIframe() {\n this.iframe?.remove(); // DOM에서 제거\n this.iframe = null; // 참조 초기화\n this.removeAllListeners(); // 모든 리스너 정리\n }\n\n get postToTap() {\n if (!this.iframe) {\n console.warn(\"TapIframeBridge: iframe not found\");\n }\n return super.postMessage;\n }\n\n listenToTap = super.on;\n\n async performHandshake(\n config: ChatInitConfig,\n options?: HandshakeOptions\n ): Promise<ChatInitiatedMessage> {\n if (!this.iframe) {\n throw new Error(\"TapIframeBridge: iframe not available for handshake\");\n }\n\n const handshake = new IframeHandshake(\n () => this.getMessageTarget(),\n () => this.getTargetOrigin(),\n (event) => this.isValidOrigin(event)\n );\n\n // Construct the ChatInitMessage\n const chatInitMessage: ChatInitMessage = {\n type: CHAT_INIT,\n hostClientUrl: this.hostClientUrl,\n pluginKey: this.pluginKey,\n chatApiParams: config.chatApiParams,\n theme: config.customStyles,\n };\n\n try {\n return await handshake.execute(chatInitMessage, options);\n } catch (error) {\n // Re-throw with additional context\n if (error instanceof Error) {\n throw new Error(`TapIframeBridge handshake failed: ${error.message}`);\n }\n throw error;\n }\n }\n}\n","import type { TapIframeBridge } from \"../tap-iframe-bridge\";\nimport type { AlarmMessageInstanceType } from \"../../types\";\nimport { PopUpOpenMessage } from \"@coxwave/tap-messages\";\n\nexport class EventManager {\n constructor(private iframeBridge: TapIframeBridge) {}\n\n onTimelineSeek(handler: (clipPlayHead: number, clipId: string) => void) {\n this.iframeBridge.listenToTap(\"timeline:seek\", (data) =>\n handler(data.clipPlayHead, data.clipId)\n );\n }\n\n onChatOpened(handler: () => void) {\n this.iframeBridge.listenToTap(\"chat:opened\", handler);\n }\n\n onChatClosed(handler: () => void) {\n this.iframeBridge.listenToTap(\"chat:closed\", handler);\n }\n\n onChatInitiated(handler: () => void) {\n this.iframeBridge.listenToTap(\"chat:initiated\", handler);\n }\n\n onAlarmFadeIn(handler: (messageInfo: AlarmMessageInstanceType) => void) {\n this.iframeBridge.listenToTap(\"alarm:fadeIn\", (data) => {\n handler(data.messageInfo);\n });\n }\n\n onPopUpOpen(handler: (popUpInfo: PopUpOpenMessage[\"popUpInfo\"]) => void) {\n this.iframeBridge.listenToTap(\"popUp:open\", (data) => {\n handler(data.popUpInfo);\n });\n }\n\n onPdfOpen(handler: () => void) {\n this.iframeBridge.listenToTap(\"pdf:open\", handler);\n }\n\n onPdfClose(handler: () => void) {\n this.iframeBridge.listenToTap(\"pdf:close\", handler);\n }\n}\n","import 'popUpImage/popUpImage.css.ts.vanilla.css?source=#H4sIAAAAAAAAE7VU7Y7bIBD8n6dYqap0lUKEXSd1uZfoK2B77dBgQIDPzlX37hX4o07qXq9qK0tY7AIzOztw6Lu0aU8Uvu0AelH5M4OE0vePO4BWKDKFWj6QUiuPyoeM54VEIvlVd54B77wO0ULbCi0ptZTcOGTg0HDLPa6SzvBSqIYB/RFkQA+ZGcBpKSqwTcEfkiTfwzik+R7oIUk/rE6xvBKdY5CbIUT1E9pa6n5FhZeXxupOVYGOtgze1XUdMmVnXZgbLZRH+7h72R1GDZKowR9TMryqYkUJHdlsYafhi8rh4AmXolEMJNZRzVorT2reCnll8MWiR1VxW0W20wH0c/iWxU48I4MkHQFjqEfRnD2DI43K9mfhMaqNDJS2LZdrpUhvuWFQWOQX0usRLPxJDN1mFoXSf6TQL6raluB3BWdTwaNRa+HXRg2+nTIZndD/izQfozRGO+GFVgwsSu7FE24bwjbFQ3qke5iHV8y9qHdndnKd7b6QyCKJSjgj+ZVBLTHuiHYjwmPrGJQ42h7ga+e8qK+zXAyiJKRA3yOqFTQptPe6ZZAFBgvaMaLNvcz48XjKbwinZoDTqmO3TbyrNhujz0SoCofglVd9sbA4RRZ323665G9XZfvB+8sqg88Uvq2gT+NTfGvS4MnVmny70fP7PWGfpxsyz1tuG6Fuu7lVWjiOuLMV6hLf6ZfvG7kHlyUGAAA=';\nexport var codeBlockContainer = 'wu2gm63';\nexport var copyButton = 'wu2gm66';\nexport var copyButtonText = 'wu2gm67';\nexport var defaultIcon = 'wu2gm68';\nexport var languageBadge = 'wu2gm65';\nexport var pluginHeader = 'wu2gm64';\nexport var pluginTable = 'wu2gm60';\nexport var pluginTd = 'wu2gm62';\nexport var pluginTh = 'wu2gm61';","import { ChatBodyType } from \"../types\";\nimport * as styles from \"./popUpImage.css\";\n\nfunction showPopupWithHtml({\n htmlString,\n callback,\n customStyles,\n}: {\n htmlString: string;\n callback: () => void;\n customStyles?: ChatBodyType;\n}) {\n // 🔹 스타일 태그 생성 및 삽입\n // const styleElement = document.createElement(\"style\");\n // styleElement.setAttribute(\"data-popup-style\", \"true\"); // 식별자\n // styleElement.innerHTML = styles;\n // document.head.appendChild(styleElement);\n\n // 백드롭 레이어\n const overlay = document.createElement(\"div\");\n overlay.style.position = \"fixed\";\n overlay.style.top = \"0\";\n overlay.style.left = \"0\";\n overlay.style.width = \"100vw\";\n overlay.style.height = \"100vh\";\n overlay.style.background = \"rgba(0, 0, 0, 0.4)\";\n overlay.style.zIndex = \"10000002\";\n\n // 팝업 컨테이너\n const popup = document.createElement(\"div\");\n popup.style.position = \"fixed\";\n popup.style.display = \"flex\";\n popup.style.flexDirection = \"column\";\n\n // ✅ right 계산\n const basePadding = 15;\n let computedRight = basePadding;\n\n // 너비 합\n if (customStyles?.width) {\n const numericWidth = parseFloat(customStyles.width); // 단위 제거 (390 from \"390px\", 80 from \"80%\")\n const unit = customStyles.width.match(/[a-zA-Z%]+/)?.[0]; // px, %, rem 등 추출\n\n if (!isNaN(numericWidth) && unit === \"px\") {\n computedRight += numericWidth;\n }\n } else {\n computedRight += 340;\n }\n\n // 오름쪽 포지션 합\n if (customStyles?.position?.right) {\n const numericRight = parseFloat(customStyles?.position?.right); // 단위 제거 (390 from \"390px\", 80 from \"80%\")\n const unit = customStyles?.position?.right.match(/[a-zA-Z%]+/)?.[0]; // px, %, rem 등 추출\n\n if (!isNaN(numericRight) && unit === \"px\") {\n computedRight += numericRight;\n }\n } else {\n computedRight = computedRight + 24;\n }\n\n popup.style.top = customStyles?.position?.top ?? \"50px\";\n popup.style.right = `${computedRight}px`;\n popup.style.left = customStyles?.position?.left ?? \"unset\";\n popup.style.bottom = customStyles?.position?.bottom ?? \"unset\";\n\n popup.style.maxWidth = \"calc(100vw - 100px)\";\n popup.style.maxHeight = customStyles?.height ?? \"calc(100vh - 116px)\";\n popup.style.overflow = \"auto\";\n popup.style.background = \"#fff\";\n popup.style.padding = \"20px\";\n popup.style.border = \"1px solid #ccc\";\n popup.style.boxShadow = \"0 4px 20px rgba(0,0,0,0.2)\";\n popup.style.zIndex = \"10000003\";\n popup.style.borderRadius = \"8px\";\n\n // 팝업 내용\n const wrapper = document.createElement(\"div\");\n wrapper.innerHTML = htmlString;\n\n // 백드롭 클릭 시 닫기\n overlay.addEventListener(\"click\", () => {\n document.body.removeChild(overlay);\n document.body.removeChild(popup);\n // document.head.removeChild(styleElement);\n callback();\n });\n\n // 팝업 내부 클릭 시 이벤트 전파 막기\n popup.addEventListener(\"click\", (e) => {\n e.stopPropagation();\n });\n\n // 조립 및 삽입\n popup.appendChild(wrapper);\n document.body.appendChild(overlay);\n document.body.appendChild(popup);\n\n // 복사 버튼 (만약 있을 시)\n const button = document.querySelector(`.${styles.copyButton}`);\n const codeBlock = document.querySelector(\".cw-plugin-code-block\");\n const defaultIcon = document.querySelector(`.${styles.defaultIcon}`);\n const copyButtonText = document.querySelector(`.${styles.copyButtonText}`);\n\n if (button && codeBlock && defaultIcon && copyButtonText) {\n button.addEventListener(\"click\", () => {\n navigator.clipboard.writeText(codeBlock.textContent ?? \"\");\n\n // 아이콘 숨기기\n (defaultIcon as HTMLElement).style.display = \"none\";\n\n // 텍스트 변경\n copyButtonText.textContent = \"복사됨\";\n\n setTimeout(() => {\n // 텍스트 원복\n copyButtonText.textContent = \"복사\";\n (defaultIcon as HTMLElement).style.display = \"inline\";\n }, 1000);\n });\n }\n}\n\nexport default showPopupWithHtml;\n","import * as v from \"valibot\";\nimport { GAEventSchema } from \"@coxwave/tap-messages\";\n\nclass InitGA {\n static isInitialized = false;\n\n constructor({ gaId }: { gaId: string }) {\n if (!InitGA.isInitialized) {\n this.init(gaId);\n InitGA.isInitialized = true;\n }\n }\n\n init(gaId: string) {\n if (\n !document.querySelector(\n `script[src=\"https://www.googletagmanager.com/gtag/js?id=${gaId}\"]`\n )\n ) {\n const gtagScript = document.createElement(\"script\");\n gtagScript.async = true;\n gtagScript.src = `https://www.googletagmanager.com/gtag/js?id=${gaId}`;\n document.head.appendChild(gtagScript);\n }\n\n if (typeof window.gtag !== \"function\") {\n const inlineScript = document.createElement(\"script\");\n inlineScript.innerHTML = `\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n gtag('config', '${gaId}');\n `;\n document.head.appendChild(inlineScript);\n }\n\n // TODO(domuk-k): GA 원천,형식 파악 후 개선\n window.addEventListener(\"message\", (event) => {\n try {\n const data =\n typeof event.data === \"string\" ? JSON.parse(event.data) : event.data;\n\n // Validate GA event message\n const gaEvent = v.parse(GAEventSchema, data);\n\n if (typeof window.gtag === \"function\") {\n window.gtag(\"event\", gaEvent.payload.action ?? \"click\", {\n event_category: gaEvent.payload.category ?? \"Default\",\n event_label: gaEvent.payload.label,\n value: gaEvent.payload.value,\n fastCampus_user_id: gaEvent.payload.fastCampus_user_id,\n course_id: gaEvent.payload.course_id,\n ...gaEvent.payload,\n });\n }\n } catch (error) {\n // Invalid message or JSON parsing error - ignore silently\n }\n });\n }\n}\n\nexport default InitGA;\n","import ChatBodyMaker from \"./chatBody\";\nimport FloatingButtonMaker from \"./floatingButton\";\nimport { TapIframeBridge } from \"./services/tap-iframe-bridge\";\nimport { EventManager } from \"./services/event-manager\";\nimport showPopupWithHtml from \"./popUpImage\";\n\nimport InitGA from \"./ga\";\n\nimport {\n AlarmMessageInstanceType,\n ChatApiParamsType,\n TapSDKType,\n CustomStylesType,\n ShortcutKeyType,\n SeekTimelineParamsType,\n} from \"./types\";\n\nclass TapSDK {\n private pluginKey: string;\n private iframeBridge: TapIframeBridge;\n public events: EventManager;\n\n private chatBody: HTMLElement | null = null;\n private chatBodyMaker: ChatBodyMaker;\n private floatingButtonMaker: FloatingButtonMaker;\n private shortcutKey: ShortcutKeyType = {\n openChat: { key: \"/\", modifier: \"\" },\n sendChat: { key: \"Enter\", modifier: \"\" },\n };\n\n private isProd: boolean;\n private isLocal: boolean;\n\n private isOpen: boolean;\n private isPdfOpen: boolean;\n\n constructor({ pluginKey, isProd = false, isLocal = false }: TapSDKType) {\n // protocol\n this.pluginKey = pluginKey;\n this.iframeBridge = new TapIframeBridge({\n hostClientUrl: window.location.origin,\n pluginKey: this.pluginKey,\n });\n\n // events\n this.events = new EventManager(this.iframeBridge);\n\n // render\n this.floatingButtonMaker = new FloatingButtonMaker();\n this.chatBodyMaker = new ChatBodyMaker();\n\n // ga log\n this.isProd = isProd;\n this.isLocal = isLocal;\n\n // state\n this.isOpen = false;\n this.isPdfOpen = false;\n }\n\n #isClient() {\n return typeof window !== \"undefined\" && typeof document !== \"undefined\";\n }\n\n private setIsOpen(isOpen: boolean) {\n this.isOpen = isOpen;\n }\n\n private setIsPdfOpen(isPdfOpen: boolean) {\n this.isPdfOpen = isPdfOpen;\n }\n\n seekTimeline({ clipId, clipPlayHead }: SeekTimelineParamsType) {\n this.iframeBridge.postToTap({\n type: \"timeline:seek\",\n clipId,\n clipPlayHead,\n });\n }\n\n async initChat({\n chatApiParams,\n customStyles,\n shortcutKey,\n }: {\n chatApiParams: ChatApiParamsType;\n customStyles?: CustomStylesType;\n shortcutKey?: ShortcutKeyType;\n }) {\n if (!this.#isClient()) throw new Error(\"not client\");\n\n this.shortcutKey = {\n openChat: shortcutKey?.openChat ?? this.shortcutKey.openChat,\n sendChat: shortcutKey?.sendChat ?? this.shortcutKey.sendChat,\n };\n\n // chat body render\n if (!this.chatBody) {\n this.chatBody = this.chatBodyMaker.createChatBody({\n ...(customStyles?.chatBody && {\n customChatBody: customStyles.chatBody,\n }),\n });\n }\n\n // chat iframe\n if (!this.iframeBridge.hasIframe()) {\n await this.iframeBridge.renderIframe({\n chatBody: this.chatBody,\n isProd: this.isProd,\n isLocal: this.isLocal,\n });\n // Handshake will be performed after iframe load\n }\n try {\n const initiatedMessage = await this.iframeBridge.performHandshake(\n {\n chatApiParams,\n customStyles,\n },\n {\n retryInterval: 500,\n maxRetries: 10,\n timeout: 10000,\n }\n );\n\n // Initialize GA with the received gaId\n new InitGA({ gaId: initiatedMessage.gaId });\n } catch (error) {\n console.error(\"Handshake failed:\", error);\n throw new Error(\n `Chat initialization failed: ${error instanceof Error ? error.message : \"Unknown error\"}`\n );\n }\n\n // floating button render\n this.floatingButtonMaker.render({\n ...(customStyles?.floatingButton && {\n customFloatingButton: customStyles.floatingButton,\n }),\n });\n this.floatingButtonMaker.addClickEvent({\n callback: () => {\n this.iframeBridge.postToTap({\n type: this.isOpen ? \"chat:close\" : \"chat:open\",\n });\n },\n });\n\n this.floatingButtonMaker.addAlarmClickEvent({\n callback: (messageInfo: AlarmMessageInstanceType) => {\n this.iframeBridge.postToTap({ type: \"chat:open\", isAlarm: true });\n this.iframeBridge.postToTap({ type: \"alarm:click\", messageInfo });\n },\n });\n\n this.iframeBridge.listenToTap(\"chat:opened\", () => {\n this.setIsOpen(true);\n this.chatBodyMaker.toggleVisibility(this.isOpen);\n this.floatingButtonMaker.alarmRemove();\n });\n this.iframeBridge.listenToTap(\"chat:closed\", () => {\n this.setIsOpen(false);\n this.chatBodyMaker.toggleVisibility(this.isOpen);\n });\n\n // alarm\n this.iframeBridge.listenToTap(\"alarm:fadeIn\", (data) => {\n if (this.isOpen) return;\n this.floatingButtonMaker.alarmFadeIn(data.messageInfo);\n });\n\n // popUp\n this.iframeBridge.listenToTap(\"popUp:open\", (data) => {\n showPopupWithHtml({\n htmlString: data.popUpInfo.html,\n callback: () => this.iframeBridge.postToTap({ type: \"popUp:close\" }),\n ...(customStyles?.chatBody && { customStyles: customStyles.chatBody }),\n });\n });\n\n // pdf Open\n this.iframeBridge.listenToTap(\"pdf:open\", () => {\n this.setIsPdfOpen(true);\n this.chatBodyMaker.resizeChatBody(this.isPdfOpen, customStyles?.chatBody);\n this.iframeBridge.postToTap({ type: \"pdf:enlarged\" });\n });\n this.iframeBridge.listenToTap(\"pdf:close\", () => {\n this.setIsPdfOpen(false);\n this.chatBodyMaker.resizeChatBody(this.isPdfOpen, customStyles?.chatBody);\n this.iframeBridge.postToTap({ type: \"pdf:shrinked\" });\n });\n\n // if dev, attach alaram:fadeIn event\n if (this.isLocal) {\n this.iframeBridge.listenToTap(\"alarm:fadeIn\", (data) => {\n this.floatingButtonMaker.alarmFadeIn(data.messageInfo);\n });\n }\n }\n\n removeChat() {\n if (!this.chatBody) throw new Error(\"chatBody is not initialized\");\n\n this.chatBodyMaker.removeChatBody();\n this.floatingButtonMaker.alarmRemove();\n this.iframeBridge.removeIframe();\n this.chatBody = null;\n this.isOpen = false;\n }\n\n /**\n * @deprecated use `seekTimeline` method. gotta be expired at v1.0.0\n */\n postChatInfo({\n clipId,\n clipPlayHead,\n }: {\n clipId: string;\n clipPlayHead: number;\n }) {\n this.seekTimeline({ clipId, clipPlayHead });\n }\n\n /**\n * @deprecated use `events.onTimelineSeek` method. gotta be expired at v1.0.0\n */\n getTimelineInfo({\n callback,\n }: {\n callback: (clipPlayHead: number, clipId: string) => void;\n }) {\n this.events.onTimelineSeek(callback);\n }\n}\n\nexport default TapSDK;\n"]}
1
+ {"version":3,"sources":["../chatBody/chatBody.css.ts","../chatBody/index.ts","../floatingButton/alarm/styles/alarm.css.ts","../floatingButton/alarm/index.ts","../floatingButton/index.ts","../../tap-messages/dist/index.js","../services/common/messenger.ts","../services/iframe-handshake/index.ts","../services/tap-iframe-bridge/index.ts","../services/event-manager/index.ts","../popUpImage/popUpImage.css.ts","../popUpImage/index.ts","../ga/index.ts","../index.ts"],"names":["chatBody","hidden","visible","ChatBodyMaker","__publicField","customChatBody","show","handleAnimationEnd","isEnlarged","baseWidthPx","baseWidth","enlargedWidth","newWidth","chatBody_default","alarmContainer","alarmCorner","alarmCornerBase","alarmCornerContainer","circle","circleBase","circleText","closeIcon","text","textContainer","textContainerBase","wrapper","_Alarm_instances","renderCornerSvg_fn","renderTextAndCloseContainer_fn","renderTextContainer_fn","appendCloseButton_fn","renderCloseIconSvg_fn","Alarm","__privateAdd","rootElement","e","__privateMethod","textAndCloseContainer","messageInfo","callback","parentElement","svg","path","textInCircle","alarm_default","_isSameKeyboardKey","FloatingButtonMaker","event","targetKey","customFloatingButton","openChatShortcutKey","__privateGet","floatingButton_default","CHAT_INIT","CHAT_INITIATED","ChatInitiatedSchema","d","GAEventSchema","Messenger","messageType","listenerCallback","data","messageData","type","error","existingListeners","ls","l","message","target","HandshakeError","reason","details","originalError","IframeHandshake","getTargetWindow","getTargetOrigin","isValidOrigin","options","timeout","maxRetries","retryInterval","resolve","reject","retryCount","timeoutId","cleanup","handleAbort","validated","ce","attemptHandshake","targetWindow","TapIframeBridge","hostClientUrl","pluginKey","eventOrigin","iframeSrcOrigin","isProd","isLocal","config","handshake","chatInitMessage","EventManager","iframeBridge","handler","copyButton","copyButtonText","defaultIcon","showPopupWithHtml","htmlString","customStyles","overlay","popup","computedRight","numericWidth","unit","numericRight","button","codeBlock","popUpImage_default","_InitGA","gaId","gtagScript","inlineScript","gaEvent","fe","InitGA","ga_default","_TapSDK_instances","isClient_fn","TapSDK","isOpen","isPdfOpen","clipId","clipPlayHead","chatApiParams","shortcutKey","initiatedMessage","index_default"],"mappings":"y2BACO,IAAIA,CAAAA,CAAW,YACXC,CAAAA,CAAS,WAAA,CAEb,IAAIC,CAAAA,CAAU,WAAA,CCDrB,IAAMC,CAAAA,CAAN,KAAoB,CAGlB,aAAc,CAFdC,CAAAA,CAAA,IAAA,CAAQ,UAAA,CAA+B,IAAA,CAAA,CAGrC,IAAA,CAAK,SAAW,KAClB,CAEA,cAAA,CAAe,CAAE,cAAA,CAAAC,CAAe,EAAsC,CACpE,OAAI,KAAK,QAAA,CAAiB,IAAA,CAAK,UAE/B,IAAA,CAAK,QAAA,CAAW,QAAA,CAA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O,SAAa,GAC9D,CAAA,KA+KKS,EAAAA,CAAQR","file":"index.js","sourcesContent":["import 'chatBody/chatBody.css.ts.vanilla.css?source=QGtleWZyYW1lcyBfMW1sdjRtZTAgewogIGZyb20gewogICAgb3BhY2l0eTogMDsKICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlWSgzMHB4KTsKICB9CiAgdG8gewogICAgb3BhY2l0eTogMTsKICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlWSgwKTsKICB9Cn0KQGtleWZyYW1lcyBfMW1sdjRtZTEgewogIGZyb20gewogICAgb3BhY2l0eTogMTsKICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlWSgwKTsKICB9CiAgdG8gewogICAgb3BhY2l0eTogMDsKICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlWSgzMHB4KTsKICAgIGRpc3BsYXk6IG5vbmU7CiAgfQp9Ci5fMW1sdjRtZTIgewogIG9wYWNpdHk6IDA7CiAgdHJhbnNmb3JtOiB0cmFuc2xhdGVZKDMwcHgpOwogIHRyYW5zaXRpb246IG9wYWNpdHkgMC40cyBlYXNlLCB0cmFuc2Zvcm0gMC40cyBlYXNlOwogIHBvaW50ZXItZXZlbnRzOiBub25lOwogIGRpc3BsYXk6IG5vbmU7Cn0KLl8xbWx2NG1lMyB7CiAgYW5pbWF0aW9uOiBfMW1sdjRtZTAgMC40cyBlYXNlIGZvcndhcmRzOwogIHBvaW50ZXItZXZlbnRzOiBhdXRvOwp9Ci5fMW1sdjRtZTQgewogIGFuaW1hdGlvbjogXzFtbHY0bWUxIDAuNHMgZWFzZSBmb3J3YXJkczsKICBwb2ludGVyLWV2ZW50czogbm9uZTsKfQouXzFtbHY0bWU1IHsKICBib3JkZXI6IG5vbmUgIWltcG9ydGFudDsKfQ==';\nexport var chatBody = '_1mlv4me2';\nexport var hidden = '_1mlv4me4';\nexport var iframe = '_1mlv4me5';\nexport var visible = '_1mlv4me3';","import { ChatBodyType } from \"../types\";\nimport * as styles from \"./chatBody.css\";\n\nclass ChatBodyMaker {\n private chatBody: HTMLElement | null = null;\n\n constructor() {\n this.chatBody = null;\n }\n\n createChatBody({ customChatBody }: { customChatBody?: ChatBodyType }) {\n if (this.chatBody) return this.chatBody;\n\n this.chatBody = document.createElement(\"div\");\n this.chatBody.id = \"cw-chat-body\";\n this.chatBody.className = styles.chatBody;\n this.chatBody.style.setProperty(\"z-index\", \"10000001\", \"important\");\n this.chatBody.style.setProperty(\"position\", \"fixed\", \"important\");\n\n Object.assign(this.chatBody.style, {\n top: customChatBody?.position?.top ?? \"50px\",\n right: customChatBody?.position?.right ?? \"24px\",\n left: customChatBody?.position?.left ?? \"unset\",\n bottom: customChatBody?.position?.bottom ?? \"unset\",\n width: customChatBody?.width ?? \"340px\",\n height: customChatBody?.height ?? \"calc(100% - 116px)\",\n overflow: \"hidden\",\n backgroundColor: \"transparent\",\n borderRadius: customChatBody?.borderRadius ?? \"16px\",\n boxShadow: `\n rgba(255, 255, 255, 0.12) 0px 0px 2px 0px inset,\n rgba(0, 0, 0, 0.05) 0px 0px 2px 1px,\n rgba(0, 0, 0, 0.3) 0px 12px 60px\n `,\n willChange: \"transform, opacity, width, max-height, max-width\",\n });\n\n document.body.appendChild(this.chatBody);\n return this.chatBody;\n }\n\n toggleVisibility(show: boolean) {\n if (!this.chatBody) return;\n\n // 기존 클래스 제거\n this.chatBody.classList.remove(styles.visible, styles.hidden);\n\n // display 초기화\n this.chatBody.style.display = \"block\";\n\n // animationend 핸들러 정의\n const handleAnimationEnd = () => {\n if (!this.chatBody) return;\n\n // hidden 상태일 경우 display: none 설정\n if (this.chatBody.classList.contains(styles.hidden)) {\n this.chatBody.style.display = \"none\";\n }\n\n // 이벤트 리스너 제거 (한 번만 실행되도록)\n this.chatBody.removeEventListener(\"animationend\", handleAnimationEnd);\n };\n\n // 애니메이션 종료 시 display 제어\n this.chatBody.addEventListener(\"animationend\", handleAnimationEnd);\n\n // requestAnimationFrame을 통해 다음 프레임에서 클래스 적용\n requestAnimationFrame(() => {\n this.chatBody?.classList.add(show ? styles.visible : styles.hidden);\n });\n }\n\n removeChatBody() {\n if (this.chatBody) {\n this.chatBody.remove();\n this.chatBody = null;\n }\n }\n\n resizeChatBody(isEnlarged: boolean, customChatBody?: ChatBodyType) {\n if (!this.chatBody) return;\n\n const baseWidthPx = customChatBody?.width ?? \"340px\";\n const baseWidth = parseInt(baseWidthPx, 10);\n\n const enlargedWidth = (baseWidth / 3) * 10 - baseWidth;\n const newWidth = isEnlarged\n ? `${baseWidth + enlargedWidth}px`\n : `${baseWidth}px`;\n\n this.chatBody.style.width = newWidth;\n }\n}\n\nexport default ChatBodyMaker;\n","import 'floatingButton/alarm/styles/alarm.css.ts.vanilla.css?source=#H4sIAAAAAAAAE61Uy27bMBC8+ysWKAqkaBlI8iMxfWlzyK1A0X5AQYsrizFNCiQVyyny7wUpOtbDblK0J1s7u8vZmSU/b/FQGLZDCz8XD2m9nifwawKQvA8/ALpiuXAHCukqfFdaKIeG4CMqZymw2mmPPE8A5heqPJYmYzBpwefJdTw7DRnDI5RW6DP7dVzYSrIDhUJiswplVjihFQW2tlrWLhTtBXclhR1rSK6VQ+V81OmKQs5kfhV4fYR51XzwgBGb0sUTfGPChcG8bZtrWe+URx5q60RxOHakkKNn7CEmxUYR4XBnW2oEFQ/0GOdCbUg4OqsC5bw2Vht6nNiHnohQHBsKy+UyMDVMHeeKAkByPbWAzOKqo112VrujPUyJHWu7vPic3lootNkzw2230zR06qt9yZNO3zZ0ajMLbUY2jbTrirTWhqMhhnFRWwqPzFwR8j18xeCPr5/gNpp13tsNq6j3s8tlfp5L9IT6jpBmVQOL+OdVpj2fT/b/3QCeeRxiOkv6lBeB8prl243RteIk19Lvyrv0Jr1L77upN5dS778s7mZ33dTbkHrEi6IIO4aNI2Eg2l6AsP1aOVKwnZAHCt8MOlScGf4CWfGEFNJZq1UbcgeJfhHMjsmX6B7bOzVLwiZJoZCUMZYlbfm+FA6JrViOFCqDZG9YFQBtOFkbZFsKW8SKMBk660c0hdT7kEghZBCf3B12+YrrSdVANm0ZjO+tdcycFiod2MNC72heOli3dU/lsWF5Dx+7xFt8/Dq89eE5hSPDo9BD4Qf7miYx/qdniEkJyXU2foI4Lb0vXWUWUV6JhaNAbrK+ULNY0R984NgpHfvw8RF60yUp/qF20/Ur7Oq5sfvZg5NO6eVrV/Bk3hvvYPZf7uBFwsP5yv58a6nz7Wry/Bv1tBtfSwgAAA==';\nexport var alarmContainer = '_6j1ub51';\nexport var alarmCorner = {'default':'_6j1ub5b _6j1ub5a','call-to-action':'_6j1ub5c _6j1ub5a'};\nexport var alarmCornerBase = '_6j1ub5a';\nexport var alarmCornerContainer = '_6j1ub59';\nexport var circle = {'default':'_6j1ub5e _6j1ub5d','call-to-action':'_6j1ub5f _6j1ub5d'};\nexport var circleBase = '_6j1ub5d';\nexport var circleText = '_6j1ub5h';\nexport var closeIcon = '_6j1ub5g';\nexport var hidden = '_6j1ub53';\nexport var text = '_6j1ub58';\nexport var textContainer = {'default':'_6j1ub56 _6j1ub55','call-to-action':'_6j1ub57 _6j1ub55'};\nexport var textContainerBase = '_6j1ub55';\nexport var visible = '_6j1ub52';\nexport var wrapper = '_6j1ub54';","import * as styles from \"./styles/alarm.css\";\n\nimport { AlarmMessageInstanceType } from \"../../types\";\n\nclass Alarm {\n // 전체 fade in & out\n private container!: HTMLDivElement;\n private alarmTimeout!: ReturnType<typeof setTimeout>;\n\n // 색상\n private alarmCornerSVG!: HTMLImageElement | SVGElement;\n private textContainer!: HTMLDivElement;\n private circleElement!: HTMLDivElement;\n\n // 텍스트 내용\n private textInTextContainer!: HTMLSpanElement;\n private messageInfo!: AlarmMessageInstanceType;\n\n constructor() {}\n\n render({ rootElement }: { rootElement: HTMLElement }) {\n this.container = document.createElement(\"div\");\n this.container.id = \"alarm-container\";\n this.container.className = styles.alarmContainer;\n this.container.addEventListener(\"click\", (e) => {\n e.stopPropagation();\n });\n rootElement.appendChild(this.container);\n\n // 코너 아이콘 렌더링\n this.#renderCornerSvg(this.container);\n\n // 텍스트 컨테이너 렌더링\n const textAndCloseContainer = this.#renderTextAndCloseContainer(\n this.container,\n );\n\n // 닫기 버튼 렌더링\n this.#appendCloseButton(textAndCloseContainer);\n\n // 텍스트 컨테이너 렌더링\n this.#renderTextContainer(textAndCloseContainer);\n }\n\n fadeIn(messageInfo: AlarmMessageInstanceType) {\n // 타입에 따라 적절한 클래스 설정\n if (messageInfo.type === \"default\" || messageInfo.type === \"hourSpent\") {\n this.textContainer.className = styles.textContainer.default;\n this.alarmCornerSVG.setAttribute(\"class\", styles.alarmCorner.default);\n this.circleElement.className = styles.circle.default;\n } else {\n this.textContainer.className = styles.textContainer[\"call-to-action\"];\n this.alarmCornerSVG.setAttribute(\n \"class\",\n styles.alarmCorner[\"call-to-action\"],\n );\n this.circleElement.className = styles.circle[\"call-to-action\"];\n } // 스타일 제거 및 적용\n this.messageInfo = messageInfo;\n\n this.textInTextContainer.textContent = messageInfo.message;\n\n this.toggleVisibility(true);\n\n this.alarmTimeout = setTimeout(() => {\n this.toggleVisibility(false);\n }, 18 * 1000);\n }\n\n addClickEvent({\n callback,\n }: {\n callback: (messageInfo: AlarmMessageInstanceType) => void;\n }) {\n this.container.addEventListener(\"click\", () => {\n this.toggleVisibility(false);\n callback(this.messageInfo);\n });\n }\n\n toggleVisibility(show: boolean) {\n this.container.classList.remove(styles.visible, styles.hidden);\n\n requestAnimationFrame(() => {\n this.container?.classList.add(show ? styles.visible : styles.hidden);\n });\n }\n\n remove() {\n if (this.container) {\n this.toggleVisibility(false);\n }\n if (this.alarmTimeout) {\n clearTimeout(this.alarmTimeout);\n }\n }\n\n #renderCornerSvg(parentElement: HTMLElement) {\n const alarmCornerContainer = document.createElement(\"div\");\n alarmCornerContainer.className = styles.alarmCornerContainer;\n parentElement.appendChild(alarmCornerContainer);\n\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n svg.setAttribute(\"width\", \"11\");\n svg.setAttribute(\"height\", \"8\");\n svg.setAttribute(\"viewBox\", \"0 0 11 8\");\n svg.setAttribute(\"fill\", \"currentColor\");\n svg.setAttribute(\"class\", styles.alarmCornerBase);\n const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\n path.setAttribute(\"d\", \"M5.5 0L11.1292 8.25H-0.129165L5.5 0Z\");\n path.setAttribute(\"fill\", \"currentColor\");\n svg.appendChild(path);\n\n this.alarmCornerSVG = svg;\n\n alarmCornerContainer.appendChild(svg);\n }\n\n #renderTextAndCloseContainer(parentElement: HTMLElement) {\n const textAndCloseContainer = document.createElement(\"div\");\n textAndCloseContainer.className = styles.wrapper;\n parentElement.appendChild(textAndCloseContainer);\n\n return textAndCloseContainer;\n }\n\n #renderTextContainer(parentElement: HTMLDivElement) {\n this.textContainer = document.createElement(\"div\");\n this.textContainer.className = styles.textContainerBase;\n parentElement.appendChild(this.textContainer);\n\n this.textInTextContainer = document.createElement(\"span\");\n this.textInTextContainer.className = styles.text;\n this.textContainer.appendChild(this.textInTextContainer);\n }\n\n #appendCloseButton(parentElement: HTMLDivElement) {\n const circle = document.createElement(\"div\");\n circle.className = styles.circleBase;\n parentElement.appendChild(circle);\n\n circle.addEventListener(\"click\", (e) => {\n e.stopPropagation();\n this.remove();\n });\n\n const textInCircle = document.createElement(\"span\");\n textInCircle.className = styles.circleText;\n circle.appendChild(textInCircle);\n textInCircle.textContent = \"알림 끄기\";\n\n this.#renderCloseIconSvg(circle);\n\n this.circleElement = circle;\n }\n\n #renderCloseIconSvg(parentElement: HTMLDivElement) {\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n svg.setAttribute(\"width\", \"10\");\n svg.setAttribute(\"height\", \"10\");\n svg.setAttribute(\"viewBox\", \"0 0 14 14\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"class\", styles.closeIcon);\n\n const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\n path.setAttribute(\"d\", \"M1 1L13 13M13 1L1 13\");\n path.setAttribute(\"stroke\", \"currentColor\");\n path.setAttribute(\"stroke-width\", \"2\");\n path.setAttribute(\"stroke-linecap\", \"round\");\n svg.appendChild(path);\n\n parentElement.appendChild(svg);\n }\n}\n\nexport default Alarm;\n","import Alarm from \"./alarm\";\n\nimport {\n AlarmMessageInstanceType,\n FloatingButtonType,\n ShortcutKeyPropertiesType,\n} from \"../types\";\n\nclass FloatingButtonMaker {\n private customFloatingButton: FloatingButtonType | undefined;\n private floatingButton!: HTMLElement;\n private alarm: Alarm;\n\n constructor() {\n this.alarm = new Alarm();\n }\n\n render({\n customFloatingButton,\n }: {\n customFloatingButton?: FloatingButtonType;\n }) {\n this.customFloatingButton = customFloatingButton;\n\n if (\n this.customFloatingButton?.isInElement &&\n this.customFloatingButton?.parentElementId\n ) {\n const parentElement = document.getElementById(\n this.customFloatingButton.parentElementId,\n );\n parentElement?.style.setProperty(\"position\", \"relative\", \"important\");\n parentElement?.style.setProperty(\"z-index\", \"10000001\", \"important\");\n\n this.floatingButton = parentElement as HTMLElement; // 부모 엘리먼트 저장\n } else {\n let rootElement = document.getElementById(\"cw-plugin\");\n\n if (!rootElement) {\n rootElement = document.createElement(\"button\");\n rootElement.id = \"cw-plugin\";\n\n rootElement.style.zIndex = \"10000001\";\n rootElement.style.setProperty(\"z-index\", \"10000001\", \"important\");\n rootElement.style.setProperty(\"position\", \"fixed\", \"important\");\n rootElement.style.width = \"50px\";\n rootElement.style.height = \"50px\";\n rootElement.style.borderRadius = \"50%\";\n rootElement.style.backgroundColor = \"#000\";\n\n document.body.appendChild(rootElement);\n\n this.floatingButton = rootElement; // 루트 엘리먼트 저장\n }\n }\n\n this.alarm.render({ rootElement: this.floatingButton });\n return this.floatingButton;\n }\n\n addClickEvent({ callback }: { callback: () => void }) {\n if (!this.floatingButton) throw new Error(\"not initialized\");\n\n this.floatingButton.addEventListener(\"click\", () => {\n callback();\n });\n }\n\n addAlarmClickEvent({\n callback,\n }: {\n callback: (messageInfo: AlarmMessageInstanceType) => void;\n }) {\n this.alarm.addClickEvent({ callback });\n }\n\n addShortCutEvent({\n openChatShortcutKey,\n callback,\n }: {\n openChatShortcutKey: ShortcutKeyPropertiesType;\n callback: () => void;\n }) {\n if (!this.floatingButton) throw new Error(\"not initialized\");\n\n window.addEventListener(\"keydown\", (event) => {\n if (\n this.#isSameKeyboardKey(event, openChatShortcutKey.key) &&\n (openChatShortcutKey.modifier\n ? event[openChatShortcutKey.modifier]\n : true)\n ) {\n callback();\n }\n });\n }\n\n alarmFadeIn(messageInfo: AlarmMessageInstanceType) {\n this.alarm.fadeIn(messageInfo);\n }\n\n alarmRemove() {\n this.alarm.remove();\n }\n\n #isSameKeyboardKey = (event: KeyboardEvent, targetKey: string): boolean => {\n if (event.key === targetKey) {\n return true;\n }\n\n if (!event.code.startsWith(\"Key\")) {\n return false;\n }\n\n const physicalKey = event.code.slice(3).toLowerCase();\n\n return physicalKey === targetKey;\n };\n}\n\nexport default FloatingButtonMaker;\n","// src/constant.ts\nvar CHAT_INIT = \"chat:init\";\nvar CHAT_INITIATED = \"chat:initiated\";\nvar CHAT_OPEN = \"chat:open\";\nvar CHAT_OPENED = \"chat:opened\";\nvar CHAT_CLOSE = \"chat:close\";\nvar CHAT_CLOSED = \"chat:closed\";\nvar TIMELINE_SEEK = \"timeline:seek\";\nvar ALARM_CLICK = \"alarm:click\";\nvar ALARM_FADE_IN = \"alarm:fadeIn\";\nvar POPUP_OPEN = \"popUp:open\";\nvar POPUP_CLOSE = \"popUp:close\";\nvar PDF_OPEN = \"pdf:open\";\nvar PDF_CLOSE = \"pdf:close\";\nvar PDF_ENLARGED = \"pdf:enlarged\";\nvar PDF_SHRINKED = \"pdf:shrinked\";\n\n// src/schema.ts\nimport * as v from \"valibot\";\nvar ChatInitiatedSchema = v.object({\n type: v.literal(CHAT_INITIATED),\n gaId: v.string()\n});\nvar GAEventSchema = v.object({\n type: v.literal(\"GA_EVENT\"),\n payload: v.record(v.string(), v.any())\n // 유연한 payload 구조\n});\nexport {\n ALARM_CLICK,\n ALARM_FADE_IN,\n CHAT_CLOSE,\n CHAT_CLOSED,\n CHAT_INIT,\n CHAT_INITIATED,\n CHAT_OPEN,\n CHAT_OPENED,\n ChatInitiatedSchema,\n GAEventSchema,\n PDF_CLOSE,\n PDF_ENLARGED,\n PDF_OPEN,\n PDF_SHRINKED,\n POPUP_CLOSE,\n POPUP_OPEN,\n TIMELINE_SEEK\n};\n","// 통합 메시지 송수신 관리 기본 클래스\ntype Unsubscribe = () => void;\n\ntype Message = {\n type: string;\n [key: string]: any;\n};\n\nexport abstract class Messenger<\n TToTargetMessages extends Message = Message,\n TFromTargetMessage extends Message = Message,\n> {\n protected listeners: Map<\n TFromTargetMessage[\"type\"],\n ((event: MessageEvent) => void)[]\n > = new Map();\n protected unifiedMessageHandler: ((event: MessageEvent) => void) | null =\n null;\n\n // 통합 리스너 등록/해지 API\n protected on<T extends TFromTargetMessage[\"type\"]>(\n messageType: T,\n callback: (data: Extract<TFromTargetMessage, { type: T }>) => void\n ): Unsubscribe {\n const listenerCallback = (event: MessageEvent) => {\n if (!this.isValidOrigin(event)) return;\n\n try {\n const data = event.data;\n\n // Handle both direct objects and JSON strings for backward compatibility\n const messageData = typeof data === 'string' ? JSON.parse(data) : data;\n const { type } = messageData;\n\n if (type === messageType) {\n callback(messageData);\n }\n } catch (error) {\n console.warn(\"Messenger: Failed to parse message data\", error);\n }\n };\n\n // 해당 메시지 타입의 리스너 배열 가져오거나 생성\n const existingListeners = this.listeners.get(messageType) || [];\n existingListeners.push(listenerCallback);\n this.listeners.set(messageType, existingListeners);\n\n // 통합 메시지 핸들러가 없으면 등록\n if (!this.unifiedMessageHandler) {\n this.unifiedMessageHandler = (event: MessageEvent) => {\n this.listeners.forEach((ls) => ls.forEach((l) => l(event)));\n };\n window.addEventListener(\"message\", this.unifiedMessageHandler);\n }\n\n return () => {\n if (this.unifiedMessageHandler) {\n window.removeEventListener(\"message\", this.unifiedMessageHandler);\n this.unifiedMessageHandler = null;\n }\n };\n }\n\n public removeListener(messageType: TFromTargetMessage[\"type\"]): void {\n this.listeners.delete(messageType);\n }\n\n public removeAllListeners(): void {\n this.listeners.clear();\n\n if (this.unifiedMessageHandler) {\n window.removeEventListener(\"message\", this.unifiedMessageHandler);\n this.unifiedMessageHandler = null;\n }\n }\n\n // 통합 메시지 전송 API\n public postMessage(message: TToTargetMessages): boolean {\n try {\n const target = this.getMessageTarget();\n if (!target) {\n console.warn(\"Messenger: Message target not available\");\n return false;\n }\n\n target.postMessage(message, this.getTargetOrigin());\n return true;\n } catch (error) {\n console.error(\"Messenger: postMessage failed\", error);\n return false;\n }\n }\n\n // 하위 클래스에서 구현해야 하는 추상 메서드들\n protected abstract isValidOrigin(event: MessageEvent): boolean;\n protected abstract getMessageTarget(): Window | null;\n protected abstract getTargetOrigin(): string;\n}\n","import * as v from \"valibot\";\nimport type {\n ChatInitiatedMessage,\n} from \"@coxwave/tap-messages\";\nimport { ChatInitiatedSchema } from \"@coxwave/tap-messages\";\n\nexport interface HandshakeOptions {\n timeout?: number;\n maxRetries?: number;\n retryInterval?: number;\n}\n\nexport enum HandshakeFailureReason {\n TIMEOUT = \"TIMEOUT\",\n MAX_RETRIES_EXCEEDED = \"MAX_RETRIES_EXCEEDED\",\n INVALID_MESSAGE = \"INVALID_MESSAGE\",\n NO_TARGET_WINDOW = \"NO_TARGET_WINDOW\",\n MESSAGE_SEND_FAILED = \"MESSAGE_SEND_FAILED\",\n}\n\nexport class HandshakeError extends Error {\n constructor(\n public reason: HandshakeFailureReason,\n public details?: string,\n public originalError?: Error\n ) {\n super(`Handshake failed: ${reason}${details ? ` - ${details}` : \"\"}`);\n this.name = \"HandshakeError\";\n }\n}\n\nexport class IframeHandshake {\n private abortController: AbortController | null = null;\n private messageListener: ((event: MessageEvent) => void) | null = null;\n\n constructor(\n private getTargetWindow: () => Window | null,\n private getTargetOrigin: () => string,\n private isValidOrigin: (event: MessageEvent) => boolean\n ) {}\n\n async execute(\n message: any,\n options: HandshakeOptions = {}\n ): Promise<ChatInitiatedMessage> {\n const { timeout = 10000, maxRetries = 10, retryInterval = 500 } = options;\n\n // Cancel any existing handshake\n this.cancel();\n\n this.abortController = new AbortController();\n\n return new Promise((resolve, reject) => {\n let retryCount = 0;\n let timeoutId: ReturnType<typeof setTimeout>;\n\n const cleanup = () => {\n if (timeoutId) clearTimeout(timeoutId);\n if (this.messageListener) {\n window.removeEventListener(\"message\", this.messageListener);\n this.messageListener = null;\n }\n };\n\n const handleAbort = () => {\n cleanup();\n reject(\n new HandshakeError(\n HandshakeFailureReason.TIMEOUT,\n \"Handshake was cancelled\"\n )\n );\n };\n\n // Set up abort handling\n this.abortController?.signal.addEventListener(\"abort\", handleAbort);\n\n // Set up message listener\n this.messageListener = (event: MessageEvent) => {\n if (!this.isValidOrigin(event)) return;\n\n try {\n const data = event.data;\n\n // Handle both direct objects and JSON strings for backward compatibility\n const messageData =\n typeof data === \"string\" ? JSON.parse(data) : data;\n\n // Validate the message\n try {\n const validated = v.safeParse(ChatInitiatedSchema, messageData);\n cleanup();\n this.abortController = null;\n resolve(validated.output as ChatInitiatedMessage);\n return;\n } catch (validationError) {\n // Invalid message - continue waiting\n }\n } catch (error) {\n // Invalid JSON or parsing error - continue waiting\n console.warn(\"Failed to parse handshake message:\", error);\n }\n };\n\n window.addEventListener(\"message\", this.messageListener);\n\n // Set overall timeout\n timeoutId = setTimeout(() => {\n cleanup();\n this.abortController = null;\n reject(\n new HandshakeError(\n HandshakeFailureReason.TIMEOUT,\n `No valid response received within ${timeout}ms`\n )\n );\n }, timeout);\n\n // Retry mechanism\n const attemptHandshake = () => {\n if (this.abortController?.signal.aborted) return;\n\n try {\n const targetWindow = this.getTargetWindow();\n\n if (!targetWindow) {\n throw new HandshakeError(\n HandshakeFailureReason.NO_TARGET_WINDOW,\n \"Target iframe window is not available\"\n );\n }\n\n targetWindow.postMessage(message, this.getTargetOrigin());\n\n retryCount++;\n\n // Schedule next retry if not at max\n if (retryCount < maxRetries) {\n setTimeout(() => {\n if (!this.abortController?.signal.aborted) {\n attemptHandshake();\n }\n }, retryInterval);\n } else {\n // Max retries exceeded, but don't reject immediately\n // Let the timeout handle the final rejection\n }\n } catch (error) {\n cleanup();\n this.abortController = null;\n\n if (error instanceof HandshakeError) {\n reject(error);\n } else {\n reject(\n new HandshakeError(\n HandshakeFailureReason.MESSAGE_SEND_FAILED,\n \"Failed to send handshake message\",\n error as Error\n )\n );\n }\n }\n };\n\n // Start the handshake process\n attemptHandshake();\n });\n }\n\n cancel(): void {\n if (this.abortController) {\n this.abortController.abort();\n this.abortController = null;\n }\n\n if (this.messageListener) {\n window.removeEventListener(\"message\", this.messageListener);\n this.messageListener = null;\n }\n }\n\n isActive(): boolean {\n return (\n this.abortController !== null && !this.abortController.signal.aborted\n );\n }\n}\n","import {\n ChatInitMessage,\n ChatOpenMessage,\n ChatCloseMessage,\n TimelineSeekMessage,\n AlarmClickMessage,\n PopUpCloseMessage,\n PdfEnlargedMessage,\n PdfShrinkedMessage,\n ChatInitiatedMessage,\n ChatOpenedMessage,\n ChatClosedMessage,\n AlarmFadeInMessage,\n PopUpOpenMessage,\n PdfOpenMessage,\n PdfCloseMessage,\n CHAT_INIT,\n} from \"@coxwave/tap-messages\";\nimport { Messenger } from \"../common/messenger\";\nimport { IframeHandshake, type HandshakeOptions } from \"../iframe-handshake\";\n\nexport type ToTapMessage =\n | ChatInitMessage\n | ChatOpenMessage\n | ChatCloseMessage\n | TimelineSeekMessage\n | AlarmClickMessage\n | PopUpCloseMessage\n | PdfEnlargedMessage\n | PdfShrinkedMessage;\n\nexport type FromTapMessage =\n | ChatInitiatedMessage\n | ChatOpenedMessage\n | ChatClosedMessage\n | AlarmFadeInMessage\n | PopUpOpenMessage\n | PdfOpenMessage\n | PdfCloseMessage\n | TimelineSeekMessage;\n\nexport interface ChatInitConfig {\n chatApiParams: any;\n customStyles?: any;\n gaId?: string;\n}\n\nexport class TapIframeBridge extends Messenger<ToTapMessage, FromTapMessage> {\n protected hostClientUrl: string;\n protected pluginKey: string;\n protected iframe!: HTMLIFrameElement | null;\n\n constructor({\n hostClientUrl,\n pluginKey,\n }: {\n hostClientUrl: string;\n pluginKey: string;\n }) {\n super();\n this.hostClientUrl = hostClientUrl;\n this.pluginKey = pluginKey;\n }\n\n // Messenger 추상 메서드 구현\n protected isValidOrigin(event: MessageEvent): boolean {\n if (!this.iframe) return false;\n\n const eventOrigin = event.origin;\n const iframeSrcOrigin = new URL(this.iframe.src).origin;\n\n // 정확한 매칭\n if (eventOrigin === iframeSrcOrigin) return true;\n\n // Vercel 도메인 패턴 매칭 (preview 배포 등)\n if (\n eventOrigin.includes(\"vercel.app\") &&\n iframeSrcOrigin.includes(\"vercel.app\")\n ) {\n return true;\n }\n\n // localhost 개발 환경\n if (\n eventOrigin.includes(\"localhost\") &&\n iframeSrcOrigin.includes(\"localhost\")\n ) {\n return true;\n }\n\n return false;\n }\n\n protected getMessageTarget(): Window | null {\n return this.iframe?.contentWindow || null;\n }\n\n protected getTargetOrigin(): string {\n if (!this.iframe?.src) return \"*\";\n\n try {\n return new URL(this.iframe.src).origin;\n } catch {\n // URL 파싱 실패 시 모든 origin 허용 (유연성 확보)\n return \"*\";\n }\n }\n\n renderIframe({\n chatBody,\n isProd,\n isLocal,\n }: {\n chatBody: HTMLElement;\n isProd: boolean;\n isLocal?: boolean;\n }) {\n return new Promise<HTMLIFrameElement>((resolve) => {\n this.iframe = document.createElement(\"iframe\");\n this.iframe.style.setProperty(\"display\", \"flex\", \"important\");\n this.iframe.style.setProperty(\"border\", \"none\", \"important\");\n\n if (isLocal) {\n this.iframe.src = `${this.hostClientUrl}/chat`;\n } else {\n this.iframe.src = isProd\n ? \"https://ax-tap-fe-staging.vercel.app/chat\"\n : \"https://ax-tap-fe-staging.vercel.app/chat\";\n }\n\n this.iframe.style.width = \"100%\";\n this.iframe.style.height = \"100%\";\n\n this.iframe.onload = () => resolve(this.iframe as HTMLIFrameElement);\n\n chatBody.appendChild(this.iframe);\n });\n }\n\n hasIframe() {\n if (!this.iframe) {\n return false;\n }\n return true;\n }\n\n removeIframe() {\n this.iframe?.remove(); // DOM에서 제거\n this.iframe = null; // 참조 초기화\n this.removeAllListeners(); // 모든 리스너 정리\n }\n\n get postToTap() {\n if (!this.iframe) {\n console.warn(\"TapIframeBridge: iframe not found\");\n }\n return super.postMessage;\n }\n\n listenToTap = super.on;\n\n async performHandshake(\n config: ChatInitConfig,\n options?: HandshakeOptions\n ): Promise<ChatInitiatedMessage> {\n if (!this.iframe) {\n throw new Error(\"TapIframeBridge: iframe not available for handshake\");\n }\n\n const handshake = new IframeHandshake(\n () => this.getMessageTarget(),\n () => this.getTargetOrigin(),\n (event) => this.isValidOrigin(event)\n );\n\n // Construct the ChatInitMessage\n const chatInitMessage: ChatInitMessage = {\n type: CHAT_INIT,\n hostClientUrl: this.hostClientUrl,\n pluginKey: this.pluginKey,\n chatApiParams: config.chatApiParams,\n theme: config.customStyles,\n };\n\n try {\n return await handshake.execute(chatInitMessage, options);\n } catch (error) {\n // Re-throw with additional context\n if (error instanceof Error) {\n throw new Error(`TapIframeBridge handshake failed: ${error.message}`);\n }\n throw error;\n }\n }\n}\n","import type { TapIframeBridge } from \"../tap-iframe-bridge\";\nimport type { AlarmMessageInstanceType } from \"../../types\";\nimport { PopUpOpenMessage } from \"@coxwave/tap-messages\";\n\nexport class EventManager {\n constructor(private iframeBridge: TapIframeBridge) {}\n\n onTimelineSeek(handler: (clipPlayHead: number, clipId: string) => void) {\n this.iframeBridge.listenToTap(\"timeline:seek\", (data) =>\n handler(data.clipPlayHead, data.clipId)\n );\n }\n\n onChatOpened(handler: () => void) {\n this.iframeBridge.listenToTap(\"chat:opened\", handler);\n }\n\n onChatClosed(handler: () => void) {\n this.iframeBridge.listenToTap(\"chat:closed\", handler);\n }\n\n onChatInitiated(handler: () => void) {\n this.iframeBridge.listenToTap(\"chat:initiated\", handler);\n }\n\n onAlarmFadeIn(handler: (messageInfo: AlarmMessageInstanceType) => void) {\n this.iframeBridge.listenToTap(\"alarm:fadeIn\", (data) => {\n handler(data.messageInfo);\n });\n }\n\n onPopUpOpen(handler: (popUpInfo: PopUpOpenMessage[\"popUpInfo\"]) => void) {\n this.iframeBridge.listenToTap(\"popUp:open\", (data) => {\n handler(data.popUpInfo);\n });\n }\n\n onPdfOpen(handler: () => void) {\n this.iframeBridge.listenToTap(\"pdf:open\", handler);\n }\n\n onPdfClose(handler: () => void) {\n this.iframeBridge.listenToTap(\"pdf:close\", handler);\n }\n}\n","import 'popUpImage/popUpImage.css.ts.vanilla.css?source=#H4sIAAAAAAAAE7VU7Y7bIBD8n6dYqap0lUKEXSd1uZfoK2B77dBgQIDPzlX37hX4o07qXq9qK0tY7AIzOztw6Lu0aU8Uvu0AelH5M4OE0vePO4BWKDKFWj6QUiuPyoeM54VEIvlVd54B77wO0ULbCi0ptZTcOGTg0HDLPa6SzvBSqIYB/RFkQA+ZGcBpKSqwTcEfkiTfwzik+R7oIUk/rE6xvBKdY5CbIUT1E9pa6n5FhZeXxupOVYGOtgze1XUdMmVnXZgbLZRH+7h72R1GDZKowR9TMryqYkUJHdlsYafhi8rh4AmXolEMJNZRzVorT2reCnll8MWiR1VxW0W20wH0c/iWxU48I4MkHQFjqEfRnD2DI43K9mfhMaqNDJS2LZdrpUhvuWFQWOQX0usRLPxJDN1mFoXSf6TQL6raluB3BWdTwaNRa+HXRg2+nTIZndD/izQfozRGO+GFVgwsSu7FE24bwjbFQ3qke5iHV8y9qHdndnKd7b6QyCKJSjgj+ZVBLTHuiHYjwmPrGJQ42h7ga+e8qK+zXAyiJKRA3yOqFTQptPe6ZZAFBgvaMaLNvcz48XjKbwinZoDTqmO3TbyrNhujz0SoCofglVd9sbA4RRZ323665G9XZfvB+8sqg88Uvq2gT+NTfGvS4MnVmny70fP7PWGfpxsyz1tuG6Fuu7lVWjiOuLMV6hLf6ZfvG7kHlyUGAAA=';\nexport var codeBlockContainer = 'wu2gm63';\nexport var copyButton = 'wu2gm66';\nexport var copyButtonText = 'wu2gm67';\nexport var defaultIcon = 'wu2gm68';\nexport var languageBadge = 'wu2gm65';\nexport var pluginHeader = 'wu2gm64';\nexport var pluginTable = 'wu2gm60';\nexport var pluginTd = 'wu2gm62';\nexport var pluginTh = 'wu2gm61';","import { ChatBodyType } from \"../types\";\nimport * as styles from \"./popUpImage.css\";\n\nfunction showPopupWithHtml({\n htmlString,\n callback,\n customStyles,\n}: {\n htmlString: string;\n callback: () => void;\n customStyles?: ChatBodyType;\n}) {\n // 🔹 스타일 태그 생성 및 삽입\n // const styleElement = document.createElement(\"style\");\n // styleElement.setAttribute(\"data-popup-style\", \"true\"); // 식별자\n // styleElement.innerHTML = styles;\n // document.head.appendChild(styleElement);\n\n // 백드롭 레이어\n const overlay = document.createElement(\"div\");\n overlay.style.position = \"fixed\";\n overlay.style.top = \"0\";\n overlay.style.left = \"0\";\n overlay.style.width = \"100vw\";\n overlay.style.height = \"100vh\";\n overlay.style.background = \"rgba(0, 0, 0, 0.4)\";\n overlay.style.zIndex = \"10000002\";\n\n // 팝업 컨테이너\n const popup = document.createElement(\"div\");\n popup.style.position = \"fixed\";\n popup.style.display = \"flex\";\n popup.style.flexDirection = \"column\";\n\n // ✅ right 계산\n const basePadding = 15;\n let computedRight = basePadding;\n\n // 너비 합\n if (customStyles?.width) {\n const numericWidth = parseFloat(customStyles.width); // 단위 제거 (390 from \"390px\", 80 from \"80%\")\n const unit = customStyles.width.match(/[a-zA-Z%]+/)?.[0]; // px, %, rem 등 추출\n\n if (!isNaN(numericWidth) && unit === \"px\") {\n computedRight += numericWidth;\n }\n } else {\n computedRight += 340;\n }\n\n // 오름쪽 포지션 합\n if (customStyles?.position?.right) {\n const numericRight = parseFloat(customStyles?.position?.right); // 단위 제거 (390 from \"390px\", 80 from \"80%\")\n const unit = customStyles?.position?.right.match(/[a-zA-Z%]+/)?.[0]; // px, %, rem 등 추출\n\n if (!isNaN(numericRight) && unit === \"px\") {\n computedRight += numericRight;\n }\n } else {\n computedRight = computedRight + 24;\n }\n\n popup.style.top = customStyles?.position?.top ?? \"50px\";\n popup.style.right = `${computedRight}px`;\n popup.style.left = customStyles?.position?.left ?? \"unset\";\n popup.style.bottom = customStyles?.position?.bottom ?? \"unset\";\n\n popup.style.maxWidth = \"calc(100vw - 100px)\";\n popup.style.maxHeight = customStyles?.height ?? \"calc(100vh - 116px)\";\n popup.style.overflow = \"auto\";\n popup.style.background = \"#fff\";\n popup.style.padding = \"20px\";\n popup.style.border = \"1px solid #ccc\";\n popup.style.boxShadow = \"0 4px 20px rgba(0,0,0,0.2)\";\n popup.style.zIndex = \"10000003\";\n popup.style.borderRadius = \"8px\";\n\n // 팝업 내용\n const wrapper = document.createElement(\"div\");\n wrapper.innerHTML = htmlString;\n\n // 백드롭 클릭 시 닫기\n overlay.addEventListener(\"click\", () => {\n document.body.removeChild(overlay);\n document.body.removeChild(popup);\n // document.head.removeChild(styleElement);\n callback();\n });\n\n // 팝업 내부 클릭 시 이벤트 전파 막기\n popup.addEventListener(\"click\", (e) => {\n e.stopPropagation();\n });\n\n // 조립 및 삽입\n popup.appendChild(wrapper);\n document.body.appendChild(overlay);\n document.body.appendChild(popup);\n\n // 복사 버튼 (만약 있을 시)\n const button = document.querySelector(`.${styles.copyButton}`);\n const codeBlock = document.querySelector(\".cw-plugin-code-block\");\n const defaultIcon = document.querySelector(`.${styles.defaultIcon}`);\n const copyButtonText = document.querySelector(`.${styles.copyButtonText}`);\n\n if (button && codeBlock && defaultIcon && copyButtonText) {\n button.addEventListener(\"click\", () => {\n navigator.clipboard.writeText(codeBlock.textContent ?? \"\");\n\n // 아이콘 숨기기\n (defaultIcon as HTMLElement).style.display = \"none\";\n\n // 텍스트 변경\n copyButtonText.textContent = \"복사됨\";\n\n setTimeout(() => {\n // 텍스트 원복\n copyButtonText.textContent = \"복사\";\n (defaultIcon as HTMLElement).style.display = \"inline\";\n }, 1000);\n });\n }\n}\n\nexport default showPopupWithHtml;\n","import * as v from \"valibot\";\nimport { GAEventSchema } from \"@coxwave/tap-messages\";\n\nclass InitGA {\n static isInitialized = false;\n\n constructor({ gaId }: { gaId: string }) {\n if (!InitGA.isInitialized) {\n this.init(gaId);\n InitGA.isInitialized = true;\n }\n }\n\n init(gaId: string) {\n if (\n !document.querySelector(\n `script[src=\"https://www.googletagmanager.com/gtag/js?id=${gaId}\"]`\n )\n ) {\n const gtagScript = document.createElement(\"script\");\n gtagScript.async = true;\n gtagScript.src = `https://www.googletagmanager.com/gtag/js?id=${gaId}`;\n document.head.appendChild(gtagScript);\n }\n\n if (typeof window.gtag !== \"function\") {\n const inlineScript = document.createElement(\"script\");\n inlineScript.innerHTML = `\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n gtag('config', '${gaId}');\n `;\n document.head.appendChild(inlineScript);\n }\n\n // TODO(domuk-k): GA 원천,형식 파악 후 개선\n window.addEventListener(\"message\", (event) => {\n try {\n const data =\n typeof event.data === \"string\" ? JSON.parse(event.data) : event.data;\n\n // Validate GA event message\n const gaEvent = v.parse(GAEventSchema, data);\n\n if (typeof window.gtag === \"function\") {\n window.gtag(\"event\", gaEvent.payload.action ?? \"click\", {\n event_category: gaEvent.payload.category ?? \"Default\",\n event_label: gaEvent.payload.label,\n value: gaEvent.payload.value,\n fastCampus_user_id: gaEvent.payload.fastCampus_user_id,\n course_id: gaEvent.payload.course_id,\n ...gaEvent.payload,\n });\n }\n } catch (error) {\n // Invalid message or JSON parsing error - ignore silently\n }\n });\n }\n}\n\nexport default InitGA;\n","import ChatBodyMaker from \"./chatBody\";\nimport FloatingButtonMaker from \"./floatingButton\";\nimport { TapIframeBridge } from \"./services/tap-iframe-bridge\";\nimport { EventManager } from \"./services/event-manager\";\nimport showPopupWithHtml from \"./popUpImage\";\n\nimport InitGA from \"./ga\";\n\nimport {\n AlarmMessageInstanceType,\n ChatApiParamsType,\n TapSDKType,\n CustomStylesType,\n ShortcutKeyType,\n SeekTimelineParamsType,\n} from \"./types\";\n\nclass TapSDK {\n private pluginKey: string;\n private iframeBridge: TapIframeBridge;\n public events: EventManager;\n\n private chatBody: HTMLElement | null = null;\n private chatBodyMaker: ChatBodyMaker;\n private floatingButtonMaker: FloatingButtonMaker;\n private shortcutKey: ShortcutKeyType = {\n openChat: { key: \"/\", modifier: \"\" },\n sendChat: { key: \"Enter\", modifier: \"\" },\n };\n\n private isProd: boolean;\n private isLocal: boolean;\n\n private isOpen: boolean;\n private isPdfOpen: boolean;\n\n constructor({ pluginKey, isProd = false, isLocal = false }: TapSDKType) {\n // protocol\n this.pluginKey = pluginKey;\n this.iframeBridge = new TapIframeBridge({\n hostClientUrl: window.location.origin,\n pluginKey: this.pluginKey,\n });\n\n // events\n this.events = new EventManager(this.iframeBridge);\n\n // render\n this.floatingButtonMaker = new FloatingButtonMaker();\n this.chatBodyMaker = new ChatBodyMaker();\n\n // ga log\n this.isProd = isProd;\n this.isLocal = isLocal;\n\n // state\n this.isOpen = false;\n this.isPdfOpen = false;\n }\n\n #isClient() {\n return typeof window !== \"undefined\" && typeof document !== \"undefined\";\n }\n\n private setIsOpen(isOpen: boolean) {\n this.isOpen = isOpen;\n }\n\n private setIsPdfOpen(isPdfOpen: boolean) {\n this.isPdfOpen = isPdfOpen;\n }\n\n seekTimeline({ clipId, clipPlayHead }: SeekTimelineParamsType) {\n this.iframeBridge.postToTap({\n type: \"timeline:seek\",\n clipId,\n clipPlayHead,\n });\n }\n\n async initChat({\n chatApiParams,\n customStyles,\n shortcutKey,\n }: {\n chatApiParams: ChatApiParamsType;\n customStyles?: CustomStylesType;\n shortcutKey?: ShortcutKeyType;\n }) {\n if (!this.#isClient()) throw new Error(\"not client\");\n\n this.shortcutKey = {\n openChat: shortcutKey?.openChat ?? this.shortcutKey.openChat,\n sendChat: shortcutKey?.sendChat ?? this.shortcutKey.sendChat,\n };\n\n // chat body render\n if (!this.chatBody) {\n this.chatBody = this.chatBodyMaker.createChatBody({\n ...(customStyles?.chatBody && {\n customChatBody: customStyles.chatBody,\n }),\n });\n }\n\n // chat iframe\n if (!this.iframeBridge.hasIframe()) {\n await this.iframeBridge.renderIframe({\n chatBody: this.chatBody,\n isProd: this.isProd,\n isLocal: this.isLocal,\n });\n // Handshake will be performed after iframe load\n }\n try {\n const initiatedMessage = await this.iframeBridge.performHandshake(\n {\n chatApiParams,\n customStyles,\n },\n {\n retryInterval: 500,\n maxRetries: 10,\n timeout: 10000,\n }\n );\n\n // Initialize GA with the received gaId\n new InitGA({ gaId: initiatedMessage.gaId });\n } catch (error) {\n console.error(\"Handshake failed:\", error);\n throw new Error(\n `Chat initialization failed: ${error instanceof Error ? error.message : \"Unknown error\"}`\n );\n }\n\n // floating button render\n this.floatingButtonMaker.render({\n ...(customStyles?.floatingButton && {\n customFloatingButton: customStyles.floatingButton,\n }),\n });\n this.floatingButtonMaker.addClickEvent({\n callback: () => {\n this.iframeBridge.postToTap({\n type: this.isOpen ? \"chat:close\" : \"chat:open\",\n });\n },\n });\n\n this.floatingButtonMaker.addAlarmClickEvent({\n callback: (messageInfo: AlarmMessageInstanceType) => {\n this.iframeBridge.postToTap({ type: \"chat:open\", isAlarm: true });\n this.iframeBridge.postToTap({ type: \"alarm:click\", messageInfo });\n },\n });\n\n this.iframeBridge.listenToTap(\"chat:opened\", () => {\n this.setIsOpen(true);\n this.chatBodyMaker.toggleVisibility(this.isOpen);\n this.floatingButtonMaker.alarmRemove();\n });\n this.iframeBridge.listenToTap(\"chat:closed\", () => {\n this.setIsOpen(false);\n this.chatBodyMaker.toggleVisibility(this.isOpen);\n });\n\n // alarm\n this.iframeBridge.listenToTap(\"alarm:fadeIn\", (data) => {\n if (this.isOpen) return;\n this.floatingButtonMaker.alarmFadeIn(data.messageInfo);\n });\n\n // popUp\n this.iframeBridge.listenToTap(\"popUp:open\", (data) => {\n showPopupWithHtml({\n htmlString: data.popUpInfo.html,\n callback: () => this.iframeBridge.postToTap({ type: \"popUp:close\" }),\n ...(customStyles?.chatBody && { customStyles: customStyles.chatBody }),\n });\n });\n\n // pdf Open\n this.iframeBridge.listenToTap(\"pdf:open\", () => {\n this.setIsPdfOpen(true);\n this.chatBodyMaker.resizeChatBody(this.isPdfOpen, customStyles?.chatBody);\n this.iframeBridge.postToTap({ type: \"pdf:enlarged\" });\n });\n this.iframeBridge.listenToTap(\"pdf:close\", () => {\n this.setIsPdfOpen(false);\n this.chatBodyMaker.resizeChatBody(this.isPdfOpen, customStyles?.chatBody);\n this.iframeBridge.postToTap({ type: \"pdf:shrinked\" });\n });\n\n // if dev, attach alaram:fadeIn event\n if (this.isLocal) {\n this.iframeBridge.listenToTap(\"alarm:fadeIn\", (data) => {\n this.floatingButtonMaker.alarmFadeIn(data.messageInfo);\n });\n }\n }\n\n removeChat() {\n if (!this.chatBody) throw new Error(\"chatBody is not initialized\");\n\n this.chatBodyMaker.removeChatBody();\n this.floatingButtonMaker.alarmRemove();\n this.iframeBridge.removeIframe();\n this.chatBody = null;\n this.isOpen = false;\n }\n\n /**\n * @deprecated use `seekTimeline` method. gotta be expired at v1.0.0\n */\n postChatInfo({\n clipId,\n clipPlayHead,\n }: {\n clipId: string;\n clipPlayHead: number;\n }) {\n this.seekTimeline({ clipId, clipPlayHead });\n }\n\n /**\n * @deprecated use `events.onTimelineSeek` method. gotta be expired at v1.0.0\n */\n getTimelineInfo({\n callback,\n }: {\n callback: (clipPlayHead: number, clipId: string) => void;\n }) {\n this.events.onTimelineSeek(callback);\n }\n}\n\nexport default TapSDK;\n"]}
package/dist/index.mjs CHANGED
@@ -11,14 +11,14 @@
11
11
  }
12
12
  })();
13
13
 
14
- import {GAEventSchema,CHAT_INIT,ChatInitiatedSchema}from'@coxwave/tap-messages';import*as oe from'valibot';var fe=Object.defineProperty;var z=s=>{throw TypeError(s)};var ye=(s,t,e)=>t in s?fe(s,t,{enumerable:true,configurable:true,writable:true,value:e}):s[t]=e;var r=(s,t,e)=>ye(s,typeof t!="symbol"?t+"":t,e),D=(s,t,e)=>t.has(s)||z("Cannot "+e);var R=(s,t,e)=>(D(s,t,"read from private field"),e?e.call(s):t.get(s)),y=(s,t,e)=>t.has(s)?z("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e);var m=(s,t,e)=>(D(s,t,"access private method"),e);var K="_1mlv4me2",w="_1mlv4me4";var k="_1mlv4me3";var _=class{constructor(){r(this,"chatBody",null);this.chatBody=null;}createChatBody({customChatBody:t}){return this.chatBody?this.chatBody:(this.chatBody=document.createElement("div"),this.chatBody.id="cw-chat-body",this.chatBody.className=K,this.chatBody.style.setProperty("z-index","10000001","important"),this.chatBody.style.setProperty("position","fixed","important"),Object.assign(this.chatBody.style,{top:t?.position?.top??"50px",right:t?.position?.right??"24px",left:t?.position?.left??"unset",bottom:t?.position?.bottom??"unset",width:t?.width??"340px",height:t?.height??"calc(100% - 116px)",overflow:"hidden",backgroundColor:"transparent",borderRadius:t?.borderRadius??"16px",boxShadow:`
14
+ import*as d from'valibot';var xe=Object.defineProperty;var R=s=>{throw TypeError(s)};var Te=(s,t,e)=>t in s?xe(s,t,{enumerable:true,configurable:true,writable:true,value:e}):s[t]=e;var r=(s,t,e)=>Te(s,typeof t!="symbol"?t+"":t,e),z=(s,t,e)=>t.has(s)||R("Cannot "+e);var K=(s,t,e)=>(z(s,t,"read from private field"),e?e.call(s):t.get(s)),v=(s,t,e)=>t.has(s)?R("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e);var g=(s,t,e)=>(z(s,t,"access private method"),e);var V="_1mlv4me2",w="_1mlv4me4";var _="_1mlv4me3";var A=class{constructor(){r(this,"chatBody",null);this.chatBody=null;}createChatBody({customChatBody:t}){return this.chatBody?this.chatBody:(this.chatBody=document.createElement("div"),this.chatBody.id="cw-chat-body",this.chatBody.className=V,this.chatBody.style.setProperty("z-index","10000001","important"),this.chatBody.style.setProperty("position","fixed","important"),Object.assign(this.chatBody.style,{top:t?.position?.top??"50px",right:t?.position?.right??"24px",left:t?.position?.left??"unset",bottom:t?.position?.bottom??"unset",width:t?.width??"340px",height:t?.height??"calc(100% - 116px)",overflow:"hidden",backgroundColor:"transparent",borderRadius:t?.borderRadius??"16px",boxShadow:`
15
15
  rgba(255, 255, 255, 0.12) 0px 0px 2px 0px inset,
16
16
  rgba(0, 0, 0, 0.05) 0px 0px 2px 1px,
17
17
  rgba(0, 0, 0, 0.3) 0px 12px 60px
18
- `,willChange:"transform, opacity, width, max-height, max-width"}),document.body.appendChild(this.chatBody),this.chatBody)}toggleVisibility(t){if(!this.chatBody)return;this.chatBody.classList.remove(k,w),this.chatBody.style.display="block";let e=()=>{this.chatBody&&(this.chatBody.classList.contains(w)&&(this.chatBody.style.display="none"),this.chatBody.removeEventListener("animationend",e));};this.chatBody.addEventListener("animationend",e),requestAnimationFrame(()=>{this.chatBody?.classList.add(t?k:w);});}removeChatBody(){this.chatBody&&(this.chatBody.remove(),this.chatBody=null);}resizeChatBody(t,e){if(!this.chatBody)return;let i=e?.width??"340px",a=parseInt(i,10),o=a/3*10-a,n=t?`${a+o}px`:`${a}px`;this.chatBody.style.width=n;}},W=_;var V="_6j1ub51",L={default:"_6j1ub5b _6j1ub5a","call-to-action":"_6j1ub5c _6j1ub5a"},$="_6j1ub5a",G="_6j1ub59",A={default:"_6j1ub5e _6j1ub5d","call-to-action":"_6j1ub5f _6j1ub5d"},q="_6j1ub5d",Y="_6j1ub5h",X="_6j1ub5g",P="_6j1ub53",J="_6j1ub58",O={default:"_6j1ub56 _6j1ub55","call-to-action":"_6j1ub57 _6j1ub55"},Z="_6j1ub55",j="_6j1ub52",Q="_6j1ub54";var p,ee,te,ae,ie,re,H=class{constructor(){y(this,p);r(this,"container");r(this,"alarmTimeout");r(this,"alarmCornerSVG");r(this,"textContainer");r(this,"circleElement");r(this,"textInTextContainer");r(this,"messageInfo");}render({rootElement:t}){this.container=document.createElement("div"),this.container.id="alarm-container",this.container.className=V,this.container.addEventListener("click",i=>{i.stopPropagation();}),t.appendChild(this.container),m(this,p,ee).call(this,this.container);let e=m(this,p,te).call(this,this.container);m(this,p,ie).call(this,e),m(this,p,ae).call(this,e);}fadeIn(t){t.type==="default"||t.type==="hourSpent"?(this.textContainer.className=O.default,this.alarmCornerSVG.setAttribute("class",L.default),this.circleElement.className=A.default):(this.textContainer.className=O["call-to-action"],this.alarmCornerSVG.setAttribute("class",L["call-to-action"]),this.circleElement.className=A["call-to-action"]),this.messageInfo=t,this.textInTextContainer.textContent=t.message,this.toggleVisibility(true),this.alarmTimeout=setTimeout(()=>{this.toggleVisibility(false);},18*1e3);}addClickEvent({callback:t}){this.container.addEventListener("click",()=>{this.toggleVisibility(false),t(this.messageInfo);});}toggleVisibility(t){this.container.classList.remove(j,P),requestAnimationFrame(()=>{this.container?.classList.add(t?j:P);});}remove(){this.container&&this.toggleVisibility(false),this.alarmTimeout&&clearTimeout(this.alarmTimeout);}};p=new WeakSet,ee=function(t){let e=document.createElement("div");e.className=G,t.appendChild(e);let i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("width","11"),i.setAttribute("height","8"),i.setAttribute("viewBox","0 0 11 8"),i.setAttribute("fill","currentColor"),i.setAttribute("class",$);let a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d","M5.5 0L11.1292 8.25H-0.129165L5.5 0Z"),a.setAttribute("fill","currentColor"),i.appendChild(a),this.alarmCornerSVG=i,e.appendChild(i);},te=function(t){let e=document.createElement("div");return e.className=Q,t.appendChild(e),e},ae=function(t){this.textContainer=document.createElement("div"),this.textContainer.className=Z,t.appendChild(this.textContainer),this.textInTextContainer=document.createElement("span"),this.textInTextContainer.className=J,this.textContainer.appendChild(this.textInTextContainer);},ie=function(t){let e=document.createElement("div");e.className=q,t.appendChild(e),e.addEventListener("click",a=>{a.stopPropagation(),this.remove();});let i=document.createElement("span");i.className=Y,e.appendChild(i),i.textContent="\uC54C\uB9BC \uB044\uAE30",m(this,p,re).call(this,e),this.circleElement=e;},re=function(t){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("width","10"),e.setAttribute("height","10"),e.setAttribute("viewBox","0 0 14 14"),e.setAttribute("fill","none"),e.setAttribute("class",X);let i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttribute("d","M1 1L13 13M13 1L1 13"),i.setAttribute("stroke","currentColor"),i.setAttribute("stroke-width","2"),i.setAttribute("stroke-linecap","round"),e.appendChild(i),t.appendChild(e);};var se=H;var T,S=class{constructor(){r(this,"customFloatingButton");r(this,"floatingButton");r(this,"alarm");y(this,T,(t,e)=>t.key===e?true:t.code.startsWith("Key")?t.code.slice(3).toLowerCase()===e:false);this.alarm=new se;}render({customFloatingButton:t}){if(this.customFloatingButton=t,this.customFloatingButton?.isInElement&&this.customFloatingButton?.parentElementId){let e=document.getElementById(this.customFloatingButton.parentElementId);e?.style.setProperty("position","relative","important"),e?.style.setProperty("z-index","10000001","important"),this.floatingButton=e;}else {let e=document.getElementById("cw-plugin");e||(e=document.createElement("button"),e.id="cw-plugin",e.style.zIndex="10000001",e.style.setProperty("z-index","10000001","important"),e.style.setProperty("position","fixed","important"),e.style.width="50px",e.style.height="50px",e.style.borderRadius="50%",e.style.backgroundColor="#000",document.body.appendChild(e),this.floatingButton=e);}return this.alarm.render({rootElement:this.floatingButton}),this.floatingButton}addClickEvent({callback:t}){if(!this.floatingButton)throw new Error("not initialized");this.floatingButton.addEventListener("click",()=>{t();});}addAlarmClickEvent({callback:t}){this.alarm.addClickEvent({callback:t});}addShortCutEvent({openChatShortcutKey:t,callback:e}){if(!this.floatingButton)throw new Error("not initialized");window.addEventListener("keydown",i=>{R(this,T).call(this,i,t.key)&&(!t.modifier||i[t.modifier])&&e();});}alarmFadeIn(t){this.alarm.fadeIn(t);}alarmRemove(){this.alarm.remove();}};T=new WeakMap;var ne=S;var C=class{constructor(){r(this,"listeners",new Map);r(this,"unifiedMessageHandler",null);}on(t,e){let i=o=>{if(this.isValidOrigin(o))try{let n=o.data,d=typeof n=="string"?JSON.parse(n):n,{type:g}=d;g===t&&e(d);}catch(n){console.warn("Messenger: Failed to parse message data",n);}},a=this.listeners.get(t)||[];return a.push(i),this.listeners.set(t,a),this.unifiedMessageHandler||(this.unifiedMessageHandler=o=>{this.listeners.forEach(n=>n.forEach(d=>d(o)));},window.addEventListener("message",this.unifiedMessageHandler)),()=>{this.unifiedMessageHandler&&(window.removeEventListener("message",this.unifiedMessageHandler),this.unifiedMessageHandler=null);}}removeListener(t){this.listeners.delete(t);}removeAllListeners(){this.listeners.clear(),this.unifiedMessageHandler&&(window.removeEventListener("message",this.unifiedMessageHandler),this.unifiedMessageHandler=null);}postMessage(t){try{let e=this.getMessageTarget();return e?(e.postMessage(t,this.getTargetOrigin()),!0):(console.warn("Messenger: Message target not available"),!1)}catch(e){return console.error("Messenger: postMessage failed",e),false}}};var u=class extends Error{constructor(e,i,a){super(`Handshake failed: ${e}${i?` - ${i}`:""}`);this.reason=e;this.details=i;this.originalError=a;this.name="HandshakeError";}},M=class{constructor(t,e,i){this.getTargetWindow=t;this.getTargetOrigin=e;this.isValidOrigin=i;r(this,"abortController",null);r(this,"messageListener",null);}async execute(t,e={}){let{timeout:i=1e4,maxRetries:a=10,retryInterval:o=500}=e;return this.cancel(),this.abortController=new AbortController,new Promise((n,d)=>{let g=0,f,h=()=>{f&&clearTimeout(f),this.messageListener&&(window.removeEventListener("message",this.messageListener),this.messageListener=null);},v=()=>{h(),d(new u("TIMEOUT","Handshake was cancelled"));};this.abortController?.signal.addEventListener("abort",v),this.messageListener=l=>{if(this.isValidOrigin(l))try{let b=l.data,ue=typeof b=="string"?JSON.parse(b):b;try{let U=oe.safeParse(ChatInitiatedSchema,ue);h(),this.abortController=null,n(U.output);return}catch{}}catch(b){console.warn("Failed to parse handshake message:",b);}},window.addEventListener("message",this.messageListener),f=setTimeout(()=>{h(),this.abortController=null,d(new u("TIMEOUT",`No valid response received within ${i}ms`));},i);let c=()=>{if(!this.abortController?.signal.aborted)try{let l=this.getTargetWindow();if(!l)throw new u("NO_TARGET_WINDOW","Target iframe window is not available");l.postMessage(t,this.getTargetOrigin()),g++,g<a&&setTimeout(()=>{this.abortController?.signal.aborted||c();},o);}catch(l){h(),this.abortController=null,l instanceof u?d(l):d(new u("MESSAGE_SEND_FAILED","Failed to send handshake message",l));}};c();})}cancel(){this.abortController&&(this.abortController.abort(),this.abortController=null),this.messageListener&&(window.removeEventListener("message",this.messageListener),this.messageListener=null);}isActive(){return this.abortController!==null&&!this.abortController.signal.aborted}};var B=class extends C{constructor({hostClientUrl:e,pluginKey:i}){super();r(this,"hostClientUrl");r(this,"pluginKey");r(this,"iframe");r(this,"listenToTap",super.on);this.hostClientUrl=e,this.pluginKey=i;}isValidOrigin(e){if(!this.iframe)return false;let i=e.origin,a=new URL(this.iframe.src).origin;return !!(i===a||i.includes("vercel.app")&&a.includes("vercel.app")||i.includes("localhost")&&a.includes("localhost"))}getMessageTarget(){return this.iframe?.contentWindow||null}getTargetOrigin(){if(!this.iframe?.src)return "*";try{return new URL(this.iframe.src).origin}catch{return "*"}}renderIframe({chatBody:e,isProd:i,isLocal:a}){return new Promise(o=>{this.iframe=document.createElement("iframe"),this.iframe.style.setProperty("display","flex","important"),this.iframe.style.setProperty("border","none","important"),a?this.iframe.src=`${this.hostClientUrl}/chat`:this.iframe.src="https://ax-tap-fe-staging.vercel.app/chat",this.iframe.style.width="100%",this.iframe.style.height="100%",this.iframe.onload=()=>o(this.iframe),e.appendChild(this.iframe);})}hasIframe(){return !!this.iframe}removeIframe(){this.iframe?.remove(),this.iframe=null,this.removeAllListeners();}get postToTap(){return this.iframe||console.warn("TapIframeBridge: iframe not found"),super.postMessage}async performHandshake(e,i){if(!this.iframe)throw new Error("TapIframeBridge: iframe not available for handshake");let a=new M(()=>this.getMessageTarget(),()=>this.getTargetOrigin(),n=>this.isValidOrigin(n)),o={type:CHAT_INIT,hostClientUrl:this.hostClientUrl,pluginKey:this.pluginKey,chatApiParams:e.chatApiParams,theme:e.customStyles};try{return await a.execute(o,i)}catch(n){throw n instanceof Error?new Error(`TapIframeBridge handshake failed: ${n.message}`):n}}};var E=class{constructor(t){this.iframeBridge=t;}onTimelineSeek(t){this.iframeBridge.listenToTap("timeline:seek",e=>t(e.clipPlayHead,e.clipId));}onChatOpened(t){this.iframeBridge.listenToTap("chat:opened",t);}onChatClosed(t){this.iframeBridge.listenToTap("chat:closed",t);}onChatInitiated(t){this.iframeBridge.listenToTap("chat:initiated",t);}onAlarmFadeIn(t){this.iframeBridge.listenToTap("alarm:fadeIn",e=>{t(e.messageInfo);});}onPopUpOpen(t){this.iframeBridge.listenToTap("popUp:open",e=>{t(e.popUpInfo);});}onPdfOpen(t){this.iframeBridge.listenToTap("pdf:open",t);}onPdfClose(t){this.iframeBridge.listenToTap("pdf:close",t);}};var le="wu2gm66",de="wu2gm67",pe="wu2gm68";function Ce({htmlString:s,callback:t,customStyles:e}){let i=document.createElement("div");i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.width="100vw",i.style.height="100vh",i.style.background="rgba(0, 0, 0, 0.4)",i.style.zIndex="10000002";let a=document.createElement("div");a.style.position="fixed",a.style.display="flex",a.style.flexDirection="column";let n=15;if(e?.width){let c=parseFloat(e.width),l=e.width.match(/[a-zA-Z%]+/)?.[0];!isNaN(c)&&l==="px"&&(n+=c);}else n+=340;if(e?.position?.right){let c=parseFloat(e?.position?.right),l=e?.position?.right.match(/[a-zA-Z%]+/)?.[0];!isNaN(c)&&l==="px"&&(n+=c);}else n=n+24;a.style.top=e?.position?.top??"50px",a.style.right=`${n}px`,a.style.left=e?.position?.left??"unset",a.style.bottom=e?.position?.bottom??"unset",a.style.maxWidth="calc(100vw - 100px)",a.style.maxHeight=e?.height??"calc(100vh - 116px)",a.style.overflow="auto",a.style.background="#fff",a.style.padding="20px",a.style.border="1px solid #ccc",a.style.boxShadow="0 4px 20px rgba(0,0,0,0.2)",a.style.zIndex="10000003",a.style.borderRadius="8px";let d=document.createElement("div");d.innerHTML=s,i.addEventListener("click",()=>{document.body.removeChild(i),document.body.removeChild(a),t();}),a.addEventListener("click",c=>{c.stopPropagation();}),a.appendChild(d),document.body.appendChild(i),document.body.appendChild(a);let g=document.querySelector(`.${le}`),f=document.querySelector(".cw-plugin-code-block"),h=document.querySelector(`.${pe}`),v=document.querySelector(`.${de}`);g&&f&&h&&v&&g.addEventListener("click",()=>{navigator.clipboard.writeText(f.textContent??""),h.style.display="none",v.textContent="\uBCF5\uC0AC\uB428",setTimeout(()=>{v.textContent="\uBCF5\uC0AC",h.style.display="inline";},1e3);});}var ce=Ce;var x=class x{constructor({gaId:t}){x.isInitialized||(this.init(t),x.isInitialized=true);}init(t){if(!document.querySelector(`script[src="https://www.googletagmanager.com/gtag/js?id=${t}"]`)){let e=document.createElement("script");e.async=true,e.src=`https://www.googletagmanager.com/gtag/js?id=${t}`,document.head.appendChild(e);}if(typeof window.gtag!="function"){let e=document.createElement("script");e.innerHTML=`
18
+ `,willChange:"transform, opacity, width, max-height, max-width"}),document.body.appendChild(this.chatBody),this.chatBody)}toggleVisibility(t){if(!this.chatBody)return;this.chatBody.classList.remove(_,w),this.chatBody.style.display="block";let e=()=>{this.chatBody&&(this.chatBody.classList.contains(w)&&(this.chatBody.style.display="none"),this.chatBody.removeEventListener("animationend",e));};this.chatBody.addEventListener("animationend",e),requestAnimationFrame(()=>{this.chatBody?.classList.add(t?_:w);});}removeChatBody(){this.chatBody&&(this.chatBody.remove(),this.chatBody=null);}resizeChatBody(t,e){if(!this.chatBody)return;let i=e?.width??"340px",a=parseInt(i,10),o=a/3*10-a,n=t?`${a+o}px`:`${a}px`;this.chatBody.style.width=n;}},W=A;var G="_6j1ub51",L={default:"_6j1ub5b _6j1ub5a","call-to-action":"_6j1ub5c _6j1ub5a"},$="_6j1ub5a",q="_6j1ub59",P={default:"_6j1ub5e _6j1ub5d","call-to-action":"_6j1ub5f _6j1ub5d"},Y="_6j1ub5d",X="_6j1ub5h",J="_6j1ub5g",O="_6j1ub53",Z="_6j1ub58",S={default:"_6j1ub56 _6j1ub55","call-to-action":"_6j1ub57 _6j1ub55"},Q="_6j1ub55",H="_6j1ub52",ee="_6j1ub54";var c,te,ae,ie,re,se,j=class{constructor(){v(this,c);r(this,"container");r(this,"alarmTimeout");r(this,"alarmCornerSVG");r(this,"textContainer");r(this,"circleElement");r(this,"textInTextContainer");r(this,"messageInfo");}render({rootElement:t}){this.container=document.createElement("div"),this.container.id="alarm-container",this.container.className=G,this.container.addEventListener("click",i=>{i.stopPropagation();}),t.appendChild(this.container),g(this,c,te).call(this,this.container);let e=g(this,c,ae).call(this,this.container);g(this,c,re).call(this,e),g(this,c,ie).call(this,e);}fadeIn(t){t.type==="default"||t.type==="hourSpent"?(this.textContainer.className=S.default,this.alarmCornerSVG.setAttribute("class",L.default),this.circleElement.className=P.default):(this.textContainer.className=S["call-to-action"],this.alarmCornerSVG.setAttribute("class",L["call-to-action"]),this.circleElement.className=P["call-to-action"]),this.messageInfo=t,this.textInTextContainer.textContent=t.message,this.toggleVisibility(true),this.alarmTimeout=setTimeout(()=>{this.toggleVisibility(false);},18*1e3);}addClickEvent({callback:t}){this.container.addEventListener("click",()=>{this.toggleVisibility(false),t(this.messageInfo);});}toggleVisibility(t){this.container.classList.remove(H,O),requestAnimationFrame(()=>{this.container?.classList.add(t?H:O);});}remove(){this.container&&this.toggleVisibility(false),this.alarmTimeout&&clearTimeout(this.alarmTimeout);}};c=new WeakSet,te=function(t){let e=document.createElement("div");e.className=q,t.appendChild(e);let i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("width","11"),i.setAttribute("height","8"),i.setAttribute("viewBox","0 0 11 8"),i.setAttribute("fill","currentColor"),i.setAttribute("class",$);let a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d","M5.5 0L11.1292 8.25H-0.129165L5.5 0Z"),a.setAttribute("fill","currentColor"),i.appendChild(a),this.alarmCornerSVG=i,e.appendChild(i);},ae=function(t){let e=document.createElement("div");return e.className=ee,t.appendChild(e),e},ie=function(t){this.textContainer=document.createElement("div"),this.textContainer.className=Q,t.appendChild(this.textContainer),this.textInTextContainer=document.createElement("span"),this.textInTextContainer.className=Z,this.textContainer.appendChild(this.textInTextContainer);},re=function(t){let e=document.createElement("div");e.className=Y,t.appendChild(e),e.addEventListener("click",a=>{a.stopPropagation(),this.remove();});let i=document.createElement("span");i.className=X,e.appendChild(i),i.textContent="\uC54C\uB9BC \uB044\uAE30",g(this,c,se).call(this,e),this.circleElement=e;},se=function(t){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("width","10"),e.setAttribute("height","10"),e.setAttribute("viewBox","0 0 14 14"),e.setAttribute("fill","none"),e.setAttribute("class",J);let i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttribute("d","M1 1L13 13M13 1L1 13"),i.setAttribute("stroke","currentColor"),i.setAttribute("stroke-width","2"),i.setAttribute("stroke-linecap","round"),e.appendChild(i),t.appendChild(e);};var ne=j;var C,F=class{constructor(){r(this,"customFloatingButton");r(this,"floatingButton");r(this,"alarm");v(this,C,(t,e)=>t.key===e?true:t.code.startsWith("Key")?t.code.slice(3).toLowerCase()===e:false);this.alarm=new ne;}render({customFloatingButton:t}){if(this.customFloatingButton=t,this.customFloatingButton?.isInElement&&this.customFloatingButton?.parentElementId){let e=document.getElementById(this.customFloatingButton.parentElementId);e?.style.setProperty("position","relative","important"),e?.style.setProperty("z-index","10000001","important"),this.floatingButton=e;}else {let e=document.getElementById("cw-plugin");e||(e=document.createElement("button"),e.id="cw-plugin",e.style.zIndex="10000001",e.style.setProperty("z-index","10000001","important"),e.style.setProperty("position","fixed","important"),e.style.width="50px",e.style.height="50px",e.style.borderRadius="50%",e.style.backgroundColor="#000",document.body.appendChild(e),this.floatingButton=e);}return this.alarm.render({rootElement:this.floatingButton}),this.floatingButton}addClickEvent({callback:t}){if(!this.floatingButton)throw new Error("not initialized");this.floatingButton.addEventListener("click",()=>{t();});}addAlarmClickEvent({callback:t}){this.alarm.addClickEvent({callback:t});}addShortCutEvent({openChatShortcutKey:t,callback:e}){if(!this.floatingButton)throw new Error("not initialized");window.addEventListener("keydown",i=>{K(this,C).call(this,i,t.key)&&(!t.modifier||i[t.modifier])&&e();});}alarmFadeIn(t){this.alarm.fadeIn(t);}alarmRemove(){this.alarm.remove();}};C=new WeakMap;var oe=F;var le="chat:init",Ee="chat:initiated";var de=d.object({type:d.literal(Ee),gaId:d.string()}),pe=d.object({type:d.literal("GA_EVENT"),payload:d.record(d.string(),d.any())});var E=class{constructor(){r(this,"listeners",new Map);r(this,"unifiedMessageHandler",null);}on(t,e){let i=o=>{if(this.isValidOrigin(o))try{let n=o.data,p=typeof n=="string"?JSON.parse(n):n,{type:u}=p;u===t&&e(p);}catch(n){console.warn("Messenger: Failed to parse message data",n);}},a=this.listeners.get(t)||[];return a.push(i),this.listeners.set(t,a),this.unifiedMessageHandler||(this.unifiedMessageHandler=o=>{this.listeners.forEach(n=>n.forEach(p=>p(o)));},window.addEventListener("message",this.unifiedMessageHandler)),()=>{this.unifiedMessageHandler&&(window.removeEventListener("message",this.unifiedMessageHandler),this.unifiedMessageHandler=null);}}removeListener(t){this.listeners.delete(t);}removeAllListeners(){this.listeners.clear(),this.unifiedMessageHandler&&(window.removeEventListener("message",this.unifiedMessageHandler),this.unifiedMessageHandler=null);}postMessage(t){try{let e=this.getMessageTarget();return e?(e.postMessage(t,this.getTargetOrigin()),!0):(console.warn("Messenger: Message target not available"),!1)}catch(e){return console.error("Messenger: postMessage failed",e),false}}};var f=class extends Error{constructor(e,i,a){super(`Handshake failed: ${e}${i?` - ${i}`:""}`);this.reason=e;this.details=i;this.originalError=a;this.name="HandshakeError";}},M=class{constructor(t,e,i){this.getTargetWindow=t;this.getTargetOrigin=e;this.isValidOrigin=i;r(this,"abortController",null);r(this,"messageListener",null);}async execute(t,e={}){let{timeout:i=1e4,maxRetries:a=10,retryInterval:o=500}=e;return this.cancel(),this.abortController=new AbortController,new Promise((n,p)=>{let u=0,y,m=()=>{y&&clearTimeout(y),this.messageListener&&(window.removeEventListener("message",this.messageListener),this.messageListener=null);},b=()=>{m(),p(new f("TIMEOUT","Handshake was cancelled"));};this.abortController?.signal.addEventListener("abort",b),this.messageListener=l=>{if(this.isValidOrigin(l))try{let x=l.data,be=typeof x=="string"?JSON.parse(x):x;try{let U=d.safeParse(de,be);m(),this.abortController=null,n(U.output);return}catch{}}catch(x){console.warn("Failed to parse handshake message:",x);}},window.addEventListener("message",this.messageListener),y=setTimeout(()=>{m(),this.abortController=null,p(new f("TIMEOUT",`No valid response received within ${i}ms`));},i);let h=()=>{if(!this.abortController?.signal.aborted)try{let l=this.getTargetWindow();if(!l)throw new f("NO_TARGET_WINDOW","Target iframe window is not available");l.postMessage(t,this.getTargetOrigin()),u++,u<a&&setTimeout(()=>{this.abortController?.signal.aborted||h();},o);}catch(l){m(),this.abortController=null,l instanceof f?p(l):p(new f("MESSAGE_SEND_FAILED","Failed to send handshake message",l));}};h();})}cancel(){this.abortController&&(this.abortController.abort(),this.abortController=null),this.messageListener&&(window.removeEventListener("message",this.messageListener),this.messageListener=null);}isActive(){return this.abortController!==null&&!this.abortController.signal.aborted}};var B=class extends E{constructor({hostClientUrl:e,pluginKey:i}){super();r(this,"hostClientUrl");r(this,"pluginKey");r(this,"iframe");r(this,"listenToTap",super.on);this.hostClientUrl=e,this.pluginKey=i;}isValidOrigin(e){if(!this.iframe)return false;let i=e.origin,a=new URL(this.iframe.src).origin;return !!(i===a||i.includes("vercel.app")&&a.includes("vercel.app")||i.includes("localhost")&&a.includes("localhost"))}getMessageTarget(){return this.iframe?.contentWindow||null}getTargetOrigin(){if(!this.iframe?.src)return "*";try{return new URL(this.iframe.src).origin}catch{return "*"}}renderIframe({chatBody:e,isProd:i,isLocal:a}){return new Promise(o=>{this.iframe=document.createElement("iframe"),this.iframe.style.setProperty("display","flex","important"),this.iframe.style.setProperty("border","none","important"),a?this.iframe.src=`${this.hostClientUrl}/chat`:this.iframe.src="https://ax-tap-fe-staging.vercel.app/chat",this.iframe.style.width="100%",this.iframe.style.height="100%",this.iframe.onload=()=>o(this.iframe),e.appendChild(this.iframe);})}hasIframe(){return !!this.iframe}removeIframe(){this.iframe?.remove(),this.iframe=null,this.removeAllListeners();}get postToTap(){return this.iframe||console.warn("TapIframeBridge: iframe not found"),super.postMessage}async performHandshake(e,i){if(!this.iframe)throw new Error("TapIframeBridge: iframe not available for handshake");let a=new M(()=>this.getMessageTarget(),()=>this.getTargetOrigin(),n=>this.isValidOrigin(n)),o={type:le,hostClientUrl:this.hostClientUrl,pluginKey:this.pluginKey,chatApiParams:e.chatApiParams,theme:e.customStyles};try{return await a.execute(o,i)}catch(n){throw n instanceof Error?new Error(`TapIframeBridge handshake failed: ${n.message}`):n}}};var I=class{constructor(t){this.iframeBridge=t;}onTimelineSeek(t){this.iframeBridge.listenToTap("timeline:seek",e=>t(e.clipPlayHead,e.clipId));}onChatOpened(t){this.iframeBridge.listenToTap("chat:opened",t);}onChatClosed(t){this.iframeBridge.listenToTap("chat:closed",t);}onChatInitiated(t){this.iframeBridge.listenToTap("chat:initiated",t);}onAlarmFadeIn(t){this.iframeBridge.listenToTap("alarm:fadeIn",e=>{t(e.messageInfo);});}onPopUpOpen(t){this.iframeBridge.listenToTap("popUp:open",e=>{t(e.popUpInfo);});}onPdfOpen(t){this.iframeBridge.listenToTap("pdf:open",t);}onPdfClose(t){this.iframeBridge.listenToTap("pdf:close",t);}};var he="wu2gm66",me="wu2gm67",ge="wu2gm68";function Be({htmlString:s,callback:t,customStyles:e}){let i=document.createElement("div");i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.width="100vw",i.style.height="100vh",i.style.background="rgba(0, 0, 0, 0.4)",i.style.zIndex="10000002";let a=document.createElement("div");a.style.position="fixed",a.style.display="flex",a.style.flexDirection="column";let n=15;if(e?.width){let h=parseFloat(e.width),l=e.width.match(/[a-zA-Z%]+/)?.[0];!isNaN(h)&&l==="px"&&(n+=h);}else n+=340;if(e?.position?.right){let h=parseFloat(e?.position?.right),l=e?.position?.right.match(/[a-zA-Z%]+/)?.[0];!isNaN(h)&&l==="px"&&(n+=h);}else n=n+24;a.style.top=e?.position?.top??"50px",a.style.right=`${n}px`,a.style.left=e?.position?.left??"unset",a.style.bottom=e?.position?.bottom??"unset",a.style.maxWidth="calc(100vw - 100px)",a.style.maxHeight=e?.height??"calc(100vh - 116px)",a.style.overflow="auto",a.style.background="#fff",a.style.padding="20px",a.style.border="1px solid #ccc",a.style.boxShadow="0 4px 20px rgba(0,0,0,0.2)",a.style.zIndex="10000003",a.style.borderRadius="8px";let p=document.createElement("div");p.innerHTML=s,i.addEventListener("click",()=>{document.body.removeChild(i),document.body.removeChild(a),t();}),a.addEventListener("click",h=>{h.stopPropagation();}),a.appendChild(p),document.body.appendChild(i),document.body.appendChild(a);let u=document.querySelector(`.${he}`),y=document.querySelector(".cw-plugin-code-block"),m=document.querySelector(`.${ge}`),b=document.querySelector(`.${me}`);u&&y&&m&&b&&u.addEventListener("click",()=>{navigator.clipboard.writeText(y.textContent??""),m.style.display="none",b.textContent="\uBCF5\uC0AC\uB428",setTimeout(()=>{b.textContent="\uBCF5\uC0AC",m.style.display="inline";},1e3);});}var ue=Be;var T=class T{constructor({gaId:t}){T.isInitialized||(this.init(t),T.isInitialized=true);}init(t){if(!document.querySelector(`script[src="https://www.googletagmanager.com/gtag/js?id=${t}"]`)){let e=document.createElement("script");e.async=true,e.src=`https://www.googletagmanager.com/gtag/js?id=${t}`,document.head.appendChild(e);}if(typeof window.gtag!="function"){let e=document.createElement("script");e.innerHTML=`
19
19
  window.dataLayer = window.dataLayer || [];
20
20
  function gtag(){dataLayer.push(arguments);}
21
21
  gtag('js', new Date());
22
22
  gtag('config', '${t}');
23
- `,document.head.appendChild(e);}window.addEventListener("message",e=>{try{let i=typeof e.data=="string"?JSON.parse(e.data):e.data,a=oe.parse(GAEventSchema,i);typeof window.gtag=="function"&&window.gtag("event",a.payload.action??"click",{event_category:a.payload.category??"Default",event_label:a.payload.label,value:a.payload.value,fastCampus_user_id:a.payload.fastCampus_user_id,course_id:a.payload.course_id,...a.payload});}catch{}});}};r(x,"isInitialized",false);var F=x,me=F;var I,ge,N=class{constructor({pluginKey:t,isProd:e=false,isLocal:i=false}){y(this,I);r(this,"pluginKey");r(this,"iframeBridge");r(this,"events");r(this,"chatBody",null);r(this,"chatBodyMaker");r(this,"floatingButtonMaker");r(this,"shortcutKey",{openChat:{key:"/",modifier:""},sendChat:{key:"Enter",modifier:""}});r(this,"isProd");r(this,"isLocal");r(this,"isOpen");r(this,"isPdfOpen");this.pluginKey=t,this.iframeBridge=new B({hostClientUrl:window.location.origin,pluginKey:this.pluginKey}),this.events=new E(this.iframeBridge),this.floatingButtonMaker=new ne,this.chatBodyMaker=new W,this.isProd=e,this.isLocal=i,this.isOpen=false,this.isPdfOpen=false;}setIsOpen(t){this.isOpen=t;}setIsPdfOpen(t){this.isPdfOpen=t;}seekTimeline({clipId:t,clipPlayHead:e}){this.iframeBridge.postToTap({type:"timeline:seek",clipId:t,clipPlayHead:e});}async initChat({chatApiParams:t,customStyles:e,shortcutKey:i}){if(!m(this,I,ge).call(this))throw new Error("not client");this.shortcutKey={openChat:i?.openChat??this.shortcutKey.openChat,sendChat:i?.sendChat??this.shortcutKey.sendChat},this.chatBody||(this.chatBody=this.chatBodyMaker.createChatBody({...e?.chatBody&&{customChatBody:e.chatBody}})),this.iframeBridge.hasIframe()||await this.iframeBridge.renderIframe({chatBody:this.chatBody,isProd:this.isProd,isLocal:this.isLocal});try{let a=await this.iframeBridge.performHandshake({chatApiParams:t,customStyles:e},{retryInterval:500,maxRetries:10,timeout:1e4});new me({gaId:a.gaId});}catch(a){throw console.error("Handshake failed:",a),new Error(`Chat initialization failed: ${a instanceof Error?a.message:"Unknown error"}`)}this.floatingButtonMaker.render({...e?.floatingButton&&{customFloatingButton:e.floatingButton}}),this.floatingButtonMaker.addClickEvent({callback:()=>{this.iframeBridge.postToTap({type:this.isOpen?"chat:close":"chat:open"});}}),this.floatingButtonMaker.addAlarmClickEvent({callback:a=>{this.iframeBridge.postToTap({type:"chat:open",isAlarm:true}),this.iframeBridge.postToTap({type:"alarm:click",messageInfo:a});}}),this.iframeBridge.listenToTap("chat:opened",()=>{this.setIsOpen(true),this.chatBodyMaker.toggleVisibility(this.isOpen),this.floatingButtonMaker.alarmRemove();}),this.iframeBridge.listenToTap("chat:closed",()=>{this.setIsOpen(false),this.chatBodyMaker.toggleVisibility(this.isOpen);}),this.iframeBridge.listenToTap("alarm:fadeIn",a=>{this.isOpen||this.floatingButtonMaker.alarmFadeIn(a.messageInfo);}),this.iframeBridge.listenToTap("popUp:open",a=>{ce({htmlString:a.popUpInfo.html,callback:()=>this.iframeBridge.postToTap({type:"popUp:close"}),...e?.chatBody&&{customStyles:e.chatBody}});}),this.iframeBridge.listenToTap("pdf:open",()=>{this.setIsPdfOpen(true),this.chatBodyMaker.resizeChatBody(this.isPdfOpen,e?.chatBody),this.iframeBridge.postToTap({type:"pdf:enlarged"});}),this.iframeBridge.listenToTap("pdf:close",()=>{this.setIsPdfOpen(false),this.chatBodyMaker.resizeChatBody(this.isPdfOpen,e?.chatBody),this.iframeBridge.postToTap({type:"pdf:shrinked"});}),this.isLocal&&this.iframeBridge.listenToTap("alarm:fadeIn",a=>{this.floatingButtonMaker.alarmFadeIn(a.messageInfo);});}removeChat(){if(!this.chatBody)throw new Error("chatBody is not initialized");this.chatBodyMaker.removeChatBody(),this.floatingButtonMaker.alarmRemove(),this.iframeBridge.removeIframe(),this.chatBody=null,this.isOpen=false;}postChatInfo({clipId:t,clipPlayHead:e}){this.seekTimeline({clipId:t,clipPlayHead:e});}getTimelineInfo({callback:t}){this.events.onTimelineSeek(t);}};I=new WeakSet,ge=function(){return typeof window<"u"&&typeof document<"u"};var Mt=N;export{Mt as default};//# sourceMappingURL=index.mjs.map
23
+ `,document.head.appendChild(e);}window.addEventListener("message",e=>{try{let i=typeof e.data=="string"?JSON.parse(e.data):e.data,a=d.parse(pe,i);typeof window.gtag=="function"&&window.gtag("event",a.payload.action??"click",{event_category:a.payload.category??"Default",event_label:a.payload.label,value:a.payload.value,fastCampus_user_id:a.payload.fastCampus_user_id,course_id:a.payload.course_id,...a.payload});}catch{}});}};r(T,"isInitialized",false);var N=T,ye=N;var k,ve,D=class{constructor({pluginKey:t,isProd:e=false,isLocal:i=false}){v(this,k);r(this,"pluginKey");r(this,"iframeBridge");r(this,"events");r(this,"chatBody",null);r(this,"chatBodyMaker");r(this,"floatingButtonMaker");r(this,"shortcutKey",{openChat:{key:"/",modifier:""},sendChat:{key:"Enter",modifier:""}});r(this,"isProd");r(this,"isLocal");r(this,"isOpen");r(this,"isPdfOpen");this.pluginKey=t,this.iframeBridge=new B({hostClientUrl:window.location.origin,pluginKey:this.pluginKey}),this.events=new I(this.iframeBridge),this.floatingButtonMaker=new oe,this.chatBodyMaker=new W,this.isProd=e,this.isLocal=i,this.isOpen=false,this.isPdfOpen=false;}setIsOpen(t){this.isOpen=t;}setIsPdfOpen(t){this.isPdfOpen=t;}seekTimeline({clipId:t,clipPlayHead:e}){this.iframeBridge.postToTap({type:"timeline:seek",clipId:t,clipPlayHead:e});}async initChat({chatApiParams:t,customStyles:e,shortcutKey:i}){if(!g(this,k,ve).call(this))throw new Error("not client");this.shortcutKey={openChat:i?.openChat??this.shortcutKey.openChat,sendChat:i?.sendChat??this.shortcutKey.sendChat},this.chatBody||(this.chatBody=this.chatBodyMaker.createChatBody({...e?.chatBody&&{customChatBody:e.chatBody}})),this.iframeBridge.hasIframe()||await this.iframeBridge.renderIframe({chatBody:this.chatBody,isProd:this.isProd,isLocal:this.isLocal});try{let a=await this.iframeBridge.performHandshake({chatApiParams:t,customStyles:e},{retryInterval:500,maxRetries:10,timeout:1e4});new ye({gaId:a.gaId});}catch(a){throw console.error("Handshake failed:",a),new Error(`Chat initialization failed: ${a instanceof Error?a.message:"Unknown error"}`)}this.floatingButtonMaker.render({...e?.floatingButton&&{customFloatingButton:e.floatingButton}}),this.floatingButtonMaker.addClickEvent({callback:()=>{this.iframeBridge.postToTap({type:this.isOpen?"chat:close":"chat:open"});}}),this.floatingButtonMaker.addAlarmClickEvent({callback:a=>{this.iframeBridge.postToTap({type:"chat:open",isAlarm:true}),this.iframeBridge.postToTap({type:"alarm:click",messageInfo:a});}}),this.iframeBridge.listenToTap("chat:opened",()=>{this.setIsOpen(true),this.chatBodyMaker.toggleVisibility(this.isOpen),this.floatingButtonMaker.alarmRemove();}),this.iframeBridge.listenToTap("chat:closed",()=>{this.setIsOpen(false),this.chatBodyMaker.toggleVisibility(this.isOpen);}),this.iframeBridge.listenToTap("alarm:fadeIn",a=>{this.isOpen||this.floatingButtonMaker.alarmFadeIn(a.messageInfo);}),this.iframeBridge.listenToTap("popUp:open",a=>{ue({htmlString:a.popUpInfo.html,callback:()=>this.iframeBridge.postToTap({type:"popUp:close"}),...e?.chatBody&&{customStyles:e.chatBody}});}),this.iframeBridge.listenToTap("pdf:open",()=>{this.setIsPdfOpen(true),this.chatBodyMaker.resizeChatBody(this.isPdfOpen,e?.chatBody),this.iframeBridge.postToTap({type:"pdf:enlarged"});}),this.iframeBridge.listenToTap("pdf:close",()=>{this.setIsPdfOpen(false),this.chatBodyMaker.resizeChatBody(this.isPdfOpen,e?.chatBody),this.iframeBridge.postToTap({type:"pdf:shrinked"});}),this.isLocal&&this.iframeBridge.listenToTap("alarm:fadeIn",a=>{this.floatingButtonMaker.alarmFadeIn(a.messageInfo);});}removeChat(){if(!this.chatBody)throw new Error("chatBody is not initialized");this.chatBodyMaker.removeChatBody(),this.floatingButtonMaker.alarmRemove(),this.iframeBridge.removeIframe(),this.chatBody=null,this.isOpen=false;}postChatInfo({clipId:t,clipPlayHead:e}){this.seekTimeline({clipId:t,clipPlayHead:e});}getTimelineInfo({callback:t}){this.events.onTimelineSeek(t);}};k=new WeakSet,ve=function(){return typeof window<"u"&&typeof document<"u"};var It=D;export{It as default};//# sourceMappingURL=index.mjs.map
24
24
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../chatBody/chatBody.css.ts","../chatBody/index.ts","../floatingButton/alarm/styles/alarm.css.ts","../floatingButton/alarm/index.ts","../floatingButton/index.ts","../services/common/messenger.ts","../services/iframe-handshake/index.ts","../services/tap-iframe-bridge/index.ts","../services/event-manager/index.ts","../popUpImage/popUpImage.css.ts","../popUpImage/index.ts","../ga/index.ts","../index.ts"],"names":["chatBody","hidden","visible","ChatBodyMaker","__publicField","customChatBody","show","handleAnimationEnd","isEnlarged","baseWidthPx","baseWidth","enlargedWidth","newWidth","chatBody_default","alarmContainer","alarmCorner","alarmCornerBase","alarmCornerContainer","circle","circleBase","circleText","closeIcon","text","textContainer","textContainerBase","wrapper","_Alarm_instances","renderCornerSvg_fn","renderTextAndCloseContainer_fn","renderTextContainer_fn","appendCloseButton_fn","renderCloseIconSvg_fn","Alarm","__privateAdd","rootElement","e","__privateMethod","textAndCloseContainer","messageInfo","callback","parentElement","svg","path","textInCircle","alarm_default","_isSameKeyboardKey","FloatingButtonMaker","event","targetKey","customFloatingButton","openChatShortcutKey","__privateGet","floatingButton_default","Messenger","messageType","listenerCallback","data","messageData","type","error","existingListeners","ls","l","message","target","HandshakeError","reason","details","originalError","IframeHandshake","getTargetWindow","getTargetOrigin","isValidOrigin","options","timeout","maxRetries","retryInterval","resolve","reject","retryCount","timeoutId","cleanup","handleAbort","validated","ChatInitiatedSchema","attemptHandshake","targetWindow","TapIframeBridge","hostClientUrl","pluginKey","eventOrigin","iframeSrcOrigin","isProd","isLocal","config","handshake","chatInitMessage","CHAT_INIT","EventManager","iframeBridge","handler","copyButton","copyButtonText","defaultIcon","showPopupWithHtml","htmlString","customStyles","overlay","popup","computedRight","numericWidth","unit","numericRight","button","codeBlock","popUpImage_default","_InitGA","gaId","gtagScript","inlineScript","gaEvent","he","GAEventSchema","InitGA","ga_default","_TapSDK_instances","isClient_fn","TapSDK","isOpen","isPdfOpen","clipId","clipPlayHead","chatApiParams","shortcutKey","initiatedMessage","index_default"],"mappings":"wkBACO,IAAIA,CAAAA,CAAW,YACXC,CAAAA,CAAS,WAAA,CAEb,IAAIC,CAAAA,CAAU,WAAA,CCDrB,IAAMC,C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jRtZTAgewogIGZyb20gewogICAgb3BhY2l0eTogMDsKICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlWSgzMHB4KTsKICB9CiAgdG8gewogICAgb3BhY2l0eTogMTsKICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlWSgwKTsKICB9Cn0KQGtleWZyYW1lcyBfMW1sdjRtZTEgewogIGZyb20gewogICAgb3BhY2l0eTogMTsKICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlWSgwKTsKICB9CiAgdG8gewogICAgb3BhY2l0eTogMDsKICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlWSgzMHB4KTsKICAgIGRpc3BsYXk6IG5vbmU7CiAgfQp9Ci5fMW1sdjRtZTIgewogIG9wYWNpdHk6IDA7CiAgdHJhbnNmb3JtOiB0cmFuc2xhdGVZKDMwcHgpOwogIHRyYW5zaXRpb246IG9wYWNpdHkgMC40cyBlYXNlLCB0cmFuc2Zvcm0gMC40cyBlYXNlOwogIHBvaW50ZXItZXZlbnRzOiBub25lOwogIGRpc3BsYXk6IG5vbmU7Cn0KLl8xbWx2NG1lMyB7CiAgYW5pbWF0aW9uOiBfMW1sdjRtZTAgMC40cyBlYXNlIGZvcndhcmRzOwogIHBvaW50ZXItZXZlbnRzOiBhdXRvOwp9Ci5fMW1sdjRtZTQgewogIGFuaW1hdGlvbjogXzFtbHY0bWUxIDAuNHMgZWFzZSBmb3J3YXJkczsKICBwb2ludGVyLWV2ZW50czogbm9uZTsKfQouXzFtbHY0bWU1IHsKICBib3JkZXI6IG5vbmUgIWltcG9ydGFudDsKfQ==';\nexport var chatBody = '_1mlv4me2';\nexport var hidden = '_1mlv4me4';\nexport var iframe = '_1mlv4me5';\nexport var visible = '_1mlv4me3';","import { ChatBodyType } from \"../types\";\nimport * as styles from \"./chatBody.css\";\n\nclass ChatBodyMaker {\n private chatBody: HTMLElement | null = null;\n\n constructor() {\n this.chatBody = null;\n }\n\n createChatBody({ customChatBody }: { customChatBody?: ChatBodyType }) {\n if (this.chatBody) return this.chatBody;\n\n this.chatBody = document.createElement(\"div\");\n this.chatBody.id = \"cw-chat-body\";\n this.chatBody.className = styles.chatBody;\n this.chatBody.style.setProperty(\"z-index\", \"10000001\", \"important\");\n this.chatBody.style.setProperty(\"position\", \"fixed\", \"important\");\n\n Object.assign(this.chatBody.style, {\n top: customChatBody?.position?.top ?? \"50px\",\n right: customChatBody?.position?.right ?? \"24px\",\n left: customChatBody?.position?.left ?? \"unset\",\n bottom: customChatBody?.position?.bottom ?? \"unset\",\n width: customChatBody?.width ?? \"340px\",\n height: customChatBody?.height ?? \"calc(100% - 116px)\",\n overflow: \"hidden\",\n backgroundColor: \"transparent\",\n borderRadius: customChatBody?.borderRadius ?? \"16px\",\n boxShadow: `\n rgba(255, 255, 255, 0.12) 0px 0px 2px 0px inset,\n rgba(0, 0, 0, 0.05) 0px 0px 2px 1px,\n rgba(0, 0, 0, 0.3) 0px 12px 60px\n `,\n willChange: \"transform, opacity, width, max-height, max-width\",\n });\n\n document.body.appendChild(this.chatBody);\n return this.chatBody;\n }\n\n toggleVisibility(show: boolean) {\n if (!this.chatBody) return;\n\n // 기존 클래스 제거\n this.chatBody.classList.remove(styles.visible, styles.hidden);\n\n // display 초기화\n this.chatBody.style.display = \"block\";\n\n // animationend 핸들러 정의\n const handleAnimationEnd = () => {\n if (!this.chatBody) return;\n\n // hidden 상태일 경우 display: none 설정\n if (this.chatBody.classList.contains(styles.hidden)) {\n this.chatBody.style.display = \"none\";\n }\n\n // 이벤트 리스너 제거 (한 번만 실행되도록)\n this.chatBody.removeEventListener(\"animationend\", handleAnimationEnd);\n };\n\n // 애니메이션 종료 시 display 제어\n this.chatBody.addEventListener(\"animationend\", handleAnimationEnd);\n\n // requestAnimationFrame을 통해 다음 프레임에서 클래스 적용\n requestAnimationFrame(() => {\n this.chatBody?.classList.add(show ? styles.visible : styles.hidden);\n });\n }\n\n removeChatBody() {\n if (this.chatBody) {\n this.chatBody.remove();\n this.chatBody = null;\n }\n }\n\n resizeChatBody(isEnlarged: boolean, customChatBody?: ChatBodyType) {\n if (!this.chatBody) return;\n\n const baseWidthPx = customChatBody?.width ?? \"340px\";\n const baseWidth = parseInt(baseWidthPx, 10);\n\n const enlargedWidth = (baseWidth / 3) * 10 - baseWidth;\n const newWidth = isEnlarged\n ? `${baseWidth + enlargedWidth}px`\n : `${baseWidth}px`;\n\n this.chatBody.style.width = newWidth;\n }\n}\n\nexport default ChatBodyMaker;\n","import 'floatingButton/alarm/styles/alarm.css.ts.vanilla.css?source=#H4sIAAAAAAAAE61Uy27bMBC8+ysWKAqkaBlI8iMxfWlzyK1A0X5AQYsrizFNCiQVyyny7wUpOtbDblK0J1s7u8vZmSU/b/FQGLZDCz8XD2m9nifwawKQvA8/ALpiuXAHCukqfFdaKIeG4CMqZymw2mmPPE8A5heqPJYmYzBpwefJdTw7DRnDI5RW6DP7dVzYSrIDhUJiswplVjihFQW2tlrWLhTtBXclhR1rSK6VQ+V81OmKQs5kfhV4fYR51XzwgBGb0sUTfGPChcG8bZtrWe+URx5q60RxOHakkKNn7CEmxUYR4XBnW2oEFQ/0GOdCbUg4OqsC5bw2Vht6nNiHnohQHBsKy+UyMDVMHeeKAkByPbWAzOKqo112VrujPUyJHWu7vPic3lootNkzw2230zR06qt9yZNO3zZ0ajMLbUY2jbTrirTWhqMhhnFRWwqPzFwR8j18xeCPr5/gNpp13tsNq6j3s8tlfp5L9IT6jpBmVQOL+OdVpj2fT/b/3QCeeRxiOkv6lBeB8prl243RteIk19Lvyrv0Jr1L77upN5dS778s7mZ33dTbkHrEi6IIO4aNI2Eg2l6AsP1aOVKwnZAHCt8MOlScGf4CWfGEFNJZq1UbcgeJfhHMjsmX6B7bOzVLwiZJoZCUMZYlbfm+FA6JrViOFCqDZG9YFQBtOFkbZFsKW8SKMBk660c0hdT7kEghZBCf3B12+YrrSdVANm0ZjO+tdcycFiod2MNC72heOli3dU/lsWF5Dx+7xFt8/Dq89eE5hSPDo9BD4Qf7miYx/qdniEkJyXU2foI4Lb0vXWUWUV6JhaNAbrK+ULNY0R984NgpHfvw8RF60yUp/qF20/Ur7Oq5sfvZg5NO6eVrV/Bk3hvvYPZf7uBFwsP5yv58a6nz7Wry/Bv1tBtfSwgAAA==';\nexport var alarmContainer = '_6j1ub51';\nexport var alarmCorner = {'default':'_6j1ub5b _6j1ub5a','call-to-action':'_6j1ub5c _6j1ub5a'};\nexport var alarmCornerBase = '_6j1ub5a';\nexport var alarmCornerContainer = '_6j1ub59';\nexport var circle = {'default':'_6j1ub5e _6j1ub5d','call-to-action':'_6j1ub5f _6j1ub5d'};\nexport var circleBase = '_6j1ub5d';\nexport var circleText = '_6j1ub5h';\nexport var closeIcon = '_6j1ub5g';\nexport var hidden = '_6j1ub53';\nexport var text = '_6j1ub58';\nexport var textContainer = {'default':'_6j1ub56 _6j1ub55','call-to-action':'_6j1ub57 _6j1ub55'};\nexport var textContainerBase = '_6j1ub55';\nexport var visible = '_6j1ub52';\nexport var wrapper = '_6j1ub54';","import * as styles from \"./styles/alarm.css\";\n\nimport { AlarmMessageInstanceType } from \"../../types\";\n\nclass Alarm {\n // 전체 fade in & out\n private container!: HTMLDivElement;\n private alarmTimeout!: ReturnType<typeof setTimeout>;\n\n // 색상\n private alarmCornerSVG!: HTMLImageElement | SVGElement;\n private textContainer!: HTMLDivElement;\n private circleElement!: HTMLDivElement;\n\n // 텍스트 내용\n private textInTextContainer!: HTMLSpanElement;\n private messageInfo!: AlarmMessageInstanceType;\n\n constructor() {}\n\n render({ rootElement }: { rootElement: HTMLElement }) {\n this.container = document.createElement(\"div\");\n this.container.id = \"alarm-container\";\n this.container.className = styles.alarmContainer;\n this.container.addEventListener(\"click\", (e) => {\n e.stopPropagation();\n });\n rootElement.appendChild(this.container);\n\n // 코너 아이콘 렌더링\n this.#renderCornerSvg(this.container);\n\n // 텍스트 컨테이너 렌더링\n const textAndCloseContainer = this.#renderTextAndCloseContainer(\n this.container,\n );\n\n // 닫기 버튼 렌더링\n this.#appendCloseButton(textAndCloseContainer);\n\n // 텍스트 컨테이너 렌더링\n this.#renderTextContainer(textAndCloseContainer);\n }\n\n fadeIn(messageInfo: AlarmMessageInstanceType) {\n // 타입에 따라 적절한 클래스 설정\n if (messageInfo.type === \"default\" || messageInfo.type === \"hourSpent\") {\n this.textContainer.className = styles.textContainer.default;\n this.alarmCornerSVG.setAttribute(\"class\", styles.alarmCorner.default);\n this.circleElement.className = styles.circle.default;\n } else {\n this.textContainer.className = styles.textContainer[\"call-to-action\"];\n this.alarmCornerSVG.setAttribute(\n \"class\",\n styles.alarmCorner[\"call-to-action\"],\n );\n this.circleElement.className = styles.circle[\"call-to-action\"];\n } // 스타일 제거 및 적용\n this.messageInfo = messageInfo;\n\n this.textInTextContainer.textContent = messageInfo.message;\n\n this.toggleVisibility(true);\n\n this.alarmTimeout = setTimeout(() => {\n this.toggleVisibility(false);\n }, 18 * 1000);\n }\n\n addClickEvent({\n callback,\n }: {\n callback: (messageInfo: AlarmMessageInstanceType) => void;\n }) {\n this.container.addEventListener(\"click\", () => {\n this.toggleVisibility(false);\n callback(this.messageInfo);\n });\n }\n\n toggleVisibility(show: boolean) {\n this.container.classList.remove(styles.visible, styles.hidden);\n\n requestAnimationFrame(() => {\n this.container?.classList.add(show ? styles.visible : styles.hidden);\n });\n }\n\n remove() {\n if (this.container) {\n this.toggleVisibility(false);\n }\n if (this.alarmTimeout) {\n clearTimeout(this.alarmTimeout);\n }\n }\n\n #renderCornerSvg(parentElement: HTMLElement) {\n const alarmCornerContainer = document.createElement(\"div\");\n alarmCornerContainer.className = styles.alarmCornerContainer;\n parentElement.appendChild(alarmCornerContainer);\n\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n svg.setAttribute(\"width\", \"11\");\n svg.setAttribute(\"height\", \"8\");\n svg.setAttribute(\"viewBox\", \"0 0 11 8\");\n svg.setAttribute(\"fill\", \"currentColor\");\n svg.setAttribute(\"class\", styles.alarmCornerBase);\n const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\n path.setAttribute(\"d\", \"M5.5 0L11.1292 8.25H-0.129165L5.5 0Z\");\n path.setAttribute(\"fill\", \"currentColor\");\n svg.appendChild(path);\n\n this.alarmCornerSVG = svg;\n\n alarmCornerContainer.appendChild(svg);\n }\n\n #renderTextAndCloseContainer(parentElement: HTMLElement) {\n const textAndCloseContainer = document.createElement(\"div\");\n textAndCloseContainer.className = styles.wrapper;\n parentElement.appendChild(textAndCloseContainer);\n\n return textAndCloseContainer;\n }\n\n #renderTextContainer(parentElement: HTMLDivElement) {\n this.textContainer = document.createElement(\"div\");\n this.textContainer.className = styles.textContainerBase;\n parentElement.appendChild(this.textContainer);\n\n this.textInTextContainer = document.createElement(\"span\");\n this.textInTextContainer.className = styles.text;\n this.textContainer.appendChild(this.textInTextContainer);\n }\n\n #appendCloseButton(parentElement: HTMLDivElement) {\n const circle = document.createElement(\"div\");\n circle.className = styles.circleBase;\n parentElement.appendChild(circle);\n\n circle.addEventListener(\"click\", (e) => {\n e.stopPropagation();\n this.remove();\n });\n\n const textInCircle = document.createElement(\"span\");\n textInCircle.className = styles.circleText;\n circle.appendChild(textInCircle);\n textInCircle.textContent = \"알림 끄기\";\n\n this.#renderCloseIconSvg(circle);\n\n this.circleElement = circle;\n }\n\n #renderCloseIconSvg(parentElement: HTMLDivElement) {\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n svg.setAttribute(\"width\", \"10\");\n svg.setAttribute(\"height\", \"10\");\n svg.setAttribute(\"viewBox\", \"0 0 14 14\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"class\", styles.closeIcon);\n\n const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\n path.setAttribute(\"d\", \"M1 1L13 13M13 1L1 13\");\n path.setAttribute(\"stroke\", \"currentColor\");\n path.setAttribute(\"stroke-width\", \"2\");\n path.setAttribute(\"stroke-linecap\", \"round\");\n svg.appendChild(path);\n\n parentElement.appendChild(svg);\n }\n}\n\nexport default Alarm;\n","import Alarm from \"./alarm\";\n\nimport {\n AlarmMessageInstanceType,\n FloatingButtonType,\n ShortcutKeyPropertiesType,\n} from \"../types\";\n\nclass FloatingButtonMaker {\n private customFloatingButton: FloatingButtonType | undefined;\n private floatingButton!: HTMLElement;\n private alarm: Alarm;\n\n constructor() {\n this.alarm = new Alarm();\n }\n\n render({\n customFloatingButton,\n }: {\n customFloatingButton?: FloatingButtonType;\n }) {\n this.customFloatingButton = customFloatingButton;\n\n if (\n this.customFloatingButton?.isInElement &&\n this.customFloatingButton?.parentElementId\n ) {\n const parentElement = document.getElementById(\n this.customFloatingButton.parentElementId,\n );\n parentElement?.style.setProperty(\"position\", \"relative\", \"important\");\n parentElement?.style.setProperty(\"z-index\", \"10000001\", \"important\");\n\n this.floatingButton = parentElement as HTMLElement; // 부모 엘리먼트 저장\n } else {\n let rootElement = document.getElementById(\"cw-plugin\");\n\n if (!rootElement) {\n rootElement = document.createElement(\"button\");\n rootElement.id = \"cw-plugin\";\n\n rootElement.style.zIndex = \"10000001\";\n rootElement.style.setProperty(\"z-index\", \"10000001\", \"important\");\n rootElement.style.setProperty(\"position\", \"fixed\", \"important\");\n rootElement.style.width = \"50px\";\n rootElement.style.height = \"50px\";\n rootElement.style.borderRadius = \"50%\";\n rootElement.style.backgroundColor = \"#000\";\n\n document.body.appendChild(rootElement);\n\n this.floatingButton = rootElement; // 루트 엘리먼트 저장\n }\n }\n\n this.alarm.render({ rootElement: this.floatingButton });\n return this.floatingButton;\n }\n\n addClickEvent({ callback }: { callback: () => void }) {\n if (!this.floatingButton) throw new Error(\"not initialized\");\n\n this.floatingButton.addEventListener(\"click\", () => {\n callback();\n });\n }\n\n addAlarmClickEvent({\n callback,\n }: {\n callback: (messageInfo: AlarmMessageInstanceType) => void;\n }) {\n this.alarm.addClickEvent({ callback });\n }\n\n addShortCutEvent({\n openChatShortcutKey,\n callback,\n }: {\n openChatShortcutKey: ShortcutKeyPropertiesType;\n callback: () => void;\n }) {\n if (!this.floatingButton) throw new Error(\"not initialized\");\n\n window.addEventListener(\"keydown\", (event) => {\n if (\n this.#isSameKeyboardKey(event, openChatShortcutKey.key) &&\n (openChatShortcutKey.modifier\n ? event[openChatShortcutKey.modifier]\n : true)\n ) {\n callback();\n }\n });\n }\n\n alarmFadeIn(messageInfo: AlarmMessageInstanceType) {\n this.alarm.fadeIn(messageInfo);\n }\n\n alarmRemove() {\n this.alarm.remove();\n }\n\n #isSameKeyboardKey = (event: KeyboardEvent, targetKey: string): boolean => {\n if (event.key === targetKey) {\n return true;\n }\n\n if (!event.code.startsWith(\"Key\")) {\n return false;\n }\n\n const physicalKey = event.code.slice(3).toLowerCase();\n\n return physicalKey === targetKey;\n };\n}\n\nexport default FloatingButtonMaker;\n","// 통합 메시지 송수신 관리 기본 클래스\ntype Unsubscribe = () => void;\n\ntype Message = {\n type: string;\n [key: string]: any;\n};\n\nexport abstract class Messenger<\n TToTargetMessages extends Message = Message,\n TFromTargetMessage extends Message = Message,\n> {\n protected listeners: Map<\n TFromTargetMessage[\"type\"],\n ((event: MessageEvent) => void)[]\n > = new Map();\n protected unifiedMessageHandler: ((event: MessageEvent) => void) | null =\n null;\n\n // 통합 리스너 등록/해지 API\n protected on<T extends TFromTargetMessage[\"type\"]>(\n messageType: T,\n callback: (data: Extract<TFromTargetMessage, { type: T }>) => void\n ): Unsubscribe {\n const listenerCallback = (event: MessageEvent) => {\n if (!this.isValidOrigin(event)) return;\n\n try {\n const data = event.data;\n\n // Handle both direct objects and JSON strings for backward compatibility\n const messageData = typeof data === 'string' ? JSON.parse(data) : data;\n const { type } = messageData;\n\n if (type === messageType) {\n callback(messageData);\n }\n } catch (error) {\n console.warn(\"Messenger: Failed to parse message data\", error);\n }\n };\n\n // 해당 메시지 타입의 리스너 배열 가져오거나 생성\n const existingListeners = this.listeners.get(messageType) || [];\n existingListeners.push(listenerCallback);\n this.listeners.set(messageType, existingListeners);\n\n // 통합 메시지 핸들러가 없으면 등록\n if (!this.unifiedMessageHandler) {\n this.unifiedMessageHandler = (event: MessageEvent) => {\n this.listeners.forEach((ls) => ls.forEach((l) => l(event)));\n };\n window.addEventListener(\"message\", this.unifiedMessageHandler);\n }\n\n return () => {\n if (this.unifiedMessageHandler) {\n window.removeEventListener(\"message\", this.unifiedMessageHandler);\n this.unifiedMessageHandler = null;\n }\n };\n }\n\n public removeListener(messageType: TFromTargetMessage[\"type\"]): void {\n this.listeners.delete(messageType);\n }\n\n public removeAllListeners(): void {\n this.listeners.clear();\n\n if (this.unifiedMessageHandler) {\n window.removeEventListener(\"message\", this.unifiedMessageHandler);\n this.unifiedMessageHandler = null;\n }\n }\n\n // 통합 메시지 전송 API\n public postMessage(message: TToTargetMessages): boolean {\n try {\n const target = this.getMessageTarget();\n if (!target) {\n console.warn(\"Messenger: Message target not available\");\n return false;\n }\n\n target.postMessage(message, this.getTargetOrigin());\n return true;\n } catch (error) {\n console.error(\"Messenger: postMessage failed\", error);\n return false;\n }\n }\n\n // 하위 클래스에서 구현해야 하는 추상 메서드들\n protected abstract isValidOrigin(event: MessageEvent): boolean;\n protected abstract getMessageTarget(): Window | null;\n protected abstract getTargetOrigin(): string;\n}\n","import * as v from \"valibot\";\nimport type {\n ChatInitiatedMessage,\n} from \"@coxwave/tap-messages\";\nimport { ChatInitiatedSchema } from \"@coxwave/tap-messages\";\n\nexport interface HandshakeOptions {\n timeout?: number;\n maxRetries?: number;\n retryInterval?: number;\n}\n\nexport enum HandshakeFailureReason {\n TIMEOUT = \"TIMEOUT\",\n MAX_RETRIES_EXCEEDED = \"MAX_RETRIES_EXCEEDED\",\n INVALID_MESSAGE = \"INVALID_MESSAGE\",\n NO_TARGET_WINDOW = \"NO_TARGET_WINDOW\",\n MESSAGE_SEND_FAILED = \"MESSAGE_SEND_FAILED\",\n}\n\nexport class HandshakeError extends Error {\n constructor(\n public reason: HandshakeFailureReason,\n public details?: string,\n public originalError?: Error\n ) {\n super(`Handshake failed: ${reason}${details ? ` - ${details}` : \"\"}`);\n this.name = \"HandshakeError\";\n }\n}\n\nexport class IframeHandshake {\n private abortController: AbortController | null = null;\n private messageListener: ((event: MessageEvent) => void) | null = null;\n\n constructor(\n private getTargetWindow: () => Window | null,\n private getTargetOrigin: () => string,\n private isValidOrigin: (event: MessageEvent) => boolean\n ) {}\n\n async execute(\n message: any,\n options: HandshakeOptions = {}\n ): Promise<ChatInitiatedMessage> {\n const { timeout = 10000, maxRetries = 10, retryInterval = 500 } = options;\n\n // Cancel any existing handshake\n this.cancel();\n\n this.abortController = new AbortController();\n\n return new Promise((resolve, reject) => {\n let retryCount = 0;\n let timeoutId: ReturnType<typeof setTimeout>;\n\n const cleanup = () => {\n if (timeoutId) clearTimeout(timeoutId);\n if (this.messageListener) {\n window.removeEventListener(\"message\", this.messageListener);\n this.messageListener = null;\n }\n };\n\n const handleAbort = () => {\n cleanup();\n reject(\n new HandshakeError(\n HandshakeFailureReason.TIMEOUT,\n \"Handshake was cancelled\"\n )\n );\n };\n\n // Set up abort handling\n this.abortController?.signal.addEventListener(\"abort\", handleAbort);\n\n // Set up message listener\n this.messageListener = (event: MessageEvent) => {\n if (!this.isValidOrigin(event)) return;\n\n try {\n const data = event.data;\n\n // Handle both direct objects and JSON strings for backward compatibility\n const messageData =\n typeof data === \"string\" ? JSON.parse(data) : data;\n\n // Validate the message\n try {\n const validated = v.safeParse(ChatInitiatedSchema, messageData);\n cleanup();\n this.abortController = null;\n resolve(validated.output as ChatInitiatedMessage);\n return;\n } catch (validationError) {\n // Invalid message - continue waiting\n }\n } catch (error) {\n // Invalid JSON or parsing error - continue waiting\n console.warn(\"Failed to parse handshake message:\", error);\n }\n };\n\n window.addEventListener(\"message\", this.messageListener);\n\n // Set overall timeout\n timeoutId = setTimeout(() => {\n cleanup();\n this.abortController = null;\n reject(\n new HandshakeError(\n HandshakeFailureReason.TIMEOUT,\n `No valid response received within ${timeout}ms`\n )\n );\n }, timeout);\n\n // Retry mechanism\n const attemptHandshake = () => {\n if (this.abortController?.signal.aborted) return;\n\n try {\n const targetWindow = this.getTargetWindow();\n\n if (!targetWindow) {\n throw new HandshakeError(\n HandshakeFailureReason.NO_TARGET_WINDOW,\n \"Target iframe window is not available\"\n );\n }\n\n targetWindow.postMessage(message, this.getTargetOrigin());\n\n retryCount++;\n\n // Schedule next retry if not at max\n if (retryCount < maxRetries) {\n setTimeout(() => {\n if (!this.abortController?.signal.aborted) {\n attemptHandshake();\n }\n }, retryInterval);\n } else {\n // Max retries exceeded, but don't reject immediately\n // Let the timeout handle the final rejection\n }\n } catch (error) {\n cleanup();\n this.abortController = null;\n\n if (error instanceof HandshakeError) {\n reject(error);\n } else {\n reject(\n new HandshakeError(\n HandshakeFailureReason.MESSAGE_SEND_FAILED,\n \"Failed to send handshake message\",\n error as Error\n )\n );\n }\n }\n };\n\n // Start the handshake process\n attemptHandshake();\n });\n }\n\n cancel(): void {\n if (this.abortController) {\n this.abortController.abort();\n this.abortController = null;\n }\n\n if (this.messageListener) {\n window.removeEventListener(\"message\", this.messageListener);\n this.messageListener = null;\n }\n }\n\n isActive(): boolean {\n return (\n this.abortController !== null && !this.abortController.signal.aborted\n );\n }\n}\n","import {\n ChatInitMessage,\n ChatOpenMessage,\n ChatCloseMessage,\n TimelineSeekMessage,\n AlarmClickMessage,\n PopUpCloseMessage,\n PdfEnlargedMessage,\n PdfShrinkedMessage,\n ChatInitiatedMessage,\n ChatOpenedMessage,\n ChatClosedMessage,\n AlarmFadeInMessage,\n PopUpOpenMessage,\n PdfOpenMessage,\n PdfCloseMessage,\n CHAT_INIT,\n} from \"@coxwave/tap-messages\";\nimport { Messenger } from \"../common/messenger\";\nimport { IframeHandshake, type HandshakeOptions } from \"../iframe-handshake\";\n\nexport type ToTapMessage =\n | ChatInitMessage\n | ChatOpenMessage\n | ChatCloseMessage\n | TimelineSeekMessage\n | AlarmClickMessage\n | PopUpCloseMessage\n | PdfEnlargedMessage\n | PdfShrinkedMessage;\n\nexport type FromTapMessage =\n | ChatInitiatedMessage\n | ChatOpenedMessage\n | ChatClosedMessage\n | AlarmFadeInMessage\n | PopUpOpenMessage\n | PdfOpenMessage\n | PdfCloseMessage\n | TimelineSeekMessage;\n\nexport interface ChatInitConfig {\n chatApiParams: any;\n customStyles?: any;\n gaId?: string;\n}\n\nexport class TapIframeBridge extends Messenger<ToTapMessage, FromTapMessage> {\n protected hostClientUrl: string;\n protected pluginKey: string;\n protected iframe!: HTMLIFrameElement | null;\n\n constructor({\n hostClientUrl,\n pluginKey,\n }: {\n hostClientUrl: string;\n pluginKey: string;\n }) {\n super();\n this.hostClientUrl = hostClientUrl;\n this.pluginKey = pluginKey;\n }\n\n // Messenger 추상 메서드 구현\n protected isValidOrigin(event: MessageEvent): boolean {\n if (!this.iframe) return false;\n\n const eventOrigin = event.origin;\n const iframeSrcOrigin = new URL(this.iframe.src).origin;\n\n // 정확한 매칭\n if (eventOrigin === iframeSrcOrigin) return true;\n\n // Vercel 도메인 패턴 매칭 (preview 배포 등)\n if (\n eventOrigin.includes(\"vercel.app\") &&\n iframeSrcOrigin.includes(\"vercel.app\")\n ) {\n return true;\n }\n\n // localhost 개발 환경\n if (\n eventOrigin.includes(\"localhost\") &&\n iframeSrcOrigin.includes(\"localhost\")\n ) {\n return true;\n }\n\n return false;\n }\n\n protected getMessageTarget(): Window | null {\n return this.iframe?.contentWindow || null;\n }\n\n protected getTargetOrigin(): string {\n if (!this.iframe?.src) return \"*\";\n\n try {\n return new URL(this.iframe.src).origin;\n } catch {\n // URL 파싱 실패 시 모든 origin 허용 (유연성 확보)\n return \"*\";\n }\n }\n\n renderIframe({\n chatBody,\n isProd,\n isLocal,\n }: {\n chatBody: HTMLElement;\n isProd: boolean;\n isLocal?: boolean;\n }) {\n return new Promise<HTMLIFrameElement>((resolve) => {\n this.iframe = document.createElement(\"iframe\");\n this.iframe.style.setProperty(\"display\", \"flex\", \"important\");\n this.iframe.style.setProperty(\"border\", \"none\", \"important\");\n\n if (isLocal) {\n this.iframe.src = `${this.hostClientUrl}/chat`;\n } else {\n this.iframe.src = isProd\n ? \"https://ax-tap-fe-staging.vercel.app/chat\"\n : \"https://ax-tap-fe-staging.vercel.app/chat\";\n }\n\n this.iframe.style.width = \"100%\";\n this.iframe.style.height = \"100%\";\n\n this.iframe.onload = () => resolve(this.iframe as HTMLIFrameElement);\n\n chatBody.appendChild(this.iframe);\n });\n }\n\n hasIframe() {\n if (!this.iframe) {\n return false;\n }\n return true;\n }\n\n removeIframe() {\n this.iframe?.remove(); // DOM에서 제거\n this.iframe = null; // 참조 초기화\n this.removeAllListeners(); // 모든 리스너 정리\n }\n\n get postToTap() {\n if (!this.iframe) {\n console.warn(\"TapIframeBridge: iframe not found\");\n }\n return super.postMessage;\n }\n\n listenToTap = super.on;\n\n async performHandshake(\n config: ChatInitConfig,\n options?: HandshakeOptions\n ): Promise<ChatInitiatedMessage> {\n if (!this.iframe) {\n throw new Error(\"TapIframeBridge: iframe not available for handshake\");\n }\n\n const handshake = new IframeHandshake(\n () => this.getMessageTarget(),\n () => this.getTargetOrigin(),\n (event) => this.isValidOrigin(event)\n );\n\n // Construct the ChatInitMessage\n const chatInitMessage: ChatInitMessage = {\n type: CHAT_INIT,\n hostClientUrl: this.hostClientUrl,\n pluginKey: this.pluginKey,\n chatApiParams: config.chatApiParams,\n theme: config.customStyles,\n };\n\n try {\n return await handshake.execute(chatInitMessage, options);\n } catch (error) {\n // Re-throw with additional context\n if (error instanceof Error) {\n throw new Error(`TapIframeBridge handshake failed: ${error.message}`);\n }\n throw error;\n }\n }\n}\n","import type { TapIframeBridge } from \"../tap-iframe-bridge\";\nimport type { AlarmMessageInstanceType } from \"../../types\";\nimport { PopUpOpenMessage } from \"@coxwave/tap-messages\";\n\nexport class EventManager {\n constructor(private iframeBridge: TapIframeBridge) {}\n\n onTimelineSeek(handler: (clipPlayHead: number, clipId: string) => void) {\n this.iframeBridge.listenToTap(\"timeline:seek\", (data) =>\n handler(data.clipPlayHead, data.clipId)\n );\n }\n\n onChatOpened(handler: () => void) {\n this.iframeBridge.listenToTap(\"chat:opened\", handler);\n }\n\n onChatClosed(handler: () => void) {\n this.iframeBridge.listenToTap(\"chat:closed\", handler);\n }\n\n onChatInitiated(handler: () => void) {\n this.iframeBridge.listenToTap(\"chat:initiated\", handler);\n }\n\n onAlarmFadeIn(handler: (messageInfo: AlarmMessageInstanceType) => void) {\n this.iframeBridge.listenToTap(\"alarm:fadeIn\", (data) => {\n handler(data.messageInfo);\n });\n }\n\n onPopUpOpen(handler: (popUpInfo: PopUpOpenMessage[\"popUpInfo\"]) => void) {\n this.iframeBridge.listenToTap(\"popUp:open\", (data) => {\n handler(data.popUpInfo);\n });\n }\n\n onPdfOpen(handler: () => void) {\n this.iframeBridge.listenToTap(\"pdf:open\", handler);\n }\n\n onPdfClose(handler: () => void) {\n this.iframeBridge.listenToTap(\"pdf:close\", handler);\n }\n}\n","import 'popUpImage/popUpImage.css.ts.vanilla.css?source=#H4sIAAAAAAAAE7VU7Y7bIBD8n6dYqap0lUKEXSd1uZfoK2B77dBgQIDPzlX37hX4o07qXq9qK0tY7AIzOztw6Lu0aU8Uvu0AelH5M4OE0vePO4BWKDKFWj6QUiuPyoeM54VEIvlVd54B77wO0ULbCi0ptZTcOGTg0HDLPa6SzvBSqIYB/RFkQA+ZGcBpKSqwTcEfkiTfwzik+R7oIUk/rE6xvBKdY5CbIUT1E9pa6n5FhZeXxupOVYGOtgze1XUdMmVnXZgbLZRH+7h72R1GDZKowR9TMryqYkUJHdlsYafhi8rh4AmXolEMJNZRzVorT2reCnll8MWiR1VxW0W20wH0c/iWxU48I4MkHQFjqEfRnD2DI43K9mfhMaqNDJS2LZdrpUhvuWFQWOQX0usRLPxJDN1mFoXSf6TQL6raluB3BWdTwaNRa+HXRg2+nTIZndD/izQfozRGO+GFVgwsSu7FE24bwjbFQ3qke5iHV8y9qHdndnKd7b6QyCKJSjgj+ZVBLTHuiHYjwmPrGJQ42h7ga+e8qK+zXAyiJKRA3yOqFTQptPe6ZZAFBgvaMaLNvcz48XjKbwinZoDTqmO3TbyrNhujz0SoCofglVd9sbA4RRZ323665G9XZfvB+8sqg88Uvq2gT+NTfGvS4MnVmny70fP7PWGfpxsyz1tuG6Fuu7lVWjiOuLMV6hLf6ZfvG7kHlyUGAAA=';\nexport var codeBlockContainer = 'wu2gm63';\nexport var copyButton = 'wu2gm66';\nexport var copyButtonText = 'wu2gm67';\nexport var defaultIcon = 'wu2gm68';\nexport var languageBadge = 'wu2gm65';\nexport var pluginHeader = 'wu2gm64';\nexport var pluginTable = 'wu2gm60';\nexport var pluginTd = 'wu2gm62';\nexport var pluginTh = 'wu2gm61';","import { ChatBodyType } from \"../types\";\nimport * as styles from \"./popUpImage.css\";\n\nfunction showPopupWithHtml({\n htmlString,\n callback,\n customStyles,\n}: {\n htmlString: string;\n callback: () => void;\n customStyles?: ChatBodyType;\n}) {\n // 🔹 스타일 태그 생성 및 삽입\n // const styleElement = document.createElement(\"style\");\n // styleElement.setAttribute(\"data-popup-style\", \"true\"); // 식별자\n // styleElement.innerHTML = styles;\n // document.head.appendChild(styleElement);\n\n // 백드롭 레이어\n const overlay = document.createElement(\"div\");\n overlay.style.position = \"fixed\";\n overlay.style.top = \"0\";\n overlay.style.left = \"0\";\n overlay.style.width = \"100vw\";\n overlay.style.height = \"100vh\";\n overlay.style.background = \"rgba(0, 0, 0, 0.4)\";\n overlay.style.zIndex = \"10000002\";\n\n // 팝업 컨테이너\n const popup = document.createElement(\"div\");\n popup.style.position = \"fixed\";\n popup.style.display = \"flex\";\n popup.style.flexDirection = \"column\";\n\n // ✅ right 계산\n const basePadding = 15;\n let computedRight = basePadding;\n\n // 너비 합\n if (customStyles?.width) {\n const numericWidth = parseFloat(customStyles.width); // 단위 제거 (390 from \"390px\", 80 from \"80%\")\n const unit = customStyles.width.match(/[a-zA-Z%]+/)?.[0]; // px, %, rem 등 추출\n\n if (!isNaN(numericWidth) && unit === \"px\") {\n computedRight += numericWidth;\n }\n } else {\n computedRight += 340;\n }\n\n // 오름쪽 포지션 합\n if (customStyles?.position?.right) {\n const numericRight = parseFloat(customStyles?.position?.right); // 단위 제거 (390 from \"390px\", 80 from \"80%\")\n const unit = customStyles?.position?.right.match(/[a-zA-Z%]+/)?.[0]; // px, %, rem 등 추출\n\n if (!isNaN(numericRight) && unit === \"px\") {\n computedRight += numericRight;\n }\n } else {\n computedRight = computedRight + 24;\n }\n\n popup.style.top = customStyles?.position?.top ?? \"50px\";\n popup.style.right = `${computedRight}px`;\n popup.style.left = customStyles?.position?.left ?? \"unset\";\n popup.style.bottom = customStyles?.position?.bottom ?? \"unset\";\n\n popup.style.maxWidth = \"calc(100vw - 100px)\";\n popup.style.maxHeight = customStyles?.height ?? \"calc(100vh - 116px)\";\n popup.style.overflow = \"auto\";\n popup.style.background = \"#fff\";\n popup.style.padding = \"20px\";\n popup.style.border = \"1px solid #ccc\";\n popup.style.boxShadow = \"0 4px 20px rgba(0,0,0,0.2)\";\n popup.style.zIndex = \"10000003\";\n popup.style.borderRadius = \"8px\";\n\n // 팝업 내용\n const wrapper = document.createElement(\"div\");\n wrapper.innerHTML = htmlString;\n\n // 백드롭 클릭 시 닫기\n overlay.addEventListener(\"click\", () => {\n document.body.removeChild(overlay);\n document.body.removeChild(popup);\n // document.head.removeChild(styleElement);\n callback();\n });\n\n // 팝업 내부 클릭 시 이벤트 전파 막기\n popup.addEventListener(\"click\", (e) => {\n e.stopPropagation();\n });\n\n // 조립 및 삽입\n popup.appendChild(wrapper);\n document.body.appendChild(overlay);\n document.body.appendChild(popup);\n\n // 복사 버튼 (만약 있을 시)\n const button = document.querySelector(`.${styles.copyButton}`);\n const codeBlock = document.querySelector(\".cw-plugin-code-block\");\n const defaultIcon = document.querySelector(`.${styles.defaultIcon}`);\n const copyButtonText = document.querySelector(`.${styles.copyButtonText}`);\n\n if (button && codeBlock && defaultIcon && copyButtonText) {\n button.addEventListener(\"click\", () => {\n navigator.clipboard.writeText(codeBlock.textContent ?? \"\");\n\n // 아이콘 숨기기\n (defaultIcon as HTMLElement).style.display = \"none\";\n\n // 텍스트 변경\n copyButtonText.textContent = \"복사됨\";\n\n setTimeout(() => {\n // 텍스트 원복\n copyButtonText.textContent = \"복사\";\n (defaultIcon as HTMLElement).style.display = \"inline\";\n }, 1000);\n });\n }\n}\n\nexport default showPopupWithHtml;\n","import * as v from \"valibot\";\nimport { GAEventSchema } from \"@coxwave/tap-messages\";\n\nclass InitGA {\n static isInitialized = false;\n\n constructor({ gaId }: { gaId: string }) {\n if (!InitGA.isInitialized) {\n this.init(gaId);\n InitGA.isInitialized = true;\n }\n }\n\n init(gaId: string) {\n if (\n !document.querySelector(\n `script[src=\"https://www.googletagmanager.com/gtag/js?id=${gaId}\"]`\n )\n ) {\n const gtagScript = document.createElement(\"script\");\n gtagScript.async = true;\n gtagScript.src = `https://www.googletagmanager.com/gtag/js?id=${gaId}`;\n document.head.appendChild(gtagScript);\n }\n\n if (typeof window.gtag !== \"function\") {\n const inlineScript = document.createElement(\"script\");\n inlineScript.innerHTML = `\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n gtag('config', '${gaId}');\n `;\n document.head.appendChild(inlineScript);\n }\n\n // TODO(domuk-k): GA 원천,형식 파악 후 개선\n window.addEventListener(\"message\", (event) => {\n try {\n const data =\n typeof event.data === \"string\" ? JSON.parse(event.data) : event.data;\n\n // Validate GA event message\n const gaEvent = v.parse(GAEventSchema, data);\n\n if (typeof window.gtag === \"function\") {\n window.gtag(\"event\", gaEvent.payload.action ?? \"click\", {\n event_category: gaEvent.payload.category ?? \"Default\",\n event_label: gaEvent.payload.label,\n value: gaEvent.payload.value,\n fastCampus_user_id: gaEvent.payload.fastCampus_user_id,\n course_id: gaEvent.payload.course_id,\n ...gaEvent.payload,\n });\n }\n } catch (error) {\n // Invalid message or JSON parsing error - ignore silently\n }\n });\n }\n}\n\nexport default InitGA;\n","import ChatBodyMaker from \"./chatBody\";\nimport FloatingButtonMaker from \"./floatingButton\";\nimport { TapIframeBridge } from \"./services/tap-iframe-bridge\";\nimport { EventManager } from \"./services/event-manager\";\nimport showPopupWithHtml from \"./popUpImage\";\n\nimport InitGA from \"./ga\";\n\nimport {\n AlarmMessageInstanceType,\n ChatApiParamsType,\n TapSDKType,\n CustomStylesType,\n ShortcutKeyType,\n SeekTimelineParamsType,\n} from \"./types\";\n\nclass TapSDK {\n private pluginKey: string;\n private iframeBridge: TapIframeBridge;\n public events: EventManager;\n\n private chatBody: HTMLElement | null = null;\n private chatBodyMaker: ChatBodyMaker;\n private floatingButtonMaker: FloatingButtonMaker;\n private shortcutKey: ShortcutKeyType = {\n openChat: { key: \"/\", modifier: \"\" },\n sendChat: { key: \"Enter\", modifier: \"\" },\n };\n\n private isProd: boolean;\n private isLocal: boolean;\n\n private isOpen: boolean;\n private isPdfOpen: boolean;\n\n constructor({ pluginKey, isProd = false, isLocal = false }: TapSDKType) {\n // protocol\n this.pluginKey = pluginKey;\n this.iframeBridge = new TapIframeBridge({\n hostClientUrl: window.location.origin,\n pluginKey: this.pluginKey,\n });\n\n // events\n this.events = new EventManager(this.iframeBridge);\n\n // render\n this.floatingButtonMaker = new FloatingButtonMaker();\n this.chatBodyMaker = new ChatBodyMaker();\n\n // ga log\n this.isProd = isProd;\n this.isLocal = isLocal;\n\n // state\n this.isOpen = false;\n this.isPdfOpen = false;\n }\n\n #isClient() {\n return typeof window !== \"undefined\" && typeof document !== \"undefined\";\n }\n\n private setIsOpen(isOpen: boolean) {\n this.isOpen = isOpen;\n }\n\n private setIsPdfOpen(isPdfOpen: boolean) {\n this.isPdfOpen = isPdfOpen;\n }\n\n seekTimeline({ clipId, clipPlayHead }: SeekTimelineParamsType) {\n this.iframeBridge.postToTap({\n type: \"timeline:seek\",\n clipId,\n clipPlayHead,\n });\n }\n\n async initChat({\n chatApiParams,\n customStyles,\n shortcutKey,\n }: {\n chatApiParams: ChatApiParamsType;\n customStyles?: CustomStylesType;\n shortcutKey?: ShortcutKeyType;\n }) {\n if (!this.#isClient()) throw new Error(\"not client\");\n\n this.shortcutKey = {\n openChat: shortcutKey?.openChat ?? this.shortcutKey.openChat,\n sendChat: shortcutKey?.sendChat ?? this.shortcutKey.sendChat,\n };\n\n // chat body render\n if (!this.chatBody) {\n this.chatBody = this.chatBodyMaker.createChatBody({\n ...(customStyles?.chatBody && {\n customChatBody: customStyles.chatBody,\n }),\n });\n }\n\n // chat iframe\n if (!this.iframeBridge.hasIframe()) {\n await this.iframeBridge.renderIframe({\n chatBody: this.chatBody,\n isProd: this.isProd,\n isLocal: this.isLocal,\n });\n // Handshake will be performed after iframe load\n }\n try {\n const initiatedMessage = await this.iframeBridge.performHandshake(\n {\n chatApiParams,\n customStyles,\n },\n {\n retryInterval: 500,\n maxRetries: 10,\n timeout: 10000,\n }\n );\n\n // Initialize GA with the received gaId\n new InitGA({ gaId: initiatedMessage.gaId });\n } catch (error) {\n console.error(\"Handshake failed:\", error);\n throw new Error(\n `Chat initialization failed: ${error instanceof Error ? error.message : \"Unknown error\"}`\n );\n }\n\n // floating button render\n this.floatingButtonMaker.render({\n ...(customStyles?.floatingButton && {\n customFloatingButton: customStyles.floatingButton,\n }),\n });\n this.floatingButtonMaker.addClickEvent({\n callback: () => {\n this.iframeBridge.postToTap({\n type: this.isOpen ? \"chat:close\" : \"chat:open\",\n });\n },\n });\n\n this.floatingButtonMaker.addAlarmClickEvent({\n callback: (messageInfo: AlarmMessageInstanceType) => {\n this.iframeBridge.postToTap({ type: \"chat:open\", isAlarm: true });\n this.iframeBridge.postToTap({ type: \"alarm:click\", messageInfo });\n },\n });\n\n this.iframeBridge.listenToTap(\"chat:opened\", () => {\n this.setIsOpen(true);\n this.chatBodyMaker.toggleVisibility(this.isOpen);\n this.floatingButtonMaker.alarmRemove();\n });\n this.iframeBridge.listenToTap(\"chat:closed\", () => {\n this.setIsOpen(false);\n this.chatBodyMaker.toggleVisibility(this.isOpen);\n });\n\n // alarm\n this.iframeBridge.listenToTap(\"alarm:fadeIn\", (data) => {\n if (this.isOpen) return;\n this.floatingButtonMaker.alarmFadeIn(data.messageInfo);\n });\n\n // popUp\n this.iframeBridge.listenToTap(\"popUp:open\", (data) => {\n showPopupWithHtml({\n htmlString: data.popUpInfo.html,\n callback: () => this.iframeBridge.postToTap({ type: \"popUp:close\" }),\n ...(customStyles?.chatBody && { customStyles: customStyles.chatBody }),\n });\n });\n\n // pdf Open\n this.iframeBridge.listenToTap(\"pdf:open\", () => {\n this.setIsPdfOpen(true);\n this.chatBodyMaker.resizeChatBody(this.isPdfOpen, customStyles?.chatBody);\n this.iframeBridge.postToTap({ type: \"pdf:enlarged\" });\n });\n this.iframeBridge.listenToTap(\"pdf:close\", () => {\n this.setIsPdfOpen(false);\n this.chatBodyMaker.resizeChatBody(this.isPdfOpen, customStyles?.chatBody);\n this.iframeBridge.postToTap({ type: \"pdf:shrinked\" });\n });\n\n // if dev, attach alaram:fadeIn event\n if (this.isLocal) {\n this.iframeBridge.listenToTap(\"alarm:fadeIn\", (data) => {\n this.floatingButtonMaker.alarmFadeIn(data.messageInfo);\n });\n }\n }\n\n removeChat() {\n if (!this.chatBody) throw new Error(\"chatBody is not initialized\");\n\n this.chatBodyMaker.removeChatBody();\n this.floatingButtonMaker.alarmRemove();\n this.iframeBridge.removeIframe();\n this.chatBody = null;\n this.isOpen = false;\n }\n\n /**\n * @deprecated use `seekTimeline` method. gotta be expired at v1.0.0\n */\n postChatInfo({\n clipId,\n clipPlayHead,\n }: {\n clipId: string;\n clipPlayHead: number;\n }) {\n this.seekTimeline({ clipId, clipPlayHead });\n }\n\n /**\n * @deprecated use `events.onTimelineSeek` method. gotta be expired at v1.0.0\n */\n getTimelineInfo({\n callback,\n }: {\n callback: (clipPlayHead: number, clipId: string) => void;\n }) {\n this.events.onTimelineSeek(callback);\n }\n}\n\nexport default TapSDK;\n"]}
1
+ {"version":3,"sources":["../chatBody/chatBody.css.ts","../chatBody/index.ts","../floatingButton/alarm/styles/alarm.css.ts","../floatingButton/alarm/index.ts","../floatingButton/index.ts","../../tap-messages/dist/index.js","../services/common/messenger.ts","../services/iframe-handshake/index.ts","../services/tap-iframe-bridge/index.ts","../services/event-manager/index.ts","../popUpImage/popUpImage.css.ts","../popUpImage/index.ts","../ga/index.ts","../index.ts"],"names":["chatBody","hidden","visible","ChatBodyMaker","__publicField","customChatBody","show","handleAnimationEnd","isEnlarged","baseWidthPx","baseWidth","enlargedWidth","newWidth","chatBody_default","alarmContainer","alarmCorner","alarmCornerBase","alarmCornerContainer","circle","circleBase","circleText","closeIcon","text","textContainer","textContainerBase","wrapper","_Alarm_instances","renderCornerSvg_fn","renderTextAndCloseContainer_fn","renderTextContainer_fn","appendCloseButton_fn","renderCloseIconSvg_fn","Alarm","__privateAdd","rootElement","e","__privateMethod","textAndCloseContainer","messageInfo","callback","parentElement","svg","path","textInCircle","alarm_default","_isSameKeyboardKey","FloatingButtonMaker","event","targetKey","customFloatingButton","openChatShortcutKey","__privateGet","floatingButton_default","CHAT_INIT","CHAT_INITIATED","ChatInitiatedSchema","GAEventSchema","Messenger","messageType","listenerCallback","data","messageData","type","error","existingListeners","ls","l","message","target","HandshakeError","reason","details","originalError","IframeHandshake","getTargetWindow","getTargetOrigin","isValidOrigin","options","timeout","maxRetries","retryInterval","resolve","reject","retryCount","timeoutId","cleanup","handleAbort","validated","ce","attemptHandshake","targetWindow","TapIframeBridge","hostClientUrl","pluginKey","eventOrigin","iframeSrcOrigin","isProd","isLocal","config","handshake","chatInitMessage","EventManager","iframeBridge","handler","copyButton","copyButtonText","defaultIcon","showPopupWithHtml","htmlString","customStyles","overlay","popup","computedRight","numericWidth","unit","numericRight","button","codeBlock","popUpImage_default","_InitGA","gaId","gtagScript","inlineScript","gaEvent","fe","InitGA","ga_default","_TapSDK_instances","isClient_fn","TapSDK","isOpen","isPdfOpen","clipId","clipPlayHead","chatApiParams","shortcutKey","initiatedMessage","index_default"],"mappings":"ufACO,IAAIA,CAAAA,CAAW,YACXC,CAAAA,CAAS,WAAA,CAEb,IAAIC,CAAAA,CAAU,WAAA,CCDrB,IAAMC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HMgZWFzZSBmb3J3YXJkczsKICBwb2ludGVyLWV2ZW50czogbm9uZTsKfQouXzFtbHY0bWU1IHsKICBib3JkZXI6IG5vbmUgIWltcG9ydGFudDsKfQ==';\nexport var chatBody = '_1mlv4me2';\nexport var hidden = '_1mlv4me4';\nexport var iframe = '_1mlv4me5';\nexport var visible = '_1mlv4me3';","import { ChatBodyType } from \"../types\";\nimport * as styles from \"./chatBody.css\";\n\nclass ChatBodyMaker {\n private chatBody: HTMLElement | null = null;\n\n constructor() {\n this.chatBody = null;\n }\n\n createChatBody({ customChatBody }: { customChatBody?: ChatBodyType }) {\n if (this.chatBody) return this.chatBody;\n\n this.chatBody = document.createElement(\"div\");\n this.chatBody.id = \"cw-chat-body\";\n this.chatBody.className = styles.chatBody;\n this.chatBody.style.setProperty(\"z-index\", \"10000001\", \"important\");\n this.chatBody.style.setProperty(\"position\", \"fixed\", \"important\");\n\n Object.assign(this.chatBody.style, {\n top: customChatBody?.position?.top ?? \"50px\",\n right: customChatBody?.position?.right ?? \"24px\",\n left: customChatBody?.position?.left ?? \"unset\",\n bottom: customChatBody?.position?.bottom ?? \"unset\",\n width: customChatBody?.width ?? \"340px\",\n height: customChatBody?.height ?? \"calc(100% - 116px)\",\n overflow: \"hidden\",\n backgroundColor: \"transparent\",\n borderRadius: customChatBody?.borderRadius ?? \"16px\",\n boxShadow: `\n rgba(255, 255, 255, 0.12) 0px 0px 2px 0px inset,\n rgba(0, 0, 0, 0.05) 0px 0px 2px 1px,\n rgba(0, 0, 0, 0.3) 0px 12px 60px\n `,\n willChange: \"transform, opacity, width, max-height, max-width\",\n });\n\n document.body.appendChild(this.chatBody);\n return this.chatBody;\n }\n\n toggleVisibility(show: boolean) {\n if (!this.chatBody) return;\n\n // 기존 클래스 제거\n this.chatBody.classList.remove(styles.visible, styles.hidden);\n\n // display 초기화\n this.chatBody.style.display = \"block\";\n\n // animationend 핸들러 정의\n const handleAnimationEnd = () => {\n if (!this.chatBody) return;\n\n // hidden 상태일 경우 display: none 설정\n if (this.chatBody.classList.contains(styles.hidden)) {\n this.chatBody.style.display = \"none\";\n }\n\n // 이벤트 리스너 제거 (한 번만 실행되도록)\n this.chatBody.removeEventListener(\"animationend\", handleAnimationEnd);\n };\n\n // 애니메이션 종료 시 display 제어\n this.chatBody.addEventListener(\"animationend\", handleAnimationEnd);\n\n // requestAnimationFrame을 통해 다음 프레임에서 클래스 적용\n requestAnimationFrame(() => {\n this.chatBody?.classList.add(show ? styles.visible : styles.hidden);\n });\n }\n\n removeChatBody() {\n if (this.chatBody) {\n this.chatBody.remove();\n this.chatBody = null;\n }\n }\n\n resizeChatBody(isEnlarged: boolean, customChatBody?: ChatBodyType) {\n if (!this.chatBody) return;\n\n const baseWidthPx = customChatBody?.width ?? \"340px\";\n const baseWidth = parseInt(baseWidthPx, 10);\n\n const enlargedWidth = (baseWidth / 3) * 10 - baseWidth;\n const newWidth = isEnlarged\n ? `${baseWidth + enlargedWidth}px`\n : `${baseWidth}px`;\n\n this.chatBody.style.width = newWidth;\n }\n}\n\nexport default ChatBodyMaker;\n","import 'floatingButton/alarm/styles/alarm.css.ts.vanilla.css?source=#H4sIAAAAAAAAE61Uy27bMBC8+ysWKAqkaBlI8iMxfWlzyK1A0X5AQYsrizFNCiQVyyny7wUpOtbDblK0J1s7u8vZmSU/b/FQGLZDCz8XD2m9nifwawKQvA8/ALpiuXAHCukqfFdaKIeG4CMqZymw2mmPPE8A5heqPJYmYzBpwefJdTw7DRnDI5RW6DP7dVzYSrIDhUJiswplVjihFQW2tlrWLhTtBXclhR1rSK6VQ+V81OmKQs5kfhV4fYR51XzwgBGb0sUTfGPChcG8bZtrWe+URx5q60RxOHakkKNn7CEmxUYR4XBnW2oEFQ/0GOdCbUg4OqsC5bw2Vht6nNiHnohQHBsKy+UyMDVMHeeKAkByPbWAzOKqo112VrujPUyJHWu7vPic3lootNkzw2230zR06qt9yZNO3zZ0ajMLbUY2jbTrirTWhqMhhnFRWwqPzFwR8j18xeCPr5/gNpp13tsNq6j3s8tlfp5L9IT6jpBmVQOL+OdVpj2fT/b/3QCeeRxiOkv6lBeB8prl243RteIk19Lvyrv0Jr1L77upN5dS778s7mZ33dTbkHrEi6IIO4aNI2Eg2l6AsP1aOVKwnZAHCt8MOlScGf4CWfGEFNJZq1UbcgeJfhHMjsmX6B7bOzVLwiZJoZCUMZYlbfm+FA6JrViOFCqDZG9YFQBtOFkbZFsKW8SKMBk660c0hdT7kEghZBCf3B12+YrrSdVANm0ZjO+tdcycFiod2MNC72heOli3dU/lsWF5Dx+7xFt8/Dq89eE5hSPDo9BD4Qf7miYx/qdniEkJyXU2foI4Lb0vXWUWUV6JhaNAbrK+ULNY0R984NgpHfvw8RF60yUp/qF20/Ur7Oq5sfvZg5NO6eVrV/Bk3hvvYPZf7uBFwsP5yv58a6nz7Wry/Bv1tBtfSwgAAA==';\nexport var alarmContainer = '_6j1ub51';\nexport var alarmCorner = {'default':'_6j1ub5b _6j1ub5a','call-to-action':'_6j1ub5c _6j1ub5a'};\nexport var alarmCornerBase = '_6j1ub5a';\nexport var alarmCornerContainer = '_6j1ub59';\nexport var circle = {'default':'_6j1ub5e _6j1ub5d','call-to-action':'_6j1ub5f _6j1ub5d'};\nexport var circleBase = '_6j1ub5d';\nexport var circleText = '_6j1ub5h';\nexport var closeIcon = '_6j1ub5g';\nexport var hidden = '_6j1ub53';\nexport var text = '_6j1ub58';\nexport var textContainer = {'default':'_6j1ub56 _6j1ub55','call-to-action':'_6j1ub57 _6j1ub55'};\nexport var textContainerBase = '_6j1ub55';\nexport var visible = '_6j1ub52';\nexport var wrapper = '_6j1ub54';","import * as styles from \"./styles/alarm.css\";\n\nimport { AlarmMessageInstanceType } from \"../../types\";\n\nclass Alarm {\n // 전체 fade in & out\n private container!: HTMLDivElement;\n private alarmTimeout!: ReturnType<typeof setTimeout>;\n\n // 색상\n private alarmCornerSVG!: HTMLImageElement | SVGElement;\n private textContainer!: HTMLDivElement;\n private circleElement!: HTMLDivElement;\n\n // 텍스트 내용\n private textInTextContainer!: HTMLSpanElement;\n private messageInfo!: AlarmMessageInstanceType;\n\n constructor() {}\n\n render({ rootElement }: { rootElement: HTMLElement }) {\n this.container = document.createElement(\"div\");\n this.container.id = \"alarm-container\";\n this.container.className = styles.alarmContainer;\n this.container.addEventListener(\"click\", (e) => {\n e.stopPropagation();\n });\n rootElement.appendChild(this.container);\n\n // 코너 아이콘 렌더링\n this.#renderCornerSvg(this.container);\n\n // 텍스트 컨테이너 렌더링\n const textAndCloseContainer = this.#renderTextAndCloseContainer(\n this.container,\n );\n\n // 닫기 버튼 렌더링\n this.#appendCloseButton(textAndCloseContainer);\n\n // 텍스트 컨테이너 렌더링\n this.#renderTextContainer(textAndCloseContainer);\n }\n\n fadeIn(messageInfo: AlarmMessageInstanceType) {\n // 타입에 따라 적절한 클래스 설정\n if (messageInfo.type === \"default\" || messageInfo.type === \"hourSpent\") {\n this.textContainer.className = styles.textContainer.default;\n this.alarmCornerSVG.setAttribute(\"class\", styles.alarmCorner.default);\n this.circleElement.className = styles.circle.default;\n } else {\n this.textContainer.className = styles.textContainer[\"call-to-action\"];\n this.alarmCornerSVG.setAttribute(\n \"class\",\n styles.alarmCorner[\"call-to-action\"],\n );\n this.circleElement.className = styles.circle[\"call-to-action\"];\n } // 스타일 제거 및 적용\n this.messageInfo = messageInfo;\n\n this.textInTextContainer.textContent = messageInfo.message;\n\n this.toggleVisibility(true);\n\n this.alarmTimeout = setTimeout(() => {\n this.toggleVisibility(false);\n }, 18 * 1000);\n }\n\n addClickEvent({\n callback,\n }: {\n callback: (messageInfo: AlarmMessageInstanceType) => void;\n }) {\n this.container.addEventListener(\"click\", () => {\n this.toggleVisibility(false);\n callback(this.messageInfo);\n });\n }\n\n toggleVisibility(show: boolean) {\n this.container.classList.remove(styles.visible, styles.hidden);\n\n requestAnimationFrame(() => {\n this.container?.classList.add(show ? styles.visible : styles.hidden);\n });\n }\n\n remove() {\n if (this.container) {\n this.toggleVisibility(false);\n }\n if (this.alarmTimeout) {\n clearTimeout(this.alarmTimeout);\n }\n }\n\n #renderCornerSvg(parentElement: HTMLElement) {\n const alarmCornerContainer = document.createElement(\"div\");\n alarmCornerContainer.className = styles.alarmCornerContainer;\n parentElement.appendChild(alarmCornerContainer);\n\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n svg.setAttribute(\"width\", \"11\");\n svg.setAttribute(\"height\", \"8\");\n svg.setAttribute(\"viewBox\", \"0 0 11 8\");\n svg.setAttribute(\"fill\", \"currentColor\");\n svg.setAttribute(\"class\", styles.alarmCornerBase);\n const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\n path.setAttribute(\"d\", \"M5.5 0L11.1292 8.25H-0.129165L5.5 0Z\");\n path.setAttribute(\"fill\", \"currentColor\");\n svg.appendChild(path);\n\n this.alarmCornerSVG = svg;\n\n alarmCornerContainer.appendChild(svg);\n }\n\n #renderTextAndCloseContainer(parentElement: HTMLElement) {\n const textAndCloseContainer = document.createElement(\"div\");\n textAndCloseContainer.className = styles.wrapper;\n parentElement.appendChild(textAndCloseContainer);\n\n return textAndCloseContainer;\n }\n\n #renderTextContainer(parentElement: HTMLDivElement) {\n this.textContainer = document.createElement(\"div\");\n this.textContainer.className = styles.textContainerBase;\n parentElement.appendChild(this.textContainer);\n\n this.textInTextContainer = document.createElement(\"span\");\n this.textInTextContainer.className = styles.text;\n this.textContainer.appendChild(this.textInTextContainer);\n }\n\n #appendCloseButton(parentElement: HTMLDivElement) {\n const circle = document.createElement(\"div\");\n circle.className = styles.circleBase;\n parentElement.appendChild(circle);\n\n circle.addEventListener(\"click\", (e) => {\n e.stopPropagation();\n this.remove();\n });\n\n const textInCircle = document.createElement(\"span\");\n textInCircle.className = styles.circleText;\n circle.appendChild(textInCircle);\n textInCircle.textContent = \"알림 끄기\";\n\n this.#renderCloseIconSvg(circle);\n\n this.circleElement = circle;\n }\n\n #renderCloseIconSvg(parentElement: HTMLDivElement) {\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n svg.setAttribute(\"width\", \"10\");\n svg.setAttribute(\"height\", \"10\");\n svg.setAttribute(\"viewBox\", \"0 0 14 14\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"class\", styles.closeIcon);\n\n const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\n path.setAttribute(\"d\", \"M1 1L13 13M13 1L1 13\");\n path.setAttribute(\"stroke\", \"currentColor\");\n path.setAttribute(\"stroke-width\", \"2\");\n path.setAttribute(\"stroke-linecap\", \"round\");\n svg.appendChild(path);\n\n parentElement.appendChild(svg);\n }\n}\n\nexport default Alarm;\n","import Alarm from \"./alarm\";\n\nimport {\n AlarmMessageInstanceType,\n FloatingButtonType,\n ShortcutKeyPropertiesType,\n} from \"../types\";\n\nclass FloatingButtonMaker {\n private customFloatingButton: FloatingButtonType | undefined;\n private floatingButton!: HTMLElement;\n private alarm: Alarm;\n\n constructor() {\n this.alarm = new Alarm();\n }\n\n render({\n customFloatingButton,\n }: {\n customFloatingButton?: FloatingButtonType;\n }) {\n this.customFloatingButton = customFloatingButton;\n\n if (\n this.customFloatingButton?.isInElement &&\n this.customFloatingButton?.parentElementId\n ) {\n const parentElement = document.getElementById(\n this.customFloatingButton.parentElementId,\n );\n parentElement?.style.setProperty(\"position\", \"relative\", \"important\");\n parentElement?.style.setProperty(\"z-index\", \"10000001\", \"important\");\n\n this.floatingButton = parentElement as HTMLElement; // 부모 엘리먼트 저장\n } else {\n let rootElement = document.getElementById(\"cw-plugin\");\n\n if (!rootElement) {\n rootElement = document.createElement(\"button\");\n rootElement.id = \"cw-plugin\";\n\n rootElement.style.zIndex = \"10000001\";\n rootElement.style.setProperty(\"z-index\", \"10000001\", \"important\");\n rootElement.style.setProperty(\"position\", \"fixed\", \"important\");\n rootElement.style.width = \"50px\";\n rootElement.style.height = \"50px\";\n rootElement.style.borderRadius = \"50%\";\n rootElement.style.backgroundColor = \"#000\";\n\n document.body.appendChild(rootElement);\n\n this.floatingButton = rootElement; // 루트 엘리먼트 저장\n }\n }\n\n this.alarm.render({ rootElement: this.floatingButton });\n return this.floatingButton;\n }\n\n addClickEvent({ callback }: { callback: () => void }) {\n if (!this.floatingButton) throw new Error(\"not initialized\");\n\n this.floatingButton.addEventListener(\"click\", () => {\n callback();\n });\n }\n\n addAlarmClickEvent({\n callback,\n }: {\n callback: (messageInfo: AlarmMessageInstanceType) => void;\n }) {\n this.alarm.addClickEvent({ callback });\n }\n\n addShortCutEvent({\n openChatShortcutKey,\n callback,\n }: {\n openChatShortcutKey: ShortcutKeyPropertiesType;\n callback: () => void;\n }) {\n if (!this.floatingButton) throw new Error(\"not initialized\");\n\n window.addEventListener(\"keydown\", (event) => {\n if (\n this.#isSameKeyboardKey(event, openChatShortcutKey.key) &&\n (openChatShortcutKey.modifier\n ? event[openChatShortcutKey.modifier]\n : true)\n ) {\n callback();\n }\n });\n }\n\n alarmFadeIn(messageInfo: AlarmMessageInstanceType) {\n this.alarm.fadeIn(messageInfo);\n }\n\n alarmRemove() {\n this.alarm.remove();\n }\n\n #isSameKeyboardKey = (event: KeyboardEvent, targetKey: string): boolean => {\n if (event.key === targetKey) {\n return true;\n }\n\n if (!event.code.startsWith(\"Key\")) {\n return false;\n }\n\n const physicalKey = event.code.slice(3).toLowerCase();\n\n return physicalKey === targetKey;\n };\n}\n\nexport default FloatingButtonMaker;\n","// src/constant.ts\nvar CHAT_INIT = \"chat:init\";\nvar CHAT_INITIATED = \"chat:initiated\";\nvar CHAT_OPEN = \"chat:open\";\nvar CHAT_OPENED = \"chat:opened\";\nvar CHAT_CLOSE = \"chat:close\";\nvar CHAT_CLOSED = \"chat:closed\";\nvar TIMELINE_SEEK = \"timeline:seek\";\nvar ALARM_CLICK = \"alarm:click\";\nvar ALARM_FADE_IN = \"alarm:fadeIn\";\nvar POPUP_OPEN = \"popUp:open\";\nvar POPUP_CLOSE = \"popUp:close\";\nvar PDF_OPEN = \"pdf:open\";\nvar PDF_CLOSE = \"pdf:close\";\nvar PDF_ENLARGED = \"pdf:enlarged\";\nvar PDF_SHRINKED = \"pdf:shrinked\";\n\n// src/schema.ts\nimport * as v from \"valibot\";\nvar ChatInitiatedSchema = v.object({\n type: v.literal(CHAT_INITIATED),\n gaId: v.string()\n});\nvar GAEventSchema = v.object({\n type: v.literal(\"GA_EVENT\"),\n payload: v.record(v.string(), v.any())\n // 유연한 payload 구조\n});\nexport {\n ALARM_CLICK,\n ALARM_FADE_IN,\n CHAT_CLOSE,\n CHAT_CLOSED,\n CHAT_INIT,\n CHAT_INITIATED,\n CHAT_OPEN,\n CHAT_OPENED,\n ChatInitiatedSchema,\n GAEventSchema,\n PDF_CLOSE,\n PDF_ENLARGED,\n PDF_OPEN,\n PDF_SHRINKED,\n POPUP_CLOSE,\n POPUP_OPEN,\n TIMELINE_SEEK\n};\n","// 통합 메시지 송수신 관리 기본 클래스\ntype Unsubscribe = () => void;\n\ntype Message = {\n type: string;\n [key: string]: any;\n};\n\nexport abstract class Messenger<\n TToTargetMessages extends Message = Message,\n TFromTargetMessage extends Message = Message,\n> {\n protected listeners: Map<\n TFromTargetMessage[\"type\"],\n ((event: MessageEvent) => void)[]\n > = new Map();\n protected unifiedMessageHandler: ((event: MessageEvent) => void) | null =\n null;\n\n // 통합 리스너 등록/해지 API\n protected on<T extends TFromTargetMessage[\"type\"]>(\n messageType: T,\n callback: (data: Extract<TFromTargetMessage, { type: T }>) => void\n ): Unsubscribe {\n const listenerCallback = (event: MessageEvent) => {\n if (!this.isValidOrigin(event)) return;\n\n try {\n const data = event.data;\n\n // Handle both direct objects and JSON strings for backward compatibility\n const messageData = typeof data === 'string' ? JSON.parse(data) : data;\n const { type } = messageData;\n\n if (type === messageType) {\n callback(messageData);\n }\n } catch (error) {\n console.warn(\"Messenger: Failed to parse message data\", error);\n }\n };\n\n // 해당 메시지 타입의 리스너 배열 가져오거나 생성\n const existingListeners = this.listeners.get(messageType) || [];\n existingListeners.push(listenerCallback);\n this.listeners.set(messageType, existingListeners);\n\n // 통합 메시지 핸들러가 없으면 등록\n if (!this.unifiedMessageHandler) {\n this.unifiedMessageHandler = (event: MessageEvent) => {\n this.listeners.forEach((ls) => ls.forEach((l) => l(event)));\n };\n window.addEventListener(\"message\", this.unifiedMessageHandler);\n }\n\n return () => {\n if (this.unifiedMessageHandler) {\n window.removeEventListener(\"message\", this.unifiedMessageHandler);\n this.unifiedMessageHandler = null;\n }\n };\n }\n\n public removeListener(messageType: TFromTargetMessage[\"type\"]): void {\n this.listeners.delete(messageType);\n }\n\n public removeAllListeners(): void {\n this.listeners.clear();\n\n if (this.unifiedMessageHandler) {\n window.removeEventListener(\"message\", this.unifiedMessageHandler);\n this.unifiedMessageHandler = null;\n }\n }\n\n // 통합 메시지 전송 API\n public postMessage(message: TToTargetMessages): boolean {\n try {\n const target = this.getMessageTarget();\n if (!target) {\n console.warn(\"Messenger: Message target not available\");\n return false;\n }\n\n target.postMessage(message, this.getTargetOrigin());\n return true;\n } catch (error) {\n console.error(\"Messenger: postMessage failed\", error);\n return false;\n }\n }\n\n // 하위 클래스에서 구현해야 하는 추상 메서드들\n protected abstract isValidOrigin(event: MessageEvent): boolean;\n protected abstract getMessageTarget(): Window | null;\n protected abstract getTargetOrigin(): string;\n}\n","import * as v from \"valibot\";\nimport type {\n ChatInitiatedMessage,\n} from \"@coxwave/tap-messages\";\nimport { ChatInitiatedSchema } from \"@coxwave/tap-messages\";\n\nexport interface HandshakeOptions {\n timeout?: number;\n maxRetries?: number;\n retryInterval?: number;\n}\n\nexport enum HandshakeFailureReason {\n TIMEOUT = \"TIMEOUT\",\n MAX_RETRIES_EXCEEDED = \"MAX_RETRIES_EXCEEDED\",\n INVALID_MESSAGE = \"INVALID_MESSAGE\",\n NO_TARGET_WINDOW = \"NO_TARGET_WINDOW\",\n MESSAGE_SEND_FAILED = \"MESSAGE_SEND_FAILED\",\n}\n\nexport class HandshakeError extends Error {\n constructor(\n public reason: HandshakeFailureReason,\n public details?: string,\n public originalError?: Error\n ) {\n super(`Handshake failed: ${reason}${details ? ` - ${details}` : \"\"}`);\n this.name = \"HandshakeError\";\n }\n}\n\nexport class IframeHandshake {\n private abortController: AbortController | null = null;\n private messageListener: ((event: MessageEvent) => void) | null = null;\n\n constructor(\n private getTargetWindow: () => Window | null,\n private getTargetOrigin: () => string,\n private isValidOrigin: (event: MessageEvent) => boolean\n ) {}\n\n async execute(\n message: any,\n options: HandshakeOptions = {}\n ): Promise<ChatInitiatedMessage> {\n const { timeout = 10000, maxRetries = 10, retryInterval = 500 } = options;\n\n // Cancel any existing handshake\n this.cancel();\n\n this.abortController = new AbortController();\n\n return new Promise((resolve, reject) => {\n let retryCount = 0;\n let timeoutId: ReturnType<typeof setTimeout>;\n\n const cleanup = () => {\n if (timeoutId) clearTimeout(timeoutId);\n if (this.messageListener) {\n window.removeEventListener(\"message\", this.messageListener);\n this.messageListener = null;\n }\n };\n\n const handleAbort = () => {\n cleanup();\n reject(\n new HandshakeError(\n HandshakeFailureReason.TIMEOUT,\n \"Handshake was cancelled\"\n )\n );\n };\n\n // Set up abort handling\n this.abortController?.signal.addEventListener(\"abort\", handleAbort);\n\n // Set up message listener\n this.messageListener = (event: MessageEvent) => {\n if (!this.isValidOrigin(event)) return;\n\n try {\n const data = event.data;\n\n // Handle both direct objects and JSON strings for backward compatibility\n const messageData =\n typeof data === \"string\" ? JSON.parse(data) : data;\n\n // Validate the message\n try {\n const validated = v.safeParse(ChatInitiatedSchema, messageData);\n cleanup();\n this.abortController = null;\n resolve(validated.output as ChatInitiatedMessage);\n return;\n } catch (validationError) {\n // Invalid message - continue waiting\n }\n } catch (error) {\n // Invalid JSON or parsing error - continue waiting\n console.warn(\"Failed to parse handshake message:\", error);\n }\n };\n\n window.addEventListener(\"message\", this.messageListener);\n\n // Set overall timeout\n timeoutId = setTimeout(() => {\n cleanup();\n this.abortController = null;\n reject(\n new HandshakeError(\n HandshakeFailureReason.TIMEOUT,\n `No valid response received within ${timeout}ms`\n )\n );\n }, timeout);\n\n // Retry mechanism\n const attemptHandshake = () => {\n if (this.abortController?.signal.aborted) return;\n\n try {\n const targetWindow = this.getTargetWindow();\n\n if (!targetWindow) {\n throw new HandshakeError(\n HandshakeFailureReason.NO_TARGET_WINDOW,\n \"Target iframe window is not available\"\n );\n }\n\n targetWindow.postMessage(message, this.getTargetOrigin());\n\n retryCount++;\n\n // Schedule next retry if not at max\n if (retryCount < maxRetries) {\n setTimeout(() => {\n if (!this.abortController?.signal.aborted) {\n attemptHandshake();\n }\n }, retryInterval);\n } else {\n // Max retries exceeded, but don't reject immediately\n // Let the timeout handle the final rejection\n }\n } catch (error) {\n cleanup();\n this.abortController = null;\n\n if (error instanceof HandshakeError) {\n reject(error);\n } else {\n reject(\n new HandshakeError(\n HandshakeFailureReason.MESSAGE_SEND_FAILED,\n \"Failed to send handshake message\",\n error as Error\n )\n );\n }\n }\n };\n\n // Start the handshake process\n attemptHandshake();\n });\n }\n\n cancel(): void {\n if (this.abortController) {\n this.abortController.abort();\n this.abortController = null;\n }\n\n if (this.messageListener) {\n window.removeEventListener(\"message\", this.messageListener);\n this.messageListener = null;\n }\n }\n\n isActive(): boolean {\n return (\n this.abortController !== null && !this.abortController.signal.aborted\n );\n }\n}\n","import {\n ChatInitMessage,\n ChatOpenMessage,\n ChatCloseMessage,\n TimelineSeekMessage,\n AlarmClickMessage,\n PopUpCloseMessage,\n PdfEnlargedMessage,\n PdfShrinkedMessage,\n ChatInitiatedMessage,\n ChatOpenedMessage,\n ChatClosedMessage,\n AlarmFadeInMessage,\n PopUpOpenMessage,\n PdfOpenMessage,\n PdfCloseMessage,\n CHAT_INIT,\n} from \"@coxwave/tap-messages\";\nimport { Messenger } from \"../common/messenger\";\nimport { IframeHandshake, type HandshakeOptions } from \"../iframe-handshake\";\n\nexport type ToTapMessage =\n | ChatInitMessage\n | ChatOpenMessage\n | ChatCloseMessage\n | TimelineSeekMessage\n | AlarmClickMessage\n | PopUpCloseMessage\n | PdfEnlargedMessage\n | PdfShrinkedMessage;\n\nexport type FromTapMessage =\n | ChatInitiatedMessage\n | ChatOpenedMessage\n | ChatClosedMessage\n | AlarmFadeInMessage\n | PopUpOpenMessage\n | PdfOpenMessage\n | PdfCloseMessage\n | TimelineSeekMessage;\n\nexport interface ChatInitConfig {\n chatApiParams: any;\n customStyles?: any;\n gaId?: string;\n}\n\nexport class TapIframeBridge extends Messenger<ToTapMessage, FromTapMessage> {\n protected hostClientUrl: string;\n protected pluginKey: string;\n protected iframe!: HTMLIFrameElement | null;\n\n constructor({\n hostClientUrl,\n pluginKey,\n }: {\n hostClientUrl: string;\n pluginKey: string;\n }) {\n super();\n this.hostClientUrl = hostClientUrl;\n this.pluginKey = pluginKey;\n }\n\n // Messenger 추상 메서드 구현\n protected isValidOrigin(event: MessageEvent): boolean {\n if (!this.iframe) return false;\n\n const eventOrigin = event.origin;\n const iframeSrcOrigin = new URL(this.iframe.src).origin;\n\n // 정확한 매칭\n if (eventOrigin === iframeSrcOrigin) return true;\n\n // Vercel 도메인 패턴 매칭 (preview 배포 등)\n if (\n eventOrigin.includes(\"vercel.app\") &&\n iframeSrcOrigin.includes(\"vercel.app\")\n ) {\n return true;\n }\n\n // localhost 개발 환경\n if (\n eventOrigin.includes(\"localhost\") &&\n iframeSrcOrigin.includes(\"localhost\")\n ) {\n return true;\n }\n\n return false;\n }\n\n protected getMessageTarget(): Window | null {\n return this.iframe?.contentWindow || null;\n }\n\n protected getTargetOrigin(): string {\n if (!this.iframe?.src) return \"*\";\n\n try {\n return new URL(this.iframe.src).origin;\n } catch {\n // URL 파싱 실패 시 모든 origin 허용 (유연성 확보)\n return \"*\";\n }\n }\n\n renderIframe({\n chatBody,\n isProd,\n isLocal,\n }: {\n chatBody: HTMLElement;\n isProd: boolean;\n isLocal?: boolean;\n }) {\n return new Promise<HTMLIFrameElement>((resolve) => {\n this.iframe = document.createElement(\"iframe\");\n this.iframe.style.setProperty(\"display\", \"flex\", \"important\");\n this.iframe.style.setProperty(\"border\", \"none\", \"important\");\n\n if (isLocal) {\n this.iframe.src = `${this.hostClientUrl}/chat`;\n } else {\n this.iframe.src = isProd\n ? \"https://ax-tap-fe-staging.vercel.app/chat\"\n : \"https://ax-tap-fe-staging.vercel.app/chat\";\n }\n\n this.iframe.style.width = \"100%\";\n this.iframe.style.height = \"100%\";\n\n this.iframe.onload = () => resolve(this.iframe as HTMLIFrameElement);\n\n chatBody.appendChild(this.iframe);\n });\n }\n\n hasIframe() {\n if (!this.iframe) {\n return false;\n }\n return true;\n }\n\n removeIframe() {\n this.iframe?.remove(); // DOM에서 제거\n this.iframe = null; // 참조 초기화\n this.removeAllListeners(); // 모든 리스너 정리\n }\n\n get postToTap() {\n if (!this.iframe) {\n console.warn(\"TapIframeBridge: iframe not found\");\n }\n return super.postMessage;\n }\n\n listenToTap = super.on;\n\n async performHandshake(\n config: ChatInitConfig,\n options?: HandshakeOptions\n ): Promise<ChatInitiatedMessage> {\n if (!this.iframe) {\n throw new Error(\"TapIframeBridge: iframe not available for handshake\");\n }\n\n const handshake = new IframeHandshake(\n () => this.getMessageTarget(),\n () => this.getTargetOrigin(),\n (event) => this.isValidOrigin(event)\n );\n\n // Construct the ChatInitMessage\n const chatInitMessage: ChatInitMessage = {\n type: CHAT_INIT,\n hostClientUrl: this.hostClientUrl,\n pluginKey: this.pluginKey,\n chatApiParams: config.chatApiParams,\n theme: config.customStyles,\n };\n\n try {\n return await handshake.execute(chatInitMessage, options);\n } catch (error) {\n // Re-throw with additional context\n if (error instanceof Error) {\n throw new Error(`TapIframeBridge handshake failed: ${error.message}`);\n }\n throw error;\n }\n }\n}\n","import type { TapIframeBridge } from \"../tap-iframe-bridge\";\nimport type { AlarmMessageInstanceType } from \"../../types\";\nimport { PopUpOpenMessage } from \"@coxwave/tap-messages\";\n\nexport class EventManager {\n constructor(private iframeBridge: TapIframeBridge) {}\n\n onTimelineSeek(handler: (clipPlayHead: number, clipId: string) => void) {\n this.iframeBridge.listenToTap(\"timeline:seek\", (data) =>\n handler(data.clipPlayHead, data.clipId)\n );\n }\n\n onChatOpened(handler: () => void) {\n this.iframeBridge.listenToTap(\"chat:opened\", handler);\n }\n\n onChatClosed(handler: () => void) {\n this.iframeBridge.listenToTap(\"chat:closed\", handler);\n }\n\n onChatInitiated(handler: () => void) {\n this.iframeBridge.listenToTap(\"chat:initiated\", handler);\n }\n\n onAlarmFadeIn(handler: (messageInfo: AlarmMessageInstanceType) => void) {\n this.iframeBridge.listenToTap(\"alarm:fadeIn\", (data) => {\n handler(data.messageInfo);\n });\n }\n\n onPopUpOpen(handler: (popUpInfo: PopUpOpenMessage[\"popUpInfo\"]) => void) {\n this.iframeBridge.listenToTap(\"popUp:open\", (data) => {\n handler(data.popUpInfo);\n });\n }\n\n onPdfOpen(handler: () => void) {\n this.iframeBridge.listenToTap(\"pdf:open\", handler);\n }\n\n onPdfClose(handler: () => void) {\n this.iframeBridge.listenToTap(\"pdf:close\", handler);\n }\n}\n","import 'popUpImage/popUpImage.css.ts.vanilla.css?source=#H4sIAAAAAAAAE7VU7Y7bIBD8n6dYqap0lUKEXSd1uZfoK2B77dBgQIDPzlX37hX4o07qXq9qK0tY7AIzOztw6Lu0aU8Uvu0AelH5M4OE0vePO4BWKDKFWj6QUiuPyoeM54VEIvlVd54B77wO0ULbCi0ptZTcOGTg0HDLPa6SzvBSqIYB/RFkQA+ZGcBpKSqwTcEfkiTfwzik+R7oIUk/rE6xvBKdY5CbIUT1E9pa6n5FhZeXxupOVYGOtgze1XUdMmVnXZgbLZRH+7h72R1GDZKowR9TMryqYkUJHdlsYafhi8rh4AmXolEMJNZRzVorT2reCnll8MWiR1VxW0W20wH0c/iWxU48I4MkHQFjqEfRnD2DI43K9mfhMaqNDJS2LZdrpUhvuWFQWOQX0usRLPxJDN1mFoXSf6TQL6raluB3BWdTwaNRa+HXRg2+nTIZndD/izQfozRGO+GFVgwsSu7FE24bwjbFQ3qke5iHV8y9qHdndnKd7b6QyCKJSjgj+ZVBLTHuiHYjwmPrGJQ42h7ga+e8qK+zXAyiJKRA3yOqFTQptPe6ZZAFBgvaMaLNvcz48XjKbwinZoDTqmO3TbyrNhujz0SoCofglVd9sbA4RRZ323665G9XZfvB+8sqg88Uvq2gT+NTfGvS4MnVmny70fP7PWGfpxsyz1tuG6Fuu7lVWjiOuLMV6hLf6ZfvG7kHlyUGAAA=';\nexport var codeBlockContainer = 'wu2gm63';\nexport var copyButton = 'wu2gm66';\nexport var copyButtonText = 'wu2gm67';\nexport var defaultIcon = 'wu2gm68';\nexport var languageBadge = 'wu2gm65';\nexport var pluginHeader = 'wu2gm64';\nexport var pluginTable = 'wu2gm60';\nexport var pluginTd = 'wu2gm62';\nexport var pluginTh = 'wu2gm61';","import { ChatBodyType } from \"../types\";\nimport * as styles from \"./popUpImage.css\";\n\nfunction showPopupWithHtml({\n htmlString,\n callback,\n customStyles,\n}: {\n htmlString: string;\n callback: () => void;\n customStyles?: ChatBodyType;\n}) {\n // 🔹 스타일 태그 생성 및 삽입\n // const styleElement = document.createElement(\"style\");\n // styleElement.setAttribute(\"data-popup-style\", \"true\"); // 식별자\n // styleElement.innerHTML = styles;\n // document.head.appendChild(styleElement);\n\n // 백드롭 레이어\n const overlay = document.createElement(\"div\");\n overlay.style.position = \"fixed\";\n overlay.style.top = \"0\";\n overlay.style.left = \"0\";\n overlay.style.width = \"100vw\";\n overlay.style.height = \"100vh\";\n overlay.style.background = \"rgba(0, 0, 0, 0.4)\";\n overlay.style.zIndex = \"10000002\";\n\n // 팝업 컨테이너\n const popup = document.createElement(\"div\");\n popup.style.position = \"fixed\";\n popup.style.display = \"flex\";\n popup.style.flexDirection = \"column\";\n\n // ✅ right 계산\n const basePadding = 15;\n let computedRight = basePadding;\n\n // 너비 합\n if (customStyles?.width) {\n const numericWidth = parseFloat(customStyles.width); // 단위 제거 (390 from \"390px\", 80 from \"80%\")\n const unit = customStyles.width.match(/[a-zA-Z%]+/)?.[0]; // px, %, rem 등 추출\n\n if (!isNaN(numericWidth) && unit === \"px\") {\n computedRight += numericWidth;\n }\n } else {\n computedRight += 340;\n }\n\n // 오름쪽 포지션 합\n if (customStyles?.position?.right) {\n const numericRight = parseFloat(customStyles?.position?.right); // 단위 제거 (390 from \"390px\", 80 from \"80%\")\n const unit = customStyles?.position?.right.match(/[a-zA-Z%]+/)?.[0]; // px, %, rem 등 추출\n\n if (!isNaN(numericRight) && unit === \"px\") {\n computedRight += numericRight;\n }\n } else {\n computedRight = computedRight + 24;\n }\n\n popup.style.top = customStyles?.position?.top ?? \"50px\";\n popup.style.right = `${computedRight}px`;\n popup.style.left = customStyles?.position?.left ?? \"unset\";\n popup.style.bottom = customStyles?.position?.bottom ?? \"unset\";\n\n popup.style.maxWidth = \"calc(100vw - 100px)\";\n popup.style.maxHeight = customStyles?.height ?? \"calc(100vh - 116px)\";\n popup.style.overflow = \"auto\";\n popup.style.background = \"#fff\";\n popup.style.padding = \"20px\";\n popup.style.border = \"1px solid #ccc\";\n popup.style.boxShadow = \"0 4px 20px rgba(0,0,0,0.2)\";\n popup.style.zIndex = \"10000003\";\n popup.style.borderRadius = \"8px\";\n\n // 팝업 내용\n const wrapper = document.createElement(\"div\");\n wrapper.innerHTML = htmlString;\n\n // 백드롭 클릭 시 닫기\n overlay.addEventListener(\"click\", () => {\n document.body.removeChild(overlay);\n document.body.removeChild(popup);\n // document.head.removeChild(styleElement);\n callback();\n });\n\n // 팝업 내부 클릭 시 이벤트 전파 막기\n popup.addEventListener(\"click\", (e) => {\n e.stopPropagation();\n });\n\n // 조립 및 삽입\n popup.appendChild(wrapper);\n document.body.appendChild(overlay);\n document.body.appendChild(popup);\n\n // 복사 버튼 (만약 있을 시)\n const button = document.querySelector(`.${styles.copyButton}`);\n const codeBlock = document.querySelector(\".cw-plugin-code-block\");\n const defaultIcon = document.querySelector(`.${styles.defaultIcon}`);\n const copyButtonText = document.querySelector(`.${styles.copyButtonText}`);\n\n if (button && codeBlock && defaultIcon && copyButtonText) {\n button.addEventListener(\"click\", () => {\n navigator.clipboard.writeText(codeBlock.textContent ?? \"\");\n\n // 아이콘 숨기기\n (defaultIcon as HTMLElement).style.display = \"none\";\n\n // 텍스트 변경\n copyButtonText.textContent = \"복사됨\";\n\n setTimeout(() => {\n // 텍스트 원복\n copyButtonText.textContent = \"복사\";\n (defaultIcon as HTMLElement).style.display = \"inline\";\n }, 1000);\n });\n }\n}\n\nexport default showPopupWithHtml;\n","import * as v from \"valibot\";\nimport { GAEventSchema } from \"@coxwave/tap-messages\";\n\nclass InitGA {\n static isInitialized = false;\n\n constructor({ gaId }: { gaId: string }) {\n if (!InitGA.isInitialized) {\n this.init(gaId);\n InitGA.isInitialized = true;\n }\n }\n\n init(gaId: string) {\n if (\n !document.querySelector(\n `script[src=\"https://www.googletagmanager.com/gtag/js?id=${gaId}\"]`\n )\n ) {\n const gtagScript = document.createElement(\"script\");\n gtagScript.async = true;\n gtagScript.src = `https://www.googletagmanager.com/gtag/js?id=${gaId}`;\n document.head.appendChild(gtagScript);\n }\n\n if (typeof window.gtag !== \"function\") {\n const inlineScript = document.createElement(\"script\");\n inlineScript.innerHTML = `\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n gtag('config', '${gaId}');\n `;\n document.head.appendChild(inlineScript);\n }\n\n // TODO(domuk-k): GA 원천,형식 파악 후 개선\n window.addEventListener(\"message\", (event) => {\n try {\n const data =\n typeof event.data === \"string\" ? JSON.parse(event.data) : event.data;\n\n // Validate GA event message\n const gaEvent = v.parse(GAEventSchema, data);\n\n if (typeof window.gtag === \"function\") {\n window.gtag(\"event\", gaEvent.payload.action ?? \"click\", {\n event_category: gaEvent.payload.category ?? \"Default\",\n event_label: gaEvent.payload.label,\n value: gaEvent.payload.value,\n fastCampus_user_id: gaEvent.payload.fastCampus_user_id,\n course_id: gaEvent.payload.course_id,\n ...gaEvent.payload,\n });\n }\n } catch (error) {\n // Invalid message or JSON parsing error - ignore silently\n }\n });\n }\n}\n\nexport default InitGA;\n","import ChatBodyMaker from \"./chatBody\";\nimport FloatingButtonMaker from \"./floatingButton\";\nimport { TapIframeBridge } from \"./services/tap-iframe-bridge\";\nimport { EventManager } from \"./services/event-manager\";\nimport showPopupWithHtml from \"./popUpImage\";\n\nimport InitGA from \"./ga\";\n\nimport {\n AlarmMessageInstanceType,\n ChatApiParamsType,\n TapSDKType,\n CustomStylesType,\n ShortcutKeyType,\n SeekTimelineParamsType,\n} from \"./types\";\n\nclass TapSDK {\n private pluginKey: string;\n private iframeBridge: TapIframeBridge;\n public events: EventManager;\n\n private chatBody: HTMLElement | null = null;\n private chatBodyMaker: ChatBodyMaker;\n private floatingButtonMaker: FloatingButtonMaker;\n private shortcutKey: ShortcutKeyType = {\n openChat: { key: \"/\", modifier: \"\" },\n sendChat: { key: \"Enter\", modifier: \"\" },\n };\n\n private isProd: boolean;\n private isLocal: boolean;\n\n private isOpen: boolean;\n private isPdfOpen: boolean;\n\n constructor({ pluginKey, isProd = false, isLocal = false }: TapSDKType) {\n // protocol\n this.pluginKey = pluginKey;\n this.iframeBridge = new TapIframeBridge({\n hostClientUrl: window.location.origin,\n pluginKey: this.pluginKey,\n });\n\n // events\n this.events = new EventManager(this.iframeBridge);\n\n // render\n this.floatingButtonMaker = new FloatingButtonMaker();\n this.chatBodyMaker = new ChatBodyMaker();\n\n // ga log\n this.isProd = isProd;\n this.isLocal = isLocal;\n\n // state\n this.isOpen = false;\n this.isPdfOpen = false;\n }\n\n #isClient() {\n return typeof window !== \"undefined\" && typeof document !== \"undefined\";\n }\n\n private setIsOpen(isOpen: boolean) {\n this.isOpen = isOpen;\n }\n\n private setIsPdfOpen(isPdfOpen: boolean) {\n this.isPdfOpen = isPdfOpen;\n }\n\n seekTimeline({ clipId, clipPlayHead }: SeekTimelineParamsType) {\n this.iframeBridge.postToTap({\n type: \"timeline:seek\",\n clipId,\n clipPlayHead,\n });\n }\n\n async initChat({\n chatApiParams,\n customStyles,\n shortcutKey,\n }: {\n chatApiParams: ChatApiParamsType;\n customStyles?: CustomStylesType;\n shortcutKey?: ShortcutKeyType;\n }) {\n if (!this.#isClient()) throw new Error(\"not client\");\n\n this.shortcutKey = {\n openChat: shortcutKey?.openChat ?? this.shortcutKey.openChat,\n sendChat: shortcutKey?.sendChat ?? this.shortcutKey.sendChat,\n };\n\n // chat body render\n if (!this.chatBody) {\n this.chatBody = this.chatBodyMaker.createChatBody({\n ...(customStyles?.chatBody && {\n customChatBody: customStyles.chatBody,\n }),\n });\n }\n\n // chat iframe\n if (!this.iframeBridge.hasIframe()) {\n await this.iframeBridge.renderIframe({\n chatBody: this.chatBody,\n isProd: this.isProd,\n isLocal: this.isLocal,\n });\n // Handshake will be performed after iframe load\n }\n try {\n const initiatedMessage = await this.iframeBridge.performHandshake(\n {\n chatApiParams,\n customStyles,\n },\n {\n retryInterval: 500,\n maxRetries: 10,\n timeout: 10000,\n }\n );\n\n // Initialize GA with the received gaId\n new InitGA({ gaId: initiatedMessage.gaId });\n } catch (error) {\n console.error(\"Handshake failed:\", error);\n throw new Error(\n `Chat initialization failed: ${error instanceof Error ? error.message : \"Unknown error\"}`\n );\n }\n\n // floating button render\n this.floatingButtonMaker.render({\n ...(customStyles?.floatingButton && {\n customFloatingButton: customStyles.floatingButton,\n }),\n });\n this.floatingButtonMaker.addClickEvent({\n callback: () => {\n this.iframeBridge.postToTap({\n type: this.isOpen ? \"chat:close\" : \"chat:open\",\n });\n },\n });\n\n this.floatingButtonMaker.addAlarmClickEvent({\n callback: (messageInfo: AlarmMessageInstanceType) => {\n this.iframeBridge.postToTap({ type: \"chat:open\", isAlarm: true });\n this.iframeBridge.postToTap({ type: \"alarm:click\", messageInfo });\n },\n });\n\n this.iframeBridge.listenToTap(\"chat:opened\", () => {\n this.setIsOpen(true);\n this.chatBodyMaker.toggleVisibility(this.isOpen);\n this.floatingButtonMaker.alarmRemove();\n });\n this.iframeBridge.listenToTap(\"chat:closed\", () => {\n this.setIsOpen(false);\n this.chatBodyMaker.toggleVisibility(this.isOpen);\n });\n\n // alarm\n this.iframeBridge.listenToTap(\"alarm:fadeIn\", (data) => {\n if (this.isOpen) return;\n this.floatingButtonMaker.alarmFadeIn(data.messageInfo);\n });\n\n // popUp\n this.iframeBridge.listenToTap(\"popUp:open\", (data) => {\n showPopupWithHtml({\n htmlString: data.popUpInfo.html,\n callback: () => this.iframeBridge.postToTap({ type: \"popUp:close\" }),\n ...(customStyles?.chatBody && { customStyles: customStyles.chatBody }),\n });\n });\n\n // pdf Open\n this.iframeBridge.listenToTap(\"pdf:open\", () => {\n this.setIsPdfOpen(true);\n this.chatBodyMaker.resizeChatBody(this.isPdfOpen, customStyles?.chatBody);\n this.iframeBridge.postToTap({ type: \"pdf:enlarged\" });\n });\n this.iframeBridge.listenToTap(\"pdf:close\", () => {\n this.setIsPdfOpen(false);\n this.chatBodyMaker.resizeChatBody(this.isPdfOpen, customStyles?.chatBody);\n this.iframeBridge.postToTap({ type: \"pdf:shrinked\" });\n });\n\n // if dev, attach alaram:fadeIn event\n if (this.isLocal) {\n this.iframeBridge.listenToTap(\"alarm:fadeIn\", (data) => {\n this.floatingButtonMaker.alarmFadeIn(data.messageInfo);\n });\n }\n }\n\n removeChat() {\n if (!this.chatBody) throw new Error(\"chatBody is not initialized\");\n\n this.chatBodyMaker.removeChatBody();\n this.floatingButtonMaker.alarmRemove();\n this.iframeBridge.removeIframe();\n this.chatBody = null;\n this.isOpen = false;\n }\n\n /**\n * @deprecated use `seekTimeline` method. gotta be expired at v1.0.0\n */\n postChatInfo({\n clipId,\n clipPlayHead,\n }: {\n clipId: string;\n clipPlayHead: number;\n }) {\n this.seekTimeline({ clipId, clipPlayHead });\n }\n\n /**\n * @deprecated use `events.onTimelineSeek` method. gotta be expired at v1.0.0\n */\n getTimelineInfo({\n callback,\n }: {\n callback: (clipPlayHead: number, clipId: string) => void;\n }) {\n this.events.onTimelineSeek(callback);\n }\n}\n\nexport default TapSDK;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coxwave/tap-sdk",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "description": "A vanilla JS SDK",
6
6
  "main": "index.ts",
@@ -29,12 +29,11 @@
29
29
  "files": [
30
30
  "dist"
31
31
  ],
32
- "dependencies": {
33
- "@coxwave/tap-messages": "workspace:*"
34
- },
32
+ "dependencies": {},
35
33
  "devDependencies": {
36
34
  "@coxwave/config-eslint": "workspace:*",
37
35
  "@coxwave/config-typescript": "workspace:*",
36
+ "@coxwave/tap-messages": "workspace:*",
38
37
  "@vanilla-extract/css": "^1.17.4",
39
38
  "@vanilla-extract/esbuild-plugin": "^2.3.18",
40
39
  "postcss": "^8.5.6",