@mjhls/mjh-framework 1.0.536 → 1.0.537

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 (148) 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/ADSponsoredResources.js +2 -2
  9. package/dist/cjs/ADWebcast.js +2 -2
  10. package/dist/cjs/ADWelcome.js +2 -2
  11. package/dist/cjs/AdSlot.js +2 -2
  12. package/dist/cjs/AdSlotsProvider.js +1 -1
  13. package/dist/cjs/ArticleQueue.js +10 -10
  14. package/dist/cjs/Auth.js +256 -507
  15. package/dist/cjs/{BlockContent-f942392e.js → BlockContent-77f81ffc.js} +1 -1
  16. package/dist/cjs/CMEDeck.js +5 -5
  17. package/dist/cjs/Column3.js +4 -4
  18. package/dist/cjs/ConferenceArticleCard.js +17 -17
  19. package/dist/cjs/DeckContent.js +15 -15
  20. package/dist/cjs/DeckQueue.js +6 -6
  21. package/dist/cjs/{Dfp-fbe32b96.js → Dfp-fcdeabc4.js} +1 -1
  22. package/dist/cjs/EventsDeck.js +22 -22
  23. package/dist/cjs/ExternalResources.js +6 -6
  24. package/dist/cjs/Feature.js +3 -3
  25. package/dist/cjs/ForbesHero.js +2 -2
  26. package/dist/cjs/GridContent.js +10 -10
  27. package/dist/cjs/GridHero.js +2 -2
  28. package/dist/cjs/GroupDeck.js +5 -5
  29. package/dist/cjs/HamMagazine.js +11 -11
  30. package/dist/cjs/Hero.js +1 -1
  31. package/dist/cjs/HorizontalHero.js +2 -2
  32. package/dist/cjs/IssueContentDeck.js +2 -2
  33. package/dist/cjs/IssueDeck.js +2 -2
  34. package/dist/cjs/IssueLanding.js +36 -36
  35. package/dist/cjs/KMTracker.js +15 -15
  36. package/dist/cjs/LeftNav.js +2 -2
  37. package/dist/cjs/MasterDeck.js +27 -24
  38. package/dist/cjs/NavMagazine.js +12 -12
  39. package/dist/cjs/NavNative.js +11 -11
  40. package/dist/cjs/OncliveHero.js +2 -2
  41. package/dist/cjs/OncliveLargeHero.js +2 -2
  42. package/dist/cjs/PartnerDetailListing.js +1210 -14
  43. package/dist/cjs/PublicationDeck.js +1 -1
  44. package/dist/cjs/PublicationLanding.js +33 -33
  45. package/dist/cjs/QueueDeckExpanded.js +9 -9
  46. package/dist/cjs/RelatedContent.js +30 -30
  47. package/dist/cjs/RelatedTopicsDropdown.js +10 -10
  48. package/dist/cjs/SideFooter.js +2 -2
  49. package/dist/cjs/TaxonomyCard.js +2 -2
  50. package/dist/cjs/TemplateNormal.js +2 -2
  51. package/dist/cjs/ThumbnailCard.js +1 -1
  52. package/dist/cjs/Ustream.js +2 -2
  53. package/dist/cjs/VerticalHero.js +2 -2
  54. package/dist/cjs/VideoSeriesFilter.js +1 -1
  55. package/dist/cjs/VideoSeriesListing.js +4 -4
  56. package/dist/cjs/View.js +38 -38
  57. package/dist/cjs/YahooHero.js +2 -2
  58. package/dist/cjs/YoutubeGroup.js +5 -5
  59. package/dist/cjs/getQuery.js +1 -1
  60. package/dist/cjs/getRelatedArticle.js +355 -6
  61. package/dist/cjs/getSerializers.js +437 -449
  62. package/dist/cjs/{getTargeting-b15993cb.js → getTargeting-3d208b98.js} +11 -11
  63. package/dist/cjs/getTargeting.js +1 -1
  64. package/dist/cjs/{index-5be2866f.js → index-3294d3bc.js} +1 -1
  65. package/dist/cjs/index-bd6c9f56.js +211 -0
  66. package/dist/cjs/{index-b5eb3ff8.js → index-be0c82be.js} +19 -20
  67. package/dist/cjs/{index-f7ee1612.js → index-fa3cec70.js} +6 -4
  68. package/dist/cjs/{index.es-ab3f2690.js → index.es-9110add6.js} +1 -3
  69. package/dist/cjs/index.js +13 -14
  70. package/dist/cjs/{main-bc4db521.js → main-88348b15.js} +35 -66
  71. package/dist/cjs/{moment-66a6a284.js → moment-575fe24c.js} +1 -1
  72. package/dist/cjs/urlFor.js +2 -2
  73. package/dist/esm/AD.js +1 -1
  74. package/dist/esm/AD300x250.js +3 -3
  75. package/dist/esm/AD300x250x600.js +3 -3
  76. package/dist/esm/AD728x90.js +4 -4
  77. package/dist/esm/ADFloatingFooter.js +5 -5
  78. package/dist/esm/ADGutter.js +2 -2
  79. package/dist/esm/ADSponsoredResources.js +2 -2
  80. package/dist/esm/ADWebcast.js +2 -2
  81. package/dist/esm/ADWelcome.js +2 -2
  82. package/dist/esm/AdSlot.js +2 -2
  83. package/dist/esm/AdSlotsProvider.js +1 -1
  84. package/dist/esm/ArticleQueue.js +10 -10
  85. package/dist/esm/Auth.js +248 -499
  86. package/dist/esm/{BlockContent-a614acdf.js → BlockContent-e9b4ddcf.js} +1 -1
  87. package/dist/esm/CMEDeck.js +5 -5
  88. package/dist/esm/Column3.js +4 -4
  89. package/dist/esm/ConferenceArticleCard.js +17 -17
  90. package/dist/esm/DeckContent.js +15 -15
  91. package/dist/esm/DeckQueue.js +6 -6
  92. package/dist/esm/{Dfp-ae9336e2.js → Dfp-81a052c2.js} +1 -1
  93. package/dist/esm/EventsDeck.js +22 -22
  94. package/dist/esm/ExternalResources.js +6 -6
  95. package/dist/esm/Feature.js +3 -3
  96. package/dist/esm/ForbesHero.js +2 -2
  97. package/dist/esm/GridContent.js +10 -10
  98. package/dist/esm/GridHero.js +2 -2
  99. package/dist/esm/GroupDeck.js +5 -5
  100. package/dist/esm/HamMagazine.js +11 -11
  101. package/dist/esm/Hero.js +1 -1
  102. package/dist/esm/HorizontalHero.js +2 -2
  103. package/dist/esm/IssueContentDeck.js +2 -2
  104. package/dist/esm/IssueDeck.js +2 -2
  105. package/dist/esm/IssueLanding.js +36 -36
  106. package/dist/esm/KMTracker.js +15 -15
  107. package/dist/esm/LeftNav.js +2 -2
  108. package/dist/esm/MasterDeck.js +27 -24
  109. package/dist/esm/NavMagazine.js +12 -12
  110. package/dist/esm/NavNative.js +11 -11
  111. package/dist/esm/OncliveHero.js +2 -2
  112. package/dist/esm/OncliveLargeHero.js +2 -2
  113. package/dist/esm/PartnerDetailListing.js +1208 -12
  114. package/dist/esm/PublicationDeck.js +1 -1
  115. package/dist/esm/PublicationLanding.js +33 -33
  116. package/dist/esm/QueueDeckExpanded.js +9 -9
  117. package/dist/esm/RelatedContent.js +30 -30
  118. package/dist/esm/RelatedTopicsDropdown.js +10 -10
  119. package/dist/esm/SideFooter.js +2 -2
  120. package/dist/esm/TaxonomyCard.js +2 -2
  121. package/dist/esm/TemplateNormal.js +2 -2
  122. package/dist/esm/ThumbnailCard.js +1 -1
  123. package/dist/esm/Ustream.js +2 -2
  124. package/dist/esm/VerticalHero.js +2 -2
  125. package/dist/esm/VideoSeriesFilter.js +1 -1
  126. package/dist/esm/VideoSeriesListing.js +4 -4
  127. package/dist/esm/View.js +13 -13
  128. package/dist/esm/YahooHero.js +2 -2
  129. package/dist/esm/YoutubeGroup.js +5 -5
  130. package/dist/esm/getQuery.js +1 -1
  131. package/dist/esm/getRelatedArticle.js +355 -6
  132. package/dist/esm/getSerializers.js +437 -449
  133. package/dist/esm/{getTargeting-1a0bd08d.js → getTargeting-1f2c61e3.js} +9 -9
  134. package/dist/esm/getTargeting.js +1 -1
  135. package/dist/esm/{index-93ec3c59.js → index-3f4dd6f2.js} +6 -4
  136. package/dist/esm/{index-51a80699.js → index-73819142.js} +19 -20
  137. package/dist/esm/index-db3bb315.js +207 -0
  138. package/dist/esm/{index-d2f90501.js → index-ef6d5dcf.js} +1 -1
  139. package/dist/esm/{index.es-938a3a58.js → index.es-29c1cef5.js} +1 -3
  140. package/dist/esm/index.js +12 -13
  141. package/dist/esm/{main-7255814e.js → main-d7ee6151.js} +34 -65
  142. package/dist/esm/{moment-12415288.js → moment-e2f9b20c.js} +1 -1
  143. package/dist/esm/urlFor.js +2 -2
  144. package/package.json +107 -107
  145. /package/dist/cjs/{ADInfeed-3404200f.js → ADInfeed-d8e47444.js} +0 -0
  146. /package/dist/cjs/{ADlgInfeed-2611e1a9.js → ADlgInfeed-947c3a47.js} +0 -0
  147. /package/dist/esm/{ADInfeed-27674dc6.js → ADInfeed-2eb234ae.js} +0 -0
  148. /package/dist/esm/{ADlgInfeed-43060a77.js → ADlgInfeed-17c13711.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,20 +10,20 @@ 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 } from 'react';
