@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
@@ -20,6 +20,10 @@ var index$2 = require('./index-eadd5035.js');
20
20
  var asyncToGenerator = require('./asyncToGenerator-77821af0.js');
21
21
  var _typeof$1 = require('./typeof-567e31ff.js');
22
22
  var brightcoveReactPlayerLoader_es = require('./brightcove-react-player-loader.es-a195642e.js');
23
+ var stringify = require('./stringify-f7a37a8d.js');
24
+ var Modal = require('react-bootstrap/Modal');
25
+ var Button = require('react-bootstrap/Button');
26
+ var Form = require('react-bootstrap/Form');
23
27
  var GroupDeck = require('./GroupDeck.js');
24
28
  var moment = require('./moment-aca40de1.js');
25
29
  var SocialShare = require('./SocialShare.js');
@@ -27,7 +31,6 @@ var core_getIteratorMethod = require('./core.get-iterator-method-5643aa10.js');
27
31
  var _objectToArray = require('./_object-to-array-ce86cae7.js');
28
32
  var toConsumableArray = require('./toConsumableArray-d7797c2b.js');
29
33
  var Pagination = require('react-bootstrap/Pagination');
30
- var Button = require('react-bootstrap/Button');
31
34
  var entities = require('./entities-df1aed86.js');
32
35
  var AdSlot = require('./AdSlot.js');
33
36
  var Row = require('react-bootstrap/Row');
@@ -45,8 +48,10 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
45
48
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
46
49
  var Router__default = /*#__PURE__*/_interopDefaultLegacy(Router);
47
50
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
48
- var Pagination__default = /*#__PURE__*/_interopDefaultLegacy(Pagination);
51
+ var Modal__default = /*#__PURE__*/_interopDefaultLegacy(Modal);
49
52
  var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
53
+ var Form__default = /*#__PURE__*/_interopDefaultLegacy(Form);
54
+ var Pagination__default = /*#__PURE__*/_interopDefaultLegacy(Pagination);
50
55
  var Row__default = /*#__PURE__*/_interopDefaultLegacy(Row);
51
56
  var Col__default = /*#__PURE__*/_interopDefaultLegacy(Col);
52
57
  var Head__default = /*#__PURE__*/_interopDefaultLegacy(Head);
@@ -2211,10 +2216,239 @@ var IFrame = function IFrame(_ref) {
2211
2216
  );
2212
2217
  };
2213
2218
 
