@quintype/native-components 2.20.26 → 2.20.27
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 +4 -0
- package/bin-dev-scripts/standard-version-release.sh +1 -1
- package/package.json +4 -4
- package/src/components/Story/index.js +4 -11
- package/src/components/Story/styles.js +0 -9
- package/src/components/YouTubePlayer/index.js +39 -1
- package/src/utils/colorUtils.js +1 -0
- package/src/utils/story.js +2 -24
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
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.27](https://github.com/quintype/native-components/compare/v2.20.26...v2.20.27) (2024-05-17)
|
|
6
|
+
|
|
7
|
+
### [2.20.26](https://github.com/quintype/native-components/compare/v2.20.25...v2.20.26) (2024-05-17)
|
|
8
|
+
|
|
5
9
|
### [2.20.25](https://github.com/quintype/native-components/compare/v2.20.24...v2.20.25) (2024-03-14)
|
|
6
10
|
|
|
7
11
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quintype/native-components",
|
|
3
|
-
"version": "2.20.
|
|
3
|
+
"version": "2.20.27",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "jest --detectOpenHandles",
|
|
8
8
|
"lint": "npx eslint './src/**/*.{js,jsx}'",
|
|
9
|
-
"lint:ci": "npx eslint $(git diff --pretty='' --diff-filter=d --name-only origin/master..HEAD -- '*.js' '*.jsx') ./start.js"
|
|
9
|
+
"lint:ci": "npx eslint $(git diff --pretty='' --diff-filter=d --name-only origin/master..HEAD -- '*.js' '*.jsx') ./start.js",
|
|
10
|
+
"prepublishOnly": "./bin-dev-scripts/standard-version-release.sh"
|
|
10
11
|
},
|
|
11
12
|
"dependencies": {
|
|
12
13
|
"atob": "^2.1.2",
|
|
@@ -33,8 +34,7 @@
|
|
|
33
34
|
"react-native-pdf": ">=6.2.0",
|
|
34
35
|
"react-native-webview": ">=11.0.0",
|
|
35
36
|
"rn-fetch-blob": ">=0.12.0",
|
|
36
|
-
"react-native-vector-icons": "^10.0.0"
|
|
37
|
-
"react-native-linear-gradient": "^2.8.3"
|
|
37
|
+
"react-native-vector-icons": "^10.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@babel/core": "^7.11.1",
|
|
@@ -15,8 +15,6 @@ import { storyStyles } from './styles';
|
|
|
15
15
|
import { isStoryFree, mutateDataBeforeAccess, getFirstVideoElement } from '../../utils/story';
|
|
16
16
|
import { isMiddleIndexOfArray } from '../../utils/arrayUtils';
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
18
|
const getLiveBlogTimeStamp = (card, DATE_FORMAT, share, styles, locale) => {
|
|
21
19
|
const slug = `?cardId=${card.id}`;
|
|
22
20
|
return (
|
|
@@ -78,9 +76,8 @@ const getStoryCards = (
|
|
|
78
76
|
currentLayout,
|
|
79
77
|
getAd,
|
|
80
78
|
locale,
|
|
81
|
-
) => cards.map((card, index, source) =>
|
|
82
|
-
|
|
83
|
-
return <View key={card?.id}>
|
|
79
|
+
) => cards.map((card, index, source) => (
|
|
80
|
+
<View key={card?.id}>
|
|
84
81
|
{isLiveBlog
|
|
85
82
|
&& getLiveBlogTimeStamp(card, DATE_FORMAT, share, styles, locale)}
|
|
86
83
|
|
|
@@ -110,6 +107,7 @@ const getStoryCards = (
|
|
|
110
107
|
{/* ^ In the case of a story having just 1 card,
|
|
111
108
|
requesting mid-content-Ad if there are > 1 story-elements in that card
|
|
112
109
|
(> 2 story-elements in case of video story since the 1st story-element gets rendered in header). */}
|
|
110
|
+
|
|
113
111
|
<StoryContent
|
|
114
112
|
testID={contentTestID}
|
|
115
113
|
key={storyElement?.id}
|
|
@@ -126,7 +124,7 @@ const getStoryCards = (
|
|
|
126
124
|
);
|
|
127
125
|
})}
|
|
128
126
|
</View>
|
|
129
|
-
|
|
127
|
+
));
|
|
130
128
|
|
|
131
129
|
export const Story = ({
|
|
132
130
|
cdn,
|
|
@@ -189,7 +187,6 @@ export const Story = ({
|
|
|
189
187
|
|
|
190
188
|
return (
|
|
191
189
|
<>
|
|
192
|
-
<View>
|
|
193
190
|
<StoryHeader
|
|
194
191
|
firstVideoElement={firstVideoElement}
|
|
195
192
|
testID={headerTestID}
|
|
@@ -221,10 +218,6 @@ export const Story = ({
|
|
|
221
218
|
getAd,
|
|
222
219
|
locale,
|
|
223
220
|
)}
|
|
224
|
-
<View style={styles.overlay} />
|
|
225
|
-
</View>
|
|
226
|
-
|
|
227
|
-
|
|
228
221
|
|
|
229
222
|
{accessComponent(story, storyHasAccess)}
|
|
230
223
|
|
|
@@ -37,13 +37,4 @@ export const storyStyles = (COLORS, FONT_SIZE) => StyleSheet.create({
|
|
|
37
37
|
color: COLORS.BRAND_1,
|
|
38
38
|
fontSize: FONT_SIZE.title,
|
|
39
39
|
},
|
|
40
|
-
overlay: {
|
|
41
|
-
position: 'absolute',
|
|
42
|
-
bottom: -10,
|
|
43
|
-
left: 0,
|
|
44
|
-
right: 0,
|
|
45
|
-
height: 180, // Adjust the height as needed
|
|
46
|
-
backgroundColor: 'rgba(150, 0, 0, 0.2)',
|
|
47
|
-
marginHorizontal:10
|
|
48
|
-
},
|
|
49
40
|
});
|
|
@@ -10,12 +10,50 @@ export const YouTubePlayer = ({ card = {} }) => {
|
|
|
10
10
|
const windowWidth = Dimensions.get("window").width;
|
|
11
11
|
const styles = webviewStyles(windowWidth);
|
|
12
12
|
|
|
13
|
+
const getYoutubeIframe = (ytEmbedURL) => {
|
|
14
|
+
const videoId = ytEmbedURL.split('/').pop();
|
|
15
|
+
const width = windowWidth - 20;
|
|
16
|
+
const height = (9/16)*(windowWidth - 20);
|
|
17
|
+
const htmlContent = `
|
|
18
|
+
<iframe
|
|
19
|
+
width="1280"
|
|
20
|
+
height="720"
|
|
21
|
+
src="https://www.youtube.com/embed/${videoId}"
|
|
22
|
+
frameborder="0"
|
|
23
|
+
allow="accelerometer;
|
|
24
|
+
autoplay;
|
|
25
|
+
clipboard-write;
|
|
26
|
+
encrypted-media;
|
|
27
|
+
gyroscope;
|
|
28
|
+
picture-in-picture;
|
|
29
|
+
web-share"
|
|
30
|
+
referrerpolicy="strict-origin-when-cross-origin"
|
|
31
|
+
allowfullscreen
|
|
32
|
+
></iframe>`;
|
|
33
|
+
|
|
34
|
+
return `
|
|
35
|
+
<html>
|
|
36
|
+
<head>
|
|
37
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
38
|
+
<style>
|
|
39
|
+
iframe{
|
|
40
|
+
width:${width}px;
|
|
41
|
+
height:${height}px;
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
${htmlContent}
|
|
47
|
+
</body>
|
|
48
|
+
</html>`;
|
|
49
|
+
}
|
|
50
|
+
|
|
13
51
|
return (
|
|
14
52
|
<View style={styles.container} testID="youtube-player-id">
|
|
15
53
|
<WebView
|
|
16
54
|
mediaPlaybackRequiresUserAction
|
|
17
55
|
style={styles.webViewContainer}
|
|
18
|
-
source={{
|
|
56
|
+
source={{ html: getYoutubeIframe(ytEmbedURL), baseUrl:'https://www.youtube.com'}}
|
|
19
57
|
javaScriptEnabled
|
|
20
58
|
domStorageEnabled
|
|
21
59
|
startInLoadingState
|
package/src/utils/colorUtils.js
CHANGED
|
@@ -2,6 +2,7 @@ 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})`)
|
|
5
6
|
return `rgba(${rgbCode[0]}, ${rgbCode[1]}, ${rgbCode[2]}, ${alpha})`;
|
|
6
7
|
}
|
|
7
8
|
|
package/src/utils/story.js
CHANGED
|
@@ -50,35 +50,13 @@ export const mutateDataBeforeAccess = (item, storyHasAccess) => {
|
|
|
50
50
|
return item;
|
|
51
51
|
}
|
|
52
52
|
/* The following steps are necessary to keep argument mutation at bay */
|
|
53
|
-
|
|
54
|
-
const firstCardObject = get(item, ['cards', 2], {});
|
|
53
|
+
const firstCardObject = get(item, ['cards', 0], {});
|
|
55
54
|
const firstCardElement = get(firstCardObject, !STORY_TYPES.VIDEO_STORY && ['story-elements', 0], {});
|
|
56
|
-
let visibleContentsForBlockedStory = [];
|
|
57
|
-
let textStoryFound = false;
|
|
58
|
-
if(item.cards && item.cards.length > 0){
|
|
59
|
-
for(let i = 0; i < Math.min(item.cards.length, 2); i++){
|
|
60
|
-
let storyElement = [];
|
|
61
|
-
for(let j=0; j<item.cards[i]['story-elements'].length; j++){
|
|
62
|
-
let tempStoryElement = item.cards[i]['story-elements'][j];
|
|
63
|
-
if(tempStoryElement?.type !== 'text'){
|
|
64
|
-
storyElement.push(tempStoryElement);
|
|
65
|
-
} else {
|
|
66
|
-
textStoryFound = true;
|
|
67
|
-
storyElement.push(tempStoryElement);
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
// console.log('risi - temp - item', item.cards[i])
|
|
72
|
-
visibleContentsForBlockedStory.push({...item.cards[i],'story-elements' : storyElement});
|
|
73
|
-
if(textStoryFound) break;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
55
|
|
|
78
56
|
return {
|
|
79
57
|
...item,
|
|
80
58
|
...{
|
|
81
|
-
cards:
|
|
59
|
+
cards: [{ ...firstCardObject, 'story-elements': [firstCardElement] }],
|
|
82
60
|
},
|
|
83
61
|
};
|
|
84
62
|
};
|