@quintype/native-components 2.19.16 → 2.19.19

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 CHANGED
@@ -2,6 +2,24 @@
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.19](https://github.com/quintype/native-components/compare/v2.19.18...v2.19.19) (2022-08-24)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **Ads:** Change midcontentAd logic for video-story :hammer: ([#186](https://github.com/quintype/native-components/issues/186)) ([b04a16c](https://github.com/quintype/native-components/commit/b04a16cb74f06c3a3f5639df31b39b2ecd4b6704))
11
+ * **deps:** Fixes dependency-conflict due to incorrect react-native version :hammer: ([b43e8ae](https://github.com/quintype/native-components/commit/b43e8ae0e4cf92d3fce21336c3cdd6c2d73db582))
12
+
13
+ ### [2.19.18](https://github.com/quintype/native-components/compare/v2.19.17...v2.19.18) (2022-07-04)
14
+
15
+ ### [2.19.17](https://github.com/quintype/native-components/compare/v2.19.14...v2.19.17) (2022-06-29)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **story-page:** Fixes crash if image-metadata is null 🔨 ([#184](https://github.com/quintype/native-components/issues/184)) ([8f703d1](https://github.com/quintype/native-components/commit/8f703d19c90c4a5c7844e2251c6691263f9b3d4b))
21
+ * **story-template:** Fixed story-template-icon color :hammer: ([#182](https://github.com/quintype/native-components/issues/182)) ([95f750d](https://github.com/quintype/native-components/commit/95f750d7df5f7cc400095317be26900c0cffd3e1))
22
+
5
23
  ### [2.19.16](https://github.com/quintype/native-components/compare/v2.19.15...v2.19.16) (2022-05-09)
6
24
 
7
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/native-components",
3
- "version": "2.19.16",
3
+ "version": "2.19.19",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -29,8 +29,8 @@
29
29
  "peerDependencies": {
30
30
  "@react-navigation/native": ">=5.7.3",
31
31
  "lodash": ">=4.17.20",
32
- "react": ">=16.13.1",
33
- "react-native": ">=0.63.2",
32
+ "react": ">=17.0.2",
33
+ "react-native": ">=0.67.4",
34
34
  "react-native-fast-image": ">=8.3.2",
35
35
  "react-native-pdf": ">=6.2.0",
36
36
  "react-native-webview": ">=11.0.0",
@@ -53,8 +53,8 @@
53
53
  "husky": "^4.2.5",
54
54
  "jest": "^26.4.0",
55
55
  "metro-react-native-babel-preset": "^0.62.0",
56
- "react": "^16.13.1",
57
- "react-native": "^0.68.0",
56
+ "react": "17.0.2",
57
+ "react-native": "0.67.4",
58
58
  "react-native-device-info": "^5.6.5",
59
59
  "react-native-gesture-handler": "^1.9.0",
60
60
  "react-native-svg": "^12.3.0",
@@ -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,
@@ -119,9 +119,11 @@ const getStoryCards = (
119
119
  )}
120
120
  {/* Skip first card if it's a listicle */}
121
121
 
122
- {source.length > 1 && (!STORY_TYPES.VIDEO_STORY || source.length > 2) && isMiddleIndexOfArray(index, source) && getAd(true)}
123
- {/* ^ Requesting Ad if there are multiple cards. Sending param true for mid-content ad
124
- If the story is from video template and have single card then not showing mid-ad */}
122
+ {source.length > (storyType === STORY_TYPES.VIDEO_STORY ? 2 : 1)
123
+ && isMiddleIndexOfArray(index, source)
124
+ && getAd(true)}
125
+ {/* ^ Requesting mid-content-ad if there are > 1 card
126
+ (> 2 cards in case of video story since the 1st card gets rendered in header). */}
125
127
 
126
128
  {(card['story-elements'] || []).map((storyElement, index, source) => {
127
129
  /* Skip the first video element for video story */
@@ -130,10 +132,12 @@ const getStoryCards = (
130
132
  return (
131
133
  <>
132
134
  {cards.length === 1
133
- && source.length > 1
134
- && isMiddleIndexOfArray(index, source)
135
- && getAd(true)}
136
- {/* ^ Requesting Ad if there's just one card but multiple elements. Sending param true for mid-content ad */}
135
+ && source.length > (storyType === STORY_TYPES.VIDEO_STORY ? 2 : 1)
136
+ && isMiddleIndexOfArray(index, source)
137
+ && getAd(true)}
138
+ {/* ^ In the case of a story having just 1 card,
139
+ requesting mid-content-Ad if there are > 1 story-elements in that card
140
+ (> 2 story-elements in case of video story since the 1st story-element gets rendered in header). */}
137
141
 
138
142
  <StoryContent
139
143
  testID={contentTestID}
@@ -195,9 +199,8 @@ export const Story = ({
195
199
 
196
200
  const shouldShowComments = () => {
197
201
  if (!enableFbComments) return null;
198
-
199
202
  if (
200
- isStoryFree(story)
203
+ isStoryFree(story) === 0
201
204
  || (storyHasAccess !== 'loading' && storyHasAccess === 'granted')
202
205
  ) {
203
206
  return (
@@ -1,8 +1,8 @@
1
1
  import { StyleSheet } from 'react-native';
2
2
  import { getImageHeight } from '../../utils';
3
3
 
4
- export const storyImageStyles = ({ COLORS, FONT_SIZE }, metadata) => {
5
- const { width, height } = metadata;
4
+ export const storyImageStyles = ({ COLORS, FONT_SIZE }, metadata = {}) => {
5
+ const { width, height } = metadata || {};
6
6
  const imageHeight = getImageHeight(width, height);
7
7
 
8
8
  return StyleSheet.create({
@@ -7,10 +7,14 @@ import get from 'lodash/get';
7
7
  */
8
8
 
9
9
  export const isStoryFree = (story = {}) => {
10
- if (!('access' in story)) {
11
- return true;
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
  /**