Skip to content

Commit

Permalink
use floating manager from ui managers
Browse files Browse the repository at this point in the history
  • Loading branch information
SivanA-Kaltura committed Dec 10, 2023
1 parent 6ab8996 commit 3de735b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 16 deletions.
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,19 @@
},
"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",
"conventional-github-releaser": "3.1.3",
"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",
Expand All @@ -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"
}
}
}
7 changes: 3 additions & 4 deletions src/call-to-action-manager.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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: () => <CallToActionPopup title={title} description={description} buttons={buttons} onClose={() => this.hidePopup()} />
});
}
Expand Down
16 changes: 6 additions & 10 deletions src/call-to-action.tsx
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -15,24 +14,21 @@ class CallToAction extends BasePlugin<CallToActionConfig> {
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();
Expand Down
16 changes: 16 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]":
version "3.17.0"
resolved "https://registry.yarnpkg.com/@playkit-js/kaltura-player-js/-/kaltura-player-js-3.17.0.tgz#95f6a2f55d42dbc60caa71688d32b7492e4ecfe4"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 3de735b

Please sign in to comment.