@mjhls/mjh-framework 1.0.1001-popup-polls → 1.0.1001

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 (151) hide show
  1. package/dist/cjs/AD.js +1 -1
  2. package/dist/cjs/AD300x250.js +2 -3
  3. package/dist/cjs/AD300x250x600.js +2 -3
  4. package/dist/cjs/AD728x90.js +2 -3
  5. package/dist/cjs/ADFloatingFooter.js +2 -3
  6. package/dist/cjs/ADGutter.js +2 -3
  7. package/dist/cjs/ADSkyscraper.js +2 -3
  8. package/dist/cjs/ADSponsoredResources.js +2 -3
  9. package/dist/cjs/ADWebcast.js +2 -3
  10. package/dist/cjs/ADWelcome.js +2 -3
  11. package/dist/cjs/AdSlot.js +2 -3
  12. package/dist/cjs/AdSlotsProvider.js +2 -3
  13. package/dist/cjs/AlgoliaSearch.js +1068 -521
  14. package/dist/cjs/ArticleCarousel.js +1 -1
  15. package/dist/cjs/ArticleProgramLandingPage.js +5 -7
  16. package/dist/cjs/ArticleSeriesLandingPage.js +4 -5
  17. package/dist/cjs/ArticleSeriesListing.js +2 -3
  18. package/dist/cjs/Auth.js +40 -11
  19. package/dist/cjs/AuthWrapper.js +89 -19
  20. package/dist/cjs/CMEDeck.js +2 -3
  21. package/dist/cjs/Column3.js +2 -3
  22. package/dist/cjs/ContentCardPaginated.js +4 -5
  23. package/dist/cjs/DeckContent.js +3 -4
  24. package/dist/cjs/DeckQueue.js +2 -3
  25. package/dist/cjs/DeckQueuePaginated.js +3 -4
  26. package/dist/cjs/{Dfp-c313a700.js → Dfp-67646058.js} +1 -2
  27. package/dist/cjs/EventsDeck.js +2 -2
  28. package/dist/cjs/ExternalResources.js +6 -8
  29. package/dist/cjs/Feature.js +1 -1
  30. package/dist/cjs/GridContent.js +4 -5
  31. package/dist/cjs/GridContentPaginated.js +5 -6
  32. package/dist/cjs/HamMagazine.js +2 -2
  33. package/dist/cjs/HorizontalArticleListing.js +5 -7
  34. package/dist/cjs/{ImageSlider-17fdaf3b.js → ImageSlider-1ec0408b.js} +156 -116
  35. package/dist/cjs/IssueLanding.js +7 -9
  36. package/dist/cjs/LeftNav.js +2 -3
  37. package/dist/cjs/MasterDeck.js +4 -5
  38. package/dist/cjs/MasterDeckPaginated.js +5 -6
  39. package/dist/cjs/{MediaSeriesCard-eacea66a.js → MediaSeriesCard-78f709ca.js} +1 -1
  40. package/dist/cjs/MediaSeriesLanding.js +9 -11
  41. package/dist/cjs/MediaSeriesLandingPaginated.js +10 -12
  42. package/dist/cjs/NavMagazine.js +2 -2
  43. package/dist/cjs/NavNative.js +1 -1
  44. package/dist/cjs/{Pagination-842c556f.js → Pagination-6359861a.js} +1 -1
  45. package/dist/cjs/PartnerDetailListing.js +8 -11
  46. package/dist/cjs/PartnerDetailListingPaginated.js +9 -12
  47. package/dist/cjs/PodcastsLanding.js +7 -9
  48. package/dist/cjs/PubSection.js +4 -5
  49. package/dist/cjs/QueueDeckExpanded.js +4 -5
  50. package/dist/cjs/QueueDeckExpandedPaginated.js +5 -6
  51. package/dist/cjs/SeriesListingDeck.js +3 -4
  52. package/dist/cjs/{SeriesSlider-3d57985d.js → SeriesSlider-18fc6e71.js} +1 -1
  53. package/dist/cjs/{SocialSearchComponent-62bceb87.js → SocialSearchComponent-ca9c0c45.js} +1 -1
  54. package/dist/cjs/TaxonomyDescription.js +5 -7
  55. package/dist/cjs/TemplateNormal.js +3 -4
  56. package/dist/cjs/{Tooltip-4cb8849a.js → Tooltip-71754b2a.js} +355 -272
  57. package/dist/cjs/Ustream.js +1 -1
  58. package/dist/cjs/VideoProgramLandingPage.js +5 -7
  59. package/dist/cjs/VideoSeriesLandingPage.js +4 -5
  60. package/dist/cjs/VideoSeriesListing.js +2 -3
  61. package/dist/cjs/View.js +5 -6
  62. package/dist/cjs/YoutubeGroup.js +1 -1
  63. package/dist/cjs/getSerializers.js +5 -7
  64. package/dist/cjs/{index-d2a6ef75.js → index-7435b964.js} +467 -2
  65. package/dist/cjs/{index-f86bb269.js → index-96c331fd.js} +53 -52
  66. package/dist/cjs/index-b95410f0.js +54 -0
  67. package/dist/cjs/{index-19fbbcea.js → index-e4f1fe32.js} +99 -161
  68. package/dist/cjs/index.js +10 -13
  69. package/dist/cjs/{main-3643d499.js → main-6054981e.js} +4 -9
  70. package/dist/esm/AD.js +1 -1
  71. package/dist/esm/AD300x250.js +2 -3
  72. package/dist/esm/AD300x250x600.js +2 -3
  73. package/dist/esm/AD728x90.js +2 -3
  74. package/dist/esm/ADFloatingFooter.js +2 -3
  75. package/dist/esm/ADGutter.js +2 -3
  76. package/dist/esm/ADSkyscraper.js +2 -3
  77. package/dist/esm/ADSponsoredResources.js +2 -3
  78. package/dist/esm/ADWebcast.js +2 -3
  79. package/dist/esm/ADWelcome.js +2 -3
  80. package/dist/esm/AdSlot.js +2 -3
  81. package/dist/esm/AdSlotsProvider.js +2 -3
  82. package/dist/esm/AlgoliaSearch.js +1065 -518
  83. package/dist/esm/ArticleCarousel.js +1 -1
  84. package/dist/esm/ArticleProgramLandingPage.js +5 -7
  85. package/dist/esm/ArticleSeriesLandingPage.js +4 -5
  86. package/dist/esm/ArticleSeriesListing.js +2 -3
  87. package/dist/esm/Auth.js +40 -11
  88. package/dist/esm/AuthWrapper.js +86 -16
  89. package/dist/esm/CMEDeck.js +2 -3
  90. package/dist/esm/Column3.js +2 -3
  91. package/dist/esm/ContentCardPaginated.js +4 -5
  92. package/dist/esm/DeckContent.js +3 -4
  93. package/dist/esm/DeckQueue.js +2 -3
  94. package/dist/esm/DeckQueuePaginated.js +3 -4
  95. package/dist/esm/{Dfp-102f0beb.js → Dfp-cf85d203.js} +1 -2
  96. package/dist/esm/EventsDeck.js +2 -2
  97. package/dist/esm/ExternalResources.js +6 -8
  98. package/dist/esm/Feature.js +1 -1
  99. package/dist/esm/GridContent.js +4 -5
  100. package/dist/esm/GridContentPaginated.js +5 -6
  101. package/dist/esm/HamMagazine.js +2 -2
  102. package/dist/esm/HorizontalArticleListing.js +5 -7
  103. package/dist/esm/{ImageSlider-f84174cb.js → ImageSlider-83913c4c.js} +157 -117
  104. package/dist/esm/IssueLanding.js +7 -9
  105. package/dist/esm/LeftNav.js +2 -3
  106. package/dist/esm/MasterDeck.js +4 -5
  107. package/dist/esm/MasterDeckPaginated.js +5 -6
  108. package/dist/esm/{MediaSeriesCard-f56c8274.js → MediaSeriesCard-db0176b5.js} +1 -1
  109. package/dist/esm/MediaSeriesLanding.js +9 -11
  110. package/dist/esm/MediaSeriesLandingPaginated.js +10 -12
  111. package/dist/esm/NavMagazine.js +2 -2
  112. package/dist/esm/NavNative.js +1 -1
  113. package/dist/esm/{Pagination-dc30727b.js → Pagination-9fe9f61d.js} +1 -1
  114. package/dist/esm/PartnerDetailListing.js +8 -11
  115. package/dist/esm/PartnerDetailListingPaginated.js +9 -12
  116. package/dist/esm/PodcastsLanding.js +7 -9
  117. package/dist/esm/PubSection.js +4 -5
  118. package/dist/esm/QueueDeckExpanded.js +4 -5
  119. package/dist/esm/QueueDeckExpandedPaginated.js +5 -6
  120. package/dist/esm/SeriesListingDeck.js +3 -4
  121. package/dist/esm/{SeriesSlider-f771e20d.js → SeriesSlider-5728e349.js} +1 -1
  122. package/dist/esm/{SocialSearchComponent-165b4ae7.js → SocialSearchComponent-68d948b9.js} +1 -1
  123. package/dist/esm/TaxonomyDescription.js +5 -7
  124. package/dist/esm/TemplateNormal.js +3 -4
  125. package/dist/esm/{Tooltip-95655b44.js → Tooltip-8307d9d1.js} +150 -67
  126. package/dist/esm/Ustream.js +1 -1
  127. package/dist/esm/VideoProgramLandingPage.js +5 -7
  128. package/dist/esm/VideoSeriesLandingPage.js +4 -5
  129. package/dist/esm/VideoSeriesListing.js +2 -3
  130. package/dist/esm/View.js +5 -6
  131. package/dist/esm/YoutubeGroup.js +1 -1
  132. package/dist/esm/getSerializers.js +5 -7
  133. package/dist/esm/index-174b5baf.js +52 -0
  134. package/dist/esm/{index-79cfd25c.js → index-30a6257d.js} +53 -52
  135. package/dist/esm/{index-5d8b0a9d.js → index-3bb56969.js} +99 -161
  136. package/dist/esm/{index-f0fc23eb.js → index-5cc7b406.js} +466 -1
  137. package/dist/esm/index.js +10 -13
  138. package/dist/esm/{main-1894c974.js → main-9f6806ea.js} +4 -9
  139. package/package.json +1 -1
  140. package/dist/cjs/defineProperty-e0fb52c5.js +0 -73
  141. package/dist/cjs/events-1b438fe7.js +0 -469
  142. package/dist/cjs/index-50be6759.js +0 -105
  143. package/dist/cjs/typeof-1358762e.js +0 -33
  144. package/dist/esm/defineProperty-23a8f8cd.js +0 -68
  145. package/dist/esm/events-6c3a7a63.js +0 -467
  146. package/dist/esm/index-98ca9cec.js +0 -100
  147. package/dist/esm/typeof-2f07d0e8.js +0 -30
  148. /package/dist/cjs/{ADInfeed-0394f391.js → ADInfeed-ef933a08.js} +0 -0
  149. /package/dist/cjs/{ADlgInfeed-759969d6.js → ADlgInfeed-0e931f24.js} +0 -0
  150. /package/dist/esm/{ADInfeed-5765a73a.js → ADInfeed-f946441a.js} +0 -0
  151. /package/dist/esm/{ADlgInfeed-5e36f317.js → ADlgInfeed-012e6f16.js} +0 -0
