@commercetools-frontend-extensions/export-resources-modal 4.7.2 → 4.8.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/README.md +7 -2
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.dev.js +64 -51
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.prod.js +63 -50
- package/dist/commercetools-frontend-extensions-export-resources-modal.esm.js +63 -52
- package/dist/declarations/src/@types/export-api.d.ts +5 -1
- package/dist/declarations/src/@types/export-resources-modal-context.d.ts +6 -2
- package/dist/declarations/src/@types/export-resources-modal-types.d.ts +8 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -129,7 +129,12 @@ import ExportResourcesModal from '@commercetools-frontend-extensions/export-reso
|
|
|
129
129
|
outputFormat="csv"
|
|
130
130
|
resourceType="category"
|
|
131
131
|
filters={{
|
|
132
|
-
|
|
132
|
+
where: 'key = "category-key"',
|
|
133
|
+
filters: { query: 'key = "category-key"' } | [ 'key = "category-key"']
|
|
134
|
+
fullText: {
|
|
135
|
+
text: 'category-text',
|
|
136
|
+
locale: 'en'
|
|
137
|
+
}
|
|
133
138
|
total: 20
|
|
134
139
|
}}
|
|
135
140
|
totalResourcesCount={143}
|
|
@@ -326,7 +331,7 @@ import ExportResourcesModal from '@commercetools-frontend-extensions/export-reso
|
|
|
326
331
|
| `onExportSuccess` | `function` | | | Callback function that is called when the export operation is successful |
|
|
327
332
|
| `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
333
|
| `resourceType` | `string` | ✅ | | The type of the resource, example: `category`, `product`...
|
|
329
|
-
| `filters` | `Filters` | | | Filters can be set as
|
|
334
|
+
| `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
335
|
| `totalResourcesCount` | `number` | ✅ | | The count of all resources of identified `resourceType` |
|
|
331
336
|
| `selectedResourceIds` | `array` | | | Array of Ids of the selected resources |
|
|
332
337
|
| `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);
|
|
@@ -770,20 +778,21 @@ function buildSelectedExportFilters(selectedResourceIds) {
|
|
|
770
778
|
return `id in (${formattedIds})`;
|
|
771
779
|
}
|
|
772
780
|
function validateFilters(filters) {
|
|
773
|
-
const
|
|
774
|
-
const
|
|
775
|
-
|
|
776
|
-
// Ensure only one of `
|
|
777
|
-
const validFilterState =
|
|
781
|
+
const hasWhere = 'where' in filters;
|
|
782
|
+
const hasFilters = 'filters' in filters;
|
|
783
|
+
const hasFullText = 'fullText' in filters;
|
|
784
|
+
// Ensure only one of `where` or `filters` is applied but not both or none
|
|
785
|
+
const validFilterState = hasWhere && !hasFilters || !hasWhere && hasFilters || hasFullText && filters?.fullText?.text?.trim() !== '';
|
|
778
786
|
return validFilterState;
|
|
779
787
|
}
|
|
780
|
-
function areFiltersApplied(
|
|
781
|
-
if (!
|
|
788
|
+
function areFiltersApplied(filterObject) {
|
|
789
|
+
if (!filterObject) {
|
|
782
790
|
return false;
|
|
783
791
|
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
792
|
+
let filters = filterObject.filters,
|
|
793
|
+
where = filterObject.where;
|
|
794
|
+
let hasFilters = where && _trimInstanceProperty__default["default"](where).call(where) !== '' || Boolean(_Array$isArray__default["default"](filters) && filters.length > 0 || typeof filters === 'object' && _Object$keys__default["default"](filters).length > 0);
|
|
795
|
+
return hasFilters;
|
|
787
796
|
}
|
|
788
797
|
function getInitialExportType(args) {
|
|
789
798
|
if (args.selectedResourceIds?.length) {
|
|
@@ -968,7 +977,8 @@ async function createExportOperation(_ref, asyncDispatchFn) {
|
|
|
968
977
|
locales = _ref.locales,
|
|
969
978
|
filters = _ref.filters,
|
|
970
979
|
where = _ref.where,
|
|
971
|
-
fillRows = _ref.fillRows
|
|
980
|
+
fillRows = _ref.fillRows,
|
|
981
|
+
fullText = _ref.fullText;
|
|
972
982
|
const uri = `/${projectKey}/export-operations`;
|
|
973
983
|
const response = await asyncDispatchFn(sdk.actions.post({
|
|
974
984
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.EXPORT,
|
|
@@ -985,8 +995,9 @@ async function createExportOperation(_ref, asyncDispatchFn) {
|
|
|
985
995
|
fillRows,
|
|
986
996
|
// Query predicate
|
|
987
997
|
where,
|
|
988
|
-
// Search API filters
|
|
989
|
-
filters
|
|
998
|
+
// Search API filters or Category API filters
|
|
999
|
+
filters,
|
|
1000
|
+
fullText
|
|
990
1001
|
}
|
|
991
1002
|
}));
|
|
992
1003
|
if (!response || typeof response !== 'object' || !('state' in response)) {
|
|
@@ -1029,16 +1040,16 @@ const useStartExportOperation = props => {
|
|
|
1029
1040
|
const fields = extractFieldNamesFromGroups(values.groups);
|
|
1030
1041
|
let where = undefined;
|
|
1031
1042
|
let filters = undefined;
|
|
1043
|
+
let fullText = undefined;
|
|
1032
1044
|
if (exportType === EXPORT_TYPES.SELECTED && props.selectedResourceIds?.length) {
|
|
1033
1045
|
where = buildSelectedExportFilters(props.selectedResourceIds);
|
|
1034
1046
|
} else if (exportType === EXPORT_TYPES.FILTERED) {
|
|
1035
|
-
if (props.filters
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
};
|
|
1047
|
+
if (props.filters) {
|
|
1048
|
+
;
|
|
1049
|
+
var _props$filters = props.filters;
|
|
1050
|
+
filters = _props$filters.filters;
|
|
1051
|
+
where = _props$filters.where;
|
|
1052
|
+
fullText = _props$filters.fullText;
|
|
1042
1053
|
}
|
|
1043
1054
|
}
|
|
1044
1055
|
const response = await createExportOperation({
|
|
@@ -1050,7 +1061,8 @@ const useStartExportOperation = props => {
|
|
|
1050
1061
|
fillRows: values.fillRows,
|
|
1051
1062
|
fields,
|
|
1052
1063
|
where,
|
|
1053
|
-
filters
|
|
1064
|
+
filters,
|
|
1065
|
+
fullText
|
|
1054
1066
|
}, asyncDispatch);
|
|
1055
1067
|
switch (response.state) {
|
|
1056
1068
|
case EXPORT_OPERATION_STATES.QUEUED:
|
|
@@ -1767,7 +1779,7 @@ const StyledGridCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, proc
|
|
|
1767
1779
|
} : {
|
|
1768
1780
|
target: "e5mvpn60",
|
|
1769
1781
|
label: "StyledGridCard"
|
|
1770
|
-
})("max-height:calc(100vh - ", totalSpacing, "px);overflow:auto;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
1782
|
+
})("max-height:calc(100vh - ", totalSpacing, "px);overflow:auto;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImV4cG9ydC1maWVsZHMtc2VsZWN0aW9uLXN0ZXAudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTBDbUMiLCJmaWxlIjoiZXhwb3J0LWZpZWxkcy1zZWxlY3Rpb24tc3RlcC50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgUmVhY3QgZnJvbSAncmVhY3QnXG5pbXBvcnQgeyB1c2VJbnRsIH0gZnJvbSAncmVhY3QtaW50bCdcbmltcG9ydCB7IEZvcm1EaWFsb2cgfSBmcm9tICdAY29tbWVyY2V0b29scy1mcm9udGVuZC9hcHBsaWNhdGlvbi1jb21wb25lbnRzJ1xuaW1wb3J0IHsgdXNlQXBwbGljYXRpb25Db250ZXh0IH0gZnJvbSAnQGNvbW1lcmNldG9vbHMtZnJvbnRlbmQvYXBwbGljYXRpb24tc2hlbGwtY29ubmVjdG9ycydcbmltcG9ydCB7IHVzZVN0b3JhZ2UgfS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8RXhwb3J0RmllbGRTZWxlY3Rpb25Qcm92aWRlciByZXNvdXJjZVR5cGU9e3Jlc291cmNlVHlwZX0+XG4gICAgICAgICAgPFNwYWNpbmdzLlN0YWNrIHNjYWxlPVwibVwiPlxuICAgICAgICAgICAgPFNlYXJjaFRleHRJbnB1dFxuICAgICAgICAgICAgICBwbGFjZWhvbGRlcj17aW50bC5mb3JtYXRNZXNzYWdlKG1lc3NhZ2VzLnNlYXJjaEZvckZpZWxkcyl9XG4gICAgICAgICAgICAgIHZhbHVlPXtmaWVsZFNlYXJjaFRlcm19XG4gICAgICAgICAgICAgIG9uQ2hhbmdlPXtvblNlYXJjaENoYW5nZVRocm90dGxlZH1cbiAgICAgICAgICAgICAgb25SZXNldD17b25TZWFyY2hSZXNldH1cbiAgICAgICAgICAgICAgLy8gVE9ETzogYFNlYXJjaFRleHRJbnB1dGAgcHJvcHMgdG8gYmUgaW1wcm92ZWQuIFRoZSBgb25TdWJtaXRgIGNhbGxiYWNrIHNob3VsZG4ndCBiZSBtYW5kYXRvcnlcbiAgICAgICAgICAgICAgb25TdWJtaXQ9eygpID0+IHt9fVxuICAgICAgICAgICAgICBpZD1cImV4cG9ydC1maWVsZHMtc2VhcmNoXCJcbiAgICAgICAgICAgIC8+XG4gICAgICAgICAgICB7aGFzUmVzdWx0cyA/IChcbiAgICAgICAgICAgICAgPFN0eWxlZEdyaWRDYXJkIGluc2V0U2NhbGU9XCJub25lXCI+XG4gICAgICAgICAgICAgICAgPEdyaWRcbiAgICAgICAgICAgICAgICAgIGdyaWRBdXRvRmxvdz1cInJvd1wiXG4gICAgICAgICAgICAgICAgICBncmlkVGVtcGxhdGVDb2x1bW5zPXtgY2FsYygke2Rlc2lnblRva2Vucy5zcGFjaW5nTH0gKyAke2Rlc2lnblRva2Vucy5jb25zdHJhaW50NX0gKyAke2Rlc2lnblRva2Vucy5zcGFjaW5nTH0pIGF1dG9gfVxuICAgICAgICAgICAgICAgID5cbiAgICAgICAgICAgICAgICAgIHtmaWx0ZXJlZEdyb3Vwcy5tYXAoKGdyb3VwLCBpbmRleCkgPT4gKFxuICAgICAgICAgICAgICAgICAgICA8RmllbGRHcm91cFNlY3Rpb25cbiAgICAgICAgICAgICAgICAgICAgICBrZXk9e2dyb3VwLmdyb3VwTmFtZX1cbiAgICAgICAgICAgICAgICAgICAgICBncm91cD17Z3JvdXB9XG4gICAgICAgICAgICAgICAgICAgICAgaW5kZXg9e2luZGV4fVxuICAgICAgICAgICAgICAgICAgICAgIGZvcm1paz17Zm9ybWlrfVxuICAgICAgICAgICAgICAgICAgICAgIGlzRm9yY2VFeHBhbmRlZD17ZmllbGRTZWFyY2hUZXJtPy50cmltKCk/Lmxlbmd0aCA+IDB9XG4gICAgICAgICAgICAgICAgICAgIC8+XG4gICAgICAgICAgICAgICAgICApKX1cbiAgICAgICAgICAgICAgICA8L0dyaWQ+XG4gICAgICAgICAgICAgIDwvU3R5bGVkR3JpZENhcmQ+XG4gICAgICAgICAgICApIDogKFxuICAgICAgICAgICAgICA8Tm9TZWFyY2hSZXN1bHRzIC8+XG4gICAgICAgICAgICApfVxuICAgICAgICAgIDwvU3BhY2luZ3MuU3RhY2s+XG4gICAgICAgIDwvRXhwb3J0RmllbGRTZWxlY3Rpb25Qcm92aWRlcj5cbiAgICAgIDwvRnVsbFN0b3J5TWFza2luZy5Vbm1hc2s+XG4gICAgPC9Gb3JtRGlhbG9nPlxuICApXG59XG4iXX0= */"));
|
|
1771
1783
|
const ExportFieldsSelectionStep = () => {
|
|
1772
1784
|
const intl = reactIntl.useIntl();
|
|
1773
1785
|
const _React$useState = React__default["default"].useState(''),
|
|
@@ -1858,7 +1870,7 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1858
1870
|
onPrimaryButtonClick: formik.submitForm,
|
|
1859
1871
|
isPrimaryButtonDisabled: !formik.isValid,
|
|
1860
1872
|
labelSecondary: intl.formatMessage(messages.back),
|
|
1861
|
-
onSecondaryButtonClick: () => setCurrentStep(
|
|
1873
|
+
onSecondaryButtonClick: () => setCurrentStep(Step.FileSettings),
|
|
1862
1874
|
onClose: onClose,
|
|
1863
1875
|
size: 16,
|
|
1864
1876
|
children: jsxRuntime.jsx(fullstory.Masking.Unmask, {
|
|
@@ -1901,7 +1913,7 @@ const ExportResourcesProvider = _ref => {
|
|
|
1901
1913
|
let children = _ref.children,
|
|
1902
1914
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
1903
1915
|
const initialValues = useInitialValues(props);
|
|
1904
|
-
const _React$useState = React__default["default"].useState(
|
|
1916
|
+
const _React$useState = React__default["default"].useState(Step.FileSettings),
|
|
1905
1917
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1906
1918
|
currentStep = _React$useState2[0],
|
|
1907
1919
|
setCurrentStep = _React$useState2[1];
|
|
@@ -1915,8 +1927,8 @@ const ExportResourcesProvider = _ref => {
|
|
|
1915
1927
|
const _useStartExportOperat = useStartExportOperation(props),
|
|
1916
1928
|
startExportOperation = _useStartExportOperat.startExportOperation;
|
|
1917
1929
|
const onSubmit = async values => {
|
|
1918
|
-
if (currentStep ===
|
|
1919
|
-
setCurrentStep(
|
|
1930
|
+
if (currentStep === Step.FileSettings) {
|
|
1931
|
+
setCurrentStep(Step.FieldsSelection);
|
|
1920
1932
|
} else {
|
|
1921
1933
|
startExportOperation(values, exportType);
|
|
1922
1934
|
}
|
|
@@ -1955,8 +1967,8 @@ const CurrentStep = () => {
|
|
|
1955
1967
|
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
1956
1968
|
currentStep = _useExportResourcesMo.currentStep;
|
|
1957
1969
|
const steps = {
|
|
1958
|
-
|
|
1959
|
-
|
|
1970
|
+
'file-settings': jsxRuntime.jsx(ExportFileSettingsStep, {}),
|
|
1971
|
+
'fields-selection': jsxRuntime.jsx(ExportFieldsSelectionStep, {})
|
|
1960
1972
|
};
|
|
1961
1973
|
return steps[currentStep] || null;
|
|
1962
1974
|
};
|
|
@@ -2056,7 +2068,7 @@ const ExportResourcesModal = props => {
|
|
|
2056
2068
|
const messages = useAsyncIntlMessages(locale, loadMessages);
|
|
2057
2069
|
if (!props.isOpen || messages.isLoading) return null;
|
|
2058
2070
|
if (props.filters && !validateFilters(props.filters)) {
|
|
2059
|
-
console.error('Invalid filters prop:', props.filters, 'Filters must contain
|
|
2071
|
+
console.error('Invalid filters prop:', props.filters, 'Filters must contain one of these values: `filters` or `where`');
|
|
2060
2072
|
return null;
|
|
2061
2073
|
}
|
|
2062
2074
|
return jsxRuntime.jsx(reactIntl.IntlProvider, {
|
|
@@ -2078,5 +2090,6 @@ ExportResourcesModal.defaultProps = {
|
|
|
2078
2090
|
|
|
2079
2091
|
exports.EXPORTABLE_RESOURCES = EXPORTABLE_RESOURCES;
|
|
2080
2092
|
exports.EXPORT_TYPES = EXPORT_TYPES;
|
|
2093
|
+
exports.Step = Step;
|
|
2081
2094
|
exports["default"] = ExportResourcesModal;
|
|
2082
2095
|
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);
|
|
@@ -770,20 +778,21 @@ function buildSelectedExportFilters(selectedResourceIds) {
|
|
|
770
778
|
return `id in (${formattedIds})`;
|
|
771
779
|
}
|
|
772
780
|
function validateFilters(filters) {
|
|
773
|
-
const
|
|
774
|
-
const
|
|
775
|
-
|
|
776
|
-
// Ensure only one of `
|
|
777
|
-
const validFilterState =
|
|
781
|
+
const hasWhere = 'where' in filters;
|
|
782
|
+
const hasFilters = 'filters' in filters;
|
|
783
|
+
const hasFullText = 'fullText' in filters;
|
|
784
|
+
// Ensure only one of `where` or `filters` is applied but not both or none
|
|
785
|
+
const validFilterState = hasWhere && !hasFilters || !hasWhere && hasFilters || hasFullText && filters?.fullText?.text?.trim() !== '';
|
|
778
786
|
return validFilterState;
|
|
779
787
|
}
|
|
780
|
-
function areFiltersApplied(
|
|
781
|
-
if (!
|
|
788
|
+
function areFiltersApplied(filterObject) {
|
|
789
|
+
if (!filterObject) {
|
|
782
790
|
return false;
|
|
783
791
|
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
792
|
+
let filters = filterObject.filters,
|
|
793
|
+
where = filterObject.where;
|
|
794
|
+
let hasFilters = where && _trimInstanceProperty__default["default"](where).call(where) !== '' || Boolean(_Array$isArray__default["default"](filters) && filters.length > 0 || typeof filters === 'object' && _Object$keys__default["default"](filters).length > 0);
|
|
795
|
+
return hasFilters;
|
|
787
796
|
}
|
|
788
797
|
function getInitialExportType(args) {
|
|
789
798
|
if (args.selectedResourceIds?.length) {
|
|
@@ -968,7 +977,8 @@ async function createExportOperation(_ref, asyncDispatchFn) {
|
|
|
968
977
|
locales = _ref.locales,
|
|
969
978
|
filters = _ref.filters,
|
|
970
979
|
where = _ref.where,
|
|
971
|
-
fillRows = _ref.fillRows
|
|
980
|
+
fillRows = _ref.fillRows,
|
|
981
|
+
fullText = _ref.fullText;
|
|
972
982
|
const uri = `/${projectKey}/export-operations`;
|
|
973
983
|
const response = await asyncDispatchFn(sdk.actions.post({
|
|
974
984
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.EXPORT,
|
|
@@ -985,8 +995,9 @@ async function createExportOperation(_ref, asyncDispatchFn) {
|
|
|
985
995
|
fillRows,
|
|
986
996
|
// Query predicate
|
|
987
997
|
where,
|
|
988
|
-
// Search API filters
|
|
989
|
-
filters
|
|
998
|
+
// Search API filters or Category API filters
|
|
999
|
+
filters,
|
|
1000
|
+
fullText
|
|
990
1001
|
}
|
|
991
1002
|
}));
|
|
992
1003
|
if (!response || typeof response !== 'object' || !('state' in response)) {
|
|
@@ -1029,16 +1040,16 @@ const useStartExportOperation = props => {
|
|
|
1029
1040
|
const fields = extractFieldNamesFromGroups(values.groups);
|
|
1030
1041
|
let where = undefined;
|
|
1031
1042
|
let filters = undefined;
|
|
1043
|
+
let fullText = undefined;
|
|
1032
1044
|
if (exportType === EXPORT_TYPES.SELECTED && props.selectedResourceIds?.length) {
|
|
1033
1045
|
where = buildSelectedExportFilters(props.selectedResourceIds);
|
|
1034
1046
|
} else if (exportType === EXPORT_TYPES.FILTERED) {
|
|
1035
|
-
if (props.filters
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
};
|
|
1047
|
+
if (props.filters) {
|
|
1048
|
+
;
|
|
1049
|
+
var _props$filters = props.filters;
|
|
1050
|
+
filters = _props$filters.filters;
|
|
1051
|
+
where = _props$filters.where;
|
|
1052
|
+
fullText = _props$filters.fullText;
|
|
1042
1053
|
}
|
|
1043
1054
|
}
|
|
1044
1055
|
const response = await createExportOperation({
|
|
@@ -1050,7 +1061,8 @@ const useStartExportOperation = props => {
|
|
|
1050
1061
|
fillRows: values.fillRows,
|
|
1051
1062
|
fields,
|
|
1052
1063
|
where,
|
|
1053
|
-
filters
|
|
1064
|
+
filters,
|
|
1065
|
+
fullText
|
|
1054
1066
|
}, asyncDispatch);
|
|
1055
1067
|
switch (response.state) {
|
|
1056
1068
|
case EXPORT_OPERATION_STATES.QUEUED:
|
|
@@ -1825,7 +1837,7 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1825
1837
|
onPrimaryButtonClick: formik.submitForm,
|
|
1826
1838
|
isPrimaryButtonDisabled: !formik.isValid,
|
|
1827
1839
|
labelSecondary: intl.formatMessage(messages.back),
|
|
1828
|
-
onSecondaryButtonClick: () => setCurrentStep(
|
|
1840
|
+
onSecondaryButtonClick: () => setCurrentStep(Step.FileSettings),
|
|
1829
1841
|
onClose: onClose,
|
|
1830
1842
|
size: 16,
|
|
1831
1843
|
children: jsxRuntime.jsx(fullstory.Masking.Unmask, {
|
|
@@ -1868,7 +1880,7 @@ const ExportResourcesProvider = _ref => {
|
|
|
1868
1880
|
let children = _ref.children,
|
|
1869
1881
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
1870
1882
|
const initialValues = useInitialValues(props);
|
|
1871
|
-
const _React$useState = React__default["default"].useState(
|
|
1883
|
+
const _React$useState = React__default["default"].useState(Step.FileSettings),
|
|
1872
1884
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1873
1885
|
currentStep = _React$useState2[0],
|
|
1874
1886
|
setCurrentStep = _React$useState2[1];
|
|
@@ -1882,8 +1894,8 @@ const ExportResourcesProvider = _ref => {
|
|
|
1882
1894
|
const _useStartExportOperat = useStartExportOperation(props),
|
|
1883
1895
|
startExportOperation = _useStartExportOperat.startExportOperation;
|
|
1884
1896
|
const onSubmit = async values => {
|
|
1885
|
-
if (currentStep ===
|
|
1886
|
-
setCurrentStep(
|
|
1897
|
+
if (currentStep === Step.FileSettings) {
|
|
1898
|
+
setCurrentStep(Step.FieldsSelection);
|
|
1887
1899
|
} else {
|
|
1888
1900
|
startExportOperation(values, exportType);
|
|
1889
1901
|
}
|
|
@@ -1922,8 +1934,8 @@ const CurrentStep = () => {
|
|
|
1922
1934
|
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
1923
1935
|
currentStep = _useExportResourcesMo.currentStep;
|
|
1924
1936
|
const steps = {
|
|
1925
|
-
|
|
1926
|
-
|
|
1937
|
+
'file-settings': jsxRuntime.jsx(ExportFileSettingsStep, {}),
|
|
1938
|
+
'fields-selection': jsxRuntime.jsx(ExportFieldsSelectionStep, {})
|
|
1927
1939
|
};
|
|
1928
1940
|
return steps[currentStep] || null;
|
|
1929
1941
|
};
|
|
@@ -2023,7 +2035,7 @@ const ExportResourcesModal = props => {
|
|
|
2023
2035
|
const messages = useAsyncIntlMessages(locale, loadMessages);
|
|
2024
2036
|
if (!props.isOpen || messages.isLoading) return null;
|
|
2025
2037
|
if (props.filters && !validateFilters(props.filters)) {
|
|
2026
|
-
console.error('Invalid filters prop:', props.filters, 'Filters must contain
|
|
2038
|
+
console.error('Invalid filters prop:', props.filters, 'Filters must contain one of these values: `filters` or `where`');
|
|
2027
2039
|
return null;
|
|
2028
2040
|
}
|
|
2029
2041
|
return jsxRuntime.jsx(reactIntl.IntlProvider, {
|
|
@@ -2045,5 +2057,6 @@ ExportResourcesModal.defaultProps = {
|
|
|
2045
2057
|
|
|
2046
2058
|
exports.EXPORTABLE_RESOURCES = EXPORTABLE_RESOURCES;
|
|
2047
2059
|
exports.EXPORT_TYPES = EXPORT_TYPES;
|
|
2060
|
+
exports.Step = Step;
|
|
2048
2061
|
exports["default"] = ExportResourcesModal;
|
|
2049
2062
|
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);
|
|
@@ -732,20 +739,21 @@ function buildSelectedExportFilters(selectedResourceIds) {
|
|
|
732
739
|
return `id in (${formattedIds})`;
|
|
733
740
|
}
|
|
734
741
|
function validateFilters(filters) {
|
|
735
|
-
const
|
|
736
|
-
const
|
|
737
|
-
|
|
738
|
-
// Ensure only one of `
|
|
739
|
-
const validFilterState =
|
|
742
|
+
const hasWhere = 'where' in filters;
|
|
743
|
+
const hasFilters = 'filters' in filters;
|
|
744
|
+
const hasFullText = 'fullText' in filters;
|
|
745
|
+
// Ensure only one of `where` or `filters` is applied but not both or none
|
|
746
|
+
const validFilterState = hasWhere && !hasFilters || !hasWhere && hasFilters || hasFullText && filters?.fullText?.text?.trim() !== '';
|
|
740
747
|
return validFilterState;
|
|
741
748
|
}
|
|
742
|
-
function areFiltersApplied(
|
|
743
|
-
if (!
|
|
749
|
+
function areFiltersApplied(filterObject) {
|
|
750
|
+
if (!filterObject) {
|
|
744
751
|
return false;
|
|
745
752
|
}
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
753
|
+
let filters = filterObject.filters,
|
|
754
|
+
where = filterObject.where;
|
|
755
|
+
let hasFilters = where && _trimInstanceProperty(where).call(where) !== '' || Boolean(_Array$isArray(filters) && filters.length > 0 || typeof filters === 'object' && _Object$keys(filters).length > 0);
|
|
756
|
+
return hasFilters;
|
|
749
757
|
}
|
|
750
758
|
function getInitialExportType(args) {
|
|
751
759
|
if (args.selectedResourceIds?.length) {
|
|
@@ -930,7 +938,8 @@ async function createExportOperation(_ref, asyncDispatchFn) {
|
|
|
930
938
|
locales = _ref.locales,
|
|
931
939
|
filters = _ref.filters,
|
|
932
940
|
where = _ref.where,
|
|
933
|
-
fillRows = _ref.fillRows
|
|
941
|
+
fillRows = _ref.fillRows,
|
|
942
|
+
fullText = _ref.fullText;
|
|
934
943
|
const uri = `/${projectKey}/export-operations`;
|
|
935
944
|
const response = await asyncDispatchFn(actions.post({
|
|
936
945
|
mcApiProxyTarget: MC_API_PROXY_TARGETS.EXPORT,
|
|
@@ -947,8 +956,9 @@ async function createExportOperation(_ref, asyncDispatchFn) {
|
|
|
947
956
|
fillRows,
|
|
948
957
|
// Query predicate
|
|
949
958
|
where,
|
|
950
|
-
// Search API filters
|
|
951
|
-
filters
|
|
959
|
+
// Search API filters or Category API filters
|
|
960
|
+
filters,
|
|
961
|
+
fullText
|
|
952
962
|
}
|
|
953
963
|
}));
|
|
954
964
|
if (!response || typeof response !== 'object' || !('state' in response)) {
|
|
@@ -991,16 +1001,16 @@ const useStartExportOperation = props => {
|
|
|
991
1001
|
const fields = extractFieldNamesFromGroups(values.groups);
|
|
992
1002
|
let where = undefined;
|
|
993
1003
|
let filters = undefined;
|
|
1004
|
+
let fullText = undefined;
|
|
994
1005
|
if (exportType === EXPORT_TYPES.SELECTED && props.selectedResourceIds?.length) {
|
|
995
1006
|
where = buildSelectedExportFilters(props.selectedResourceIds);
|
|
996
1007
|
} else if (exportType === EXPORT_TYPES.FILTERED) {
|
|
997
|
-
if (props.filters
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
};
|
|
1008
|
+
if (props.filters) {
|
|
1009
|
+
;
|
|
1010
|
+
var _props$filters = props.filters;
|
|
1011
|
+
filters = _props$filters.filters;
|
|
1012
|
+
where = _props$filters.where;
|
|
1013
|
+
fullText = _props$filters.fullText;
|
|
1004
1014
|
}
|
|
1005
1015
|
}
|
|
1006
1016
|
const response = await createExportOperation({
|
|
@@ -1012,7 +1022,8 @@ const useStartExportOperation = props => {
|
|
|
1012
1022
|
fillRows: values.fillRows,
|
|
1013
1023
|
fields,
|
|
1014
1024
|
where,
|
|
1015
|
-
filters
|
|
1025
|
+
filters,
|
|
1026
|
+
fullText
|
|
1016
1027
|
}, asyncDispatch);
|
|
1017
1028
|
switch (response.state) {
|
|
1018
1029
|
case EXPORT_OPERATION_STATES.QUEUED:
|
|
@@ -1729,7 +1740,7 @@ const StyledGridCard = /*#__PURE__*/_styled(Card, process.env.NODE_ENV === "prod
|
|
|
1729
1740
|
} : {
|
|
1730
1741
|
target: "e5mvpn60",
|
|
1731
1742
|
label: "StyledGridCard"
|
|
1732
|
-
})("max-height:calc(100vh - ", totalSpacing, "px);overflow:auto;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
1743
|
+
})("max-height:calc(100vh - ", totalSpacing, "px);overflow:auto;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImV4cG9ydC1maWVsZHMtc2VsZWN0aW9uLXN0ZXAudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTBDbUMiLCJmaWxlIjoiZXhwb3J0LWZpZWxkcy1zZWxlY3Rpb24tc3RlcC50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgUmVhY3QgZnJvbSAncmVhY3QnXG5pbXBvcnQgeyB1c2VJbnRsIH0gZnJvbSAncmVhY3QtaW50bCdcbmltcG9ydCB7IEZvcm1EaWFsb2cgfSBmcm9tICdAY29tbWVyY2V0b29scy1mcm9udGVuZC9hcHBsaWNhdGlvbi1jb21wb25lbnRzJ1xuaW1wb3J0IHsgdXNlQXBwbGljYXRpb25Db250ZXh0IH0gZnJvbSAnQGNvbW1lcmNldG9vbHMtZnJvbnRlbmQvYXBwbGljYXRpb24tc2hlbGwtY29ubmVjdG9ycydcbmltcG9ydCB7IHVzZVN0b3JhZ2UgfSBmcm9tICdAY29tbWVyY2V0b29scy1mcm9udGVuZC9leHBlcmltZW50YWwtY29tcG9uZW50cydcbmltcG9ydCB7IE1hc2tpbmcgYXMgRnVsbFN0b3J5TWFza2luZyB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLWZyb250ZW5kL2Z1bGxzdG9yeSdcbmltcG9ydCB7XG4gIENhcmQsXG4gIEdyaWQsXG4gIFNwYWNpbmdzLFxuICBTZWFyY2hUZXh0SW5wdXQsXG4gIGRlc2lnblRva2Vucyxcbn0g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VlPXtmaWVsZFNlYXJjaFRlcm19XG4gICAgICAgICAgICAgIG9uQ2hhbmdlPXtvblNlYXJjaENoYW5nZVRocm90dGxlZH1cbiAgICAgICAgICAgICAgb25SZXNldD17b25TZWFyY2hSZXNldH1cbiAgICAgICAgICAgICAgLy8gVE9ETzogYFNlYXJjaFRleHRJbnB1dGAgcHJvcHMgdG8gYmUgaW1wcm92ZWQuIFRoZSBgb25TdWJtaXRgIGNhbGxiYWNrIHNob3VsZG4ndCBiZSBtYW5kYXRvcnlcbiAgICAgICAgICAgICAgb25TdWJtaXQ9eygpID0+IHt9fVxuICAgICAgICAgICAgICBpZD1cImV4cG9ydC1maWVsZHMtc2VhcmNoXCJcbiAgICAgICAgICAgIC8+XG4gICAgICAgICAgICB7aGFzUmVzdWx0cyA/IChcbiAgICAgICAgICAgICAgPFN0eWxlZEdyaWRDYXJkIGluc2V0U2NhbGU9XCJub25lXCI+XG4gICAgICAgICAgICAgICAgPEdyaWRcbiAgICAgICAgICAgICAgICAgIGdyaWRBdXRvRmxvdz1cInJvd1wiXG4gICAgICAgICAgICAgICAgICBncmlkVGVtcGxhdGVDb2x1bW5zPXtgY2FsYygke2Rlc2lnblRva2Vucy5zcGFjaW5nTH0gKyAke2Rlc2lnblRva2Vucy5jb25zdHJhaW50NX0gKyAke2Rlc2lnblRva2Vucy5zcGFjaW5nTH0pIGF1dG9gfVxuICAgICAgICAgICAgICAgID5cbiAgICAgICAgICAgICAgICAgIHtmaWx0ZXJlZEdyb3Vwcy5tYXAoKGdyb3VwLCBpbmRleCkgPT4gKFxuICAgICAgICAgICAgICAgICAgICA8RmllbGRHcm91cFNlY3Rpb25cbiAgICAgICAgICAgICAgICAgICAgICBrZXk9e2dyb3VwLmdyb3VwTmFtZX1cbiAgICAgICAgICAgICAgICAgICAgICBncm91cD17Z3JvdXB9XG4gICAgICAgICAgICAgICAgICAgICAgaW5kZXg9e2luZGV4fVxuICAgICAgICAgICAgICAgICAgICAgIGZvcm1paz17Zm9ybWlrfVxuICAgICAgICAgICAgICAgICAgICAgIGlzRm9yY2VFeHBhbmRlZD17ZmllbGRTZWFyY2hUZXJtPy50cmltKCk/Lmxlbmd0aCA+IDB9XG4gICAgICAgICAgICAgICAgICAgIC8+XG4gICAgICAgICAgICAgICAgICApKX1cbiAgICAgICAgICAgICAgICA8L0dyaWQ+XG4gICAgICAgICAgICAgIDwvU3R5bGVkR3JpZENhcmQ+XG4gICAgICAgICAgICApIDogKFxuICAgICAgICAgICAgICA8Tm9TZWFyY2hSZXN1bHRzIC8+XG4gICAgICAgICAgICApfVxuICAgICAgICAgIDwvU3BhY2luZ3MuU3RhY2s+XG4gICAgICAgIDwvRXhwb3J0RmllbGRTZWxlY3Rpb25Qcm92aWRlcj5cbiAgICAgIDwvRnVsbFN0b3J5TWFza2luZy5Vbm1hc2s+XG4gICAgPC9Gb3JtRGlhbG9nPlxuICApXG59XG4iXX0= */"));
|
|
1733
1744
|
const ExportFieldsSelectionStep = () => {
|
|
1734
1745
|
const intl = useIntl();
|
|
1735
1746
|
const _React$useState = React.useState(''),
|
|
@@ -1820,7 +1831,7 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1820
1831
|
onPrimaryButtonClick: formik.submitForm,
|
|
1821
1832
|
isPrimaryButtonDisabled: !formik.isValid,
|
|
1822
1833
|
labelSecondary: intl.formatMessage(messages.back),
|
|
1823
|
-
onSecondaryButtonClick: () => setCurrentStep(
|
|
1834
|
+
onSecondaryButtonClick: () => setCurrentStep(Step.FileSettings),
|
|
1824
1835
|
onClose: onClose,
|
|
1825
1836
|
size: 16,
|
|
1826
1837
|
children: jsx(Masking.Unmask, {
|
|
@@ -1863,7 +1874,7 @@ const ExportResourcesProvider = _ref => {
|
|
|
1863
1874
|
let children = _ref.children,
|
|
1864
1875
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
1865
1876
|
const initialValues = useInitialValues(props);
|
|
1866
|
-
const _React$useState = React.useState(
|
|
1877
|
+
const _React$useState = React.useState(Step.FileSettings),
|
|
1867
1878
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1868
1879
|
currentStep = _React$useState2[0],
|
|
1869
1880
|
setCurrentStep = _React$useState2[1];
|
|
@@ -1877,8 +1888,8 @@ const ExportResourcesProvider = _ref => {
|
|
|
1877
1888
|
const _useStartExportOperat = useStartExportOperation(props),
|
|
1878
1889
|
startExportOperation = _useStartExportOperat.startExportOperation;
|
|
1879
1890
|
const onSubmit = async values => {
|
|
1880
|
-
if (currentStep ===
|
|
1881
|
-
setCurrentStep(
|
|
1891
|
+
if (currentStep === Step.FileSettings) {
|
|
1892
|
+
setCurrentStep(Step.FieldsSelection);
|
|
1882
1893
|
} else {
|
|
1883
1894
|
startExportOperation(values, exportType);
|
|
1884
1895
|
}
|
|
@@ -1917,8 +1928,8 @@ const CurrentStep = () => {
|
|
|
1917
1928
|
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
1918
1929
|
currentStep = _useExportResourcesMo.currentStep;
|
|
1919
1930
|
const steps = {
|
|
1920
|
-
|
|
1921
|
-
|
|
1931
|
+
'file-settings': jsx(ExportFileSettingsStep, {}),
|
|
1932
|
+
'fields-selection': jsx(ExportFieldsSelectionStep, {})
|
|
1922
1933
|
};
|
|
1923
1934
|
return steps[currentStep] || null;
|
|
1924
1935
|
};
|
|
@@ -2018,7 +2029,7 @@ const ExportResourcesModal = props => {
|
|
|
2018
2029
|
const messages = useAsyncIntlMessages(locale, loadMessages);
|
|
2019
2030
|
if (!props.isOpen || messages.isLoading) return null;
|
|
2020
2031
|
if (props.filters && !validateFilters(props.filters)) {
|
|
2021
|
-
console.error('Invalid filters prop:', props.filters, 'Filters must contain
|
|
2032
|
+
console.error('Invalid filters prop:', props.filters, 'Filters must contain one of these values: `filters` or `where`');
|
|
2022
2033
|
return null;
|
|
2023
2034
|
}
|
|
2024
2035
|
return jsx(IntlProvider, {
|
|
@@ -2038,4 +2049,4 @@ ExportResourcesModal.defaultProps = {
|
|
|
2038
2049
|
fieldOrder: []
|
|
2039
2050
|
};
|
|
2040
2051
|
|
|
2041
|
-
export { EXPORTABLE_RESOURCES, EXPORT_TYPES, ExportResourcesModal as default, useConvertFieldDefinitionsForExport };
|
|
2052
|
+
export { EXPORTABLE_RESOURCES, EXPORT_TYPES, Step, ExportResourcesModal as default, useConvertFieldDefinitionsForExport };
|
|
@@ -7,9 +7,13 @@ export interface ExportApiRequest {
|
|
|
7
7
|
locales: string[];
|
|
8
8
|
filters?: {
|
|
9
9
|
query: Record<string, unknown>;
|
|
10
|
-
}
|
|
10
|
+
} | Array<string>;
|
|
11
11
|
where?: string;
|
|
12
12
|
fillRows?: boolean;
|
|
13
|
+
fullText?: {
|
|
14
|
+
text: string;
|
|
15
|
+
locale: string;
|
|
16
|
+
};
|
|
13
17
|
}
|
|
14
18
|
export interface ExportApiResponse {
|
|
15
19
|
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;
|
|
@@ -33,7 +33,13 @@ export interface ExportResourcesModalProps {
|
|
|
33
33
|
}
|
|
34
34
|
export type ExportType = keyof typeof EXPORT_TYPES;
|
|
35
35
|
export type Filters = {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
filters?: {
|
|
37
|
+
query: Record<string, unknown>;
|
|
38
|
+
} | Array<string>;
|
|
39
|
+
where?: string;
|
|
40
|
+
fullText?: {
|
|
41
|
+
text: string;
|
|
42
|
+
locale: string;
|
|
43
|
+
};
|
|
38
44
|
total: number;
|
|
39
45
|
};
|
package/package.json
CHANGED