@ndla/video-search 2.0.10 → 2.0.11

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.
package/es/VideoTabs.js CHANGED
@@ -1,27 +1,14 @@
1
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
-
1
+ 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); }
5
2
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
-
7
3
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
8
-
9
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
10
-
11
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
12
-
13
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
14
-
4
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
6
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
15
7
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
16
-
17
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
18
-
8
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
19
9
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
20
-
21
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
22
-
23
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
24
-
10
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
11
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
25
12
  /**
26
13
  * Copyright (c) 2016-present, NDLA.
27
14
  *
@@ -29,32 +16,27 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
29
16
  * LICENSE file in the root directory of this source tree.
30
17
  *
31
18
  */
19
+
32
20
  import React, { Component } from 'react';
33
21
  import PropTypes from 'prop-types';
34
22
  import Tabs from '@ndla/tabs';
35
-
23
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
36
24
  var VideoTabs = /*#__PURE__*/function (_Component) {
37
25
  _inherits(VideoTabs, _Component);
38
-
39
26
  var _super = _createSuper(VideoTabs);
40
-
41
27
  function VideoTabs(props) {
42
28
  var _this;
43
-
44
29
  _classCallCheck(this, VideoTabs);
45
-
46
30
  _this = _super.call(this, props);
47
31
  _this.handleOnSelect = _this.handleOnSelect.bind(_assertThisInitialized(_this));
48
32
  return _this;
49
33
  }
50
-
51
34
  _createClass(VideoTabs, [{
52
35
  key: "handleOnSelect",
53
36
  value: function handleOnSelect(index, last) {
54
37
  var _this$props = this.props,
55
- onSearchTypeChange = _this$props.onSearchTypeChange,
56
- tabs = _this$props.tabs;
57
-
38
+ onSearchTypeChange = _this$props.onSearchTypeChange,
39
+ tabs = _this$props.tabs;
58
40
  if (index !== last) {
59
41
  onSearchTypeChange(tabs[index].title.toLowerCase());
60
42
  }
@@ -69,10 +51,8 @@ var VideoTabs = /*#__PURE__*/function (_Component) {
69
51
  });
70
52
  }
71
53
  }]);
72
-
73
54
  return VideoTabs;
74
55
  }(Component);
