@mjhls/mjh-framework 1.0.929 → 1.0.930

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 (32) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/ArticleProgramLandingPage.js +4 -2
  3. package/dist/cjs/ExternalResources.js +3 -1
  4. package/dist/cjs/HorizontalArticleListing.js +4 -2
  5. package/dist/cjs/IssueLanding.js +4 -2
  6. package/dist/cjs/{MediaSeriesCard-7dad50bb.js → MediaSeriesCard-6dd7dc87.js} +1 -1
  7. package/dist/cjs/MediaSeriesLanding.js +5 -3
  8. package/dist/cjs/MediaSeriesLandingPaginated.js +4 -2
  9. package/dist/cjs/PartnerDetailListing.js +4 -2
  10. package/dist/cjs/PartnerDetailListingPaginated.js +3 -1
  11. package/dist/cjs/TaxonomyDescription.js +4 -2
  12. package/dist/cjs/VideoProgramLandingPage.js +2 -1
  13. package/dist/cjs/View.js +2 -1
  14. package/dist/cjs/getSerializers.js +4 -2
  15. package/dist/cjs/{index-07f1af18.js → index-636dcd3f.js} +453 -27
  16. package/dist/cjs/index.js +1 -1
  17. package/dist/esm/ArticleProgramLandingPage.js +4 -2
  18. package/dist/esm/ExternalResources.js +3 -1
  19. package/dist/esm/HorizontalArticleListing.js +4 -2
  20. package/dist/esm/IssueLanding.js +4 -2
  21. package/dist/esm/{MediaSeriesCard-d514b9be.js → MediaSeriesCard-a40e4d77.js} +1 -1
  22. package/dist/esm/MediaSeriesLanding.js +5 -3
  23. package/dist/esm/MediaSeriesLandingPaginated.js +4 -2
  24. package/dist/esm/PartnerDetailListing.js +4 -2
  25. package/dist/esm/PartnerDetailListingPaginated.js +3 -1
  26. package/dist/esm/TaxonomyDescription.js +4 -2
  27. package/dist/esm/VideoProgramLandingPage.js +2 -1
  28. package/dist/esm/View.js +2 -1
  29. package/dist/esm/getSerializers.js +4 -2
  30. package/dist/esm/{index-c071590e.js → index-fa71969f.js} +454 -30
  31. package/dist/esm/index.js +1 -1
  32. package/package.json +2 -1
@@ -1,7 +1,7 @@
1
1
  import { _ as _extends, b as _extends$1 } from './extends-6d8e3924.js';
2
2
  import React__default, { useState, useEffect, useRef, useLayoutEffect, useCallback } from 'react';
3
3
  import { _ as _slicedToArray, a as _getIterator } from './slicedToArray-6ebcbfea.js';
4
- import { Carousel, Table, Figure as Figure$1, Card, Row, Col, Button, ProgressBar } from 'react-bootstrap';
4
+ import { Carousel, Table, Figure as Figure$1, Card, Row, Col, Button as Button$1, ProgressBar } from 'react-bootstrap';
5
5
  import urlFor from './urlFor.js';
6
6
  import { l as lib_3 } from './index-f0fc23eb.js';
7
7
  import Router, { useRouter } from 'next/router';
@@ -18,6 +18,10 @@ import { L as LazyLoad } from './index-755f2cc2.js';
18
18
  import { _ as _asyncToGenerator, r as regenerator } from './asyncToGenerator-958ef5fc.js';
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
+ import { _ as _JSON$stringify } from './stringify-2b084bee.js';
22
+ import Modal from 'react-bootstrap/Modal';
23
+ import Button from 'react-bootstrap/Button';
24
+ import Form from 'react-bootstrap/Form';
21
25
  import GroupDeck from './GroupDeck.js';
22
26
  import { m as moment } from './moment-bc12cb97.js';
23
27
  import SocialShare from './SocialShare.js';
@@ -25,7 +29,6 @@ import { _ as _export, a as _core } from './core.get-iterator-method-ea258bb1.js
25
29
  import { _ as _objectToArray } from './_object-to-array-2300e51b.js';
26
30
  import { a as _Array$from, _ as _toConsumableArray } from './toConsumableArray-f7074d7c.js';
27
31
  import Pagination from 'react-bootstrap/Pagination';
28
- import Button$1 from 'react-bootstrap/Button';
29
32
  import { h as html_decode_1 } from './entities-6d9154b4.js';
30
33
  import DFPAdSlot from './AdSlot.js';
31
34
  import Row$1 from 'react-bootstrap/Row';
