@vtex/ads-stories 0.4.0 → 0.5.0
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/CHANGELOG.md +67 -0
- package/README.md +260 -28
- package/dist/cdn/vtex-ads-stories.js +1073 -20
- package/dist/cdn/vtex-ads-stories.js.map +1 -1
- package/dist/cjs/index.cjs +4392 -315
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +198 -12
- package/dist/cjs/react.cjs.map +1 -1
- package/dist/cjs/react.d.cts +46 -5
- package/dist/esm/index.d.ts +198 -12
- package/dist/esm/index.js +2819 -291
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/react.d.ts +46 -5
- package/package.json +21 -4
- package/src/cdn.ts +7 -3
- package/src/components/card/card.ts +101 -111
- package/src/components/card/index.ts +1 -1
- package/src/components/carousel/carousel.ts +670 -0
- package/src/components/carousel/index.ts +15 -0
- package/src/components/events/events-controller.ts +212 -0
- package/src/components/events/index.ts +6 -0
- package/src/components/icons/assets/caret-left-bold.svg +1 -0
- package/src/components/icons/assets/caret-right-bold.svg +1 -0
- package/src/components/icons/assets/caret-up-bold.svg +1 -0
- package/src/components/icons/index.ts +30 -9
- package/src/components/media/index.ts +3 -0
- package/src/components/media/media.ts +70 -0
- package/src/components/media/video-controller.ts +125 -0
- package/src/components/player/index.ts +6 -2
- package/src/components/player/player.ts +946 -134
- package/src/components/product/cta.ts +56 -0
- package/src/components/product/index.ts +20 -0
- package/src/components/product/price.ts +86 -0
- package/src/components/product/product.styles.ts +369 -0
- package/src/components/product/product.ts +235 -0
- package/src/index.ts +9 -1
- package/src/locales/en.ts +29 -0
- package/src/locales/es.ts +30 -0
- package/src/locales/index.ts +36 -0
- package/src/locales/pt.ts +29 -0
- package/src/locales/types.ts +24 -0
- package/src/react.ts +49 -7
- package/src/story/index.ts +5 -1
- package/src/story/story.ts +528 -93
- package/src/tag-name.ts +1 -0
- package/src/types.ts +8 -12
- package/src/utils/fetch-story.ts +113 -0
- package/src/utils/http-url.ts +12 -0
- package/src/utils/hydrate-products.ts +88 -0
- package/src/utils/send-event.ts +71 -0
- package/src/utils/with-timeout.ts +43 -0
|
@@ -1,16 +1,487 @@
|
|
|
1
|
-
"use strict";var VtexAdsStories=(()=>{var
|
|
2
|
-
|
|
3
|
-
`;var H=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,48V88a8,8,0,0,1-16,0V56H168a8,8,0,0,1,0-16h40A8,8,0,0,1,216,48ZM88,200H56V168a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H88a8,8,0,0,0,0-16Zm120-40a8,8,0,0,0-8,8v32H168a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V168A8,8,0,0,0,208,160ZM88,40H48a8,8,0,0,0-8,8V88a8,8,0,0,0,16,0V56H88a8,8,0,0,0,0-16Z"/></svg>
|
|
4
|
-
`;var
|
|
5
|
-
`;var
|
|
6
|
-
`;var
|
|
7
|
-
`;var
|
|
8
|
-
`;var
|
|
1
|
+
"use strict";var VtexAdsStories=(()=>{var Oe=Object.defineProperty;var Ir=Object.getOwnPropertyDescriptor;var Nr=Object.getOwnPropertyNames;var Hr=Object.prototype.hasOwnProperty;var Vr=(o,e)=>{for(var t in e)Oe(o,t,{get:e[t],enumerable:!0})},Dr=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Nr(e))!Hr.call(o,i)&&i!==t&&Oe(o,i,{get:()=>e[i],enumerable:!(r=Ir(e,i))||r.enumerable});return o};var Ur=o=>Dr(Oe({},"__esModule",{value:!0}),o);var li={};Vr(li,{TAG_NAME:()=>$,VtexAdsStoryCarouselElement:()=>R,defineVtexAdsStoryCarousel:()=>ce});var pe=globalThis,ue=pe.ShadowRoot&&(pe.ShadyCSS===void 0||pe.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Me=Symbol(),lt=new WeakMap,Z=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Me)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(ue&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=lt.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&<.set(t,e))}return e}toString(){return this.cssText}},ct=o=>new Z(typeof o=="string"?o:o+"",void 0,Me),g=(o,...e)=>{let t=o.length===1?o[0]:e.reduce((r,i,s)=>r+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[s+1],o[0]);return new Z(t,o,Me)},pt=(o,e)=>{if(ue)o.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),i=pe.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,o.appendChild(r)}},Re=ue?o=>o:o=>o instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return ct(t)})(o):o;var{is:Br,defineProperty:Fr,getOwnPropertyDescriptor:zr,getOwnPropertyNames:qr,getOwnPropertySymbols:jr,getPrototypeOf:Wr}=Object,T=globalThis,ut=T.trustedTypes,Gr=ut?ut.emptyScript:"",Le=T.reactiveElementPolyfillSupport,X=(o,e)=>o,Ie={toAttribute(o,e){switch(e){case Boolean:o=o?Gr:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,e){let t=o;switch(e){case Boolean:t=o!==null;break;case Number:t=o===null?null:Number(o);break;case Object:case Array:try{t=JSON.parse(o)}catch(r){t=null}}return t}},vt=(o,e)=>!Br(o,e),ht={attribute:!0,type:String,converter:Ie,reflect:!1,useDefault:!1,hasChanged:vt},ft,mt;(ft=Symbol.metadata)!=null||(Symbol.metadata=Symbol("metadata")),(mt=T.litPropertyMetadata)!=null||(T.litPropertyMetadata=new WeakMap);var _=class extends HTMLElement{static addInitializer(e){var t;this._$Ei(),((t=this.l)!=null?t:this.l=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=ht){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&Fr(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){var n;let{get:i,set:s}=(n=zr(this.prototype,e))!=null?n:{get(){return this[t]},set(a){this[t]=a}};return{get:i,set(a){let d=i==null?void 0:i.call(this);s==null||s.call(this,a),this.requestUpdate(e,d,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){var t;return(t=this.elementProperties.get(e))!=null?t:ht}static _$Ei(){if(this.hasOwnProperty(X("elementProperties")))return;let e=Wr(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(X("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(X("properties"))){let t=this.properties,r=[...qr(t),...jr(t)];for(let i of r)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)t.unshift(Re(i))}else e!==void 0&&t.push(Re(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t,r;((t=this._$EO)!=null?t:this._$EO=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&((r=e.hostConnected)==null||r.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){var t;let e=(t=this.shadowRoot)!=null?t:this.attachShadow(this.constructor.shadowRootOptions);return pt(e,this.constructor.elementStyles),e}connectedCallback(){var e,t;(e=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(r=>{var i;return(i=r.hostConnected)==null?void 0:i.call(r)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var r;return(r=t.hostDisconnected)==null?void 0:r.call(t)})}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){var s;let r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){let n=(((s=r.converter)==null?void 0:s.toAttribute)!==void 0?r.converter:Ie).toAttribute(t,r.type);this._$Em=e,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(e,t){var s,n,a;let r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let d=r.getPropertyOptions(i),l=typeof d.converter=="function"?{fromAttribute:d.converter}:((s=d.converter)==null?void 0:s.fromAttribute)!==void 0?d.converter:Ie;this._$Em=i;let p=l.fromAttribute(t,d.type);this[i]=(a=p!=null?p:(n=this._$Ej)==null?void 0:n.get(i))!=null?a:p,this._$Em=null}}requestUpdate(e,t,r,i=!1,s){var n,a;if(e!==void 0){let d=this.constructor;if(i===!1&&(s=this[e]),r!=null||(r=d.getPropertyOptions(e)),!(((n=r.hasChanged)!=null?n:vt)(s,t)||r.useDefault&&r.reflect&&s===((a=this._$Ej)==null?void 0:a.get(e))&&!this.hasAttribute(d._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:s},n){var a,d,l;r&&!((a=this._$Ej)!=null?a:this._$Ej=new Map).has(e)&&(this._$Ej.set(e,(d=n!=null?n:t)!=null?d:this[e]),s!==!0||n!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&((l=this._$Eq)!=null?l:this._$Eq=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var r,i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if((r=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[n,a]of this._$Ep)this[n]=a;this._$Ep=void 0}let s=this.constructor.elementProperties;if(s.size>0)for(let[n,a]of s){let{wrapped:d}=a,l=this[n];d!==!0||this._$AL.has(n)||l===void 0||this.C(n,void 0,a,l)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(i=this._$EO)==null||i.forEach(s=>{var n;return(n=s.hostUpdate)==null?void 0:n.call(s)}),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(r=>{var i;return(i=r.hostUpdated)==null?void 0:i.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}},yt;_.elementStyles=[],_.shadowRootOptions={mode:"open"},_[X("elementProperties")]=new Map,_[X("finalized")]=new Map,Le==null||Le({ReactiveElement:_}),((yt=T.reactiveElementVersions)!=null?yt:T.reactiveElementVersions=[]).push("2.1.2");var Q=globalThis,gt=o=>o,he=Q.trustedTypes,bt=he?he.createPolicy("lit-html",{createHTML:o=>o}):void 0,Ve="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,De="?"+C,Kr=`<${De}>`,H=document,J=()=>H.createComment(""),ee=o=>o===null||typeof o!="object"&&typeof o!="function",Ue=Array.isArray,Ct=o=>Ue(o)||typeof(o==null?void 0:o[Symbol.iterator])=="function",Ne=`[
|
|
2
|
+
\f\r]`,Y=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,xt=/-->/g,wt=/>/g,I=RegExp(`>|${Ne}(?:([^\\s"'>=/]+)(${Ne}*=${Ne}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),$t=/'/g,St=/"/g,Et=/^(?:script|style|textarea|title)$/i,Be=o=>(e,...t)=>({_$litType$:o,strings:e,values:t}),m=Be(1),mi=Be(2),yi=Be(3),b=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),At=new WeakMap,N=H.createTreeWalker(H,129);function Pt(o,e){if(!Ue(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return bt!==void 0?bt.createHTML(e):e}var Tt=(o,e)=>{let t=o.length-1,r=[],i,s=e===2?"<svg>":e===3?"<math>":"",n=Y;for(let a=0;a<t;a++){let d=o[a],l,p,c=-1,h=0;for(;h<d.length&&(n.lastIndex=h,p=n.exec(d),p!==null);)h=n.lastIndex,n===Y?p[1]==="!--"?n=xt:p[1]!==void 0?n=wt:p[2]!==void 0?(Et.test(p[2])&&(i=RegExp("</"+p[2],"g")),n=I):p[3]!==void 0&&(n=I):n===I?p[0]===">"?(n=i!=null?i:Y,c=-1):p[1]===void 0?c=-2:(c=n.lastIndex-p[2].length,l=p[1],n=p[3]===void 0?I:p[3]==='"'?St:$t):n===St||n===$t?n=I:n===xt||n===wt?n=Y:(n=I,i=void 0);let u=n===I&&o[a+1].startsWith("/>")?" ":"";s+=n===Y?d+Kr:c>=0?(r.push(l),d.slice(0,c)+Ve+d.slice(c)+C+u):d+C+(c===-2?a:u)}return[Pt(o,s+(o[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},te=class o{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let s=0,n=0,a=e.length-1,d=this.parts,[l,p]=Tt(e,t);if(this.el=o.createElement(l,r),N.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(i=N.nextNode())!==null&&d.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let c of i.getAttributeNames())if(c.endsWith(Ve)){let h=p[n++],u=i.getAttribute(c).split(C),y=/([.?@])?(.*)/.exec(h);d.push({type:1,index:s,name:y[2],strings:u,ctor:y[1]==="."?me:y[1]==="?"?ye:y[1]==="@"?ve:D}),i.removeAttribute(c)}else c.startsWith(C)&&(d.push({type:6,index:s}),i.removeAttribute(c));if(Et.test(i.tagName)){let c=i.textContent.split(C),h=c.length-1;if(h>0){i.textContent=he?he.emptyScript:"";for(let u=0;u<h;u++)i.append(c[u],J()),N.nextNode(),d.push({type:2,index:++s});i.append(c[h],J())}}}else if(i.nodeType===8)if(i.data===De)d.push({type:2,index:s});else{let c=-1;for(;(c=i.data.indexOf(C,c+1))!==-1;)d.push({type:7,index:s}),c+=C.length-1}s++}}static createElement(e,t){let r=H.createElement("template");return r.innerHTML=e,r}};function V(o,e,t=o,r){var n,a,d;if(e===b)return e;let i=r!==void 0?(n=t._$Co)==null?void 0:n[r]:t._$Cl,s=ee(e)?void 0:e._$litDirective$;return(i==null?void 0:i.constructor)!==s&&((a=i==null?void 0:i._$AO)==null||a.call(i,!1),s===void 0?i=void 0:(i=new s(o),i._$AT(o,t,r)),r!==void 0?((d=t._$Co)!=null?d:t._$Co=[])[r]=i:t._$Cl=i),i!==void 0&&(e=V(o,i._$AS(o,e.values),i,r)),e}var fe=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var l;let{el:{content:t},parts:r}=this._$AD,i=((l=e==null?void 0:e.creationScope)!=null?l:H).importNode(t,!0);N.currentNode=i;let s=N.nextNode(),n=0,a=0,d=r[0];for(;d!==void 0;){if(n===d.index){let p;d.type===2?p=new F(s,s.nextSibling,this,e):d.type===1?p=new d.ctor(s,d.name,d.strings,this,e):d.type===6&&(p=new ge(s,this,e)),this._$AV.push(p),d=r[++a]}n!==(d==null?void 0:d.index)&&(s=N.nextNode(),n++)}return N.currentNode=H,i}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},F=class o{get _$AU(){var e,t;return(t=(e=this._$AM)==null?void 0:e._$AU)!=null?t:this._$Cv}constructor(e,t,r,i){var s;this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=(s=i==null?void 0:i.isConnected)!=null?s:!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=V(this,e,t),ee(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==b&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ct(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==f&&ee(this._$AH)?this._$AA.nextSibling.data=e:this.T(H.createTextNode(e)),this._$AH=e}$(e){var s;let{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=te.createElement(Pt(r.h,r.h[0]),this.options)),r);if(((s=this._$AH)==null?void 0:s._$AD)===i)this._$AH.p(t);else{let n=new fe(i,this),a=n.u(this.options);n.p(t),this.T(a),this._$AH=n}}_$AC(e){let t=At.get(e.strings);return t===void 0&&At.set(e.strings,t=new te(e)),t}k(e){Ue(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,i=0;for(let s of e)i===t.length?t.push(r=new o(this.O(J()),this.O(J()),this,this.options)):r=t[i],r._$AI(s),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,t);e!==this._$AB;){let i=gt(e).nextSibling;gt(e).remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}},D=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,s){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=f}_$AI(e,t=this,r,i){let s=this.strings,n=!1;if(s===void 0)e=V(this,e,t,0),n=!ee(e)||e!==this._$AH&&e!==b,n&&(this._$AH=e);else{let a=e,d,l;for(e=s[0],d=0;d<s.length-1;d++)l=V(this,a[r+d],t,d),l===b&&(l=this._$AH[d]),n||(n=!ee(l)||l!==this._$AH[d]),l===f?e=f:e!==f&&(e+=(l!=null?l:"")+s[d+1]),this._$AH[d]=l}n&&!i&&this.j(e)}j(e){e===f?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e!=null?e:"")}},me=class extends D{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===f?void 0:e}},ye=class extends D{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==f)}},ve=class extends D{constructor(e,t,r,i,s){super(e,t,r,i,s),this.type=5}_$AI(e,t=this){var n;if((e=(n=V(this,e,t,0))!=null?n:f)===b)return;let r=this._$AH,i=e===f&&r!==f||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,s=e!==f&&(r===f||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,r;typeof this._$AH=="function"?this._$AH.call((r=(t=this.options)==null?void 0:t.host)!=null?r:this.element,e):this._$AH.handleEvent(e)}},ge=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){V(this,e)}},kt={M:Ve,P:C,A:De,C:1,L:Tt,R:fe,D:Ct,V,I:F,H:D,N:ye,U:ve,B:me,F:ge},He=Q.litHtmlPolyfillSupport,_t;He==null||He(te,F),((_t=Q.litHtmlVersions)!=null?_t:Q.litHtmlVersions=[]).push("3.3.3");var Ot=(o,e,t)=>{var s,n;let r=(s=t==null?void 0:t.renderBefore)!=null?s:e,i=r._$litPart$;if(i===void 0){let a=(n=t==null?void 0:t.renderBefore)!=null?n:null;r._$litPart$=i=new F(e.insertBefore(J(),a),a,void 0,t!=null?t:{})}return i._$AI(o),i};var U=globalThis,k=class extends _{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,r;let e=super.createRenderRoot();return(r=(t=this.renderOptions).renderBefore)!=null||(t.renderBefore=e.firstChild),e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ot(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return b}},Mt;k._$litElement$=!0,k.finalized=!0,(Mt=U.litElementHydrateSupport)==null||Mt.call(U,{LitElement:k});var Fe=U.litElementPolyfillSupport;Fe==null||Fe({LitElement:k});var Rt;((Rt=U.litElementVersions)!=null?Rt:U.litElementVersions=[]).push("4.2.2");var{I:Zr}=kt,Lt=o=>o;var Nt=o=>o.strings===void 0,It=()=>document.createComment(""),z=(o,e,t)=>{var s;let r=o._$AA.parentNode,i=e===void 0?o._$AB:e._$AA;if(t===void 0){let n=r.insertBefore(It(),i),a=r.insertBefore(It(),i);t=new Zr(n,a,o,o.options)}else{let n=t._$AB.nextSibling,a=t._$AM,d=a!==o;if(d){let l;(s=t._$AQ)==null||s.call(t,o),t._$AM=o,t._$AP!==void 0&&(l=o._$AU)!==a._$AU&&t._$AP(l)}if(n!==i||d){let l=t._$AA;for(;l!==n;){let p=Lt(l).nextSibling;Lt(r).insertBefore(l,i),l=p}}}return t},O=(o,e,t=o)=>(o._$AI(e,t),o),Xr={},Ht=(o,e=Xr)=>o._$AH=e,Vt=o=>o._$AH,be=o=>{o._$AR(),o._$AA.remove()};var M={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},E=o=>(...e)=>({_$litDirective$:o,values:e}),S=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var re=(o,e)=>{var r;let t=o._$AN;if(t===void 0)return!1;for(let i of t)(r=i._$AO)==null||r.call(i,e,!1),re(i,e);return!0},xe=o=>{let e,t;do{if((e=o._$AM)===void 0)break;t=e._$AN,t.delete(o),o=e}while((t==null?void 0:t.size)===0)},Dt=o=>{for(let e;e=o._$AM;o=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(o))break;t.add(o),Jr(e)}};function Yr(o){this._$AN!==void 0?(xe(this),this._$AM=o,Dt(this)):this._$AM=o}function Qr(o,e=!1,t=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(r))for(let s=t;s<r.length;s++)re(r[s],!1),xe(r[s]);else r!=null&&(re(r,!1),xe(r));else re(this,o)}var Jr=o=>{var e,t;o.type==M.CHILD&&((e=o._$AP)!=null||(o._$AP=Qr),(t=o._$AQ)!=null||(o._$AQ=Yr))},we=class extends S{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),Dt(this),this.isConnected=e._$AU}_$AO(e,t=!0){var r,i;e!==this.isConnected&&(this.isConnected=e,e?(r=this.reconnected)==null||r.call(this):(i=this.disconnected)==null||i.call(this)),t&&(re(this,e),xe(this))}setValue(e){if(Nt(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var P=()=>new qe,qe=class{},ze=new WeakMap,x=E(class extends we{render(o){return f}update(o,[e]){var r;let t=e!==this.G;return t&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=(r=o.options)==null?void 0:r.host,this.rt(this.ct=o.element)),f}rt(o){var e;if(this.G!==void 0)if(this.isConnected||(o=void 0),typeof this.G=="function"){let t=(e=this.ht)!=null?e:globalThis,r=ze.get(t);r===void 0&&(r=new WeakMap,ze.set(t,r)),r.get(this.G)!==void 0&&this.G.call(this.ht,void 0),r.set(this.G,o),o!==void 0&&this.G.call(this.ht,o)}else this.G.value=o}get lt(){var o,e,t;return typeof this.G=="function"?(e=ze.get((o=this.ht)!=null?o:globalThis))==null?void 0:e.get(this.G):(t=this.G)==null?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var oe=class extends S{constructor(e){if(super(e),this.it=f,e.type!==M.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===f||e==null)return this._t=void 0,this.it=e;if(e===b)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};oe.directiveName="unsafeHTML",oe.resultType=1;var Ut=E(oe);var Bt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M168.49,199.51a12,12,0,0,1-17,17l-80-80a12,12,0,0,1,0-17l80-80a12,12,0,0,1,17,17L97,128Z"/></svg>
|
|
4
|
+
`;var Ft=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z"/></svg>
|
|
5
|
+
`;var zt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"/></svg>
|
|
6
|
+
`;var qt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"/></svg>';var jt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M152,96V48a8,8,0,0,1,16,0V88h40a8,8,0,0,1,0,16H160A8,8,0,0,1,152,96ZM96,152H48a8,8,0,0,0,0,16H88v40a8,8,0,0,0,16,0V160A8,8,0,0,0,96,152Zm112,0H160a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V168h40a8,8,0,0,0,0-16ZM96,40a8,8,0,0,0-8,8V88H48a8,8,0,0,0,0,16H96a8,8,0,0,0,8-8V48A8,8,0,0,0,96,40Z"/></svg>
|
|
7
|
+
`;var Wt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,48V88a8,8,0,0,1-16,0V56H168a8,8,0,0,1,0-16h40A8,8,0,0,1,216,48ZM88,200H56V168a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H88a8,8,0,0,0,0-16Zm120-40a8,8,0,0,0-8,8v32H168a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V168A8,8,0,0,0,208,160ZM88,40H48a8,8,0,0,0-8,8V88a8,8,0,0,0,16,0V56H88a8,8,0,0,0,0-16Z"/></svg>
|
|
8
|
+
`;var Gt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,48V208a16,16,0,0,1-16,16H160a16,16,0,0,1-16-16V48a16,16,0,0,1,16-16h40A16,16,0,0,1,216,48ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Z"/></svg>
|
|
9
|
+
`;var Kt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,128a15.74,15.74,0,0,1-7.6,13.51L88.32,229.65a16,16,0,0,1-16.2.3A15.86,15.86,0,0,1,64,216.13V39.87a15.86,15.86,0,0,1,8.12-13.82,16,16,0,0,1,16.2.3L232.4,114.49A15.74,15.74,0,0,1,240,128Z"/></svg>
|
|
10
|
+
`;var Zt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M245.66,146.34a8,8,0,0,1-11.32,11.32L216,139.31l-18.34,18.35a8,8,0,0,1-11.32-11.32L204.69,128l-18.35-18.34a8,8,0,0,1,11.32-11.32L216,116.69l18.34-18.35a8,8,0,0,1,11.32,11.32L227.31,128ZM60,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H60a4,4,0,0,0,4-4V84A4,4,0,0,0,60,80Zm97.15-54.15a8,8,0,0,0-10-.16l-65.57,51A4,4,0,0,0,80,79.84v96.32a4,4,0,0,0,1.55,3.15l65.57,51a8,8,0,0,0,9,.56,8.29,8.29,0,0,0,3.91-7.18V32.25A8.27,8.27,0,0,0,157.12,25.85Z"/></svg>
|
|
11
|
+
`;var Xt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M160,32.25V223.69a8.29,8.29,0,0,1-3.91,7.18,8,8,0,0,1-9-.56l-65.57-51A4,4,0,0,1,80,176.16V79.84a4,4,0,0,1,1.55-3.15l65.57-51a8,8,0,0,1,10,.16A8.27,8.27,0,0,1,160,32.25ZM60,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H60a4,4,0,0,0,4-4V84A4,4,0,0,0,60,80Zm126.77,20.84a8,8,0,0,0-.72,11.3,24,24,0,0,1,0,31.72,8,8,0,1,0,12,10.58,40,40,0,0,0,0-52.88A8,8,0,0,0,186.74,100.84Zm40.89-26.17a8,8,0,1,0-11.92,10.66,64,64,0,0,1,0,85.34,8,8,0,1,0,11.92,10.66,80,80,0,0,0,0-106.66Z"/></svg>
|
|
12
|
+
`;var po={caretUp:qt,close:zt,collapse:jt,expand:Wt,next:Ft,pause:Gt,play:Kt,previous:Bt,soundOff:Zt,soundOn:Xt},uo=Object.fromEntries(Object.entries(po).map(([o,e])=>[o,e.replace("<svg",'<svg class="icon" aria-hidden="true" focusable="false"')]));function v(o){return Ut(uo[o])}function w(o){if(!o)return null;try{let{protocol:e}=new URL(o);return e==="https:"||e==="http:"?o:null}catch(e){return null}}function $e(){var o,e;return(e=(o=globalThis.matchMedia)==null?void 0:o.call(globalThis,"(prefers-reduced-motion: reduce)").matches)!=null?e:!1}function q(o,e){return!e.failed&&w(o.media_url)!==null}function ie(o,e,{withVideo:t=!0,loop:r=!0,onEnded:i}={}){let s=w(o.poster_url),n=t?w(o.media_url):null;return m`
|
|
13
|
+
${s?m`<img class="poster" alt="" src=${s} />`:f}
|
|
14
|
+
${n&&!e.failed?m`
|
|
15
|
+
<video
|
|
16
|
+
class="video"
|
|
17
|
+
muted
|
|
18
|
+
playsinline
|
|
19
|
+
?loop=${r}
|
|
20
|
+
preload="metadata"
|
|
21
|
+
.muted=${!0}
|
|
22
|
+
?autoplay=${!$e()}
|
|
23
|
+
poster=${s!=null?s:f}
|
|
24
|
+
src=${n}
|
|
25
|
+
${x(e.ref)}
|
|
26
|
+
@play=${e.sync}
|
|
27
|
+
@pause=${e.sync}
|
|
28
|
+
@volumechange=${e.sync}
|
|
29
|
+
@error=${e.fail}
|
|
30
|
+
@ended=${i}
|
|
31
|
+
></video>
|
|
32
|
+
`:f}
|
|
33
|
+
`}function j(o){var e;(e=o.play())==null||e.catch(()=>{})}var B=class{constructor(e){this.host=e;this.ref=P();this.paused=!0;this.muted=!0;this.failed=!1;this.sync=()=>{let e=this.ref.value;e&&(this.paused=e.paused,this.muted=e.muted,this.host.requestUpdate())};this.fail=()=>{this.failed=!0,this.host.requestUpdate()}}get playing(){let e=this.ref.value;return!!e&&e.isConnected&&!e.paused}reset(){this.paused=!0,this.muted=!0,this.failed=!1}play(){let e=this.ref.value;e&&j(e)}pause(){var e;(e=this.ref.value)==null||e.pause()}resume(){let e=this.ref.value;e!=null&&e.autoplay&&j(e)}togglePlayback(){let e=this.ref.value;e&&(e.paused?j(e):e.pause())}mute(){let e=this.ref.value;e&&(e.muted=!0)}restart({withSound:e=!1}={}){let t=this.ref.value;t&&(t.currentTime=0,e?this.playWithSound():j(t))}playWithSound(){var t;let e=this.ref.value;e&&(e.muted=!1,(t=e.play())==null||t.catch(r=>{!(r instanceof DOMException&&r.name==="NotAllowedError")||this.ref.value!==e||!e.isConnected||(e.muted=!0,j(e))}))}toggleMuted(){let e=this.ref.value;e&&(e.muted=!e.muted)}};var Se="pt-BR";function Yt(o){let e=Number.NaN;return typeof o=="number"?e=o:typeof o=="string"&&o.trim()!==""&&(e=Number(o)),Number.isFinite(e)&&e>0?e:void 0}function We(o){let e=Yt(o==null?void 0:o.price),t=Yt(o==null?void 0:o.promotional_price);return t!==void 0&&(e===void 0||t<e)?e===void 0?{price:t}:{price:t,listPrice:e}:e===void 0?void 0:{price:e}}function ho(o){try{return Intl.NumberFormat.supportedLocalesOf(o).length>0}catch(e){return!1}}var je=Intl;function fo(o){var t;if(!/^[a-z]{3}$/i.test(o))return!1;let e=(t=je.supportedValuesOf)==null?void 0:t.call(je,"currency");return e?e.includes(o.toUpperCase()):!0}function Ge(o,e){let t=new Intl.NumberFormat(o&&ho(o)?o:Se,{style:"currency",currency:e&&fo(e)?e:"BRL"});return r=>t.format(r)}function Ke(o,e,t,r){var p,c,h,u;let i=o.product,s=(p=i==null?void 0:i.product_name)==null?void 0:p.trim();if(!i||!s)return;let n={name:s,imageUrl:(c=w(i.image_url))!=null?c:void 0,url:(h=w(o.destination_url))!=null?h:void 0};if(r==="loading")return{...n,label:t.product(s),isLoading:!0};if((r==null?void 0:r.available)===!1)return{...n,label:t.product(s,t.soldOut),soldOut:t.soldOut};let a=(u=r==null?void 0:r.price)!=null?u:We(i.product_metadata),d=a&&e(a.price),l=(a==null?void 0:a.listPrice)===void 0?void 0:e(a.listPrice);return{...n,price:d,listPrice:l,label:t.product(s,d,l)}}var mo=m`
|
|
34
|
+
<span
|
|
35
|
+
class="product-price product-loading product-price-loading"
|
|
36
|
+
aria-hidden="true"
|
|
37
|
+
></span>
|
|
38
|
+
`,yo=m`
|
|
39
|
+
<span
|
|
40
|
+
class="product-loading product-add-to-cart-loading"
|
|
41
|
+
aria-hidden="true"
|
|
42
|
+
></span>
|
|
43
|
+
`;function vo({isLoading:o,soldOut:e,price:t,listPrice:r}){return o?mo:e?m`<span class="product-price product-sold-out">${e}</span>`:t?m`
|
|
44
|
+
<span class="product-price">
|
|
45
|
+
<span>${t}</span>
|
|
46
|
+
${r?m`<s class="product-list-price">${r}</s>`:f}
|
|
47
|
+
</span>
|
|
48
|
+
`:f}function Qt(o){return m`
|
|
49
|
+
${o.imageUrl?m`<img class="product-image" alt="" src=${o.imageUrl} />`:f}
|
|
50
|
+
<span class="product-info">
|
|
51
|
+
<span class="product-name">${o.name}</span>
|
|
52
|
+
${vo(o)}
|
|
53
|
+
</span>
|
|
54
|
+
`}function Ze(o,e){return m`
|
|
55
|
+
<button
|
|
56
|
+
type="button"
|
|
57
|
+
class="card-product"
|
|
58
|
+
aria-label=${o.label}
|
|
59
|
+
@click=${e}
|
|
60
|
+
>
|
|
61
|
+
${Qt(o)}
|
|
62
|
+
</button>
|
|
63
|
+
`}function go({isLoading:o,soldOut:e},{labels:t}){return o?yo:e?m`
|
|
64
|
+
<button type="button" class="product-action product-unavailable" disabled>
|
|
65
|
+
${t.unavailable}
|
|
66
|
+
</button>
|
|
67
|
+
`:m`
|
|
68
|
+
<button type="button" class="product-action product-add-to-cart">
|
|
69
|
+
${t.addToCart}
|
|
70
|
+
</button>
|
|
71
|
+
`}function Xe(o,e){let{open:t}=e;return m`
|
|
72
|
+
<div class="card-product product-expandable" ?data-open=${t}>
|
|
73
|
+
<button
|
|
74
|
+
type="button"
|
|
75
|
+
class="product-summary"
|
|
76
|
+
aria-label=${o.label}
|
|
77
|
+
aria-expanded=${t?"true":"false"}
|
|
78
|
+
aria-controls=${e.panelId}
|
|
79
|
+
@click=${e.onToggle}
|
|
80
|
+
>
|
|
81
|
+
${Qt(o)}
|
|
82
|
+
<span class="product-toggle">${v("caretUp")}</span>
|
|
83
|
+
</button>
|
|
84
|
+
<div id=${e.panelId} class="product-panel" ?inert=${!t}>
|
|
85
|
+
<div class="product-actions">
|
|
86
|
+
${go(o,e)}
|
|
87
|
+
${o.url?m`
|
|
88
|
+
<a
|
|
89
|
+
class="product-action product-view"
|
|
90
|
+
href=${o.url}
|
|
91
|
+
target="_blank"
|
|
92
|
+
rel="noopener noreferrer"
|
|
93
|
+
>
|
|
94
|
+
${e.labels.viewProduct}
|
|
95
|
+
</a>
|
|
96
|
+
`:f}
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
`}function Ae(o){var r;if(o.product)return;let e=(r=o.call_to_action)==null?void 0:r.trim(),t=w(o.destination_url);return e&&t?{label:e,url:t}:void 0}function se(o,e){let t=e?r=>{r.preventDefault(),e()}:void 0;return m`
|
|
101
|
+
<a
|
|
102
|
+
class="card-cta"
|
|
103
|
+
href=${o.url}
|
|
104
|
+
target="_blank"
|
|
105
|
+
rel="noopener noreferrer"
|
|
106
|
+
@click=${t}
|
|
107
|
+
>
|
|
108
|
+
<span class="cta-label">${o.label}</span>
|
|
109
|
+
${v("next")}
|
|
110
|
+
</a>
|
|
111
|
+
`}var Ye=g`
|
|
112
|
+
/* A glass pill at the bottom of the card, above its button: the product or
|
|
113
|
+
the call to action. */
|
|
114
|
+
.card-product,
|
|
115
|
+
.card-cta {
|
|
116
|
+
position: absolute;
|
|
117
|
+
right: 12px;
|
|
118
|
+
bottom: 12px;
|
|
119
|
+
left: 12px;
|
|
120
|
+
z-index: 1;
|
|
121
|
+
display: flex;
|
|
122
|
+
gap: 8px;
|
|
123
|
+
align-items: center;
|
|
124
|
+
box-sizing: border-box;
|
|
125
|
+
padding: 8px;
|
|
126
|
+
border: 0;
|
|
127
|
+
border-radius: 16px;
|
|
128
|
+
background: rgba(255, 255, 255, 0.15);
|
|
129
|
+
backdrop-filter: blur(5px);
|
|
130
|
+
color: #fff;
|
|
131
|
+
font: inherit;
|
|
132
|
+
text-align: left;
|
|
133
|
+
isolation: isolate;
|
|
134
|
+
transition: transform 0.2s ease;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* The glass's tint and inner light, darker on hover. */
|
|
138
|
+
.card-product::before,
|
|
139
|
+
.card-cta::before {
|
|
140
|
+
position: absolute;
|
|
141
|
+
inset: 0;
|
|
142
|
+
z-index: -1;
|
|
143
|
+
border-radius: inherit;
|
|
144
|
+
background: rgba(0, 0, 0, 0.15);
|
|
145
|
+
box-shadow: inset 0 0 3px rgba(255, 255, 255, 0.42);
|
|
146
|
+
content: "";
|
|
147
|
+
transition: background-color 0.2s ease;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
button.card-product,
|
|
151
|
+
.card-cta {
|
|
152
|
+
cursor: pointer;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.card-product:focus-visible,
|
|
156
|
+
.card-cta:focus-visible {
|
|
157
|
+
outline: 2px solid #fff;
|
|
158
|
+
outline-offset: 2px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@media (hover: hover) and (pointer: fine) {
|
|
162
|
+
.card-product:hover,
|
|
163
|
+
.card-cta:hover {
|
|
164
|
+
transform: translateY(-2px);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.card-product:hover::before,
|
|
168
|
+
.card-cta:hover::before {
|
|
169
|
+
background: rgba(0, 0, 0, 0.32);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/* A Story with a link: the pill is the call to action, its text centered
|
|
174
|
+
with a caret after it. */
|
|
175
|
+
.card-cta {
|
|
176
|
+
justify-content: center;
|
|
177
|
+
gap: 6px;
|
|
178
|
+
height: 48px;
|
|
179
|
+
padding: 0 16px;
|
|
180
|
+
font-size: 14px;
|
|
181
|
+
font-weight: 700;
|
|
182
|
+
line-height: 1;
|
|
183
|
+
text-decoration: none;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.cta-label {
|
|
187
|
+
min-width: 0;
|
|
188
|
+
overflow: hidden;
|
|
189
|
+
text-overflow: ellipsis;
|
|
190
|
+
white-space: nowrap;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.card-cta .icon {
|
|
194
|
+
flex: none;
|
|
195
|
+
width: 14px;
|
|
196
|
+
height: 14px;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/* In the player: the pill is a toggle, with the actions panel below. */
|
|
200
|
+
.product-expandable {
|
|
201
|
+
display: block;
|
|
202
|
+
padding: 0;
|
|
203
|
+
transition:
|
|
204
|
+
background-color 0.3s ease,
|
|
205
|
+
color 0.3s ease,
|
|
206
|
+
box-shadow 0.3s ease,
|
|
207
|
+
transform 0.2s ease;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.product-expandable::before {
|
|
211
|
+
transition:
|
|
212
|
+
opacity 0.3s ease,
|
|
213
|
+
background-color 0.2s ease;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.product-summary {
|
|
217
|
+
display: flex;
|
|
218
|
+
gap: 8px;
|
|
219
|
+
align-items: center;
|
|
220
|
+
box-sizing: border-box;
|
|
221
|
+
width: 100%;
|
|
222
|
+
padding: 8px;
|
|
223
|
+
border: 0;
|
|
224
|
+
border-radius: inherit;
|
|
225
|
+
background: transparent;
|
|
226
|
+
color: inherit;
|
|
227
|
+
font: inherit;
|
|
228
|
+
text-align: left;
|
|
229
|
+
cursor: pointer;
|
|
230
|
+
transition: padding 0.3s ease;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.product-summary:focus-visible {
|
|
234
|
+
outline: 2px solid currentColor;
|
|
235
|
+
outline-offset: 2px;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/* The caret points up while closed and down while open. */
|
|
239
|
+
.product-toggle {
|
|
240
|
+
display: grid;
|
|
241
|
+
flex: none;
|
|
242
|
+
margin-right: 4px;
|
|
243
|
+
opacity: 0.7;
|
|
244
|
+
transition:
|
|
245
|
+
transform 0.3s ease,
|
|
246
|
+
opacity 0.2s ease;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.product-toggle .icon {
|
|
250
|
+
width: 14px;
|
|
251
|
+
height: 14px;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.product-summary:hover .product-toggle {
|
|
255
|
+
opacity: 1;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/* Closed: 0 rows tall, so it grows smoothly when it opens. */
|
|
259
|
+
.product-panel {
|
|
260
|
+
display: grid;
|
|
261
|
+
grid-template-rows: 0fr;
|
|
262
|
+
transition: grid-template-rows 0.3s ease;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.product-actions {
|
|
266
|
+
display: grid;
|
|
267
|
+
gap: 8px;
|
|
268
|
+
min-height: 0;
|
|
269
|
+
overflow: hidden;
|
|
270
|
+
padding: 0 12px;
|
|
271
|
+
opacity: 0;
|
|
272
|
+
transition:
|
|
273
|
+
padding 0.3s ease,
|
|
274
|
+
opacity 0.2s ease;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.product-action {
|
|
278
|
+
display: flex;
|
|
279
|
+
align-items: center;
|
|
280
|
+
justify-content: center;
|
|
281
|
+
box-sizing: border-box;
|
|
282
|
+
height: 48px;
|
|
283
|
+
padding: 0 16px;
|
|
284
|
+
border: 1px solid var(--vtex-ads-story-color-accent, #1b75a8);
|
|
285
|
+
border-radius: 50px;
|
|
286
|
+
font: inherit;
|
|
287
|
+
font-size: 14px;
|
|
288
|
+
font-weight: 700;
|
|
289
|
+
text-decoration: none;
|
|
290
|
+
cursor: pointer;
|
|
291
|
+
transition: background-color 0.2s ease;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.product-action:focus-visible {
|
|
295
|
+
outline: 2px solid var(--vtex-ads-story-color-accent, #1b75a8);
|
|
296
|
+
outline-offset: 2px;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.product-add-to-cart {
|
|
300
|
+
background: var(--vtex-ads-story-color-accent, #1b75a8);
|
|
301
|
+
color: var(--vtex-ads-story-color-accent-contrast, #fff);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.product-add-to-cart:hover {
|
|
305
|
+
background: color-mix(
|
|
306
|
+
in srgb,
|
|
307
|
+
var(--vtex-ads-story-color-accent, #1b75a8) 85%,
|
|
308
|
+
#000
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/* Sold out: add to cart, disabled and grayed. */
|
|
313
|
+
.product-unavailable {
|
|
314
|
+
border-color: transparent;
|
|
315
|
+
background: rgba(0, 0, 0, 0.06);
|
|
316
|
+
color: var(--vtex-ads-story-color-muted, #6b6b6b);
|
|
317
|
+
cursor: not-allowed;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.product-view {
|
|
321
|
+
background: var(--vtex-ads-story-color-surface, #fff);
|
|
322
|
+
color: var(--vtex-ads-story-color-accent, #1b75a8);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/* A light tint of the accent. */
|
|
326
|
+
.product-view:hover {
|
|
327
|
+
background: color-mix(
|
|
328
|
+
in srgb,
|
|
329
|
+
var(--vtex-ads-story-color-accent, #1b75a8) 8%,
|
|
330
|
+
var(--vtex-ads-story-color-surface, #fff)
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/* Open: a solid card (white by default), without the glass. */
|
|
335
|
+
.product-expandable[data-open] {
|
|
336
|
+
background: var(--vtex-ads-story-color-surface, #fff);
|
|
337
|
+
color: var(--vtex-ads-story-color-text, #242424);
|
|
338
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.product-expandable[data-open]::before {
|
|
342
|
+
opacity: 0;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.product-expandable[data-open] .product-price {
|
|
346
|
+
color: inherit;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.product-expandable[data-open] .product-list-price {
|
|
350
|
+
color: var(--vtex-ads-story-color-muted, #6b6b6b);
|
|
351
|
+
opacity: 1;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.product-expandable[data-open] .product-summary {
|
|
355
|
+
padding: 12px;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.product-expandable[data-open] .product-toggle {
|
|
359
|
+
transform: rotate(180deg);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.product-expandable[data-open] .product-panel {
|
|
363
|
+
grid-template-rows: 1fr;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.product-expandable[data-open] .product-actions {
|
|
367
|
+
padding: 0 12px 12px;
|
|
368
|
+
opacity: 1;
|
|
369
|
+
transition:
|
|
370
|
+
padding 0.3s ease,
|
|
371
|
+
opacity 0.25s ease 0.1s;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/* Open, it stays in place on hover. */
|
|
375
|
+
@media (hover: hover) and (pointer: fine) {
|
|
376
|
+
.product-expandable[data-open]:hover {
|
|
377
|
+
transform: none;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
@media (prefers-reduced-motion: reduce) {
|
|
382
|
+
.card-product,
|
|
383
|
+
.card-product:hover,
|
|
384
|
+
.card-cta,
|
|
385
|
+
.card-cta:hover {
|
|
386
|
+
transform: none;
|
|
387
|
+
transition: none;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.card-product::before,
|
|
391
|
+
.card-cta::before,
|
|
392
|
+
.product-summary,
|
|
393
|
+
.product-toggle,
|
|
394
|
+
.product-panel,
|
|
395
|
+
.product-actions,
|
|
396
|
+
.product-expandable[data-open] .product-actions {
|
|
397
|
+
transition: none;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.product-image {
|
|
402
|
+
flex: none;
|
|
403
|
+
width: 60px;
|
|
404
|
+
height: 60px;
|
|
405
|
+
border-radius: 8px;
|
|
406
|
+
background: #fff;
|
|
407
|
+
object-fit: contain;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.product-info {
|
|
411
|
+
display: grid;
|
|
412
|
+
flex: 1;
|
|
413
|
+
gap: 4px;
|
|
414
|
+
min-width: 0;
|
|
415
|
+
font-size: 12px;
|
|
416
|
+
font-weight: 700;
|
|
417
|
+
line-height: 16px;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
.product-name {
|
|
421
|
+
display: -webkit-box;
|
|
422
|
+
overflow: hidden;
|
|
423
|
+
-webkit-box-orient: vertical;
|
|
424
|
+
-webkit-line-clamp: 2;
|
|
425
|
+
overflow-wrap: anywhere;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.product-price {
|
|
429
|
+
display: flex;
|
|
430
|
+
flex-wrap: wrap;
|
|
431
|
+
gap: 0 6px;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
.product-list-price {
|
|
435
|
+
font-weight: 400;
|
|
436
|
+
opacity: 0.5;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/* In place of the price, for a product that can't be bought. */
|
|
440
|
+
.product-sold-out {
|
|
441
|
+
font-weight: 700;
|
|
442
|
+
opacity: 0.75;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/* Placeholders while the product loads, pulsing gently. */
|
|
446
|
+
.product-loading {
|
|
447
|
+
background: currentColor;
|
|
448
|
+
opacity: 0.25;
|
|
449
|
+
animation: product-loading-pulse 1.2s ease-in-out infinite alternate;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
@keyframes product-loading-pulse {
|
|
453
|
+
to {
|
|
454
|
+
opacity: 0.1;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/* The price's: a line its height (the info's line height). */
|
|
459
|
+
.product-price-loading {
|
|
460
|
+
width: 64px;
|
|
461
|
+
height: 16px;
|
|
462
|
+
border-radius: 4px;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/* The add to cart button's: its size and shape. */
|
|
466
|
+
.product-add-to-cart-loading {
|
|
467
|
+
display: block;
|
|
468
|
+
height: 48px;
|
|
469
|
+
border-radius: 50px;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
@media (prefers-reduced-motion: reduce) {
|
|
473
|
+
.product-loading {
|
|
474
|
+
animation: none;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
`;var Qe=g`
|
|
478
|
+
/* 9:16 at the height its container gives it (--card-height, default
|
|
479
|
+
500px). */
|
|
9
480
|
.card {
|
|
10
481
|
position: relative;
|
|
11
482
|
box-sizing: border-box;
|
|
12
|
-
width: calc(500px * 9 / 16);
|
|
13
|
-
height: 500px;
|
|
483
|
+
width: calc(var(--card-height, 500px) * 9 / 16);
|
|
484
|
+
height: var(--card-height, 500px);
|
|
14
485
|
overflow: hidden;
|
|
15
486
|
border-radius: var(--vtex-ads-story-radius, 20px);
|
|
16
487
|
background: #000;
|
|
@@ -111,7 +582,245 @@
|
|
|
111
582
|
transform: translate(-50%, -50%);
|
|
112
583
|
}
|
|
113
584
|
}
|
|
114
|
-
`;function
|
|
585
|
+
`;function bo(o,e){return m`
|
|
586
|
+
<button
|
|
587
|
+
type="button"
|
|
588
|
+
class="card-sound"
|
|
589
|
+
aria-label=${o.muted?e.labels.soundOn:e.labels.soundOff}
|
|
590
|
+
@click=${()=>o.toggleMuted()}
|
|
591
|
+
>
|
|
592
|
+
${v(o.muted?"soundOff":"soundOn")}
|
|
593
|
+
</button>
|
|
594
|
+
`}function Je(o,e,t){var i,s;let r=(i=t.withVideo)!=null?i:!0;return m`
|
|
595
|
+
<div
|
|
596
|
+
class="card"
|
|
597
|
+
${x(t.ref)}
|
|
598
|
+
@click=${{handleEvent:()=>{var n;return(n=t.onPress)==null?void 0:n.call(t)},capture:!0}}
|
|
599
|
+
>
|
|
600
|
+
${ie(o,e,{withVideo:r})}
|
|
601
|
+
<button
|
|
602
|
+
type="button"
|
|
603
|
+
class="card-open"
|
|
604
|
+
${x(t.openRef)}
|
|
605
|
+
aria-label=${t.label}
|
|
606
|
+
@click=${t.onSelect}
|
|
607
|
+
>
|
|
608
|
+
<span class="play" aria-hidden="true">${v("play")}</span>
|
|
609
|
+
</button>
|
|
610
|
+
${r&&q(o,e)&&!e.paused?bo(e,t):f}
|
|
611
|
+
${t.product?Ze(t.product,(s=t.onProductSelect)!=null?s:t.onSelect):f}
|
|
612
|
+
${t.cta?se(t.cta,t.onCtaSelect):f}
|
|
613
|
+
</div>
|
|
614
|
+
`}var Jt=(o,e,t)=>{let r=new Map;for(let i=e;i<=t;i++)r.set(o[i],i);return r},_e=E(class extends S{constructor(o){if(super(o),o.type!==M.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,e,t){let r;t===void 0?t=e:e!==void 0&&(r=e);let i=[],s=[],n=0;for(let a of o)i[n]=r?r(a,n):n,s[n]=t(a,n),n++;return{values:s,keys:i}}render(o,e,t){return this.dt(o,e,t).values}update(o,[e,t,r]){var L;let i=Vt(o),{values:s,keys:n}=this.dt(e,t,r);if(!Array.isArray(i))return this.ut=n,s;let a=(L=this.ut)!=null?L:this.ut=[],d=[],l,p,c=0,h=i.length-1,u=0,y=s.length-1;for(;c<=h&&u<=y;)if(i[c]===null)c++;else if(i[h]===null)h--;else if(a[c]===n[u])d[u]=O(i[c],s[u]),c++,u++;else if(a[h]===n[y])d[y]=O(i[h],s[y]),h--,y--;else if(a[c]===n[y])d[y]=O(i[c],s[y]),z(o,d[y+1],i[c]),c++,y--;else if(a[h]===n[u])d[u]=O(i[h],s[u]),z(o,i[c],i[h]),h--,u++;else if(l===void 0&&(l=Jt(n,u,y),p=Jt(a,c,h)),l.has(a[c]))if(l.has(a[h])){let A=p.get(n[u]),ke=A!==void 0?i[A]:null;if(ke===null){let dt=z(o,i[c]);O(dt,s[u]),d[u]=dt}else d[u]=O(ke,s[u]),z(o,i[c],ke),i[A]=null;u++}else be(i[h]),h--;else be(i[c]),c++;for(;u<=y;){let A=z(o,d[y+1]);O(A,s[u]),d[u++]=A}for(;c<=h;){let A=i[c++];A!==null&&be(A)}return this.ut=n,Ht(o,d),b}});var er="important",xo=" !"+er,W=E(class extends S{constructor(o){var e;if(super(o),o.type!==M.ATTRIBUTE||o.name!=="style"||((e=o.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((e,t)=>{let r=o[t];return r==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(o,[e]){let{style:t}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(let r of this.ft)e[r]==null&&(this.ft.delete(r),r.includes("-")?t.removeProperty(r):t[r]=null);for(let r in e){let i=e[r];if(i!=null){this.ft.add(r);let s=typeof i=="string"&&i.endsWith(xo);r.includes("-")||s?t.setProperty(r,s?i.slice(0,-11):i,s?er:""):t[r]=i}}return b}});var G=g`500px`,tr=g`24px`,ir=5e3,sr=40,et=g`(max-width: 576px)`,tt=2,ne=tt+3,rt=g`
|
|
615
|
+
.carousel {
|
|
616
|
+
position: relative;
|
|
617
|
+
box-sizing: border-box;
|
|
618
|
+
display: grid;
|
|
619
|
+
height: ${G};
|
|
620
|
+
place-items: center;
|
|
621
|
+
--card-height: ${G};
|
|
622
|
+
user-select: none;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
.carousel[data-layout="solo"] {
|
|
626
|
+
padding: ${tr};
|
|
627
|
+
border-radius: var(--vtex-ads-story-radius, 20px);
|
|
628
|
+
background: var(--vtex-ads-story-color-surface, #fafafa);
|
|
629
|
+
--card-height: calc(${G} - 2 * ${tr});
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
.carousel[data-layout="solo"] .card {
|
|
633
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
.track {
|
|
637
|
+
position: absolute;
|
|
638
|
+
inset: 0;
|
|
639
|
+
overflow: hidden;
|
|
640
|
+
touch-action: pan-y;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/* Each slide starts centered, then moves by its own transform. */
|
|
644
|
+
.slide {
|
|
645
|
+
--ease: cubic-bezier(0.25, 1, 0.5, 1);
|
|
646
|
+
--duration: var(--slide-duration, 0.4s);
|
|
647
|
+
position: absolute;
|
|
648
|
+
top: 0;
|
|
649
|
+
left: 50%;
|
|
650
|
+
width: calc(${G} * 9 / 16);
|
|
651
|
+
height: 100%;
|
|
652
|
+
margin-left: calc(${G} * 9 / -32);
|
|
653
|
+
opacity: 0.5;
|
|
654
|
+
transition:
|
|
655
|
+
transform var(--duration) var(--ease),
|
|
656
|
+
opacity var(--duration) var(--ease),
|
|
657
|
+
visibility 0s;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
.slide[data-active] {
|
|
661
|
+
opacity: 1;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
/* Pair: --side is -1 for the first card, 1 for the second. The highlighted
|
|
665
|
+
card sits 47.5% of its width off center, the other (scaled to 0.9)
|
|
666
|
+
52.5%, so the gap between them stays 8px. */
|
|
667
|
+
.carousel[data-layout="pair"] .slide {
|
|
668
|
+
--side: 1;
|
|
669
|
+
--offset: 52.5%;
|
|
670
|
+
--scale: 0.9;
|
|
671
|
+
transform: translateX(calc(var(--side) * (var(--offset) + 4px)))
|
|
672
|
+
scale(var(--scale));
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
.carousel[data-layout="pair"] .slide[data-index="0"] {
|
|
676
|
+
--side: -1;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
.carousel[data-layout="pair"] .slide[data-active] {
|
|
680
|
+
--offset: 47.5%;
|
|
681
|
+
--scale: 1;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
/* Rolling: --place is the slide's distance from the highlighted one, in
|
|
685
|
+
cards, 8px apart. A hidden slide fades out, then stops being visible. */
|
|
686
|
+
.carousel[data-layout="rolling"] .slide {
|
|
687
|
+
transform: translateX(calc(var(--place) * (100% + 8px))) scale(0.9);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
.carousel[data-layout="rolling"] .slide[data-active] {
|
|
691
|
+
transform: translateX(0) scale(1);
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
.slide[data-hidden] {
|
|
695
|
+
opacity: 0;
|
|
696
|
+
visibility: hidden;
|
|
697
|
+
transition:
|
|
698
|
+
transform var(--duration) var(--ease),
|
|
699
|
+
opacity var(--duration) var(--ease),
|
|
700
|
+
visibility 0s var(--duration);
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/* Only the highlighted card opens the player, so only it shows play. Its
|
|
704
|
+
sound is the only one to turn on: the others play muted, if at all. */
|
|
705
|
+
.slide:not([data-active]) .play,
|
|
706
|
+
.slide:not([data-active]) .card-sound {
|
|
707
|
+
display: none;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
.arrow {
|
|
711
|
+
position: absolute;
|
|
712
|
+
top: 50%;
|
|
713
|
+
z-index: 2;
|
|
714
|
+
display: grid;
|
|
715
|
+
width: 32px;
|
|
716
|
+
height: 32px;
|
|
717
|
+
place-items: center;
|
|
718
|
+
padding: 0;
|
|
719
|
+
border: 1px solid rgba(133, 133, 133, 0.3);
|
|
720
|
+
border-radius: 50%;
|
|
721
|
+
background: rgba(0, 0, 0, 0.3);
|
|
722
|
+
backdrop-filter: blur(5px);
|
|
723
|
+
color: #fff;
|
|
724
|
+
cursor: pointer;
|
|
725
|
+
transform: translateY(-50%);
|
|
726
|
+
transition: background-color 0.2s;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
.arrow:hover {
|
|
730
|
+
background: #262626;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
.arrow:disabled {
|
|
734
|
+
cursor: default;
|
|
735
|
+
opacity: 0.5;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
.arrow .icon {
|
|
739
|
+
width: 16px;
|
|
740
|
+
height: 16px;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
.arrow-previous {
|
|
744
|
+
left: 3px;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
.arrow-next {
|
|
748
|
+
right: 3px;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
@media ${et} {
|
|
752
|
+
.carousel[data-layout="solo"] {
|
|
753
|
+
padding: 0;
|
|
754
|
+
background: none;
|
|
755
|
+
--card-height: ${G};
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
.carousel[data-layout="solo"] .card {
|
|
759
|
+
box-shadow: none;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
@media (prefers-reduced-motion: reduce) {
|
|
764
|
+
.slide,
|
|
765
|
+
.slide[data-hidden] {
|
|
766
|
+
transition: none;
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
`,rr=(o,e)=>(o%e+e)%e;function or(o,e){let t;return r=>{t&&o.delete(t),t=r,r&&o.set(r,e)}}var ae=class{constructor(e,t){this.host=e;this.options=t;this.position=0;this.distance=1;this.count=0;this.narrow=!1;this.connected=!1;this.hovered=!1;this.focused=!1;this.cards=new Map;this.focusTargets=new Map;this.onMediaChange=e=>{var r,i;let t=this.layout;this.narrow=e.matches,this.layout!==t&&((i=(r=this.options).onLayoutChange)==null||i.call(r),this.host.requestUpdate())};this.onPointerEnter=()=>{this.hovered=!0,this.syncTimer()};this.onPointerLeave=()=>{this.hovered=!1,this.syncTimer()};this.onFocusIn=e=>{this.focused=e.target.matches(":focus-visible"),this.syncTimer()};this.onFocusOut=e=>{let t=e.currentTarget,r=e.relatedTarget;(!r||!t.contains(r))&&(this.focused=!1),this.syncTimer()};this.onPointerDown=e=>{this.endSwipe(),this.swipe={x:e.clientX,moved:!1},globalThis.addEventListener("pointerup",this.onPointerUp),globalThis.addEventListener("pointercancel",this.onPointerCancel)};this.onPointerUp=e=>{let{swipe:t}=this;if(this.removeSwipeListeners(),!t)return;let r=e.clientX-t.x;Math.abs(r)>sr&&(t.moved=!0,this.step(r<0?1:-1))};this.onPointerCancel=()=>this.endSwipe();this.onClickCapture={handleEvent:e=>{var t;(t=this.swipe)!=null&&t.moved&&(e.stopPropagation(),e.preventDefault()),this.swipe=void 0},capture:!0};e.addController(this)}get active(){return this.count?rr(this.position,this.count):0}get layout(){return this.count<2?"solo":this.count===2&&!this.narrow?"pair":"rolling"}get activeKey(){return this.layout==="rolling"?this.position:this.active}*visibleCards(){for(let[e,t]of this.cards)t.hidden||(yield[e,t])}focusActive(){for(let[e,t]of this.focusTargets)if(t.active&&e instanceof HTMLElement){e.focus();return}}hostConnected(){var e,t,r,i;this.connected=!0,this.media=(e=globalThis.matchMedia)==null?void 0:e.call(globalThis,et.toString()),(t=this.media)==null||t.addEventListener("change",this.onMediaChange),this.narrow=(i=(r=this.media)==null?void 0:r.matches)!=null?i:!1,this.syncTimer()}hostDisconnected(){var e;this.connected=!1,(e=this.media)==null||e.removeEventListener("change",this.onMediaChange),this.media=void 0,this.endSwipe(),this.syncTimer()}hostUpdated(){this.syncTimer()}reset(e){this.count=e,this.position=0,this.distance=1,this.hovered=!1,this.focused=!1,this.restartTimer()}step(e,{evenIfLocked:t=!1}={}){var i,s,n,a;if(this.count<2||e===0||(s=(i=this.options).locked)!=null&&s.call(i)&&!t)return;let r=this.activeKey;this.position+=e,this.distance=Math.abs(e),this.host.requestUpdate(),(a=(n=this.options).onStep)==null||a.call(n,r,this.activeKey),this.restartTimer()}get shouldAdvance(){var e,t;return this.connected&&this.count>1&&!this.hovered&&!this.focused&&!((t=(e=this.options).locked)!=null&&t.call(e))}syncTimer(){this.shouldAdvance&&!this.timer?this.timer=setInterval(()=>this.step(1),ir):!this.shouldAdvance&&this.timer&&this.stopTimer()}stopTimer(){clearInterval(this.timer),this.timer=void 0}restartTimer(){this.stopTimer(),this.syncTimer()}endSwipe(){this.removeSwipeListeners(),this.swipe=void 0}removeSwipeListeners(){globalThis.removeEventListener("pointerup",this.onPointerUp),globalThis.removeEventListener("pointercancel",this.onPointerCancel)}slide(e){let t={...e,cardRef:s=>r(s),focusRef:s=>i(s)},r=or(this.cards,t),i=or(this.focusTargets,t);return t}pairSlides(){let{active:e}=this;return[0,1].map(t=>this.slide({key:t,index:t,offset:t-e,active:t===e,hidden:!1}))}rollingSlides(){let{count:e}=this,t=e===2||e===4,r=t?e/2:Math.floor((e-1)/2),i=t?e/2:e-1-r,s=[];for(let n=-ne;n<=ne;n+=1)s.push(this.slide({key:this.position+n,index:rr(this.position+n,e),offset:n,active:n===0,hidden:Math.abs(n)>tt||n<-r||n>i}));return s}renderSlides(e,t){let{layout:r}=this,i=r==="pair"?this.pairSlides():this.rollingSlides();return _e(i,s=>`${r}:${s.key}`,s=>{let{index:n}=s;return m`
|
|
770
|
+
<div
|
|
771
|
+
class="slide"
|
|
772
|
+
data-index=${n}
|
|
773
|
+
?data-active=${s.active}
|
|
774
|
+
?data-hidden=${s.hidden}
|
|
775
|
+
?inert=${s.hidden}
|
|
776
|
+
style=${W({"--place":String(s.offset)})}
|
|
777
|
+
>
|
|
778
|
+
${t(e[n],s)}
|
|
779
|
+
</div>
|
|
780
|
+
`})}render(e,t,r){var s,n,a;if(this.layout==="solo")return m`
|
|
781
|
+
<div class="carousel" data-layout="solo">
|
|
782
|
+
${t(e[0],this.slide({key:0,index:0,offset:0,active:!0,hidden:!1}))}
|
|
783
|
+
</div>
|
|
784
|
+
`;let i=(a=(n=(s=this.options).locked)==null?void 0:n.call(s))!=null?a:!1;return m`
|
|
785
|
+
<div
|
|
786
|
+
class="carousel"
|
|
787
|
+
data-layout=${this.layout}
|
|
788
|
+
role="region"
|
|
789
|
+
aria-roledescription=${r.carouselRole}
|
|
790
|
+
aria-label=${r.carousel}
|
|
791
|
+
@pointerenter=${this.onPointerEnter}
|
|
792
|
+
@pointerleave=${this.onPointerLeave}
|
|
793
|
+
@focusin=${this.onFocusIn}
|
|
794
|
+
@focusout=${this.onFocusOut}
|
|
795
|
+
>
|
|
796
|
+
<div
|
|
797
|
+
class="track"
|
|
798
|
+
style=${W({"--slide-duration":this.distance>1?"0.52s":"0.4s"})}
|
|
799
|
+
@pointerdown=${this.onPointerDown}
|
|
800
|
+
@click=${this.onClickCapture}
|
|
801
|
+
>
|
|
802
|
+
${this.renderSlides(e,t)}
|
|
803
|
+
</div>
|
|
804
|
+
<button
|
|
805
|
+
type="button"
|
|
806
|
+
class="arrow arrow-previous"
|
|
807
|
+
aria-label=${r.previous}
|
|
808
|
+
?disabled=${i}
|
|
809
|
+
@click=${()=>this.step(-1)}
|
|
810
|
+
>
|
|
811
|
+
${v("previous")}
|
|
812
|
+
</button>
|
|
813
|
+
<button
|
|
814
|
+
type="button"
|
|
815
|
+
class="arrow arrow-next"
|
|
816
|
+
aria-label=${r.next}
|
|
817
|
+
?disabled=${i}
|
|
818
|
+
@click=${()=>this.step(1)}
|
|
819
|
+
>
|
|
820
|
+
${v("next")}
|
|
821
|
+
</button>
|
|
822
|
+
</div>
|
|
823
|
+
`}};var $="vtex-ads-story-carousel";var nr="text/plain;charset=utf-8";function ar(o,{sessionId:e,userId:t}){var s,n;let r=w(o);if(!r||globalThis.window===void 0)return!1;let i=JSON.stringify(t?{session_id:e,user_id:t}:{session_id:e});try{if((n=(s=globalThis.navigator)==null?void 0:s.sendBeacon)==null?void 0:n.call(s,r,new Blob([i],{type:nr})))return!0}catch(a){}return typeof globalThis.fetch!="function"?!1:(globalThis.fetch(r,{method:"POST",headers:{"Content-Type":nr},body:i,keepalive:!0,credentials:"omit"}).catch(a=>{console.error(`[${$}] Event request failed`,{url:r,error:a})}),!0)}var ot=.5,dr=2e3,wo={impression:"impression_url",view:"view_url",click:"click_url"},de=class{constructor(e,t){this.host=e;this.options=t;this.sent={impression:new Set,view:new Set,click:new Set};this.pendingImpressions=[];this.watched=new Map;this.onIntersect=e=>{for(let t of e){let r=this.watched.get(t.target);r&&(r.visible=t.isIntersecting&&t.intersectionRatio>=ot,r.visible?this.startTimer(r):this.stopTimer(r))}};this.onVisibilityChange=()=>{for(let e of this.watched.values())document.hidden?this.stopTimer(e):e.visible&&this.startTimer(e)};e.addController(this)}hostConnected(){var e;typeof IntersectionObserver=="function"&&(this.observer=new IntersectionObserver(this.onIntersect,{threshold:ot})),(e=globalThis.document)==null||e.addEventListener("visibilitychange",this.onVisibilityChange),this.host.updateComplete.then(()=>this.syncViewTargets())}hostDisconnected(){var e,t;(e=globalThis.document)==null||e.removeEventListener("visibilitychange",this.onVisibilityChange),(t=this.observer)==null||t.disconnect(),this.observer=void 0;for(let r of this.watched.values())clearTimeout(r.timer);this.watched.clear(),this.pendingImpressions=[]}hostUpdated(){let e=this.pendingImpressions;if(e.length&&this.options.identity().sessionId){this.pendingImpressions=[];for(let t of e)this.send("impression",t)}this.syncViewTargets()}impress(e){this.pendingImpressions=e}click(e){this.send("click",e)}key(e,t){return`${e}|${t.ad_id}`}wasSent(e,t){let{sessionId:r}=this.options.identity();return!!r&&this.sent[e].has(this.key(r,t))}send(e,t){let{sessionId:r,userId:i}=this.options.identity();if(!r||this.wasSent(e,t))return;ar(t[wo[e]],{sessionId:r,userId:i})&&this.sent[e].add(this.key(r,t))}syncViewTargets(){let{observer:e}=this;if(!e)return;let t=new Map;for(let[r,i]of this.options.viewTargets())this.wasSent("view",i)||t.set(r,i);for(let[r,i]of this.watched)t.get(r)!==i.story&&this.unwatch(r,i);for(let[r,i]of t)this.watched.has(r)||(this.watched.set(r,{story:i,visible:!1}),e.observe(r))}startTimer(e){var t;e.timer||(t=globalThis.document)!=null&&t.hidden||(e.timer=setTimeout(()=>{e.timer=void 0,this.send("view",e.story),this.wasSent("view",e.story)&&this.unwatchStory(e.story)},dr))}stopTimer(e){clearTimeout(e.timer),e.timer=void 0}unwatch(e,t){var r;this.stopTimer(t),(r=this.observer)==null||r.unobserve(e),this.watched.delete(e)}unwatchStory(e){for(let[t,r]of this.watched)r.story.ad_id===e.ad_id&&this.unwatch(t,r)}};var Ce=72,cr=48,it=g`
|
|
115
824
|
.player {
|
|
116
825
|
position: fixed;
|
|
117
826
|
inset: auto 16px 16px auto;
|
|
@@ -144,12 +853,28 @@
|
|
|
144
853
|
background: transparent;
|
|
145
854
|
}
|
|
146
855
|
|
|
856
|
+
/* Focusable only to keep the focus in the player when its video is clicked
|
|
857
|
+
(see render): no ring around the whole player. */
|
|
858
|
+
.player:focus {
|
|
859
|
+
outline: none;
|
|
860
|
+
}
|
|
861
|
+
|
|
147
862
|
.player-frame {
|
|
148
863
|
position: relative;
|
|
149
864
|
width: 100%;
|
|
150
865
|
height: 100%;
|
|
151
866
|
}
|
|
152
867
|
|
|
868
|
+
/* What moves in the expanded view, off center with two Stories and in the
|
|
869
|
+
step animation: the video, its dimming and previous and next. Expand and
|
|
870
|
+
close stay out of it: a transformed box becomes the one their fixed
|
|
871
|
+
position, at the top right of the screen, is measured from. */
|
|
872
|
+
.player-stage {
|
|
873
|
+
position: relative;
|
|
874
|
+
width: 100%;
|
|
875
|
+
height: 100%;
|
|
876
|
+
}
|
|
877
|
+
|
|
153
878
|
.player .card {
|
|
154
879
|
width: 100%;
|
|
155
880
|
height: 100%;
|
|
@@ -196,6 +921,26 @@
|
|
|
196
921
|
height: 20px;
|
|
197
922
|
}
|
|
198
923
|
|
|
924
|
+
/* The product pill or the call to action. Their wrapper only stops clicks:
|
|
925
|
+
the pill places itself. The product is larger than on the carousel card
|
|
926
|
+
(as in the prototype). */
|
|
927
|
+
.player-destination {
|
|
928
|
+
display: contents;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
.player .product-info {
|
|
932
|
+
font-size: 14px;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
.player .product-image {
|
|
936
|
+
width: 72px;
|
|
937
|
+
height: 72px;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
.player .product-price {
|
|
941
|
+
color: rgba(255, 255, 255, 0.7);
|
|
942
|
+
}
|
|
943
|
+
|
|
199
944
|
/* Above the card: on narrow screens the expanded card can cover them. */
|
|
200
945
|
.player-controls {
|
|
201
946
|
position: absolute;
|
|
@@ -206,6 +951,12 @@
|
|
|
206
951
|
gap: 8px;
|
|
207
952
|
}
|
|
208
953
|
|
|
954
|
+
/* Previous and next Story, above the card's top left (mini player only). */
|
|
955
|
+
.player-nav {
|
|
956
|
+
right: auto;
|
|
957
|
+
left: 0;
|
|
958
|
+
}
|
|
959
|
+
|
|
209
960
|
.player-button {
|
|
210
961
|
display: grid;
|
|
211
962
|
width: 36px;
|
|
@@ -259,6 +1010,116 @@
|
|
|
259
1010
|
height: 40px;
|
|
260
1011
|
}
|
|
261
1012
|
|
|
1013
|
+
/* Expanded with more than one Story: the other Stories' covers beside the
|
|
1014
|
+
video, smaller and dimmed, as in the prototype. --side is -1 (before)
|
|
1015
|
+
or 1 (after), --beyond how many places past the nearest one. */
|
|
1016
|
+
.player[data-expanded] {
|
|
1017
|
+
--center-height: min(78vh, 720px);
|
|
1018
|
+
--side-height: min(38vh, 320px);
|
|
1019
|
+
--side-width: calc(var(--side-height) * 9 / 16);
|
|
1020
|
+
--center-half: calc(var(--center-height) * 9 / 32);
|
|
1021
|
+
--near-gap: ${Ce}px;
|
|
1022
|
+
--far-gap: ${cr}px;
|
|
1023
|
+
--near: calc(var(--center-half) + var(--near-gap) + var(--side-width) / 2);
|
|
1024
|
+
--pitch: calc(var(--side-width) + var(--far-gap));
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
.player-neighbor {
|
|
1028
|
+
position: absolute;
|
|
1029
|
+
top: 50%;
|
|
1030
|
+
left: 50%;
|
|
1031
|
+
width: var(--side-width);
|
|
1032
|
+
height: var(--side-height);
|
|
1033
|
+
padding: 0;
|
|
1034
|
+
overflow: hidden;
|
|
1035
|
+
border: 0;
|
|
1036
|
+
border-radius: 16px;
|
|
1037
|
+
background: #111;
|
|
1038
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
|
|
1039
|
+
cursor: pointer;
|
|
1040
|
+
transform: translate(
|
|
1041
|
+
calc(-50% + var(--side) * var(--near) + var(--beyond) * var(--pitch)),
|
|
1042
|
+
-50%
|
|
1043
|
+
);
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
.player-neighbor img {
|
|
1047
|
+
width: 100%;
|
|
1048
|
+
height: 100%;
|
|
1049
|
+
object-fit: cover;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
/* Fades out as the video arrives from a dimmed cover (see animateStep). */
|
|
1053
|
+
.player-dim {
|
|
1054
|
+
position: absolute;
|
|
1055
|
+
inset: 0;
|
|
1056
|
+
z-index: 3;
|
|
1057
|
+
border-radius: var(--vtex-ads-story-radius, 20px);
|
|
1058
|
+
background: rgba(0, 0, 0, 0.35);
|
|
1059
|
+
opacity: 0;
|
|
1060
|
+
pointer-events: none;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
.player-neighbor::after {
|
|
1064
|
+
position: absolute;
|
|
1065
|
+
inset: 0;
|
|
1066
|
+
background: rgba(0, 0, 0, 0.35);
|
|
1067
|
+
content: "";
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
.player-neighbor:hover::after,
|
|
1071
|
+
.player-neighbor:focus-visible::after {
|
|
1072
|
+
background: rgba(0, 0, 0, 0.12);
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
.player-neighbor:focus-visible {
|
|
1076
|
+
outline: 2px solid #fff;
|
|
1077
|
+
outline-offset: 2px;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
/* Two Stories: the video moves off center toward --pair-dir, and the other
|
|
1081
|
+
Story sits on the other side. */
|
|
1082
|
+
.player[data-pair] .player-stage {
|
|
1083
|
+
transform: translateX(
|
|
1084
|
+
calc(var(--pair-dir) * (var(--near-gap) + var(--side-width)) / 2)
|
|
1085
|
+
);
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
.player[data-pair] .player-neighbor {
|
|
1089
|
+
transform: translate(
|
|
1090
|
+
calc(
|
|
1091
|
+
-50% + var(--pair-dir) * -1 * (var(--center-half) + var(--near-gap) / 2)
|
|
1092
|
+
),
|
|
1093
|
+
-50%
|
|
1094
|
+
);
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
/* Expanded previous and next: beside the video, centered on its height. */
|
|
1098
|
+
.player[data-expanded] .player-nav {
|
|
1099
|
+
position: static;
|
|
1100
|
+
display: contents;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
.player[data-expanded] .player-nav .player-button {
|
|
1104
|
+
position: absolute;
|
|
1105
|
+
top: 50%;
|
|
1106
|
+
z-index: 2;
|
|
1107
|
+
transform: translateY(-50%);
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
.player[data-expanded] .player-previous {
|
|
1111
|
+
left: -56px;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
.player[data-expanded] .player-next {
|
|
1115
|
+
right: -56px;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
/* With two, the other Story's cover beside the video does that. */
|
|
1119
|
+
.player[data-expanded][data-pair] .player-nav {
|
|
1120
|
+
display: none;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
262
1123
|
@media (max-width: 576px) {
|
|
263
1124
|
.player {
|
|
264
1125
|
right: 12px;
|
|
@@ -266,6 +1127,18 @@
|
|
|
266
1127
|
height: 391px;
|
|
267
1128
|
}
|
|
268
1129
|
|
|
1130
|
+
.player:not([data-expanded]) .product-image {
|
|
1131
|
+
width: 56px;
|
|
1132
|
+
height: 56px;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
/* "Adicionar ao carrinho" fits on one line in the narrow mini player. */
|
|
1136
|
+
.player:not([data-expanded]) .product-action {
|
|
1137
|
+
height: 40px;
|
|
1138
|
+
padding: 0 8px;
|
|
1139
|
+
font-size: 12px;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
269
1142
|
.player[data-expanded] {
|
|
270
1143
|
background: #000;
|
|
271
1144
|
}
|
|
@@ -288,6 +1161,28 @@
|
|
|
288
1161
|
top: 60px;
|
|
289
1162
|
right: 12px;
|
|
290
1163
|
}
|
|
1164
|
+
|
|
1165
|
+
/* No room for the other Stories' covers: previous and next go inside
|
|
1166
|
+
the video's edges instead, also with two. */
|
|
1167
|
+
.player-neighbor {
|
|
1168
|
+
display: none;
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
.player[data-pair] .player-stage {
|
|
1172
|
+
transform: none;
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
.player[data-expanded][data-pair] .player-nav {
|
|
1176
|
+
display: contents;
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
.player[data-expanded] .player-previous {
|
|
1180
|
+
left: 12px;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
.player[data-expanded] .player-next {
|
|
1184
|
+
right: 12px;
|
|
1185
|
+
}
|
|
291
1186
|
}
|
|
292
1187
|
|
|
293
1188
|
@keyframes player-in {
|
|
@@ -302,14 +1197,172 @@
|
|
|
302
1197
|
animation: none;
|
|
303
1198
|
}
|
|
304
1199
|
}
|
|
305
|
-
`;function
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
1200
|
+
`;function st(o,e){if(o<2)return[];if(o===2)return[e===0?1:-1];let t=[],r=new Set([0]);for(let i of[-1,1,-2,2]){let s=(i%o+o)%o;r.has(s)||(r.add(s),t.push(i))}return t}var K={duration:560,easing:"cubic-bezier(0.32, 0.72, 0, 1)"},Ee=(o,e=1)=>`translate(-50%, -50%) translateX(${o}px) scale(${e})`,pr=o=>o.animate([{opacity:0},{opacity:1}],{...K,pseudoElement:"::after"});function $o(o,e,t,{frameWidth:r,sideWidth:i}){let s=d=>{if(d===0)return 0;let l=Math.sign(d),p=r/2+Ce+i/2;return l*p+(d-l)*(i+cr)},n=i/r,a=[o.animate([{transform:`translateX(${s(e)}px) scale(${n})`},{transform:"none"}],K)];for(let{element:d,offset:l,from:p}of t){let c=p===0;a.push(d.animate([{transform:Ee(s(p),c?1/n:1)},{transform:Ee(s(l))}],K)),c&&a.push(pr(d))}return a}function So(o,e,t,{frameWidth:r,sideWidth:i}){let s=d=>d*(Ce+i)/2,n=d=>-d*(r+Ce)/2,a=i/r;return[o.animate([{transform:`translateX(${n(-t)}px) scale(${a})`},{transform:`translateX(${s(t)}px)`}],K),e.animate([{transform:Ee(s(-t),1/a)},{transform:Ee(n(t))}],K),pr(e)]}var Ao={ArrowLeft:-1,ArrowRight:1},_o=o=>!o.defaultPrevented&&!o.altKey&&!o.ctrlKey&&!o.metaKey&&!o.shiftKey;function lr(o){return typeof o.showPopover=="function"}var le=class{constructor(e,t){this.host=e;this.options=t;this.isOpen=!1;this.expanded=!1;this.productOpen=!1;this.switched=!1;this.shown=!1;this.dialog=P();this.expandButton=P();this.closeButton=P();this.stage=P();this.stageCardRef=P();this.dim=P();this.neighborElements=new Map;this.neighborRefs=new Map;this.navigation=!1;this.pairDirection=0;this.animations=[];this.toggleExpanded=async()=>{var t;let e=this.dialog.value;e&&(this.cancelAnimations(),this.hide(e),this.expanded=!this.expanded,this.switched=!0,this.host.requestUpdate(),await this.host.updateComplete,this.isOpen&&(this.show(e),(t=this.expandButton.value)==null||t.focus()))};this.onKeyDown=e=>{e.key==="Escape"&&this.options.onClose()};this.onPlayerKeyDown=e=>{var r,i;let t=Ao[e.key];!t||!this.navigation||!_o(e)||(e.preventDefault(),(i=(r=this.options).onStep)==null||i.call(r,t))};this.onDialogClick=e=>{this.expanded&&e.target===e.currentTarget&&this.options.onClose()};this.onCancel=e=>{e.preventDefault(),this.options.onClose()};this.toggleProduct=()=>{this.productOpen=!this.productOpen,this.host.requestUpdate()};this.onVideoClick=()=>{this.productOpen?this.toggleProduct():this.video.togglePlayback()};e.addController(this),this.video=new B(e)}get isExpanded(){return this.isOpen&&this.expanded}get stageCard(){return this.isOpen?this.stageCardRef.value:void 0}hostDisconnected(){this.close()}async open({productOpen:e=!1}={}){var r;if(this.isOpen)return;document.addEventListener("keydown",this.onKeyDown),this.isOpen=!0,this.expanded=!1,this.productOpen=e,this.switched=!1,this.rendered=void 0,this.beforeStep=void 0,this.video.reset(),this.host.requestUpdate(),await this.host.updateComplete;let t=this.dialog.value;!this.isOpen||!t||(this.show(t),this.video.play(),(r=this.closeButton.value)==null||r.focus())}close(){if(!this.isOpen)return;document.removeEventListener("keydown",this.onKeyDown),this.cancelAnimations();let e=this.dialog.value;e&&this.hide(e),this.isOpen=!1,this.host.requestUpdate()}async showNext(e=0){if(!this.isOpen)return;let t=!this.video.muted;this.video.failed=!1,this.productOpen=!1,this.host.requestUpdate(),await this.host.updateComplete,this.isOpen&&(this.video.restart({withSound:t}),this.animateStep(e))}cancelAnimations(){for(let e of this.animations)e.cancel();this.animations=[]}animateStep(e){var l,p;if(!this.expanded||e===0||$e())return;let t=this.stage.value,r=this.dim.value;if(!t||!r||typeof t.animate!="function")return;let{rendered:i,beforeStep:s}=this,n=(c,h)=>{var y;if(!c||!s)return h;if(c===s.story)return 0;let u=s.neighbors.find(L=>L.story===c);return(y=u==null?void 0:u.offset)!=null?y:h},a=[...this.neighborElements].map(([c,h])=>{var u;return{offset:c,element:h,from:n((u=i==null?void 0:i.neighbors.find(y=>y.offset===c))==null?void 0:u.story,c+e)}}),d={frameWidth:t.offsetWidth,sideWidth:(p=(l=a[0])==null?void 0:l.element.offsetWidth)!=null?p:0};!d.frameWidth||!d.sideWidth||(this.cancelAnimations(),this.animations=[r.animate([{opacity:1},{opacity:0}],K),...this.pairDirection?So(t,a[0].element,this.pairDirection,d):$o(t,n(i==null?void 0:i.story,e),a,d)])}neighborRef(e){let t=this.neighborRefs.get(e);return t||(t=r=>{r?this.neighborElements.set(e,r):this.neighborElements.delete(e)},this.neighborRefs.set(e,t)),t}show(e){this.shown||(this.expanded?e.showModal():lr(e)?e.showPopover():e.show(),this.shown=!0)}hide(e){this.shown&&(!this.expanded&&lr(e)?e.hidePopover():e.close(),this.shown=!1)}renderDestination({product:e,cta:t,labels:r}){let i;if(e)i=Xe(e,{open:this.productOpen,onToggle:this.toggleProduct,panelId:"player-product-panel",labels:r});else if(t)i=se(t);else return f;return m`
|
|
1201
|
+
<div
|
|
1202
|
+
class="player-destination"
|
|
1203
|
+
@click=${s=>s.stopPropagation()}
|
|
1204
|
+
>
|
|
1205
|
+
${i}
|
|
1206
|
+
</div>
|
|
1207
|
+
`}renderVideoControls(e){let{video:t}=this,r=s=>{s.stopPropagation(),t.togglePlayback()},i=s=>{s.stopPropagation(),t.toggleMuted()};return m`
|
|
1208
|
+
<button
|
|
1209
|
+
type="button"
|
|
1210
|
+
class="play player-toggle"
|
|
1211
|
+
aria-label=${t.paused?e.play:e.pause}
|
|
1212
|
+
@click=${r}
|
|
1213
|
+
>
|
|
1214
|
+
${v(t.paused?"play":"pause")}
|
|
1215
|
+
</button>
|
|
1216
|
+
<button
|
|
1217
|
+
type="button"
|
|
1218
|
+
class="player-button player-sound"
|
|
1219
|
+
aria-label=${t.muted?e.soundOn:e.soundOff}
|
|
1220
|
+
@click=${i}
|
|
1221
|
+
>
|
|
1222
|
+
${v(t.muted?"soundOff":"soundOn")}
|
|
1223
|
+
</button>
|
|
1224
|
+
`}renderNavigation(e){let{options:t}=this,r=i=>()=>{var s;return(s=t.onStep)==null?void 0:s.call(t,i)};return m`
|
|
1225
|
+
<div class="player-controls player-nav">
|
|
1226
|
+
<button
|
|
1227
|
+
type="button"
|
|
1228
|
+
class="player-button player-previous"
|
|
1229
|
+
aria-label=${e.previous}
|
|
1230
|
+
@click=${r(-1)}
|
|
1231
|
+
>
|
|
1232
|
+
${v("previous")}
|
|
1233
|
+
</button>
|
|
1234
|
+
<button
|
|
1235
|
+
type="button"
|
|
1236
|
+
class="player-button player-next"
|
|
1237
|
+
aria-label=${e.next}
|
|
1238
|
+
@click=${r(1)}
|
|
1239
|
+
>
|
|
1240
|
+
${v("next")}
|
|
1241
|
+
</button>
|
|
1242
|
+
</div>
|
|
1243
|
+
`}renderNeighbors(e,t){let{options:r}=this;return _e(e,({offset:i})=>e.length===1?"single":i,({offset:i,story:s,label:n})=>{let a=w(s.poster_url),d=Math.sign(i);return m`
|
|
1244
|
+
<button
|
|
1245
|
+
type="button"
|
|
1246
|
+
class="player-neighbor"
|
|
1247
|
+
aria-label=${n!=null?n:t.show}
|
|
1248
|
+
style=${W({"--side":String(d),"--beyond":String(i-d)})}
|
|
1249
|
+
${x(this.neighborRef(i))}
|
|
1250
|
+
@click=${()=>{var l;return(l=r.onStep)==null?void 0:l.call(r,i)}}
|
|
1251
|
+
>
|
|
1252
|
+
${a?m`<img alt="" src=${a} />`:f}
|
|
1253
|
+
</button>
|
|
1254
|
+
`})}renderWindowControls(e){let{options:t,expanded:r}=this;return m`
|
|
1255
|
+
<div class="player-controls">
|
|
1256
|
+
<button
|
|
1257
|
+
type="button"
|
|
1258
|
+
class="player-button player-expand"
|
|
1259
|
+
aria-label=${r?e.collapse:e.expand}
|
|
1260
|
+
${x(this.expandButton)}
|
|
1261
|
+
@click=${this.toggleExpanded}
|
|
1262
|
+
>
|
|
1263
|
+
${v(r?"collapse":"expand")}
|
|
1264
|
+
</button>
|
|
1265
|
+
<button
|
|
1266
|
+
type="button"
|
|
1267
|
+
class="player-button player-close"
|
|
1268
|
+
aria-label=${e.close}
|
|
1269
|
+
${x(this.closeButton)}
|
|
1270
|
+
@click=${t.onClose}
|
|
1271
|
+
>
|
|
1272
|
+
${v("close")}
|
|
1273
|
+
</button>
|
|
1274
|
+
</div>
|
|
1275
|
+
`}renderVideo(e,t,r){let{video:i,options:s}=this;return m`
|
|
1276
|
+
<div class="card" ${x(this.stageCardRef)} @click=${this.onVideoClick}>
|
|
1277
|
+
${ie(e,i,{loop:!t,onEnded:t?()=>{var n;return(n=s.onStep)==null?void 0:n.call(s,1)}:void 0})}
|
|
1278
|
+
${q(e,i)?this.renderVideoControls(r.labels):f}
|
|
1279
|
+
${this.renderDestination(r)}
|
|
1280
|
+
</div>
|
|
1281
|
+
`}track(e,t){let r=this.expanded?t:[];return this.pairDirection=r.length===1?-Math.sign(r[0].offset):0,this.rendered&&e!==this.rendered.story&&(this.beforeStep=this.rendered),this.rendered={story:e,neighbors:r},r}render(e,{labels:t,navigation:r=!1,neighbors:i=[],product:s,cta:n,onPress:a}){if(!this.isOpen)return f;let{video:d,expanded:l}=this,p=this.track(e,i),c=this.pairDirection!==0;return this.navigation=r,m`
|
|
1282
|
+
<dialog
|
|
1283
|
+
class="player"
|
|
1284
|
+
popover="manual"
|
|
1285
|
+
aria-label=${t.player}
|
|
1286
|
+
?data-expanded=${l}
|
|
1287
|
+
?data-pair=${c}
|
|
1288
|
+
style=${W({"--pair-dir":c?String(this.pairDirection):void 0})}
|
|
1289
|
+
?data-switched=${this.switched}
|
|
1290
|
+
?data-paused=${q(e,d)&&d.paused}
|
|
1291
|
+
tabindex="-1"
|
|
1292
|
+
${x(this.dialog)}
|
|
1293
|
+
@click=${this.onDialogClick}
|
|
1294
|
+
@cancel=${this.onCancel}
|
|
1295
|
+
@keydown=${this.onPlayerKeyDown}
|
|
1296
|
+
>
|
|
1297
|
+
${this.renderNeighbors(p,t)}
|
|
1298
|
+
<div class="player-frame">
|
|
1299
|
+
${this.renderWindowControls(t)}
|
|
1300
|
+
<div
|
|
1301
|
+
class="player-stage"
|
|
1302
|
+
${x(this.stage)}
|
|
1303
|
+
@click=${{handleEvent:h=>{let u=this.stageCardRef.value;u!=null&&u.contains(h.target)&&(a==null||a())},capture:!0}}
|
|
1304
|
+
>
|
|
1305
|
+
${r?this.renderNavigation(t):f}
|
|
1306
|
+
${this.renderVideo(e,r&&l,{product:s,cta:n,labels:t})}
|
|
1307
|
+
<span class="player-dim" aria-hidden="true" ${x(this.dim)}></span>
|
|
1308
|
+
</div>
|
|
1309
|
+
</div>
|
|
1310
|
+
</dialog>
|
|
1311
|
+
`}};var ur=(o,e)=>globalThis.fetch(o,e);var Co=()=>{let o=async(s,n,a,d,l)=>{let p=new URL(n,s).toString(),c=d?{"content-type":"application/json"}:void 0;return ur(p,{body:d?JSON.stringify(d):void 0,method:a,signal:l==null?void 0:l.signal,headers:{accept:"application/json",...c}}).then(h=>{if(!h.ok)throw console.error({description:"HTTP error",response:h}),new Error(`HTTP error! status: ${h.status}`);return h.json()})};return{get:async(s,n,a)=>o(s,n,"GET",void 0,a),post:async(s,n,a,d)=>o(s,n,"POST",a,d),put:async(s,n,a)=>o(s,n,"PUT",a),delete:async(s,n)=>o(s,n,"DELETE")}},nt=Co(),Eo="https://newtail-media.newtail.com.br/v1/rma/",Po=async(o,e,t)=>nt.post(Eo,o,e,{signal:t==null?void 0:t.signal}).then(r=>{if(r.validations&&r.validations.length>0)throw console.error(JSON.stringify({description:"Ads validation error",response:r},null,2)),new Error("Ads validation error");return r}),To=o=>Object.entries(o).filter(([,e])=>Array.isArray(e)).map(([e,t])=>[e,t.filter(r=>"product_sku"in r)]).filter(([e,t])=>t.length>0),ko=o=>Object.entries(o).filter(([,e])=>Array.isArray(e)).map(([e,t])=>[e,t.filter(r=>"type"in r&&r.type==="story")]).filter(([e,t])=>t.length>0),vr=o=>{var e;return{skuId:o.product_sku,sellerId:(e=o.seller_id)!=null?e:"1",productId:o.product_metadata.productId}},gr=o=>{var e,t,r;let{product:i}=o;if(!i)return;let s=(e=i.product_metadata)==null?void 0:e.productId;return{skuId:i.product_sku,sellerId:(r=(t=i.seller_id)!=null?t:o.seller_id)!=null?r:"1",productId:typeof s=="string"?s:""}},hr=o=>{let e={};for(let[t,r]of o)e[t]=r;return e},Oo=(o,e)=>{let t={};for(let[r,i]of Object.entries(o))t[r]=i.map(s=>e(s));return t},Mo=(o,e)=>e?new Promise((t,r)=>{let i=()=>r(e.reason);if(e.aborted){i();return}e.addEventListener("abort",i,{once:!0}),o.then(t,r).finally(()=>e.removeEventListener("abort",i))}):o,br=(o,e)=>({eventUrls:{click:o.click_url,impression:o.impression_url,view:o.view_url},eventParameters:btoa(o.impression_url),sponsoredBySellerId:e}),Ro=(o,e,t)=>({product:o,advertisement:br(e,t.sellerId)}),Lo=(o,e)=>{var t;let r=gr(o);return{story:o,product:e(r),offer:r,advertisement:br(o,(t=r==null?void 0:r.sellerId)!=null?t:o.seller_id)}},fr=(o,e)=>Object.values(o).flatMap(t=>t.map(r=>e(r))).filter(t=>t!==void 0),Io=(o,e)=>t=>t&&o.find(r=>e(r,t)),No=(o,e)=>{var t;let r={},i=[];for(let[s,n]of Object.entries(o))for(let a of n){let d=vr(a),l=e(d);l?((t=r[s])!=null||(r[s]=[]),r[s].push(Ro(l,a,d))):i.push(a)}return{byPlacement:r,failed:i}},xr=async({sponsoredProducts:o={},stories:e={}},t,r,i,s)=>{let n=[...fr(o,vr),...fr(e,gr)],a=n.length>0?await Mo(t(n,i,{signal:s==null?void 0:s.signal}),s==null?void 0:s.signal):[],d=Io(a,r);return{sponsoredProducts:No(o,d),stories:Oo(e,l=>Lo(l,d))}},wr=(o,e)=>o.items.some(t=>t.itemId===e.skuId&&t.sellers.some(r=>r.sellerId===e.sellerId)),$r=o=>`https://${o}.vtexcommercestable.com.br/api/intelligent-search/`,Sr="product_search",Ho=async(o,e,t)=>{let r=$r(o),i=`product:${e.map(encodeURIComponent).join(";")}`,s=`${Sr}?q=${i}`;return nt.get(r,s,t)},Vo=24,Do=async(o,e,t)=>{let r=$r(o),i=`sku:${e.map(encodeURIComponent).join(";")}`,s=`${Sr}?q=${i}`;return nt.get(r,s,t)},Uo=o=>{let e=new Map;for(let{skuId:t,sellerId:r}of o){let i=e.get(t);i?i.push(r):e.set(t,[r])}return e},Bo=(o,e)=>o.map(t=>{let r=e.get(t.itemId);if(!r)return null;let i=t.sellers.filter(s=>r.includes(s.sellerId));return i.length===0?null:{...t,sellers:i}}).filter(t=>t!==null),Fo=(o,e)=>{let t=Uo(e);return o.map(r=>{let i=Bo(r.items,t);return i.length===0?null:{...r,items:i}}).filter(r=>r!==null)},zo=(o,e)=>{let t=[];for(let r=0;r<o.length;r+=e)t.push(o.slice(r,r+e));return t},mr=(o,e,t,r)=>zo(t,Vo).map(i=>o(e,i,r)),qo=o=>[...new Map(o.map(e=>[e.productId,e])).values()],Ar=async(o,{accountName:e},t)=>{let r=new Set,i=new Set;for(let{productId:d,skuId:l}of o)d?r.add(d):i.add(l);let s={signal:t==null?void 0:t.signal},n=await Promise.all([...mr(Ho,e,[...r],s),...mr(Do,e,[...i],s)]),a=qo(n.flatMap(d=>d.products));return Fo(a,o)},_r=(o,{skuId:e,sellerId:t})=>{var r,i;return(i=(r=o.items.find(s=>s.itemId===e))==null?void 0:r.sellers.find(s=>s.sellerId===t))==null?void 0:i.commertialOffer},yr=o=>typeof o=="number"&&Number.isFinite(o)?o:void 0,Cr=(o,e)=>{let t=_r(o,e),r=yr(t==null?void 0:t.Price);if(r===void 0)return;let i=yr(t==null?void 0:t.ListPrice);return i!==void 0&&i>r?{price:r,listPrice:i}:{price:r}},Er=(o,e)=>{var t;let r=(t=_r(o,e))==null?void 0:t.AvailableQuantity;return typeof r=="number"&&!Number.isNaN(r)?r>0:void 0},Pe=({selectedFacets:o,attributeSynonyms:e,attributePrefix:t})=>{if(!(o!=null&&o.length))return;let r=e==null?void 0:e.map(n=>n.toLowerCase()),i=t==null?void 0:t.toLowerCase(),s=o.filter(n=>{let a=n.key.toLowerCase();return(r==null?void 0:r.includes(a))||i&&a.startsWith(i)});if(s.length>0)return s},jo=o=>{var e;return(e=Pe({selectedFacets:o,attributeSynonyms:["categoria","c"],attributePrefix:"category"}))==null?void 0:e.map(t=>t.value).join(" > ")},Wo=o=>{var e;return(e=Pe({selectedFacets:o,attributeSynonyms:["brand","b"]}))==null?void 0:e.map(t=>t.value)[0]},Go=o=>{var e;return(e=Pe({selectedFacets:o,attributeSynonyms:["productClusterIds","productClusterNames"]}))==null?void 0:e.map(t=>`product_cluster/${t.value}`)},Ko=o=>{var e;return(e=Pe({selectedFacets:o,attributeSynonyms:["sellerName","seller"]}))==null?void 0:e.map(t=>t.value)[0]},Zo=o=>({category:jo(o),brand:Wo(o),tags:Go(o),seller:Ko(o)}),Xo=({term:o,category:e,brand:t,skuId:r})=>o?"search":e?"category":t?"brand_page":r?"product_page":"home",Yo=o=>{var e;let{category:t,brand:r,tags:i,seller:s}=Zo(o.search.selectedFacets),n=(e=o.search.term)!=null?e:!t&&!r?s:void 0,a=Xo({term:n,category:t,brand:r,skuId:o.search.skuId});return{brand_name:r,category_name:t,tags:i,context:a,placements:o.placements,channel:o.identity.channel,term:n,session_id:o.identity.sessionId,user_id:o.identity.userId,product_sku:o.search.skuId}},Pr=async(o,e)=>{let t=Yo(o),r=await Po(o.identity.publisherId,t,e);return{sponsoredProducts:hr(To(r)),stories:hr(ko(r)),banners:void 0,sponsoredBrands:void 0}};var Te=(o,e,t)=>{let r=o!==void 0&&Number.isFinite(o)&&o>0?o:e,i=new AbortController,s=setTimeout(()=>i.abort(new DOMException(`Timed out after ${r} ms`,"TimeoutError")),r),n=()=>i.abort(t==null?void 0:t.reason);return t!=null&&t.aborted?n():t==null||t.addEventListener("abort",n,{once:!0}),{signal:i.signal,clear:()=>{clearTimeout(s),t==null||t.removeEventListener("abort",n)}}};var Qo=5e3,Tr={fetcher:Ar,matcher:wr,price:Cr,available:Er};async function kr(o,e,t,r,{signal:i,timeout:s}={}){var d,l;let n=new Map,a=Te(s,Qo,i);try{let p=await xr({stories:{[o]:e}},t.fetcher,(c,h)=>t.matcher(c,h),r,{signal:a.signal});for(let{story:c,product:h,offer:u}of(d=p.stories[o])!=null?d:[]){if(!h||!u)continue;let y=t.price(h,u),L=(l=t.available)==null?void 0:l.call(t,h,u);n.set(c.ad_id,{...y&&{price:y},...L!==void 0&&{available:L}})}}catch(p){a.signal.aborted||console.error(`[${$}] Product request failed`,p)}finally{a.clear()}return n}var Jo=2e3,ei=8,ti=o=>o!==void 0&&Number.isFinite(o)&&o>=1?Math.floor(o):ei;async function Or({publisherId:o,sessionId:e,placement:t,userId:r,accountName:i,channel:s,quantity:n},{signal:a,timeout:d}={}){var h;if(globalThis.window===void 0||!o||!e||!t)return[];let p=Te(d,Jo,a),c=ti(n);try{let{stories:u}=await Pr({identity:{accountName:i!=null?i:"",publisherId:o,sessionId:e,userId:r,channel:s},search:{},placements:{[t]:{quantity:c,types:["story"]}}},{signal:p.signal});return((h=u[t])!=null?h:[]).slice(0,c)}catch(u){return p.signal.aborted||console.error(`[${$}] Story request failed`,{placement:t,publisherId:o,error:u}),[]}finally{p.clear()}}var Mr={watch:"Watch video",show:"Show video",carousel:"Videos",carouselRole:"carousel",previous:"Previous video",next:"Next video",player:"Video",expand:"Expand video",collapse:"Collapse video",close:"Close video",play:"Play video",pause:"Pause video",soundOn:"Turn sound on",soundOff:"Turn sound off",addToCart:"Add to cart",unavailable:"Product unavailable",soldOut:"Sold out",viewProduct:"View product",product:(o,e,t)=>e&&t?`${o}, was ${t}, now ${e}`:e?`${o}, ${e}`:o,position:(o,e,t)=>t>1?`${o} ${e+1} of ${t}`:o};var Rr={watch:"Ver video",show:"Mostrar video",carousel:"Videos",carouselRole:"carrusel",previous:"Video anterior",next:"Video siguiente",player:"Video",expand:"Ampliar video",collapse:"Reducir video",close:"Cerrar video",play:"Reproducir video",pause:"Pausar video",soundOn:"Activar sonido",soundOff:"Desactivar sonido",addToCart:"Agregar al carrito",unavailable:"Producto no disponible",soldOut:"Agotado",viewProduct:"Ver producto",product:(o,e,t)=>e&&t?`${o}, antes ${t}, ahora ${e}`:e?`${o}, ${e}`:o,position:(o,e,t)=>t>1?`${o} ${e+1} de ${t}`:o};var at={watch:"Assistir v\xEDdeo",show:"Mostrar v\xEDdeo",carousel:"V\xEDdeos",carouselRole:"carrossel",previous:"V\xEDdeo anterior",next:"Pr\xF3ximo v\xEDdeo",player:"V\xEDdeo",expand:"Expandir v\xEDdeo",collapse:"Reduzir v\xEDdeo",close:"Fechar v\xEDdeo",play:"Reproduzir v\xEDdeo",pause:"Pausar v\xEDdeo",soundOn:"Ativar som",soundOff:"Desativar som",addToCart:"Adicionar ao carrinho",unavailable:"Produto indispon\xEDvel",soldOut:"Esgotado",viewProduct:"Ver produto",product:(o,e,t)=>e&&t?`${o}, de ${t} por ${e}`:e?`${o}, ${e}`:o,position:(o,e,t)=>t>1?`${o} ${e+1} de ${t}`:o};var ri=new Map([["pt",at],["es",Rr],["en",Mr]]);function Lr(o,e={}){var n,a,d;let t=o.split("-")[0].toLowerCase(),r=(n=ri.get(t))!=null?n:at,i=(a=e.addToCart)==null?void 0:a.trim(),s=(d=e.viewProduct)==null?void 0:d.trim();return{...r,...i&&{addToCart:i},...s&&{viewProduct:s}}}var oi=["publisherId","sessionId","placement","userId","accountName","channel","quantity","hydration"],ii=new Set(["site","app"]),si=o=>ii.has(o),ni={fromAttribute:o=>typeof o=="string"&&(o===""||o.toLowerCase()==="true")},ai={fromAttribute:o=>si(o)?o:void 0},di={fromAttribute:o=>o==="none"?"none":void 0},R=class extends k{constructor(){super();this.cardVideos=new Map;this.soundPending=!1;this.carousel=new ae(this,{onStep:(t,r)=>this.leaveHighlight(t,r),onLayoutChange:()=>{this.cardVideos.clear(),this.player.isOpen&&(this.afterRender=()=>{var t;return(t=this.activeVideo)==null?void 0:t.pause()})},locked:()=>this.player.isOpen});this.player=new le(this,{onStep:t=>this.stepInPlayer(t),onClose:()=>this.closePlayer()});this.events=new de(this,{identity:()=>({sessionId:this.sessionId,userId:this.userId}),viewTargets:()=>this.viewTargets()});this.renderSlide=(t,{key:r,index:i,offset:s,active:n,hidden:a,cardRef:d,focusRef:l})=>Je(t,this.videoFor(r),{label:this.labels.position(n?this.labels.watch:this.labels.show,i,this.stories.length),labels:this.labels,withVideo:n||this.inactiveAutoplay&&!a,product:this.productOf(t),onSelect:n?()=>this.openPlayer():()=>this.carousel.step(s),onProductSelect:n?()=>this.openPlayer({productOpen:!0}):void 0,cta:Ae(t),onCtaSelect:n?void 0:()=>this.carousel.step(s),onPress:()=>this.events.click(t),ref:d,openRef:l});this.inactiveAutoplay=!1,this.stories=[]}connectedCallback(){var t;super.connectedCallback();for(let r of this.cardVideos.values())r.resume();(t=this.request)!=null&&t.signal.aborted&&this.loadStory()}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.request)==null||t.abort()}willUpdate(t){oi.some(r=>t.has(r))&&this.loadStory()}updated(){let t=this.afterRender;this.afterRender=void 0,t==null||t()}get activeHydration(){if(this.hydration!=="none")return this.hydration?this.hydration:this.accountName?Tr:void 0}async loadStory(){var n,a,d,l,p;(n=this.request)==null||n.abort();let t=new AbortController;if(this.request=t,this.player.close(),this.showStories([]),!this.isConnected){t.abort();return}let r=await Or(this,{signal:t.signal,timeout:this.timeout});if(t.signal.aborted)return;let i=this.activeHydration;if(!i||!r.some(c=>c.product)){this.request=void 0,this.showStories(r);return}this.showStories(r,"loading");let s=await kr((a=this.placement)!=null?a:"",r,i,{accountName:(d=this.accountName)!=null?d:"",publisherId:(l=this.publisherId)!=null?l:"",sessionId:(p=this.sessionId)!=null?p:"",userId:this.userId,channel:this.channel},{signal:t.signal,timeout:this.hydrationTimeout});t.signal.aborted||(this.request=void 0,this.products=s)}showStories(t,r){this.products=r,this.cardVideos.clear(),this.soundPending=!1,this.afterRender=void 0,this.carousel.reset(t.length),this.stories=t,this.events.impress(t)}*viewTargets(){var s;let{stories:t}=this;if(!this.player.isExpanded)for(let[n,{key:a,index:d}]of this.carousel.visibleCards()){let l=t[d];l&&((s=this.cardVideos.get(a))!=null&&s.playing)&&(yield[n,l])}let r=this.player.stageCard,i=t[this.carousel.active];r&&i&&this.player.video.playing&&(yield[r,i])}videoFor(t){let r=this.cardVideos.get(t);return r||(r=new B(this),this.cardVideos.set(t,r)),r}get activeVideo(){return this.cardVideos.get(this.carousel.activeKey)}leaveHighlight(t,r){let i=this.cardVideos.get(t);this.soundPending||(this.soundPending=i!==void 0&&!i.muted),this.inactiveAutoplay?i==null||i.mute():i==null||i.reset(),this.player.isOpen?(this.soundPending=!1,this.afterRender=()=>this.videoFor(r).pause()):this.soundPending&&(this.afterRender=()=>{this.soundPending=!1,this.videoFor(r).playWithSound()});for(let s of this.cardVideos.keys())Math.abs(s-r)>ne&&this.cardVideos.delete(s)}stepInPlayer(t){this.carousel.step(t,{evenIfLocked:!0}),this.player.showNext(t)}openPlayer({productOpen:t=!1}={}){var r;this.player.isOpen||((r=this.activeVideo)==null||r.pause(),this.player.open({productOpen:t}))}closePlayer(){if(this.player.isOpen){this.player.close();for(let t of this.cardVideos.values())t.resume();this.carousel.focusActive()}}get locale(){var t,r;return(r=(t=this.closest('[lang]:not([lang=""])'))==null?void 0:t.lang)!=null?r:Se}get labels(){var n;let{locale:t,labelAddToCart:r="",labelViewProduct:i=""}=this,s=JSON.stringify([t,r,i]);return((n=this.labelSet)==null?void 0:n.key)!==s&&(this.labelSet={key:s,labels:Lr(t,{addToCart:r,viewProduct:i})}),this.labelSet.labels}get formatPrice(){var i,s;let{locale:t}=this,r=`${t}|${(i=this.currency)!=null?i:""}`;return((s=this.formatter)==null?void 0:s.key)!==r&&(this.formatter={key:r,format:Ge(t,this.currency)}),this.formatter.format}productOf(t){var i;let r=this.products==="loading"?"loading":(i=this.products)==null?void 0:i.get(t.ad_id);return Ke(t,this.formatPrice,this.labels,r)}render(){let{stories:t}=this,r=this.carousel.active,i=t[r];if(!i)return f;let s=st(t.length,r).map(n=>{let a=(r+n+t.length)%t.length;return{offset:n,story:t[a],label:this.labels.position(this.labels.show,a,t.length)}});return m`
|
|
1312
|
+
<div class="root">
|
|
1313
|
+
${this.carousel.render(t,this.renderSlide,this.labels)}
|
|
1314
|
+
</div>
|
|
1315
|
+
${this.player.render(i,{labels:this.labels,navigation:t.length>1,neighbors:s,product:this.productOf(i),cta:Ae(i),onPress:()=>this.events.click(i)})}
|
|
1316
|
+
`}};R.properties={publisherId:{attribute:"publisher-id"},sessionId:{attribute:"session-id"},placement:{},userId:{attribute:"user-id"},accountName:{attribute:"account-name"},channel:{converter:ai},timeout:{type:Number},quantity:{type:Number},currency:{},labelAddToCart:{attribute:"label-add-to-cart"},labelViewProduct:{attribute:"label-view-product"},hydration:{converter:di},hydrationTimeout:{type:Number,attribute:"hydration-timeout"},inactiveAutoplay:{type:Boolean,attribute:"inactive-autoplay",converter:ni},stories:{state:!0},products:{state:!0}},R.styles=[g`
|
|
1317
|
+
:host {
|
|
1318
|
+
display: block;
|
|
1319
|
+
font-family: var(--vtex-ads-story-font-family, inherit);
|
|
1320
|
+
color: var(--vtex-ads-story-color-text, inherit);
|
|
1321
|
+
}
|
|
1322
|
+
`,Qe,Ye,rt,it];function ce(){typeof customElements!="undefined"&&(customElements.get($)||customElements.define($,R))}ce();return Ur(li);})();
|
|
314
1323
|
/*! Icons from Phosphor Icons (https://phosphoricons.com), MIT License, Copyright (c) 2023 Phosphor Icons */
|
|
1324
|
+
/*! Bundled license information:
|
|
1325
|
+
|
|
1326
|
+
@lit/reactive-element/css-tag.js:
|
|
1327
|
+
(**
|
|
1328
|
+
* @license
|
|
1329
|
+
* Copyright 2019 Google LLC
|
|
1330
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1331
|
+
*)
|
|
1332
|
+
|
|
1333
|
+
@lit/reactive-element/reactive-element.js:
|
|
1334
|
+
lit-html/lit-html.js:
|
|
1335
|
+
lit-element/lit-element.js:
|
|
1336
|
+
lit-html/directive.js:
|
|
1337
|
+
lit-html/async-directive.js:
|
|
1338
|
+
lit-html/directives/unsafe-html.js:
|
|
1339
|
+
lit-html/directives/repeat.js:
|
|
1340
|
+
(**
|
|
1341
|
+
* @license
|
|
1342
|
+
* Copyright 2017 Google LLC
|
|
1343
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1344
|
+
*)
|
|
1345
|
+
|
|
1346
|
+
lit-html/is-server.js:
|
|
1347
|
+
(**
|
|
1348
|
+
* @license
|
|
1349
|
+
* Copyright 2022 Google LLC
|
|
1350
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1351
|
+
*)
|
|
1352
|
+
|
|
1353
|
+
lit-html/directive-helpers.js:
|
|
1354
|
+
lit-html/directives/ref.js:
|
|
1355
|
+
(**
|
|
1356
|
+
* @license
|
|
1357
|
+
* Copyright 2020 Google LLC
|
|
1358
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1359
|
+
*)
|
|
1360
|
+
|
|
1361
|
+
lit-html/directives/style-map.js:
|
|
1362
|
+
(**
|
|
1363
|
+
* @license
|
|
1364
|
+
* Copyright 2018 Google LLC
|
|
1365
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1366
|
+
*)
|
|
1367
|
+
*/
|
|
315
1368
|
//# sourceMappingURL=vtex-ads-stories.js.map
|