@commercetools-frontend-extensions/export-resources-modal 4.7.2 → 4.8.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/README.md +8 -2
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.dev.js +83 -49
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.prod.js +82 -48
- package/dist/commercetools-frontend-extensions-export-resources-modal.esm.js +82 -50
- package/dist/declarations/src/@types/export-api.d.ts +6 -3
- package/dist/declarations/src/@types/export-resources-modal-context.d.ts +6 -2
- package/dist/declarations/src/@types/export-resources-modal-types.d.ts +12 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -129,7 +129,13 @@ import ExportResourcesModal from '@commercetools-frontend-extensions/export-reso
|
|
|
129
129
|
outputFormat="csv"
|
|
130
130
|
resourceType="category"
|
|
131
131
|
filters={{
|
|
132
|
-
|
|
132
|
+
{
|
|
133
|
+
filters: [ 'key = "category-key"'],
|
|
134
|
+
fullText: {
|
|
135
|
+
text: 'category-text',
|
|
136
|
+
locale: 'en'
|
|
137
|
+
}
|
|
138
|
+
},
|
|
133
139
|
total: 20
|
|
134
140
|
}}
|
|
135
141
|
totalResourcesCount={143}
|
|
@@ -326,7 +332,7 @@ import ExportResourcesModal from '@commercetools-frontend-extensions/export-reso
|
|
|
326
332
|
| `onExportSuccess` | `function` | | | Callback function that is called when the export operation is successful |
|
|
327
333
|
| `onClose` | `function` | | | Callback function invoked when the modal is requested to close (on overlay click, close button click or `ESC` press). This function is also called after an export operation regardless of its success or failure |
|
|
328
334
|
| `resourceType` | `string` | ✅ | | The type of the resource, example: `category`, `product`...
|
|
329
|
-
| `filters` | `Filters` | | | Filters can be set as
|
|
335
|
+
| `filters` | `Filters` | | | Filters can be set as filters object with a `query` property or array of strings. It can also be set as a simple string for the `where` property. Lastly, another option is to set Filters as `fulltext` object with `text` and locale` string properties.
|
|
330
336
|
| `totalResourcesCount` | `number` | ✅ | | The count of all resources of identified `resourceType` |
|
|
331
337
|
| `selectedResourceIds` | `array` | | | Array of Ids of the selected resources |
|
|
332
338
|
| `fieldGroups` | `array` | ✅ | | Array of the grouped `fields` to export. |
|
|
@@ -44,6 +44,7 @@ var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-arr
|
|
|
44
44
|
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
45
45
|
var _sortInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/sort');
|
|
46
46
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
47
|
+
var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
|
|
47
48
|
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
48
49
|
var constants = require('@commercetools-frontend/constants');
|
|
49
50
|
var sdk = require('@commercetools-frontend/sdk');
|
|
@@ -87,6 +88,7 @@ var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
|
87
88
|
var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
88
89
|
var _sortInstanceProperty__default = /*#__PURE__*/_interopDefault(_sortInstanceProperty);
|
|
89
90
|
var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
|
|
91
|
+
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
|
|
90
92
|
var sortBy__default = /*#__PURE__*/_interopDefault(sortBy);
|
|
91
93
|
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
92
94
|
var throttle__default = /*#__PURE__*/_interopDefault(throttle);
|
|
@@ -262,107 +264,107 @@ var messages = reactIntl.defineMessages({
|
|
|
262
264
|
exportScopeAllCategories: {
|
|
263
265
|
id: 'ExportResourcesModal.exportScopeAllCategories',
|
|
264
266
|
description: 'Label for Export All categories',
|
|
265
|
-
defaultMessage: 'Export all: {total} categories'
|
|
267
|
+
defaultMessage: 'Export all: {total, plural, one {# category} other {# categories}}'
|
|
266
268
|
},
|
|
267
269
|
exportScopeSelectedCategories: {
|
|
268
270
|
id: 'ExportResourcesModal.exportScopeSelectedCategories',
|
|
269
271
|
description: 'Label for Export Selected categories',
|
|
270
|
-
defaultMessage: 'Export selected: {total} categories'
|
|
272
|
+
defaultMessage: 'Export selected: {total, plural, one {# category} other {# categories}}'
|
|
271
273
|
},
|
|
272
274
|
exportScopeFilteredCategories: {
|
|
273
275
|
id: 'ExportResourcesModal.exportScopeFilteredCategories',
|
|
274
276
|
description: 'Label for Export Filtered categories',
|
|
275
|
-
defaultMessage: 'Export filtered: {total} categories'
|
|
277
|
+
defaultMessage: 'Export filtered: {total, plural, one {# category} other {# categories}}'
|
|
276
278
|
},
|
|
277
279
|
exportScopeAllProducts: {
|
|
278
280
|
id: 'ExportResourcesModal.exportScopeAllProducts',
|
|
279
281
|
description: 'Label for Export All products',
|
|
280
|
-
defaultMessage: 'Export all: {total} products'
|
|
282
|
+
defaultMessage: 'Export all: {total, plural, one {# product} other {# products}}'
|
|
281
283
|
},
|
|
282
284
|
exportScopeSelectedProducts: {
|
|
283
285
|
id: 'ExportResourcesModal.exportScopeSelectedProducts',
|
|
284
286
|
description: 'Label for Export Selected products',
|
|
285
|
-
defaultMessage: 'Export selected: {total} products'
|
|
287
|
+
defaultMessage: 'Export selected: {total, plural, one {# product} other {# products}}'
|
|
286
288
|
},
|
|
287
289
|
exportScopeFilteredProducts: {
|
|
288
290
|
id: 'ExportResourcesModal.exportScopeFilteredProducts',
|
|
289
291
|
description: 'Label for Export Filtered products',
|
|
290
|
-
defaultMessage: 'Export filtered: {total} products'
|
|
292
|
+
defaultMessage: 'Export filtered: {total, plural, one {# product} other {# products}}'
|
|
291
293
|
},
|
|
292
294
|
exportScopeAllProductTypes: {
|
|
293
295
|
id: 'ExportResourcesModal.exportScopeAllProductTypes',
|
|
294
296
|
description: 'Label for Export All product types',
|
|
295
|
-
defaultMessage: 'Export all: {total} product types'
|
|
297
|
+
defaultMessage: 'Export all: {total, plural, one {# product type} other {# product types}}'
|
|
296
298
|
},
|
|
297
299
|
exportScopeSelectedProductTypes: {
|
|
298
300
|
id: 'ExportResourcesModal.exportScopeSelectedProductTypes',
|
|
299
301
|
description: 'Label for Export Selected product types',
|
|
300
|
-
defaultMessage: 'Export selected: {total} product types'
|
|
302
|
+
defaultMessage: 'Export selected: {total, plural, one {# product type} other {# product types}}'
|
|
301
303
|
},
|
|
302
304
|
exportScopeFilteredProductTypes: {
|
|
303
305
|
id: 'ExportResourcesModal.exportScopeFilteredProductTypes',
|
|
304
306
|
description: 'Label for Export Filtered product types',
|
|
305
|
-
defaultMessage: 'Export filtered: {total} product types'
|
|
307
|
+
defaultMessage: 'Export filtered: {total, plural, one {# product type} other {# product types}}'
|
|
306
308
|
},
|
|
307
309
|
exportInventoriesForAllProducts: {
|
|
308
310
|
id: 'ExportResourcesModal.exportInventoriesForAllProducts',
|
|
309
311
|
description: 'Label for Export All inventories',
|
|
310
|
-
defaultMessage: 'Export inventories for all {total} products'
|
|
312
|
+
defaultMessage: 'Export inventories for all {total, plural, one {# product} other {# products}}'
|
|
311
313
|
},
|
|
312
314
|
exportInventoriesForSelectedProducts: {
|
|
313
315
|
id: 'ExportResourcesModal.exportInventoriesForSelectedProducts',
|
|
314
316
|
description: 'Label for Export Selected inventories',
|
|
315
|
-
defaultMessage: 'Export inventories for the {total} selected products'
|
|
317
|
+
defaultMessage: 'Export inventories for the {total, plural, one {# selected product} other {# selected products}}'
|
|
316
318
|
},
|
|
317
319
|
exportInventoriesForFilteredProducts: {
|
|
318
320
|
id: 'ExportResourcesModal.exportInventoriesForFilteredProducts',
|
|
319
321
|
description: 'Label for Export Filtered inventories',
|
|
320
|
-
defaultMessage: 'Export inventories for the {total} filtered products'
|
|
322
|
+
defaultMessage: 'Export inventories for the {total, plural, one {# filtered product} other {# filtered products}}'
|
|
321
323
|
},
|
|
322
324
|
exportScopeAllDiscountCodes: {
|
|
323
325
|
id: 'ExportResourcesModal.exportScopeAllDiscountCodes',
|
|
324
326
|
description: 'Label for Export All discount codes',
|
|
325
|
-
defaultMessage: 'Export all: {total} discount codes'
|
|
327
|
+
defaultMessage: 'Export all: {total, plural, one {# discount code} other {# discount codes}}'
|
|
326
328
|
},
|
|
327
329
|
exportScopeSelectedDiscountCodes: {
|
|
328
330
|
id: 'ExportResourcesModal.exportScopeSelectedDiscountCodes',
|
|
329
331
|
description: 'Label for Export Selected discount codes',
|
|
330
|
-
defaultMessage: 'Export selected: {total} discount codes'
|
|
332
|
+
defaultMessage: 'Export selected: {total, plural, one {# discount code} other {# discount codes}}'
|
|
331
333
|
},
|
|
332
334
|
exportScopeFilteredDiscountCodes: {
|
|
333
335
|
id: 'ExportResourcesModal.exportScopeFilteredDiscountCodes',
|
|
334
336
|
description: 'Label for Export Filtered discount codes',
|
|
335
|
-
defaultMessage: 'Export filtered: {total} discount codes'
|
|
337
|
+
defaultMessage: 'Export filtered: {total, plural, one {# discount code} other {# discount codes}}'
|
|
336
338
|
},
|
|
337
339
|
exportScopeAllOrders: {
|
|
338
340
|
id: 'ExportResourcesModal.exportScopeAllOrders',
|
|
339
341
|
description: 'Label for Export All orders',
|
|
340
|
-
defaultMessage: 'Export all: {total} orders'
|
|
342
|
+
defaultMessage: 'Export all: {total, plural, one {# order} other {# orders}}'
|
|
341
343
|
},
|
|
342
344
|
exportScopeSelectedOrders: {
|
|
343
345
|
id: 'ExportResourcesModal.exportScopeSelectedOrders',
|
|
344
346
|
description: 'Label for Export Selected orders',
|
|
345
|
-
defaultMessage: 'Export selected: {total} orders'
|
|
347
|
+
defaultMessage: 'Export selected: {total, plural, one {# order} other {# orders}}'
|
|
346
348
|
},
|
|
347
349
|
exportScopeFilteredOrders: {
|
|
348
350
|
id: 'ExportResourcesModal.exportScopeFilteredOrders',
|
|
349
351
|
description: 'Label for Export Filtered orders',
|
|
350
|
-
defaultMessage: 'Export filtered: {total} orders'
|
|
352
|
+
defaultMessage: 'Export filtered: {total, plural, one {# order} other {# orders}}'
|
|
351
353
|
},
|
|
352
354
|
exportScopeAllCustomers: {
|
|
353
355
|
id: 'ExportResourcesModal.exportScopeAllCustomers',
|
|
354
356
|
description: 'Label for Export All customers',
|
|
355
|
-
defaultMessage: 'Export all: {total} customers'
|
|
357
|
+
defaultMessage: 'Export all: {total, plural, one {# customer} other {# customers}}'
|
|
356
358
|
},
|
|
357
359
|
exportScopeSelectedCustomers: {
|
|
358
360
|
id: 'ExportResourcesModal.exportScopeSelectedCustomers',
|
|
359
361
|
description: 'Label for Export Selected customers',
|
|
360
|
-
defaultMessage: 'Export selected: {total} customers'
|
|
362
|
+
defaultMessage: 'Export selected: {total, plural, one {# customer} other {# customers}}'
|
|
361
363
|
},
|
|
362
364
|
exportScopeFilteredCustomers: {
|
|
363
365
|
id: 'ExportResourcesModal.exportScopeFilteredCustomers',
|
|
364
366
|
description: 'Label for Export Filtered customers',
|
|
365
|
-
defaultMessage: 'Export filtered: {total} customers'
|
|
367
|
+
defaultMessage: 'Export filtered: {total, plural, one {# customer} other {# customers}}'
|
|
366
368
|
},
|
|
367
369
|
exportScopeSelectedWithoutCount: {
|
|
368
370
|
id: 'ExportResourcesModal.exportScopeSelectedWithoutCount',
|
|
@@ -652,6 +654,12 @@ const getTotalCheckedFields = group => {
|
|
|
652
654
|
return countCheckedFields(group.fields);
|
|
653
655
|
};
|
|
654
656
|
|
|
657
|
+
let Step = /*#__PURE__*/function (Step) {
|
|
658
|
+
Step["FileSettings"] = "file-settings";
|
|
659
|
+
Step["FieldsSelection"] = "fields-selection";
|
|
660
|
+
return Step;
|
|
661
|
+
}({});
|
|
662
|
+
|
|
655
663
|
function validate(_ref) {
|
|
656
664
|
let values = _valuesInstanceProperty__default["default"](_ref),
|
|
657
665
|
step = _ref.step;
|
|
@@ -671,7 +679,7 @@ function validate(_ref) {
|
|
|
671
679
|
if (locales.length < 1) {
|
|
672
680
|
errors.locales.missing = true;
|
|
673
681
|
}
|
|
674
|
-
if (step ===
|
|
682
|
+
if (step === Step.FieldsSelection) {
|
|
675
683
|
const allFields = _reduceInstanceProperty__default["default"](groups).call(groups, (acc, group) => _concatInstanceProperty__default["default"](acc).call(acc, group.fields), []);
|
|
676
684
|
const checkedFieldsCount = _filterInstanceProperty__default["default"](allFields).call(allFields, field => {
|
|
677
685
|
if (field.fields) return isAnyFieldChecked(field.fields);
|
|
@@ -769,21 +777,45 @@ function buildSelectedExportFilters(selectedResourceIds) {
|
|
|
769
777
|
const formattedIds = _mapInstanceProperty__default["default"](selectedResourceIds).call(selectedResourceIds, id => `"${id}"`).join(', ');
|
|
770
778
|
return `id in (${formattedIds})`;
|
|
771
779
|
}
|
|
772
|
-
function
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
const validFilterState = hasQueryPredicate && !hasSearchQuery || !hasQueryPredicate && hasSearchQuery;
|
|
778
|
-
return validFilterState;
|
|
780
|
+
function isQueryFilter(filters) {
|
|
781
|
+
return filters?.query !== undefined;
|
|
782
|
+
}
|
|
783
|
+
function isSearchFilter(filters) {
|
|
784
|
+
return filters?.filters?.length || filters?.fullText !== undefined;
|
|
779
785
|
}
|
|
780
|
-
function
|
|
781
|
-
|
|
786
|
+
function validateFilters(filtersObject) {
|
|
787
|
+
var _context2;
|
|
788
|
+
if (filtersObject.where && filtersObject.filters) {
|
|
782
789
|
return false;
|
|
783
790
|
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
791
|
+
if (isQueryFilter(filtersObject.filters)) {
|
|
792
|
+
return Boolean(filtersObject.filters?.query);
|
|
793
|
+
}
|
|
794
|
+
if (isSearchFilter(filtersObject.filters)) {
|
|
795
|
+
const searchFilters = filtersObject.filters;
|
|
796
|
+
return Boolean(searchFilters.filters?.length || searchFilters.fullText?.text?.trim());
|
|
797
|
+
}
|
|
798
|
+
if (filtersObject.where && _trimInstanceProperty__default["default"](_context2 = filtersObject.where).call(_context2) !== '') {
|
|
799
|
+
return true;
|
|
800
|
+
}
|
|
801
|
+
return false;
|
|
802
|
+
}
|
|
803
|
+
function areFiltersApplied(filtersObject) {
|
|
804
|
+
var _context3;
|
|
805
|
+
if (!filtersObject) {
|
|
806
|
+
return false;
|
|
807
|
+
}
|
|
808
|
+
if (filtersObject.where && _trimInstanceProperty__default["default"](_context3 = filtersObject.where).call(_context3) !== '') {
|
|
809
|
+
return true;
|
|
810
|
+
}
|
|
811
|
+
if (filtersObject.filters && 'query' in filtersObject.filters) {
|
|
812
|
+
return Boolean(filtersObject.filters.query);
|
|
813
|
+
}
|
|
814
|
+
if (filtersObject.filters && ('filters' in filtersObject.filters || 'fullText' in filtersObject.filters)) {
|
|
815
|
+
const _filters = filtersObject.filters;
|
|
816
|
+
return Boolean(_filters.filters?.length || _filters.fullText?.text?.trim());
|
|
817
|
+
}
|
|
818
|
+
return false;
|
|
787
819
|
}
|
|
788
820
|
function getInitialExportType(args) {
|
|
789
821
|
if (args.selectedResourceIds?.length) {
|
|
@@ -985,7 +1017,7 @@ async function createExportOperation(_ref, asyncDispatchFn) {
|
|
|
985
1017
|
fillRows,
|
|
986
1018
|
// Query predicate
|
|
987
1019
|
where,
|
|
988
|
-
// Search API filters
|
|
1020
|
+
// Search API filters or Category API filters
|
|
989
1021
|
filters
|
|
990
1022
|
}
|
|
991
1023
|
}));
|
|
@@ -1031,14 +1063,15 @@ const useStartExportOperation = props => {
|
|
|
1031
1063
|
let filters = undefined;
|
|
1032
1064
|
if (exportType === EXPORT_TYPES.SELECTED && props.selectedResourceIds?.length) {
|
|
1033
1065
|
where = buildSelectedExportFilters(props.selectedResourceIds);
|
|
1034
|
-
} else if (exportType === EXPORT_TYPES.FILTERED) {
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
if (props.filters?.searchQuery) {
|
|
1066
|
+
} else if (exportType === EXPORT_TYPES.FILTERED && props.filters) {
|
|
1067
|
+
where = props.filters.where;
|
|
1068
|
+
if (isQueryFilter(props.filters.filters)) {
|
|
1069
|
+
const _filters = props.filters.filters;
|
|
1039
1070
|
filters = {
|
|
1040
|
-
query:
|
|
1071
|
+
query: _filters.query
|
|
1041
1072
|
};
|
|
1073
|
+
} else if (isSearchFilter(props.filters.filters)) {
|
|
1074
|
+
filters = props.filters.filters;
|
|
1042
1075
|
}
|
|
1043
1076
|
}
|
|
1044
1077
|
const response = await createExportOperation({
|
|
@@ -1767,7 +1800,7 @@ const StyledGridCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, proc
|
|
|
1767
1800
|
} : {
|
|
1768
1801
|
target: "e5mvpn60",
|
|
1769
1802
|
label: "StyledGridCard"
|
|
1770
|
-
})("max-height:calc(100vh - ", totalSpacing, "px);overflow:auto;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
1803
|
+
})("max-height:calc(100vh - ", totalSpacing, "px);overflow:auto;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImV4cG9ydC1maWVsZHMtc2VsZWN0aW9uLXN0ZXAudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTBDbUMiLCJmaWxlIjoiZXhwb3J0LWZpZWxkcy1zZWxlY3Rpb24tc3RlcC50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgUmVhY3QgZnJvbSAncmVhY3QnXG5pbXBvcnQgeyB1c2VJbnRsIH0gZnJvbSAncmVhY3QtaW50bCdcbmltcG9ydCB7IEZvcm1EaWFsb2cgfSBmcm9tICdAY29tbWVyY2V0b29scy1mcm9udGVuZC9hcHBsaWNhdGlvbi1jb21wb25lbnRzJ1xuaW1wb3J0IHsgdXNlQXBwbGljYXRpb25Db250ZXh0IH0gZnJvbSAnQGNvbW1lcmNldG9vbHMtZnJvbnRlbmQvYXBwbGljYXRpb24tc2hlbGwtY29ubmVjdG9ycydcbmltcG9ydCB7IHVzZVN0b3JhZ2UgfSBmcm9tIC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J0RmllbGRTZWxlY3Rpb25Qcm92aWRlciByZXNvdXJjZVR5cGU9e3Jlc291cmNlVHlwZX0+XG4gICAgICAgICAgPFNwYWNpbmdzLlN0YWNrIHNjYWxlPVwibVwiPlxuICAgICAgICAgICAgPFNlYXJjaFRleHRJbnB1dFxuICAgICAgICAgICAgICBwbGFjZWhvbGRlcj17aW50bC5mb3JtYXRNZXNzYWdlKG1lc3NhZ2VzLnNlYXJjaEZvckZpZWxkcyl9XG4gICAgICAgICAgICAgIHZhbHVlPXtmaWVsZFNlYXJjaFRlcm19XG4gICAgICAgICAgICAgIG9uQ2hhbmdlPXtvblNlYXJjaENoYW5nZVRocm90dGxlZH1cbiAgICAgICAgICAgICAgb25SZXNldD17b25TZWFyY2hSZXNldH1cbiAgICAgICAgICAgICAgLy8gVE9ETzogYFNlYXJjaFRleHRJbnB1dGAgcHJvcHMgdG8gYmUgaW1wcm92ZWQuIFRoZSBgb25TdWJtaXRgIGNhbGxiYWNrIHNob3VsZG4ndCBiZSBtYW5kYXRvcnlcbiAgICAgICAgICAgICAgb25TdWJtaXQ9eygpID0+IHt9fVxuICAgICAgICAgICAgICBpZD1cImV4cG9ydC1maWVsZHMtc2VhcmNoXCJcbiAgICAgICAgICAgIC8+XG4gICAgICAgICAgICB7aGFzUmVzdWx0cyA/IChcbiAgICAgICAgICAgICAgPFN0eWxlZEdyaWRDYXJkIGluc2V0U2NhbGU9XCJub25lXCI+XG4gICAgICAgICAgICAgICAgPEdyaWRcbiAgICAgICAgICAgICAgICAgIGdyaWRBdXRvRmxvdz1cInJvd1wiXG4gICAgICAgICAgICAgICAgICBncmlkVGVtcGxhdGVDb2x1bW5zPXtgY2FsYygke2Rlc2lnblRva2Vucy5zcGFjaW5nTH0gKyAke2Rlc2lnblRva2Vucy5jb25zdHJhaW50NX0gKyAke2Rlc2lnblRva2Vucy5zcGFjaW5nTH0pIGF1dG9gfVxuICAgICAgICAgICAgICAgID5cbiAgICAgICAgICAgICAgICAgIHtmaWx0ZXJlZEdyb3Vwcy5tYXAoKGdyb3VwLCBpbmRleCkgPT4gKFxuICAgICAgICAgICAgICAgICAgICA8RmllbGRHcm91cFNlY3Rpb25cbiAgICAgICAgICAgICAgICAgICAgICBrZXk9e2dyb3VwLmdyb3VwTmFtZX1cbiAgICAgICAgICAgICAgICAgICAgICBncm91cD17Z3JvdXB9XG4gICAgICAgICAgICAgICAgICAgICAgaW5kZXg9e2luZGV4fVxuICAgICAgICAgICAgICAgICAgICAgIGZvcm1paz17Zm9ybWlrfVxuICAgICAgICAgICAgICAgICAgICAgIGlzRm9yY2VFeHBhbmRlZD17ZmllbGRTZWFyY2hUZXJtPy50cmltKCk/Lmxlbmd0aCA+IDB9XG4gICAgICAgICAgICAgICAgICAgIC8+XG4gICAgICAgICAgICAgICAgICApKX1cbiAgICAgICAgICAgICAgICA8L0dyaWQ+XG4gICAgICAgICAgICAgIDwvU3R5bGVkR3JpZENhcmQ+XG4gICAgICAgICAgICApIDogKFxuICAgICAgICAgICAgICA8Tm9TZWFyY2hSZXN1bHRzIC8+XG4gICAgICAgICAgICApfVxuICAgICAgICAgIDwvU3BhY2luZ3MuU3RhY2s+XG4gICAgICAgIDwvRXhwb3J0RmllbGRTZWxlY3Rpb25Qcm92aWRlcj5cbiAgICAgIDwvRnVsbFN0b3J5TWFza2luZy5Vbm1hc2s+XG4gICAgPC9Gb3JtRGlhbG9nPlxuICApXG59XG4iXX0= */"));
|
|
1771
1804
|
const ExportFieldsSelectionStep = () => {
|
|
1772
1805
|
const intl = reactIntl.useIntl();
|
|
1773
1806
|
const _React$useState = React__default["default"].useState(''),
|
|
@@ -1858,7 +1891,7 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1858
1891
|
onPrimaryButtonClick: formik.submitForm,
|
|
1859
1892
|
isPrimaryButtonDisabled: !formik.isValid,
|
|
1860
1893
|
labelSecondary: intl.formatMessage(messages.back),
|
|
1861
|
-
onSecondaryButtonClick: () => setCurrentStep(
|
|
1894
|
+
onSecondaryButtonClick: () => setCurrentStep(Step.FileSettings),
|
|
1862
1895
|
onClose: onClose,
|
|
1863
1896
|
size: 16,
|
|
1864
1897
|
children: jsxRuntime.jsx(fullstory.Masking.Unmask, {
|
|
@@ -1901,7 +1934,7 @@ const ExportResourcesProvider = _ref => {
|
|
|
1901
1934
|
let children = _ref.children,
|
|
1902
1935
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
1903
1936
|
const initialValues = useInitialValues(props);
|
|
1904
|
-
const _React$useState = React__default["default"].useState(
|
|
1937
|
+
const _React$useState = React__default["default"].useState(Step.FileSettings),
|
|
1905
1938
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1906
1939
|
currentStep = _React$useState2[0],
|
|
1907
1940
|
setCurrentStep = _React$useState2[1];
|
|
@@ -1915,8 +1948,8 @@ const ExportResourcesProvider = _ref => {
|
|
|
1915
1948
|
const _useStartExportOperat = useStartExportOperation(props),
|
|
1916
1949
|
startExportOperation = _useStartExportOperat.startExportOperation;
|
|
1917
1950
|
const onSubmit = async values => {
|
|
1918
|
-
if (currentStep ===
|
|
1919
|
-
setCurrentStep(
|
|
1951
|
+
if (currentStep === Step.FileSettings) {
|
|
1952
|
+
setCurrentStep(Step.FieldsSelection);
|
|
1920
1953
|
} else {
|
|
1921
1954
|
startExportOperation(values, exportType);
|
|
1922
1955
|
}
|
|
@@ -1955,8 +1988,8 @@ const CurrentStep = () => {
|
|
|
1955
1988
|
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
1956
1989
|
currentStep = _useExportResourcesMo.currentStep;
|
|
1957
1990
|
const steps = {
|
|
1958
|
-
|
|
1959
|
-
|
|
1991
|
+
'file-settings': jsxRuntime.jsx(ExportFileSettingsStep, {}),
|
|
1992
|
+
'fields-selection': jsxRuntime.jsx(ExportFieldsSelectionStep, {})
|
|
1960
1993
|
};
|
|
1961
1994
|
return steps[currentStep] || null;
|
|
1962
1995
|
};
|
|
@@ -2056,7 +2089,7 @@ const ExportResourcesModal = props => {
|
|
|
2056
2089
|
const messages = useAsyncIntlMessages(locale, loadMessages);
|
|
2057
2090
|
if (!props.isOpen || messages.isLoading) return null;
|
|
2058
2091
|
if (props.filters && !validateFilters(props.filters)) {
|
|
2059
|
-
console.error('Invalid filters prop:', props.filters, 'Filters must contain
|
|
2092
|
+
console.error('Invalid filters prop:', props.filters, 'Filters must contain one of these values: `filters` or `where`');
|
|
2060
2093
|
return null;
|
|
2061
2094
|
}
|
|
2062
2095
|
return jsxRuntime.jsx(reactIntl.IntlProvider, {
|
|
@@ -2078,5 +2111,6 @@ ExportResourcesModal.defaultProps = {
|
|
|
2078
2111
|
|
|
2079
2112
|
exports.EXPORTABLE_RESOURCES = EXPORTABLE_RESOURCES;
|
|
2080
2113
|
exports.EXPORT_TYPES = EXPORT_TYPES;
|
|
2114
|
+
exports.Step = Step;
|
|
2081
2115
|
exports["default"] = ExportResourcesModal;
|
|
2082
2116
|
exports.useConvertFieldDefinitionsForExport = useConvertFieldDefinitionsForExport;
|
|
@@ -44,6 +44,7 @@ var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-arr
|
|
|
44
44
|
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
45
45
|
var _sortInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/sort');
|
|
46
46
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
47
|
+
var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
|
|
47
48
|
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
48
49
|
var constants = require('@commercetools-frontend/constants');
|
|
49
50
|
var sdk = require('@commercetools-frontend/sdk');
|
|
@@ -87,6 +88,7 @@ var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
|
87
88
|
var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
88
89
|
var _sortInstanceProperty__default = /*#__PURE__*/_interopDefault(_sortInstanceProperty);
|
|
89
90
|
var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
|
|
91
|
+
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
|
|
90
92
|
var sortBy__default = /*#__PURE__*/_interopDefault(sortBy);
|
|
91
93
|
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
92
94
|
var throttle__default = /*#__PURE__*/_interopDefault(throttle);
|
|
@@ -262,107 +264,107 @@ var messages = reactIntl.defineMessages({
|
|
|
262
264
|
exportScopeAllCategories: {
|
|
263
265
|
id: 'ExportResourcesModal.exportScopeAllCategories',
|
|
264
266
|
description: 'Label for Export All categories',
|
|
265
|
-
defaultMessage: 'Export all: {total} categories'
|
|
267
|
+
defaultMessage: 'Export all: {total, plural, one {# category} other {# categories}}'
|
|
266
268
|
},
|
|
267
269
|
exportScopeSelectedCategories: {
|
|
268
270
|
id: 'ExportResourcesModal.exportScopeSelectedCategories',
|
|
269
271
|
description: 'Label for Export Selected categories',
|
|
270
|
-
defaultMessage: 'Export selected: {total} categories'
|
|
272
|
+
defaultMessage: 'Export selected: {total, plural, one {# category} other {# categories}}'
|
|
271
273
|
},
|
|
272
274
|
exportScopeFilteredCategories: {
|
|
273
275
|
id: 'ExportResourcesModal.exportScopeFilteredCategories',
|
|
274
276
|
description: 'Label for Export Filtered categories',
|
|
275
|
-
defaultMessage: 'Export filtered: {total} categories'
|
|
277
|
+
defaultMessage: 'Export filtered: {total, plural, one {# category} other {# categories}}'
|
|
276
278
|
},
|
|
277
279
|
exportScopeAllProducts: {
|
|
278
280
|
id: 'ExportResourcesModal.exportScopeAllProducts',
|
|
279
281
|
description: 'Label for Export All products',
|
|
280
|
-
defaultMessage: 'Export all: {total} products'
|
|
282
|
+
defaultMessage: 'Export all: {total, plural, one {# product} other {# products}}'
|
|
281
283
|
},
|
|
282
284
|
exportScopeSelectedProducts: {
|
|
283
285
|
id: 'ExportResourcesModal.exportScopeSelectedProducts',
|
|
284
286
|
description: 'Label for Export Selected products',
|
|
285
|
-
defaultMessage: 'Export selected: {total} products'
|
|
287
|
+
defaultMessage: 'Export selected: {total, plural, one {# product} other {# products}}'
|
|
286
288
|
},
|
|
287
289
|
exportScopeFilteredProducts: {
|
|
288
290
|
id: 'ExportResourcesModal.exportScopeFilteredProducts',
|
|
289
291
|
description: 'Label for Export Filtered products',
|
|
290
|
-
defaultMessage: 'Export filtered: {total} products'
|
|
292
|
+
defaultMessage: 'Export filtered: {total, plural, one {# product} other {# products}}'
|
|
291
293
|
},
|
|
292
294
|
exportScopeAllProductTypes: {
|
|
293
295
|
id: 'ExportResourcesModal.exportScopeAllProductTypes',
|
|
294
296
|
description: 'Label for Export All product types',
|
|
295
|
-
defaultMessage: 'Export all: {total} product types'
|
|
297
|
+
defaultMessage: 'Export all: {total, plural, one {# product type} other {# product types}}'
|
|
296
298
|
},
|
|
297
299
|
exportScopeSelectedProductTypes: {
|
|
298
300
|
id: 'ExportResourcesModal.exportScopeSelectedProductTypes',
|
|
299
301
|
description: 'Label for Export Selected product types',
|
|
300
|
-
defaultMessage: 'Export selected: {total} product types'
|
|
302
|
+
defaultMessage: 'Export selected: {total, plural, one {# product type} other {# product types}}'
|
|
301
303
|
},
|
|
302
304
|
exportScopeFilteredProductTypes: {
|
|
303
305
|
id: 'ExportResourcesModal.exportScopeFilteredProductTypes',
|
|
304
306
|
description: 'Label for Export Filtered product types',
|
|
305
|
-
defaultMessage: 'Export filtered: {total} product types'
|
|
307
|
+
defaultMessage: 'Export filtered: {total, plural, one {# product type} other {# product types}}'
|
|
306
308
|
},
|
|
307
309
|
exportInventoriesForAllProducts: {
|
|
308
310
|
id: 'ExportResourcesModal.exportInventoriesForAllProducts',
|
|
309
311
|
description: 'Label for Export All inventories',
|
|
310
|
-
defaultMessage: 'Export inventories for all {total} products'
|
|
312
|
+
defaultMessage: 'Export inventories for all {total, plural, one {# product} other {# products}}'
|
|
311
313
|
},
|
|
312
314
|
exportInventoriesForSelectedProducts: {
|
|
313
315
|
id: 'ExportResourcesModal.exportInventoriesForSelectedProducts',
|
|
314
316
|
description: 'Label for Export Selected inventories',
|
|
315
|
-
defaultMessage: 'Export inventories for the {total} selected products'
|
|
317
|
+
defaultMessage: 'Export inventories for the {total, plural, one {# selected product} other {# selected products}}'
|
|
316
318
|
},
|
|
317
319
|
exportInventoriesForFilteredProducts: {
|
|
318
320
|
id: 'ExportResourcesModal.exportInventoriesForFilteredProducts',
|
|
319
321
|
description: 'Label for Export Filtered inventories',
|
|
320
|
-
defaultMessage: 'Export inventories for the {total} filtered products'
|
|
322
|
+
defaultMessage: 'Export inventories for the {total, plural, one {# filtered product} other {# filtered products}}'
|
|
321
323
|
},
|
|
322
324
|
exportScopeAllDiscountCodes: {
|
|
323
325
|
id: 'ExportResourcesModal.exportScopeAllDiscountCodes',
|
|
324
326
|
description: 'Label for Export All discount codes',
|
|
325
|
-
defaultMessage: 'Export all: {total} discount codes'
|
|
327
|
+
defaultMessage: 'Export all: {total, plural, one {# discount code} other {# discount codes}}'
|
|
326
328
|
},
|
|
327
329
|
exportScopeSelectedDiscountCodes: {
|
|
328
330
|
id: 'ExportResourcesModal.exportScopeSelectedDiscountCodes',
|
|
329
331
|
description: 'Label for Export Selected discount codes',
|
|
330
|
-
defaultMessage: 'Export selected: {total} discount codes'
|
|
332
|
+
defaultMessage: 'Export selected: {total, plural, one {# discount code} other {# discount codes}}'
|
|
331
333
|
},
|
|
332
334
|
exportScopeFilteredDiscountCodes: {
|
|
333
335
|
id: 'ExportResourcesModal.exportScopeFilteredDiscountCodes',
|
|
334
336
|
description: 'Label for Export Filtered discount codes',
|
|
335
|
-
defaultMessage: 'Export filtered: {total} discount codes'
|
|
337
|
+
defaultMessage: 'Export filtered: {total, plural, one {# discount code} other {# discount codes}}'
|
|
336
338
|
},
|
|
337
339
|
exportScopeAllOrders: {
|
|
338
340
|
id: 'ExportResourcesModal.exportScopeAllOrders',
|
|
339
341
|
description: 'Label for Export All orders',
|
|
340
|
-
defaultMessage: 'Export all: {total} orders'
|
|
342
|
+
defaultMessage: 'Export all: {total, plural, one {# order} other {# orders}}'
|
|
341
343
|
},
|
|
342
344
|
exportScopeSelectedOrders: {
|
|
343
345
|
id: 'ExportResourcesModal.exportScopeSelectedOrders',
|
|
344
346
|
description: 'Label for Export Selected orders',
|
|
345
|
-
defaultMessage: 'Export selected: {total} orders'
|
|
347
|
+
defaultMessage: 'Export selected: {total, plural, one {# order} other {# orders}}'
|
|
346
348
|
},
|
|
347
349
|
exportScopeFilteredOrders: {
|
|
348
350
|
id: 'ExportResourcesModal.exportScopeFilteredOrders',
|
|
349
351
|
description: 'Label for Export Filtered orders',
|
|
350
|
-
defaultMessage: 'Export filtered: {total} orders'
|
|
352
|
+
defaultMessage: 'Export filtered: {total, plural, one {# order} other {# orders}}'
|
|
351
353
|
},
|
|
352
354
|
exportScopeAllCustomers: {
|
|
353
355
|
id: 'ExportResourcesModal.exportScopeAllCustomers',
|
|
354
356
|
description: 'Label for Export All customers',
|
|
355
|
-
defaultMessage: 'Export all: {total} customers'
|
|
357
|
+
defaultMessage: 'Export all: {total, plural, one {# customer} other {# customers}}'
|
|
356
358
|
},
|
|
357
359
|
exportScopeSelectedCustomers: {
|
|
358
360
|
id: 'ExportResourcesModal.exportScopeSelectedCustomers',
|
|
359
361
|
description: 'Label for Export Selected customers',
|
|
360
|
-
defaultMessage: 'Export selected: {total} customers'
|
|
362
|
+
defaultMessage: 'Export selected: {total, plural, one {# customer} other {# customers}}'
|
|
361
363
|
},
|
|
362
364
|
exportScopeFilteredCustomers: {
|
|
363
365
|
id: 'ExportResourcesModal.exportScopeFilteredCustomers',
|
|
364
366
|
description: 'Label for Export Filtered customers',
|
|
365
|
-
defaultMessage: 'Export filtered: {total} customers'
|
|
367
|
+
defaultMessage: 'Export filtered: {total, plural, one {# customer} other {# customers}}'
|
|
366
368
|
},
|
|
367
369
|
exportScopeSelectedWithoutCount: {
|
|
368
370
|
id: 'ExportResourcesModal.exportScopeSelectedWithoutCount',
|
|
@@ -652,6 +654,12 @@ const getTotalCheckedFields = group => {
|
|
|
652
654
|
return countCheckedFields(group.fields);
|
|
653
655
|
};
|
|
654
656
|
|
|
657
|
+
let Step = /*#__PURE__*/function (Step) {
|
|
658
|
+
Step["FileSettings"] = "file-settings";
|
|
659
|
+
Step["FieldsSelection"] = "fields-selection";
|
|
660
|
+
return Step;
|
|
661
|
+
}({});
|
|
662
|
+
|
|
655
663
|
function validate(_ref) {
|
|
656
664
|
let values = _valuesInstanceProperty__default["default"](_ref),
|
|
657
665
|
step = _ref.step;
|
|
@@ -671,7 +679,7 @@ function validate(_ref) {
|
|
|
671
679
|
if (locales.length < 1) {
|
|
672
680
|
errors.locales.missing = true;
|
|
673
681
|
}
|
|
674
|
-
if (step ===
|
|
682
|
+
if (step === Step.FieldsSelection) {
|
|
675
683
|
const allFields = _reduceInstanceProperty__default["default"](groups).call(groups, (acc, group) => _concatInstanceProperty__default["default"](acc).call(acc, group.fields), []);
|
|
676
684
|
const checkedFieldsCount = _filterInstanceProperty__default["default"](allFields).call(allFields, field => {
|
|
677
685
|
if (field.fields) return isAnyFieldChecked(field.fields);
|
|
@@ -769,21 +777,45 @@ function buildSelectedExportFilters(selectedResourceIds) {
|
|
|
769
777
|
const formattedIds = _mapInstanceProperty__default["default"](selectedResourceIds).call(selectedResourceIds, id => `"${id}"`).join(', ');
|
|
770
778
|
return `id in (${formattedIds})`;
|
|
771
779
|
}
|
|
772
|
-
function
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
const validFilterState = hasQueryPredicate && !hasSearchQuery || !hasQueryPredicate && hasSearchQuery;
|
|
778
|
-
return validFilterState;
|
|
780
|
+
function isQueryFilter(filters) {
|
|
781
|
+
return filters?.query !== undefined;
|
|
782
|
+
}
|
|
783
|
+
function isSearchFilter(filters) {
|
|
784
|
+
return filters?.filters?.length || filters?.fullText !== undefined;
|
|
779
785
|
}
|
|
780
|
-
function
|
|
781
|
-
|
|
786
|
+
function validateFilters(filtersObject) {
|
|
787
|
+
var _context2;
|
|
788
|
+
if (filtersObject.where && filtersObject.filters) {
|
|
782
789
|
return false;
|
|
783
790
|
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
791
|
+
if (isQueryFilter(filtersObject.filters)) {
|
|
792
|
+
return Boolean(filtersObject.filters?.query);
|
|
793
|
+
}
|
|
794
|
+
if (isSearchFilter(filtersObject.filters)) {
|
|
795
|
+
const searchFilters = filtersObject.filters;
|
|
796
|
+
return Boolean(searchFilters.filters?.length || searchFilters.fullText?.text?.trim());
|
|
797
|
+
}
|
|
798
|
+
if (filtersObject.where && _trimInstanceProperty__default["default"](_context2 = filtersObject.where).call(_context2) !== '') {
|
|
799
|
+
return true;
|
|
800
|
+
}
|
|
801
|
+
return false;
|
|
802
|
+
}
|
|
803
|
+
function areFiltersApplied(filtersObject) {
|
|
804
|
+
var _context3;
|
|
805
|
+
if (!filtersObject) {
|
|
806
|
+
return false;
|
|
807
|
+
}
|
|
808
|
+
if (filtersObject.where && _trimInstanceProperty__default["default"](_context3 = filtersObject.where).call(_context3) !== '') {
|
|
809
|
+
return true;
|
|
810
|
+
}
|
|
811
|
+
if (filtersObject.filters && 'query' in filtersObject.filters) {
|
|
812
|
+
return Boolean(filtersObject.filters.query);
|
|
813
|
+
}
|
|
814
|
+
if (filtersObject.filters && ('filters' in filtersObject.filters || 'fullText' in filtersObject.filters)) {
|
|
815
|
+
const _filters = filtersObject.filters;
|
|
816
|
+
return Boolean(_filters.filters?.length || _filters.fullText?.text?.trim());
|
|
817
|
+
}
|
|
818
|
+
return false;
|
|
787
819
|
}
|
|
788
820
|
function getInitialExportType(args) {
|
|
789
821
|
if (args.selectedResourceIds?.length) {
|
|
@@ -985,7 +1017,7 @@ async function createExportOperation(_ref, asyncDispatchFn) {
|
|
|
985
1017
|
fillRows,
|
|
986
1018
|
// Query predicate
|
|
987
1019
|
where,
|
|
988
|
-
// Search API filters
|
|
1020
|
+
// Search API filters or Category API filters
|
|
989
1021
|
filters
|
|
990
1022
|
}
|
|
991
1023
|
}));
|
|
@@ -1031,14 +1063,15 @@ const useStartExportOperation = props => {
|
|
|
1031
1063
|
let filters = undefined;
|
|
1032
1064
|
if (exportType === EXPORT_TYPES.SELECTED && props.selectedResourceIds?.length) {
|
|
1033
1065
|
where = buildSelectedExportFilters(props.selectedResourceIds);
|
|
1034
|
-
} else if (exportType === EXPORT_TYPES.FILTERED) {
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
if (props.filters?.searchQuery) {
|
|
1066
|
+
} else if (exportType === EXPORT_TYPES.FILTERED && props.filters) {
|
|
1067
|
+
where = props.filters.where;
|
|
1068
|
+
if (isQueryFilter(props.filters.filters)) {
|
|
1069
|
+
const _filters = props.filters.filters;
|
|
1039
1070
|
filters = {
|
|
1040
|
-
query:
|
|
1071
|
+
query: _filters.query
|
|
1041
1072
|
};
|
|
1073
|
+
} else if (isSearchFilter(props.filters.filters)) {
|
|
1074
|
+
filters = props.filters.filters;
|
|
1042
1075
|
}
|
|
1043
1076
|
}
|
|
1044
1077
|
const response = await createExportOperation({
|
|
@@ -1825,7 +1858,7 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1825
1858
|
onPrimaryButtonClick: formik.submitForm,
|
|
1826
1859
|
isPrimaryButtonDisabled: !formik.isValid,
|
|
1827
1860
|
labelSecondary: intl.formatMessage(messages.back),
|
|
1828
|
-
onSecondaryButtonClick: () => setCurrentStep(
|
|
1861
|
+
onSecondaryButtonClick: () => setCurrentStep(Step.FileSettings),
|
|
1829
1862
|
onClose: onClose,
|
|
1830
1863
|
size: 16,
|
|
1831
1864
|
children: jsxRuntime.jsx(fullstory.Masking.Unmask, {
|
|
@@ -1868,7 +1901,7 @@ const ExportResourcesProvider = _ref => {
|
|
|
1868
1901
|
let children = _ref.children,
|
|
1869
1902
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
1870
1903
|
const initialValues = useInitialValues(props);
|
|
1871
|
-
const _React$useState = React__default["default"].useState(
|
|
1904
|
+
const _React$useState = React__default["default"].useState(Step.FileSettings),
|
|
1872
1905
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1873
1906
|
currentStep = _React$useState2[0],
|
|
1874
1907
|
setCurrentStep = _React$useState2[1];
|
|
@@ -1882,8 +1915,8 @@ const ExportResourcesProvider = _ref => {
|
|
|
1882
1915
|
const _useStartExportOperat = useStartExportOperation(props),
|
|
1883
1916
|
startExportOperation = _useStartExportOperat.startExportOperation;
|
|
1884
1917
|
const onSubmit = async values => {
|
|
1885
|
-
if (currentStep ===
|
|
1886
|
-
setCurrentStep(
|
|
1918
|
+
if (currentStep === Step.FileSettings) {
|
|
1919
|
+
setCurrentStep(Step.FieldsSelection);
|
|
1887
1920
|
} else {
|
|
1888
1921
|
startExportOperation(values, exportType);
|
|
1889
1922
|
}
|
|
@@ -1922,8 +1955,8 @@ const CurrentStep = () => {
|
|
|
1922
1955
|
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
1923
1956
|
currentStep = _useExportResourcesMo.currentStep;
|
|
1924
1957
|
const steps = {
|
|
1925
|
-
|
|
1926
|
-
|
|
1958
|
+
'file-settings': jsxRuntime.jsx(ExportFileSettingsStep, {}),
|
|
1959
|
+
'fields-selection': jsxRuntime.jsx(ExportFieldsSelectionStep, {})
|
|
1927
1960
|
};
|
|
1928
1961
|
return steps[currentStep] || null;
|
|
1929
1962
|
};
|
|
@@ -2023,7 +2056,7 @@ const ExportResourcesModal = props => {
|
|
|
2023
2056
|
const messages = useAsyncIntlMessages(locale, loadMessages);
|
|
2024
2057
|
if (!props.isOpen || messages.isLoading) return null;
|
|
2025
2058
|
if (props.filters && !validateFilters(props.filters)) {
|
|
2026
|
-
console.error('Invalid filters prop:', props.filters, 'Filters must contain
|
|
2059
|
+
console.error('Invalid filters prop:', props.filters, 'Filters must contain one of these values: `filters` or `where`');
|
|
2027
2060
|
return null;
|
|
2028
2061
|
}
|
|
2029
2062
|
return jsxRuntime.jsx(reactIntl.IntlProvider, {
|
|
@@ -2045,5 +2078,6 @@ ExportResourcesModal.defaultProps = {
|
|
|
2045
2078
|
|
|
2046
2079
|
exports.EXPORTABLE_RESOURCES = EXPORTABLE_RESOURCES;
|
|
2047
2080
|
exports.EXPORT_TYPES = EXPORT_TYPES;
|
|
2081
|
+
exports.Step = Step;
|
|
2048
2082
|
exports["default"] = ExportResourcesModal;
|
|
2049
2083
|
exports.useConvertFieldDefinitionsForExport = useConvertFieldDefinitionsForExport;
|
|
@@ -40,6 +40,7 @@ import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array
|
|
|
40
40
|
import _Set from '@babel/runtime-corejs3/core-js-stable/set';
|
|
41
41
|
import _sortInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/sort';
|
|
42
42
|
import _indexOfInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/index-of';
|
|
43
|
+
import _trimInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/trim';
|
|
43
44
|
import { useShowNotification } from '@commercetools-frontend/actions-global';
|
|
44
45
|
import { MC_API_PROXY_TARGETS, DOMAINS } from '@commercetools-frontend/constants';
|
|
45
46
|
import { actions, useAsyncDispatch } from '@commercetools-frontend/sdk';
|
|
@@ -224,107 +225,107 @@ var messages = defineMessages({
|
|
|
224
225
|
exportScopeAllCategories: {
|
|
225
226
|
id: 'ExportResourcesModal.exportScopeAllCategories',
|
|
226
227
|
description: 'Label for Export All categories',
|
|
227
|
-
defaultMessage: 'Export all: {total} categories'
|
|
228
|
+
defaultMessage: 'Export all: {total, plural, one {# category} other {# categories}}'
|
|
228
229
|
},
|
|
229
230
|
exportScopeSelectedCategories: {
|
|
230
231
|
id: 'ExportResourcesModal.exportScopeSelectedCategories',
|
|
231
232
|
description: 'Label for Export Selected categories',
|
|
232
|
-
defaultMessage: 'Export selected: {total} categories'
|
|
233
|
+
defaultMessage: 'Export selected: {total, plural, one {# category} other {# categories}}'
|
|
233
234
|
},
|
|
234
235
|
exportScopeFilteredCategories: {
|
|
235
236
|
id: 'ExportResourcesModal.exportScopeFilteredCategories',
|
|
236
237
|
description: 'Label for Export Filtered categories',
|
|
237
|
-
defaultMessage: 'Export filtered: {total} categories'
|
|
238
|
+
defaultMessage: 'Export filtered: {total, plural, one {# category} other {# categories}}'
|
|
238
239
|
},
|
|
239
240
|
exportScopeAllProducts: {
|
|
240
241
|
id: 'ExportResourcesModal.exportScopeAllProducts',
|
|
241
242
|
description: 'Label for Export All products',
|
|
242
|
-
defaultMessage: 'Export all: {total} products'
|
|
243
|
+
defaultMessage: 'Export all: {total, plural, one {# product} other {# products}}'
|
|
243
244
|
},
|
|
244
245
|
exportScopeSelectedProducts: {
|
|
245
246
|
id: 'ExportResourcesModal.exportScopeSelectedProducts',
|
|
246
247
|
description: 'Label for Export Selected products',
|
|
247
|
-
defaultMessage: 'Export selected: {total} products'
|
|
248
|
+
defaultMessage: 'Export selected: {total, plural, one {# product} other {# products}}'
|
|
248
249
|
},
|
|
249
250
|
exportScopeFilteredProducts: {
|
|
250
251
|
id: 'ExportResourcesModal.exportScopeFilteredProducts',
|
|
251
252
|
description: 'Label for Export Filtered products',
|
|
252
|
-
defaultMessage: 'Export filtered: {total} products'
|
|
253
|
+
defaultMessage: 'Export filtered: {total, plural, one {# product} other {# products}}'
|
|
253
254
|
},
|
|
254
255
|
exportScopeAllProductTypes: {
|
|
255
256
|
id: 'ExportResourcesModal.exportScopeAllProductTypes',
|
|
256
257
|
description: 'Label for Export All product types',
|
|
257
|
-
defaultMessage: 'Export all: {total} product types'
|
|
258
|
+
defaultMessage: 'Export all: {total, plural, one {# product type} other {# product types}}'
|
|
258
259
|
},
|
|
259
260
|
exportScopeSelectedProductTypes: {
|
|
260
261
|
id: 'ExportResourcesModal.exportScopeSelectedProductTypes',
|
|
261
262
|
description: 'Label for Export Selected product types',
|
|
262
|
-
defaultMessage: 'Export selected: {total} product types'
|
|
263
|
+
defaultMessage: 'Export selected: {total, plural, one {# product type} other {# product types}}'
|
|
263
264
|
},
|
|
264
265
|
exportScopeFilteredProductTypes: {
|
|
265
266
|
id: 'ExportResourcesModal.exportScopeFilteredProductTypes',
|
|
266
267
|
description: 'Label for Export Filtered product types',
|
|
267
|
-
defaultMessage: 'Export filtered: {total} product types'
|
|
268
|
+
defaultMessage: 'Export filtered: {total, plural, one {# product type} other {# product types}}'
|
|
268
269
|
},
|
|
269
270
|
exportInventoriesForAllProducts: {
|
|
270
271
|
id: 'ExportResourcesModal.exportInventoriesForAllProducts',
|
|
271
272
|
description: 'Label for Export All inventories',
|
|
272
|
-
defaultMessage: 'Export inventories for all {total} products'
|
|
273
|
+
defaultMessage: 'Export inventories for all {total, plural, one {# product} other {# products}}'
|
|
273
274
|
},
|
|
274
275
|
exportInventoriesForSelectedProducts: {
|
|
275
276
|
id: 'ExportResourcesModal.exportInventoriesForSelectedProducts',
|
|
276
277
|
description: 'Label for Export Selected inventories',
|
|
277
|
-
defaultMessage: 'Export inventories for the {total} selected products'
|
|
278
|
+
defaultMessage: 'Export inventories for the {total, plural, one {# selected product} other {# selected products}}'
|
|
278
279
|
},
|
|
279
280
|
exportInventoriesForFilteredProducts: {
|
|
280
281
|
id: 'ExportResourcesModal.exportInventoriesForFilteredProducts',
|
|
281
282
|
description: 'Label for Export Filtered inventories',
|
|
282
|
-
defaultMessage: 'Export inventories for the {total} filtered products'
|
|
283
|
+
defaultMessage: 'Export inventories for the {total, plural, one {# filtered product} other {# filtered products}}'
|
|
283
284
|
},
|
|
284
285
|
exportScopeAllDiscountCodes: {
|
|
285
286
|
id: 'ExportResourcesModal.exportScopeAllDiscountCodes',
|
|
286
287
|
description: 'Label for Export All discount codes',
|
|
287
|
-
defaultMessage: 'Export all: {total} discount codes'
|
|
288
|
+
defaultMessage: 'Export all: {total, plural, one {# discount code} other {# discount codes}}'
|
|
288
289
|
},
|
|
289
290
|
exportScopeSelectedDiscountCodes: {
|
|
290
291
|
id: 'ExportResourcesModal.exportScopeSelectedDiscountCodes',
|
|
291
292
|
description: 'Label for Export Selected discount codes',
|
|
292
|
-
defaultMessage: 'Export selected: {total} discount codes'
|
|
293
|
+
defaultMessage: 'Export selected: {total, plural, one {# discount code} other {# discount codes}}'
|
|
293
294
|
},
|
|
294
295
|
exportScopeFilteredDiscountCodes: {
|
|
295
296
|
id: 'ExportResourcesModal.exportScopeFilteredDiscountCodes',
|
|
296
297
|
description: 'Label for Export Filtered discount codes',
|
|
297
|
-
defaultMessage: 'Export filtered: {total} discount codes'
|
|
298
|
+
defaultMessage: 'Export filtered: {total, plural, one {# discount code} other {# discount codes}}'
|
|
298
299
|
},
|
|
299
300
|
exportScopeAllOrders: {
|
|
300
301
|
id: 'ExportResourcesModal.exportScopeAllOrders',
|
|
301
302
|
description: 'Label for Export All orders',
|
|
302
|
-
defaultMessage: 'Export all: {total} orders'
|
|
303
|
+
defaultMessage: 'Export all: {total, plural, one {# order} other {# orders}}'
|
|
303
304
|
},
|
|
304
305
|
exportScopeSelectedOrders: {
|
|
305
306
|
id: 'ExportResourcesModal.exportScopeSelectedOrders',
|
|
306
307
|
description: 'Label for Export Selected orders',
|
|
307
|
-
defaultMessage: 'Export selected: {total} orders'
|
|
308
|
+
defaultMessage: 'Export selected: {total, plural, one {# order} other {# orders}}'
|
|
308
309
|
},
|
|
309
310
|
exportScopeFilteredOrders: {
|
|
310
311
|
id: 'ExportResourcesModal.exportScopeFilteredOrders',
|
|
311
312
|
description: 'Label for Export Filtered orders',
|
|
312
|
-
defaultMessage: 'Export filtered: {total} orders'
|
|
313
|
+
defaultMessage: 'Export filtered: {total, plural, one {# order} other {# orders}}'
|
|
313
314
|
},
|
|
314
315
|
exportScopeAllCustomers: {
|
|
315
316
|
id: 'ExportResourcesModal.exportScopeAllCustomers',
|
|
316
317
|
description: 'Label for Export All customers',
|
|
317
|
-
defaultMessage: 'Export all: {total} customers'
|
|
318
|
+
defaultMessage: 'Export all: {total, plural, one {# customer} other {# customers}}'
|
|
318
319
|
},
|
|
319
320
|
exportScopeSelectedCustomers: {
|
|
320
321
|
id: 'ExportResourcesModal.exportScopeSelectedCustomers',
|
|
321
322
|
description: 'Label for Export Selected customers',
|
|
322
|
-
defaultMessage: 'Export selected: {total} customers'
|
|
323
|
+
defaultMessage: 'Export selected: {total, plural, one {# customer} other {# customers}}'
|
|
323
324
|
},
|
|
324
325
|
exportScopeFilteredCustomers: {
|
|
325
326
|
id: 'ExportResourcesModal.exportScopeFilteredCustomers',
|
|
326
327
|
description: 'Label for Export Filtered customers',
|
|
327
|
-
defaultMessage: 'Export filtered: {total} customers'
|
|
328
|
+
defaultMessage: 'Export filtered: {total, plural, one {# customer} other {# customers}}'
|
|
328
329
|
},
|
|
329
330
|
exportScopeSelectedWithoutCount: {
|
|
330
331
|
id: 'ExportResourcesModal.exportScopeSelectedWithoutCount',
|
|
@@ -614,6 +615,12 @@ const getTotalCheckedFields = group => {
|
|
|
614
615
|
return countCheckedFields(group.fields);
|
|
615
616
|
};
|
|
616
617
|
|
|
618
|
+
let Step = /*#__PURE__*/function (Step) {
|
|
619
|
+
Step["FileSettings"] = "file-settings";
|
|
620
|
+
Step["FieldsSelection"] = "fields-selection";
|
|
621
|
+
return Step;
|
|
622
|
+
}({});
|
|
623
|
+
|
|
617
624
|
function validate(_ref) {
|
|
618
625
|
let values = _valuesInstanceProperty(_ref),
|
|
619
626
|
step = _ref.step;
|
|
@@ -633,7 +640,7 @@ function validate(_ref) {
|
|
|
633
640
|
if (locales.length < 1) {
|
|
634
641
|
errors.locales.missing = true;
|
|
635
642
|
}
|
|
636
|
-
if (step ===
|
|
643
|
+
if (step === Step.FieldsSelection) {
|
|
637
644
|
const allFields = _reduceInstanceProperty(groups).call(groups, (acc, group) => _concatInstanceProperty(acc).call(acc, group.fields), []);
|
|
638
645
|
const checkedFieldsCount = _filterInstanceProperty(allFields).call(allFields, field => {
|
|
639
646
|
if (field.fields) return isAnyFieldChecked(field.fields);
|
|
@@ -731,21 +738,45 @@ function buildSelectedExportFilters(selectedResourceIds) {
|
|
|
731
738
|
const formattedIds = _mapInstanceProperty(selectedResourceIds).call(selectedResourceIds, id => `"${id}"`).join(', ');
|
|
732
739
|
return `id in (${formattedIds})`;
|
|
733
740
|
}
|
|
734
|
-
function
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
const validFilterState = hasQueryPredicate && !hasSearchQuery || !hasQueryPredicate && hasSearchQuery;
|
|
740
|
-
return validFilterState;
|
|
741
|
+
function isQueryFilter(filters) {
|
|
742
|
+
return filters?.query !== undefined;
|
|
743
|
+
}
|
|
744
|
+
function isSearchFilter(filters) {
|
|
745
|
+
return filters?.filters?.length || filters?.fullText !== undefined;
|
|
741
746
|
}
|
|
742
|
-
function
|
|
743
|
-
|
|
747
|
+
function validateFilters(filtersObject) {
|
|
748
|
+
var _context2;
|
|
749
|
+
if (filtersObject.where && filtersObject.filters) {
|
|
744
750
|
return false;
|
|
745
751
|
}
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
752
|
+
if (isQueryFilter(filtersObject.filters)) {
|
|
753
|
+
return Boolean(filtersObject.filters?.query);
|
|
754
|
+
}
|
|
755
|
+
if (isSearchFilter(filtersObject.filters)) {
|
|
756
|
+
const searchFilters = filtersObject.filters;
|
|
757
|
+
return Boolean(searchFilters.filters?.length || searchFilters.fullText?.text?.trim());
|
|
758
|
+
}
|
|
759
|
+
if (filtersObject.where && _trimInstanceProperty(_context2 = filtersObject.where).call(_context2) !== '') {
|
|
760
|
+
return true;
|
|
761
|
+
}
|
|
762
|
+
return false;
|
|
763
|
+
}
|
|
764
|
+
function areFiltersApplied(filtersObject) {
|
|
765
|
+
var _context3;
|
|
766
|
+
if (!filtersObject) {
|
|
767
|
+
return false;
|
|
768
|
+
}
|
|
769
|
+
if (filtersObject.where && _trimInstanceProperty(_context3 = filtersObject.where).call(_context3) !== '') {
|
|
770
|
+
return true;
|
|
771
|
+
}
|
|
772
|
+
if (filtersObject.filters && 'query' in filtersObject.filters) {
|
|
773
|
+
return Boolean(filtersObject.filters.query);
|
|
774
|
+
}
|
|
775
|
+
if (filtersObject.filters && ('filters' in filtersObject.filters || 'fullText' in filtersObject.filters)) {
|
|
776
|
+
const _filters = filtersObject.filters;
|
|
777
|
+
return Boolean(_filters.filters?.length || _filters.fullText?.text?.trim());
|
|
778
|
+
}
|
|
779
|
+
return false;
|
|
749
780
|
}
|
|
750
781
|
function getInitialExportType(args) {
|
|
751
782
|
if (args.selectedResourceIds?.length) {
|
|
@@ -947,7 +978,7 @@ async function createExportOperation(_ref, asyncDispatchFn) {
|
|
|
947
978
|
fillRows,
|
|
948
979
|
// Query predicate
|
|
949
980
|
where,
|
|
950
|
-
// Search API filters
|
|
981
|
+
// Search API filters or Category API filters
|
|
951
982
|
filters
|
|
952
983
|
}
|
|
953
984
|
}));
|
|
@@ -993,14 +1024,15 @@ const useStartExportOperation = props => {
|
|
|
993
1024
|
let filters = undefined;
|
|
994
1025
|
if (exportType === EXPORT_TYPES.SELECTED && props.selectedResourceIds?.length) {
|
|
995
1026
|
where = buildSelectedExportFilters(props.selectedResourceIds);
|
|
996
|
-
} else if (exportType === EXPORT_TYPES.FILTERED) {
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
if (props.filters?.searchQuery) {
|
|
1027
|
+
} else if (exportType === EXPORT_TYPES.FILTERED && props.filters) {
|
|
1028
|
+
where = props.filters.where;
|
|
1029
|
+
if (isQueryFilter(props.filters.filters)) {
|
|
1030
|
+
const _filters = props.filters.filters;
|
|
1001
1031
|
filters = {
|
|
1002
|
-
query:
|
|
1032
|
+
query: _filters.query
|
|
1003
1033
|
};
|
|
1034
|
+
} else if (isSearchFilter(props.filters.filters)) {
|
|
1035
|
+
filters = props.filters.filters;
|
|
1004
1036
|
}
|
|
1005
1037
|
}
|
|
1006
1038
|
const response = await createExportOperation({
|
|
@@ -1729,7 +1761,7 @@ const StyledGridCard = /*#__PURE__*/_styled(Card, process.env.NODE_ENV === "prod
|
|
|
1729
1761
|
} : {
|
|
1730
1762
|
target: "e5mvpn60",
|
|
1731
1763
|
label: "StyledGridCard"
|
|
1732
|
-
})("max-height:calc(100vh - ", totalSpacing, "px);overflow:auto;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
1764
|
+
})("max-height:calc(100vh - ", totalSpacing, "px);overflow:auto;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImV4cG9ydC1maWVsZHMtc2VsZWN0aW9uLXN0ZXAudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTBDbUMiLCJmaWxlIjoiZXhwb3J0LWZpZWxkcy1zZWxlY3Rpb24tc3RlcC50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgUmVhY3QgZnJvbSAncmVhY3QnXG5pbXBvcnQgeyB1c2VJbnRsIH0gZnJvbSAncmVhY3QtaW50bCdcbmltcG9ydCB7IEZvcm1EaWFsb2cgfSBmcm9tICdAY29tbWVyY2V0b29scy1mcm9udGVuZC9hcHBsaWNhdGlvbi1jb21wb25lbnRzJ1xuaW1wb3J0IHsgdXNlQXBwbGljYXRpb25Db250ZXh0IH0gZnJvbSAnQGNvbW1lcmNldG9vbHMtZnJvbnRlbmQvYXBwbGljYXRpb24tc2hlbGwtY29ubmVjdG9ycydcbmltcG9ydCB7IHVzZVN0b3JhZ2UgfSBmcm9tICdAY29tbWVyY2V0b29scy1mcm9udGVuZC9leHBlcmltZW50YWwtY29tcG9uZW50cydcbmltcG9ydCB7IE1hc2tpbmcgYXMgRnVsbFN0b3J5TWFza2luZyB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLWZyb250ZW5kL2Z1bGxzdG9yeSdcbmltcG9ydCB7XG4gIENhcmQsXG4gIEdyaWQsXG4gIFNwYWNpbmdzLFxuICBTZWFyY2hUZXh0SW5wdXQsXG4gIGRlc2lnblRva2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gICAgIHZhbHVlPXtmaWVsZFNlYXJjaFRlcm19XG4gICAgICAgICAgICAgIG9uQ2hhbmdlPXtvblNlYXJjaENoYW5nZVRocm90dGxlZH1cbiAgICAgICAgICAgICAgb25SZXNldD17b25TZWFyY2hSZXNldH1cbiAgICAgICAgICAgICAgLy8gVE9ETzogYFNlYXJjaFRleHRJbnB1dGAgcHJvcHMgdG8gYmUgaW1wcm92ZWQuIFRoZSBgb25TdWJtaXRgIGNhbGxiYWNrIHNob3VsZG4ndCBiZSBtYW5kYXRvcnlcbiAgICAgICAgICAgICAgb25TdWJtaXQ9eygpID0+IHt9fVxuICAgICAgICAgICAgICBpZD1cImV4cG9ydC1maWVsZHMtc2VhcmNoXCJcbiAgICAgICAgICAgIC8+XG4gICAgICAgICAgICB7aGFzUmVzdWx0cyA/IChcbiAgICAgICAgICAgICAgPFN0eWxlZEdyaWRDYXJkIGluc2V0U2NhbGU9XCJub25lXCI+XG4gICAgICAgICAgICAgICAgPEdyaWRcbiAgICAgICAgICAgICAgICAgIGdyaWRBdXRvRmxvdz1cInJvd1wiXG4gICAgICAgICAgICAgICAgICBncmlkVGVtcGxhdGVDb2x1bW5zPXtgY2FsYygke2Rlc2lnblRva2Vucy5zcGFjaW5nTH0gKyAke2Rlc2lnblRva2Vucy5jb25zdHJhaW50NX0gKyAke2Rlc2lnblRva2Vucy5zcGFjaW5nTH0pIGF1dG9gfVxuICAgICAgICAgICAgICAgID5cbiAgICAgICAgICAgICAgICAgIHtmaWx0ZXJlZEdyb3Vwcy5tYXAoKGdyb3VwLCBpbmRleCkgPT4gKFxuICAgICAgICAgICAgICAgICAgICA8RmllbGRHcm91cFNlY3Rpb25cbiAgICAgICAgICAgICAgICAgICAgICBrZXk9e2dyb3VwLmdyb3VwTmFtZX1cbiAgICAgICAgICAgICAgICAgICAgICBncm91cD17Z3JvdXB9XG4gICAgICAgICAgICAgICAgICAgICAgaW5kZXg9e2luZGV4fVxuICAgICAgICAgICAgICAgICAgICAgIGZvcm1paz17Zm9ybWlrfVxuICAgICAgICAgICAgICAgICAgICAgIGlzRm9yY2VFeHBhbmRlZD17ZmllbGRTZWFyY2hUZXJtPy50cmltKCk/Lmxlbmd0aCA+IDB9XG4gICAgICAgICAgICAgICAgICAgIC8+XG4gICAgICAgICAgICAgICAgICApKX1cbiAgICAgICAgICAgICAgICA8L0dyaWQ+XG4gICAgICAgICAgICAgIDwvU3R5bGVkR3JpZENhcmQ+XG4gICAgICAgICAgICApIDogKFxuICAgICAgICAgICAgICA8Tm9TZWFyY2hSZXN1bHRzIC8+XG4gICAgICAgICAgICApfVxuICAgICAgICAgIDwvU3BhY2luZ3MuU3RhY2s+XG4gICAgICAgIDwvRXhwb3J0RmllbGRTZWxlY3Rpb25Qcm92aWRlcj5cbiAgICAgIDwvRnVsbFN0b3J5TWFza2luZy5Vbm1hc2s+XG4gICAgPC9Gb3JtRGlhbG9nPlxuICApXG59XG4iXX0= */"));
|
|
1733
1765
|
const ExportFieldsSelectionStep = () => {
|
|
1734
1766
|
const intl = useIntl();
|
|
1735
1767
|
const _React$useState = React.useState(''),
|
|
@@ -1820,7 +1852,7 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1820
1852
|
onPrimaryButtonClick: formik.submitForm,
|
|
1821
1853
|
isPrimaryButtonDisabled: !formik.isValid,
|
|
1822
1854
|
labelSecondary: intl.formatMessage(messages.back),
|
|
1823
|
-
onSecondaryButtonClick: () => setCurrentStep(
|
|
1855
|
+
onSecondaryButtonClick: () => setCurrentStep(Step.FileSettings),
|
|
1824
1856
|
onClose: onClose,
|
|
1825
1857
|
size: 16,
|
|
1826
1858
|
children: jsx(Masking.Unmask, {
|
|
@@ -1863,7 +1895,7 @@ const ExportResourcesProvider = _ref => {
|
|
|
1863
1895
|
let children = _ref.children,
|
|
1864
1896
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
1865
1897
|
const initialValues = useInitialValues(props);
|
|
1866
|
-
const _React$useState = React.useState(
|
|
1898
|
+
const _React$useState = React.useState(Step.FileSettings),
|
|
1867
1899
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1868
1900
|
currentStep = _React$useState2[0],
|
|
1869
1901
|
setCurrentStep = _React$useState2[1];
|
|
@@ -1877,8 +1909,8 @@ const ExportResourcesProvider = _ref => {
|
|
|
1877
1909
|
const _useStartExportOperat = useStartExportOperation(props),
|
|
1878
1910
|
startExportOperation = _useStartExportOperat.startExportOperation;
|
|
1879
1911
|
const onSubmit = async values => {
|
|
1880
|
-
if (currentStep ===
|
|
1881
|
-
setCurrentStep(
|
|
1912
|
+
if (currentStep === Step.FileSettings) {
|
|
1913
|
+
setCurrentStep(Step.FieldsSelection);
|
|
1882
1914
|
} else {
|
|
1883
1915
|
startExportOperation(values, exportType);
|
|
1884
1916
|
}
|
|
@@ -1917,8 +1949,8 @@ const CurrentStep = () => {
|
|
|
1917
1949
|
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
1918
1950
|
currentStep = _useExportResourcesMo.currentStep;
|
|
1919
1951
|
const steps = {
|
|
1920
|
-
|
|
1921
|
-
|
|
1952
|
+
'file-settings': jsx(ExportFileSettingsStep, {}),
|
|
1953
|
+
'fields-selection': jsx(ExportFieldsSelectionStep, {})
|
|
1922
1954
|
};
|
|
1923
1955
|
return steps[currentStep] || null;
|
|
1924
1956
|
};
|
|
@@ -2018,7 +2050,7 @@ const ExportResourcesModal = props => {
|
|
|
2018
2050
|
const messages = useAsyncIntlMessages(locale, loadMessages);
|
|
2019
2051
|
if (!props.isOpen || messages.isLoading) return null;
|
|
2020
2052
|
if (props.filters && !validateFilters(props.filters)) {
|
|
2021
|
-
console.error('Invalid filters prop:', props.filters, 'Filters must contain
|
|
2053
|
+
console.error('Invalid filters prop:', props.filters, 'Filters must contain one of these values: `filters` or `where`');
|
|
2022
2054
|
return null;
|
|
2023
2055
|
}
|
|
2024
2056
|
return jsx(IntlProvider, {
|
|
@@ -2038,4 +2070,4 @@ ExportResourcesModal.defaultProps = {
|
|
|
2038
2070
|
fieldOrder: []
|
|
2039
2071
|
};
|
|
2040
2072
|
|
|
2041
|
-
export { EXPORTABLE_RESOURCES, EXPORT_TYPES, ExportResourcesModal as default, useConvertFieldDefinitionsForExport };
|
|
2073
|
+
export { EXPORTABLE_RESOURCES, EXPORT_TYPES, Step, ExportResourcesModal as default, useConvertFieldDefinitionsForExport };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { QueryFilter, SearchFilter } from "./export-resources-modal-types.js";
|
|
1
2
|
export interface ExportApiRequest {
|
|
2
3
|
projectKey: string;
|
|
3
4
|
resourceType: string;
|
|
@@ -5,11 +6,13 @@ export interface ExportApiRequest {
|
|
|
5
6
|
fileFormat: string;
|
|
6
7
|
fields: string[];
|
|
7
8
|
locales: string[];
|
|
8
|
-
filters?:
|
|
9
|
-
query: Record<string, unknown>;
|
|
10
|
-
};
|
|
9
|
+
filters?: QueryFilter | SearchFilter;
|
|
11
10
|
where?: string;
|
|
12
11
|
fillRows?: boolean;
|
|
12
|
+
fullText?: {
|
|
13
|
+
text: string;
|
|
14
|
+
locale: string;
|
|
15
|
+
};
|
|
13
16
|
}
|
|
14
17
|
export interface ExportApiResponse {
|
|
15
18
|
id: string;
|
|
@@ -2,10 +2,14 @@ import type { FormikProps } from 'formik';
|
|
|
2
2
|
import type { ExportType, Filters } from "./export-resources-modal-types.js";
|
|
3
3
|
import type { FormValues } from "./form.js";
|
|
4
4
|
import type { ResourceType } from "./resource-type.js";
|
|
5
|
+
export declare enum Step {
|
|
6
|
+
FileSettings = "file-settings",
|
|
7
|
+
FieldsSelection = "fields-selection"
|
|
8
|
+
}
|
|
5
9
|
export interface ExportResourcesModalContext {
|
|
6
10
|
formik: FormikProps<FormValues>;
|
|
7
|
-
currentStep:
|
|
8
|
-
setCurrentStep: React.Dispatch<React.SetStateAction<
|
|
11
|
+
currentStep: Step;
|
|
12
|
+
setCurrentStep: React.Dispatch<React.SetStateAction<Step>>;
|
|
9
13
|
onClose: () => void;
|
|
10
14
|
resourceType: ResourceType;
|
|
11
15
|
exportType: ExportType;
|
|
@@ -32,8 +32,18 @@ export interface ExportResourcesModalProps {
|
|
|
32
32
|
onExportSuccess?: () => void;
|
|
33
33
|
}
|
|
34
34
|
export type ExportType = keyof typeof EXPORT_TYPES;
|
|
35
|
+
export type QueryFilter = {
|
|
36
|
+
query: Record<string, unknown>;
|
|
37
|
+
};
|
|
38
|
+
export type SearchFilter = {
|
|
39
|
+
filters?: string[];
|
|
40
|
+
fullText?: {
|
|
41
|
+
text: string;
|
|
42
|
+
locale: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
35
45
|
export type Filters = {
|
|
36
|
-
|
|
37
|
-
|
|
46
|
+
filters?: QueryFilter | SearchFilter;
|
|
47
|
+
where?: string;
|
|
38
48
|
total: number;
|
|
39
49
|
};
|
package/package.json
CHANGED