14
+ import './index-3f4dd6f2.js';
15
+ import PropTypes from 'prop-types';
16
16
  import 'react-bootstrap/Card';
17
- import { m as moment } from './moment-12415288.js';
17
+ import { m as moment } from './moment-e2f9b20c.js';
18
18
  import 'next/router';
19
19
  import './isSymbol-b7b7434f.js';
20
20
  import './debounce-048d9cb6.js';
21
- import './index.es-938a3a58.js';
21
+ import './index.es-29c1cef5.js';
22
22
  import 'react-dom';
23
23
  import './visibility-sensor-0baa4eea.js';
24
- import { i as imageUrlBuilder } from './index-51a80699.js';
24
+ import { i as imageUrlBuilder } from './index-73819142.js';
25
25
  import './index-5f9f807a.js';
26
- import './main-7255814e.js';
26
+ import './main-d7ee6151.js';
27
27
  import './entities-7cc3bf45.js';
28
28
  import { _ as _slicedToArray } from './slicedToArray-f1e40361.js';
29
29
  import './stringify-e30bc114.js';
@@ -31,11 +31,11 @@ import { a as _asyncToGenerator, r as regenerator, _ as _Promise } from './async
31
31
  import './_set-species-6f64f1c1.js';
32
32
  import './beam-a25bd8fd.js';
33
33
  import './AdSlot.js';
34
- import './ADInfeed-27674dc6.js';
34
+ import './ADInfeed-2eb234ae.js';
35
35
  import './lodash-17fdfebb.js';
36
- import './ADlgInfeed-43060a77.js';
36
+ import './ADlgInfeed-17c13711.js';
37
37
  import './AuthorComponent-158226c9.js';
38
- import { B as BlockContent } from './BlockContent-a614acdf.js';
38
+ import { B as BlockContent } from './BlockContent-e9b4ddcf.js';
39
39
  import './smoothscroll-4b699764.js';
40
40
  import './GroupDeck.js';
41
41
  import 'react-bootstrap';
@@ -50,7 +50,1203 @@ import Feature from './Feature.js';
50
50
  import 'react-bootstrap/Breadcrumb';
51
51
  import Breadcrumbs from './Breadcrumbs.js';
52
52
  import urlFor from './urlFor.js';
