cloudinary-video-player 3.12.1 → 3.12.2-edge.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/dist/134.min.js +8 -0
- package/dist/309.min.js +6 -0
- package/dist/adaptive-streaming.js +9 -9
- package/dist/adaptive-streaming.min.js +2 -2
- package/dist/chapters.js +4 -4
- package/dist/chapters.min.js +3 -3
- package/dist/cld-player-core.js +37 -0
- package/dist/cld-player-core.min.js +6 -0
- package/dist/cld-video-player-lazy.js +494 -0
- package/dist/cld-video-player-lazy.min.js +6 -0
- package/dist/cld-video-player.css +2 -2
- package/dist/cld-video-player.js +366 -332
- package/dist/cld-video-player.light.js +366 -332
- package/dist/cld-video-player.light.min.js +4 -4
- package/dist/cld-video-player.min.css +2 -2
- package/dist/cld-video-player.min.js +4 -4
- package/dist/colors.js +4 -4
- package/dist/colors.min.js +2 -2
- package/dist/dash.js +6 -6
- package/dist/dash.min.js +2 -2
- package/dist/debug.js +8 -8
- package/dist/debug.min.js +3 -3
- package/dist/ima.js +9 -9
- package/dist/ima.min.js +2 -2
- package/dist/interaction-areas.js +11 -11
- package/dist/interaction-areas.min.js +2 -2
- package/dist/node_modules_lodash_throttle_js.js +8 -8
- package/dist/playlist.js +31 -31
- package/dist/playlist.min.js +3 -3
- package/dist/recommendations-overlay.js +10 -10
- package/dist/recommendations-overlay.min.js +2 -2
- package/dist/schema.json +19 -0
- package/dist/share.js +5 -5
- package/dist/share.min.js +3 -3
- package/dist/shoppable.js +12 -12
- package/dist/shoppable.min.js +2 -2
- package/dist/utils_fetch-config_js.js +81 -0
- package/dist/video-player_js.js +3111 -0
- package/dist/visual-search.js +7 -7
- package/dist/visual-search.min.js +2 -2
- package/lib/_commonjsHelpers.js +7 -0
- package/lib/_videojs-proxy.js +30294 -0
- package/lib/abr-strategies.js +31 -0
- package/lib/adaptive-streaming.js +468 -2
- package/lib/all.js +25 -2
- package/lib/chapters.js +205 -1
- package/lib/cld-video-player.min.css +5 -22
- package/lib/colors.js +59 -1
- package/lib/{schema.json → config/configSchema.json} +19 -0
- package/lib/dash.js +69943 -2
- package/lib/debug.js +322 -1
- package/lib/document.js +770 -0
- package/lib/download-button.js +48 -0
- package/lib/fetch-config.js +93 -0
- package/lib/ima.js +6851 -1
- package/lib/index.js +27 -0
- package/lib/interaction-areas.const.js +24 -0
- package/lib/interaction-areas.service.js +469 -0
- package/lib/lazy.js +20 -0
- package/lib/noop.js +33 -0
- package/lib/player-api.js +469 -0
- package/lib/player.js +7 -2
- package/lib/playlist-panel.js +602 -0
- package/lib/playlist.js +637 -1
- package/lib/querystring.js +81 -0
- package/lib/recommendations-overlay.js +320 -1
- package/lib/share.js +129 -1
- package/lib/shoppable-post-widget.js +572 -0
- package/lib/shoppable-widget.js +77 -0
- package/lib/throttle.js +318 -0
- package/lib/toNumber.js +134 -0
- package/lib/validators-functions.js +485 -0
- package/lib/video-player.js +16241 -0
- package/lib/videoPlayer.js +7 -2
- package/lib/videojs-contrib-hlsjs.js +37638 -0
- package/lib/visual-search.js +235 -1
- package/package.json +31 -15
- package/lib/adaptive-streaming.js.LICENSE.txt +0 -3
- package/lib/all.js.LICENSE.txt +0 -25
- package/lib/cld-video-player.js +0 -2
- package/lib/cld-video-player.js.LICENSE.txt +0 -21
- package/lib/dash.js.LICENSE.txt +0 -1842
- package/lib/interaction-areas.js +0 -1
- package/lib/player.js.LICENSE.txt +0 -21
- package/lib/shoppable.js +0 -1
- package/lib/videoPlayer.js.LICENSE.txt +0 -21
package/lib/interaction-areas.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[404,691],{9454:(t,e,o)=>{o.d(e,{default:()=>a,w:()=>r});var n=o(7764);const i={colorsDark:{base:"#000000",accent:"#0D9AFF",text:"#FFFFFF"},colorsLight:{base:"#FFFFFF",accent:"#0D9AFF",text:"#000000"}},r=t=>(0,n.T4)(t)?i.colorsLight:i.colorsDark,a=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=r(t.options_);e.colors=Object.assign({},o,e.colors);const n=t.el();return e.colors.base&&n.style.setProperty("--color-base",e.colors.base),e.colors.accent&&n.style.setProperty("--color-accent",e.colors.accent),e.colors.text&&n.style.setProperty("--color-text",e.colors.text),{updateColors:t=>{const o=Object.assign({},e.colors,t);o.base&&n.style.setProperty("--color-base",o.base),o.accent&&n.style.setProperty("--color-accent",o.accent),o.text&&n.style.setProperty("--color-text",o.text),e.colors=o},getColors:()=>e.colors}}},9017:(t,e,o)=>{o.d(e,{F0:()=>a,Fg:()=>r,IT:()=>s,T$:()=>l,Vv:()=>d,Yx:()=>c,be:()=>i,q3:()=>u,sb:()=>n});const n="cld-ia-layout-state",i="vp-ia",r="interaction-areas-container",a={PORTRAIT:"portrait",LANDSCAPE:"landscape",All:"all",CENTER:"center"},s={PULSING:"pulsing",SHADOWED:"shadowed"},c={[a.PORTRAIT]:"https://res.cloudinary.com/prod/raw/upload/v1623772481/video-player/vtts/portrait.vtt",[a.LANDSCAPE]:"https://res.cloudinary.com/prod/raw/upload/v1623772303/video-player/vtts/landscape.vtt",[a.All]:"https://res.cloudinary.com/prod/raw/upload/v1623250266/video-player/vtts/all.vtt",[a.CENTER]:"https://res.cloudinary.com/prod/raw/upload/v1623250265/video-player/vtts/center.vtt"},l="https://res.cloudinary.com/prod/image/upload/v1626764643/video-player/interaction-area-hand.svg",d=4500,u=250},1066:(t,e,o)=>{o.d(e,{interactionAreasService:()=>k});var n=o(6673),i=o.n(n),r=o(2832),a=o.n(r),s=o(2858),c=o.n(s),l=o(5114),d=o.n(l),u=o(9017),v=o(7134),p=o(9454);const h=t=>{let{text:e,onClick:o,theme:n="",loadingDelay:i=0}=t;return(0,v.It)({tag:"button",attr:{class:`vp-theme-button theme-${n}`},onClick:o,children:[{tag:"div",attr:{class:"vp-loading-bar"},style:{"animation-duration":`${i}ms`}},{tag:"div",attr:{class:"content"},children:e}]})},f=(t,e)=>t.id||t.type||`id_${e}`,m=(t,e,o,n,i)=>{let{playerOptions:r,videojsOptions:s}=t;const c=(0,p.w)(s),l=r&&r.colors?r.colors.accent:c.accent,d=a()(s,"interactionDisplay.theme.template",u.IT.PULSING);return(0,v.It)({tag:"div",attr:{class:`${u.be}-item theme-${d}`,"data-id":f(e,o)},style:{left:`${e.left}%`,top:`${e.top}%`,width:`${e.width}%`,height:`${e.height}%`,transitionDuration:`${n}ms`},event:{name:"click",callback:i},children:[{tag:"div",attr:{class:`${u.be}-area-marker`},children:[{tag:"div",attr:{class:`${u.be}-marker-shadow`},style:{[d===u.IT.SHADOWED?"backgroundColor":"borderColor"]:l}},{tag:"div",attr:{class:`${u.be}-marker-main`},style:{borderColor:l}}]}]})},g=(t,e)=>t/(100/+e),y=(t,e)=>{const o=T(t);o?o.replaceWith(e):t.el().appendChild(e)},b=(t,e,o)=>t.querySelector(`[data-id=${f(e,o)}]`),x=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d();localStorage.setItem(u.sb,JSON.parse(t)),e()},T=t=>t.el().querySelector(`.${u.Fg}`),$=t=>{const e=T(t);e&&e.parentNode.removeChild(e)};var w=o(7764),E=o(1104);const k=(t,e,o)=>{let n=!1,r=null,s=null,l=d();function p(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=C();return t||e&&e.enable}function k(){s&&t.videojs.removeRemoteTextTrack(s);const e=p(),o=C();if(!e||n)return null;if(Array.isArray(o.template))F(o.template),O();else{const e=o.vttUrl||u.Yx[o.template];e&&(s=(0,w.eo)(t.videojs,e),function(e){if(!e)return;let o=null;e.addEventListener("cuechange",()=>{const n=e.activeCues&&e.activeCues[0];if(n){const t=Math.max(Math.floor(1e3*(n.endTime-n.startTime)),u.q3),e=JSON.parse(n.text);F(e,o,t),!o&&O(),o=e}else $(t.videojs),o=null})}(s))}}function C(){const{cldSrc:t}=r;return t&&t.interactionAreas()}function j(){$(t.videojs),k(),t.play()}function D(){if(p())if(e=o.interactionDisplay,a()(e,"layout.enable",!0)&&"true"!==localStorage.getItem(u.sb)){let e=null;const n=a()(o,"interactionDisplay.layout.showAgain",!1);t.pause(),function(t,e){let o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=!1;const i=`checkbox_${Math.round(1e4*Math.random())}`,r=(0,v.It)({tag:"div",attr:{class:`${u.Fg} ${u.be}-layout-message ${o?"":"clickable"}`},onClick:o?null:()=>x(n,e),children:[{tag:"img",attr:{class:`${u.be}-layout-icon`,src:u.T$}},{tag:"h3",attr:{class:`${u.be}-layout-message-title`},children:"Tap on dots to zoom for a product."},h({text:"Got it",theme:"transparent-white",loadingDelay:o?0:u.Vv,onClick:o?()=>x(n,e):null}),o&&{tag:"div",attr:{class:`${u.be}-layout-message-do-not-show`},children:[{tag:"input",attr:{type:"checkbox",class:`${u.be}-layout-message-checkbox`,id:i},event:{name:"input",callback:t=>{n=t.target.checked}}},{tag:"label",attr:{class:`${u.be}-layout-message-checkbox-title`,for:i},children:"Don׳t show it again"}]}].filter(t=>t)});y(t,r)}(t.videojs,()=>{clearTimeout(e),j()},n),n||(e=setTimeout(j,u.Vv))}else j();var e}function A(e){let{event:o,item:a,index:s}=e;const c=C();c.onClick&&c.onClick({item:a,index:s,event:o,zoom:(e,o)=>{!function(e,o,a){const s=t.currentTime(),c=(()=>{const t=C();return!(!t||void 0===t.syncOffsetTime)&&t.syncOffsetTime})(),{cldSrc:d}=r,p=d.getInitOptions(),h=o||{transformation:p.transformation},f=!e&&((t,e)=>{const{videoHeight:o,videoWidth:n}=t,i=g(n,e.left),r=g(o,e.top),a=g(n,e.width),s=g(o,e.height),c=n/o,l=a/s,d=Math.round(l>1||c>1?s*l:a),u=Math.round(d/c),v=Math.round(i-(d-a)/2),p=Math.round(r-(u-s)/2);return{width:d,height:u,x:Math.min(Math.max(v,0),n-d),y:Math.min(Math.max(p,0),o-u),crop:"crop"}})(t.videoElement,a),m=f?i().obj.merge({transformation:f},h):h,b=d.isRawUrl?r.src:{publicId:d.publicId()};t.source(f?{publicId:d.publicId()}:e,m).play(),c&&t.currentTime(s),n=!0,function(){const e=(0,v.n)("div",{class:"go-back-button"});e.addEventListener("click",()=>{l()},!1);const o=(0,v.n)("div",{class:u.Fg},e);y(t.videojs,o)}(),l=()=>{if(n){n=!1;const e=t.currentTime(),o=t.duration();t.source(b,p).play(),c&&e<o&&t.currentTime(e),k()}}}(e,o,a)}})}function F(n,i){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const a={playerOptions:e,videojsOptions:o};if(i)((t,e,o,n,i,r)=>{const a=T(t);o.forEach((t,o)=>{const s=b(a,t,o),c=f(t),l=n.some(t=>f(t)===c);l&&s?(0,v.cu)(s,{left:`${t.left}%`,top:`${t.top}%`,width:`${t.width}%`,height:`${t.height}%`,transitionDuration:`${i}ms`}):l||s||a.appendChild(m(e,t,o,i,e=>{r({event:e,item:t,index:o})}))}),n.forEach((t,e)=>{const n=b(a,t,e),i=f(t),r=!o.some(t=>f(t)===i);n&&r&&n.parentNode.removeChild(n)})})(t.videojs,a,n,i,r,A);else{const e=n.map((t,e)=>m(a,t,e,r,o=>{A({event:o,item:t,index:e})}));y(t.videojs,(0,v.n)("div",{class:u.Fg},e))}}function O(){p()&&((t,e)=>{const o=T(t);if(!o)return;const{videoHeight:n,videoWidth:i}=e,r=i/n,a=r*e.clientHeight;o.style.width=`${e.clientWidth<a?"100%":a}px`,o.style.height=e.clientWidth<a?e.clientWidth/r+"px":"100%"})(t.videojs,t.videoElement)}!function(){if(r=r||t.videojs.currentSource(),p()){t.videojs.el().classList.add("interaction-areas"),t.videojs.one(E.f.PLAY,()=>{"object"==typeof t.videojs.ima?t.on("adsready",()=>{t.videojs.ima.addEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,D)}):D()});const e=c()(O,100);t.videojs.on(E.f.FULL_SCREEN_CHANGE,()=>{setTimeout(e,100)});const o=(0,v.q2)(window,"resize",O,!1);t.videojs.on(E.f.DISPOSE,o)}t.videojs.on(E.f.ENDED,()=>{l()}),t.videojs.on(E.f.ERROR,()=>{t.pause()})}()}},8812:(t,e,o)=>{var n=o(2140),i=/^\s+/;t.exports=function(t){return t?t.slice(0,n(t)+1).replace(i,""):t}},2140:t=>{var e=/\s/;t.exports=function(t){for(var o=t.length;o--&&e.test(t.charAt(o)););return o}},6177:(t,e,o)=>{var n=o(8953),i=o(3664),r=o(5378),a=Math.max,s=Math.min;t.exports=function(t,e,o){var c,l,d,u,v,p,h=0,f=!1,m=!1,g=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function y(e){var o=c,n=l;return c=l=void 0,h=e,u=t.apply(n,o)}function b(t){var o=t-p;return void 0===p||o>=e||o<0||m&&t-h>=d}function x(){var t=i();if(b(t))return T(t);v=setTimeout(x,function(t){var o=e-(t-p);return m?s(o,d-(t-h)):o}(t))}function T(t){return v=void 0,g&&c?y(t):(c=l=void 0,u)}function $(){var t=i(),o=b(t);if(c=arguments,l=this,p=t,o){if(void 0===v)return function(t){return h=t,v=setTimeout(x,e),f?y(t):u}(p);if(m)return clearTimeout(v),v=setTimeout(x,e),y(p)}return void 0===v&&(v=setTimeout(x,e)),u}return e=r(e)||0,n(o)&&(f=!!o.leading,d=(m="maxWait"in o)?a(r(o.maxWait)||0,e):d,g="trailing"in o?!!o.trailing:g),$.cancel=function(){void 0!==v&&clearTimeout(v),h=0,c=p=l=v=void 0},$.flush=function(){return void 0===v?u:T(i())},$}},5114:t=>{t.exports=function(){}},3664:(t,e,o)=>{var n=o(1433);t.exports=function(){return n.Date.now()}},2858:(t,e,o)=>{var n=o(6177),i=o(8953);t.exports=function(t,e,o){var r=!0,a=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return i(o)&&(r="leading"in o?!!o.leading:r,a="trailing"in o?!!o.trailing:a),n(t,e,{leading:r,maxWait:e,trailing:a})}},5378:(t,e,o)=>{var n=o(8812),i=o(8953),r=o(5414),a=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(r(t))return NaN;if(i(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=i(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=n(t);var o=s.test(t);return o||c.test(t)?l(t.slice(2),o?2:8):a.test(t)?NaN:+t}}}]);
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*! @name videojs-per-source-behaviors @version 3.0.1 @license Apache-2.0 */
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @license
|
|
5
|
-
* slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
|
|
6
|
-
* Copyright (c) 2014 David Björklund
|
|
7
|
-
* Available under the MIT license
|
|
8
|
-
* <https://github.com/kesla/parse-headers/blob/master/LICENCE>
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @license
|
|
13
|
-
* Video.js 8.23.4 <http://videojs.com/>
|
|
14
|
-
* Copyright Brightcove, Inc. <https://www.brightcove.com/>
|
|
15
|
-
* Available under Apache License Version 2.0
|
|
16
|
-
* <https://github.com/videojs/video.js/blob/main/LICENSE>
|
|
17
|
-
*
|
|
18
|
-
* Includes vtt.js <https://github.com/mozilla/vtt.js>
|
|
19
|
-
* Available under Apache License Version 2.0
|
|
20
|
-
* <https://github.com/mozilla/vtt.js/blob/main/LICENSE>
|
|
21
|
-
*/
|
package/lib/shoppable.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[525],{9987:(t,e,s)=>{s.d(e,{default:()=>q});var o=s(6673),a=s.n(o);const i=function(t){const[e,s,o]=t.split(":").reverse();let a=null;return isNaN(e)||(a=60*(+o||0)*60+60*(+s||0)+ +e),a};var r=s(9339);const n={location:"right",toggleIcon:"",width:"20%",startState:"openOnPlay",autoClose:2,transformation:{quality:"auto",width:"auto",fetch_format:"auto",crop:"scale"},products:[],showPostPlayOverlay:!1},l="goto",c="seek",p="shoppable-panel-visible",d="shoppable-panel-hidden",h="shoppable-products-overlay",u="cld-spbl-panel",m="cld-spbl-toggle",g="cld-spbl-toggle-icon",_="cld-spbl-bar-inner",y="animate",f="cld-spbl-item",v="cld-spbl-img";var b=s(1104);const C=a().dom||a(),E=a().getComponent("Component");class T extends E{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(t,e),this.options_=e,this.player_=t,this.player_.on(b.f.SHOW_PRODUCTS_OVERLAY,this.renderProducts),this.dispose=()=>{this.layout_.dispose()}}renderProducts=()=>{this.player_.removeClass(p),this.player_.addClass(d),this.player_.addClass(h),this.layout_.innerHTML="";const t=this.player_.currentTime();this.options_.products.filter(e=>e.hotspots&&e.hotspots.some(e=>i(e.time)===t)).forEach(e=>{const s=(0,r.I)(e.hotspots,e=>i(e.time)===t),o=C.createEl("div",{className:"cld-spbl-product-hotspot-name"},{},e.productName),a=C.createEl("div",{className:"cld-spbl-product-tooltip cld-spbl-product-tooltip-"+s.tooltipPosition},{},o),n=C.createEl("a",{className:"cld-spbl-product-hotspot accent-color-text",href:s.clickUrl,target:"_blank"},{style:"left:"+s.x+"; top:"+s.y+";"},a);this.layout_.appendChild(n)}),this.player_.one(b.f.SEEKING,this.clearLayout),this.player_.one(b.f.PLAY,this.clearLayout)};clearLayout=()=>{this.layout_.innerHTML="",this.player_.removeClass(h)};createEl(){const t=this.player_.currentDimensions();return this.layout_=C.createEl("div",{className:"cld-spbl-products-overlay",style:`padding-top: ${t.height/t.width*100}%;`}),this.layout_}}a().registerComponent("ShoppableProductsOverlay",T);const N=T,P=a().dom||a(),L=a().getComponent("ClickableComponent");class x extends L{constructor(t,e){super(t,e),this.options_=e}handleClick(t){t.preventDefault(),t.stopPropagation(),this.options_.clickHandler()}createEl(){let t={},e={};this.options_.toggleIcon?(t={className:`${g} cld-spbl-toggle-custom-icon vjs-icon-close`},e={style:`background-image: url(${this.options_.toggleIcon})`}):t={className:`${g} vjs-icon-cart`};const s=P.createEl("span",t,e),o=super.createEl("a",{className:`${m} base-color-bg`});return o.appendChild(s),this.player_.on(b.f.PRODUCT_BAR_MIN,()=>{setTimeout(()=>{s.classList.add(y),setTimeout(()=>{s.classList.remove(y)},1e3)},500)}),o}}a().registerComponent("shoppablePanelToggle",x);const w=x,k=a().dom||a(),I=a().getComponent("Component");class A extends I{constructor(t,e){super(t,e),this.player_=t,this.player().addClass("cld-shoppable-panel"),this.player().addClass(d),this.contentWrpEl_=k.createEl("div",{className:"cld-spbl-bar"}),this.contentBannerEl_=k.createEl("div",{className:"cld-spbl-banner-msg base-color-text"},{},this.options_.bannerMsg||"Shop the Video"),this.contentWrpEl_.appendChild(this.contentBannerEl_);const s=new N(this.player_,this.options_);this.contentWrpEl_.appendChild(s.el_),this.contentEl_=k.createEl("div",{className:_}),this.contentWrpEl_.appendChild(this.contentEl_),this.player().el().appendChild(this.contentWrpEl_),this.addChild(new w(this.player_,{toggleIcon:this.options_.toggleIcon,clickHandler:()=>{this.togglePanel()}})),this.addChild("ShoppablePanel",this.options_),this.dispose=()=>{this.removeLayout(),super.dispose()},this.togglePanel=t=>{!0===t?(this.player().removeClass(d),this.player().addClass(p)):!1===t?(this.player().removeClass(p),this.player().addClass(d)):(this.player().toggleClass(d),this.player().toggleClass(p));let e=this.player().hasClass(p)?"productBarMax":"productBarMin";this.player().trigger(e)},"open"===this.options_.startState&&this.togglePanel(!0),this.player_.on(b.f.PLAY,()=>{this.player_.currentTime()<.01&&("openOnPlay"===this.options_.startState&&this.togglePanel(!0,this.options_.autoClose),this.options_.autoClose&&-1!==this.options_.startState.indexOf("open")&&setTimeout(()=>{this.contentEl_.matches(":hover")?this.contentEl_.addEventListener("mouseleave",()=>{this.togglePanel(!1)},{once:!0}):this.togglePanel(!1)},1e3*this.options_.autoClose))})}createEl(){return super.createEl("div")}}a().registerComponent("shoppableBarLayout",A);const H=A;var M=s(2858),S=s.n(M),$=s(4650);const O=a().getComponent("ClickableComponent"),D=a().dom||a(),W={width:132};class j extends O{constructor(t,e){super(t,e),this.options_=e,this.isDragged=!1}handleClick(t){t.preventDefault(),t.stopPropagation(),this.el_.matches(`.dragged .${f}`)||this.options_.clickHandler(t),this.isDragged=!1}getTitle(){return this.options_.conf.title}createEl(){const t=super.createEl("a",{className:`${f} base-color-bg accent-color-text`,href:"#"});t.setAttribute("data-product-id",this.options_.conf.productId||""),t.setAttribute("data-product-name",this.options_.conf.productName||""),this.options_.conf.onHover&&B(t,this.options_.conf.onHover,this.options_.item.cloudinaryConfig()),this.options_.conf.onClick&&R(t,this.options_.conf.onClick);const e=super.createEl("img",{className:v},{src:this.options_.item.url(W)});if(t.appendChild(e),this.getTitle()){const e=D.createEl("div",{className:"cld-spbl-item-info base-color-semi-bg text-color-text"}),s=D.createEl("span",{className:"cld-spbl-item-title"},{},this.getTitle());e.appendChild(s),t.appendChild(e)}return t}}const B=(t,e,s)=>{if(t.setAttribute("data-hover-action",e.action),"overlay"===e.action){const s=D.createEl("span",{className:"cld-spbl-overlay-text base-color-text"},{},e.args),o=D.createEl("span",{className:"cld-spbl-overlay text-color-semi-bg base-color-text"},{title:e.args},s);t.appendChild(o)}else{const o=new $.A(e.args.publicId,{cloudinaryConfig:s,transformation:e.args.transformation}),a=D.createEl("img",{className:`${v} cld-spbl-hover-img`},{src:o.url(W)});t.appendChild(a)}},R=(t,e)=>{t.setAttribute("data-click-action",e.action),t.setAttribute("data-pause",e.pause),e.action===c?t.setAttribute("data-seek",e.args.time):e.action===l&&t.setAttribute("data-goto-url",e.args.url)};a().registerComponent("shoppablePanelItem",j);const z=j,U=a().getComponent("Component");class V extends U{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(t,e),this.options=e;const s=()=>{this.render()};t.on(b.f.SHOPPABLE_ITEM_CHANGED,s),this.render(),this.dispose=()=>{super.dispose(),t.off(b.f.SHOPPABLE_ITEM_CHANGED,s)}}createEl(){const t=super.createEl();return[u,"base-color-bg"].map(e=>t.classList.add(e)),t}removeAll(){const t=this.children();for(let e=t.length-1;e>=0;--e)this.removeChild(t[e])}getItems(){const t=this.player_.cloudinary.cloudinaryConfig();return this.options.products.map(e=>{e.onHover&&"object"==typeof e.onHover.args&&(e.onHover.args.transformation=Object.assign({},this.options.transformation,e.onHover.args.transformation));const s={productId:e.productId,productName:e.productName,title:e.title,onHover:e.onHover,onClick:e.onClick,startTime:e.startTime,endTime:e.endTime};return{imageSrc:new $.A(e.publicId,{cloudinaryConfig:t,transformation:Object.assign({},this.options.transformation,e.transformation)}),conf:s}})}scrollToActiveItem(){const t=this.el_.getElementsByClassName("active");if(t.length>0){const e=t[0].offsetTop-12;"scrollBehavior"in document.documentElement.style?this.el_.scrollTo({top:e,behavior:"smooth"}):this.el_.scrollTop=e}}render(){this.removeAll();const t=this.getItems(),e=S()(()=>this.scrollToActiveItem(),1e3);t.forEach((t,s)=>{const o=new z(this.player(),{item:t.imageSrc,conf:t.conf,next:1===s,current:0===s,clickHandler:t=>{let e=t.currentTarget||t.target,s=this.player_.ended()?"productClickPost":"productClick";if(this.player_.trigger(s,{productId:e.dataset.productId,productName:e.dataset.productName}),e.dataset.clickAction===l)window.open(e.dataset.gotoUrl,"_blank");else if(e.dataset.clickAction===c){const t=i(e.dataset.seek);null!==t&&(this.player_.addClass("vjs-has-started"),this.player_.postModal&&this.player_.postModal.close(),this.player_.currentTime(t),this.player_.removeClass(p),this.player_.addClass(d),this.player_.addClass(h),this.player_.one("seeked",()=>this.player_.trigger("showProductsOverlay")))}"false"!==e.dataset.pause&&(this.player_.pause(),i(e.dataset.pause)&&setTimeout(()=>{this.player_.play()},1e3*i(e.dataset.pause)))}});o.on("mouseover",t=>{let e=t.currentTarget||t.target,s=this.player_.ended()?"productHoverPost":"productHover";this.player_.trigger(s,{productId:e.dataset.productId,productName:e.dataset.productName})}),void 0!==t.conf.startTime&&void 0!==t.conf.endTime&&this.player_.on(b.f.TIME_UPDATE,()=>{const s=this.player_.currentTime();s>=t.conf.startTime&&s<t.conf.endTime?(o.el_.classList.add("active"),e()):o.el_.classList.contains("active")&&o.el_.classList.remove("active")}),this.addChild(o)})}}a().registerComponent("shoppablePanel",V);const X=V,G=a().dom||a(),Y=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.options_={...e,postPlay:!0},this.player_=t,this.render(),this.handleDragToScroll(),this.dispose=()=>{this.layout_.dispose()}}handleDragToScroll(){const t=this.player_.postModal.el_.querySelector(`.${u}`);let e=!1,s=0,o=0;t.addEventListener("mousedown",a=>{e=!0,s=a.pageX-t.offsetLeft,o=t.scrollLeft}),document.addEventListener("mouseup",o=>{e=!1,setTimeout(()=>{t.classList.remove("dragged")},300);const a=o.pageX-t.offsetLeft-s;Math.abs(a)>5&&o.preventDefault()}),document.addEventListener("mousemove",a=>{if(!e)return;a.preventDefault();const i=a.pageX-t.offsetLeft-s;t.scrollLeft=o-i,Math.abs(i)>5&&!t.classList.contains("dragged")&&t.classList.add("dragged")})}render(){this.player_.postModal=null;const t=G.createEl("div",{className:"cld-spbl-post-play"}),e=new X(this.player_,this.options_),s=G.createEl("div",{className:"cld-spbl-post-title base-color-text"},{},this.options_.bannerMsg||"Shop the Video"),o=this.player_.cloudinary.currentPoster();o.transformation([o.transformation().toOptions?o.transformation().toOptions():{},{effect:"blur:3000"}]);const a=G.createEl("div",{className:"cld-spbl-post-play-bg",style:`background-image: url("${o.url()}")`}),i=G.createEl("button",{className:"cld-spbl-replay-btn base-color-bg vjs-icon-replay",onclick:()=>{this.player_.trigger("replay"),this.player_.postModal.close(),this.player_.play()}},{},"Replay");t.appendChild(a),t.appendChild(s),t.appendChild(e.el()),t.appendChild(i),this.player_.postModal=this.player_.createModal(t,{name:"postModal",uncloseable:!0}),this.player_.addClass("cld-spbl-post-modal"),this.player_.postModal.on("beforemodalclose",()=>{this.player_.removeClass("cld-spbl-post-modal")})}},q=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.options_=a().obj.merge(n,e),this.player_=t,this.options_.showPostPlayOverlay&&this.player_.on(b.f.ENDED,()=>{this.player_.addChild(new Y(this.player_,this.options_))});const s=this.options_.width;this._injectCSS(`\n .${_} {\n transform: translateX(${s});\n }\n .${p} .vjs-control-bar {\n width: calc(100% - ${s});\n }\n .${m} {\n right: ${s};\n }\n .${u}{\n width: ${s};\n }\n `),this._setListeners()}_setListeners(){const t=this._resizeHandler.bind(this);this.player_.on(b.f.RESIZE,t),window.addEventListener("resize",t),this.dispose=()=>{this.player_.off(b.f.RESIZE,t),window.removeEventListener("resize",t),this.layout_.dispose()}}_injectCSS(t){const e=document.createElement("style");e.innerHTML=t,this.player_.el_.appendChild(e)}_resizeHandler(){const t=[["sm",0,80],["md",81,110],["lg",111,170]],e=parseFloat(this.options_.width)/100*this.player_.el_.clientWidth;let s=!1;if(e){for(const[o,a,i]of t)e>a&&e<=i&&(this.layout_.contentWrpEl_.setAttribute("size",o),s=o);s||this.layout_.contentWrpEl_.removeAttribute("size")}}init(){this.render()}render(){this.layout_=new H(this.player_,this.options_)}}},8812:(t,e,s)=>{var o=s(2140),a=/^\s+/;t.exports=function(t){return t?t.slice(0,o(t)+1).replace(a,""):t}},2140:t=>{var e=/\s/;t.exports=function(t){for(var s=t.length;s--&&e.test(t.charAt(s)););return s}},6177:(t,e,s)=>{var o=s(8953),a=s(3664),i=s(5378),r=Math.max,n=Math.min;t.exports=function(t,e,s){var l,c,p,d,h,u,m=0,g=!1,_=!1,y=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){var s=l,o=c;return l=c=void 0,m=e,d=t.apply(o,s)}function v(t){var s=t-u;return void 0===u||s>=e||s<0||_&&t-m>=p}function b(){var t=a();if(v(t))return C(t);h=setTimeout(b,function(t){var s=e-(t-u);return _?n(s,p-(t-m)):s}(t))}function C(t){return h=void 0,y&&l?f(t):(l=c=void 0,d)}function E(){var t=a(),s=v(t);if(l=arguments,c=this,u=t,s){if(void 0===h)return function(t){return m=t,h=setTimeout(b,e),g?f(t):d}(u);if(_)return clearTimeout(h),h=setTimeout(b,e),f(u)}return void 0===h&&(h=setTimeout(b,e)),d}return e=i(e)||0,o(s)&&(g=!!s.leading,p=(_="maxWait"in s)?r(i(s.maxWait)||0,e):p,y="trailing"in s?!!s.trailing:y),E.cancel=function(){void 0!==h&&clearTimeout(h),m=0,l=u=c=h=void 0},E.flush=function(){return void 0===h?d:C(a())},E}},3664:(t,e,s)=>{var o=s(1433);t.exports=function(){return o.Date.now()}},2858:(t,e,s)=>{var o=s(6177),a=s(8953);t.exports=function(t,e,s){var i=!0,r=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return a(s)&&(i="leading"in s?!!s.leading:i,r="trailing"in s?!!s.trailing:r),o(t,e,{leading:i,maxWait:e,trailing:r})}},5378:(t,e,s)=>{var o=s(8812),a=s(8953),i=s(5414),r=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,l=/^0o[0-7]+$/i,c=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return NaN;if(a(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=a(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=o(t);var s=n.test(t);return s||l.test(t)?c(t.slice(2),s?2:8):r.test(t)?NaN:+t}}}]);
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*! @name videojs-per-source-behaviors @version 3.0.1 @license Apache-2.0 */
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @license
|
|
5
|
-
* slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
|
|
6
|
-
* Copyright (c) 2014 David Björklund
|
|
7
|
-
* Available under the MIT license
|
|
8
|
-
* <https://github.com/kesla/parse-headers/blob/master/LICENCE>
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @license
|
|
13
|
-
* Video.js 8.23.4 <http://videojs.com/>
|
|
14
|
-
* Copyright Brightcove, Inc. <https://www.brightcove.com/>
|
|
15
|
-
* Available under Apache License Version 2.0
|
|
16
|
-
* <https://github.com/videojs/video.js/blob/main/LICENSE>
|
|
17
|
-
*
|
|
18
|
-
* Includes vtt.js <https://github.com/mozilla/vtt.js>
|
|
19
|
-
* Available under Apache License Version 2.0
|
|
20
|
-
* <https://github.com/mozilla/vtt.js/blob/main/LICENSE>
|
|
21
|
-
*/
|