@quintype/native-components 2.20.15 → 2.20.17

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,15 @@
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.17](https://github.com/quintype/native-components/compare/v2.20.16...v2.20.17) (2023-11-16)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **icon-text:** Removing fontWeight since it does not work on Android ([913fcdf](https://github.com/quintype/native-components/commit/913fcdf0ee9987a776faa9531f20754abead19f4))
11
+
12
+ ### [2.20.16](https://github.com/quintype/native-components/compare/v2.20.15...v2.20.16) (2023-11-15)
13
+
5
14
  ### [2.20.15](https://github.com/quintype/native-components/compare/v2.20.14...v2.20.15) (2023-10-16)
6
15
 
7
16
  ### [2.20.14](https://github.com/quintype/native-components/compare/v2.20.13...v2.20.14) (2023-10-13)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/native-components",
3
- "version": "2.20.15",
3
+ "version": "2.20.17",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -18,7 +18,6 @@ export const iconTextStyles = () => {
18
18
  color: COLORS.BRAND_BLACK,
19
19
  fontSize: FONT_SIZE.h3,
20
20
  opacity: 0.7,
21
- fontWeight: '500',
22
21
  },
23
22
  });
24
23
  };
@@ -2,7 +2,6 @@ import PropTypes from 'prop-types';
2
2
  import React, { useEffect, useContext } from 'react';
3
3
  import { View, I18nManager } from 'react-native';
4
4
  import { TouchableOpacity } from 'react-native-gesture-handler';
5
- import get from 'lodash/get';
6
5
  import { Text } from '../index';
7
6
  import { StoryHeader } from '../StoryHeader';
8
7
  import { StoryContent } from '../StoryContent';
@@ -13,19 +12,9 @@ import { getTimeInFormat, AppTheme } from '../../utils';
13
12
  import { ShareIcon } from '../../Icons/ShareIcon';
14
13
  import { ClockIcon } from '../../Icons/ClockIcon';
15
14
  import { storyStyles } from './styles';
16
- import { isStoryFree } from '../../utils/story';
15
+ import { isStoryFree, mutateDataBeforeAccess, getFirstVideoElement } from '../../utils/story';
17
16
  import { isMiddleIndexOfArray } from '../../utils/arrayUtils';
18
17
 
19
- const getFirstVideoElement = (cards) => cards
20
- .reduce((acc, currEle) => {
21
- acc = acc.concat(currEle['story-elements']);
22
- return acc;
23
- }, [])
24
- .find(
25
- ({ type, subtype }) => type === 'youtube-video'
26
- || (type === 'jsembed' && subtype === 'dailymotion-video'),
27
- ) || {};
28
-
29
18
  const getLiveBlogTimeStamp = (card, DATE_FORMAT, share, styles, locale) => {
30
19
  const slug = `?cardId=${card.id}`;
31
20
  return (
@@ -45,26 +34,6 @@ const getLiveBlogTimeStamp = (card, DATE_FORMAT, share, styles, locale) => {
45
34
  );
46
35
  };
47
36
 
48
- /* Mutate the data during access check to limit the content shown */
49
- const mutateDataBeforeAccess = (item, storyHasAccess) => {
50
- if (isStoryFree(item) === 0 || storyHasAccess === 'granted') {
51
- return item;
52
- }
53
- if (storyHasAccess !== 'loading' && storyHasAccess === 'granted') {
54
- return item;
55
- }
56
- /* The following steps are necessary to keep argument mutation at bay */
57
- const firstCardObject = get(item, ['cards', 0], {});
58
- const firstCardElement = get(firstCardObject, !STORY_TYPES.VIDEO_STORY && ['story-elements', 0], {});
59
-
60
- return {
61
- ...item,
62
- ...{
63
- cards: [{ ...firstCardObject, 'story-elements': [firstCardElement] }],
64
- },
65
- };
66
- };
67
-
68
37
  const showListicles = (bulletType, index, length, styles) => {
69
38
  switch (bulletType) {
70
39
  case '123':
@@ -1,4 +1,5 @@
1
1
  import get from 'lodash/get';
2
+ import { STORY_TYPES } from './story-types';
2
3
 
3
4
  /**
4
5
  |--------------------------------------------------
@@ -24,3 +25,38 @@ export const isStoryFree = (story = {}) => {
24
25
  */
25
26
 
26
27
  export const getStoryHeadline = (story = {}) => get(story, ['alternative', 'home', 'default', 'headline'], '') || story.headline;
28
+
29
+ /**
30
+ |--------------------------------------------------
31
+ | Get First Video Element
32
+ |--------------------------------------------------
33
+ */
34
+
35
+ export const getFirstVideoElement = (cards) => cards
36
+ .reduce((acc, currEle) => {
37
+ acc = acc.concat(currEle['story-elements']);
38
+ return acc;
39
+ }, [])
40
+ .find(
41
+ ({ type, subtype }) => type === 'youtube-video'
42
+ || (type === 'jsembed' && subtype === 'dailymotion-video'),
43
+ ) || {};
44
+
45
+ export const mutateDataBeforeAccess = (item, storyHasAccess) => {
46
+ if (isStoryFree(item) === 0 || storyHasAccess === 'granted') {
47
+ return item;
48
+ }
49
+ if (storyHasAccess !== 'loading' && storyHasAccess === 'granted') {
50
+ return item;
51
+ }
52
+ /* The following steps are necessary to keep argument mutation at bay */
53
+ const firstCardObject = get(item, ['cards', 0], {});
54
+ const firstCardElement = get(firstCardObject, !STORY_TYPES.VIDEO_STORY && ['story-elements', 0], {});
55
+
56
+ return {
57
+ ...item,
58
+ ...{
59
+ cards: [{ ...firstCardObject, 'story-elements': [firstCardElement] }],
60
+ },
61
+ };
62
+ };