@quintype/components 3.8.3-test-branch.0 → 3.8.3
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
CHANGED
|
@@ -1106,12 +1106,11 @@ var InfiniteStoryBase = /*#__PURE__*/function (_React$Component) {
|
|
|
1106
1106
|
var _this2 = this;
|
|
1107
1107
|
|
|
1108
1108
|
var item = this.allItems()[index];
|
|
1109
|
-
console.log('aa--!this.props.doNotChangeUrl', !this.props.doNotChangeUrl);
|
|
1110
1109
|
|
|
1111
1110
|
if (!this.props.doNotChangeUrl) {
|
|
1112
|
-
var storyPath = item.story.url ? new URL(item.story.url).pathname :
|
|
1111
|
+
var storyPath = item.story.url ? new URL(item.story.url).pathname : "/" + item.story.slug;
|
|
1113
1112
|
var metaTitle = get__default["default"](item, ['story', 'seo', 'meta-title'], item.story.headline);
|
|
1114
|
-
var title = get__default["default"](item, [
|
|
1113
|
+
var title = get__default["default"](item, ["customSeo", "title"], metaTitle);
|
|
1115
1114
|
var path = this.props.changeUrlTo ? this.props.changeUrlTo(item) : storyPath;
|
|
1116
1115
|
global.app.maybeSetUrl(path, title);
|
|
1117
1116
|
}
|
|
@@ -3273,7 +3272,7 @@ function loadLibrary() {
|
|
|
3273
3272
|
'react-youtube')); }).then(function (YT) {
|
|
3274
3273
|
YouTube = YT["default"];
|
|
3275
3274
|
})["catch"](function (err) {
|
|
3276
|
-
console.log(
|
|
3275
|
+
console.log('Failed to load react-youtube', err);
|
|
3277
3276
|
return Promise.reject();
|
|
3278
3277
|
});
|
|
3279
3278
|
}
|
|
@@ -3285,6 +3284,26 @@ function isLibraryLoaded() {
|
|
|
3285
3284
|
return YouTube !== null;
|
|
3286
3285
|
}
|
|
3287
3286
|
|
|
3287
|
+
function getYoutubeButton(onClick) {
|
|
3288
|
+
return /*#__PURE__*/React__default["default"].createElement("button", {
|
|
3289
|
+
onClick: onClick,
|
|
3290
|
+
className: "youtube-playBtn",
|
|
3291
|
+
"aria-label": "Play Video"
|
|
3292
|
+
}, /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
3293
|
+
width: "68",
|
|
3294
|
+
height: "48",
|
|
3295
|
+
viewBox: "0 0 68 48",
|
|
3296
|
+
fill: "none",
|
|
3297
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
3298
|
+
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
3299
|
+
d: "M66.52 7.74C65.74 4.81 64.03 2.33 61.1 1.55C55.79 0.13 34 0 34 0C34 0 12.21 0.13 6.9 1.55C3.97 2.33 2.27 4.81 1.48 7.74C0.0600001 13.05 0 24 0 24C0 24 0.0600001 34.95 1.48 40.26C2.26 43.19 3.97 45.67 6.9 46.45C12.21 47.87 34 48 34 48C34 48 55.79 47.87 61.1 46.45C64.03 45.67 65.74 43.19 66.52 40.26C67.94 34.95 68 24 68 24C68 24 67.94 13.05 66.52 7.74Z",
|
|
3300
|
+
fill: "#FF0000"
|
|
3301
|
+
}), /*#__PURE__*/React__default["default"].createElement("path", {
|
|
3302
|
+
d: "M43 24L25 14V34",
|
|
3303
|
+
fill: "white"
|
|
3304
|
+
})));
|
|
3305
|
+
}
|
|
3306
|
+
|
|
3288
3307
|
var CustomStoryElementYoutube = /*#__PURE__*/function (_React$Component) {
|
|
3289
3308
|
_inherits__default["default"](CustomStoryElementYoutube, _React$Component);
|
|
3290
3309
|
|
|
@@ -3318,24 +3337,24 @@ var CustomStoryElementYoutube = /*#__PURE__*/function (_React$Component) {
|
|
|
3318
3337
|
element = _this$props$element === void 0 ? {} : _this$props$element;
|
|
3319
3338
|
|
|
3320
3339
|
var qliticsData = _objectSpread$3(_objectSpread$3({}, getQliticsSchema(story, card, element)), {
|
|
3321
|
-
|
|
3340
|
+
'story-element-action': action
|
|
3322
3341
|
});
|
|
3323
3342
|
|
|
3324
3343
|
if (global.qlitics) {
|
|
3325
|
-
global.qlitics(
|
|
3344
|
+
global.qlitics('track', 'story-element-action', qliticsData);
|
|
3326
3345
|
} else {
|
|
3327
3346
|
global.qlitics = global.qlitics || function () {
|
|
3328
3347
|
(qlitics.q = qlitics.q || []).push(arguments);
|
|
3329
3348
|
};
|
|
3330
3349
|
|
|
3331
|
-
qlitics.qlitics.q.push(
|
|
3350
|
+
qlitics.qlitics.q.push('track', 'story-element-action', qliticsData);
|
|
3332
3351
|
}
|
|
3333
3352
|
});
|
|
3334
3353
|
|
|
3335
3354
|
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "onPlayCallback", function (event) {
|
|
3336
|
-
_this.triggerQlitics(
|
|
3355
|
+
_this.triggerQlitics('play');
|
|
3337
3356
|
|
|
3338
|
-
_this.props.onPlay ===
|
|
3357
|
+
_this.props.onPlay === 'function' && _this.props.onPlay(event);
|
|
3339
3358
|
_this.videoRef.current = event.target;
|
|
3340
3359
|
|
|
3341
3360
|
var targetElement = _this.videoRef.current.getIframe();
|
|
@@ -3358,9 +3377,9 @@ var CustomStoryElementYoutube = /*#__PURE__*/function (_React$Component) {
|
|
|
3358
3377
|
});
|
|
3359
3378
|
|
|
3360
3379
|
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "onPauseCallback", function (event) {
|
|
3361
|
-
_this.triggerQlitics(
|
|
3380
|
+
_this.triggerQlitics('pause');
|
|
3362
3381
|
|
|
3363
|
-
_this.props.onPause ===
|
|
3382
|
+
_this.props.onPause === 'function' && _this.props.onPause(event);
|
|
3364
3383
|
var videoPausedByObserver = _this.videoPausedByObserver.current;
|
|
3365
3384
|
|
|
3366
3385
|
if (videoPausedByObserver) {
|
|
@@ -3371,9 +3390,9 @@ var CustomStoryElementYoutube = /*#__PURE__*/function (_React$Component) {
|
|
|
3371
3390
|
});
|
|
3372
3391
|
|
|
3373
3392
|
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "onEndCallback", function (event) {
|
|
3374
|
-
_this.triggerQlitics(
|
|
3393
|
+
_this.triggerQlitics('end');
|
|
3375
3394
|
|
|
3376
|
-
_this.props.onEnd ===
|
|
3395
|
+
_this.props.onEnd === 'function' && _this.props.onEnd(event);
|
|
3377
3396
|
});
|
|
3378
3397
|
|
|
3379
3398
|
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "triggerIframe", function () {
|
|
@@ -3443,11 +3462,7 @@ var CustomStoryElementYoutube = /*#__PURE__*/function (_React$Component) {
|
|
|
3443
3462
|
if (this.props.loadIframeOnClick) {
|
|
3444
3463
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3445
3464
|
className: "thumbnail-wrapper"
|
|
3446
|
-
}, !this.state.showVideo && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("
|
|
3447
|
-
className: "youtube-playBtn",
|
|
3448
|
-
onClick: this.renderVideo,
|
|
3449
|
-
"aria-label": "Play Video"
|
|
3450
|
-
}), /*#__PURE__*/React__default["default"].createElement("img", {
|
|
3465
|
+
}, !this.state.showVideo && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, getYoutubeButton(this.renderVideo), /*#__PURE__*/React__default["default"].createElement("img", {
|
|
3451
3466
|
className: "youtube-thumbnail",
|
|
3452
3467
|
onClick: this.renderVideo,
|
|
3453
3468
|
src: "https://i.ytimg.com/vi/".concat(getYouTubeID__default["default"](this.props.element.url), "/hqdefault.jpg"),
|
|
@@ -8,10 +8,10 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
8
8
|
|
|
9
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
10
|
|
|
11
|
-
import
|
|
12
|
-
import
|
|
11
|
+
import React from "react";
|
|
12
|
+
import get from "lodash/get";
|
|
13
|
+
import { InfiniteScroll } from "./infinite-scroll.js";
|
|
13
14
|
import { removeDuplicateStories } from '../utils';
|
|
14
|
-
import { InfiniteScroll } from './infinite-scroll.js';
|
|
15
15
|
/**
|
|
16
16
|
* This component can be used to implement InfiniteScroll on the story page. You will need to specify the function which renders the story (which will recieve props.index and props.story), and functions for triggering analytics.
|
|
17
17
|
*
|
|
@@ -106,12 +106,11 @@ export var InfiniteStoryBase = /*#__PURE__*/function (_React$Component) {
|
|
|
106
106
|
var _this2 = this;
|
|
107
107
|
|
|
108
108
|
var item = this.allItems()[index];
|
|
109
|
-
console.log('aa--!this.props.doNotChangeUrl', !this.props.doNotChangeUrl);
|
|
110
109
|
|
|
111
110
|
if (!this.props.doNotChangeUrl) {
|
|
112
|
-
var storyPath = item.story.url ? new URL(item.story.url).pathname :
|
|
111
|
+
var storyPath = item.story.url ? new URL(item.story.url).pathname : "/" + item.story.slug;
|
|
113
112
|
var metaTitle = get(item, ['story', 'seo', 'meta-title'], item.story.headline);
|
|
114
|
-
var title = get(item, [
|
|
113
|
+
var title = get(item, ["customSeo", "title"], metaTitle);
|
|
115
114
|
var path = this.props.changeUrlTo ? this.props.changeUrlTo(item) : storyPath;
|
|
116
115
|
global.app.maybeSetUrl(path, title);
|
|
117
116
|
}
|
|
@@ -14,11 +14,11 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
14
14
|
|
|
15
15
|
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; } }
|
|
16
16
|
|
|
17
|
-
import getYouTubeID from
|
|
18
|
-
import { bool, func, object } from
|
|
19
|
-
import React from
|
|
20
|
-
import { disconnectObserver, getQliticsSchema, initiateNewObserver } from
|
|
21
|
-
import { WithLazy } from
|
|
17
|
+
import getYouTubeID from 'get-youtube-id';
|
|
18
|
+
import { bool, func, object } from 'prop-types';
|
|
19
|
+
import React from 'react';
|
|
20
|
+
import { disconnectObserver, getQliticsSchema, initiateNewObserver } from '../../utils';
|
|
21
|
+
import { WithLazy } from '../with-lazy';
|
|
22
22
|
var YouTube = null;
|
|
23
23
|
var loaderPromise = null;
|
|
24
24
|
|
|
@@ -26,10 +26,10 @@ function loadLibrary() {
|
|
|
26
26
|
if (loaderPromise === null) {
|
|
27
27
|
loaderPromise = import(
|
|
28
28
|
/* webpackChunkName: "qtc-react-youtube" */
|
|
29
|
-
|
|
29
|
+
'react-youtube').then(function (YT) {
|
|
30
30
|
YouTube = YT["default"];
|
|
31
31
|
})["catch"](function (err) {
|
|
32
|
-
console.log(
|
|
32
|
+
console.log('Failed to load react-youtube', err);
|
|
33
33
|
return Promise.reject();
|
|
34
34
|
});
|
|
35
35
|
}
|
|
@@ -41,6 +41,26 @@ function isLibraryLoaded() {
|
|
|
41
41
|
return YouTube !== null;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
function getYoutubeButton(onClick) {
|
|
45
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
46
|
+
onClick: onClick,
|
|
47
|
+
className: "youtube-playBtn",
|
|
48
|
+
"aria-label": "Play Video"
|
|
49
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
50
|
+
width: "68",
|
|
51
|
+
height: "48",
|
|
52
|
+
viewBox: "0 0 68 48",
|
|
53
|
+
fill: "none",
|
|
54
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
55
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
56
|
+
d: "M66.52 7.74C65.74 4.81 64.03 2.33 61.1 1.55C55.79 0.13 34 0 34 0C34 0 12.21 0.13 6.9 1.55C3.97 2.33 2.27 4.81 1.48 7.74C0.0600001 13.05 0 24 0 24C0 24 0.0600001 34.95 1.48 40.26C2.26 43.19 3.97 45.67 6.9 46.45C12.21 47.87 34 48 34 48C34 48 55.79 47.87 61.1 46.45C64.03 45.67 65.74 43.19 66.52 40.26C67.94 34.95 68 24 68 24C68 24 67.94 13.05 66.52 7.74Z",
|
|
57
|
+
fill: "#FF0000"
|
|
58
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
59
|
+
d: "M43 24L25 14V34",
|
|
60
|
+
fill: "white"
|
|
61
|
+
})));
|
|
62
|
+
}
|
|
63
|
+
|
|
44
64
|
var CustomStoryElementYoutube = /*#__PURE__*/function (_React$Component) {
|
|
45
65
|
_inherits(CustomStoryElementYoutube, _React$Component);
|
|
46
66
|
|
|
@@ -74,24 +94,24 @@ var CustomStoryElementYoutube = /*#__PURE__*/function (_React$Component) {
|
|
|
74
94
|
element = _this$props$element === void 0 ? {} : _this$props$element;
|
|
75
95
|
|
|
76
96
|
var qliticsData = _objectSpread(_objectSpread({}, getQliticsSchema(story, card, element)), {
|
|
77
|
-
|
|
97
|
+
'story-element-action': action
|
|
78
98
|
});
|
|
79
99
|
|
|
80
100
|
if (global.qlitics) {
|
|
81
|
-
global.qlitics(
|
|
101
|
+
global.qlitics('track', 'story-element-action', qliticsData);
|
|
82
102
|
} else {
|
|
83
103
|
global.qlitics = global.qlitics || function () {
|
|
84
104
|
(qlitics.q = qlitics.q || []).push(arguments);
|
|
85
105
|
};
|
|
86
106
|
|
|
87
|
-
qlitics.qlitics.q.push(
|
|
107
|
+
qlitics.qlitics.q.push('track', 'story-element-action', qliticsData);
|
|
88
108
|
}
|
|
89
109
|
});
|
|
90
110
|
|
|
91
111
|
_defineProperty(_assertThisInitialized(_this), "onPlayCallback", function (event) {
|
|
92
|
-
_this.triggerQlitics(
|
|
112
|
+
_this.triggerQlitics('play');
|
|
93
113
|
|
|
94
|
-
_this.props.onPlay ===
|
|
114
|
+
_this.props.onPlay === 'function' && _this.props.onPlay(event);
|
|
95
115
|
_this.videoRef.current = event.target;
|
|
96
116
|
|
|
97
117
|
var targetElement = _this.videoRef.current.getIframe();
|
|
@@ -114,9 +134,9 @@ var CustomStoryElementYoutube = /*#__PURE__*/function (_React$Component) {
|
|
|
114
134
|
});
|
|
115
135
|
|
|
116
136
|
_defineProperty(_assertThisInitialized(_this), "onPauseCallback", function (event) {
|
|
117
|
-
_this.triggerQlitics(
|
|
137
|
+
_this.triggerQlitics('pause');
|
|
118
138
|
|
|
119
|
-
_this.props.onPause ===
|
|
139
|
+
_this.props.onPause === 'function' && _this.props.onPause(event);
|
|
120
140
|
var videoPausedByObserver = _this.videoPausedByObserver.current;
|
|
121
141
|
|
|
122
142
|
if (videoPausedByObserver) {
|
|
@@ -127,9 +147,9 @@ var CustomStoryElementYoutube = /*#__PURE__*/function (_React$Component) {
|
|
|
127
147
|
});
|
|
128
148
|
|
|
129
149
|
_defineProperty(_assertThisInitialized(_this), "onEndCallback", function (event) {
|
|
130
|
-
_this.triggerQlitics(
|
|
150
|
+
_this.triggerQlitics('end');
|
|
131
151
|
|
|
132
|
-
_this.props.onEnd ===
|
|
152
|
+
_this.props.onEnd === 'function' && _this.props.onEnd(event);
|
|
133
153
|
});
|
|
134
154
|
|
|
135
155
|
_defineProperty(_assertThisInitialized(_this), "triggerIframe", function () {
|
|
@@ -199,11 +219,7 @@ var CustomStoryElementYoutube = /*#__PURE__*/function (_React$Component) {
|
|
|
199
219
|
if (this.props.loadIframeOnClick) {
|
|
200
220
|
return /*#__PURE__*/React.createElement("div", {
|
|
201
221
|
className: "thumbnail-wrapper"
|
|
202
|
-
}, !this.state.showVideo && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("
|
|
203
|
-
className: "youtube-playBtn",
|
|
204
|
-
onClick: this.renderVideo,
|
|
205
|
-
"aria-label": "Play Video"
|
|
206
|
-
}), /*#__PURE__*/React.createElement("img", {
|
|
222
|
+
}, !this.state.showVideo && /*#__PURE__*/React.createElement(React.Fragment, null, getYoutubeButton(this.renderVideo), /*#__PURE__*/React.createElement("img", {
|
|
207
223
|
className: "youtube-thumbnail",
|
|
208
224
|
onClick: this.renderVideo,
|
|
209
225
|
src: "https://i.ytimg.com/vi/".concat(getYouTubeID(this.props.element.url), "/hqdefault.jpg"),
|