2219
+ var PopupMultiChoice = function PopupMultiChoice(_ref) {
2220
+ var question = _ref.question,
2221
+ choices = _ref.choices,
2222
+ handlePollAnswer = _ref.handlePollAnswer;
2223
+
2224
+ var choiceArray = choices.map(function (choice) {
2225
+ return React__default['default'].createElement(Form__default['default'].Check, {
2226
+ inline: true,
2227
+ label: choice.choiceText,
2228
+ value: choice.choiceText,
2229
+ name: 'radioButton',
2230
+ type: 'radio',
2231
+ className: 'radioButton',
2232
+ onClick: handlePollAnswer
2233
+ });
2234
+ });
2235
+ return React__default['default'].createElement(
2236
+ 'div',
2237
+ {
2238
+ key: 'inline-radio',
2239
+ className: 'mb-3' },
2240
+ React__default['default'].createElement(
2241
+ 'h2',
2242
+ {
2243
+ className: 'radioLabelText'
2244
+ },
2245
+ question
2246
+ ),
2247
+ React__default['default'].createElement(
2248
+ 'div',
2249
+ {
2250
+ className: 'multiChoiceDiv'
2251
+ },
2252
+ choiceArray
2253
+ )
2254
+ );
2255
+ };
2256
+
2257
+ var PopupPollTextInput = function PopupPollTextInput(_ref) {
2258
+ var textInputQuestion = _ref.textInputQuestion,
2259
+ textAnswer = _ref.textAnswer,
2260
+ handleTextAnswer = _ref.handleTextAnswer;
2261
+
2262
+ return React__default['default'].createElement(
2263
+ 'div',
2264
+ {
2265
+ className: 'textInputDiv'
2266
+ },
2267
+ React__default['default'].createElement(
2268
+ 'h2',
2269
+ {
2270
+ className: 'textInputQuestion'
2271
+ },
2272
+ textInputQuestion
2273
+ ),
2274
+ React__default['default'].createElement(Form__default['default'].Control, {
2275
+ type: 'text',
2276
+ className: 'textInput',
2277
+ value: textAnswer,
2278
+ placeholder: 'Your response',
2279
+ onChange: handleTextAnswer
2280
+ })
2281
+ );
2282
+ };
2283
+
2284
+ var _this = undefined;
2285
+ var fetch = require('node-fetch');
2286
+
2287
+ var PopupPollModal = function PopupPollModal(props) {
2288
+ var pollItems = props.pollItems,
2289
+ pollUrl = props.pollUrl,
2290
+ restartPlayer = props.restartPlayer,
2291
+ multiChoiceRender = props.multiChoiceRender,
2292
+ textInputRender = props.textInputRender;
2293
+
2294
+ var _useState = React.useState(''),
2295
+ _useState2 = slicedToArray._slicedToArray(_useState, 2),
2296
+ pollAnswer = _useState2[0],
2297
+ setPollAnswer = _useState2[1];
2298
+
2299
+ var _useState3 = React.useState(''),
2300
+ _useState4 = slicedToArray._slicedToArray(_useState3, 2),
2301
+ textAnswer = _useState4[0],
2302
+ setTextAnswer = _useState4[1];
2303
+
2304
+ React.useEffect(function () {
2305
+ var modal = document.getElementById('modalDiv');
2306
+ modal.style.visibility = 'visible';
2307
+ }, []);
2308
+
2309
+ var handleTextAnswer = function handleTextAnswer(e) {
2310
+ setTextAnswer(e.target.value);
2311
+ };
2312
+
2313
+ var handlePollAnswer = function handlePollAnswer(e) {
2314
+ setPollAnswer(e.target.value);
2315
+ };
2316
+
2317
+ var handleSubmit = function handleSubmit(e) {
2318
+ var currentDate = new Date(Date.now()).toUTCString();
2319
+ // eslint-disable-next-line no-undef
2320
+ var anonymousID = typeof analytics !== 'undefined' && typeof analytics.user === 'function' && analytics.user() && analytics.user().anonymousId();
2321
+ pollItems.forEach(function (item) {
2322
+ var submitAnswer = void 0;
2323
+ if (item.format === 'multiChoice') submitAnswer = pollAnswer;
2324
+ if (item.format === 'textInput') submitAnswer = textAnswer;
2325
+ var formData = {
2326
+ uuid: anonymousID,
2327
+ url: pollUrl,
2328
+ date: currentDate,
2329
+ question: item.question,
2330
+ answer: submitAnswer
2331
+ };
2332
+ var requestOptions = {
2333
+ method: 'POST',
2334
+ headers: { 'content-type': 'application/json' },
2335
+ body: stringify._JSON$stringify({ data: formData })
2336
+ };
2337
+ var insertData = function () {
2338
+ var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee() {
2339
+ return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
2340
+ while (1) {
2341
+ switch (_context.prev = _context.next) {
2342
+ case 0:
2343
+ _context.prev = 0;
2344
+ _context.next = 3;
2345
+ return fetch('/api/popup_polls', requestOptions).then(function (res) {
2346
+ return res.json();
2347
+ }).then(function (res) {
2348
+ return console.log(res);
2349
+ });
2350
+
2351
+ case 3:
2352
+ _context.next = 8;
2353
+ break;
2354
+
2355
+ case 5:
2356
+ _context.prev = 5;
2357
+ _context.t0 = _context['catch'](0);
2358
+
2359
+ if (_context.t0) console.log('There was an error in insertData in PopupPollModal.js: ' + _context.t0);
2360
+
2361
+ case 8:
2362
+ case 'end':
2363
+ return _context.stop();
2364
+ }
2365
+ }
2366
+ }, _callee, _this, [[0, 5]]);
2367
+ }));
2368
+
2369
+ return function insertData() {
2370
+ return _ref.apply(this, arguments);
2371
+ };
2372
+ }();
2373
+ console.log('formData', formData);
2374
+ insertData();
2375
+ });
2376
+ restartPlayer();
2377
+ // setIsPollingTime(false)
2378
+ e.preventDefault();
2379
+ };
2380
+
2381
+ var pollArray = [];
2382
+ pollItems.forEach(function (item, ind) {
2383
+ if (item.format === 'multiChoice') {
2384
+ pollArray.push(React__default['default'].createElement(PopupMultiChoice, {
2385
+ question: item.question,
2386
+ choices: item.choices,
2387
+ handlePollAnswer: handlePollAnswer,
2388
+ key: ind
2389
+ }));
2390
+ }
2391
+ if (item.format === 'textInput') {
2392
+ pollArray.push(React__default['default'].createElement(PopupPollTextInput, {
2393
+ textInputQuestion: item.question,
2394
+ textanswer: textAnswer,
2395
+ handleTextAnswer: handleTextAnswer,
2396
+ key: ind
2397
+ }));
2398
+ }
2399
+ });
2400
+
2401
+ return React__default['default'].createElement(
2402
+ 'div',
2403
+ {
2404
+ className: 'modalDiv',
2405
+ id: 'modalDiv'
2406
+ },
2407
+ React__default['default'].createElement(
2408
+ Modal__default['default'].Dialog,
2409
+ null,
2410
+ React__default['default'].createElement(
2411
+ Modal__default['default'].Body,
2412
+ null,
2413
+ React__default['default'].createElement(
2414
+ Form__default['default'],
2415
+ {
2416
+ onSubmit: handleSubmit,
2417
+ className: 'modalForm'
2418
+ },
2419
+ pollArray,
2420
+ textInputRender && !multiChoiceRender ? React__default['default'].createElement(
2421
+ Button__default['default'],
2422
+ {
2423
+ className: 'submitButton',
2424
+ type: 'submit',
2425
+ variant: 'success',
2426
+ disabled: !textAnswer
2427
+ },
2428
+ 'Submit'
2429
+ ) : React__default['default'].createElement(
2430
+ Button__default['default'],
2431
+ {
2432
+ className: 'submitButton',
2433
+ type: 'submit',
2434
+ variant: 'success',
2435
+ disabled: !pollAnswer
2436
+ },
2437
+ 'Submit'
2438
+ )
2439
+ )
2440
+ )
2441
+ )
2442
+ );
2443
+ };
2444
+
2214
2445
  var VideoMp4 = function VideoMp4(_ref) {
2215
2446
  var url = _ref.url,
2216
2447
  thumbnail = _ref.thumbnail,
2217
- vidLoaded = _ref.vidLoaded;
2448
+ vidLoaded = _ref.vidLoaded,
2449
+ polls = _ref.polls,
2450
+ modalTimes = _ref.modalTimes,
2451
+ targetingUrl = _ref.targetingUrl;
2218
2452
 
2219
2453
  var _useState = React.useState(false),
2220
2454
  _useState2 = slicedToArray._slicedToArray(_useState, 2),
@@ -2231,7 +2465,43 @@ var VideoMp4 = function VideoMp4(_ref) {
2231
2465
  intervalID = _useState6[0],
2232
2466
  setIntervalID = _useState6[1];
2233
2467
 
2468
+ var _useState7 = React.useState(false),
2469
+ _useState8 = slicedToArray._slicedToArray(_useState7, 2),
2470
+ isPollingTime = _useState8[0],
2471
+ setIsPollingTime = _useState8[1];
2472
+
2473
+ var _useState9 = React.useState([]),
2474
+ _useState10 = slicedToArray._slicedToArray(_useState9, 2),
2475
+ pollItems = _useState10[0],
2476
+ setPollItems = _useState10[1];
2477
+
2478
+ var _useState11 = React.useState(''),
2479
+ _useState12 = slicedToArray._slicedToArray(_useState11, 2),
2480
+ pollUrl = _useState12[0],
2481
+ setPollUrl = _useState12[1];
2482
+
2483
+ var _useState13 = React.useState(false),
2484
+ _useState14 = slicedToArray._slicedToArray(_useState13, 2),
2485
+ multiChoiceRender = _useState14[0],
2486
+ setMultiChoiceRender = _useState14[1];
2487
+
2488
+ var _useState15 = React.useState(false),
2489
+ _useState16 = slicedToArray._slicedToArray(_useState15, 2),
2490
+ textInputRender = _useState16[0],
2491
+ setTextInputRender = _useState16[1];
2492
+
2493
+ var _useState17 = React.useState(),
2494
+ _useState18 = slicedToArray._slicedToArray(_useState17, 2),
2495
+ videoPlayer = _useState18[0],
2496
+ setVideoPlayer = _useState18[1];
2497
+
2234
2498
  var queueProgress = [];
2499
+ var intId = void 0;
2500
+
2501
+ var restartPlayer = function restartPlayer() {
2502
+ setIsPollingTime(false);
2503
+ videoPlayer.play();
2504
+ };
2235
2505
 
2236
2506
  var handleOnReady = function handleOnReady(event) {
2237
2507
  event.target.muted = true;
@@ -2241,7 +2511,7 @@ var VideoMp4 = function VideoMp4(_ref) {
2241
2511
  var duration = player.duration;
2242
2512
  var queue = Math.floor(duration / 10);
2243
2513
  var segment = Math.floor(current / queue);
2244
- //Beam.report_beam_video('Ready', deviceType, duration, current, segment, 'MP4')
2514
+ // Beam.report_beam_video('Ready', deviceType, duration, current, segment, 'MP4')
2245
2515
  Segment.report_video_event('Video Ready', main.main_18, duration, current, segment, 'MP4');
2246
2516
  };
2247
2517
 
@@ -2251,7 +2521,7 @@ var VideoMp4 = function VideoMp4(_ref) {
2251
2521
  var queue = Math.floor(duration / 10);
2252
2522
  var segment = Math.floor(current / queue);
2253
2523
  if (!queueProgress.includes(segment)) {
2254
- //Beam.report_beam_video('Segment', deviceType, duration, current, segment, 'MP4')
2524
+ // Beam.report_beam_video('Segment', deviceType, duration, current, segment, 'MP4')
2255
2525
  Segment.report_video_event('Video Segment', main.main_18, duration, current, segment, 'MP4');
2256
2526
  queueProgress.push(segment);
2257
2527
  }
@@ -2264,9 +2534,8 @@ var VideoMp4 = function VideoMp4(_ref) {
2264
2534
  var duration = player.duration;
2265
2535
  var queue = Math.floor(duration / 10);
2266
2536
  var segment = Math.floor(current / queue);
2267
- //Beam.report_beam_video('Play', deviceType, duration, current, segment, 'MP4')
2537
+ // Beam.report_beam_video('Play', deviceType, duration, current, segment, 'MP4')
2268
2538
  Segment.report_video_event('Video Play', main.main_18, duration, current, segment, 'MP4');
2269
-
2270
2539
  if (!playReported) {
2271
2540
  event.persist();
2272
2541
  setPlayReported(true);
@@ -2275,6 +2544,29 @@ var VideoMp4 = function VideoMp4(_ref) {
2275
2544
  }, 1000);
2276
2545
  setIntervalID(_intervalID);
2277
2546
  }
2547
+ if (polls) {
2548
+ event.persist();
2549
+ setVideoPlayer(event.target);
2550
+ intId = setInterval(function () {
2551
+ var ct = player.currentTime;
2552
+ console.log('videoPlayer in Interval', videoPlayer);
2553
+ if (intId) console.log('interval ID is ' + intId);
2554
+ modalTimes.forEach(function (modalTime, ind) {
2555
+ if (Math.floor(ct) === modalTime) {
2556
+ console.log('clearing interval: ' + intId);
2557
+ clearInterval(intId);
2558
+ setPollItems(polls[ind].pollItems);
2559
+ setPollUrl(targetingUrl);
2560
+ setIsPollingTime(true);
2561
+ polls[ind].pollItems.forEach(function (item) {
2562
+ if (item.format === 'multiChoice') setMultiChoiceRender(true);
2563
+ if (item.format === 'textInput') setTextInputRender(true);
2564
+ });
2565
+ event.target.pause();
2566
+ }
2567
+ });
2568
+ }, 1000);
2569
+ }
2278
2570
  };
2279
2571
 
2280
2572
  var handleOnEnd = function handleOnEnd(event) {
@@ -2284,8 +2576,8 @@ var VideoMp4 = function VideoMp4(_ref) {
2284
2576
  var duration = player.duration;
2285
2577
  var queue = Math.floor(duration / 10);
2286
2578
  var segment = Math.floor(current / queue);
2287
-
2288
- //Beam.report_beam_video('End', deviceType, duration, current, segment, 'MP4')
2579
+ clearInterval(intId);
2580
+ // Beam.report_beam_video('End', deviceType, duration, current, segment, 'MP4')
2289
2581
  Segment.report_video_event('Video End', main.main_18, duration, current, segment, 'MP4');
2290
2582
  setEndReported(true);
2291
2583
  clearInterval(intervalID);
@@ -2298,13 +2590,28 @@ var VideoMp4 = function VideoMp4(_ref) {
2298
2590
  var duration = player.duration - current;
2299
2591
  var queue = Math.floor(duration / 10);
2300
2592
  var segment = Math.floor(current / queue);
2301
- //Beam.report_beam_video('Pause', deviceType, duration, current, segment, 'MP4')
2593
+ clearInterval(intId);
2594
+ // Beam.report_beam_video('Pause', deviceType, duration, current, segment, 'MP4')
2302
2595
  Segment.report_video_event('Video Pause', main.main_18, duration, current, segment, 'MP4');
2303
2596
  };
2304
2597
 
2305
2598
  return React__default['default'].createElement(
2306
2599
  'div',
2307
2600
  null,
2601
+ isPollingTime ? React__default['default'].createElement(PopupPollModal
2602
+ // eslint-disable-next-line react/jsx-indent-props
2603
+ , { pollItems: pollItems
2604
+ // eslint-disable-next-line react/jsx-indent-props
2605
+ , pollUrl: pollUrl
2606
+ // eslint-disable-next-line react/jsx-indent-props
2607
+ , isPollingTime: isPollingTime
2608
+ // eslint-disable-next-line react/jsx-indent-props
2609
+ , restartPlayer: restartPlayer
2610
+ // eslint-disable-next-line react/jsx-indent-props
2611
+ , textInputRender: textInputRender
2612
+ // eslint-disable-next-line react/jsx-indent-props
2613
+ , multiChoiceRender: multiChoiceRender
2614
+ }) : null,
2308
2615
  vidLoaded && React__default['default'].createElement(
2309
2616
  'video',
2310
2617
  {
@@ -2345,14 +2652,63 @@ var Video = function Video(_ref) {
2345
2652
  playlistID = node.playlistID,
2346
2653
  experienceID = node.experienceID;
2347
2654
 
2655
+ var polls = void 0;
2656
+ if (node.polls) polls = node.polls;
2657
+
2348
2658
  var _useState = React.useState(false),
2349
2659
  _useState2 = slicedToArray._slicedToArray(_useState, 2),
2350
2660
  videoLoaded = _useState2[0],
2351
2661
  setVideoLoaded = _useState2[1];
2352
2662
 
2663
+ var _useState3 = React.useState(false),
2664
+ _useState4 = slicedToArray._slicedToArray(_useState3, 2),
2665
+ isPollingTime = _useState4[0],
2666
+ setIsPollingTime = _useState4[1];
2667
+
2668
+ var _useState5 = React.useState([]),
2669
+ _useState6 = slicedToArray._slicedToArray(_useState5, 2),
2670
+ pollItems = _useState6[0],
2671
+ setPollItems = _useState6[1];
2672
+
2673
+ var _useState7 = React.useState(''),
2674
+ _useState8 = slicedToArray._slicedToArray(_useState7, 2),
2675
+ pollUrl = _useState8[0],
2676
+ setPollUrl = _useState8[1];
2677
+
2678
+ var _useState9 = React.useState(),
2679
+ _useState10 = slicedToArray._slicedToArray(_useState9, 2),
2680
+ videoPlayer = _useState10[0],
2681
+ setVideoPlayer = _useState10[1];
2682
+
2683
+ var _useState11 = React.useState(false),
2684
+ _useState12 = slicedToArray._slicedToArray(_useState11, 2),
2685
+ multiChoiceRender = _useState12[0],
2686
+ setMultiChoiceRender = _useState12[1];
2687
+
2688
+ var _useState13 = React.useState(false),
2689
+ _useState14 = slicedToArray._slicedToArray(_useState13, 2),
2690
+ textInputRender = _useState14[0],
2691
+ setTextInputRender = _useState14[1];
2692
+
2693
+ var intId = void 0;
2694
+ var convertTime = function convertTime(timeStr) {
2695
+ var minutes = parseInt(timeStr.slice(0, 2));
2696
+ var seconds = parseInt(timeStr.slice(3));
2697
+ return minutes * 60 + seconds;
2698
+ };
2699
+ var modalTimes = [];
2700
+ polls.forEach(function (pollObj) {
2701
+ return modalTimes.push(convertTime(pollObj.timestamp));
2702
+ });
2703
+
2704
+ var restartPlayer = function restartPlayer() {
2705
+ setIsPollingTime(false);
2706
+ videoPlayer.play();
2707
+ };
2708
+
2353
2709
  React.useEffect(function () {
2354
2710
  if (!videoLoaded && experienceID) {
2355
- //To load Experience Player JS
2711
+ // To load Experience Player JS
2356
2712
  var experiencePlayerScript = document.createElement('script');
2357
2713
  experiencePlayerScript.src = 'https://players.brightcove.net/' + accountIDs.brightcove.accountId + '/experience_' + experienceID + '/live.js';
2358
2714
  document.body.appendChild(experiencePlayerScript);
@@ -2365,8 +2721,9 @@ var Video = function Video(_ref) {
2365
2721
  };
2366
2722
 
2367
2723
  var onVideoSuccess = function onVideoSuccess(success) {
2368
- //console.log('success:', success.ref)
2724
+ // console.log('success:', success)
2369
2725
  var player = success.ref;
2726
+ setVideoPlayer(player);
2370
2727
  if (_typeof$1._typeof(player.ima3) === 'object' && player.ima3.settings && player.ima3.settings.serverUrl && targeting !== null) {
2371
2728
  player.ima3.settings.debug = true;
2372
2729
  if (targeting.content_placement && targeting.document_url) {
@@ -2377,7 +2734,7 @@ var Video = function Video(_ref) {
2377
2734
  player.on('loadedmetadata', function (evt) {
2378
2735
  var _this = this;
2379
2736
 
2380
- //console.log('loadedmetadata:', evt)
2737
+ // console.log('loadedmetadata:', evt)
2381
2738
  console.log('mediainfo:', player.mediainfo); // get the duration from here
2382
2739
  var duration = player.mediainfo.duration;
2383
2740
  var current = player.currentTime();
@@ -2421,17 +2778,42 @@ var Video = function Video(_ref) {
2421
2778
  autoPlayVideo();
2422
2779
  }
2423
2780
 
2424
- //Beam.report_beam_video('Ready', deviceType, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID)
2781
+ // Beam.report_beam_video('Ready', deviceType, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID)
2425
2782
  Segment.report_video_event('Video Ready', main.main_18, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID);
2426
2783
  });
2427
-
2428
- // play
2784
+ // let intId
2785
+ // const convertTime = (timeStr) => {
2786
+ // const minutes = parseInt(timeStr.slice(0, 2))
2787
+ // const seconds = parseInt(timeStr.slice(3))
2788
+ // return minutes * 60 + seconds
2789
+ // }
2790
+ // const modalTimes = []
2791
+ // polls.forEach(pollObj => modalTimes.push(convertTime(pollObj.timestamp)))
2429
2792
  player.on('play', function (evt) {
2430
2793
  var duration = player.mediainfo.duration;
2431
2794
  var current = player.currentTime();
2432
2795
  var queue = Math.floor(duration / 10);
2433
2796
  var segment = Math.floor(current / queue);
2434
- //Beam.report_beam_video('Play', deviceType, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID)
2797
+ if (polls) {
2798
+ var vidPlayer = this;
2799
+ intId = setInterval(function () {
2800
+ var ct = player.currentTime();
2801
+ if (intId) console.log('interval ID is ' + intId);
2802
+ modalTimes.forEach(function (modalTime, ind) {
2803
+ if (Math.floor(ct) === modalTime) {
2804
+ setPollItems(polls[ind].pollItems);
2805
+ setPollUrl(targeting.document_url[0]);
2806
+ setIsPollingTime(true);
2807
+ polls[ind].pollItems.forEach(function (item) {
2808
+ if (item.format === 'multiChoice') setMultiChoiceRender(true);
2809
+ if (item.format === 'textInput') setTextInputRender(true);
2810
+ });
2811
+ vidPlayer.pause();
2812
+ }
2813
+ });
2814
+ }, 1000);
2815
+ }
2816
+ // Beam.report_beam_video('Play', deviceType, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID)
2435
2817
  Segment.report_video_event('Video Play', main.main_18, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID);
2436
2818
  });
2437
2819
 
@@ -2441,7 +2823,8 @@ var Video = function Video(_ref) {
2441
2823
  var current = player.currentTime();
2442
2824
  var queue = Math.floor(duration / 10);
2443
2825
  var segment = Math.floor(current / queue);
2444
- //Beam.report_beam_video('Pause', deviceType, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID)
2826
+ clearInterval(intId);
2827
+ // Beam.report_beam_video('Pause', deviceType, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID)
2445
2828
  Segment.report_video_event('Video Pause', main.main_18, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID);
2446
2829
  });
2447
2830
 
@@ -2451,9 +2834,10 @@ var Video = function Video(_ref) {
2451
2834
  var current = player.currentTime();
2452
2835
  var queue = Math.floor(duration / 10);
2453
2836
  var segment = Math.floor(current / queue);
2454
- //Beam.report_beam_video('End', deviceType, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID)
2837
+ clearInterval(intId);
2838
+ // Beam.report_beam_video('End', deviceType, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID)
2455
2839
  Segment.report_video_event('Video End', main.main_18, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID);
2456
- //This is for old series format
2840
+ // This is for old series format
2457
2841
  autoplayNextVideo(evt);
2458
2842
  if (nextVideo) {
2459
2843
  window.location.href = '/view/' + nextVideo;
@@ -2467,7 +2851,7 @@ var Video = function Video(_ref) {
2467
2851
  var queue = Math.floor(duration / 10);
2468
2852
  var segment = Math.floor(current / queue);
2469
2853
  if (!queueProgress.includes(segment)) {
2470
- //Beam.report_beam_video('Segment', deviceType, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID)
2854
+ // Beam.report_beam_video('Segment', deviceType, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID)
2471
2855
  Segment.report_video_event('Video Segment', main.main_18, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID);
2472
2856
  queueProgress.push(segment);
2473
2857
  }
@@ -2476,19 +2860,19 @@ var Video = function Video(_ref) {
2476
2860
  // ad impression
2477
2861
  player.on('ads-ad-started', function (evt) {
2478
2862
  var duration = player.ads.ad.duration;
2479
- player.ads.ad.id;
2863
+ // const id = player.ads.ad.id
2480
2864
  var adType = 'Bright Cove: ' + player.ads.ad.type;
2481
2865
 
2482
- //Beam.report_beam_ad('AD Started', deviceType, '', '', '', '', '', adType, duration, id)
2866
+ // Beam.report_beam_ad('AD Started', deviceType, '', '', '', '', '', adType, duration, id)
2483
2867
  Segment.report_ad_event('Video Ad Started', main.main_18, duration, adType, accountIDs.brightcove.playerId, accountIDs.brightcove.accountId);
2484
2868
  });
2485
2869
 
2486
2870
  // ad ended
2487
2871
  player.on('ads-ad-ended', function (evt) {
2488
2872
  var duration = player.ads.ad.duration;
2489
- player.ads.ad.id;
2873
+ // const id = player.ads.ad.id
2490
2874
  var adType = 'Bright Cove: ' + player.ads.ad.type;
2491
- //Beam.report_beam_ad('AD Ended', deviceType, '', '', '', '', '', adType, duration, id)
2875
+ // Beam.report_beam_ad('AD Ended', deviceType, '', '', '', '', '', adType, duration, id)
2492
2876
  Segment.report_ad_event('Video Ad Ended', main.main_18, duration, adType, accountIDs.brightcove.playerId, accountIDs.brightcove.accountId);
2493
2877
  });
2494
2878
  };
@@ -2498,6 +2882,20 @@ var Video = function Video(_ref) {
2498
2882
  return React__default['default'].createElement(
2499
2883
  'div',
2500
2884
  null,
2885
+ isPollingTime ? React__default['default'].createElement(PopupPollModal
2886
+ // eslint-disable-next-line react/jsx-indent-props
2887
+ , { pollItems: pollItems
2888
+ // eslint-disable-next-line react/jsx-indent-props
2889
+ , pollUrl: pollUrl
2890
+ // eslint-disable-next-line react/jsx-indent-props
2891
+ , isPollingTime: isPollingTime
2892
+ // eslint-disable-next-line react/jsx-indent-props
2893
+ , restartPlayer: restartPlayer
2894
+ // eslint-disable-next-line react/jsx-indent-props
2895
+ , textInputRender: textInputRender
2896
+ // eslint-disable-next-line react/jsx-indent-props
2897
+ , multiChoiceRender: multiChoiceRender
2898
+ }) : null,
2501
2899
  React__default['default'].createElement(brightcoveReactPlayerLoader_es.ReactPlayerLoader, {
2502
2900
  onSuccess: onVideoSuccess,
2503
2901
  onFailure: onVideoFailure,
@@ -2516,6 +2914,20 @@ var Video = function Video(_ref) {
2516
2914
  return React__default['default'].createElement(
2517
2915
  'div',
2518
2916
  null,
2917
+ isPollingTime ? React__default['default'].createElement(PopupPollModal
2918
+ // eslint-disable-next-line react/jsx-indent-props
2919
+ , { pollItems: pollItems
2920
+ // eslint-disable-next-line react/jsx-indent-props
2921
+ , pollUrl: pollUrl
2922
+ // eslint-disable-next-line react/jsx-indent-props
2923
+ , isPollingTime: isPollingTime
2924
+ // eslint-disable-next-line react/jsx-indent-props
2925
+ , restartPlayer: restartPlayer
2926
+ // eslint-disable-next-line react/jsx-indent-props
2927
+ , textInputRender: textInputRender
2928
+ // eslint-disable-next-line react/jsx-indent-props
2929
+ , multiChoiceRender: multiChoiceRender
2930
+ }) : null,
2519
2931
  React__default['default'].createElement(brightcoveReactPlayerLoader_es.ReactPlayerLoader, {
2520
2932
  accountId: accountIDs.brightcove.accountId,
2521
2933
  playlistId: playlistID,
@@ -2534,16 +2946,30 @@ var Video = function Video(_ref) {
2534
2946
  return React__default['default'].createElement(
2535
2947
  'div',
2536
2948
  { className: 'brightcove-playlist', style: { position: 'relative', display: 'block', margin: '0px auto' } },
2537
- videoLoaded && React__default['default'].createElement('div', { 'data-experience': experienceID })
2949
+ isPollingTime ? React__default['default'].createElement(PopupPollModal
2950
+ // eslint-disable-next-line react/jsx-indent-props
2951
+ , { pollItems: pollItems
2952
+ // eslint-disable-next-line react/jsx-indent-props
2953
+ , pollUrl: pollUrl
2954
+ // eslint-disable-next-line react/jsx-indent-props
2955
+ , isPollingTime: isPollingTime
2956
+ // eslint-disable-next-line react/jsx-indent-props
2957
+ , restartPlayer: restartPlayer
2958
+ // eslint-disable-next-line react/jsx-indent-props
2959
+ , textInputRender: textInputRender
2960
+ // eslint-disable-next-line react/jsx-indent-props
2961
+ , multiChoiceRender: multiChoiceRender
2962
+ }) : null
2538
2963
  );
2539
2964
  }
2540
2965
  return null;
2541
2966
  }
2967
+
2542
2968
  if (source === 'mp4') {
2543
2969
  return React__default['default'].createElement(
2544
2970
  'div',
2545
2971
  null,
2546
- React__default['default'].createElement(VideoMp4, { url: node.mp4url, thumbnail: null, vidLoaded: true })
2972
+ React__default['default'].createElement(VideoMp4, { url: node.mp4url, thumbnail: null, vidLoaded: true, polls: polls, modalTimes: modalTimes, targetingUrl: targeting.document_url[0] })
2547
2973
  );
2548
2974
  }
2549
2975
 
package/dist/cjs/index.js CHANGED
@@ -89,7 +89,7 @@ var VerticalHero = require('./VerticalHero.js');
89
89
  var YahooHero = require('./YahooHero.js');
90
90
  var GridHero = require('./GridHero.js');
91
91
  var ConferenceArticleCard = require('./ConferenceArticleCard.js');
92
- var getSerializers = require('./index-07f1af18.js');
92
+ var getSerializers = require('./index-636dcd3f.js');
93
93
  var Beam = require('./Beam.js');
94
94
  var Segment = require('./Segment.js');
95
95
  var KMTracker = require('./KMTracker.js');