@mjhls/mjh-framework 1.0.686 → 1.0.687

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 (74) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/AD300x250.js +2 -1
  3. package/dist/cjs/AD300x250x600.js +2 -1
  4. package/dist/cjs/AD728x90.js +2 -1
  5. package/dist/cjs/ADFloatingFooter.js +2 -1
  6. package/dist/cjs/ADGutter.js +2 -1
  7. package/dist/cjs/ADSkyscraper.js +2 -1
  8. package/dist/cjs/ADSponsoredResources.js +2 -1
  9. package/dist/cjs/ADWebcast.js +2 -1
  10. package/dist/cjs/ADWelcome.js +2 -1
  11. package/dist/cjs/AdSlot.js +6 -5
  12. package/dist/cjs/Beam.js +340 -4
  13. package/dist/cjs/Column2.js +1 -2
  14. package/dist/cjs/Column3.js +2 -1
  15. package/dist/cjs/DeckContent.js +3 -2
  16. package/dist/cjs/ExternalResources.js +3 -2
  17. package/dist/cjs/GridContent.js +4 -3
  18. package/dist/cjs/HamMagazine.js +7 -8
  19. package/dist/cjs/IssueLanding.js +4 -3
  20. package/dist/cjs/LeftNav.js +3 -4
  21. package/dist/cjs/MasterDeck.js +4 -3
  22. package/dist/cjs/NavDvm.js +5 -6
  23. package/dist/cjs/NavMagazine.js +7 -8
  24. package/dist/cjs/NavNative.js +7 -8
  25. package/dist/cjs/NavNormal.js +2 -4
  26. package/dist/cjs/PartnerDetailListing.js +5 -4
  27. package/dist/cjs/QueueDeckExpanded.js +4 -3
  28. package/dist/cjs/Segment.js +346 -4
  29. package/dist/cjs/SideFooter.js +2 -4
  30. package/dist/cjs/TemplateNormal.js +2 -1
  31. package/dist/cjs/View.js +3 -2
  32. package/dist/cjs/getSerializers.js +3 -2
  33. package/dist/cjs/{index-8c9e8ca7.js → index-a1090dcd.js} +47 -47
  34. package/dist/cjs/index.js +7 -6
  35. package/dist/esm/AD300x250.js +2 -1
  36. package/dist/esm/AD300x250x600.js +2 -1
  37. package/dist/esm/AD728x90.js +2 -1
  38. package/dist/esm/ADFloatingFooter.js +2 -1
  39. package/dist/esm/ADGutter.js +2 -1
  40. package/dist/esm/ADSkyscraper.js +2 -1
  41. package/dist/esm/ADSponsoredResources.js +2 -1
  42. package/dist/esm/ADWebcast.js +2 -1
  43. package/dist/esm/ADWelcome.js +2 -1
  44. package/dist/esm/AdSlot.js +2 -1
  45. package/dist/esm/Beam.js +343 -3
  46. package/dist/esm/Column2.js +1 -2
  47. package/dist/esm/Column3.js +2 -1
  48. package/dist/esm/DeckContent.js +3 -2
  49. package/dist/esm/ExternalResources.js +3 -2
  50. package/dist/esm/GridContent.js +4 -3
  51. package/dist/esm/HamMagazine.js +1 -2
  52. package/dist/esm/IssueLanding.js +4 -3
  53. package/dist/esm/LeftNav.js +2 -3
  54. package/dist/esm/MasterDeck.js +4 -3
  55. package/dist/esm/NavDvm.js +1 -2
  56. package/dist/esm/NavMagazine.js +1 -2
  57. package/dist/esm/NavNative.js +1 -2
  58. package/dist/esm/NavNormal.js +1 -3
  59. package/dist/esm/PartnerDetailListing.js +5 -4
  60. package/dist/esm/QueueDeckExpanded.js +4 -3
  61. package/dist/esm/Segment.js +349 -3
  62. package/dist/esm/SideFooter.js +1 -3
  63. package/dist/esm/TemplateNormal.js +2 -1
  64. package/dist/esm/View.js +3 -2
  65. package/dist/esm/getSerializers.js +3 -2
  66. package/dist/esm/{index-5505d4f9.js → index-a3da0503.js} +2 -2
  67. package/dist/esm/index.js +5 -4
  68. package/package.json +1 -1
  69. package/dist/cjs/beam-7217b7e7.js +0 -733
  70. package/dist/esm/beam-681a9749.js +0 -730
  71. /package/dist/cjs/{ADInfeed-c676389b.js → ADInfeed-cf81b7aa.js} +0 -0
  72. /package/dist/cjs/{ADlgInfeed-57d63c87.js → ADlgInfeed-ebc1bf56.js} +0 -0
  73. /package/dist/esm/{ADInfeed-97b8cea7.js → ADInfeed-898b9c8f.js} +0 -0
  74. /package/dist/esm/{ADlgInfeed-3ab91c75.js → ADlgInfeed-a747451b.js} +0 -0
