@quintype/components 2.31.4-lazy-iframe.1 → 2.31.4-lazy-iframe.5
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.
- package/dist/cjs/index.js +322 -234
- package/dist/es/components/story-element.js +12 -8
- package/dist/es/components/story-elements/dailymotion.js +162 -0
- package/dist/es/components/story-elements/jsembed.js +51 -75
- package/dist/es/components/story-elements/youtube.js +20 -11
- package/package.json +3 -1
package/dist/cjs/index.js
CHANGED
|
@@ -45,7 +45,8 @@ var quintypeJs = require('quintype-js');
|
|
|
45
45
|
var _extends = _interopDefault(require('@babel/runtime/helpers/extends'));
|
|
46
46
|
var _assertThisInitialized = _interopDefault(require('@babel/runtime/helpers/assertThisInitialized'));
|
|
47
47
|
var classNames = _interopDefault(require('classnames'));
|
|
48
|
-
var
|
|
48
|
+
var getVideoID = _interopDefault(require('get-video-id'));
|
|
49
|
+
require('atob');
|
|
49
50
|
var getYouTubeID = _interopDefault(require('get-youtube-id'));
|
|
50
51
|
var _asyncToGenerator = _interopDefault(require('@babel/runtime/helpers/asyncToGenerator'));
|
|
51
52
|
var _regeneratorRuntime = _interopDefault(require('@babel/runtime/regenerator'));
|
|
@@ -2249,107 +2250,105 @@ var SearchPageBase = /*#__PURE__*/function (_React$Component) {
|
|
|
2249
2250
|
function _createSuper$d(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$d(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
2250
2251
|
|
|
2251
2252
|
function _isNativeReflectConstruct$d() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
2253
|
+
/**
|
|
2254
|
+
* This component can be used to load some DOM just before it scrolls into the screen. Currently, it does not support unloading. The `margin` prop is passed to `IntersectionObserver`.
|
|
2255
|
+
*
|
|
2256
|
+
* Example
|
|
2257
|
+
* ```javascript
|
|
2258
|
+
* import { WithLazy } from '@quintype/components';
|
|
2259
|
+
*
|
|
2260
|
+
* <WithLazy margin="50px">{() =>
|
|
2261
|
+
* <SomeHeavyComponent />
|
|
2262
|
+
* }</WithLazy>
|
|
2263
|
+
* ```
|
|
2264
|
+
* @component
|
|
2265
|
+
* @hideconstructor
|
|
2266
|
+
* @category Other
|
|
2267
|
+
*/
|
|
2252
2268
|
|
|
2253
|
-
function
|
|
2254
|
-
|
|
2255
|
-
script.text = node.innerHTML;
|
|
2256
|
-
|
|
2257
|
-
for (var i = node.attributes.length - 1; i >= 0; i--) {
|
|
2258
|
-
setTimeout(function () {
|
|
2259
|
-
script.setAttribute(node.attributes[i].name, node.attributes[i].value);
|
|
2260
|
-
}, 3000);
|
|
2261
|
-
}
|
|
2262
|
-
|
|
2263
|
-
return script;
|
|
2264
|
-
}
|
|
2265
|
-
|
|
2266
|
-
function replaceScriptNodes(node) {
|
|
2267
|
-
if (node.tagName === "SCRIPT") {
|
|
2268
|
-
node.parentNode.replaceChild(cloneScriptNode(node), node);
|
|
2269
|
-
if (window.instgrm) window.instgrm.Embeds.process(); // Temporary fix for instagram element on live blog page.
|
|
2270
|
-
} else {
|
|
2271
|
-
var i = 0;
|
|
2272
|
-
var children = node.childNodes;
|
|
2273
|
-
|
|
2274
|
-
while (i < children.length) {
|
|
2275
|
-
replaceScriptNodes(children[i++]);
|
|
2276
|
-
}
|
|
2277
|
-
}
|
|
2278
|
-
}
|
|
2279
|
-
|
|
2280
|
-
var JSEmbed = /*#__PURE__*/function (_React$Component) {
|
|
2281
|
-
_inherits(JSEmbed, _React$Component);
|
|
2269
|
+
var WithLazy = /*#__PURE__*/function (_React$Component) {
|
|
2270
|
+
_inherits(WithLazy, _React$Component);
|
|
2282
2271
|
|
|
2283
|
-
var _super = /*#__PURE__*/_createSuper$d(
|
|
2272
|
+
var _super = /*#__PURE__*/_createSuper$d(WithLazy);
|
|
2284
2273
|
|
|
2285
|
-
function
|
|
2274
|
+
function WithLazy(props) {
|
|
2286
2275
|
var _this;
|
|
2287
2276
|
|
|
2288
|
-
_classCallCheck(this,
|
|
2277
|
+
_classCallCheck(this, WithLazy);
|
|
2289
2278
|
|
|
2290
2279
|
_this = _super.call(this, props);
|
|
2291
|
-
_this.
|
|
2280
|
+
_this.state = {
|
|
2281
|
+
loaded: false
|
|
2282
|
+
};
|
|
2283
|
+
_this.observerRef = /*#__PURE__*/React__default.createRef();
|
|
2292
2284
|
return _this;
|
|
2293
2285
|
}
|
|
2294
2286
|
|
|
2295
|
-
_createClass(
|
|
2296
|
-
key: "
|
|
2297
|
-
value: function
|
|
2298
|
-
|
|
2287
|
+
_createClass(WithLazy, [{
|
|
2288
|
+
key: "render",
|
|
2289
|
+
value: function render() {
|
|
2290
|
+
if (this.state.loaded) {
|
|
2291
|
+
return this.props.children();
|
|
2292
|
+
} else {
|
|
2293
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
2294
|
+
style: {
|
|
2295
|
+
height: this.props.height || 50
|
|
2296
|
+
},
|
|
2297
|
+
ref: this.observerRef
|
|
2298
|
+
});
|
|
2299
|
+
}
|
|
2299
2300
|
}
|
|
2300
2301
|
}, {
|
|
2301
2302
|
key: "componentDidMount",
|
|
2302
2303
|
value: function componentDidMount() {
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2304
|
+
var _this2 = this;
|
|
2305
|
+
|
|
2306
|
+
this.observer = new global.IntersectionObserver(function (entries, observer) {
|
|
2307
|
+
return _this2.observerCallback(entries, observer);
|
|
2308
|
+
}, {
|
|
2309
|
+
rootMargin: this.props.margin || "160px"
|
|
2310
|
+
});
|
|
2311
|
+
this.observer.observe(this.observerRef.current);
|
|
2309
2312
|
}
|
|
2310
2313
|
}, {
|
|
2311
|
-
key: "
|
|
2312
|
-
value: function
|
|
2313
|
-
|
|
2314
|
-
return embedjs != null ? atob(embedjs) : null;
|
|
2314
|
+
key: "componentWillUnmount",
|
|
2315
|
+
value: function componentWillUnmount() {
|
|
2316
|
+
this.observer.disconnect();
|
|
2315
2317
|
}
|
|
2316
2318
|
}, {
|
|
2317
|
-
key: "
|
|
2318
|
-
value: function
|
|
2319
|
-
var
|
|
2319
|
+
key: "observerCallback",
|
|
2320
|
+
value: function observerCallback(entries, observer) {
|
|
2321
|
+
var _this3 = this;
|
|
2320
2322
|
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2323
|
+
entries.forEach(function (entry) {
|
|
2324
|
+
if (entry.isIntersecting || entry.isIntersecting === undefined) {
|
|
2325
|
+
_this3.setState({
|
|
2326
|
+
loaded: true
|
|
2327
|
+
});
|
|
2328
|
+
|
|
2329
|
+
observer.disconnect();
|
|
2327
2330
|
}
|
|
2328
2331
|
});
|
|
2329
2332
|
}
|
|
2330
2333
|
}]);
|
|
2331
2334
|
|
|
2332
|
-
return
|
|
2335
|
+
return WithLazy;
|
|
2333
2336
|
}(React__default.Component);
|
|
2334
2337
|
|
|
2335
|
-
function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2336
|
-
|
|
2337
|
-
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2338
|
-
|
|
2339
2338
|
function _createSuper$e(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$e(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
2340
2339
|
|
|
2341
2340
|
function _isNativeReflectConstruct$e() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
2342
|
-
var
|
|
2341
|
+
var DailyMotion = null;
|
|
2343
2342
|
var loaderPromise = null;
|
|
2344
2343
|
|
|
2345
2344
|
function loadLibrary() {
|
|
2346
2345
|
if (loaderPromise === null) {
|
|
2347
2346
|
loaderPromise = new Promise(function (resolve) { resolve(_interopNamespace(require(
|
|
2348
|
-
/* webpackChunkName: "qtc-react-
|
|
2349
|
-
'react-
|
|
2350
|
-
|
|
2347
|
+
/* webpackChunkName: "qtc-react-dailymotion" */
|
|
2348
|
+
'react-dailymotion'))); }).then(function (DM) {
|
|
2349
|
+
DailyMotion = DM["default"];
|
|
2351
2350
|
})["catch"](function (err) {
|
|
2352
|
-
console.log("Failed to load react-
|
|
2351
|
+
console.log("Failed to load react-dailymotion", err);
|
|
2353
2352
|
return Promise.reject();
|
|
2354
2353
|
});
|
|
2355
2354
|
}
|
|
@@ -2358,61 +2357,30 @@ function loadLibrary() {
|
|
|
2358
2357
|
}
|
|
2359
2358
|
|
|
2360
2359
|
function isLibraryLoaded() {
|
|
2361
|
-
return
|
|
2360
|
+
return DailyMotion !== null;
|
|
2362
2361
|
}
|
|
2363
2362
|
|
|
2364
|
-
var
|
|
2365
|
-
_inherits(
|
|
2363
|
+
var CustomStoryElementDailyMotion = /*#__PURE__*/function (_React$Component) {
|
|
2364
|
+
_inherits(CustomStoryElementDailyMotion, _React$Component);
|
|
2366
2365
|
|
|
2367
|
-
var _super = /*#__PURE__*/_createSuper$e(
|
|
2366
|
+
var _super = /*#__PURE__*/_createSuper$e(CustomStoryElementDailyMotion);
|
|
2368
2367
|
|
|
2369
|
-
function
|
|
2368
|
+
function CustomStoryElementDailyMotion(props) {
|
|
2370
2369
|
var _this;
|
|
2371
2370
|
|
|
2372
|
-
_classCallCheck(this,
|
|
2371
|
+
_classCallCheck(this, CustomStoryElementDailyMotion);
|
|
2373
2372
|
|
|
2374
2373
|
_this = _super.call(this, props);
|
|
2375
2374
|
|
|
2376
|
-
_defineProperty(_assertThisInitialized(_this), "triggerQlitics", function (action) {
|
|
2377
|
-
if (_this.props.disableAnalytics === true) return false;
|
|
2378
|
-
var _this$props = _this.props,
|
|
2379
|
-
_this$props$story = _this$props.story,
|
|
2380
|
-
story = _this$props$story === void 0 ? {} : _this$props$story,
|
|
2381
|
-
_this$props$card = _this$props.card,
|
|
2382
|
-
card = _this$props$card === void 0 ? {} : _this$props$card,
|
|
2383
|
-
_this$props$element = _this$props.element,
|
|
2384
|
-
element = _this$props$element === void 0 ? {} : _this$props$element;
|
|
2385
|
-
|
|
2386
|
-
var qliticsData = _objectSpread$4(_objectSpread$4({}, getQliticsSchema(story, card, element)), {
|
|
2387
|
-
"story-element-action": action
|
|
2388
|
-
});
|
|
2389
|
-
|
|
2390
|
-
if (global.qlitics) {
|
|
2391
|
-
global.qlitics("track", "story-element-action", qliticsData);
|
|
2392
|
-
} else {
|
|
2393
|
-
global.qlitics = global.qlitics || function () {
|
|
2394
|
-
(qlitics.q = qlitics.q || []).push(arguments);
|
|
2395
|
-
};
|
|
2396
|
-
|
|
2397
|
-
qlitics.qlitics.q.push("track", "story-element-action", qliticsData);
|
|
2398
|
-
}
|
|
2399
|
-
});
|
|
2400
|
-
|
|
2401
2375
|
_defineProperty(_assertThisInitialized(_this), "onPlayCallback", function (event) {
|
|
2402
|
-
_this.triggerQlitics("play");
|
|
2403
|
-
|
|
2404
2376
|
_this.props.onPlay === "function" && _this.props.onPlay(event);
|
|
2405
2377
|
});
|
|
2406
2378
|
|
|
2407
2379
|
_defineProperty(_assertThisInitialized(_this), "onPauseCallback", function (event) {
|
|
2408
|
-
_this.triggerQlitics("pause");
|
|
2409
|
-
|
|
2410
2380
|
_this.props.onPause === "function" && _this.props.onPause(event);
|
|
2411
2381
|
});
|
|
2412
2382
|
|
|
2413
2383
|
_defineProperty(_assertThisInitialized(_this), "onEndCallback", function (event) {
|
|
2414
|
-
_this.triggerQlitics("end");
|
|
2415
|
-
|
|
2416
2384
|
_this.props.onEnd === "function" && _this.props.onEnd(event);
|
|
2417
2385
|
});
|
|
2418
2386
|
|
|
@@ -2447,7 +2415,7 @@ var StoryElementYoutube = /*#__PURE__*/function (_React$Component) {
|
|
|
2447
2415
|
return _this;
|
|
2448
2416
|
}
|
|
2449
2417
|
|
|
2450
|
-
_createClass(
|
|
2418
|
+
_createClass(CustomStoryElementDailyMotion, [{
|
|
2451
2419
|
key: "componentDidMount",
|
|
2452
2420
|
value: function componentDidMount() {
|
|
2453
2421
|
if (!this.props.loadIframeOnClick) {
|
|
@@ -2464,35 +2432,37 @@ var StoryElementYoutube = /*#__PURE__*/function (_React$Component) {
|
|
|
2464
2432
|
value: function render() {
|
|
2465
2433
|
var _this2 = this;
|
|
2466
2434
|
|
|
2467
|
-
var
|
|
2468
|
-
|
|
2469
|
-
|
|
2435
|
+
var _getVideoID = getVideoID(this.props.element.metadata["dailymotion-url"]),
|
|
2436
|
+
videoId = _getVideoID.id;
|
|
2437
|
+
|
|
2438
|
+
var dailymotionIframe = function dailymotionIframe() {
|
|
2439
|
+
return /*#__PURE__*/React__default.createElement(DailyMotion, {
|
|
2440
|
+
video: videoId,
|
|
2470
2441
|
opts: _this2.opts,
|
|
2471
2442
|
onPlay: _this2.onPlayCallback,
|
|
2472
2443
|
onPause: _this2.onPauseCallback,
|
|
2473
|
-
onEnd: _this2.onEndCallback
|
|
2474
|
-
onReady: _this2.onPlayerReady
|
|
2444
|
+
onEnd: _this2.onEndCallback
|
|
2475
2445
|
});
|
|
2476
2446
|
};
|
|
2477
2447
|
|
|
2478
2448
|
if (this.props.loadIframeOnClick) {
|
|
2479
2449
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
2480
2450
|
className: "thumbnail-wrapper"
|
|
2481
|
-
}, /*#__PURE__*/React__default.createElement("button", {
|
|
2482
|
-
className: "
|
|
2451
|
+
}, !this.state.showVideo && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("button", {
|
|
2452
|
+
className: "dailymotion-playBtn",
|
|
2483
2453
|
onClick: this.renderVideo,
|
|
2484
2454
|
"aria-label": "Play Video"
|
|
2485
|
-
}),
|
|
2486
|
-
className: "
|
|
2455
|
+
}), /*#__PURE__*/React__default.createElement("img", {
|
|
2456
|
+
className: "dailymotion-thumbnail",
|
|
2487
2457
|
onClick: this.renderVideo,
|
|
2488
|
-
src: "https://
|
|
2489
|
-
alt: "video"
|
|
2490
|
-
}), this.state.showVideo && isLibraryLoaded() && /*#__PURE__*/React__default.createElement("div", {
|
|
2491
|
-
className: "
|
|
2492
|
-
},
|
|
2458
|
+
src: "https://www.dailymotion.com/thumbnail/video/".concat(videoId),
|
|
2459
|
+
alt: "daily-motion-video"
|
|
2460
|
+
})), this.state.showVideo && isLibraryLoaded() && /*#__PURE__*/React__default.createElement("div", {
|
|
2461
|
+
className: "dailymotion-iframe-wrapper"
|
|
2462
|
+
}, dailymotionIframe()));
|
|
2493
2463
|
} else if (!this.props.loadIframeOnClick && isLibraryLoaded()) {
|
|
2494
|
-
return /*#__PURE__*/React__default.createElement(
|
|
2495
|
-
|
|
2464
|
+
return /*#__PURE__*/React__default.createElement(DailyMotion, {
|
|
2465
|
+
video: videoId,
|
|
2496
2466
|
opts: this.opts,
|
|
2497
2467
|
onPlay: this.onPlayCallback,
|
|
2498
2468
|
onPause: this.onPauseCallback,
|
|
@@ -2502,9 +2472,31 @@ var StoryElementYoutube = /*#__PURE__*/function (_React$Component) {
|
|
|
2502
2472
|
}
|
|
2503
2473
|
}]);
|
|
2504
2474
|
|
|
2505
|
-
return
|
|
2475
|
+
return CustomStoryElementDailyMotion;
|
|
2506
2476
|
}(React__default.Component);
|
|
2507
2477
|
|
|
2478
|
+
var StoryElementDailyMotion = function StoryElementDailyMotion(props) {
|
|
2479
|
+
return /*#__PURE__*/React__default.createElement(WithLazy, {
|
|
2480
|
+
margin: "0px"
|
|
2481
|
+
}, function () {
|
|
2482
|
+
return /*#__PURE__*/React__default.createElement(CustomStoryElementDailyMotion, props);
|
|
2483
|
+
});
|
|
2484
|
+
};
|
|
2485
|
+
|
|
2486
|
+
var JSEmbed = function JSEmbed(props) {
|
|
2487
|
+
console.log("###props", props);
|
|
2488
|
+
return (
|
|
2489
|
+
/*#__PURE__*/
|
|
2490
|
+
// <WithLazy margin="0px">
|
|
2491
|
+
// {() => {
|
|
2492
|
+
// console.log("###lazy loading");
|
|
2493
|
+
// return <CustomJSEmbed {...props} />;
|
|
2494
|
+
// }}
|
|
2495
|
+
// </WithLazy>
|
|
2496
|
+
React__default.createElement("div", null, "Lazy")
|
|
2497
|
+
);
|
|
2498
|
+
};
|
|
2499
|
+
|
|
2508
2500
|
function _createSuper$f(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$f(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
2509
2501
|
|
|
2510
2502
|
function _isNativeReflectConstruct$f() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -2669,13 +2661,194 @@ var Table = /*#__PURE__*/function (_React$Component) {
|
|
|
2669
2661
|
return Table;
|
|
2670
2662
|
}(React__default.Component);
|
|
2671
2663
|
|
|
2672
|
-
function ownKeys$
|
|
2664
|
+
function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2673
2665
|
|
|
2674
|
-
function _objectSpread$
|
|
2666
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2675
2667
|
|
|
2676
2668
|
function _createSuper$h(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$h(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
2677
2669
|
|
|
2678
2670
|
function _isNativeReflectConstruct$h() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
2671
|
+
var YouTube = null;
|
|
2672
|
+
var loaderPromise$1 = null;
|
|
2673
|
+
|
|
2674
|
+
function loadLibrary$1() {
|
|
2675
|
+
if (loaderPromise$1 === null) {
|
|
2676
|
+
loaderPromise$1 = new Promise(function (resolve) { resolve(_interopNamespace(require(
|
|
2677
|
+
/* webpackChunkName: "qtc-react-youtube" */
|
|
2678
|
+
'react-youtube'))); }).then(function (YT) {
|
|
2679
|
+
YouTube = YT["default"];
|
|
2680
|
+
})["catch"](function (err) {
|
|
2681
|
+
console.log("Failed to load react-youtube", err);
|
|
2682
|
+
return Promise.reject();
|
|
2683
|
+
});
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2686
|
+
return loaderPromise$1;
|
|
2687
|
+
}
|
|
2688
|
+
|
|
2689
|
+
function isLibraryLoaded$1() {
|
|
2690
|
+
return YouTube !== null;
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2693
|
+
var CustomStoryElementYoutube = /*#__PURE__*/function (_React$Component) {
|
|
2694
|
+
_inherits(CustomStoryElementYoutube, _React$Component);
|
|
2695
|
+
|
|
2696
|
+
var _super = /*#__PURE__*/_createSuper$h(CustomStoryElementYoutube);
|
|
2697
|
+
|
|
2698
|
+
function CustomStoryElementYoutube(props) {
|
|
2699
|
+
var _this;
|
|
2700
|
+
|
|
2701
|
+
_classCallCheck(this, CustomStoryElementYoutube);
|
|
2702
|
+
|
|
2703
|
+
_this = _super.call(this, props);
|
|
2704
|
+
|
|
2705
|
+
_defineProperty(_assertThisInitialized(_this), "triggerQlitics", function (action) {
|
|
2706
|
+
if (_this.props.disableAnalytics === true) return false;
|
|
2707
|
+
var _this$props = _this.props,
|
|
2708
|
+
_this$props$story = _this$props.story,
|
|
2709
|
+
story = _this$props$story === void 0 ? {} : _this$props$story,
|
|
2710
|
+
_this$props$card = _this$props.card,
|
|
2711
|
+
card = _this$props$card === void 0 ? {} : _this$props$card,
|
|
2712
|
+
_this$props$element = _this$props.element,
|
|
2713
|
+
element = _this$props$element === void 0 ? {} : _this$props$element;
|
|
2714
|
+
|
|
2715
|
+
var qliticsData = _objectSpread$4(_objectSpread$4({}, getQliticsSchema(story, card, element)), {
|
|
2716
|
+
"story-element-action": action
|
|
2717
|
+
});
|
|
2718
|
+
|
|
2719
|
+
if (global.qlitics) {
|
|
2720
|
+
global.qlitics("track", "story-element-action", qliticsData);
|
|
2721
|
+
} else {
|
|
2722
|
+
global.qlitics = global.qlitics || function () {
|
|
2723
|
+
(qlitics.q = qlitics.q || []).push(arguments);
|
|
2724
|
+
};
|
|
2725
|
+
|
|
2726
|
+
qlitics.qlitics.q.push("track", "story-element-action", qliticsData);
|
|
2727
|
+
}
|
|
2728
|
+
});
|
|
2729
|
+
|
|
2730
|
+
_defineProperty(_assertThisInitialized(_this), "onPlayCallback", function (event) {
|
|
2731
|
+
_this.triggerQlitics("play");
|
|
2732
|
+
|
|
2733
|
+
_this.props.onPlay === "function" && _this.props.onPlay(event);
|
|
2734
|
+
});
|
|
2735
|
+
|
|
2736
|
+
_defineProperty(_assertThisInitialized(_this), "onPauseCallback", function (event) {
|
|
2737
|
+
_this.triggerQlitics("pause");
|
|
2738
|
+
|
|
2739
|
+
_this.props.onPause === "function" && _this.props.onPause(event);
|
|
2740
|
+
});
|
|
2741
|
+
|
|
2742
|
+
_defineProperty(_assertThisInitialized(_this), "onEndCallback", function (event) {
|
|
2743
|
+
_this.triggerQlitics("end");
|
|
2744
|
+
|
|
2745
|
+
_this.props.onEnd === "function" && _this.props.onEnd(event);
|
|
2746
|
+
});
|
|
2747
|
+
|
|
2748
|
+
_defineProperty(_assertThisInitialized(_this), "triggerIframe", function () {
|
|
2749
|
+
_this._isMounted = true;
|
|
2750
|
+
loadLibrary$1().then(function () {
|
|
2751
|
+
return _this._isMounted && _this.forceUpdate();
|
|
2752
|
+
});
|
|
2753
|
+
});
|
|
2754
|
+
|
|
2755
|
+
_defineProperty(_assertThisInitialized(_this), "onPlayerReady", function (event) {
|
|
2756
|
+
event.target.setVolume(100);
|
|
2757
|
+
event.target.playVideo();
|
|
2758
|
+
});
|
|
2759
|
+
|
|
2760
|
+
_defineProperty(_assertThisInitialized(_this), "renderVideo", function () {
|
|
2761
|
+
_this.triggerIframe();
|
|
2762
|
+
|
|
2763
|
+
_this.setState({
|
|
2764
|
+
showVideo: true
|
|
2765
|
+
});
|
|
2766
|
+
});
|
|
2767
|
+
|
|
2768
|
+
_this.state = {
|
|
2769
|
+
showVideo: false
|
|
2770
|
+
};
|
|
2771
|
+
_this.opts = {
|
|
2772
|
+
playerVars: {
|
|
2773
|
+
autoplay: 0
|
|
2774
|
+
}
|
|
2775
|
+
};
|
|
2776
|
+
return _this;
|
|
2777
|
+
}
|
|
2778
|
+
|
|
2779
|
+
_createClass(CustomStoryElementYoutube, [{
|
|
2780
|
+
key: "componentDidMount",
|
|
2781
|
+
value: function componentDidMount() {
|
|
2782
|
+
if (!this.props.loadIframeOnClick) {
|
|
2783
|
+
this.triggerIframe();
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2786
|
+
}, {
|
|
2787
|
+
key: "componentWillUnmount",
|
|
2788
|
+
value: function componentWillUnmount() {
|
|
2789
|
+
this._isMounted = false;
|
|
2790
|
+
}
|
|
2791
|
+
}, {
|
|
2792
|
+
key: "render",
|
|
2793
|
+
value: function render() {
|
|
2794
|
+
var _this2 = this;
|
|
2795
|
+
|
|
2796
|
+
var youtubeIframe = function youtubeIframe() {
|
|
2797
|
+
return /*#__PURE__*/React__default.createElement(YouTube, {
|
|
2798
|
+
videoId: getYouTubeID(_this2.props.element.url),
|
|
2799
|
+
opts: _this2.opts,
|
|
2800
|
+
onPlay: _this2.onPlayCallback,
|
|
2801
|
+
onPause: _this2.onPauseCallback,
|
|
2802
|
+
onEnd: _this2.onEndCallback,
|
|
2803
|
+
onReady: _this2.onPlayerReady
|
|
2804
|
+
});
|
|
2805
|
+
};
|
|
2806
|
+
|
|
2807
|
+
if (this.props.loadIframeOnClick) {
|
|
2808
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
2809
|
+
className: "thumbnail-wrapper"
|
|
2810
|
+
}, !this.state.showVideo && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("button", {
|
|
2811
|
+
className: "youtube-playBtn",
|
|
2812
|
+
onClick: this.renderVideo,
|
|
2813
|
+
"aria-label": "Play Video"
|
|
2814
|
+
}), /*#__PURE__*/React__default.createElement("img", {
|
|
2815
|
+
className: "youtube-thumbnail",
|
|
2816
|
+
onClick: this.renderVideo,
|
|
2817
|
+
src: "https://img.youtube.com/vi/".concat(getYouTubeID(this.props.element.url), "/sddefault.jpg"),
|
|
2818
|
+
alt: "video"
|
|
2819
|
+
})), this.state.showVideo && isLibraryLoaded$1() && /*#__PURE__*/React__default.createElement("div", {
|
|
2820
|
+
className: "youtube-iframe-wrapper"
|
|
2821
|
+
}, youtubeIframe()));
|
|
2822
|
+
} else if (!this.props.loadIframeOnClick && isLibraryLoaded$1()) {
|
|
2823
|
+
return /*#__PURE__*/React__default.createElement(YouTube, {
|
|
2824
|
+
videoId: getYouTubeID(this.props.element.url),
|
|
2825
|
+
opts: this.opts,
|
|
2826
|
+
onPlay: this.onPlayCallback,
|
|
2827
|
+
onPause: this.onPauseCallback,
|
|
2828
|
+
onEnd: this.onEndCallback
|
|
2829
|
+
});
|
|
2830
|
+
} else return /*#__PURE__*/React__default.createElement("div", null);
|
|
2831
|
+
}
|
|
2832
|
+
}]);
|
|
2833
|
+
|
|
2834
|
+
return CustomStoryElementYoutube;
|
|
2835
|
+
}(React__default.Component);
|
|
2836
|
+
|
|
2837
|
+
var StoryElementYoutube = function StoryElementYoutube(props) {
|
|
2838
|
+
return /*#__PURE__*/React__default.createElement(WithLazy, {
|
|
2839
|
+
margin: "0px"
|
|
2840
|
+
}, function () {
|
|
2841
|
+
return /*#__PURE__*/React__default.createElement(CustomStoryElementYoutube, props);
|
|
2842
|
+
});
|
|
2843
|
+
};
|
|
2844
|
+
|
|
2845
|
+
function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2846
|
+
|
|
2847
|
+
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2848
|
+
|
|
2849
|
+
function _createSuper$i(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$i(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
2850
|
+
|
|
2851
|
+
function _isNativeReflectConstruct$i() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
2679
2852
|
/**
|
|
2680
2853
|
* This component renders different types of [story elements](https://developers.quintype.com/malibu/terminology#story-elements)
|
|
2681
2854
|
|
|
@@ -2705,7 +2878,7 @@ function _isNativeReflectConstruct$h() { if (typeof Reflect === "undefined" || !
|
|
|
2705
2878
|
var StoryElement = /*#__PURE__*/function (_React$Component) {
|
|
2706
2879
|
_inherits(StoryElement, _React$Component);
|
|
2707
2880
|
|
|
2708
|
-
var _super = /*#__PURE__*/_createSuper$
|
|
2881
|
+
var _super = /*#__PURE__*/_createSuper$i(StoryElement);
|
|
2709
2882
|
|
|
2710
2883
|
function StoryElement(props) {
|
|
2711
2884
|
var _this;
|
|
@@ -2827,10 +3000,12 @@ function StoryElementSoundCloud(_ref5) {
|
|
|
2827
3000
|
}
|
|
2828
3001
|
|
|
2829
3002
|
function StoryElementJsembed(_ref6) {
|
|
2830
|
-
var element = _ref6.element
|
|
3003
|
+
var element = _ref6.element,
|
|
3004
|
+
loadEmbed = _ref6.loadEmbed;
|
|
2831
3005
|
return /*#__PURE__*/React__default.createElement(JSEmbed, {
|
|
2832
3006
|
embedJS: element["embed-js"],
|
|
2833
|
-
id: element["id"]
|
|
3007
|
+
id: element["id"],
|
|
3008
|
+
loadEmbed: loadEmbed
|
|
2834
3009
|
});
|
|
2835
3010
|
}
|
|
2836
3011
|
|
|
@@ -2868,6 +3043,7 @@ var DEFAULT_TEMPLATES = {
|
|
|
2868
3043
|
image: StoryElementImage,
|
|
2869
3044
|
title: StoryElementTitle,
|
|
2870
3045
|
"youtube-video": StoryElementYoutube,
|
|
3046
|
+
"dailymotion-video": StoryElementDailyMotion,
|
|
2871
3047
|
"soundcloud-audio": StoryElementSoundCloud,
|
|
2872
3048
|
jsembed: StoryElementJsembed,
|
|
2873
3049
|
polltype: StoryElementPolltype,
|
|
@@ -2879,7 +3055,7 @@ var DEFAULT_TEMPLATES = {
|
|
|
2879
3055
|
var StoryElementBase = /*#__PURE__*/function (_React$Component2) {
|
|
2880
3056
|
_inherits(StoryElementBase, _React$Component2);
|
|
2881
3057
|
|
|
2882
|
-
var _super2 = /*#__PURE__*/_createSuper$
|
|
3058
|
+
var _super2 = /*#__PURE__*/_createSuper$i(StoryElementBase);
|
|
2883
3059
|
|
|
2884
3060
|
function StoryElementBase(props) {
|
|
2885
3061
|
var _this2;
|
|
@@ -2993,9 +3169,9 @@ var StoryElementBase = /*#__PURE__*/function (_React$Component2) {
|
|
|
2993
3169
|
|
|
2994
3170
|
var STORY_ELEMENT_TEMPLATES = DEFAULT_TEMPLATES;
|
|
2995
3171
|
|
|
2996
|
-
function _createSuper$
|
|
3172
|
+
function _createSuper$j(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$j(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
2997
3173
|
|
|
2998
|
-
function _isNativeReflectConstruct$
|
|
3174
|
+
function _isNativeReflectConstruct$j() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
2999
3175
|
|
|
3000
3176
|
function getNativeShareHandler(canNativeShare, title, fullUrl) {
|
|
3001
3177
|
if (!canNativeShare) {
|
|
@@ -3013,7 +3189,7 @@ function getNativeShareHandler(canNativeShare, title, fullUrl) {
|
|
|
3013
3189
|
var SocialShareBase = /*#__PURE__*/function (_React$Component) {
|
|
3014
3190
|
_inherits(SocialShareBase, _React$Component);
|
|
3015
3191
|
|
|
3016
|
-
var _super = /*#__PURE__*/_createSuper$
|
|
3192
|
+
var _super = /*#__PURE__*/_createSuper$j(SocialShareBase);
|
|
3017
3193
|
|
|
3018
3194
|
function SocialShareBase(props) {
|
|
3019
3195
|
var _this;
|
|
@@ -3479,15 +3655,15 @@ LoadMoreButton.defaultProps = {
|
|
|
3479
3655
|
text: 'Load more'
|
|
3480
3656
|
};
|
|
3481
3657
|
|
|
3482
|
-
function _createSuper$
|
|
3658
|
+
function _createSuper$k(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$k(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
3483
3659
|
|
|
3484
|
-
function _isNativeReflectConstruct$
|
|
3660
|
+
function _isNativeReflectConstruct$k() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
3485
3661
|
var loadedMember = false;
|
|
3486
3662
|
|
|
3487
3663
|
var WithMemberBase = /*#__PURE__*/function (_React$Component) {
|
|
3488
3664
|
_inherits(WithMemberBase, _React$Component);
|
|
3489
3665
|
|
|
3490
|
-
var _super = /*#__PURE__*/_createSuper$
|
|
3666
|
+
var _super = /*#__PURE__*/_createSuper$k(WithMemberBase);
|
|
3491
3667
|
|
|
3492
3668
|
function WithMemberBase(props) {
|
|
3493
3669
|
var _this;
|
|
@@ -3616,9 +3792,9 @@ function mapDispatchToProps$6(dispatch, ownProps) {
|
|
|
3616
3792
|
|
|
3617
3793
|
var WithMember = /*#__PURE__*/reactRedux.connect(mapStateToProps$9, mapDispatchToProps$6)(WithMemberBase);
|
|
3618
3794
|
|
|
3619
|
-
function _createSuper$
|
|
3795
|
+
function _createSuper$l(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$l(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
3620
3796
|
|
|
3621
|
-
function _isNativeReflectConstruct$
|
|
3797
|
+
function _isNativeReflectConstruct$l() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
3622
3798
|
/**
|
|
3623
3799
|
* This higher order function can be used for the home or story page preview. It takes a component, and a function to map the story into props suitable for the component
|
|
3624
3800
|
*
|
|
@@ -3652,7 +3828,7 @@ function WithPreview(klazz, updateData) {
|
|
|
3652
3828
|
return /*#__PURE__*/function (_React$Component) {
|
|
3653
3829
|
_inherits(WithPreviewWrapper, _React$Component);
|
|
3654
3830
|
|
|
3655
|
-
var _super = _createSuper$
|
|
3831
|
+
var _super = _createSuper$l(WithPreviewWrapper);
|
|
3656
3832
|
|
|
3657
3833
|
function WithPreviewWrapper(props) {
|
|
3658
3834
|
var _this;
|
|
@@ -3700,9 +3876,9 @@ function WithPreview(klazz, updateData) {
|
|
|
3700
3876
|
}(React__default.Component);
|
|
3701
3877
|
}
|
|
3702
3878
|
|
|
3703
|
-
function _createSuper$
|
|
3879
|
+
function _createSuper$m(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$m(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
3704
3880
|
|
|
3705
|
-
function _isNativeReflectConstruct$
|
|
3881
|
+
function _isNativeReflectConstruct$m() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
3706
3882
|
/**
|
|
3707
3883
|
* This is an abstract render props component for logging in with social accounts. The component adds two items to scope: `serverSideLoginPath` for redirecting to server side, and `login` for doing a client side login. Calling `login()` returns a promise which can be used to handle success and failure cases.
|
|
3708
3884
|
*
|
|
@@ -3754,7 +3930,7 @@ function _isNativeReflectConstruct$l() { if (typeof Reflect === "undefined" || !
|
|
|
3754
3930
|
var WithSocialLogin = /*#__PURE__*/function (_React$Component) {
|
|
3755
3931
|
_inherits(WithSocialLogin, _React$Component);
|
|
3756
3932
|
|
|
3757
|
-
var _super = /*#__PURE__*/_createSuper$
|
|
3933
|
+
var _super = /*#__PURE__*/_createSuper$m(WithSocialLogin);
|
|
3758
3934
|
|
|
3759
3935
|
function WithSocialLogin(props) {
|
|
3760
3936
|
var _this;
|
|
@@ -4079,9 +4255,9 @@ var loginWithLinkedIn = function loginWithLinkedIn(_ref2) {
|
|
|
4079
4255
|
});
|
|
4080
4256
|
};
|
|
4081
4257
|
|
|
4082
|
-
function _createSuper$
|
|
4258
|
+
function _createSuper$n(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$n(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
4083
4259
|
|
|
4084
|
-
function _isNativeReflectConstruct$
|
|
4260
|
+
function _isNativeReflectConstruct$n() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
4085
4261
|
/**
|
|
4086
4262
|
* This render props component willupdate it's children via props while executing data loaders sent as props to the component.
|
|
4087
4263
|
*
|
|
@@ -4113,7 +4289,7 @@ function _isNativeReflectConstruct$m() { if (typeof Reflect === "undefined" || !
|
|
|
4113
4289
|
var UpdateOnInterval = /*#__PURE__*/function (_React$Component) {
|
|
4114
4290
|
_inherits(UpdateOnInterval, _React$Component);
|
|
4115
4291
|
|
|
4116
|
-
var _super = /*#__PURE__*/_createSuper$
|
|
4292
|
+
var _super = /*#__PURE__*/_createSuper$n(UpdateOnInterval);
|
|
4117
4293
|
|
|
4118
4294
|
function UpdateOnInterval(props) {
|
|
4119
4295
|
var _this;
|
|
@@ -4219,14 +4395,14 @@ function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if
|
|
|
4219
4395
|
|
|
4220
4396
|
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
4221
4397
|
|
|
4222
|
-
function _createSuper$
|
|
4398
|
+
function _createSuper$o(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$o(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
4223
4399
|
|
|
4224
|
-
function _isNativeReflectConstruct$
|
|
4400
|
+
function _isNativeReflectConstruct$o() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
4225
4401
|
|
|
4226
4402
|
var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
4227
4403
|
_inherits(AccessTypeBase, _React$Component);
|
|
4228
4404
|
|
|
4229
|
-
var _super = /*#__PURE__*/_createSuper$
|
|
4405
|
+
var _super = /*#__PURE__*/_createSuper$o(AccessTypeBase);
|
|
4230
4406
|
|
|
4231
4407
|
function AccessTypeBase(props) {
|
|
4232
4408
|
var _this;
|
|
@@ -5362,94 +5538,6 @@ function mapDispatchToProps$8(dispatch) {
|
|
|
5362
5538
|
|
|
5363
5539
|
var WithHostUrl = /*#__PURE__*/reactRedux.connect(mapStateToProps$b, mapDispatchToProps$8)(WithHostUrlBase);
|
|
5364
5540
|
|
|
5365
|
-
function _createSuper$o(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$o(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
5366
|
-
|
|
5367
|
-
function _isNativeReflectConstruct$o() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
5368
|
-
/**
|
|
5369
|
-
* This component can be used to load some DOM just before it scrolls into the screen. Currently, it does not support unloading. The `margin` prop is passed to `IntersectionObserver`.
|
|
5370
|
-
*
|
|
5371
|
-
* Example
|
|
5372
|
-
* ```javascript
|
|
5373
|
-
* import { WithLazy } from '@quintype/components';
|
|
5374
|
-
*
|
|
5375
|
-
* <WithLazy margin="50px">{() =>
|
|
5376
|
-
* <SomeHeavyComponent />
|
|
5377
|
-
* }</WithLazy>
|
|
5378
|
-
* ```
|
|
5379
|
-
* @component
|
|
5380
|
-
* @hideconstructor
|
|
5381
|
-
* @category Other
|
|
5382
|
-
*/
|
|
5383
|
-
|
|
5384
|
-
var WithLazy = /*#__PURE__*/function (_React$Component) {
|
|
5385
|
-
_inherits(WithLazy, _React$Component);
|
|
5386
|
-
|
|
5387
|
-
var _super = /*#__PURE__*/_createSuper$o(WithLazy);
|
|
5388
|
-
|
|
5389
|
-
function WithLazy(props) {
|
|
5390
|
-
var _this;
|
|
5391
|
-
|
|
5392
|
-
_classCallCheck(this, WithLazy);
|
|
5393
|
-
|
|
5394
|
-
_this = _super.call(this, props);
|
|
5395
|
-
_this.state = {
|
|
5396
|
-
loaded: false
|
|
5397
|
-
};
|
|
5398
|
-
_this.observerRef = /*#__PURE__*/React__default.createRef();
|
|
5399
|
-
return _this;
|
|
5400
|
-
}
|
|
5401
|
-
|
|
5402
|
-
_createClass(WithLazy, [{
|
|
5403
|
-
key: "render",
|
|
5404
|
-
value: function render() {
|
|
5405
|
-
if (this.state.loaded) {
|
|
5406
|
-
return this.props.children();
|
|
5407
|
-
} else {
|
|
5408
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
5409
|
-
style: {
|
|
5410
|
-
height: this.props.height || 50
|
|
5411
|
-
},
|
|
5412
|
-
ref: this.observerRef
|
|
5413
|
-
});
|
|
5414
|
-
}
|
|
5415
|
-
}
|
|
5416
|
-
}, {
|
|
5417
|
-
key: "componentDidMount",
|
|
5418
|
-
value: function componentDidMount() {
|
|
5419
|
-
var _this2 = this;
|
|
5420
|
-
|
|
5421
|
-
this.observer = new global.IntersectionObserver(function (entries, observer) {
|
|
5422
|
-
return _this2.observerCallback(entries, observer);
|
|
5423
|
-
}, {
|
|
5424
|
-
rootMargin: this.props.margin || "160px"
|
|
5425
|
-
});
|
|
5426
|
-
this.observer.observe(this.observerRef.current);
|
|
5427
|
-
}
|
|
5428
|
-
}, {
|
|
5429
|
-
key: "componentWillUnmount",
|
|
5430
|
-
value: function componentWillUnmount() {
|
|
5431
|
-
this.observer.disconnect();
|
|
5432
|
-
}
|
|
5433
|
-
}, {
|
|
5434
|
-
key: "observerCallback",
|
|
5435
|
-
value: function observerCallback(entries, observer) {
|
|
5436
|
-
var _this3 = this;
|
|
5437
|
-
|
|
5438
|
-
entries.forEach(function (entry) {
|
|
5439
|
-
if (entry.isIntersecting || entry.isIntersecting === undefined) {
|
|
5440
|
-
_this3.setState({
|
|
5441
|
-
loaded: true
|
|
5442
|
-
});
|
|
5443
|
-
|
|
5444
|
-
observer.disconnect();
|
|
5445
|
-
}
|
|
5446
|
-
});
|
|
5447
|
-
}
|
|
5448
|
-
}]);
|
|
5449
|
-
|
|
5450
|
-
return WithLazy;
|
|
5451
|
-
}(React__default.Component);
|
|
5452
|
-
|
|
5453
5541
|
/**
|
|
5454
5542
|
* This component calls the render prop with `clientSideRendered` = true if the client side is completely loaded, and false during SSR and initial bootup.
|
|
5455
5543
|
*
|
|
@@ -15,16 +15,17 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
15
15
|
|
|
16
16
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
17
17
|
|
|
18
|
-
import React from "react";
|
|
19
18
|
import classNames from "classnames";
|
|
20
|
-
import
|
|
21
|
-
import
|
|
19
|
+
import get from "lodash/get";
|
|
20
|
+
import React from "react";
|
|
21
|
+
import { getQliticsSchema } from "../utils";
|
|
22
|
+
import { Link } from "./link";
|
|
22
23
|
import { ResponsiveImage } from "./responsive-image";
|
|
24
|
+
import StoryElementDailyMotion from "./story-elements/dailymotion";
|
|
25
|
+
import JSEmbed from "./story-elements/jsembed";
|
|
23
26
|
import Polltype from "./story-elements/polltype";
|
|
24
27
|
import { Table } from "./story-elements/table";
|
|
25
|
-
import
|
|
26
|
-
import get from "lodash/get";
|
|
27
|
-
import { getQliticsSchema } from "../utils";
|
|
28
|
+
import StoryElementYoutube from "./story-elements/youtube";
|
|
28
29
|
/**
|
|
29
30
|
* This component renders different types of [story elements](https://developers.quintype.com/malibu/terminology#story-elements)
|
|
30
31
|
|
|
@@ -176,10 +177,12 @@ function StoryElementSoundCloud(_ref5) {
|
|
|
176
177
|
}
|
|
177
178
|
|
|
178
179
|
function StoryElementJsembed(_ref6) {
|
|
179
|
-
var element = _ref6.element
|
|
180
|
+
var element = _ref6.element,
|
|
181
|
+
loadEmbed = _ref6.loadEmbed;
|
|
180
182
|
return /*#__PURE__*/React.createElement(JSEmbed, {
|
|
181
183
|
embedJS: element["embed-js"],
|
|
182
|
-
id: element["id"]
|
|
184
|
+
id: element["id"],
|
|
185
|
+
loadEmbed: loadEmbed
|
|
183
186
|
});
|
|
184
187
|
}
|
|
185
188
|
|
|
@@ -217,6 +220,7 @@ var DEFAULT_TEMPLATES = {
|
|
|
217
220
|
image: StoryElementImage,
|
|
218
221
|
title: StoryElementTitle,
|
|
219
222
|
"youtube-video": StoryElementYoutube,
|
|
223
|
+
"dailymotion-video": StoryElementDailyMotion,
|
|
220
224
|
"soundcloud-audio": StoryElementSoundCloud,
|
|
221
225
|
jsembed: StoryElementJsembed,
|
|
222
226
|
polltype: StoryElementPolltype,
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
+
|
|
9
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
+
|
|
11
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
+
|
|
13
|
+
import getVideoID from "get-video-id";
|
|
14
|
+
import { PropTypes } from "prop-types";
|
|
15
|
+
import React from "react";
|
|
16
|
+
import { WithLazy } from "../with-lazy";
|
|
17
|
+
var DailyMotion = null;
|
|
18
|
+
var loaderPromise = null;
|
|
19
|
+
|
|
20
|
+
function loadLibrary() {
|
|
21
|
+
if (loaderPromise === null) {
|
|
22
|
+
loaderPromise = import(
|
|
23
|
+
/* webpackChunkName: "qtc-react-dailymotion" */
|
|
24
|
+
"react-dailymotion").then(function (DM) {
|
|
25
|
+
DailyMotion = DM["default"];
|
|
26
|
+
})["catch"](function (err) {
|
|
27
|
+
console.log("Failed to load react-dailymotion", err);
|
|
28
|
+
return Promise.reject();
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return loaderPromise;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function isLibraryLoaded() {
|
|
36
|
+
return DailyMotion !== null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var CustomStoryElementDailyMotion = /*#__PURE__*/function (_React$Component) {
|
|
40
|
+
_inherits(CustomStoryElementDailyMotion, _React$Component);
|
|
41
|
+
|
|
42
|
+
var _super = /*#__PURE__*/_createSuper(CustomStoryElementDailyMotion);
|
|
43
|
+
|
|
44
|
+
function CustomStoryElementDailyMotion(props) {
|
|
45
|
+
var _this;
|
|
46
|
+
|
|
47
|
+
_classCallCheck(this, CustomStoryElementDailyMotion);
|
|
48
|
+
|
|
49
|
+
_this = _super.call(this, props);
|
|
50
|
+
|
|
51
|
+
_defineProperty(_assertThisInitialized(_this), "onPlayCallback", function (event) {
|
|
52
|
+
_this.props.onPlay === "function" && _this.props.onPlay(event);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
_defineProperty(_assertThisInitialized(_this), "onPauseCallback", function (event) {
|
|
56
|
+
_this.props.onPause === "function" && _this.props.onPause(event);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
_defineProperty(_assertThisInitialized(_this), "onEndCallback", function (event) {
|
|
60
|
+
_this.props.onEnd === "function" && _this.props.onEnd(event);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
_defineProperty(_assertThisInitialized(_this), "triggerIframe", function () {
|
|
64
|
+
_this._isMounted = true;
|
|
65
|
+
loadLibrary().then(function () {
|
|
66
|
+
return _this._isMounted && _this.forceUpdate();
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
_defineProperty(_assertThisInitialized(_this), "onPlayerReady", function (event) {
|
|
71
|
+
event.target.setVolume(100);
|
|
72
|
+
event.target.playVideo();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
_defineProperty(_assertThisInitialized(_this), "renderVideo", function () {
|
|
76
|
+
_this.triggerIframe();
|
|
77
|
+
|
|
78
|
+
_this.setState({
|
|
79
|
+
showVideo: true
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
_this.state = {
|
|
84
|
+
showVideo: false
|
|
85
|
+
};
|
|
86
|
+
_this.opts = {
|
|
87
|
+
playerVars: {
|
|
88
|
+
autoplay: 0
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
return _this;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
_createClass(CustomStoryElementDailyMotion, [{
|
|
95
|
+
key: "componentDidMount",
|
|
96
|
+
value: function componentDidMount() {
|
|
97
|
+
if (!this.props.loadIframeOnClick) {
|
|
98
|
+
this.triggerIframe();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
key: "componentWillUnmount",
|
|
103
|
+
value: function componentWillUnmount() {
|
|
104
|
+
this._isMounted = false;
|
|
105
|
+
}
|
|
106
|
+
}, {
|
|
107
|
+
key: "render",
|
|
108
|
+
value: function render() {
|
|
109
|
+
var _this2 = this;
|
|
110
|
+
|
|
111
|
+
var _getVideoID = getVideoID(this.props.element.metadata["dailymotion-url"]),
|
|
112
|
+
videoId = _getVideoID.id;
|
|
113
|
+
|
|
114
|
+
var dailymotionIframe = function dailymotionIframe() {
|
|
115
|
+
return /*#__PURE__*/React.createElement(DailyMotion, {
|
|
116
|
+
video: videoId,
|
|
117
|
+
opts: _this2.opts,
|
|
118
|
+
onPlay: _this2.onPlayCallback,
|
|
119
|
+
onPause: _this2.onPauseCallback,
|
|
120
|
+
onEnd: _this2.onEndCallback
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
if (this.props.loadIframeOnClick) {
|
|
125
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
126
|
+
className: "thumbnail-wrapper"
|
|
127
|
+
}, !this.state.showVideo && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
128
|
+
className: "dailymotion-playBtn",
|
|
129
|
+
onClick: this.renderVideo,
|
|
130
|
+
"aria-label": "Play Video"
|
|
131
|
+
}), /*#__PURE__*/React.createElement("img", {
|
|
132
|
+
className: "dailymotion-thumbnail",
|
|
133
|
+
onClick: this.renderVideo,
|
|
134
|
+
src: "https://www.dailymotion.com/thumbnail/video/".concat(videoId),
|
|
135
|
+
alt: "daily-motion-video"
|
|
136
|
+
})), this.state.showVideo && isLibraryLoaded() && /*#__PURE__*/React.createElement("div", {
|
|
137
|
+
className: "dailymotion-iframe-wrapper"
|
|
138
|
+
}, dailymotionIframe()));
|
|
139
|
+
} else if (!this.props.loadIframeOnClick && isLibraryLoaded()) {
|
|
140
|
+
return /*#__PURE__*/React.createElement(DailyMotion, {
|
|
141
|
+
video: videoId,
|
|
142
|
+
opts: this.opts,
|
|
143
|
+
onPlay: this.onPlayCallback,
|
|
144
|
+
onPause: this.onPauseCallback,
|
|
145
|
+
onEnd: this.onEndCallback
|
|
146
|
+
});
|
|
147
|
+
} else return /*#__PURE__*/React.createElement("div", null);
|
|
148
|
+
}
|
|
149
|
+
}]);
|
|
150
|
+
|
|
151
|
+
return CustomStoryElementDailyMotion;
|
|
152
|
+
}(React.Component);
|
|
153
|
+
|
|
154
|
+
var StoryElementDailyMotion = function StoryElementDailyMotion(props) {
|
|
155
|
+
return /*#__PURE__*/React.createElement(WithLazy, {
|
|
156
|
+
margin: "0px"
|
|
157
|
+
}, function () {
|
|
158
|
+
return /*#__PURE__*/React.createElement(CustomStoryElementDailyMotion, props);
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export default StoryElementDailyMotion;
|
|
@@ -1,31 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
|
|
7
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
-
|
|
9
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
-
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
11
2
|
import atob from "atob";
|
|
12
|
-
import {
|
|
13
|
-
import React from "react";
|
|
3
|
+
import React, { useEffect, useState } from "react";
|
|
14
4
|
|
|
15
|
-
function cloneScriptNode(node) {
|
|
5
|
+
var cloneScriptNode = function cloneScriptNode(node) {
|
|
16
6
|
var script = document.createElement("script");
|
|
17
7
|
script.text = node.innerHTML;
|
|
18
8
|
|
|
19
9
|
for (var i = node.attributes.length - 1; i >= 0; i--) {
|
|
20
|
-
|
|
21
|
-
script.setAttribute(node.attributes[i].name, node.attributes[i].value);
|
|
22
|
-
}, 3000);
|
|
10
|
+
script.setAttribute(node.attributes[i].name, node.attributes[i].value);
|
|
23
11
|
}
|
|
24
12
|
|
|
25
13
|
return script;
|
|
26
|
-
}
|
|
14
|
+
};
|
|
27
15
|
|
|
28
|
-
function replaceScriptNodes(node) {
|
|
16
|
+
var replaceScriptNodes = function replaceScriptNodes(node) {
|
|
29
17
|
if (node.tagName === "SCRIPT") {
|
|
30
18
|
node.parentNode.replaceChild(cloneScriptNode(node), node);
|
|
31
19
|
if (window.instgrm) window.instgrm.Embeds.process(); // Temporary fix for instagram element on live blog page.
|
|
@@ -37,61 +25,49 @@ function replaceScriptNodes(node) {
|
|
|
37
25
|
replaceScriptNodes(children[i++]);
|
|
38
26
|
}
|
|
39
27
|
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}, {
|
|
68
|
-
key: "componentDidUpdate",
|
|
69
|
-
value: function componentDidUpdate() {
|
|
70
|
-
replaceScriptNodes(this.JSEmbed);
|
|
71
|
-
}
|
|
72
|
-
}, {
|
|
73
|
-
key: "getEmbedJS",
|
|
74
|
-
value: function getEmbedJS() {
|
|
75
|
-
var embedjs = this.props.embedJS;
|
|
76
|
-
return embedjs != null ? atob(embedjs) : null;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var CustomJSEmbed = function CustomJSEmbed(props) {
|
|
31
|
+
var _useState = useState(null),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
JSEmbed = _useState2[0],
|
|
34
|
+
setJSEmbed = _useState2[1];
|
|
35
|
+
|
|
36
|
+
useEffect(function () {
|
|
37
|
+
JSEmbed && replaceScriptNodes(JSEmbed);
|
|
38
|
+
}, []);
|
|
39
|
+
useEffect(function () {
|
|
40
|
+
JSEmbed && replaceScriptNodes(JSEmbed);
|
|
41
|
+
}, [JSEmbed]);
|
|
42
|
+
|
|
43
|
+
var getEmbedJS = function getEmbedJS() {
|
|
44
|
+
var embedjs = props.embedJS;
|
|
45
|
+
var embed = embedjs != null ? atob(embedjs) : null;
|
|
46
|
+
return embed;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
ref: function ref(jsembed) {
|
|
51
|
+
setJSEmbed(jsembed);
|
|
52
|
+
},
|
|
53
|
+
dangerouslySetInnerHTML: {
|
|
54
|
+
__html: getEmbedJS()
|
|
77
55
|
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
export { JSEmbed as default };
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
var JSEmbed = function JSEmbed(props) {
|
|
60
|
+
console.log("###props", props);
|
|
61
|
+
return (
|
|
62
|
+
/*#__PURE__*/
|
|
63
|
+
// <WithLazy margin="0px">
|
|
64
|
+
// {() => {
|
|
65
|
+
// console.log("###lazy loading");
|
|
66
|
+
// return <CustomJSEmbed {...props} />;
|
|
67
|
+
// }}
|
|
68
|
+
// </WithLazy>
|
|
69
|
+
React.createElement("div", null, "Lazy")
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default JSEmbed;
|
|
@@ -18,6 +18,7 @@ import getYouTubeID from "get-youtube-id";
|
|
|
18
18
|
import { PropTypes } from "prop-types";
|
|
19
19
|
import React from "react";
|
|
20
20
|
import { getQliticsSchema } from "../../utils";
|
|
21
|
+
import { WithLazy } from "../with-lazy";
|
|
21
22
|
var YouTube = null;
|
|
22
23
|
var loaderPromise = null;
|
|
23
24
|
|
|
@@ -40,15 +41,15 @@ function isLibraryLoaded() {
|
|
|
40
41
|
return YouTube !== null;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
var
|
|
44
|
-
_inherits(
|
|
44
|
+
var CustomStoryElementYoutube = /*#__PURE__*/function (_React$Component) {
|
|
45
|
+
_inherits(CustomStoryElementYoutube, _React$Component);
|
|
45
46
|
|
|
46
|
-
var _super = /*#__PURE__*/_createSuper(
|
|
47
|
+
var _super = /*#__PURE__*/_createSuper(CustomStoryElementYoutube);
|
|
47
48
|
|
|
48
|
-
function
|
|
49
|
+
function CustomStoryElementYoutube(props) {
|
|
49
50
|
var _this;
|
|
50
51
|
|
|
51
|
-
_classCallCheck(this,
|
|
52
|
+
_classCallCheck(this, CustomStoryElementYoutube);
|
|
52
53
|
|
|
53
54
|
_this = _super.call(this, props);
|
|
54
55
|
|
|
@@ -126,7 +127,7 @@ var StoryElementYoutube = /*#__PURE__*/function (_React$Component) {
|
|
|
126
127
|
return _this;
|
|
127
128
|
}
|
|
128
129
|
|
|
129
|
-
_createClass(
|
|
130
|
+
_createClass(CustomStoryElementYoutube, [{
|
|
130
131
|
key: "componentDidMount",
|
|
131
132
|
value: function componentDidMount() {
|
|
132
133
|
if (!this.props.loadIframeOnClick) {
|
|
@@ -157,16 +158,16 @@ var StoryElementYoutube = /*#__PURE__*/function (_React$Component) {
|
|
|
157
158
|
if (this.props.loadIframeOnClick) {
|
|
158
159
|
return /*#__PURE__*/React.createElement("div", {
|
|
159
160
|
className: "thumbnail-wrapper"
|
|
160
|
-
}, /*#__PURE__*/React.createElement("button", {
|
|
161
|
+
}, !this.state.showVideo && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
161
162
|
className: "youtube-playBtn",
|
|
162
163
|
onClick: this.renderVideo,
|
|
163
164
|
"aria-label": "Play Video"
|
|
164
|
-
}),
|
|
165
|
+
}), /*#__PURE__*/React.createElement("img", {
|
|
165
166
|
className: "youtube-thumbnail",
|
|
166
167
|
onClick: this.renderVideo,
|
|
167
168
|
src: "https://img.youtube.com/vi/".concat(getYouTubeID(this.props.element.url), "/sddefault.jpg"),
|
|
168
169
|
alt: "video"
|
|
169
|
-
}), this.state.showVideo && isLibraryLoaded() && /*#__PURE__*/React.createElement("div", {
|
|
170
|
+
})), this.state.showVideo && isLibraryLoaded() && /*#__PURE__*/React.createElement("div", {
|
|
170
171
|
className: "youtube-iframe-wrapper"
|
|
171
172
|
}, youtubeIframe()));
|
|
172
173
|
} else if (!this.props.loadIframeOnClick && isLibraryLoaded()) {
|
|
@@ -181,7 +182,15 @@ var StoryElementYoutube = /*#__PURE__*/function (_React$Component) {
|
|
|
181
182
|
}
|
|
182
183
|
}]);
|
|
183
184
|
|
|
184
|
-
return
|
|
185
|
+
return CustomStoryElementYoutube;
|
|
185
186
|
}(React.Component);
|
|
186
187
|
|
|
187
|
-
|
|
188
|
+
var StoryElementYoutube = function StoryElementYoutube(props) {
|
|
189
|
+
return /*#__PURE__*/React.createElement(WithLazy, {
|
|
190
|
+
margin: "0px"
|
|
191
|
+
}, function () {
|
|
192
|
+
return /*#__PURE__*/React.createElement(CustomStoryElementYoutube, props);
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export default StoryElementYoutube;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quintype/components",
|
|
3
|
-
"version": "2.31.4-lazy-iframe.
|
|
3
|
+
"version": "2.31.4-lazy-iframe.5",
|
|
4
4
|
"description": "Components to help build Quintype Node.js apps",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/es/index.js",
|
|
@@ -26,11 +26,13 @@
|
|
|
26
26
|
"atob": "^2.1.2",
|
|
27
27
|
"classnames": "^2.2.6",
|
|
28
28
|
"empty-web-gif": "^1.0.1",
|
|
29
|
+
"get-video-id": "^3.4.1",
|
|
29
30
|
"get-youtube-id": "^1.0.1",
|
|
30
31
|
"papaparse": "^5.2.0",
|
|
31
32
|
"prop-types": "^15.7.2",
|
|
32
33
|
"quintype-js": "^1.2.0",
|
|
33
34
|
"react": "^16.8.6",
|
|
35
|
+
"react-dailymotion": "^0.4.1",
|
|
34
36
|
"react-dfp": "quintype/react-dfp",
|
|
35
37
|
"react-redux": "^7.0.3",
|
|
36
38
|
"react-youtube": "^7.9.0",
|