@commercetools-frontend-extensions/export-resources-modal 0.0.0-canary-20240904091928 → 0.0.0-canary-20240906151917
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 +40 -33
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.prod.js +40 -33
- package/dist/commercetools-frontend-extensions-export-resources-modal.esm.js +40 -33
- package/dist/declarations/src/@hooks/index.d.ts +1 -1
- package/dist/declarations/src/@hooks/use-convert-type-definitions-for-export.d.ts +8 -0
- package/dist/declarations/src/@types/index.d.ts +1 -1
- package/dist/declarations/src/@types/type-definition.d.ts +22 -0
- package/dist/declarations/src/index.d.ts +1 -1
- package/package.json +2 -2
- package/dist/declarations/src/@hooks/use-convert-custom-type-definitions-for-export.d.ts +0 -8
- package/dist/declarations/src/@types/custom-type-definition.d.ts +0 -38
|
@@ -1034,66 +1034,73 @@ const useStartExportOperation = props => {
|
|
|
1034
1034
|
const _excluded$1 = ["fieldDefinitions"];
|
|
1035
1035
|
function ownKeys$5(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; }
|
|
1036
1036
|
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys$5(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys$5(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1037
|
-
const
|
|
1038
|
-
const getCustomFieldFullName = _ref => {
|
|
1037
|
+
const getFieldFullName = _ref => {
|
|
1039
1038
|
var _context;
|
|
1040
|
-
let
|
|
1041
|
-
|
|
1042
|
-
return _filterInstanceProperty__default["default"](_context = [
|
|
1039
|
+
let fieldPrefix = _ref.fieldPrefix,
|
|
1040
|
+
fieldName = _ref.fieldName;
|
|
1041
|
+
return _filterInstanceProperty__default["default"](_context = [fieldPrefix, fieldName]).call(_context, Boolean).join('.');
|
|
1043
1042
|
};
|
|
1044
|
-
const
|
|
1043
|
+
const localizeTypeDefinitionLabels = function () {
|
|
1045
1044
|
let typeDefinitions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1046
1045
|
return _mapInstanceProperty__default["default"](typeDefinitions).call(typeDefinitions, _ref2 => {
|
|
1047
1046
|
let fieldDefinitions = _ref2.fieldDefinitions,
|
|
1048
1047
|
typeDefinition = _objectWithoutProperties(_ref2, _excluded$1);
|
|
1048
|
+
const isTypeLabelLocalized = _Array$isArray__default["default"](typeDefinition.label);
|
|
1049
1049
|
return {
|
|
1050
|
-
type: l10n.applyTransformedLocalizedFields(typeDefinition, [{
|
|
1051
|
-
from: '
|
|
1052
|
-
to: 'name'
|
|
1053
|
-
}]),
|
|
1054
|
-
fields: _mapInstanceProperty__default["default"](fieldDefinitions).call(fieldDefinitions, fieldDefinition => _objectSpread$5({}, l10n.applyTransformedLocalizedFields(fieldDefinition, [{
|
|
1055
|
-
from: 'labelAllLocales',
|
|
1050
|
+
type: isTypeLabelLocalized ? l10n.applyTransformedLocalizedFields(typeDefinition, [{
|
|
1051
|
+
from: 'label',
|
|
1056
1052
|
to: 'label'
|
|
1057
|
-
}])
|
|
1053
|
+
}]) : typeDefinition,
|
|
1054
|
+
fields: _mapInstanceProperty__default["default"](fieldDefinitions).call(fieldDefinitions, fieldDefinition => {
|
|
1055
|
+
const isFieldLabelLocalized = _Array$isArray__default["default"](fieldDefinition.label);
|
|
1056
|
+
if (!isFieldLabelLocalized) {
|
|
1057
|
+
return fieldDefinition;
|
|
1058
|
+
}
|
|
1059
|
+
return _objectSpread$5({}, l10n.applyTransformedLocalizedFields(fieldDefinition, [{
|
|
1060
|
+
from: 'label',
|
|
1061
|
+
to: 'label'
|
|
1062
|
+
}]));
|
|
1063
|
+
})
|
|
1058
1064
|
};
|
|
1059
1065
|
});
|
|
1060
1066
|
};
|
|
1061
|
-
const
|
|
1067
|
+
const useConvertTypeDefinitionsForExport = () => {
|
|
1062
1068
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
1063
1069
|
language: applicationContext.dataLocale,
|
|
1064
1070
|
languages: applicationContext.project?.languages
|
|
1065
1071
|
})),
|
|
1066
1072
|
language = _useApplicationContex.language,
|
|
1067
1073
|
languages = _useApplicationContex.languages;
|
|
1068
|
-
const
|
|
1069
|
-
let
|
|
1070
|
-
|
|
1071
|
-
expandAll = _ref3.expandAll
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1074
|
+
const convertTypeDefinitionsForExport = _ref3 => {
|
|
1075
|
+
let typeDefinitions = _ref3.typeDefinitions,
|
|
1076
|
+
fieldPrefix = _ref3.fieldPrefix,
|
|
1077
|
+
_ref3$expandAll = _ref3.expandAll,
|
|
1078
|
+
expandAll = _ref3$expandAll === void 0 ? false : _ref3$expandAll;
|
|
1079
|
+
if (!typeDefinitions) return [];
|
|
1080
|
+
const transformedTypeDefinitions = localizeTypeDefinitionLabels(typeDefinitions);
|
|
1081
|
+
return _mapInstanceProperty__default["default"](transformedTypeDefinitions).call(transformedTypeDefinitions, transformedType => {
|
|
1075
1082
|
var _context2;
|
|
1076
1083
|
return {
|
|
1077
1084
|
isExpandable: true,
|
|
1078
1085
|
isExpanded: expandAll,
|
|
1079
|
-
name:
|
|
1086
|
+
name: transformedType.type.name,
|
|
1080
1087
|
label: l10n.formatLocalizedString({
|
|
1081
|
-
|
|
1088
|
+
label: transformedType.type.label
|
|
1082
1089
|
}, {
|
|
1083
|
-
key: '
|
|
1090
|
+
key: 'label',
|
|
1084
1091
|
locale: language,
|
|
1085
1092
|
fallbackOrder: languages,
|
|
1086
|
-
fallback:
|
|
1093
|
+
fallback: transformedType.type.name
|
|
1087
1094
|
}),
|
|
1088
|
-
fields: _mapInstanceProperty__default["default"](_context2 =
|
|
1089
|
-
name:
|
|
1090
|
-
|
|
1091
|
-
|
|
1095
|
+
fields: _mapInstanceProperty__default["default"](_context2 = transformedType.fields).call(_context2, fieldDefinition => ({
|
|
1096
|
+
name: getFieldFullName({
|
|
1097
|
+
fieldPrefix: fieldPrefix,
|
|
1098
|
+
fieldName: fieldDefinition.name
|
|
1092
1099
|
}),
|
|
1093
1100
|
label: l10n.formatLocalizedString({
|
|
1094
|
-
|
|
1101
|
+
label: fieldDefinition.label
|
|
1095
1102
|
}, {
|
|
1096
|
-
key: '
|
|
1103
|
+
key: 'label',
|
|
1097
1104
|
locale: language,
|
|
1098
1105
|
fallbackOrder: languages,
|
|
1099
1106
|
fallback: fieldDefinition.name
|
|
@@ -1103,7 +1110,7 @@ const useConvertCustomTypeDefinitionsForExport = () => {
|
|
|
1103
1110
|
});
|
|
1104
1111
|
};
|
|
1105
1112
|
return {
|
|
1106
|
-
|
|
1113
|
+
convertTypeDefinitionsForExport
|
|
1107
1114
|
};
|
|
1108
1115
|
};
|
|
1109
1116
|
|
|
@@ -1939,4 +1946,4 @@ ExportResourcesModal.defaultProps = {
|
|
|
1939
1946
|
exports.EXPORTABLE_RESOURCES = EXPORTABLE_RESOURCES;
|
|
1940
1947
|
exports.EXPORT_TYPES = EXPORT_TYPES;
|
|
1941
1948
|
exports["default"] = ExportResourcesModal;
|
|
1942
|
-
exports.
|
|
1949
|
+
exports.useConvertTypeDefinitionsForExport = useConvertTypeDefinitionsForExport;
|
|
@@ -1034,66 +1034,73 @@ const useStartExportOperation = props => {
|
|
|
1034
1034
|
const _excluded$1 = ["fieldDefinitions"];
|
|
1035
1035
|
function ownKeys$5(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; }
|
|
1036
1036
|
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys$5(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys$5(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1037
|
-
const
|
|
1038
|
-
const getCustomFieldFullName = _ref => {
|
|
1037
|
+
const getFieldFullName = _ref => {
|
|
1039
1038
|
var _context;
|
|
1040
|
-
let
|
|
1041
|
-
|
|
1042
|
-
return _filterInstanceProperty__default["default"](_context = [
|
|
1039
|
+
let fieldPrefix = _ref.fieldPrefix,
|
|
1040
|
+
fieldName = _ref.fieldName;
|
|
1041
|
+
return _filterInstanceProperty__default["default"](_context = [fieldPrefix, fieldName]).call(_context, Boolean).join('.');
|
|
1043
1042
|
};
|
|
1044
|
-
const
|
|
1043
|
+
const localizeTypeDefinitionLabels = function () {
|
|
1045
1044
|
let typeDefinitions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1046
1045
|
return _mapInstanceProperty__default["default"](typeDefinitions).call(typeDefinitions, _ref2 => {
|
|
1047
1046
|
let fieldDefinitions = _ref2.fieldDefinitions,
|
|
1048
1047
|
typeDefinition = _objectWithoutProperties(_ref2, _excluded$1);
|
|
1048
|
+
const isTypeLabelLocalized = _Array$isArray__default["default"](typeDefinition.label);
|
|
1049
1049
|
return {
|
|
1050
|
-
type: l10n.applyTransformedLocalizedFields(typeDefinition, [{
|
|
1051
|
-
from: '
|
|
1052
|
-
to: 'name'
|
|
1053
|
-
}]),
|
|
1054
|
-
fields: _mapInstanceProperty__default["default"](fieldDefinitions).call(fieldDefinitions, fieldDefinition => _objectSpread$5({}, l10n.applyTransformedLocalizedFields(fieldDefinition, [{
|
|
1055
|
-
from: 'labelAllLocales',
|
|
1050
|
+
type: isTypeLabelLocalized ? l10n.applyTransformedLocalizedFields(typeDefinition, [{
|
|
1051
|
+
from: 'label',
|
|
1056
1052
|
to: 'label'
|
|
1057
|
-
}])
|
|
1053
|
+
}]) : typeDefinition,
|
|
1054
|
+
fields: _mapInstanceProperty__default["default"](fieldDefinitions).call(fieldDefinitions, fieldDefinition => {
|
|
1055
|
+
const isFieldLabelLocalized = _Array$isArray__default["default"](fieldDefinition.label);
|
|
1056
|
+
if (!isFieldLabelLocalized) {
|
|
1057
|
+
return fieldDefinition;
|
|
1058
|
+
}
|
|
1059
|
+
return _objectSpread$5({}, l10n.applyTransformedLocalizedFields(fieldDefinition, [{
|
|
1060
|
+
from: 'label',
|
|
1061
|
+
to: 'label'
|
|
1062
|
+
}]));
|
|
1063
|
+
})
|
|
1058
1064
|
};
|
|
1059
1065
|
});
|
|
1060
1066
|
};
|
|
1061
|
-
const
|
|
1067
|
+
const useConvertTypeDefinitionsForExport = () => {
|
|
1062
1068
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
1063
1069
|
language: applicationContext.dataLocale,
|
|
1064
1070
|
languages: applicationContext.project?.languages
|
|
1065
1071
|
})),
|
|
1066
1072
|
language = _useApplicationContex.language,
|
|
1067
1073
|
languages = _useApplicationContex.languages;
|
|
1068
|
-
const
|
|
1069
|
-
let
|
|
1070
|
-
|
|
1071
|
-
expandAll = _ref3.expandAll
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1074
|
+
const convertTypeDefinitionsForExport = _ref3 => {
|
|
1075
|
+
let typeDefinitions = _ref3.typeDefinitions,
|
|
1076
|
+
fieldPrefix = _ref3.fieldPrefix,
|
|
1077
|
+
_ref3$expandAll = _ref3.expandAll,
|
|
1078
|
+
expandAll = _ref3$expandAll === void 0 ? false : _ref3$expandAll;
|
|
1079
|
+
if (!typeDefinitions) return [];
|
|
1080
|
+
const transformedTypeDefinitions = localizeTypeDefinitionLabels(typeDefinitions);
|
|
1081
|
+
return _mapInstanceProperty__default["default"](transformedTypeDefinitions).call(transformedTypeDefinitions, transformedType => {
|
|
1075
1082
|
var _context2;
|
|
1076
1083
|
return {
|
|
1077
1084
|
isExpandable: true,
|
|
1078
1085
|
isExpanded: expandAll,
|
|
1079
|
-
name:
|
|
1086
|
+
name: transformedType.type.name,
|
|
1080
1087
|
label: l10n.formatLocalizedString({
|
|
1081
|
-
|
|
1088
|
+
label: transformedType.type.label
|
|
1082
1089
|
}, {
|
|
1083
|
-
key: '
|
|
1090
|
+
key: 'label',
|
|
1084
1091
|
locale: language,
|
|
1085
1092
|
fallbackOrder: languages,
|
|
1086
|
-
fallback:
|
|
1093
|
+
fallback: transformedType.type.name
|
|
1087
1094
|
}),
|
|
1088
|
-
fields: _mapInstanceProperty__default["default"](_context2 =
|
|
1089
|
-
name:
|
|
1090
|
-
|
|
1091
|
-
|
|
1095
|
+
fields: _mapInstanceProperty__default["default"](_context2 = transformedType.fields).call(_context2, fieldDefinition => ({
|
|
1096
|
+
name: getFieldFullName({
|
|
1097
|
+
fieldPrefix: fieldPrefix,
|
|
1098
|
+
fieldName: fieldDefinition.name
|
|
1092
1099
|
}),
|
|
1093
1100
|
label: l10n.formatLocalizedString({
|
|
1094
|
-
|
|
1101
|
+
label: fieldDefinition.label
|
|
1095
1102
|
}, {
|
|
1096
|
-
key: '
|
|
1103
|
+
key: 'label',
|
|
1097
1104
|
locale: language,
|
|
1098
1105
|
fallbackOrder: languages,
|
|
1099
1106
|
fallback: fieldDefinition.name
|
|
@@ -1103,7 +1110,7 @@ const useConvertCustomTypeDefinitionsForExport = () => {
|
|
|
1103
1110
|
});
|
|
1104
1111
|
};
|
|
1105
1112
|
return {
|
|
1106
|
-
|
|
1113
|
+
convertTypeDefinitionsForExport
|
|
1107
1114
|
};
|
|
1108
1115
|
};
|
|
1109
1116
|
|
|
@@ -1906,4 +1913,4 @@ ExportResourcesModal.defaultProps = {
|
|
|
1906
1913
|
exports.EXPORTABLE_RESOURCES = EXPORTABLE_RESOURCES;
|
|
1907
1914
|
exports.EXPORT_TYPES = EXPORT_TYPES;
|
|
1908
1915
|
exports["default"] = ExportResourcesModal;
|
|
1909
|
-
exports.
|
|
1916
|
+
exports.useConvertTypeDefinitionsForExport = useConvertTypeDefinitionsForExport;
|
|
@@ -1000,66 +1000,73 @@ const useStartExportOperation = props => {
|
|
|
1000
1000
|
const _excluded$1 = ["fieldDefinitions"];
|
|
1001
1001
|
function ownKeys$5(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; }
|
|
1002
1002
|
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context3 = ownKeys$5(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context4 = ownKeys$5(Object(t))).call(_context4, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1003
|
-
const
|
|
1004
|
-
const getCustomFieldFullName = _ref => {
|
|
1003
|
+
const getFieldFullName = _ref => {
|
|
1005
1004
|
var _context;
|
|
1006
|
-
let
|
|
1007
|
-
|
|
1008
|
-
return _filterInstanceProperty(_context = [
|
|
1005
|
+
let fieldPrefix = _ref.fieldPrefix,
|
|
1006
|
+
fieldName = _ref.fieldName;
|
|
1007
|
+
return _filterInstanceProperty(_context = [fieldPrefix, fieldName]).call(_context, Boolean).join('.');
|
|
1009
1008
|
};
|
|
1010
|
-
const
|
|
1009
|
+
const localizeTypeDefinitionLabels = function () {
|
|
1011
1010
|
let typeDefinitions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1012
1011
|
return _mapInstanceProperty(typeDefinitions).call(typeDefinitions, _ref2 => {
|
|
1013
1012
|
let fieldDefinitions = _ref2.fieldDefinitions,
|
|
1014
1013
|
typeDefinition = _objectWithoutProperties(_ref2, _excluded$1);
|
|
1014
|
+
const isTypeLabelLocalized = _Array$isArray(typeDefinition.label);
|
|
1015
1015
|
return {
|
|
1016
|
-
type: applyTransformedLocalizedFields(typeDefinition, [{
|
|
1017
|
-
from: '
|
|
1018
|
-
to: 'name'
|
|
1019
|
-
}]),
|
|
1020
|
-
fields: _mapInstanceProperty(fieldDefinitions).call(fieldDefinitions, fieldDefinition => _objectSpread$5({}, applyTransformedLocalizedFields(fieldDefinition, [{
|
|
1021
|
-
from: 'labelAllLocales',
|
|
1016
|
+
type: isTypeLabelLocalized ? applyTransformedLocalizedFields(typeDefinition, [{
|
|
1017
|
+
from: 'label',
|
|
1022
1018
|
to: 'label'
|
|
1023
|
-
}])
|
|
1019
|
+
}]) : typeDefinition,
|
|
1020
|
+
fields: _mapInstanceProperty(fieldDefinitions).call(fieldDefinitions, fieldDefinition => {
|
|
1021
|
+
const isFieldLabelLocalized = _Array$isArray(fieldDefinition.label);
|
|
1022
|
+
if (!isFieldLabelLocalized) {
|
|
1023
|
+
return fieldDefinition;
|
|
1024
|
+
}
|
|
1025
|
+
return _objectSpread$5({}, applyTransformedLocalizedFields(fieldDefinition, [{
|
|
1026
|
+
from: 'label',
|
|
1027
|
+
to: 'label'
|
|
1028
|
+
}]));
|
|
1029
|
+
})
|
|
1024
1030
|
};
|
|
1025
1031
|
});
|
|
1026
1032
|
};
|
|
1027
|
-
const
|
|
1033
|
+
const useConvertTypeDefinitionsForExport = () => {
|
|
1028
1034
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
1029
1035
|
language: applicationContext.dataLocale,
|
|
1030
1036
|
languages: applicationContext.project?.languages
|
|
1031
1037
|
})),
|
|
1032
1038
|
language = _useApplicationContex.language,
|
|
1033
1039
|
languages = _useApplicationContex.languages;
|
|
1034
|
-
const
|
|
1035
|
-
let
|
|
1036
|
-
|
|
1037
|
-
expandAll = _ref3.expandAll
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1040
|
+
const convertTypeDefinitionsForExport = _ref3 => {
|
|
1041
|
+
let typeDefinitions = _ref3.typeDefinitions,
|
|
1042
|
+
fieldPrefix = _ref3.fieldPrefix,
|
|
1043
|
+
_ref3$expandAll = _ref3.expandAll,
|
|
1044
|
+
expandAll = _ref3$expandAll === void 0 ? false : _ref3$expandAll;
|
|
1045
|
+
if (!typeDefinitions) return [];
|
|
1046
|
+
const transformedTypeDefinitions = localizeTypeDefinitionLabels(typeDefinitions);
|
|
1047
|
+
return _mapInstanceProperty(transformedTypeDefinitions).call(transformedTypeDefinitions, transformedType => {
|
|
1041
1048
|
var _context2;
|
|
1042
1049
|
return {
|
|
1043
1050
|
isExpandable: true,
|
|
1044
1051
|
isExpanded: expandAll,
|
|
1045
|
-
name:
|
|
1052
|
+
name: transformedType.type.name,
|
|
1046
1053
|
label: formatLocalizedString({
|
|
1047
|
-
|
|
1054
|
+
label: transformedType.type.label
|
|
1048
1055
|
}, {
|
|
1049
|
-
key: '
|
|
1056
|
+
key: 'label',
|
|
1050
1057
|
locale: language,
|
|
1051
1058
|
fallbackOrder: languages,
|
|
1052
|
-
fallback:
|
|
1059
|
+
fallback: transformedType.type.name
|
|
1053
1060
|
}),
|
|
1054
|
-
fields: _mapInstanceProperty(_context2 =
|
|
1055
|
-
name:
|
|
1056
|
-
|
|
1057
|
-
|
|
1061
|
+
fields: _mapInstanceProperty(_context2 = transformedType.fields).call(_context2, fieldDefinition => ({
|
|
1062
|
+
name: getFieldFullName({
|
|
1063
|
+
fieldPrefix: fieldPrefix,
|
|
1064
|
+
fieldName: fieldDefinition.name
|
|
1058
1065
|
}),
|
|
1059
1066
|
label: formatLocalizedString({
|
|
1060
|
-
|
|
1067
|
+
label: fieldDefinition.label
|
|
1061
1068
|
}, {
|
|
1062
|
-
key: '
|
|
1069
|
+
key: 'label',
|
|
1063
1070
|
locale: language,
|
|
1064
1071
|
fallbackOrder: languages,
|
|
1065
1072
|
fallback: fieldDefinition.name
|
|
@@ -1069,7 +1076,7 @@ const useConvertCustomTypeDefinitionsForExport = () => {
|
|
|
1069
1076
|
});
|
|
1070
1077
|
};
|
|
1071
1078
|
return {
|
|
1072
|
-
|
|
1079
|
+
convertTypeDefinitionsForExport
|
|
1073
1080
|
};
|
|
1074
1081
|
};
|
|
1075
1082
|
|
|
@@ -1902,4 +1909,4 @@ ExportResourcesModal.defaultProps = {
|
|
|
1902
1909
|
fieldOrder: []
|
|
1903
1910
|
};
|
|
1904
1911
|
|
|
1905
|
-
export { EXPORTABLE_RESOURCES, EXPORT_TYPES, ExportResourcesModal as default,
|
|
1912
|
+
export { EXPORTABLE_RESOURCES, EXPORT_TYPES, ExportResourcesModal as default, useConvertTypeDefinitionsForExport };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from "./use-export-resources-modal-context.js";
|
|
2
2
|
export * from "./use-initial-values.js";
|
|
3
3
|
export * from "./use-start-export-operation.js";
|
|
4
|
-
export * from "./use-convert-
|
|
4
|
+
export * from "./use-convert-type-definitions-for-export.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Field, TypeDefinition } from "../@types/index.js";
|
|
2
|
+
export declare const useConvertTypeDefinitionsForExport: () => {
|
|
3
|
+
convertTypeDefinitionsForExport: ({ typeDefinitions, fieldPrefix, expandAll, }: {
|
|
4
|
+
typeDefinitions?: TypeDefinition[] | undefined;
|
|
5
|
+
fieldPrefix?: string | undefined;
|
|
6
|
+
expandAll?: boolean | undefined;
|
|
7
|
+
}) => Field[];
|
|
8
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type LocalizedField = {
|
|
2
|
+
value: string;
|
|
3
|
+
locale: string;
|
|
4
|
+
};
|
|
5
|
+
export type FieldDefinition = {
|
|
6
|
+
name: string;
|
|
7
|
+
label: LocalizedField[];
|
|
8
|
+
};
|
|
9
|
+
export type TypeDefinition = {
|
|
10
|
+
name: string;
|
|
11
|
+
label: LocalizedField[];
|
|
12
|
+
fieldDefinitions: FieldDefinition[];
|
|
13
|
+
};
|
|
14
|
+
type TransformedFieldDefinition = {
|
|
15
|
+
name: string;
|
|
16
|
+
label: LocalizedField[];
|
|
17
|
+
};
|
|
18
|
+
export type TransformedTypeDefinition = {
|
|
19
|
+
type: FieldDefinition;
|
|
20
|
+
fields: TransformedFieldDefinition[];
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ExportResourcesModal from "./export-resources-modal.js";
|
|
2
2
|
export { EXPORT_TYPES, EXPORTABLE_RESOURCES } from "./@constants/index.js";
|
|
3
3
|
export * from "./@types/index.js";
|
|
4
|
-
export {
|
|
4
|
+
export { useConvertTypeDefinitionsForExport } from "./@hooks/index.js";
|
|
5
5
|
export default ExportResourcesModal;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend-extensions/export-resources-modal",
|
|
3
3
|
"description": "Shared export modal for exporting resources",
|
|
4
|
-
"version": "0.0.0-canary-
|
|
4
|
+
"version": "0.0.0-canary-20240906151917",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@commercetools-frontend/constants": "22.32.0",
|
|
39
39
|
"@commercetools-frontend/i18n": "22.32.0",
|
|
40
40
|
"@commercetools-frontend/jest-preset-mc-app": "22.32.0",
|
|
41
|
-
"@commercetools-frontend/l10n": "22.
|
|
41
|
+
"@commercetools-frontend/l10n": "22.x",
|
|
42
42
|
"@commercetools-frontend/sdk": "22.32.0",
|
|
43
43
|
"@commercetools-frontend/sentry": "22.32.0",
|
|
44
44
|
"@commercetools-frontend/ui-kit": "19.11.0",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Field, CustomTypeDefinition } from "../@types/index.js";
|
|
2
|
-
export declare const useConvertCustomTypeDefinitionsForExport: () => {
|
|
3
|
-
convertCustomTypeDefinitionsForExport: ({ customTypeDefinitions, customFieldPrefix, expandAll, }: {
|
|
4
|
-
customTypeDefinitions?: CustomTypeDefinition[] | undefined;
|
|
5
|
-
customFieldPrefix?: string | undefined;
|
|
6
|
-
expandAll?: boolean | undefined;
|
|
7
|
-
}) => Field[];
|
|
8
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
type LocalizedString = {
|
|
2
|
-
value: string;
|
|
3
|
-
locale: string;
|
|
4
|
-
};
|
|
5
|
-
type FieldType = {
|
|
6
|
-
name: string;
|
|
7
|
-
};
|
|
8
|
-
export type FieldDefinition = {
|
|
9
|
-
type: FieldType;
|
|
10
|
-
name: string;
|
|
11
|
-
labelAllLocales: LocalizedString[];
|
|
12
|
-
};
|
|
13
|
-
export type CustomTypeDefinition = {
|
|
14
|
-
key: string;
|
|
15
|
-
nameAllLocales: LocalizedString[];
|
|
16
|
-
fieldDefinitions: FieldDefinition[];
|
|
17
|
-
};
|
|
18
|
-
type TransformedFieldDefinition = {
|
|
19
|
-
type: {
|
|
20
|
-
name: string;
|
|
21
|
-
};
|
|
22
|
-
name: string;
|
|
23
|
-
label: {
|
|
24
|
-
value: string;
|
|
25
|
-
locale: string;
|
|
26
|
-
}[];
|
|
27
|
-
};
|
|
28
|
-
export type TransformedCustomTypeDefinition = {
|
|
29
|
-
type: {
|
|
30
|
-
key: string;
|
|
31
|
-
name: {
|
|
32
|
-
value: string;
|
|
33
|
-
locale: string;
|
|
34
|
-
}[];
|
|
35
|
-
};
|
|
36
|
-
fields: TransformedFieldDefinition[];
|
|
37
|
-
};
|
|
38
|
-
export {};
|