@@ -2194,10 +2197,239 @@ var IFrame = function IFrame(_ref) {
2194
2197
  );
2195
2198
  };
2196
2199
 
2200
+ var PopupMultiChoice = function PopupMultiChoice(_ref) {
2201
+ var question = _ref.question,
2202
+ choices = _ref.choices,
2203
+ handlePollAnswer = _ref.handlePollAnswer;
2204
+
2205
+ var choiceArray = choices.map(function (choice) {
2206
+ return React__default.createElement(Form.Check, {
2207
+ inline: true,
2208
+ label: choice.choiceText,
2209
+ value: choice.choiceText,
2210
+ name: 'radioButton',
2211
+ type: 'radio',
2212
+ className: 'radioButton',
2213
+ onClick: handlePollAnswer
2214
+ });
2215
+ });
2216
+ return React__default.createElement(
2217
+ 'div',
2218
+ {
2219
+ key: 'inline-radio',
2220
+ className: 'mb-3' },
2221
+ React__default.createElement(
2222
+ 'h2',
2223
+ {
2224
+ className: 'radioLabelText'
2225
+ },
2226
+ question
2227
+ ),
2228
+ React__default.createElement(
2229
+ 'div',
2230
+ {
2231
+ className: 'multiChoiceDiv'
2232
+ },
2233
+ choiceArray
2234
+ )
2235
+ );
2236
+ };
2237
+
2238
+ var PopupPollTextInput = function PopupPollTextInput(_ref) {
2239
+ var textInputQuestion = _ref.textInputQuestion,
2240
+ textAnswer = _ref.textAnswer,
2241
+ handleTextAnswer = _ref.handleTextAnswer;
2242
+
2243
+ return React__default.createElement(
2244
+ 'div',
2245
+ {
2246
+ className: 'textInputDiv'
2247
+ },
2248
+ React__default.createElement(
2249
+ 'h2',
2250
+ {
2251
+ className: 'textInputQuestion'
2252
+ },
2253
+ textInputQuestion
2254
+ ),
2255
+ React__default.createElement(Form.Control, {
2256
+ type: 'text',
2257
+ className: 'textInput',
2258
+ value: textAnswer,
2259
+ placeholder: 'Your response',
2260
+ onChange: handleTextAnswer
2261
+ })
2262
+ );
2263
+ };
2264
+
2265
+ var _this = undefined;
2266
+ var fetch = require('node-fetch');
2267
+
2268
+ var PopupPollModal = function PopupPollModal(props) {
2269
+ var pollItems = props.pollItems,
2270
+ pollUrl = props.pollUrl,
2271
+ restartPlayer = props.restartPlayer,
2272
+ multiChoiceRender = props.multiChoiceRender,
2273
+ textInputRender = props.textInputRender;
2274
+
2275
+ var _useState = useState(''),
2276
+ _useState2 = _slicedToArray(_useState, 2),
2277
+ pollAnswer = _useState2[0],
2278
+ setPollAnswer = _useState2[1];
2279
+
2280
+ var _useState3 = useState(''),
2281
+ _useState4 = _slicedToArray(_useState3, 2),
2282
+ textAnswer = _useState4[0],
2283
+ setTextAnswer = _useState4[1];
2284
+
2285
+ useEffect(function () {
2286
+ var modal = document.getElementById('modalDiv');
2287
+ modal.style.visibility = 'visible';
2288
+ }, []);
2289
+
2290
+ var handleTextAnswer = function handleTextAnswer(e) {
2291
+ setTextAnswer(e.target.value);
2292
+ };
2293
+
2294
+ var handlePollAnswer = function handlePollAnswer(e) {
2295
+ setPollAnswer(e.target.value);
2296
+ };
2297
+
2298
+ var handleSubmit = function handleSubmit(e) {
2299
+ var currentDate = new Date(Date.now()).toUTCString();
2300
+ // eslint-disable-next-line no-undef
2301
+ var anonymousID = typeof analytics !== 'undefined' && typeof analytics.user === 'function' && analytics.user() && analytics.user().anonymousId();
2302
+ pollItems.forEach(function (item) {
2303
+ var submitAnswer = void 0;
2304
+ if (item.format === 'multiChoice') submitAnswer = pollAnswer;
2305
+ if (item.format === 'textInput') submitAnswer = textAnswer;
2306
+ var formData = {
2307
+ uuid: anonymousID,
2308
+ url: pollUrl,
2309
+ date: currentDate,
2310
+ question: item.question,
2311
+ answer: submitAnswer
2312
+ };
2313
+ var requestOptions = {
2314
+ method: 'POST',
2315
+ headers: { 'content-type': 'application/json' },
2316
+ body: _JSON$stringify({ data: formData })
2317
+ };
2318
+ var insertData = function () {
2319
+ var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
2320
+ return regenerator.wrap(function _callee$(_context) {
2321
+ while (1) {
2322
+ switch (_context.prev = _context.next) {
2323
+ case 0:
2324
+ _context.prev = 0;
2325
+ _context.next = 3;
2326
+ return fetch('/api/popup_polls', requestOptions).then(function (res) {
2327
+ return res.json();
2328
+ }).then(function (res) {
2329
+ return console.log(res);
2330
+ });
2331
+
2332
+ case 3:
2333
+ _context.next = 8;
2334
+ break;
2335
+
2336
+ case 5:
2337
+ _context.prev = 5;
2338
+ _context.t0 = _context['catch'](0);
2339
+
2340
+ if (_context.t0) console.log('There was an error in insertData in PopupPollModal.js: ' + _context.t0);
2341
+
2342
+ case 8:
2343
+ case 'end':
2344
+ return _context.stop();
2345
+ }
2346
+ }
2347
+ }, _callee, _this, [[0, 5]]);
2348
+ }));
2349
+
2350
+ return function insertData() {
2351
+ return _ref.apply(this, arguments);
2352
+ };
2353
+ }();
2354
+ console.log('formData', formData);
2355
+ insertData();
2356
+ });
2357
+ restartPlayer();
2358
+ // setIsPollingTime(false)
2359
+ e.preventDefault();
2360
+ };
2361
+
2362
+ var pollArray = [];
2363
+ pollItems.forEach(function (item, ind) {
2364
+ if (item.format === 'multiChoice') {
2365
+ pollArray.push(React__default.createElement(PopupMultiChoice, {
2366
+ question: item.question,
2367
+ choices: item.choices,
2368
+ handlePollAnswer: handlePollAnswer,
2369
+ key: ind
2370
+ }));
2371
+ }
2372
+ if (item.format === 'textInput') {
2373
+ pollArray.push(React__default.createElement(PopupPollTextInput, {
2374
+ textInputQuestion: item.question,
2375
+ textanswer: textAnswer,
2376
+ handleTextAnswer: handleTextAnswer,
2377
+ key: ind
2378
+ }));
2379
+ }
2380
+ });
2381
+
2382
+ return React__default.createElement(
2383
+ 'div',
2384
+ {
2385
+ className: 'modalDiv',
2386
+ id: 'modalDiv'
2387
+ },
2388
+ React__default.createElement(
2389
+ Modal.Dialog,
2390
+ null,
2391
+ React__default.createElement(
2392
+ Modal.Body,
2393
+ null,
2394
+ React__default.createElement(
2395
+ Form,
2396
+ {
2397
+ onSubmit: handleSubmit,
2398
+ className: 'modalForm'
2399
+ },
2400
+ pollArray,
2401
+ textInputRender && !multiChoiceRender ? React__default.createElement(
2402
+ Button,
2403
+ {
2404
+ className: 'submitButton',
2405
+ type: 'submit',
2406
+ variant: 'success',
2407
+ disabled: !textAnswer
2408
+ },
2409
+ 'Submit'
2410
+ ) : React__default.createElement(
2411
+ Button,
2412
+ {
2413
+ className: 'submitButton',
2414
+ type: 'submit',
2415
+ variant: 'success',
2416
+ disabled: !pollAnswer
2417
+ },
2418
+ 'Submit'
2419
+ )
2420
+ )
2421
+ )
2422
+ )
2423
+ );
2424
+ };
2425
+
2197
2426
  var VideoMp4 = function VideoMp4(_ref) {
2198
2427
  var url = _ref.url,
2199
2428
  thumbnail = _ref.thumbnail,
2200
- vidLoaded = _ref.vidLoaded;
2429
+ vidLoaded = _ref.vidLoaded,
2430
+ polls = _ref.polls,
2431
+ modalTimes = _ref.modalTimes,
2432
+ targetingUrl = _ref.targetingUrl;
2201
2433
 
2202
2434
  var _useState = useState(false),
2203
2435
  _useState2 = _slicedToArray(_useState, 2),
@@ -2214,7 +2446,43 @@ var VideoMp4 = function VideoMp4(_ref) {
2214
2446
  intervalID = _useState6[0],
2215
2447
  setIntervalID = _useState6[1];
2216
2448
 
2449
+ var _useState7 = useState(false),
2450
+ _useState8 = _slicedToArray(_useState7, 2),
2451
+ isPollingTime = _useState8[0],
2452
+ setIsPollingTime = _useState8[1];
2453
+
2454
+ var _useState9 = useState([]),
2455
+ _useState10 = _slicedToArray(_useState9, 2),
2456
+ pollItems = _useState10[0],
2457
+ setPollItems = _useState10[1];
2458
+
2459
+ var _useState11 = useState(''),
2460
+ _useState12 = _slicedToArray(_useState11, 2),
2461
+ pollUrl = _useState12[0],
2462
+ setPollUrl = _useState12[1];
2463
+
2464
+ var _useState13 = useState(false),
2465
+ _useState14 = _slicedToArray(_useState13, 2),
2466
+ multiChoiceRender = _useState14[0],
2467
+ setMultiChoiceRender = _useState14[1];
2468
+
2469
+ var _useState15 = useState(false),
2470
+ _useState16 = _slicedToArray(_useState15, 2),
2471
+ textInputRender = _useState16[0],
2472
+ setTextInputRender = _useState16[1];
2473
+
2474
+ var _useState17 = useState(),
2475
+ _useState18 = _slicedToArray(_useState17, 2),
2476
+ videoPlayer = _useState18[0],
2477
+ setVideoPlayer = _useState18[1];
2478
+
2217
2479
  var queueProgress = [];
2480
+ var intId = void 0;
2481
+
2482
+ var restartPlayer = function restartPlayer() {
2483
+ setIsPollingTime(false);
2484
+ videoPlayer.play();
2485
+ };
2218
2486
 
2219
2487
  var handleOnReady = function handleOnReady(event) {
2220
2488
  event.target.muted = true;
@@ -2224,7 +2492,7 @@ var VideoMp4 = function VideoMp4(_ref) {
2224
2492
  var duration = player.duration;
2225
2493
  var queue = Math.floor(duration / 10);
2226
2494
  var segment = Math.floor(current / queue);
2227
- //Beam.report_beam_video('Ready', deviceType, duration, current, segment, 'MP4')
2495
+ // Beam.report_beam_video('Ready', deviceType, duration, current, segment, 'MP4')
2228
2496
  Segment.report_video_event('Video Ready', main_18, duration, current, segment, 'MP4');
2229
2497
  };
2230
2498
 
@@ -2234,7 +2502,7 @@ var VideoMp4 = function VideoMp4(_ref) {
2234
2502
  var queue = Math.floor(duration / 10);
2235
2503
  var segment = Math.floor(current / queue);
2236
2504
  if (!queueProgress.includes(segment)) {
2237
- //Beam.report_beam_video('Segment', deviceType, duration, current, segment, 'MP4')
2505
+ // Beam.report_beam_video('Segment', deviceType, duration, current, segment, 'MP4')
2238
2506
  Segment.report_video_event('Video Segment', main_18, duration, current, segment, 'MP4');
2239
2507
  queueProgress.push(segment);
2240
2508
  }
@@ -2247,9 +2515,8 @@ var VideoMp4 = function VideoMp4(_ref) {
2247
2515
  var duration = player.duration;
2248
2516
  var queue = Math.floor(duration / 10);
2249
2517
  var segment = Math.floor(current / queue);
2250
- //Beam.report_beam_video('Play', deviceType, duration, current, segment, 'MP4')
2518
+ // Beam.report_beam_video('Play', deviceType, duration, current, segment, 'MP4')
2251
2519
  Segment.report_video_event('Video Play', main_18, duration, current, segment, 'MP4');
2252
-
2253
2520
  if (!playReported) {
2254
2521
  event.persist();
2255
2522
  setPlayReported(true);
@@ -2258,6 +2525,29 @@ var VideoMp4 = function VideoMp4(_ref) {
2258
2525
  }, 1000);
2259
2526
  setIntervalID(_intervalID);
2260
2527
  }
2528
+ if (polls) {
2529
+ event.persist();
2530
+ setVideoPlayer(event.target);
2531
+ intId = setInterval(function () {
2532
+ var ct = player.currentTime;
2533
+ console.log('videoPlayer in Interval', videoPlayer);
2534
+ if (intId) console.log('interval ID is ' + intId);
2535
+ modalTimes.forEach(function (modalTime, ind) {
2536
+ if (Math.floor(ct) === modalTime) {
2537
+ console.log('clearing interval: ' + intId);
2538
+ clearInterval(intId);
2539
+ setPollItems(polls[ind].pollItems);
2540
+ setPollUrl(targetingUrl);
2541
+ setIsPollingTime(true);
2542
+ polls[ind].pollItems.forEach(function (item) {
2543
+ if (item.format === 'multiChoice') setMultiChoiceRender(true);
2544
+ if (item.format === 'textInput') setTextInputRender(true);
2545
+ });
2546
+ event.target.pause();
2547
+ }
2548
+ });
2549
+ }, 1000);
2550
+ }
2261
2551
  };
2262
2552
 
2263
2553
  var handleOnEnd = function handleOnEnd(event) {
@@ -2267,8 +2557,8 @@ var VideoMp4 = function VideoMp4(_ref) {
2267
2557
  var duration = player.duration;
2268
2558
  var queue = Math.floor(duration / 10);
2269
2559
  var segment = Math.floor(current / queue);
2270
-
2271
- //Beam.report_beam_video('End', deviceType, duration, current, segment, 'MP4')
2560
+ clearInterval(intId);
2561
+ // Beam.report_beam_video('End', deviceType, duration, current, segment, 'MP4')
2272
2562
  Segment.report_video_event('Video End', main_18, duration, current, segment, 'MP4');
2273
2563
  setEndReported(true);
2274
2564
  clearInterval(intervalID);
@@ -2281,13 +2571,28 @@ var VideoMp4 = function VideoMp4(_ref) {
2281
2571
  var duration = player.duration - current;
2282
2572
  var queue = Math.floor(duration / 10);
2283
2573
  var segment = Math.floor(current / queue);
2284
- //Beam.report_beam_video('Pause', deviceType, duration, current, segment, 'MP4')
2574
+ clearInterval(intId);
2575
+ // Beam.report_beam_video('Pause', deviceType, duration, current, segment, 'MP4')
2285
2576
  Segment.report_video_event('Video Pause', main_18, duration, current, segment, 'MP4');
2286
2577
  };
2287
2578
 
2288
2579
  return React__default.createElement(
2289
2580
  'div',
2290
2581
  null,
2582
+ isPollingTime ? React__default.createElement(PopupPollModal
2583
+ // eslint-disable-next-line react/jsx-indent-props
2584
+ , { pollItems: pollItems
2585
+ // eslint-disable-next-line react/jsx-indent-props
2586
+ , pollUrl: pollUrl
2587
+ // eslint-disable-next-line react/jsx-indent-props
2588
+ , isPollingTime: isPollingTime
2589
+ // eslint-disable-next-line react/jsx-indent-props
2590
+ , restartPlayer: restartPlayer
2591
+ // eslint-disable-next-line react/jsx-indent-props
2592
+ , textInputRender: textInputRender
2593
+ // eslint-disable-next-line react/jsx-indent-props
2594
+ , multiChoiceRender: multiChoiceRender
2595
+ }) : null,
2291
2596
  vidLoaded && React__default.createElement(
2292
2597
  'video',
2293
2598
  {
@@ -2328,14 +2633,63 @@ var Video = function Video(_ref) {
2328
2633
  playlistID = node.playlistID,
2329
2634
  experienceID = node.experienceID;
2330
2635
 
2636
+ var polls = void 0;
2637
+ if (node.polls) polls = node.polls;
2638
+
2331
2639
  var _useState = useState(false),
2332
2640
  _useState2 = _slicedToArray(_useState, 2),
2333
2641
  videoLoaded = _useState2[0],
2334
2642
  setVideoLoaded = _useState2[1];
2335
2643
 
2644
+ var _useState3 = useState(false),
2645
+ _useState4 = _slicedToArray(_useState3, 2),
2646
+ isPollingTime = _useState4[0],
2647
+ setIsPollingTime = _useState4[1];
2648
+
2649
+ var _useState5 = useState([]),
2650
+ _useState6 = _slicedToArray(_useState5, 2),
2651
+ pollItems = _useState6[0],
2652
+ setPollItems = _useState6[1];
2653
+
2654
+ var _useState7 = useState(''),
2655
+ _useState8 = _slicedToArray(_useState7, 2),
2656
+ pollUrl = _useState8[0],
2657
+ setPollUrl = _useState8[1];
2658
+
2659
+ var _useState9 = useState(),
2660
+ _useState10 = _slicedToArray(_useState9, 2),
2661
+ videoPlayer = _useState10[0],
2662
+ setVideoPlayer = _useState10[1];
2663
+
2664
+ var _useState11 = useState(false),
2665
+ _useState12 = _slicedToArray(_useState11, 2),
2666
+ multiChoiceRender = _useState12[0],
2667
+ setMultiChoiceRender = _useState12[1];
2668
+
2669
+ var _useState13 = useState(false),
2670
+ _useState14 = _slicedToArray(_useState13, 2),
2671
+ textInputRender = _useState14[0],
2672
+ setTextInputRender = _useState14[1];
2673
+
2674
+ var intId = void 0;
2675
+ var convertTime = function convertTime(timeStr) {
2676
+ var minutes = parseInt(timeStr.slice(0, 2));
2677
+ var seconds = parseInt(timeStr.slice(3));
2678
+ return minutes * 60 + seconds;
2679
+ };
2680
+ var modalTimes = [];
2681
+ polls.forEach(function (pollObj) {
2682
+ return modalTimes.push(convertTime(pollObj.timestamp));
2683
+ });
2684
+
2685
+ var restartPlayer = function restartPlayer() {
2686
+ setIsPollingTime(false);
2687
+ videoPlayer.play();
2688
+ };
2689
+
2336
2690
  useEffect(function () {
2337
2691
  if (!videoLoaded && experienceID) {
2338
- //To load Experience Player JS
2692
+ // To load Experience Player JS
2339
2693
  var experiencePlayerScript = document.createElement('script');
2340
2694
  experiencePlayerScript.src = 'https://players.brightcove.net/' + accountIDs.brightcove.accountId + '/experience_' + experienceID + '/live.js';
2341
2695
  document.body.appendChild(experiencePlayerScript);
@@ -2348,8 +2702,9 @@ var Video = function Video(_ref) {
2348
2702
  };
2349
2703
 
2350
2704
  var onVideoSuccess = function onVideoSuccess(success) {
2351
- //console.log('success:', success.ref)
2705
+ // console.log('success:', success)
2352
2706
  var player = success.ref;
2707
+ setVideoPlayer(player);
2353
2708
  if (_typeof$1(player.ima3) === 'object' && player.ima3.settings && player.ima3.settings.serverUrl && targeting !== null) {
2354
2709
  player.ima3.settings.debug = true;
2355
2710
  if (targeting.content_placement && targeting.document_url) {
@@ -2360,7 +2715,7 @@ var Video = function Video(_ref) {
2360
2715
  player.on('loadedmetadata', function (evt) {
2361
2716
  var _this = this;
2362
2717
 
2363
- //console.log('loadedmetadata:', evt)
2718
+ // console.log('loadedmetadata:', evt)
2364
2719
  console.log('mediainfo:', player.mediainfo); // get the duration from here
2365
2720
  var duration = player.mediainfo.duration;
2366
2721
  var current = player.currentTime();
@@ -2404,17 +2759,42 @@ var Video = function Video(_ref) {
2404
2759
  autoPlayVideo();
2405
2760
  }
2406
2761
 
2407
- //Beam.report_beam_video('Ready', deviceType, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID)
2762
+ // Beam.report_beam_video('Ready', deviceType, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID)
2408
2763
  Segment.report_video_event('Video Ready', main_18, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID);
2409
2764
  });
2410
-
2411
- // play
2765
+ // let intId
2766
+ // const convertTime = (timeStr) => {
2767
+ // const minutes = parseInt(timeStr.slice(0, 2))
2768
+ // const seconds = parseInt(timeStr.slice(3))
2769
+ // return minutes * 60 + seconds
2770
+ // }
2771
+ // const modalTimes = []
2772
+ // polls.forEach(pollObj => modalTimes.push(convertTime(pollObj.timestamp)))
2412
2773
  player.on('play', function (evt) {
2413
2774
  var duration = player.mediainfo.duration;
2414
2775
  var current = player.currentTime();
2415
2776
  var queue = Math.floor(duration / 10);
2416
2777
  var segment = Math.floor(current / queue);
2417
- //Beam.report_beam_video('Play', deviceType, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID)
2778
+ if (polls) {
2779
+ var vidPlayer = this;
2780
+ intId = setInterval(function () {
2781
+ var ct = player.currentTime();
2782
+ if (intId) console.log('interval ID is ' + intId);
2783
+ modalTimes.forEach(function (modalTime, ind) {
2784
+ if (Math.floor(ct) === modalTime) {
2785
+ setPollItems(polls[ind].pollItems);
2786
+ setPollUrl(targeting.document_url[0]);
2787
+ setIsPollingTime(true);
2788
+ polls[ind].pollItems.forEach(function (item) {
2789
+ if (item.format === 'multiChoice') setMultiChoiceRender(true);
2790
+ if (item.format === 'textInput') setTextInputRender(true);
2791
+ });
2792
+ vidPlayer.pause();
2793
+ }
2794
+ });
2795
+ }, 1000);
2796
+ }
2797
+ // Beam.report_beam_video('Play', deviceType, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID)
2418
2798
  Segment.report_video_event('Video Play', main_18, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID);
2419
2799
  });
2420
2800
 
@@ -2424,7 +2804,8 @@ var Video = function Video(_ref) {
2424
2804
  var current = player.currentTime();
2425
2805
  var queue = Math.floor(duration / 10);
2426
2806
  var segment = Math.floor(current / queue);
2427
- //Beam.report_beam_video('Pause', deviceType, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID)
2807
+ clearInterval(intId);
2808
+ // Beam.report_beam_video('Pause', deviceType, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID)
2428
2809
  Segment.report_video_event('Video Pause', main_18, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID);
2429
2810
  });
2430
2811
 
@@ -2434,9 +2815,10 @@ var Video = function Video(_ref) {
2434
2815
  var current = player.currentTime();
2435
2816
  var queue = Math.floor(duration / 10);
2436
2817
  var segment = Math.floor(current / queue);
2437
- //Beam.report_beam_video('End', deviceType, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID)
2818
+ clearInterval(intId);
2819
+ // Beam.report_beam_video('End', deviceType, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID)
2438
2820
  Segment.report_video_event('Video End', main_18, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID);
2439
- //This is for old series format
2821
+ // This is for old series format
2440
2822
  autoplayNextVideo(evt);
2441
2823
  if (nextVideo) {
2442
2824
  window.location.href = '/view/' + nextVideo;
@@ -2450,7 +2832,7 @@ var Video = function Video(_ref) {
2450
2832
  var queue = Math.floor(duration / 10);
2451
2833
  var segment = Math.floor(current / queue);
2452
2834
  if (!queueProgress.includes(segment)) {
2453
- //Beam.report_beam_video('Segment', deviceType, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID)
2835
+ // Beam.report_beam_video('Segment', deviceType, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID)
2454
2836
  Segment.report_video_event('Video Segment', main_18, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID);
2455
2837
  queueProgress.push(segment);
2456
2838
  }
@@ -2459,19 +2841,19 @@ var Video = function Video(_ref) {
2459
2841
  // ad impression
2460
2842
  player.on('ads-ad-started', function (evt) {
2461
2843
  var duration = player.ads.ad.duration;
2462
- player.ads.ad.id;
2844
+ // const id = player.ads.ad.id
2463
2845
  var adType = 'Bright Cove: ' + player.ads.ad.type;
2464
2846
 
2465
- //Beam.report_beam_ad('AD Started', deviceType, '', '', '', '', '', adType, duration, id)
2847
+ // Beam.report_beam_ad('AD Started', deviceType, '', '', '', '', '', adType, duration, id)
2466
2848
  Segment.report_ad_event('Video Ad Started', main_18, duration, adType, accountIDs.brightcove.playerId, accountIDs.brightcove.accountId);
2467
2849
  });
2468
2850
 
2469
2851
  // ad ended
2470
2852
  player.on('ads-ad-ended', function (evt) {
2471
2853
  var duration = player.ads.ad.duration;
2472
- player.ads.ad.id;
2854
+ // const id = player.ads.ad.id
2473
2855
  var adType = 'Bright Cove: ' + player.ads.ad.type;
2474
- //Beam.report_beam_ad('AD Ended', deviceType, '', '', '', '', '', adType, duration, id)
2856
+ // Beam.report_beam_ad('AD Ended', deviceType, '', '', '', '', '', adType, duration, id)
2475
2857
  Segment.report_ad_event('Video Ad Ended', main_18, duration, adType, accountIDs.brightcove.playerId, accountIDs.brightcove.accountId);
2476
2858
  });
2477
2859
  };
@@ -2481,6 +2863,20 @@ var Video = function Video(_ref) {
2481
2863
  return React__default.createElement(
2482
2864
  'div',
2483
2865
  null,
2866
+ isPollingTime ? React__default.createElement(PopupPollModal
2867
+ // eslint-disable-next-line react/jsx-indent-props
2868
+ , { pollItems: pollItems
2869
+ // eslint-disable-next-line react/jsx-indent-props
2870
+ , pollUrl: pollUrl
2871
+ // eslint-disable-next-line react/jsx-indent-props
2872
+ , isPollingTime: isPollingTime
2873
+ // eslint-disable-next-line react/jsx-indent-props
2874
+ , restartPlayer: restartPlayer
2875
+ // eslint-disable-next-line react/jsx-indent-props
2876
+ , textInputRender: textInputRender
2877
+ // eslint-disable-next-line react/jsx-indent-props
2878
+ , multiChoiceRender: multiChoiceRender
2879
+ }) : null,
2484
2880
  React__default.createElement(ReactPlayerLoader, {
2485
2881
  onSuccess: onVideoSuccess,
2486
2882
  onFailure: onVideoFailure,
@@ -2499,6 +2895,20 @@ var Video = function Video(_ref) {
2499
2895
  return React__default.createElement(
2500
2896
  'div',
2501
2897
  null,
2898
+ isPollingTime ? React__default.createElement(PopupPollModal
2899
+ // eslint-disable-next-line react/jsx-indent-props
2900
+ , { pollItems: pollItems
2901
+ // eslint-disable-next-line react/jsx-indent-props
2902
+ , pollUrl: pollUrl
2903
+ // eslint-disable-next-line react/jsx-indent-props
2904
+ , isPollingTime: isPollingTime
2905
+ // eslint-disable-next-line react/jsx-indent-props
2906
+ , restartPlayer: restartPlayer
2907
+ // eslint-disable-next-line react/jsx-indent-props
2908
+ , textInputRender: textInputRender
2909
+ // eslint-disable-next-line react/jsx-indent-props
2910
+ , multiChoiceRender: multiChoiceRender
2911
+ }) : null,
2502
2912
  React__default.createElement(ReactPlayerLoader, {
2503
2913
  accountId: accountIDs.brightcove.accountId,
2504
2914
  playlistId: playlistID,
@@ -2517,16 +2927,30 @@ var Video = function Video(_ref) {
2517
2927
  return React__default.createElement(
2518
2928
  'div',
2519
2929
  { className: 'brightcove-playlist', style: { position: 'relative', display: 'block', margin: '0px auto' } },
2520
- videoLoaded && React__default.createElement('div', { 'data-experience': experienceID })
2930
+ isPollingTime ? React__default.createElement(PopupPollModal
2931
+ // eslint-disable-next-line react/jsx-indent-props
2932
+ , { pollItems: pollItems
2933
+ // eslint-disable-next-line react/jsx-indent-props
2934
+ , pollUrl: pollUrl
2935
+ // eslint-disable-next-line react/jsx-indent-props
2936
+ , isPollingTime: isPollingTime
2937
+ // eslint-disable-next-line react/jsx-indent-props
2938
+ , restartPlayer: restartPlayer
2939
+ // eslint-disable-next-line react/jsx-indent-props
2940
+ , textInputRender: textInputRender
2941
+ // eslint-disable-next-line react/jsx-indent-props
2942
+ , multiChoiceRender: multiChoiceRender
2943
+ }) : null
2521
2944
  );
2522
2945
  }
2523
2946
  return null;
2524
2947
  }
2948
+
2525
2949
  if (source === 'mp4') {
2526
2950
  return React__default.createElement(
2527
2951
  'div',
2528
2952
  null,
2529
- React__default.createElement(VideoMp4, { url: node.mp4url, thumbnail: null, vidLoaded: true })
2953
+ React__default.createElement(VideoMp4, { url: node.mp4url, thumbnail: null, vidLoaded: true, polls: polls, modalTimes: modalTimes, targetingUrl: targeting.document_url[0] })
2530
2954
  );
2531
2955
  }
2532
2956
 
@@ -7629,7 +8053,7 @@ var Poll$1 = function Poll(_ref) {
7629
8053
  );
7630
8054
  }),
7631
8055
  React__default.createElement(
7632
- Button,
8056
+ Button$1,
7633
8057
  { disabled: !selectedChoice, type: 'submit' },
7634
8058
  'Vote'
7635
8059
  )
@@ -7806,7 +8230,7 @@ var Poll = function Poll(_ref) {
7806
8230
  );
7807
8231
  }),
7808
8232
  React__default.createElement(
7809
- Button,
8233
+ Button$1,
7810
8234
  { disabled: !selectedChoice, type: 'submit' },
7811
8235
  'Vote'
7812
8236
  )
@@ -8119,7 +8543,7 @@ var Quiz = function Quiz(_ref) {
8119
8543
  )
8120
8544
  ),
8121
8545
  !showAnswer && React__default.createElement(
8122
- Button$1,
8546
+ Button,
8123
8547
  { onClick: function onClick() {
8124
8548
  return checkAnswers();
8125
8549
  }, variant: 'info', block: true },