@uncinc/uncinc-react-kitchen-sink 2.16.14 → 2.17.0

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.
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
+ import { type CookieCompliancePopupProps } from './types';
2
3
  import './style.scss';
3
- import { CookieCompliancePopupProps } from './types';
4
4
  export declare const COOKIE_CONSENT_CATEGORIES = "cookie_consent_categories";
5
5
  export declare const COOKIE_CONSENT_STATE = "cookie_consent_state";
6
6
  export declare const DEFAULT_COOKIE_EXPIRATION_DAYS = 365;
@@ -10,22 +10,28 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
10
10
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
11
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
- import React, { useEffect, useState } from 'react';
13
+ import React, { useCallback, useEffect, useState } from 'react';
14
14
  import Cookies from 'js-cookie';
15
15
  import classNames from 'classnames';
16
16
  import { useTranslation } from 'react-i18next';
17
+ import useCookieStore from '../../hooks/useCookieStore';
17
18
  import Accordion from '../Accordion';
18
19
  import AccordionItemVariant from '../Accordion/AccordionItemVariant';
19
20
  import Button from '../Button';
20
21
  import Container from '../Layout/Container';
21
22
  import Checkbox from './Checkbox';
22
- import './style.scss';
23
23
  import { LocalConsentStatus, AvailableConsentPermissions } from './types';
24
- import useCookieStore from '../../hooks/useCookieStore';
24
+ import './style.scss';
25
25
  export var COOKIE_CONSENT_CATEGORIES = 'cookie_consent_categories';
26
26
  export var COOKIE_CONSENT_STATE = 'cookie_consent_state';
27
27
  export var DEFAULT_COOKIE_EXPIRATION_DAYS = 365;
28
28
  export var CONSENT_UPDATE_EVENT = 'consentUpdate';
