@quintype/components 3.0.3-test-react18.0 → 3.0.3-test-react18.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.
Files changed (58) hide show
  1. package/dist/cjs/index.js +330 -1044
  2. package/dist/es/components/access-type.js +51 -229
  3. package/dist/es/components/adbutler-ad.js +10 -14
  4. package/dist/es/components/api-client.js +4 -6
  5. package/dist/es/components/breaking-news-item.js +2 -3
  6. package/dist/es/components/breaking-news.js +1 -15
  7. package/dist/es/components/client-side-only.js +14 -26
  8. package/dist/es/components/collection.js +5 -5
  9. package/dist/es/components/dfp-ad.js +23 -30
  10. package/dist/es/components/eager-load-images.js +1 -9
  11. package/dist/es/components/hamburger-button.js +2 -5
  12. package/dist/es/components/image-gallery.js +10 -13
  13. package/dist/es/components/impl/collection-impl.js +2 -8
  14. package/dist/es/components/impl/gumlet-image.js +8 -15
  15. package/dist/es/components/impl/image-utils.js +3 -3
  16. package/dist/es/components/impl/load-more-stories-manager.js +0 -11
  17. package/dist/es/components/impl/thumbor-image.js +0 -15
  18. package/dist/es/components/infinite-scroll.js +3 -51
  19. package/dist/es/components/infinite-story-base.js +1 -16
  20. package/dist/es/components/lazy-collection.js +8 -8
  21. package/dist/es/components/lazy-load-images.js +36 -66
  22. package/dist/es/components/link-base.js +11 -19
  23. package/dist/es/components/link.js +1 -4
  24. package/dist/es/components/load-more-collection-stories.js +1 -10
  25. package/dist/es/components/load-more-stories-base.js +0 -12
  26. package/dist/es/components/loading-indicator.js +1 -5
  27. package/dist/es/components/menu-item.js +6 -10
  28. package/dist/es/components/menu.js +6 -9
  29. package/dist/es/components/responsive-hero-image.js +1 -3
  30. package/dist/es/components/responsive-image.js +0 -5
  31. package/dist/es/components/responsive-source.js +1 -1
  32. package/dist/es/components/review-rating/review-rating.js +21 -27
  33. package/dist/es/components/review-rating/star-icon.js +3 -5
  34. package/dist/es/components/search-box.js +1 -15
  35. package/dist/es/components/search-page-base.js +1 -10
  36. package/dist/es/components/social-logins/with-facebook-login.js +10 -20
  37. package/dist/es/components/social-logins/with-google-login.js +8 -18
  38. package/dist/es/components/social-logins/with-linkedin-login.js +7 -12
  39. package/dist/es/components/social-logins/with-social-login.js +1 -13
  40. package/dist/es/components/social-logins/with-twitter-login.js +7 -7
  41. package/dist/es/components/social-share.js +1 -15
  42. package/dist/es/components/story-element.js +27 -66
  43. package/dist/es/components/story-elements/dailymotion.js +2 -30
  44. package/dist/es/components/story-elements/jsembed.js +0 -17
  45. package/dist/es/components/story-elements/polltype.js +0 -12
  46. package/dist/es/components/story-elements/table.js +4 -20
  47. package/dist/es/components/story-elements/youtube.js +9 -45
  48. package/dist/es/components/update-on-interval.js +1 -18
  49. package/dist/es/components/with-client-side-only.js +3 -4
  50. package/dist/es/components/with-error.js +1 -12
  51. package/dist/es/components/with-host-url.js +4 -9
  52. package/dist/es/components/with-lazy.js +1 -13
  53. package/dist/es/components/with-member.js +7 -23
  54. package/dist/es/components/with-preview.js +1 -12
  55. package/dist/es/components/wrap-collection-layout.js +4 -16
  56. package/dist/es/store/reducers.js +1 -45
  57. package/dist/es/utils.js +7 -12
  58. package/package.json +6 -4
@@ -1,34 +1,31 @@
1
1
  import { func, string } from "prop-types";
2
2
  import { connect } from "react-redux";