@@ -2,7 +2,7 @@ import React__default, { useState, useEffect, useRef, useLayoutEffect, useCallba
2
2
  import { _ as _slicedToArray, a as _getIterator } from './slicedToArray-6ebcbfea.js';
3
3
  import { Carousel, Table, Figure as Figure$1, Card, Row, Col, Button as Button$1, ProgressBar } from 'react-bootstrap';
4
4
  import urlFor from './urlFor.js';
5
- import { l as lib_3 } from './index-f0fc23eb.js';
5
+ import { l as lib_3 } from './index-5cc7b406.js';
6
6
  import Router, { useRouter } from 'next/router';
7
7
  import { g as getYoutubeId } from './index-c7e2ac95.js';
8
8
  import PropTypes from 'prop-types';
@@ -10,7 +10,7 @@ import { c as createCommonjsModule, u as unwrapExports } from './_commonjsHelper
10
10
  import { u as util } from './util-8ed16d48.js';
11
11
  import './Beam.js';
12
12
  import Segment from './Segment.js';
13
- import { e as main_18, b as main_42, m as main_43 } from './main-1894c974.js';
13
+ import { e as main_18, b as main_42, m as main_43 } from './main-9f6806ea.js';
14
14
  import { B as BlockContent } from './BlockContent-1e73bd2c.js';
15
15
  import { _ as _extends, b as _extends$1 } from './extends-6d8e3924.js';
16
16
  import { u as urlForFile } from './urlForFile-b69adffc.js';
@@ -19,9 +19,6 @@ import { _ as _asyncToGenerator, r as regenerator } from './asyncToGenerator-958
19
19
  import { _ as _typeof$1 } from './typeof-e9fc0c5d.js';
20
20
  import { R as ReactPlayerLoader } from './brightcove-react-player-loader.es-57a70a56.js';
21
21
  import { _ as _JSON$stringify } from './stringify-2b084bee.js';
22
- import { _ as _export, a as _core } from './core.get-iterator-method-ea258bb1.js';
23
- import { _ as _objectToArray } from './_object-to-array-2300e51b.js';
24
- import { _ as _Object$keys } from './keys-31dcdb31.js';
25
22
  import Modal from 'react-bootstrap/Modal';
26
23
  import Button from 'react-bootstrap/Button';
27
24
  import Form from 'react-bootstrap/Form';
@@ -29,6 +26,8 @@ import ReactGA from 'react-ga';
29
26
  import GroupDeck from './GroupDeck.js';
30
27
  import { m as moment } from './moment-bc12cb97.js';
31
28
  import SocialShare from './SocialShare.js';
29
+ import { _ as _export, a as _core } from './core.get-iterator-method-ea258bb1.js';
30
+ import { _ as _objectToArray } from './_object-to-array-2300e51b.js';
32
31
  import { a as _Array$from, _ as _toConsumableArray } from './toConsumableArray-f7074d7c.js';
33
32
  import Pagination from 'react-bootstrap/Pagination';
34
33
  import { h as html_decode_1 } from './entities-6d9154b4.js';
@@ -1629,13 +1628,11 @@ function shouldUpdateVideo(prevProps, props) {
1629
1628
 
1630
1629
  function filterResetOptions(opts) {
1631
1630
  return _objectSpread(_objectSpread({}, opts), {}, {
1632
- height: 0,
1633
- width: 0,
1634
- playerVars: _objectSpread(_objectSpread({}, opts.playerVars), {}, {
1631
+ playerVars: _objectSpread({
1635
1632
  autoplay: 0,
1636
1633
  start: 0,
1637
1634
  end: 0
1638
- })
1635
+ }, opts.playerVars)
1639
1636
  });
1640
1637
  }
1641
1638
  /**
@@ -1650,7 +1647,7 @@ function filterResetOptions(opts) {
1650
1647
 
1651
1648
 
1652
1649
  function shouldResetPlayer(prevProps, props) {
1653
- return prevProps.videoId !== props.videoId || !fastDeepEqual(filterResetOptions(prevProps.opts), filterResetOptions(props.opts));
1650
+ return !fastDeepEqual(filterResetOptions(prevProps.opts), filterResetOptions(props.opts));
1654
1651
  }
1655
1652
  /**
1656
1653
  * Check whether a props change should result in an id or className update.
@@ -1661,7 +1658,7 @@ function shouldResetPlayer(prevProps, props) {
1661
1658
 
1662
1659
 
1663
1660
  function shouldUpdatePlayer(prevProps, props) {
1664
- return prevProps.id !== props.id || prevProps.className !== props.className || prevProps.opts.width !== props.opts.width || prevProps.opts.height !== props.opts.height || prevProps.title !== props.title;
1661
+ return prevProps.id !== props.id || prevProps.className !== props.className;
1665
1662
  }
1666
1663
 
1667
1664
  var YouTube = /*#__PURE__*/function (_React$Component) {
@@ -1748,9 +1745,6 @@ var YouTube = /*#__PURE__*/function (_React$Component) {
1748
1745
  _this.internalPlayer.getIframe().then(function (iframe) {
1749
1746
  if (_this.props.id) iframe.setAttribute('id', _this.props.id);else iframe.removeAttribute('id');
1750
1747
  if (_this.props.className) iframe.setAttribute('class', _this.props.className);else iframe.removeAttribute('class');
1751
- if (_this.props.opts && _this.props.opts.width) iframe.setAttribute('width', _this.props.opts.width);else iframe.removeAttribute('width');
1752
- if (_this.props.opts && _this.props.opts.height) iframe.setAttribute('height', _this.props.opts.height);else iframe.removeAttribute('height');
1753
- if (typeof _this.props.title === 'string') iframe.setAttribute('title', _this.props.title);else iframe.setAttribute('title', 'YouTube video player');
1754
1748
  });
1755
1749
  });
1756
1750
 
@@ -1849,8 +1843,7 @@ var YouTube = /*#__PURE__*/function (_React$Component) {
1849
1843
  }, /*#__PURE__*/React__default.createElement("div", {
1850
1844
  id: this.props.id,
1851
1845
  className: this.props.className,
1852
- ref: this.refContainer,
1853
- loading: this.props.loading
1846
+ ref: this.refContainer
1854
1847
  }));
1855
1848
  }
