Skip to content

Commit

Permalink
Merge branch 'master' into devops-deployment
Browse files Browse the repository at this point in the history
* master:
  SUP-37601: Social Highlights - Shares analytics not working on V7 (#25)
  • Loading branch information
giladna committed Jun 19, 2023
2 parents bdd427a + 726fd2d commit 54d9d20
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/share-overlay/share-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/
import {ui} from '@playkit-js/kaltura-player-js';
import shareStyle from './style.scss';
import {FakeEvent} from '@playkit-js/playkit-js';
import {ShareEvent} from '../../event';

const {preact, preacti18n, Components, Event, Utils, style, redux, Reducers, preactHooks} = ui;
const {h, Component} = preact;
Expand Down Expand Up @@ -61,6 +63,7 @@ const ShareButton = (props: Object): React$Element<any> => {
window.open(href, '_blank', 'width=580,height=580');
break;
}
props.player.dispatchEvent(new FakeEvent(ShareEvent.SHARE_NETWORK, {shareNetworkName: buttonType}));
};

return (
Expand Down Expand Up @@ -411,6 +414,7 @@ class ShareOverlay extends Component {
config={shareButtonConfig}
addAccessibleChild={this.props.addAccessibleChild}
updateShareOverlay={this._updateOverlay}
player={this.props.player}
/>
);
});
Expand Down
2 changes: 2 additions & 0 deletions src/event/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import {ShareEvent} from './share-event';
export {ShareEvent};
15 changes: 15 additions & 0 deletions src/event/share-event.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Share plugin event types.
*/
const ShareEvent = {
/**
* Fired when the user clicks on share icon.
*/
SHARE_CLICKED: 'share_clicked',
/**
* Fired when the user clicks on specific social network.
*/
SHARE_NETWORK: 'share_network'
};

export {ShareEvent};
2 changes: 2 additions & 0 deletions src/share.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {KalturaPlayer, BasePlugin, core, ui} from '@playkit-js/kaltura-player-js
import {ICON_PATH, Share as ShareComponent} from './components/share/share';
import {defaultShareOptionsConfig} from './default-share-options-config';
import {ShareButton} from './components/plugin-button/plugin-button';
import {ShareEvent} from './event';
const {ReservedPresetNames} = ui;
const {Utils} = core;

Expand Down Expand Up @@ -78,6 +79,7 @@ class Share extends BasePlugin {
this.player.pause();
this._wasPlayed = true;
}
this.dispatchEvent(ShareEvent.SHARE_CLICKED);
if (this.config.useNative && navigator.share) {
const videoDesc = this._getVideoDesc();
navigator
Expand Down
1 change: 1 addition & 0 deletions types/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {ShareEvent} from '../src/event/share-event';

0 comments on commit 54d9d20

Please sign in to comment.