75
-
76
56
  VideoTabs.propTypes = {
77
57
  searchTypes: PropTypes.string,
78
58
  onSearchTypeChange: PropTypes.func.isRequired,
package/es/shapes.js CHANGED
@@ -5,6 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
+
8
9
  import PropTypes from 'prop-types';
9
10
  export var LicenseShape = PropTypes.shape({
10
11
  "short": PropTypes.string.isRequired,
@@ -5,21 +5,18 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
+
8
9
  export var getLastPage = function getLastPage(search, type) {
9
10
  if (type === 'youtube') {
10
11
  var _search$queries, _search$queries$reque;
11
-
12
12
  if ((search === null || search === void 0 ? void 0 : (_search$queries = search.queries) === null || _search$queries === void 0 ? void 0 : (_search$queries$reque = _search$queries.request) === null || _search$queries$reque === void 0 ? void 0 : _search$queries$reque.length) > 0) {
13
13
  var request = search.queries.request[0];
14
-
15
14
  if (request.totalResults && request.count) {
16
15
  return Math.ceil(request.totalResults / request.count);
17
16
  }
18
-
19
17
  return 0;
20
18
  }
21
19
  }
22
-
23
20
  return 0;
24
21
  };
25
22
  export var youTubeDurationToSeconds = function youTubeDurationToSeconds(duration) {
@@ -40,10 +37,8 @@ export var setLocaleDate = function setLocaleDate(date, locale) {
40
37
  };
41
38
  export var setYouTubeDuration = function setYouTubeDuration(duration) {
42
39
  var seconds = youTubeDurationToSeconds(duration);
43
-
44
40
  if (seconds > 86400) {
45
41
  return "24h+ ".concat(new Date(seconds * 1000).toISOString().substr(11, 8));
46
42
  }
47
-
48
43
  return new Date(seconds * 1000).toISOString().substr(11, 8);
49
44
  };
@@ -4,35 +4,23 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = PreviewVideo;
7
-
8
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
9
-
10
7
  var _react = _interopRequireDefault(require("react"));
11
-
12
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
-
14
9
  var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
15
-
16
10
  var _button = _interopRequireDefault(require("@ndla/button"));
17
-
18
11
  var _action = require("@ndla/icons/action");
19
-
12
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
20
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
-
22
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
23
-
24
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
25
-
14
+ 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; }
15
+ 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; }
26
16
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
-
28
17
  var classes = new _reactBemHelper["default"]({
29
18
  name: 'video-preview',
30
19
  prefix: 'c-'
31
20
  });
32
-
33
21
  function PreviewVideo(_ref) {
34
22
  var onVideoPreview = _ref.onVideoPreview,
35
- children = _ref.children;
23
+ children = _ref.children;
36
24
  return (0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({}, classes()), {}, {
37
25
  children: [(0, _jsxRuntime.jsx)(_button["default"], _objectSpread(_objectSpread({}, classes('close')), {}, {
38
26
  stripped: true,
@@ -43,7 +31,6 @@ function PreviewVideo(_ref) {
43
31
  })), children]
44
32
  }));
45
33
  }
46
-
47
34
  PreviewVideo.propTypes = {
48
35
  children: _propTypes["default"].node,
49
36
  onVideoPreview: _propTypes["default"].func.isRequired
@@ -4,43 +4,29 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
9
-
10
7
  var _react = _interopRequireDefault(require("react"));
11
-
12
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
-
14
9
  var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
15
-
16
10
  var _button = _interopRequireDefault(require("@ndla/button"));
17
-
18
11
  var _shapes = require("./shapes");
19
-
12
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
20
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
-
22
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
23
-
24
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
25
-
14
+ 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; }
15
+ 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; }
26
16
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
-
28
17
  var classes = new _reactBemHelper["default"]({
29
18
  name: 'video-search',
30
19
  prefix: 'c-'
31
20
  });
32
-
33
21
  var VideoLoadMoreButton = function VideoLoadMoreButton(props) {
34
22
  var videos = props.videos,
35
- searching = props.searching,
36
- limit = props.limit,
37
- translations = props.translations,
38
- loadMoreVideos = props.loadMoreVideos;
39
-
23
+ searching = props.searching,
24
+ limit = props.limit,
25
+ translations = props.translations,
26
+ loadMoreVideos = props.loadMoreVideos;
40
27
  if (!videos || videos.length === 0 || videos.length % limit !== 0) {
41
28
  return null;
42
29
  }
43
-
44
30
  return (0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, classes('load-videos')), {}, {
45
31
  children: (0, _jsxRuntime.jsx)(_button["default"], {
46
32
  disabled: searching,
@@ -49,7 +35,6 @@ var VideoLoadMoreButton = function VideoLoadMoreButton(props) {
49
35
  })
50
36
  }));
51
37
  };
52
-
53
38
  VideoLoadMoreButton.propTypes = {
54
39
  searching: _propTypes["default"].bool.isRequired,
55
40
  videos: _propTypes["default"].oneOfType([_propTypes["default"].arrayOf(_shapes.BrightcoveShape), _propTypes["default"].arrayOf(_shapes.YouTubeShape)]),
@@ -1,79 +1,46 @@
1
1
  "use strict";
2
2
 
3
+ 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); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports["default"] = void 0;
7
-
8
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
9
-
10
8
  var _react = _interopRequireWildcard(require("react"));
11
-
12
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
-
14
10
  var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
15
-
16
11
  var _pager = _interopRequireDefault(require("@ndla/pager"));
17
-
18
12
  var _VideoSearchForm = _interopRequireDefault(require("./VideoSearchForm"));
19
-
20
13
  var _VideoSearchList = _interopRequireDefault(require("./VideoSearchList"));
21
-
22
14
  var _VideoLoadMoreButton = _interopRequireDefault(require("./VideoLoadMoreButton"));
23
-
24
15
  var _VideoTabs = _interopRequireDefault(require("./VideoTabs"));
25
-
26
16
  var _videoHelpers = require("./videoHelpers");
27
-
17
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
28
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
29
-
30
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
31
-
32
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
-
34
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
35
-
36
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
37
-
38
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
39
-
19
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
20
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
+ 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; }
22
+ 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; }
40
23
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
41
-
42
24
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
43
-
44
25
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
45
-
46
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
47
-
48
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
49
-
50
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
51
-
26
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
27
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
28
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
52
29
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
53
-
54
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
55
-
30
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
56
31
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
57
-
58
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
59
-
60
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
61
-
32
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
33
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
62
34
  var classes = new _reactBemHelper["default"]({
63
35
  name: 'video-search',
64
36
  prefix: 'c-'
65
37
  });
