@quintype/components 3.8.7 → 3.8.8-only-react-v19.1
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 +1090 -2039
- package/dist/es/components/access-type.js +574 -822
- package/dist/es/components/adbutler-ad.js +10 -14
- package/dist/es/components/api-client.js +4 -6
- package/dist/es/components/breaking-news-item.js +2 -3
- package/dist/es/components/breaking-news.js +7 -23
- package/dist/es/components/client-side-only.js +6 -19
- package/dist/es/components/collection.js +5 -5
- package/dist/es/components/dfp-ad.js +23 -30
- package/dist/es/components/eager-load-images.js +7 -17
- package/dist/es/components/hamburger-button.js +2 -5
- package/dist/es/components/image-gallery.js +10 -13
- package/dist/es/components/impl/collection-impl.js +2 -8
- package/dist/es/components/impl/gumlet-image.js +10 -19
- package/dist/es/components/impl/image-utils.js +3 -4
- package/dist/es/components/impl/load-more-stories-manager.js +6 -19
- package/dist/es/components/impl/thumbor-image.js +10 -32
- package/dist/es/components/infinite-scroll.js +29 -85
- package/dist/es/components/infinite-story-base.js +7 -24
- package/dist/es/components/lazy-collection.js +8 -8
- package/dist/es/components/lazy-load-images.js +10 -43
- package/dist/es/components/link-base.js +11 -19
- package/dist/es/components/link.js +1 -4
- package/dist/es/components/load-more-collection-stories.js +7 -18
- package/dist/es/components/load-more-stories-base.js +6 -20
- package/dist/es/components/loading-indicator.js +1 -5
- package/dist/es/components/menu-item.js +6 -10
- package/dist/es/components/menu.js +6 -9
- package/dist/es/components/responsive-hero-image.js +1 -3
- package/dist/es/components/responsive-image.js +0 -5
- package/dist/es/components/responsive-source.js +1 -1
- package/dist/es/components/review-rating/review-rating.js +21 -27
- package/dist/es/components/review-rating/star-icon.js +3 -5
- package/dist/es/components/search-box.js +7 -23
- package/dist/es/components/search-page-base.js +7 -18
- package/dist/es/components/social-logins/with-facebook-login.js +10 -20
- package/dist/es/components/social-logins/with-google-login.js +8 -18
- package/dist/es/components/social-logins/with-linkedin-login.js +7 -12
- package/dist/es/components/social-logins/with-social-login.js +7 -21
- package/dist/es/components/social-logins/with-twitter-login.js +7 -7
- package/dist/es/components/social-share.js +8 -24
- package/dist/es/components/story-element.js +43 -88
- package/dist/es/components/story-elements/brightcove.js +54 -94
- package/dist/es/components/story-elements/dailymotion-embed-script.js +13 -39
- package/dist/es/components/story-elements/dailymotion.js +19 -61
- package/dist/es/components/story-elements/jsembed.js +10 -30
- package/dist/es/components/story-elements/jwPlayer.js +9 -24
- package/dist/es/components/story-elements/polltype.js +6 -20
- package/dist/es/components/story-elements/table.js +16 -34
- package/dist/es/components/story-elements/youtube.js +24 -73
- package/dist/es/components/update-on-interval.js +31 -52
- package/dist/es/components/with-client-side-only.js +3 -4
- package/dist/es/components/with-error.js +7 -20
- package/dist/es/components/with-host-url.js +4 -9
- package/dist/es/components/with-lazy.js +7 -21
- package/dist/es/components/with-member.js +14 -33
- package/dist/es/components/with-preview.js +7 -20
- package/dist/es/components/wrap-collection-layout.js +4 -16
- package/dist/es/store/reducers.js +1 -45
- package/dist/es/utils.js +7 -12
- package/package.json +9 -6
|
@@ -1,30 +1,23 @@
|
|
|
1
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
2
1
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
3
2
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
5
5
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
6
6
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
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; } }
|
|
11
|
-
|
|
7
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
8
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
9
|
import { func, string } from 'prop-types';
|
|
13
10
|
import React from "react";
|
|
14
|
-
|
|
15
11
|
var IntersectionObserverWrapper = /*#__PURE__*/function () {
|
|
16
12
|
function IntersectionObserverWrapper(callback) {
|
|
17
13
|
_classCallCheck(this, IntersectionObserverWrapper);
|
|
18
|
-
|
|
19
14
|
this.observedItems = [];
|
|
20
15
|
this.callback = callback;
|
|
21
16
|
}
|
|
22
|
-
|
|
23
|
-
_createClass(IntersectionObserverWrapper, [{
|
|
17
|
+
return _createClass(IntersectionObserverWrapper, [{
|
|
24
18
|
key: "start",
|
|
25
19
|
value: function start(margin) {
|
|
26
20
|
var _this = this;
|
|
27
|
-
|
|
28
21
|
this.observer = new global.IntersectionObserver(function (entries) {
|
|
29
22
|
return _this.onObservation(entries);
|
|
30
23
|
}, {
|
|
@@ -33,9 +26,8 @@ var IntersectionObserverWrapper = /*#__PURE__*/function () {
|
|
|
33
26
|
});
|
|
34
27
|
this.observedItems.forEach(function (_ref) {
|
|
35
28
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
dom = _ref2[0],
|
|
30
|
+
component = _ref2[1];
|
|
39
31
|
return _this.observer.observe(dom);
|
|
40
32
|
});
|
|
41
33
|
}
|
|
@@ -43,7 +35,6 @@ var IntersectionObserverWrapper = /*#__PURE__*/function () {
|
|
|
43
35
|
key: "onObservation",
|
|
44
36
|
value: function onObservation(entries) {
|
|
45
37
|
var _this2 = this;
|
|
46
|
-
|
|
47
38
|
entries.filter(function (entry) {
|
|
48
39
|
return entry.isIntersecting === undefined || entry.isIntersecting;
|
|
49
40
|
}).map(function (entry) {
|
|
@@ -52,12 +43,9 @@ var IntersectionObserverWrapper = /*#__PURE__*/function () {
|
|
|
52
43
|
var index = _this2.observedItems.findIndex(function (x) {
|
|
53
44
|
return x[0] === dom;
|
|
54
45
|
});
|
|
55
|
-
|
|
56
46
|
if (index > -1) {
|
|
57
47
|
var component = _this2.observedItems[index][1];
|
|
58
|
-
|
|
59
48
|
_this2.callback(component);
|
|
60
|
-
|
|
61
49
|
_this2.unregister(dom, component);
|
|
62
50
|
}
|
|
63
51
|
});
|
|
@@ -74,7 +62,6 @@ var IntersectionObserverWrapper = /*#__PURE__*/function () {
|
|
|
74
62
|
var index = this.observedItems.findIndex(function (x) {
|
|
75
63
|
return x[0] === dom;
|
|
76
64
|
});
|
|
77
|
-
|
|
78
65
|
if (index > -1) {
|
|
79
66
|
this.observedItems.splice(index, 1);
|
|
80
67
|
this.observer && this.observer.unobserve(dom);
|
|
@@ -86,18 +73,13 @@ var IntersectionObserverWrapper = /*#__PURE__*/function () {
|
|
|
86
73
|
this.observer.disconnect();
|
|
87
74
|
}
|
|
88
75
|
}]);
|
|
89
|
-
|
|
90
|
-
return IntersectionObserverWrapper;
|
|
91
76
|
}();
|
|
92
|
-
|
|
93
77
|
var StubObserverWrapper = /*#__PURE__*/function () {
|
|
94
78
|
function StubObserverWrapper(callback) {
|
|
95
79
|
_classCallCheck(this, StubObserverWrapper);
|
|
96
|
-
|
|
97
80
|
this.callback = callback;
|
|
98
81
|
}
|
|
99
|
-
|
|
100
|
-
_createClass(StubObserverWrapper, [{
|
|
82
|
+
return _createClass(StubObserverWrapper, [{
|
|
101
83
|
key: "register",
|
|
102
84
|
value: function register(dom, component) {
|
|
103
85
|
this.callback(component);
|
|
@@ -112,8 +94,6 @@ var StubObserverWrapper = /*#__PURE__*/function () {
|
|
|
112
94
|
key: "disconnect",
|
|
113
95
|
value: function disconnect() {}
|
|
114
96
|
}]);
|
|
115
|
-
|
|
116
|
-
return StubObserverWrapper;
|
|
117
97
|
}();
|
|
118
98
|
/**
|
|
119
99
|
* This component will ensure all {@link ResponsiveImages} that are in its descendent path will be loaded async. By default, the image is loaded with an empty gif, and the image becomes visible when the image scrolls 250 from the edge of the screen.
|
|
@@ -149,29 +129,19 @@ var StubObserverWrapper = /*#__PURE__*/function () {
|
|
|
149
129
|
* @component
|
|
150
130
|
* @category Images
|
|
151
131
|
*/
|
|
152
|
-
|
|
153
|
-
|
|
154
132
|
export var LazyLoadImages = /*#__PURE__*/function (_React$Component) {
|
|
155
|
-
_inherits(LazyLoadImages, _React$Component);
|
|
156
|
-
|
|
157
|
-
var _super = /*#__PURE__*/_createSuper(LazyLoadImages);
|
|
158
|
-
|
|
159
133
|
function LazyLoadImages(props) {
|
|
160
134
|
var _this3;
|
|
161
|
-
|
|
162
135
|
_classCallCheck(this, LazyLoadImages);
|
|
163
|
-
|
|
164
|
-
_this3 = _super.call(this, props);
|
|
165
|
-
|
|
136
|
+
_this3 = _callSuper(this, LazyLoadImages, [props]);
|
|
166
137
|
var callback = function callback(component) {
|
|
167
138
|
return component.showImage();
|
|
168
139
|
};
|
|
169
|
-
|
|
170
140
|
_this3.observerWrapper = global.IntersectionObserver ? new IntersectionObserverWrapper(callback) : new StubObserverWrapper(callback);
|
|
171
141
|
return _this3;
|
|
172
142
|
}
|
|
173
|
-
|
|
174
|
-
_createClass(LazyLoadImages, [{
|
|
143
|
+
_inherits(LazyLoadImages, _React$Component);
|
|
144
|
+
return _createClass(LazyLoadImages, [{
|
|
175
145
|
key: "componentDidMount",
|
|
176
146
|
value: function componentDidMount() {
|
|
177
147
|
this.observerWrapper.start(this.props.margin || "500px");
|
|
@@ -185,7 +155,6 @@ export var LazyLoadImages = /*#__PURE__*/function (_React$Component) {
|
|
|
185
155
|
key: "getChildContext",
|
|
186
156
|
value: function getChildContext() {
|
|
187
157
|
var _this4 = this;
|
|
188
|
-
|
|
189
158
|
return {
|
|
190
159
|
lazyLoadObserveImage: function lazyLoadObserveImage(dom, component) {
|
|
191
160
|
return dom && _this4.observerWrapper.register(dom, component);
|
|
@@ -201,8 +170,6 @@ export var LazyLoadImages = /*#__PURE__*/function (_React$Component) {
|
|
|
201
170
|
return this.props.children;
|
|
202
171
|
}
|
|
203
172
|
}]);
|
|
204
|
-
|
|
205
|
-
return LazyLoadImages;
|
|
206
173
|
}(React.Component);
|
|
207
174
|
LazyLoadImages.childContextTypes = {
|
|
208
175
|
lazyLoadObserveImage: func,
|
|
@@ -2,11 +2,11 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
2
2
|
var _excluded = ["navigateToImpl", "externalLink", "callback", "href", "currentHostUrl", "navigateTo", "preventDefault", "disableAjaxLinks"];
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { string, func, bool } from "prop-types";
|
|
5
|
-
|
|
6
5
|
var preventDefaultImpl = function preventDefaultImpl(e) {
|
|
7
6
|
e.preventDefault();
|
|
8
7
|
e.stopPropagation();
|
|
9
8
|
};
|
|
9
|
+
|
|
10
10
|
/**
|
|
11
11
|
* This component generates an anchor tag. Instead of doing a browser page load, it will go to the next page via AJAX. Analytics scripts will be fired correctly (and if not, it's a bug)
|
|
12
12
|
* LinkBase is not connected to the store or plugged to context, this is used as an alternative for usecases such as partial hydration where context is lost.
|
|
@@ -18,21 +18,18 @@ var preventDefaultImpl = function preventDefaultImpl(e) {
|
|
|
18
18
|
* @category Other
|
|
19
19
|
* @component
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
21
|
export var LinkBase = function LinkBase(_ref) {
|
|
24
22
|
var navigateToImpl = _ref.navigateToImpl,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
externalLink = _ref.externalLink,
|
|
24
|
+
callback = _ref.callback,
|
|
25
|
+
href = _ref.href,
|
|
26
|
+
currentHostUrl = _ref.currentHostUrl,
|
|
27
|
+
navigateTo = _ref.navigateTo,
|
|
28
|
+
_ref$preventDefault = _ref.preventDefault,
|
|
29
|
+
preventDefault = _ref$preventDefault === void 0 ? preventDefaultImpl : _ref$preventDefault,
|
|
30
|
+
_ref$disableAjaxLinks = _ref.disableAjaxLinks,
|
|
31
|
+
disableAjaxLinks = _ref$disableAjaxLinks === void 0 ? global.disableAjaxLinks || global.disableAjaxNavigation : _ref$disableAjaxLinks,
|
|
32
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
36
33
|
navigateTo = navigateTo || navigateToImpl;
|
|
37
34
|
return /*#__PURE__*/React.createElement("a", Object.assign(otherProps, {
|
|
38
35
|
href: href,
|
|
@@ -40,21 +37,16 @@ export var LinkBase = function LinkBase(_ref) {
|
|
|
40
37
|
if (disableAjaxLinks || e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
41
38
|
return;
|
|
42
39
|
}
|
|
43
|
-
|
|
44
40
|
var relativeLink = href.startsWith(currentHostUrl) ? href.replace(currentHostUrl, "") : href;
|
|
45
|
-
|
|
46
41
|
if (!relativeLink.startsWith("/")) {
|
|
47
42
|
return;
|
|
48
43
|
}
|
|
49
|
-
|
|
50
44
|
preventDefault(e);
|
|
51
|
-
|
|
52
45
|
if (externalLink) {
|
|
53
46
|
global.open(externalLink, "_blank");
|
|
54
47
|
} else {
|
|
55
48
|
navigateTo(relativeLink);
|
|
56
49
|
}
|
|
57
|
-
|
|
58
50
|
typeof callback === "function" && callback(e);
|
|
59
51
|
}
|
|
60
52
|
}));
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { connect } from "react-redux";
|
|
2
2
|
import { LinkBase } from "./link-base";
|
|
3
|
-
|
|
4
3
|
var mapStateToProps = function mapStateToProps(state) {
|
|
5
4
|
return {
|
|
6
5
|
currentHostUrl: state.qt && state.qt.currentHostUrl
|
|
7
6
|
};
|
|
8
7
|
};
|
|
9
|
-
|
|
10
8
|
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
11
9
|
return {
|
|
12
10
|
navigateToImpl: function navigateToImpl(url) {
|
|
@@ -14,6 +12,7 @@ var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
|
14
12
|
}
|
|
15
13
|
};
|
|
16
14
|
};
|
|
15
|
+
|
|
17
16
|
/**
|
|
18
17
|
* This component generates an anchor tag. Instead of doing a browser page load, it will go to the next page via AJAX. Analytics scripts will be fired correctly (and if not, it's a bug)
|
|
19
18
|
*
|
|
@@ -24,6 +23,4 @@ var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
|
24
23
|
* @category Other
|
|
25
24
|
* @component
|
|
26
25
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
26
|
export var Link = /*#__PURE__*/connect(mapStateToProps, mapDispatchToProps)(LinkBase);
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
3
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
4
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
|
|
7
|
-
function
|
|
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
|
-
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
7
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
8
|
import React from 'react';
|
|
12
9
|
import get from "lodash/get";
|
|
13
10
|
import { getRequest } from './api-client';
|
|
14
11
|
import { LoadMoreStoriesManager } from './impl/load-more-stories-manager';
|
|
12
|
+
|
|
15
13
|
/**
|
|
16
14
|
* This component is very similar to the {@link LoadMoreBase} component but fetches the stories from a `collection`. The api call `/api/v1/collections/{collectionSlug}` is made with the passed collection slug value. The component accepts the `params` prop and a requires a Collection Slug from which to fetch the stories and returns a set of stories only.
|
|
17
15
|
*
|
|
@@ -47,19 +45,13 @@ import { LoadMoreStoriesManager } from './impl/load-more-stories-manager';
|
|
|
47
45
|
* @component
|
|
48
46
|
* @category Collection Page
|
|
49
47
|
*/
|
|
50
|
-
|
|
51
48
|
export var LoadMoreCollectionStories = /*#__PURE__*/function (_React$Component) {
|
|
52
|
-
_inherits(LoadMoreCollectionStories, _React$Component);
|
|
53
|
-
|
|
54
|
-
var _super = /*#__PURE__*/_createSuper(LoadMoreCollectionStories);
|
|
55
|
-
|
|
56
49
|
function LoadMoreCollectionStories() {
|
|
57
50
|
_classCallCheck(this, LoadMoreCollectionStories);
|
|
58
|
-
|
|
59
|
-
return _super.apply(this, arguments);
|
|
51
|
+
return _callSuper(this, LoadMoreCollectionStories, arguments);
|
|
60
52
|
}
|
|
61
|
-
|
|
62
|
-
_createClass(LoadMoreCollectionStories, [{
|
|
53
|
+
_inherits(LoadMoreCollectionStories, _React$Component);
|
|
54
|
+
return _createClass(LoadMoreCollectionStories, [{
|
|
63
55
|
key: "loadMoreStories",
|
|
64
56
|
value: function loadMoreStories(pageNumber) {
|
|
65
57
|
var stories = get(this.props, ['data', 'stories'], []);
|
|
@@ -78,7 +70,6 @@ export var LoadMoreCollectionStories = /*#__PURE__*/function (_React$Component)
|
|
|
78
70
|
key: "render",
|
|
79
71
|
value: function render() {
|
|
80
72
|
var _this = this;
|
|
81
|
-
|
|
82
73
|
return /*#__PURE__*/React.createElement(LoadMoreStoriesManager, Object.assign({}, this.props.data, {
|
|
83
74
|
template: this.props.template,
|
|
84
75
|
loadStories: function loadStories(pageNumber) {
|
|
@@ -89,6 +80,4 @@ export var LoadMoreCollectionStories = /*#__PURE__*/function (_React$Component)
|
|
|
89
80
|
}));
|
|
90
81
|
}
|
|
91
82
|
}]);
|
|
92
|
-
|
|
93
|
-
return LoadMoreCollectionStories;
|
|
94
83
|
}(React.Component);
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
3
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
4
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
|
|
7
|
-
function
|
|
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
|
-
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
7
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
8
|
import React from 'react';
|
|
12
9
|
import get from "lodash/get";
|
|
13
10
|
import { getRequest } from './api-client';
|
|
@@ -39,23 +36,16 @@ import { LoadMoreStoriesManager } from './impl/load-more-stories-manager';
|
|
|
39
36
|
* @component
|
|
40
37
|
* @category Collection Page
|
|
41
38
|
*/
|
|
42
|
-
|
|
43
39
|
export var LoadMoreStoriesBase = /*#__PURE__*/function (_React$Component) {
|
|
44
|
-
_inherits(LoadMoreStoriesBase, _React$Component);
|
|
45
|
-
|
|
46
|
-
var _super = /*#__PURE__*/_createSuper(LoadMoreStoriesBase);
|
|
47
|
-
|
|
48
40
|
function LoadMoreStoriesBase() {
|
|
49
41
|
_classCallCheck(this, LoadMoreStoriesBase);
|
|
50
|
-
|
|
51
|
-
return _super.apply(this, arguments);
|
|
42
|
+
return _callSuper(this, LoadMoreStoriesBase, arguments);
|
|
52
43
|
}
|
|
53
|
-
|
|
54
|
-
_createClass(LoadMoreStoriesBase, [{
|
|
44
|
+
_inherits(LoadMoreStoriesBase, _React$Component);
|
|
45
|
+
return _createClass(LoadMoreStoriesBase, [{
|
|
55
46
|
key: "loadMoreStories",
|
|
56
47
|
value: function loadMoreStories(pageNumber) {
|
|
57
48
|
var _this = this;
|
|
58
|
-
|
|
59
49
|
var stories = get(this.props, ['data', 'stories'], []);
|
|
60
50
|
return getRequest(this.props.api || '/api/v1/stories', Object.assign({}, this.props.params, {
|
|
61
51
|
offset: this.props.numStoriesToLoad * (pageNumber - 1) + stories.length,
|
|
@@ -65,7 +55,6 @@ export var LoadMoreStoriesBase = /*#__PURE__*/function (_React$Component) {
|
|
|
65
55
|
if (_this.props.apiResponseTransformer) {
|
|
66
56
|
return _this.props.apiResponseTransformer(response);
|
|
67
57
|
}
|
|
68
|
-
|
|
69
58
|
return response.stories || get(response, ['results', 'stories'], []);
|
|
70
59
|
});
|
|
71
60
|
}
|
|
@@ -73,7 +62,6 @@ export var LoadMoreStoriesBase = /*#__PURE__*/function (_React$Component) {
|
|
|
73
62
|
key: "render",
|
|
74
63
|
value: function render() {
|
|
75
64
|
var _this2 = this;
|
|
76
|
-
|
|
77
65
|
return /*#__PURE__*/React.createElement(LoadMoreStoriesManager, Object.assign({}, this.props.data, {
|
|
78
66
|
template: this.props.template,
|
|
79
67
|
loadStories: function loadStories(pageNumber) {
|
|
@@ -84,6 +72,4 @@ export var LoadMoreStoriesBase = /*#__PURE__*/function (_React$Component) {
|
|
|
84
72
|
}));
|
|
85
73
|
}
|
|
86
74
|
}]);
|
|
87
|
-
|
|
88
|
-
return LoadMoreStoriesBase;
|
|
89
75
|
}(React.Component);
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
|
-
|
|
4
3
|
function LoadingIndicatorBase(props) {
|
|
5
4
|
return /*#__PURE__*/React.createElement("div", {
|
|
6
5
|
className: "loading-indicator ".concat(props.loading ? "loading-indicator-loading" : "")
|
|
7
6
|
}, props.loading && props.children);
|
|
8
7
|
}
|
|
9
|
-
|
|
10
8
|
function mapStateToProps(state) {
|
|
11
9
|
return {
|
|
12
10
|
loading: state.pageLoading
|
|
13
11
|
};
|
|
14
12
|
}
|
|
15
|
-
|
|
16
13
|
function mapDispatchToProps() {
|
|
17
14
|
return {};
|
|
18
15
|
}
|
|
16
|
+
|
|
19
17
|
/**
|
|
20
18
|
* This component renders it's children when the app is moving between pages. It can be used to show a spinner. It always has the class "loading-indicator", and also "loading-indicator-loading" when loading.
|
|
21
19
|
*
|
|
@@ -30,6 +28,4 @@ function mapDispatchToProps() {
|
|
|
30
28
|
* @component
|
|
31
29
|
* @category Other
|
|
32
30
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
31
|
export var LoadingIndicator = /*#__PURE__*/connect(mapStateToProps, mapDispatchToProps)(LoadingIndicatorBase);
|
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Link } from "./link";
|
|
3
|
+
|
|
3
4
|
/**
|
|
4
5
|
* @see {@link Menu}
|
|
5
6
|
* @deprecated
|
|
6
7
|
* @component
|
|
7
8
|
* @category Header
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
10
|
export function MenuItem(_ref) {
|
|
11
11
|
var item = _ref.item,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
className = _ref.className,
|
|
13
|
+
currentUrl = _ref.currentUrl;
|
|
14
14
|
var url = getRelativeUrl(item.url);
|
|
15
15
|
return /*#__PURE__*/React.createElement("li", null, getMenuItemBody(item, "".concat(className).concat(currentUrl == url ? " active" : ""), url));
|
|
16
16
|
}
|
|
17
|
-
|
|
18
17
|
function getRelativeUrl(url) {
|
|
19
18
|
var _URL = new URL(url),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
pathname = _URL.pathname,
|
|
20
|
+
search = _URL.search,
|
|
21
|
+
hash = _URL.hash;
|
|
24
22
|
return "".concat(pathname).concat(search || "").concat(hash || "");
|
|
25
23
|
}
|
|
26
|
-
|
|
27
24
|
function getMenuItemBody(item, className, url, currentUrl) {
|
|
28
25
|
switch (item['item-type']) {
|
|
29
26
|
case 'section':
|
|
@@ -31,7 +28,6 @@ function getMenuItemBody(item, className, url, currentUrl) {
|
|
|
31
28
|
href: url,
|
|
32
29
|
className: className
|
|
33
30
|
}, item.title);
|
|
34
|
-
|
|
35
31
|
default:
|
|
36
32
|
return /*#__PURE__*/React.createElement("a", {
|
|
37
33
|
href: item.url,
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
|
-
|
|
4
3
|
function MenuBase(_ref) {
|
|
5
4
|
var children = _ref.children,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
className = _ref.className,
|
|
6
|
+
itemClassName = _ref.itemClassName,
|
|
7
|
+
items = _ref.items,
|
|
8
|
+
currentUrl = _ref.currentUrl,
|
|
9
|
+
slice = _ref.slice;
|
|
11
10
|
items = items.slice.apply(items, slice);
|
|
12
11
|
return /*#__PURE__*/React.createElement("ul", {
|
|
13
12
|
className: className
|
|
@@ -20,13 +19,13 @@ function MenuBase(_ref) {
|
|
|
20
19
|
});
|
|
21
20
|
}));
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
function mapStateToProps(state) {
|
|
25
23
|
return {
|
|
26
24
|
items: state.qt.config.layout.menu,
|
|
27
25
|
currentUrl: state.qt.currentPath
|
|
28
26
|
};
|
|
29
27
|
}
|
|
28
|
+
|
|
30
29
|
/**
|
|
31
30
|
* This component can be used to render a menu from the menuItems in the editor. An extra class called active is applied if the menu item is the current url. By default, links will resolve via AJAX.
|
|
32
31
|
*
|
|
@@ -48,8 +47,6 @@ function mapStateToProps(state) {
|
|
|
48
47
|
* @component
|
|
49
48
|
* @category Header
|
|
50
49
|
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
50
|
export var Menu = /*#__PURE__*/connect(mapStateToProps, function () {
|
|
54
51
|
return {};
|
|
55
52
|
})(MenuBase);
|
|
@@ -2,6 +2,7 @@ import omit from "@babel/runtime/helpers/objectWithoutProperties";
|
|
|
2
2
|
import get from "lodash/get";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { ResponsiveImage } from "./responsive-image";
|
|
5
|
+
|
|
5
6
|
/**
|
|
6
7
|
* This component is a wrapper over {@link ResponsiveImages}. It accepts story as a prop and renders story's hero image.
|
|
7
8
|
* If hero-image-s3-key is present, it takes that as slug and the story headline as image alt text.
|
|
@@ -20,13 +21,11 @@ import { ResponsiveImage } from "./responsive-image";
|
|
|
20
21
|
* @component
|
|
21
22
|
* @category Images
|
|
22
23
|
*/
|
|
23
|
-
|
|
24
24
|
export function ResponsiveHeroImage(props) {
|
|
25
25
|
var metadata, slug, alternateText;
|
|
26
26
|
var heroImageS3Key = get(props, ["story", "hero-image-s3-key"], "");
|
|
27
27
|
var storyAlternateData = get(props, ["story", "alternative", "home", "default"], {}) || {};
|
|
28
28
|
var alternateHeroImageS3Key = get(storyAlternateData, ["hero-image", "hero-image-s3-key"], "");
|
|
29
|
-
|
|
30
29
|
if (heroImageS3Key) {
|
|
31
30
|
slug = heroImageS3Key;
|
|
32
31
|
metadata = get(props, ["story", "hero-image-metadata"], {});
|
|
@@ -36,7 +35,6 @@ export function ResponsiveHeroImage(props) {
|
|
|
36
35
|
metadata = get(storyAlternateData, ["hero-image", "hero-image-metadata"], {});
|
|
37
36
|
alternateText = get(storyAlternateData, ["headline"], "");
|
|
38
37
|
} else return null;
|
|
39
|
-
|
|
40
38
|
return /*#__PURE__*/React.createElement(ResponsiveImage, Object.assign({
|
|
41
39
|
slug: slug,
|
|
42
40
|
metadata: metadata,
|
|
@@ -3,26 +3,21 @@ import React from 'react';
|
|
|
3
3
|
import { connect } from 'react-redux';
|
|
4
4
|
import { GumletImage } from './impl/gumlet-image';
|
|
5
5
|
import { ThumborImage } from './impl/thumbor-image';
|
|
6
|
-
|
|
7
6
|
function mapStateToProps(state) {
|
|
8
7
|
return {
|
|
9
8
|
imageCDN: state.qt.config['cdn-image'],
|
|
10
9
|
imageCDNFormat: state.qt.config['image-cdn-format'] || 'thumbor'
|
|
11
10
|
};
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
function ResponsiveImageBase(props) {
|
|
15
13
|
if (process.env.NODE_ENV == 'development' && !props.alt && !props.reactTag) {
|
|
16
14
|
global.console && global.console.warn("Image Found without an alt attribute: ".concat(props.slug));
|
|
17
15
|
}
|
|
18
|
-
|
|
19
16
|
if (props.imageCDNFormat === 'gumlet') {
|
|
20
17
|
return /*#__PURE__*/React.createElement(GumletImage, props);
|
|
21
18
|
}
|
|
22
|
-
|
|
23
19
|
return /*#__PURE__*/React.createElement(ThumborImage, props);
|
|
24
20
|
}
|
|
25
|
-
|
|
26
21
|
/**
|
|
27
22
|
* This component takes an image, and resizes it to the correct aspect ratio using imgix or thumbor.
|
|
28
23
|
*
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ResponsiveImage } from './responsive-image';
|
|
3
|
+
|
|
3
4
|
/**
|
|
4
5
|
* This component is to be used if the aspect of an images changes significantly between different devices.
|
|
5
6
|
*
|
|
@@ -32,7 +33,6 @@ import { ResponsiveImage } from './responsive-image';
|
|
|
32
33
|
* @component
|
|
33
34
|
* @category Images
|
|
34
35
|
*/
|
|
35
|
-
|
|
36
36
|
export var ResponsiveSource = function ResponsiveSource(props) {
|
|
37
37
|
return /*#__PURE__*/React.createElement(ResponsiveImage, Object.assign({
|
|
38
38
|
reactTag: 'source',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { bool, element, number, string } from "prop-types";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { StarIcon } from "./star-icon";
|
|
4
|
+
|
|
4
5
|
/**
|
|
5
6
|
* This component takes in the value for rating and renders star for the value passed in. This comopent is generally used for story review type.
|
|
6
7
|
*
|
|
@@ -14,31 +15,29 @@ import { StarIcon } from "./star-icon";
|
|
|
14
15
|
* @component
|
|
15
16
|
* @category Story Page
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
18
|
export function ReviewRating(_ref) {
|
|
19
19
|
var value = _ref.value,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
20
|
+
_ref$canShowEmptyRati = _ref.canShowEmptyRating,
|
|
21
|
+
canShowEmptyRating = _ref$canShowEmptyRati === void 0 ? false : _ref$canShowEmptyRati,
|
|
22
|
+
_ref$size = _ref.size,
|
|
23
|
+
size = _ref$size === void 0 ? 20 : _ref$size,
|
|
24
|
+
_ref$activeColor = _ref.activeColor,
|
|
25
|
+
activeColor = _ref$activeColor === void 0 ? "gold" : _ref$activeColor,
|
|
26
|
+
_ref$inActiveColor = _ref.inActiveColor,
|
|
27
|
+
inActiveColor = _ref$inActiveColor === void 0 ? "gray" : _ref$inActiveColor,
|
|
28
|
+
_ref$count = _ref.count,
|
|
29
|
+
count = _ref$count === void 0 ? 5 : _ref$count,
|
|
30
|
+
_ref$showHalfStar = _ref.showHalfStar,
|
|
31
|
+
showHalfStar = _ref$showHalfStar === void 0 ? true : _ref$showHalfStar,
|
|
32
|
+
_ref$className = _ref.className,
|
|
33
|
+
className = _ref$className === void 0 ? "review-rating" : _ref$className,
|
|
34
|
+
_ref$activeSymbol = _ref.activeSymbol,
|
|
35
|
+
activeSymbol = _ref$activeSymbol === void 0 ? null : _ref$activeSymbol,
|
|
36
|
+
_ref$inActiveSymbol = _ref.inActiveSymbol,
|
|
37
|
+
inActiveSymbol = _ref$inActiveSymbol === void 0 ? null : _ref$inActiveSymbol,
|
|
38
|
+
_ref$halfActiveSymbol = _ref.halfActiveSymbol,
|
|
39
|
+
halfActiveSymbol = _ref$halfActiveSymbol === void 0 ? null : _ref$halfActiveSymbol;
|
|
40
40
|
if (!canShowEmptyRating && value < 0.1) return null;
|
|
41
|
-
|
|
42
41
|
var activeComponent = function activeComponent(index) {
|
|
43
42
|
return activeSymbol ? /*#__PURE__*/React.cloneElement(activeSymbol, {
|
|
44
43
|
size: size,
|
|
@@ -55,7 +54,6 @@ export function ReviewRating(_ref) {
|
|
|
55
54
|
"data-test-id": "star-icon"
|
|
56
55
|
});
|
|
57
56
|
};
|
|
58
|
-
|
|
59
57
|
var inActiveComponent = function inActiveComponent(index) {
|
|
60
58
|
return inActiveSymbol ? /*#__PURE__*/React.cloneElement(inActiveSymbol, {
|
|
61
59
|
size: size,
|
|
@@ -71,7 +69,6 @@ export function ReviewRating(_ref) {
|
|
|
71
69
|
key: "review-".concat(index)
|
|
72
70
|
});
|
|
73
71
|
};
|
|
74
|
-
|
|
75
72
|
var halfActiveComponent = function halfActiveComponent(index) {
|
|
76
73
|
return halfActiveSymbol ? /*#__PURE__*/React.cloneElement(halfActiveSymbol, {
|
|
77
74
|
size: size,
|
|
@@ -87,9 +84,7 @@ export function ReviewRating(_ref) {
|
|
|
87
84
|
key: "review-".concat(index)
|
|
88
85
|
});
|
|
89
86
|
};
|
|
90
|
-
|
|
91
87
|
var children = [];
|
|
92
|
-
|
|
93
88
|
for (var i = 1; i <= count; i++) {
|
|
94
89
|
if (i <= Math.floor(value)) {
|
|
95
90
|
children.push(activeComponent(i));
|
|
@@ -99,7 +94,6 @@ export function ReviewRating(_ref) {
|
|
|
99
94
|
children.push(inActiveComponent(i));
|
|
100
95
|
}
|
|
101
96
|
}
|
|
102
|
-
|
|
103
97
|
return /*#__PURE__*/React.createElement("div", {
|
|
104
98
|
className: className
|
|
105
99
|
}, children);
|