@letscooee/web-sdk 14.0.4 → 14.0.5
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/{chunk-BxeSb631-CAitwQDp.js → chunk-DbQ39eGC-BuuE3sKA.js} +3 -3
- package/dist/{debugger.component-d6E3q1eL-_q-tmkAy.js → debugger.component-D-8HGaxr-rhz7Y3ND.js} +3 -3
- package/dist/{esm-DKhFdjmg-CtDf3Ccs.js → esm-DKhFdjmg-CkLM_H-o.js} +1 -1
- package/dist/main.min.js +17 -17
- package/dist/renderer-BpHcv0Tu-BjlOyaqx.js +6 -0
- package/dist/{share-dialog.component-BqG6ZyPV-Dab85WiK.js → share-dialog.component-CMwPyb-w-B0UrEp43.js} +3 -3
- package/dist/{video-detail-dialog.component-DEqp2L89-CjIG-YSe.js → video-detail-dialog.component-CX4_iSK--CHXmFUnS.js} +5 -5
- package/dist/{widgets-aIQ74dpG-ac52Zxc7.js → widgets-D_OSh97N-Bpf2Pdkf.js} +11 -11
- package/package.json +2 -2
- package/dist/renderer-CQIvegw_-BzUvQegY.js +0 -6
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@letscooee/web-sdk",
|
|
3
3
|
"description": "Engage uniquely and boost conversions with AI-powered customer journeys driven by real-time intent",
|
|
4
|
-
"version": "14.0.
|
|
4
|
+
"version": "14.0.5",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"lint": "ng lint",
|
|
7
7
|
"integrity": "./scripts/validate-integrity.sh",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"hex-to-rgba": "^2.0.1",
|
|
91
91
|
"isbot": "^5.1.32",
|
|
92
92
|
"js-logger": "^1.6.1",
|
|
93
|
-
"lightningcss-linux-x64-gnu": "^1.
|
|
93
|
+
"lightningcss-linux-x64-gnu": "^1.32.0",
|
|
94
94
|
"localforage": "^1.10.0",
|
|
95
95
|
"preact": "^10.26.9",
|
|
96
96
|
"rxjs": "^7.8.0",
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { k as ke, a as Be$1, z as zr, Y, r, s, R as Rn, L as Ln } from './chunk-BxeSb631-CAitwQDp.js';
|
|
2
|
-
import { j, c as H$1, B as Be, M, e as V, m as mt, f as fe, I as Ir, q as qr, G as Gr, g as yt, h as jr, i as it, k as Gt, W as Wr, $ as $r, A as A$1, S as S$1, o as nt, p as Ve, v as vi, r as f$1, s as Br, t as He, w as yi } from './main.min.js';
|
|
3
|
-
|
|
4
|
-
var L=class{loadedFonts=[];async loadAllFonts(e){e.elems?.forEach(t=>{t instanceof Ve&&this.loadFamily(t.typography?.fam);});}async loadFamily(e){if(!e?.fonts||this.loadedFonts.indexOf(e.name)>-1)return;let t=[];e.fonts.forEach(n=>{if(n.url){let l=new FontFace(`cooee`+e.name,n.getURL(),n.getFontDescriptor());t.push(l.load());}}),this.loadedFonts.push(e.name),(await Promise.all(t)).forEach(n=>{document.fonts.add(n);});}};var S=class{static updateIdentity(e){if(!this.isInstalled())return;let t={};e.email&&(t.email=e.email),e.mobile&&(t.phone_number=e.mobile),Y.verbose(`Sending email/mobile to Klaviyo`),window.klaviyo.push([`identify`,t]);}static isInstalled(){return window.klaviyo&&typeof window.klaviyo==`object`}};var H=class{action;triggerContext;constructor(e,t){this.action=e,this.triggerContext=t;}async execute(){let e=this.containsCTA()?`CE Trigger Clicked`:`CE Trigger Closed`;switch(this.action.at!==He.SUBMIT_FORM&&await this.closeTriggerAndSendEvent(e),this.action.at){case He.ACCEPT_POPUP:break;case He.GO_TO_URL:this.gotoURLAction();break;case He.SHARE:this.shareAction();break;case He.SUBMIT_FORM:await this.collectFormData();break;case void 0:case He.OPEN_CART:break;default:Y.error(`Received an invalid ClickActionType: `,this.action.at);return}}externalAction(){this.action.ext?.u&&window.open(this.action.ext.u,`_blank`)?.focus();}gotoURLAction(){if(this.action.gu?.u){let e=this.action.gu.u;Rn(e)||(e=`//${e}`),window.open(e,`_self`);}}async closeTriggerAndSendEvent(e,t){this.triggerContext.closeInApp(e,t),await this.dispatchEvent();}shareAction(){if(!this.action.share)return;if(!navigator.share){Y.warn(`Navigator.share is not compatible with this browser`);return}navigator.share({text:this.action.share.text,title:`Share`}).then(t=>console.log(t)).catch(t=>console.error(t));}containsCTA(){return this.action.at&&this.action.at!==He.REJECT_POPUP?true:!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(e){return e?Object.keys(e).length===0:true}async collectFormData(){let e={};for(let t of this.triggerContext.inputs){if(!t.isValid)return;let n=document.getElementById(t.id).value;t.type===51?e.email=n:t.type===52&&(e.mobile=n);}await this.closeTriggerAndSendEvent(`CE Form Submitted`,{form:e}),this.action.applyDiscount&&Ln(`Coupon applied on cart`),S.updateIdentity(e);}async dispatchEvent(){let e=this.triggerContext.triggerData,t={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??e.embeddedItems??e.items,collections:e.collections,triggerData:e};await new yi().process(t);let r={action:this.containsCTA()?`CLICKED`:`CLOSED`};document.dispatchEvent(new CustomEvent(`letscooee:outbound:popup-activities`,{detail:r}));}};var a=class{renderer=I.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(e,t,r){this.parentHTMLEl=e,this.inappElement=t,this.triggerContext=r,this.stylesConverter=new vi(this.renderer.getScalingFactor());}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.parentHTMLEl.appendChild(this.inappHTMLEl);}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();let e=s(r(r(r(r({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:`border-box`,outline:`none`});S$1(this.inappHTMLEl,e);}getDisplayStyles(){return {display:`block`}}processWidthAndHeight(){this.inappElement.w&&H$1(this.inappHTMLEl,`width`,this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&H$1(this.inappHTMLEl,`height`,this.stylesConverter.getSizePx(this.inappElement.h));}processPositionBlock(){let e={position:`absolute`,left:this.stylesConverter.getSizePx(this.inappElement.x),top:this.stylesConverter.getSizePx(this.inappElement.y)};S$1(this.inappHTMLEl,e);}getBorderStyles(){return this.stylesConverter.getBorderStyles(this.inappElement.br)}getSpaceStyles(){return this.stylesConverter.getSpaceStyles(this.inappElement.spc)}processTransparency(){let e=this.inappElement.alpha;if(!isNaN(e)){let t=(e/100).toFixed(2);H$1(this.inappHTMLEl,`opacity`,t);}}processShadow(){let e=this.inappElement.shd;e?H$1(this.inappHTMLEl,`box-shadow`,e.getStyle(this.scalingFactor)):H$1(this.inappHTMLEl,`box-shadow`,`unset`);}processTransformBlock(){let e=new f$1(this.inappElement.trf);e&&e.rotate&&H$1(this.inappHTMLEl,`transform`,`rotate(${e.rotate}deg)`);}registerAction(){let e=this.inappElement.clc;!e||Object.keys(e).length===0||(this.inappHTMLEl.addEventListener(`click`,t=>{t.stopPropagation(),new H(e,this.triggerContext).execute();}),H$1(this.inappHTMLEl,`cursor`,`pointer`));}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}};var p=class extends a{constructor(e,t,r){super(e,t,r);}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment();}processFontBlock(){let e={},t=this.inappElement.typography;return t&&(e.fontSize=this.stylesConverter.getSizePx(t.fs),e.fontFamily=`cooee`+t.fam?.name,e.lineHeight=`${t.lh}`,e.letterSpacing=t.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,`color`,e),S$1(this.inappHTMLEl,e),e}processPart(e,t){let r=[];t.u&&r.push(`underline`),t.st&&r.push(`line-through`),r.length||r.push(`normal`),H$1(e,`font-weight`,t.b?`bold`:`normal`),H$1(e,`font-style`,t.i?`italic`:`normal`),H$1(e,`text-decoration`,r.join(` `)),H$1(e,`color`,t.c??`inherit`),H$1(e,`font-family`,`inherit`);}processAlignment(){let e=this.inappElement.typography.ta,t=e?Br[e]?.toLowerCase():this.inappElement.typography.alignment;t||(t=`start`),H$1(this.inappHTMLEl,`text-align`,t);}};var u=class extends p{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`div`),this.insertElement();}render(){this.inappElement.parts?.forEach(e=>{let t=document.createElement(`span`);t.innerHTML=e.txt?.toString()?.replace(/\n/g,`<br />`),this.processPart(t,e),this.inappHTMLEl.appendChild(t);}),this.processCommonBlocks();}};var f=class extends a{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`div`),this.insertElement();}render(){this.processCommonBlocks();}};var E=class extends a{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`img`),this.insertElement();}render(){this.inappHTMLEl.setAttribute(`src`,this.inappElement.src),H$1(this.inappHTMLEl,`max-width`,`none`),H$1(this.inappHTMLEl,`max-height`,`none`),H$1(this.inappHTMLEl,`margin`,`0 auto`),this.processCommonBlocks();}};var v=class o extends a{constructor(t,r,n){super(t,r,n);this.parent=t;this.inappHTMLEl=document.createElement(`div`);}static MAX_Z_INDEX=`2147483647`;render(){return this.parent||this.renderer.removeInApp(),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add(`cooee-wrapper`),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),H$1(this.inappHTMLEl,`z-index`,o.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let t=this.inappElement.cont;if(this.inappElement.cover)this.renderer.isParentNotBody()?(H$1(this.inappHTMLEl,`width`,`100%`),H$1(this.inappHTMLEl,`height`,`100%`)):(H$1(this.inappHTMLEl,`width`,`100vw`),H$1(this.inappHTMLEl,`height`,`100vh`)),H$1(this.inappHTMLEl,`top`,`0`),H$1(this.inappHTMLEl,`left`,`0`);else {let r=this.inappElement.spc,n=this.stylesConverter.getScaledSize(t.w)+r.getHorizontal(),l=this.stylesConverter.getScaledSize(t.h)+r.getVertical();H$1(this.inappHTMLEl,`width`,n+`px`),H$1(this.inappHTMLEl,`height`,l+`px`);}}getSpaceStyles(){return {padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return r(r({display:`flex`},this.inappElement.getStylesForWrapper()),this.inappElement.getFlexStylesForContainer())}processPositionBlock(){this.renderer.isParentNotBody()?H$1(this.inappHTMLEl,`position`,`absolute`):H$1(this.inappHTMLEl,`position`,`fixed`);}getBorderStyles(){return {}}processTransparency(){}processTransformBlock(){}processShadow(){}};var se=`cooee-container`,w=class extends a{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`div`),this.insertElement();}render(){return this.processCommonBlocks(),H$1(this.inappHTMLEl,`position`,`relative`),H$1(this.inappHTMLEl,`overflow`,`hidden`),this.inappHTMLEl.classList.add(se),this}};var A=class o extends p{static DAYS=`Days`;static HOURS=`Hours`;static MINUTES=`Minutes`;static SECONDS=`Seconds`;elements;spans=[];constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`div`),this.insertElement();}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();let e=s(r(r(r({flex:`1 1 0`},this.stylesConverter.getBackgroundStyles(this.inappElement.bg)),this.stylesConverter.getBorderStyles(this.inappElement.br)),this.stylesConverter.getSpaceStyles(this.inappElement.spc)),{marginLeft:this.stylesConverter.getSizePx(this.inappElement.gap),marginRight:this.stylesConverter.getSizePx(this.inappElement.gap)});this.addStylesToTimer(e);}getBackgroundStyles(){return {}}processFontBlock(){let e=super.processFontBlock();return this.stylesConverter.getColourStyles(this.inappElement.color,`color`,e),this.addStylesToTimer(e),e}getSpaceStyles(){return {}}getBorderStyles(){return {}}getDisplayStyles(){return {display:`flex`,flexWrap:`nowrap`,justifyContent:`center`}}addStylesToTimer(e){this.elements.forEach(t=>S$1(t,e));}addTimerChildren(){let e=this.inappElement.show;this.elements=[],e.day&&this.elements.push(this.getChild(o.DAYS)),e.hour&&this.elements.push(this.getChild(o.HOURS)),e.minute&&this.elements.push(this.getChild(o.MINUTES)),e.second&&this.elements.push(this.getChild(o.SECONDS)),this.elements.forEach(t=>this.inappHTMLEl.appendChild(t));}getChild(e){let t=document.createElement(`div`),r=document.createElement(`span`),n=document.createElement(`span`);return n.innerText=e,r.innerText=`00`,r.id=`lc-${e}`,H$1(n,`font-size`,`0.5em`),H$1(n,`text-align`,`center`),H$1(n,`font-family`,`inherit`),H$1(r,`text-align`,`center`),H$1(r,`font-family`,`inherit`),this.inappElement.lblPos===`start`?(t.appendChild(n),t.appendChild(r)):(t.appendChild(r),t.appendChild(n)),H$1(t,`display`,`flex`),H$1(t,`flex-direction`,this.inappElement.horizontal?``:`column`),H$1(t,`justify-content`,`center`),H$1(t,`align-items`,`center`),H$1(t,`gap`,`5px`),this.spans.push(r),t}processAndStartTimer(){let e=this.inappElement.timer.start(this.inappElement.timerType,t=>{this.spans.forEach(r=>{r.id===`lc-${o.DAYS}`?r.innerText=String(t.days).padStart(2,`0`):r.id===`lc-${o.HOURS}`?r.innerText=String(t.hours).padStart(2,`0`):r.id===`lc-${o.MINUTES}`?r.innerText=String(t.minutes).padStart(2,`0`):r.id===`lc-${o.SECONDS}`&&(r.innerText=String(t.seconds).padStart(2,`0`));});});this.triggerContext.intervals.push(e);}};var b=class extends p{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`select`),this.insertElement();}render(){H$1(this.inappHTMLEl,`background`,`#ffffff00`),H$1(this.inappHTMLEl,`outline`,`none`),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions();}addListener(e){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),e.addEventListener(`click`,t=>{t.stopPropagation();}),e.addEventListener(`change`,()=>{let t=new nt(JSON.parse(e.value));this.updateItems(t);});}updateItems(e){let t=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[t.toEmbed(e)];let r=this.parentHTMLEl.querySelector(`#coo-13`);if(!r)return;let n=e.imgs[0]??t.imgs?.at(0);n?.url&&r.setAttribute(`src`,n.url);}addOptions(){let e=this.triggerContext.triggerData.items,t=this.inappHTMLEl;if(!e?.length){t.add(this.createOption(this.inappElement.placeholderText));return}let r=this.triggerContext.selectedEmbeddedItems?.at(0);e[0].vars.forEach(n=>{t.add(this.createOption(n.name??`Default`,n,n.mID===r?.vID));});}createOption(e,t,r){let n=document.createElement(`option`);return n.text=e,n.value=JSON.stringify(t),r&&(n.selected=true),t||(n.disabled=true),n}};var T=class extends p{borderColor=``;constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`input`),this.insertElement();}render(){let e=this.setInputType();this.inappHTMLEl.setAttribute(`placeholder`,this.inappElement.placeholderText),H$1(this.inappHTMLEl,`background`,`#ffffff00`),H$1(this.inappHTMLEl,`outline`,`none`),this.inappHTMLEl.addEventListener(`click`,t=>{t.stopPropagation();}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,e),this.triggerContext.addInputField(e,this.inappElement.t);}};var R=class o extends T{static EMAIL_REGEX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;constructor(e,t,r){super(e,t,r);}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute(`type`,`email`),this.inappHTMLEl.setAttribute(`id`,e),e}addListener(e,t){e.addEventListener(`keydown`,r=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(o.EMAIL_REGEX)?(H$1(this.inappHTMLEl,`border-color`,this.borderColor),this.triggerContext.updateValidation(t,true)):(H$1(this.inappHTMLEl,`border-color`,`red`),this.triggerContext.updateValidation(t,false)),r.stopPropagation();});}};var D=class o extends T{static MOBILE_REGEX=/^\d+$/;constructor(e,t,r){super(e,t,r);}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute(`type`,`tel`),this.inappHTMLEl.setAttribute(`id`,e),e}addListener(e,t){e.addEventListener(`keydown`,r=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(o.MOBILE_REGEX)?(H$1(this.inappHTMLEl,`border-color`,this.borderColor),this.triggerContext.updateValidation(t,true)):(H$1(this.inappHTMLEl,`border-color`,`red`),this.triggerContext.updateValidation(t,false)),r.stopPropagation();});}};var P=class extends E{constructor(e,t,r){super(e,t,r);}render(){super.render(),this.inappHTMLEl.setAttribute(`id`,`coo-${this.inappElement.type}`);}};var I=class o{static DOCUMENT_STANDARD_MODE=`CSS1Compat`;static ACTIVE_TRIGGER_DATA;static _instance;parent;rootContainer;containerHTMLElement;ian;scalingFactor=1;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){this.resizeListener=()=>this.screenResized(),this.setParentContainer(e);}static get(){return o._instance}render(e){this.renderEngagement(new j(e));}getScalingFactor(){return this.scalingFactor}calculateScalingFactor(e){let t=e.max,r=e.cont.w,n=e.cont.h,l=e.spc,c=this.getWidth(),h=this.getHeight();t&&(c=c?Math.min(c,t):t,h=h?Math.min(h,t):t),h&&(c-=l.getHorizontal(),h-=l.getVertical(),c/h<r/n?this.scalingFactor=c/r:this.scalingFactor=h/n,this.scalingFactor=Math.min(this.scalingFactor,1));}setParentContainer(e){this.parent=e||document.body,this.isParentNotBody()&&H$1(this.parent,`position`,`relative`);}isParentNotBody(){return this.parent&&this.parent!==document.body}getWidth(){return this.isParentNotBody()?this.parent.clientWidth:document.compatMode===o.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parent.clientHeight:document.compatMode===o.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}async renderEngagement(e){this.triggerContext=new Be(new Date,e),this.triggerContext.onClose(t=>{this.closeInApp(t);}),this.ian=e.ian,(M()||e.previewType===`mobile`)&&this.ian.overrideForMobileView(),await this.preloadImages(e),e.shouldDelay()?window.setTimeout(()=>{this.withCartDrawerClosed();},e.getDelaySeconds()):this.withCartDrawerClosed();}withCartDrawerClosed(){if(!V.get().isOpen()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=window.CooeeSDK.cartDrawerToggle$.subscribe(({open:t})=>{!t&&this.startRenderingOnce();});}startRenderingOnce(){if(!this.shouldSkipCampaign()){o.ACTIVE_TRIGGER_DATA=this.triggerContext.triggerData,o._instance=this;try{this.startRendering();}catch(e){ke(e,`render-popup`,{triggerContext:this.triggerContext});return}this.sendTriggerDisplayed(),M()||window.addEventListener(`resize`,this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe();}}shouldSkipCampaign(){let e=this.triggerContext.triggerData;if(!e.previewType&&o.ACTIVE_TRIGGER_DATA){let r={triggerShown:new mt(o.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(e,r),true}if(Be$1().isGoKwikPopupOpen)return this.skipTrigger(e,{reason:`GoKwik popup is open`}),true;let t=zr.find(r=>!!document.querySelector(r.identifier));return t?(this.skipTrigger(e,{reason:`${t.gateway} modal is open`}),true):false}startRendering(){this.calculateScalingFactor(this.ian),this.rootContainer=new v(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext);}catch(e){throw Y.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(n=>n.mID));fe(new Ir(`CE Trigger Displayed`,e,this.triggerContext.triggerData));document.dispatchEvent(new CustomEvent(`letscooee:outbound:popup-activities`,{detail:{action:`DISPLAYED`}}));}sendTriggerClosed(e){let t=e.eventName;delete e.eventName;let r=new Ir(t,e,this.triggerContext.triggerData);r.name===`CE Trigger Clicked`&&(r.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map(n=>n.toEmbed())),fe(r);}addEnterAnimation(e){this.containerHTMLElement.animate(e.getEnterAnimation(),{duration:500});}renderElement(e,t,r){t instanceof qr?new R(e,t,r).render():t instanceof Gr?new D(e,t,r).render():t instanceof yt?new u(e,t,r).render():t instanceof jr?new P(e,t,r).render():t instanceof it?new E(e,t,r).render():t instanceof Gt?new f(e,t,r).render():t instanceof Wr?new A(e,t,r).render():t instanceof $r?new b(e,t,r).render():Y.error(`Unsupported element type- `+t.type);}renderContainer(e){let t=this.ian?.cont;t&&(this.containerHTMLElement=new w(this.rootContainer,t,e).render().getHTMLElement(),new L().loadAllFonts(this.ian),this.ian.elems?.forEach(async r=>{await this.renderElement(this.containerHTMLElement,r,e);}),this.addEnterAnimation(this.ian.anim));}closeInApp(e){let t=this.ian.anim.getExitAnimation();this.sendTriggerClosed(e),o.ACTIVE_TRIGGER_DATA=void 0;let r=this.containerHTMLElement.animate(t,{duration:500,easing:`ease-in-out`});r.onfinish=()=>{this.removeInApp(),window.removeEventListener(`resize`,this.resizeListener);};}screenResized(){this.removeInApp(),this.startRendering();}removeInApp(){let e=document.querySelector(`.${this.triggerContext.rootClassName}`);e&&e.parentElement.removeChild(e);}skipTrigger(e,t){fe(new Ir(`CE Campaign Rejected`,t,e));}async preloadImages(e){let t=e.ian;if(!t)return;let r=[];t.elems.forEach(n=>{let l=n.bg?.img?.src;if(l&&r.push(l),n.t===1){let c=n.src;if(!c)return;r.push(c);}}),t.bg?.img?.src&&r.push(t.bg.img.src),t.cont.bg?.img?.src&&r.push(t.cont.bg.img.src),await Promise.all(r.map(n=>A$1(n)));}};
|
|
5
|
-
|
|
6
|
-
export { I as FreeformRenderer };
|