3
-
4
3
  function WithHostUrlBase(_ref) {
5
4
  var children = _ref.children,
6
- primaryHostUrl = _ref.primaryHostUrl,
7
- currentHostUrl = _ref.currentHostUrl;
5
+ primaryHostUrl = _ref.primaryHostUrl,
6
+ currentHostUrl = _ref.currentHostUrl;
8
7
  return children({
9
8
  primaryHostUrl: primaryHostUrl,
10
9
  currentHostUrl: currentHostUrl
11
10
  });
12
11
  }
13
-
14
12
  WithHostUrlBase.propTypes = {
15
13
  children: func.isRequired,
16
14
  primaryHostUrl: string,
17
15
  currentHostUrl: string
18
16
  };
19
-
20
17
  function mapStateToProps(_ref2) {
21
18
  var _ref2$qt = _ref2.qt,
22
- qt = _ref2$qt === void 0 ? {} : _ref2$qt;
19
+ qt = _ref2$qt === void 0 ? {} : _ref2$qt;
23
20
  return {
24
21
  primaryHostUrl: qt.primaryHostUrl,
25
22
  currentHostUrl: qt.currentHostUrl
26
23
  };
27
24
  }
28
-
29
25
  function mapDispatchToProps(dispatch) {
30
26
  return {};
31
27
  }
28
+
32
29
  /**
33
30
  * This component can be used to get access to the `currentHostUrl` and `primaryHostUrl`, as configured within the editor.
34
31
  *
@@ -46,6 +43,4 @@ function mapDispatchToProps(dispatch) {
46
43
  * @component
47
44
  * @category Other
48
45
  */
49
-
50
-
51
46
  export var WithHostUrl = /*#__PURE__*/connect(mapStateToProps, mapDispatchToProps)(WithHostUrlBase);
@@ -3,13 +3,11 @@ import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/inherits";
4
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
-
7
6
  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
7
  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
-
11
8
  import { func, number, string } from 'prop-types';
12
9
  import React from 'react';
10
+
13
11
  /**
14
12
  * 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`.
15
13
  *
@@ -25,17 +23,12 @@ import React from 'react';
25
23
  * @hideconstructor
26
24
  * @category Other
27
25
  */
