@commercetools-frontend-extensions/export-resources-modal 5.11.4 → 5.12.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/dist/commercetools-frontend-extensions-export-resources-modal.cjs.dev.js +86 -12
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.prod.js +86 -12
- package/dist/commercetools-frontend-extensions-export-resources-modal.esm.js +86 -12
- package/dist/declarations/src/@constants/export-types.d.ts +1 -0
- package/dist/declarations/src/@constants/exportable-resources.d.ts +1 -0
- package/dist/declarations/src/@constants/resource-type-messages.d.ts +1 -0
- package/dist/declarations/src/@hooks/use-start-export-operation.d.ts +1 -1
- package/dist/declarations/src/@types/export-resources-modal-context.d.ts +4 -1
- package/dist/declarations/src/@types/export-resources-modal-types.d.ts +5 -0
- package/package.json +1 -1
|
@@ -163,6 +163,11 @@ var messages = reactIntl.defineMessages({
|
|
|
163
163
|
description: 'Label for the business units modal title',
|
|
164
164
|
defaultMessage: 'Export business units'
|
|
165
165
|
},
|
|
166
|
+
'modalTitle.product-tailoring': {
|
|
167
|
+
id: 'ExportResourcesModal.modalTitle.productTailoring',
|
|
168
|
+
description: 'Label for the product tailorings modal title',
|
|
169
|
+
defaultMessage: 'Export tailored products'
|
|
170
|
+
},
|
|
166
171
|
outputFormat: {
|
|
167
172
|
id: 'ExportResourcesModal.outputFormat',
|
|
168
173
|
description: 'File format like (csv, xls, ...etc)',
|
|
@@ -387,6 +392,26 @@ var messages = reactIntl.defineMessages({
|
|
|
387
392
|
description: 'Label for Export Filtered business units',
|
|
388
393
|
defaultMessage: 'Export filtered: {total, plural, one {# business unit} other {# business units}}'
|
|
389
394
|
},
|
|
395
|
+
exportScopeAllProductTailorings: {
|
|
396
|
+
id: 'ExportResourcesModal.exportScopeAllProductTailorings',
|
|
397
|
+
description: 'Label for Export All product tailorings',
|
|
398
|
+
defaultMessage: 'Export tailored products for {total, plural, one {# product} other {# products}} in all stores'
|
|
399
|
+
},
|
|
400
|
+
exportScopeSelectedProductTailorings: {
|
|
401
|
+
id: 'ExportResourcesModal.exportScopeSelectedProductTailorings',
|
|
402
|
+
description: 'Label for Export Selected product tailorings',
|
|
403
|
+
defaultMessage: 'Export tailored products for the {total, plural, one {# selected product} other {# selected products}}'
|
|
404
|
+
},
|
|
405
|
+
exportScopeFilteredProductTailorings: {
|
|
406
|
+
id: 'ExportResourcesModal.exportScopeFilteredProductTailorings',
|
|
407
|
+
description: 'Label for Export Filtered product tailorings',
|
|
408
|
+
defaultMessage: 'Export tailored products for the {total, plural, one {# filtered product} other {# filtered products}}'
|
|
409
|
+
},
|
|
410
|
+
exportScopeSpecificStoreProductTailorings: {
|
|
411
|
+
id: 'ExportResourcesModal.exportScopeSpecificStoreProductTailorings',
|
|
412
|
+
description: 'Label for Export For a specific store option for product tailorings',
|
|
413
|
+
defaultMessage: 'Export tailored products for a specific store'
|
|
414
|
+
},
|
|
390
415
|
exportScopeAllOrders: {
|
|
391
416
|
id: 'ExportResourcesModal.exportScopeAllOrders',
|
|
392
417
|
description: 'Label for Export All orders',
|
|
@@ -677,6 +702,11 @@ var messages = reactIntl.defineMessages({
|
|
|
677
702
|
description: 'Label for query predicate option',
|
|
678
703
|
defaultMessage: 'Query predicate'
|
|
679
704
|
},
|
|
705
|
+
selectStorePlaceholder: {
|
|
706
|
+
id: 'ExportResourcesModal.selectStorePlaceholder',
|
|
707
|
+
description: 'Placeholder for the store selection dropdown',
|
|
708
|
+
defaultMessage: 'Select store'
|
|
709
|
+
},
|
|
680
710
|
invalidQueryPredicate: {
|
|
681
711
|
id: 'ExportResourcesModal.invalidQueryPredicate',
|
|
682
712
|
description: 'Error when query predicate field is not valid',
|
|
@@ -839,7 +869,8 @@ const EXPORT_TYPES = {
|
|
|
839
869
|
ALL: 'all',
|
|
840
870
|
FILTERED: 'filtered',
|
|
841
871
|
SELECTED: 'selected',
|
|
842
|
-
QUERY_PREDICATE: 'query-predicate'
|
|
872
|
+
QUERY_PREDICATE: 'query-predicate',
|
|
873
|
+
SPECIFIC_STORE: 'specific-store'
|
|
843
874
|
};
|
|
844
875
|
|
|
845
876
|
const EXPORTABLE_RESOURCES = {
|
|
@@ -850,7 +881,8 @@ const EXPORTABLE_RESOURCES = {
|
|
|
850
881
|
INVENTORY_ENTRY: 'inventory-entry',
|
|
851
882
|
ORDER: 'order',
|
|
852
883
|
CUSTOMER: 'customer',
|
|
853
|
-
BUSINESS_UNIT: 'business-unit'
|
|
884
|
+
BUSINESS_UNIT: 'business-unit',
|
|
885
|
+
PRODUCT_TAILORING: 'product-tailoring'
|
|
854
886
|
};
|
|
855
887
|
|
|
856
888
|
const OUTPUT_FORMATS = {
|
|
@@ -910,6 +942,12 @@ const resourceTypeMessages = {
|
|
|
910
942
|
exportScopeAll: messages.exportScopeAllBusinessUnits,
|
|
911
943
|
exportScopeSelected: messages.exportScopeSelectedBusinessUnits,
|
|
912
944
|
exportScopeFiltered: messages.exportScopeFilteredBusinessUnits
|
|
945
|
+
},
|
|
946
|
+
[EXPORTABLE_RESOURCES.PRODUCT_TAILORING]: {
|
|
947
|
+
exportScopeAll: messages.exportScopeAllProductTailorings,
|
|
948
|
+
exportScopeSelected: messages.exportScopeSelectedProductTailorings,
|
|
949
|
+
exportScopeFiltered: messages.exportScopeFilteredProductTailorings,
|
|
950
|
+
exportScopeSpecificStore: messages.exportScopeSpecificStoreProductTailorings
|
|
913
951
|
}
|
|
914
952
|
};
|
|
915
953
|
|
|
@@ -1141,7 +1179,8 @@ function resourceTypeToFileName(resourceType, locale) {
|
|
|
1141
1179
|
[EXPORTABLE_RESOURCES.INVENTORY_ENTRY]: 'Inventories',
|
|
1142
1180
|
[EXPORTABLE_RESOURCES.CUSTOMER]: 'Customers',
|
|
1143
1181
|
[EXPORTABLE_RESOURCES.ORDER]: 'Orders',
|
|
1144
|
-
[EXPORTABLE_RESOURCES.BUSINESS_UNIT]: 'Business_Units'
|
|
1182
|
+
[EXPORTABLE_RESOURCES.BUSINESS_UNIT]: 'Business_Units',
|
|
1183
|
+
[EXPORTABLE_RESOURCES.PRODUCT_TAILORING]: 'Product_Tailorings'
|
|
1145
1184
|
};
|
|
1146
1185
|
const displayName = resourceTypeMap[resourceType];
|
|
1147
1186
|
if (!displayName) {
|
|
@@ -1770,7 +1809,7 @@ const useStartExportOperation = props => {
|
|
|
1770
1809
|
projectKey: applicationContext.project?.key
|
|
1771
1810
|
})),
|
|
1772
1811
|
projectKey = _useApplicationContex.projectKey;
|
|
1773
|
-
const startExportOperation = async (values, exportType, fieldSelectionMode, localeOption, importedHeaders) => {
|
|
1812
|
+
const startExportOperation = async (values, exportType, fieldSelectionMode, localeOption, importedHeaders, selectedStoreKey) => {
|
|
1774
1813
|
try {
|
|
1775
1814
|
if (!projectKey) throw new Error('Project key is missing');
|
|
1776
1815
|
let fields = [];
|
|
@@ -1793,6 +1832,8 @@ const useStartExportOperation = props => {
|
|
|
1793
1832
|
} else if (exportType === EXPORT_TYPES.QUERY_PREDICATE) {
|
|
1794
1833
|
var _context;
|
|
1795
1834
|
where = _trimInstanceProperty__default["default"](_context = values.queryPredicate).call(_context);
|
|
1835
|
+
} else if (exportType === EXPORT_TYPES.SPECIFIC_STORE) {
|
|
1836
|
+
where = `store(key="${selectedStoreKey}")`;
|
|
1796
1837
|
}
|
|
1797
1838
|
where = mergeWhereClause(props.baseFilters?.where, where);
|
|
1798
1839
|
let locales = undefined;
|
|
@@ -2154,6 +2195,7 @@ const ExportPreferenceSection = () => {
|
|
|
2154
2195
|
function ownKeys$8(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2155
2196
|
function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$8(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$8(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
2156
2197
|
function ExportScopeSection() {
|
|
2198
|
+
const intl = reactIntl.useIntl();
|
|
2157
2199
|
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
2158
2200
|
formik = _useExportResourcesMo.formik,
|
|
2159
2201
|
exportType = _useExportResourcesMo.exportType,
|
|
@@ -2164,7 +2206,10 @@ function ExportScopeSection() {
|
|
|
2164
2206
|
setExportType = _useExportResourcesMo.setExportType,
|
|
2165
2207
|
resourceType = _useExportResourcesMo.resourceType,
|
|
2166
2208
|
hideExportSelectedResourcesOption = _useExportResourcesMo.hideExportSelectedResourcesOption,
|
|
2167
|
-
showQueryPredicateOption = _useExportResourcesMo.showQueryPredicateOption
|
|
2209
|
+
showQueryPredicateOption = _useExportResourcesMo.showQueryPredicateOption,
|
|
2210
|
+
stores = _useExportResourcesMo.stores,
|
|
2211
|
+
selectedStoreKey = _useExportResourcesMo.selectedStoreKey,
|
|
2212
|
+
setSelectedStoreKey = _useExportResourcesMo.setSelectedStoreKey;
|
|
2168
2213
|
const shouldShowQueryPredicateField = exportType === EXPORT_TYPES.QUERY_PREDICATE;
|
|
2169
2214
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2170
2215
|
children: [jsxRuntime.jsxs(uiKit.RadioInput.Group, {
|
|
@@ -2212,7 +2257,26 @@ function ExportScopeSection() {
|
|
|
2212
2257
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
2213
2258
|
intlMessage: messages.queryPredicate
|
|
2214
2259
|
})
|
|
2260
|
+
}), stores && stores.length > 0 && resourceTypeMessages[resourceType].exportScopeSpecificStore && jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
2261
|
+
value: EXPORT_TYPES.SPECIFIC_STORE,
|
|
2262
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
2263
|
+
intlMessage: resourceTypeMessages[resourceType].exportScopeSpecificStore
|
|
2264
|
+
})
|
|
2215
2265
|
})]
|
|
2266
|
+
}), stores && stores.length > 0 && exportType !== EXPORT_TYPES.QUERY_PREDICATE && jsxRuntime.jsx(uiKit.SelectField, {
|
|
2267
|
+
name: "selectedStoreKey",
|
|
2268
|
+
title: "",
|
|
2269
|
+
horizontalConstraint: 7,
|
|
2270
|
+
isDisabled: exportType !== EXPORT_TYPES.SPECIFIC_STORE,
|
|
2271
|
+
value: selectedStoreKey,
|
|
2272
|
+
onChange: event => setSelectedStoreKey(event.target.value),
|
|
2273
|
+
options: _mapInstanceProperty__default["default"](stores).call(stores, store => ({
|
|
2274
|
+
value: store.key,
|
|
2275
|
+
label: store.name
|
|
2276
|
+
})),
|
|
2277
|
+
placeholder: intl.formatMessage(messages.selectStorePlaceholder),
|
|
2278
|
+
menuPortalTarget: document.body,
|
|
2279
|
+
menuPortalZIndex: Z_INDEX_DROPDOWN
|
|
2216
2280
|
}), shouldShowQueryPredicateField && jsxRuntime.jsx(uiKit.TextField, {
|
|
2217
2281
|
name: "queryPredicate",
|
|
2218
2282
|
"data-testid": "query-predicate-field",
|
|
@@ -2234,7 +2298,10 @@ const ExportFileSettingsStep = () => {
|
|
|
2234
2298
|
resourceType = _useExportResourcesMo.resourceType,
|
|
2235
2299
|
setFieldSelectionMode = _useExportResourcesMo.setFieldSelectionMode,
|
|
2236
2300
|
setLocaleOption = _useExportResourcesMo.setLocaleOption,
|
|
2237
|
-
onClose = _useExportResourcesMo.onClose
|
|
2301
|
+
onClose = _useExportResourcesMo.onClose,
|
|
2302
|
+
exportType = _useExportResourcesMo.exportType,
|
|
2303
|
+
selectedStoreKey = _useExportResourcesMo.selectedStoreKey;
|
|
2304
|
+
const isStoreSelectionMissing = exportType === EXPORT_TYPES.SPECIFIC_STORE && !selectedStoreKey;
|
|
2238
2305
|
const handleOutputFormatChange = event => {
|
|
2239
2306
|
formik.handleChange(event);
|
|
2240
2307
|
if (event.target.value === OUTPUT_FORMATS.JSON) {
|
|
@@ -2254,7 +2321,7 @@ const ExportFileSettingsStep = () => {
|
|
|
2254
2321
|
})}: ${intl.formatMessage(messages.selectContentToExport)}`,
|
|
2255
2322
|
iconLeftPrimaryButton: jsxRuntime.jsx(uiKit.AngleRightIcon, {}),
|
|
2256
2323
|
onPrimaryButtonClick: formik.submitForm,
|
|
2257
|
-
isPrimaryButtonDisabled: !formik.isValid,
|
|
2324
|
+
isPrimaryButtonDisabled: !formik.isValid || isStoreSelectionMissing,
|
|
2258
2325
|
onSecondaryButtonClick: onClose,
|
|
2259
2326
|
onClose: onClose,
|
|
2260
2327
|
size: 16,
|
|
@@ -3092,10 +3159,14 @@ const ExportResourcesProvider = _ref => {
|
|
|
3092
3159
|
_React$useState0 = _slicedToArray(_React$useState9, 2),
|
|
3093
3160
|
importedHeaders = _React$useState0[0],
|
|
3094
3161
|
setImportedHeaders = _React$useState0[1];
|
|
3095
|
-
const _React$useState1 = React__default["default"].useState(
|
|
3162
|
+
const _React$useState1 = React__default["default"].useState(''),
|
|
3096
3163
|
_React$useState10 = _slicedToArray(_React$useState1, 2),
|
|
3097
|
-
|
|
3098
|
-
|
|
3164
|
+
selectedStoreKey = _React$useState10[0],
|
|
3165
|
+
setSelectedStoreKey = _React$useState10[1];
|
|
3166
|
+
const _React$useState11 = React__default["default"].useState([]),
|
|
3167
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
3168
|
+
validationErrors = _React$useState12[0],
|
|
3169
|
+
setValidationErrors = _React$useState12[1];
|
|
3099
3170
|
const _useStartExportOperat = useStartExportOperation(props),
|
|
3100
3171
|
startExportOperation = _useStartExportOperat.startExportOperation;
|
|
3101
3172
|
const _useValidateExportOpe = useValidateExportOperation(),
|
|
@@ -3151,7 +3222,7 @@ const ExportResourcesProvider = _ref => {
|
|
|
3151
3222
|
setCurrentStep(Step.ValidationErrors);
|
|
3152
3223
|
}
|
|
3153
3224
|
} else {
|
|
3154
|
-
startExportOperation(values, exportType, fieldSelectionMode, localeOption, importedHeaders);
|
|
3225
|
+
startExportOperation(values, exportType, fieldSelectionMode, localeOption, importedHeaders, selectedStoreKey);
|
|
3155
3226
|
}
|
|
3156
3227
|
}
|
|
3157
3228
|
});
|
|
@@ -3179,7 +3250,10 @@ const ExportResourcesProvider = _ref => {
|
|
|
3179
3250
|
setLocaleOption,
|
|
3180
3251
|
importedHeaders,
|
|
3181
3252
|
setImportedHeaders,
|
|
3182
|
-
validationErrors
|
|
3253
|
+
validationErrors,
|
|
3254
|
+
stores: props.stores,
|
|
3255
|
+
selectedStoreKey,
|
|
3256
|
+
setSelectedStoreKey
|
|
3183
3257
|
},
|
|
3184
3258
|
children: children
|
|
3185
3259
|
});
|
|
@@ -163,6 +163,11 @@ var messages = reactIntl.defineMessages({
|
|
|
163
163
|
description: 'Label for the business units modal title',
|
|
164
164
|
defaultMessage: 'Export business units'
|
|
165
165
|
},
|
|
166
|
+
'modalTitle.product-tailoring': {
|
|
167
|
+
id: 'ExportResourcesModal.modalTitle.productTailoring',
|
|
168
|
+
description: 'Label for the product tailorings modal title',
|
|
169
|
+
defaultMessage: 'Export tailored products'
|
|
170
|
+
},
|
|
166
171
|
outputFormat: {
|
|
167
172
|
id: 'ExportResourcesModal.outputFormat',
|
|
168
173
|
description: 'File format like (csv, xls, ...etc)',
|
|
@@ -387,6 +392,26 @@ var messages = reactIntl.defineMessages({
|
|
|
387
392
|
description: 'Label for Export Filtered business units',
|
|
388
393
|
defaultMessage: 'Export filtered: {total, plural, one {# business unit} other {# business units}}'
|
|
389
394
|
},
|
|
395
|
+
exportScopeAllProductTailorings: {
|
|
396
|
+
id: 'ExportResourcesModal.exportScopeAllProductTailorings',
|
|
397
|
+
description: 'Label for Export All product tailorings',
|
|
398
|
+
defaultMessage: 'Export tailored products for {total, plural, one {# product} other {# products}} in all stores'
|
|
399
|
+
},
|
|
400
|
+
exportScopeSelectedProductTailorings: {
|
|
401
|
+
id: 'ExportResourcesModal.exportScopeSelectedProductTailorings',
|
|
402
|
+
description: 'Label for Export Selected product tailorings',
|
|
403
|
+
defaultMessage: 'Export tailored products for the {total, plural, one {# selected product} other {# selected products}}'
|
|
404
|
+
},
|
|
405
|
+
exportScopeFilteredProductTailorings: {
|
|
406
|
+
id: 'ExportResourcesModal.exportScopeFilteredProductTailorings',
|
|
407
|
+
description: 'Label for Export Filtered product tailorings',
|
|
408
|
+
defaultMessage: 'Export tailored products for the {total, plural, one {# filtered product} other {# filtered products}}'
|
|
409
|
+
},
|
|
410
|
+
exportScopeSpecificStoreProductTailorings: {
|
|
411
|
+
id: 'ExportResourcesModal.exportScopeSpecificStoreProductTailorings',
|
|
412
|
+
description: 'Label for Export For a specific store option for product tailorings',
|
|
413
|
+
defaultMessage: 'Export tailored products for a specific store'
|
|
414
|
+
},
|
|
390
415
|
exportScopeAllOrders: {
|
|
391
416
|
id: 'ExportResourcesModal.exportScopeAllOrders',
|
|
392
417
|
description: 'Label for Export All orders',
|
|
@@ -677,6 +702,11 @@ var messages = reactIntl.defineMessages({
|
|
|
677
702
|
description: 'Label for query predicate option',
|
|
678
703
|
defaultMessage: 'Query predicate'
|
|
679
704
|
},
|
|
705
|
+
selectStorePlaceholder: {
|
|
706
|
+
id: 'ExportResourcesModal.selectStorePlaceholder',
|
|
707
|
+
description: 'Placeholder for the store selection dropdown',
|
|
708
|
+
defaultMessage: 'Select store'
|
|
709
|
+
},
|
|
680
710
|
invalidQueryPredicate: {
|
|
681
711
|
id: 'ExportResourcesModal.invalidQueryPredicate',
|
|
682
712
|
description: 'Error when query predicate field is not valid',
|
|
@@ -839,7 +869,8 @@ const EXPORT_TYPES = {
|
|
|
839
869
|
ALL: 'all',
|
|
840
870
|
FILTERED: 'filtered',
|
|
841
871
|
SELECTED: 'selected',
|
|
842
|
-
QUERY_PREDICATE: 'query-predicate'
|
|
872
|
+
QUERY_PREDICATE: 'query-predicate',
|
|
873
|
+
SPECIFIC_STORE: 'specific-store'
|
|
843
874
|
};
|
|
844
875
|
|
|
845
876
|
const EXPORTABLE_RESOURCES = {
|
|
@@ -850,7 +881,8 @@ const EXPORTABLE_RESOURCES = {
|
|
|
850
881
|
INVENTORY_ENTRY: 'inventory-entry',
|
|
851
882
|
ORDER: 'order',
|
|
852
883
|
CUSTOMER: 'customer',
|
|
853
|
-
BUSINESS_UNIT: 'business-unit'
|
|
884
|
+
BUSINESS_UNIT: 'business-unit',
|
|
885
|
+
PRODUCT_TAILORING: 'product-tailoring'
|
|
854
886
|
};
|
|
855
887
|
|
|
856
888
|
const OUTPUT_FORMATS = {
|
|
@@ -910,6 +942,12 @@ const resourceTypeMessages = {
|
|
|
910
942
|
exportScopeAll: messages.exportScopeAllBusinessUnits,
|
|
911
943
|
exportScopeSelected: messages.exportScopeSelectedBusinessUnits,
|
|
912
944
|
exportScopeFiltered: messages.exportScopeFilteredBusinessUnits
|
|
945
|
+
},
|
|
946
|
+
[EXPORTABLE_RESOURCES.PRODUCT_TAILORING]: {
|
|
947
|
+
exportScopeAll: messages.exportScopeAllProductTailorings,
|
|
948
|
+
exportScopeSelected: messages.exportScopeSelectedProductTailorings,
|
|
949
|
+
exportScopeFiltered: messages.exportScopeFilteredProductTailorings,
|
|
950
|
+
exportScopeSpecificStore: messages.exportScopeSpecificStoreProductTailorings
|
|
913
951
|
}
|
|
914
952
|
};
|
|
915
953
|
|
|
@@ -1141,7 +1179,8 @@ function resourceTypeToFileName(resourceType, locale) {
|
|
|
1141
1179
|
[EXPORTABLE_RESOURCES.INVENTORY_ENTRY]: 'Inventories',
|
|
1142
1180
|
[EXPORTABLE_RESOURCES.CUSTOMER]: 'Customers',
|
|
1143
1181
|
[EXPORTABLE_RESOURCES.ORDER]: 'Orders',
|
|
1144
|
-
[EXPORTABLE_RESOURCES.BUSINESS_UNIT]: 'Business_Units'
|
|
1182
|
+
[EXPORTABLE_RESOURCES.BUSINESS_UNIT]: 'Business_Units',
|
|
1183
|
+
[EXPORTABLE_RESOURCES.PRODUCT_TAILORING]: 'Product_Tailorings'
|
|
1145
1184
|
};
|
|
1146
1185
|
const displayName = resourceTypeMap[resourceType];
|
|
1147
1186
|
if (!displayName) {
|
|
@@ -1770,7 +1809,7 @@ const useStartExportOperation = props => {
|
|
|
1770
1809
|
projectKey: applicationContext.project?.key
|
|
1771
1810
|
})),
|
|
1772
1811
|
projectKey = _useApplicationContex.projectKey;
|
|
1773
|
-
const startExportOperation = async (values, exportType, fieldSelectionMode, localeOption, importedHeaders) => {
|
|
1812
|
+
const startExportOperation = async (values, exportType, fieldSelectionMode, localeOption, importedHeaders, selectedStoreKey) => {
|
|
1774
1813
|
try {
|
|
1775
1814
|
if (!projectKey) throw new Error('Project key is missing');
|
|
1776
1815
|
let fields = [];
|
|
@@ -1793,6 +1832,8 @@ const useStartExportOperation = props => {
|
|
|
1793
1832
|
} else if (exportType === EXPORT_TYPES.QUERY_PREDICATE) {
|
|
1794
1833
|
var _context;
|
|
1795
1834
|
where = _trimInstanceProperty__default["default"](_context = values.queryPredicate).call(_context);
|
|
1835
|
+
} else if (exportType === EXPORT_TYPES.SPECIFIC_STORE) {
|
|
1836
|
+
where = `store(key="${selectedStoreKey}")`;
|
|
1796
1837
|
}
|
|
1797
1838
|
where = mergeWhereClause(props.baseFilters?.where, where);
|
|
1798
1839
|
let locales = undefined;
|
|
@@ -2154,6 +2195,7 @@ const ExportPreferenceSection = () => {
|
|
|
2154
2195
|
function ownKeys$8(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2155
2196
|
function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$8(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$8(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
2156
2197
|
function ExportScopeSection() {
|
|
2198
|
+
const intl = reactIntl.useIntl();
|
|
2157
2199
|
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
2158
2200
|
formik = _useExportResourcesMo.formik,
|
|
2159
2201
|
exportType = _useExportResourcesMo.exportType,
|
|
@@ -2164,7 +2206,10 @@ function ExportScopeSection() {
|
|
|
2164
2206
|
setExportType = _useExportResourcesMo.setExportType,
|
|
2165
2207
|
resourceType = _useExportResourcesMo.resourceType,
|
|
2166
2208
|
hideExportSelectedResourcesOption = _useExportResourcesMo.hideExportSelectedResourcesOption,
|
|
2167
|
-
showQueryPredicateOption = _useExportResourcesMo.showQueryPredicateOption
|
|
2209
|
+
showQueryPredicateOption = _useExportResourcesMo.showQueryPredicateOption,
|
|
2210
|
+
stores = _useExportResourcesMo.stores,
|
|
2211
|
+
selectedStoreKey = _useExportResourcesMo.selectedStoreKey,
|
|
2212
|
+
setSelectedStoreKey = _useExportResourcesMo.setSelectedStoreKey;
|
|
2168
2213
|
const shouldShowQueryPredicateField = exportType === EXPORT_TYPES.QUERY_PREDICATE;
|
|
2169
2214
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2170
2215
|
children: [jsxRuntime.jsxs(uiKit.RadioInput.Group, {
|
|
@@ -2212,7 +2257,26 @@ function ExportScopeSection() {
|
|
|
2212
2257
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
2213
2258
|
intlMessage: messages.queryPredicate
|
|
2214
2259
|
})
|
|
2260
|
+
}), stores && stores.length > 0 && resourceTypeMessages[resourceType].exportScopeSpecificStore && jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
2261
|
+
value: EXPORT_TYPES.SPECIFIC_STORE,
|
|
2262
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
2263
|
+
intlMessage: resourceTypeMessages[resourceType].exportScopeSpecificStore
|
|
2264
|
+
})
|
|
2215
2265
|
})]
|
|
2266
|
+
}), stores && stores.length > 0 && exportType !== EXPORT_TYPES.QUERY_PREDICATE && jsxRuntime.jsx(uiKit.SelectField, {
|
|
2267
|
+
name: "selectedStoreKey",
|
|
2268
|
+
title: "",
|
|
2269
|
+
horizontalConstraint: 7,
|
|
2270
|
+
isDisabled: exportType !== EXPORT_TYPES.SPECIFIC_STORE,
|
|
2271
|
+
value: selectedStoreKey,
|
|
2272
|
+
onChange: event => setSelectedStoreKey(event.target.value),
|
|
2273
|
+
options: _mapInstanceProperty__default["default"](stores).call(stores, store => ({
|
|
2274
|
+
value: store.key,
|
|
2275
|
+
label: store.name
|
|
2276
|
+
})),
|
|
2277
|
+
placeholder: intl.formatMessage(messages.selectStorePlaceholder),
|
|
2278
|
+
menuPortalTarget: document.body,
|
|
2279
|
+
menuPortalZIndex: Z_INDEX_DROPDOWN
|
|
2216
2280
|
}), shouldShowQueryPredicateField && jsxRuntime.jsx(uiKit.TextField, {
|
|
2217
2281
|
name: "queryPredicate",
|
|
2218
2282
|
"data-testid": "query-predicate-field",
|
|
@@ -2234,7 +2298,10 @@ const ExportFileSettingsStep = () => {
|
|
|
2234
2298
|
resourceType = _useExportResourcesMo.resourceType,
|
|
2235
2299
|
setFieldSelectionMode = _useExportResourcesMo.setFieldSelectionMode,
|
|
2236
2300
|
setLocaleOption = _useExportResourcesMo.setLocaleOption,
|
|
2237
|
-
onClose = _useExportResourcesMo.onClose
|
|
2301
|
+
onClose = _useExportResourcesMo.onClose,
|
|
2302
|
+
exportType = _useExportResourcesMo.exportType,
|
|
2303
|
+
selectedStoreKey = _useExportResourcesMo.selectedStoreKey;
|
|
2304
|
+
const isStoreSelectionMissing = exportType === EXPORT_TYPES.SPECIFIC_STORE && !selectedStoreKey;
|
|
2238
2305
|
const handleOutputFormatChange = event => {
|
|
2239
2306
|
formik.handleChange(event);
|
|
2240
2307
|
if (event.target.value === OUTPUT_FORMATS.JSON) {
|
|
@@ -2254,7 +2321,7 @@ const ExportFileSettingsStep = () => {
|
|
|
2254
2321
|
})}: ${intl.formatMessage(messages.selectContentToExport)}`,
|
|
2255
2322
|
iconLeftPrimaryButton: jsxRuntime.jsx(uiKit.AngleRightIcon, {}),
|
|
2256
2323
|
onPrimaryButtonClick: formik.submitForm,
|
|
2257
|
-
isPrimaryButtonDisabled: !formik.isValid,
|
|
2324
|
+
isPrimaryButtonDisabled: !formik.isValid || isStoreSelectionMissing,
|
|
2258
2325
|
onSecondaryButtonClick: onClose,
|
|
2259
2326
|
onClose: onClose,
|
|
2260
2327
|
size: 16,
|
|
@@ -3059,10 +3126,14 @@ const ExportResourcesProvider = _ref => {
|
|
|
3059
3126
|
_React$useState0 = _slicedToArray(_React$useState9, 2),
|
|
3060
3127
|
importedHeaders = _React$useState0[0],
|
|
3061
3128
|
setImportedHeaders = _React$useState0[1];
|
|
3062
|
-
const _React$useState1 = React__default["default"].useState(
|
|
3129
|
+
const _React$useState1 = React__default["default"].useState(''),
|
|
3063
3130
|
_React$useState10 = _slicedToArray(_React$useState1, 2),
|
|
3064
|
-
|
|
3065
|
-
|
|
3131
|
+
selectedStoreKey = _React$useState10[0],
|
|
3132
|
+
setSelectedStoreKey = _React$useState10[1];
|
|
3133
|
+
const _React$useState11 = React__default["default"].useState([]),
|
|
3134
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
3135
|
+
validationErrors = _React$useState12[0],
|
|
3136
|
+
setValidationErrors = _React$useState12[1];
|
|
3066
3137
|
const _useStartExportOperat = useStartExportOperation(props),
|
|
3067
3138
|
startExportOperation = _useStartExportOperat.startExportOperation;
|
|
3068
3139
|
const _useValidateExportOpe = useValidateExportOperation(),
|
|
@@ -3118,7 +3189,7 @@ const ExportResourcesProvider = _ref => {
|
|
|
3118
3189
|
setCurrentStep(Step.ValidationErrors);
|
|
3119
3190
|
}
|
|
3120
3191
|
} else {
|
|
3121
|
-
startExportOperation(values, exportType, fieldSelectionMode, localeOption, importedHeaders);
|
|
3192
|
+
startExportOperation(values, exportType, fieldSelectionMode, localeOption, importedHeaders, selectedStoreKey);
|
|
3122
3193
|
}
|
|
3123
3194
|
}
|
|
3124
3195
|
});
|
|
@@ -3146,7 +3217,10 @@ const ExportResourcesProvider = _ref => {
|
|
|
3146
3217
|
setLocaleOption,
|
|
3147
3218
|
importedHeaders,
|
|
3148
3219
|
setImportedHeaders,
|
|
3149
|
-
validationErrors
|
|
3220
|
+
validationErrors,
|
|
3221
|
+
stores: props.stores,
|
|
3222
|
+
selectedStoreKey,
|
|
3223
|
+
setSelectedStoreKey
|
|
3150
3224
|
},
|
|
3151
3225
|
children: children
|
|
3152
3226
|
});
|
|
@@ -120,6 +120,11 @@ var messages = defineMessages({
|
|
|
120
120
|
description: 'Label for the business units modal title',
|
|
121
121
|
defaultMessage: 'Export business units'
|
|
122
122
|
},
|
|
123
|
+
'modalTitle.product-tailoring': {
|
|
124
|
+
id: 'ExportResourcesModal.modalTitle.productTailoring',
|
|
125
|
+
description: 'Label for the product tailorings modal title',
|
|
126
|
+
defaultMessage: 'Export tailored products'
|
|
127
|
+
},
|
|
123
128
|
outputFormat: {
|
|
124
129
|
id: 'ExportResourcesModal.outputFormat',
|
|
125
130
|
description: 'File format like (csv, xls, ...etc)',
|
|
@@ -344,6 +349,26 @@ var messages = defineMessages({
|
|
|
344
349
|
description: 'Label for Export Filtered business units',
|
|
345
350
|
defaultMessage: 'Export filtered: {total, plural, one {# business unit} other {# business units}}'
|
|
346
351
|
},
|
|
352
|
+
exportScopeAllProductTailorings: {
|
|
353
|
+
id: 'ExportResourcesModal.exportScopeAllProductTailorings',
|
|
354
|
+
description: 'Label for Export All product tailorings',
|
|
355
|
+
defaultMessage: 'Export tailored products for {total, plural, one {# product} other {# products}} in all stores'
|
|
356
|
+
},
|
|
357
|
+
exportScopeSelectedProductTailorings: {
|
|
358
|
+
id: 'ExportResourcesModal.exportScopeSelectedProductTailorings',
|
|
359
|
+
description: 'Label for Export Selected product tailorings',
|
|
360
|
+
defaultMessage: 'Export tailored products for the {total, plural, one {# selected product} other {# selected products}}'
|
|
361
|
+
},
|
|
362
|
+
exportScopeFilteredProductTailorings: {
|
|
363
|
+
id: 'ExportResourcesModal.exportScopeFilteredProductTailorings',
|
|
364
|
+
description: 'Label for Export Filtered product tailorings',
|
|
365
|
+
defaultMessage: 'Export tailored products for the {total, plural, one {# filtered product} other {# filtered products}}'
|
|
366
|
+
},
|
|
367
|
+
exportScopeSpecificStoreProductTailorings: {
|
|
368
|
+
id: 'ExportResourcesModal.exportScopeSpecificStoreProductTailorings',
|
|
369
|
+
description: 'Label for Export For a specific store option for product tailorings',
|
|
370
|
+
defaultMessage: 'Export tailored products for a specific store'
|
|
371
|
+
},
|
|
347
372
|
exportScopeAllOrders: {
|
|
348
373
|
id: 'ExportResourcesModal.exportScopeAllOrders',
|
|
349
374
|
description: 'Label for Export All orders',
|
|
@@ -634,6 +659,11 @@ var messages = defineMessages({
|
|
|
634
659
|
description: 'Label for query predicate option',
|
|
635
660
|
defaultMessage: 'Query predicate'
|
|
636
661
|
},
|
|
662
|
+
selectStorePlaceholder: {
|
|
663
|
+
id: 'ExportResourcesModal.selectStorePlaceholder',
|
|
664
|
+
description: 'Placeholder for the store selection dropdown',
|
|
665
|
+
defaultMessage: 'Select store'
|
|
666
|
+
},
|
|
637
667
|
invalidQueryPredicate: {
|
|
638
668
|
id: 'ExportResourcesModal.invalidQueryPredicate',
|
|
639
669
|
description: 'Error when query predicate field is not valid',
|
|
@@ -796,7 +826,8 @@ const EXPORT_TYPES = {
|
|
|
796
826
|
ALL: 'all',
|
|
797
827
|
FILTERED: 'filtered',
|
|
798
828
|
SELECTED: 'selected',
|
|
799
|
-
QUERY_PREDICATE: 'query-predicate'
|
|
829
|
+
QUERY_PREDICATE: 'query-predicate',
|
|
830
|
+
SPECIFIC_STORE: 'specific-store'
|
|
800
831
|
};
|
|
801
832
|
|
|
802
833
|
const EXPORTABLE_RESOURCES = {
|
|
@@ -807,7 +838,8 @@ const EXPORTABLE_RESOURCES = {
|
|
|
807
838
|
INVENTORY_ENTRY: 'inventory-entry',
|
|
808
839
|
ORDER: 'order',
|
|
809
840
|
CUSTOMER: 'customer',
|
|
810
|
-
BUSINESS_UNIT: 'business-unit'
|
|
841
|
+
BUSINESS_UNIT: 'business-unit',
|
|
842
|
+
PRODUCT_TAILORING: 'product-tailoring'
|
|
811
843
|
};
|
|
812
844
|
|
|
813
845
|
const OUTPUT_FORMATS = {
|
|
@@ -867,6 +899,12 @@ const resourceTypeMessages = {
|
|
|
867
899
|
exportScopeAll: messages.exportScopeAllBusinessUnits,
|
|
868
900
|
exportScopeSelected: messages.exportScopeSelectedBusinessUnits,
|
|
869
901
|
exportScopeFiltered: messages.exportScopeFilteredBusinessUnits
|
|
902
|
+
},
|
|
903
|
+
[EXPORTABLE_RESOURCES.PRODUCT_TAILORING]: {
|
|
904
|
+
exportScopeAll: messages.exportScopeAllProductTailorings,
|
|
905
|
+
exportScopeSelected: messages.exportScopeSelectedProductTailorings,
|
|
906
|
+
exportScopeFiltered: messages.exportScopeFilteredProductTailorings,
|
|
907
|
+
exportScopeSpecificStore: messages.exportScopeSpecificStoreProductTailorings
|
|
870
908
|
}
|
|
871
909
|
};
|
|
872
910
|
|
|
@@ -1098,7 +1136,8 @@ function resourceTypeToFileName(resourceType, locale) {
|
|
|
1098
1136
|
[EXPORTABLE_RESOURCES.INVENTORY_ENTRY]: 'Inventories',
|
|
1099
1137
|
[EXPORTABLE_RESOURCES.CUSTOMER]: 'Customers',
|
|
1100
1138
|
[EXPORTABLE_RESOURCES.ORDER]: 'Orders',
|
|
1101
|
-
[EXPORTABLE_RESOURCES.BUSINESS_UNIT]: 'Business_Units'
|
|
1139
|
+
[EXPORTABLE_RESOURCES.BUSINESS_UNIT]: 'Business_Units',
|
|
1140
|
+
[EXPORTABLE_RESOURCES.PRODUCT_TAILORING]: 'Product_Tailorings'
|
|
1102
1141
|
};
|
|
1103
1142
|
const displayName = resourceTypeMap[resourceType];
|
|
1104
1143
|
if (!displayName) {
|
|
@@ -1727,7 +1766,7 @@ const useStartExportOperation = props => {
|
|
|
1727
1766
|
projectKey: applicationContext.project?.key
|
|
1728
1767
|
})),
|
|
1729
1768
|
projectKey = _useApplicationContex.projectKey;
|
|
1730
|
-
const startExportOperation = async (values, exportType, fieldSelectionMode, localeOption, importedHeaders) => {
|
|
1769
|
+
const startExportOperation = async (values, exportType, fieldSelectionMode, localeOption, importedHeaders, selectedStoreKey) => {
|
|
1731
1770
|
try {
|
|
1732
1771
|
if (!projectKey) throw new Error('Project key is missing');
|
|
1733
1772
|
let fields = [];
|
|
@@ -1750,6 +1789,8 @@ const useStartExportOperation = props => {
|
|
|
1750
1789
|
} else if (exportType === EXPORT_TYPES.QUERY_PREDICATE) {
|
|
1751
1790
|
var _context;
|
|
1752
1791
|
where = _trimInstanceProperty(_context = values.queryPredicate).call(_context);
|
|
1792
|
+
} else if (exportType === EXPORT_TYPES.SPECIFIC_STORE) {
|
|
1793
|
+
where = `store(key="${selectedStoreKey}")`;
|
|
1753
1794
|
}
|
|
1754
1795
|
where = mergeWhereClause(props.baseFilters?.where, where);
|
|
1755
1796
|
let locales = undefined;
|
|
@@ -2111,6 +2152,7 @@ const ExportPreferenceSection = () => {
|
|
|
2111
2152
|
function ownKeys$8(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2112
2153
|
function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$8(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$8(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2113
2154
|
function ExportScopeSection() {
|
|
2155
|
+
const intl = useIntl();
|
|
2114
2156
|
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
2115
2157
|
formik = _useExportResourcesMo.formik,
|
|
2116
2158
|
exportType = _useExportResourcesMo.exportType,
|
|
@@ -2121,7 +2163,10 @@ function ExportScopeSection() {
|
|
|
2121
2163
|
setExportType = _useExportResourcesMo.setExportType,
|
|
2122
2164
|
resourceType = _useExportResourcesMo.resourceType,
|
|
2123
2165
|
hideExportSelectedResourcesOption = _useExportResourcesMo.hideExportSelectedResourcesOption,
|
|
2124
|
-
showQueryPredicateOption = _useExportResourcesMo.showQueryPredicateOption
|
|
2166
|
+
showQueryPredicateOption = _useExportResourcesMo.showQueryPredicateOption,
|
|
2167
|
+
stores = _useExportResourcesMo.stores,
|
|
2168
|
+
selectedStoreKey = _useExportResourcesMo.selectedStoreKey,
|
|
2169
|
+
setSelectedStoreKey = _useExportResourcesMo.setSelectedStoreKey;
|
|
2125
2170
|
const shouldShowQueryPredicateField = exportType === EXPORT_TYPES.QUERY_PREDICATE;
|
|
2126
2171
|
return jsxs(Fragment, {
|
|
2127
2172
|
children: [jsxs(RadioInput.Group, {
|
|
@@ -2169,7 +2214,26 @@ function ExportScopeSection() {
|
|
|
2169
2214
|
children: jsx(Text.Body, {
|
|
2170
2215
|
intlMessage: messages.queryPredicate
|
|
2171
2216
|
})
|
|
2217
|
+
}), stores && stores.length > 0 && resourceTypeMessages[resourceType].exportScopeSpecificStore && jsx(RadioInput.Option, {
|
|
2218
|
+
value: EXPORT_TYPES.SPECIFIC_STORE,
|
|
2219
|
+
children: jsx(Text.Body, {
|
|
2220
|
+
intlMessage: resourceTypeMessages[resourceType].exportScopeSpecificStore
|
|
2221
|
+
})
|
|
2172
2222
|
})]
|
|
2223
|
+
}), stores && stores.length > 0 && exportType !== EXPORT_TYPES.QUERY_PREDICATE && jsx(SelectField, {
|
|
2224
|
+
name: "selectedStoreKey",
|
|
2225
|
+
title: "",
|
|
2226
|
+
horizontalConstraint: 7,
|
|
2227
|
+
isDisabled: exportType !== EXPORT_TYPES.SPECIFIC_STORE,
|
|
2228
|
+
value: selectedStoreKey,
|
|
2229
|
+
onChange: event => setSelectedStoreKey(event.target.value),
|
|
2230
|
+
options: _mapInstanceProperty(stores).call(stores, store => ({
|
|
2231
|
+
value: store.key,
|
|
2232
|
+
label: store.name
|
|
2233
|
+
})),
|
|
2234
|
+
placeholder: intl.formatMessage(messages.selectStorePlaceholder),
|
|
2235
|
+
menuPortalTarget: document.body,
|
|
2236
|
+
menuPortalZIndex: Z_INDEX_DROPDOWN
|
|
2173
2237
|
}), shouldShowQueryPredicateField && jsx(TextField, {
|
|
2174
2238
|
name: "queryPredicate",
|
|
2175
2239
|
"data-testid": "query-predicate-field",
|
|
@@ -2191,7 +2255,10 @@ const ExportFileSettingsStep = () => {
|
|
|
2191
2255
|
resourceType = _useExportResourcesMo.resourceType,
|
|
2192
2256
|
setFieldSelectionMode = _useExportResourcesMo.setFieldSelectionMode,
|
|
2193
2257
|
setLocaleOption = _useExportResourcesMo.setLocaleOption,
|
|
2194
|
-
onClose = _useExportResourcesMo.onClose
|
|
2258
|
+
onClose = _useExportResourcesMo.onClose,
|
|
2259
|
+
exportType = _useExportResourcesMo.exportType,
|
|
2260
|
+
selectedStoreKey = _useExportResourcesMo.selectedStoreKey;
|
|
2261
|
+
const isStoreSelectionMissing = exportType === EXPORT_TYPES.SPECIFIC_STORE && !selectedStoreKey;
|
|
2195
2262
|
const handleOutputFormatChange = event => {
|
|
2196
2263
|
formik.handleChange(event);
|
|
2197
2264
|
if (event.target.value === OUTPUT_FORMATS.JSON) {
|
|
@@ -2211,7 +2278,7 @@ const ExportFileSettingsStep = () => {
|
|
|
2211
2278
|
})}: ${intl.formatMessage(messages.selectContentToExport)}`,
|
|
2212
2279
|
iconLeftPrimaryButton: jsx(AngleRightIcon, {}),
|
|
2213
2280
|
onPrimaryButtonClick: formik.submitForm,
|
|
2214
|
-
isPrimaryButtonDisabled: !formik.isValid,
|
|
2281
|
+
isPrimaryButtonDisabled: !formik.isValid || isStoreSelectionMissing,
|
|
2215
2282
|
onSecondaryButtonClick: onClose,
|
|
2216
2283
|
onClose: onClose,
|
|
2217
2284
|
size: 16,
|
|
@@ -3049,10 +3116,14 @@ const ExportResourcesProvider = _ref => {
|
|
|
3049
3116
|
_React$useState0 = _slicedToArray(_React$useState9, 2),
|
|
3050
3117
|
importedHeaders = _React$useState0[0],
|
|
3051
3118
|
setImportedHeaders = _React$useState0[1];
|
|
3052
|
-
const _React$useState1 = React.useState(
|
|
3119
|
+
const _React$useState1 = React.useState(''),
|
|
3053
3120
|
_React$useState10 = _slicedToArray(_React$useState1, 2),
|
|
3054
|
-
|
|
3055
|
-
|
|
3121
|
+
selectedStoreKey = _React$useState10[0],
|
|
3122
|
+
setSelectedStoreKey = _React$useState10[1];
|
|
3123
|
+
const _React$useState11 = React.useState([]),
|
|
3124
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
3125
|
+
validationErrors = _React$useState12[0],
|
|
3126
|
+
setValidationErrors = _React$useState12[1];
|
|
3056
3127
|
const _useStartExportOperat = useStartExportOperation(props),
|
|
3057
3128
|
startExportOperation = _useStartExportOperat.startExportOperation;
|
|
3058
3129
|
const _useValidateExportOpe = useValidateExportOperation(),
|
|
@@ -3108,7 +3179,7 @@ const ExportResourcesProvider = _ref => {
|
|
|
3108
3179
|
setCurrentStep(Step.ValidationErrors);
|
|
3109
3180
|
}
|
|
3110
3181
|
} else {
|
|
3111
|
-
startExportOperation(values, exportType, fieldSelectionMode, localeOption, importedHeaders);
|
|
3182
|
+
startExportOperation(values, exportType, fieldSelectionMode, localeOption, importedHeaders, selectedStoreKey);
|
|
3112
3183
|
}
|
|
3113
3184
|
}
|
|
3114
3185
|
});
|
|
@@ -3136,7 +3207,10 @@ const ExportResourcesProvider = _ref => {
|
|
|
3136
3207
|
setLocaleOption,
|
|
3137
3208
|
importedHeaders,
|
|
3138
3209
|
setImportedHeaders,
|
|
3139
|
-
validationErrors
|
|
3210
|
+
validationErrors,
|
|
3211
|
+
stores: props.stores,
|
|
3212
|
+
selectedStoreKey,
|
|
3213
|
+
setSelectedStoreKey
|
|
3140
3214
|
},
|
|
3141
3215
|
children: children
|
|
3142
3216
|
});
|
|
@@ -5,6 +5,7 @@ export type ExportScopeMessagesMap = {
|
|
|
5
5
|
exportScopeAll: MessageDescriptor;
|
|
6
6
|
exportScopeSelected: MessageDescriptor;
|
|
7
7
|
exportScopeFiltered: MessageDescriptor;
|
|
8
|
+
exportScopeSpecificStore?: MessageDescriptor;
|
|
8
9
|
};
|
|
9
10
|
};
|
|
10
11
|
export declare const resourceTypeMessages: ExportScopeMessagesMap;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ExportResourcesModalProps, ExportType, FieldSelectionMode, FormValues, LocaleOption } from "../@types/index.js";
|
|
2
2
|
export declare const useStartExportOperation: (props: ExportResourcesModalProps) => {
|
|
3
|
-
startExportOperation: (values: FormValues, exportType: ExportType, fieldSelectionMode: FieldSelectionMode, localeOption: LocaleOption, importedHeaders: string[]) => Promise<void>;
|
|
3
|
+
startExportOperation: (values: FormValues, exportType: ExportType, fieldSelectionMode: FieldSelectionMode, localeOption: LocaleOption, importedHeaders: string[], selectedStoreKey: string) => Promise<void>;
|
|
4
4
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { FormikProps } from 'formik';
|
|
3
|
-
import type { ExportType, Filters } from "./export-resources-modal-types.js";
|
|
3
|
+
import type { ExportType, Filters, Store } from "./export-resources-modal-types.js";
|
|
4
4
|
import type { FieldSelectionMode } from "./field-selection-mode.js";
|
|
5
5
|
import type { FieldValidationError } from "./field-validation-error.js";
|
|
6
6
|
import type { FormValues } from "./form.js";
|
|
@@ -33,4 +33,7 @@ export interface ExportResourcesModalContext {
|
|
|
33
33
|
importedHeaders: string[];
|
|
34
34
|
setImportedHeaders: React.Dispatch<React.SetStateAction<string[]>>;
|
|
35
35
|
validationErrors: FieldValidationError[];
|
|
36
|
+
stores?: Store[];
|
|
37
|
+
selectedStoreKey: string;
|
|
38
|
+
setSelectedStoreKey: React.Dispatch<React.SetStateAction<string>>;
|
|
36
39
|
}
|
|
@@ -20,6 +20,10 @@ export interface FieldGroup {
|
|
|
20
20
|
isExpanded?: boolean;
|
|
21
21
|
fields: Field[];
|
|
22
22
|
}
|
|
23
|
+
export interface Store {
|
|
24
|
+
key: string;
|
|
25
|
+
name: string;
|
|
26
|
+
}
|
|
23
27
|
export interface ExportResourcesModalProps {
|
|
24
28
|
isOpen?: boolean;
|
|
25
29
|
resourceType: ResourceType;
|
|
@@ -32,6 +36,7 @@ export interface ExportResourcesModalProps {
|
|
|
32
36
|
fieldOrder?: string[];
|
|
33
37
|
hideExportSelectedResourcesOption?: boolean;
|
|
34
38
|
showQueryPredicateOption?: boolean;
|
|
39
|
+
stores?: Store[];
|
|
35
40
|
onClose: () => void;
|
|
36
41
|
onExportSuccess?: () => void;
|
|
37
42
|
}
|
package/package.json
CHANGED