@commercetools-frontend-extensions/export-resources-modal 5.12.0 → 5.13.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 +2 -0
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.dev.js +4 -4
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.prod.js +4 -4
- package/dist/commercetools-frontend-extensions-export-resources-modal.esm.js +4 -4
- package/dist/declarations/src/@types/export-resources-modal-types.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -358,6 +358,8 @@ import ExportResourcesModal from '@commercetools-frontend-extensions/export-reso
|
|
|
358
358
|
| `fieldGroups[].fields[].isExpandable` | `boolean` | | `false`| `isExpandable` property indicates if the field can be expanded/collapsed on the UI. If the `isExpandable` is passed as true, then a expand/collapse button is displayed on the UI to control |
|
|
359
359
|
| `fieldGroups[].fields[].isExpanded` | `boolean` | | `false` | This property is used along with `fieldGroups[].fields[].isExpandable` to control the default state of each expandable fields in the UI. If `fieldGroups[].fields[].isExpanded` is set to `true`, then the corresponding field will be expanded when the component loads. The default value is `false` which means unless explicitly set to `true`, the field will be collapsed on initial load |
|
|
360
360
|
| `fieldOrder` | `string[]` | | | The field names are sorted based on the order passed. The value `*` can be passed to denote any fields and for example fieldOrder=['*', 'custom'] will push all the fields that starts with custom to the last in the list and any other fields will be at the beginning of the list |
|
|
361
|
+
| `stores` | `Array<{ key: string; name: string }>` | | | When provided (and the `resourceType` defines an `exportScopeSpecificStore` message), renders an additional "Specific store" scope option with a store-selection dropdown. Selecting a store sets `where=store(key="<key>")` on the export request. |
|
|
362
|
+
| `selectedScopeQueryPredicateBuilder` | `(selectedResourceIds: string[]) => string` | | | Overrides the `where` predicate produced for the SELECTED scope. Useful when `selectedResourceIds` reference a related resource — e.g. tailoring exports where IDs are product IDs, so the predicate must be `product(id in (...))` instead of the default `id in (...)`. |
|
|
361
363
|
|
|
362
364
|
## Releasing
|
|
363
365
|
|
|
@@ -1821,7 +1821,7 @@ const useStartExportOperation = props => {
|
|
|
1821
1821
|
let where = undefined;
|
|
1822
1822
|
let filters = undefined;
|
|
1823
1823
|
if (exportType === EXPORT_TYPES.SELECTED && props.selectedResourceIds?.length) {
|
|
1824
|
-
where = buildSelectedExportFilters(props.selectedResourceIds);
|
|
1824
|
+
where = props.selectedScopeQueryPredicateBuilder ? props.selectedScopeQueryPredicateBuilder(props.selectedResourceIds) : buildSelectedExportFilters(props.selectedResourceIds);
|
|
1825
1825
|
} else if (exportType === EXPORT_TYPES.FILTERED && props.filters) {
|
|
1826
1826
|
where = props.filters.where;
|
|
1827
1827
|
if (isQueryFilter(props.filters.filters)) {
|
|
@@ -2211,7 +2211,8 @@ function ExportScopeSection() {
|
|
|
2211
2211
|
selectedStoreKey = _useExportResourcesMo.selectedStoreKey,
|
|
2212
2212
|
setSelectedStoreKey = _useExportResourcesMo.setSelectedStoreKey;
|
|
2213
2213
|
const shouldShowQueryPredicateField = exportType === EXPORT_TYPES.QUERY_PREDICATE;
|
|
2214
|
-
return jsxRuntime.jsxs(
|
|
2214
|
+
return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
2215
|
+
scale: "xs",
|
|
2215
2216
|
children: [jsxRuntime.jsxs(uiKit.RadioInput.Group, {
|
|
2216
2217
|
value: exportType,
|
|
2217
2218
|
onChange: e => {
|
|
@@ -2263,11 +2264,10 @@ function ExportScopeSection() {
|
|
|
2263
2264
|
intlMessage: resourceTypeMessages[resourceType].exportScopeSpecificStore
|
|
2264
2265
|
})
|
|
2265
2266
|
})]
|
|
2266
|
-
}), stores && stores.length > 0 && exportType
|
|
2267
|
+
}), stores && stores.length > 0 && exportType === EXPORT_TYPES.SPECIFIC_STORE && jsxRuntime.jsx(uiKit.SelectField, {
|
|
2267
2268
|
name: "selectedStoreKey",
|
|
2268
2269
|
title: "",
|
|
2269
2270
|
horizontalConstraint: 7,
|
|
2270
|
-
isDisabled: exportType !== EXPORT_TYPES.SPECIFIC_STORE,
|
|
2271
2271
|
value: selectedStoreKey,
|
|
2272
2272
|
onChange: event => setSelectedStoreKey(event.target.value),
|
|
2273
2273
|
options: _mapInstanceProperty__default["default"](stores).call(stores, store => ({
|
|
@@ -1821,7 +1821,7 @@ const useStartExportOperation = props => {
|
|
|
1821
1821
|
let where = undefined;
|
|
1822
1822
|
let filters = undefined;
|
|
1823
1823
|
if (exportType === EXPORT_TYPES.SELECTED && props.selectedResourceIds?.length) {
|
|
1824
|
-
where = buildSelectedExportFilters(props.selectedResourceIds);
|
|
1824
|
+
where = props.selectedScopeQueryPredicateBuilder ? props.selectedScopeQueryPredicateBuilder(props.selectedResourceIds) : buildSelectedExportFilters(props.selectedResourceIds);
|
|
1825
1825
|
} else if (exportType === EXPORT_TYPES.FILTERED && props.filters) {
|
|
1826
1826
|
where = props.filters.where;
|
|
1827
1827
|
if (isQueryFilter(props.filters.filters)) {
|
|
@@ -2211,7 +2211,8 @@ function ExportScopeSection() {
|
|
|
2211
2211
|
selectedStoreKey = _useExportResourcesMo.selectedStoreKey,
|
|
2212
2212
|
setSelectedStoreKey = _useExportResourcesMo.setSelectedStoreKey;
|
|
2213
2213
|
const shouldShowQueryPredicateField = exportType === EXPORT_TYPES.QUERY_PREDICATE;
|
|
2214
|
-
return jsxRuntime.jsxs(
|
|
2214
|
+
return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
2215
|
+
scale: "xs",
|
|
2215
2216
|
children: [jsxRuntime.jsxs(uiKit.RadioInput.Group, {
|
|
2216
2217
|
value: exportType,
|
|
2217
2218
|
onChange: e => {
|
|
@@ -2263,11 +2264,10 @@ function ExportScopeSection() {
|
|
|
2263
2264
|
intlMessage: resourceTypeMessages[resourceType].exportScopeSpecificStore
|
|
2264
2265
|
})
|
|
2265
2266
|
})]
|
|
2266
|
-
}), stores && stores.length > 0 && exportType
|
|
2267
|
+
}), stores && stores.length > 0 && exportType === EXPORT_TYPES.SPECIFIC_STORE && jsxRuntime.jsx(uiKit.SelectField, {
|
|
2267
2268
|
name: "selectedStoreKey",
|
|
2268
2269
|
title: "",
|
|
2269
2270
|
horizontalConstraint: 7,
|
|
2270
|
-
isDisabled: exportType !== EXPORT_TYPES.SPECIFIC_STORE,
|
|
2271
2271
|
value: selectedStoreKey,
|
|
2272
2272
|
onChange: event => setSelectedStoreKey(event.target.value),
|
|
2273
2273
|
options: _mapInstanceProperty__default["default"](stores).call(stores, store => ({
|
|
@@ -1778,7 +1778,7 @@ const useStartExportOperation = props => {
|
|
|
1778
1778
|
let where = undefined;
|
|
1779
1779
|
let filters = undefined;
|
|
1780
1780
|
if (exportType === EXPORT_TYPES.SELECTED && props.selectedResourceIds?.length) {
|
|
1781
|
-
where = buildSelectedExportFilters(props.selectedResourceIds);
|
|
1781
|
+
where = props.selectedScopeQueryPredicateBuilder ? props.selectedScopeQueryPredicateBuilder(props.selectedResourceIds) : buildSelectedExportFilters(props.selectedResourceIds);
|
|
1782
1782
|
} else if (exportType === EXPORT_TYPES.FILTERED && props.filters) {
|
|
1783
1783
|
where = props.filters.where;
|
|
1784
1784
|
if (isQueryFilter(props.filters.filters)) {
|
|
@@ -2168,7 +2168,8 @@ function ExportScopeSection() {
|
|
|
2168
2168
|
selectedStoreKey = _useExportResourcesMo.selectedStoreKey,
|
|
2169
2169
|
setSelectedStoreKey = _useExportResourcesMo.setSelectedStoreKey;
|
|
2170
2170
|
const shouldShowQueryPredicateField = exportType === EXPORT_TYPES.QUERY_PREDICATE;
|
|
2171
|
-
return jsxs(
|
|
2171
|
+
return jsxs(Spacings.Stack, {
|
|
2172
|
+
scale: "xs",
|
|
2172
2173
|
children: [jsxs(RadioInput.Group, {
|
|
2173
2174
|
value: exportType,
|
|
2174
2175
|
onChange: e => {
|
|
@@ -2220,11 +2221,10 @@ function ExportScopeSection() {
|
|
|
2220
2221
|
intlMessage: resourceTypeMessages[resourceType].exportScopeSpecificStore
|
|
2221
2222
|
})
|
|
2222
2223
|
})]
|
|
2223
|
-
}), stores && stores.length > 0 && exportType
|
|
2224
|
+
}), stores && stores.length > 0 && exportType === EXPORT_TYPES.SPECIFIC_STORE && jsx(SelectField, {
|
|
2224
2225
|
name: "selectedStoreKey",
|
|
2225
2226
|
title: "",
|
|
2226
2227
|
horizontalConstraint: 7,
|
|
2227
|
-
isDisabled: exportType !== EXPORT_TYPES.SPECIFIC_STORE,
|
|
2228
2228
|
value: selectedStoreKey,
|
|
2229
2229
|
onChange: event => setSelectedStoreKey(event.target.value),
|
|
2230
2230
|
options: _mapInstanceProperty(stores).call(stores, store => ({
|
|
@@ -37,6 +37,7 @@ export interface ExportResourcesModalProps {
|
|
|
37
37
|
hideExportSelectedResourcesOption?: boolean;
|
|
38
38
|
showQueryPredicateOption?: boolean;
|
|
39
39
|
stores?: Store[];
|
|
40
|
+
selectedScopeQueryPredicateBuilder?: (selectedResourceIds: string[]) => string;
|
|
40
41
|
onClose: () => void;
|
|
41
42
|
onExportSuccess?: () => void;
|
|
42
43
|
}
|
package/package.json
CHANGED