@mjhls/mjh-framework 1.0.594 → 1.0.597

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 (166) hide show
  1. package/README.md +172 -172
  2. package/dist/cjs/AD.js +1 -1
  3. package/dist/cjs/AD300x250.js +3 -3
  4. package/dist/cjs/AD300x250x600.js +3 -3
  5. package/dist/cjs/AD728x90.js +4 -4
  6. package/dist/cjs/ADFloatingFooter.js +5 -5
  7. package/dist/cjs/ADGutter.js +2 -2
  8. package/dist/cjs/ADSkyscraper.js +2 -2
  9. package/dist/cjs/ADSponsoredResources.js +2 -2
  10. package/dist/cjs/ADWebcast.js +2 -2
  11. package/dist/cjs/ADWelcome.js +2 -2
  12. package/dist/cjs/AdSlot.js +2 -2
  13. package/dist/cjs/AdSlotsProvider.js +1 -1
  14. package/dist/cjs/ArticleQueue.js +298 -28
  15. package/dist/cjs/Auth.js +256 -507
  16. package/dist/cjs/{AuthorComponent-cb8b8128.js → AuthorComponent-3c79e1ab.js} +2 -2
  17. package/dist/cjs/{BlockContent-f942392e.js → BlockContent-77f81ffc.js} +1 -1
  18. package/dist/cjs/CMEDeck.js +5 -5
  19. package/dist/cjs/Column3.js +4 -4
  20. package/dist/cjs/ConferenceArticleCard.js +17 -17
  21. package/dist/cjs/DeckContent.js +16 -16
  22. package/dist/cjs/DeckQueue.js +7 -7
  23. package/dist/cjs/{Dfp-fbe32b96.js → Dfp-fcdeabc4.js} +1 -1
  24. package/dist/cjs/EventsDeck.js +22 -22
  25. package/dist/cjs/ExternalResources.js +7 -7
  26. package/dist/cjs/Feature.js +3 -3
  27. package/dist/cjs/ForbesHero.js +3 -3
  28. package/dist/cjs/GridContent.js +12 -12
  29. package/dist/cjs/GridHero.js +3 -3
  30. package/dist/cjs/GroupDeck.js +5 -5
  31. package/dist/cjs/HamMagazine.js +11 -11
  32. package/dist/cjs/Hero.js +1 -1
  33. package/dist/cjs/HorizontalHero.js +2 -2
  34. package/dist/cjs/InscreenSensor-22a96661.js +85 -0
  35. package/dist/cjs/IssueContentDeck.js +3 -3
  36. package/dist/cjs/IssueDeck.js +2 -2
  37. package/dist/cjs/IssueLanding.js +37 -37
  38. package/dist/cjs/KMTracker.js +15 -15
  39. package/dist/cjs/LeftNav.js +2 -2
  40. package/dist/cjs/MasterDeck.js +17 -17
  41. package/dist/cjs/NavMagazine.js +12 -12
  42. package/dist/cjs/NavNative.js +11 -11
  43. package/dist/cjs/OncliveHero.js +2 -2
  44. package/dist/cjs/OncliveLargeHero.js +3 -3
  45. package/dist/cjs/PartnerDetailListing.js +1307 -30
  46. package/dist/cjs/PublicationDeck.js +1 -1
  47. package/dist/cjs/PublicationLanding.js +33 -33
  48. package/dist/cjs/QueueDeckExpanded.js +10 -10
  49. package/dist/cjs/RecentNews.js +93 -0
  50. package/dist/cjs/RelatedContent.js +30 -30
  51. package/dist/cjs/RelatedTopicsDropdown.js +10 -10
  52. package/dist/cjs/SideFooter.js +2 -2
  53. package/dist/cjs/TaxonomyCard.js +2 -2
  54. package/dist/cjs/TemplateNormal.js +2 -2
  55. package/dist/cjs/ThumbnailCard.js +1 -1
  56. package/dist/cjs/Ustream.js +2 -2
  57. package/dist/cjs/VerticalHero.js +2 -2
  58. package/dist/cjs/VideoSeriesFilter.js +1 -1
  59. package/dist/cjs/VideoSeriesListing.js +5 -5
  60. package/dist/cjs/View.js +259 -88
  61. package/dist/cjs/YahooHero.js +3 -3
  62. package/dist/cjs/YoutubeGroup.js +5 -5
  63. package/dist/cjs/getQuery.js +2 -4
  64. package/dist/cjs/getRelatedArticle.js +358 -11
  65. package/dist/cjs/getSerializers.js +6 -6
  66. package/dist/cjs/{getTargeting-b15993cb.js → getTargeting-3d208b98.js} +11 -11
  67. package/dist/cjs/getTargeting.js +1 -1
  68. package/dist/cjs/{index-5be2866f.js → index-3294d3bc.js} +1 -1
  69. package/dist/cjs/index-bd6c9f56.js +211 -0
  70. package/dist/cjs/{index-b5eb3ff8.js → index-be0c82be.js} +19 -20
  71. package/dist/cjs/{index-e7f86168.js → index-c4972b44.js} +441 -453
  72. package/dist/cjs/{index-f7ee1612.js → index-fa3cec70.js} +6 -4
  73. package/dist/cjs/{index.es-ab3f2690.js → index.es-9110add6.js} +1 -3
  74. package/dist/cjs/index.js +17 -18
  75. package/dist/cjs/{inherits-93684212.js → inherits-14962339.js} +4 -4
  76. package/dist/cjs/{main-bc4db521.js → main-88348b15.js} +35 -66
  77. package/dist/cjs/{moment-66a6a284.js → moment-575fe24c.js} +1 -1
  78. package/dist/cjs/urlFor.js +2 -2
  79. package/dist/esm/AD.js +1 -1
  80. package/dist/esm/AD300x250.js +5 -5
  81. package/dist/esm/AD300x250x600.js +5 -5
  82. package/dist/esm/AD728x90.js +6 -6
  83. package/dist/esm/ADFloatingFooter.js +7 -7
  84. package/dist/esm/ADGutter.js +4 -4
  85. package/dist/esm/ADSkyscraper.js +4 -4
  86. package/dist/esm/ADSponsoredResources.js +4 -4
  87. package/dist/esm/ADWebcast.js +4 -4
  88. package/dist/esm/ADWelcome.js +4 -4
  89. package/dist/esm/AdSlot.js +4 -4
  90. package/dist/esm/AdSlotsProvider.js +1 -1
  91. package/dist/esm/ArticleQueue.js +296 -26
  92. package/dist/esm/Auth.js +248 -499
  93. package/dist/esm/{AuthorComponent-158226c9.js → AuthorComponent-357dbee9.js} +2 -2
  94. package/dist/esm/{BlockContent-a614acdf.js → BlockContent-e9b4ddcf.js} +1 -1
  95. package/dist/esm/CMEDeck.js +7 -7
  96. package/dist/esm/Column2.js +3 -3
  97. package/dist/esm/Column3.js +8 -8
  98. package/dist/esm/ConferenceArticleCard.js +17 -17
  99. package/dist/esm/DeckContent.js +17 -17
  100. package/dist/esm/DeckQueue.js +10 -10
  101. package/dist/esm/{Dfp-ae9336e2.js → Dfp-a36ad202.js} +3 -3
  102. package/dist/esm/EventsDeck.js +22 -22
  103. package/dist/esm/ExternalResources.js +9 -9
  104. package/dist/esm/Feature.js +3 -3
  105. package/dist/esm/ForbesHero.js +3 -3
  106. package/dist/esm/GridContent.js +15 -15
  107. package/dist/esm/GridHero.js +3 -3
  108. package/dist/esm/GroupDeck.js +5 -5
  109. package/dist/esm/HamMagazine.js +11 -11
  110. package/dist/esm/Hero.js +1 -1
  111. package/dist/esm/HorizontalHero.js +2 -2
  112. package/dist/esm/InscreenSensor-beb2ec79.js +80 -0
  113. package/dist/esm/IssueContentDeck.js +3 -3
  114. package/dist/esm/IssueDeck.js +2 -2
  115. package/dist/esm/IssueLanding.js +39 -39
  116. package/dist/esm/KMTracker.js +15 -15
  117. package/dist/esm/LeftNav.js +4 -4
  118. package/dist/esm/MasterDeck.js +18 -18
  119. package/dist/esm/NavMagazine.js +12 -12
  120. package/dist/esm/NavNative.js +11 -11
  121. package/dist/esm/OncliveHero.js +2 -2
  122. package/dist/esm/OncliveLargeHero.js +3 -3
  123. package/dist/esm/PartnerDetailListing.js +1307 -30
  124. package/dist/esm/PublicationDeck.js +1 -1
  125. package/dist/esm/PublicationLanding.js +33 -33
  126. package/dist/esm/QueueDeckExpanded.js +12 -12
  127. package/dist/esm/RecentNews.js +88 -0
  128. package/dist/esm/RelatedContent.js +30 -30
  129. package/dist/esm/RelatedTopicsDropdown.js +10 -10
  130. package/dist/esm/SideFooter.js +5 -5
  131. package/dist/esm/TaxonomyCard.js +2 -2
  132. package/dist/esm/TemplateNormal.js +6 -6
  133. package/dist/esm/ThumbnailCard.js +1 -1
  134. package/dist/esm/Ustream.js +2 -2
  135. package/dist/esm/VerticalHero.js +2 -2
  136. package/dist/esm/VideoSeriesFilter.js +1 -1
  137. package/dist/esm/VideoSeriesListing.js +6 -6
  138. package/dist/esm/View.js +237 -66
  139. package/dist/esm/YahooHero.js +3 -3
  140. package/dist/esm/YoutubeGroup.js +5 -5
  141. package/dist/esm/{_arrayMap-64cbe0e4.js → _arrayMap-818441dd.js} +1 -1
  142. package/dist/esm/{debounce-048d9cb6.js → debounce-a0d9abca.js} +1 -1
  143. package/dist/esm/{get-0eb56363.js → get-58d2f7cc.js} +2 -2
  144. package/dist/esm/getQuery.js +2 -4
  145. package/dist/esm/getRelatedArticle.js +358 -11
  146. package/dist/esm/getSerializers.js +8 -8
  147. package/dist/esm/{getTargeting-1a0bd08d.js → getTargeting-1f2c61e3.js} +9 -9
  148. package/dist/esm/getTargeting.js +1 -1
  149. package/dist/esm/{index-93ec3c59.js → index-3f4dd6f2.js} +6 -4
  150. package/dist/esm/{index-51a80699.js → index-73819142.js} +19 -20
  151. package/dist/esm/{index-80cb5ee6.js → index-7ca90052.js} +441 -453
  152. package/dist/esm/index-db3bb315.js +207 -0
  153. package/dist/esm/{index-d2f90501.js → index-ef6d5dcf.js} +1 -1
  154. package/dist/esm/{index.es-938a3a58.js → index.es-29c1cef5.js} +1 -3
  155. package/dist/esm/index.js +19 -20
  156. package/dist/esm/{isSymbol-b7b7434f.js → isSymbol-47f5ff3b.js} +1 -1
  157. package/dist/esm/{main-7255814e.js → main-d7ee6151.js} +34 -65
  158. package/dist/esm/{moment-12415288.js → moment-e2f9b20c.js} +1 -1
  159. package/dist/esm/urlFor.js +2 -2
  160. package/package.json +107 -107
  161. package/dist/cjs/InscreenSensor-e7f3579f.js +0 -361
  162. package/dist/esm/InscreenSensor-280b2b10.js +0 -352
  163. /package/dist/cjs/{ADInfeed-17a378db.js → ADInfeed-df340285.js} +0 -0
  164. /package/dist/cjs/{ADlgInfeed-070d911c.js → ADlgInfeed-2110d08c.js} +0 -0
  165. /package/dist/esm/{ADInfeed-c7dba95f.js → ADInfeed-a5a1f81f.js} +0 -0
  166. /package/dist/esm/{ADlgInfeed-8bfd6d58.js → ADlgInfeed-99f14909.js} +0 -0
