diff --git a/package.json b/package.json index 81b67e9..de2c789 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ }, "devDependencies": { "@playkit-js/kaltura-player-js": "3.17.0", + "@playkit-js/ui-managers": "^1.4.2", "@types/node": "^14.11.2", "@typescript-eslint/eslint-plugin": "^5.25.0", "@typescript-eslint/parser": "^5.25.0", @@ -37,11 +38,11 @@ "css-loader": "^6.7.1", "cypress": "^13.2.0", "eslint": "^7.32.0", - "eslint-plugin-mocha": "^10.1.0", "eslint-config-preact": "^1.3.0", "eslint-config-prettier": "^8.8.0", "eslint-plugin-cypress": "^2.13.3", "eslint-plugin-jsdoc": "^41.1.2", + "eslint-plugin-mocha": "^10.1.0", "eslint-plugin-prettier": "^4.2.1", "prettier": "^2.6.2", "rimraf": "^5.0.5", @@ -66,6 +67,9 @@ "@playkit-js/common": "1.5.2-canary.0-56dd9d9" }, "kaltura": { - "name": "call-to-action" + "name": "call-to-action", + "dependencies": { + "playkit-ui-managers": "1.4.2" + } } } diff --git a/src/call-to-action-manager.tsx b/src/call-to-action-manager.tsx index 522fdc0..9232393 100644 --- a/src/call-to-action-manager.tsx +++ b/src/call-to-action-manager.tsx @@ -1,8 +1,7 @@ import {KalturaPlayer, ui} from '@playkit-js/kaltura-player-js'; const {PLAYER_SIZE} = ui.Components; -import {FloatingManager} from '@playkit-js/common/dist/ui-common/floating-manager'; -import {FloatingItem, FloatingPositions, FloatingUIModes} from '@playkit-js/common/dist/ui-common'; +import {FloatingItem, FloatingManager} from '@playkit-js/ui-managers'; import {MessageData} from './types'; import {CallToActionOverlay, CallToActionPopup} from './components'; @@ -28,8 +27,8 @@ class CallToActionManager { private showPopup({title, description, buttons}: MessageData) { this.popupInstance = this.floatingManager.add({ label: 'Call To Action Popup', - mode: FloatingUIModes.Immediate, - position: FloatingPositions.InteractiveArea, + mode: 'Immediate', + position: 'InteractiveArea', renderContent: () => this.hidePopup()} /> }); } diff --git a/src/call-to-action.tsx b/src/call-to-action.tsx index 450c742..e33490d 100644 --- a/src/call-to-action.tsx +++ b/src/call-to-action.tsx @@ -1,6 +1,5 @@ import {BasePlugin, KalturaPlayer} from '@playkit-js/kaltura-player-js'; -import {ContribServices} from '@playkit-js/common/dist/ui-common'; - +import {FloatingManager} from '@playkit-js/ui-managers'; import {CallToActionConfig, MessageData} from './types'; import {CallToActionManager} from './call-to-action-manager'; @@ -15,24 +14,21 @@ class CallToAction extends BasePlugin { private callToActionManager: CallToActionManager; private messages: (MessageData & MessageVisibilityData)[] = []; - private contribServices: ContribServices; - private messagesFiltered = false; constructor(name: string, player: KalturaPlayer, config: CallToActionConfig) { super(name, player, config); - this.contribServices = ContribServices.get({kalturaPlayer: this.player}); - this.callToActionManager = new CallToActionManager(player, this.contribServices.floatingManager); - } - - getUIComponents(): any[] { - return this.contribServices.register(); + this.callToActionManager = new CallToActionManager(player, this.floatingManager); } static isValid() { return true; } + private get floatingManager(): FloatingManager { + return (this.player.getService('floatingManager') as FloatingManager) || {}; + } + protected loadMedia(): void { if (!this.messagesFiltered) { this.filterMessages(); diff --git a/yarn.lock b/yarn.lock index ac9e3ce..5318291 100644 --- a/yarn.lock +++ b/yarn.lock @@ -444,6 +444,15 @@ classnames "^2.3.2" linkify-it "^4.0.1" +"@playkit-js/common@^1.2.10": + version "1.5.1" + resolved "https://registry.yarnpkg.com/@playkit-js/common/-/common-1.5.1.tgz#14edd4f01ecd16ea22016bdb68f7dd3604eb39a0" + integrity sha512-YRJfhxZihOggy9tXOL1wm/pYChV+b+NuD9f7Y/JjVt5KIjVgeEPvPhSWSyKRv3LxbBJ4BcwYXtMe8Tg/gUmq3A== + dependencies: + "@playkit-js/playkit-js-ui" "^0.77.10" + classnames "^2.3.2" + linkify-it "^4.0.1" + "@playkit-js/kaltura-player-js@3.17.0": version "3.17.0" resolved "https://registry.yarnpkg.com/@playkit-js/kaltura-player-js/-/kaltura-player-js-3.17.0.tgz#95f6a2f55d42dbc60caa71688d32b7492e4ecfe4" @@ -503,6 +512,13 @@ js-logger "^1.6.0" ua-parser-js "1.0.2" +"@playkit-js/ui-managers@^1.4.2": + version "1.4.2" + resolved "https://registry.yarnpkg.com/@playkit-js/ui-managers/-/ui-managers-1.4.2.tgz#ae81c77dabcf84bb7de409570c6eb31a15551df3" + integrity sha512-MHdN7tgMNfuVpFTkKzlMqGmBzIOyGyoSqOJ3X3ePFZUz8AunmYcFIllX9Y+x6GVtUodczqMbXJxmyCScKNjq3g== + dependencies: + "@playkit-js/common" "^1.2.10" + "@sindresorhus/is@^0.7.0": version "0.7.0" resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd"