@quintype/components 3.8.7 → 3.8.8-only-react-v19.1

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.
Files changed (61) hide show
  1. package/dist/cjs/index.js +1090 -2039
  2. package/dist/es/components/access-type.js +574 -822
  3. package/dist/es/components/adbutler-ad.js +10 -14
  4. package/dist/es/components/api-client.js +4 -6
  5. package/dist/es/components/breaking-news-item.js +2 -3
  6. package/dist/es/components/breaking-news.js +7 -23
  7. package/dist/es/components/client-side-only.js +6 -19
  8. package/dist/es/components/collection.js +5 -5
  9. package/dist/es/components/dfp-ad.js +23 -30
  10. package/dist/es/components/eager-load-images.js +7 -17
  11. package/dist/es/components/hamburger-button.js +2 -5
  12. package/dist/es/components/image-gallery.js +10 -13
  13. package/dist/es/components/impl/collection-impl.js +2 -8
  14. package/dist/es/components/impl/gumlet-image.js +10 -19
  15. package/dist/es/components/impl/image-utils.js +3 -4
  16. package/dist/es/components/impl/load-more-stories-manager.js +6 -19
  17. package/dist/es/components/impl/thumbor-image.js +10 -32
  18. package/dist/es/components/infinite-scroll.js +29 -85
  19. package/dist/es/components/infinite-story-base.js +7 -24
  20. package/dist/es/components/lazy-collection.js +8 -8
  21. package/dist/es/components/lazy-load-images.js +10 -43
  22. package/dist/es/components/link-base.js +11 -19
  23. package/dist/es/components/link.js +1 -4
  24. package/dist/es/components/load-more-collection-stories.js +7 -18
  25. package/dist/es/components/load-more-stories-base.js +6 -20
  26. package/dist/es/components/loading-indicator.js +1 -5
  27. package/dist/es/components/menu-item.js +6 -10
  28. package/dist/es/components/menu.js +6 -9
  29. package/dist/es/components/responsive-hero-image.js +1 -3
  30. package/dist/es/components/responsive-image.js +0 -5
  31. package/dist/es/components/responsive-source.js +1 -1
  32. package/dist/es/components/review-rating/review-rating.js +21 -27
  33. package/dist/es/components/review-rating/star-icon.js +3 -5
  34. package/dist/es/components/search-box.js +7 -23
  35. package/dist/es/components/search-page-base.js +7 -18
  36. package/dist/es/components/social-logins/with-facebook-login.js +10 -20
  37. package/dist/es/components/social-logins/with-google-login.js +8 -18
  38. package/dist/es/components/social-logins/with-linkedin-login.js +7 -12
  39. package/dist/es/components/social-logins/with-social-login.js +7 -21
  40. package/dist/es/components/social-logins/with-twitter-login.js +7 -7
  41. package/dist/es/components/social-share.js +8 -24
  42. package/dist/es/components/story-element.js +43 -88
  43. package/dist/es/components/story-elements/brightcove.js +54 -94
  44. package/dist/es/components/story-elements/dailymotion-embed-script.js +13 -39
  45. package/dist/es/components/story-elements/dailymotion.js +19 -61
  46. package/dist/es/components/story-elements/jsembed.js +10 -30
  47. package/dist/es/components/story-elements/jwPlayer.js +9 -24
  48. package/dist/es/components/story-elements/polltype.js +6 -20
  49. package/dist/es/components/story-elements/table.js +16 -34
  50. package/dist/es/components/story-elements/youtube.js +24 -73
  51. package/dist/es/components/update-on-interval.js +31 -52
  52. package/dist/es/components/with-client-side-only.js +3 -4
  53. package/dist/es/components/with-error.js +7 -20
  54. package/dist/es/components/with-host-url.js +4 -9
  55. package/dist/es/components/with-lazy.js +7 -21
  56. package/dist/es/components/with-member.js +14 -33
  57. package/dist/es/components/with-preview.js +7 -20
  58. package/dist/es/components/wrap-collection-layout.js +4 -16
  59. package/dist/es/store/reducers.js +1 -45
  60. package/dist/es/utils.js +7 -12
  61. package/package.json +9 -6
