@commercetools-frontend-extensions/export-resources-modal 4.4.0 → 4.4.2
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/dist/commercetools-frontend-extensions-export-resources-modal.cjs.dev.js +10 -12
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.prod.js +10 -12
- package/dist/commercetools-frontend-extensions-export-resources-modal.esm.js +9 -11
- package/dist/declarations/src/@types/export-resources-modal-types.d.ts +0 -1
- package/package.json +5 -5
|
@@ -35,6 +35,7 @@ var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-arr
|
|
|
35
35
|
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
36
36
|
var _sortInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/sort');
|
|
37
37
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
38
|
+
var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
|
|
38
39
|
var moment = require('moment');
|
|
39
40
|
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
40
41
|
var _everyInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/every');
|
|
@@ -44,7 +45,6 @@ var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
|
44
45
|
var constants = require('@commercetools-frontend/constants');
|
|
45
46
|
var _styled = require('@emotion/styled/base');
|
|
46
47
|
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
47
|
-
var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
|
|
48
48
|
var throttle = require('lodash/throttle');
|
|
49
49
|
var formik = require('formik');
|
|
50
50
|
var react = require('@emotion/react');
|
|
@@ -74,12 +74,12 @@ var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
|
74
74
|
var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
75
75
|
var _sortInstanceProperty__default = /*#__PURE__*/_interopDefault(_sortInstanceProperty);
|
|
76
76
|
var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
|
|
77
|
+
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
|
|
77
78
|
var moment__default = /*#__PURE__*/_interopDefault(moment);
|
|
78
79
|
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
79
80
|
var _everyInstanceProperty__default = /*#__PURE__*/_interopDefault(_everyInstanceProperty);
|
|
80
81
|
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
81
82
|
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
82
|
-
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
|
|
83
83
|
var throttle__default = /*#__PURE__*/_interopDefault(throttle);
|
|
84
84
|
var get__default = /*#__PURE__*/_interopDefault(get);
|
|
85
85
|
|
|
@@ -557,21 +557,19 @@ function buildSelectedExportFilters(selectedResourceIds) {
|
|
|
557
557
|
const formattedIds = _mapInstanceProperty__default["default"](selectedResourceIds).call(selectedResourceIds, id => "\"".concat(id, "\"")).join(', ');
|
|
558
558
|
return "id in (".concat(formattedIds, ")");
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function areFiltersApplied(filters) {
|
|
561
|
+
var _filters$where;
|
|
561
562
|
if (!filters) {
|
|
562
563
|
return false;
|
|
563
564
|
}
|
|
564
|
-
|
|
565
|
-
return filters.length > 0;
|
|
566
|
-
}
|
|
567
|
-
return _Object$keys__default["default"](filters).length > 0;
|
|
565
|
+
return filters.where !== undefined && ((_filters$where = filters.where) === null || _filters$where === void 0 ? void 0 : _trimInstanceProperty__default["default"](_filters$where).call(_filters$where)) !== '';
|
|
568
566
|
}
|
|
569
567
|
function getInitialExportType(args) {
|
|
570
568
|
var _args$selectedResourc, _args$filters;
|
|
571
569
|
if ((_args$selectedResourc = args.selectedResourceIds) !== null && _args$selectedResourc !== void 0 && _args$selectedResourc.length) {
|
|
572
570
|
return EXPORT_TYPES.SELECTED;
|
|
573
571
|
}
|
|
574
|
-
if ((_args$filters = args.filters) !== null && _args$filters !== void 0 && _args$filters.total) {
|
|
572
|
+
if ((_args$filters = args.filters) !== null && _args$filters !== void 0 && _args$filters.total && areFiltersApplied(args.filters)) {
|
|
575
573
|
return EXPORT_TYPES.FILTERED;
|
|
576
574
|
}
|
|
577
575
|
return EXPORT_TYPES.ALL;
|
|
@@ -860,8 +858,8 @@ function ExportScopeSection() {
|
|
|
860
858
|
exportType = _useExportResourcesCo.exportType,
|
|
861
859
|
totalResourcesCount = _useExportResourcesCo.totalResourcesCount,
|
|
862
860
|
filters = _useExportResourcesCo.filters,
|
|
863
|
-
selectedResourceIds = _useExportResourcesCo.selectedResourceIds,
|
|
864
861
|
hasFilters = _useExportResourcesCo.hasFilters,
|
|
862
|
+
selectedResourceIds = _useExportResourcesCo.selectedResourceIds,
|
|
865
863
|
setExportType = _useExportResourcesCo.setExportType,
|
|
866
864
|
resourceType = _useExportResourcesCo.resourceType;
|
|
867
865
|
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
@@ -886,9 +884,9 @@ function ExportScopeSection() {
|
|
|
886
884
|
})
|
|
887
885
|
}), filters && jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
888
886
|
value: EXPORT_TYPES.FILTERED,
|
|
889
|
-
isDisabled: !filters.total,
|
|
887
|
+
isDisabled: !filters.total || !hasFilters,
|
|
890
888
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
891
|
-
tone: !hasFilters ? 'tertiary' : undefined,
|
|
889
|
+
tone: !filters.total || !hasFilters ? 'tertiary' : undefined,
|
|
892
890
|
intlMessage: filters.total ? _objectSpread$5(_objectSpread$5({}, resourceTypeMessages[resourceType].exportScopeFiltered), {}, {
|
|
893
891
|
values: {
|
|
894
892
|
total: intl.formatNumber(filters.total)
|
|
@@ -1609,7 +1607,7 @@ const ExportResourcesProvider = props => {
|
|
|
1609
1607
|
totalResourcesCount: props.totalResourcesCount,
|
|
1610
1608
|
selectedResourceIds: props.selectedResourceIds,
|
|
1611
1609
|
filters: props.filters,
|
|
1612
|
-
hasFilters:
|
|
1610
|
+
hasFilters: areFiltersApplied(props.filters),
|
|
1613
1611
|
setExportType
|
|
1614
1612
|
},
|
|
1615
1613
|
children: props.children
|
|
@@ -35,6 +35,7 @@ var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-arr
|
|
|
35
35
|
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
36
36
|
var _sortInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/sort');
|
|
37
37
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
38
|
+
var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
|
|
38
39
|
var moment = require('moment');
|
|
39
40
|
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
40
41
|
var _everyInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/every');
|
|
@@ -44,7 +45,6 @@ var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
|
44
45
|
var constants = require('@commercetools-frontend/constants');
|
|
45
46
|
var _styled = require('@emotion/styled/base');
|
|
46
47
|
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
47
|
-
var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
|
|
48
48
|
var throttle = require('lodash/throttle');
|
|
49
49
|
var react = require('@emotion/react');
|
|
50
50
|
var get = require('lodash/get');
|
|
@@ -74,12 +74,12 @@ var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
|
74
74
|
var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
75
75
|
var _sortInstanceProperty__default = /*#__PURE__*/_interopDefault(_sortInstanceProperty);
|
|
76
76
|
var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
|
|
77
|
+
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
|
|
77
78
|
var moment__default = /*#__PURE__*/_interopDefault(moment);
|
|
78
79
|
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
79
80
|
var _everyInstanceProperty__default = /*#__PURE__*/_interopDefault(_everyInstanceProperty);
|
|
80
81
|
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
81
82
|
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
82
|
-
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
|
|
83
83
|
var throttle__default = /*#__PURE__*/_interopDefault(throttle);
|
|
84
84
|
var get__default = /*#__PURE__*/_interopDefault(get);
|
|
85
85
|
|
|
@@ -557,21 +557,19 @@ function buildSelectedExportFilters(selectedResourceIds) {
|
|
|
557
557
|
const formattedIds = _mapInstanceProperty__default["default"](selectedResourceIds).call(selectedResourceIds, id => "\"".concat(id, "\"")).join(', ');
|
|
558
558
|
return "id in (".concat(formattedIds, ")");
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function areFiltersApplied(filters) {
|
|
561
|
+
var _filters$where;
|
|
561
562
|
if (!filters) {
|
|
562
563
|
return false;
|
|
563
564
|
}
|
|
564
|
-
|
|
565
|
-
return filters.length > 0;
|
|
566
|
-
}
|
|
567
|
-
return _Object$keys__default["default"](filters).length > 0;
|
|
565
|
+
return filters.where !== undefined && ((_filters$where = filters.where) === null || _filters$where === void 0 ? void 0 : _trimInstanceProperty__default["default"](_filters$where).call(_filters$where)) !== '';
|
|
568
566
|
}
|
|
569
567
|
function getInitialExportType(args) {
|
|
570
568
|
var _args$selectedResourc, _args$filters;
|
|
571
569
|
if ((_args$selectedResourc = args.selectedResourceIds) !== null && _args$selectedResourc !== void 0 && _args$selectedResourc.length) {
|
|
572
570
|
return EXPORT_TYPES.SELECTED;
|
|
573
571
|
}
|
|
574
|
-
if ((_args$filters = args.filters) !== null && _args$filters !== void 0 && _args$filters.total) {
|
|
572
|
+
if ((_args$filters = args.filters) !== null && _args$filters !== void 0 && _args$filters.total && areFiltersApplied(args.filters)) {
|
|
575
573
|
return EXPORT_TYPES.FILTERED;
|
|
576
574
|
}
|
|
577
575
|
return EXPORT_TYPES.ALL;
|
|
@@ -860,8 +858,8 @@ function ExportScopeSection() {
|
|
|
860
858
|
exportType = _useExportResourcesCo.exportType,
|
|
861
859
|
totalResourcesCount = _useExportResourcesCo.totalResourcesCount,
|
|
862
860
|
filters = _useExportResourcesCo.filters,
|
|
863
|
-
selectedResourceIds = _useExportResourcesCo.selectedResourceIds,
|
|
864
861
|
hasFilters = _useExportResourcesCo.hasFilters,
|
|
862
|
+
selectedResourceIds = _useExportResourcesCo.selectedResourceIds,
|
|
865
863
|
setExportType = _useExportResourcesCo.setExportType,
|
|
866
864
|
resourceType = _useExportResourcesCo.resourceType;
|
|
867
865
|
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
@@ -886,9 +884,9 @@ function ExportScopeSection() {
|
|
|
886
884
|
})
|
|
887
885
|
}), filters && jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
888
886
|
value: EXPORT_TYPES.FILTERED,
|
|
889
|
-
isDisabled: !filters.total,
|
|
887
|
+
isDisabled: !filters.total || !hasFilters,
|
|
890
888
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
891
|
-
tone: !hasFilters ? 'tertiary' : undefined,
|
|
889
|
+
tone: !filters.total || !hasFilters ? 'tertiary' : undefined,
|
|
892
890
|
intlMessage: filters.total ? _objectSpread$5(_objectSpread$5({}, resourceTypeMessages[resourceType].exportScopeFiltered), {}, {
|
|
893
891
|
values: {
|
|
894
892
|
total: intl.formatNumber(filters.total)
|
|
@@ -1570,7 +1568,7 @@ const ExportResourcesProvider = props => {
|
|
|
1570
1568
|
totalResourcesCount: props.totalResourcesCount,
|
|
1571
1569
|
selectedResourceIds: props.selectedResourceIds,
|
|
1572
1570
|
filters: props.filters,
|
|
1573
|
-
hasFilters:
|
|
1571
|
+
hasFilters: areFiltersApplied(props.filters),
|
|
1574
1572
|
setExportType
|
|
1575
1573
|
},
|
|
1576
1574
|
children: props.children
|
|
@@ -31,6 +31,7 @@ import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array
|
|
|
31
31
|
import _Set from '@babel/runtime-corejs3/core-js-stable/set';
|
|
32
32
|
import _sortInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/sort';
|
|
33
33
|
import _indexOfInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/index-of';
|
|
34
|
+
import _trimInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/trim';
|
|
34
35
|
import moment from 'moment';
|
|
35
36
|
import _findInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
36
37
|
import _everyInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/every';
|
|
@@ -40,7 +41,6 @@ import { useShowNotification } from '@commercetools-frontend/actions-global';
|
|
|
40
41
|
import { MC_API_PROXY_TARGETS, DOMAINS } from '@commercetools-frontend/constants';
|
|
41
42
|
import _styled from '@emotion/styled/base';
|
|
42
43
|
import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
|
|
43
|
-
import _trimInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/trim';
|
|
44
44
|
import throttle from 'lodash/throttle';
|
|
45
45
|
import { useFormik } from 'formik';
|
|
46
46
|
import { css } from '@emotion/react';
|
|
@@ -522,21 +522,19 @@ function buildSelectedExportFilters(selectedResourceIds) {
|
|
|
522
522
|
const formattedIds = _mapInstanceProperty(selectedResourceIds).call(selectedResourceIds, id => "\"".concat(id, "\"")).join(', ');
|
|
523
523
|
return "id in (".concat(formattedIds, ")");
|
|
524
524
|
}
|
|
525
|
-
function
|
|
525
|
+
function areFiltersApplied(filters) {
|
|
526
|
+
var _filters$where;
|
|
526
527
|
if (!filters) {
|
|
527
528
|
return false;
|
|
528
529
|
}
|
|
529
|
-
|
|
530
|
-
return filters.length > 0;
|
|
531
|
-
}
|
|
532
|
-
return _Object$keys(filters).length > 0;
|
|
530
|
+
return filters.where !== undefined && ((_filters$where = filters.where) === null || _filters$where === void 0 ? void 0 : _trimInstanceProperty(_filters$where).call(_filters$where)) !== '';
|
|
533
531
|
}
|
|
534
532
|
function getInitialExportType(args) {
|
|
535
533
|
var _args$selectedResourc, _args$filters;
|
|
536
534
|
if ((_args$selectedResourc = args.selectedResourceIds) !== null && _args$selectedResourc !== void 0 && _args$selectedResourc.length) {
|
|
537
535
|
return EXPORT_TYPES.SELECTED;
|
|
538
536
|
}
|
|
539
|
-
if ((_args$filters = args.filters) !== null && _args$filters !== void 0 && _args$filters.total) {
|
|
537
|
+
if ((_args$filters = args.filters) !== null && _args$filters !== void 0 && _args$filters.total && areFiltersApplied(args.filters)) {
|
|
540
538
|
return EXPORT_TYPES.FILTERED;
|
|
541
539
|
}
|
|
542
540
|
return EXPORT_TYPES.ALL;
|
|
@@ -825,8 +823,8 @@ function ExportScopeSection() {
|
|
|
825
823
|
exportType = _useExportResourcesCo.exportType,
|
|
826
824
|
totalResourcesCount = _useExportResourcesCo.totalResourcesCount,
|
|
827
825
|
filters = _useExportResourcesCo.filters,
|
|
828
|
-
selectedResourceIds = _useExportResourcesCo.selectedResourceIds,
|
|
829
826
|
hasFilters = _useExportResourcesCo.hasFilters,
|
|
827
|
+
selectedResourceIds = _useExportResourcesCo.selectedResourceIds,
|
|
830
828
|
setExportType = _useExportResourcesCo.setExportType,
|
|
831
829
|
resourceType = _useExportResourcesCo.resourceType;
|
|
832
830
|
return jsx(Spacings.Stack, {
|
|
@@ -851,9 +849,9 @@ function ExportScopeSection() {
|
|
|
851
849
|
})
|
|
852
850
|
}), filters && jsx(RadioInput.Option, {
|
|
853
851
|
value: EXPORT_TYPES.FILTERED,
|
|
854
|
-
isDisabled: !filters.total,
|
|
852
|
+
isDisabled: !filters.total || !hasFilters,
|
|
855
853
|
children: jsx(Text.Body, {
|
|
856
|
-
tone: !hasFilters ? 'tertiary' : undefined,
|
|
854
|
+
tone: !filters.total || !hasFilters ? 'tertiary' : undefined,
|
|
857
855
|
intlMessage: filters.total ? _objectSpread$5(_objectSpread$5({}, resourceTypeMessages[resourceType].exportScopeFiltered), {}, {
|
|
858
856
|
values: {
|
|
859
857
|
total: intl.formatNumber(filters.total)
|
|
@@ -1574,7 +1572,7 @@ const ExportResourcesProvider = props => {
|
|
|
1574
1572
|
totalResourcesCount: props.totalResourcesCount,
|
|
1575
1573
|
selectedResourceIds: props.selectedResourceIds,
|
|
1576
1574
|
filters: props.filters,
|
|
1577
|
-
hasFilters:
|
|
1575
|
+
hasFilters: areFiltersApplied(props.filters),
|
|
1578
1576
|
setExportType
|
|
1579
1577
|
},
|
|
1580
1578
|
children: props.children
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend-extensions/export-resources-modal",
|
|
3
3
|
"description": "Shared export modal for exporting resources",
|
|
4
|
-
"version": "4.4.
|
|
4
|
+
"version": "4.4.2",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"README.md"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@babel/runtime": "7.
|
|
19
|
-
"@babel/runtime-corejs3": "7.
|
|
18
|
+
"@babel/runtime": "7.25.0",
|
|
19
|
+
"@babel/runtime-corejs3": "7.25.0",
|
|
20
20
|
"@commercetools-frontend/experimental-components": "6.1.3",
|
|
21
|
-
"@emotion/react": "11.
|
|
22
|
-
"@emotion/styled": "11.
|
|
21
|
+
"@emotion/react": "11.13.0",
|
|
22
|
+
"@emotion/styled": "11.13.0",
|
|
23
23
|
"@formatjs/cli": "6.2.12",
|
|
24
24
|
"formik": "2.4.6",
|
|
25
25
|
"jest": "29.7.0",
|