1856
1849
  }]);
@@ -1875,10 +1868,6 @@ YouTube.propTypes = {
1875
1868
  className: PropTypes.string,
1876
1869
  // custom class name for player container element
1877
1870
  containerClassName: PropTypes.string,
1878
- // custom title for the iFrame, see https://www.w3.org/TR/WCAG20-TECHS/H64.html
1879
- title: PropTypes.string,
1880
- // custom loading for player element
1881
- loading: PropTypes.oneOf(['lazy', 'eager', 'auto']),
1882
1871
  // https://developers.google.com/youtube/iframe_api_reference#Loading_a_Video_Player
1883
1872
  opts: PropTypes.objectOf(PropTypes.any),
1884
1873
  // event subscriptions
@@ -1895,7 +1884,6 @@ YouTube.defaultProps = {
1895
1884
  videoId: null,
1896
1885
  id: null,
1897
1886
  className: null,
1898
- loading: null,
1899
1887
  opts: {},
1900
1888
  containerClassName: '',
1901
1889
  onReady: function onReady() {},
@@ -1905,8 +1893,7 @@ YouTube.defaultProps = {
1905
1893
  onEnd: function onEnd() {},
1906
1894
  onStateChange: function onStateChange() {},
1907
1895
  onPlaybackRateChange: function onPlaybackRateChange() {},
1908
- onPlaybackQualityChange: function onPlaybackQualityChange() {},
1909
- title: null
1896
+ onPlaybackQualityChange: function onPlaybackQualityChange() {}
1910
1897
  };
1911
1898
 
1912
1899
  var YouTubePlayer = function YouTubePlayer(_ref) {
@@ -2212,24 +2199,6 @@ var IFrame = function IFrame(_ref) {
2212
2199
  );
2213
2200
  };
2214
2201
 
2215
- // https://github.com/tc39/proposal-object-values-entries
2216
-
2217
- var $values = _objectToArray(false);
2218
-
2219
- _export(_export.S, 'Object', {
2220
- values: function values(it) {
2221
- return $values(it);
2222
- }
2223
- });
2224
-
2225
- var values$1 = _core.Object.values;
2226
-
2227
- var values = createCommonjsModule(function (module) {
2228
- module.exports = { "default": values$1, __esModule: true };
2229
- });
2230
-
2231
- var _Object$values = unwrapExports(values);
2232
-
2233
2202
  var PopupMultiChoice = function PopupMultiChoice(_ref) {
2234
2203
  var question = _ref.question,
2235
2204
  choices = _ref.choices,
@@ -2240,7 +2209,7 @@ var PopupMultiChoice = function PopupMultiChoice(_ref) {
2240
2209
  inline: true,
2241
2210
  label: choice.choiceText,
2242
2211
  value: choice.choiceText,
2243
- name: question,
2212
+ name: 'radioButton',
2244
2213
  type: 'radio',
2245
2214
  className: 'radioButton',
2246
2215
  onClick: handlePollAnswer
@@ -2310,15 +2279,10 @@ var PopupPollModal = function PopupPollModal(props) {
2310
2279
  pollAnswer = _useState2[0],
2311
2280
  setPollAnswer = _useState2[1];
2312
2281
 
2313
- var _useState3 = useState({}),
2282
+ var _useState3 = useState(''),
2314
2283
  _useState4 = _slicedToArray(_useState3, 2),
2315
- multiItemPollAnswers = _useState4[0],
2316
- setMultiItemPollAnswers = _useState4[1];
2317
-
2318
- var _useState5 = useState(''),
2319
- _useState6 = _slicedToArray(_useState5, 2),
2320
- textAnswer = _useState6[0],
2321
- setTextAnswer = _useState6[1];
2284
+ textAnswer = _useState4[0],
2285
+ setTextAnswer = _useState4[1];
2322
2286
 
2323
2287
  useEffect(function () {
2324
2288
  var modal = document.getElementById('modalDiv');
@@ -2333,98 +2297,77 @@ var PopupPollModal = function PopupPollModal(props) {
2333
2297
  setPollAnswer(e.target.value);
2334
2298
  };
2335
2299
 
2336
- var handleMultiItemPollAnswers = function handleMultiItemPollAnswers(e) {
2337
- var question = e.target.name;
2338
- var answer = e.target.value;
2339
- var tempObj = {};
2340
- tempObj[question] = answer;
2341
- setMultiItemPollAnswers(function (prev) {
2342
- return _extends({}, prev, tempObj);
2343
- });
2344
- };
2345
-
2346
2300
  var handleSubmit = function handleSubmit(e) {
2347
2301
  var currentDate = new Date(Date.now()).toUTCString();
2348
2302
  // eslint-disable-next-line no-undef
2349
2303
  var anonymousID = typeof analytics !== 'undefined' && typeof analytics.user === 'function' && analytics.user() && analytics.user().anonymousId();
2350
- var formData = {};
2351
-
2352
2304
  pollItems.forEach(function (item) {
2353
- formData = {
2305
+ var submitAnswer = void 0;
2306
+ if (item.format === 'multiChoice') submitAnswer = pollAnswer;
2307
+ if (item.format === 'textInput') submitAnswer = textAnswer;
2308
+ var formData = {
2354
2309
  uuid: anonymousID,
2355
2310
  url: pollUrl,
2356
2311
  date: currentDate,
2357
- questionsArray: _Object$keys(multiItemPollAnswers),
2358
- answersArray: _Object$values(multiItemPollAnswers)
2312
+ question: item.question,
2313
+ answer: submitAnswer
2359
2314
  };
2360
- item.question ? formData.question = item.question : null;
2361
- pollAnswer && item.format === 'multiChoice' ? formData.answer = pollAnswer : pollAnswer && item.format === 'textInput' ? formData.answer = textAnswer : null;
2362
- _Object$keys(multiItemPollAnswers).length > 0 ? formData.multiItemQandA = multiItemPollAnswers : null;
2363
- });
2364
- var requestOptions = {
2365
- method: 'POST',
2366
- headers: { 'content-type': 'application/json' },
2367
- body: _JSON$stringify({ data: formData })
2368
- };
2369
- var insertData = function () {
2370
- var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
2371
- return regenerator.wrap(function _callee$(_context) {
2372
- while (1) {
2373
- switch (_context.prev = _context.next) {
2374
- case 0:
2375
- _context.prev = 0;
2376
- _context.next = 3;
2377
- return fetch('/api/popup_polls', requestOptions).then(function (res) {
2378
- return res.json();
2379
- }).then(function (res) {
2380
- return console.log(res);
2381
- });
2382
-
2383
- case 3:
2384
- _context.next = 8;
2385
- break;
2386
-
2387
- case 5:
2388
- _context.prev = 5;
2389
- _context.t0 = _context['catch'](0);
2390
-
2391
- if (_context.t0) console.log('There was an error in insertData in PopupPollModal.js: ' + _context.t0);
2392
-
2393
- case 8:
2394
- case 'end':
2395
- return _context.stop();
2315
+ var requestOptions = {
2316
+ method: 'POST',
2317
+ headers: { 'content-type': 'application/json' },
2318
+ body: _JSON$stringify({ data: formData })
2319
+ };
2320
+ var insertData = function () {
2321
+ var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
2322
+ return regenerator.wrap(function _callee$(_context) {
2323
+ while (1) {
2324
+ switch (_context.prev = _context.next) {
2325
+ case 0:
2326
+ _context.prev = 0;
2327
+ _context.next = 3;
2328
+ return fetch('/api/popup_polls', requestOptions).then(function (res) {
2329
+ return res.json();
2330
+ }).then(function (res) {
2331
+ return console.log(res);
2332
+ });
2333
+
2334
+ case 3:
2335
+ _context.next = 8;
2336
+ break;
2337
+
2338
+ case 5:
2339
+ _context.prev = 5;
2340
+ _context.t0 = _context['catch'](0);
2341
+
2342
+ if (_context.t0) console.log('There was an error in insertData in PopupPollModal.js: ' + _context.t0);
2343
+
2344
+ case 8:
2345
+ case 'end':
2346
+ return _context.stop();
2347
+ }
2396
2348
  }
2397
- }
2398
- }, _callee, _this, [[0, 5]]);
2399
- }));
2349
+ }, _callee, _this, [[0, 5]]);
2350
+ }));
2400
2351
 
2401
- return function insertData() {
2402
- return _ref.apply(this, arguments);
2403
- };
2404
- }();
2405
- // console.log('formData', formData)
2406
- insertData();
2352
+ return function insertData() {
2353
+ return _ref.apply(this, arguments);
2354
+ };
2355
+ }();
2356
+ console.log('formData', formData);
2357
+ insertData();
2358
+ });
2407
2359
  restartPlayer();
2360
+ // setIsPollingTime(false)
2408
2361
  e.preventDefault();
2409
2362
  };
2410
2363
 
2411
2364
  var pollArray = [];
2412
-
2413
2365
  pollItems.forEach(function (item, ind) {
2414
- if (!item.atStart) {
2415
- if (item.format === 'multiChoice') {
2416
- pollArray.push(React__default.createElement(PopupMultiChoice, { question: item.question, choices: item.choices, handlePollAnswer: handlePollAnswer, key: ind }));
2417
- }
2418
- if (item.format === 'textInput') {
2419
- pollArray.push(React__default.createElement(PopupPollTextInput, { textInputQuestion: item.question, textanswer: textAnswer, handleTextAnswer: handleTextAnswer, key: ind }));
2420
- }
2421
- } else {
2422
- if (item.pollItems[0] && item.pollItems[0].format === 'multiChoice') {
2423
- pollArray.push(React__default.createElement(PopupMultiChoice, { question: item.pollItems[0].question, choices: item.pollItems[0].choices, handlePollAnswer: handleMultiItemPollAnswers, key: ind }));
2424
- }
2425
- if (item.pollItems[0] && item.pollItems[0].format === 'textInput') {
2426
- pollArray.push(React__default.createElement(PopupPollTextInput, { textInputQuestion: item.pollItems[0].question, textanswer: textAnswer, handleTextAnswer: handleTextAnswer, key: ind }));
2427
- }
2366
+ if (item.format === 'multiChoice') {
2367
+ pollArray.push(React__default.createElement(PopupMultiChoice, { question: item.question, choices: item.choices, handlePollAnswer: handlePollAnswer, key: ind }));
2368
+ }
2369
+ if (item.format === 'textInput') {
2370
+ pollArray.push(React__default.createElement(PopupPollTextInput, { textInputQuestion: item.question, textanswer: textAnswer, handleTextAnswer: handleTextAnswer, key: ind }));
2428
2371
  }
2429
2372
  });
2430
2373
 
@@ -2433,10 +2376,7 @@ var PopupPollModal = function PopupPollModal(props) {
2433
2376
  { className: 'modalDiv', id: 'modalDiv' },
2434
2377
  React__default.createElement(
2435
2378
  Modal.Dialog,
2436
- { className: pollItems.length > 1 ? 'modal-dialog-overflow' : null, scrollable: pollItems.length > 1 },
2437
- props.closeable && React__default.createElement(Modal.Header, { closeButton: true, onClick: function onClick() {
2438
- return restartPlayer();
2439
- } }),
2379
+ null,
2440
2380
  React__default.createElement(
2441
2381
  Modal.Body,
2442
2382
  null,
@@ -2448,13 +2388,9 @@ var PopupPollModal = function PopupPollModal(props) {
2448
2388
  Button,
2449
2389
  { className: 'submitButton', type: 'submit', variant: 'success', disabled: !textAnswer },
2450
2390
  'Submit'
2451
- ) : !textInputRender && multiChoiceRender ? React__default.createElement(
2452
- Button,
2453
- { className: 'submitButton', type: 'submit', variant: 'success', disabled: !pollAnswer },
2454
- 'Submit'
2455
2391
  ) : React__default.createElement(
2456
2392
  Button,
2457
- { className: 'submitButton', type: 'submit', variant: 'success' },
2393
+ { className: 'submitButton', type: 'submit', variant: 'success', disabled: !pollAnswer },
2458
2394
  'Submit'
2459
2395
  )
2460
2396
  )
@@ -2674,7 +2610,6 @@ var Video = function Video(_ref) {
2674
2610
  experienceID = node.experienceID;
2675
2611
 
2676
2612
  var polls = void 0;
2677
-
2678
2613
  if (node.polls) polls = node.polls;
2679
2614
 
2680
2615
  var _useState = useState(false),
@@ -2719,16 +2654,10 @@ var Video = function Video(_ref) {
2719
2654
  return minutes * 60 + seconds;
2720
2655
  };
2721
2656
  var modalTimes = [];
2722
- var initPolls = [];
2723
- var nonInitPolls = [];
2724
2657
  if (polls) {
2725
2658
  polls.forEach(function (pollObj) {
2726
- return pollObj.timestamp !== '0:00' && pollObj.timestamp !== '00:00' ? modalTimes.push(convertTime(pollObj.timestamp)) : null;
2659
+ return modalTimes.push(convertTime(pollObj.timestamp));
2727
2660
  });
2728
- polls.forEach(function (pollObj) {
2729
- return pollObj.atStart ? initPolls.push(pollObj) : nonInitPolls.push(pollObj);
2730
- });
2731
- if (nonInitPolls.length > 0) polls = nonInitPolls;
2732
2661
  }
2733
2662
 
2734
2663
  var restartPlayer = function restartPlayer() {
@@ -2803,14 +2732,7 @@ var Video = function Video(_ref) {
2803
2732
  return _ref2.apply(this, arguments);
2804
2733
  };
2805
2734
  }();
2806
- // console.log('initPolls', initPolls)
2807
- if (initPolls.length > 0) {
2808
- player.pause();
2809
- setPollItems(initPolls);
2810
- setPollUrl(targeting.document_url[0]);
2811
- setIsPollingTime(true);
2812
- initPolls = [];
2813
- }
2735
+
2814
2736
  if (autoplay) {
2815
2737
  autoPlayVideo();
2816
2738
  }
@@ -2818,15 +2740,20 @@ var Video = function Video(_ref) {
2818
2740
  // Beam.report_beam_video('Ready', deviceType, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID)
2819
2741
  Segment.report_video_event('Video Ready', main_18, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID);
2820
2742
  });
2821
-
2743
+ // let intId
2744
+ // const convertTime = (timeStr) => {
2745
+ // const minutes = parseInt(timeStr.slice(0, 2))
2746
+ // const seconds = parseInt(timeStr.slice(3))
2747
+ // return minutes * 60 + seconds
2748
+ // }
2749
+ // const modalTimes = []
2750
+ // polls.forEach(pollObj => modalTimes.push(convertTime(pollObj.timestamp)))
2822
2751
  player.on('play', function (evt) {
2823
- console.log('in player.on');
2824
2752
  var duration = player.mediainfo.duration;
2825
2753
  var current = player.currentTime();
2826
2754
  var queue = Math.floor(duration / 10);
2827
2755
  var segment = Math.floor(current / queue);
2828
-
2829
- if (polls && initPolls.length === 0) {
2756
+ if (polls) {
2830
2757
  var vidPlayer = this;
2831
2758
  intId = setInterval(function () {
2832
2759
  var ct = player.currentTime();
@@ -2927,8 +2854,6 @@ var Video = function Video(_ref) {
2927
2854
  , textInputRender: textInputRender
2928
2855
  // eslint-disable-next-line react/jsx-indent-props
2929
2856
  , multiChoiceRender: multiChoiceRender
2930
- // eslint-disable-next-line react/jsx-indent-props
2931
- , closeable: node.polls && node.polls[0] ? node.polls[0].closeable : null
2932
2857
  }) : null,
2933
2858
  React__default.createElement(ReactPlayerLoader, {
2934
2859
  onSuccess: onVideoSuccess,
@@ -2961,8 +2886,6 @@ var Video = function Video(_ref) {
2961
2886
  , textInputRender: textInputRender
2962
2887
  // eslint-disable-next-line react/jsx-indent-props
2963
2888
  , multiChoiceRender: multiChoiceRender
2964
- // eslint-disable-next-line react/jsx-indent-props
2965
- , closeable: node.polls && node.polls[0] ? node.polls[0].closeable : null
2966
2889
  }) : null,
2967
2890
  React__default.createElement(ReactPlayerLoader, {
2968
2891
  accountId: accountIDs.brightcove.accountId,
@@ -2996,9 +2919,6 @@ var Video = function Video(_ref) {
2996
2919
  , textInputRender: textInputRender
2997
2920
  // eslint-disable-next-line react/jsx-indent-props
2998
2921
  , multiChoiceRender: multiChoiceRender
2999
- // eslint-disable-next-line react/jsx-indent-props
3000
- , closeable: node.polls && node.polls[0] ? node.polls[0].closeable : null
3001
-
3002
2922
  }) : null
3003
2923
  );
3004
2924
  }
@@ -8215,6 +8135,24 @@ var Poll$1 = function Poll(_ref) {
8215
8135
  );
8216
8136
  };
8217
8137
 
8138
+ // https://github.com/tc39/proposal-object-values-entries
8139
+
8140
+ var $values = _objectToArray(false);
8141
+
8142
+ _export(_export.S, 'Object', {
8143
+ values: function values(it) {
8144
+ return $values(it);
8145
+ }
8146
+ });
8147
+
8148
+ var values$1 = _core.Object.values;
8149
+
8150
+ var values = createCommonjsModule(function (module) {
8151
+ module.exports = { "default": values$1, __esModule: true };
8152
+ });
8153
+
8154
+ var _Object$values = unwrapExports(values);
8155
+
8218
8156
  var Poll = function Poll(_ref) {
8219
8157
  var node = _ref.node;
8220
8158
  _ref.client;