@@ -1,4 +1,4 @@
1
- import './_commonjsHelpers-0c4b6f40.js';
1
+ import { c as createCommonjsModule, u as unwrapExports } from './_commonjsHelpers-0c4b6f40.js';
2
2
  import './_to-object-16fd8b46.js';
3
3
  import './core.get-iterator-method-f5c0d66a.js';
4
4
  import './_library-528f1934.js';
@@ -10,22 +10,22 @@ import { _ as _extends } from './extends-6e00b262.js';
10
10
  import './web.dom.iterable-46c95e52.js';
11
11
  import './typeof-5f046efd.js';
12
12
  import './_is-array-dd5523d6.js';
13
- import React__default from 'react';
14
- import './index-93ec3c59.js';
15
- import 'prop-types';
13
+ import React__default, { Component, useRef, useState, useEffect } from 'react';
14
+ import './index-3f4dd6f2.js';
15
+ import PropTypes from 'prop-types';
16
16
  import 'react-bootstrap/Row';
17
17
  import 'react-bootstrap/Col';
18
18
  import 'react-bootstrap/Card';
19
- import { m as moment } from './moment-12415288.js';
19
+ import { m as moment } from './moment-e2f9b20c.js';
20
20
  import 'next/router';
21
- import './isSymbol-b7b7434f.js';
22
- import './debounce-048d9cb6.js';
23
- import './index.es-938a3a58.js';
21
+ import './isSymbol-47f5ff3b.js';
22
+ import './debounce-a0d9abca.js';
23
+ import './index.es-29c1cef5.js';
24
24
  import 'react-dom';
25
25
  import './visibility-sensor-0baa4eea.js';
26
- import { i as imageUrlBuilder } from './index-51a80699.js';
26
+ import { i as imageUrlBuilder } from './index-73819142.js';
27
27
  import './index-5f9f807a.js';
28
- import './main-7255814e.js';
28
+ import './main-d7ee6151.js';
29
29
  import './entities-7cc3bf45.js';
30
30
  import { _ as _slicedToArray } from './slicedToArray-f1e40361.js';
31
31
  import './stringify-e30bc114.js';
@@ -33,17 +33,17 @@ import { a as _asyncToGenerator, r as regenerator, _ as _Promise } from './async
33
33
  import './_set-species-6f64f1c1.js';
34
34
  import './beam-a25bd8fd.js';
35
35
  import './AdSlot.js';
36
- import './ADInfeed-c7dba95f.js';
36
+ import './ADInfeed-a5a1f81f.js';
37
37
  import './lodash-17fdfebb.js';
38
- import './ADlgInfeed-8bfd6d58.js';
39
- import './AuthorComponent-158226c9.js';
40
- import { B as BlockContent } from './BlockContent-a614acdf.js';
41
- import './smoothscroll-4b699764.js';
38
+ import './ADlgInfeed-99f14909.js';
39
+ import './AuthorComponent-357dbee9.js';
40
+ import { B as BlockContent } from './BlockContent-e9b4ddcf.js';
41
+ import { s as smoothscroll } from './smoothscroll-4b699764.js';
42
42
  import './GroupDeck.js';
43
43
  import 'react-bootstrap';
44
44
  import QueueDeckExpanded from './QueueDeckExpanded.js';
45
45
  import 'react-bootstrap/Button';
46
- import { g as getSerializers } from './index-80cb5ee6.js';
46
+ import { g as getSerializers } from './index-7ca90052.js';
47
47
  import './util-7700fc59.js';
48
48
  import './brightcove-react-player-loader.es-83f53e4e.js';
49
49
  import 'react-bootstrap/Pagination';
@@ -52,29 +52,1306 @@ import Feature from './Feature.js';
52
52
  import 'react-bootstrap/Breadcrumb';
53
53
  import Breadcrumbs from './Breadcrumbs.js';
54
54
  import urlFor from './urlFor.js';
