@blaze-cms/react-page-builder 0.130.0 → 0.131.0-admin-updates.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 +28 -0
- package/lib/components/Card/CardsRender.js +13 -6
- package/lib/components/Card/CardsRender.js.map +1 -1
- package/lib/components/Card/helpers/get-updated-items-to-display.js +55 -0
- package/lib/components/Card/helpers/get-updated-items-to-display.js.map +1 -0
- package/lib/components/Card/helpers/index.js +7 -0
- package/lib/components/Card/helpers/index.js.map +1 -1
- package/lib/components/Code/Code.js +7 -3
- package/lib/components/Code/Code.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-loop-props-content.js +3 -1
- package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js +3 -2
- package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
- package/lib/components/List/ListFactory.js +16 -11
- package/lib/components/List/ListFactory.js.map +1 -1
- package/lib/components/List/helpers/get-list-query.js +43 -0
- package/lib/components/List/helpers/get-list-query.js.map +1 -0
- package/lib/components/List/helpers/get-list-specific-search-filter.js +21 -0
- package/lib/components/List/helpers/get-list-specific-search-filter.js.map +1 -0
- package/lib/components/List/helpers/index.js +14 -0
- package/lib/components/List/helpers/index.js.map +1 -1
- package/lib/components/List/helpers/strip-query-key.js +14 -0
- package/lib/components/List/helpers/strip-query-key.js.map +1 -0
- package/lib/components/SearchContent/SearchContent.js +8 -6
- package/lib/components/SearchContent/SearchContent.js.map +1 -1
- package/lib/components/SearchContent/SearchContentItems.js +1 -1
- package/lib/components/SearchContent/SearchContentItems.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +17 -11
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilterContainer.js +63 -85
- package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-filters-query.js +3 -1
- package/lib/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-new-url.js +17 -0
- package/lib/components/SearchFilter/helpers/build-new-url.js.map +1 -0
- package/lib/components/SearchFilter/helpers/build-url-query.js +48 -0
- package/lib/components/SearchFilter/helpers/build-url-query.js.map +1 -0
- package/lib/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +32 -0
- package/lib/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js.map +1 -0
- package/lib/components/SearchFilter/helpers/get-filter-values.js +31 -0
- package/lib/components/SearchFilter/helpers/get-filter-values.js.map +1 -0
- package/lib/components/SearchFilter/helpers/index.js +18 -11
- package/lib/components/SearchFilter/helpers/index.js.map +1 -1
- package/lib/components/SearchFilter/index.js.map +1 -1
- package/lib/components/SearchFilter/searchFilterReducer.js +45 -0
- package/lib/components/SearchFilter/searchFilterReducer.js.map +1 -0
- package/lib/components/SearchFilterSort/SearchFilterSort.js +31 -11
- package/lib/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js +19 -5
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/update-sort.js +9 -5
- package/lib/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
- package/lib/helpers/build-inherited-filters.js +2 -0
- package/lib/helpers/build-inherited-filters.js.map +1 -1
- package/lib/helpers/build-props-query.js +5 -2
- package/lib/helpers/build-props-query.js.map +1 -1
- package/lib/helpers/build-query-key.js +16 -0
- package/lib/helpers/build-query-key.js.map +1 -0
- package/lib/helpers/build-set-filters.js +5 -1
- package/lib/helpers/build-set-filters.js.map +1 -1
- package/lib/helpers/get-query-filters.js +6 -8
- package/lib/helpers/get-query-filters.js.map +1 -1
- package/lib/helpers/get-query-props.js +13 -2
- package/lib/helpers/get-query-props.js.map +1 -1
- package/lib/helpers/get-wrapped-value-with-link.js +2 -3
- package/lib/helpers/get-wrapped-value-with-link.js.map +1 -1
- package/lib/helpers/index.js +14 -0
- package/lib/helpers/index.js.map +1 -1
- package/lib/helpers/parse-props-to-display.js +13 -8
- package/lib/helpers/parse-props-to-display.js.map +1 -1
- package/lib/helpers/process-data-summary-value.js +56 -0
- package/lib/helpers/process-data-summary-value.js.map +1 -0
- package/lib-es/components/Card/CardsRender.js +14 -7
- package/lib-es/components/Card/CardsRender.js.map +1 -1
- package/lib-es/components/Card/helpers/get-updated-items-to-display.js +32 -0
- package/lib-es/components/Card/helpers/get-updated-items-to-display.js.map +1 -0
- package/lib-es/components/Card/helpers/index.js +1 -0
- package/lib-es/components/Card/helpers/index.js.map +1 -1
- package/lib-es/components/Code/Code.js +8 -4
- package/lib-es/components/Code/Code.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js +3 -1
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/build-props-to-display-with-content.js +4 -3
- package/lib-es/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
- package/lib-es/components/List/ListFactory.js +16 -12
- package/lib-es/components/List/ListFactory.js.map +1 -1
- package/lib-es/components/List/helpers/get-list-query.js +24 -0
- package/lib-es/components/List/helpers/get-list-query.js.map +1 -0
- package/lib-es/components/List/helpers/get-list-specific-search-filter.js +12 -0
- package/lib-es/components/List/helpers/get-list-specific-search-filter.js.map +1 -0
- package/lib-es/components/List/helpers/index.js +2 -0
- package/lib-es/components/List/helpers/index.js.map +1 -1
- package/lib-es/components/List/helpers/strip-query-key.js +6 -0
- package/lib-es/components/List/helpers/strip-query-key.js.map +1 -0
- package/lib-es/components/SearchContent/SearchContent.js +8 -6
- package/lib-es/components/SearchContent/SearchContent.js.map +1 -1
- package/lib-es/components/SearchContent/SearchContentItems.js +1 -1
- package/lib-es/components/SearchContent/SearchContentItems.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js +18 -11
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilterContainer.js +47 -72
- package/lib-es/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-filters-query.js +2 -0
- package/lib-es/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-new-url.js +8 -0
- package/lib-es/components/SearchFilter/helpers/build-new-url.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/build-url-query.js +30 -0
- package/lib-es/components/SearchFilter/helpers/build-url-query.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +18 -0
- package/lib-es/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/get-filter-values.js +19 -0
- package/lib-es/components/SearchFilter/helpers/get-filter-values.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/index.js +5 -4
- package/lib-es/components/SearchFilter/helpers/index.js.map +1 -1
- package/lib-es/components/SearchFilter/index.js +2 -2
- package/lib-es/components/SearchFilter/index.js.map +1 -1
- package/lib-es/components/SearchFilter/searchFilterReducer.js +28 -0
- package/lib-es/components/SearchFilter/searchFilterReducer.js.map +1 -0
- package/lib-es/components/SearchFilterSort/SearchFilterSort.js +26 -10
- package/lib-es/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
- package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js +21 -4
- package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib-es/components/SearchFilterSort/helpers/update-sort.js +8 -4
- package/lib-es/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
- package/lib-es/helpers/build-inherited-filters.js +2 -0
- package/lib-es/helpers/build-inherited-filters.js.map +1 -1
- package/lib-es/helpers/build-props-query.js +4 -2
- package/lib-es/helpers/build-props-query.js.map +1 -1
- package/lib-es/helpers/build-query-key.js +7 -0
- package/lib-es/helpers/build-query-key.js.map +1 -0
- package/lib-es/helpers/build-set-filters.js +5 -1
- package/lib-es/helpers/build-set-filters.js.map +1 -1
- package/lib-es/helpers/get-query-filters.js +6 -8
- package/lib-es/helpers/get-query-filters.js.map +1 -1
- package/lib-es/helpers/get-query-props.js +10 -2
- package/lib-es/helpers/get-query-props.js.map +1 -1
- package/lib-es/helpers/get-wrapped-value-with-link.js +2 -2
- package/lib-es/helpers/get-wrapped-value-with-link.js.map +1 -1
- package/lib-es/helpers/index.js +2 -0
- package/lib-es/helpers/index.js.map +1 -1
- package/lib-es/helpers/parse-props-to-display.js +12 -9
- package/lib-es/helpers/parse-props-to-display.js.map +1 -1
- package/lib-es/helpers/process-data-summary-value.js +36 -0
- package/lib-es/helpers/process-data-summary-value.js.map +1 -0
- package/package.json +10 -10
- package/src/components/Card/CardsRender.js +27 -7
- package/src/components/Card/helpers/get-updated-items-to-display.js +32 -0
- package/src/components/Card/helpers/index.js +1 -0
- package/src/components/Code/Code.js +7 -3
- package/src/components/DataSummary/helpers/build-loop-props-content.js +4 -1
- package/src/components/DataSummary/helpers/build-props-to-display-with-content.js +6 -3
- package/src/components/List/ListFactory.js +25 -15
- package/src/components/List/helpers/get-list-query.js +28 -0
- package/src/components/List/helpers/get-list-specific-search-filter.js +10 -0
- package/src/components/List/helpers/index.js +2 -0
- package/src/components/List/helpers/strip-query-key.js +6 -0
- package/src/components/SearchContent/SearchContent.js +8 -6
- package/src/components/SearchFilter/SearchFilter/SearchFilter.js +21 -12
- package/src/components/SearchFilter/SearchFilterContainer.js +57 -69
- package/src/components/SearchFilter/helpers/build-filters-query.js +9 -1
- package/src/components/SearchFilter/helpers/build-new-url.js +8 -0
- package/src/components/SearchFilter/helpers/build-url-query.js +31 -0
- package/src/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +17 -0
- package/src/components/SearchFilter/helpers/get-filter-values.js +21 -0
- package/src/components/SearchFilter/helpers/index.js +9 -7
- package/src/components/SearchFilter/index.js +2 -2
- package/src/components/SearchFilter/searchFilterReducer.js +15 -0
- package/src/components/SearchFilterSort/SearchFilterSort.js +18 -8
- package/src/components/SearchFilterSort/helpers/handle-sort-update.js +14 -5
- package/src/components/SearchFilterSort/helpers/update-sort.js +7 -3
- package/src/helpers/build-inherited-filters.js +3 -1
- package/src/helpers/build-props-query.js +4 -2
- package/src/helpers/build-query-key.js +7 -0
- package/src/helpers/build-set-filters.js +2 -1
- package/src/helpers/get-query-filters.js +4 -4
- package/src/helpers/get-query-props.js +12 -4
- package/src/helpers/get-wrapped-value-with-link.js +6 -3
- package/src/helpers/index.js +2 -0
- package/src/helpers/parse-props-to-display.js +25 -21
- package/src/helpers/process-data-summary-value.js +22 -0
- package/tests/helpers/mocks.js +3 -5
- package/tests/unit/src/components/Card/helpers/get-updated-items-to-display.test.js +72 -0
- package/tests/unit/src/components/Code/Code.test.js +5 -0
- package/tests/unit/src/components/Code/__snapshots__/Code.test.js.snap +8 -0
- package/tests/unit/src/components/DataSummary/helpers/build-loop-props-content.test.js +9 -0
- package/tests/unit/src/components/SearchFilter/__snapshots__/SearchFilterContainer.test.js.snap +1 -7
- package/tests/unit/src/components/SearchFilter/helpers/build-new-query.test.js +10 -10
- package/tests/unit/src/components/SearchFilter/helpers/build-query.test.js +24 -7
- package/tests/unit/src/components/SearchFilter/helpers/get-initial-filter-values.test.js +10 -10
- package/tests/unit/src/components/SearchFilterSort/SearchFilterSort.test.js +4 -1
- package/tests/unit/src/components/SearchFilterSort/helpers/handle-sort-update.test.js +26 -19
- package/tests/unit/src/components/SearchFilterSort/helpers/update-sort.test.js +10 -1
- package/tests/unit/src/helpers/__snapshots__/get-wrapped-value-with-link.test.js.snap +18 -0
- package/tests/unit/src/helpers/build-props-query.test.js +25 -0
- package/tests/unit/src/helpers/get-wrapped-value-with-link.test.js +2 -2
- package/tests/unit/src/helpers/parse-props-to-display.test.js +4 -0
- package/tests/unit/src/helpers/prcoess-data-summary-value.test.js +52 -0
- package/lib/components/SearchFilter/helpers/build-new-query.js +0 -15
- package/lib/components/SearchFilter/helpers/build-new-query.js.map +0 -1
- package/lib/components/SearchFilter/helpers/build-query.js +0 -37
- package/lib/components/SearchFilter/helpers/build-query.js.map +0 -1
- package/lib/components/SearchFilter/helpers/get-initial-filter-values.js +0 -43
- package/lib/components/SearchFilter/helpers/get-initial-filter-values.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/build-new-query.js +0 -6
- package/lib-es/components/SearchFilter/helpers/build-new-query.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/build-query.js +0 -23
- package/lib-es/components/SearchFilter/helpers/build-query.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js +0 -26
- package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js.map +0 -1
- package/src/components/SearchFilter/helpers/build-new-query.js +0 -6
- package/src/components/SearchFilter/helpers/build-query.js +0 -26
- package/src/components/SearchFilter/helpers/get-initial-filter-values.js +0 -30
|
@@ -11,22 +11,22 @@ Object.defineProperty(exports, "buildFiltersQuery", {
|
|
|
11
11
|
return _buildFiltersQuery["default"];
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
Object.defineProperty(exports, "
|
|
14
|
+
Object.defineProperty(exports, "buildNewUrl", {
|
|
15
15
|
enumerable: true,
|
|
16
16
|
get: function get() {
|
|
17
|
-
return
|
|
17
|
+
return _buildNewUrl["default"];
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
Object.defineProperty(exports, "
|
|
20
|
+
Object.defineProperty(exports, "buildRawQueryStringified", {
|
|
21
21
|
enumerable: true,
|
|
22
22
|
get: function get() {
|
|
23
|
-
return
|
|
23
|
+
return _buildRawQueryStringified["default"];
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
-
Object.defineProperty(exports, "
|
|
26
|
+
Object.defineProperty(exports, "buildUrlQuery", {
|
|
27
27
|
enumerable: true,
|
|
28
28
|
get: function get() {
|
|
29
|
-
return
|
|
29
|
+
return _buildUrlQuery["default"];
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "calculateMinMax", {
|
|
@@ -65,16 +65,22 @@ Object.defineProperty(exports, "getDisplayValue", {
|
|
|
65
65
|
return _getDisplayValue["default"];
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
|
+
Object.defineProperty(exports, "getFilterRangesAndCheckboxesValues", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function get() {
|
|
71
|
+
return _getFilterRangesAndCheckboxesValues["default"];
|
|
72
|
+
}
|
|
73
|
+
});
|
|
68
74
|
Object.defineProperty(exports, "getFilterValueFromQuery", {
|
|
69
75
|
enumerable: true,
|
|
70
76
|
get: function get() {
|
|
71
77
|
return _getFilterValueFromQuery["default"];
|
|
72
78
|
}
|
|
73
79
|
});
|
|
74
|
-
Object.defineProperty(exports, "
|
|
80
|
+
Object.defineProperty(exports, "getFilterValues", {
|
|
75
81
|
enumerable: true,
|
|
76
82
|
get: function get() {
|
|
77
|
-
return
|
|
83
|
+
return _getFilterValues["default"];
|
|
78
84
|
}
|
|
79
85
|
});
|
|
80
86
|
Object.defineProperty(exports, "getIntersectedProp", {
|
|
@@ -107,7 +113,7 @@ Object.defineProperty(exports, "isDeviceDesktop", {
|
|
|
107
113
|
return _isDeviceDesktop["default"];
|
|
108
114
|
}
|
|
109
115
|
});
|
|
110
|
-
var
|
|
116
|
+
var _buildNewUrl = _interopRequireDefault(require("./build-new-url"));
|
|
111
117
|
var _buildRawQueryStringified = _interopRequireDefault(require("./build-raw-query-stringified"));
|
|
112
118
|
var _decodeEncode = require("./decode-encode");
|
|
113
119
|
var _checkIfRangeUpdated = _interopRequireDefault(require("./check-if-range-updated"));
|
|
@@ -119,8 +125,9 @@ var _getIntersectedProp = _interopRequireDefault(require("./get-intersected-prop
|
|
|
119
125
|
var _getRangeValue = _interopRequireDefault(require("./get-range-value"));
|
|
120
126
|
var _getSelectOptions = _interopRequireDefault(require("./get-select-options"));
|
|
121
127
|
var _isDeviceDesktop = _interopRequireDefault(require("./is-device-desktop"));
|
|
122
|
-
var
|
|
128
|
+
var _getFilterValues = _interopRequireDefault(require("./get-filter-values"));
|
|
123
129
|
var _getFilterValueFromQuery = _interopRequireDefault(require("./get-filter-value-from-query"));
|
|
124
|
-
var
|
|
130
|
+
var _buildUrlQuery = _interopRequireDefault(require("./build-url-query"));
|
|
125
131
|
var _buildFiltersQuery = _interopRequireDefault(require("./build-filters-query"));
|
|
132
|
+
var _getFilterRangesAndCheckboxesValues = _interopRequireDefault(require("./get-filter-ranges-and-checkboxes-values"));
|
|
126
133
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["_buildNewUrl","_interopRequireDefault","require","_buildRawQueryStringified","_decodeEncode","_checkIfRangeUpdated","_getResponsiveFilterClassnames","_getDisplayValue","_calculateStep","_calculateMinMax","_getIntersectedProp","_getRangeValue","_getSelectOptions","_isDeviceDesktop","_getFilterValues","_getFilterValueFromQuery","_buildUrlQuery","_buildFiltersQuery","_getFilterRangesAndCheckboxesValues"],"sources":["../../../../src/components/SearchFilter/helpers/index.js"],"sourcesContent":["import buildNewUrl from './build-new-url';\nimport buildRawQueryStringified from './build-raw-query-stringified';\nimport { decodeValue, encodeValue } from './decode-encode';\nimport checkIfRangeUpdated from './check-if-range-updated';\nimport getResponsiveFilterClassnames from './get-responsive-filter-classnames';\nimport getDisplayValue from './get-display-value';\nimport calculateStep from './calculate-step';\nimport calculateMinMax from './calculate-min-max';\nimport getIntersectedProp from './get-intersected-prop';\nimport getRangeValue from './get-range-value';\nimport getSelectOptions from './get-select-options';\nimport isDeviceDesktop from './is-device-desktop';\nimport getFilterValues from './get-filter-values';\nimport getFilterValueFromQuery from './get-filter-value-from-query';\nimport buildUrlQuery from './build-url-query';\nimport buildFiltersQuery from './build-filters-query';\nimport getFilterRangesAndCheckboxesValues from './get-filter-ranges-and-checkboxes-values';\n\nexport {\n buildUrlQuery,\n buildNewUrl,\n buildRawQueryStringified,\n decodeValue,\n encodeValue,\n checkIfRangeUpdated,\n getResponsiveFilterClassnames,\n getDisplayValue,\n calculateStep,\n calculateMinMax,\n getIntersectedProp,\n getRangeValue,\n getSelectOptions,\n isDeviceDesktop,\n getFilterValues,\n getFilterValueFromQuery,\n buildFiltersQuery,\n getFilterRangesAndCheckboxesValues\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,yBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,8BAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,gBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,cAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,gBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,mBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,cAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,iBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,gBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,gBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,wBAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,cAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,kBAAA,GAAAhB,sBAAA,CAAAC,OAAA;AACA,IAAAgB,mCAAA,GAAAjB,sBAAA,CAAAC,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_SearchFilterContainer","_interopRequireDefault","require","_default","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_SearchFilterContainer","_interopRequireDefault","require","_default","SearchFilter","exports"],"sources":["../../../src/components/SearchFilter/index.js"],"sourcesContent":["import SearchFilter from './SearchFilterContainer';\n\nexport default SearchFilter;\n"],"mappings":";;;;;;;;AAAA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAmD,IAAAC,QAAA,GAEpCC,iCAAY;AAAAC,OAAA,cAAAF,QAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.keys.js");
|
|
4
|
+
require("core-js/modules/es.symbol.js");
|
|
5
|
+
require("core-js/modules/es.array.filter.js");
|
|
6
|
+
require("core-js/modules/es.object.to-string.js");
|
|
7
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
8
|
+
require("core-js/modules/es.array.for-each.js");
|
|
9
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
10
|
+
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
11
|
+
require("core-js/modules/es.object.define-properties.js");
|
|
12
|
+
require("core-js/modules/es.object.define-property.js");
|
|
13
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
exports["default"] = void 0;
|
|
18
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
19
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
+
var searchFilterReducer = function searchFilterReducer(state, action) {
|
|
22
|
+
var newValues = action.newValues,
|
|
23
|
+
type = action.type,
|
|
24
|
+
_action$shouldSearch = action.shouldSearch,
|
|
25
|
+
shouldSearch = _action$shouldSearch === void 0 ? true : _action$shouldSearch;
|
|
26
|
+
switch (type) {
|
|
27
|
+
case 'update':
|
|
28
|
+
return _objectSpread(_objectSpread(_objectSpread({}, state), newValues), {}, {
|
|
29
|
+
shouldSearch: shouldSearch
|
|
30
|
+
});
|
|
31
|
+
case 'resetSearch':
|
|
32
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
33
|
+
shouldSearch: false
|
|
34
|
+
});
|
|
35
|
+
case 'reset':
|
|
36
|
+
return _objectSpread(_objectSpread({}, newValues), {}, {
|
|
37
|
+
shouldSearch: false
|
|
38
|
+
});
|
|
39
|
+
default:
|
|
40
|
+
throw new Error();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var _default = searchFilterReducer;
|
|
44
|
+
exports["default"] = _default;
|
|
45
|
+
//# sourceMappingURL=searchFilterReducer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchFilterReducer.js","names":["searchFilterReducer","state","action","newValues","type","_action$shouldSearch","shouldSearch","_objectSpread","Error","_default","exports"],"sources":["../../../src/components/SearchFilter/searchFilterReducer.js"],"sourcesContent":["const searchFilterReducer = (state, action) => {\n const { newValues, type, shouldSearch = true } = action;\n switch (type) {\n case 'update':\n return { ...state, ...newValues, shouldSearch };\n case 'resetSearch':\n return { ...state, shouldSearch: false };\n case 'reset':\n return { ...newValues, shouldSearch: false };\n default:\n throw new Error();\n }\n};\n\nexport default searchFilterReducer;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIC,KAAK,EAAEC,MAAM,EAAK;EAC7C,IAAQC,SAAS,GAAgCD,MAAM,CAA/CC,SAAS;IAAEC,IAAI,GAA0BF,MAAM,CAApCE,IAAI;IAAAC,oBAAA,GAA0BH,MAAM,CAA9BI,YAAY;IAAZA,YAAY,GAAAD,oBAAA,cAAG,IAAI,GAAAA,oBAAA;EAC5C,QAAQD,IAAI;IACV,KAAK,QAAQ;MACX,OAAAG,aAAA,CAAAA,aAAA,CAAAA,aAAA,KAAYN,KAAK,GAAKE,SAAS;QAAEG,YAAY,EAAZA;MAAY;IAC/C,KAAK,aAAa;MAChB,OAAAC,aAAA,CAAAA,aAAA,KAAYN,KAAK;QAAEK,YAAY,EAAE;MAAK;IACxC,KAAK,OAAO;MACV,OAAAC,aAAA,CAAAA,aAAA,KAAYJ,SAAS;QAAEG,YAAY,EAAE;MAAK;IAC5C;MACE,MAAM,IAAIE,KAAK,CAAC,CAAC;EACrB;AACF,CAAC;AAAC,IAAAC,QAAA,GAEaT,mBAAmB;AAAAU,OAAA,cAAAD,QAAA"}
|
|
@@ -6,9 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
|
-
require("
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
require("core-js/modules/es.array.concat.js");
|
|
11
11
|
require("core-js/modules/es.array.map.js");
|
|
12
|
+
require("core-js/modules/es.array.sort.js");
|
|
12
13
|
var _react = _interopRequireDefault(require("react"));
|
|
13
14
|
var _select = _interopRequireDefault(require("@blaze-react/select"));
|
|
14
15
|
var _router = require("next/router");
|
|
@@ -17,20 +18,31 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
17
18
|
var _constants = require("./constants");
|
|
18
19
|
var _helpers = require("./helpers");
|
|
19
20
|
var _HOC = require("../../HOC");
|
|
21
|
+
var getSortFromQuery = function getSortFromQuery(listComponentName) {
|
|
22
|
+
var listNameKey = listComponentName ? "pb[".concat(listComponentName, "]") : '';
|
|
23
|
+
var sortKey = "".concat(listNameKey).concat(listNameKey ? '[sort]' : 'sort');
|
|
24
|
+
var sortByKey = "".concat(listNameKey).concat(listNameKey ? '[sortby]' : 'sortby');
|
|
25
|
+
return [sortKey, sortByKey];
|
|
26
|
+
};
|
|
20
27
|
var SearchFilterSort = function SearchFilterSort(_ref) {
|
|
21
|
-
var
|
|
22
|
-
filters = _ref.filters,
|
|
28
|
+
var filters = _ref.filters,
|
|
23
29
|
elementLabel = _ref.elementLabel,
|
|
24
30
|
selectLabel = _ref.selectLabel,
|
|
25
|
-
id = _ref.id
|
|
31
|
+
id = _ref.id,
|
|
32
|
+
listComponentName = _ref.listComponentName;
|
|
33
|
+
var router = (0, _router.useRouter)();
|
|
26
34
|
var asPath = router.asPath;
|
|
35
|
+
var _getSortFromQuery = getSortFromQuery(listComponentName),
|
|
36
|
+
_getSortFromQuery2 = (0, _slicedToArray2["default"])(_getSortFromQuery, 2),
|
|
37
|
+
sortKey = _getSortFromQuery2[0],
|
|
38
|
+
sortByKey = _getSortFromQuery2[1];
|
|
27
39
|
var _parseUrl = (0, _queryString.parseUrl)(asPath),
|
|
28
40
|
url = _parseUrl.url,
|
|
29
41
|
query = _parseUrl.query,
|
|
30
42
|
_parseUrl$query = _parseUrl.query,
|
|
31
43
|
_parseUrl$query2 = _parseUrl$query === void 0 ? {} : _parseUrl$query,
|
|
32
|
-
sort = _parseUrl$query2
|
|
33
|
-
sortby = _parseUrl$query2
|
|
44
|
+
sort = _parseUrl$query2[sortKey],
|
|
45
|
+
sortby = _parseUrl$query2[sortByKey];
|
|
34
46
|
var selectedValue = "".concat(sortby, ":").concat(sort) || '';
|
|
35
47
|
var defaultTextValue = selectLabel || _constants.DEFAULT_SORT;
|
|
36
48
|
var options = filters.map(function (_ref2) {
|
|
@@ -41,7 +53,14 @@ var SearchFilterSort = function SearchFilterSort(_ref) {
|
|
|
41
53
|
});
|
|
42
54
|
var setSortValue = function setSortValue(_ref3) {
|
|
43
55
|
var value = _ref3.value;
|
|
44
|
-
return (0, _helpers.handleSortUpdate)(
|
|
56
|
+
return (0, _helpers.handleSortUpdate)({
|
|
57
|
+
router: router,
|
|
58
|
+
value: value,
|
|
59
|
+
query: query,
|
|
60
|
+
url: url,
|
|
61
|
+
selectLabel: selectLabel,
|
|
62
|
+
listComponentName: listComponentName
|
|
63
|
+
});
|
|
45
64
|
};
|
|
46
65
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
47
66
|
className: "sort-by"
|
|
@@ -55,18 +74,19 @@ var SearchFilterSort = function SearchFilterSort(_ref) {
|
|
|
55
74
|
}));
|
|
56
75
|
};
|
|
57
76
|
SearchFilterSort.propTypes = {
|
|
58
|
-
router: _propTypes["default"].object.isRequired,
|
|
59
77
|
filters: _propTypes["default"].array,
|
|
60
78
|
elementLabel: _propTypes["default"].string,
|
|
61
79
|
selectLabel: _propTypes["default"].string,
|
|
62
|
-
id: _propTypes["default"].string
|
|
80
|
+
id: _propTypes["default"].string,
|
|
81
|
+
listComponentName: _propTypes["default"].string
|
|
63
82
|
};
|
|
64
83
|
SearchFilterSort.defaultProps = {
|
|
65
84
|
filters: [],
|
|
66
85
|
elementLabel: '',
|
|
67
86
|
selectLabel: '',
|
|
68
|
-
id: ''
|
|
87
|
+
id: '',
|
|
88
|
+
listComponentName: ''
|
|
69
89
|
};
|
|
70
|
-
var _default = (0,
|
|
90
|
+
var _default = (0, _HOC.withTitle)(SearchFilterSort);
|
|
71
91
|
exports["default"] = _default;
|
|
72
92
|
//# sourceMappingURL=SearchFilterSort.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchFilterSort.js","names":["_react","_interopRequireDefault","require","_select","_router","_queryString","_propTypes","_constants","_helpers","_HOC","
|
|
1
|
+
{"version":3,"file":"SearchFilterSort.js","names":["_react","_interopRequireDefault","require","_select","_router","_queryString","_propTypes","_constants","_helpers","_HOC","getSortFromQuery","listComponentName","listNameKey","concat","sortKey","sortByKey","SearchFilterSort","_ref","filters","elementLabel","selectLabel","id","router","useRouter","asPath","_getSortFromQuery","_getSortFromQuery2","_slicedToArray2","_parseUrl","parseUrl","url","query","_parseUrl$query","_parseUrl$query2","sort","sortby","selectedValue","defaultTextValue","DEFAULT_SORT","options","map","_ref2","optionLabel","label","propsToDisplay","sortValue","setSortValue","_ref3","value","handleSortUpdate","createElement","className","onChange","propTypes","PropTypes","array","string","defaultProps","_default","withTitle","exports"],"sources":["../../../src/components/SearchFilterSort/SearchFilterSort.js"],"sourcesContent":["import React from 'react';\nimport Select from '@blaze-react/select';\nimport { useRouter } from 'next/router';\nimport { parseUrl } from 'query-string';\nimport PropTypes from 'prop-types';\nimport { DEFAULT_SORT } from './constants';\nimport { handleSortUpdate } from './helpers';\nimport { withTitle } from '../../HOC';\n\nconst getSortFromQuery = listComponentName => {\n const listNameKey = listComponentName ? `pb[${listComponentName}]` : '';\n const sortKey = `${listNameKey}${listNameKey ? '[sort]' : 'sort'}`;\n const sortByKey = `${listNameKey}${listNameKey ? '[sortby]' : 'sortby'}`;\n return [sortKey, sortByKey];\n};\nconst SearchFilterSort = ({ filters, elementLabel, selectLabel, id, listComponentName }) => {\n const router = useRouter();\n const { asPath } = router;\n const [sortKey, sortByKey] = getSortFromQuery(listComponentName);\n const { url, query, query: { [sortKey]: sort, [sortByKey]: sortby } = {} } = parseUrl(asPath);\n const selectedValue = `${sortby}:${sort}` || '';\n const defaultTextValue = selectLabel || DEFAULT_SORT;\n const options = filters.map(({ label: optionLabel, propsToDisplay, sort: sortValue }) => [\n `${propsToDisplay[0]}:${sortValue}`,\n optionLabel\n ]);\n\n const setSortValue = ({ value }) =>\n handleSortUpdate({ router, value, query, url, selectLabel, listComponentName });\n\n return (\n <div className=\"sort-by\">\n <Select\n label={elementLabel}\n defaultTextValue={defaultTextValue}\n value={selectedValue}\n id={id}\n options={options}\n onChange={setSortValue}\n />\n </div>\n );\n};\n\nSearchFilterSort.propTypes = {\n filters: PropTypes.array,\n elementLabel: PropTypes.string,\n selectLabel: PropTypes.string,\n id: PropTypes.string,\n listComponentName: PropTypes.string\n};\n\nSearchFilterSort.defaultProps = {\n filters: [],\n elementLabel: '',\n selectLabel: '',\n id: '',\n listComponentName: ''\n};\n\nexport default withTitle(SearchFilterSort);\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AAEA,IAAMQ,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAGC,iBAAiB,EAAI;EAC5C,IAAMC,WAAW,GAAGD,iBAAiB,SAAAE,MAAA,CAASF,iBAAiB,SAAM,EAAE;EACvE,IAAMG,OAAO,MAAAD,MAAA,CAAMD,WAAW,EAAAC,MAAA,CAAGD,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAE;EAClE,IAAMG,SAAS,MAAAF,MAAA,CAAMD,WAAW,EAAAC,MAAA,CAAGD,WAAW,GAAG,UAAU,GAAG,QAAQ,CAAE;EACxE,OAAO,CAACE,OAAO,EAAEC,SAAS,CAAC;AAC7B,CAAC;AACD,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAAsE;EAAA,IAAhEC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IA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9
|
+
require("core-js/modules/es.array.concat.js");
|
|
9
10
|
require("core-js/modules/es.array.for-each.js");
|
|
10
11
|
require("core-js/modules/es.object.to-string.js");
|
|
11
12
|
require("core-js/modules/web.dom-collections.for-each.js");
|
|
12
13
|
require("core-js/modules/es.object.keys.js");
|
|
13
14
|
require("core-js/modules/es.array.index-of.js");
|
|
14
|
-
require("core-js/modules/es.array.concat.js");
|
|
15
15
|
var _queryString = require("query-string");
|
|
16
16
|
var _constants = require("../constants");
|
|
17
17
|
var _updateSort = _interopRequireDefault(require("./update-sort"));
|
|
18
|
-
var handleSortUpdate = function handleSortUpdate(
|
|
18
|
+
var handleSortUpdate = function handleSortUpdate(_ref) {
|
|
19
|
+
var router = _ref.router,
|
|
20
|
+
value = _ref.value,
|
|
21
|
+
query = _ref.query,
|
|
22
|
+
url = _ref.url,
|
|
23
|
+
selectLabel = _ref.selectLabel,
|
|
24
|
+
listComponentName = _ref.listComponentName;
|
|
19
25
|
var queryWithoutSort = {};
|
|
20
26
|
var routerOptions = {
|
|
21
27
|
shallow: true,
|
|
22
28
|
scroll: false
|
|
23
29
|
};
|
|
30
|
+
var asPath = router.asPath;
|
|
31
|
+
var hashBit = asPath.split('#')[1];
|
|
32
|
+
var parsedHash = hashBit ? "#".concat(hashBit) : '';
|
|
33
|
+
var listNameKey = listComponentName ? "pb[".concat(listComponentName, "]") : '';
|
|
34
|
+
var sortString = listNameKey ? "[".concat(_constants.SORT, "]") : _constants.SORT;
|
|
35
|
+
var sortByString = listNameKey ? "[".concat(_constants.SORTBY, "]") : _constants.SORTBY;
|
|
36
|
+
var sortKey = "".concat(listNameKey).concat(sortString);
|
|
37
|
+
var sortByKey = "".concat(listNameKey).concat(sortByString);
|
|
24
38
|
Object.keys(query).forEach(function (key) {
|
|
25
39
|
if (key.indexOf(_constants.PAGINATION_QUERY) !== -1) return;
|
|
26
|
-
if (key !==
|
|
40
|
+
if (key !== sortByKey && key !== sortKey) queryWithoutSort[key] = query[key];
|
|
27
41
|
});
|
|
28
42
|
if (value === _constants.DEFAULT_SORT || value === selectLabel) {
|
|
29
43
|
var stringifiedQuery = (0, _queryString.stringify)(queryWithoutSort);
|
|
30
|
-
return stringifiedQuery ? router.push("/Resolver", "".concat(url, "?").concat(stringifiedQuery), routerOptions) : router.push("/Resolver", url, routerOptions);
|
|
44
|
+
return stringifiedQuery ? router.push("/Resolver", "".concat(url, "?").concat(stringifiedQuery).concat(parsedHash), routerOptions) : router.push("/Resolver", "".concat(url).concat(parsedHash), routerOptions);
|
|
31
45
|
}
|
|
32
|
-
var updatedSortUrl = (0, _updateSort["default"])(value, queryWithoutSort, url);
|
|
46
|
+
var updatedSortUrl = (0, _updateSort["default"])(value, queryWithoutSort, url, parsedHash, listComponentName);
|
|
33
47
|
return router.push('/Resolver', updatedSortUrl, routerOptions);
|
|
34
48
|
};
|
|
35
49
|
var _default = handleSortUpdate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-sort-update.js","names":["_queryString","require","_constants","_updateSort","_interopRequireDefault","handleSortUpdate","router","value","query","url","selectLabel","queryWithoutSort","routerOptions","shallow","scroll","
|
|
1
|
+
{"version":3,"file":"handle-sort-update.js","names":["_queryString","require","_constants","_updateSort","_interopRequireDefault","handleSortUpdate","_ref","router","value","query","url","selectLabel","listComponentName","queryWithoutSort","routerOptions","shallow","scroll","asPath","hashBit","split","parsedHash","concat","listNameKey","sortString","SORT","sortByString","SORTBY","sortKey","sortByKey","Object","keys","forEach","key","indexOf","PAGINATION_QUERY","DEFAULT_SORT","stringifiedQuery","stringify","push","updatedSortUrl","updateSort","_default","exports"],"sources":["../../../../src/components/SearchFilterSort/helpers/handle-sort-update.js"],"sourcesContent":["import { stringify } from 'query-string';\nimport { DEFAULT_SORT, SORT, SORTBY, PAGINATION_QUERY } from '../constants';\nimport updateSort from './update-sort';\n\nconst handleSortUpdate = ({ router, value, query, url, selectLabel, listComponentName }) => {\n const queryWithoutSort = {};\n const routerOptions = { shallow: true, scroll: false };\n const { asPath } = router;\n const hashBit = asPath.split('#')[1];\n const parsedHash = hashBit ? `#${hashBit}` : '';\n const listNameKey = listComponentName ? `pb[${listComponentName}]` : '';\n const sortString = listNameKey ? `[${SORT}]` : SORT;\n const sortByString = listNameKey ? `[${SORTBY}]` : SORTBY;\n const sortKey = `${listNameKey}${sortString}`;\n const sortByKey = `${listNameKey}${sortByString}`;\n Object.keys(query).forEach(key => {\n if (key.indexOf(PAGINATION_QUERY) !== -1) return;\n if (key !== sortByKey && key !== sortKey) queryWithoutSort[key] = query[key];\n });\n if (value === DEFAULT_SORT || value === selectLabel) {\n const stringifiedQuery = stringify(queryWithoutSort);\n\n return stringifiedQuery\n ? router.push(`/Resolver`, `${url}?${stringifiedQuery}${parsedHash}`, routerOptions)\n : router.push(`/Resolver`, `${url}${parsedHash}`, routerOptions);\n }\n\n const updatedSortUrl = updateSort(value, queryWithoutSort, url, parsedHash, listComponentName);\n return router.push('/Resolver', updatedSortUrl, routerOptions);\n};\n\nexport default handleSortUpdate;\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAMI,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAAsE;EAAA,IAAhEC,MAAM,GAAAD,IAAA,CAANC,MAAM;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK;IAAEC,KAAK,GAAAH,IAAA,CAALG,KAAK;IAAEC,GAAG,GAAAJ,IAAA,CAAHI,GAAG;IAAEC,WAAW,GAAAL,IAAA,CAAXK,WAAW;IAAEC,iBAAiB,GAAAN,IAAA,CAAjBM,iBAAiB;EACnF,IAAMC,gBAAgB,GAAG,CAAC,CAAC;EAC3B,IAAMC,aAAa,GAAG;IAAEC,OAAO,EAAE,IAAI;IAAEC,MAAM,EAAE;EAAM,CAAC;EACtD,IAAQC,MAAM,GAAKV,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,GAAIN,aAAa,CAAC;EACpE;EAEA,IAAMyB,cAAc,GAAG,IAAAC,sBAAU,EAAChC,KAAK,EAAEK,gBAAgB,EAAEH,GAAG,EAAEU,UAAU,EAAER,iBAAiB,CAAC;EAC9F,OAAOL,MAAM,CAAC+B,IAAI,CAAC,WAAW,EAAEC,cAAc,EAAEzB,aAAa,CAAC;AAChE,CAAC;AAAC,IAAA2B,QAAA,GAEapC,gBAAgB;AAAAqC,OAAA,cAAAD,QAAA"}
|
|
@@ -19,19 +19,23 @@ require("core-js/modules/es.array.concat.js");
|
|
|
19
19
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
20
20
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
21
21
|
var _queryString = require("query-string");
|
|
22
|
+
var _helpers = require("../../../helpers");
|
|
23
|
+
var _constants = require("../constants");
|
|
22
24
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
25
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
24
26
|
var updateSort = function updateSort(value, query, url) {
|
|
27
|
+
var _objectSpread2;
|
|
28
|
+
var hashBit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
|
|
29
|
+
var listComponentName = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
|
|
30
|
+
var sortKey = (0, _helpers.buildQueryKey)(_constants.SORT, listComponentName);
|
|
31
|
+
var sortByKey = (0, _helpers.buildQueryKey)(_constants.SORTBY, listComponentName);
|
|
25
32
|
var _value$split = value.split(':'),
|
|
26
33
|
_value$split2 = (0, _slicedToArray2["default"])(_value$split, 2),
|
|
27
34
|
newSortBy = _value$split2[0],
|
|
28
35
|
newSort = _value$split2[1];
|
|
29
|
-
var updatedQuery = _objectSpread(_objectSpread({}, query), {}, {
|
|
30
|
-
sortby: newSortBy,
|
|
31
|
-
sort: newSort
|
|
32
|
-
});
|
|
36
|
+
var updatedQuery = _objectSpread(_objectSpread({}, query), {}, (_objectSpread2 = {}, (0, _defineProperty2["default"])(_objectSpread2, sortByKey, newSortBy), (0, _defineProperty2["default"])(_objectSpread2, sortKey, newSort), _objectSpread2));
|
|
33
37
|
var parsedQuery = (0, _queryString.stringify)(updatedQuery);
|
|
34
|
-
return "".concat(url, "?").concat(parsedQuery);
|
|
38
|
+
return "".concat(url, "?").concat(parsedQuery).concat(hashBit);
|
|
35
39
|
};
|
|
36
40
|
var _default = updateSort;
|
|
37
41
|
exports["default"] = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-sort.js","names":["_queryString","require","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","updateSort","value","query","url","_value$split","split","_value$split2","_slicedToArray2","newSortBy","newSort","updatedQuery","
|
|
1
|
+
{"version":3,"file":"update-sort.js","names":["_queryString","require","_helpers","_constants","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","updateSort","value","query","url","_objectSpread2","hashBit","undefined","listComponentName","sortKey","buildQueryKey","SORT","sortByKey","SORTBY","_value$split","split","_value$split2","_slicedToArray2","newSortBy","newSort","updatedQuery","parsedQuery","stringify","concat","_default","exports"],"sources":["../../../../src/components/SearchFilterSort/helpers/update-sort.js"],"sourcesContent":["import { stringify } from 'query-string';\nimport { buildQueryKey } from '../../../helpers';\nimport { SORT, SORTBY } from '../constants';\n\nconst updateSort = (value, query, url, hashBit = '', listComponentName = '') => {\n const sortKey = buildQueryKey(SORT, listComponentName);\n const sortByKey = buildQueryKey(SORTBY, listComponentName);\n const [newSortBy, newSort] = value.split(':');\n const updatedQuery = { ...query, [sortByKey]: newSortBy, [sortKey]: newSort };\n const parsedQuery = stringify(updatedQuery);\n return `${url}?${parsedQuery}${hashBit}`;\n};\n\nexport default updateSort;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAA4C,SAAAG,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA,CAAAI,MAAA,CAAAc,MAAA,OAAAC,OAAA,WAAAC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IAAAC,sBAAS,EAACF,YAAY,CAAC;EAC3C,UAAAG,MAAA,CAAUnB,GAAG,OAAAmB,MAAA,CAAIF,WAAW,EAAAE,MAAA,CAAGjB,OAAO;AACxC,CAAC;AAAC,IAAAkB,QAAA,GAEavB,UAAU;AAAAwB,OAAA,cAAAD,QAAA"}
|
|
@@ -19,6 +19,7 @@ require("core-js/modules/es.array.is-array.js");
|
|
|
19
19
|
var _lodash = _interopRequireDefault(require("lodash.flatten"));
|
|
20
20
|
var _isFilterEntitysId = _interopRequireDefault(require("./is-filter-entitys-id"));
|
|
21
21
|
var _getFilterProps2 = _interopRequireDefault(require("./get-filter-props"));
|
|
22
|
+
var _constants = require("../constants");
|
|
22
23
|
var getRelationData = function getRelationData(entityData, relationName, currentRelationNames) {
|
|
23
24
|
if (!entityData) return null;
|
|
24
25
|
if (currentRelationNames && currentRelationNames.length) {
|
|
@@ -57,6 +58,7 @@ var buildInheritedFilters = function buildInheritedFilters(entityData, inherited
|
|
|
57
58
|
relationEntityName = _getFilterProps.relationEntityName,
|
|
58
59
|
relationForeignKeys = _getFilterProps.relationForeignKeys,
|
|
59
60
|
shouldIgnoreFilter = _getFilterProps.shouldIgnoreFilter;
|
|
61
|
+
if (filterName === _constants.ID) return;
|
|
60
62
|
var relationData = getRelationData(entityData, relationName, relationForeignKeys);
|
|
61
63
|
if (currentEntityId === entityName && (0, _isFilterEntitysId["default"])(filterName, currentEntityId) || shouldIgnoreFilter) {
|
|
62
64
|
relationFilters.push("".concat(filterName, "/").concat(itemId));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-inherited-filters.js","names":["_lodash","_interopRequireDefault","require","_isFilterEntitysId","_getFilterProps2","getRelationData","entityData","relationName","currentRelationNames","length","arrayOfRelations","map","name","filter","Boolean","flatten","checkIfArrayHasData","isDataArray","relationData","setFiltersNoRelation","arrayHasData","filters","filterValues","reduce","acc","relationValue","_typeof2","push","concat","apply","_toConsumableArray2","buildInheritedFilters","inheritedFilters","currentSchema","filterEntitySchema","itemId","relationFilters","currentEntityId","identifier","forEach","_getFilterProps","getFilterProps","filterName","entityName","relationProp","relationEntityName","relationForeignKeys","shouldIgnoreFilter","isFilterEntitysId","Array","isArray","filtersNoRelation","_default","exports"],"sources":["../../src/helpers/build-inherited-filters.js"],"sourcesContent":["import flatten from 'lodash.flatten';\nimport isFilterEntitysId from './is-filter-entitys-id';\nimport getFilterProps from './get-filter-props';\n\nconst getRelationData = (entityData, relationName, currentRelationNames) => {\n if (!entityData) return null;\n if (currentRelationNames && currentRelationNames.length) {\n const arrayOfRelations = currentRelationNames.map(name => entityData[name]).filter(Boolean);\n return arrayOfRelations.length ? flatten(arrayOfRelations) : null;\n }\n return entityData[relationName];\n};\n\nconst checkIfArrayHasData = (isDataArray, relationData) => isDataArray && !!relationData.length;\n\nconst setFiltersNoRelation = (isDataArray, arrayHasData, relationData, relationName) => {\n const filters = [];\n if (arrayHasData) {\n const filterValues = relationData.reduce((acc, relationValue) => {\n if (relationValue && typeof relationValue !== 'object')\n acc.push(`${relationName}/${relationValue}`);\n return acc;\n }, []);\n filters.push(...filterValues);\n } else if (!isDataArray && typeof relationData !== 'object') {\n filters.push(`${relationName}/${relationData}`);\n }\n\n return filters;\n};\nconst buildInheritedFilters = (\n entityData,\n inheritedFilters,\n currentSchema,\n filterEntitySchema,\n itemId\n) => {\n const relationFilters = [];\n const { identifier: currentEntityId } = currentSchema;\n\n inheritedFilters.forEach(filter => {\n const {\n filterName,\n entityName,\n relationName,\n relationProp,\n relationEntityName,\n relationForeignKeys,\n shouldIgnoreFilter\n } = getFilterProps(filter, currentSchema, filterEntitySchema);\n\n const relationData = getRelationData(entityData, relationName, relationForeignKeys);\n
|
|
1
|
+
{"version":3,"file":"build-inherited-filters.js","names":["_lodash","_interopRequireDefault","require","_isFilterEntitysId","_getFilterProps2","_constants","getRelationData","entityData","relationName","currentRelationNames","length","arrayOfRelations","map","name","filter","Boolean","flatten","checkIfArrayHasData","isDataArray","relationData","setFiltersNoRelation","arrayHasData","filters","filterValues","reduce","acc","relationValue","_typeof2","push","concat","apply","_toConsumableArray2","buildInheritedFilters","inheritedFilters","currentSchema","filterEntitySchema","itemId","relationFilters","currentEntityId","identifier","forEach","_getFilterProps","getFilterProps","filterName","entityName","relationProp","relationEntityName","relationForeignKeys","shouldIgnoreFilter","ID","isFilterEntitysId","Array","isArray","filtersNoRelation","_default","exports"],"sources":["../../src/helpers/build-inherited-filters.js"],"sourcesContent":["import flatten from 'lodash.flatten';\nimport isFilterEntitysId from './is-filter-entitys-id';\nimport getFilterProps from './get-filter-props';\nimport { ID } from '../constants';\n\nconst getRelationData = (entityData, relationName, currentRelationNames) => {\n if (!entityData) return null;\n if (currentRelationNames && currentRelationNames.length) {\n const arrayOfRelations = currentRelationNames.map(name => entityData[name]).filter(Boolean);\n return arrayOfRelations.length ? flatten(arrayOfRelations) : null;\n }\n return entityData[relationName];\n};\n\nconst checkIfArrayHasData = (isDataArray, relationData) => isDataArray && !!relationData.length;\n\nconst setFiltersNoRelation = (isDataArray, arrayHasData, relationData, relationName) => {\n const filters = [];\n if (arrayHasData) {\n const filterValues = relationData.reduce((acc, relationValue) => {\n if (relationValue && typeof relationValue !== 'object')\n acc.push(`${relationName}/${relationValue}`);\n return acc;\n }, []);\n filters.push(...filterValues);\n } else if (!isDataArray && typeof relationData !== 'object') {\n filters.push(`${relationName}/${relationData}`);\n }\n\n return filters;\n};\nconst buildInheritedFilters = (\n entityData,\n inheritedFilters,\n currentSchema,\n filterEntitySchema,\n itemId\n) => {\n const relationFilters = [];\n const { identifier: currentEntityId } = currentSchema;\n\n inheritedFilters.forEach(filter => {\n const {\n filterName,\n entityName,\n relationName,\n relationProp,\n relationEntityName,\n relationForeignKeys,\n shouldIgnoreFilter\n } = getFilterProps(filter, currentSchema, filterEntitySchema);\n\n if (filterName === ID) return;\n\n const relationData = getRelationData(entityData, relationName, relationForeignKeys);\n if (\n (currentEntityId === entityName && isFilterEntitysId(filterName, currentEntityId)) ||\n shouldIgnoreFilter\n ) {\n relationFilters.push(`${filterName}/${itemId}`);\n }\n\n if (!relationData) return;\n\n const isDataArray = Array.isArray(relationData);\n const arrayHasData = checkIfArrayHasData(isDataArray, relationData);\n\n if (!relationEntityName) {\n const filtersNoRelation = setFiltersNoRelation(\n isDataArray,\n arrayHasData,\n relationData,\n relationName\n );\n relationFilters.push(...filtersNoRelation);\n }\n\n if (arrayHasData) {\n const filterValues = relationData.reduce((acc, relationValue) => {\n if (relationValue[relationProp]) acc.push(`${filterName}/${relationValue[relationProp]}`);\n return acc;\n }, []);\n relationFilters.push(...filterValues);\n } else if (!isDataArray && relationData[relationProp]) {\n relationFilters.push(`${filterName}/${relationData[relationProp]}`);\n }\n });\n\n return relationFilters;\n};\n\nexport default buildInheritedFilters;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,gBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAEA,IAAMI,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,UAAU,EAAEC,YAAY,EAAEC,oBAAoB,EAAK;EAC1E,IAAI,CAACF,UAAU,EAAE,OAAO,IAAI;EAC5B,IAAIE,oBAAoB,IAAIA,oBAAoB,CAACC,MAAM,EAAE;IACvD,IAAMC,gBAAgB,GAAGF,oBAAoB,CAACG,GAAG,CAAC,UAAAC,IAAI;MAAA,OAAIN,UAAU,CAACM,IAAI,CAAC;IAAA,EAAC,CAACC,MAAM,CAACC,OAAO,CAAC;IAC3F,OAAOJ,gBAAgB,CAACD,MAAM,GAAG,IAAAM,kBAAO,EAACL,gBAAgB,CAAC,GAAG,IAAI;EACnE;EACA,OAAOJ,UAAU,CAACC,YAAY,CAAC;AACjC,CAAC;AAED,IAAMS,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIC,WAAW,EAA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;MACZ,CAAC,EAAE,EAAE,CAAC;MACNY,eAAe,CAACT,IAAI,CAAAE,KAAA,CAApBO,eAAe,MAAAN,mBAAA,aAASR,YAAY,EAAC;IACvC,CAAC,MAAM,IAAI,CAACL,WAAW,IAAIC,YAAY,CAAC0B,YAAY,CAAC,EAAE;MACrDR,eAAe,CAACT,IAAI,IAAAC,MAAA,CAAIc,UAAU,OAAAd,MAAA,CAAIV,YAAY,CAAC0B,YAAY,CAAC,CAAE,CAAC;IACrE;EACF,CAAC,CAAC;EAEF,OAAOR,eAAe;AACxB,CAAC;AAAC,IAAAiB,QAAA,GAEatB,qBAAqB;AAAAuB,OAAA,cAAAD,QAAA"}
|
|
@@ -66,12 +66,15 @@ var buildComplexProps = function buildComplexProps(shouldAddCategoryProps, props
|
|
|
66
66
|
var _ref$relations = _ref.relations,
|
|
67
67
|
relations = _ref$relations === void 0 ? [] : _ref$relations,
|
|
68
68
|
_ref$dynamicPropertie = _ref.dynamicProperties,
|
|
69
|
-
dynamicProperties = _ref$dynamicPropertie === void 0 ? {} : _ref$dynamicPropertie
|
|
69
|
+
dynamicProperties = _ref$dynamicPropertie === void 0 ? {} : _ref$dynamicPropertie,
|
|
70
|
+
_ref$properties = _ref.properties,
|
|
71
|
+
properties = _ref$properties === void 0 ? {} : _ref$properties;
|
|
70
72
|
return Object.keys(props).map(function (base) {
|
|
71
73
|
var nestedProps = props[base];
|
|
72
74
|
var hasLink = !!linkProps.find(function (linkProp) {
|
|
73
75
|
return linkProp.includes(base);
|
|
74
76
|
});
|
|
77
|
+
var matchingProperty = !!properties[base];
|
|
75
78
|
var matchingRelation = relations.find(function (_ref2) {
|
|
76
79
|
var localField = _ref2.localField;
|
|
77
80
|
return localField === base;
|
|
@@ -80,7 +83,7 @@ var buildComplexProps = function buildComplexProps(shouldAddCategoryProps, props
|
|
|
80
83
|
return dynamicKey === base;
|
|
81
84
|
});
|
|
82
85
|
if (matchingRelation && !nestedProps.includes('id')) nestedProps.push('id');
|
|
83
|
-
if (hasLink && (!!matchingRelation || !!matchingDynamicProp)) nestedProps.push('url');
|
|
86
|
+
if (hasLink && (!!matchingProperty || !!matchingRelation || !!matchingDynamicProp)) nestedProps.push('url');
|
|
84
87
|
var jointNestedProps = nestedProps.join(',');
|
|
85
88
|
if (base === 'category' && shouldAddCategoryProps) return "".concat(base, "{").concat(jointNestedProps, ", ").concat(categoryProps, "}");
|
|
86
89
|
if (base.includes('published')) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-props-query.js","names":["_constants","require","defaultProps","ID","categoryProps","checkProps","props","Object","keys","filter","prop","CATEGORY_ID","length","buildPropsQuery","entitySchema","extraProps","arguments","undefined","cardOptions","linkProps","parsedSchema","getEntitySchema","extraPropsHaveCategory","includes","_getTypeBaseProps","getTypeBaseProps","typeBasedProps","shouldAddCategoryProps","allProps","concat","_toConsumableArray2","uniqueProps","Set","basicProps","nestedProps","forEach","push","_prop$split","split","_prop$split2","_slicedToArray2","base","nested","complexProps","buildComplexProps","join","_ref","_ref$relations","relations","_ref$dynamicPropertie","dynamicProperties","map","hasLink","find","linkProp","matchingRelation","_ref2","localField","matchingDynamicProp","dynamicKey","jointNestedProps","isCard","_ref3","_ref3$displayCategory","displayCategory","_ref3$displayThumbnai","displayThumbnail","interfaces","properties","isContent","hasCategory","hasPreheader","PREHEADER_PROP","apply","getCategoyProps","getContentProps","url","_ref4","HEADLINE_PROP","_default","exports"],"sources":["../../src/helpers/build-props-query.js"],"sourcesContent":["import { CATEGORY_ID, ID, PREHEADER_PROP, HEADLINE_PROP } from '../constants';\n\nconst defaultProps = [ID, 'name'];\nconst categoryProps = 'id publishedListingPage{id, url}';\n\nconst checkProps = props =>\n !!(props && Object.keys(props).filter(prop => prop === CATEGORY_ID).length);\n\nconst buildPropsQuery = (entitySchema, extraProps = [], cardOptions = null, linkProps = []) => {\n const parsedSchema = entitySchema.getEntitySchema ? entitySchema.getEntitySchema : entitySchema;\n const extraPropsHaveCategory = !!extraProps.filter(prop => prop.includes('category.')).length;\n const { typeBasedProps, shouldAddCategoryProps } = getTypeBaseProps(\n parsedSchema,\n cardOptions,\n extraPropsHaveCategory\n );\n\n const allProps = [...typeBasedProps, ...extraProps];\n const uniqueProps = [...new Set([...allProps])];\n const basicProps = [];\n const nestedProps = {};\n uniqueProps.forEach(prop => {\n if (prop) {\n if (!prop.includes('.')) {\n basicProps.push(prop);\n return;\n }\n const [base, nested] = prop.split('.');\n if (!nestedProps[base]) nestedProps[base] = [nested];\n else nestedProps[base].push(nested);\n }\n });\n\n const complexProps = buildComplexProps(\n shouldAddCategoryProps,\n nestedProps,\n parsedSchema,\n linkProps\n );\n\n return [...basicProps, ...complexProps].join(',');\n};\n\nconst buildComplexProps = (\n shouldAddCategoryProps,\n props,\n { relations = [], dynamicProperties = {} },\n linkProps\n) =>\n Object.keys(props).map(base => {\n const nestedProps = props[base];\n const hasLink = !!linkProps.find(linkProp => linkProp.includes(base));\n const matchingRelation = relations.find(({ localField }) => localField === base);\n const matchingDynamicProp = Object.keys(dynamicProperties).find(\n dynamicKey => dynamicKey === base\n );\n\n if (matchingRelation && !nestedProps.includes('id')) nestedProps.push('id');\n if (hasLink && (!!matchingRelation || !!matchingDynamicProp)) nestedProps.push('url');\n const jointNestedProps = nestedProps.join(',');\n if (base === 'category' && shouldAddCategoryProps)\n return `${base}{${jointNestedProps}, ${categoryProps}}`;\n if (base.includes('published')) {\n return `${base}{${jointNestedProps},url}`;\n }\n return `${base}{${jointNestedProps}}`;\n });\n\nconst getTypeBaseProps = (entitySchema, cardOptions, extraPropsHaveCategory) => {\n const isCard = !!cardOptions;\n const { displayCategory = true, displayThumbnail = true } = cardOptions || {};\n\n const shouldAddCategoryProps =\n (isCard && displayCategory) || (!isCard && !extraPropsHaveCategory);\n\n if (!isCard) return { typeBasedProps: [ID], shouldAddCategoryProps };\n\n const { interfaces, properties, dynamicProperties, relations } = entitySchema;\n\n const isContent = !!interfaces.includes('content/content');\n const hasCategory = checkProps(properties) || checkProps(dynamicProperties);\n const hasPreheader = properties[PREHEADER_PROP];\n\n const typeBasedProps = [...defaultProps];\n\n typeBasedProps.push(...getCategoyProps(shouldAddCategoryProps, hasCategory, hasPreheader));\n typeBasedProps.push(...getContentProps(isContent));\n\n if (properties.url || dynamicProperties.url) typeBasedProps.push('url');\n\n if (displayThumbnail && relations.find(({ localField }) => localField === 'image')) {\n typeBasedProps.push('image.id', 'image.url', 'image.data');\n }\n\n return { typeBasedProps, shouldAddCategoryProps };\n};\n\nconst getContentProps = isContent => (isContent ? ['url', 'sponsored', 'featured'] : []);\n\nconst getCategoyProps = (shouldAddCategoryProps, hasCategory, hasPreheader) => {\n if (!shouldAddCategoryProps) return [];\n const props = [];\n if (hasCategory)\n props.push('category.name', 'category.listingPageId', 'category.listingPageEntity');\n\n if (hasPreheader) {\n props.push(`${PREHEADER_PROP}{name}`);\n props.push(HEADLINE_PROP);\n }\n\n return props;\n};\n\nexport default buildPropsQuery;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAMC,YAAY,GAAG,CAACC,aAAE,EAAE,MAAM,CAAC;AACjC,IAAMC,aAAa,GAAG,kCAAkC;AAExD,IAAMC,UAAU,GAAG,SAAbA,UAAUA,CAAGC,KAAK;EAAA,OACtB,CAAC,EAAEA,KAAK,IAAIC,MAAM,CAACC,IAAI,CAACF,KAAK,CAAC,CAACG,MAAM,CAAC,UAAAC,IAAI;IAAA,OAAIA,IAAI,KAAKC,sBAAW;EAAA,EAAC,CAACC,MAAM,CAAC;AAAA;AAE7E,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,YAAY,EAA0D;EAAA,IAAxDC,UAAU,GAAAC,SAAA,CAAAJ,MAAA,QAAAI,SAAA,QAAAC,SAAA,GAAAD,SAAA,MAAG,EAAE;EAAA,IAAEE,WAAW,GAAAF,SAAA,CAAAJ,MAAA,QAAAI,SAAA,QAAAC,SAAA,GAAAD,SAAA,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AAS;EAAA,OAAKA,SAAS,GAAG,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE;AAAA,CAAC;AAExF,IAAMK,eAAe,GAAG,SAAlBA,eAAeA,CAAI/C,sBAAsB,EAAE2C,WAAW,EAAEC,YAAY,EAAK;EAC7E,IAAI,CAAC5C,sBAAsB,EAAE,OAAO,EAAE;EACtC,IAAMrB,KAAK,GAAG,EAAE;EAChB,IAAIgE,WAAW,EACbhE,KAAK,CAAC8B,IAAI,CAAC,eAAe,EAAE,wBAAwB,EAAE,4BAA4B,CAAC;EAErF,IAAImC,YAAY,EAAE;IAChBjE,KAAK,CAAC8B,IAAI,IAAAP,MAAA,CAAI2C,yBAAc,WAAQ,CAAC;IACrClE,KAAK,CAAC8B,IAAI,CAAC0C,wBAAa,CAAC;EAC3B;EAEA,OAAOxE,KAAK;AACd,CAAC;AAAC,IAAAyE,QAAA,GAEalE,eAAe;AAAAmE,OAAA,cAAAD,QAAA"}
|
|
1
|
+
{"version":3,"file":"build-props-query.js","names":["_constants","require","defaultProps","ID","categoryProps","checkProps","props","Object","keys","filter","prop","CATEGORY_ID","length","buildPropsQuery","entitySchema","extraProps","arguments","undefined","cardOptions","linkProps","parsedSchema","getEntitySchema","extraPropsHaveCategory","includes","_getTypeBaseProps","getTypeBaseProps","typeBasedProps","shouldAddCategoryProps","allProps","concat","_toConsumableArray2","uniqueProps","Set","basicProps","nestedProps","forEach","push","_prop$split","split","_prop$split2","_slicedToArray2","base","nested","complexProps","buildComplexProps","join","_ref","_ref$relations","relations","_ref$dynamicPropertie","dynamicProperties","_ref$properties","properties","map","hasLink","find","linkProp","matchingProperty","matchingRelation","_ref2","localField","matchingDynamicProp","dynamicKey","jointNestedProps","isCard","_ref3","_ref3$displayCategory","displayCategory","_ref3$displayThumbnai","displayThumbnail","interfaces","isContent","hasCategory","hasPreheader","PREHEADER_PROP","apply","getCategoyProps","getContentProps","url","_ref4","HEADLINE_PROP","_default","exports"],"sources":["../../src/helpers/build-props-query.js"],"sourcesContent":["import { CATEGORY_ID, ID, PREHEADER_PROP, HEADLINE_PROP } from '../constants';\n\nconst defaultProps = [ID, 'name'];\nconst categoryProps = 'id publishedListingPage{id, url}';\n\nconst checkProps = props =>\n !!(props && Object.keys(props).filter(prop => prop === CATEGORY_ID).length);\n\nconst buildPropsQuery = (entitySchema, extraProps = [], cardOptions = null, linkProps = []) => {\n const parsedSchema = entitySchema.getEntitySchema ? entitySchema.getEntitySchema : entitySchema;\n const extraPropsHaveCategory = !!extraProps.filter(prop => prop.includes('category.')).length;\n const { typeBasedProps, shouldAddCategoryProps } = getTypeBaseProps(\n parsedSchema,\n cardOptions,\n extraPropsHaveCategory\n );\n\n const allProps = [...typeBasedProps, ...extraProps];\n const uniqueProps = [...new Set([...allProps])];\n const basicProps = [];\n const nestedProps = {};\n uniqueProps.forEach(prop => {\n if (prop) {\n if (!prop.includes('.')) {\n basicProps.push(prop);\n return;\n }\n const [base, nested] = prop.split('.');\n if (!nestedProps[base]) nestedProps[base] = [nested];\n else nestedProps[base].push(nested);\n }\n });\n\n const complexProps = buildComplexProps(\n shouldAddCategoryProps,\n nestedProps,\n parsedSchema,\n linkProps\n );\n\n return [...basicProps, ...complexProps].join(',');\n};\n\nconst buildComplexProps = (\n shouldAddCategoryProps,\n props,\n { relations = [], dynamicProperties = {}, properties = {} },\n linkProps\n) =>\n Object.keys(props).map(base => {\n const nestedProps = props[base];\n const hasLink = !!linkProps.find(linkProp => linkProp.includes(base));\n const matchingProperty = !!properties[base];\n const matchingRelation = relations.find(({ localField }) => localField === base);\n const matchingDynamicProp = Object.keys(dynamicProperties).find(\n dynamicKey => dynamicKey === base\n );\n\n if (matchingRelation && !nestedProps.includes('id')) nestedProps.push('id');\n if (hasLink && (!!matchingProperty || !!matchingRelation || !!matchingDynamicProp))\n nestedProps.push('url');\n const jointNestedProps = nestedProps.join(',');\n if (base === 'category' && shouldAddCategoryProps)\n return `${base}{${jointNestedProps}, ${categoryProps}}`;\n if (base.includes('published')) {\n return `${base}{${jointNestedProps},url}`;\n }\n return `${base}{${jointNestedProps}}`;\n });\n\nconst getTypeBaseProps = (entitySchema, cardOptions, extraPropsHaveCategory) => {\n const isCard = !!cardOptions;\n const { displayCategory = true, displayThumbnail = true } = cardOptions || {};\n\n const shouldAddCategoryProps =\n (isCard && displayCategory) || (!isCard && !extraPropsHaveCategory);\n\n if (!isCard) return { typeBasedProps: [ID], shouldAddCategoryProps };\n\n const { interfaces, properties, dynamicProperties, relations } = entitySchema;\n\n const isContent = !!interfaces.includes('content/content');\n const hasCategory = checkProps(properties) || checkProps(dynamicProperties);\n const hasPreheader = properties[PREHEADER_PROP];\n\n const typeBasedProps = [...defaultProps];\n\n typeBasedProps.push(...getCategoyProps(shouldAddCategoryProps, hasCategory, hasPreheader));\n typeBasedProps.push(...getContentProps(isContent));\n\n if (properties.url || dynamicProperties.url) typeBasedProps.push('url');\n\n if (displayThumbnail && relations.find(({ localField }) => localField === 'image')) {\n typeBasedProps.push('image.id', 'image.url', 'image.data');\n }\n\n return { typeBasedProps, shouldAddCategoryProps };\n};\n\nconst getContentProps = isContent => (isContent ? ['url', 'sponsored', 'featured'] : []);\n\nconst getCategoyProps = (shouldAddCategoryProps, hasCategory, hasPreheader) => {\n if (!shouldAddCategoryProps) return [];\n const props = [];\n if (hasCategory)\n props.push('category.name', 'category.listingPageId', 'category.listingPageEntity');\n\n if (hasPreheader) {\n props.push(`${PREHEADER_PROP}{name}`);\n props.push(HEADLINE_PROP);\n }\n\n return props;\n};\n\nexport default buildPropsQuery;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAMC,YAAY,GAAG,CAACC,aAAE,EAAE,MAAM,CAAC;AACjC,IAAMC,aAAa,GAAG,kCAAkC;AAExD,IAAMC,UAAU,GAAG,SAAbA,UAAUA,CAAGC,KAAK;EAAA,OACtB,CAAC,EAAEA,KAAK,IAAIC,MAAM,CAACC,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";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
require("core-js/modules/es.array.concat.js");
|
|
9
|
+
var buildQueryKey = function buildQueryKey(key, listName) {
|
|
10
|
+
var listNameKey = listName ? "pb[".concat(listName, "]") : '';
|
|
11
|
+
var wrappedSearchKey = listNameKey ? "[".concat(key, "]") : key;
|
|
12
|
+
return "".concat(listNameKey).concat(wrappedSearchKey);
|
|
13
|
+
};
|
|
14
|
+
var _default = buildQueryKey;
|
|
15
|
+
exports["default"] = _default;
|
|
16
|
+
//# sourceMappingURL=build-query-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-query-key.js","names":["buildQueryKey","key","listName","listNameKey","concat","wrappedSearchKey","_default","exports"],"sources":["../../src/helpers/build-query-key.js"],"sourcesContent":["const buildQueryKey = (key, listName) => {\n const listNameKey = listName ? `pb[${listName}]` : '';\n const wrappedSearchKey = listNameKey ? `[${key}]` : key;\n return `${listNameKey}${wrappedSearchKey}`;\n};\n\nexport default buildQueryKey;\n"],"mappings":";;;;;;;;AAAA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,GAAG,EAAEC,QAAQ,EAAK;EACvC,IAAMC,WAAW,GAAGD,QAAQ,SAAAE,MAAA,CAASF,QAAQ,SAAM,EAAE;EACrD,IAAMG,gBAAgB,GAAGF,WAAW,OAAAC,MAAA,CAAOH,GAAG,SAAMA,GAAG;EACvD,UAAAG,MAAA,CAAUD,WAAW,EAAAC,MAAA,CAAGC,gBAAgB;AAC1C,CAAC;AAAC,IAAAC,QAAA,GAEaN,aAAa;AAAAO,OAAA,cAAAD,QAAA"}
|
|
@@ -45,7 +45,11 @@ var buildSetFilters = function buildSetFilters(_ref) {
|
|
|
45
45
|
getCheckboxFilters(checkboxFilters, _constants.SPONSORED);
|
|
46
46
|
}
|
|
47
47
|
var shouldApplyFilterValues = filterBy.length && filterByProperty.length;
|
|
48
|
-
|
|
48
|
+
if (!shouldApplyFilterValues) return {
|
|
49
|
+
checkboxFilters: checkboxFilters,
|
|
50
|
+
listFilterValues: {}
|
|
51
|
+
};
|
|
52
|
+
var listFilterValues = getFilterValues(filterBy);
|
|
49
53
|
return {
|
|
50
54
|
checkboxFilters: checkboxFilters,
|
|
51
55
|
listFilterValues: listFilterValues
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-set-filters.js","names":["_constants","require","getCheckboxFilters","checkboxFilters","name","push","getFilterValues","filterBy","reduce","acc","filter","_filter$split","split","_filter$split2","_toArray2","fieldName","values","slice","value","join","previousValue","finalValue","concat","_toConsumableArray2","buildSetFilters","_ref","_ref$filterBy","_ref$filterByProperty","filterByProperty","filterByFeatured","filterBySponsored","FEATURED","SPONSORED","shouldApplyFilterValues","length","listFilterValues","_default","exports"],"sources":["../../src/helpers/build-set-filters.js"],"sourcesContent":["import { FEATURED, SPONSORED } from '../constants';\n\nconst getCheckboxFilters = (checkboxFilters, name) => {\n checkboxFilters.push(name);\n};\n\nconst getFilterValues = filterBy =>\n filterBy.reduce((acc, filter) => {\n const [fieldName, ...values] = filter.split('/');\n const value = values.join('/');\n const previousValue = acc[fieldName];\n const finalValue = previousValue ? [...previousValue, value] : [value];\n\n acc[fieldName] = finalValue;\n return acc;\n }, {});\n\nconst buildSetFilters = ({\n filterBy = [],\n filterByProperty = [],\n filterByFeatured,\n filterBySponsored\n}) => {\n const checkboxFilters = [];\n\n if (filterByFeatured) {\n getCheckboxFilters(checkboxFilters, FEATURED);\n }\n if (filterBySponsored) {\n getCheckboxFilters(checkboxFilters, SPONSORED);\n }\n\n const shouldApplyFilterValues = filterBy.length && filterByProperty.length;\n
|
|
1
|
+
{"version":3,"file":"build-set-filters.js","names":["_constants","require","getCheckboxFilters","checkboxFilters","name","push","getFilterValues","filterBy","reduce","acc","filter","_filter$split","split","_filter$split2","_toArray2","fieldName","values","slice","value","join","previousValue","finalValue","concat","_toConsumableArray2","buildSetFilters","_ref","_ref$filterBy","_ref$filterByProperty","filterByProperty","filterByFeatured","filterBySponsored","FEATURED","SPONSORED","shouldApplyFilterValues","length","listFilterValues","_default","exports"],"sources":["../../src/helpers/build-set-filters.js"],"sourcesContent":["import { FEATURED, SPONSORED } from '../constants';\n\nconst getCheckboxFilters = (checkboxFilters, name) => {\n checkboxFilters.push(name);\n};\n\nconst getFilterValues = filterBy =>\n filterBy.reduce((acc, filter) => {\n const [fieldName, ...values] = filter.split('/');\n const value = values.join('/');\n const previousValue = acc[fieldName];\n const finalValue = previousValue ? [...previousValue, value] : [value];\n\n acc[fieldName] = finalValue;\n return acc;\n }, {});\n\nconst buildSetFilters = ({\n filterBy = [],\n filterByProperty = [],\n filterByFeatured,\n filterBySponsored\n}) => {\n const checkboxFilters = [];\n\n if (filterByFeatured) {\n getCheckboxFilters(checkboxFilters, FEATURED);\n }\n if (filterBySponsored) {\n getCheckboxFilters(checkboxFilters, SPONSORED);\n }\n\n const shouldApplyFilterValues = filterBy.length && filterByProperty.length;\n if (!shouldApplyFilterValues) return { checkboxFilters, listFilterValues: {} };\n\n const listFilterValues = getFilterValues(filterBy);\n return { checkboxFilters, listFilterValues };\n};\n\nexport default buildSetFilters;\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,eAAe,EAAEC,IAAI,EAAK;EACpDD,eAAe,CAACE,IAAI,CAACD,IAAI,CAAC;AAC5B,CAAC;AAED,IAAME,eAAe,GAAG,SAAlBA,eAAeA,CAAGC,QAAQ;EAAA,OAC9BA,QAAQ,CAACC,MAAM,CAAC,UAACC,GAAG,EAAEC,MAAM,EAAK;IAC/B,IAAAC,aAAA,GAA+BD,MAAM,CAACE,KAAK,CAAC,GAAG,CAAC;MAAAC,cAAA,OAAAC,SAAA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