@@ -1,21 +1,15 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
3
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
5
4
  import _createClass from "@babel/runtime/helpers/createClass";
6
- import _inherits from "@babel/runtime/helpers/inherits";
7
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
8
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
+ import _inherits from "@babel/runtime/helpers/inherits";
9
8
  var _excluded = ["renderTemplates"];
10
-
11
- 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; }
12
-
13
- 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; }
14
-
15
- 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 _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; } }
18
-
9
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
12
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
19
13
  import classNames from "classnames";
20
14
  import get from "lodash/get";
21
15
  import React from "react";
@@ -30,6 +24,7 @@ import StoryElementJwPlayer from "./story-elements/jwPlayer";
30
24
  import Polltype from "./story-elements/polltype";
31
25
  import { Table } from "./story-elements/table";
32
26
  import StoryElementYoutube from "./story-elements/youtube";
27
+
33
28
  /**
34
29
  * This component renders different types of [story elements](https://developers.quintype.com/malibu/terminology#story-elements)
35
30
 
@@ -55,25 +50,18 @@ import StoryElementYoutube from "./story-elements/youtube";
55
50
  * @hideconstructor
56
51
  * @category Story Page
57
52
  */
58
-
59
53
  export var StoryElement = /*#__PURE__*/function (_React$Component) {
60
- _inherits(StoryElement, _React$Component);
61
-
62
- var _super = /*#__PURE__*/_createSuper(StoryElement);
63
-
64
54
  function StoryElement(props) {
65
55
  var _this;
66
-
67
56
  _classCallCheck(this, StoryElement);
68
-
69
- _this = _super.call(this, props);
57
+ _this = _callSuper(this, StoryElement, [props]);
70
58
  _this.state = {
71
59
  crashed: false
72
60
  };
73
61
  return _this;
74
62
  }
75
-
76
- _createClass(StoryElement, [{
63
+ _inherits(StoryElement, _React$Component);
64
+ return _createClass(StoryElement, [{
77
65
  key: "componentDidCatch",
78
66
  value: function componentDidCatch(error, stack) {
79
67
  this.setState({
@@ -94,32 +82,26 @@ export var StoryElement = /*#__PURE__*/function (_React$Component) {
94
82
  }
95
83
  }
96
84
  }]);
97
-
98
- return StoryElement;
99
85
  }(React.Component);
100
-
101
86
  function StoryElementText(_ref) {
102
87
  var _ref$element = _ref.element,
103
- element = _ref$element === void 0 ? {} : _ref$element,
104
- externalLink = _ref.externalLink;
88
+ element = _ref$element === void 0 ? {} : _ref$element,
89
+ externalLink = _ref.externalLink;
105
90
  var text = element.text || "";
106
-
107
91
  if (externalLink) {
108
92
  text = element.text.replace(/<a/g, '<a target="_blank"');
109
93
  }
110
-
111
94
  return /*#__PURE__*/React.createElement("div", {
112
95
  dangerouslySetInnerHTML: {
113
96
  __html: text
114
97
  }
115
98
  });
116
99
  }
117
-
118
100
  function StoryElementAlsoRead(_ref2) {
119
101
  var element = _ref2.element,
120
- story = _ref2.story,
121
- _ref2$alsoreadText = _ref2.alsoreadText,
122
- alsoreadText = _ref2$alsoreadText === void 0 ? "Also Read: " : _ref2$alsoreadText;
102
+ story = _ref2.story,
103
+ _ref2$alsoreadText = _ref2.alsoreadText,
104
+ alsoreadText = _ref2$alsoreadText === void 0 ? "Also Read: " : _ref2$alsoreadText;
123
105
  var linkedStories = get(story, ["linked-stories"]);
124
106
  var linkedStoryId = get(element, ["metadata", "linked-story-id"]);
125
107
  var linkedStorySlug = get(linkedStories, [linkedStoryId, "slug"]);
@@ -132,15 +114,14 @@ function StoryElementAlsoRead(_ref2) {
132
114
  className: "story-element-text-also-read__label"
133
115
  }, alsoreadText), /*#__PURE__*/React.createElement(Link, linkProps, element.text));
134
116
  }
135
-
136
117
  function StoryElementImage(_ref3) {
137
118
  var element = _ref3.element,
138
- _ref3$story = _ref3.story,
139
- story = _ref3$story === void 0 ? {} : _ref3$story,
140
- imageWidths = _ref3.imageWidths,
141
- imageDefaultWidth = _ref3.imageDefaultWidth,
142
- _ref3$onClick = _ref3.onClick,
143
- onClick = _ref3$onClick === void 0 ? function () {} : _ref3$onClick;
119
+ _ref3$story = _ref3.story,
120
+ story = _ref3$story === void 0 ? {} : _ref3$story,
121
+ imageWidths = _ref3.imageWidths,
122
+ imageDefaultWidth = _ref3.imageDefaultWidth,
123
+ _ref3$onClick = _ref3.onClick,
124
+ onClick = _ref3$onClick === void 0 ? function () {} : _ref3$onClick;
144
125
  return /*#__PURE__*/React.createElement("figure", {}, /*#__PURE__*/React.createElement(ResponsiveImage, {
145
126
  slug: element["image-s3-key"],
146
127
  metadata: element["metadata"],
@@ -166,12 +147,10 @@ function StoryElementImage(_ref3) {
166
147
  className: "story-element-image-attribution"
167
148
  }) : undefined));
168
149
  }
169
-
170
150
  function StoryElementTitle(_ref4) {
171
151
  var element = _ref4.element;
172
152
  return /*#__PURE__*/React.createElement("h2", {}, element.text);
173
153
  }
174
-
175
154
  function StoryElementSoundCloud(_ref5) {
176
155
  var element = _ref5.element;
177
156
  return /*#__PURE__*/React.createElement("iframe", {
@@ -179,7 +158,6 @@ function StoryElementSoundCloud(_ref5) {
179
158
  width: "100%"
180
159
  });
181
160
  }
182
-
183
161
  function StoryElementJsembed(_ref6) {
184
162
  var element = _ref6.element;
185
163
  return /*#__PURE__*/React.createElement(JSEmbed, {
@@ -187,14 +165,12 @@ function StoryElementJsembed(_ref6) {
187
165
  id: element["id"]
188
166
  });
189
167
  }
190
-
191
168
  function StoryElementPolltype(_ref7) {
192
169
  var element = _ref7.element;
193
170
  return /*#__PURE__*/React.createElement(Polltype, {
194
171
  id: element["polltype-id"]
195
172
  });
196
173
  }
197
-
198
174
  function StoryElementTable(_ref8) {
199
175
  var element = _ref8.element;
200
176
  return /*#__PURE__*/React.createElement(Table, {
@@ -203,7 +179,6 @@ function StoryElementTable(_ref8) {
203
179
  hasHeader: element.metadata["has-header"]
204
180
  });
205
181
  }
206
-
207
182
  function StoryElementFile(_ref9) {
208
183
  var element = _ref9.element;
209
184
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
@@ -213,9 +188,10 @@ function StoryElementFile(_ref9) {
213
188
  href: element.url,
214
189
  download: true
215
190
  }, "download"));
216
- } // FIXME MISSING: composite
217
- // TODO: Can also support various subtypes (though not needed potentially)
191
+ }
218
192
 
193
+ // FIXME MISSING: composite
194
+ // TODO: Can also support various subtypes (though not needed potentially)
219
195
 
220
196
  var DEFAULT_TEMPLATES = {
221
197
  text: StoryElementText,
@@ -233,20 +209,12 @@ var DEFAULT_TEMPLATES = {
233
209
  "brightcove-video": StoryElementBrightcove,
234
210
  "jwplayer": StoryElementJwPlayer
235
211
  };
236
-
237
212
  var StoryElementBase = /*#__PURE__*/function (_React$Component2) {
238
- _inherits(StoryElementBase, _React$Component2);
239
-
240
- var _super2 = /*#__PURE__*/_createSuper(StoryElementBase);
241
-
242
213
  function StoryElementBase(props) {
243
214
  var _this2;
244
-
245
215
  _classCallCheck(this, StoryElementBase);
246
-
247
- _this2 = _super2.call(this, props);
248
-
249
- _defineProperty(_assertThisInitialized(_this2), "initiateObserver", function () {
216
+ _this2 = _callSuper(this, StoryElementBase, [props]);
217
+ _defineProperty(_this2, "initiateObserver", function () {
250
218
  if (_this2.props.disableAnalytics === true) return false;
251
219
  var options = {
252
220
  root: null,
@@ -254,28 +222,24 @@ var StoryElementBase = /*#__PURE__*/function (_React$Component2) {
254
222
  threshold: 1.0
255
223
  };
256
224
  _this2.observer = new IntersectionObserver(_this2.observerCallback, options);
257
-
258
225
  _this2.observer.observe(_this2.storyElementRef);
259
226
  });
260
-
261
- _defineProperty(_assertThisInitialized(_this2), "destroyObserver", function () {
227
+ _defineProperty(_this2, "destroyObserver", function () {
262
228
  _this2.observer && _this2.observer.disconnect();
263
229
  });
264
-
265
- _defineProperty(_assertThisInitialized(_this2), "observerCallback", function (entries) {
230
+ _defineProperty(_this2, "observerCallback", function (entries) {
266
231
  entries.forEach(function (entry) {
267
232
  if (entry.isIntersecting) {
268
233
  _this2.emitElementQlitics();
269
234
  }
270
235
  });
271
236
  });
272
-
273
237
  _this2.observer = null;
274
238
  _this2.storyElementRef = null;
275
239
  return _this2;
276
240
  }
277
-
278
- _createClass(StoryElementBase, [{
241
+ _inherits(StoryElementBase, _React$Component2);
242
+ return _createClass(StoryElementBase, [{
279
243
  key: "componentDidMount",
280
244
  value: function componentDidMount() {
281
245
  this.initiateObserver();
@@ -296,20 +260,18 @@ var StoryElementBase = /*#__PURE__*/function (_React$Component2) {
296
260
  key: "emitElementQlitics",
297
261
  value: function emitElementQlitics() {
298
262
  var _this$props = this.props,
299
- _this$props$story = _this$props.story,
300
- story = _this$props$story === void 0 ? {} : _this$props$story,
301
- _this$props$card = _this$props.card,
302
- card = _this$props$card === void 0 ? {} : _this$props$card,
303
- _this$props$element = _this$props.element,
304
- element = _this$props$element === void 0 ? {} : _this$props$element;
305
-
263
+ _this$props$story = _this$props.story,
264
+ story = _this$props$story === void 0 ? {} : _this$props$story,
265
+ _this$props$card = _this$props.card,
266
+ card = _this$props$card === void 0 ? {} : _this$props$card,
267
+ _this$props$element = _this$props.element,
268
+ element = _this$props$element === void 0 ? {} : _this$props$element;
306
269
  if (global.qlitics) {
307
270
  global.qlitics("track", "story-element-view", getQliticsSchema(story, card, element));
308
271
  } else {
309
272
  global.qlitics = global.qlitics || function () {
310
273
  (qlitics.q = qlitics.q || []).push(arguments);
311
274
  };
312
-
313
275
  global.qlitics("track", "story-element-view", getQliticsSchema(story, card, element));
314
276
  }
315
277
  }
@@ -321,32 +283,25 @@ var StoryElementBase = /*#__PURE__*/function (_React$Component2) {
321
283
  }, {
322
284
  key: "render",
323
285
  value: function render() {
324
- var _classNames,
325
- _this3 = this;
326
-
286
+ var _this3 = this;
327
287
  var storyElement = this.props.element;
328
288
  var typeClassName = "story-element-".concat(storyElement.type);
329
289
  var subtypeClassName = "story-element-".concat(storyElement.type, "-").concat(storyElement.subtype);
330
290
  var storyElementTemplate = this.template();
331
-
332
291
  var _this$props2 = this.props,
333
- _this$props2$renderTe = _this$props2.renderTemplates,
334
- renderTemplates = _this$props2$renderTe === void 0 ? {} : _this$props2$renderTe,
335
- elementProps = _objectWithoutProperties(_this$props2, _excluded);
336
-
292
+ _this$props2$renderTe = _this$props2.renderTemplates,
293
+ renderTemplates = _this$props2$renderTe === void 0 ? {} : _this$props2$renderTe,
294
+ elementProps = _objectWithoutProperties(_this$props2, _excluded);
337
295
  var renderTemplate = renderTemplates[storyElement.subtype] || renderTemplates[storyElement.type];
338
296
  return /*#__PURE__*/React.createElement("div", {
339
- className: classNames((_classNames = {
297
+ className: classNames(_defineProperty(_defineProperty({
340
298
  "story-element": true
341
- }, _defineProperty(_classNames, typeClassName, true), _defineProperty(_classNames, subtypeClassName, !!storyElement.subtype), _classNames)),
342
- ref: function ref(_ref10) {
343
- return _this3.storyElementRef = _ref10;
299
+ }, typeClassName, true), subtypeClassName, !!storyElement.subtype)),
300
+ ref: function ref(_ref0) {
301
+ return _this3.storyElementRef = _ref0;
344
302
  }
345
303
  }, renderTemplate ? /*#__PURE__*/React.createElement(renderTemplate, _objectSpread({}, elementProps), /*#__PURE__*/React.createElement(storyElementTemplate, Object.assign({}, elementProps))) : /*#__PURE__*/React.createElement(storyElementTemplate, Object.assign({}, elementProps)));
346
304
  }
347
305
  }]);
348
-
349
- return StoryElementBase;
350
306
  }(React.Component);
351
-
352
307
  export var STORY_ELEMENT_TEMPLATES = DEFAULT_TEMPLATES;
@@ -6,53 +6,41 @@ import { bool, object } from "prop-types";
6
6
  import React, { useEffect, useRef, useState } from "react";
7
7
  import { disconnectObserver, initiateNewObserver } from "../../utils";
8
8
  import { WithLazy } from "../with-lazy";
9
-
10
9
  var BrightcoveElement = function BrightcoveElement(props) {
11
10
  var _window4;
12
-
13
11
  var _props$element = props.element,
14
- element = _props$element === void 0 ? {} : _props$element,
15
- loadIframeOnClick = props.loadIframeOnClick,
16
- _props$policyKey = props.policyKey,
17
- policyKey = _props$policyKey === void 0 ? "" : _props$policyKey;
18
-
12
+ element = _props$element === void 0 ? {} : _props$element,
13
+ loadIframeOnClick = props.loadIframeOnClick,
14
+ _props$policyKey = props.policyKey,
15
+ policyKey = _props$policyKey === void 0 ? "" : _props$policyKey;
19
16
  var _get = get(element, ["metadata"], {}),
20
- accountId = _get["account-id"],
21
- videoId = _get["video-id"],
22
- playerId = _get["player-id"];
23
-
17
+ accountId = _get["account-id"],
18
+ videoId = _get["video-id"],
19
+ playerId = _get["player-id"];
24
20
  var _useState = useState(false),
25
- _useState2 = _slicedToArray(_useState, 2),
26
- showVideo = _useState2[0],
27
- setVideoToggle = _useState2[1];
28
-
21
+ _useState2 = _slicedToArray(_useState, 2),
22
+ showVideo = _useState2[0],
23
+ setVideoToggle = _useState2[1];
29
24
  var _useState3 = useState(""),
30
- _useState4 = _slicedToArray(_useState3, 2),
31
- posterImage = _useState4[0],
32
- setPosterImage = _useState4[1];
33
-
25
+ _useState4 = _slicedToArray(_useState3, 2),
26
+ posterImage = _useState4[0],
27
+ setPosterImage = _useState4[1];
34
28
  var _useState5 = useState(null),
35
- _useState6 = _slicedToArray(_useState5, 2),
36
- myPlayer = _useState6[0],
37
- setMyPlayer = _useState6[1];
38
-
29
+ _useState6 = _slicedToArray(_useState5, 2),
30
+ myPlayer = _useState6[0],
31
+ setMyPlayer = _useState6[1];
39
32
  var _useState7 = useState(false),
40
- _useState8 = _slicedToArray(_useState7, 2),
41
- thumbnailClicked = _useState8[0],
42
- setThumbnailClicked = _useState8[1];
43
-
33
+ _useState8 = _slicedToArray(_useState7, 2),
34
+ thumbnailClicked = _useState8[0],
35
+ setThumbnailClicked = _useState8[1];
44
36
  var videoRef = useRef();
45
37
  var videoPausedByObserver = useRef(); // To check if the video is not click paused by user but paused by intersection observer, Its implemented this way because we cannot capture the click-pause event as videos are playing in iframe
46
-
47
38
  var observerRef = useRef(); // To Observe video element for intersection
48
39
 
49
40
  var loadLibrary = function loadLibrary() {
50
41
  var _window;
51
-
52
42
  if (!((_window = window) !== null && _window !== void 0 && _window.BrightcovePlayerLoader)) {
53
- return import(
54
- /* webpackChunkName: "qtc-react-brightcove" */
55
- "@brightcove/react-player-loader").then(function (module) {
43
+ return import(/* webpackChunkName: "qtc-react-brightcove" */"@brightcove/react-player-loader").then(function (module) {
56
44
  window.BrightcovePlayerLoader = module["default"];
57
45
  setVideoToggle(true);
58
46
  })["catch"](function (err) {
@@ -60,10 +48,8 @@ var BrightcoveElement = function BrightcoveElement(props) {
60
48
  return Promise.reject();
61
49
  });
62
50
  }
63
-
64
51
  setVideoToggle(true);
65
52
  };
66
-
67
53
  useEffect(function () {
68
54
  if (!loadIframeOnClick) {
69
55
  loadLibrary();
@@ -80,20 +66,16 @@ var BrightcoveElement = function BrightcoveElement(props) {
80
66
  observerRef.current && disconnectObserver(observerRef.current);
81
67
  };
82
68
  }, [myPlayer, thumbnailClicked]);
83
-
84
69
  function intersectionCallback(entries) {
85
70
  var videoInViewPort = entries === null || entries === void 0 ? void 0 : entries[0].isIntersecting;
86
71
  if (videoInViewPort) myPlayer.play();else {
87
72
  videoPausedByObserver.current = true; // before the below line fires the pause event we set the videoPausedByObserver Ref to true, this lets the pause events callback to know that the video is not click-paused by the user but paused by the intersection observer
88
-
89
73
  myPlayer.pause();
90
74
  }
91
75
  }
92
-
93
76
  function startObserver() {
94
77
  var targetElement = videoRef.current;
95
78
  var observer = observerRef.current;
96
-
97
79
  if (observer) {
98
80
  observer.observe(targetElement);
99
81
  } else {
@@ -101,21 +83,17 @@ var BrightcoveElement = function BrightcoveElement(props) {
101
83
  observerRef.current = intersectionObserver;
102
84
  }
103
85
  }
104
-
105
86
  function handleVideoPause() {
106
87
  var observer = observerRef.current;
107
88
  var isVideoPausedByObserver = videoPausedByObserver.current;
108
-
109
89
  if (isVideoPausedByObserver) {
110
90
  videoPausedByObserver.current = false; // This is a clean up to set videoPausedByObserver back to false
111
91
  } else {
112
92
  disconnectObserver(observer);
113
93
  }
114
94
  }
115
-
116
95
  var brightcoveIframe = function brightcoveIframe() {
117
96
  var _window2;
118
-
119
97
  var BrightcovePlayerLoader = (_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.BrightcovePlayerLoader;
120
98
  return /*#__PURE__*/React.createElement(BrightcovePlayerLoader, {
121
99
  accountId: accountId,
@@ -132,75 +110,59 @@ var BrightcoveElement = function BrightcoveElement(props) {
132
110
  }
133
111
  });
134
112
  };
135
-
136
113
  var getPoster = /*#__PURE__*/function () {
137
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
114
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
138
115
  var _yield$yield$fetch$js, videos;
139
-
140
- return _regeneratorRuntime.wrap(function _callee$(_context) {
141
- while (1) {
142
- switch (_context.prev = _context.next) {
143
- case 0:
144
- if (posterImage) {
145
- _context.next = 8;
146
- break;
147
- }
148
-
116
+ return _regeneratorRuntime.wrap(function (_context) {
117
+ while (1) switch (_context.prev = _context.next) {
118
+ case 0:
119
+ if (posterImage) {
149
120
  _context.next = 3;
150
- return fetch("https://edge.api.brightcove.com/playback/v1/accounts/".concat(accountId, "/videos?q=id:").concat(videoId), {
151
- headers: {
152
- "BCOV-Policy": policyKey
153
- }
154
- });
155
-
156
- case 3:
157
- _context.next = 5;
158
- return _context.sent.json();
159
-
160
- case 5:
161
- _yield$yield$fetch$js = _context.sent;
162
- videos = _yield$yield$fetch$js.videos;
163
- setPosterImage(videos[0].poster || "");
164
-
165
- case 8:
166
- case "end":
167
- return _context.stop();
168
- }
121
+ break;
122
+ }
123
+ _context.next = 1;
124
+ return fetch("https://edge.api.brightcove.com/playback/v1/accounts/".concat(accountId, "/videos?q=id:").concat(videoId), {
125
+ headers: {
126
+ "BCOV-Policy": policyKey
127
+ }
128
+ });
129
+ case 1:
130
+ _context.next = 2;
131
+ return _context.sent.json();
132
+ case 2:
133
+ _yield$yield$fetch$js = _context.sent;
134
+ videos = _yield$yield$fetch$js.videos;
135
+ setPosterImage(videos[0].poster || "");
136
+ case 3:
137
+ case "end":
138
+ return _context.stop();
169
139
  }
170
140
  }, _callee);
171
141
  }));
172
-
173
142
  return function getPoster() {
174
143
  return _ref.apply(this, arguments);
175
144
  };
176
145
  }();
177
-
178
146
  if (loadIframeOnClick) {
179
147
  var _window3;
180
-
181
148
  if (!showVideo) {
182
149
  getPoster();
183
150
  }
184
-
185
151
  return /*#__PURE__*/React.createElement("div", {
186
152
  className: "brightcove-wrapper",
187
153
  ref: videoRef
188
154
  }, !showVideo && /*#__PURE__*/React.createElement("div", {
189
- onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
190
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
191
- while (1) {
192
- switch (_context2.prev = _context2.next) {
193
- case 0:
194
- _context2.next = 2;
195
- return loadLibrary();
196
-
197
- case 2:
198
- setThumbnailClicked(true);
199
-
200
- case 3:
201
- case "end":
202
- return _context2.stop();
203
- }
155
+ onClick: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
156
+ return _regeneratorRuntime.wrap(function (_context2) {
157
+ while (1) switch (_context2.prev = _context2.next) {
158
+ case 0:
159
+ _context2.next = 1;
160
+ return loadLibrary();
161
+ case 1:
162
+ setThumbnailClicked(true);
163
+ case 2:
164
+ case "end":
165
+ return _context2.stop();
204
166
  }
205
167
  }, _callee2);
206
168
  }))
@@ -223,7 +185,6 @@ var BrightcoveElement = function BrightcoveElement(props) {
223
185
  return null;
224
186
  }
225
187
  };
226
-
227
188
  var StoryElementBrightcove = function StoryElementBrightcove(props) {
228
189
  return /*#__PURE__*/React.createElement(WithLazy, {
229
190
  margin: "0px"
@@ -231,5 +192,4 @@ var StoryElementBrightcove = function StoryElementBrightcove(props) {
231
192
  return /*#__PURE__*/React.createElement(BrightcoveElement, props);
232
193
  });
233
194
  };
234
-
235
195
  export default StoryElementBrightcove;