55
- import { TwitterTimelineEmbed } from 'react-twitter-embed';
55
+
56
+ function _classCallCheck(instance, Constructor) {
57
+ if (!(instance instanceof Constructor)) {
58
+ throw new TypeError("Cannot call a class as a function");
59
+ }
60
+ }
61
+
62
+ function _defineProperties(target, props) {
63
+ for (var i = 0; i < props.length; i++) {
64
+ var descriptor = props[i];
65
+ descriptor.enumerable = descriptor.enumerable || false;
66
+ descriptor.configurable = true;
67
+ if ("value" in descriptor) descriptor.writable = true;
68
+ Object.defineProperty(target, descriptor.key, descriptor);
69
+ }
70
+ }
71
+
72
+ function _createClass(Constructor, protoProps, staticProps) {
73
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
74
+ if (staticProps) _defineProperties(Constructor, staticProps);
75
+ return Constructor;
76
+ }
77
+
78
+ function _typeof(obj) {
79
+ "@babel/helpers - typeof";
80
+
81
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
82
+ _typeof = function _typeof(obj) {
83
+ return typeof obj;
84
+ };
85
+ } else {
86
+ _typeof = function _typeof(obj) {
87
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
88
+ };
89
+ }
90
+
91
+ return _typeof(obj);
92
+ }
93
+
94
+ function _assertThisInitialized(self) {
95
+ if (self === void 0) {
96
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
97
+ }
98
+
99
+ return self;
100
+ }
101
+
102
+ function _possibleConstructorReturn(self, call) {
103
+ if (call && (_typeof(call) === "object" || typeof call === "function")) {
104
+ return call;
105
+ }
106
+
107
+ return _assertThisInitialized(self);
108
+ }
109
+
110
+ function _getPrototypeOf(o) {
111
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
112
+ return o.__proto__ || Object.getPrototypeOf(o);
113
+ };
114
+ return _getPrototypeOf(o);
115
+ }
116
+
117
+ function _setPrototypeOf(o, p) {
118
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
119
+ o.__proto__ = p;
120
+ return o;
121
+ };
122
+
123
+ return _setPrototypeOf(o, p);
124
+ }
125
+
126
+ function _inherits(subClass, superClass) {
127
+ if (typeof superClass !== "function" && superClass !== null) {
128
+ throw new TypeError("Super expression must either be null or a function");
129
+ }
130
+
131
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
132
+ constructor: {
133
+ value: subClass,
134
+ writable: true,
135
+ configurable: true
136
+ }
137
+ });
138
+ if (superClass) _setPrototypeOf(subClass, superClass);
139
+ }
140
+
141
+ function _defineProperty(obj, key, value) {
142
+ if (key in obj) {
143
+ Object.defineProperty(obj, key, {
144
+ value: value,
145
+ enumerable: true,
146
+ configurable: true,
147
+ writable: true
148
+ });
149
+ } else {
150
+ obj[key] = value;
151
+ }
152
+
153
+ return obj;
154
+ }
155
+
156
+ var isRequiredIf_1 = createCommonjsModule(function (module, exports) {
157
+ Object.defineProperty(exports,'__esModule',{value:!0});var VALIDATOR_ARG_ERROR_MESSAGE='The typeValidator argument must be a function with the signature function(props, propName, componentName).',MESSAGE_ARG_ERROR_MESSAGE='The error message is optional, but must be a string if provided.',propIsRequired=function propIsRequired(a,b,c,d){if('boolean'==typeof a)return a;return 'function'==typeof a?a(b,c,d):!(!0!==!!a)&&!!a},propExists=function propExists(a,b){return Object.hasOwnProperty.call(a,b)},missingPropError=function missingPropError(a,b,c,d){return d?new Error(d):new Error('Required '+a[b]+' `'+b+'`'+(' was not specified in `'+c+'`.'))},guardAgainstInvalidArgTypes=function guardAgainstInvalidArgTypes(a,b){if('function'!=typeof a)throw new TypeError(VALIDATOR_ARG_ERROR_MESSAGE);if(!!b&&'string'!=typeof b)throw new TypeError(MESSAGE_ARG_ERROR_MESSAGE)},isRequiredIf=function isRequiredIf(a,b,c){return guardAgainstInvalidArgTypes(a,c),function(d,e,f){for(var _len=arguments.length,g=Array(3<_len?_len-3:0),_key=3;_key<_len;_key++)g[_key-3]=arguments[_key];return propIsRequired(b,d,e,f)?propExists(d,e)?a.apply(void 0,[d,e,f].concat(g)):missingPropError(d,e,f,c):a.apply(void 0,[d,e,f].concat(g));// Is not required, so just run typeValidator.
158
+ }};exports.default=isRequiredIf;
159
+
160
+
161
+ });
162
+
163
+ var isRequiredIf = unwrapExports(isRequiredIf_1);
164
+
165
+ var exenv = createCommonjsModule(function (module) {
166
+ /*!
167
+ Copyright (c) 2015 Jed Watson.
168
+ Based on code that is Copyright 2013-2015, Facebook, Inc.
169
+ All rights reserved.
170
+ */
171
+ /* global define */
172
+
173
+ (function () {
174
+
175
+ var canUseDOM = !!(
176
+ typeof window !== 'undefined' &&
177
+ window.document &&
178
+ window.document.createElement
179
+ );
180
+
181
+ var ExecutionEnvironment = {
182
+
183
+ canUseDOM: canUseDOM,
184
+
185
+ canUseWorkers: typeof Worker !== 'undefined',
186
+
187
+ canUseEventListeners:
188
+ canUseDOM && !!(window.addEventListener || window.attachEvent),
189
+
190
+ canUseViewport: canUseDOM && !!window.screen
191
+
192
+ };
193
+
194
+ if ( module.exports) {
195
+ module.exports = ExecutionEnvironment;
196
+ } else {
197
+ window.ExecutionEnvironment = ExecutionEnvironment;
198
+ }
199
+
200
+ }());
201
+ });
202
+
203
+ var twitterWidgetJs = 'https://platform.twitter.com/widgets.js';
204
+
205
+ var TwitterTimelineEmbed =
206
+ /*#__PURE__*/
207
+ function (_Component) {
208
+ _inherits(TwitterTimelineEmbed, _Component);
209
+
210
+ function TwitterTimelineEmbed(props) {
211
+ var _this;
212
+
213
+ _classCallCheck(this, TwitterTimelineEmbed);
214
+
215
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(TwitterTimelineEmbed).call(this, props));
216
+ _this.state = {
217
+ isLoading: true
218
+ };
219
+ return _this;
220
+ }
221
+
222
+ _createClass(TwitterTimelineEmbed, [{
223
+ key: "buildChromeOptions",
224
+ value: function buildChromeOptions(options) {
225
+ options.chrome = '';
226
+
227
+ if (this.props.noHeader) {
228
+ options.chrome = options.chrome + ' noheader';
229
+ }
230
+
231
+ if (this.props.noFooter) {
232
+ options.chrome = options.chrome + ' nofooter';
233
+ }
234
+
235
+ if (this.props.noBorders) {
236
+ options.chrome = options.chrome + ' noborders';
237
+ }
238
+
239
+ if (this.props.noScrollbar) {
240
+ options.chrome = options.chrome + ' noscrollbar';
241
+ }
242
+
243
+ if (this.props.transparent) {
244
+ options.chrome = options.chrome + ' transparent';
245
+ }
246
+
247
+ return options;
248
+ }
249
+ }, {
250
+ key: "buildOptions",
251
+ value: function buildOptions() {
252
+ var options = Object.assign({}, this.props.options);
253
+
254
+ if (this.props.autoHeight) {
255
+ options.height = this.refs.embedContainer.parentNode.offsetHeight;
256
+ }
257
+
258
+ options = Object.assign({}, options, {
259
+ theme: this.props.theme,
260
+ linkColor: this.props.linkColor,
261
+ borderColor: this.props.borderColor,
262
+ lang: this.props.lang
263
+ });
264
+ return options;
265
+ }
266
+ }, {
267
+ key: "renderWidget",
268
+ value: function renderWidget(options) {
269
+ var _this2 = this;
270
+
271
+ var onLoad = this.props.onLoad;
272
+
273
+ if (!this.isMountCanceled) {
274
+ window.twttr.widgets.createTimeline({
275
+ sourceType: this.props.sourceType,
276
+ screenName: this.props.screenName,
277
+ userId: this.props.userId,
278
+ ownerScreenName: this.props.ownerScreenName,
279
+ slug: this.props.slug,
280
+ id: this.props.id || this.props.widgetId,
281
+ url: this.props.url
282
+ }, this.refs.embedContainer, options).then(function (element) {
283
+ _this2.setState({
284
+ isLoading: false
285
+ });
286
+
287
+ if (onLoad) {
288
+ onLoad(element);
289
+ }
290
+ });
291
+ }
292
+ }
293
+ }, {
294
+ key: "componentDidMount",
295
+ value: function componentDidMount() {
296
+ var _this3 = this;
297
+
298
+ if (exenv.canUseDOM) {
299
+ var script = require('scriptjs');
300
+
301
+ script(twitterWidgetJs, 'twitter-embed', function () {
302
+ if (!window.twttr) {
303
+ console.error('Failure to load window.twttr in TwitterTimelineEmbed, aborting load.');
304
+ return;
305
+ }
306
+
307
+ var options = _this3.buildOptions();
308
+ /** Append chrome options */
309
+
310
+
311
+ options = _this3.buildChromeOptions(options);
312
+
313
+ _this3.renderWidget(options);
314
+ });
315
+ }
316
+ }
317
+ }, {
318
+ key: "componentWillUnmount",
319
+ value: function componentWillUnmount() {
320
+ this.isMountCanceled = true;
321
+ }
322
+ }, {
323
+ key: "render",
324
+ value: function render() {
325
+ var isLoading = this.state.isLoading;
326
+ var placeholder = this.props.placeholder;
327
+ return React__default.createElement(React__default.Fragment, null, isLoading && placeholder, React__default.createElement("div", {
328
+ ref: "embedContainer"
329
+ }));
330
+ }
331
+ }]);
332
+
333
+ return TwitterTimelineEmbed;
334
+ }(Component);
335
+
336
+ _defineProperty(TwitterTimelineEmbed, "propTypes", {
337
+ /**
338
+ * This can be either of profile, likes, list, collection, URL, widget
339
+ */
340
+ sourceType: PropTypes.oneOf(['profile', 'likes', 'list', 'collection', 'url', 'widget']).isRequired,
341
+
342
+ /**
343
+ * username of twitter handle as String
344
+ */
345
+ screenName: isRequiredIf(PropTypes.string, function (props) {
346
+ return !props.hasOwnProperty('userId') && (props.sourceType === 'profile' || props.sourceType === 'likes');
347
+ }),
348
+
349
+ /**
350
+ * UserId of twitter handle as number
351
+ */
352
+ userId: isRequiredIf(PropTypes.number, function (props) {
353
+ return !props.hasOwnProperty('screenName') && (props.sourceType === 'profile' || props.sourceType === 'likes');
354
+ }),
355
+
356
+ /**
357
+ * To show list, used along with slug
358
+ */
359
+ ownerScreenName: isRequiredIf(PropTypes.string, function (props) {
360
+ return props.sourceType === 'list' && !props.hasOwnProperty('id');
361
+ }),
362
+
363
+ /**
364
+ * To show list, used along with ownerScreenName
365
+ */
366
+ slug: isRequiredIf(PropTypes.string, function (props) {
367
+ return props.sourceType === 'list' && !props.hasOwnProperty('id');
368
+ }),
369
+
370
+ /**
371
+ * To show list, unique list id
372
+ * Also used with collections, in that case its valid collection id
373
+ */
374
+ id: isRequiredIf(PropTypes.oneOfType([PropTypes.number, PropTypes.string]), function (props) {
375
+ return props.sourceType === 'list' && !props.hasOwnProperty('ownerScreenName') && !props.hasOwnProperty('slug') || props.sourceType === 'collection';
376
+ }),
377
+
378
+ /**
379
+ * To show twitter content with url.
380
+ * Supported content includes profiles, likes, lists, and collections.
381
+ */
382
+ url: isRequiredIf(PropTypes.string, function (props) {
383
+ return props.sourceType === 'url';
384
+ }),
385
+
386
+ /**
387
+ * To show custom widget
388
+ */
389
+ widgetId: isRequiredIf(PropTypes.string, function (props) {
390
+ return props.sourceType === 'widget';
391
+ }),
392
+
393
+ /**
394
+ * Additional options to pass to twitter widget plugin
395
+ */
396
+ options: PropTypes.object,
397
+
398
+ /**
399
+ * Automatically fit into parent container height
400
+ */
401
+ autoHeight: PropTypes.bool,
402
+
403
+ /**
404
+ * With dark or light theme
405
+ */
406
+ theme: PropTypes.oneOf(['dark', 'light']),
407
+
408
+ /**
409
+ * With custom link colors. Note: Only Hex colors are supported.
410
+ */
411
+ linkColor: PropTypes.string,
412
+
413
+ /**
414
+ * With custom border colors. Note: Only Hex colors are supported.
415
+ */
416
+ borderColor: PropTypes.string,
417
+
418
+ /**
419
+ * Hide the header from timeline
420
+ */
421
+ noHeader: PropTypes.bool,
422
+
423
+ /**
424
+ * Hide the footer from timeline
425
+ */
426
+ noFooter: PropTypes.bool,
427
+
428
+ /**
429
+ * Hide the border from timeline
430
+ */
431
+ noBorders: PropTypes.bool,
432
+
433
+ /**
434
+ * Hide the scrollbars
435
+ */
436
+ noScrollbar: PropTypes.bool,
437
+
438
+ /**
439
+ * Enable Transparancy
440
+ */
441
+ transparent: PropTypes.bool,
442
+
443
+ /**
444
+ * Custom language code. Supported codes here: https://developer.twitter.com/en/docs/twitter-for-websites/twitter-for-websites-supported-languages/overview.html
445
+ */
446
+ lang: PropTypes.string,
447
+
448
+ /**
449
+ * Placeholder while tweet is loading
450
+ */
451
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
452
+
453
+ /**
454
+ * Function to execute after load, return html element
455
+ */
456
+ onLoad: PropTypes.func
457
+ });
458
+
459
+ var TwitterShareButton =
460
+ /*#__PURE__*/
461
+ function (_Component) {
462
+ _inherits(TwitterShareButton, _Component);
463
+
464
+ function TwitterShareButton(props) {
465
+ var _this;
466
+
467
+ _classCallCheck(this, TwitterShareButton);
468
+
469
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(TwitterShareButton).call(this, props));
470
+ _this.state = {
471
+ isLoading: true
472
+ };
473
+ return _this;
474
+ }
475
+
476
+ _createClass(TwitterShareButton, [{
477
+ key: "componentDidMount",
478
+ value: function componentDidMount() {
479
+ var _this2 = this;
480
+
481
+ var onLoad = this.props.onLoad;
482
+
483
+ if (exenv.canUseDOM) {
484
+ var script = require('scriptjs');
485
+
486
+ script(twitterWidgetJs, 'twitter-embed', function () {
487
+ if (!window.twttr) {
488
+ console.error('Failure to load window.twttr in TwitterShareButton, aborting load.');
489
+ return;
490
+ }
491
+
492
+ if (!_this2.isMountCanceled) {
493
+ window.twttr.widgets.createShareButton(_this2.props.url, _this2.refs.embedContainer, _this2.props.options).then(function (element) {
494
+ _this2.setState({
495
+ isLoading: false
496
+ });
497
+
498
+ if (onLoad) {
499
+ onLoad(element);
500
+ }
501
+ });
502
+ }
503
+ });
504
+ }
505
+ }
506
+ }, {
507
+ key: "componentWillUnmount",
508
+ value: function componentWillUnmount() {
509
+ this.isMountCanceled = true;
510
+ }
511
+ }, {
512
+ key: "render",
513
+ value: function render() {
514
+ var isLoading = this.state.isLoading;
515
+ var placeholder = this.props.placeholder;
516
+ return React__default.createElement(React__default.Fragment, null, isLoading && placeholder, React__default.createElement("div", {
517
+ ref: "embedContainer"
518
+ }));
519
+ }
520
+ }]);
521
+
522
+ return TwitterShareButton;
523
+ }(Component);
524
+
525
+ _defineProperty(TwitterShareButton, "propTypes", {
526
+ /**
527
+ * Url for sharing
528
+ */
529
+ url: PropTypes.string.isRequired,
530
+
531
+ /**
532
+ * Additional options for overriding config. Details at : https://dev.twitter.com/web/tweet-button/parameters
533
+ */
534
+ options: PropTypes.object,
535
+
536
+ /**
537
+ * Placeholder while tweet is loading
538
+ */
539
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
540
+
541
+ /**
542
+ * Function to execute after load, return html element
543
+ */
544
+ onLoad: PropTypes.func
545
+ });
546
+
547
+ var TwitterFollowButton =
548
+ /*#__PURE__*/
549
+ function (_Component) {
550
+ _inherits(TwitterFollowButton, _Component);
551
+
552
+ function TwitterFollowButton(props) {
553
+ var _this;
554
+
555
+ _classCallCheck(this, TwitterFollowButton);
556
+
557
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(TwitterFollowButton).call(this, props));
558
+ _this.state = {
559
+ isLoading: true
560
+ };
561
+ return _this;
562
+ }
563
+
564
+ _createClass(TwitterFollowButton, [{
565
+ key: "componentDidMount",
566
+ value: function componentDidMount() {
567
+ var _this2 = this;
568
+
569
+ var onLoad = this.props.onLoad;
570
+
571
+ if (exenv.canUseDOM) {
572
+ var script = require('scriptjs');
573
+
574
+ script(twitterWidgetJs, 'twitter-embed', function () {
575
+ if (!window.twttr) {
576
+ console.error('Failure to load window.twttr in TwitterFollowButton, aborting load.');
577
+ return;
578
+ }
579
+
580
+ if (!_this2.isMountCanceled) {
581
+ window.twttr.widgets.createFollowButton(_this2.props.screenName, _this2.refs.embedContainer, _this2.props.options).then(function (element) {
582
+ _this2.setState({
583
+ isLoading: false
584
+ });
585
+
586
+ if (onLoad) {
587
+ onLoad(element);
588
+ }
589
+ });
590
+ }
591
+ });
592
+ }
593
+ }
594
+ }, {
595
+ key: "componentWillUnmount",
596
+ value: function componentWillUnmount() {
597
+ this.isMountCanceled = true;
598
+ }
599
+ }, {
600
+ key: "render",
601
+ value: function render() {
602
+ var isLoading = this.state.isLoading;
603
+ var placeholder = this.props.placeholder;
604
+ return React__default.createElement(React__default.Fragment, null, isLoading && placeholder, React__default.createElement("div", {
605
+ ref: "embedContainer"
606
+ }));
607
+ }
608
+ }]);
609
+
610
+ return TwitterFollowButton;
611
+ }(Component);
612
+
613
+ _defineProperty(TwitterFollowButton, "propTypes", {
614
+ /**
615
+ * Username of twitter user which will be followed on click
616
+ */
617
+ screenName: PropTypes.string.isRequired,
618
+
619
+ /**
620
+ * Additional options to be added to the button
621
+ */
622
+ options: PropTypes.object,
623
+
624
+ /**
625
+ * Placeholder while tweet is loading
626
+ */
627
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
628
+
629
+ /**
630
+ * Function to execute after load, return html element
631
+ */
632
+ onLoad: PropTypes.func
633
+ });
634
+
635
+ var TwitterHashtagButton =
636
+ /*#__PURE__*/
637
+ function (_Component) {
638
+ _inherits(TwitterHashtagButton, _Component);
639
+
640
+ function TwitterHashtagButton(props) {
641
+ var _this;
642
+
643
+ _classCallCheck(this, TwitterHashtagButton);
644
+
645
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(TwitterHashtagButton).call(this, props));
646
+ _this.state = {
647
+ isLoading: true
648
+ };
649
+ return _this;
650
+ }
651
+
652
+ _createClass(TwitterHashtagButton, [{
653
+ key: "componentDidMount",
654
+ value: function componentDidMount() {
655
+ var _this2 = this;
656
+
657
+ var onLoad = this.props.onLoad;
658
+
659
+ if (exenv.canUseDOM) {
660
+ var script = require('scriptjs');
661
+
662
+ script(twitterWidgetJs, 'twitter-embed', function () {
663
+ if (!window.twttr) {
664
+ console.error('Failure to load window.twttr in TwitterHashtagButton, aborting load.');
665
+ return;
666
+ }
667
+
668
+ if (!_this2.isMountCanceled) {
669
+ window.twttr.widgets.createHashtagButton(_this2.props.tag, _this2.refs.embedContainer, _this2.props.options).then(function (element) {
670
+ _this2.setState({
671
+ isLoading: false
672
+ });
673
+
674
+ if (onLoad) {
675
+ onLoad(element);
676
+ }
677
+ });
678
+ }
679
+ });
680
+ }
681
+ }
682
+ }, {
683
+ key: "componentWillUnmount",
684
+ value: function componentWillUnmount() {
685
+ this.isMountCanceled = true;
686
+ }
687
+ }, {
688
+ key: "render",
689
+ value: function render() {
690
+ var isLoading = this.state.isLoading;
691
+ var placeholder = this.props.placeholder;
692
+ return React__default.createElement(React__default.Fragment, null, isLoading && placeholder, React__default.createElement("div", {
693
+ ref: "embedContainer"
694
+ }));
695
+ }
696
+ }]);
697
+
698
+ return TwitterHashtagButton;
699
+ }(Component);
700
+
701
+ _defineProperty(TwitterHashtagButton, "propTypes", {
702
+ /**
703
+ * Tag name for hashtag button
704
+ */
705
+ tag: PropTypes.string.isRequired,
706
+
707
+ /**
708
+ * Additional options to be added to the button
709
+ */
710
+ options: PropTypes.object,
711
+
712
+ /**
713
+ * Placeholder while tweet is loading
714
+ */
715
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
716
+
717
+ /**
718
+ * Function to execute after load, return html element
719
+ */
720
+ onLoad: PropTypes.func
721
+ });
722
+
723
+ var TwitterMentionButton =
724
+ /*#__PURE__*/
725
+ function (_Component) {
726
+ _inherits(TwitterMentionButton, _Component);
727
+
728
+ function TwitterMentionButton(props) {
729
+ var _this;
730
+
731
+ _classCallCheck(this, TwitterMentionButton);
732
+
733
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(TwitterMentionButton).call(this, props));
734
+ _this.state = {
735
+ isLoading: true
736
+ };
737
+ return _this;
738
+ }
739
+
740
+ _createClass(TwitterMentionButton, [{
741
+ key: "componentDidMount",
742
+ value: function componentDidMount() {
743
+ var _this2 = this;
744
+
745
+ var onLoad = this.props.onLoad;
746
+
747
+ if (exenv.canUseDOM) {
748
+ var script = require('scriptjs');
749
+
750
+ script(twitterWidgetJs, 'twitter-embed', function () {
751
+ if (!window.twttr) {
752
+ console.error('Failure to load window.twttr in TwitterMentionButton, aborting load.');
753
+ return;
754
+ }
755
+
756
+ if (!_this2.isMountCanceled) {
757
+ window.twttr.widgets.createMentionButton(_this2.props.screenName, _this2.refs.embedContainer, _this2.props.options).then(function (element) {
758
+ _this2.setState({
759
+ isLoading: false
760
+ });
761
+
762
+ if (onLoad) {
763
+ onLoad(element);
764
+ }
765
+ });
766
+ }
767
+ });
768
+ }
769
+ }
770
+ }, {
771
+ key: "componentWillUnmount",
772
+ value: function componentWillUnmount() {
773
+ this.isMountCanceled = true;
774
+ }
775
+ }, {
776
+ key: "render",
777
+ value: function render() {
778
+ var isLoading = this.state.isLoading;
779
+ var placeholder = this.props.placeholder;
780
+ return React__default.createElement(React__default.Fragment, null, isLoading && placeholder, React__default.createElement("div", {
781
+ ref: "embedContainer"
782
+ }));
783
+ }
784
+ }]);
785
+
786
+ return TwitterMentionButton;
787
+ }(Component);
788
+
789
+ _defineProperty(TwitterMentionButton, "propTypes", {
790
+ /**
791
+ * Username to which you will need to tweet
792
+ */
793
+ screenName: PropTypes.string.isRequired,
794
+
795
+ /**
796
+ * Additional options for overriding config.
797
+ */
798
+ options: PropTypes.object,
799
+
800
+ /**
801
+ * Placeholder while tweet is loading
802
+ */
803
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
804
+
805
+ /**
806
+ * Function to execute after load, return html element
807
+ */
808
+ onLoad: PropTypes.func
809
+ });
810
+
811
+ var TwitterTweetEmbed =
812
+ /*#__PURE__*/
813
+ function (_Component) {
814
+ _inherits(TwitterTweetEmbed, _Component);
815
+
816
+ function TwitterTweetEmbed(props) {
817
+ var _this;
818
+
819
+ _classCallCheck(this, TwitterTweetEmbed);
820
+
821
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(TwitterTweetEmbed).call(this, props));
822
+ _this.state = {
823
+ isLoading: true
824
+ };
825
+ return _this;
826
+ }
827
+
828
+ _createClass(TwitterTweetEmbed, [{
829
+ key: "renderWidget",
830
+ value: function renderWidget() {
831
+ var _this2 = this;
832
+
833
+ var onLoad = this.props.onLoad;
834
+
835
+ if (!window.twttr) {
836
+ console.error('Failure to load window.twttr in TwitterTweetEmbed, aborting load.');
837
+ return;
838
+ }
839
+
840
+ if (!this.isMountCanceled) {
841
+ window.twttr.widgets.createTweet(this.props.tweetId, this.refs.embedContainer, this.props.options).then(function (element) {
842
+ _this2.setState({
843
+ isLoading: false
844
+ });
845
+
846
+ if (onLoad) {
847
+ onLoad(element);
848
+ }
849
+ });
850
+ }
851
+ }
852
+ }, {
853
+ key: "componentDidMount",
854
+ value: function componentDidMount() {
855
+ var _this3 = this;
856
+
857
+ if (exenv.canUseDOM) {
858
+ var script = require('scriptjs');
859
+
860
+ script(twitterWidgetJs, 'twitter-embed', function () {
861
+ _this3.renderWidget();
862
+ });
863
+ }
864
+ }
865
+ }, {
866
+ key: "componentWillUnmount",
867
+ value: function componentWillUnmount() {
868
+ this.isMountCanceled = true;
869
+ }
870
+ }, {
871
+ key: "render",
872
+ value: function render() {
873
+ var isLoading = this.state.isLoading;
874
+ var placeholder = this.props.placeholder;
875
+ return React__default.createElement(React__default.Fragment, null, isLoading && placeholder, React__default.createElement("div", {
876
+ ref: "embedContainer"
877
+ }));
878
+ }
879
+ }]);
880
+
881
+ return TwitterTweetEmbed;
882
+ }(Component);
883
+
884
+ _defineProperty(TwitterTweetEmbed, "propTypes", {
885
+ /**
886
+ * Tweet id that needs to be shown
887
+ */
888
+ tweetId: PropTypes.string.isRequired,
889
+
890
+ /**
891
+ * Additional options to pass to twitter widget plugin
892
+ */
893
+ options: PropTypes.object,
894
+
895
+ /**
896
+ * Placeholder while tweet is loading
897
+ */
898
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
899
+
900
+ /**
901
+ * Function to execute after load, return html element
902
+ */
903
+ onLoad: PropTypes.func
904
+ });
905
+
906
+ var TwitterMomentShare =
907
+ /*#__PURE__*/
908
+ function (_Component) {
909
+ _inherits(TwitterMomentShare, _Component);
910
+
911
+ function TwitterMomentShare(props) {
912
+ var _this;
913
+
914
+ _classCallCheck(this, TwitterMomentShare);
915
+
916
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(TwitterMomentShare).call(this, props));
917
+ _this.state = {
918
+ isLoading: true
919
+ };
920
+ return _this;
921
+ }
922
+
923
+ _createClass(TwitterMomentShare, [{
924
+ key: "componentDidMount",
925
+ value: function componentDidMount() {
926
+ var _this2 = this;
927
+
928
+ var onLoad = this.props.onLoad;
929
+
930
+ if (exenv.canUseDOM) {
931
+ var script = require('scriptjs');
932
+
933
+ script(twitterWidgetJs, 'twitter-embed', function () {
934
+ if (!window.twttr) {
935
+ console.error('Failure to load window.twttr in TwitterMomentShare, aborting load.');
936
+ return;
937
+ }
938
+
939
+ if (!_this2.isMountCanceled) {
940
+ window.twttr.widgets.createMoment(_this2.props.momentId, _this2.refs.shareMoment, _this2.props.options).then(function (element) {
941
+ _this2.setState({
942
+ isLoading: false
943
+ });
944
+
945
+ if (onLoad) {
946
+ onLoad(element);
947
+ }
948
+ });
949
+ }
950
+ });
951
+ }
952
+ }
953
+ }, {
954
+ key: "componentWillUnmount",
955
+ value: function componentWillUnmount() {
956
+ this.isMountCanceled = true;
957
+ }
958
+ }, {
959
+ key: "render",
960
+ value: function render() {
961
+ var isLoading = this.state.isLoading;
962
+ var placeholder = this.props.placeholder;
963
+ return React__default.createElement(React__default.Fragment, null, isLoading && placeholder, React__default.createElement("div", {
964
+ ref: "shareMoment"
965
+ }));
966
+ }
967
+ }]);
968
+
969
+ return TwitterMomentShare;
970
+ }(Component);
971
+
972
+ _defineProperty(TwitterMomentShare, "propTypes", {
973
+ /**
974
+ * id of Twitter moment to show
975
+ */
976
+ momentId: PropTypes.string.isRequired,
977
+
978
+ /**
979
+ * Additional options for overriding config.
980
+ */
981
+ options: PropTypes.object,
982
+
983
+ /**
984
+ * Placeholder while tweet is loading
985
+ */
986
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
987
+
988
+ /**
989
+ * Function to execute after load, return html element
990
+ */
991
+ onLoad: PropTypes.func
992
+ });
993
+
994
+ var TwitterDMButton =
995
+ /*#__PURE__*/
996
+ function (_Component) {
997
+ _inherits(TwitterDMButton, _Component);
998
+
999
+ function TwitterDMButton(props) {
1000
+ var _this;
1001
+
1002
+ _classCallCheck(this, TwitterDMButton);
1003
+
1004
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(TwitterDMButton).call(this, props));
1005
+ _this.state = {
1006
+ isLoading: true
1007
+ };
1008
+ return _this;
1009
+ }
1010
+
1011
+ _createClass(TwitterDMButton, [{
1012
+ key: "componentDidMount",
1013
+ value: function componentDidMount() {
1014
+ var _this2 = this;
1015
+
1016
+ var onLoad = this.props.onLoad;
1017
+
1018
+ if (exenv.canUseDOM) {
1019
+ var script = require('scriptjs');
1020
+
1021
+ script(twitterWidgetJs, 'twitter-embed', function () {
1022
+ if (!window.twttr) {
1023
+ console.error('Failure to load window.twttr in TwitterDMButton, aborting load.');
1024
+ return;
1025
+ }
1026
+
1027
+ if (!_this2.isMountCanceled) {
1028
+ window.twttr.widgets.createDMButton(_this2.props.id, _this2.refs.embedContainer, _this2.props.options).then(function (element) {
1029
+ _this2.setState({
1030
+ isLoading: false
1031
+ });
1032
+
1033
+ if (onLoad) {
1034
+ onLoad(element);
1035
+ }
1036
+ });
1037
+ }
1038
+ });
1039
+ }
1040
+ }
1041
+ }, {
1042
+ key: "componentWillUnmount",
1043
+ value: function componentWillUnmount() {
1044
+ this.isMountCanceled = true;
1045
+ }
1046
+ }, {
1047
+ key: "render",
1048
+ value: function render() {
1049
+ var isLoading = this.state.isLoading;
1050
+ var placeholder = this.props.placeholder;
1051
+ return React__default.createElement(React__default.Fragment, null, isLoading && placeholder, React__default.createElement("div", {
1052
+ ref: "embedContainer"
1053
+ }));
1054
+ }
1055
+ }]);
1056
+
1057
+ return TwitterDMButton;
1058
+ }(Component);
1059
+
1060
+ _defineProperty(TwitterDMButton, "propTypes", {
1061
+ /**
1062
+ * Twitter user id for DM button
1063
+ */
1064
+ id: PropTypes.number.isRequired,
1065
+
1066
+ /**
1067
+ * Additional options to be added to the button
1068
+ */
1069
+ options: PropTypes.object,
1070
+
1071
+ /**
1072
+ * Placeholder while tweet is loading
1073
+ */
1074
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
1075
+
1076
+ /**
1077
+ * Function to execute after load, return html element
1078
+ */
1079
+ onLoad: PropTypes.func
1080
+ });
1081
+
1082
+ var TwitterVideoEmbed =
1083
+ /*#__PURE__*/
1084
+ function (_Component) {
1085
+ _inherits(TwitterVideoEmbed, _Component);
1086
+
1087
+ function TwitterVideoEmbed(props) {
1088
+ var _this;
1089
+
1090
+ _classCallCheck(this, TwitterVideoEmbed);
1091
+
1092
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(TwitterVideoEmbed).call(this, props));
1093
+ _this.state = {
1094
+ isLoading: true
1095
+ };
1096
+ return _this;
1097
+ }
1098
+
1099
+ _createClass(TwitterVideoEmbed, [{
1100
+ key: "componentDidMount",
1101
+ value: function componentDidMount() {
1102
+ var _this2 = this;
1103
+
1104
+ var onLoad = this.props.onLoad;
1105
+
1106
+ if (exenv.canUseDOM) {
1107
+ var script = require('scriptjs');
1108
+
1109
+ script(twitterWidgetJs, 'twitter-embed', function () {
1110
+ if (!window.twttr) {
1111
+ console.error('Failure to load window.twttr in TwitterVideoEmbed, aborting load.');
1112
+ return;
1113
+ }
1114
+
1115
+ if (!_this2.isMountCanceled) {
1116
+ window.twttr.widgets.createVideo(_this2.props.id, _this2.refs.embedContainer).then(function (element) {
1117
+ _this2.setState({
1118
+ isLoading: false
1119
+ });
1120
+
1121
+ if (onLoad) {
1122
+ onLoad(element);
1123
+ }
1124
+ });
1125
+ }
1126
+ });
1127
+ }
1128
+ }
1129
+ }, {
1130
+ key: "componentWillUnmount",
1131
+ value: function componentWillUnmount() {
1132
+ this.isMountCanceled = true;
1133
+ }
1134
+ }, {
1135
+ key: "render",
1136
+ value: function render() {
1137
+ var isLoading = this.state.isLoading;
1138
+ var placeholder = this.props.placeholder;
1139
+ return React__default.createElement(React__default.Fragment, null, isLoading && placeholder, React__default.createElement("div", {
1140
+ ref: "embedContainer"
1141
+ }));
1142
+ }
1143
+ }]);
1144
+
1145
+ return TwitterVideoEmbed;
1146
+ }(Component);
1147
+
1148
+ _defineProperty(TwitterVideoEmbed, "propTypes", {
1149
+ /**
1150
+ * Id of video tweet.
1151
+ */
1152
+ id: PropTypes.string.isRequired,
1153
+
1154
+ /**
1155
+ * Placeholder while tweet is loading
1156
+ */
1157
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
1158
+
1159
+ /**
1160
+ * Function to execute after load, return html element
1161
+ */
1162
+ onLoad: PropTypes.func
1163
+ });
1164
+
1165
+ var TwitterOnAirButton =
1166
+ /*#__PURE__*/
1167
+ function (_Component) {
1168
+ _inherits(TwitterOnAirButton, _Component);
1169
+
1170
+ function TwitterOnAirButton(props) {
1171
+ var _this;
1172
+
1173
+ _classCallCheck(this, TwitterOnAirButton);
1174
+
1175
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(TwitterOnAirButton).call(this, props));
1176
+ _this.state = {
1177
+ isLoading: true
1178
+ };
1179
+ return _this;
1180
+ }
1181
+
1182
+ _createClass(TwitterOnAirButton, [{
1183
+ key: "componentDidMount",
1184
+ value: function componentDidMount() {
1185
+ var _this2 = this;
1186
+
1187
+ var onLoad = this.props.onLoad;
1188
+
1189
+ if (exenv.canUseDOM) {
1190
+ var script = require('scriptjs');
1191
+
1192
+ script(twitterWidgetJs, 'twitter-embed', function () {
1193
+ if (!window.twttr) {
1194
+ console.error('Failure to load window.twttr in TwitterOnAirButton, aborting load.');
1195
+ return;
1196
+ }
1197
+
1198
+ if (!_this2.isMountCanceled) {
1199
+ window.twttr.widgets.createPeriscopeOnAirButton(_this2.props.username, _this2.refs.embedContainer, _this2.props.options).then(function (element) {
1200
+ _this2.setState({
1201
+ isLoading: false
1202
+ });
1203
+
1204
+ if (onLoad) {
1205
+ onLoad(element);
1206
+ }
1207
+ });
1208
+ }
1209
+ });
1210
+ }
1211
+ }
1212
+ }, {
1213
+ key: "componentWillUnmount",
1214
+ value: function componentWillUnmount() {
1215
+ this.isMountCanceled = true;
1216
+ }
1217
+ }, {
1218
+ key: "render",
1219
+ value: function render() {
1220
+ var isLoading = this.state.isLoading;
1221
+ var placeholder = this.props.placeholder;
1222
+ return React__default.createElement(React__default.Fragment, null, isLoading && placeholder, React__default.createElement("div", {
1223
+ ref: "embedContainer"
1224
+ }));
1225
+ }
1226
+ }]);
1227
+
1228
+ return TwitterOnAirButton;
1229
+ }(Component);
1230
+
1231
+ _defineProperty(TwitterOnAirButton, "propTypes", {
1232
+ /**
1233
+ * Username for which you require periscope on air button
1234
+ */
1235
+ username: PropTypes.string.isRequired,
1236
+
1237
+ /**
1238
+ * Additional options for overriding config.
1239
+ */
1240
+ options: PropTypes.object,
1241
+
1242
+ /**
1243
+ * Placeholder while tweet is loading
1244
+ */
1245
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
1246
+
1247
+ /**
1248
+ * Function to execute after load, return html element
1249
+ */
1250
+ onLoad: PropTypes.func
1251
+ });
56
1252
 