@@ -1,730 +0,0 @@
1
- import { _ as _JSON$stringify } from './stringify-008c8802.js';
2
- import { a as _asyncToGenerator, r as regenerator } from './asyncToGenerator-7c654f36.js';
3
-
4
- require("babel-polyfill");
5
-
6
- var Segment = {
7
- // onclive default
8
- init: function init() {
9
- var apiKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'BBbKMoOjmhsxPnbd2nO6osz3zq67DzuN';
10
-
11
- if (typeof window === 'undefined') {
12
- console.error('window object is not defined');
13
- return;
14
- }
15
-
16
- if (window.$segment) {
17
- return;
18
- }
19
-
20
- var Analytics = require('@segment/analytics.js-core/build/analytics');
21
- var SegmentIntegration = require('@segment/analytics.js-integration-segmentio');
22
-
23
- var analytics = new Analytics();
24
- analytics.use(SegmentIntegration);
25
-
26
- var integrationSettings = {
27
- "Segment.io": {
28
- apiKey: apiKey,
29
- retryQueue: true,
30
- addBundledMetadata: true
31
- }
32
- };
33
-
34
- analytics.initialize(integrationSettings);
35
- window.$segment = analytics;
36
- },
37
- identify: function identify(eKey) {
38
- if (!eKey) {
39
- throw new Error('eKey is not present');
40
- }
41
-
42
- var segment = window.$segment;
43
- if (!segment) {
44
- console.error('Segment not initialized', window);
45
- return;
46
- }
47
-
48
- var buff = Buffer.from(eKey, 'base64');
49
- var email = buff.toString('ascii');
50
-
51
- segment.identify(eKey, {
52
- email: email
53
- });
54
- },
55
- getURL: function getURL(url) {
56
- var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
57
-
58
- if (!data || !data.needSegmentSupport) {
59
- return url;
60
- }
61
-
62
- var segment = typeof window !== 'undefined' ? window.$segment : null;
63
- if (!segment) {
64
- console.error('segment not defined');
65
- return url;
66
- }
67
-
68
- var user = segment.user();
69
- if (!user) {
70
- console.log('segment user not defined');
71
- return url;
72
- }
73
-
74
- var anonymouseId = user.anonymousId();
75
- //const eKey = Beam.proc_eKey(Beam.proc_url())
76
- var eKey = user._getId();
77
- if (eKey) {
78
- url += (url.includes('?') ? '&' : '?') + 'ekey=' + eKey;
79
- } else {
80
- url += (url.includes('?') ? '&' : '?') + 'anonymousid=' + anonymouseId;
81
- }
82
-
83
- return url;
84
- },
85
- getIDs: function getIDs() {
86
- var _this = this;
87
-
88
- return _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
89
- var res, json;
90
- return regenerator.wrap(function _callee$(_context) {
91
- while (1) {
92
- switch (_context.prev = _context.next) {
93
- case 0:
94
- _context.next = 2;
95
- return fetch('https://beam.mjhlifesciences.com/api/beam/id', {
96
- headers: {
97
- 'Content-Type': 'application/json',
98
- Accept: 'application/json'
99
- },
100
- method: 'post',
101
- credentials: 'include'
102
- });
103
-
104
- case 2:
105
- res = _context.sent;
106
- _context.next = 5;
107
- return res.json();
108
-
109
- case 5:
110
- json = _context.sent;
111
- return _context.abrupt('return', json);
112
-
113
- case 7:
114
- case 'end':
115
- return _context.stop();
116
- }
117
- }
118
- }, _callee, _this);
119
- }))();
120
- },
121
- pageview: function pageview(domain) {
122
- var _this2 = this;
123
-
124
- return _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2() {
125
- var segment, result, beam_id, session_id;
126
- return regenerator.wrap(function _callee2$(_context2) {
127
- while (1) {
128
- switch (_context2.prev = _context2.next) {
129
- case 0:
130
- segment = window.$segment;
131
-
132
- if (segment) {
133
- _context2.next = 4;
134
- break;
135
- }
136
-
137
- console.error('Segment not initialized', window);
138
- return _context2.abrupt('return');
139
-
140
- case 4:
141
- _context2.next = 6;
142
- return _this2.getIDs();
143
-
144
- case 6:
145
- result = _context2.sent;
146
- beam_id = result.beam_id ? result.beam_id : '';
147
- session_id = result.session_id ? result.session_id : '';
148
-
149
-
150
- segment.track('pageviews', {
151
- beamid: beam_id,
152
- sessionid: session_id,
153
- category: '',
154
- domain: domain
155
- });
156
-
157
- case 10:
158
- case 'end':
159
- return _context2.stop();
160
- }
161
- }
162
- }, _callee2, _this2);
163
- }))();
164
- },
165
- report_video_event: function report_video_event(action, deviceType, duration, current, segmentData) {
166
- var videoType = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'Youtube';
167
- var brightCovePlayerID = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '';
168
-
169
- var _this3 = this;
170
-
171
- var brightCoveAccountID = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : '';
172
- var brightCoveVideoID = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : '';
173
- return _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3() {
174
- var segment, result, beam_id, session_id, domain, data;
175
- return regenerator.wrap(function _callee3$(_context3) {
176
- while (1) {
177
- switch (_context3.prev = _context3.next) {
178
- case 0:
179
- segment = window.$segment;
180
-
181
- if (segment) {
182
- _context3.next = 4;
183
- break;
184
- }
185
-
186
- console.error('Segment not initialized');
187
- return _context3.abrupt('return');
188
-
189
- case 4:
190
- _context3.next = 6;
191
- return _this3.getIDs();
192
-
193
- case 6:
194
- result = _context3.sent;
195
- beam_id = result.beam_id ? result.beam_id : '';
196
- session_id = result.session_id ? result.session_id : '';
197
- domain = typeof window !== 'undefined' && window.location ? window.location.hostname : '';
198
- data = {
199
- beamid: beam_id,
200
- sessionid: session_id,
201
- domain: domain,
202
- Devicetype: deviceType,
203
- videoid: brightCoveVideoID,
204
- title: '',
205
- category: '',
206
- videoplayer: videoType,
207
- totalduration: duration,
208
- currentduration: current,
209
- segment: segmentData,
210
- queue: Math.floor(duration / 10),
211
- brightCovePlayerID: brightCovePlayerID,
212
- brightCoveAccountID: brightCoveAccountID
213
- };
214
-
215
-
216
- console.log('Segment ' + videoType, action, data);
217
-
218
- segment.track(action, data);
219
-
220
- case 13:
221
- case 'end':
222
- return _context3.stop();
223
- }
224
- }
225
- }, _callee3, _this3);
226
- }))();
227
- },
228
- report_ad_event: function report_ad_event(action, deviceType, duration) {
229
- var adType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'brightcove';
230
- var adId = arguments[4];
231
-
232
- var _this4 = this;
233
-
234
- var brightCovePlayerID = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : '';
235
- var brightCoveAccountID = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '';
236
- return _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee4() {
237
- var segment, result, beam_id, session_id, domain, data;
238
- return regenerator.wrap(function _callee4$(_context4) {
239
- while (1) {
240
- switch (_context4.prev = _context4.next) {
241
- case 0:
242
- segment = window.$segment;
243
-
244
- if (segment) {
245
- _context4.next = 4;
246
- break;
247
- }
248
-
249
- console.error('Segment not initialized');
250
- return _context4.abrupt('return');
251
-
252
- case 4:
253
- _context4.next = 6;
254
- return _this4.getIDs();
255
-
256
- case 6:
257
- result = _context4.sent;
258
- beam_id = result.beam_id ? result.beam_id : '';
259
- session_id = result.session_id ? result.session_id : '';
260
- domain = typeof window !== 'undefined' && window.location ? window.location.hostname : '';
261
- data = {
262
- beamid: beam_id,
263
- sessionid: session_id,
264
- domain: domain,
265
- Devicetype: deviceType,
266
- title: '',
267
- category: '',
268
- adType: adType,
269
- totalduration: duration,
270
- adId: adId,
271
- brightCovePlayerID: brightCovePlayerID,
272
- brightCoveAccountID: brightCoveAccountID
273
- };
274
-
275
-
276
- console.log('Segment ' + adType, action, data);
277
-
278
- segment.track(action, data);
279
-
280
- case 13:
281
- case 'end':
282
- return _context4.stop();
283
- }
284
- }
285
- }, _callee4, _this4);
286
- }))();
287
- },
288
- adClicked: function adClicked(domain, advertiserid, campaignid, creativeid, itemid, size, isemptyline, sourceAgnosticCreativeId, sourceAgnosticlineId) {
289
- var _this5 = this;
290
-
291
- return _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee5() {
292
- var segment, result, beam_id, session_id;
293
- return regenerator.wrap(function _callee5$(_context5) {
294
- while (1) {
295
- switch (_context5.prev = _context5.next) {
296
- case 0:
297
- segment = window.$segment;
298
-
299
- if (segment) {
300
- _context5.next = 4;
301
- break;
302
- }
303
-
304
- console.error('Segment not initialized');
305
- return _context5.abrupt('return');
306
-
307
- case 4:
308
- _context5.next = 6;
309
- return _this5.getIDs();
310
-
311
- case 6:
312
- result = _context5.sent;
313
- beam_id = result.beam_id ? result.beam_id : '';
314
- session_id = result.session_id ? result.session_id : '';
315
-
316
-
317
- segment.track('Ad Clicked', {
318
- beamid: beam_id,
319
- sessionid: session_id,
320
- advertiserid: advertiserid,
321
- campaignid: campaignid,
322
- creativeid: creativeid,
323
- itemid: itemid,
324
- size: size,
325
- isemptyline: isemptyline,
326
- sourceAgnosticCreativeId: sourceAgnosticCreativeId,
327
- sourceAgnosticlineId: sourceAgnosticlineId,
328
- domain: domain
329
- });
330
-
331
- case 10:
332
- case 'end':
333
- return _context5.stop();
334
- }
335
- }
336
- }, _callee5, _this5);
337
- }))();
338
- },
339
- adViewed: function adViewed(domain, advertiserid, campaignid, creativeid, itemid, size, isemptyline, sourceAgnosticCreativeId, sourceAgnosticlineId) {
340
- var _this6 = this;
341
-
342
- return _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee6() {
343
- var segment, result, beam_id, session_id;
344
- return regenerator.wrap(function _callee6$(_context6) {
345
- while (1) {
346
- switch (_context6.prev = _context6.next) {
347
- case 0:
348
- segment = window.$segment;
349
-
350
- if (segment) {
351
- _context6.next = 4;
352
- break;
353
- }
354
-
355
- console.error('Segment not initialized');
356
- return _context6.abrupt('return');
357
-
358
- case 4:
359
- _context6.next = 6;
360
- return _this6.getIDs();
361
-
362
- case 6:
363
- result = _context6.sent;
364
- beam_id = result.beam_id ? result.beam_id : '';
365
- session_id = result.session_id ? result.session_id : '';
366
-
367
-
368
- segment.track('Impression Viewed', {
369
- beamid: beam_id,
370
- sessionid: session_id,
371
- advertiserid: advertiserid,
372
- campaignid: campaignid,
373
- creativeid: creativeid,
374
- itemid: itemid,
375
- size: size,
376
- isemptyline: isemptyline,
377
- sourceAgnosticCreativeId: sourceAgnosticCreativeId,
378
- sourceAgnosticlineId: sourceAgnosticlineId,
379
- domain: domain
380
- });
381
-
382
- case 10:
383
- case 'end':
384
- return _context6.stop();
385
- }
386
- }
387
- }, _callee6, _this6);
388
- }))();
389
- }
390
- };
391
-
392
- require("babel-polyfill");
393
- // server key for beam
394
- // fnADs4Gtx6ACEgKgwlNo-eNSIrdwykH9Zj74GsDI
395
-
396
- var beam_domain = 'https://beam.mjhlifesciences.com';
397
-
398
- function getCookie(cname) {
399
- var name = cname + "=";
400
- var decodedCookie = decodeURIComponent(document.cookie);
401
- var ca = decodedCookie.split(';');
402
- for (var i = 0; i < ca.length; i++) {
403
- var c = ca[i];
404
- while (c.charAt(0) == ' ') {
405
- c = c.substring(1);
406
- }
407
- if (c.indexOf(name) == 0) {
408
- return c.substring(name.length, c.length);
409
- }
410
- }
411
- return "";
412
- }
413
-
414
- var Beam = {
415
- proc_url: function proc_url() {
416
- var $_GET = {};
417
- document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function () {
418
- function decode(s) {
419
- return decodeURIComponent(s.split("+").join(" "));
420
- }
421
- $_GET[decode(arguments[1])] = decode(arguments[2]);
422
- });
423
-
424
- return $_GET;
425
- },
426
- proc_eKey: function proc_eKey($_GET) {
427
- var _this = this;
428
-
429
- return _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
430
- var eKey;
431
- return regenerator.wrap(function _callee$(_context) {
432
- while (1) {
433
- switch (_context.prev = _context.next) {
434
- case 0:
435
- eKey = "N/A";
436
-
437
-
438
- if ($_GET["eKey"]) {
439
- eKey = $_GET["eKey"];
440
- } else if (typeof window.eKey !== 'undefined') {
441
- eKey = window.eKey;
442
- }
443
-
444
- if (!eKey || eKey === 'N/A') {
445
- eKey = getCookie('eKey');
446
- }
447
-
448
- return _context.abrupt('return', eKey);
449
-
450
- case 4:
451
- case 'end':
452
- return _context.stop();
453
- }
454
- }
455
- }, _callee, _this);
456
- }))();
457
- },
458
- proc_source: function proc_source() {
459
- var referrer = "N/A";
460
-
461
- if (encodeURIComponent(document.referrer)) {
462
- referrer = encodeURIComponent(document.referrer);
463
- }
464
-
465
- return referrer;
466
- },
467
- proc_meta: function proc_meta() {
468
- var data = {};
469
-
470
- //keyword processing
471
- var element = document.querySelector('meta[name="keywords"]');
472
-
473
- data.keywords = "N/A";
474
-
475
- if (element && element.getAttribute("content")) {
476
- data.keywords = element.getAttribute("content");
477
- }
478
-
479
- //title processing
480
- data.title = "N/A";
481
- if (document.title !== "undefined") {
482
- data.title = document.title;
483
- }
484
-
485
- return data;
486
- },
487
- proc_host: function proc_host() {
488
- var data = {};
489
- data.domain = window.location.hostname;
490
- data.uri = window.location.pathname;
491
- data.host = window.location.host;
492
- data.protocol = window.location.protocol;
493
-
494
- if (window.location.search) {
495
- data.uri = data.uri + window.location.search;
496
- }
497
-
498
- return data;
499
- },
500
- get_beam: function get_beam(deviceType) {
501
- var _this2 = this;
502
-
503
- return _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2() {
504
- var beam;
505
- return regenerator.wrap(function _callee2$(_context2) {
506
- while (1) {
507
- switch (_context2.prev = _context2.next) {
508
- case 0:
509
- beam = {};
510
- _context2.next = 3;
511
- return _this2.proc_eKey(_this2.proc_url());
512
-
513
- case 3:
514
- beam.eKey = _context2.sent;
515
-
516
- beam.source = _this2.proc_source();
517
- beam.meta = _this2.proc_meta();
518
- beam.host = _this2.proc_host();
519
- beam.device = deviceType;
520
- return _context2.abrupt('return', beam);
521
-
522
- case 9:
523
- case 'end':
524
- return _context2.stop();
525
- }
526
- }
527
- }, _callee2, _this2);
528
- }))();
529
- },
530
-
531
-
532
- /* for client use */
533
- report_beam_event: function report_beam_event(action, deviceType) {
534
- var _this3 = this;
535
-
536
- return _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3() {
537
- var beam, response, res;
538
- return regenerator.wrap(function _callee3$(_context3) {
539
- while (1) {
540
- switch (_context3.prev = _context3.next) {
541
- case 0:
542
- _context3.next = 2;
543
- return _this3.get_beam(deviceType);
544
-
545
- case 2:
546
- beam = _context3.sent;
547
-
548
-
549
- console.log('Call Beam', action, beam);
550
-
551
- _context3.next = 6;
552
- return fetch(beam_domain + '/api/beam/event', {
553
- headers: {
554
- 'Content-Type': 'application/json',
555
- 'Accept': 'application/json'
556
- },
557
- method: 'post',
558
- credentials: "include",
559
- body: _JSON$stringify({
560
- event: 'Beam',
561
- action: action,
562
- beam: _JSON$stringify(beam)
563
- })
564
- });
565
-
566
- case 6:
567
- response = _context3.sent;
568
- _context3.next = 9;
569
- return response.json();
570
-
571
- case 9:
572
- res = _context3.sent;
573
-
574
- if (res.error) {
575
- console.error('Beam reporting error:', res.error);
576
- }
577
-
578
- // report segment when eKey is present
579
- if (beam.eKey) {
580
- Segment.identify(beam.eKey);
581
- }
582
-
583
- case 12:
584
- case 'end':
585
- return _context3.stop();
586
- }
587
- }
588
- }, _callee3, _this3);
589
- }))();
590
- },
591
- report_beam_ad: function report_beam_ad(action, deviceType, cID, lID, campID, adSize, slotId) {
592
- var adType = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 'DFP';
593
-
594
- var _this4 = this;
595
-
596
- var adDurationBrightCove = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : '';
597
- var adIDBrightCove = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : '';
598
- return _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee4() {
599
- var beam, data, response, res;
600
- return regenerator.wrap(function _callee4$(_context4) {
601
- while (1) {
602
- switch (_context4.prev = _context4.next) {
603
- case 0:
604
- _context4.next = 2;
605
- return _this4.get_beam(deviceType);
606
-
607
- case 2:
608
- beam = _context4.sent;
609
- data = {};
610
-
611
- data.campaignId = campID;
612
- data.lineItemId = lID;
613
- data.creativeId = cID;
614
- data.size = adSize;
615
- data.slotId = slotId;
616
-
617
- data.adType = adType;
618
- data.adDurationBrightCove = adDurationBrightCove;
619
- data.adIDBrightCove = adIDBrightCove;
620
-
621
- console.log('Call ' + adType, action, data);
622
-
623
- _context4.next = 15;
624
- return fetch(beam_domain + '/api/beam/ad', {
625
- headers: {
626
- 'Content-Type': 'application/json',
627
- 'Accept': 'application/json'
628
- },
629
- method: 'post',
630
- credentials: "include",
631
- body: _JSON$stringify({
632
- event: 'DFP',
633
- action: action,
634
- beam: _JSON$stringify(beam),
635
- data: _JSON$stringify(data)
636
- })
637
- });
638
-
639
- case 15:
640
- response = _context4.sent;
641
- _context4.next = 18;
642
- return response.json();
643
-
644
- case 18:
645
- res = _context4.sent;
646
-
647
- if (res.error) {
648
- console.error('DFP reporting error:', res.error);
649
- }
650
-
651
- case 20:
652
- case 'end':
653
- return _context4.stop();
654
- }
655
- }
656
- }, _callee4, _this4);
657
- }))();
658
- },
659
- report_beam_video: function report_beam_video(action, deviceType, duration, current, segment) {
660
- var videoType = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'Youtube';
661
- var brightCovePlayerID = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '';
662
-
663
- var _this5 = this;
664
-
665
- var brightCoveAccountID = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : '';
666
- var brightCoveVideoID = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : '';
667
- return _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee5() {
668
- var beam, data, response, res;
669
- return regenerator.wrap(function _callee5$(_context5) {
670
- while (1) {
671
- switch (_context5.prev = _context5.next) {
672
- case 0:
673
- _context5.next = 2;
674
- return _this5.get_beam(deviceType);
675
-
676
- case 2:
677
- beam = _context5.sent;
678
- data = {};
679
-
680
- data.duration = duration;
681
- data.queue = Math.floor(duration / 10);
682
- data.segment = segment;
683
- data.current = current;
684
-
685
- data.videoType = videoType;
686
- data.brightCovePlayerID = brightCovePlayerID;
687
- data.brightCoveAccountID = brightCoveAccountID;
688
- data.brightCoveVideoID = brightCoveVideoID;
689
-
690
- console.log('Call ' + videoType, action, data);
691
-
692
- _context5.next = 15;
693
- return fetch(beam_domain + '/api/beam/video', {
694
- headers: {
695
- 'Content-Type': 'application/json',
696
- 'Accept': 'application/json'
697
- },
698
- method: 'post',
699
- credentials: "include",
700
- body: _JSON$stringify({
701
- event: 'Video',
702
- action: action,
703
- beam: _JSON$stringify(beam),
704
- data: _JSON$stringify(data)
705
- })
706
- });
707
-
708
- case 15:
709
- response = _context5.sent;
710
- _context5.next = 18;
711
- return response.json();
712
-
713
- case 18:
714
- res = _context5.sent;
715
-
716
- if (res.error) {
717
- console.error('Video reporting error:', res.error);
718
- }
719
-
720
- case 20:
721
- case 'end':
722
- return _context5.stop();
723
- }
724
- }
725
- }, _callee5, _this5);
726
- }))();
727
- }
728
- };
729
-
730
- export { Beam as B, Segment as S };