@blaze-cms/react-page-builder 0.133.0-admin-updates.1 → 0.133.0-admin-updates.6
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 +32 -0
- package/lib/components/Banner/AdSlotRender.js +12 -3
- package/lib/components/Banner/AdSlotRender.js.map +1 -1
- package/lib/components/Banner/Banner.js +4 -7
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Banner/BannerRender.js +5 -1
- package/lib/components/Banner/BannerRender.js.map +1 -1
- package/lib/components/Button.js +1 -1
- package/lib/components/Button.js.map +1 -1
- package/lib/components/List/helpers/get-sort-props.js +9 -6
- package/lib/components/List/helpers/get-sort-props.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/helpers/get-generic-render-variables.js +17 -12
- package/lib/helpers/get-generic-render-variables.js.map +1 -1
- package/lib-es/components/Banner/AdSlotRender.js +12 -3
- package/lib-es/components/Banner/AdSlotRender.js.map +1 -1
- package/lib-es/components/Banner/Banner.js +4 -7
- package/lib-es/components/Banner/Banner.js.map +1 -1
- package/lib-es/components/Banner/BannerRender.js +6 -2
- package/lib-es/components/Banner/BannerRender.js.map +1 -1
- package/lib-es/components/Button.js +1 -1
- package/lib-es/components/Button.js.map +1 -1
- package/lib-es/components/List/helpers/get-sort-props.js +9 -6
- package/lib-es/components/List/helpers/get-sort-props.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib-es/helpers/get-generic-render-variables.js +2 -1
- package/lib-es/helpers/get-generic-render-variables.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Banner/AdSlotRender.js +9 -5
- package/src/components/Banner/Banner.js +9 -11
- package/src/components/Banner/BannerRender.js +4 -0
- package/src/components/Button.js +1 -1
- package/src/components/List/helpers/get-sort-props.js +4 -6
- package/src/components/SearchFilter/SearchFilter/SearchFilter.js +1 -1
- package/src/helpers/get-generic-render-variables.js +2 -1
- package/tests/unit/src/components/Banner/AdSlotRender.test.js +6 -11
- package/tests/unit/src/components/Banner/__snapshots__/AdSlotRender.test.js.snap +45 -25
- package/tests/unit/src/components/Banner/__snapshots__/BannerRender.test.js.snap +8 -3
- package/tests/unit/src/components/List/helpers/get-sort-props.test.js +23 -0
|
@@ -7,7 +7,6 @@ import { useQuery } from '@apollo/client';
|
|
|
7
7
|
import { useRouter } from 'next/router';
|
|
8
8
|
import { buildUserQuery, buildPropsData } from './helpers';
|
|
9
9
|
import { getSingleEntitySchema, getUser } from '../../application/query';
|
|
10
|
-
import Wrapper from '../Wrapper';
|
|
11
10
|
import BannerRender from './BannerRender';
|
|
12
11
|
import buildPropsQuery from '../../helpers/build-props-query';
|
|
13
12
|
import { getClassModifiers } from '../../utils';
|
|
@@ -47,16 +46,15 @@ const Banner = ({ type, ...otherProps }) => {
|
|
|
47
46
|
const bannerKey = `${sizeId}${asPath}`;
|
|
48
47
|
|
|
49
48
|
return (
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
</Wrapper>
|
|
49
|
+
<BannerRender
|
|
50
|
+
key={bannerKey}
|
|
51
|
+
{...otherProps}
|
|
52
|
+
action={action}
|
|
53
|
+
actionKey={actionKey}
|
|
54
|
+
asPath={asPath}
|
|
55
|
+
userPropsData={userPropsData}
|
|
56
|
+
modifiers={modifiers}
|
|
57
|
+
/>
|
|
60
58
|
);
|
|
61
59
|
};
|
|
62
60
|
|
|
@@ -34,6 +34,7 @@ const BannerRender = ({
|
|
|
34
34
|
actionKey,
|
|
35
35
|
renderCounter,
|
|
36
36
|
userPropsData,
|
|
37
|
+
modifiers,
|
|
37
38
|
...otherProps
|
|
38
39
|
}) => {
|
|
39
40
|
const { id } = otherProps;
|
|
@@ -90,6 +91,7 @@ const BannerRender = ({
|
|
|
90
91
|
sizeId={sizeId}
|
|
91
92
|
parsedAdunit={parsedAdunit}
|
|
92
93
|
parsedSizes={parsedSizes}
|
|
94
|
+
modifiers={modifiers}
|
|
93
95
|
targetingArguments={targetingArguments}
|
|
94
96
|
/>
|
|
95
97
|
);
|
|
@@ -108,6 +110,7 @@ BannerRender.propTypes = {
|
|
|
108
110
|
targetings: PropTypes.string,
|
|
109
111
|
sizes: PropTypes.string,
|
|
110
112
|
renderCounter: PropTypes.number,
|
|
113
|
+
modifiers: PropTypes.string,
|
|
111
114
|
userPropsData: PropTypes.object
|
|
112
115
|
};
|
|
113
116
|
|
|
@@ -120,6 +123,7 @@ BannerRender.defaultProps = {
|
|
|
120
123
|
targetings: '',
|
|
121
124
|
sizes: '',
|
|
122
125
|
renderCounter: null,
|
|
126
|
+
modifiers: '',
|
|
123
127
|
userPropsData: {}
|
|
124
128
|
};
|
|
125
129
|
|
package/src/components/Button.js
CHANGED
|
@@ -60,7 +60,7 @@ const Button = props => {
|
|
|
60
60
|
const logout = () => {
|
|
61
61
|
handleLogout(client);
|
|
62
62
|
if (hasChildren(children)) return setShowChildren(true);
|
|
63
|
-
return url ?
|
|
63
|
+
return url ? (window.location.href = urlToUse) : router.reload();
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
const handleClick = () => {
|
|
@@ -6,14 +6,12 @@ const getSortProps = ({
|
|
|
6
6
|
defaultSortBy,
|
|
7
7
|
isTextSearchFilterApplied
|
|
8
8
|
}) => {
|
|
9
|
-
const sort = querySort || (sortProperties.length ? null : defaultSort);
|
|
10
|
-
let sortby = null;
|
|
11
|
-
if (querySortBy) sortby = [querySortBy];
|
|
12
|
-
else if (!sortProperties.length) sortby = defaultSortBy;
|
|
13
|
-
|
|
14
9
|
const updatedSortProperties = [...sortProperties];
|
|
10
|
+
if (!querySort && !sortProperties.length) {
|
|
11
|
+
updatedSortProperties.unshift({ sort: defaultSort, propsToDisplay: defaultSortBy });
|
|
12
|
+
}
|
|
15
13
|
if (isTextSearchFilterApplied) updatedSortProperties.unshift({ isScore: true });
|
|
16
|
-
if (
|
|
14
|
+
if (querySort) updatedSortProperties.unshift({ sort: querySort, propsToDisplay: [querySortBy] });
|
|
17
15
|
|
|
18
16
|
const sortbyFilters = updatedSortProperties
|
|
19
17
|
.map(({ propsToDisplay: filterProps }) => filterProps)
|
|
@@ -3,9 +3,10 @@ import buildSortValues from './build-sort-values';
|
|
|
3
3
|
|
|
4
4
|
const getCorrectSort = (relations, filterProps, stringProps, useSortObject) => {
|
|
5
5
|
const { sort, sortby, sortProperties = [] } = filterProps;
|
|
6
|
+
const [sortProperty = []] = sortProperties || [];
|
|
6
7
|
|
|
7
8
|
return buildSortValues(
|
|
8
|
-
[{ sort, propsToDisplay: sortby }, ...
|
|
9
|
+
[{ sort, propsToDisplay: sortby }, ...[sortProperty]],
|
|
9
10
|
relations,
|
|
10
11
|
stringProps,
|
|
11
12
|
useSortObject
|
|
@@ -50,17 +50,17 @@ describe('Banner render component', () => {
|
|
|
50
50
|
<AdSlotRender {...defaultProps} shouldShowBanner={false} />
|
|
51
51
|
);
|
|
52
52
|
|
|
53
|
-
expect(container.childNodes[0].nodeName).toEqual('
|
|
54
|
-
expect(
|
|
53
|
+
expect(container.childNodes[0].nodeName).toEqual('DIV');
|
|
54
|
+
expect(getByTestId('ad-slot')).toHaveClass('ad-slot ad-slot-loading banner-sizeId');
|
|
55
55
|
expect(() => getByTestId(slotTestId)).toThrow();
|
|
56
56
|
expect(asFragment()).toMatchSnapshot();
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
describe('AdSlot loading', () => {
|
|
60
60
|
it('should render AdSlot', () => {
|
|
61
|
-
const { asFragment,
|
|
61
|
+
const { asFragment, getByTestId } = render(<AdSlotRender {...defaultProps} />);
|
|
62
62
|
expect(getByTestId('adslot-test')).toBeDefined();
|
|
63
|
-
expect(
|
|
63
|
+
expect(getByTestId('ad-slot')).toHaveClass('ad-slot ad-slot-loading banner-sizeId');
|
|
64
64
|
expect(asFragment()).toMatchSnapshot();
|
|
65
65
|
});
|
|
66
66
|
|
|
@@ -69,16 +69,11 @@ describe('Banner render component', () => {
|
|
|
69
69
|
const adSlot = getByTestId(slotTestId);
|
|
70
70
|
|
|
71
71
|
fireEvent.mouseOver(adSlot);
|
|
72
|
-
await waitFor(() =>
|
|
73
|
-
expect(container.childNodes[0]).toHaveClass('ad-slot ad-slot-loaded banner-sizeId')
|
|
74
|
-
);
|
|
75
|
-
expect(container.childNodes[0]).toHaveStyle('min-height: 250px');
|
|
72
|
+
await waitFor(() => expect(container.childNodes[0]).toHaveClass('banner banner-loaded'));
|
|
76
73
|
expect(asFragment()).toMatchSnapshot();
|
|
77
74
|
|
|
78
75
|
fireEvent.mouseLeave(adSlot);
|
|
79
|
-
await waitFor(() =>
|
|
80
|
-
expect(container.childNodes[0]).toHaveClass('ad-slot ad-slot-empty banner-sizeId')
|
|
81
|
-
);
|
|
76
|
+
await waitFor(() => expect(container.childNodes[0]).toHaveClass('banner banner-empty'));
|
|
82
77
|
expect(asFragment()).toMatchSnapshot();
|
|
83
78
|
});
|
|
84
79
|
});
|
|
@@ -3,13 +3,18 @@
|
|
|
3
3
|
exports[`Banner render component AdSlot loading should change class and remove responsive styles after loaded events 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
|
-
class="
|
|
7
|
-
style="min-height: 250px;"
|
|
6
|
+
class="banner banner-loaded"
|
|
8
7
|
>
|
|
9
8
|
<div
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
class="ad-slot ad-slot-loaded banner-sizeId"
|
|
10
|
+
data-testid="ad-slot"
|
|
11
|
+
style="min-height: 250px;"
|
|
12
|
+
>
|
|
13
|
+
<div
|
|
14
|
+
data-testid="adslot-test"
|
|
15
|
+
role="button"
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
13
18
|
</div>
|
|
14
19
|
</DocumentFragment>
|
|
15
20
|
`;
|
|
@@ -17,44 +22,59 @@ exports[`Banner render component AdSlot loading should change class and remove r
|
|
|
17
22
|
exports[`Banner render component AdSlot loading should change class and remove responsive styles after loaded events 2`] = `
|
|
18
23
|
<DocumentFragment>
|
|
19
24
|
<div
|
|
20
|
-
class="
|
|
21
|
-
style=""
|
|
25
|
+
class="banner banner-empty"
|
|
22
26
|
>
|
|
23
27
|
<div
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
class="ad-slot ad-slot-empty banner-sizeId"
|
|
29
|
+
data-testid="ad-slot"
|
|
30
|
+
style=""
|
|
31
|
+
>
|
|
32
|
+
<div
|
|
33
|
+
data-testid="adslot-test"
|
|
34
|
+
role="button"
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
27
37
|
</div>
|
|
28
38
|
</DocumentFragment>
|
|
29
39
|
`;
|
|
30
40
|
|
|
31
41
|
exports[`Banner render component AdSlot loading should render AdSlot 1`] = `
|
|
32
42
|
<DocumentFragment>
|
|
33
|
-
<style>
|
|
34
|
-
@media(min-width:320px){.banner-sizeId{min-height:100px;}
|
|
35
|
-
@media(min-width:728px){.banner-sizeId{min-height:100px;}
|
|
36
|
-
@media(min-width:970px){.banner-sizeId{min-height:250px;}
|
|
37
|
-
</style>
|
|
38
43
|
<div
|
|
39
|
-
class="
|
|
44
|
+
class="banner banner-loading"
|
|
40
45
|
>
|
|
46
|
+
<style>
|
|
47
|
+
@media(min-width:320px){.banner-sizeId{min-height:100px;}
|
|
48
|
+
@media(min-width:728px){.banner-sizeId{min-height:100px;}
|
|
49
|
+
@media(min-width:970px){.banner-sizeId{min-height:250px;}
|
|
50
|
+
</style>
|
|
41
51
|
<div
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
52
|
+
class="ad-slot ad-slot-loading banner-sizeId"
|
|
53
|
+
data-testid="ad-slot"
|
|
54
|
+
>
|
|
55
|
+
<div
|
|
56
|
+
data-testid="adslot-test"
|
|
57
|
+
role="button"
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
45
60
|
</div>
|
|
46
61
|
</DocumentFragment>
|
|
47
62
|
`;
|
|
48
63
|
|
|
49
64
|
exports[`Banner render component should not render AdSlot if shouldShowBanner=false but should render styles and wrapper 1`] = `
|
|
50
65
|
<DocumentFragment>
|
|
51
|
-
<
|
|
52
|
-
|
|
66
|
+
<div
|
|
67
|
+
class="banner banner-loading"
|
|
68
|
+
>
|
|
69
|
+
<style>
|
|
70
|
+
@media(min-width:320px){.banner-sizeId{min-height:100px;}
|
|
53
71
|
@media(min-width:728px){.banner-sizeId{min-height:100px;}
|
|
54
72
|
@media(min-width:970px){.banner-sizeId{min-height:250px;}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
73
|
+
</style>
|
|
74
|
+
<div
|
|
75
|
+
class="ad-slot ad-slot-loading banner-sizeId"
|
|
76
|
+
data-testid="ad-slot"
|
|
77
|
+
/>
|
|
78
|
+
</div>
|
|
59
79
|
</DocumentFragment>
|
|
60
80
|
`;
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Banner render component should render 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
|
-
<style />
|
|
6
5
|
<div
|
|
7
|
-
class="
|
|
8
|
-
|
|
6
|
+
class="banner banner-loading"
|
|
7
|
+
>
|
|
8
|
+
<style />
|
|
9
|
+
<div
|
|
10
|
+
class="ad-slot ad-slot-loading banner-sizeId"
|
|
11
|
+
data-testid="ad-slot"
|
|
12
|
+
/>
|
|
13
|
+
</div>
|
|
9
14
|
</DocumentFragment>
|
|
10
15
|
`;
|
|
@@ -60,6 +60,29 @@ describe('getSortProps helper function', () => {
|
|
|
60
60
|
]);
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
+
it('should add score sort as first value if has textSearch but no sort applied', () => {
|
|
64
|
+
const { updatedSortProperties } = getSortProps({
|
|
65
|
+
...props,
|
|
66
|
+
isTextSearchFilterApplied: true
|
|
67
|
+
});
|
|
68
|
+
expect(updatedSortProperties).toEqual([{ isScore: true }, ...sortProperties]);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('should add default sort and score sort as first value if has textSearch and no other sort', () => {
|
|
72
|
+
const { updatedSortProperties } = getSortProps({
|
|
73
|
+
...props,
|
|
74
|
+
sortProperties: [],
|
|
75
|
+
isTextSearchFilterApplied: true
|
|
76
|
+
});
|
|
77
|
+
expect(updatedSortProperties).toEqual([
|
|
78
|
+
{ isScore: true },
|
|
79
|
+
{
|
|
80
|
+
propsToDisplay: props.defaultSortBy,
|
|
81
|
+
sort: props.defaultSort
|
|
82
|
+
}
|
|
83
|
+
]);
|
|
84
|
+
});
|
|
85
|
+
|
|
63
86
|
it('should use old style sort', () => {
|
|
64
87
|
const { sortbyFilters, updatedSortProperties } = getSortProps({
|
|
65
88
|
...props,
|