@commercetools-frontend-extensions/import-resources-modal 1.1.1 → 1.2.1
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/{active-drag-drop-area-8456b360.cjs.prod.js → active-drag-drop-area-1ac31437.cjs.prod.js} +1 -1
- package/dist/{active-drag-drop-area-f5c4c801.esm.js → active-drag-drop-area-7c8d7f16.esm.js} +1 -1
- package/dist/{active-drag-drop-area-a3479c4b.cjs.dev.js → active-drag-drop-area-b8f17528.cjs.dev.js} +1 -1
- package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.dev.js +1 -1
- package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.prod.js +1 -1
- package/dist/commercetools-frontend-extensions-import-resources-modal.esm.js +1 -1
- package/dist/declarations/src/@types/resource-type.d.ts +1 -1
- package/dist/{enabled-drop-area-cc25daca.esm.js → enabled-drop-area-8d33207e.esm.js} +1 -1
- package/dist/{enabled-drop-area-668a7291.cjs.prod.js → enabled-drop-area-bb340df2.cjs.prod.js} +1 -1
- package/dist/{enabled-drop-area-83b1b98e.cjs.dev.js → enabled-drop-area-c93b15af.cjs.dev.js} +1 -1
- package/dist/{file-dropped-area-5320497d.cjs.prod.js → file-dropped-area-5632c032.cjs.prod.js} +1 -1
- package/dist/{file-dropped-area-fcc62264.cjs.dev.js → file-dropped-area-5b0aa739.cjs.dev.js} +1 -1
- package/dist/{file-dropped-area-b714e041.esm.js → file-dropped-area-c0f3932c.esm.js} +1 -1
- package/dist/{index-7498d508.cjs.prod.js → index-06262b8c.cjs.prod.js} +56 -95
- package/dist/{index-339a08f1.esm.js → index-79e36c76.esm.js} +56 -95
- package/dist/{index-5b2739bc.cjs.dev.js → index-bea140f8.cjs.dev.js} +56 -95
- package/package.json +28 -28
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var dist_commercetoolsFrontendExtensionsImportResourcesModal = require('./index-
|
|
3
|
+
var dist_commercetoolsFrontendExtensionsImportResourcesModal = require('./index-06262b8c.cjs.prod.js');
|
|
4
4
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
5
5
|
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
6
6
|
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
package/dist/{active-drag-drop-area-f5c4c801.esm.js → active-drag-drop-area-7c8d7f16.esm.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FileDropped, E as EnabledDropArea } from './index-
|
|
1
|
+
import { F as FileDropped, E as EnabledDropArea } from './index-79e36c76.esm.js';
|
|
2
2
|
import { jsx } from '@emotion/react/jsx-runtime';
|
|
3
3
|
import '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
4
4
|
import '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
package/dist/{active-drag-drop-area-a3479c4b.cjs.dev.js → active-drag-drop-area-b8f17528.cjs.dev.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var dist_commercetoolsFrontendExtensionsImportResourcesModal = require('./index-
|
|
3
|
+
var dist_commercetoolsFrontendExtensionsImportResourcesModal = require('./index-bea140f8.cjs.dev.js');
|
|
4
4
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
5
5
|
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
6
6
|
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var dist_commercetoolsFrontendExtensionsImportResourcesModal = require('./index-
|
|
5
|
+
var dist_commercetoolsFrontendExtensionsImportResourcesModal = require('./index-bea140f8.cjs.dev.js');
|
|
6
6
|
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
7
7
|
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
8
8
|
require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var dist_commercetoolsFrontendExtensionsImportResourcesModal = require('./index-
|
|
5
|
+
var dist_commercetoolsFrontendExtensionsImportResourcesModal = require('./index-06262b8c.cjs.prod.js');
|
|
6
6
|
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
7
7
|
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
8
8
|
require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { I as default } from './index-
|
|
1
|
+
export { I as default } from './index-79e36c76.esm.js';
|
|
2
2
|
import '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
3
3
|
import '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
4
4
|
import '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type ResourceType = 'category' | 'product' | 'inventory';
|
|
1
|
+
export type ResourceType = 'category' | 'product' | 'inventory' | 'discount-code';
|
|
@@ -9,7 +9,7 @@ import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object
|
|
|
9
9
|
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
10
10
|
import 'react';
|
|
11
11
|
import { Spacings, Text, Link } from '@commercetools-frontend/ui-kit';
|
|
12
|
-
import { m as messages } from './index-
|
|
12
|
+
import { m as messages } from './index-79e36c76.esm.js';
|
|
13
13
|
import { jsxs, jsx } from '@emotion/react/jsx-runtime';
|
|
14
14
|
import '@babel/runtime-corejs3/core-js-stable/instance/every';
|
|
15
15
|
import 'react-intl';
|
package/dist/{enabled-drop-area-668a7291.cjs.prod.js → enabled-drop-area-bb340df2.cjs.prod.js}
RENAMED
|
@@ -11,7 +11,7 @@ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/obje
|
|
|
11
11
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
12
12
|
require('react');
|
|
13
13
|
var uiKit = require('@commercetools-frontend/ui-kit');
|
|
14
|
-
var dist_commercetoolsFrontendExtensionsImportResourcesModal = require('./index-
|
|
14
|
+
var dist_commercetoolsFrontendExtensionsImportResourcesModal = require('./index-06262b8c.cjs.prod.js');
|
|
15
15
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
16
16
|
require('@babel/runtime-corejs3/core-js-stable/instance/every');
|
|
17
17
|
require('react-intl');
|
package/dist/{enabled-drop-area-83b1b98e.cjs.dev.js → enabled-drop-area-c93b15af.cjs.dev.js}
RENAMED
|
@@ -11,7 +11,7 @@ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/obje
|
|
|
11
11
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
12
12
|
require('react');
|
|
13
13
|
var uiKit = require('@commercetools-frontend/ui-kit');
|
|
14
|
-
var dist_commercetoolsFrontendExtensionsImportResourcesModal = require('./index-
|
|
14
|
+
var dist_commercetoolsFrontendExtensionsImportResourcesModal = require('./index-bea140f8.cjs.dev.js');
|
|
15
15
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
16
16
|
require('@babel/runtime-corejs3/core-js-stable/instance/every');
|
|
17
17
|
require('react-intl');
|
package/dist/{file-dropped-area-5320497d.cjs.prod.js → file-dropped-area-5632c032.cjs.prod.js}
RENAMED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var reactIntl = require('react-intl');
|
|
4
4
|
var uiKit = require('@commercetools-frontend/ui-kit');
|
|
5
|
-
var dist_commercetoolsFrontendExtensionsImportResourcesModal = require('./index-
|
|
5
|
+
var dist_commercetoolsFrontendExtensionsImportResourcesModal = require('./index-06262b8c.cjs.prod.js');
|
|
6
6
|
require('react');
|
|
7
7
|
require('@commercetools-frontend/application-shell-connectors');
|
|
8
8
|
require('@commercetools-frontend/sdk');
|
package/dist/{file-dropped-area-fcc62264.cjs.dev.js → file-dropped-area-5b0aa739.cjs.dev.js}
RENAMED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var reactIntl = require('react-intl');
|
|
4
4
|
var uiKit = require('@commercetools-frontend/ui-kit');
|
|
5
|
-
var dist_commercetoolsFrontendExtensionsImportResourcesModal = require('./index-
|
|
5
|
+
var dist_commercetoolsFrontendExtensionsImportResourcesModal = require('./index-bea140f8.cjs.dev.js');
|
|
6
6
|
require('react');
|
|
7
7
|
require('@commercetools-frontend/application-shell-connectors');
|
|
8
8
|
require('@commercetools-frontend/sdk');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useIntl } from 'react-intl';
|
|
2
2
|
import { Spacings, PaperclipIcon, Constraints, Text, SecondaryButton } from '@commercetools-frontend/ui-kit';
|
|
3
|
-
import { u as useImportResourcesContext, m as messages } from './index-
|
|
3
|
+
import { u as useImportResourcesContext, m as messages } from './index-79e36c76.esm.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import '@commercetools-frontend/application-shell-connectors';
|
|
6
6
|
import '@commercetools-frontend/sdk';
|
|
@@ -80,7 +80,8 @@ var DataTable__default = /*#__PURE__*/_interopDefault(DataTable);
|
|
|
80
80
|
const EnabledResourceType = {
|
|
81
81
|
category: true,
|
|
82
82
|
product: true,
|
|
83
|
-
inventory: true
|
|
83
|
+
inventory: true,
|
|
84
|
+
'discount-code': true
|
|
84
85
|
};
|
|
85
86
|
function isResourceType(maybeResourceType) {
|
|
86
87
|
return typeof maybeResourceType === 'string' && maybeResourceType in EnabledResourceType;
|
|
@@ -112,25 +113,36 @@ const IMPORT_TAG_VALUES = {
|
|
|
112
113
|
};
|
|
113
114
|
const TAG_KEY_SOURCE_FILE_UPLOAD = `${IMPORT_TAG_KEYS.source}:${IMPORT_TAG_VALUES.fileUpload}`;
|
|
114
115
|
|
|
116
|
+
const IMPORTABLE_RESOURCES = {
|
|
117
|
+
CATEGORY: 'category',
|
|
118
|
+
PRODUCT: 'product',
|
|
119
|
+
INVENTORY: 'inventory',
|
|
120
|
+
DISCOUNT_CODE: 'discount-code'
|
|
121
|
+
};
|
|
122
|
+
|
|
115
123
|
const FILE_SIZE_LIMITS_MB = {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
124
|
+
[IMPORTABLE_RESOURCES.CATEGORY]: 10,
|
|
125
|
+
[IMPORTABLE_RESOURCES.INVENTORY]: 10,
|
|
126
|
+
[IMPORTABLE_RESOURCES.PRODUCT]: 35,
|
|
127
|
+
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 10
|
|
119
128
|
};
|
|
120
129
|
const ROW_LIMITS = {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
130
|
+
[IMPORTABLE_RESOURCES.CATEGORY]: 5_000,
|
|
131
|
+
[IMPORTABLE_RESOURCES.INVENTORY]: 4_000,
|
|
132
|
+
[IMPORTABLE_RESOURCES.PRODUCT]: 70_000,
|
|
133
|
+
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 4_000
|
|
124
134
|
};
|
|
125
135
|
const RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS = {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
136
|
+
[IMPORTABLE_RESOURCES.CATEGORY]: 'https://docs.commercetools.com/merchant-center/downloads/category_import_template.csv',
|
|
137
|
+
[IMPORTABLE_RESOURCES.PRODUCT]: 'https://docs.commercetools.com/merchant-center/import-data#download-a-csv-template',
|
|
138
|
+
[IMPORTABLE_RESOURCES.INVENTORY]: 'https://docs.commercetools.com/merchant-center/downloads/inventory_entry_import_template.csv',
|
|
139
|
+
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 'https://docs.commercetools.com/merchant-center/downloads/discount_code_import_template.csv'
|
|
129
140
|
};
|
|
130
141
|
const RESOURCE_TYPE_DOCUMENTATION_LINKS = {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
142
|
+
[IMPORTABLE_RESOURCES.CATEGORY]: 'https://docs.commercetools.com/merchant-center/import-categories#supported-headers-and-values',
|
|
143
|
+
[IMPORTABLE_RESOURCES.PRODUCT]: 'https://docs.commercetools.com/merchant-center/import-products#supported-headers-and-values',
|
|
144
|
+
[IMPORTABLE_RESOURCES.INVENTORY]: 'https://docs.commercetools.com/merchant-center/import-inventory-entries#supported-headers-and-values',
|
|
145
|
+
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 'https://docs.commercetools.com/merchant-center/import-discount-codes#supported-headers-and-values'
|
|
134
146
|
};
|
|
135
147
|
|
|
136
148
|
function ownKeys$f(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; }
|
|
@@ -260,20 +272,6 @@ function getProccessFileURL(projectKey, resourceType, containerKey) {
|
|
|
260
272
|
return `/${projectKey}/${pluralize.plural(resourceType)}/import-containers/${containerKey}/process-file`;
|
|
261
273
|
}
|
|
262
274
|
|
|
263
|
-
function _callSuper$3(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$3() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
264
|
-
function _isNativeReflectConstruct$3() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$3 = function () { return !!t; })(); }
|
|
265
|
-
let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
|
|
266
|
-
function UnexpectedResourceTypeError(resourceType) {
|
|
267
|
-
var _this;
|
|
268
|
-
_classCallCheck(this, UnexpectedResourceTypeError);
|
|
269
|
-
_this = _callSuper$3(this, UnexpectedResourceTypeError, [`Unexpected resource type "${resourceType}"`]);
|
|
270
|
-
_this.name = 'UnexpectedResourceTypeError';
|
|
271
|
-
return _this;
|
|
272
|
-
}
|
|
273
|
-
_inherits(UnexpectedResourceTypeError, _Error);
|
|
274
|
-
return _createClass(UnexpectedResourceTypeError);
|
|
275
|
-
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
276
|
-
|
|
277
275
|
function _callSuper$2(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$2() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
278
276
|
function _isNativeReflectConstruct$2() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$2 = function () { return !!t; })(); }
|
|
279
277
|
let MissingImportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
@@ -799,29 +797,6 @@ const useUpload = () => {
|
|
|
799
797
|
};
|
|
800
798
|
};
|
|
801
799
|
|
|
802
|
-
function resourceTypeToDisplayName$1(_ref) {
|
|
803
|
-
let resourceType = _ref.resourceType,
|
|
804
|
-
_ref$isUpperCase = _ref.isUpperCase,
|
|
805
|
-
isUpperCase = _ref$isUpperCase === void 0 ? false : _ref$isUpperCase,
|
|
806
|
-
_ref$isPlural = _ref.isPlural,
|
|
807
|
-
isPlural = _ref$isPlural === void 0 ? false : _ref$isPlural;
|
|
808
|
-
let displayName;
|
|
809
|
-
switch (resourceType) {
|
|
810
|
-
case 'category':
|
|
811
|
-
displayName = isPlural ? 'Categories' : 'Category';
|
|
812
|
-
break;
|
|
813
|
-
case 'product':
|
|
814
|
-
displayName = isPlural ? 'Products' : 'Product';
|
|
815
|
-
break;
|
|
816
|
-
case 'inventory':
|
|
817
|
-
displayName = isPlural ? 'Inventories' : 'Inventory';
|
|
818
|
-
break;
|
|
819
|
-
default:
|
|
820
|
-
throw new UnexpectedResourceTypeError(resourceType);
|
|
821
|
-
}
|
|
822
|
-
return isUpperCase ? displayName : displayName.toLowerCase();
|
|
823
|
-
}
|
|
824
|
-
|
|
825
800
|
const getBorderColor = state => {
|
|
826
801
|
const borderColors = {
|
|
827
802
|
default: '#909dbc',
|
|
@@ -874,13 +849,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
874
849
|
return /*#__PURE__*/react.css("" , "" );
|
|
875
850
|
}
|
|
876
851
|
|
|
877
|
-
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-
|
|
852
|
+
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-1ac31437.cjs.prod.js' /* webpackChunkName: "active-drag-drop-area" */); }));
|
|
878
853
|
|
|
879
854
|
var DisabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./disabled-drop-area-99c1fa0b.cjs.prod.js' /* webpackChunkName: "disabled-drop-area" */); }));
|
|
880
855
|
|
|
881
|
-
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-
|
|
856
|
+
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-bb340df2.cjs.prod.js' /* webpackChunkName: "enabled-drop-area" */); }));
|
|
882
857
|
|
|
883
|
-
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-
|
|
858
|
+
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-5632c032.cjs.prod.js' /* webpackChunkName: "filed-dropped-area" */); }));
|
|
884
859
|
|
|
885
860
|
function getDropArea(_ref) {
|
|
886
861
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -1051,10 +1026,25 @@ const FileDropArea = () => {
|
|
|
1051
1026
|
};
|
|
1052
1027
|
|
|
1053
1028
|
var sharedMessages = reactIntl.defineMessages({
|
|
1054
|
-
modalTitle: {
|
|
1055
|
-
id: 'ImportResourcesModal.modalTitle',
|
|
1056
|
-
description: 'Label for the modal title',
|
|
1057
|
-
defaultMessage: 'Import
|
|
1029
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.CATEGORY}`]: {
|
|
1030
|
+
id: 'ImportResourcesModal.modalTitle.category',
|
|
1031
|
+
description: 'Label for the categories modal title',
|
|
1032
|
+
defaultMessage: 'Import categories by CSV'
|
|
1033
|
+
},
|
|
1034
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.PRODUCT}`]: {
|
|
1035
|
+
id: 'ImportResourcesModal.modalTitle.product',
|
|
1036
|
+
description: 'Label for the products modal title',
|
|
1037
|
+
defaultMessage: 'Import products by CSV'
|
|
1038
|
+
},
|
|
1039
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.INVENTORY}`]: {
|
|
1040
|
+
id: 'ImportResourcesModal.modalTitle.inventoryEntry',
|
|
1041
|
+
description: 'Label for the inventories modal title',
|
|
1042
|
+
defaultMessage: 'Import inventories by CSV'
|
|
1043
|
+
},
|
|
1044
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.DISCOUNT_CODE}`]: {
|
|
1045
|
+
id: 'ImportResourcesModal.modalTitle.discountCode',
|
|
1046
|
+
description: 'Label for the inventories modal title',
|
|
1047
|
+
defaultMessage: 'Import discount codes by CSV'
|
|
1058
1048
|
},
|
|
1059
1049
|
uploadButton: {
|
|
1060
1050
|
id: 'ImportResourcesModal.uploadButton',
|
|
@@ -1079,19 +1069,13 @@ const Upload = () => {
|
|
|
1079
1069
|
onClose = _useImportResourcesCo.onClose,
|
|
1080
1070
|
resourceTypes = _useImportResourcesCo.resourceTypes;
|
|
1081
1071
|
const intl = reactIntl.useIntl();
|
|
1082
|
-
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1083
|
-
resourceType: state.resourceType,
|
|
1084
|
-
isPlural: true
|
|
1085
|
-
});
|
|
1086
1072
|
const _useUpload = useUpload(),
|
|
1087
1073
|
handleUploadAndValidation = _useUpload.handleUploadAndValidation;
|
|
1088
1074
|
const isMultipleResourceTypes = resourceTypes.length > 1;
|
|
1089
1075
|
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
1090
1076
|
size: 16,
|
|
1091
1077
|
isOpen: true,
|
|
1092
|
-
title: intl.formatMessage(sharedMessages.
|
|
1093
|
-
resourceType: resourceTypePlural
|
|
1094
|
-
}),
|
|
1078
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1095
1079
|
labelPrimary: intl.formatMessage(sharedMessages.uploadButton),
|
|
1096
1080
|
onPrimaryButtonClick: handleUploadAndValidation,
|
|
1097
1081
|
isPrimaryButtonDisabled: !Boolean(state.droppedFile),
|
|
@@ -1254,9 +1238,7 @@ function UploadPreviewModal() {
|
|
|
1254
1238
|
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
1255
1239
|
size: 16,
|
|
1256
1240
|
isOpen: true,
|
|
1257
|
-
title: intl.formatMessage(sharedMessages.
|
|
1258
|
-
resourceType: state.resourceType
|
|
1259
|
-
}),
|
|
1241
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1260
1242
|
labelPrimary: intl.formatMessage(messages$3.continue),
|
|
1261
1243
|
onSecondaryButtonClick: () => onClose({
|
|
1262
1244
|
shouldDeleteImportContainer: true
|
|
@@ -1374,12 +1356,7 @@ const ImportConfirmationModal = () => {
|
|
|
1374
1356
|
})
|
|
1375
1357
|
});
|
|
1376
1358
|
return jsxRuntime.jsx(applicationComponents.ConfirmationDialog, {
|
|
1377
|
-
title: intl.formatMessage(sharedMessages.
|
|
1378
|
-
resourceType: resourceTypeToDisplayName$1({
|
|
1379
|
-
resourceType: state.resourceType,
|
|
1380
|
-
isPlural: true
|
|
1381
|
-
})
|
|
1382
|
-
}),
|
|
1359
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1383
1360
|
labelPrimary: intl.formatMessage(messages$3.startImportButton),
|
|
1384
1361
|
isOpen: true,
|
|
1385
1362
|
onClose: () => onClose({
|
|
@@ -1550,12 +1527,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1550
1527
|
return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1551
1528
|
size: 16,
|
|
1552
1529
|
isOpen: true,
|
|
1553
|
-
title: intl.formatMessage(sharedMessages.
|
|
1554
|
-
resourceType: resourceTypeToDisplayName$1({
|
|
1555
|
-
resourceType: state.resourceType,
|
|
1556
|
-
isPlural: true
|
|
1557
|
-
})
|
|
1558
|
-
}),
|
|
1530
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1559
1531
|
onClose: () => onClose(),
|
|
1560
1532
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1561
1533
|
scale: "l",
|
|
@@ -1668,12 +1640,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1668
1640
|
return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1669
1641
|
size: 16,
|
|
1670
1642
|
isOpen: true,
|
|
1671
|
-
title: intl.formatMessage(sharedMessages.
|
|
1672
|
-
resourceType: resourceTypeToDisplayName$1({
|
|
1673
|
-
resourceType: state.resourceType,
|
|
1674
|
-
isPlural: true
|
|
1675
|
-
})
|
|
1676
|
-
}),
|
|
1643
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1677
1644
|
onClose: onClose,
|
|
1678
1645
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1679
1646
|
scale: "l",
|
|
@@ -1771,16 +1738,10 @@ const Uploading = () => {
|
|
|
1771
1738
|
state = _useImportResourcesCo.state,
|
|
1772
1739
|
actions = _useImportResourcesCo.actions,
|
|
1773
1740
|
onClose = _useImportResourcesCo.onClose;
|
|
1774
|
-
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1775
|
-
resourceType: state.resourceType,
|
|
1776
|
-
isPlural: true
|
|
1777
|
-
});
|
|
1778
1741
|
if (state.droppedFile?.name) return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1779
1742
|
size: 16,
|
|
1780
1743
|
isOpen: true,
|
|
1781
|
-
title: intl.formatMessage(sharedMessages.
|
|
1782
|
-
resourceType: resourceTypePlural
|
|
1783
|
-
}),
|
|
1744
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1784
1745
|
onClose: () => onClose({
|
|
1785
1746
|
shouldDeleteImportContainer: true
|
|
1786
1747
|
}),
|
|
@@ -1855,11 +1816,11 @@ var messages$1 = reactIntl.defineMessages({
|
|
|
1855
1816
|
|
|
1856
1817
|
const resourceTypeToDisplayName = resourceType => {
|
|
1857
1818
|
switch (resourceType) {
|
|
1858
|
-
case
|
|
1819
|
+
case IMPORTABLE_RESOURCES.PRODUCT:
|
|
1859
1820
|
return messages$1.products;
|
|
1860
|
-
case
|
|
1821
|
+
case IMPORTABLE_RESOURCES.INVENTORY:
|
|
1861
1822
|
return messages$1.inventories;
|
|
1862
|
-
case
|
|
1823
|
+
case IMPORTABLE_RESOURCES.CATEGORY:
|
|
1863
1824
|
return messages$1.categories;
|
|
1864
1825
|
default:
|
|
1865
1826
|
throw new Error(`Unknown resource type: ${resourceType}`);
|
|
@@ -51,7 +51,8 @@ import { parseChunkImport, mapLocaleToIntlLocale } from '@commercetools-frontend
|
|
|
51
51
|
const EnabledResourceType = {
|
|
52
52
|
category: true,
|
|
53
53
|
product: true,
|
|
54
|
-
inventory: true
|
|
54
|
+
inventory: true,
|
|
55
|
+
'discount-code': true
|
|
55
56
|
};
|
|
56
57
|
function isResourceType(maybeResourceType) {
|
|
57
58
|
return typeof maybeResourceType === 'string' && maybeResourceType in EnabledResourceType;
|
|
@@ -83,25 +84,36 @@ const IMPORT_TAG_VALUES = {
|
|
|
83
84
|
};
|
|
84
85
|
const TAG_KEY_SOURCE_FILE_UPLOAD = `${IMPORT_TAG_KEYS.source}:${IMPORT_TAG_VALUES.fileUpload}`;
|
|
85
86
|
|
|
87
|
+
const IMPORTABLE_RESOURCES = {
|
|
88
|
+
CATEGORY: 'category',
|
|
89
|
+
PRODUCT: 'product',
|
|
90
|
+
INVENTORY: 'inventory',
|
|
91
|
+
DISCOUNT_CODE: 'discount-code'
|
|
92
|
+
};
|
|
93
|
+
|
|
86
94
|
const FILE_SIZE_LIMITS_MB = {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
95
|
+
[IMPORTABLE_RESOURCES.CATEGORY]: 10,
|
|
96
|
+
[IMPORTABLE_RESOURCES.INVENTORY]: 10,
|
|
97
|
+
[IMPORTABLE_RESOURCES.PRODUCT]: 35,
|
|
98
|
+
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 10
|
|
90
99
|
};
|
|
91
100
|
const ROW_LIMITS = {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
101
|
+
[IMPORTABLE_RESOURCES.CATEGORY]: 5_000,
|
|
102
|
+
[IMPORTABLE_RESOURCES.INVENTORY]: 4_000,
|
|
103
|
+
[IMPORTABLE_RESOURCES.PRODUCT]: 70_000,
|
|
104
|
+
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 4_000
|
|
95
105
|
};
|
|
96
106
|
const RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS = {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
107
|
+
[IMPORTABLE_RESOURCES.CATEGORY]: 'https://docs.commercetools.com/merchant-center/downloads/category_import_template.csv',
|
|
108
|
+
[IMPORTABLE_RESOURCES.PRODUCT]: 'https://docs.commercetools.com/merchant-center/import-data#download-a-csv-template',
|
|
109
|
+
[IMPORTABLE_RESOURCES.INVENTORY]: 'https://docs.commercetools.com/merchant-center/downloads/inventory_entry_import_template.csv',
|
|
110
|
+
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 'https://docs.commercetools.com/merchant-center/downloads/discount_code_import_template.csv'
|
|
100
111
|
};
|
|
101
112
|
const RESOURCE_TYPE_DOCUMENTATION_LINKS = {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
113
|
+
[IMPORTABLE_RESOURCES.CATEGORY]: 'https://docs.commercetools.com/merchant-center/import-categories#supported-headers-and-values',
|
|
114
|
+
[IMPORTABLE_RESOURCES.PRODUCT]: 'https://docs.commercetools.com/merchant-center/import-products#supported-headers-and-values',
|
|
115
|
+
[IMPORTABLE_RESOURCES.INVENTORY]: 'https://docs.commercetools.com/merchant-center/import-inventory-entries#supported-headers-and-values',
|
|
116
|
+
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 'https://docs.commercetools.com/merchant-center/import-discount-codes#supported-headers-and-values'
|
|
105
117
|
};
|
|
106
118
|
|
|
107
119
|
function ownKeys$f(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; }
|
|
@@ -231,20 +243,6 @@ function getProccessFileURL(projectKey, resourceType, containerKey) {
|
|
|
231
243
|
return `/${projectKey}/${plural(resourceType)}/import-containers/${containerKey}/process-file`;
|
|
232
244
|
}
|
|
233
245
|
|
|
234
|
-
function _callSuper$3(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$3() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
235
|
-
function _isNativeReflectConstruct$3() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$3 = function () { return !!t; })(); }
|
|
236
|
-
let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
|
|
237
|
-
function UnexpectedResourceTypeError(resourceType) {
|
|
238
|
-
var _this;
|
|
239
|
-
_classCallCheck(this, UnexpectedResourceTypeError);
|
|
240
|
-
_this = _callSuper$3(this, UnexpectedResourceTypeError, [`Unexpected resource type "${resourceType}"`]);
|
|
241
|
-
_this.name = 'UnexpectedResourceTypeError';
|
|
242
|
-
return _this;
|
|
243
|
-
}
|
|
244
|
-
_inherits(UnexpectedResourceTypeError, _Error);
|
|
245
|
-
return _createClass(UnexpectedResourceTypeError);
|
|
246
|
-
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
247
|
-
|
|
248
246
|
function _callSuper$2(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$2() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
249
247
|
function _isNativeReflectConstruct$2() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$2 = function () { return !!t; })(); }
|
|
250
248
|
let MissingImportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
@@ -770,29 +768,6 @@ const useUpload = () => {
|
|
|
770
768
|
};
|
|
771
769
|
};
|
|
772
770
|
|
|
773
|
-
function resourceTypeToDisplayName$1(_ref) {
|
|
774
|
-
let resourceType = _ref.resourceType,
|
|
775
|
-
_ref$isUpperCase = _ref.isUpperCase,
|
|
776
|
-
isUpperCase = _ref$isUpperCase === void 0 ? false : _ref$isUpperCase,
|
|
777
|
-
_ref$isPlural = _ref.isPlural,
|
|
778
|
-
isPlural = _ref$isPlural === void 0 ? false : _ref$isPlural;
|
|
779
|
-
let displayName;
|
|
780
|
-
switch (resourceType) {
|
|
781
|
-
case 'category':
|
|
782
|
-
displayName = isPlural ? 'Categories' : 'Category';
|
|
783
|
-
break;
|
|
784
|
-
case 'product':
|
|
785
|
-
displayName = isPlural ? 'Products' : 'Product';
|
|
786
|
-
break;
|
|
787
|
-
case 'inventory':
|
|
788
|
-
displayName = isPlural ? 'Inventories' : 'Inventory';
|
|
789
|
-
break;
|
|
790
|
-
default:
|
|
791
|
-
throw new UnexpectedResourceTypeError(resourceType);
|
|
792
|
-
}
|
|
793
|
-
return isUpperCase ? displayName : displayName.toLowerCase();
|
|
794
|
-
}
|
|
795
|
-
|
|
796
771
|
const getBorderColor = state => {
|
|
797
772
|
const borderColors = {
|
|
798
773
|
default: '#909dbc',
|
|
@@ -848,13 +823,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
848
823
|
return /*#__PURE__*/css(process.env.NODE_ENV === "production" ? "" : ";label:getDefaultDropWrapperStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRyb3AtYXJlYS13cmFwcGVyLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE0QlkiLCJmaWxlIjoiZHJvcC1hcmVhLXdyYXBwZXIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnXG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCdcbmltcG9ydCB7IHR5cGUgRHJvcHpvbmVSb290UHJvcHMgfSBmcm9tICdyZWFjdC1kcm9wem9uZSdcbmltcG9ydCB7IHN0eWxlcyB9IGZyb20gJy4vc3R5bGVzJ1xuaW1wb3J0IHsgdHlwZSBEcm9wQXJlYVN0YXRlIH0gZnJvbSAnQHR5cGVzJ1xuXG5pbnRlcmZhY2UgRHJvcFdyYXBwZXJQcm9wcyBleHRlbmRzIERyb3B6b25lUm9vdFByb3BzIHtcbiAgZHJvcEFyZWFTdGF0ZTogRHJvcEFyZWFTdGF0ZVxufVxuZXhwb3J0IGNvbnN0IERyb3BXcmFwcGVyID0gc3R5bGVkLmRpdjxEcm9wV3JhcHBlclByb3BzPmBcbiAgJHtzdHlsZXMuYmFzZX1cbiAgJHsocHJvcHMpID0+IHtcbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ2Rpc2FibGVkJykge1xuICAgICAgcmV0dXJuIHN0eWxlcy5kaXNhYmxlZFxuICAgIH1cbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ3JlYWR5LWZvci1kcm9wJykge1xuICAgICAgcmV0dXJuIHN0eWxlcy5yZWFkeUZvckRyb3BcbiAgICB9XG4gICAgaWYgKHByb3BzLmRyb3BBcmVhU3RhdGUgPT09ICdhY3RpdmUtZHJhZycpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuYWN0aXZlRHJhZ1xuICAgIH1cbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ2ZpbGUtZHJvcHBlZCcpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuZmlsZURyb3BwZWRcbiAgICB9XG4gICAgcmV0dXJuIGdldERlZmF1bHREcm9wV3JhcHBlclN0eWxlcyhwcm9wcy5kcm9wQXJlYVN0YXRlKVxuICB9fVxuYFxuZnVuY3Rpb24gZ2V0RGVmYXVsdERyb3BXcmFwcGVyU3R5bGVzKF9kcm9wQXJlYVN0YXRlOiBuZXZlcikge1xuICByZXR1cm4gY3NzYGBcbn1cbiJdfQ== */");
|
|
849
824
|
}
|
|
850
825
|
|
|
851
|
-
var ActiveDragDropArea = /*#__PURE__*/lazy(() => import('./active-drag-drop-area-
|
|
826
|
+
var ActiveDragDropArea = /*#__PURE__*/lazy(() => import('./active-drag-drop-area-7c8d7f16.esm.js' /* webpackChunkName: "active-drag-drop-area" */));
|
|
852
827
|
|
|
853
828
|
var DisabledDropArea = /*#__PURE__*/lazy(() => import('./disabled-drop-area-2c088477.esm.js' /* webpackChunkName: "disabled-drop-area" */));
|
|
854
829
|
|
|
855
|
-
var EnabledDropArea = /*#__PURE__*/lazy(() => import('./enabled-drop-area-
|
|
830
|
+
var EnabledDropArea = /*#__PURE__*/lazy(() => import('./enabled-drop-area-8d33207e.esm.js' /* webpackChunkName: "enabled-drop-area" */));
|
|
856
831
|
|
|
857
|
-
var FileDropped = /*#__PURE__*/lazy(() => import('./file-dropped-area-
|
|
832
|
+
var FileDropped = /*#__PURE__*/lazy(() => import('./file-dropped-area-c0f3932c.esm.js' /* webpackChunkName: "filed-dropped-area" */));
|
|
858
833
|
|
|
859
834
|
function getDropArea(_ref) {
|
|
860
835
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -1025,10 +1000,25 @@ const FileDropArea = () => {
|
|
|
1025
1000
|
};
|
|
1026
1001
|
|
|
1027
1002
|
var sharedMessages = defineMessages({
|
|
1028
|
-
modalTitle: {
|
|
1029
|
-
id: 'ImportResourcesModal.modalTitle',
|
|
1030
|
-
description: 'Label for the modal title',
|
|
1031
|
-
defaultMessage: 'Import
|
|
1003
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.CATEGORY}`]: {
|
|
1004
|
+
id: 'ImportResourcesModal.modalTitle.category',
|
|
1005
|
+
description: 'Label for the categories modal title',
|
|
1006
|
+
defaultMessage: 'Import categories by CSV'
|
|
1007
|
+
},
|
|
1008
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.PRODUCT}`]: {
|
|
1009
|
+
id: 'ImportResourcesModal.modalTitle.product',
|
|
1010
|
+
description: 'Label for the products modal title',
|
|
1011
|
+
defaultMessage: 'Import products by CSV'
|
|
1012
|
+
},
|
|
1013
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.INVENTORY}`]: {
|
|
1014
|
+
id: 'ImportResourcesModal.modalTitle.inventoryEntry',
|
|
1015
|
+
description: 'Label for the inventories modal title',
|
|
1016
|
+
defaultMessage: 'Import inventories by CSV'
|
|
1017
|
+
},
|
|
1018
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.DISCOUNT_CODE}`]: {
|
|
1019
|
+
id: 'ImportResourcesModal.modalTitle.discountCode',
|
|
1020
|
+
description: 'Label for the inventories modal title',
|
|
1021
|
+
defaultMessage: 'Import discount codes by CSV'
|
|
1032
1022
|
},
|
|
1033
1023
|
uploadButton: {
|
|
1034
1024
|
id: 'ImportResourcesModal.uploadButton',
|
|
@@ -1053,19 +1043,13 @@ const Upload = () => {
|
|
|
1053
1043
|
onClose = _useImportResourcesCo.onClose,
|
|
1054
1044
|
resourceTypes = _useImportResourcesCo.resourceTypes;
|
|
1055
1045
|
const intl = useIntl();
|
|
1056
|
-
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1057
|
-
resourceType: state.resourceType,
|
|
1058
|
-
isPlural: true
|
|
1059
|
-
});
|
|
1060
1046
|
const _useUpload = useUpload(),
|
|
1061
1047
|
handleUploadAndValidation = _useUpload.handleUploadAndValidation;
|
|
1062
1048
|
const isMultipleResourceTypes = resourceTypes.length > 1;
|
|
1063
1049
|
return jsx(FormDialog, {
|
|
1064
1050
|
size: 16,
|
|
1065
1051
|
isOpen: true,
|
|
1066
|
-
title: intl.formatMessage(sharedMessages.
|
|
1067
|
-
resourceType: resourceTypePlural
|
|
1068
|
-
}),
|
|
1052
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1069
1053
|
labelPrimary: intl.formatMessage(sharedMessages.uploadButton),
|
|
1070
1054
|
onPrimaryButtonClick: handleUploadAndValidation,
|
|
1071
1055
|
isPrimaryButtonDisabled: !Boolean(state.droppedFile),
|
|
@@ -1231,9 +1215,7 @@ function UploadPreviewModal() {
|
|
|
1231
1215
|
return jsx(FormDialog, {
|
|
1232
1216
|
size: 16,
|
|
1233
1217
|
isOpen: true,
|
|
1234
|
-
title: intl.formatMessage(sharedMessages.
|
|
1235
|
-
resourceType: state.resourceType
|
|
1236
|
-
}),
|
|
1218
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1237
1219
|
labelPrimary: intl.formatMessage(messages$3.continue),
|
|
1238
1220
|
onSecondaryButtonClick: () => onClose({
|
|
1239
1221
|
shouldDeleteImportContainer: true
|
|
@@ -1351,12 +1333,7 @@ const ImportConfirmationModal = () => {
|
|
|
1351
1333
|
})
|
|
1352
1334
|
});
|
|
1353
1335
|
return jsx(ConfirmationDialog, {
|
|
1354
|
-
title: intl.formatMessage(sharedMessages.
|
|
1355
|
-
resourceType: resourceTypeToDisplayName$1({
|
|
1356
|
-
resourceType: state.resourceType,
|
|
1357
|
-
isPlural: true
|
|
1358
|
-
})
|
|
1359
|
-
}),
|
|
1336
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1360
1337
|
labelPrimary: intl.formatMessage(messages$3.startImportButton),
|
|
1361
1338
|
isOpen: true,
|
|
1362
1339
|
onClose: () => onClose({
|
|
@@ -1527,12 +1504,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1527
1504
|
return jsx(InfoDialog, {
|
|
1528
1505
|
size: 16,
|
|
1529
1506
|
isOpen: true,
|
|
1530
|
-
title: intl.formatMessage(sharedMessages.
|
|
1531
|
-
resourceType: resourceTypeToDisplayName$1({
|
|
1532
|
-
resourceType: state.resourceType,
|
|
1533
|
-
isPlural: true
|
|
1534
|
-
})
|
|
1535
|
-
}),
|
|
1507
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1536
1508
|
onClose: () => onClose(),
|
|
1537
1509
|
children: jsxs(Spacings.Stack, {
|
|
1538
1510
|
scale: "l",
|
|
@@ -1645,12 +1617,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1645
1617
|
return jsx(InfoDialog, {
|
|
1646
1618
|
size: 16,
|
|
1647
1619
|
isOpen: true,
|
|
1648
|
-
title: intl.formatMessage(sharedMessages.
|
|
1649
|
-
resourceType: resourceTypeToDisplayName$1({
|
|
1650
|
-
resourceType: state.resourceType,
|
|
1651
|
-
isPlural: true
|
|
1652
|
-
})
|
|
1653
|
-
}),
|
|
1620
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1654
1621
|
onClose: onClose,
|
|
1655
1622
|
children: jsxs(Spacings.Stack, {
|
|
1656
1623
|
scale: "l",
|
|
@@ -1748,16 +1715,10 @@ const Uploading = () => {
|
|
|
1748
1715
|
state = _useImportResourcesCo.state,
|
|
1749
1716
|
actions = _useImportResourcesCo.actions,
|
|
1750
1717
|
onClose = _useImportResourcesCo.onClose;
|
|
1751
|
-
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1752
|
-
resourceType: state.resourceType,
|
|
1753
|
-
isPlural: true
|
|
1754
|
-
});
|
|
1755
1718
|
if (state.droppedFile?.name) return jsx(InfoDialog, {
|
|
1756
1719
|
size: 16,
|
|
1757
1720
|
isOpen: true,
|
|
1758
|
-
title: intl.formatMessage(sharedMessages.
|
|
1759
|
-
resourceType: resourceTypePlural
|
|
1760
|
-
}),
|
|
1721
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1761
1722
|
onClose: () => onClose({
|
|
1762
1723
|
shouldDeleteImportContainer: true
|
|
1763
1724
|
}),
|
|
@@ -1832,11 +1793,11 @@ var messages$1 = defineMessages({
|
|
|
1832
1793
|
|
|
1833
1794
|
const resourceTypeToDisplayName = resourceType => {
|
|
1834
1795
|
switch (resourceType) {
|
|
1835
|
-
case
|
|
1796
|
+
case IMPORTABLE_RESOURCES.PRODUCT:
|
|
1836
1797
|
return messages$1.products;
|
|
1837
|
-
case
|
|
1798
|
+
case IMPORTABLE_RESOURCES.INVENTORY:
|
|
1838
1799
|
return messages$1.inventories;
|
|
1839
|
-
case
|
|
1800
|
+
case IMPORTABLE_RESOURCES.CATEGORY:
|
|
1840
1801
|
return messages$1.categories;
|
|
1841
1802
|
default:
|
|
1842
1803
|
throw new Error(`Unknown resource type: ${resourceType}`);
|
|
@@ -80,7 +80,8 @@ var DataTable__default = /*#__PURE__*/_interopDefault(DataTable);
|
|
|
80
80
|
const EnabledResourceType = {
|
|
81
81
|
category: true,
|
|
82
82
|
product: true,
|
|
83
|
-
inventory: true
|
|
83
|
+
inventory: true,
|
|
84
|
+
'discount-code': true
|
|
84
85
|
};
|
|
85
86
|
function isResourceType(maybeResourceType) {
|
|
86
87
|
return typeof maybeResourceType === 'string' && maybeResourceType in EnabledResourceType;
|
|
@@ -112,25 +113,36 @@ const IMPORT_TAG_VALUES = {
|
|
|
112
113
|
};
|
|
113
114
|
const TAG_KEY_SOURCE_FILE_UPLOAD = `${IMPORT_TAG_KEYS.source}:${IMPORT_TAG_VALUES.fileUpload}`;
|
|
114
115
|
|
|
116
|
+
const IMPORTABLE_RESOURCES = {
|
|
117
|
+
CATEGORY: 'category',
|
|
118
|
+
PRODUCT: 'product',
|
|
119
|
+
INVENTORY: 'inventory',
|
|
120
|
+
DISCOUNT_CODE: 'discount-code'
|
|
121
|
+
};
|
|
122
|
+
|
|
115
123
|
const FILE_SIZE_LIMITS_MB = {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
124
|
+
[IMPORTABLE_RESOURCES.CATEGORY]: 10,
|
|
125
|
+
[IMPORTABLE_RESOURCES.INVENTORY]: 10,
|
|
126
|
+
[IMPORTABLE_RESOURCES.PRODUCT]: 35,
|
|
127
|
+
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 10
|
|
119
128
|
};
|
|
120
129
|
const ROW_LIMITS = {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
130
|
+
[IMPORTABLE_RESOURCES.CATEGORY]: 5_000,
|
|
131
|
+
[IMPORTABLE_RESOURCES.INVENTORY]: 4_000,
|
|
132
|
+
[IMPORTABLE_RESOURCES.PRODUCT]: 70_000,
|
|
133
|
+
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 4_000
|
|
124
134
|
};
|
|
125
135
|
const RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS = {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
136
|
+
[IMPORTABLE_RESOURCES.CATEGORY]: 'https://docs.commercetools.com/merchant-center/downloads/category_import_template.csv',
|
|
137
|
+
[IMPORTABLE_RESOURCES.PRODUCT]: 'https://docs.commercetools.com/merchant-center/import-data#download-a-csv-template',
|
|
138
|
+
[IMPORTABLE_RESOURCES.INVENTORY]: 'https://docs.commercetools.com/merchant-center/downloads/inventory_entry_import_template.csv',
|
|
139
|
+
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 'https://docs.commercetools.com/merchant-center/downloads/discount_code_import_template.csv'
|
|
129
140
|
};
|
|
130
141
|
const RESOURCE_TYPE_DOCUMENTATION_LINKS = {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
142
|
+
[IMPORTABLE_RESOURCES.CATEGORY]: 'https://docs.commercetools.com/merchant-center/import-categories#supported-headers-and-values',
|
|
143
|
+
[IMPORTABLE_RESOURCES.PRODUCT]: 'https://docs.commercetools.com/merchant-center/import-products#supported-headers-and-values',
|
|
144
|
+
[IMPORTABLE_RESOURCES.INVENTORY]: 'https://docs.commercetools.com/merchant-center/import-inventory-entries#supported-headers-and-values',
|
|
145
|
+
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 'https://docs.commercetools.com/merchant-center/import-discount-codes#supported-headers-and-values'
|
|
134
146
|
};
|
|
135
147
|
|
|
136
148
|
function ownKeys$f(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; }
|
|
@@ -260,20 +272,6 @@ function getProccessFileURL(projectKey, resourceType, containerKey) {
|
|
|
260
272
|
return `/${projectKey}/${pluralize.plural(resourceType)}/import-containers/${containerKey}/process-file`;
|
|
261
273
|
}
|
|
262
274
|
|
|
263
|
-
function _callSuper$3(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$3() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
264
|
-
function _isNativeReflectConstruct$3() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$3 = function () { return !!t; })(); }
|
|
265
|
-
let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
|
|
266
|
-
function UnexpectedResourceTypeError(resourceType) {
|
|
267
|
-
var _this;
|
|
268
|
-
_classCallCheck(this, UnexpectedResourceTypeError);
|
|
269
|
-
_this = _callSuper$3(this, UnexpectedResourceTypeError, [`Unexpected resource type "${resourceType}"`]);
|
|
270
|
-
_this.name = 'UnexpectedResourceTypeError';
|
|
271
|
-
return _this;
|
|
272
|
-
}
|
|
273
|
-
_inherits(UnexpectedResourceTypeError, _Error);
|
|
274
|
-
return _createClass(UnexpectedResourceTypeError);
|
|
275
|
-
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
276
|
-
|
|
277
275
|
function _callSuper$2(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$2() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
278
276
|
function _isNativeReflectConstruct$2() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$2 = function () { return !!t; })(); }
|
|
279
277
|
let MissingImportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
@@ -799,29 +797,6 @@ const useUpload = () => {
|
|
|
799
797
|
};
|
|
800
798
|
};
|
|
801
799
|
|
|
802
|
-
function resourceTypeToDisplayName$1(_ref) {
|
|
803
|
-
let resourceType = _ref.resourceType,
|
|
804
|
-
_ref$isUpperCase = _ref.isUpperCase,
|
|
805
|
-
isUpperCase = _ref$isUpperCase === void 0 ? false : _ref$isUpperCase,
|
|
806
|
-
_ref$isPlural = _ref.isPlural,
|
|
807
|
-
isPlural = _ref$isPlural === void 0 ? false : _ref$isPlural;
|
|
808
|
-
let displayName;
|
|
809
|
-
switch (resourceType) {
|
|
810
|
-
case 'category':
|
|
811
|
-
displayName = isPlural ? 'Categories' : 'Category';
|
|
812
|
-
break;
|
|
813
|
-
case 'product':
|
|
814
|
-
displayName = isPlural ? 'Products' : 'Product';
|
|
815
|
-
break;
|
|
816
|
-
case 'inventory':
|
|
817
|
-
displayName = isPlural ? 'Inventories' : 'Inventory';
|
|
818
|
-
break;
|
|
819
|
-
default:
|
|
820
|
-
throw new UnexpectedResourceTypeError(resourceType);
|
|
821
|
-
}
|
|
822
|
-
return isUpperCase ? displayName : displayName.toLowerCase();
|
|
823
|
-
}
|
|
824
|
-
|
|
825
800
|
const getBorderColor = state => {
|
|
826
801
|
const borderColors = {
|
|
827
802
|
default: '#909dbc',
|
|
@@ -877,13 +852,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
877
852
|
return /*#__PURE__*/react.css(process.env.NODE_ENV === "production" ? "" : ";label:getDefaultDropWrapperStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRyb3AtYXJlYS13cmFwcGVyLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE0QlkiLCJmaWxlIjoiZHJvcC1hcmVhLXdyYXBwZXIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnXG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCdcbmltcG9ydCB7IHR5cGUgRHJvcHpvbmVSb290UHJvcHMgfSBmcm9tICdyZWFjdC1kcm9wem9uZSdcbmltcG9ydCB7IHN0eWxlcyB9IGZyb20gJy4vc3R5bGVzJ1xuaW1wb3J0IHsgdHlwZSBEcm9wQXJlYVN0YXRlIH0gZnJvbSAnQHR5cGVzJ1xuXG5pbnRlcmZhY2UgRHJvcFdyYXBwZXJQcm9wcyBleHRlbmRzIERyb3B6b25lUm9vdFByb3BzIHtcbiAgZHJvcEFyZWFTdGF0ZTogRHJvcEFyZWFTdGF0ZVxufVxuZXhwb3J0IGNvbnN0IERyb3BXcmFwcGVyID0gc3R5bGVkLmRpdjxEcm9wV3JhcHBlclByb3BzPmBcbiAgJHtzdHlsZXMuYmFzZX1cbiAgJHsocHJvcHMpID0+IHtcbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ2Rpc2FibGVkJykge1xuICAgICAgcmV0dXJuIHN0eWxlcy5kaXNhYmxlZFxuICAgIH1cbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ3JlYWR5LWZvci1kcm9wJykge1xuICAgICAgcmV0dXJuIHN0eWxlcy5yZWFkeUZvckRyb3BcbiAgICB9XG4gICAgaWYgKHByb3BzLmRyb3BBcmVhU3RhdGUgPT09ICdhY3RpdmUtZHJhZycpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuYWN0aXZlRHJhZ1xuICAgIH1cbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ2ZpbGUtZHJvcHBlZCcpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuZmlsZURyb3BwZWRcbiAgICB9XG4gICAgcmV0dXJuIGdldERlZmF1bHREcm9wV3JhcHBlclN0eWxlcyhwcm9wcy5kcm9wQXJlYVN0YXRlKVxuICB9fVxuYFxuZnVuY3Rpb24gZ2V0RGVmYXVsdERyb3BXcmFwcGVyU3R5bGVzKF9kcm9wQXJlYVN0YXRlOiBuZXZlcikge1xuICByZXR1cm4gY3NzYGBcbn1cbiJdfQ== */");
|
|
878
853
|
}
|
|
879
854
|
|
|
880
|
-
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-
|
|
855
|
+
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-b8f17528.cjs.dev.js' /* webpackChunkName: "active-drag-drop-area" */); }));
|
|
881
856
|
|
|
882
857
|
var DisabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./disabled-drop-area-aa78075b.cjs.dev.js' /* webpackChunkName: "disabled-drop-area" */); }));
|
|
883
858
|
|
|
884
|
-
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-
|
|
859
|
+
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-c93b15af.cjs.dev.js' /* webpackChunkName: "enabled-drop-area" */); }));
|
|
885
860
|
|
|
886
|
-
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-
|
|
861
|
+
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-5b0aa739.cjs.dev.js' /* webpackChunkName: "filed-dropped-area" */); }));
|
|
887
862
|
|
|
888
863
|
function getDropArea(_ref) {
|
|
889
864
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -1054,10 +1029,25 @@ const FileDropArea = () => {
|
|
|
1054
1029
|
};
|
|
1055
1030
|
|
|
1056
1031
|
var sharedMessages = reactIntl.defineMessages({
|
|
1057
|
-
modalTitle: {
|
|
1058
|
-
id: 'ImportResourcesModal.modalTitle',
|
|
1059
|
-
description: 'Label for the modal title',
|
|
1060
|
-
defaultMessage: 'Import
|
|
1032
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.CATEGORY}`]: {
|
|
1033
|
+
id: 'ImportResourcesModal.modalTitle.category',
|
|
1034
|
+
description: 'Label for the categories modal title',
|
|
1035
|
+
defaultMessage: 'Import categories by CSV'
|
|
1036
|
+
},
|
|
1037
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.PRODUCT}`]: {
|
|
1038
|
+
id: 'ImportResourcesModal.modalTitle.product',
|
|
1039
|
+
description: 'Label for the products modal title',
|
|
1040
|
+
defaultMessage: 'Import products by CSV'
|
|
1041
|
+
},
|
|
1042
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.INVENTORY}`]: {
|
|
1043
|
+
id: 'ImportResourcesModal.modalTitle.inventoryEntry',
|
|
1044
|
+
description: 'Label for the inventories modal title',
|
|
1045
|
+
defaultMessage: 'Import inventories by CSV'
|
|
1046
|
+
},
|
|
1047
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.DISCOUNT_CODE}`]: {
|
|
1048
|
+
id: 'ImportResourcesModal.modalTitle.discountCode',
|
|
1049
|
+
description: 'Label for the inventories modal title',
|
|
1050
|
+
defaultMessage: 'Import discount codes by CSV'
|
|
1061
1051
|
},
|
|
1062
1052
|
uploadButton: {
|
|
1063
1053
|
id: 'ImportResourcesModal.uploadButton',
|
|
@@ -1082,19 +1072,13 @@ const Upload = () => {
|
|
|
1082
1072
|
onClose = _useImportResourcesCo.onClose,
|
|
1083
1073
|
resourceTypes = _useImportResourcesCo.resourceTypes;
|
|
1084
1074
|
const intl = reactIntl.useIntl();
|
|
1085
|
-
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1086
|
-
resourceType: state.resourceType,
|
|
1087
|
-
isPlural: true
|
|
1088
|
-
});
|
|
1089
1075
|
const _useUpload = useUpload(),
|
|
1090
1076
|
handleUploadAndValidation = _useUpload.handleUploadAndValidation;
|
|
1091
1077
|
const isMultipleResourceTypes = resourceTypes.length > 1;
|
|
1092
1078
|
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
1093
1079
|
size: 16,
|
|
1094
1080
|
isOpen: true,
|
|
1095
|
-
title: intl.formatMessage(sharedMessages.
|
|
1096
|
-
resourceType: resourceTypePlural
|
|
1097
|
-
}),
|
|
1081
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1098
1082
|
labelPrimary: intl.formatMessage(sharedMessages.uploadButton),
|
|
1099
1083
|
onPrimaryButtonClick: handleUploadAndValidation,
|
|
1100
1084
|
isPrimaryButtonDisabled: !Boolean(state.droppedFile),
|
|
@@ -1260,9 +1244,7 @@ function UploadPreviewModal() {
|
|
|
1260
1244
|
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
1261
1245
|
size: 16,
|
|
1262
1246
|
isOpen: true,
|
|
1263
|
-
title: intl.formatMessage(sharedMessages.
|
|
1264
|
-
resourceType: state.resourceType
|
|
1265
|
-
}),
|
|
1247
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1266
1248
|
labelPrimary: intl.formatMessage(messages$3.continue),
|
|
1267
1249
|
onSecondaryButtonClick: () => onClose({
|
|
1268
1250
|
shouldDeleteImportContainer: true
|
|
@@ -1380,12 +1362,7 @@ const ImportConfirmationModal = () => {
|
|
|
1380
1362
|
})
|
|
1381
1363
|
});
|
|
1382
1364
|
return jsxRuntime.jsx(applicationComponents.ConfirmationDialog, {
|
|
1383
|
-
title: intl.formatMessage(sharedMessages.
|
|
1384
|
-
resourceType: resourceTypeToDisplayName$1({
|
|
1385
|
-
resourceType: state.resourceType,
|
|
1386
|
-
isPlural: true
|
|
1387
|
-
})
|
|
1388
|
-
}),
|
|
1365
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1389
1366
|
labelPrimary: intl.formatMessage(messages$3.startImportButton),
|
|
1390
1367
|
isOpen: true,
|
|
1391
1368
|
onClose: () => onClose({
|
|
@@ -1556,12 +1533,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1556
1533
|
return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1557
1534
|
size: 16,
|
|
1558
1535
|
isOpen: true,
|
|
1559
|
-
title: intl.formatMessage(sharedMessages.
|
|
1560
|
-
resourceType: resourceTypeToDisplayName$1({
|
|
1561
|
-
resourceType: state.resourceType,
|
|
1562
|
-
isPlural: true
|
|
1563
|
-
})
|
|
1564
|
-
}),
|
|
1536
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1565
1537
|
onClose: () => onClose(),
|
|
1566
1538
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1567
1539
|
scale: "l",
|
|
@@ -1674,12 +1646,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1674
1646
|
return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1675
1647
|
size: 16,
|
|
1676
1648
|
isOpen: true,
|
|
1677
|
-
title: intl.formatMessage(sharedMessages.
|
|
1678
|
-
resourceType: resourceTypeToDisplayName$1({
|
|
1679
|
-
resourceType: state.resourceType,
|
|
1680
|
-
isPlural: true
|
|
1681
|
-
})
|
|
1682
|
-
}),
|
|
1649
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1683
1650
|
onClose: onClose,
|
|
1684
1651
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1685
1652
|
scale: "l",
|
|
@@ -1777,16 +1744,10 @@ const Uploading = () => {
|
|
|
1777
1744
|
state = _useImportResourcesCo.state,
|
|
1778
1745
|
actions = _useImportResourcesCo.actions,
|
|
1779
1746
|
onClose = _useImportResourcesCo.onClose;
|
|
1780
|
-
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1781
|
-
resourceType: state.resourceType,
|
|
1782
|
-
isPlural: true
|
|
1783
|
-
});
|
|
1784
1747
|
if (state.droppedFile?.name) return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1785
1748
|
size: 16,
|
|
1786
1749
|
isOpen: true,
|
|
1787
|
-
title: intl.formatMessage(sharedMessages.
|
|
1788
|
-
resourceType: resourceTypePlural
|
|
1789
|
-
}),
|
|
1750
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1790
1751
|
onClose: () => onClose({
|
|
1791
1752
|
shouldDeleteImportContainer: true
|
|
1792
1753
|
}),
|
|
@@ -1861,11 +1822,11 @@ var messages$1 = reactIntl.defineMessages({
|
|
|
1861
1822
|
|
|
1862
1823
|
const resourceTypeToDisplayName = resourceType => {
|
|
1863
1824
|
switch (resourceType) {
|
|
1864
|
-
case
|
|
1825
|
+
case IMPORTABLE_RESOURCES.PRODUCT:
|
|
1865
1826
|
return messages$1.products;
|
|
1866
|
-
case
|
|
1827
|
+
case IMPORTABLE_RESOURCES.INVENTORY:
|
|
1867
1828
|
return messages$1.inventories;
|
|
1868
|
-
case
|
|
1829
|
+
case IMPORTABLE_RESOURCES.CATEGORY:
|
|
1869
1830
|
return messages$1.categories;
|
|
1870
1831
|
default:
|
|
1871
1832
|
throw new Error(`Unknown resource type: ${resourceType}`);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend-extensions/import-resources-modal",
|
|
3
3
|
"description": "Shared import modal for importing resources",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.1",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -36,20 +36,20 @@
|
|
|
36
36
|
"react-dropzone": "14.2.3"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@commercetools-frontend/actions-global": "22.
|
|
40
|
-
"@commercetools-frontend/application-components": "22.
|
|
41
|
-
"@commercetools-frontend/application-shell": "22.
|
|
42
|
-
"@commercetools-frontend/application-shell-connectors": "22.
|
|
43
|
-
"@commercetools-frontend/constants": "22.
|
|
44
|
-
"@commercetools-frontend/i18n": "22.
|
|
45
|
-
"@commercetools-frontend/jest-preset-mc-app": "22.
|
|
46
|
-
"@commercetools-frontend/sdk": "22.
|
|
47
|
-
"@commercetools-frontend/sentry": "22.
|
|
48
|
-
"@commercetools-frontend/ui-kit": "19.
|
|
49
|
-
"@commercetools-uikit/data-table": "19.
|
|
50
|
-
"@commercetools-uikit/design-system": "19.
|
|
51
|
-
"@commercetools-uikit/icons": "19.
|
|
52
|
-
"@commercetools-uikit/select-field": "19.
|
|
39
|
+
"@commercetools-frontend/actions-global": "22.29.0",
|
|
40
|
+
"@commercetools-frontend/application-components": "22.29.0",
|
|
41
|
+
"@commercetools-frontend/application-shell": "22.29.0",
|
|
42
|
+
"@commercetools-frontend/application-shell-connectors": "22.29.0",
|
|
43
|
+
"@commercetools-frontend/constants": "22.29.0",
|
|
44
|
+
"@commercetools-frontend/i18n": "22.29.0",
|
|
45
|
+
"@commercetools-frontend/jest-preset-mc-app": "22.29.0",
|
|
46
|
+
"@commercetools-frontend/sdk": "22.29.0",
|
|
47
|
+
"@commercetools-frontend/sentry": "22.29.0",
|
|
48
|
+
"@commercetools-frontend/ui-kit": "19.7.0",
|
|
49
|
+
"@commercetools-uikit/data-table": "19.7.0",
|
|
50
|
+
"@commercetools-uikit/design-system": "19.7.0",
|
|
51
|
+
"@commercetools-uikit/icons": "19.7.0",
|
|
52
|
+
"@commercetools-uikit/select-field": "19.7.0",
|
|
53
53
|
"@preconstruct/cli": "2.8.4",
|
|
54
54
|
"@types/jest": "29.5.12",
|
|
55
55
|
"@types/lodash.truncate": "^4.4.7",
|
|
@@ -61,19 +61,19 @@
|
|
|
61
61
|
"rimraf": "5.0.7"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@commercetools-frontend/actions-global": "22.
|
|
65
|
-
"@commercetools-frontend/application-components": "22.
|
|
66
|
-
"@commercetools-frontend/application-shell": "22.
|
|
67
|
-
"@commercetools-frontend/application-shell-connectors": "22.
|
|
68
|
-
"@commercetools-frontend/constants": "22.
|
|
69
|
-
"@commercetools-frontend/i18n": "22.
|
|
70
|
-
"@commercetools-frontend/jest-preset-mc-app": "22.
|
|
71
|
-
"@commercetools-frontend/sdk": "22.
|
|
72
|
-
"@commercetools-frontend/sentry": "22.
|
|
73
|
-
"@commercetools-frontend/ui-kit": "
|
|
74
|
-
"@commercetools-uikit/data-table": "
|
|
75
|
-
"@commercetools-uikit/design-system": "
|
|
76
|
-
"@commercetools-uikit/icons": "
|
|
64
|
+
"@commercetools-frontend/actions-global": "22.29.0",
|
|
65
|
+
"@commercetools-frontend/application-components": "22.29.0",
|
|
66
|
+
"@commercetools-frontend/application-shell": "22.29.0",
|
|
67
|
+
"@commercetools-frontend/application-shell-connectors": "22.29.0",
|
|
68
|
+
"@commercetools-frontend/constants": "22.29.0",
|
|
69
|
+
"@commercetools-frontend/i18n": "22.29.0",
|
|
70
|
+
"@commercetools-frontend/jest-preset-mc-app": "22.29.0",
|
|
71
|
+
"@commercetools-frontend/sdk": "22.29.0",
|
|
72
|
+
"@commercetools-frontend/sentry": "22.29.0",
|
|
73
|
+
"@commercetools-frontend/ui-kit": "19.7.0",
|
|
74
|
+
"@commercetools-uikit/data-table": "19.7.0",
|
|
75
|
+
"@commercetools-uikit/design-system": "19.7.0",
|
|
76
|
+
"@commercetools-uikit/icons": "19.7.0",
|
|
77
77
|
"react-intl": "6.x",
|
|
78
78
|
"react-redux": "7.x",
|
|
79
79
|
"redux": "4.x"
|