@blaze-cms/react-page-builder 0.128.0-core-styles.0 → 0.128.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 +46 -369
- package/lib/components/Card/Card.js +1 -1
- package/lib/components/Card/Card.js.map +1 -1
- package/lib/components/Card/CardsContainer.js +53 -24
- package/lib/components/Card/CardsContainer.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryFactory.js +2 -1
- package/lib/components/DataSummary/DataSummaryFactory.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js +3 -1
- package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js.map +1 -1
- package/lib/components/DataSummary/helpers/get-link-props.js +23 -0
- package/lib/components/DataSummary/helpers/get-link-props.js.map +1 -0
- package/lib/components/DataSummary/helpers/get-link-to-published-content.js +7 -12
- package/lib/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
- package/lib/components/DataSummary/helpers/index.js +7 -0
- package/lib/components/DataSummary/helpers/index.js.map +1 -1
- package/lib/components/Image/Image.js +1 -1
- package/lib/components/Image/Image.js.map +1 -1
- package/lib/components/List/components/Full/FullRender.js.map +1 -1
- package/lib/components/List/components/helpers/check-if-should-render-banner.js +27 -5
- package/lib/components/List/components/helpers/check-if-should-render-banner.js.map +1 -1
- package/lib/components/List/components/helpers/index.js +8 -2
- package/lib/components/List/components/helpers/index.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/SearchFilter/components/Checkbox.js +6 -1
- package/lib/components/SearchFilter/components/Checkbox.js.map +1 -1
- package/lib/components/SearchFilter/components/Range.js +9 -5
- package/lib/components/SearchFilter/components/Range.js.map +1 -1
- package/lib/components/SearchFilter/components/Select.js +9 -5
- package/lib/components/SearchFilter/components/Select.js.map +1 -1
- package/lib/components/SearchFilter/components/TextSearch.js +9 -5
- package/lib/components/SearchFilter/components/TextSearch.js.map +1 -1
- package/lib/helpers/build-props-query.js +34 -24
- package/lib/helpers/build-props-query.js.map +1 -1
- package/lib/hooks/helpers/RenderComponent.js +3 -2
- package/lib/hooks/helpers/RenderComponent.js.map +1 -1
- package/lib-es/components/Card/Card.js +1 -1
- package/lib-es/components/Card/Card.js.map +1 -1
- package/lib-es/components/Card/CardsContainer.js +59 -35
- package/lib-es/components/Card/CardsContainer.js.map +1 -1
- package/lib-es/components/DataSummary/DataSummaryFactory.js +3 -2
- package/lib-es/components/DataSummary/DataSummaryFactory.js.map +1 -1
- package/lib-es/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js +3 -1
- package/lib-es/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/get-link-props.js +6 -0
- package/lib-es/components/DataSummary/helpers/get-link-props.js.map +1 -0
- package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js +4 -7
- package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/index.js +2 -1
- package/lib-es/components/DataSummary/helpers/index.js.map +1 -1
- package/lib-es/components/Image/Image.js +1 -1
- package/lib-es/components/Image/Image.js.map +1 -1
- package/lib-es/components/List/components/Full/FullRender.js.map +1 -1
- package/lib-es/components/List/components/helpers/check-if-should-render-banner.js +29 -3
- package/lib-es/components/List/components/helpers/check-if-should-render-banner.js.map +1 -1
- package/lib-es/components/List/components/helpers/index.js +3 -2
- package/lib-es/components/List/components/helpers/index.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib-es/components/SearchFilter/components/Checkbox.js +6 -1
- package/lib-es/components/SearchFilter/components/Checkbox.js.map +1 -1
- package/lib-es/components/SearchFilter/components/Range.js +9 -5
- package/lib-es/components/SearchFilter/components/Range.js.map +1 -1
- package/lib-es/components/SearchFilter/components/Select.js +9 -5
- package/lib-es/components/SearchFilter/components/Select.js.map +1 -1
- package/lib-es/components/SearchFilter/components/TextSearch.js +9 -5
- package/lib-es/components/SearchFilter/components/TextSearch.js.map +1 -1
- package/lib-es/helpers/build-props-query.js +22 -9
- package/lib-es/helpers/build-props-query.js.map +1 -1
- package/lib-es/hooks/helpers/RenderComponent.js +3 -2
- package/lib-es/hooks/helpers/RenderComponent.js.map +1 -1
- package/package.json +10 -9
- package/src/components/Card/Card.js +2 -2
- package/src/components/Card/CardsContainer.js +54 -35
- package/src/components/DataSummary/DataSummaryFactory.js +3 -2
- package/src/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js +1 -1
- package/src/components/DataSummary/helpers/get-link-props.js +7 -0
- package/src/components/DataSummary/helpers/get-link-to-published-content.js +4 -8
- package/src/components/DataSummary/helpers/index.js +3 -1
- package/src/components/Image/Image.js +1 -1
- package/src/components/List/components/Full/FullRender.js +0 -1
- package/src/components/List/components/helpers/check-if-should-render-banner.js +24 -3
- package/src/components/List/components/helpers/index.js +4 -2
- package/src/components/SearchFilter/SearchFilter/SearchFilter.js +0 -1
- package/src/components/SearchFilter/components/Checkbox.js +4 -0
- package/src/components/SearchFilter/components/Range.js +7 -4
- package/src/components/SearchFilter/components/Select.js +23 -17
- package/src/components/SearchFilter/components/TextSearch.js +30 -26
- package/src/helpers/build-props-query.js +46 -33
- package/src/hooks/helpers/RenderComponent.js +19 -16
- package/tests/unit/src/components/Card/__snapshots__/Card.test.js.snap +10 -10
- package/tests/unit/src/components/Card/__snapshots__/CardContainer.test.js.snap +8 -8
- package/tests/unit/src/components/DataSummary/DataSummaryTypes/__snapshots__/ItemDetailsSummary.test.js.snap +24 -4
- package/tests/unit/src/components/DataSummary/helpers/get-link-props.test.js +35 -0
- package/tests/unit/src/components/DataSummary/helpers/get-link-to-published-content.test.js +0 -3
- package/tests/unit/src/components/List/components/Cards/__snapshots__/CardsRender.test.js.snap +12 -12
- package/tests/unit/src/components/List/components/helpers/check-if-should-render-banner.test.js +59 -28
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
if (!banner) return false;
|
|
1
|
+
const legacyCheckIfShouldRenderBanner = (elementIndex, banner) => {
|
|
3
2
|
const { interval, repeat, hasBanner } = banner;
|
|
4
3
|
if (!hasBanner || !interval) return false;
|
|
5
4
|
const position = elementIndex + 1;
|
|
@@ -8,5 +7,27 @@ const checkIfShouldRenderBanner = (elementIndex, banner) => {
|
|
|
8
7
|
if (repeat && repeatMatch) return true;
|
|
9
8
|
return false;
|
|
10
9
|
};
|
|
10
|
+
const checkNewBannerSettings = banner => {
|
|
11
|
+
if (!banner) return false;
|
|
12
|
+
|
|
13
|
+
const { repeatEvery, startingPoint, maxRepetitions } = banner;
|
|
14
|
+
return repeatEvery > 0 || startingPoint > 0 || maxRepetitions > 0;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const checkIfShouldRenderBanner = (elementIndex, banner) => {
|
|
18
|
+
if (!banner) return false;
|
|
19
|
+
if (!checkNewBannerSettings(banner)) return legacyCheckIfShouldRenderBanner(elementIndex, banner);
|
|
20
|
+
|
|
21
|
+
const { repeatEvery, startingPoint, maxRepetitions } = banner;
|
|
22
|
+
const position = elementIndex + 1;
|
|
23
|
+
if (position < startingPoint) return false;
|
|
24
|
+
if (position === startingPoint) return true;
|
|
25
|
+
const positionDifference = position - startingPoint;
|
|
26
|
+
if (positionDifference < repeatEvery) return false;
|
|
27
|
+
const timesRepeated = positionDifference / repeatEvery;
|
|
28
|
+
const repeatMatch = Number.isInteger(timesRepeated);
|
|
29
|
+
if (!repeatMatch) return false;
|
|
30
|
+
return timesRepeated < maxRepetitions;
|
|
31
|
+
};
|
|
11
32
|
|
|
12
|
-
export
|
|
33
|
+
export { checkIfShouldRenderBanner, checkNewBannerSettings };
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { checkIfShouldRenderBanner, checkNewBannerSettings } from './check-if-should-render-banner';
|
|
2
|
+
import checkIfShouldRenderGtm from './check-if-should-render-gtm';
|
|
3
|
+
|
|
4
|
+
export { checkIfShouldRenderBanner, checkNewBannerSettings, checkIfShouldRenderGtm };
|
|
@@ -13,6 +13,7 @@ const Checkbox = ({
|
|
|
13
13
|
updateFilterValues,
|
|
14
14
|
filterValues,
|
|
15
15
|
label,
|
|
16
|
+
elementTitle,
|
|
16
17
|
shouldSearch,
|
|
17
18
|
displayFilterCount
|
|
18
19
|
}) => {
|
|
@@ -68,6 +69,7 @@ const Checkbox = ({
|
|
|
68
69
|
|
|
69
70
|
return (
|
|
70
71
|
<>
|
|
72
|
+
{elementTitle && <div className="heading heading--section">{elementTitle}</div>}
|
|
71
73
|
{label ? <p>{label}</p> : ''}
|
|
72
74
|
<Checkboxes
|
|
73
75
|
className="form-checkbox"
|
|
@@ -109,12 +111,14 @@ Checkbox.propTypes = {
|
|
|
109
111
|
updateFilterValues: PropTypes.func.isRequired,
|
|
110
112
|
shouldSearch: PropTypes.bool,
|
|
111
113
|
label: PropTypes.string,
|
|
114
|
+
elementTitle: PropTypes.string,
|
|
112
115
|
displayFilterCount: PropTypes.bool
|
|
113
116
|
};
|
|
114
117
|
|
|
115
118
|
Checkbox.defaultProps = {
|
|
116
119
|
shouldSearch: false,
|
|
117
120
|
label: '',
|
|
121
|
+
elementTitle: '',
|
|
118
122
|
displayFilterCount: false
|
|
119
123
|
};
|
|
120
124
|
|
|
@@ -6,7 +6,6 @@ import { useRouter } from 'next/router';
|
|
|
6
6
|
import Select from '@blaze-react/select';
|
|
7
7
|
import { parseUrl } from 'query-string';
|
|
8
8
|
import { useGetSingleEntitySchema } from '../../../hooks';
|
|
9
|
-
import { withTitle } from '../../../HOC';
|
|
10
9
|
import { getSelectOptions, getIntersectedProp, getRangeValue, calculateMinMax } from '../helpers';
|
|
11
10
|
import { decodeValue } from '../helpers/decode-encode';
|
|
12
11
|
|
|
@@ -18,7 +17,8 @@ const Range = ({
|
|
|
18
17
|
dataAggregations,
|
|
19
18
|
updateFilterValues,
|
|
20
19
|
filterValues,
|
|
21
|
-
shouldSearch
|
|
20
|
+
shouldSearch,
|
|
21
|
+
elementTitle
|
|
22
22
|
}) => {
|
|
23
23
|
const router = useRouter();
|
|
24
24
|
const debounceAmount = shouldSearch ? 1200 : 400;
|
|
@@ -50,6 +50,7 @@ const Range = ({
|
|
|
50
50
|
|
|
51
51
|
return (
|
|
52
52
|
<>
|
|
53
|
+
{elementTitle && <div className="heading heading--section">{elementTitle}</div>}
|
|
53
54
|
{hasMultipleOptions && (
|
|
54
55
|
<>
|
|
55
56
|
<label>{label}</label>
|
|
@@ -93,13 +94,15 @@ Range.propTypes = {
|
|
|
93
94
|
shouldSearch: PropTypes.bool,
|
|
94
95
|
rangeInterval: PropTypes.number,
|
|
95
96
|
label: PropTypes.string,
|
|
97
|
+
elementTitle: PropTypes.string,
|
|
96
98
|
dataAggregations: PropTypes.object.isRequired
|
|
97
99
|
};
|
|
98
100
|
|
|
99
101
|
Range.defaultProps = {
|
|
100
102
|
shouldSearch: false,
|
|
101
103
|
rangeInterval: 1,
|
|
102
|
-
label: ''
|
|
104
|
+
label: '',
|
|
105
|
+
elementTitle: ''
|
|
103
106
|
};
|
|
104
107
|
|
|
105
|
-
export default
|
|
108
|
+
export default Range;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import Select from '@blaze-react/select';
|
|
4
|
-
import { withTitle } from '../../../HOC';
|
|
5
4
|
import { DEFAULT_OPTION } from '../constants';
|
|
6
5
|
|
|
7
6
|
const SelectFilter = ({
|
|
@@ -12,7 +11,8 @@ const SelectFilter = ({
|
|
|
12
11
|
filterValues,
|
|
13
12
|
shouldSearch,
|
|
14
13
|
displayLabelAsPlaceholder,
|
|
15
|
-
displayFilterCount
|
|
14
|
+
displayFilterCount,
|
|
15
|
+
elementTitle
|
|
16
16
|
}) => {
|
|
17
17
|
const filterValue = filterValues[prop] || '';
|
|
18
18
|
const disabledOptions = [];
|
|
@@ -35,20 +35,23 @@ const SelectFilter = ({
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
38
|
+
<>
|
|
39
|
+
{elementTitle && <div className="heading heading--section">{elementTitle}</div>}
|
|
40
|
+
<Select
|
|
41
|
+
label={labelToUse}
|
|
42
|
+
value={filterValue}
|
|
43
|
+
id={prop}
|
|
44
|
+
data-testid={`filter-${prop}`}
|
|
45
|
+
options={options}
|
|
46
|
+
defaultTextValue={defaultTextValue}
|
|
47
|
+
onChange={({ value }) => {
|
|
48
|
+
let valueToUse = value;
|
|
49
|
+
if (value === defaultTextValue) valueToUse = '';
|
|
50
|
+
updateFilterValues({ [prop]: valueToUse }, shouldSearch);
|
|
51
|
+
}}
|
|
52
|
+
disabled={disabledOptions}
|
|
53
|
+
/>
|
|
54
|
+
</>
|
|
52
55
|
);
|
|
53
56
|
};
|
|
54
57
|
|
|
@@ -59,6 +62,8 @@ SelectFilter.propTypes = {
|
|
|
59
62
|
updateFilterValues: PropTypes.func.isRequired,
|
|
60
63
|
shouldSearch: PropTypes.bool,
|
|
61
64
|
label: PropTypes.string,
|
|
65
|
+
elementTitle: PropTypes.string,
|
|
66
|
+
|
|
62
67
|
displayLabelAsPlaceholder: PropTypes.bool,
|
|
63
68
|
displayFilterCount: PropTypes.bool
|
|
64
69
|
};
|
|
@@ -67,8 +72,9 @@ SelectFilter.defaultProps = {
|
|
|
67
72
|
filterValues: {},
|
|
68
73
|
shouldSearch: false,
|
|
69
74
|
label: '',
|
|
75
|
+
elementTitle: '',
|
|
70
76
|
displayLabelAsPlaceholder: false,
|
|
71
77
|
displayFilterCount: false
|
|
72
78
|
};
|
|
73
79
|
|
|
74
|
-
export default
|
|
80
|
+
export default SelectFilter;
|
|
@@ -2,45 +2,49 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import Input from '@blaze-react/input';
|
|
4
4
|
import { MdSearch } from 'react-icons/md';
|
|
5
|
-
import { withTitle } from '../../../HOC';
|
|
6
5
|
import { SEARCH_TERM } from '../constants';
|
|
7
6
|
|
|
8
|
-
const TextSearch = ({ label, searchValue, updateFilterValues }) => (
|
|
9
|
-
|
|
10
|
-
<div className="
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
const TextSearch = ({ label, searchValue, updateFilterValues, elementTitle }) => (
|
|
8
|
+
<>
|
|
9
|
+
{elementTitle && <div className="heading heading--section">{elementTitle}</div>}
|
|
10
|
+
<div className="search">
|
|
11
|
+
<div className="search__wrapper">
|
|
12
|
+
<div className="form-field form-field--input form-field--search">
|
|
13
|
+
<Input
|
|
14
|
+
id={SEARCH_TERM}
|
|
15
|
+
value={searchValue}
|
|
16
|
+
placeholder={label || 'Search'}
|
|
17
|
+
onChange={({ value: eValue }) => {
|
|
18
|
+
updateFilterValues({ [SEARCH_TERM]: eValue }, false);
|
|
19
|
+
}}
|
|
20
|
+
/>
|
|
21
|
+
</div>
|
|
22
|
+
<button
|
|
23
|
+
type="button"
|
|
24
|
+
className="icon-button icon-button--search"
|
|
25
|
+
onClick={e => {
|
|
26
|
+
e.preventDefault();
|
|
27
|
+
updateFilterValues({ [SEARCH_TERM]: searchValue }, true);
|
|
28
|
+
}}>
|
|
29
|
+
<i>
|
|
30
|
+
<MdSearch />
|
|
31
|
+
</i>
|
|
32
|
+
</button>
|
|
20
33
|
</div>
|
|
21
|
-
<button
|
|
22
|
-
type="button"
|
|
23
|
-
className="icon-button icon-button--search"
|
|
24
|
-
onClick={e => {
|
|
25
|
-
e.preventDefault();
|
|
26
|
-
updateFilterValues({ [SEARCH_TERM]: searchValue }, true);
|
|
27
|
-
}}>
|
|
28
|
-
<i>
|
|
29
|
-
<MdSearch />
|
|
30
|
-
</i>
|
|
31
|
-
</button>
|
|
32
34
|
</div>
|
|
33
|
-
|
|
35
|
+
</>
|
|
34
36
|
);
|
|
35
37
|
|
|
36
38
|
TextSearch.propTypes = {
|
|
37
39
|
searchValue: PropTypes.string.isRequired,
|
|
38
40
|
updateFilterValues: PropTypes.func.isRequired,
|
|
41
|
+
elementTitle: PropTypes.string,
|
|
39
42
|
label: PropTypes.string
|
|
40
43
|
};
|
|
41
44
|
|
|
42
45
|
TextSearch.defaultProps = {
|
|
46
|
+
elementTitle: '',
|
|
43
47
|
label: ''
|
|
44
48
|
};
|
|
45
49
|
|
|
46
|
-
export default
|
|
50
|
+
export default TextSearch;
|
|
@@ -6,7 +6,7 @@ const categoryProps = 'id publishedListingPage{id, url}';
|
|
|
6
6
|
const checkProps = props =>
|
|
7
7
|
!!(props && Object.keys(props).filter(prop => prop === CATEGORY_ID).length);
|
|
8
8
|
|
|
9
|
-
const buildPropsQuery = (entitySchema, extraProps = [], cardOptions = null) => {
|
|
9
|
+
const buildPropsQuery = (entitySchema, extraProps = [], cardOptions = null, linkProps = []) => {
|
|
10
10
|
const parsedSchema = entitySchema.getEntitySchema ? entitySchema.getEntitySchema : entitySchema;
|
|
11
11
|
const extraPropsHaveCategory = !!extraProps.filter(prop => prop.includes('category.')).length;
|
|
12
12
|
const { typeBasedProps, shouldAddCategoryProps } = getTypeBaseProps(
|
|
@@ -16,39 +16,55 @@ const buildPropsQuery = (entitySchema, extraProps = [], cardOptions = null) => {
|
|
|
16
16
|
);
|
|
17
17
|
|
|
18
18
|
const allProps = [...typeBasedProps, ...extraProps];
|
|
19
|
-
|
|
20
19
|
const uniqueProps = [...new Set([...allProps])];
|
|
20
|
+
const basicProps = [];
|
|
21
|
+
const nestedProps = {};
|
|
22
|
+
uniqueProps.forEach(prop => {
|
|
23
|
+
if (prop) {
|
|
24
|
+
if (!prop.includes('.')) {
|
|
25
|
+
basicProps.push(prop);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const [base, nested] = prop.split('.');
|
|
29
|
+
if (!nestedProps[base]) nestedProps[base] = [nested];
|
|
30
|
+
else nestedProps[base].push(nested);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const complexProps = buildComplexProps(
|
|
35
|
+
shouldAddCategoryProps,
|
|
36
|
+
nestedProps,
|
|
37
|
+
parsedSchema,
|
|
38
|
+
linkProps
|
|
39
|
+
);
|
|
21
40
|
|
|
22
|
-
const basicProps = uniqueProps
|
|
23
|
-
.filter(prop => prop && !prop.includes('.'))
|
|
24
|
-
.filter((prop, i, arr) => arr.indexOf(prop) === i);
|
|
25
|
-
const complexProps = buildComplexProps(shouldAddCategoryProps, uniqueProps, parsedSchema);
|
|
26
41
|
return [...basicProps, ...complexProps].join(',');
|
|
27
42
|
};
|
|
28
43
|
|
|
29
|
-
const buildComplexProps = (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
}
|
|
44
|
+
const buildComplexProps = (
|
|
45
|
+
shouldAddCategoryProps,
|
|
46
|
+
props,
|
|
47
|
+
{ relations = [], dynamicProperties = {} },
|
|
48
|
+
linkProps
|
|
49
|
+
) =>
|
|
50
|
+
Object.keys(props).map(base => {
|
|
51
|
+
const nestedProps = props[base];
|
|
52
|
+
const hasLink = !!linkProps.find(linkProp => linkProp.includes(base));
|
|
53
|
+
const matchingRelation = relations.find(({ localField }) => localField === base);
|
|
54
|
+
const matchingDynamicProp = Object.keys(dynamicProperties).find(
|
|
55
|
+
dynamicKey => dynamicKey === base
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
if (matchingRelation && !nestedProps.includes('id')) nestedProps.push('id');
|
|
59
|
+
if (hasLink && (!!matchingRelation || !!matchingDynamicProp)) nestedProps.push('url');
|
|
60
|
+
const jointNestedProps = nestedProps.join(',');
|
|
61
|
+
if (base === 'category' && shouldAddCategoryProps)
|
|
62
|
+
return `${base}{${jointNestedProps}, ${categoryProps}}`;
|
|
63
|
+
if (base.includes('published')) {
|
|
64
|
+
return `${base}{${jointNestedProps},url}`;
|
|
65
|
+
}
|
|
66
|
+
return `${base}{${jointNestedProps}}`;
|
|
67
|
+
});
|
|
52
68
|
|
|
53
69
|
const getTypeBaseProps = (entitySchema, cardOptions, extraPropsHaveCategory) => {
|
|
54
70
|
const isCard = !!cardOptions;
|
|
@@ -83,12 +99,9 @@ const getContentProps = isContent => (isContent ? ['url', 'sponsored', 'featured
|
|
|
83
99
|
|
|
84
100
|
const getCategoyProps = (shouldAddCategoryProps, hasCategory, hasPreheader) => {
|
|
85
101
|
if (!shouldAddCategoryProps) return [];
|
|
86
|
-
|
|
87
102
|
const props = [];
|
|
88
|
-
|
|
89
|
-
if (hasCategory) {
|
|
103
|
+
if (hasCategory)
|
|
90
104
|
props.push('category.name', 'category.listingPageId', 'category.listingPageEntity');
|
|
91
|
-
}
|
|
92
105
|
|
|
93
106
|
if (hasPreheader) {
|
|
94
107
|
props.push(`${PREHEADER_PROP}{name}`);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import ErrorBoundary from '@blaze-cms/core-errors-ui';
|
|
3
4
|
import getComponent from './getComponent';
|
|
4
5
|
import appendGtmClassName from './append-gtm-classname';
|
|
5
6
|
import { PB_TYPE_IMAGE, PB_TYPE_BANNER, PB_TYPE_TEXTBLOCK, PB_TYPE_CAROUSEL } from './constants';
|
|
@@ -25,22 +26,24 @@ const RenderComponent = ({
|
|
|
25
26
|
const updatedSettings = appendGtmClassName(settings, childComponents);
|
|
26
27
|
|
|
27
28
|
return (
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
29
|
+
<ErrorBoundary>
|
|
30
|
+
<Component
|
|
31
|
+
key={id}
|
|
32
|
+
type={type}
|
|
33
|
+
{...options}
|
|
34
|
+
{...imageOptions}
|
|
35
|
+
{...nestedComponentsProps}
|
|
36
|
+
{...updatedSettings}
|
|
37
|
+
name={name || settings.name}>
|
|
38
|
+
{hasTextBlockBanners ? (
|
|
39
|
+
<BannerContextProvider siblings={siblings} banners={textBlockBanners} pbOptions={options}>
|
|
40
|
+
{childComponents}
|
|
41
|
+
</BannerContextProvider>
|
|
42
|
+
) : (
|
|
43
|
+
childComponents
|
|
44
|
+
)}
|
|
45
|
+
</Component>
|
|
46
|
+
</ErrorBoundary>
|
|
44
47
|
);
|
|
45
48
|
};
|
|
46
49
|
|
|
@@ -30,7 +30,7 @@ exports[`Card component should not render alternative headline if alternativePre
|
|
|
30
30
|
>
|
|
31
31
|
category-name
|
|
32
32
|
</a>
|
|
33
|
-
<
|
|
33
|
+
<div
|
|
34
34
|
class="card__title card__title--portrait "
|
|
35
35
|
>
|
|
36
36
|
<a
|
|
@@ -38,7 +38,7 @@ exports[`Card component should not render alternative headline if alternativePre
|
|
|
38
38
|
>
|
|
39
39
|
mock name
|
|
40
40
|
</a>
|
|
41
|
-
</
|
|
41
|
+
</div>
|
|
42
42
|
<div
|
|
43
43
|
class="card__details card__details--portrait"
|
|
44
44
|
>
|
|
@@ -99,7 +99,7 @@ exports[`Card component should not render alternative headline if displayCategor
|
|
|
99
99
|
<div
|
|
100
100
|
class="card__content card__content--portrait"
|
|
101
101
|
>
|
|
102
|
-
<
|
|
102
|
+
<div
|
|
103
103
|
class="card__title card__title--portrait "
|
|
104
104
|
>
|
|
105
105
|
<a
|
|
@@ -107,7 +107,7 @@ exports[`Card component should not render alternative headline if displayCategor
|
|
|
107
107
|
>
|
|
108
108
|
mock name
|
|
109
109
|
</a>
|
|
110
|
-
</
|
|
110
|
+
</div>
|
|
111
111
|
<div
|
|
112
112
|
class="card__details card__details--portrait"
|
|
113
113
|
>
|
|
@@ -174,7 +174,7 @@ exports[`Card component should not render preHeader if alternativeHeadline is no
|
|
|
174
174
|
>
|
|
175
175
|
category-name
|
|
176
176
|
</a>
|
|
177
|
-
<
|
|
177
|
+
<div
|
|
178
178
|
class="card__title card__title--portrait "
|
|
179
179
|
>
|
|
180
180
|
<a
|
|
@@ -182,7 +182,7 @@ exports[`Card component should not render preHeader if alternativeHeadline is no
|
|
|
182
182
|
>
|
|
183
183
|
mock name
|
|
184
184
|
</a>
|
|
185
|
-
</
|
|
185
|
+
</div>
|
|
186
186
|
<div
|
|
187
187
|
class="card__details card__details--portrait"
|
|
188
188
|
>
|
|
@@ -248,7 +248,7 @@ exports[`Card component should render customPreheader and alternativeHeadline in
|
|
|
248
248
|
>
|
|
249
249
|
Pre header
|
|
250
250
|
</div>
|
|
251
|
-
<
|
|
251
|
+
<div
|
|
252
252
|
class="card__title card__title--portrait "
|
|
253
253
|
>
|
|
254
254
|
<a
|
|
@@ -256,7 +256,7 @@ exports[`Card component should render customPreheader and alternativeHeadline in
|
|
|
256
256
|
>
|
|
257
257
|
Alternative headline
|
|
258
258
|
</a>
|
|
259
|
-
</
|
|
259
|
+
</div>
|
|
260
260
|
<div
|
|
261
261
|
class="card__details card__details--portrait"
|
|
262
262
|
>
|
|
@@ -323,7 +323,7 @@ exports[`Card component should render without throwing an error and match snapsh
|
|
|
323
323
|
>
|
|
324
324
|
category-name
|
|
325
325
|
</a>
|
|
326
|
-
<
|
|
326
|
+
<div
|
|
327
327
|
class="card__title card__title--portrait "
|
|
328
328
|
>
|
|
329
329
|
<a
|
|
@@ -331,7 +331,7 @@ exports[`Card component should render without throwing an error and match snapsh
|
|
|
331
331
|
>
|
|
332
332
|
mock name
|
|
333
333
|
</a>
|
|
334
|
-
</
|
|
334
|
+
</div>
|
|
335
335
|
<div
|
|
336
336
|
class="card__details card__details--portrait"
|
|
337
337
|
>
|
|
@@ -36,7 +36,7 @@ exports[`CardsContainer component should render with carousel if option is enabl
|
|
|
36
36
|
>
|
|
37
37
|
page
|
|
38
38
|
</div>
|
|
39
|
-
<
|
|
39
|
+
<div
|
|
40
40
|
class="card__title card__title--portrait "
|
|
41
41
|
>
|
|
42
42
|
<a
|
|
@@ -44,7 +44,7 @@ exports[`CardsContainer component should render with carousel if option is enabl
|
|
|
44
44
|
>
|
|
45
45
|
Swan 78
|
|
46
46
|
</a>
|
|
47
|
-
</
|
|
47
|
+
</div>
|
|
48
48
|
</div>
|
|
49
49
|
<div
|
|
50
50
|
class="card__child-content"
|
|
@@ -73,7 +73,7 @@ exports[`CardsContainer component should render with carousel if option is enabl
|
|
|
73
73
|
>
|
|
74
74
|
page
|
|
75
75
|
</div>
|
|
76
|
-
<
|
|
76
|
+
<div
|
|
77
77
|
class="card__title card__title--portrait "
|
|
78
78
|
>
|
|
79
79
|
<a
|
|
@@ -81,7 +81,7 @@ exports[`CardsContainer component should render with carousel if option is enabl
|
|
|
81
81
|
>
|
|
82
82
|
Swan 98
|
|
83
83
|
</a>
|
|
84
|
-
</
|
|
84
|
+
</div>
|
|
85
85
|
</div>
|
|
86
86
|
<div
|
|
87
87
|
class="card__child-content"
|
|
@@ -123,7 +123,7 @@ exports[`CardsContainer component should render without throwing error and match
|
|
|
123
123
|
>
|
|
124
124
|
page
|
|
125
125
|
</div>
|
|
126
|
-
<
|
|
126
|
+
<div
|
|
127
127
|
class="card__title card__title--portrait "
|
|
128
128
|
>
|
|
129
129
|
<a
|
|
@@ -131,7 +131,7 @@ exports[`CardsContainer component should render without throwing error and match
|
|
|
131
131
|
>
|
|
132
132
|
Swan 78
|
|
133
133
|
</a>
|
|
134
|
-
</
|
|
134
|
+
</div>
|
|
135
135
|
</div>
|
|
136
136
|
<div
|
|
137
137
|
class="card__child-content"
|
|
@@ -160,7 +160,7 @@ exports[`CardsContainer component should render without throwing error and match
|
|
|
160
160
|
>
|
|
161
161
|
page
|
|
162
162
|
</div>
|
|
163
|
-
<
|
|
163
|
+
<div
|
|
164
164
|
class="card__title card__title--portrait "
|
|
165
165
|
>
|
|
166
166
|
<a
|
|
@@ -168,7 +168,7 @@ exports[`CardsContainer component should render without throwing error and match
|
|
|
168
168
|
>
|
|
169
169
|
Swan 98
|
|
170
170
|
</a>
|
|
171
|
-
</
|
|
171
|
+
</div>
|
|
172
172
|
</div>
|
|
173
173
|
<div
|
|
174
174
|
class="card__child-content"
|
|
@@ -13,12 +13,22 @@ exports[`ItemDetailsSummary component should render without throwing an error an
|
|
|
13
13
|
<span
|
|
14
14
|
class=""
|
|
15
15
|
>
|
|
16
|
-
|
|
16
|
+
<span
|
|
17
|
+
class="item-details-summary-label"
|
|
18
|
+
>
|
|
19
|
+
first
|
|
20
|
+
</span>
|
|
21
|
+
something
|
|
17
22
|
</span>
|
|
18
23
|
<span
|
|
19
24
|
class=""
|
|
20
25
|
>
|
|
21
|
-
|
|
26
|
+
<span
|
|
27
|
+
class="item-details-summary-label"
|
|
28
|
+
>
|
|
29
|
+
second
|
|
30
|
+
</span>
|
|
31
|
+
other thing
|
|
22
32
|
</span>
|
|
23
33
|
</div>
|
|
24
34
|
</DocumentFragment>
|
|
@@ -37,12 +47,22 @@ exports[`ItemDetailsSummary component should render without throwing an error if
|
|
|
37
47
|
<span
|
|
38
48
|
class=""
|
|
39
49
|
>
|
|
40
|
-
|
|
50
|
+
<span
|
|
51
|
+
class="item-details-summary-label"
|
|
52
|
+
>
|
|
53
|
+
first
|
|
54
|
+
</span>
|
|
55
|
+
something
|
|
41
56
|
</span>
|
|
42
57
|
<span
|
|
43
58
|
class=""
|
|
44
59
|
>
|
|
45
|
-
|
|
60
|
+
<span
|
|
61
|
+
class="item-details-summary-label"
|
|
62
|
+
>
|
|
63
|
+
second
|
|
64
|
+
</span>
|
|
65
|
+
other thing
|
|
46
66
|
</span>
|
|
47
67
|
</div>
|
|
48
68
|
</DocumentFragment>
|