@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.
@@ -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 customFieldKey = 'custom.fields';
1038
- const getCustomFieldFullName = _ref => {
1037
+ const getFieldFullName = _ref => {
1039
1038
  var _context;
1040
- let customFieldPrefix = _ref.customFieldPrefix,
1041
- key = _ref.key;
1042
- return _filterInstanceProperty__default["default"](_context = [customFieldPrefix, customFieldKey, key]).call(_context, Boolean).join('.');
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 transformAndLocalizeTypeDefinitions = function () {
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: 'nameAllLocales',
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 useConvertCustomTypeDefinitionsForExport = () => {
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 convertCustomTypeDefinitionsForExport = _ref3 => {
1069
- let customTypeDefinitions = _ref3.customTypeDefinitions,
1070
- customFieldPrefix = _ref3.customFieldPrefix,
1071
- expandAll = _ref3.expandAll;
1072
- if (!customTypeDefinitions) return [];
1073
- const transformedCustomTypeDefinitions = transformAndLocalizeTypeDefinitions(customTypeDefinitions);
1074
- return _mapInstanceProperty__default["default"](transformedCustomTypeDefinitions).call(transformedCustomTypeDefinitions, customTypeDefinition => {
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: customTypeDefinition.type.key,
1086
+ name: transformedType.type.name,
1080
1087
  label: l10n.formatLocalizedString({
1081
- nameAllLocales: customTypeDefinition.type.name
1088
+ label: transformedType.type.label
1082
1089
  }, {
1083
- key: 'nameAllLocales',
1090
+ key: 'label',
1084
1091
  locale: language,
1085
1092
  fallbackOrder: languages,
1086
- fallback: customTypeDefinition.type.key
1093
+ fallback: transformedType.type.name
1087
1094
  }),
1088
- fields: _mapInstanceProperty__default["default"](_context2 = customTypeDefinition.fields).call(_context2, fieldDefinition => ({
1089
- name: getCustomFieldFullName({
1090
- customFieldPrefix: customFieldPrefix,
1091
- key: fieldDefinition.name
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
- labelAllLocales: fieldDefinition.label
1101
+ label: fieldDefinition.label
1095
1102
  }, {
1096
- key: 'labelAllLocales',
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
- convertCustomTypeDefinitionsForExport
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.useConvertCustomTypeDefinitionsForExport = useConvertCustomTypeDefinitionsForExport;
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 customFieldKey = 'custom.fields';
1038
- const getCustomFieldFullName = _ref => {
1037
+ const getFieldFullName = _ref => {
1039
1038
  var _context;
1040
- let customFieldPrefix = _ref.customFieldPrefix,
1041
- key = _ref.key;
1042
- return _filterInstanceProperty__default["default"](_context = [customFieldPrefix, customFieldKey, key]).call(_context, Boolean).join('.');
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 transformAndLocalizeTypeDefinitions = function () {
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: 'nameAllLocales',
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 useConvertCustomTypeDefinitionsForExport = () => {
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 convertCustomTypeDefinitionsForExport = _ref3 => {
1069
- let customTypeDefinitions = _ref3.customTypeDefinitions,
1070
- customFieldPrefix = _ref3.customFieldPrefix,
1071
- expandAll = _ref3.expandAll;
1072
- if (!customTypeDefinitions) return [];
1073
- const transformedCustomTypeDefinitions = transformAndLocalizeTypeDefinitions(customTypeDefinitions);
1074
- return _mapInstanceProperty__default["default"](transformedCustomTypeDefinitions).call(transformedCustomTypeDefinitions, customTypeDefinition => {
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: customTypeDefinition.type.key,
1086
+ name: transformedType.type.name,
1080
1087
  label: l10n.formatLocalizedString({
1081
- nameAllLocales: customTypeDefinition.type.name
1088
+ label: transformedType.type.label
1082
1089
  }, {
1083
- key: 'nameAllLocales',
1090
+ key: 'label',
1084
1091
  locale: language,
1085
1092
  fallbackOrder: languages,
1086
- fallback: customTypeDefinition.type.key
1093
+ fallback: transformedType.type.name
1087
1094
  }),
1088
- fields: _mapInstanceProperty__default["default"](_context2 = customTypeDefinition.fields).call(_context2, fieldDefinition => ({
1089
- name: getCustomFieldFullName({
1090
- customFieldPrefix: customFieldPrefix,
1091
- key: fieldDefinition.name
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
- labelAllLocales: fieldDefinition.label
1101
+ label: fieldDefinition.label
1095
1102
  }, {
1096
- key: 'labelAllLocales',
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
- convertCustomTypeDefinitionsForExport
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.useConvertCustomTypeDefinitionsForExport = useConvertCustomTypeDefinitionsForExport;
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 customFieldKey = 'custom.fields';
1004
- const getCustomFieldFullName = _ref => {
1003
+ const getFieldFullName = _ref => {
1005
1004
  var _context;
1006
- let customFieldPrefix = _ref.customFieldPrefix,
1007
- key = _ref.key;
1008
- return _filterInstanceProperty(_context = [customFieldPrefix, customFieldKey, key]).call(_context, Boolean).join('.');
1005
+ let fieldPrefix = _ref.fieldPrefix,
1006
+ fieldName = _ref.fieldName;
1007
+ return _filterInstanceProperty(_context = [fieldPrefix, fieldName]).call(_context, Boolean).join('.');
1009
1008
  };
1010
- const transformAndLocalizeTypeDefinitions = function () {
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: 'nameAllLocales',
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 useConvertCustomTypeDefinitionsForExport = () => {
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 convertCustomTypeDefinitionsForExport = _ref3 => {
1035
- let customTypeDefinitions = _ref3.customTypeDefinitions,
1036
- customFieldPrefix = _ref3.customFieldPrefix,
1037
- expandAll = _ref3.expandAll;
1038
- if (!customTypeDefinitions) return [];
1039
- const transformedCustomTypeDefinitions = transformAndLocalizeTypeDefinitions(customTypeDefinitions);
1040
- return _mapInstanceProperty(transformedCustomTypeDefinitions).call(transformedCustomTypeDefinitions, customTypeDefinition => {
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: customTypeDefinition.type.key,
1052
+ name: transformedType.type.name,
1046
1053
  label: formatLocalizedString({
1047
- nameAllLocales: customTypeDefinition.type.name
1054
+ label: transformedType.type.label
1048
1055
  }, {
1049
- key: 'nameAllLocales',
1056
+ key: 'label',
1050
1057
  locale: language,
1051
1058
  fallbackOrder: languages,
1052
- fallback: customTypeDefinition.type.key
1059
+ fallback: transformedType.type.name
1053
1060
  }),
1054
- fields: _mapInstanceProperty(_context2 = customTypeDefinition.fields).call(_context2, fieldDefinition => ({
1055
- name: getCustomFieldFullName({
1056
- customFieldPrefix: customFieldPrefix,
1057
- key: fieldDefinition.name
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
- labelAllLocales: fieldDefinition.label
1067
+ label: fieldDefinition.label
1061
1068
  }, {
1062
- key: 'labelAllLocales',
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
- convertCustomTypeDefinitionsForExport
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, useConvertCustomTypeDefinitionsForExport };
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-custom-type-definitions-for-export.js";
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
+ };
@@ -4,4 +4,4 @@ export * from "./form.js";
4
4
  export * from "./resource-type.js";
5
5
  export * from "./output-format.js";
6
6
  export * from "./export-api.js";
7
- export * from "./custom-type-definition.js";
7
+ export * from "./type-definition.js";
@@ -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 { useConvertCustomTypeDefinitionsForExport } from "./@hooks/index.js";
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-20240904091928",
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.32.0",
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 {};