53
- import { TwitterTimelineEmbed } from 'react-twitter-embed';
53
+
54
+ function _classCallCheck(instance, Constructor) {
55
+ if (!(instance instanceof Constructor)) {
56
+ throw new TypeError("Cannot call a class as a function");
57
+ }
58
+ }
59
+
60
+ function _defineProperties(target, props) {
61
+ for (var i = 0; i < props.length; i++) {
62
+ var descriptor = props[i];
63
+ descriptor.enumerable = descriptor.enumerable || false;
64
+ descriptor.configurable = true;
65
+ if ("value" in descriptor) descriptor.writable = true;
66
+ Object.defineProperty(target, descriptor.key, descriptor);
67
+ }
68
+ }
69
+
70
+ function _createClass(Constructor, protoProps, staticProps) {
71
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
72
+ if (staticProps) _defineProperties(Constructor, staticProps);
73
+ return Constructor;
74
+ }
75
+
76
+ function _typeof(obj) {
77
+ "@babel/helpers - typeof";
78
+
79
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
80
+ _typeof = function _typeof(obj) {
81
+ return typeof obj;
82
+ };
83
+ } else {
84
+ _typeof = function _typeof(obj) {
85
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
86
+ };
87
+ }
88
+
89
+ return _typeof(obj);
90
+ }
91
+
92
+ function _assertThisInitialized(self) {
93
+ if (self === void 0) {
94
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
95
+ }
96
+
97
+ return self;
98
+ }
99
+
100
+ function _possibleConstructorReturn(self, call) {
101
+ if (call && (_typeof(call) === "object" || typeof call === "function")) {
102
+ return call;
103
+ }
104
+
105
+ return _assertThisInitialized(self);
106
+ }
107
+
108
+ function _getPrototypeOf(o) {
109
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
110
+ return o.__proto__ || Object.getPrototypeOf(o);
111
+ };
112
+ return _getPrototypeOf(o);
113
+ }
114
+
115
+ function _setPrototypeOf(o, p) {
116
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
117
+ o.__proto__ = p;
118
+ return o;
119
+ };
120
+
121
+ return _setPrototypeOf(o, p);
122
+ }
123
+
124
+ function _inherits(subClass, superClass) {
125
+ if (typeof superClass !== "function" && superClass !== null) {
126
+ throw new TypeError("Super expression must either be null or a function");
127
+ }
128
+
129
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
130
+ constructor: {
131
+ value: subClass,
132
+ writable: true,
133
+ configurable: true
134
+ }
135
+ });
136
+ if (superClass) _setPrototypeOf(subClass, superClass);
137
+ }
138
+
139
+ function _defineProperty(obj, key, value) {
140
+ if (key in obj) {
141
+ Object.defineProperty(obj, key, {
142
+ value: value,
143
+ enumerable: true,
144
+ configurable: true,
145
+ writable: true
146
+ });
147
+ } else {
148
+ obj[key] = value;
149
+ }
150
+
151
+ return obj;
152
+ }
153
+
154
+ var isRequiredIf_1 = createCommonjsModule(function (module, exports) {
155
+ 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.
156
+ }};exports.default=isRequiredIf;
157
+
158
+
159
+ });
160
+
161
+ var isRequiredIf = unwrapExports(isRequiredIf_1);
162
+
163
+ var exenv = createCommonjsModule(function (module) {
164
+ /*!
165
+ Copyright (c) 2015 Jed Watson.
166
+ Based on code that is Copyright 2013-2015, Facebook, Inc.
167
+ All rights reserved.
168
+ */
169
+ /* global define */
170
+
171
+ (function () {
172
+
173
+ var canUseDOM = !!(
174
+ typeof window !== 'undefined' &&
175
+ window.document &&
176
+ window.document.createElement
177
+ );
178
+
179
+ var ExecutionEnvironment = {
180
+
181
+ canUseDOM: canUseDOM,
182
+
183
+ canUseWorkers: typeof Worker !== 'undefined',
184
+
185
+ canUseEventListeners:
186
+ canUseDOM && !!(window.addEventListener || window.attachEvent),
187
+
188
+ canUseViewport: canUseDOM && !!window.screen
189
+
190
+ };
191
+
192
+ if ( module.exports) {
193
+ module.exports = ExecutionEnvironment;
194
+ } else {
195
+ window.ExecutionEnvironment = ExecutionEnvironment;
196
+ }
197
+
198
+ }());
199
+ });
200
+
201
+ var twitterWidgetJs = 'https://platform.twitter.com/widgets.js';
202
+
203
+ var TwitterTimelineEmbed =
204
+ /*#__PURE__*/
205
+ function (_Component) {
206
+ _inherits(TwitterTimelineEmbed, _Component);
207
+
208
+ function TwitterTimelineEmbed(props) {
209
+ var _this;
210
+
211
+ _classCallCheck(this, TwitterTimelineEmbed);
212
+
213
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(TwitterTimelineEmbed).call(this, props));
214
+ _this.state = {
215
+ isLoading: true
216
+ };
217
+ return _this;
218
+ }
219
+
220
+ _createClass(TwitterTimelineEmbed, [{
221
+ key: "buildChromeOptions",
222
+ value: function buildChromeOptions(options) {
223
+ options.chrome = '';
224
+
225
+ if (this.props.noHeader) {
226
+ options.chrome = options.chrome + ' noheader';
227
+ }
228
+
229
+ if (this.props.noFooter) {
230
+ options.chrome = options.chrome + ' nofooter';
231
+ }
232
+
233
+ if (this.props.noBorders) {
234
+ options.chrome = options.chrome + ' noborders';
235
+ }
236
+
237
+ if (this.props.noScrollbar) {
238
+ options.chrome = options.chrome + ' noscrollbar';
239
+ }
240
+
241
+ if (this.props.transparent) {
242
+ options.chrome = options.chrome + ' transparent';
243
+ }
244
+
245
+ return options;
246
+ }
247
+ }, {
248
+ key: "buildOptions",
249
+ value: function buildOptions() {
250
+ var options = Object.assign({}, this.props.options);
251
+
252
+ if (this.props.autoHeight) {
253
+ options.height = this.refs.embedContainer.parentNode.offsetHeight;
254
+ }
255
+
256
+ options = Object.assign({}, options, {
257
+ theme: this.props.theme,
258
+ linkColor: this.props.linkColor,
259
+ borderColor: this.props.borderColor,
260
+ lang: this.props.lang
261
+ });
262
+ return options;
263
+ }
264
+ }, {
265
+ key: "renderWidget",
266
+ value: function renderWidget(options) {
267
+ var _this2 = this;
268
+
269
+ var onLoad = this.props.onLoad;
270
+
271
+ if (!this.isMountCanceled) {
272
+ window.twttr.widgets.createTimeline({
273
+ sourceType: this.props.sourceType,
274
+ screenName: this.props.screenName,
275
+ userId: this.props.userId,
276
+ ownerScreenName: this.props.ownerScreenName,
277
+ slug: this.props.slug,
278
+ id: this.props.id || this.props.widgetId,
279
+ url: this.props.url
280
+ }, this.refs.embedContainer, options).then(function (element) {
281
+ _this2.setState({
282
+ isLoading: false
283
+ });
284
+
285
+ if (onLoad) {
286
+ onLoad(element);
287
+ }
288
+ });
289
+ }
290
+ }
291
+ }, {
292
+ key: "componentDidMount",
293
+ value: function componentDidMount() {
294
+ var _this3 = this;
295
+
296
+ if (exenv.canUseDOM) {
297
+ var script = require('scriptjs');
298
+
299
+ script(twitterWidgetJs, 'twitter-embed', function () {
300
+ if (!window.twttr) {
301
+ console.error('Failure to load window.twttr in TwitterTimelineEmbed, aborting load.');
302
+ return;
303
+ }
304
+
305
+ var options = _this3.buildOptions();
306
+ /** Append chrome options */
307
+
308
+
309
+ options = _this3.buildChromeOptions(options);
310
+
311
+ _this3.renderWidget(options);
312
+ });
313
+ }
314
+ }
315
+ }, {
316
+ key: "componentWillUnmount",
317
+ value: function componentWillUnmount() {
318
+ this.isMountCanceled = true;
319
+ }
320
+ }, {
321
+ key: "render",
322
+ value: function render() {
323
+ var isLoading = this.state.isLoading;
324
+ var placeholder = this.props.placeholder;
325
+ return React__default.createElement(React__default.Fragment, null, isLoading && placeholder, React__default.createElement("div", {
326
+ ref: "embedContainer"
327
+ }));
328
+ }
329
+ }]);
330
+
331
+ return TwitterTimelineEmbed;
332
+ }(Component);
333
+
334
+ _defineProperty(TwitterTimelineEmbed, "propTypes", {
335
+ /**
336
+ * This can be either of profile, likes, list, collection, URL, widget
337
+ */
338
+ sourceType: PropTypes.oneOf(['profile', 'likes', 'list', 'collection', 'url', 'widget']).isRequired,
339
+
340
+ /**
341
+ * username of twitter handle as String
342
+ */
343
+ screenName: isRequiredIf(PropTypes.string, function (props) {
344
+ return !props.hasOwnProperty('userId') && (props.sourceType === 'profile' || props.sourceType === 'likes');
345
+ }),
346
+
347
+ /**
348
+ * UserId of twitter handle as number
349
+ */
350
+ userId: isRequiredIf(PropTypes.number, function (props) {
351
+ return !props.hasOwnProperty('screenName') && (props.sourceType === 'profile' || props.sourceType === 'likes');
352
+ }),
353
+
354
+ /**
355
+ * To show list, used along with slug
356
+ */
357
+ ownerScreenName: isRequiredIf(PropTypes.string, function (props) {
358
+ return props.sourceType === 'list' && !props.hasOwnProperty('id');
359
+ }),
360
+
361
+ /**
362
+ * To show list, used along with ownerScreenName
363
+ */
364
+ slug: isRequiredIf(PropTypes.string, function (props) {
365
+ return props.sourceType === 'list' && !props.hasOwnProperty('id');
366
+ }),
367
+
368
+ /**
369
+ * To show list, unique list id
370
+ * Also used with collections, in that case its valid collection id
371
+ */
372
+ id: isRequiredIf(PropTypes.oneOfType([PropTypes.number, PropTypes.string]), function (props) {
373
+ return props.sourceType === 'list' && !props.hasOwnProperty('ownerScreenName') && !props.hasOwnProperty('slug') || props.sourceType === 'collection';
374
+ }),
375
+
376
+ /**
377
+ * To show twitter content with url.
378
+ * Supported content includes profiles, likes, lists, and collections.
379
+ */
380
+ url: isRequiredIf(PropTypes.string, function (props) {
381
+ return props.sourceType === 'url';
382
+ }),
383
+
384
+ /**
385
+ * To show custom widget
386
+ */
387
+ widgetId: isRequiredIf(PropTypes.string, function (props) {
388
+ return props.sourceType === 'widget';
389
+ }),
390
+
391
+ /**
392
+ * Additional options to pass to twitter widget plugin
393
+ */
394
+ options: PropTypes.object,
395
+
396
+ /**
397
+ * Automatically fit into parent container height
398
+ */
399
+ autoHeight: PropTypes.bool,
400
+
401
+ /**
402
+ * With dark or light theme
403
+ */
404
+ theme: PropTypes.oneOf(['dark', 'light']),
405
+
406
+ /**
407
+ * With custom link colors. Note: Only Hex colors are supported.
408
+ */
409
+ linkColor: PropTypes.string,
410
+
411
+ /**
412
+ * With custom border colors. Note: Only Hex colors are supported.
413
+ */
414
+ borderColor: PropTypes.string,
415
+
416
+ /**
417
+ * Hide the header from timeline
418
+ */
419
+ noHeader: PropTypes.bool,
420
+
421
+ /**
422
+ * Hide the footer from timeline
423
+ */
424
+ noFooter: PropTypes.bool,
425
+
426
+ /**
427
+ * Hide the border from timeline
428
+ */
429
+ noBorders: PropTypes.bool,
430
+
431
+ /**
432
+ * Hide the scrollbars
433
+ */
434
+ noScrollbar: PropTypes.bool,
435
+
436
+ /**
437
+ * Enable Transparancy
438
+ */
439
+ transparent: PropTypes.bool,
440
+
441
+ /**
442
+ * Custom language code. Supported codes here: https://developer.twitter.com/en/docs/twitter-for-websites/twitter-for-websites-supported-languages/overview.html
443
+ */
444
+ lang: PropTypes.string,
445
+
446
+ /**
447
+ * Placeholder while tweet is loading
448
+ */
449
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
450
+
451
+ /**
452
+ * Function to execute after load, return html element
453
+ */
454
+ onLoad: PropTypes.func
455
+ });
456
+
457
+ var TwitterShareButton =
458
+ /*#__PURE__*/
459
+ function (_Component) {
460
+ _inherits(TwitterShareButton, _Component);
461
+
462
+ function TwitterShareButton(props) {
463
+ var _this;
464
+
465
+ _classCallCheck(this, TwitterShareButton);
466
+
467
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(TwitterShareButton).call(this, props));
468
+ _this.state = {
469
+ isLoading: true
470
+ };
471
+ return _this;
472
+ }
473
+
474
+ _createClass(TwitterShareButton, [{
475
+ key: "componentDidMount",
476
+ value: function componentDidMount() {
477
+ var _this2 = this;
478
+
479
+ var onLoad = this.props.onLoad;
480
+
481
+ if (exenv.canUseDOM) {
482
+ var script = require('scriptjs');
483
+
484
+ script(twitterWidgetJs, 'twitter-embed', function () {
485
+ if (!window.twttr) {
486
+ console.error('Failure to load window.twttr in TwitterShareButton, aborting load.');
487
+ return;
488
+ }
489
+
490
+ if (!_this2.isMountCanceled) {
491
+ window.twttr.widgets.createShareButton(_this2.props.url, _this2.refs.embedContainer, _this2.props.options).then(function (element) {
492
+ _this2.setState({
493
+ isLoading: false
494
+ });
495
+
496
+ if (onLoad) {
497
+ onLoad(element);
498
+ }
499
+ });
500
+ }
501
+ });
502
+ }
503
+ }
504
+ }, {
505
+ key: "componentWillUnmount",
506
+ value: function componentWillUnmount() {
507
+ this.isMountCanceled = true;
508
+ }
509
+ }, {
510
+ key: "render",
511
+ value: function render() {
512
+ var isLoading = this.state.isLoading;
513
+ var placeholder = this.props.placeholder;
514
+ return React__default.createElement(React__default.Fragment, null, isLoading && placeholder, React__default.createElement("div", {
515
+ ref: "embedContainer"
516
+ }));
517
+ }
518
+ }]);
519
+
520
+ return TwitterShareButton;
521
+ }(Component);
522
+
523
+ _defineProperty(TwitterShareButton, "propTypes", {
524
+ /**
525
+ * Url for sharing
526
+ */
527
+ url: PropTypes.string.isRequired,
528
+
529
+ /**
530
+ * Additional options for overriding config. Details at : https://dev.twitter.com/web/tweet-button/parameters
531
+ */
532
+ options: PropTypes.object,
533
+
534
+ /**
535
+ * Placeholder while tweet is loading
536
+ */
537
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
538
+
539
+ /**
540
+ * Function to execute after load, return html element
541
+ */
542
+ onLoad: PropTypes.func
543
+ });
544
+
545
+ var TwitterFollowButton =
546
+ /*#__PURE__*/
547
+ function (_Component) {
548
+ _inherits(TwitterFollowButton, _Component);
549
+
550
+ function TwitterFollowButton(props) {
551
+ var _this;
552
+
553
+ _classCallCheck(this, TwitterFollowButton);
554
+
555
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(TwitterFollowButton).call(this, props));
556
+ _this.state = {
557
+ isLoading: true
558
+ };
559
+ return _this;
560
+ }
561
+
562
+ _createClass(TwitterFollowButton, [{
563
+ key: "componentDidMount",
564
+ value: function componentDidMount() {
565
+ var _this2 = this;
566
+
567
+ var onLoad = this.props.onLoad;
568
+
569
+ if (exenv.canUseDOM) {
570
+ var script = require('scriptjs');
571
+
572
+ script(twitterWidgetJs, 'twitter-embed', function () {
573
+ if (!window.twttr) {
574
+ console.error('Failure to load window.twttr in TwitterFollowButton, aborting load.');
575
+ return;
576
+ }
577
+
578
+ if (!_this2.isMountCanceled) {
579
+ window.twttr.widgets.createFollowButton(_this2.props.screenName, _this2.refs.embedContainer, _this2.props.options).then(function (element) {
580
+ _this2.setState({
581
+ isLoading: false
582
+ });
583
+
584
+ if (onLoad) {
585
+ onLoad(element);
586
+ }
587
+ });
588
+ }
589
+ });
590
+ }
591
+ }
592
+ }, {
593
+ key: "componentWillUnmount",
594
+ value: function componentWillUnmount() {
595
+ this.isMountCanceled = true;
596
+ }
597
+ }, {
598
+ key: "render",
599
+ value: function render() {
600
+ var isLoading = this.state.isLoading;
601
+ var placeholder = this.props.placeholder;
602
+ return React__default.createElement(React__default.Fragment, null, isLoading && placeholder, React__default.createElement("div", {
603
+ ref: "embedContainer"
604
+ }));
605
+ }
606
+ }]);
607
+
608
+ return TwitterFollowButton;
609
+ }(Component);
610
+
611
+ _defineProperty(TwitterFollowButton, "propTypes", {
612
+ /**
613
+ * Username of twitter user which will be followed on click
614
+ */
615
+ screenName: PropTypes.string.isRequired,
616
+
617
+ /**
618
+ * Additional options to be added to the button
619
+ */
620
+ options: PropTypes.object,
621
+
622
+ /**
623
+ * Placeholder while tweet is loading
624
+ */
625
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
626
+
627
+ /**
628
+ * Function to execute after load, return html element
629
+ */
630
+ onLoad: PropTypes.func
631
+ });
632
+
633
+ var TwitterHashtagButton =
634
+ /*#__PURE__*/
635
+ function (_Component) {
636
+ _inherits(TwitterHashtagButton, _Component);
637
+
638
+ function TwitterHashtagButton(props) {
639
+ var _this;
640
+
641
+ _classCallCheck(this, TwitterHashtagButton);
642
+
643
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(TwitterHashtagButton).call(this, props));
644
+ _this.state = {
645
+ isLoading: true
646
+ };
647
+ return _this;
648
+ }
649
+
650
+ _createClass(TwitterHashtagButton, [{
651
+ key: "componentDidMount",
652
+ value: function componentDidMount() {
653
+ var _this2 = this;
654
+
655
+ var onLoad = this.props.onLoad;
656
+
657
+ if (exenv.canUseDOM) {
658
+ var script = require('scriptjs');
659
+
660
+ script(twitterWidgetJs, 'twitter-embed', function () {
661
+ if (!window.twttr) {
662
+ console.error('Failure to load window.twttr in TwitterHashtagButton, aborting load.');
663
+ return;
664
+ }
665
+
666
+ if (!_this2.isMountCanceled) {
667
+ window.twttr.widgets.createHashtagButton(_this2.props.tag, _this2.refs.embedContainer, _this2.props.options).then(function (element) {
668
+ _this2.setState({
669
+ isLoading: false
670
+ });
671
+
672
+ if (onLoad) {
673
+ onLoad(element);
674
+ }
675
+ });
676
+ }
677
+ });
678
+ }
679
+ }
680
+ }, {
681
+ key: "componentWillUnmount",
682
+ value: function componentWillUnmount() {
683
+ this.isMountCanceled = true;
684
+ }
685
+ }, {
686
+ key: "render",
687
+ value: function render() {
688
+ var isLoading = this.state.isLoading;
689
+ var placeholder = this.props.placeholder;
690
+ return React__default.createElement(React__default.Fragment, null, isLoading && placeholder, React__default.createElement("div", {
691
+ ref: "embedContainer"
692
+ }));
693
+ }
694
+ }]);
695
+
696
+ return TwitterHashtagButton;
697
+ }(Component);
698
+
699
+ _defineProperty(TwitterHashtagButton, "propTypes", {
700
+ /**
701
+ * Tag name for hashtag button
702
+ */
703
+ tag: PropTypes.string.isRequired,
704
+
705
+ /**
706
+ * Additional options to be added to the button
707
+ */
708
+ options: PropTypes.object,
709
+
710
+ /**
711
+ * Placeholder while tweet is loading
712
+ */
713
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
714
+
715
+ /**
716
+ * Function to execute after load, return html element
717
+ */
718
+ onLoad: PropTypes.func
719
+ });
720
+
721
+ var TwitterMentionButton =
722
+ /*#__PURE__*/
723
+ function (_Component) {
724
+ _inherits(TwitterMentionButton, _Component);
725
+
726
+ function TwitterMentionButton(props) {
727
+ var _this;
728
+
729
+ _classCallCheck(this, TwitterMentionButton);
730
+
731
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(TwitterMentionButton).call(this, props));
732
+ _this.state = {
733
+ isLoading: true
734
+ };
735
+ return _this;
736
+ }
737
+
738
+ _createClass(TwitterMentionButton, [{
739
+ key: "componentDidMount",
740
+ value: function componentDidMount() {
741
+ var _this2 = this;
742
+
743
+ var onLoad = this.props.onLoad;
744
+
745
+ if (exenv.canUseDOM) {
746
+ var script = require('scriptjs');
747
+
748
+ script(twitterWidgetJs, 'twitter-embed', function () {
749
+ if (!window.twttr) {
750
+ console.error('Failure to load window.twttr in TwitterMentionButton, aborting load.');
751
+ return;
752
+ }
753
+
754
+ if (!_this2.isMountCanceled) {
755
+ window.twttr.widgets.createMentionButton(_this2.props.screenName, _this2.refs.embedContainer, _this2.props.options).then(function (element) {
756
+ _this2.setState({
757
+ isLoading: false
758
+ });
759
+
760
+ if (onLoad) {
761
+ onLoad(element);
762
+ }
763
+ });
764
+ }
765
+ });
766
+ }
767
+ }
768
+ }, {
769
+ key: "componentWillUnmount",
770
+ value: function componentWillUnmount() {
771
+ this.isMountCanceled = true;
772
+ }
773
+ }, {
774
+ key: "render",
775
+ value: function render() {
776
+ var isLoading = this.state.isLoading;
777
+ var placeholder = this.props.placeholder;
778
+ return React__default.createElement(React__default.Fragment, null, isLoading && placeholder, React__default.createElement("div", {
779
+ ref: "embedContainer"
780
+ }));
781
+ }
782
+ }]);
783
+
784
+ return TwitterMentionButton;
785
+ }(Component);
786
+
787
+ _defineProperty(TwitterMentionButton, "propTypes", {
788
+ /**
789
+ * Username to which you will need to tweet
790
+ */
791
+ screenName: PropTypes.string.isRequired,
792
+
793
+ /**
794
+ * Additional options for overriding config.
795
+ */
796
+ options: PropTypes.object,
797
+
798
+ /**
799
+ * Placeholder while tweet is loading
800
+ */
801
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
802
+
803
+ /**
804
+ * Function to execute after load, return html element
805
+ */
806
+ onLoad: PropTypes.func
807
+ });
808
+
809
+ var TwitterTweetEmbed =
810
+ /*#__PURE__*/
811
+ function (_Component) {
812
+ _inherits(TwitterTweetEmbed, _Component);
813
+
814
+ function TwitterTweetEmbed(props) {
815
+ var _this;
816
+
817
+ _classCallCheck(this, TwitterTweetEmbed);
818
+
819
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(TwitterTweetEmbed).call(this, props));
820
+ _this.state = {
821
+ isLoading: true
822
+ };
823
+ return _this;
824
+ }
825
+
826
+ _createClass(TwitterTweetEmbed, [{
827
+ key: "renderWidget",
828
+ value: function renderWidget() {
829
+ var _this2 = this;
830
+
831
+ var onLoad = this.props.onLoad;
832
+
833
+ if (!window.twttr) {
834
+ console.error('Failure to load window.twttr in TwitterTweetEmbed, aborting load.');
835
+ return;
836
+ }
837
+
838
+ if (!this.isMountCanceled) {
839
+ window.twttr.widgets.createTweet(this.props.tweetId, this.refs.embedContainer, this.props.options).then(function (element) {
840
+ _this2.setState({
841
+ isLoading: false
842
+ });
843
+
844
+ if (onLoad) {
845
+ onLoad(element);
846
+ }
847
+ });
848
+ }
849
+ }
850
+ }, {
851
+ key: "componentDidMount",
852
+ value: function componentDidMount() {
853
+ var _this3 = this;
854
+
855
+ if (exenv.canUseDOM) {
856
+ var script = require('scriptjs');
857
+
858
+ script(twitterWidgetJs, 'twitter-embed', function () {
859
+ _this3.renderWidget();
860
+ });
861
+ }
862
+ }
863
+ }, {
864
+ key: "componentWillUnmount",
865
+ value: function componentWillUnmount() {
866
+ this.isMountCanceled = true;
867
+ }
868
+ }, {
869
+ key: "render",
870
+ value: function render() {
871
+ var isLoading = this.state.isLoading;
872
+ var placeholder = this.props.placeholder;
873
+ return React__default.createElement(React__default.Fragment, null, isLoading && placeholder, React__default.createElement("div", {
874
+ ref: "embedContainer"
875
+ }));
876
+ }
877
+ }]);
878
+
879
+ return TwitterTweetEmbed;
880
+ }(Component);
881
+
882
+ _defineProperty(TwitterTweetEmbed, "propTypes", {
883
+ /**
884
+ * Tweet id that needs to be shown
885
+ */
886
+ tweetId: PropTypes.string.isRequired,
887
+
888
+ /**
889
+ * Additional options to pass to twitter widget plugin
890
+ */
891
+ options: PropTypes.object,
892
+
893
+ /**
894
+ * Placeholder while tweet is loading
895
+ */
896
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
897
+
898
+ /**
899
+ * Function to execute after load, return html element
900
+ */
901
+ onLoad: PropTypes.func
902
+ });
903
+
904
+ var TwitterMomentShare =
905
+ /*#__PURE__*/
906
+ function (_Component) {
907
+ _inherits(TwitterMomentShare, _Component);
908
+
909
+ function TwitterMomentShare(props) {
910
+ var _this;
911
+
912
+ _classCallCheck(this, TwitterMomentShare);
913
+
914
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(TwitterMomentShare).call(this, props));
915
+ _this.state = {
916
+ isLoading: true
917
+ };
918
+ return _this;
919
+ }
920
+
921
+ _createClass(TwitterMomentShare, [{
922
+ key: "componentDidMount",
923
+ value: function componentDidMount() {
924
+ var _this2 = this;
925
+
926
+ var onLoad = this.props.onLoad;
927
+
928
+ if (exenv.canUseDOM) {
929
+ var script = require('scriptjs');
930
+
931
+ script(twitterWidgetJs, 'twitter-embed', function () {
932
+ if (!window.twttr) {
933
+ console.error('Failure to load window.twttr in TwitterMomentShare, aborting load.');
934
+ return;
935
+ }
936
+
937
+ if (!_this2.isMountCanceled) {
938
+ window.twttr.widgets.createMoment(_this2.props.momentId, _this2.refs.shareMoment, _this2.props.options).then(function (element) {
939
+ _this2.setState({
940
+ isLoading: false
941
+ });
942
+
943
+ if (onLoad) {
944
+ onLoad(element);
945
+ }
946
+ });
947
+ }
948
+ });
949
+ }
950
+ }
951
+ }, {
952
+ key: "componentWillUnmount",
953
+ value: function componentWillUnmount() {
954
+ this.isMountCanceled = true;
955
+ }
956
+ }, {
957
+ key: "render",
958
+ value: function render() {
959
+ var isLoading = this.state.isLoading;
960
+ var placeholder = this.props.placeholder;
961
+ return React__default.createElement(React__default.Fragment, null, isLoading && placeholder, React__default.createElement("div", {
962
+ ref: "shareMoment"
963
+ }));
964
+ }
965
+ }]);
966
+
967
+ return TwitterMomentShare;
968
+ }(Component);
969
+
970
+ _defineProperty(TwitterMomentShare, "propTypes", {
971
+ /**
972
+ * id of Twitter moment to show
973
+ */
974
+ momentId: PropTypes.string.isRequired,
975
+
976
+ /**
977
+ * Additional options for overriding config.
978
+ */
979
+ options: PropTypes.object,
980
+
981
+ /**
982
+ * Placeholder while tweet is loading
983
+ */
984
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
985
+
986
+ /**
987
+ * Function to execute after load, return html element
988
+ */
989
+ onLoad: PropTypes.func
990
+ });
991
+
992
+ var TwitterDMButton =
993
+ /*#__PURE__*/
994
+ function (_Component) {
995
+ _inherits(TwitterDMButton, _Component);
996
+
997
+ function TwitterDMButton(props) {
998
+ var _this;
999
+
1000
+ _classCallCheck(this, TwitterDMButton);
1001
+
1002
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(TwitterDMButton).call(this, props));
1003
+ _this.state = {
1004
+ isLoading: true
1005
+ };
1006
+ return _this;
1007
+ }
1008
+
1009
+ _createClass(TwitterDMButton, [{
1010
+ key: "componentDidMount",
1011
+ value: function componentDidMount() {
1012
+ var _this2 = this;
1013
+
1014
+ var onLoad = this.props.onLoad;
1015
+
1016
+ if (exenv.canUseDOM) {
1017
+ var script = require('scriptjs');
1018
+
1019
+ script(twitterWidgetJs, 'twitter-embed', function () {
1020
+ if (!window.twttr) {
1021
+ console.error('Failure to load window.twttr in TwitterDMButton, aborting load.');
1022
+ return;
1023
+ }
1024
+
1025
+ if (!_this2.isMountCanceled) {
1026
+ window.twttr.widgets.createDMButton(_this2.props.id, _this2.refs.embedContainer, _this2.props.options).then(function (element) {
1027
+ _this2.setState({
1028
+ isLoading: false
1029
+ });
1030
+
1031
+ if (onLoad) {
1032
+ onLoad(element);
1033
+ }
1034
+ });
1035
+ }
1036
+ });
1037
+ }
1038
+ }
1039
+ }, {
1040
+ key: "componentWillUnmount",
1041
+ value: function componentWillUnmount() {
1042
+ this.isMountCanceled = true;
1043
+ }
1044
+ }, {
1045
+ key: "render",
1046
+ value: function render() {
1047
+ var isLoading = this.state.isLoading;
1048
+ var placeholder = this.props.placeholder;
1049
+ return React__default.createElement(React__default.Fragment, null, isLoading && placeholder, React__default.createElement("div", {
1050
+ ref: "embedContainer"
1051
+ }));
1052
+ }
1053
+ }]);
1054
+
1055
+ return TwitterDMButton;
1056
+ }(Component);
1057
+
1058
+ _defineProperty(TwitterDMButton, "propTypes", {
1059
+ /**
1060
+ * Twitter user id for DM button
1061
+ */
1062
+ id: PropTypes.number.isRequired,
1063
+
1064
+ /**
1065
+ * Additional options to be added to the button
1066
+ */
1067
+ options: PropTypes.object,
1068
+
1069
+ /**
1070
+ * Placeholder while tweet is loading
1071
+ */
1072
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
1073
+
1074
+ /**
1075
+ * Function to execute after load, return html element
1076
+ */
1077
+ onLoad: PropTypes.func
1078
+ });
1079
+
1080
+ var TwitterVideoEmbed =
1081
+ /*#__PURE__*/
1082
+ function (_Component) {
1083
+ _inherits(TwitterVideoEmbed, _Component);
1084
+
1085
+ function TwitterVideoEmbed(props) {
1086
+ var _this;
1087
+
1088
+ _classCallCheck(this, TwitterVideoEmbed);
1089
+
1090
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(TwitterVideoEmbed).call(this, props));
1091
+ _this.state = {
1092
+ isLoading: true
1093
+ };
1094
+ return _this;
1095
+ }
1096
+
1097
+ _createClass(TwitterVideoEmbed, [{
1098
+ key: "componentDidMount",
1099
+ value: function componentDidMount() {
1100
+ var _this2 = this;
1101
+
1102
+ var onLoad = this.props.onLoad;
1103
+
1104
+ if (exenv.canUseDOM) {
1105
+ var script = require('scriptjs');
1106
+
1107
+ script(twitterWidgetJs, 'twitter-embed', function () {
1108
+ if (!window.twttr) {
1109
+ console.error('Failure to load window.twttr in TwitterVideoEmbed, aborting load.');
1110
+ return;
1111
+ }
1112
+
1113
+ if (!_this2.isMountCanceled) {
1114
+ window.twttr.widgets.createVideo(_this2.props.id, _this2.refs.embedContainer).then(function (element) {
1115
+ _this2.setState({
1116
+ isLoading: false
1117
+ });
1118
+
1119
+ if (onLoad) {
1120
+ onLoad(element);
1121
+ }
1122
+ });
1123
+ }
1124
+ });
1125
+ }
1126
+ }
1127
+ }, {
1128
+ key: "componentWillUnmount",
1129
+ value: function componentWillUnmount() {
1130
+ this.isMountCanceled = true;
1131
+ }
1132
+ }, {
1133
+ key: "render",
1134
+ value: function render() {
1135
+ var isLoading = this.state.isLoading;
1136
+ var placeholder = this.props.placeholder;
1137
+ return React__default.createElement(React__default.Fragment, null, isLoading && placeholder, React__default.createElement("div", {
1138
+ ref: "embedContainer"
1139
+ }));
1140
+ }
1141
+ }]);
1142
+
1143
+ return TwitterVideoEmbed;
1144
+ }(Component);
1145
+
1146
+ _defineProperty(TwitterVideoEmbed, "propTypes", {
1147
+ /**
1148
+ * Id of video tweet.
1149
+ */
1150
+ id: PropTypes.string.isRequired,
1151
+
1152
+ /**
1153
+ * Placeholder while tweet is loading
1154
+ */
1155
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
1156
+
1157
+ /**
1158
+ * Function to execute after load, return html element
1159
+ */
1160
+ onLoad: PropTypes.func
1161
+ });
1162
+
1163
+ var TwitterOnAirButton =
1164
+ /*#__PURE__*/
1165
+ function (_Component) {
1166
+ _inherits(TwitterOnAirButton, _Component);
1167
+
1168
+ function TwitterOnAirButton(props) {
1169
+ var _this;
1170
+
1171
+ _classCallCheck(this, TwitterOnAirButton);
1172
+
1173
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(TwitterOnAirButton).call(this, props));
1174
+ _this.state = {
1175
+ isLoading: true
1176
+ };
1177
+ return _this;
1178
+ }
1179
+
1180
+ _createClass(TwitterOnAirButton, [{
1181
+ key: "componentDidMount",
1182
+ value: function componentDidMount() {
1183
+ var _this2 = this;
1184
+
1185
+ var onLoad = this.props.onLoad;
1186
+
1187
+ if (exenv.canUseDOM) {
1188
+ var script = require('scriptjs');
1189
+
1190
+ script(twitterWidgetJs, 'twitter-embed', function () {
1191
+ if (!window.twttr) {
1192
+ console.error('Failure to load window.twttr in TwitterOnAirButton, aborting load.');
1193
+ return;
1194
+ }
1195
+
1196
+ if (!_this2.isMountCanceled) {
1197
+ window.twttr.widgets.createPeriscopeOnAirButton(_this2.props.username, _this2.refs.embedContainer, _this2.props.options).then(function (element) {
1198
+ _this2.setState({
1199
+ isLoading: false
1200
+ });
1201
+
1202
+ if (onLoad) {
1203
+ onLoad(element);
1204
+ }
1205
+ });
1206
+ }
1207
+ });
1208
+ }
1209
+ }
1210
+ }, {
1211
+ key: "componentWillUnmount",
1212
+ value: function componentWillUnmount() {
1213
+ this.isMountCanceled = true;
1214
+ }
1215
+ }, {
1216
+ key: "render",
1217
+ value: function render() {
1218
+ var isLoading = this.state.isLoading;
1219
+ var placeholder = this.props.placeholder;
1220
+ return React__default.createElement(React__default.Fragment, null, isLoading && placeholder, React__default.createElement("div", {
1221
+ ref: "embedContainer"
1222
+ }));
1223
+ }
1224
+ }]);
1225
+
1226
+ return TwitterOnAirButton;
1227
+ }(Component);
1228
+
1229
+ _defineProperty(TwitterOnAirButton, "propTypes", {
1230
+ /**
1231
+ * Username for which you require periscope on air button
1232
+ */
1233
+ username: PropTypes.string.isRequired,
1234
+
1235
+ /**
1236
+ * Additional options for overriding config.
1237
+ */
1238
+ options: PropTypes.object,
1239
+
1240
+ /**
1241
+ * Placeholder while tweet is loading
1242
+ */
1243
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
1244
+
1245
+ /**
1246
+ * Function to execute after load, return html element
1247
+ */
1248
+ onLoad: PropTypes.func
1249
+ });
54
1250
 
55
1251
  var ImageSlider = function ImageSlider(props) {
56
1252
  var builder = imageUrlBuilder(props.client);