29
+ var categoryDefaultValues = {
30
+ necessary: true,
31
+ preferences: false,
32
+ statistics: false,
33
+ marketing: false
34
+ };
29
35
  var CookieCompliancePopup = function CookieCompliancePopup(props) {
30
36
  var _useTranslation = useTranslation(),
31
37
  t = _useTranslation.t;
@@ -90,12 +96,7 @@ var CookieCompliancePopup = function CookieCompliancePopup(props) {
90
96
  _props$cookieDomain = props.cookieDomain,
91
97
  cookieDomain = _props$cookieDomain === void 0 ? null : _props$cookieDomain,
92
98
  _props$defaultValues = props.defaultValues,
93
- defaultValues = _props$defaultValues === void 0 ? {
94
- necessary: true,
95
- preferences: false,
96
- statistics: false,
97
- marketing: false
98
- } : _props$defaultValues,
99
+ defaultValues = _props$defaultValues === void 0 ? categoryDefaultValues : _props$defaultValues,
99
100
  _props$manualHeader = props.manualHeader,
100
101
  manualHeader = _props$manualHeader === void 0 ? '' : _props$manualHeader,
101
102
  _props$manualButtonCl = props.manualButtonClassname,
@@ -187,34 +188,33 @@ var CookieCompliancePopup = function CookieCompliancePopup(props) {
187
188
  setManualChoiceVisible(true);
188
189
  };
189
190
 
190
- // Build an object of passed consent, send that to google via "update"
191
- // Set the cookie containing the consent categories and version
192
- var handleGoogleConsent = function handleGoogleConsent() {
193
- var selectedConsent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
194
- var selectedCategories = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
195
- var consentEventObject = {};
196
- Object.values(AvailableConsentPermissions).forEach(function (consentOption) {
197
- consentEventObject[consentOption] = selectedConsent.indexOf(consentOption) > -1 ? 'granted' : 'denied';
198
- });
199
- window.gtag('consent', 'update', consentEventObject);
200
- window.gtag('event', CONSENT_UPDATE_EVENT);
201
- Cookies.set(COOKIE_CONSENT_CATEGORIES, JSON.stringify({
202
- categories: selectedCategories,
203
- consent: consentEventObject
204
- }), {
205
- expires: cookieOptions.days,
206
- domain: cookieDomain
207
- });
208
- setDidConsent(JSON.stringify({
209
- status: LocalConsentStatus.STATUS_ACCEPTED,
210
- version: version
211
- }), cookieOptions);
212
- setAnsweredInCurrentSession(true);
213
- };
214
-
215
191
  // On agree clicked, send consent for categories to Google
216
192
  // Update cookie and fire agree callback
217
- var onInternalAgree = function onInternalAgree(choices) {
193
+ var onInternalAgree = useCallback(function (choices) {
194
+ // Build an object of passed consent, send that to google via "update"
195
+ // Set the cookie containing the consent categories and version
196
+ var handleGoogleConsent = function handleGoogleConsent() {
197
+ var selectedConsent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
198
+ var selectedCategories = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
199
+ var consentEventObject = {};
200
+ Object.values(AvailableConsentPermissions).forEach(function (consentOption) {
201
+ consentEventObject[consentOption] = selectedConsent.indexOf(consentOption) > -1 ? 'granted' : 'denied';
202
+ });
203
+ window.gtag('consent', 'update', consentEventObject);
204
+ window.gtag('event', CONSENT_UPDATE_EVENT);
205
+ Cookies.set(COOKIE_CONSENT_CATEGORIES, JSON.stringify({
206
+ categories: selectedCategories,
207
+ consent: consentEventObject
208
+ }), {
209
+ expires: cookieOptions.days,
210
+ domain: cookieDomain
211
+ });
212
+ setDidConsent(JSON.stringify({
213
+ status: LocalConsentStatus.STATUS_ACCEPTED,
214
+ version: version
215
+ }), cookieOptions);
216
+ setAnsweredInCurrentSession(true);
217
+ };
218
218
  var selectedCategories = Object.keys(choices).filter(function (key) {
219
219
  return choices[key];
220
220
  });
@@ -229,10 +229,10 @@ var CookieCompliancePopup = function CookieCompliancePopup(props) {
229
229
  selectedCategories: selectedCategories,
230
230
  consent: selectedConsent
231
231
  });
232
- };
232
+ }, [cookieDomain, cookieLevels, cookieOptions, onAgree, setDidConsent, version]);
233
233
 
234
234
  // Function for accepting al categories at once.
235
- var onConsentAll = function onConsentAll() {
235
+ var onConsentAll = useCallback(function () {
236
236
  var allCategoriesSelected = categories.reduce(function (prev, category) {
237
237
  var newPartialState = prev;
238
238
  newPartialState[category] = true;
@@ -240,19 +240,17 @@ var CookieCompliancePopup = function CookieCompliancePopup(props) {
240
240
  }, {});
241
241
  setChoicesSelected(allCategoriesSelected);
242
242
  onInternalAgree(allCategoriesSelected);
243
- };
243
+ }, [categories, onInternalAgree]);
244
+ var onConsentOnlyNecessary = useCallback(function () {
245
+ setChoicesSelected(defaultValues);
246
+ onInternalAgree(defaultValues);
247
+ }, [defaultValues, onInternalAgree]);
244
248
 
245
249
  // This function is fired when the accept button is pressed.
246
250
  // Also has eventual support for a false case.
247
- var onConsent = function onConsent(onlyNecessary) {
248
- return function () {
249
- if (onlyNecessary === true) {
250
- onInternalAgree(defaultValues);
251
- } else {
252
- onInternalAgree(choicesSelected);
253
- }
254
- };
255
- };
251
+ var onConsent = useCallback(function () {
252
+ onInternalAgree(choicesSelected);
253
+ }, [choicesSelected, onInternalAgree]);
256
254
 
257
255
  // This function sets the value of the checkmark in the form state.
258
256
  var handleChoiceState = function handleChoiceState(event) {
@@ -326,7 +324,7 @@ var CookieCompliancePopup = function CookieCompliancePopup(props) {
326
324
  id: "only-necessary-agree",
327
325
  className: "Button--cta",
328
326
  inverted: necessaryButtonInverted,
329
- onClick: onConsent(true)
327
+ onClick: onConsentOnlyNecessary
330
328
  }, onlyNecessaryText), /*#__PURE__*/React.createElement("button", {
331
329
  type: "button",
332
330
  className: "GoogleConsentCookieBanner__content__buttons__manual GoogleConsentCookieBanner__content__buttons__manual-agree ".concat(manualButtonClassname),
@@ -344,12 +342,12 @@ var CookieCompliancePopup = function CookieCompliancePopup(props) {
344
342
  }, /*#__PURE__*/React.createElement(Button, {
345
343
  className: "Button--cta",
346
344
  primary: true,
347
- onClick: onConsent(false)
345
+ onClick: onConsent
348
346
  }, acceptSelectionText), showAcceptOnlyNeededSelections && /*#__PURE__*/React.createElement(Button, {
349
347
  id: "only-necessary-agree-selections",
350
348
  className: "Button--cta",
351
349
  inverted: necessaryButtonInverted,
352
- onClick: onConsent(true)
350
+ onClick: onConsentOnlyNecessary
353
351
  }, onlyNecessaryText), /*#__PURE__*/React.createElement(Button, {
354
352
  className: "Button--cta",
355
353
  inverted: necessaryButtonInverted,
@@ -1,8 +1,4 @@
1
1
  import React from 'react';
2
- import 'videojs-vimeo-tech';
3
- import 'videojs-youtube';
4
2
  import { MediaPlayerProps } from './types';
5
- import 'video.js/dist/video-js.css';
6
- import './style.scss';
7
3
  declare const MediaPlayer: React.FC<MediaPlayerProps>;
8
4
  export default MediaPlayer;
@@ -1,153 +1,8 @@
1
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
5
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
7
- import React, { useEffect, useMemo } from 'react';
8
- import c from 'classnames';
9
- import { useVideoJS } from 'react-hook-videojs';
10
- import { useTranslation } from 'react-i18next';
11
- // VideoJS plugins:
12
- import 'videojs-vimeo-tech';
13
- import 'videojs-youtube';
14
- import 'video.js/dist/video-js.css';
15
- import './style.scss';
16
- var MediaPlayer = function MediaPlayer(_ref) {
17
- var src = _ref.src,
18
- type = _ref.type,
19
- controls = _ref.controls,
20
- posterUrl = _ref.posterUrl,
21
- customOptions = _ref.options,
22
- captions = _ref.captions,
23
- audioOnly = _ref.audioOnly,
24
- notSupportedMessage = _ref.notSupportedMessage,
25
- className = _ref.className,
26
- onPlay = _ref.onPlay,
27
- _ref$autoPlay = _ref.autoPlay,
28
- autoPlay = _ref$autoPlay === void 0 ? false : _ref$autoPlay,
29
- onPause = _ref.onPause,
30
- onEnded = _ref.onEnded,
31
- onSeeking = _ref.onSeeking,
32
- onVolumeChange = _ref.onVolumeChange,
33
- onFullscreenChange = _ref.onFullscreenChange,
34
- onError = _ref.onError;
35
- var _useTranslation = useTranslation(),
36
- t = _useTranslation.t;
37
- var classNames = c('MediaPlayer', 'video-js', 'vjs-default-skin', 'vjs-big-play-centered', className);
38
- var audioOnlyMode = useMemo(function () {
39
- return audioOnly || type.startsWith('audio');
40
- }, [type, audioOnly]);
41
- var controlBar = useMemo(function () {
42
- var videoJSControls = {
43
- play: 'playToggle',
44
- currentTime: 'currentTimeDisplay',
45
- timeDivider: 'timeDivider',
46
- duration: 'durationDisplay',
47
- seekbar: 'progressControl',
48
- captions: 'subsCapsButton',
49
- volume: 'volumePanel',
50
- fullscreen: 'fullscreenToggle'
51
- };
52
- var controlMapped = function controlMapped(control) {
53
- return {
54
- name: videoJSControls[control],
55
- className: "MediaPlayer__control MediaPlayer__control--".concat(control)
56
- };
57
- };
58
- if (controls === false || _typeof(controls) === 'object' && controls.length === 0) {
59
- return false;
60
- }
61
- if (_typeof(controls) === 'object' && controls.length > 0) {
62
- return {
63
- children: controls.map(controlMapped)
64
- };
65
- }
66
- var controlKeys = Object.keys(videoJSControls);
67
- return {
68
- children: controlKeys.map(controlMapped)
69
- };
70
- }, [controls]);
71
-
72
- // Can be overridden by the custom options prop.
73
- var defaultOptions = {
74
- controls: true,
75
- aspectRatio: '16:9',
76
- audioOnlyMode: audioOnlyMode,
77
- fluid: true,
78
- notSupportedMessage: notSupportedMessage || t('organisms.media_player.not_supported_message'),
79
- techOrder: ['html5', 'youtube', 'vimeo'],
80
- poster: posterUrl,
81
- controlBar: controlBar,
82
- autoplay: autoPlay,
83
- sources: [{
84
- src: src,
85
- type: type
86
- }]
87
- };
88
- var options = _objectSpread(_objectSpread({}, defaultOptions), customOptions);
89
- var videoJS = useVideoJS(options);
90
- var _ref2 = videoJS,
91
- Video = _ref2.Video,
92
- player = _ref2.player,
93
- ready = _ref2.ready;
94
-
95
- // Passing down the VideoJS events.
96
- useEffect(function () {
97
- if (ready) {
98
- if (autoPlay && onPlay) {
99
- player.one('play', function (event) {
100
- return onPlay(player, event);
101
- });
102
- } else if (!autoPlay && onPlay) {
103
- player.on('play', function (event) {
104
- return onPlay(player, event);
105
- });
106
- }
107
- if (onPause) {
108
- player.one('pause', function (event) {
109
- return onPause(player, event);
110
- });
111
- }
112
- if (onEnded) {
113
- player.one('ended', function (event) {
114
- return onEnded(player, event);
115
- });
116
- }
117
- if (onSeeking) {
118
- player.one('seeking', function (event) {
119
- return onSeeking(player, event);
120
- });
121
- }
122
- if (onVolumeChange) {
123
- player.one('volumechange', function (event) {
124
- return onVolumeChange(player, event);
125
- });
126
- }
127
- if (onFullscreenChange) {
128
- player.one('fullscreenchange', function (event) {
129
- return onFullscreenChange(player, event);
130
- });
131
- }
132
- if (onError) {
133
- player.one('error', function (event) {
134
- return onError(player, event);
135
- });
136
- }
137
- }
138
- // eslint-disable-next-line max-len
139
- }, [onEnded, onError, onFullscreenChange, onPause, onPlay, onSeeking, onVolumeChange, player, ready]);
140
- return /*#__PURE__*/React.createElement(Video, {
141
- className: classNames
142
- }, !audioOnlyMode && captions && captions.map(function (caption) {
143
- return /*#__PURE__*/React.createElement("track", {
144
- key: "caption:".concat(caption.language),
145
- kind: "captions",
146
- src: caption.src,
147
- srcLang: caption.language,
148
- label: caption.label || caption.language,
149
- default: caption.default
150
- });
151
- }));
1
+ import React, { lazy, Suspense } from 'react';
2
+ var MediaPlayerLazy = /*#__PURE__*/lazy(function () {
3
+ return import('./index.lazy');
4
+ });
5
+ var MediaPlayer = function MediaPlayer(props) {
6
+ return /*#__PURE__*/React.createElement(Suspense, null, /*#__PURE__*/React.createElement(MediaPlayerLazy, props));
152
7
  };
153
8
  export default MediaPlayer;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import 'videojs-vimeo-tech';
3
+ import 'videojs-youtube';
4
+ import { MediaPlayerProps } from './types';
5
+ import 'video.js/dist/video-js.css';
6
+ import './style.scss';
7
+ declare const MediaPlayer: React.FC<MediaPlayerProps>;
8
+ export default MediaPlayer;
@@ -0,0 +1,153 @@
1
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
5
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
7
+ import React, { useEffect, useMemo } from 'react';
8
+ import c from 'classnames';
9
+ import { useVideoJS } from 'react-hook-videojs';
10
+ import { useTranslation } from 'react-i18next';
11
+ // VideoJS plugins:
12
+ import 'videojs-vimeo-tech';
13
+ import 'videojs-youtube';
14
+ import 'video.js/dist/video-js.css';
15
+ import './style.scss';
16
+ var MediaPlayer = function MediaPlayer(_ref) {
17
+ var src = _ref.src,
18
+ type = _ref.type,
19
+ controls = _ref.controls,
20
+ posterUrl = _ref.posterUrl,
21
+ customOptions = _ref.options,
22
+ captions = _ref.captions,
23
+ audioOnly = _ref.audioOnly,
24
+ notSupportedMessage = _ref.notSupportedMessage,
25
+ className = _ref.className,
26
+ onPlay = _ref.onPlay,
27
+ _ref$autoPlay = _ref.autoPlay,
28
+ autoPlay = _ref$autoPlay === void 0 ? false : _ref$autoPlay,
29
+ onPause = _ref.onPause,
30
+ onEnded = _ref.onEnded,
31
+ onSeeking = _ref.onSeeking,
32
+ onVolumeChange = _ref.onVolumeChange,
33
+ onFullscreenChange = _ref.onFullscreenChange,
34
+ onError = _ref.onError;
35
+ var _useTranslation = useTranslation(),
36
+ t = _useTranslation.t;
37
+ var classNames = c('MediaPlayer', 'video-js', 'vjs-default-skin', 'vjs-big-play-centered', className);
38
+ var audioOnlyMode = useMemo(function () {
39
+ return audioOnly || type.startsWith('audio');
40
+ }, [type, audioOnly]);
41
+ var controlBar = useMemo(function () {
42
+ var videoJSControls = {
43
+ play: 'playToggle',
44
+ currentTime: 'currentTimeDisplay',
45
+ timeDivider: 'timeDivider',
46
+ duration: 'durationDisplay',
47
+ seekbar: 'progressControl',
48
+ captions: 'subsCapsButton',
49
+ volume: 'volumePanel',
50
+ fullscreen: 'fullscreenToggle'
51
+ };
52
+ var controlMapped = function controlMapped(control) {
53
+ return {
54
+ name: videoJSControls[control],
55
+ className: "MediaPlayer__control MediaPlayer__control--".concat(control)
56
+ };
57
+ };
58
+ if (controls === false || _typeof(controls) === 'object' && controls.length === 0) {
59
+ return false;
60
+ }
61
+ if (_typeof(controls) === 'object' && controls.length > 0) {
62
+ return {
63
+ children: controls.map(controlMapped)
64
+ };
65
+ }
66
+ var controlKeys = Object.keys(videoJSControls);
67
+ return {
68
+ children: controlKeys.map(controlMapped)
69
+ };
70
+ }, [controls]);
71
+
72
+ // Can be overridden by the custom options prop.
73
+ var defaultOptions = {
74
+ controls: true,
75
+ aspectRatio: '16:9',
76
+ audioOnlyMode: audioOnlyMode,
77
+ fluid: true,
78
+ notSupportedMessage: notSupportedMessage || t('organisms.media_player.not_supported_message'),
79
+ techOrder: ['html5', 'youtube', 'vimeo'],
80
+ poster: posterUrl,
81
+ controlBar: controlBar,
82
+ autoplay: autoPlay,
83
+ sources: [{
84
+ src: src,
85
+ type: type
86
+ }]
87
+ };
88
+ var options = _objectSpread(_objectSpread({}, defaultOptions), customOptions);
89
+ var videoJS = useVideoJS(options);
90
+ var _ref2 = videoJS,
91
+ Video = _ref2.Video,
92
+ player = _ref2.player,
93
+ ready = _ref2.ready;
94
+
95
+ // Passing down the VideoJS events.
96
+ useEffect(function () {
97
+ if (ready) {
98
+ if (autoPlay && onPlay) {
99
+ player.one('play', function (event) {
100
+ return onPlay(player, event);
101
+ });
102
+ } else if (!autoPlay && onPlay) {
103
+ player.on('play', function (event) {
104
+ return onPlay(player, event);
105
+ });
106
+ }
107
+ if (onPause) {
108
+ player.one('pause', function (event) {
109
+ return onPause(player, event);
110
+ });
111
+ }
112
+ if (onEnded) {
113
+ player.one('ended', function (event) {
114
+ return onEnded(player, event);
115
+ });
116
+ }
117
+ if (onSeeking) {
118
+ player.one('seeking', function (event) {
119
+ return onSeeking(player, event);
120
+ });
121
+ }
122
+ if (onVolumeChange) {
123
+ player.one('volumechange', function (event) {
124
+ return onVolumeChange(player, event);
125
+ });
126
+ }
127
+ if (onFullscreenChange) {
128
+ player.one('fullscreenchange', function (event) {
129
+ return onFullscreenChange(player, event);
130
+ });
131
+ }
132
+ if (onError) {
133
+ player.one('error', function (event) {
134
+ return onError(player, event);
135
+ });
136
+ }
137
+ }
138
+ // eslint-disable-next-line max-len
139
+ }, [onEnded, onError, onFullscreenChange, onPause, onPlay, onSeeking, onVolumeChange, player, ready]);
140
+ return /*#__PURE__*/React.createElement(Video, {
141
+ className: classNames
142
+ }, !audioOnlyMode && captions && captions.map(function (caption) {
143
+ return /*#__PURE__*/React.createElement("track", {
144
+ key: "caption:".concat(caption.language),
145
+ kind: "captions",
146
+ src: caption.src,
147
+ srcLang: caption.language,
148
+ label: caption.label || caption.language,
149
+ default: caption.default
150
+ });
151
+ }));
152
+ };
153
+ export default MediaPlayer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uncinc/uncinc-react-kitchen-sink",
3
- "version": "2.16.14",
3
+ "version": "2.17.0",
4
4
  "description": "Default React components that are easily extended.",
5
5
  "author": "uncinc",
6
6
  "license": "MIT",