66
-
67
38
  var VideoSearch = /*#__PURE__*/function (_Component) {
68
39
  _inherits(VideoSearch, _Component);
69
-
70
40
  var _super = _createSuper(VideoSearch);
71
-
72
41
  function VideoSearch() {
73
42
  var _this;
74
-
75
43
  _classCallCheck(this, VideoSearch);
76
-
77
44
  _this = _super.call(this);
78
45
  _this.state = {
79
46
  queryObject: {
@@ -97,7 +64,6 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
97
64
  _this.loadMoreVideos = _this.loadMoreVideos.bind(_assertThisInitialized(_this));
98
65
  return _this;
99
66
  }
100
-
101
67
  _createClass(VideoSearch, [{
102
68
  key: "componentDidMount",
103
69
  value: function componentDidMount() {
@@ -124,7 +90,6 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
124
90
  key: "onSearchTypeChange",
125
91
  value: function onSearchTypeChange(type) {
126
92
  var queryObject;
127
-
128
93
  if (type === 'youtube') {
129
94
  queryObject = {
130
95
  query: '',
@@ -142,7 +107,6 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
142
107
  start: undefined
143
108
  };
144
109
  }
145
-
146
110
  this.setState({
147
111
  queryObject: queryObject,
148
112
  selectedType: type,
@@ -155,14 +119,13 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
155
119
  key: "loadMoreVideos",
156
120
  value: function loadMoreVideos() {
157
121
  var _this2 = this;
158
-
159
122
  var _this$state = this.state,
160
- queryObject = _this$state.queryObject,
161
- videos = _this$state.videos,
162
- selectedType = _this$state.selectedType;
123
+ queryObject = _this$state.queryObject,
124
+ videos = _this$state.videos,
125
+ selectedType = _this$state.selectedType;
163
126
  var _this$props = this.props,
164
- searchVideos = _this$props.searchVideos,
165
- onError = _this$props.onError;
127
+ searchVideos = _this$props.searchVideos,
128
+ onError = _this$props.onError;
166
129
  this.setState({
167
130
  searching: true
168
131
  });
@@ -180,7 +143,6 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
180
143
  });
181
144
  })["catch"](function (err) {
182
145
  onError(err);
183
-
184
146
  _this2.setState({
185
147
  searching: false
186
148
  });
@@ -194,11 +156,9 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
194
156
  });
195
157
  var queryObject = this.state.queryObject;
196
158
  var nextIndex = queryObject.start + (page.page - queryObject.page) * 10;
197
-
198
159
  var newQueryObject = _objectSpread(_objectSpread(_objectSpread({}, queryObject), page), {}, {
199
160
  start: nextIndex
200
161
  });
201
-
202
162
  this.searchVideos(newQueryObject);
203
163
  }
204
164
  }, {
@@ -207,18 +167,16 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
207
167
  var queryObject = _objectSpread(_objectSpread({}, this.state.queryObject), {}, {
208
168
  query: query
209
169
  });
210
-
211
170
  this.searchVideos(queryObject);
212
171
  }
213
172
  }, {
214
173
  key: "searchVideos",
215
174
  value: function searchVideos(queryObject) {
216
175
  var _this3 = this;
217
-
218
176
  var selectedType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.state.selectedType;
219
177
  var _this$props2 = this.props,
220
- searchVideos = _this$props2.searchVideos,
221
- onError = _this$props2.onError;
178
+ searchVideos = _this$props2.searchVideos,
179
+ onError = _this$props2.onError;
222
180
  searchVideos(queryObject, selectedType).then(function (result) {
223
181
  if (selectedType === _this3.state.selectedType) {
224
182
  _this3.setState(function (prevState) {
@@ -237,7 +195,6 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
237
195
  }
238
196
  })["catch"](function (err) {
239
197
  onError(err);
240
-
241
198
  _this3.setState({
242
199
  searching: false
243
200
  });
@@ -247,21 +204,19 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
247
204
  key: "render",
248
205
  value: function render() {
249
206
  var _this4 = this;
250
-
251
207
  var _this$props3 = this.props,
252
- translations = _this$props3.translations,
253
- locale = _this$props3.locale,
254
- enabledSources = _this$props3.enabledSources;
208
+ translations = _this$props3.translations,
209
+ locale = _this$props3.locale,
210
+ enabledSources = _this$props3.enabledSources;
255
211
  var _this$state2 = this.state,
256
- queryObject = _this$state2.queryObject,
257
- lastPage = _this$state2.lastPage,
258
- videos = _this$state2.videos,
259
- selectedVideo = _this$state2.selectedVideo,
260
- selectedType = _this$state2.selectedType,
261
- searching = _this$state2.searching;
212
+ queryObject = _this$state2.queryObject,
213
+ lastPage = _this$state2.lastPage,
214
+ videos = _this$state2.videos,
215
+ selectedVideo = _this$state2.selectedVideo,
216
+ selectedType = _this$state2.selectedType,
217
+ searching = _this$state2.searching;
262
218
  var query = queryObject.query,
263
- page = queryObject.page;
264
-
219
+ page = queryObject.page;
265
220
  var paginationItem = function paginationItem() {
266
221
  if (selectedType === 'brightcove') {
267
222
  return (0, _jsxRuntime.jsx)(_VideoLoadMoreButton["default"], {
@@ -272,14 +227,12 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
272
227
  translations: translations
273
228
  });
274
229
  }
275
-
276
230
  return (0, _jsxRuntime.jsx)(_pager["default"], {
277
231
  page: page || 1,
278
232
  lastPage: lastPage,
279
233
  onClick: _this4.changeQueryPage
280
234
  });
281
235
  };
282
-
283
236
  var searchListTabs = enabledSources.map(function (source) {
284
237
  return {
285
238
  title: source,
@@ -311,10 +264,8 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
311
264
  }));
312
265
  }
313
266
  }]);
314
-
315
267
  return VideoSearch;
316
268
  }(_react.Component);
317
-
318
269
  VideoSearch.propTypes = {
319
270
  onVideoSelect: _propTypes["default"].func.isRequired,
320
271
  searchVideos: _propTypes["default"].func.isRequired,
@@ -1,69 +1,41 @@
1
1
  "use strict";
2
2
 
3
+ 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); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports["default"] = void 0;
7
-
8
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
9
-
10
8
  var _react = _interopRequireWildcard(require("react"));
11
-
12
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
-
14
10
  var _button = _interopRequireDefault(require("@ndla/button"));
15
-
16
11
  var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
17
-
12
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
18
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
-
20
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
21
-
22
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
-
24
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
25
-
26
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
27
-
28
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
29
-
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
+ 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; }
17
+ 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; }
30
18
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
31
-
32
19
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
33
-
34
20
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
35
-
36
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
37
-
38
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
39
-
40
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
41
-
21
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
22
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
23
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
42
24
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
43
-
44
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
45
-
25
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
46
26
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
47
-
48
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
49
-
50
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
51
-
27
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
28
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
52
29
  var classes = new _reactBemHelper["default"]({
53
30
  name: 'video-search',
54
31
  prefix: 'c-'
55
32
  });
56
-
57
33
  var SearchForm = /*#__PURE__*/function (_Component) {
58
34
  _inherits(SearchForm, _Component);
59
-
60
35
  var _super = _createSuper(SearchForm);
61
-
62
36
  function SearchForm(props) {
63
37
  var _this;
64
-
65
38
  _classCallCheck(this, SearchForm);
66
-
67
39
  _this = _super.call(this, props);
68
40
  _this.state = {
69
41
  query: props.query
@@ -73,7 +45,6 @@ var SearchForm = /*#__PURE__*/function (_Component) {
73
45
  _this.onKeyPress = _this.onKeyPress.bind(_assertThisInitialized(_this));
74
46
  return _this;
75
47
  }
76
-
77
48
  _createClass(SearchForm, [{
78
49
  key: "onKeyPress",
79
50
  value: function onKeyPress(evt) {
@@ -98,8 +69,8 @@ var SearchForm = /*#__PURE__*/function (_Component) {
98
69
  key: "render",
99
70
  value: function render() {
100
71
  var _this$props = this.props,
101
- searching = _this$props.searching,
102
- translations = _this$props.translations;
72
+ searching = _this$props.searching,
73
+ translations = _this$props.translations;
103
74
  return (0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({}, classes('form')), {}, {
104
75
  children: [(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({}, classes('form-query')), {}, {
105
76
  type: "text",
@@ -115,10 +86,8 @@ var SearchForm = /*#__PURE__*/function (_Component) {
115
86
  }));
116
87
  }
117
88
  }]);
118
-
119
89
  return SearchForm;
120
90
  }(_react.Component);
121
-
122
91
  SearchForm.propTypes = {
123
92
  query: _propTypes["default"].string,
124
93
  searching: _propTypes["default"].bool.isRequired,