28
-
29
26
  export var WithLazy = /*#__PURE__*/function (_React$Component) {
30
27
  _inherits(WithLazy, _React$Component);
31
-
32
28
  var _super = /*#__PURE__*/_createSuper(WithLazy);
33
-
34
29
  function WithLazy(props) {
35
30
  var _this;
36
-
37
31
  _classCallCheck(this, WithLazy);
38
-
39
32
  _this = _super.call(this, props);
40
33
  _this.state = {
41
34
  loaded: false
@@ -43,7 +36,6 @@ export var WithLazy = /*#__PURE__*/function (_React$Component) {
43
36
  _this.observerRef = /*#__PURE__*/React.createRef();
44
37
  return _this;
45
38
  }
46
-
47
39
  _createClass(WithLazy, [{
48
40
  key: "render",
49
41
  value: function render() {
@@ -62,7 +54,6 @@ export var WithLazy = /*#__PURE__*/function (_React$Component) {
62
54
  key: "componentDidMount",
63
55
  value: function componentDidMount() {
64
56
  var _this2 = this;
65
-
66
57
  this.observer = new global.IntersectionObserver(function (entries, observer) {
67
58
  return _this2.observerCallback(entries, observer);
68
59
  }, {
@@ -79,18 +70,15 @@ export var WithLazy = /*#__PURE__*/function (_React$Component) {
79
70
  key: "observerCallback",
80
71
  value: function observerCallback(entries, observer) {
81
72
  var _this3 = this;
82
-
83
73
  entries.forEach(function (entry) {
84
74
  if (entry.isIntersecting || entry.isIntersecting === undefined) {
85
75
  _this3.setState({
86
76
  loaded: true
87
77
  });
88
-
89
78
  observer.disconnect();
90
79
  }
91
80
  });
92
81
  }
93
82
  }]);
94
-
95
83
  return WithLazy;
96
84
  }(React.Component);
@@ -4,38 +4,28 @@ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized
4
4
  import _inherits from "@babel/runtime/helpers/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
-
8
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); }; }
9
-
10
8
  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
-
12
9
  import { bool, func } from "prop-types";
13
10
  import React from "react";
14
11
  import { connect } from "react-redux";
15
12
  import { MEMBER_BEING_LOADED, MEMBER_UPDATED } from '../store/actions';
16
13
  import { getRequest } from './api-client';
17
14
  var loadedMember = false;
18
-
19
15
  var WithMemberBase = /*#__PURE__*/function (_React$Component) {
20
16
  _inherits(WithMemberBase, _React$Component);
21
-
22
17
  var _super = /*#__PURE__*/_createSuper(WithMemberBase);
23
-
24
18
  function WithMemberBase(props) {
25
19
  var _this;
26
-
27
20
  _classCallCheck(this, WithMemberBase);
28
-
29
21
  _this = _super.call(this, props);
30
22
  _this.checkForMemberUpdated = _this.checkForMemberUpdated.bind(_assertThisInitialized(_this));
31
23
  return _this;
32
24
  }
33
-
34
25
  _createClass(WithMemberBase, [{
35
26
  key: "checkForMemberUpdated",
36
27
  value: function checkForMemberUpdated() {
37
28
  var _this2 = this;
38
-
39
29
  this.props.memberBeingLoaded();
40
30
  var requestUrl = this.props.isBridgekeeperEnabled ? "/api/auth/v1/users/me" : "/api/v1/members/me";
41
31
  return getRequest(requestUrl).forbidden(function () {
@@ -44,9 +34,8 @@ var WithMemberBase = /*#__PURE__*/function (_React$Component) {
44
34
  return _this2.props.memberUpdated(null);
45
35
  }).json(function (_ref) {
46
36
  var member = _ref.member,
47
- user = _ref.user;
37
+ user = _ref.user;
48
38
  var memberObj = _this2.props.isBridgekeeperEnabled ? user : member;
49
-
50
39
  _this2.props.memberUpdated(memberObj);
51
40
  });
52
41
  }
@@ -62,10 +51,10 @@ var WithMemberBase = /*#__PURE__*/function (_React$Component) {
62
51
  key: "render",
63
52
  value: function render() {
64
53
  var _this$props = this.props,
65
- member = _this$props.member,
66
- logout = _this$props.logout,
67
- children = _this$props.children,
68
- isLoading = _this$props.isLoading;
54
+ member = _this$props.member,
55
+ logout = _this$props.logout,
56
+ children = _this$props.children,
57
+ isLoading = _this$props.isLoading;
69
58
  return children({
70
59
  member: member,
71
60
  logout: logout,
@@ -74,24 +63,20 @@ var WithMemberBase = /*#__PURE__*/function (_React$Component) {
74
63
  });
75
64
  }
76
65
  }]);
77
-
78
66
  return WithMemberBase;
79
67
  }(React.Component);
80
-
81
68
  WithMemberBase.defaultProps = {
82
69
  isBridgekeeperEnabled: false
83
70
  };
84
-
85
71
  function mapStateToProps(_ref2) {
86
72
  var member = _ref2.member,
87
- memberLoading = _ref2.memberLoading;
73
+ memberLoading = _ref2.memberLoading;
88
74
  return {
89
75
  member: member || null,
90
76
  // undefined on server side
91
77
  isLoading: memberLoading === true || memberLoading === undefined
92
78
  };
93
79
  }
94
-
95
80
  function mapDispatchToProps(dispatch, ownProps) {
96
81
  var logoutRequestUrl = ownProps.isBridgekeeperEnabled ? "/api/auth/v1/logout" : "/api/logout";
97
82
  return {
@@ -116,6 +101,7 @@ function mapDispatchToProps(dispatch, ownProps) {
116
101
  }
117
102
  };
118
103
  }
104
+
119
105
  /**
120
106
  * This is a render props component which will call your callback with the current logged in member. It will automatically call `/api/v1/members/me` to figure out if you are logged in, and replace the contents in the store and callback. In future, this may use LocalStorage to cache the member for some time.
121
107
  *
@@ -144,6 +130,4 @@ function mapDispatchToProps(dispatch, ownProps) {
144
130
  * @component
145
131
  * @category Login
146
132
  */
147
-
148
-
149
133
  export var WithMember = /*#__PURE__*/connect(mapStateToProps, mapDispatchToProps)(WithMemberBase);
@@ -3,12 +3,10 @@ import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/inherits";
4
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
-
7
6
  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
7
  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
-
11
8
  import React from "react";
9
+
12
10
  /**
13
11
  * 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
14
12
  *
@@ -37,30 +35,23 @@ import React from "react";
37
35
  * @category Other
38
36
  * @returns {Component} Component which can be used for preview
39
37
  */
40
-
41
38
  export function WithPreview(klazz, updateData) {
42
39
  return /*#__PURE__*/function (_React$Component) {
43
40
  _inherits(WithPreviewWrapper, _React$Component);
44
-
45
41
  var _super = _createSuper(WithPreviewWrapper);
46
-
47
42
  function WithPreviewWrapper(props) {
48
43
  var _this;
49
-
50
44
  _classCallCheck(this, WithPreviewWrapper);
51
-
52
45
  _this = _super.call(this, props);
53
46
  _this.state = {
54
47
  story: null
55
48
  };
56
49
  return _this;
57
50
  }
58
-
59
51
  _createClass(WithPreviewWrapper, [{
60
52
  key: "componentDidMount",
61
53
  value: function componentDidMount() {
62
54
  var _this2 = this;
63
-
64
55
  global.addEventListener("message", function (event) {
65
56
  if (event.data && event.data.action == 'reloadStory' && event.data.story) {
66
57
  _this2.setState({
@@ -79,13 +70,11 @@ export function WithPreview(klazz, updateData) {
79
70
  }
80
71
  });
81
72
  }
82
-
83
73
  return /*#__PURE__*/React.createElement(klazz, Object.assign({}, this.props, {
84
74
  data: updateData(this.props.data, this.state.story)
85
75
  }));
86
76
  }
87
77
  }]);
88
-
89
78
  return WithPreviewWrapper;
90
79
  }(React.Component);
91
80
  }
@@ -4,7 +4,6 @@ import get from "lodash/get";
4
4
  import { LoadMoreCollectionStories } from "./load-more-collection-stories";
5
5
  import { LazyLoadImages } from "./lazy-load-images";
6
6
  import { ClientSideOnly } from "./client-side-only";
7
-
8
7
  function loadMoreWrapper(Component, data, enableLoadMoreButton, slug, numStoriesToLoad) {
9
8
  return !enableLoadMoreButton ? /*#__PURE__*/React.createElement(Component, data) : /*#__PURE__*/React.createElement(LoadMoreCollectionStories, {
10
9
  template: Component,
@@ -16,32 +15,26 @@ function loadMoreWrapper(Component, data, enableLoadMoreButton, slug, numStories
16
15
  numStoriesToLoad: numStoriesToLoad
17
16
  });
18
17
  }
19
-
20
18
  function lazyLoadWrapper(component, _ref) {
21
19
  var _ref$lazy_load_images = _ref.lazy_load_images,
22
- lazyLoadImages = _ref$lazy_load_images === void 0 ? false : _ref$lazy_load_images;
20
+ lazyLoadImages = _ref$lazy_load_images === void 0 ? false : _ref$lazy_load_images;
23
21
  return !lazyLoadImages ? component : /*#__PURE__*/React.createElement(LazyLoadImages, {}, component);
24
22
  }
25
-
26
23
  function clientSideLoadWrapper(component, _ref2) {
27
24
  var _ref2$client_side_onl = _ref2.client_side_only,
28
- clientSideOnly = _ref2$client_side_onl === void 0 ? false : _ref2$client_side_onl;
25
+ clientSideOnly = _ref2$client_side_onl === void 0 ? false : _ref2$client_side_onl;
29
26
  return !clientSideOnly ? component : /*#__PURE__*/React.createElement(ClientSideOnly, {}, component);
30
27
  }
31
-
32
28
  function WrapCollectionComponent(Component) {
33
29
  return function (props) {
34
30
  if (!props.collection) {
35
31
  return /*#__PURE__*/React.createElement("div", null);
36
32
  }
37
-
38
33
  var associatedMetadata = props.collection["associated-metadata"] || {};
39
34
  var stories = collectionToStories(props.collection);
40
-
41
35
  if (associatedMetadata.initial_stories_load_count) {
42
36
  stories = stories.slice(0, associatedMetadata.initial_stories_load_count);
43
37
  }
44
-
45
38
  var data = Object.assign({}, props, {
46
39
  stories: stories,
47
40
  associatedMetadata: associatedMetadata
@@ -52,6 +45,7 @@ function WrapCollectionComponent(Component) {
52
45
  }, component);
53
46
  };
54
47
  }
48
+
55
49
  /**
56
50
  * Use this function to wrap a UI for collections, which returns a component handling common behavior, such as only rendering client side, or lazy loading images.
57
51
  * This component adds two props: `stories` and `associatedMetadata`
@@ -69,25 +63,21 @@ function WrapCollectionComponent(Component) {
69
63
  * @category Collection Page
70
64
  * @returns {Component} A component which can be passed collection
71
65
  */
72
-
73
-
74
66
  export function wrapCollectionLayout(component) {
75
67
  var wrappedComponent = connect(function (state) {
76
68
  return {
77
69
  config: state.qt.config
78
70
  };
79
71
  })(WrapCollectionComponent(component));
80
-
81
72
  if (component.storyLimit) {
82
73
  wrappedComponent.storyLimit = component.storyLimit;
83
74
  }
84
-
85
75
  if (component.nestedCollectionLimit) {
86
76
  wrappedComponent.nestedCollectionLimit = component.nestedCollectionLimit;
87
77
  }
88
-
89
78
  return wrappedComponent;
90
79
  }
80
+
91
81
  /**
92
82
  * Use this function to get the stories from a collection object
93
83
  * returns [] if collection doesn't have items key
@@ -96,7 +86,6 @@ export function wrapCollectionLayout(component) {
96
86
  * @category Collection Page
97
87
  * @returns {Array} An array of stories
98
88
  */
99
-
100
89
  export function collectionToStories(collection) {
101
90
  if (!collection.items) return [];
102
91
  return collection.items.filter(function (item) {
@@ -105,7 +94,6 @@ export function collectionToStories(collection) {
105
94
  return replaceWithAlternates(item.story);
106
95
  });
107
96
  }
108
-
109
97
  function replaceWithAlternates(story) {
110
98
  var alternates = get(story, ["alternative", "home", "default"]);
111
99
  if (!alternates) return story;
@@ -3,7 +3,6 @@
3
3
  */
4
4
  import { BREAKING_NEWS_UPDATED, CLIENT_SIDE_RENDERED, PAGE_LOADING, NAVIGATE_TO_PAGE, PAGE_FINISHED_LOADING, HAMBURGER_CLICKED, HAMBURGER_CLOSED, MEMBER_UPDATED, MEMBER_BEING_LOADED, SUBSCRIPTION_GROUP_UPDATED, PAYMENT_OPTIONS_UPDATED, ACCESS_BEING_LOADED, ACCESS_UPDATED, METER_UPDATED, ASSET_PLANS, CAMPAIGN_SUBSCRIPTION_GROUP_UPDATED } from "./actions";
5
5
  import { computeAccess } from "../utils";
6
-
7
6
  function setToTrueOnEvent() {
8
7
  var events = Array.from(arguments);
9
8
  return function () {
@@ -12,185 +11,142 @@ function setToTrueOnEvent() {
12
11
  return state || events.includes(action.type);
13
12
  };
14
13
  }
15
-
16
14
  function breakingNewsReducer() {
17
15
  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
18
16
  var action = arguments.length > 1 ? arguments[1] : undefined;
19
-
20
17
  switch (action.type) {
21
18
  case BREAKING_NEWS_UPDATED:
22
19
  return action.stories;
23
-
24
20
  default:
25
21
  return state;
26
22
  }
27
23
  }
28
-
29
24
  var breakingNewsLoadedReducer = /*#__PURE__*/setToTrueOnEvent(BREAKING_NEWS_UPDATED);
30
25
  var clientSideRenderedReducer = /*#__PURE__*/setToTrueOnEvent(CLIENT_SIDE_RENDERED);
31
-
32
26
  function pageLoadingReducer() {
33
27
  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
34
28
  var action = arguments.length > 1 ? arguments[1] : undefined;
35
-
36
29
  switch (action.type) {
37
30
  case PAGE_LOADING:
38
31
  return true;
39
-
40
32
  case NAVIGATE_TO_PAGE:
41
33
  return false;
42
-
43
34
  case PAGE_FINISHED_LOADING:
44
35
  return false;
45
-
46
36
  default:
47
37
  return state;
48
38
  }
49
39
  }
50
-
51
40
  function hamburgerOpenedReducer() {
52
41
  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
53
42
  var action = arguments.length > 1 ? arguments[1] : undefined;
54
-
55
43
  switch (action.type) {
56
44
  case HAMBURGER_CLICKED:
57
45
  return true;
58
-
59
46
  case HAMBURGER_CLOSED:
60
47
  return false;
61
-
62
48
  case NAVIGATE_TO_PAGE:
63
49
  return false;
64
-
65
50
  default:
66
51
  return state;
67
52
  }
68
53
  }
69
-
70
54
  function memberReducer() {
71
55
  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
72
56
  var action = arguments.length > 1 ? arguments[1] : undefined;
73
-
74
57
  switch (action.type) {
75
58
  case MEMBER_UPDATED:
76
59
  return action.member;
77
-
78
60
  default:
79
61
  return state;
80
62
  }
81
63
  }
82
-
83
64
  function memberLoadingReducer() {
84
65
  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
85
66
  var action = arguments.length > 1 ? arguments[1] : undefined;
86
-
87
67
  switch (action.type) {
88
68
  case MEMBER_BEING_LOADED:
89
69
  return true;
90
-
91
70
  case MEMBER_UPDATED:
92
71
  return false;
93
-
94
72
  default:
95
73
  return state;
96
74
  }
97
75
  }
98
-
99
76
  function subscriptionReducer() {
100
77
  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
101
78
  var action = arguments.length > 1 ? arguments[1] : undefined;
102
-
103
79
  switch (action.type) {
104
80
  case SUBSCRIPTION_GROUP_UPDATED:
105
81
  return action.subscriptions;
106
-
107
82
  default:
108
83
  return state;
109
84
  }
110
85
  }
111
-
112
86
  function paymentOptionsReducer() {
113
87
  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
114
88
  var action = arguments.length > 1 ? arguments[1] : undefined;
115
-
116
89
  switch (action.type) {
117
90
  case PAYMENT_OPTIONS_UPDATED:
118
91
  return action.paymentOptions;
119
-
120
92
  default:
121
93
  return state;
122
94
  }
123
95
  }
124
-
125
96
  function accessLoadingReducer() {
126
97
  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
127
98
  var action = arguments.length > 1 ? arguments[1] : undefined;
128
-
129
99
  switch (action.type) {
130
100
  case ACCESS_BEING_LOADED:
131
101
  return action.loading;
132
-
133
102
  default:
134
103
  return state;
135
104
  }
136
105
  }
137
-
138
106
  function accessReducer() {
139
107
  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
140
108
  var action = arguments.length > 1 ? arguments[1] : undefined;
141
-
142
109
  switch (action.type) {
143
110
  case ACCESS_UPDATED:
144
111
  return computeAccess(state, action);
145
-
146
112
  default:
147
113
  return state;
148
114
  }
149
115
  }
150
-
151
116
  function meteringReducer() {
152
117
  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
153
118
  var action = arguments.length > 1 ? arguments[1] : undefined;
154
-
155
119
  switch (action.type) {
156
120
  case METER_UPDATED:
157
121
  return action.meterCount;
158
-
159
122
  default:
160
123
  return state;
161
124
  }
162
125
  }
163
-
164
126
  function assetPlansReducer() {
165
127
  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
166
128
  var action = arguments.length > 1 ? arguments[1] : undefined;
167
-
168
129
  switch (action.type) {
169
130
  case ASSET_PLANS:
170
131
  return action.assetPlans;
171
-
172
132
  default:
173
133
  return state;
174
134
  }
175
135
  }
176
-
177
136
  function campaignSubscriptionReducer() {
178
137
  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
179
138
  var action = arguments.length > 1 ? arguments[1] : undefined;
180
-
181
139
  switch (action.type) {
182
140
  case CAMPAIGN_SUBSCRIPTION_GROUP_UPDATED:
183
141
  return action.campaignSubscriptions;
184
-
185
142
  default:
186
143
  return state;
187
144
  }
188
145
  }
146
+
189
147
  /**
190
148
  * ComponentReducers is a list of reducers that are needed by the various components included
191
149
  */
192
-
193
-
194
150
  export var ComponentReducers = {
195
151
  breakingNews: breakingNewsReducer,
196
152
  breakingNewsLoaded: breakingNewsLoadedReducer,
package/dist/es/utils.js CHANGED
@@ -1,9 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
- function ownKeys(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; }
4
-
5
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
-
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
4
  // FIXME: TEST THIS
8
5
  import get from "lodash/get";
9
6
  export function removeDuplicateStories(existingStories, newStories) {
@@ -18,8 +15,9 @@ export function removeDuplicateStories(existingStories, newStories) {
18
15
  export function getAssociatedTemplate(_ref) {
19
16
  var associatedMetadata = _ref["associated-metadata"];
20
17
  return associatedMetadata ? associatedMetadata.layout : 'default';
21
- } // FIXME: TEST THIS
18
+ }
22
19
 
20
+ // FIXME: TEST THIS
23
21
  export function replaceAllStoriesInCollection(collection, story) {
24
22
  var items = (collection.items || []).map(function (item) {
25
23
  if (item.type === "story") {
@@ -31,13 +29,14 @@ export function replaceAllStoriesInCollection(collection, story) {
31
29
  } else if (item.type === "collection") {
32
30
  return replaceAllStoriesInCollection(item, story);
33
31
  }
34
-
35
32
  return item;
36
33
  });
37
34
  return Object.assign({}, collection, {
38
35
  items: items
39
36
  });
40
- } //Helps handle errors with async await pattern
37
+ }
38
+
39
+ //Helps handle errors with async await pattern
41
40
 
42
41
  export var awaitHelper = function awaitHelper(promise) {
43
42
  return promise.then(function (data) {
@@ -72,16 +71,12 @@ export var getQliticsSchema = function getQliticsSchema() {
72
71
  export var computeAccess = function computeAccess(previousState, currentState) {
73
72
  var currentAccess = get(currentState, ["access"], {});
74
73
  var currentStoryId = get(Object.keys(currentAccess), [0], "");
75
-
76
74
  if (currentStoryId in previousState) {
77
75
  var storyAccess = previousState[currentStoryId];
78
-
79
76
  if (storyAccess.granted !== currentAccess[currentStoryId].granted || storyAccess.grantReason !== currentAccess[currentStoryId].grantReason) {
80
77
  return _objectSpread(_objectSpread({}, previousState), currentAccess);
81
78
  }
82
-
83
79
  return previousState;
84
80
  }
85
-
86
81
  return _objectSpread(_objectSpread({}, previousState), currentAccess);
87
82
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/components",
3
- "version": "3.0.3-test-react18.0",
3
+ "version": "3.0.3-test-react18.1",
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",
@@ -32,9 +32,11 @@
32
32
  "prop-types": "^15.7.2",
33
33
  "quintype-js": "^1.2.1",
34
34
  "react": "^18.2.0",
35
+ "react-ace": "^10.1.0",
35
36
  "react-dailymotion": "^0.4.1",
36
37
  "react-dfp": "quintype/react-dfp",
37
- "react-redux": "^7.2.6",
38
+ "react-frame-component": "^5.2.3",
39
+ "react-redux": "^8.0.4",
38
40
  "react-youtube": "^7.13.1",
39
41
  "redux": "^4.1.2",
40
42
  "wretch": "^1.7.6"
@@ -54,7 +56,7 @@
54
56
  "babel-plugin-annotate-pure-calls": "^0.4.0",
55
57
  "babel-plugin-quintype-assets": "^1.1.1",
56
58
  "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
57
- "better-docs": "^2.3.2",
59
+ "better-docs": "^2.7.2",
58
60
  "eslint": "^8.2.0",
59
61
  "eslint-config-prettier": "^8.3.0",
60
62
  "eslint-config-standard": "^16.0.3",
@@ -75,7 +77,7 @@
75
77
  "parcel-bundler": "^1.12.4",
76
78
  "prettier": "2.4.1",
77
79
  "react-dom": "^18.2.0",
78
- "react-testing-library": "^7.0.0",
80
+ "react-testing-library": "^8.0.1",
79
81
  "rimraf": "^3.0.2",
80
82
  "rollup": "^2.59.0",
81
83
  "rollup-plugin-babel": "^4.3.2",