@blaze-cms/react-page-builder 0.132.0 → 0.133.0-admin-updates.1
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 +24 -0
- package/lib/components/Banner/BannerRender.js +2 -2
- package/lib/components/Banner/BannerRender.js.map +1 -1
- package/lib/components/Banner/helpers.js +2 -2
- package/lib/components/Banner/helpers.js.map +1 -1
- package/lib/components/BlazeLink.js +2 -2
- package/lib/components/BlazeLink.js.map +1 -1
- package/lib/components/Button.js +2 -2
- package/lib/components/Button.js.map +1 -1
- package/lib/components/Card/CardsContainer.js +2 -2
- package/lib/components/Card/CardsContainer.js.map +1 -1
- package/lib/components/Card/CardsRender.js +2 -2
- package/lib/components/Card/CardsRender.js.map +1 -1
- package/lib/components/Card/helpers/filter-query-setup.js +11 -5
- package/lib/components/Card/helpers/filter-query-setup.js.map +1 -1
- package/lib/components/ClickWrapper.js +2 -2
- package/lib/components/ClickWrapper.js.map +1 -1
- package/lib/components/Code/Code.js +2 -2
- package/lib/components/Code/Code.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-loop-props-content.js +3 -2
- package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib/components/DataSummary/helpers/get-link-to-published-content.js +2 -0
- package/lib/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
- package/lib/components/Image/Image.js +2 -2
- package/lib/components/Image/Image.js.map +1 -1
- package/lib/components/Layout/Layout.js +2 -2
- package/lib/components/Layout/Layout.js.map +1 -1
- package/lib/components/List/ListBuilder.js +46 -26
- package/lib/components/List/ListBuilder.js.map +1 -1
- package/lib/components/List/ListFactory.js +5 -5
- package/lib/components/List/ListFactory.js.map +1 -1
- package/lib/components/List/components/Cards/CardsRender.js +2 -2
- package/lib/components/List/components/Cards/CardsRender.js.map +1 -1
- package/lib/components/List/components/Full/FullRender.js +2 -2
- package/lib/components/List/components/Full/FullRender.js.map +1 -1
- package/lib/components/List/components/Full/FullRenderItem.js +2 -2
- package/lib/components/List/components/Full/FullRenderItem.js.map +1 -1
- package/lib/components/List/components/Pagination/ListPagination.js +2 -2
- package/lib/components/List/components/Pagination/ListPagination.js.map +1 -1
- package/lib/components/List/helpers/build-az-url.js +2 -2
- package/lib/components/List/helpers/build-az-url.js.map +1 -1
- package/lib/components/List/helpers/build-pagination-url.js +2 -2
- package/lib/components/List/helpers/build-pagination-url.js.map +1 -1
- package/lib/components/List/helpers/get-list-query.js +6 -2
- package/lib/components/List/helpers/get-list-query.js.map +1 -1
- package/lib/components/List/helpers/get-sort-props.js +5 -1
- package/lib/components/List/helpers/get-sort-props.js.map +1 -1
- package/lib/components/SearchFilter/components/Range.js +2 -2
- package/lib/components/SearchFilter/components/Range.js.map +1 -1
- package/lib/components/SearchFilter/searchFilterReducer.js +2 -2
- package/lib/components/SearchFilterSort/helpers/update-sort.js +2 -2
- package/lib/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
- package/lib/components/TextBlock/index.js +2 -2
- package/lib/components/TextBlock/index.js.map +1 -1
- package/lib/components/Video/Video.js +2 -2
- package/lib/components/Video/Video.js.map +1 -1
- package/lib/components/Video/providers/JWPlayer/JWPlayerProvider.js +2 -2
- package/lib/components/Video/providers/JWPlayer/JWPlayerProvider.js.map +1 -1
- package/lib/constants/index.js +4 -34
- package/lib/constants/index.js.map +1 -1
- package/lib/helpers/append-images.js +2 -2
- package/lib/helpers/build-az-filter.js +8 -7
- package/lib/helpers/build-az-filter.js.map +1 -1
- package/lib/helpers/build-raw-query-base.js +2 -2
- package/lib/helpers/build-raw-query-base.js.map +1 -1
- package/lib/helpers/build-raw-query.js +30 -8
- package/lib/helpers/build-raw-query.js.map +1 -1
- package/lib/helpers/build-sort-values.js +49 -0
- package/lib/helpers/build-sort-values.js.map +1 -0
- package/lib/helpers/get-banner-data.js +2 -2
- package/lib/helpers/get-click-wrapper-options.js +2 -2
- package/lib/helpers/get-click-wrapper-options.js.map +1 -1
- package/lib/helpers/get-entities-with-banner.js +2 -2
- package/lib/helpers/get-entities-with-banner.js.map +1 -1
- package/lib/helpers/get-extra-az-bits.js +46 -3
- package/lib/helpers/get-extra-az-bits.js.map +1 -1
- package/lib/helpers/get-generic-props.js +2 -2
- package/lib/helpers/get-generic-props.js.map +1 -1
- package/lib/helpers/get-generic-render-variables.js +30 -37
- package/lib/helpers/get-generic-render-variables.js.map +1 -1
- package/lib/helpers/inject-multiple-banners/get-banners-for-nodes/get-banners-for-nodes.js +2 -2
- package/lib/helpers/inject-multiple-banners/get-banners-for-nodes/get-banners-for-nodes.js.map +1 -1
- package/lib/helpers/process-data-summary-value.js +2 -2
- package/lib/helpers/process-data-summary-value.js.map +1 -1
- package/lib/helpers/remove-unwanted-characters.js +2 -2
- package/lib/helpers/render-children.js +2 -2
- package/lib/helpers/render-children.js.map +1 -1
- package/lib/helpers/split-children.js +2 -2
- package/lib/helpers/update-childrens-parent.js +2 -2
- package/lib/hooks/helpers/append-gtm-classname.js +2 -2
- package/lib/hooks/helpers/append-gtm-classname.js.map +1 -1
- package/lib/hooks/helpers/buildPBComponents.js +2 -2
- package/lib/hooks/helpers/buildPBComponents.js.map +1 -1
- package/lib/hooks/helpers/get-lightbox-images.js +2 -2
- package/lib/hooks/helpers/get-lightbox-images.js.map +1 -1
- package/lib/hooks/helpers/inject-element-banners.js +2 -2
- package/lib/hooks/helpers/inject-element-banners.js.map +1 -1
- package/lib/hooks/helpers/inject-textblock-banners.js +2 -2
- package/lib/hooks/helpers/inject-textblock-banners.js.map +1 -1
- package/lib/utils/get-class-modifiers.js +2 -2
- package/lib/utils/get-class-modifiers.js.map +1 -1
- package/lib-es/components/Banner/BannerRender.js +2 -2
- package/lib-es/components/Banner/helpers.js +2 -2
- package/lib-es/components/BlazeLink.js +2 -2
- package/lib-es/components/Button.js +2 -2
- package/lib-es/components/Card/CardsContainer.js +2 -2
- package/lib-es/components/Card/CardsRender.js +2 -2
- package/lib-es/components/Card/helpers/filter-query-setup.js +11 -5
- package/lib-es/components/Card/helpers/filter-query-setup.js.map +1 -1
- package/lib-es/components/ClickWrapper.js +2 -2
- package/lib-es/components/Code/Code.js +2 -2
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js +3 -2
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js +2 -1
- package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
- package/lib-es/components/Image/Image.js +2 -2
- package/lib-es/components/Layout/Layout.js +2 -2
- package/lib-es/components/List/ListBuilder.js +46 -26
- package/lib-es/components/List/ListBuilder.js.map +1 -1
- package/lib-es/components/List/ListFactory.js +5 -5
- package/lib-es/components/List/ListFactory.js.map +1 -1
- package/lib-es/components/List/components/Cards/CardsRender.js +2 -2
- package/lib-es/components/List/components/Full/FullRender.js +2 -2
- package/lib-es/components/List/components/Full/FullRenderItem.js +2 -2
- package/lib-es/components/List/components/Pagination/ListPagination.js +2 -2
- package/lib-es/components/List/helpers/build-az-url.js +2 -2
- package/lib-es/components/List/helpers/build-pagination-url.js +2 -2
- package/lib-es/components/List/helpers/get-list-query.js +5 -2
- package/lib-es/components/List/helpers/get-list-query.js.map +1 -1
- package/lib-es/components/List/helpers/get-sort-props.js +5 -1
- package/lib-es/components/List/helpers/get-sort-props.js.map +1 -1
- package/lib-es/components/SearchFilter/components/Range.js +2 -2
- package/lib-es/components/SearchFilter/searchFilterReducer.js +2 -2
- package/lib-es/components/SearchFilterSort/helpers/update-sort.js +2 -2
- package/lib-es/components/TextBlock/index.js +2 -2
- package/lib-es/components/Video/Video.js +2 -2
- package/lib-es/components/Video/providers/JWPlayer/JWPlayerProvider.js +2 -2
- package/lib-es/constants/index.js +2 -31
- package/lib-es/constants/index.js.map +1 -1
- package/lib-es/helpers/append-images.js +2 -2
- package/lib-es/helpers/build-az-filter.js +3 -2
- package/lib-es/helpers/build-az-filter.js.map +1 -1
- package/lib-es/helpers/build-raw-query-base.js +2 -2
- package/lib-es/helpers/build-raw-query.js +27 -8
- package/lib-es/helpers/build-raw-query.js.map +1 -1
- package/lib-es/helpers/build-sort-values.js +34 -0
- package/lib-es/helpers/build-sort-values.js.map +1 -0
- package/lib-es/helpers/get-banner-data.js +2 -2
- package/lib-es/helpers/get-click-wrapper-options.js +2 -2
- package/lib-es/helpers/get-entities-with-banner.js +2 -2
- package/lib-es/helpers/get-extra-az-bits.js +48 -2
- package/lib-es/helpers/get-extra-az-bits.js.map +1 -1
- package/lib-es/helpers/get-generic-props.js +2 -2
- package/lib-es/helpers/get-generic-render-variables.js +24 -28
- package/lib-es/helpers/get-generic-render-variables.js.map +1 -1
- package/lib-es/helpers/inject-multiple-banners/get-banners-for-nodes/get-banners-for-nodes.js +2 -2
- package/lib-es/helpers/process-data-summary-value.js +2 -2
- package/lib-es/helpers/remove-unwanted-characters.js +2 -2
- package/lib-es/helpers/render-children.js +2 -2
- package/lib-es/helpers/split-children.js +2 -2
- package/lib-es/helpers/update-childrens-parent.js +2 -2
- package/lib-es/hooks/helpers/append-gtm-classname.js +2 -2
- package/lib-es/hooks/helpers/buildPBComponents.js +2 -2
- package/lib-es/hooks/helpers/get-lightbox-images.js +2 -2
- package/lib-es/hooks/helpers/inject-element-banners.js +2 -2
- package/lib-es/hooks/helpers/inject-textblock-banners.js +2 -2
- package/lib-es/utils/get-class-modifiers.js +2 -2
- package/package.json +10 -10
- package/src/components/Card/helpers/filter-query-setup.js +4 -5
- package/src/components/DataSummary/helpers/build-loop-props-content.js +3 -2
- package/src/components/DataSummary/helpers/get-link-to-published-content.js +4 -1
- package/src/components/List/ListBuilder.js +46 -55
- package/src/components/List/ListFactory.js +9 -7
- package/src/components/List/helpers/get-list-query.js +5 -2
- package/src/components/List/helpers/get-sort-props.js +9 -1
- package/src/constants/index.js +2 -32
- package/src/helpers/build-az-filter.js +3 -2
- package/src/helpers/build-raw-query.js +13 -7
- package/src/helpers/build-sort-values.js +32 -0
- package/src/helpers/get-extra-az-bits.js +40 -2
- package/src/helpers/get-generic-render-variables.js +20 -27
- package/tests/unit/src/components/DataSummary/helpers/build-loop-props-content.test.js +41 -0
- package/tests/unit/src/components/DataSummary/helpers/get-link-to-published-content.test.js +21 -0
- package/tests/unit/src/components/List/helpers/get-list-query.test.js +55 -0
- package/tests/unit/src/components/List/helpers/get-sort-props.test.js +18 -0
- package/tests/unit/src/components/PlaceholderIcon/__snapshots__/index.test.js.snap +72 -0
- package/tests/unit/src/components/PlaceholderIcon/index.test.js +20 -0
- package/tests/unit/src/constants/__snapshots__/index.test.js.snap +3 -0
- package/tests/unit/src/constants/index.test.js +7 -0
- package/tests/unit/src/helpers/__snapshots__/get-extra-az-bits.test.js.snap +137 -0
- package/tests/unit/src/helpers/build-az-query.test.js +4 -3
- package/tests/unit/src/helpers/build-raw-query.test.js +151 -58
- package/tests/unit/src/helpers/build-sort-values.test.js +34 -0
- package/tests/unit/src/helpers/get-extra-az-bits.test.js +36 -6
- package/tests/unit/src/helpers/get-generic-render-variables.test.js +50 -53
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import '@testing-library/jest-dom/extend-expect';
|
|
2
2
|
import getGenericRenderVariables from '../../../../src/helpers/get-generic-render-variables';
|
|
3
3
|
|
|
4
|
-
const IS_TEXT_SEARCH_FILTER_APPLIED_TRUE = true;
|
|
5
|
-
const IS_TEXT_SEARCH_FILTER_APPLIED_FALSE = false;
|
|
6
4
|
const RAW_QUERY_STRINGIFIED = '{}';
|
|
7
5
|
const SORT_VALUE = 'updated:desc';
|
|
8
6
|
const STRING_PROPS_EMPTY = [];
|
|
@@ -18,88 +16,87 @@ const mockedProps = overrides => ({
|
|
|
18
16
|
|
|
19
17
|
describe('get card/list render variables', () => {
|
|
20
18
|
it('should always return an object', () => {
|
|
21
|
-
const variables = getGenericRenderVariables();
|
|
22
|
-
const variablesWithProps = getGenericRenderVariables(
|
|
19
|
+
const variables = getGenericRenderVariables({});
|
|
20
|
+
const variablesWithProps = getGenericRenderVariables({
|
|
21
|
+
relations: [],
|
|
22
|
+
filterProps: mockedProps(),
|
|
23
|
+
stringProps: STRING_PROPS_EMPTY
|
|
24
|
+
});
|
|
23
25
|
|
|
24
26
|
expect(typeof variables).toBe('object');
|
|
25
27
|
expect(typeof variablesWithProps).toBe('object');
|
|
26
28
|
});
|
|
27
29
|
|
|
28
30
|
it('should return an object with correct data', () => {
|
|
29
|
-
const { limit, sort, offset } = getGenericRenderVariables(
|
|
30
|
-
[],
|
|
31
|
-
mockedProps(),
|
|
32
|
-
STRING_PROPS_EMPTY
|
|
33
|
-
);
|
|
31
|
+
const { limit, sort, offset } = getGenericRenderVariables({
|
|
32
|
+
relations: [],
|
|
33
|
+
filterProps: mockedProps(),
|
|
34
|
+
stringProps: STRING_PROPS_EMPTY
|
|
35
|
+
});
|
|
34
36
|
|
|
35
37
|
expect(limit).toEqual(50);
|
|
36
38
|
expect(offset).toEqual(2);
|
|
37
39
|
expect(sort).toEqual(SORT_VALUE);
|
|
38
40
|
});
|
|
39
41
|
|
|
40
|
-
it('should return an object with sort being undefined when text-search filter applied', () => {
|
|
41
|
-
const { sort } = getGenericRenderVariables(
|
|
42
|
-
[],
|
|
43
|
-
mockedProps(),
|
|
44
|
-
STRING_PROPS_EMPTY,
|
|
45
|
-
RAW_QUERY_STRINGIFIED,
|
|
46
|
-
IS_TEXT_SEARCH_FILTER_APPLIED_TRUE
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
expect(sort).toBeFalsy();
|
|
50
|
-
});
|
|
51
|
-
|
|
52
42
|
it('should return an object with correct sort when text-search filter not applied', () => {
|
|
53
|
-
const { sort } = getGenericRenderVariables(
|
|
54
|
-
[],
|
|
55
|
-
mockedProps(),
|
|
56
|
-
STRING_PROPS_EMPTY,
|
|
57
|
-
RAW_QUERY_STRINGIFIED,
|
|
58
|
-
|
|
59
|
-
);
|
|
43
|
+
const { sort } = getGenericRenderVariables({
|
|
44
|
+
relations: [],
|
|
45
|
+
filterProps: mockedProps(),
|
|
46
|
+
stringProps: STRING_PROPS_EMPTY,
|
|
47
|
+
rawQuery: RAW_QUERY_STRINGIFIED,
|
|
48
|
+
isTextSearchFilterApplied: false
|
|
49
|
+
});
|
|
60
50
|
|
|
61
51
|
expect(sort).toEqual(SORT_VALUE);
|
|
62
52
|
});
|
|
63
53
|
|
|
64
54
|
it('should return an object with correct data when no arguments passed to function', () => {
|
|
65
|
-
const { sort, offset } = getGenericRenderVariables();
|
|
66
|
-
|
|
55
|
+
const { sort, offset } = getGenericRenderVariables({});
|
|
67
56
|
expect(sort).toBeFalsy();
|
|
68
57
|
expect(offset).toEqual(0);
|
|
69
58
|
});
|
|
70
59
|
|
|
71
60
|
it('should return an object with correct data when no sortby is passed', () => {
|
|
72
|
-
const { sort, offset } = getGenericRenderVariables(mockedProps({ sortby: [] }));
|
|
61
|
+
const { sort, offset } = getGenericRenderVariables({ relations: mockedProps({ sortby: [] }) });
|
|
73
62
|
|
|
74
63
|
expect(sort).toBeFalsy();
|
|
75
64
|
expect(offset).toEqual(0);
|
|
76
65
|
});
|
|
77
66
|
|
|
78
67
|
it('should return correct sort data when we pass an array', () => {
|
|
79
|
-
const { sort } = getGenericRenderVariables(
|
|
80
|
-
[],
|
|
81
|
-
mockedProps({ sortby: ['length'] }),
|
|
82
|
-
STRING_PROPS_EMPTY
|
|
83
|
-
);
|
|
68
|
+
const { sort } = getGenericRenderVariables({
|
|
69
|
+
relations: [],
|
|
70
|
+
filterProps: mockedProps({ sortby: ['length'] }),
|
|
71
|
+
stringProps: STRING_PROPS_EMPTY
|
|
72
|
+
});
|
|
84
73
|
expect(sort).toEqual('length:desc');
|
|
85
74
|
});
|
|
86
75
|
|
|
87
76
|
it('should return correct sort data when when there is a prop that is of type string', () => {
|
|
88
|
-
const { sort } = getGenericRenderVariables(
|
|
77
|
+
const { sort } = getGenericRenderVariables({
|
|
78
|
+
relations: [],
|
|
79
|
+
filterProps: mockedProps({ sortby: 'name' }),
|
|
80
|
+
stringProps: STRING_PROPS
|
|
81
|
+
});
|
|
89
82
|
expect(sort).toEqual('name.keyword:desc');
|
|
90
83
|
});
|
|
91
84
|
|
|
92
85
|
it('should return correct sort data sortby is an array', () => {
|
|
93
|
-
const { sort } = getGenericRenderVariables(
|
|
86
|
+
const { sort } = getGenericRenderVariables({
|
|
87
|
+
relations: [],
|
|
88
|
+
filterProps: mockedProps({ sortby: ['name'] }),
|
|
89
|
+
stringProps: STRING_PROPS
|
|
90
|
+
});
|
|
94
91
|
expect(sort).toEqual('name.keyword:desc');
|
|
95
92
|
});
|
|
96
93
|
|
|
97
94
|
it("should return correct sort data when when there is a prop that is of type string and it's also a relation prop", () => {
|
|
98
|
-
const { sort } = getGenericRenderVariables(
|
|
99
|
-
[{ localField: 'entity', entityIdentifier: 'entity' }],
|
|
100
|
-
mockedProps({ sortby: 'entity.name', sort: 'ASC' }),
|
|
101
|
-
['entity.name']
|
|
102
|
-
);
|
|
95
|
+
const { sort } = getGenericRenderVariables({
|
|
96
|
+
relations: [{ localField: 'entity', entityIdentifier: 'entity' }],
|
|
97
|
+
filterProps: mockedProps({ sortby: 'entity.name', sort: 'ASC' }),
|
|
98
|
+
stringProps: ['entity.name']
|
|
99
|
+
});
|
|
103
100
|
|
|
104
101
|
expect(sort).toEqual('entity.name.keyword:asc');
|
|
105
102
|
});
|
|
@@ -107,21 +104,21 @@ describe('get card/list render variables', () => {
|
|
|
107
104
|
it("should return correct sort data when when there is a prop that is not of type string but it's a relation prop", () => {
|
|
108
105
|
const localField = 'entityField';
|
|
109
106
|
const sortby = `${localField}.length`;
|
|
110
|
-
const { sort } = getGenericRenderVariables(
|
|
111
|
-
[{ localField, entityIdentifier: 'entity' }],
|
|
112
|
-
mockedProps({ sortby, sort: 'ASC' }),
|
|
113
|
-
[]
|
|
114
|
-
);
|
|
107
|
+
const { sort } = getGenericRenderVariables({
|
|
108
|
+
relations: [{ localField, entityIdentifier: 'entity' }],
|
|
109
|
+
filterProps: mockedProps({ sortby, sort: 'ASC' }),
|
|
110
|
+
stringProps: []
|
|
111
|
+
});
|
|
115
112
|
|
|
116
113
|
expect(sort).toEqual(`${sortby}:asc`);
|
|
117
114
|
});
|
|
118
115
|
|
|
119
116
|
it('should return correct sort data when when there is a relation prop that is of type string but with updated value', () => {
|
|
120
|
-
const { sort } = getGenericRenderVariables(
|
|
121
|
-
[{ localField: 'tag', entityIdentifier: 'tags' }],
|
|
122
|
-
mockedProps({ sortby: 'tag.name', sort: 'ASC' }),
|
|
123
|
-
['tags.name']
|
|
124
|
-
);
|
|
117
|
+
const { sort } = getGenericRenderVariables({
|
|
118
|
+
relations: [{ localField: 'tag', entityIdentifier: 'tags' }],
|
|
119
|
+
filterProps: mockedProps({ sortby: 'tag.name', sort: 'ASC' }),
|
|
120
|
+
stringProps: ['tags.name']
|
|
121
|
+
});
|
|
125
122
|
|
|
126
123
|
expect(sort).toEqual('tag.name.keyword:asc');
|
|
127
124
|
});
|