@quintype/native-components 2.20.24 → 2.20.26-beta.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/CHANGELOG.md +7 -0
- package/bin-dev-scripts/standard-version-release.sh +10 -10
- package/package.json +3 -2
- package/src/components/Story/index.js +37 -5
- package/src/components/Story/styles.js +6 -0
- package/src/constants/renderHTML.js +7 -6
- package/src/utils/colorUtils.js +0 -1
- package/src/utils/story.js +35 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
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.20.25](https://github.com/quintype/native-components/compare/v2.20.24...v2.20.25) (2024-03-14)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **text-clip:** Bump lineheight for HTML story-content ([91f6279](https://github.com/quintype/native-components/commit/91f6279ca2815bf48bddcf0eb03020351bde8666))
|
|
11
|
+
|
|
5
12
|
### [2.20.24](https://github.com/quintype/native-components/compare/v2.20.23...v2.20.24) (2024-03-13)
|
|
6
13
|
|
|
7
14
|
### [2.20.23](https://github.com/quintype/native-components/compare/v2.20.22...v2.20.23) (2024-03-11)
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/bin/bash -e
|
|
2
2
|
|
|
3
|
-
npm install
|
|
4
|
-
git diff --quiet
|
|
3
|
+
# npm install
|
|
4
|
+
# git diff --quiet
|
|
5
5
|
|
|
6
|
-
BRANCH=$(git symbolic-ref --short HEAD)
|
|
6
|
+
# BRANCH=$(git symbolic-ref --short HEAD)
|
|
7
7
|
|
|
8
|
-
if [ "$BRANCH" == 'master' ]
|
|
9
|
-
then
|
|
10
|
-
|
|
11
|
-
else
|
|
12
|
-
|
|
13
|
-
fi
|
|
8
|
+
# if [ "$BRANCH" == 'master' ]
|
|
9
|
+
# then
|
|
10
|
+
# npx standard-version
|
|
11
|
+
# else
|
|
12
|
+
# npx standard-version --prerelease "$(git symbolic-ref --short HEAD | sed s:/:-:g )" --skip.changelog=true
|
|
13
|
+
# fi
|
|
14
14
|
|
|
15
|
-
git push --follow-tags origin "$BRANCH"
|
|
15
|
+
# git push --follow-tags origin "$BRANCH"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quintype/native-components",
|
|
3
|
-
"version": "2.20.
|
|
3
|
+
"version": "2.20.26-beta.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
"react-native-pdf": ">=6.2.0",
|
|
35
35
|
"react-native-webview": ">=11.0.0",
|
|
36
36
|
"rn-fetch-blob": ">=0.12.0",
|
|
37
|
-
"react-native-vector-icons": "^10.0.0"
|
|
37
|
+
"react-native-vector-icons": "^10.0.0",
|
|
38
|
+
"react-native-linear-gradient": "^2.8.3"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@babel/core": "^7.11.1",
|
|
@@ -14,6 +14,8 @@ import { ClockIcon } from '../../Icons/ClockIcon';
|
|
|
14
14
|
import { storyStyles } from './styles';
|
|
15
15
|
import { isStoryFree, mutateDataBeforeAccess, getFirstVideoElement } from '../../utils/story';
|
|
16
16
|
import { isMiddleIndexOfArray } from '../../utils/arrayUtils';
|
|
17
|
+
import LinearGradient from "react-native-linear-gradient";
|
|
18
|
+
import { hexToRgb } from '@quintype/native-components/src/utils/colorUtils';
|
|
17
19
|
|
|
18
20
|
const getLiveBlogTimeStamp = (card, DATE_FORMAT, share, styles, locale) => {
|
|
19
21
|
const slug = `?cardId=${card.id}`;
|
|
@@ -77,7 +79,7 @@ const getStoryCards = (
|
|
|
77
79
|
getAd,
|
|
78
80
|
locale,
|
|
79
81
|
) => cards.map((card, index, source) => (
|
|
80
|
-
|
|
82
|
+
<View key={card?.id}>
|
|
81
83
|
{isLiveBlog
|
|
82
84
|
&& getLiveBlogTimeStamp(card, DATE_FORMAT, share, styles, locale)}
|
|
83
85
|
|
|
@@ -107,7 +109,6 @@ const getStoryCards = (
|
|
|
107
109
|
{/* ^ In the case of a story having just 1 card,
|
|
108
110
|
requesting mid-content-Ad if there are > 1 story-elements in that card
|
|
109
111
|
(> 2 story-elements in case of video story since the 1st story-element gets rendered in header). */}
|
|
110
|
-
|
|
111
112
|
<StoryContent
|
|
112
113
|
testID={contentTestID}
|
|
113
114
|
key={storyElement?.id}
|
|
@@ -144,15 +145,18 @@ export const Story = ({
|
|
|
144
145
|
storyHasAccess = 'loading',
|
|
145
146
|
currentLayout,
|
|
146
147
|
getAd,
|
|
148
|
+
showWall,
|
|
149
|
+
userObjectLength,
|
|
150
|
+
numberOfVisibleStoryCard
|
|
147
151
|
}) => {
|
|
148
152
|
const { theme } = useContext(AppTheme);
|
|
149
|
-
const { COLORS, FONT_SIZE, locale } = theme;
|
|
153
|
+
const { COLORS, FONT_SIZE, locale, DARK_MODE } = theme;
|
|
150
154
|
const styles = storyStyles(COLORS, FONT_SIZE);
|
|
151
155
|
|
|
152
156
|
const {
|
|
153
157
|
cards = [],
|
|
154
158
|
'linked-stories': linkedStories,
|
|
155
|
-
} = mutateDataBeforeAccess(story, storyHasAccess);
|
|
159
|
+
} = mutateDataBeforeAccess(story, storyHasAccess, numberOfVisibleStoryCard);
|
|
156
160
|
|
|
157
161
|
const firstVideoElement = story['story-template'] === STORY_TYPES.VIDEO_STORY
|
|
158
162
|
? getFirstVideoElement(cards)
|
|
@@ -185,8 +189,28 @@ export const Story = ({
|
|
|
185
189
|
checkStoryAccess(story);
|
|
186
190
|
}, []);
|
|
187
191
|
|
|
192
|
+
useEffect(()=>{
|
|
193
|
+
if(userObjectLength){
|
|
194
|
+
checkStoryAccess(story);
|
|
195
|
+
}
|
|
196
|
+
},[userObjectLength])
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
const GradientView = () => {
|
|
200
|
+
return (
|
|
201
|
+
<LinearGradient
|
|
202
|
+
colors={[
|
|
203
|
+
DARK_MODE ? hexToRgb("#252525", 0) : hexToRgb(COLORS.BRAND_WHITE, 0),
|
|
204
|
+
DARK_MODE ? hexToRgb("#252525", 1) : hexToRgb(COLORS.BRAND_WHITE, 1),
|
|
205
|
+
]}
|
|
206
|
+
style={{ height: 200}}
|
|
207
|
+
></LinearGradient>
|
|
208
|
+
);
|
|
209
|
+
};
|
|
210
|
+
|
|
188
211
|
return (
|
|
189
212
|
<>
|
|
213
|
+
<View>
|
|
190
214
|
<StoryHeader
|
|
191
215
|
firstVideoElement={firstVideoElement}
|
|
192
216
|
testID={headerTestID}
|
|
@@ -196,6 +220,8 @@ export const Story = ({
|
|
|
196
220
|
onSectionPress={onSectionPress}
|
|
197
221
|
/>
|
|
198
222
|
|
|
223
|
+
|
|
224
|
+
|
|
199
225
|
{getAd()}
|
|
200
226
|
|
|
201
227
|
{getStoryCards(
|
|
@@ -219,7 +245,13 @@ export const Story = ({
|
|
|
219
245
|
locale,
|
|
220
246
|
)}
|
|
221
247
|
|
|
222
|
-
{
|
|
248
|
+
{(!(isStoryFree(story) === 0 || storyHasAccess === "granted") && showWall) && <View style={styles.overlay} >
|
|
249
|
+
<GradientView />
|
|
250
|
+
</View>
|
|
251
|
+
}
|
|
252
|
+
</View>
|
|
253
|
+
{accessComponent(story, storyHasAccess, showWall)}
|
|
254
|
+
|
|
223
255
|
|
|
224
256
|
{shouldShowComments()}
|
|
225
257
|
|
|
@@ -21,13 +21,13 @@ export const customHTMLStyles = () => {
|
|
|
21
21
|
marginTop: 7,
|
|
22
22
|
marginBottom: 7,
|
|
23
23
|
fontSize: FONT_SIZE.p1,
|
|
24
|
-
lineHeight: FONT_SIZE.p1 * 1.
|
|
24
|
+
lineHeight: FONT_SIZE.p1 * 1.7,
|
|
25
25
|
color: COLORS.BRAND_BLACK,
|
|
26
26
|
opacity: 0.85,
|
|
27
27
|
},
|
|
28
28
|
li: {
|
|
29
29
|
fontSize: FONT_SIZE.h3,
|
|
30
|
-
lineHeight: FONT_SIZE.h3 * 1.
|
|
30
|
+
lineHeight: FONT_SIZE.h3 * 1.5,
|
|
31
31
|
marginTop: 8,
|
|
32
32
|
color: COLORS.BRAND_BLACK,
|
|
33
33
|
opacity: 0.85,
|
|
@@ -50,25 +50,26 @@ export const customHTMLStyles = () => {
|
|
|
50
50
|
marginTop: 7,
|
|
51
51
|
marginBottom: 7,
|
|
52
52
|
fontSize: FONT_SIZE.p1,
|
|
53
|
-
lineHeight: FONT_SIZE.p1 * 1.
|
|
53
|
+
lineHeight: FONT_SIZE.p1 * 1.7,
|
|
54
54
|
color: COLORS.HYPERLINK_COLOR || COLORS.BRAND_BLACK,
|
|
55
55
|
},
|
|
56
56
|
h: {
|
|
57
57
|
fontFamily: FONT_FAMILY.secondaryBold,
|
|
58
58
|
fontWeight: 'normal',
|
|
59
|
-
marginTop:
|
|
59
|
+
marginTop: 12,
|
|
60
60
|
marginRight: 4,
|
|
61
|
+
lineHeight: FONT_SIZE.h1 * 2,
|
|
61
62
|
color: COLORS.BRAND_BLACK,
|
|
62
63
|
opacity: 0.85,
|
|
63
64
|
},
|
|
64
65
|
sup: {
|
|
65
66
|
marginBottom: 16,
|
|
66
|
-
lineHeight: FONT_SIZE.p1 * 0.
|
|
67
|
+
lineHeight: FONT_SIZE.p1 * 0.5,
|
|
67
68
|
fontSize: FONT_SIZE.p1 * 0.5,
|
|
68
69
|
},
|
|
69
70
|
sub: {
|
|
70
71
|
marginBottom: 16,
|
|
71
|
-
lineHeight: FONT_SIZE.p1 * 0.
|
|
72
|
+
lineHeight: FONT_SIZE.p1 * 0.5,
|
|
72
73
|
fontSize: FONT_SIZE.p1 * 0.5,
|
|
73
74
|
},
|
|
74
75
|
};
|
package/src/utils/colorUtils.js
CHANGED
|
@@ -2,7 +2,6 @@ export const hexToRgb = (hex, alpha=1) => {
|
|
|
2
2
|
let rgbCode = hex.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(m, r, g, b) => '#' + r + r + g + g + b + b)
|
|
3
3
|
.substring(1).match(/.{2}/g)
|
|
4
4
|
.map(x => parseInt(x, 16));
|
|
5
|
-
console.log('risi - color', `rgb(${rgbCode[0]}, ${rgbCode[1]}, ${rgbCode[2]}, ${alpha})`)
|
|
6
5
|
return `rgba(${rgbCode[0]}, ${rgbCode[1]}, ${rgbCode[2]}, ${alpha})`;
|
|
7
6
|
}
|
|
8
7
|
|
package/src/utils/story.js
CHANGED
|
@@ -42,21 +42,52 @@ export const getFirstVideoElement = (cards) => cards
|
|
|
42
42
|
|| (type === 'jsembed' && subtype === 'dailymotion-video'),
|
|
43
43
|
) || {};
|
|
44
44
|
|
|
45
|
-
export const mutateDataBeforeAccess = (item, storyHasAccess) => {
|
|
45
|
+
export const mutateDataBeforeAccess = (item, storyHasAccess, visibleCardCountForBlockedStories) => {
|
|
46
|
+
console.log('risi - visibleCardCountForBlockedStories', visibleCardCountForBlockedStories)
|
|
46
47
|
if (isStoryFree(item) === 0 || storyHasAccess === 'granted') {
|
|
47
48
|
return item;
|
|
48
49
|
}
|
|
49
50
|
if (storyHasAccess !== 'loading' && storyHasAccess === 'granted') {
|
|
50
51
|
return item;
|
|
51
52
|
}
|
|
52
|
-
|
|
53
|
-
const firstCardObject = get(item, ['cards', 0], {});
|
|
53
|
+
const firstCardObject = get(item, ['cards', 2], {});
|
|
54
54
|
const firstCardElement = get(firstCardObject, !STORY_TYPES.VIDEO_STORY && ['story-elements', 0], {});
|
|
55
|
+
let visibleContentsForBlockedStory = [];
|
|
56
|
+
let showBlockingWall = false;
|
|
57
|
+
let visibleStoryCount = 0;
|
|
58
|
+
// visibleCardCountForBlockedStories = 0;
|
|
59
|
+
if(!visibleCardCountForBlockedStories){
|
|
60
|
+
return {
|
|
61
|
+
cards: visibleContentsForBlockedStory,
|
|
62
|
+
showBlockingWall: true
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if(item.cards && item.cards.length > 0){
|
|
67
|
+
for(let i = 0; i < item.cards.length; i++){
|
|
68
|
+
let storyElement = [];
|
|
69
|
+
for(let j=0; j<item.cards[i]['story-elements'].length; j++){
|
|
70
|
+
let tempStoryElement = item.cards[i]['story-elements'][j];
|
|
71
|
+
if(visibleStoryCount < visibleCardCountForBlockedStories-1){
|
|
72
|
+
storyElement.push(tempStoryElement);
|
|
73
|
+
visibleStoryCount++;
|
|
74
|
+
} else {
|
|
75
|
+
showBlockingWall = true;
|
|
76
|
+
storyElement.push(tempStoryElement);
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
visibleContentsForBlockedStory.push({...item.cards[i],'story-elements' : storyElement});
|
|
82
|
+
if(showBlockingWall) break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
55
85
|
|
|
56
86
|
return {
|
|
57
87
|
...item,
|
|
58
88
|
...{
|
|
59
|
-
cards:
|
|
89
|
+
cards: visibleContentsForBlockedStory,
|
|
60
90
|
},
|
|
91
|
+
showBlockingWall
|
|
61
92
|
};
|
|
62
93
|
};
|