@quintype/native-components 2.19.17 → 2.19.18
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/CHANGELOG.md +2 -0
- package/package.json +1 -1
- package/src/components/Story/index.js +3 -4
- package/src/utils/story.js +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [2.19.18](https://github.com/quintype/native-components/compare/v2.19.17...v2.19.18) (2022-07-04)
|
|
6
|
+
|
|
5
7
|
### [2.19.17](https://github.com/quintype/native-components/compare/v2.19.14...v2.19.17) (2022-06-29)
|
|
6
8
|
|
|
7
9
|
|
package/package.json
CHANGED
|
@@ -47,7 +47,7 @@ const getLiveBlogTimeStamp = (card, DATE_FORMAT, share, styles, locale) => {
|
|
|
47
47
|
|
|
48
48
|
/* Mutate the data during access check to limit the content shown */
|
|
49
49
|
const mutateDataBeforeAccess = (item, storyHasAccess) => {
|
|
50
|
-
if (isStoryFree(item)) {
|
|
50
|
+
if (isStoryFree(item) === 0 || storyHasAccess === 'granted') {
|
|
51
51
|
return item;
|
|
52
52
|
}
|
|
53
53
|
if (storyHasAccess !== 'loading' && storyHasAccess === 'granted') {
|
|
@@ -55,7 +55,7 @@ const mutateDataBeforeAccess = (item, storyHasAccess) => {
|
|
|
55
55
|
}
|
|
56
56
|
/* The following steps are necessary to keep argument mutation at bay */
|
|
57
57
|
const firstCardObject = get(item, ['cards', 0], {});
|
|
58
|
-
const firstCardElement = get(firstCardObject, ['story-elements', 0], {});
|
|
58
|
+
const firstCardElement = get(firstCardObject, !STORY_TYPES.VIDEO_STORY && ['story-elements', 0], {});
|
|
59
59
|
|
|
60
60
|
return {
|
|
61
61
|
...item,
|
|
@@ -195,9 +195,8 @@ export const Story = ({
|
|
|
195
195
|
|
|
196
196
|
const shouldShowComments = () => {
|
|
197
197
|
if (!enableFbComments) return null;
|
|
198
|
-
|
|
199
198
|
if (
|
|
200
|
-
isStoryFree(story)
|
|
199
|
+
isStoryFree(story) === 0
|
|
201
200
|
|| (storyHasAccess !== 'loading' && storyHasAccess === 'granted')
|
|
202
201
|
) {
|
|
203
202
|
return (
|
package/src/utils/story.js
CHANGED
|
@@ -7,10 +7,14 @@ import get from 'lodash/get';
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
export const isStoryFree = (story = {}) => {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
switch (story.access) {
|
|
11
|
+
case 'login':
|
|
12
|
+
return 1;
|
|
13
|
+
case 'subscription':
|
|
14
|
+
return 2;
|
|
15
|
+
default:
|
|
16
|
+
return 0;
|
|
12
17
|
}
|
|
13
|
-
return story.access === 'public' || Object.is(story.access, null);
|
|
14
18
|
};
|
|
15
19
|
|
|
16
20
|
/**
|