Skip to content

Commit

Permalink
Merge pull request #519 from cloudinary/ME-14382-lazy-shoppable
Browse files Browse the repository at this point in the history
ME-14382-lazy-shoppable-plugin
  • Loading branch information
tsi authored Jan 23, 2024
2 parents 1462633 + 15472c1 commit 1ec7f69
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 19 deletions.
2 changes: 0 additions & 2 deletions src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import JumpForwardButton from './jumpButtons/jump-10-plus';
import JumpBackButton from './jumpButtons/jump-10-minus';
import LogoButton from './logoButton/logo-button';
import ProgressControlEventsBlocker from './progress-control-events-blocker/progress-control-events-blocker';
import ShoppablePanel from './shoppable-bar/panel/shoppable-panel';
import TitleBar from './title-bar/title-bar';

export {
JumpForwardButton,
JumpBackButton,
LogoButton,
ProgressControlEventsBlocker,
ShoppablePanel,
TitleBar
};
11 changes: 7 additions & 4 deletions src/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'videojs-per-source-behaviors';
// #if (!process.env.WEBPACK_BUILD_LIGHT)
import dashPlugin from './dash';
import imaPlugin from './ima';
import interactive from './interactive-plugin';
import './videojs-http-source-selector/plugin';
// #endif

Expand All @@ -21,14 +20,15 @@ import vttThumbnails from './vtt-thumbnails';

// Lazy loaded plugins
import playlist from './playlist';
import shoppable from './shoppable-plugin';
import styledTextTracks from './styled-text-tracks';

const plugins = {
// #if (!process.env.WEBPACK_BUILD_LIGHT)
dashPlugin,
interactive,
imaPlugin,
// #endif

aiHighlightsGraph,
analytics,
autoplayOnScroll,
Expand All @@ -39,9 +39,12 @@ const plugins = {
contextMenu,
floatingPlayer,
pacedTranscript,
vttThumbnails,

// Lazy loaded plugins
playlist,
styledTextTracks,
vttThumbnails
shoppable,
styledTextTracks
};

export default plugins;
10 changes: 0 additions & 10 deletions src/plugins/interactive-plugin/index.js

This file was deleted.

6 changes: 6 additions & 0 deletions src/plugins/shoppable-plugin/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default async function lazyShoppablePlugin(player, options) {

const { default: ShoppableWidget } = await import(/* webpackChunkName: "shoppable" */ '../../components/shoppable-bar/shoppable-widget');
new ShoppableWidget(player, options.shoppable).init();

}
5 changes: 2 additions & 3 deletions src/video-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,8 @@ class VideoPlayer extends Utils.mixin(Eventable) {
return this.videojs.cloudinary.source(publicId, options);
}

// Interactive plugin - available in full (not light) build only
if (this.videojs.interactive) {
this.videojs.interactive(this.videojs, options);
if (options.shoppable && this.videojs.shoppable) {
this.videojs.shoppable(this.videojs, options);
}

if (VideoPlayer.allowUsageReport()) {
Expand Down

0 comments on commit 1ec7f69

Please sign in to comment.