@quintype/components 3.4.6 → 3.4.7-stories-by-external-id.0

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
@@ -1093,9 +1093,10 @@ var InfiniteStoryBase = /*#__PURE__*/function (_React$Component) {
1093
1093
 
1094
1094
  if (!this.props.doNotChangeUrl) {
1095
1095
  var storyPath = item.story.url ? new URL(item.story.url).pathname : "/" + item.story.slug;
1096
- var metaTitle = get__default["default"](item, ['story', 'seo', 'meta-title'], item.story.headline);
1096
+ var metaTitle = get__default["default"](item, ["story", "seo", "meta-title"], item.story.headline);
1097
1097
  var title = get__default["default"](item, ["customSeo", "title"], metaTitle);
1098
- global.app.maybeSetUrl(storyPath, title);
1098
+ var path = this.props.changeUrlTo && this.props.changeUrlTo(item);
1099
+ global.app.maybeSetUrl(path || storyPath, title);
1099
1100
  }
1100
1101
 
1101
1102
  this.props.onItemFocus && this.props.onItemFocus(item, index);
@@ -1115,7 +1116,7 @@ var InfiniteStoryBase = /*#__PURE__*/function (_React$Component) {
1115
1116
 
1116
1117
  if (this.state.loading) return;
1117
1118
  var pageNumber = this.state.pageNumber;
1118
- var story = get__default["default"](this.props.data, ['story'], {});
1119
+ var story = get__default["default"](this.props.data, ["story"], {});
1119
1120
  this.setState({
1120
1121
  loading: true,
1121
1122
  pageNumber: pageNumber + 1
@@ -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 React from "react";
12
11
  import get from "lodash/get";
12
+ import React from "react";
13
+ import { removeDuplicateStories } from "../utils";
13
14
  import { InfiniteScroll } from "./infinite-scroll.js";
14
- import { removeDuplicateStories } from '../utils';
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
  *
@@ -94,9 +94,10 @@ export var InfiniteStoryBase = /*#__PURE__*/function (_React$Component) {
94
94
 
95
95
  if (!this.props.doNotChangeUrl) {
96
96
  var storyPath = item.story.url ? new URL(item.story.url).pathname : "/" + item.story.slug;
97
- var metaTitle = get(item, ['story', 'seo', 'meta-title'], item.story.headline);
97
+ var metaTitle = get(item, ["story", "seo", "meta-title"], item.story.headline);
98
98
  var title = get(item, ["customSeo", "title"], metaTitle);
99
- global.app.maybeSetUrl(storyPath, title);
99
+ var path = this.props.changeUrlTo && this.props.changeUrlTo(item);
100
+ global.app.maybeSetUrl(path || storyPath, title);
100
101
  }
101
102
 
102
103
  this.props.onItemFocus && this.props.onItemFocus(item, index);
@@ -116,7 +117,7 @@ export var InfiniteStoryBase = /*#__PURE__*/function (_React$Component) {
116
117
 
117
118
  if (this.state.loading) return;
118
119
  var pageNumber = this.state.pageNumber;
119
- var story = get(this.props.data, ['story'], {});
120
+ var story = get(this.props.data, ["story"], {});
120
121
  this.setState({
121
122
  loading: true,
122
123
  pageNumber: pageNumber + 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/components",
3
- "version": "3.4.6",
3
+ "version": "3.4.7-stories-by-external-id.0",
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",