cloudinary-video-player 2.0.5 → 2.1.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/chapters.js +7 -7
- package/dist/chapters.light.js +7 -7
- package/dist/chapters.light.min.js +1 -1
- package/dist/chapters.min.js +1 -1
- package/dist/cld-video-player.css +5 -5
- package/dist/cld-video-player.js +3852 -1479
- package/dist/cld-video-player.light.css +5 -5
- package/dist/cld-video-player.light.js +2495 -901
- package/dist/cld-video-player.light.min.css +1 -1
- package/dist/cld-video-player.light.min.js +1 -1
- package/dist/cld-video-player.light.min.js.LICENSE.txt +1 -5
- package/dist/cld-video-player.min.css +1 -1
- package/dist/cld-video-player.min.js +1 -1
- package/dist/cld-video-player.min.js.LICENSE.txt +1 -5
- package/dist/debug.js +11 -11
- package/dist/debug.light.js +11 -11
- package/dist/debug.light.min.js +1 -1
- package/dist/debug.min.js +1 -1
- package/dist/ima.js +21 -9
- package/dist/ima.light.js +21 -9
- package/dist/ima.light.min.js +1 -1
- package/dist/ima.min.js +1 -1
- package/dist/interaction-areas.js +28 -28
- package/dist/interaction-areas.light.js +28 -28
- package/dist/interaction-areas.light.min.js +1 -1
- package/dist/interaction-areas.min.js +1 -1
- package/dist/playlist.js +40 -44
- package/dist/playlist.light.js +40 -44
- package/dist/playlist.light.min.js +1 -1
- package/dist/playlist.min.js +1 -1
- package/dist/recommendations-overlay.js +2 -2
- package/dist/recommendations-overlay.light.js +2 -2
- package/dist/recommendations-overlay.light.min.js +1 -1
- package/dist/recommendations-overlay.min.js +1 -1
- package/dist/shoppable.js +60 -50
- package/dist/shoppable.light.js +60 -50
- package/dist/shoppable.light.min.js +1 -1
- package/dist/shoppable.min.js +1 -1
- package/lib/all.js +1 -1
- package/lib/all.js.LICENSE.txt +1 -5
- package/lib/chapters.js +1 -1
- package/lib/cld-video-player.js +1 -1
- package/lib/cld-video-player.js.LICENSE.txt +1 -5
- package/lib/cld-video-player.min.css +2 -2
- package/lib/debug.js +1 -1
- package/lib/ima.js +1 -1
- package/lib/interaction-areas.js +1 -1
- package/lib/player.js +3 -0
- package/lib/player.js.LICENSE.txt +19 -0
- package/lib/playlist.js +1 -1
- package/lib/recommendations-overlay.js +1 -1
- package/lib/shoppable.js +1 -1
- package/lib/videoPlayer.js +1 -1
- package/lib/videoPlayer.js.LICENSE.txt +1 -5
- package/lib/videoPlayerWithProfile.js +1 -1
- package/lib/videoPlayerWithProfile.js.LICENSE.txt +1 -5
- package/package.json +32 -32
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[410],{7604:(t,
|
|
1
|
+
"use strict";(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[410],{7604:(e,t,s)=>{s.r(t),s.d(t,{default:()=>k});var i=s(6673),n=s.n(i);const o=n().getComponent("ClickableComponent");const r=class extends o{setItem(e){const{action:t,source:s}=e;this.source=s;const i=s.info();this.setTitle(i.title||s.publicId()),this.setPoster(this.source.poster().url({transformation:{aspect_ratio:"16:9",crop:"pad",background:"black"}})),this.setAction(t)}setTitle(e){this.title.innerText=e}setAction(e){this.action=e}handleClick(){super.handleClick(),this.player().trigger("recommendationshide"),this.action()}};var a=s(7878),c=s.n(a);const l=n().dom||n();const h=class extends r{setItem(e){super.setItem(e);const t=this.source.info();if(this.setTitle(t.title),this.setSubtitle(t.subtitle),t.description){const e=300,s=t.description.length>e?t.description.substring(0,e)+"...":t.description;this.setDescription(s)}}setPoster(e){this.poster.style.backgroundImage=`url('${e}')`}setTitle(e){c().setText(this.title,e),this.setAriaCheck(this.title,!!e)}setSubtitle(e){c().setText(this.subtitle,e),this.setAriaCheck(this.subtitle,!!e)}setDescription(e){c().setText(this.description,e),this.setAriaCheck(this.description,!!e)}setAriaCheck(e){!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden","true")}clearItem(){this.setTitle(""),this.setSubtitle(""),this.setDescription(""),this.poster.style.backgroundImage=null}createEl(){const e=super.createEl("div",{className:"vjs-recommendations-overlay-item vjs-recommendations-overlay-item-primary"});return this.poster=l.createEl("div",{className:"vjs-recommendations-overlay-item-primary-image"}),this.title=l.createEl("h2",{ariaLabel:"Recmmendation Title"}),this.setAriaCheck(this.title,!1),this.title.innerHTML="",this.subtitle=l.createEl("h3",{ariaLabel:"Recmmendation Subtitle"}),this.setAriaCheck(this.subtitle,!1),this.subtitle.innerHTML="",this.description=l.createEl("p"),this.setAriaCheck(this.description,!1),this.description.innerHTML="",this.content=l.createEl("div",{className:"vjs-recommendations-overlay-item-info vjs-recommendations-overlay-item-primary-content"}),this.content.appendChild(this.title),this.content.appendChild(this.subtitle),this.content.appendChild(this.description),e.appendChild(this.poster),e.appendChild(this.content),e}},d=n().dom||n();const m=class extends r{setItem(e){super.setItem(e),this.setDuration("")}setPoster(e){this.el().style.backgroundImage=`url('${e}')`}setDuration(e){this.duration.innerText=e}createEl(){const e=super.createEl("div",{className:"vjs-recommendations-overlay-item vjs-recommendations-overlay-item-secondary"});this.title=d.createEl("span",{className:"vjs-recommendations-overlay-item-secondary-title"}),this.title.innerHTML="",this.duration=d.createEl("span",{className:"vjs-recommendations-overlay-item-secondary-duration"}),this.duration.innerHTML="";const t=d.createEl("div",{className:"vjs-recommendations-overlay-item-info"});return t.appendChild(this.title),t.appendChild(this.duration),e.appendChild(t),e}handleClick(){super.handleClick(),this.action()}},p=n().getComponent("Component");const u=class extends p{setItems(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];this.clearItems(),t&&t.forEach((e=>{const t=new m(this.player());t.setItem(e),this.addChild(t)}))}clearItems(){this.children().forEach((()=>{this.removeChild(this.children()[0])}))}createEl(){return super.createEl("div",{className:"vjs-recommendations-overlay-item-secondary-container"})}},v=n().getComponent("Component");class y extends v{constructor(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),i=1;i<t;i++)s[i-1]=arguments[i];super(e,...s),this._primary=new h(e),this._secondaryContainer=new u(e),this.addChild(this._primary),this.addChild(this._secondaryContainer)}setItems(e){this._primary.setItem(e);for(var t=arguments.length,s=new Array(t>1?t-1:0),i=1;i<t;i++)s[i-1]=arguments[i];this._secondaryContainer.setItems(...s)}createEl(){return super.createEl("div",{className:"aspect-ratio-content"})}}const C=class extends v{constructor(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),i=1;i<t;i++)s[i-1]=arguments[i];super(e,...s),this._content=new y(e),this.addChild(this._content)}setItems(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),i=1;i<t;i++)s[i-1]=arguments[i];this._content.setItems(e,...s)}clearItems(){this._content._primary.clearItem(),this._content._secondaryContainer.clearItems()}createEl(){return super.createEl("div",{className:"vjs-recommendations-overlay-content"})}},g=n().getComponent("ClickableComponent");const I=class extends g{createEl(){return super.createEl("span",{className:"vjs-recommendations-overlay-hide vjs-icon-close"})}handleClick(){this.options_.clickHandler()}},b=n().getComponent("Component");class E extends b{constructor(e,t){for(var s=arguments.length,i=new Array(s>2?s-2:0),n=2;n<s;n++)i[n-2]=arguments[n];super(e,...i),this._content=new C(e),this.addChild(this._content),this.addChild(new I(e,{clickHandler:()=>{this.close()}},...i)),this.setEvents(e),this.doNotOpen=!1}setEvents(e){this.on(e,"recommendationschanged",((e,t)=>{this.setItems(...t.items)})),this.on(e,"recommendationsnoshow",this.setDoNotOpen),this.on(e,"recommendationsshow",this.open),this.on(e,"recommendationshide",this.close),this.on(e,"cldsourcechanged",(()=>{this.clearItems(),this.close()}))}setDoNotOpen(){this.doNotOpen=!0}open(){this.doNotOpen||(this._showControlsOnClose=this.player().controls(),this.player().controls(!1),this.el().style.visibility="visible")}clearItems(){this._content.clearItems()}close(){this.el().style.visibility="hidden",this._showControlsOnClose&&this.player().controls(!0)}createEl(){const e="vjs-recommendations-overlay",t=super.createEl("div",{className:e});return n().dom.addClass(t,e),t}setItems(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),i=1;i<t;i++)s[i-1]=arguments[i];this.doNotOpen=!1,s=s.slice(0,3),this._content.setItems(e,...s)}handleClick(){this.stopPropagation()}dispose(){super.dispose()}}n().registerComponent("recommendationsOverlay",E);const k=E}}]);
|
|
2
2
|
//# sourceMappingURL=recommendations-overlay.light.min.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[410],{7604:(t,
|
|
1
|
+
"use strict";(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[410],{7604:(e,t,s)=>{s.r(t),s.d(t,{default:()=>k});var i=s(7938),n=s.n(i);const o=n().getComponent("ClickableComponent");const r=class extends o{setItem(e){const{action:t,source:s}=e;this.source=s;const i=s.info();this.setTitle(i.title||s.publicId()),this.setPoster(this.source.poster().url({transformation:{aspect_ratio:"16:9",crop:"pad",background:"black"}})),this.setAction(t)}setTitle(e){this.title.innerText=e}setAction(e){this.action=e}handleClick(){super.handleClick(),this.player().trigger("recommendationshide"),this.action()}};var a=s(7878),c=s.n(a);const l=n().dom||n();const h=class extends r{setItem(e){super.setItem(e);const t=this.source.info();if(this.setTitle(t.title),this.setSubtitle(t.subtitle),t.description){const e=300,s=t.description.length>e?t.description.substring(0,e)+"...":t.description;this.setDescription(s)}}setPoster(e){this.poster.style.backgroundImage=`url('${e}')`}setTitle(e){c().setText(this.title,e),this.setAriaCheck(this.title,!!e)}setSubtitle(e){c().setText(this.subtitle,e),this.setAriaCheck(this.subtitle,!!e)}setDescription(e){c().setText(this.description,e),this.setAriaCheck(this.description,!!e)}setAriaCheck(e){!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden","true")}clearItem(){this.setTitle(""),this.setSubtitle(""),this.setDescription(""),this.poster.style.backgroundImage=null}createEl(){const e=super.createEl("div",{className:"vjs-recommendations-overlay-item vjs-recommendations-overlay-item-primary"});return this.poster=l.createEl("div",{className:"vjs-recommendations-overlay-item-primary-image"}),this.title=l.createEl("h2",{ariaLabel:"Recmmendation Title"}),this.setAriaCheck(this.title,!1),this.title.innerHTML="",this.subtitle=l.createEl("h3",{ariaLabel:"Recmmendation Subtitle"}),this.setAriaCheck(this.subtitle,!1),this.subtitle.innerHTML="",this.description=l.createEl("p"),this.setAriaCheck(this.description,!1),this.description.innerHTML="",this.content=l.createEl("div",{className:"vjs-recommendations-overlay-item-info vjs-recommendations-overlay-item-primary-content"}),this.content.appendChild(this.title),this.content.appendChild(this.subtitle),this.content.appendChild(this.description),e.appendChild(this.poster),e.appendChild(this.content),e}},d=n().dom||n();const m=class extends r{setItem(e){super.setItem(e),this.setDuration("")}setPoster(e){this.el().style.backgroundImage=`url('${e}')`}setDuration(e){this.duration.innerText=e}createEl(){const e=super.createEl("div",{className:"vjs-recommendations-overlay-item vjs-recommendations-overlay-item-secondary"});this.title=d.createEl("span",{className:"vjs-recommendations-overlay-item-secondary-title"}),this.title.innerHTML="",this.duration=d.createEl("span",{className:"vjs-recommendations-overlay-item-secondary-duration"}),this.duration.innerHTML="";const t=d.createEl("div",{className:"vjs-recommendations-overlay-item-info"});return t.appendChild(this.title),t.appendChild(this.duration),e.appendChild(t),e}handleClick(){super.handleClick(),this.action()}},p=n().getComponent("Component");const u=class extends p{setItems(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];this.clearItems(),t&&t.forEach((e=>{const t=new m(this.player());t.setItem(e),this.addChild(t)}))}clearItems(){this.children().forEach((()=>{this.removeChild(this.children()[0])}))}createEl(){return super.createEl("div",{className:"vjs-recommendations-overlay-item-secondary-container"})}},v=n().getComponent("Component");class y extends v{constructor(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),i=1;i<t;i++)s[i-1]=arguments[i];super(e,...s),this._primary=new h(e),this._secondaryContainer=new u(e),this.addChild(this._primary),this.addChild(this._secondaryContainer)}setItems(e){this._primary.setItem(e);for(var t=arguments.length,s=new Array(t>1?t-1:0),i=1;i<t;i++)s[i-1]=arguments[i];this._secondaryContainer.setItems(...s)}createEl(){return super.createEl("div",{className:"aspect-ratio-content"})}}const C=class extends v{constructor(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),i=1;i<t;i++)s[i-1]=arguments[i];super(e,...s),this._content=new y(e),this.addChild(this._content)}setItems(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),i=1;i<t;i++)s[i-1]=arguments[i];this._content.setItems(e,...s)}clearItems(){this._content._primary.clearItem(),this._content._secondaryContainer.clearItems()}createEl(){return super.createEl("div",{className:"vjs-recommendations-overlay-content"})}},g=n().getComponent("ClickableComponent");const I=class extends g{createEl(){return super.createEl("span",{className:"vjs-recommendations-overlay-hide vjs-icon-close"})}handleClick(){this.options_.clickHandler()}},b=n().getComponent("Component");class E extends b{constructor(e,t){for(var s=arguments.length,i=new Array(s>2?s-2:0),n=2;n<s;n++)i[n-2]=arguments[n];super(e,...i),this._content=new C(e),this.addChild(this._content),this.addChild(new I(e,{clickHandler:()=>{this.close()}},...i)),this.setEvents(e),this.doNotOpen=!1}setEvents(e){this.on(e,"recommendationschanged",((e,t)=>{this.setItems(...t.items)})),this.on(e,"recommendationsnoshow",this.setDoNotOpen),this.on(e,"recommendationsshow",this.open),this.on(e,"recommendationshide",this.close),this.on(e,"cldsourcechanged",(()=>{this.clearItems(),this.close()}))}setDoNotOpen(){this.doNotOpen=!0}open(){this.doNotOpen||(this._showControlsOnClose=this.player().controls(),this.player().controls(!1),this.el().style.visibility="visible")}clearItems(){this._content.clearItems()}close(){this.el().style.visibility="hidden",this._showControlsOnClose&&this.player().controls(!0)}createEl(){const e="vjs-recommendations-overlay",t=super.createEl("div",{className:e});return n().dom.addClass(t,e),t}setItems(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),i=1;i<t;i++)s[i-1]=arguments[i];this.doNotOpen=!1,s=s.slice(0,3),this._content.setItems(e,...s)}handleClick(){this.stopPropagation()}dispose(){super.dispose()}}n().registerComponent("recommendationsOverlay",E);const k=E}}]);
|
|
2
2
|
//# sourceMappingURL=recommendations-overlay.min.js.map
|
package/dist/shoppable.js
CHANGED
|
@@ -148,19 +148,19 @@ class ShoppablePanelToggle extends ClickableComponent {
|
|
|
148
148
|
let iconAttrs = {};
|
|
149
149
|
if (this.options_.toggleIcon) {
|
|
150
150
|
iconProps = {
|
|
151
|
-
className:
|
|
151
|
+
className: `${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_1__.CLD_SPBL_TOGGLE_ICON_CLASS} ${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_1__.CLD_SPBL_TOGGLE_CUSTOM_ICON_CLASS} ${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_1__.CLOSE_ICON_CLASS}`
|
|
152
152
|
};
|
|
153
153
|
iconAttrs = {
|
|
154
|
-
style:
|
|
154
|
+
style: `background-image: url(${this.options_.toggleIcon})`
|
|
155
155
|
};
|
|
156
156
|
} else {
|
|
157
157
|
iconProps = {
|
|
158
|
-
className:
|
|
158
|
+
className: `${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_1__.CLD_SPBL_TOGGLE_ICON_CLASS} ${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_1__.ICON_CART_CLASS}`
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
161
|
const icon = dom.createEl('span', iconProps, iconAttrs);
|
|
162
162
|
const el = super.createEl('a', {
|
|
163
|
-
className:
|
|
163
|
+
className: `${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_1__.CLD_SPBL_TOGGLE_CLASS} base-color-bg`
|
|
164
164
|
});
|
|
165
165
|
el.appendChild(icon);
|
|
166
166
|
this.player_.on(_utils_consts__WEBPACK_IMPORTED_MODULE_2__.PLAYER_EVENT.PRODUCT_BAR_MIN, () => {
|
|
@@ -195,9 +195,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
195
195
|
/* harmony import */ var utils_find__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! utils/find */ "./utils/find.js");
|
|
196
196
|
/* harmony import */ var _shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shoppable-widget.const */ "./components/shoppable-bar/shoppable-widget.const.js");
|
|
197
197
|
/* harmony import */ var _utils_consts__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../utils/consts */ "./utils/consts.js");
|
|
198
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
199
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
200
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
201
198
|
|
|
202
199
|
const dom = (video_js__WEBPACK_IMPORTED_MODULE_0___default().dom) || (video_js__WEBPACK_IMPORTED_MODULE_0___default());
|
|
203
200
|
|
|
@@ -209,42 +206,6 @@ class ShoppableProductsOverlay extends Component {
|
|
|
209
206
|
constructor(player) {
|
|
210
207
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
211
208
|
super(player, options);
|
|
212
|
-
_defineProperty(this, "renderProducts", () => {
|
|
213
|
-
// Close products side-panel
|
|
214
|
-
this.player_.removeClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PANEL_VISIBLE_CLASS);
|
|
215
|
-
this.player_.addClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PANEL_HIDDEN_CLASS);
|
|
216
|
-
this.player_.addClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PRODUCTS_OVERLAY_CLASS);
|
|
217
|
-
this.layout_.innerHTML = '';
|
|
218
|
-
|
|
219
|
-
// Filter products with appearance on currentTime
|
|
220
|
-
const currentTime = this.player_.currentTime();
|
|
221
|
-
const currentProducts = this.options_.products.filter(product => product.hotspots && product.hotspots.some(a => (0,utils_time__WEBPACK_IMPORTED_MODULE_1__.parseTime)(a.time) === currentTime));
|
|
222
|
-
currentProducts.forEach(product => {
|
|
223
|
-
const hotspot = (0,utils_find__WEBPACK_IMPORTED_MODULE_2__.find)(product.hotspots, hs => (0,utils_time__WEBPACK_IMPORTED_MODULE_1__.parseTime)(hs.time) === currentTime);
|
|
224
|
-
const productName = dom.createEl('div', {
|
|
225
|
-
className: 'cld-spbl-product-hotspot-name'
|
|
226
|
-
}, {}, product.productName);
|
|
227
|
-
const productTooltip = dom.createEl('div', {
|
|
228
|
-
className: 'cld-spbl-product-tooltip cld-spbl-product-tooltip-' + hotspot.tooltipPosition
|
|
229
|
-
}, {}, productName);
|
|
230
|
-
const productHotSpot = dom.createEl('a', {
|
|
231
|
-
className: 'cld-spbl-product-hotspot accent-color-text',
|
|
232
|
-
href: hotspot.clickUrl,
|
|
233
|
-
target: '_blank'
|
|
234
|
-
}, {
|
|
235
|
-
style: 'left:' + hotspot.x + '; top:' + hotspot.y + ';'
|
|
236
|
-
}, productTooltip);
|
|
237
|
-
this.layout_.appendChild(productHotSpot);
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
// Remove
|
|
241
|
-
this.player_.one(_utils_consts__WEBPACK_IMPORTED_MODULE_4__.PLAYER_EVENT.SEEKING, this.clearLayout);
|
|
242
|
-
this.player_.one(_utils_consts__WEBPACK_IMPORTED_MODULE_4__.PLAYER_EVENT.PLAY, this.clearLayout);
|
|
243
|
-
});
|
|
244
|
-
_defineProperty(this, "clearLayout", () => {
|
|
245
|
-
this.layout_.innerHTML = '';
|
|
246
|
-
this.player_.removeClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PRODUCTS_OVERLAY_CLASS);
|
|
247
|
-
});
|
|
248
209
|
this.options_ = options;
|
|
249
210
|
this.player_ = player;
|
|
250
211
|
this.player_.on(_utils_consts__WEBPACK_IMPORTED_MODULE_4__.PLAYER_EVENT.SHOW_PRODUCTS_OVERLAY, this.renderProducts);
|
|
@@ -252,11 +213,47 @@ class ShoppableProductsOverlay extends Component {
|
|
|
252
213
|
this.layout_.dispose();
|
|
253
214
|
};
|
|
254
215
|
}
|
|
216
|
+
renderProducts = () => {
|
|
217
|
+
// Close products side-panel
|
|
218
|
+
this.player_.removeClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PANEL_VISIBLE_CLASS);
|
|
219
|
+
this.player_.addClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PANEL_HIDDEN_CLASS);
|
|
220
|
+
this.player_.addClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PRODUCTS_OVERLAY_CLASS);
|
|
221
|
+
this.layout_.innerHTML = '';
|
|
222
|
+
|
|
223
|
+
// Filter products with appearance on currentTime
|
|
224
|
+
const currentTime = this.player_.currentTime();
|
|
225
|
+
const currentProducts = this.options_.products.filter(product => product.hotspots && product.hotspots.some(a => (0,utils_time__WEBPACK_IMPORTED_MODULE_1__.parseTime)(a.time) === currentTime));
|
|
226
|
+
currentProducts.forEach(product => {
|
|
227
|
+
const hotspot = (0,utils_find__WEBPACK_IMPORTED_MODULE_2__.find)(product.hotspots, hs => (0,utils_time__WEBPACK_IMPORTED_MODULE_1__.parseTime)(hs.time) === currentTime);
|
|
228
|
+
const productName = dom.createEl('div', {
|
|
229
|
+
className: 'cld-spbl-product-hotspot-name'
|
|
230
|
+
}, {}, product.productName);
|
|
231
|
+
const productTooltip = dom.createEl('div', {
|
|
232
|
+
className: 'cld-spbl-product-tooltip cld-spbl-product-tooltip-' + hotspot.tooltipPosition
|
|
233
|
+
}, {}, productName);
|
|
234
|
+
const productHotSpot = dom.createEl('a', {
|
|
235
|
+
className: 'cld-spbl-product-hotspot accent-color-text',
|
|
236
|
+
href: hotspot.clickUrl,
|
|
237
|
+
target: '_blank'
|
|
238
|
+
}, {
|
|
239
|
+
style: 'left:' + hotspot.x + '; top:' + hotspot.y + ';'
|
|
240
|
+
}, productTooltip);
|
|
241
|
+
this.layout_.appendChild(productHotSpot);
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
// Remove
|
|
245
|
+
this.player_.one(_utils_consts__WEBPACK_IMPORTED_MODULE_4__.PLAYER_EVENT.SEEKING, this.clearLayout);
|
|
246
|
+
this.player_.one(_utils_consts__WEBPACK_IMPORTED_MODULE_4__.PLAYER_EVENT.PLAY, this.clearLayout);
|
|
247
|
+
};
|
|
248
|
+
clearLayout = () => {
|
|
249
|
+
this.layout_.innerHTML = '';
|
|
250
|
+
this.player_.removeClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PRODUCTS_OVERLAY_CLASS);
|
|
251
|
+
};
|
|
255
252
|
createEl() {
|
|
256
253
|
const dimensions = this.player_.currentDimensions();
|
|
257
254
|
this.layout_ = dom.createEl('div', {
|
|
258
255
|
className: 'cld-spbl-products-overlay',
|
|
259
|
-
style:
|
|
256
|
+
style: `padding-top: ${dimensions.height / dimensions.width * 100}%;`
|
|
260
257
|
});
|
|
261
258
|
return this.layout_;
|
|
262
259
|
}
|
|
@@ -297,7 +294,7 @@ class ShoppablePanelItem extends ClickableComponent {
|
|
|
297
294
|
handleClick(event) {
|
|
298
295
|
event.preventDefault();
|
|
299
296
|
event.stopPropagation();
|
|
300
|
-
if (!this.el_.matches(
|
|
297
|
+
if (!this.el_.matches(`.dragged .${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_2__.CLD_SPBL_ITEM}`)) {
|
|
301
298
|
// Prevent click event if dragged
|
|
302
299
|
this.options_.clickHandler(event);
|
|
303
300
|
}
|
|
@@ -308,7 +305,7 @@ class ShoppablePanelItem extends ClickableComponent {
|
|
|
308
305
|
}
|
|
309
306
|
createEl() {
|
|
310
307
|
const el = super.createEl('a', {
|
|
311
|
-
className:
|
|
308
|
+
className: `${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_2__.CLD_SPBL_ITEM} base-color-bg accent-color-text`,
|
|
312
309
|
href: '#'
|
|
313
310
|
});
|
|
314
311
|
el.setAttribute('data-product-id', this.options_.conf.productId || '');
|
|
@@ -356,7 +353,7 @@ const addOnHover = (el, conf, cldConf) => {
|
|
|
356
353
|
transformation: conf.args.transformation
|
|
357
354
|
});
|
|
358
355
|
const hoverImg = dom.createEl('img', {
|
|
359
|
-
className:
|
|
356
|
+
className: `${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_2__.CLD_SPBL_IMAGE} cld-spbl-hover-img`
|
|
360
357
|
}, {
|
|
361
358
|
src: switchImgSource.url(widthTransformation)
|
|
362
359
|
});
|
|
@@ -583,7 +580,7 @@ class ShoppablePostWidget {
|
|
|
583
580
|
}
|
|
584
581
|
handleDragToScroll() {
|
|
585
582
|
const postModal = this.player_.postModal.el_;
|
|
586
|
-
const slider = postModal.querySelector(
|
|
583
|
+
const slider = postModal.querySelector(`.${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_2__.CLD_SPBL_PANEL_CLASS}`);
|
|
587
584
|
let isDown = false;
|
|
588
585
|
let startX = 0;
|
|
589
586
|
let scrollLeft = 0;
|
|
@@ -633,7 +630,7 @@ class ShoppablePostWidget {
|
|
|
633
630
|
}]);
|
|
634
631
|
const panelBg = dom.createEl('div', {
|
|
635
632
|
className: 'cld-spbl-post-play-bg',
|
|
636
|
-
style:
|
|
633
|
+
style: `background-image: url("${bgSrc.url()}")`
|
|
637
634
|
});
|
|
638
635
|
const replayBtn = dom.createEl('button', {
|
|
639
636
|
className: 'cld-spbl-replay-btn base-color-bg vjs-icon-replay',
|
|
@@ -758,7 +755,20 @@ class ShoppableWidget {
|
|
|
758
755
|
});
|
|
759
756
|
}
|
|
760
757
|
const width = this.options_.width;
|
|
761
|
-
this._injectCSS(
|
|
758
|
+
this._injectCSS(`
|
|
759
|
+
.${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_4__.CLD_SPBL_INNER_BAR} {
|
|
760
|
+
transform: translateX(${width});
|
|
761
|
+
}
|
|
762
|
+
.${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_4__.SHOPPABLE_PANEL_VISIBLE_CLASS} .vjs-control-bar {
|
|
763
|
+
width: calc(100% - ${width});
|
|
764
|
+
}
|
|
765
|
+
.${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_4__.CLD_SPBL_TOGGLE_CLASS} {
|
|
766
|
+
right: ${width};
|
|
767
|
+
}
|
|
768
|
+
.${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_4__.CLD_SPBL_PANEL_CLASS}{
|
|
769
|
+
width: ${width};
|
|
770
|
+
}
|
|
771
|
+
`);
|
|
762
772
|
this._setListeners();
|
|
763
773
|
}
|
|
764
774
|
_setListeners() {
|
package/dist/shoppable.light.js
CHANGED
|
@@ -148,19 +148,19 @@ class ShoppablePanelToggle extends ClickableComponent {
|
|
|
148
148
|
let iconAttrs = {};
|
|
149
149
|
if (this.options_.toggleIcon) {
|
|
150
150
|
iconProps = {
|
|
151
|
-
className:
|
|
151
|
+
className: `${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_1__.CLD_SPBL_TOGGLE_ICON_CLASS} ${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_1__.CLD_SPBL_TOGGLE_CUSTOM_ICON_CLASS} ${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_1__.CLOSE_ICON_CLASS}`
|
|
152
152
|
};
|
|
153
153
|
iconAttrs = {
|
|
154
|
-
style:
|
|
154
|
+
style: `background-image: url(${this.options_.toggleIcon})`
|
|
155
155
|
};
|
|
156
156
|
} else {
|
|
157
157
|
iconProps = {
|
|
158
|
-
className:
|
|
158
|
+
className: `${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_1__.CLD_SPBL_TOGGLE_ICON_CLASS} ${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_1__.ICON_CART_CLASS}`
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
161
|
const icon = dom.createEl('span', iconProps, iconAttrs);
|
|
162
162
|
const el = super.createEl('a', {
|
|
163
|
-
className:
|
|
163
|
+
className: `${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_1__.CLD_SPBL_TOGGLE_CLASS} base-color-bg`
|
|
164
164
|
});
|
|
165
165
|
el.appendChild(icon);
|
|
166
166
|
this.player_.on(_utils_consts__WEBPACK_IMPORTED_MODULE_2__.PLAYER_EVENT.PRODUCT_BAR_MIN, () => {
|
|
@@ -195,9 +195,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
195
195
|
/* harmony import */ var utils_find__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! utils/find */ "./utils/find.js");
|
|
196
196
|
/* harmony import */ var _shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shoppable-widget.const */ "./components/shoppable-bar/shoppable-widget.const.js");
|
|
197
197
|
/* harmony import */ var _utils_consts__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../utils/consts */ "./utils/consts.js");
|
|
198
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
199
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
200
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
201
198
|
|
|
202
199
|
const dom = (video_js__WEBPACK_IMPORTED_MODULE_0___default().dom) || (video_js__WEBPACK_IMPORTED_MODULE_0___default());
|
|
203
200
|
|
|
@@ -209,42 +206,6 @@ class ShoppableProductsOverlay extends Component {
|
|
|
209
206
|
constructor(player) {
|
|
210
207
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
211
208
|
super(player, options);
|
|
212
|
-
_defineProperty(this, "renderProducts", () => {
|
|
213
|
-
// Close products side-panel
|
|
214
|
-
this.player_.removeClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PANEL_VISIBLE_CLASS);
|
|
215
|
-
this.player_.addClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PANEL_HIDDEN_CLASS);
|
|
216
|
-
this.player_.addClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PRODUCTS_OVERLAY_CLASS);
|
|
217
|
-
this.layout_.innerHTML = '';
|
|
218
|
-
|
|
219
|
-
// Filter products with appearance on currentTime
|
|
220
|
-
const currentTime = this.player_.currentTime();
|
|
221
|
-
const currentProducts = this.options_.products.filter(product => product.hotspots && product.hotspots.some(a => (0,utils_time__WEBPACK_IMPORTED_MODULE_1__.parseTime)(a.time) === currentTime));
|
|
222
|
-
currentProducts.forEach(product => {
|
|
223
|
-
const hotspot = (0,utils_find__WEBPACK_IMPORTED_MODULE_2__.find)(product.hotspots, hs => (0,utils_time__WEBPACK_IMPORTED_MODULE_1__.parseTime)(hs.time) === currentTime);
|
|
224
|
-
const productName = dom.createEl('div', {
|
|
225
|
-
className: 'cld-spbl-product-hotspot-name'
|
|
226
|
-
}, {}, product.productName);
|
|
227
|
-
const productTooltip = dom.createEl('div', {
|
|
228
|
-
className: 'cld-spbl-product-tooltip cld-spbl-product-tooltip-' + hotspot.tooltipPosition
|
|
229
|
-
}, {}, productName);
|
|
230
|
-
const productHotSpot = dom.createEl('a', {
|
|
231
|
-
className: 'cld-spbl-product-hotspot accent-color-text',
|
|
232
|
-
href: hotspot.clickUrl,
|
|
233
|
-
target: '_blank'
|
|
234
|
-
}, {
|
|
235
|
-
style: 'left:' + hotspot.x + '; top:' + hotspot.y + ';'
|
|
236
|
-
}, productTooltip);
|
|
237
|
-
this.layout_.appendChild(productHotSpot);
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
// Remove
|
|
241
|
-
this.player_.one(_utils_consts__WEBPACK_IMPORTED_MODULE_4__.PLAYER_EVENT.SEEKING, this.clearLayout);
|
|
242
|
-
this.player_.one(_utils_consts__WEBPACK_IMPORTED_MODULE_4__.PLAYER_EVENT.PLAY, this.clearLayout);
|
|
243
|
-
});
|
|
244
|
-
_defineProperty(this, "clearLayout", () => {
|
|
245
|
-
this.layout_.innerHTML = '';
|
|
246
|
-
this.player_.removeClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PRODUCTS_OVERLAY_CLASS);
|
|
247
|
-
});
|
|
248
209
|
this.options_ = options;
|
|
249
210
|
this.player_ = player;
|
|
250
211
|
this.player_.on(_utils_consts__WEBPACK_IMPORTED_MODULE_4__.PLAYER_EVENT.SHOW_PRODUCTS_OVERLAY, this.renderProducts);
|
|
@@ -252,11 +213,47 @@ class ShoppableProductsOverlay extends Component {
|
|
|
252
213
|
this.layout_.dispose();
|
|
253
214
|
};
|
|
254
215
|
}
|
|
216
|
+
renderProducts = () => {
|
|
217
|
+
// Close products side-panel
|
|
218
|
+
this.player_.removeClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PANEL_VISIBLE_CLASS);
|
|
219
|
+
this.player_.addClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PANEL_HIDDEN_CLASS);
|
|
220
|
+
this.player_.addClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PRODUCTS_OVERLAY_CLASS);
|
|
221
|
+
this.layout_.innerHTML = '';
|
|
222
|
+
|
|
223
|
+
// Filter products with appearance on currentTime
|
|
224
|
+
const currentTime = this.player_.currentTime();
|
|
225
|
+
const currentProducts = this.options_.products.filter(product => product.hotspots && product.hotspots.some(a => (0,utils_time__WEBPACK_IMPORTED_MODULE_1__.parseTime)(a.time) === currentTime));
|
|
226
|
+
currentProducts.forEach(product => {
|
|
227
|
+
const hotspot = (0,utils_find__WEBPACK_IMPORTED_MODULE_2__.find)(product.hotspots, hs => (0,utils_time__WEBPACK_IMPORTED_MODULE_1__.parseTime)(hs.time) === currentTime);
|
|
228
|
+
const productName = dom.createEl('div', {
|
|
229
|
+
className: 'cld-spbl-product-hotspot-name'
|
|
230
|
+
}, {}, product.productName);
|
|
231
|
+
const productTooltip = dom.createEl('div', {
|
|
232
|
+
className: 'cld-spbl-product-tooltip cld-spbl-product-tooltip-' + hotspot.tooltipPosition
|
|
233
|
+
}, {}, productName);
|
|
234
|
+
const productHotSpot = dom.createEl('a', {
|
|
235
|
+
className: 'cld-spbl-product-hotspot accent-color-text',
|
|
236
|
+
href: hotspot.clickUrl,
|
|
237
|
+
target: '_blank'
|
|
238
|
+
}, {
|
|
239
|
+
style: 'left:' + hotspot.x + '; top:' + hotspot.y + ';'
|
|
240
|
+
}, productTooltip);
|
|
241
|
+
this.layout_.appendChild(productHotSpot);
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
// Remove
|
|
245
|
+
this.player_.one(_utils_consts__WEBPACK_IMPORTED_MODULE_4__.PLAYER_EVENT.SEEKING, this.clearLayout);
|
|
246
|
+
this.player_.one(_utils_consts__WEBPACK_IMPORTED_MODULE_4__.PLAYER_EVENT.PLAY, this.clearLayout);
|
|
247
|
+
};
|
|
248
|
+
clearLayout = () => {
|
|
249
|
+
this.layout_.innerHTML = '';
|
|
250
|
+
this.player_.removeClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PRODUCTS_OVERLAY_CLASS);
|
|
251
|
+
};
|
|
255
252
|
createEl() {
|
|
256
253
|
const dimensions = this.player_.currentDimensions();
|
|
257
254
|
this.layout_ = dom.createEl('div', {
|
|
258
255
|
className: 'cld-spbl-products-overlay',
|
|
259
|
-
style:
|
|
256
|
+
style: `padding-top: ${dimensions.height / dimensions.width * 100}%;`
|
|
260
257
|
});
|
|
261
258
|
return this.layout_;
|
|
262
259
|
}
|
|
@@ -297,7 +294,7 @@ class ShoppablePanelItem extends ClickableComponent {
|
|
|
297
294
|
handleClick(event) {
|
|
298
295
|
event.preventDefault();
|
|
299
296
|
event.stopPropagation();
|
|
300
|
-
if (!this.el_.matches(
|
|
297
|
+
if (!this.el_.matches(`.dragged .${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_2__.CLD_SPBL_ITEM}`)) {
|
|
301
298
|
// Prevent click event if dragged
|
|
302
299
|
this.options_.clickHandler(event);
|
|
303
300
|
}
|
|
@@ -308,7 +305,7 @@ class ShoppablePanelItem extends ClickableComponent {
|
|
|
308
305
|
}
|
|
309
306
|
createEl() {
|
|
310
307
|
const el = super.createEl('a', {
|
|
311
|
-
className:
|
|
308
|
+
className: `${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_2__.CLD_SPBL_ITEM} base-color-bg accent-color-text`,
|
|
312
309
|
href: '#'
|
|
313
310
|
});
|
|
314
311
|
el.setAttribute('data-product-id', this.options_.conf.productId || '');
|
|
@@ -356,7 +353,7 @@ const addOnHover = (el, conf, cldConf) => {
|
|
|
356
353
|
transformation: conf.args.transformation
|
|
357
354
|
});
|
|
358
355
|
const hoverImg = dom.createEl('img', {
|
|
359
|
-
className:
|
|
356
|
+
className: `${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_2__.CLD_SPBL_IMAGE} cld-spbl-hover-img`
|
|
360
357
|
}, {
|
|
361
358
|
src: switchImgSource.url(widthTransformation)
|
|
362
359
|
});
|
|
@@ -583,7 +580,7 @@ class ShoppablePostWidget {
|
|
|
583
580
|
}
|
|
584
581
|
handleDragToScroll() {
|
|
585
582
|
const postModal = this.player_.postModal.el_;
|
|
586
|
-
const slider = postModal.querySelector(
|
|
583
|
+
const slider = postModal.querySelector(`.${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_2__.CLD_SPBL_PANEL_CLASS}`);
|
|
587
584
|
let isDown = false;
|
|
588
585
|
let startX = 0;
|
|
589
586
|
let scrollLeft = 0;
|
|
@@ -633,7 +630,7 @@ class ShoppablePostWidget {
|
|
|
633
630
|
}]);
|
|
634
631
|
const panelBg = dom.createEl('div', {
|
|
635
632
|
className: 'cld-spbl-post-play-bg',
|
|
636
|
-
style:
|
|
633
|
+
style: `background-image: url("${bgSrc.url()}")`
|
|
637
634
|
});
|
|
638
635
|
const replayBtn = dom.createEl('button', {
|
|
639
636
|
className: 'cld-spbl-replay-btn base-color-bg vjs-icon-replay',
|
|
@@ -758,7 +755,20 @@ class ShoppableWidget {
|
|
|
758
755
|
});
|
|
759
756
|
}
|
|
760
757
|
const width = this.options_.width;
|
|
761
|
-
this._injectCSS(
|
|
758
|
+
this._injectCSS(`
|
|
759
|
+
.${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_4__.CLD_SPBL_INNER_BAR} {
|
|
760
|
+
transform: translateX(${width});
|
|
761
|
+
}
|
|
762
|
+
.${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_4__.SHOPPABLE_PANEL_VISIBLE_CLASS} .vjs-control-bar {
|
|
763
|
+
width: calc(100% - ${width});
|
|
764
|
+
}
|
|
765
|
+
.${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_4__.CLD_SPBL_TOGGLE_CLASS} {
|
|
766
|
+
right: ${width};
|
|
767
|
+
}
|
|
768
|
+
.${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_4__.CLD_SPBL_PANEL_CLASS}{
|
|
769
|
+
width: ${width};
|
|
770
|
+
}
|
|
771
|
+
`);
|
|
762
772
|
this._setListeners();
|
|
763
773
|
}
|
|
764
774
|
_setListeners() {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[525],{9987:(t,e,s)=>{"use strict";s.d(e,{default:()=>F});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 n=s(9339);const r={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="overlay",d="shoppable-panel-visible",h="shoppable-panel-hidden",u="shoppable-products-overlay",m="cld-spbl-panel",g="cld-spbl-toggle",_="cld-spbl-toggle-icon",f="cld-spbl-bar-inner",y="animate",v="cld-spbl-item",b="cld-spbl-img";var C=s(1104);function E(t,e,s){var o;return(e="symbol"==typeof(o=function(t,e){if("object"!=typeof t||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var o=s.call(t,e||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(e,"string"))?o:o+"")in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}const T=a().dom||a(),N=a().getComponent("Component");class P extends N{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(t,e),E(this,"renderProducts",(()=>{this.player_.removeClass(d),this.player_.addClass(h),this.player_.addClass(u),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,n.I)(e.hotspots,(e=>i(e.time)===t)),o=T.createEl("div",{className:"cld-spbl-product-hotspot-name"},{},e.productName),a=T.createEl("div",{className:"cld-spbl-product-tooltip cld-spbl-product-tooltip-"+s.tooltipPosition},{},o),r=T.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(r)})),this.player_.one(C.f.SEEKING,this.clearLayout),this.player_.one(C.f.PLAY,this.clearLayout)})),E(this,"clearLayout",(()=>{this.layout_.innerHTML="",this.player_.removeClass(u)})),this.options_=e,this.player_=t,this.player_.on(C.f.SHOW_PRODUCTS_OVERLAY,this.renderProducts),this.dispose=()=>{this.layout_.dispose()}}createEl(){const t=this.player_.currentDimensions();return this.layout_=T.createEl("div",{className:"cld-spbl-products-overlay",style:"padding-top: ".concat(t.height/t.width*100,"%;")}),this.layout_}}a().registerComponent("ShoppableProductsOverlay",P);const L=P,w=a().dom||a(),x=a().getComponent("ClickableComponent");class k extends x{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:"".concat(_," ").concat("cld-spbl-toggle-custom-icon"," ").concat("vjs-icon-close")},e={style:"background-image: url(".concat(this.options_.toggleIcon,")")}):t={className:"".concat(_," ").concat("vjs-icon-cart")};const s=w.createEl("span",t,e),o=super.createEl("a",{className:"".concat(g," base-color-bg")});return o.appendChild(s),this.player_.on(C.f.PRODUCT_BAR_MIN,(()=>{setTimeout((()=>{s.classList.add(y),setTimeout((()=>{s.classList.remove(y)}),1e3)}),500)})),o}}a().registerComponent("shoppablePanelToggle",k);const I=k,A=a().dom||a(),S=a().getComponent("Component");class H extends S{constructor(t,e){super(t,e),this.player_=t,this.player().addClass("cld-shoppable-panel"),this.player().addClass(h),this.contentWrpEl_=A.createEl("div",{className:"cld-spbl-bar"}),this.contentBannerEl_=A.createEl("div",{className:"cld-spbl-banner-msg base-color-text"},{},this.options_.bannerMsg||"Shop the Video"),this.contentWrpEl_.appendChild(this.contentBannerEl_);const s=new L(this.player_,this.options_);this.contentWrpEl_.appendChild(s.el_),this.contentEl_=A.createEl("div",{className:f}),this.contentWrpEl_.appendChild(this.contentEl_),this.player().el().appendChild(this.contentWrpEl_),this.addChild(new I(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(h),this.player().addClass(d)):!1===t?(this.player().removeClass(d),this.player().addClass(h)):(this.player().toggleClass(h),this.player().toggleClass(d));let e=this.player().hasClass(d)?"productBarMax":"productBarMin";this.player().trigger(e)},"open"===this.options_.startState&&this.togglePanel(!0),this.player_.on(C.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",H);const M=H;var O=s(2858),D=s.n(O),j=s(4650);const W=a().getComponent("ClickableComponent"),B=a().dom||a(),R={width:132};class z extends W{constructor(t,e){super(t,e),this.options_=e,this.isDragged=!1}handleClick(t){t.preventDefault(),t.stopPropagation(),this.el_.matches(".dragged .".concat(v))||this.options_.clickHandler(t),this.isDragged=!1}getTitle(){return this.options_.conf.title}createEl(){const t=super.createEl("a",{className:"".concat(v," 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&&U(t,this.options_.conf.onHover,this.options_.item.cloudinaryConfig()),this.options_.conf.onClick&&V(t,this.options_.conf.onClick);const e=super.createEl("img",{className:b},{src:this.options_.item.url(R)});if(t.appendChild(e),this.getTitle()){const e=B.createEl("div",{className:"cld-spbl-item-info base-color-semi-bg text-color-text"}),s=B.createEl("span",{className:"cld-spbl-item-title"},{},this.getTitle());e.appendChild(s),t.appendChild(e)}return t}}const U=(t,e,s)=>{if(t.setAttribute("data-hover-action",e.action),e.action===p){const s=B.createEl("span",{className:"cld-spbl-overlay-text base-color-text"},{},e.args),o=B.createEl("span",{className:"cld-spbl-overlay text-color-semi-bg base-color-text"},{title:e.args},s);t.appendChild(o)}else{const o=new j.A(e.args.publicId,{cloudinaryConfig:s,transformation:e.args.transformation}),a=B.createEl("img",{className:"".concat(b," cld-spbl-hover-img")},{src:o.url(R)});t.appendChild(a)}},V=(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",z);const X=z,G=a().getComponent("Component");class Y extends G{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(C.f.SHOPPABLE_ITEM_CHANGED,s),this.render(),this.dispose=()=>{super.dispose(),t.off(C.f.SHOPPABLE_ITEM_CHANGED,s)}}createEl(){const t=super.createEl();return[m,"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 j.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=D()((()=>this.scrollToActiveItem()),1e3);t.forEach(((t,s)=>{const o=new X(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(d),this.player_.addClass(h),this.player_.addClass(u),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(C.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",Y);const $=Y,q=a().dom||a();const Z=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(".".concat(m));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=q.createEl("div",{className:"cld-spbl-post-play"}),e=new $(this.player_,this.options_),s=q.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=q.createEl("div",{className:"cld-spbl-post-play-bg",style:'background-image: url("'.concat(o.url(),'")')}),i=q.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")}))}};const F=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.options_=a().obj.merge(r,e),this.player_=t,this.options_.showPostPlayOverlay&&this.player_.on(C.f.ENDED,(()=>{this.player_.addChild(new Z(this.player_,this.options_))}));const s=this.options_.width;this._injectCSS("\n .".concat(f," {\n transform: translateX(").concat(s,");\n }\n .").concat(d," .vjs-control-bar {\n width: calc(100% - ").concat(s,");\n }\n .").concat(g," {\n right: ").concat(s,";\n }\n .").concat(m,"{\n width: ").concat(s,";\n }\n ")),this._setListeners()}_setListeners(){const t=this._resizeHandler.bind(this);this.player_.on(C.f.RESIZE,t),window.addEventListener("resize",t),this.dispose=()=>{this.player_.off(C.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 M(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),n=Math.max,r=Math.min;t.exports=function(t,e,s){var l,c,p,d,h,u,m=0,g=!1,_=!1,f=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function y(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 _?r(s,p-(t-m)):s}(t))}function C(t){return h=void 0,f&&l?y(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?y(t):d}(u);if(_)return clearTimeout(h),h=setTimeout(b,e),y(u)}return void 0===h&&(h=setTimeout(b,e)),d}return e=i(e)||0,o(s)&&(g=!!s.leading,p=(_="maxWait"in s)?n(i(s.maxWait)||0,e):p,f="trailing"in s?!!s.trailing:f),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,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return a(s)&&(i="leading"in s?!!s.leading:i,n="trailing"in s?!!s.trailing:n),o(t,e,{leading:i,maxWait:e,trailing:n})}},5378:(t,e,s)=>{var o=s(8812),a=s(8953),i=s(5414),n=/^[-+]0x[0-9a-f]+$/i,r=/^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=r.test(t);return s||l.test(t)?c(t.slice(2),s?2:8):n.test(t)?NaN:+t}}}]);
|
|
1
|
+
(self.cloudinaryVideoPlayerChunkLoading=self.cloudinaryVideoPlayerChunkLoading||[]).push([[525],{9987:(t,e,s)=>{"use strict";s.d(e,{default:()=>Z});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="overlay",d="shoppable-panel-visible",h="shoppable-panel-hidden",u="shoppable-products-overlay",m="cld-spbl-panel",g="cld-spbl-toggle",_="cld-spbl-toggle-icon",y="cld-spbl-bar-inner",f="animate",v="cld-spbl-item",b="cld-spbl-img";var C=s(1104);const E=a().dom||a(),T=a().getComponent("Component");class N extends T{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(C.f.SHOW_PRODUCTS_OVERLAY,this.renderProducts),this.dispose=()=>{this.layout_.dispose()}}renderProducts=()=>{this.player_.removeClass(d),this.player_.addClass(h),this.player_.addClass(u),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=E.createEl("div",{className:"cld-spbl-product-hotspot-name"},{},e.productName),a=E.createEl("div",{className:"cld-spbl-product-tooltip cld-spbl-product-tooltip-"+s.tooltipPosition},{},o),n=E.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(C.f.SEEKING,this.clearLayout),this.player_.one(C.f.PLAY,this.clearLayout)};clearLayout=()=>{this.layout_.innerHTML="",this.player_.removeClass(u)};createEl(){const t=this.player_.currentDimensions();return this.layout_=E.createEl("div",{className:"cld-spbl-products-overlay",style:`padding-top: ${t.height/t.width*100}%;`}),this.layout_}}a().registerComponent("ShoppableProductsOverlay",N);const P=N,L=a().dom||a(),x=a().getComponent("ClickableComponent");class w extends x{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:`${_} cld-spbl-toggle-custom-icon vjs-icon-close`},e={style:`background-image: url(${this.options_.toggleIcon})`}):t={className:`${_} vjs-icon-cart`};const s=L.createEl("span",t,e),o=super.createEl("a",{className:`${g} base-color-bg`});return o.appendChild(s),this.player_.on(C.f.PRODUCT_BAR_MIN,(()=>{setTimeout((()=>{s.classList.add(f),setTimeout((()=>{s.classList.remove(f)}),1e3)}),500)})),o}}a().registerComponent("shoppablePanelToggle",w);const k=w,I=a().dom||a(),A=a().getComponent("Component");class H extends A{constructor(t,e){super(t,e),this.player_=t,this.player().addClass("cld-shoppable-panel"),this.player().addClass(h),this.contentWrpEl_=I.createEl("div",{className:"cld-spbl-bar"}),this.contentBannerEl_=I.createEl("div",{className:"cld-spbl-banner-msg base-color-text"},{},this.options_.bannerMsg||"Shop the Video"),this.contentWrpEl_.appendChild(this.contentBannerEl_);const s=new P(this.player_,this.options_);this.contentWrpEl_.appendChild(s.el_),this.contentEl_=I.createEl("div",{className:y}),this.contentWrpEl_.appendChild(this.contentEl_),this.player().el().appendChild(this.contentWrpEl_),this.addChild(new k(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(h),this.player().addClass(d)):!1===t?(this.player().removeClass(d),this.player().addClass(h)):(this.player().toggleClass(h),this.player().toggleClass(d));let e=this.player().hasClass(d)?"productBarMax":"productBarMin";this.player().trigger(e)},"open"===this.options_.startState&&this.togglePanel(!0),this.player_.on(C.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",H);const M=H;var S=s(2858),$=s.n(S),O=s(4650);const D=a().getComponent("ClickableComponent"),W=a().dom||a(),j={width:132};class B extends D{constructor(t,e){super(t,e),this.options_=e,this.isDragged=!1}handleClick(t){t.preventDefault(),t.stopPropagation(),this.el_.matches(`.dragged .${v}`)||this.options_.clickHandler(t),this.isDragged=!1}getTitle(){return this.options_.conf.title}createEl(){const t=super.createEl("a",{className:`${v} 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&&R(t,this.options_.conf.onHover,this.options_.item.cloudinaryConfig()),this.options_.conf.onClick&&z(t,this.options_.conf.onClick);const e=super.createEl("img",{className:b},{src:this.options_.item.url(j)});if(t.appendChild(e),this.getTitle()){const e=W.createEl("div",{className:"cld-spbl-item-info base-color-semi-bg text-color-text"}),s=W.createEl("span",{className:"cld-spbl-item-title"},{},this.getTitle());e.appendChild(s),t.appendChild(e)}return t}}const R=(t,e,s)=>{if(t.setAttribute("data-hover-action",e.action),e.action===p){const s=W.createEl("span",{className:"cld-spbl-overlay-text base-color-text"},{},e.args),o=W.createEl("span",{className:"cld-spbl-overlay text-color-semi-bg base-color-text"},{title:e.args},s);t.appendChild(o)}else{const o=new O.A(e.args.publicId,{cloudinaryConfig:s,transformation:e.args.transformation}),a=W.createEl("img",{className:`${b} cld-spbl-hover-img`},{src:o.url(j)});t.appendChild(a)}},z=(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",B);const U=B,V=a().getComponent("Component");class X extends V{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(C.f.SHOPPABLE_ITEM_CHANGED,s),this.render(),this.dispose=()=>{super.dispose(),t.off(C.f.SHOPPABLE_ITEM_CHANGED,s)}}createEl(){const t=super.createEl();return[m,"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 O.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=$()((()=>this.scrollToActiveItem()),1e3);t.forEach(((t,s)=>{const o=new U(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(d),this.player_.addClass(h),this.player_.addClass(u),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(C.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",X);const G=X,Y=a().dom||a();const q=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(`.${m}`);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=Y.createEl("div",{className:"cld-spbl-post-play"}),e=new G(this.player_,this.options_),s=Y.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=Y.createEl("div",{className:"cld-spbl-post-play-bg",style:`background-image: url("${o.url()}")`}),i=Y.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")}))}};const Z=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(C.f.ENDED,(()=>{this.player_.addChild(new q(this.player_,this.options_))}));const s=this.options_.width;this._injectCSS(`\n .${y} {\n transform: translateX(${s});\n }\n .${d} .vjs-control-bar {\n width: calc(100% - ${s});\n }\n .${g} {\n right: ${s};\n }\n .${m}{\n width: ${s};\n }\n `),this._setListeners()}_setListeners(){const t=this._resizeHandler.bind(this);this.player_.on(C.f.RESIZE,t),window.addEventListener("resize",t),this.dispose=()=>{this.player_.off(C.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 M(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}}}]);
|
|
2
2
|
//# sourceMappingURL=shoppable.light.min.js.map
|