cloudinary-video-player 2.6.0 → 2.6.1-edge.1
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/README.md +14 -16
- package/dist/adaptive-streaming.js +36927 -0
- package/dist/adaptive-streaming.min.js +3 -0
- package/dist/adaptive-streaming.min.js.LICENSE.txt +3 -0
- package/dist/chapters.js +1 -1
- package/dist/chapters.min.js +1 -1
- package/dist/cld-video-player.css +200 -11
- package/dist/cld-video-player.js +37548 -79684
- package/dist/cld-video-player.light.js +197 -662
- package/dist/cld-video-player.light.min.js +4 -3
- 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 +16 -14
- package/dist/colors.js +86 -0
- package/dist/colors.min.js +2 -0
- package/dist/dash.js +62 -2
- package/dist/dash.min.js +1 -1
- package/dist/debug.js +140 -90
- package/dist/debug.min.js +1 -1
- package/dist/ima.js +66 -3
- package/dist/ima.min.js +1 -1
- package/dist/interaction-areas.js +87 -4
- package/dist/interaction-areas.min.js +1 -1
- package/dist/playlist.js +9 -9
- package/dist/playlist.min.js +1 -1
- package/dist/recommendations-overlay.js +7 -7
- package/dist/recommendations-overlay.min.js +1 -1
- package/dist/shoppable.js +7 -7
- package/dist/shoppable.min.js +1 -1
- package/dist/srt-text-tracks.js +208 -0
- package/dist/srt-text-tracks.min.js +2 -0
- package/dist/visual-search.js +4 -4
- package/dist/visual-search.min.js +1 -1
- package/lib/adaptive-streaming.js +3 -0
- package/lib/adaptive-streaming.js.LICENSE.txt +3 -0
- package/lib/all.js +1 -1
- package/lib/all.js.LICENSE.txt +18 -12
- package/lib/chapters.js +1 -1
- package/lib/cld-video-player.js +1 -1
- package/lib/cld-video-player.js.LICENSE.txt +16 -14
- package/lib/cld-video-player.min.css +2 -2
- package/lib/colors.js +2 -0
- package/lib/dash.js +1 -1
- package/lib/debug.js +1 -1
- package/lib/ima.js +1 -1
- package/lib/interaction-areas.js +1 -1
- package/lib/player.js +1 -1
- package/lib/player.js.LICENSE.txt +16 -14
- package/lib/playlist.js +1 -1
- package/lib/recommendations-overlay.js +1 -1
- package/lib/shoppable.js +1 -1
- package/lib/srt-text-tracks.js +2 -0
- package/lib/videoPlayer.js +1 -1
- package/lib/videoPlayer.js.LICENSE.txt +16 -14
- package/lib/visual-search.js +1 -1
- package/package.json +10 -23
- package/dist/chapters.light.js +0 -233
- package/dist/chapters.light.min.js +0 -2
- package/dist/cld-video-player.light.css +0 -2428
- package/dist/cld-video-player.light.min.css +0 -2
- package/dist/cld-video-player.light.min.js.LICENSE.txt +0 -21
- package/dist/dash.light.js +0 -70036
- package/dist/dash.light.min.js +0 -3
- package/dist/dash.light.min.js.LICENSE.txt +0 -1842
- package/dist/debug.light.js +0 -383
- package/dist/debug.light.min.js +0 -2
- package/dist/ima.light.js +0 -7110
- package/dist/ima.light.min.js +0 -2
- package/dist/interaction-areas.light.js +0 -646
- package/dist/interaction-areas.light.min.js +0 -2
- package/dist/node_modules_lodash_throttle_js.light.js +0 -449
- package/dist/playlist.light.js +0 -1788
- package/dist/playlist.light.min.js +0 -2
- package/dist/recommendations-overlay.light.js +0 -464
- package/dist/recommendations-overlay.light.min.js +0 -2
- package/dist/shoppable.light.js +0 -853
- package/dist/shoppable.light.min.js +0 -2
- package/dist/visual-search.light.js +0 -317
- package/dist/visual-search.light.min.js +0 -2
- package/lib/light/chapters.js +0 -2
- package/lib/light/cld-video-player.light.min.css +0 -21
- package/lib/light/dash.js +0 -3
- package/lib/light/dash.js.LICENSE.txt +0 -1842
- package/lib/light/debug.js +0 -2
- package/lib/light/ima.js +0 -2
- package/lib/light/index.js +0 -3
- package/lib/light/index.js.LICENSE.txt +0 -21
- package/lib/light/interaction-areas.js +0 -2
- package/lib/light/playlist.js +0 -2
- package/lib/light/recommendations-overlay.js +0 -2
- package/lib/light/shoppable.js +0 -2
- package/lib/light/visual-search.js +0 -2
package/dist/shoppable.light.js
DELETED
|
@@ -1,853 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
(self["cloudinaryVideoPlayerChunkLoading"] = self["cloudinaryVideoPlayerChunkLoading"] || []).push([["shoppable"],{
|
|
3
|
-
|
|
4
|
-
/***/ "./components/shoppable-bar/layout/bar-layout.js":
|
|
5
|
-
/*!*******************************************************!*\
|
|
6
|
-
!*** ./components/shoppable-bar/layout/bar-layout.js ***!
|
|
7
|
-
\*******************************************************/
|
|
8
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
9
|
-
|
|
10
|
-
__webpack_require__.r(__webpack_exports__);
|
|
11
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12
|
-
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
13
|
-
/* harmony export */ });
|
|
14
|
-
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! video.js */ "../node_modules/video.js/dist/alt/video.core-exposed.js");
|
|
15
|
-
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(video_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
16
|
-
/* harmony import */ var _shoppable_products_overlay__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./shoppable-products-overlay */ "./components/shoppable-bar/layout/shoppable-products-overlay.js");
|
|
17
|
-
/* harmony import */ var _shoppable_panel_toggle__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./shoppable-panel-toggle */ "./components/shoppable-bar/layout/shoppable-panel-toggle.js");
|
|
18
|
-
/* harmony import */ var _shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shoppable-widget.const */ "./components/shoppable-bar/shoppable-widget.const.js");
|
|
19
|
-
/* harmony import */ var _utils_consts__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../utils/consts */ "./utils/consts.js");
|
|
20
|
-
|
|
21
|
-
const dom = (video_js__WEBPACK_IMPORTED_MODULE_0___default().dom) || (video_js__WEBPACK_IMPORTED_MODULE_0___default());
|
|
22
|
-
const Component = video_js__WEBPACK_IMPORTED_MODULE_0___default().getComponent('Component');
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
class ShoppableBarLayout extends Component {
|
|
28
|
-
constructor(player, options) {
|
|
29
|
-
super(player, options);
|
|
30
|
-
this.player_ = player;
|
|
31
|
-
this.player().addClass('cld-shoppable-panel');
|
|
32
|
-
this.player().addClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PANEL_HIDDEN_CLASS);
|
|
33
|
-
this.contentWrpEl_ = dom.createEl('div', {
|
|
34
|
-
className: 'cld-spbl-bar'
|
|
35
|
-
});
|
|
36
|
-
this.contentBannerEl_ = dom.createEl('div', {
|
|
37
|
-
className: 'cld-spbl-banner-msg base-color-text'
|
|
38
|
-
}, {}, this.options_.bannerMsg || 'Shop the Video');
|
|
39
|
-
this.contentWrpEl_.appendChild(this.contentBannerEl_);
|
|
40
|
-
const productsOverlay = new _shoppable_products_overlay__WEBPACK_IMPORTED_MODULE_1__["default"](this.player_, this.options_);
|
|
41
|
-
this.contentWrpEl_.appendChild(productsOverlay.el_);
|
|
42
|
-
this.contentEl_ = dom.createEl('div', {
|
|
43
|
-
className: _shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.CLD_SPBL_INNER_BAR
|
|
44
|
-
});
|
|
45
|
-
this.contentWrpEl_.appendChild(this.contentEl_);
|
|
46
|
-
this.player().el().appendChild(this.contentWrpEl_);
|
|
47
|
-
this.addChild(new _shoppable_panel_toggle__WEBPACK_IMPORTED_MODULE_2__["default"](this.player_, {
|
|
48
|
-
toggleIcon: this.options_.toggleIcon,
|
|
49
|
-
clickHandler: () => {
|
|
50
|
-
this.togglePanel();
|
|
51
|
-
}
|
|
52
|
-
}));
|
|
53
|
-
this.addChild('ShoppablePanel', this.options_);
|
|
54
|
-
this.dispose = () => {
|
|
55
|
-
this.removeLayout();
|
|
56
|
-
super.dispose();
|
|
57
|
-
};
|
|
58
|
-
this.togglePanel = open => {
|
|
59
|
-
if (open === true) {
|
|
60
|
-
// Open
|
|
61
|
-
this.player().removeClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PANEL_HIDDEN_CLASS);
|
|
62
|
-
this.player().addClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PANEL_VISIBLE_CLASS);
|
|
63
|
-
} else if (open === false) {
|
|
64
|
-
// Close
|
|
65
|
-
this.player().removeClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PANEL_VISIBLE_CLASS);
|
|
66
|
-
this.player().addClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PANEL_HIDDEN_CLASS);
|
|
67
|
-
} else {
|
|
68
|
-
// Toggle
|
|
69
|
-
this.player().toggleClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PANEL_HIDDEN_CLASS);
|
|
70
|
-
this.player().toggleClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PANEL_VISIBLE_CLASS);
|
|
71
|
-
}
|
|
72
|
-
let eventName = this.player().hasClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__.SHOPPABLE_PANEL_VISIBLE_CLASS) ? 'productBarMax' : 'productBarMin';
|
|
73
|
-
this.player().trigger(eventName);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
// Open shoppable
|
|
77
|
-
if (this.options_.startState === 'open') {
|
|
78
|
-
this.togglePanel(true);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// On play start
|
|
82
|
-
this.player_.on(_utils_consts__WEBPACK_IMPORTED_MODULE_4__.PLAYER_EVENT.PLAY, () => {
|
|
83
|
-
if (this.player_.currentTime() < 0.01) {
|
|
84
|
-
// Open shoppable on-play
|
|
85
|
-
if (this.options_.startState === 'openOnPlay') {
|
|
86
|
-
this.togglePanel(true, this.options_.autoClose);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Auto-close shoppable
|
|
90
|
-
if (this.options_.autoClose && this.options_.startState.indexOf('open') !== -1) {
|
|
91
|
-
setTimeout(() => {
|
|
92
|
-
// Keep it open while hovered
|
|
93
|
-
if (!this.contentEl_.matches(':hover')) {
|
|
94
|
-
this.togglePanel(false);
|
|
95
|
-
} else {
|
|
96
|
-
this.contentEl_.addEventListener('mouseleave', () => {
|
|
97
|
-
this.togglePanel(false);
|
|
98
|
-
}, {
|
|
99
|
-
once: true
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}, this.options_.autoClose * 1000);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
createEl() {
|
|
108
|
-
const el = super.createEl('div');
|
|
109
|
-
return el;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
video_js__WEBPACK_IMPORTED_MODULE_0___default().registerComponent('shoppableBarLayout', ShoppableBarLayout);
|
|
113
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ShoppableBarLayout);
|
|
114
|
-
|
|
115
|
-
/***/ }),
|
|
116
|
-
|
|
117
|
-
/***/ "./components/shoppable-bar/layout/shoppable-panel-toggle.js":
|
|
118
|
-
/*!*******************************************************************!*\
|
|
119
|
-
!*** ./components/shoppable-bar/layout/shoppable-panel-toggle.js ***!
|
|
120
|
-
\*******************************************************************/
|
|
121
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
122
|
-
|
|
123
|
-
__webpack_require__.r(__webpack_exports__);
|
|
124
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
125
|
-
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
126
|
-
/* harmony export */ });
|
|
127
|
-
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! video.js */ "../node_modules/video.js/dist/alt/video.core-exposed.js");
|
|
128
|
-
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(video_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
129
|
-
/* harmony import */ var _shoppable_widget_const__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shoppable-widget.const */ "./components/shoppable-bar/shoppable-widget.const.js");
|
|
130
|
-
/* harmony import */ var _utils_consts__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../utils/consts */ "./utils/consts.js");
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const dom = (video_js__WEBPACK_IMPORTED_MODULE_0___default().dom) || (video_js__WEBPACK_IMPORTED_MODULE_0___default());
|
|
135
|
-
const ClickableComponent = video_js__WEBPACK_IMPORTED_MODULE_0___default().getComponent('ClickableComponent');
|
|
136
|
-
class ShoppablePanelToggle extends ClickableComponent {
|
|
137
|
-
constructor(player, options) {
|
|
138
|
-
super(player, options);
|
|
139
|
-
this.options_ = options;
|
|
140
|
-
}
|
|
141
|
-
handleClick(event) {
|
|
142
|
-
event.preventDefault();
|
|
143
|
-
event.stopPropagation();
|
|
144
|
-
this.options_.clickHandler();
|
|
145
|
-
}
|
|
146
|
-
createEl() {
|
|
147
|
-
let iconProps = {};
|
|
148
|
-
let iconAttrs = {};
|
|
149
|
-
if (this.options_.toggleIcon) {
|
|
150
|
-
iconProps = {
|
|
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
|
-
};
|
|
153
|
-
iconAttrs = {
|
|
154
|
-
style: `background-image: url(${this.options_.toggleIcon})`
|
|
155
|
-
};
|
|
156
|
-
} else {
|
|
157
|
-
iconProps = {
|
|
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
|
-
};
|
|
160
|
-
}
|
|
161
|
-
const icon = dom.createEl('span', iconProps, iconAttrs);
|
|
162
|
-
const el = super.createEl('a', {
|
|
163
|
-
className: `${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_1__.CLD_SPBL_TOGGLE_CLASS} base-color-bg`
|
|
164
|
-
});
|
|
165
|
-
el.appendChild(icon);
|
|
166
|
-
this.player_.on(_utils_consts__WEBPACK_IMPORTED_MODULE_2__.PLAYER_EVENT.PRODUCT_BAR_MIN, () => {
|
|
167
|
-
setTimeout(() => {
|
|
168
|
-
icon.classList.add(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_1__.SHOPPABLE_ANIMATION_CLASS);
|
|
169
|
-
setTimeout(() => {
|
|
170
|
-
icon.classList.remove(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_1__.SHOPPABLE_ANIMATION_CLASS);
|
|
171
|
-
}, 1000);
|
|
172
|
-
}, 500);
|
|
173
|
-
});
|
|
174
|
-
return el;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
video_js__WEBPACK_IMPORTED_MODULE_0___default().registerComponent('shoppablePanelToggle', ShoppablePanelToggle);
|
|
178
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ShoppablePanelToggle);
|
|
179
|
-
|
|
180
|
-
/***/ }),
|
|
181
|
-
|
|
182
|
-
/***/ "./components/shoppable-bar/layout/shoppable-products-overlay.js":
|
|
183
|
-
/*!***********************************************************************!*\
|
|
184
|
-
!*** ./components/shoppable-bar/layout/shoppable-products-overlay.js ***!
|
|
185
|
-
\***********************************************************************/
|
|
186
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
187
|
-
|
|
188
|
-
__webpack_require__.r(__webpack_exports__);
|
|
189
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
190
|
-
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
191
|
-
/* harmony export */ });
|
|
192
|
-
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! video.js */ "../node_modules/video.js/dist/alt/video.core-exposed.js");
|
|
193
|
-
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(video_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
194
|
-
/* harmony import */ var utils_time__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! utils/time */ "./utils/time.js");
|
|
195
|
-
/* harmony import */ var utils_find__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! utils/find */ "./utils/find.js");
|
|
196
|
-
/* harmony import */ var _shoppable_widget_const__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shoppable-widget.const */ "./components/shoppable-bar/shoppable-widget.const.js");
|
|
197
|
-
/* harmony import */ var _utils_consts__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../utils/consts */ "./utils/consts.js");
|
|
198
|
-
|
|
199
|
-
const dom = (video_js__WEBPACK_IMPORTED_MODULE_0___default().dom) || (video_js__WEBPACK_IMPORTED_MODULE_0___default());
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
const Component = video_js__WEBPACK_IMPORTED_MODULE_0___default().getComponent('Component');
|
|
205
|
-
class ShoppableProductsOverlay extends Component {
|
|
206
|
-
constructor(player) {
|
|
207
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
208
|
-
super(player, options);
|
|
209
|
-
this.options_ = options;
|
|
210
|
-
this.player_ = player;
|
|
211
|
-
this.player_.on(_utils_consts__WEBPACK_IMPORTED_MODULE_4__.PLAYER_EVENT.SHOW_PRODUCTS_OVERLAY, this.renderProducts);
|
|
212
|
-
this.dispose = () => {
|
|
213
|
-
this.layout_.dispose();
|
|
214
|
-
};
|
|
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
|
-
};
|
|
252
|
-
createEl() {
|
|
253
|
-
const dimensions = this.player_.currentDimensions();
|
|
254
|
-
this.layout_ = dom.createEl('div', {
|
|
255
|
-
className: 'cld-spbl-products-overlay',
|
|
256
|
-
style: `padding-top: ${dimensions.height / dimensions.width * 100}%;`
|
|
257
|
-
});
|
|
258
|
-
return this.layout_;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
video_js__WEBPACK_IMPORTED_MODULE_0___default().registerComponent('ShoppableProductsOverlay', ShoppableProductsOverlay);
|
|
262
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ShoppableProductsOverlay);
|
|
263
|
-
|
|
264
|
-
/***/ }),
|
|
265
|
-
|
|
266
|
-
/***/ "./components/shoppable-bar/panel/shoppable-panel-item.js":
|
|
267
|
-
/*!****************************************************************!*\
|
|
268
|
-
!*** ./components/shoppable-bar/panel/shoppable-panel-item.js ***!
|
|
269
|
-
\****************************************************************/
|
|
270
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
271
|
-
|
|
272
|
-
__webpack_require__.r(__webpack_exports__);
|
|
273
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
274
|
-
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
275
|
-
/* harmony export */ });
|
|
276
|
-
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! video.js */ "../node_modules/video.js/dist/alt/video.core-exposed.js");
|
|
277
|
-
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(video_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
278
|
-
/* harmony import */ var _plugins_cloudinary_models_image_source__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../plugins/cloudinary/models/image-source */ "./plugins/cloudinary/models/image-source.js");
|
|
279
|
-
/* harmony import */ var _shoppable_widget_const__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shoppable-widget.const */ "./components/shoppable-bar/shoppable-widget.const.js");
|
|
280
|
-
|
|
281
|
-
const ClickableComponent = video_js__WEBPACK_IMPORTED_MODULE_0___default().getComponent('ClickableComponent');
|
|
282
|
-
const dom = (video_js__WEBPACK_IMPORTED_MODULE_0___default().dom) || (video_js__WEBPACK_IMPORTED_MODULE_0___default());
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
const widthTransformation = {
|
|
286
|
-
width: 132
|
|
287
|
-
};
|
|
288
|
-
class ShoppablePanelItem extends ClickableComponent {
|
|
289
|
-
constructor(player, initOptions) {
|
|
290
|
-
super(player, initOptions);
|
|
291
|
-
this.options_ = initOptions;
|
|
292
|
-
this.isDragged = false;
|
|
293
|
-
}
|
|
294
|
-
handleClick(event) {
|
|
295
|
-
event.preventDefault();
|
|
296
|
-
event.stopPropagation();
|
|
297
|
-
if (!this.el_.matches(`.dragged .${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_2__.CLD_SPBL_ITEM}`)) {
|
|
298
|
-
// Prevent click event if dragged
|
|
299
|
-
this.options_.clickHandler(event);
|
|
300
|
-
}
|
|
301
|
-
this.isDragged = false;
|
|
302
|
-
}
|
|
303
|
-
getTitle() {
|
|
304
|
-
return this.options_.conf.title;
|
|
305
|
-
}
|
|
306
|
-
createEl() {
|
|
307
|
-
const el = super.createEl('a', {
|
|
308
|
-
className: `${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_2__.CLD_SPBL_ITEM} base-color-bg accent-color-text`,
|
|
309
|
-
href: '#'
|
|
310
|
-
});
|
|
311
|
-
el.setAttribute('data-product-id', this.options_.conf.productId || '');
|
|
312
|
-
el.setAttribute('data-product-name', this.options_.conf.productName || '');
|
|
313
|
-
if (this.options_.conf.onHover) {
|
|
314
|
-
addOnHover(el, this.options_.conf.onHover, this.options_.item.cloudinaryConfig());
|
|
315
|
-
}
|
|
316
|
-
if (this.options_.conf.onClick) {
|
|
317
|
-
addOnClick(el, this.options_.conf.onClick);
|
|
318
|
-
}
|
|
319
|
-
const img = super.createEl('img', {
|
|
320
|
-
className: _shoppable_widget_const__WEBPACK_IMPORTED_MODULE_2__.CLD_SPBL_IMAGE
|
|
321
|
-
}, {
|
|
322
|
-
src: this.options_.item.url(widthTransformation)
|
|
323
|
-
});
|
|
324
|
-
el.appendChild(img);
|
|
325
|
-
if (this.getTitle()) {
|
|
326
|
-
const info = dom.createEl('div', {
|
|
327
|
-
className: 'cld-spbl-item-info base-color-semi-bg text-color-text'
|
|
328
|
-
});
|
|
329
|
-
const title = dom.createEl('span', {
|
|
330
|
-
className: 'cld-spbl-item-title'
|
|
331
|
-
}, {}, this.getTitle());
|
|
332
|
-
info.appendChild(title);
|
|
333
|
-
el.appendChild(info);
|
|
334
|
-
}
|
|
335
|
-
return el;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
const addOnHover = (el, conf, cldConf) => {
|
|
339
|
-
el.setAttribute('data-hover-action', conf.action);
|
|
340
|
-
if (conf.action === _shoppable_widget_const__WEBPACK_IMPORTED_MODULE_2__.SHOPPABLE_HOVER_ACTIONS.OVERLAY) {
|
|
341
|
-
const overlayText = dom.createEl('span', {
|
|
342
|
-
className: 'cld-spbl-overlay-text base-color-text'
|
|
343
|
-
}, {}, conf.args);
|
|
344
|
-
const overlay = dom.createEl('span', {
|
|
345
|
-
className: 'cld-spbl-overlay text-color-semi-bg base-color-text'
|
|
346
|
-
}, {
|
|
347
|
-
title: conf.args
|
|
348
|
-
}, overlayText);
|
|
349
|
-
el.appendChild(overlay);
|
|
350
|
-
} else {
|
|
351
|
-
const switchImgSource = new _plugins_cloudinary_models_image_source__WEBPACK_IMPORTED_MODULE_1__["default"](conf.args.publicId, {
|
|
352
|
-
cloudinaryConfig: cldConf,
|
|
353
|
-
transformation: conf.args.transformation
|
|
354
|
-
});
|
|
355
|
-
const hoverImg = dom.createEl('img', {
|
|
356
|
-
className: `${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_2__.CLD_SPBL_IMAGE} cld-spbl-hover-img`
|
|
357
|
-
}, {
|
|
358
|
-
src: switchImgSource.url(widthTransformation)
|
|
359
|
-
});
|
|
360
|
-
el.appendChild(hoverImg);
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
const addOnClick = (el, conf) => {
|
|
364
|
-
el.setAttribute('data-click-action', conf.action);
|
|
365
|
-
el.setAttribute('data-pause', conf.pause);
|
|
366
|
-
if (conf.action === _shoppable_widget_const__WEBPACK_IMPORTED_MODULE_2__.SHOPPABLE_CLICK_ACTIONS.SEEk) {
|
|
367
|
-
el.setAttribute('data-seek', conf.args.time);
|
|
368
|
-
} else if (conf.action === _shoppable_widget_const__WEBPACK_IMPORTED_MODULE_2__.SHOPPABLE_CLICK_ACTIONS.GO_TO) {
|
|
369
|
-
el.setAttribute('data-goto-url', conf.args.url);
|
|
370
|
-
}
|
|
371
|
-
};
|
|
372
|
-
video_js__WEBPACK_IMPORTED_MODULE_0___default().registerComponent('shoppablePanelItem', ShoppablePanelItem);
|
|
373
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ShoppablePanelItem);
|
|
374
|
-
|
|
375
|
-
/***/ }),
|
|
376
|
-
|
|
377
|
-
/***/ "./components/shoppable-bar/panel/shoppable-panel.js":
|
|
378
|
-
/*!***********************************************************!*\
|
|
379
|
-
!*** ./components/shoppable-bar/panel/shoppable-panel.js ***!
|
|
380
|
-
\***********************************************************/
|
|
381
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
382
|
-
|
|
383
|
-
__webpack_require__.r(__webpack_exports__);
|
|
384
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
385
|
-
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
386
|
-
/* harmony export */ });
|
|
387
|
-
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! video.js */ "../node_modules/video.js/dist/alt/video.core-exposed.js");
|
|
388
|
-
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(video_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
389
|
-
/* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/throttle */ "../node_modules/lodash/throttle.js");
|
|
390
|
-
/* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_throttle__WEBPACK_IMPORTED_MODULE_1__);
|
|
391
|
-
/* harmony import */ var utils_time__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! utils/time */ "./utils/time.js");
|
|
392
|
-
/* harmony import */ var _shoppable_panel_item__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./shoppable-panel-item */ "./components/shoppable-bar/panel/shoppable-panel-item.js");
|
|
393
|
-
/* harmony import */ var _plugins_cloudinary_models_image_source__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../plugins/cloudinary/models/image-source */ "./plugins/cloudinary/models/image-source.js");
|
|
394
|
-
/* harmony import */ var _shoppable_widget_const__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../shoppable-widget.const */ "./components/shoppable-bar/shoppable-widget.const.js");
|
|
395
|
-
/* harmony import */ var _utils_consts__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../utils/consts */ "./utils/consts.js");
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
const Component = video_js__WEBPACK_IMPORTED_MODULE_0___default().getComponent('Component');
|
|
404
|
-
class ShoppablePanel extends Component {
|
|
405
|
-
constructor(player) {
|
|
406
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
407
|
-
super(player, options);
|
|
408
|
-
this.options = options;
|
|
409
|
-
const itemChangeHandler = () => {
|
|
410
|
-
this.render();
|
|
411
|
-
};
|
|
412
|
-
player.on(_utils_consts__WEBPACK_IMPORTED_MODULE_6__.PLAYER_EVENT.SHOPPABLE_ITEM_CHANGED, itemChangeHandler);
|
|
413
|
-
this.render();
|
|
414
|
-
this.dispose = () => {
|
|
415
|
-
super.dispose();
|
|
416
|
-
player.off(_utils_consts__WEBPACK_IMPORTED_MODULE_6__.PLAYER_EVENT.SHOPPABLE_ITEM_CHANGED, itemChangeHandler);
|
|
417
|
-
};
|
|
418
|
-
}
|
|
419
|
-
createEl() {
|
|
420
|
-
const el = super.createEl();
|
|
421
|
-
[_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_5__.CLD_SPBL_PANEL_CLASS, 'base-color-bg'].map(cls => el.classList.add(cls));
|
|
422
|
-
return el;
|
|
423
|
-
}
|
|
424
|
-
removeAll() {
|
|
425
|
-
const childrens = this.children();
|
|
426
|
-
for (let i = childrens.length - 1; i >= 0; --i) {
|
|
427
|
-
this.removeChild(childrens[i]);
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
getItems() {
|
|
431
|
-
const cloudinaryConfig = this.player_.cloudinary.cloudinaryConfig();
|
|
432
|
-
return this.options.products.map(product => {
|
|
433
|
-
if (product.onHover && typeof product.onHover.args === 'object') {
|
|
434
|
-
product.onHover.args.transformation = Object.assign({}, this.options.transformation, product.onHover.args.transformation);
|
|
435
|
-
}
|
|
436
|
-
const conf = {
|
|
437
|
-
productId: product.productId,
|
|
438
|
-
productName: product.productName,
|
|
439
|
-
title: product.title,
|
|
440
|
-
onHover: product.onHover,
|
|
441
|
-
onClick: product.onClick,
|
|
442
|
-
startTime: product.startTime,
|
|
443
|
-
endTime: product.endTime
|
|
444
|
-
};
|
|
445
|
-
const imageSource = new _plugins_cloudinary_models_image_source__WEBPACK_IMPORTED_MODULE_4__["default"](product.publicId, {
|
|
446
|
-
cloudinaryConfig: cloudinaryConfig,
|
|
447
|
-
transformation: Object.assign({}, this.options.transformation, product.transformation)
|
|
448
|
-
});
|
|
449
|
-
return {
|
|
450
|
-
imageSrc: imageSource,
|
|
451
|
-
conf: conf
|
|
452
|
-
};
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
|
-
scrollToActiveItem() {
|
|
456
|
-
const activeItems = this.el_.getElementsByClassName('active');
|
|
457
|
-
if (activeItems.length > 0) {
|
|
458
|
-
const toScroll = activeItems[0].offsetTop - 12;
|
|
459
|
-
// Test for native scrollTo support (IE will fail)
|
|
460
|
-
if ('scrollBehavior' in document.documentElement.style) {
|
|
461
|
-
this.el_.scrollTo({
|
|
462
|
-
top: toScroll,
|
|
463
|
-
behavior: 'smooth'
|
|
464
|
-
});
|
|
465
|
-
} else {
|
|
466
|
-
this.el_.scrollTop = toScroll;
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
render() {
|
|
471
|
-
this.removeAll();
|
|
472
|
-
const items = this.getItems();
|
|
473
|
-
const throttledScrollToActiveItem = lodash_throttle__WEBPACK_IMPORTED_MODULE_1___default()(() => this.scrollToActiveItem(), 1000);
|
|
474
|
-
items.forEach((item, index) => {
|
|
475
|
-
const shoppablePanelItem = new _shoppable_panel_item__WEBPACK_IMPORTED_MODULE_3__["default"](this.player(), {
|
|
476
|
-
item: item.imageSrc,
|
|
477
|
-
conf: item.conf,
|
|
478
|
-
next: index === 1,
|
|
479
|
-
current: index === 0,
|
|
480
|
-
clickHandler: e => {
|
|
481
|
-
let target = e.currentTarget || e.target;
|
|
482
|
-
let evName = this.player_.ended() ? 'productClickPost' : 'productClick';
|
|
483
|
-
this.player_.trigger(evName, {
|
|
484
|
-
productId: target.dataset.productId,
|
|
485
|
-
productName: target.dataset.productName
|
|
486
|
-
});
|
|
487
|
-
|
|
488
|
-
// Go to URL, or seek video (set currentTime)
|
|
489
|
-
if (target.dataset.clickAction === _shoppable_widget_const__WEBPACK_IMPORTED_MODULE_5__.SHOPPABLE_CLICK_ACTIONS.GO_TO) {
|
|
490
|
-
window.open(target.dataset.gotoUrl, '_blank');
|
|
491
|
-
} else if (target.dataset.clickAction === _shoppable_widget_const__WEBPACK_IMPORTED_MODULE_5__.SHOPPABLE_CLICK_ACTIONS.SEEk) {
|
|
492
|
-
const gotoSecs = (0,utils_time__WEBPACK_IMPORTED_MODULE_2__.parseTime)(target.dataset.seek);
|
|
493
|
-
if (gotoSecs !== null) {
|
|
494
|
-
this.player_.addClass('vjs-has-started'); // Hide the poster image
|
|
495
|
-
if (this.player_.postModal) {
|
|
496
|
-
this.player_.postModal.close();
|
|
497
|
-
}
|
|
498
|
-
this.player_.currentTime(gotoSecs);
|
|
499
|
-
// Close products side-panel
|
|
500
|
-
this.player_.removeClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_5__.SHOPPABLE_PANEL_VISIBLE_CLASS);
|
|
501
|
-
this.player_.addClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_5__.SHOPPABLE_PANEL_HIDDEN_CLASS);
|
|
502
|
-
this.player_.addClass(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_5__.SHOPPABLE_PRODUCTS_OVERLAY_CLASS);
|
|
503
|
-
// Wait for the time update and show the tooltips
|
|
504
|
-
this.player_.one('seeked', () => this.player_.trigger('showProductsOverlay'));
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
// pause - true (default), false, or number of seconds
|
|
509
|
-
if (target.dataset.pause !== 'false') {
|
|
510
|
-
this.player_.pause();
|
|
511
|
-
if ((0,utils_time__WEBPACK_IMPORTED_MODULE_2__.parseTime)(target.dataset.pause)) {
|
|
512
|
-
setTimeout(() => {
|
|
513
|
-
this.player_.play();
|
|
514
|
-
}, (0,utils_time__WEBPACK_IMPORTED_MODULE_2__.parseTime)(target.dataset.pause) * 1000);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
});
|
|
519
|
-
shoppablePanelItem.on('mouseover', e => {
|
|
520
|
-
let target = e.currentTarget || e.target;
|
|
521
|
-
let evName = this.player_.ended() ? 'productHoverPost' : 'productHover';
|
|
522
|
-
this.player_.trigger(evName, {
|
|
523
|
-
productId: target.dataset.productId,
|
|
524
|
-
productName: target.dataset.productName
|
|
525
|
-
});
|
|
526
|
-
});
|
|
527
|
-
if (typeof item.conf.startTime !== 'undefined' && typeof item.conf.endTime !== 'undefined') {
|
|
528
|
-
this.player_.on(_utils_consts__WEBPACK_IMPORTED_MODULE_6__.PLAYER_EVENT.TIME_UPDATE, () => {
|
|
529
|
-
const time = this.player_.currentTime();
|
|
530
|
-
if (time >= item.conf.startTime && time < item.conf.endTime) {
|
|
531
|
-
shoppablePanelItem.el_.classList.add('active');
|
|
532
|
-
throttledScrollToActiveItem();
|
|
533
|
-
} else if (shoppablePanelItem.el_.classList.contains('active')) {
|
|
534
|
-
shoppablePanelItem.el_.classList.remove('active');
|
|
535
|
-
}
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
this.addChild(shoppablePanelItem);
|
|
539
|
-
});
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
video_js__WEBPACK_IMPORTED_MODULE_0___default().registerComponent('shoppablePanel', ShoppablePanel);
|
|
543
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ShoppablePanel);
|
|
544
|
-
|
|
545
|
-
/***/ }),
|
|
546
|
-
|
|
547
|
-
/***/ "./components/shoppable-bar/shoppable-post-widget.js":
|
|
548
|
-
/*!***********************************************************!*\
|
|
549
|
-
!*** ./components/shoppable-bar/shoppable-post-widget.js ***!
|
|
550
|
-
\***********************************************************/
|
|
551
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
552
|
-
|
|
553
|
-
__webpack_require__.r(__webpack_exports__);
|
|
554
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
555
|
-
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
556
|
-
/* harmony export */ });
|
|
557
|
-
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! video.js */ "../node_modules/video.js/dist/alt/video.core-exposed.js");
|
|
558
|
-
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(video_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
559
|
-
/* harmony import */ var _panel_shoppable_panel_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./panel/shoppable-panel.js */ "./components/shoppable-bar/panel/shoppable-panel.js");
|
|
560
|
-
/* harmony import */ var _shoppable_widget_const__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./shoppable-widget.const */ "./components/shoppable-bar/shoppable-widget.const.js");
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
const dom = (video_js__WEBPACK_IMPORTED_MODULE_0___default().dom) || (video_js__WEBPACK_IMPORTED_MODULE_0___default());
|
|
565
|
-
class ShoppablePostWidget {
|
|
566
|
-
constructor(player) {
|
|
567
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
568
|
-
this.options_ = {
|
|
569
|
-
...options,
|
|
570
|
-
postPlay: true
|
|
571
|
-
};
|
|
572
|
-
this.player_ = player;
|
|
573
|
-
this.render();
|
|
574
|
-
|
|
575
|
-
// Handle drag-to-scroll
|
|
576
|
-
this.handleDragToScroll();
|
|
577
|
-
this.dispose = () => {
|
|
578
|
-
this.layout_.dispose();
|
|
579
|
-
};
|
|
580
|
-
}
|
|
581
|
-
handleDragToScroll() {
|
|
582
|
-
const postModal = this.player_.postModal.el_;
|
|
583
|
-
const slider = postModal.querySelector(`.${_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_2__.CLD_SPBL_PANEL_CLASS}`);
|
|
584
|
-
let isDown = false;
|
|
585
|
-
let startX = 0;
|
|
586
|
-
let scrollLeft = 0;
|
|
587
|
-
slider.addEventListener('mousedown', e => {
|
|
588
|
-
isDown = true;
|
|
589
|
-
startX = e.pageX - slider.offsetLeft;
|
|
590
|
-
scrollLeft = slider.scrollLeft;
|
|
591
|
-
});
|
|
592
|
-
document.addEventListener('mouseup', e => {
|
|
593
|
-
isDown = false;
|
|
594
|
-
setTimeout(() => {
|
|
595
|
-
slider.classList.remove('dragged');
|
|
596
|
-
}, 300);
|
|
597
|
-
const x = e.pageX - slider.offsetLeft;
|
|
598
|
-
const walk = x - startX;
|
|
599
|
-
if (Math.abs(walk) > 5) {
|
|
600
|
-
e.preventDefault();
|
|
601
|
-
}
|
|
602
|
-
});
|
|
603
|
-
document.addEventListener('mousemove', e => {
|
|
604
|
-
if (!isDown) {
|
|
605
|
-
return;
|
|
606
|
-
}
|
|
607
|
-
e.preventDefault();
|
|
608
|
-
const x = e.pageX - slider.offsetLeft;
|
|
609
|
-
const walk = x - startX;
|
|
610
|
-
slider.scrollLeft = scrollLeft - walk;
|
|
611
|
-
if (Math.abs(walk) > 5 && !slider.classList.contains('dragged')) {
|
|
612
|
-
slider.classList.add('dragged');
|
|
613
|
-
}
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
render() {
|
|
617
|
-
this.player_.postModal = null;
|
|
618
|
-
const el = dom.createEl('div', {
|
|
619
|
-
className: 'cld-spbl-post-play'
|
|
620
|
-
});
|
|
621
|
-
const panel = new _panel_shoppable_panel_js__WEBPACK_IMPORTED_MODULE_1__["default"](this.player_, this.options_);
|
|
622
|
-
const title = dom.createEl('div', {
|
|
623
|
-
className: 'cld-spbl-post-title base-color-text'
|
|
624
|
-
}, {}, this.options_.bannerMsg || 'Shop the Video');
|
|
625
|
-
|
|
626
|
-
// Background - poster + blur effect
|
|
627
|
-
const bgSrc = this.player_.cloudinary.currentPoster();
|
|
628
|
-
bgSrc.transformation([bgSrc.transformation().toOptions ? bgSrc.transformation().toOptions() : {}, {
|
|
629
|
-
effect: 'blur:3000'
|
|
630
|
-
}]);
|
|
631
|
-
const panelBg = dom.createEl('div', {
|
|
632
|
-
className: 'cld-spbl-post-play-bg',
|
|
633
|
-
style: `background-image: url("${bgSrc.url()}")`
|
|
634
|
-
});
|
|
635
|
-
const replayBtn = dom.createEl('button', {
|
|
636
|
-
className: 'cld-spbl-replay-btn base-color-bg vjs-icon-replay',
|
|
637
|
-
onclick: () => {
|
|
638
|
-
this.player_.trigger('replay');
|
|
639
|
-
this.player_.postModal.close();
|
|
640
|
-
this.player_.play();
|
|
641
|
-
}
|
|
642
|
-
}, {}, 'Replay');
|
|
643
|
-
el.appendChild(panelBg);
|
|
644
|
-
el.appendChild(title);
|
|
645
|
-
el.appendChild(panel.el());
|
|
646
|
-
el.appendChild(replayBtn);
|
|
647
|
-
this.player_.postModal = this.player_.createModal(el, {
|
|
648
|
-
name: 'postModal',
|
|
649
|
-
uncloseable: true
|
|
650
|
-
});
|
|
651
|
-
this.player_.addClass('cld-spbl-post-modal');
|
|
652
|
-
this.player_.postModal.on('beforemodalclose', () => {
|
|
653
|
-
this.player_.removeClass('cld-spbl-post-modal');
|
|
654
|
-
});
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ShoppablePostWidget);
|
|
658
|
-
|
|
659
|
-
/***/ }),
|
|
660
|
-
|
|
661
|
-
/***/ "./components/shoppable-bar/shoppable-widget.const.js":
|
|
662
|
-
/*!************************************************************!*\
|
|
663
|
-
!*** ./components/shoppable-bar/shoppable-widget.const.js ***!
|
|
664
|
-
\************************************************************/
|
|
665
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
666
|
-
|
|
667
|
-
__webpack_require__.r(__webpack_exports__);
|
|
668
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
669
|
-
/* harmony export */ CLD_SPBL_IMAGE: () => (/* binding */ CLD_SPBL_IMAGE),
|
|
670
|
-
/* harmony export */ CLD_SPBL_INNER_BAR: () => (/* binding */ CLD_SPBL_INNER_BAR),
|
|
671
|
-
/* harmony export */ CLD_SPBL_ITEM: () => (/* binding */ CLD_SPBL_ITEM),
|
|
672
|
-
/* harmony export */ CLD_SPBL_PANEL_CLASS: () => (/* binding */ CLD_SPBL_PANEL_CLASS),
|
|
673
|
-
/* harmony export */ CLD_SPBL_TOGGLE_CLASS: () => (/* binding */ CLD_SPBL_TOGGLE_CLASS),
|
|
674
|
-
/* harmony export */ CLD_SPBL_TOGGLE_CUSTOM_ICON_CLASS: () => (/* binding */ CLD_SPBL_TOGGLE_CUSTOM_ICON_CLASS),
|
|
675
|
-
/* harmony export */ CLD_SPBL_TOGGLE_ICON_CLASS: () => (/* binding */ CLD_SPBL_TOGGLE_ICON_CLASS),
|
|
676
|
-
/* harmony export */ CLOSE_ICON_CLASS: () => (/* binding */ CLOSE_ICON_CLASS),
|
|
677
|
-
/* harmony export */ ICON_CART_CLASS: () => (/* binding */ ICON_CART_CLASS),
|
|
678
|
-
/* harmony export */ SHOPPABLE_ANIMATION_CLASS: () => (/* binding */ SHOPPABLE_ANIMATION_CLASS),
|
|
679
|
-
/* harmony export */ SHOPPABLE_CLICK_ACTIONS: () => (/* binding */ SHOPPABLE_CLICK_ACTIONS),
|
|
680
|
-
/* harmony export */ SHOPPABLE_HOVER_ACTIONS: () => (/* binding */ SHOPPABLE_HOVER_ACTIONS),
|
|
681
|
-
/* harmony export */ SHOPPABLE_PANEL_HIDDEN_CLASS: () => (/* binding */ SHOPPABLE_PANEL_HIDDEN_CLASS),
|
|
682
|
-
/* harmony export */ SHOPPABLE_PANEL_VISIBLE_CLASS: () => (/* binding */ SHOPPABLE_PANEL_VISIBLE_CLASS),
|
|
683
|
-
/* harmony export */ SHOPPABLE_PRODUCTS_OVERLAY_CLASS: () => (/* binding */ SHOPPABLE_PRODUCTS_OVERLAY_CLASS),
|
|
684
|
-
/* harmony export */ SHOPPABLE_WIDGET_OPTIONS_DEFAULTS: () => (/* binding */ SHOPPABLE_WIDGET_OPTIONS_DEFAULTS)
|
|
685
|
-
/* harmony export */ });
|
|
686
|
-
const SHOPPABLE_WIDGET_OPTIONS_DEFAULTS = {
|
|
687
|
-
location: 'right',
|
|
688
|
-
toggleIcon: '',
|
|
689
|
-
width: '20%',
|
|
690
|
-
startState: 'openOnPlay',
|
|
691
|
-
autoClose: 2,
|
|
692
|
-
transformation: {
|
|
693
|
-
quality: 'auto',
|
|
694
|
-
width: 'auto',
|
|
695
|
-
fetch_format: 'auto',
|
|
696
|
-
crop: 'scale'
|
|
697
|
-
},
|
|
698
|
-
products: [],
|
|
699
|
-
showPostPlayOverlay: false
|
|
700
|
-
};
|
|
701
|
-
const SHOPPABLE_CLICK_ACTIONS = {
|
|
702
|
-
GO_TO: 'goto',
|
|
703
|
-
SEEk: 'seek'
|
|
704
|
-
};
|
|
705
|
-
const SHOPPABLE_HOVER_ACTIONS = {
|
|
706
|
-
OVERLAY: 'overlay'
|
|
707
|
-
};
|
|
708
|
-
const SHOPPABLE_PANEL_VISIBLE_CLASS = 'shoppable-panel-visible';
|
|
709
|
-
const SHOPPABLE_PANEL_HIDDEN_CLASS = 'shoppable-panel-hidden';
|
|
710
|
-
const SHOPPABLE_PRODUCTS_OVERLAY_CLASS = 'shoppable-products-overlay';
|
|
711
|
-
const CLD_SPBL_PANEL_CLASS = 'cld-spbl-panel';
|
|
712
|
-
const CLD_SPBL_TOGGLE_CLASS = 'cld-spbl-toggle';
|
|
713
|
-
const CLD_SPBL_TOGGLE_ICON_CLASS = 'cld-spbl-toggle-icon';
|
|
714
|
-
const CLD_SPBL_INNER_BAR = 'cld-spbl-bar-inner';
|
|
715
|
-
const CLD_SPBL_TOGGLE_CUSTOM_ICON_CLASS = 'cld-spbl-toggle-custom-icon';
|
|
716
|
-
const ICON_CART_CLASS = 'vjs-icon-cart';
|
|
717
|
-
const CLOSE_ICON_CLASS = 'vjs-icon-close';
|
|
718
|
-
const SHOPPABLE_ANIMATION_CLASS = 'animate';
|
|
719
|
-
const CLD_SPBL_ITEM = 'cld-spbl-item';
|
|
720
|
-
const CLD_SPBL_IMAGE = 'cld-spbl-img';
|
|
721
|
-
|
|
722
|
-
/***/ }),
|
|
723
|
-
|
|
724
|
-
/***/ "./components/shoppable-bar/shoppable-widget.js":
|
|
725
|
-
/*!******************************************************!*\
|
|
726
|
-
!*** ./components/shoppable-bar/shoppable-widget.js ***!
|
|
727
|
-
\******************************************************/
|
|
728
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
729
|
-
|
|
730
|
-
__webpack_require__.r(__webpack_exports__);
|
|
731
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
732
|
-
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
733
|
-
/* harmony export */ });
|
|
734
|
-
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! video.js */ "../node_modules/video.js/dist/alt/video.core-exposed.js");
|
|
735
|
-
/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(video_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
736
|
-
/* harmony import */ var _layout_bar_layout__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./layout/bar-layout */ "./components/shoppable-bar/layout/bar-layout.js");
|
|
737
|
-
/* harmony import */ var _shoppable_post_widget__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./shoppable-post-widget */ "./components/shoppable-bar/shoppable-post-widget.js");
|
|
738
|
-
/* harmony import */ var _shoppable_widget_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./shoppable-widget.scss */ "./components/shoppable-bar/shoppable-widget.scss");
|
|
739
|
-
/* harmony import */ var _shoppable_widget_const__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./shoppable-widget.const */ "./components/shoppable-bar/shoppable-widget.const.js");
|
|
740
|
-
/* harmony import */ var _utils_consts__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils/consts */ "./utils/consts.js");
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
class ShoppableWidget {
|
|
748
|
-
constructor(player) {
|
|
749
|
-
let initOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
750
|
-
this.options_ = video_js__WEBPACK_IMPORTED_MODULE_0___default().obj.merge(_shoppable_widget_const__WEBPACK_IMPORTED_MODULE_4__.SHOPPABLE_WIDGET_OPTIONS_DEFAULTS, initOptions);
|
|
751
|
-
this.player_ = player;
|
|
752
|
-
if (this.options_.showPostPlayOverlay) {
|
|
753
|
-
this.player_.on(_utils_consts__WEBPACK_IMPORTED_MODULE_5__.PLAYER_EVENT.ENDED, () => {
|
|
754
|
-
this.player_.addChild(new _shoppable_post_widget__WEBPACK_IMPORTED_MODULE_2__["default"](this.player_, this.options_));
|
|
755
|
-
});
|
|
756
|
-
}
|
|
757
|
-
const width = this.options_.width;
|
|
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
|
-
`);
|
|
772
|
-
this._setListeners();
|
|
773
|
-
}
|
|
774
|
-
_setListeners() {
|
|
775
|
-
const resizeHandler = this._resizeHandler.bind(this);
|
|
776
|
-
this.player_.on(_utils_consts__WEBPACK_IMPORTED_MODULE_5__.PLAYER_EVENT.RESIZE, resizeHandler);
|
|
777
|
-
window.addEventListener('resize', resizeHandler);
|
|
778
|
-
this.dispose = () => {
|
|
779
|
-
this.player_.off(_utils_consts__WEBPACK_IMPORTED_MODULE_5__.PLAYER_EVENT.RESIZE, resizeHandler);
|
|
780
|
-
window.removeEventListener('resize', resizeHandler);
|
|
781
|
-
this.layout_.dispose();
|
|
782
|
-
};
|
|
783
|
-
}
|
|
784
|
-
_injectCSS(css) {
|
|
785
|
-
const style = document.createElement('style');
|
|
786
|
-
style.innerHTML = css;
|
|
787
|
-
this.player_.el_.appendChild(style);
|
|
788
|
-
}
|
|
789
|
-
_resizeHandler() {
|
|
790
|
-
const shoppableBarBreakpoints = [['sm', 0, 80], ['md', 81, 110], ['lg', 111, 170]];
|
|
791
|
-
const shoppableBarWidth = parseFloat(this.options_.width) / 100.0 * this.player_.el_.clientWidth;
|
|
792
|
-
let inRange = false;
|
|
793
|
-
if (shoppableBarWidth) {
|
|
794
|
-
for (const [name, min, max] of shoppableBarBreakpoints) {
|
|
795
|
-
if (shoppableBarWidth > min && shoppableBarWidth <= max) {
|
|
796
|
-
this.layout_.contentWrpEl_.setAttribute('size', name);
|
|
797
|
-
inRange = name;
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
if (!inRange) {
|
|
801
|
-
this.layout_.contentWrpEl_.removeAttribute('size');
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
init() {
|
|
806
|
-
this.render();
|
|
807
|
-
}
|
|
808
|
-
render() {
|
|
809
|
-
this.layout_ = new _layout_bar_layout__WEBPACK_IMPORTED_MODULE_1__["default"](this.player_, this.options_);
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ShoppableWidget);
|
|
813
|
-
|
|
814
|
-
/***/ }),
|
|
815
|
-
|
|
816
|
-
/***/ "./utils/time.js":
|
|
817
|
-
/*!***********************!*\
|
|
818
|
-
!*** ./utils/time.js ***!
|
|
819
|
-
\***********************/
|
|
820
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
821
|
-
|
|
822
|
-
__webpack_require__.r(__webpack_exports__);
|
|
823
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
824
|
-
/* harmony export */ parseTime: () => (/* binding */ parseTime)
|
|
825
|
-
/* harmony export */ });
|
|
826
|
-
// Convert time string i.e. '2:40' to seconds number (160)
|
|
827
|
-
// Also allows h:m:s format and mm:ss, m:s etc.
|
|
828
|
-
const parseTime = function (hms) {
|
|
829
|
-
const [seconds, minutes, hours] = hms.split(':').reverse();
|
|
830
|
-
let sum = null;
|
|
831
|
-
if (!isNaN(seconds)) {
|
|
832
|
-
sum = (+hours || 0) * 60 * 60 + (+minutes || 0) * 60 + +seconds;
|
|
833
|
-
}
|
|
834
|
-
return sum;
|
|
835
|
-
};
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
/***/ }),
|
|
839
|
-
|
|
840
|
-
/***/ "./components/shoppable-bar/shoppable-widget.scss":
|
|
841
|
-
/*!********************************************************!*\
|
|
842
|
-
!*** ./components/shoppable-bar/shoppable-widget.scss ***!
|
|
843
|
-
\********************************************************/
|
|
844
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
845
|
-
|
|
846
|
-
__webpack_require__.r(__webpack_exports__);
|
|
847
|
-
// extracted by mini-css-extract-plugin
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
/***/ })
|
|
851
|
-
|
|
852
|
-
}]);
|
|
853
|
-
//# sourceMappingURL=shoppable.light.js.map
|