57
1253
  var ImageSlider = function ImageSlider(props) {
1254
+ var innerSlider = useRef(null);
1255
+ var tile = useRef(null);
1256
+ var viewableWindow = useRef(null);
1257
+
1258
+ var _useState = useState(0),
1259
+ _useState2 = _slicedToArray(_useState, 2),
1260
+ tileSize = _useState2[0],
1261
+ setTileSize = _useState2[1];
1262
+
1263
+ var _useState3 = useState(false),
1264
+ _useState4 = _slicedToArray(_useState3, 2),
1265
+ showScroller = _useState4[0],
1266
+ setShowScroller = _useState4[1];
1267
+
1268
+ var _useState5 = useState(0),
1269
+ _useState6 = _slicedToArray(_useState5, 2),
1270
+ scrollPosition = _useState6[0],
1271
+ setScrollPosition = _useState6[1];
1272
+
58
1273
  var builder = imageUrlBuilder(props.client);
59
1274
  function urlFor(source) {
60
1275
  return builder.image(source);
61
1276
  }
62
1277
  function scrollSlider(e, direction) {
63
1278
  var slide = e.target.parentElement;
64
- var scrollOffset = slide.scrollLeft;
65
- var viewableWidth = slide.clientWidth > 700 ? 3 * (document.querySelector('.tile').scrollWidth + 8) : document.querySelector('.tile').scrollWidth + 8;
1279
+ var scrollOffset = scrollPosition;
1280
+ var viewableWidth = slide.clientWidth;
1281
+ //calculate viewable size / slide
1282
+ var numberOfSlidesToScroll = Math.floor(tile.current.clientWidth + 25); //width of the tile plus margin
66
1283
  var scrollDirection = void 0;
67
1284
  if (direction === 'next') {
68
- scrollDirection = scrollOffset + viewableWidth;
1285
+ scrollDirection = scrollOffset + numberOfSlidesToScroll;
1286
+ if (scrollOffset + viewableWidth + 25 >= innerSlider.current.offsetWidth) {
1287
+ scrollDirection = 0;
1288
+ }
69
1289
  }
70
1290
  if (direction === 'prev') {
71
- scrollDirection = scrollOffset - viewableWidth;
1291
+ scrollDirection = scrollOffset - numberOfSlidesToScroll;
1292
+ if (scrollOffset === 0) {
1293
+ if (window.innerWidth > 1399) {
1294
+ scrollDirection = innerSlider.current.offsetWidth - tileSize * 3 - 70;
1295
+ }
1296
+ if (window.innerWidth < 1399 && window.innerWidth > 592) {
1297
+ scrollDirection = innerSlider.current.offsetWidth - tileSize * 2 - 40;
1298
+ }
1299
+ if (window.innerWidth < 592) {
1300
+ scrollDirection = innerSlider.current.offsetWidth - tileSize * 1 - 24;
1301
+ }
1302
+ }
72
1303
  }
73
1304
  slide.scrollTo({
74
1305
  left: scrollDirection,
75
1306
  behavior: 'smooth'
76
1307
  });
1308
+ setScrollPosition(scrollDirection);
77
1309
  }
1310
+ var setThumbSize = function setThumbSize() {
1311
+ var thumbSize = void 0;
1312
+ var scrollerVisible = false;
1313
+ if (window.innerWidth > 1399) {
1314
+ thumbSize = Math.floor(viewableWindow.current.clientWidth / 3 - 40);
1315
+ if (props.data.slides.length > 3) {
1316
+ scrollerVisible = true;
1317
+ }
1318
+ }
1319
+ if (window.innerWidth < 1399 && window.innerWidth > 592) {
1320
+ thumbSize = Math.floor(viewableWindow.current.clientWidth / 2 - 48);
1321
+ if (props.data.slides.length > 2) {
1322
+ scrollerVisible = true;
1323
+ }
1324
+ }
1325
+ if (window.innerWidth < 592) {
1326
+ thumbSize = Math.floor(viewableWindow.current.clientWidth / 1 - 64);
1327
+ if (props.data.slides.length > 1) {
1328
+ scrollerVisible = true;
1329
+ }
1330
+ }
1331
+ if (thumbSize !== tileSize) {
1332
+ setTileSize(thumbSize);
1333
+ setScrollPosition(0);
1334
+ setShowScroller(scrollerVisible);
1335
+ var videoRows = document.querySelectorAll('#vid-slider .row');
1336
+ for (var i = 0; i < videoRows.length; i++) {
1337
+ videoRows[i].scrollTo({
1338
+ left: 0,
1339
+ behavior: 'smooth'
1340
+ });
1341
+ }
1342
+ }
1343
+ };
1344
+ useEffect(function () {
1345
+ //IE11 Polyfill
1346
+ smoothscroll.polyfill();
1347
+ setThumbSize();
1348
+
1349
+ window.addEventListener('resize', setThumbSize);
1350
+
1351
+ return function () {
1352
+ return window.removeEventListener('resize', setThumbSize);
1353
+ };
1354
+ }, []);
78
1355
 
79
1356
  var variant = 'black';
80
1357
  return React__default.createElement(
@@ -82,18 +1359,18 @@ var ImageSlider = function ImageSlider(props) {
82
1359
  null,
83
1360
  React__default.createElement(
84
1361
  'div',
85
- { id: 'vid-slider', className: 'col' },
1362
+ { ref: viewableWindow, id: 'vid-slider', className: 'col' },
86
1363
  React__default.createElement(
87
1364
  'div',
88
1365
  { className: 'row' },
89
- React__default.createElement(
1366
+ showScroller && React__default.createElement(
90
1367
  'div',
91
1368
  { onClick: function onClick(e) {
92
1369
  return scrollSlider(e, 'prev');
93
1370
  }, className: 'tile__slider-prev', style: { color: variant } },
94
1371
  React__default.createElement('i', { style: { border: 'solid ' + variant, borderWidth: '0 4px 4px 0' }, className: 'arrow left' })
95
1372
  ),
96
- React__default.createElement(
1373
+ showScroller && React__default.createElement(
97
1374
  'div',
98
1375
  { onClick: function onClick(e) {
99
1376
  return scrollSlider(e, 'next');
@@ -102,28 +1379,28 @@ var ImageSlider = function ImageSlider(props) {
102
1379
  ),
103
1380
  React__default.createElement(
104
1381
  'div',
105
- { className: 'row__inner' },
1382
+ { ref: innerSlider, className: 'row__inner' },
106
1383
  props.data.slides.map(function (img, index) {
107
1384
  var thumbnail = urlFor(img.slideshowImage).width(250);
108
1385
  if (!img.slideshowImage.link) {
109
1386
  return React__default.createElement(
110
1387
  'div',
111
- { key: index, className: 'tile' },
1388
+ { ref: tile, key: index, className: 'tile', style: { width: tileSize + 'px' } },
112
1389
  React__default.createElement(
113
1390
  'div',
114
1391
  { className: 'tile__media' },
115
- React__default.createElement('img', { className: 'tile__img', src: thumbnail, alt: img.slideshowImage.alt ? img.slideshowImage.alt : '' })
1392
+ React__default.createElement('img', { className: 'tile__img', src: thumbnail, alt: img.slideshowImage.alt ? img.slideshowImage.alt : '', style: { width: tileSize + 'px' } })
116
1393
  ),
117
1394
  React__default.createElement('div', { style: { color: variant }, className: 'tile__info' })
118
1395
  );
119
1396
  } else {
120
1397
  return React__default.createElement(
121
1398
  'a',
122
- { key: index, href: img.slideshowImage.link, target: img.slideshowImage.blank ? '_target' : '_self', className: 'tile' },
1399
+ { ref: tile, key: index, href: img.slideshowImage.link, target: img.slideshowImage.blank ? '_target' : '_self', className: 'tile', style: { width: tileSize + 'px' } },
123
1400
  React__default.createElement(
124
1401
  'div',
125
1402
  { className: 'tile__media' },
126
- React__default.createElement('img', { className: 'tile__img', src: thumbnail, alt: img.slideshowImage.alt ? img.slideshowImage.alt : '' })
1403
+ React__default.createElement('img', { className: 'tile__img', src: thumbnail, alt: img.slideshowImage.alt ? img.slideshowImage.alt : '', style: { width: tileSize + 'px' } })
127
1404
  ),
128
1405
  React__default.createElement('div', { style: { color: variant }, className: 'tile__info' })
129
1406
  );
@@ -134,7 +1411,7 @@ var ImageSlider = function ImageSlider(props) {
134
1411
  React__default.createElement(
135
1412
  'style',
136
1413
  { jsx: 'true' },
137
- '\n #vid-slider * {\n box-sizing: border-box;\n }\n #vid-slider::-webkit-scrollbar-thumb {\n display: none;\n }\n #vid-slider::-webkit-scrollbar {\n display: none;\n }\n #vid-slider .row::-webkit-scrollbar {\n display: none;\n }\n #vid-slider .row::-webkit-scrollbar-thumb {\n display: none;\n }\n #vid-slider {\n position: relative;\n -ms-overflow-style: none;\n }\n #vid-slider .contain {\n width: 100%;\n }\n #vid-slider .row {\n overflow: scroll;\n width: 100%;\n -ms-overflow-style: none;\n max-height: 255px;\n }\n #vid-slider .tile__info {\n white-space: normal !important;\n position: absolute;\n text-align: center;\n color: ' + (props.dark ? 'white' : '#383838') + ';\n opacity: 1;\n font-size: 1rem;\n transition: opacity 0.25s;\n }\n #vid-slider .row__inner {\n transition: 450ms -webkit-transform;\n transition: 450ms transform;\n transition: 450ms transform, 450ms -webkit-transform;\n font-size: 0;\n white-space: nowrap;\n margin: 0.5rem 0;\n padding-bottom: 10px;\n padding-left: 0;\n }\n #vid-slider .tile {\n position: relative;\n display: inline-block;\n width: 250px;\n margin-right: 10px;\n font-size: 20px;\n transition: 450ms all;\n -webkit-transform-origin: center left;\n transform-origin: center left;\n }\n #vid-slider .tile__img {\n width: 250px;\n height: auto;\n max-height: 150px;\n padding: 0 1.5rem;\n -o-object-fit: contain;\n object-fit: contain;\n }\n #vid-slider .tile__slider-prev,\n #vid-slider .tile__slider-next {\n width: 30px;\n background: transparent;\n border: none;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n z-index: 99;\n cursor: pointer;\n color: ' + (props.dark ? 'white' : 'black') + ';\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 2rem;\n }\n #vid-slider .tile__slider-prev {\n left: -3px;\n }\n #vid-slider .tile__slider-next {\n right: 0;\n }\n #vid-slider,\n #vid-slider .row {\n margin: 0;\n padding: 0 1.2rem;\n }\n #vid-slider .tile:last-child {\n margin-right: 2rem;\n }\n #vid-slider .row::-webkit-scrollbar-thumb {\n background-color: transparent !important;\n }\n #vid-slider i {\n border: solid ' + (props.dark ? 'white' : 'black') + ';\n border-width: 0 4px 4px 0;\n display: inline-block;\n padding: 4px;\n pointer-events: none;\n }\n #vid-slider .right {\n transform: rotate(-45deg);\n -webkit-transform: rotate(-45deg);\n }\n #vid-slider .left {\n transform: rotate(135deg);\n -webkit-transform: rotate(135deg);\n }\n '
1414
+ '\n #vid-slider * {\n box-sizing: border-box;\n -ms-overflow-style: none;\n }\n #vid-slider::-webkit-scrollbar-thumb {\n display: none;\n }\n #vid-slider::-webkit-scrollbar {\n display: none;\n }\n #vid-slider .row::-webkit-scrollbar {\n display: none;\n }\n #vid-slider .row::-webkit-scrollbar-thumb {\n display: none;\n }\n #vid-slider {\n position: relative;\n -ms-overflow-style: none;\n padding: 0 1.5rem;\n margin-bottom: 0 !important;\n }\n #vid-slider .now-playing {\n position: absolute;\n top: 0.5rem;\n left: 1rem;\n color: white;\n background: rgba(0, 0, 0, 0.75);\n }\n #vid-slider h1,\n #vid-slider p {\n text-align: center;\n width: 100%;\n max-width: 500px;\n margin: auto;\n }\n #vid-slider,\n #vidHolder {\n max-width: 805px;\n }\n #vid-slider a:link,\n #vid-slider a:hover,\n #vid-slider a:active,\n #vid-slider a:visited {\n transition: color 150ms;\n color: #95a5a6;\n text-decoration: none;\n }\n #vid-slider a:hover {\n color: #7f8c8d;\n text-decoration: underline;\n }\n #vid-slider .contain {\n width: 100%;\n }\n #vid-slider .row {\n overflow-x: scroll;\n width: 100%;\n -ms-overflow-style: none;\n overflow-y: hidden !important;\n }\n #vid-slider .tile__info {\n white-space: normal !important;\n position: absolute;\n text-align: center;\n color: ' + (props.dark ? 'white' : '#383838') + ';\n opacity: 1;\n font-size: 0.9rem;\n font-weight: bold;\n transition: opacity 0.25s;\n }\n #vid-slider .row__inner {\n transition: 450ms -webkit-transform;\n transition: 450ms transform;\n transition: 450ms transform, 450ms -webkit-transform;\n font-size: 0;\n white-space: nowrap;\n margin: 25px 0 70px !important;\n padding-bottom: 10px;\n padding-left: 0;\n }\n #vid-slider .tile {\n position: relative;\n display: inline-block;\n margin: 0 12px;\n font-size: 20px;\n transition: 450ms all;\n -webkit-transform-origin: center left;\n transform-origin: center left;\n }\n \n #vid-slider .tile:first-child {\n margin-left: 15px;\n }\n #vid-slider .tile__img {\n height: auto;\n -o-object-fit: contain;\n object-fit: contain;\n object-position: center;\n }\n #vid-slider .tile__details {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n font-size: 10px;\n opacity: 0;\n background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);\n transition: 450ms opacity;\n }\n #vid-slider .tile__details:after,\n #vid-slider .tile__details:before {\n content: \'\';\n \n position: absolute;\n top: 50%;\n left: 50%;\n display: #000;\n }\n #vid-slider .tile__details:after {\n margin-top: -25px;\n margin-left: -25px;\n width: 50px;\n height: 50px;\n border: 3px solid #ecf0f1;\n line-height: 50px;\n text-align: center;\n border-radius: 100%;\n background: rgba(0, 0, 0, 0.5);\n z-index: 1;\n }\n #vid-slider .tile__details:before {\n content: \'\';\n background: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 64 64\' width=\'64\' height=\'64\' fill=\'white\'><path d=\'M26 46 L46 32 L26 18 Z\'/></svg>")\n no-repeat center center;\n left: 0;\n width: 100%;\n height: 3rem;\n font-size: 30px;\n margin-right: 12px;\n margin-top: -24px;\n text-align: center;\n z-index: 2;\n color: white;\n }\n \n #vid-slider .tile__title {\n position: absolute;\n bottom: 0;\n padding: 10px;\n max-width: 250px;\n }\n #vid-slider .tile__title_text {\n position: relative;\n left: 0;\n white-space: normal;\n }\n \n #vid-slider .tile__slider-prev,\n #vid-slider .tile__slider-next {\n width: 30px;\n background: transparent;\n border: none;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n z-index: 99;\n cursor: pointer;\n color: ' + (props.dark ? 'white' : 'black') + ';\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 2rem;\n }\n #vid-slider .tile__slider-prev {\n left: -0.5rem;\n padding: 1rem;\n }\n #vid-slider .tile__slider-next {\n right: -0.5rem;\n padding: 1rem;\n }\n #vid-slider,\n #vid-slider .row {\n margin: 0;\n }\n \n #vid-slider .row::-webkit-scrollbar-thumb {\n background-color: transparent !important;\n }\n #vid-slider i {\n border: solid ' + (props.dark ? 'white' : 'black') + ';\n border-width: 0 4px 4px 0;\n display: inline-block;\n padding: 4px;\n pointer-events: none;\n }\n #vid-slider .right {\n transform: rotate(-45deg);\n -webkit-transform: rotate(-45deg);\n }\n #vid-slider .left {\n transform: rotate(135deg);\n -webkit-transform: rotate(135deg);\n }\n @media screen and (min-width: 1399px) {\n .block-content #vid-slider .tile__img {\n height: auto;\n }\n .block-content #vid-slider .tile {\n height: auto;\n }\n }\n \n @media screen and (max-width: 1399px) {\n #vid-slider,\n #vidHolder {\n max-width: 620px;\n }\n }\n @media screen and (max-width: 1200px) {\n #vid-slider,\n #vidHolder {\n max-width: 580px;\n }\n }\n @media screen and (max-width: 967px) {\n #vid-slider {\n max-width: 100%;\n }\n \n #vid-slider .row__inner {\n margin: 60px 0 50px !important;\n }\n }\n \n @media screen and (max-width: 768px) {\n #vidHolder {\n position: unset;\n width: 100%;\n }\n }\n @media screen and (max-width: 568px) {\n #vidHolder {\n position: unset;\n width: 100%;\n }\n \n #vid-slider .row__inner {\n margin: 30px 0 70px;\n }\n }\n '
138
1415
  )
139
1416
  )
140
1417
  );