@commercetools-frontend-extensions/import-resources-modal 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{active-drag-drop-area-1cac282b.cjs.prod.js → active-drag-drop-area-1ac31437.cjs.prod.js} +1 -1
- package/dist/{active-drag-drop-area-eb0b8dad.esm.js → active-drag-drop-area-7c8d7f16.esm.js} +1 -1
- package/dist/{active-drag-drop-area-8ee86fd4.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-fc9c086c.esm.js → enabled-drop-area-8d33207e.esm.js} +1 -1
- package/dist/{enabled-drop-area-fd89b405.cjs.prod.js → enabled-drop-area-bb340df2.cjs.prod.js} +1 -1
- package/dist/{enabled-drop-area-a1260be0.cjs.dev.js → enabled-drop-area-c93b15af.cjs.dev.js} +1 -1
- package/dist/{file-dropped-area-da127fa5.cjs.prod.js → file-dropped-area-5632c032.cjs.prod.js} +1 -1
- package/dist/{file-dropped-area-8aae58b3.cjs.dev.js → file-dropped-area-5b0aa739.cjs.dev.js} +1 -1
- package/dist/{file-dropped-area-2c96a537.esm.js → file-dropped-area-c0f3932c.esm.js} +1 -1
- package/dist/{index-f801ad59.cjs.prod.js → index-06262b8c.cjs.prod.js} +62 -96
- package/dist/{index-851dade8.esm.js → index-79e36c76.esm.js} +62 -96
- package/dist/{index-369f6a23.cjs.dev.js → index-bea140f8.cjs.dev.js} +62 -96
- 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-eb0b8dad.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-8ee86fd4.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-fd89b405.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-a1260be0.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-da127fa5.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-8aae58b3.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) {
|
|
@@ -662,6 +660,11 @@ var messages$5 = reactIntl.defineMessages({
|
|
|
662
660
|
id: 'ImportResourcesModal.unexpectedError',
|
|
663
661
|
description: 'Generic notification message when file upload fails',
|
|
664
662
|
defaultMessage: 'An unexpected error occurred during the file upload. Please try again, or contact support if this error occurs again.'
|
|
663
|
+
},
|
|
664
|
+
missingKeyError: {
|
|
665
|
+
id: 'ImportResourcesModal.missingKeyError',
|
|
666
|
+
description: 'Error message displayed when the uploaded file is missing the key field',
|
|
667
|
+
defaultMessage: "The 'key' field is missing or incomplete in some rows. Please ensure every row has a 'key' value."
|
|
665
668
|
}
|
|
666
669
|
});
|
|
667
670
|
|
|
@@ -722,7 +725,7 @@ const useUpload = () => {
|
|
|
722
725
|
showNotification({
|
|
723
726
|
kind: 'error',
|
|
724
727
|
domain: constants.DOMAINS.PAGE,
|
|
725
|
-
text:
|
|
728
|
+
text: intl.formatMessage(messages$5.unexpectedError)
|
|
726
729
|
});
|
|
727
730
|
} else if (error.errorData?.invalid > 0) {
|
|
728
731
|
actions.setUploadFileResponse(error.errorData);
|
|
@@ -794,29 +797,6 @@ const useUpload = () => {
|
|
|
794
797
|
};
|
|
795
798
|
};
|
|
796
799
|
|
|
797
|
-
function resourceTypeToDisplayName$1(_ref) {
|
|
798
|
-
let resourceType = _ref.resourceType,
|
|
799
|
-
_ref$isUpperCase = _ref.isUpperCase,
|
|
800
|
-
isUpperCase = _ref$isUpperCase === void 0 ? false : _ref$isUpperCase,
|
|
801
|
-
_ref$isPlural = _ref.isPlural,
|
|
802
|
-
isPlural = _ref$isPlural === void 0 ? false : _ref$isPlural;
|
|
803
|
-
let displayName;
|
|
804
|
-
switch (resourceType) {
|
|
805
|
-
case 'category':
|
|
806
|
-
displayName = isPlural ? 'Categories' : 'Category';
|
|
807
|
-
break;
|
|
808
|
-
case 'product':
|
|
809
|
-
displayName = isPlural ? 'Products' : 'Product';
|
|
810
|
-
break;
|
|
811
|
-
case 'inventory':
|
|
812
|
-
displayName = isPlural ? 'Inventories' : 'Inventory';
|
|
813
|
-
break;
|
|
814
|
-
default:
|
|
815
|
-
throw new UnexpectedResourceTypeError(resourceType);
|
|
816
|
-
}
|
|
817
|
-
return isUpperCase ? displayName : displayName.toLowerCase();
|
|
818
|
-
}
|
|
819
|
-
|
|
820
800
|
const getBorderColor = state => {
|
|
821
801
|
const borderColors = {
|
|
822
802
|
default: '#909dbc',
|
|
@@ -869,13 +849,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
869
849
|
return /*#__PURE__*/react.css("" , "" );
|
|
870
850
|
}
|
|
871
851
|
|
|
872
|
-
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" */); }));
|
|
873
853
|
|
|
874
854
|
var DisabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./disabled-drop-area-99c1fa0b.cjs.prod.js' /* webpackChunkName: "disabled-drop-area" */); }));
|
|
875
855
|
|
|
876
|
-
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" */); }));
|
|
877
857
|
|
|
878
|
-
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" */); }));
|
|
879
859
|
|
|
880
860
|
function getDropArea(_ref) {
|
|
881
861
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -1046,10 +1026,25 @@ const FileDropArea = () => {
|
|
|
1046
1026
|
};
|
|
1047
1027
|
|
|
1048
1028
|
var sharedMessages = reactIntl.defineMessages({
|
|
1049
|
-
modalTitle: {
|
|
1050
|
-
id: 'ImportResourcesModal.modalTitle',
|
|
1051
|
-
description: 'Label for the modal title',
|
|
1052
|
-
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'
|
|
1053
1048
|
},
|
|
1054
1049
|
uploadButton: {
|
|
1055
1050
|
id: 'ImportResourcesModal.uploadButton',
|
|
@@ -1074,19 +1069,13 @@ const Upload = () => {
|
|
|
1074
1069
|
onClose = _useImportResourcesCo.onClose,
|
|
1075
1070
|
resourceTypes = _useImportResourcesCo.resourceTypes;
|
|
1076
1071
|
const intl = reactIntl.useIntl();
|
|
1077
|
-
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1078
|
-
resourceType: state.resourceType,
|
|
1079
|
-
isPlural: true
|
|
1080
|
-
});
|
|
1081
1072
|
const _useUpload = useUpload(),
|
|
1082
1073
|
handleUploadAndValidation = _useUpload.handleUploadAndValidation;
|
|
1083
1074
|
const isMultipleResourceTypes = resourceTypes.length > 1;
|
|
1084
1075
|
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
1085
1076
|
size: 16,
|
|
1086
1077
|
isOpen: true,
|
|
1087
|
-
title: intl.formatMessage(sharedMessages.
|
|
1088
|
-
resourceType: resourceTypePlural
|
|
1089
|
-
}),
|
|
1078
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1090
1079
|
labelPrimary: intl.formatMessage(sharedMessages.uploadButton),
|
|
1091
1080
|
onPrimaryButtonClick: handleUploadAndValidation,
|
|
1092
1081
|
isPrimaryButtonDisabled: !Boolean(state.droppedFile),
|
|
@@ -1249,9 +1238,7 @@ function UploadPreviewModal() {
|
|
|
1249
1238
|
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
1250
1239
|
size: 16,
|
|
1251
1240
|
isOpen: true,
|
|
1252
|
-
title: intl.formatMessage(sharedMessages.
|
|
1253
|
-
resourceType: state.resourceType
|
|
1254
|
-
}),
|
|
1241
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1255
1242
|
labelPrimary: intl.formatMessage(messages$3.continue),
|
|
1256
1243
|
onSecondaryButtonClick: () => onClose({
|
|
1257
1244
|
shouldDeleteImportContainer: true
|
|
@@ -1369,12 +1356,7 @@ const ImportConfirmationModal = () => {
|
|
|
1369
1356
|
})
|
|
1370
1357
|
});
|
|
1371
1358
|
return jsxRuntime.jsx(applicationComponents.ConfirmationDialog, {
|
|
1372
|
-
title: intl.formatMessage(sharedMessages.
|
|
1373
|
-
resourceType: resourceTypeToDisplayName$1({
|
|
1374
|
-
resourceType: state.resourceType,
|
|
1375
|
-
isPlural: true
|
|
1376
|
-
})
|
|
1377
|
-
}),
|
|
1359
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1378
1360
|
labelPrimary: intl.formatMessage(messages$3.startImportButton),
|
|
1379
1361
|
isOpen: true,
|
|
1380
1362
|
onClose: () => onClose({
|
|
@@ -1545,12 +1527,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1545
1527
|
return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1546
1528
|
size: 16,
|
|
1547
1529
|
isOpen: true,
|
|
1548
|
-
title: intl.formatMessage(sharedMessages.
|
|
1549
|
-
resourceType: resourceTypeToDisplayName$1({
|
|
1550
|
-
resourceType: state.resourceType,
|
|
1551
|
-
isPlural: true
|
|
1552
|
-
})
|
|
1553
|
-
}),
|
|
1530
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1554
1531
|
onClose: () => onClose(),
|
|
1555
1532
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1556
1533
|
scale: "l",
|
|
@@ -1663,12 +1640,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1663
1640
|
return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1664
1641
|
size: 16,
|
|
1665
1642
|
isOpen: true,
|
|
1666
|
-
title: intl.formatMessage(sharedMessages.
|
|
1667
|
-
resourceType: resourceTypeToDisplayName$1({
|
|
1668
|
-
resourceType: state.resourceType,
|
|
1669
|
-
isPlural: true
|
|
1670
|
-
})
|
|
1671
|
-
}),
|
|
1643
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1672
1644
|
onClose: onClose,
|
|
1673
1645
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1674
1646
|
scale: "l",
|
|
@@ -1766,16 +1738,10 @@ const Uploading = () => {
|
|
|
1766
1738
|
state = _useImportResourcesCo.state,
|
|
1767
1739
|
actions = _useImportResourcesCo.actions,
|
|
1768
1740
|
onClose = _useImportResourcesCo.onClose;
|
|
1769
|
-
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1770
|
-
resourceType: state.resourceType,
|
|
1771
|
-
isPlural: true
|
|
1772
|
-
});
|
|
1773
1741
|
if (state.droppedFile?.name) return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1774
1742
|
size: 16,
|
|
1775
1743
|
isOpen: true,
|
|
1776
|
-
title: intl.formatMessage(sharedMessages.
|
|
1777
|
-
resourceType: resourceTypePlural
|
|
1778
|
-
}),
|
|
1744
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1779
1745
|
onClose: () => onClose({
|
|
1780
1746
|
shouldDeleteImportContainer: true
|
|
1781
1747
|
}),
|
|
@@ -1850,11 +1816,11 @@ var messages$1 = reactIntl.defineMessages({
|
|
|
1850
1816
|
|
|
1851
1817
|
const resourceTypeToDisplayName = resourceType => {
|
|
1852
1818
|
switch (resourceType) {
|
|
1853
|
-
case
|
|
1819
|
+
case IMPORTABLE_RESOURCES.PRODUCT:
|
|
1854
1820
|
return messages$1.products;
|
|
1855
|
-
case
|
|
1821
|
+
case IMPORTABLE_RESOURCES.INVENTORY:
|
|
1856
1822
|
return messages$1.inventories;
|
|
1857
|
-
case
|
|
1823
|
+
case IMPORTABLE_RESOURCES.CATEGORY:
|
|
1858
1824
|
return messages$1.categories;
|
|
1859
1825
|
default:
|
|
1860
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) {
|
|
@@ -633,6 +631,11 @@ var messages$5 = defineMessages({
|
|
|
633
631
|
id: 'ImportResourcesModal.unexpectedError',
|
|
634
632
|
description: 'Generic notification message when file upload fails',
|
|
635
633
|
defaultMessage: 'An unexpected error occurred during the file upload. Please try again, or contact support if this error occurs again.'
|
|
634
|
+
},
|
|
635
|
+
missingKeyError: {
|
|
636
|
+
id: 'ImportResourcesModal.missingKeyError',
|
|
637
|
+
description: 'Error message displayed when the uploaded file is missing the key field',
|
|
638
|
+
defaultMessage: "The 'key' field is missing or incomplete in some rows. Please ensure every row has a 'key' value."
|
|
636
639
|
}
|
|
637
640
|
});
|
|
638
641
|
|
|
@@ -693,7 +696,7 @@ const useUpload = () => {
|
|
|
693
696
|
showNotification({
|
|
694
697
|
kind: 'error',
|
|
695
698
|
domain: DOMAINS.PAGE,
|
|
696
|
-
text:
|
|
699
|
+
text: intl.formatMessage(messages$5.unexpectedError)
|
|
697
700
|
});
|
|
698
701
|
} else if (error.errorData?.invalid > 0) {
|
|
699
702
|
actions.setUploadFileResponse(error.errorData);
|
|
@@ -765,29 +768,6 @@ const useUpload = () => {
|
|
|
765
768
|
};
|
|
766
769
|
};
|
|
767
770
|
|
|
768
|
-
function resourceTypeToDisplayName$1(_ref) {
|
|
769
|
-
let resourceType = _ref.resourceType,
|
|
770
|
-
_ref$isUpperCase = _ref.isUpperCase,
|
|
771
|
-
isUpperCase = _ref$isUpperCase === void 0 ? false : _ref$isUpperCase,
|
|
772
|
-
_ref$isPlural = _ref.isPlural,
|
|
773
|
-
isPlural = _ref$isPlural === void 0 ? false : _ref$isPlural;
|
|
774
|
-
let displayName;
|
|
775
|
-
switch (resourceType) {
|
|
776
|
-
case 'category':
|
|
777
|
-
displayName = isPlural ? 'Categories' : 'Category';
|
|
778
|
-
break;
|
|
779
|
-
case 'product':
|
|
780
|
-
displayName = isPlural ? 'Products' : 'Product';
|
|
781
|
-
break;
|
|
782
|
-
case 'inventory':
|
|
783
|
-
displayName = isPlural ? 'Inventories' : 'Inventory';
|
|
784
|
-
break;
|
|
785
|
-
default:
|
|
786
|
-
throw new UnexpectedResourceTypeError(resourceType);
|
|
787
|
-
}
|
|
788
|
-
return isUpperCase ? displayName : displayName.toLowerCase();
|
|
789
|
-
}
|
|
790
|
-
|
|
791
771
|
const getBorderColor = state => {
|
|
792
772
|
const borderColors = {
|
|
793
773
|
default: '#909dbc',
|
|
@@ -843,13 +823,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
843
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== */");
|
|
844
824
|
}
|
|
845
825
|
|
|
846
|
-
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" */));
|
|
847
827
|
|
|
848
828
|
var DisabledDropArea = /*#__PURE__*/lazy(() => import('./disabled-drop-area-2c088477.esm.js' /* webpackChunkName: "disabled-drop-area" */));
|
|
849
829
|
|
|
850
|
-
var EnabledDropArea = /*#__PURE__*/lazy(() => import('./enabled-drop-area-
|
|
830
|
+
var EnabledDropArea = /*#__PURE__*/lazy(() => import('./enabled-drop-area-8d33207e.esm.js' /* webpackChunkName: "enabled-drop-area" */));
|
|
851
831
|
|
|
852
|
-
var FileDropped = /*#__PURE__*/lazy(() => import('./file-dropped-area-
|
|
832
|
+
var FileDropped = /*#__PURE__*/lazy(() => import('./file-dropped-area-c0f3932c.esm.js' /* webpackChunkName: "filed-dropped-area" */));
|
|
853
833
|
|
|
854
834
|
function getDropArea(_ref) {
|
|
855
835
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -1020,10 +1000,25 @@ const FileDropArea = () => {
|
|
|
1020
1000
|
};
|
|
1021
1001
|
|
|
1022
1002
|
var sharedMessages = defineMessages({
|
|
1023
|
-
modalTitle: {
|
|
1024
|
-
id: 'ImportResourcesModal.modalTitle',
|
|
1025
|
-
description: 'Label for the modal title',
|
|
1026
|
-
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'
|
|
1027
1022
|
},
|
|
1028
1023
|
uploadButton: {
|
|
1029
1024
|
id: 'ImportResourcesModal.uploadButton',
|
|
@@ -1048,19 +1043,13 @@ const Upload = () => {
|
|
|
1048
1043
|
onClose = _useImportResourcesCo.onClose,
|
|
1049
1044
|
resourceTypes = _useImportResourcesCo.resourceTypes;
|
|
1050
1045
|
const intl = useIntl();
|
|
1051
|
-
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1052
|
-
resourceType: state.resourceType,
|
|
1053
|
-
isPlural: true
|
|
1054
|
-
});
|
|
1055
1046
|
const _useUpload = useUpload(),
|
|
1056
1047
|
handleUploadAndValidation = _useUpload.handleUploadAndValidation;
|
|
1057
1048
|
const isMultipleResourceTypes = resourceTypes.length > 1;
|
|
1058
1049
|
return jsx(FormDialog, {
|
|
1059
1050
|
size: 16,
|
|
1060
1051
|
isOpen: true,
|
|
1061
|
-
title: intl.formatMessage(sharedMessages.
|
|
1062
|
-
resourceType: resourceTypePlural
|
|
1063
|
-
}),
|
|
1052
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1064
1053
|
labelPrimary: intl.formatMessage(sharedMessages.uploadButton),
|
|
1065
1054
|
onPrimaryButtonClick: handleUploadAndValidation,
|
|
1066
1055
|
isPrimaryButtonDisabled: !Boolean(state.droppedFile),
|
|
@@ -1226,9 +1215,7 @@ function UploadPreviewModal() {
|
|
|
1226
1215
|
return jsx(FormDialog, {
|
|
1227
1216
|
size: 16,
|
|
1228
1217
|
isOpen: true,
|
|
1229
|
-
title: intl.formatMessage(sharedMessages.
|
|
1230
|
-
resourceType: state.resourceType
|
|
1231
|
-
}),
|
|
1218
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1232
1219
|
labelPrimary: intl.formatMessage(messages$3.continue),
|
|
1233
1220
|
onSecondaryButtonClick: () => onClose({
|
|
1234
1221
|
shouldDeleteImportContainer: true
|
|
@@ -1346,12 +1333,7 @@ const ImportConfirmationModal = () => {
|
|
|
1346
1333
|
})
|
|
1347
1334
|
});
|
|
1348
1335
|
return jsx(ConfirmationDialog, {
|
|
1349
|
-
title: intl.formatMessage(sharedMessages.
|
|
1350
|
-
resourceType: resourceTypeToDisplayName$1({
|
|
1351
|
-
resourceType: state.resourceType,
|
|
1352
|
-
isPlural: true
|
|
1353
|
-
})
|
|
1354
|
-
}),
|
|
1336
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1355
1337
|
labelPrimary: intl.formatMessage(messages$3.startImportButton),
|
|
1356
1338
|
isOpen: true,
|
|
1357
1339
|
onClose: () => onClose({
|
|
@@ -1522,12 +1504,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1522
1504
|
return jsx(InfoDialog, {
|
|
1523
1505
|
size: 16,
|
|
1524
1506
|
isOpen: true,
|
|
1525
|
-
title: intl.formatMessage(sharedMessages.
|
|
1526
|
-
resourceType: resourceTypeToDisplayName$1({
|
|
1527
|
-
resourceType: state.resourceType,
|
|
1528
|
-
isPlural: true
|
|
1529
|
-
})
|
|
1530
|
-
}),
|
|
1507
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1531
1508
|
onClose: () => onClose(),
|
|
1532
1509
|
children: jsxs(Spacings.Stack, {
|
|
1533
1510
|
scale: "l",
|
|
@@ -1640,12 +1617,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1640
1617
|
return jsx(InfoDialog, {
|
|
1641
1618
|
size: 16,
|
|
1642
1619
|
isOpen: true,
|
|
1643
|
-
title: intl.formatMessage(sharedMessages.
|
|
1644
|
-
resourceType: resourceTypeToDisplayName$1({
|
|
1645
|
-
resourceType: state.resourceType,
|
|
1646
|
-
isPlural: true
|
|
1647
|
-
})
|
|
1648
|
-
}),
|
|
1620
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1649
1621
|
onClose: onClose,
|
|
1650
1622
|
children: jsxs(Spacings.Stack, {
|
|
1651
1623
|
scale: "l",
|
|
@@ -1743,16 +1715,10 @@ const Uploading = () => {
|
|
|
1743
1715
|
state = _useImportResourcesCo.state,
|
|
1744
1716
|
actions = _useImportResourcesCo.actions,
|
|
1745
1717
|
onClose = _useImportResourcesCo.onClose;
|
|
1746
|
-
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1747
|
-
resourceType: state.resourceType,
|
|
1748
|
-
isPlural: true
|
|
1749
|
-
});
|
|
1750
1718
|
if (state.droppedFile?.name) return jsx(InfoDialog, {
|
|
1751
1719
|
size: 16,
|
|
1752
1720
|
isOpen: true,
|
|
1753
|
-
title: intl.formatMessage(sharedMessages.
|
|
1754
|
-
resourceType: resourceTypePlural
|
|
1755
|
-
}),
|
|
1721
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1756
1722
|
onClose: () => onClose({
|
|
1757
1723
|
shouldDeleteImportContainer: true
|
|
1758
1724
|
}),
|
|
@@ -1827,11 +1793,11 @@ var messages$1 = defineMessages({
|
|
|
1827
1793
|
|
|
1828
1794
|
const resourceTypeToDisplayName = resourceType => {
|
|
1829
1795
|
switch (resourceType) {
|
|
1830
|
-
case
|
|
1796
|
+
case IMPORTABLE_RESOURCES.PRODUCT:
|
|
1831
1797
|
return messages$1.products;
|
|
1832
|
-
case
|
|
1798
|
+
case IMPORTABLE_RESOURCES.INVENTORY:
|
|
1833
1799
|
return messages$1.inventories;
|
|
1834
|
-
case
|
|
1800
|
+
case IMPORTABLE_RESOURCES.CATEGORY:
|
|
1835
1801
|
return messages$1.categories;
|
|
1836
1802
|
default:
|
|
1837
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) {
|
|
@@ -662,6 +660,11 @@ var messages$5 = reactIntl.defineMessages({
|
|
|
662
660
|
id: 'ImportResourcesModal.unexpectedError',
|
|
663
661
|
description: 'Generic notification message when file upload fails',
|
|
664
662
|
defaultMessage: 'An unexpected error occurred during the file upload. Please try again, or contact support if this error occurs again.'
|
|
663
|
+
},
|
|
664
|
+
missingKeyError: {
|
|
665
|
+
id: 'ImportResourcesModal.missingKeyError',
|
|
666
|
+
description: 'Error message displayed when the uploaded file is missing the key field',
|
|
667
|
+
defaultMessage: "The 'key' field is missing or incomplete in some rows. Please ensure every row has a 'key' value."
|
|
665
668
|
}
|
|
666
669
|
});
|
|
667
670
|
|
|
@@ -722,7 +725,7 @@ const useUpload = () => {
|
|
|
722
725
|
showNotification({
|
|
723
726
|
kind: 'error',
|
|
724
727
|
domain: constants.DOMAINS.PAGE,
|
|
725
|
-
text:
|
|
728
|
+
text: intl.formatMessage(messages$5.unexpectedError)
|
|
726
729
|
});
|
|
727
730
|
} else if (error.errorData?.invalid > 0) {
|
|
728
731
|
actions.setUploadFileResponse(error.errorData);
|
|
@@ -794,29 +797,6 @@ const useUpload = () => {
|
|
|
794
797
|
};
|
|
795
798
|
};
|
|
796
799
|
|
|
797
|
-
function resourceTypeToDisplayName$1(_ref) {
|
|
798
|
-
let resourceType = _ref.resourceType,
|
|
799
|
-
_ref$isUpperCase = _ref.isUpperCase,
|
|
800
|
-
isUpperCase = _ref$isUpperCase === void 0 ? false : _ref$isUpperCase,
|
|
801
|
-
_ref$isPlural = _ref.isPlural,
|
|
802
|
-
isPlural = _ref$isPlural === void 0 ? false : _ref$isPlural;
|
|
803
|
-
let displayName;
|
|
804
|
-
switch (resourceType) {
|
|
805
|
-
case 'category':
|
|
806
|
-
displayName = isPlural ? 'Categories' : 'Category';
|
|
807
|
-
break;
|
|
808
|
-
case 'product':
|
|
809
|
-
displayName = isPlural ? 'Products' : 'Product';
|
|
810
|
-
break;
|
|
811
|
-
case 'inventory':
|
|
812
|
-
displayName = isPlural ? 'Inventories' : 'Inventory';
|
|
813
|
-
break;
|
|
814
|
-
default:
|
|
815
|
-
throw new UnexpectedResourceTypeError(resourceType);
|
|
816
|
-
}
|
|
817
|
-
return isUpperCase ? displayName : displayName.toLowerCase();
|
|
818
|
-
}
|
|
819
|
-
|
|
820
800
|
const getBorderColor = state => {
|
|
821
801
|
const borderColors = {
|
|
822
802
|
default: '#909dbc',
|
|
@@ -872,13 +852,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
872
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== */");
|
|
873
853
|
}
|
|
874
854
|
|
|
875
|
-
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" */); }));
|
|
876
856
|
|
|
877
857
|
var DisabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./disabled-drop-area-aa78075b.cjs.dev.js' /* webpackChunkName: "disabled-drop-area" */); }));
|
|
878
858
|
|
|
879
|
-
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" */); }));
|
|
880
860
|
|
|
881
|
-
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" */); }));
|
|
882
862
|
|
|
883
863
|
function getDropArea(_ref) {
|
|
884
864
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -1049,10 +1029,25 @@ const FileDropArea = () => {
|
|
|
1049
1029
|
};
|
|
1050
1030
|
|
|
1051
1031
|
var sharedMessages = reactIntl.defineMessages({
|
|
1052
|
-
modalTitle: {
|
|
1053
|
-
id: 'ImportResourcesModal.modalTitle',
|
|
1054
|
-
description: 'Label for the modal title',
|
|
1055
|
-
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'
|
|
1056
1051
|
},
|
|
1057
1052
|
uploadButton: {
|
|
1058
1053
|
id: 'ImportResourcesModal.uploadButton',
|
|
@@ -1077,19 +1072,13 @@ const Upload = () => {
|
|
|
1077
1072
|
onClose = _useImportResourcesCo.onClose,
|
|
1078
1073
|
resourceTypes = _useImportResourcesCo.resourceTypes;
|
|
1079
1074
|
const intl = reactIntl.useIntl();
|
|
1080
|
-
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1081
|
-
resourceType: state.resourceType,
|
|
1082
|
-
isPlural: true
|
|
1083
|
-
});
|
|
1084
1075
|
const _useUpload = useUpload(),
|
|
1085
1076
|
handleUploadAndValidation = _useUpload.handleUploadAndValidation;
|
|
1086
1077
|
const isMultipleResourceTypes = resourceTypes.length > 1;
|
|
1087
1078
|
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
1088
1079
|
size: 16,
|
|
1089
1080
|
isOpen: true,
|
|
1090
|
-
title: intl.formatMessage(sharedMessages.
|
|
1091
|
-
resourceType: resourceTypePlural
|
|
1092
|
-
}),
|
|
1081
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1093
1082
|
labelPrimary: intl.formatMessage(sharedMessages.uploadButton),
|
|
1094
1083
|
onPrimaryButtonClick: handleUploadAndValidation,
|
|
1095
1084
|
isPrimaryButtonDisabled: !Boolean(state.droppedFile),
|
|
@@ -1255,9 +1244,7 @@ function UploadPreviewModal() {
|
|
|
1255
1244
|
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
1256
1245
|
size: 16,
|
|
1257
1246
|
isOpen: true,
|
|
1258
|
-
title: intl.formatMessage(sharedMessages.
|
|
1259
|
-
resourceType: state.resourceType
|
|
1260
|
-
}),
|
|
1247
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1261
1248
|
labelPrimary: intl.formatMessage(messages$3.continue),
|
|
1262
1249
|
onSecondaryButtonClick: () => onClose({
|
|
1263
1250
|
shouldDeleteImportContainer: true
|
|
@@ -1375,12 +1362,7 @@ const ImportConfirmationModal = () => {
|
|
|
1375
1362
|
})
|
|
1376
1363
|
});
|
|
1377
1364
|
return jsxRuntime.jsx(applicationComponents.ConfirmationDialog, {
|
|
1378
|
-
title: intl.formatMessage(sharedMessages.
|
|
1379
|
-
resourceType: resourceTypeToDisplayName$1({
|
|
1380
|
-
resourceType: state.resourceType,
|
|
1381
|
-
isPlural: true
|
|
1382
|
-
})
|
|
1383
|
-
}),
|
|
1365
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1384
1366
|
labelPrimary: intl.formatMessage(messages$3.startImportButton),
|
|
1385
1367
|
isOpen: true,
|
|
1386
1368
|
onClose: () => onClose({
|
|
@@ -1551,12 +1533,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1551
1533
|
return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1552
1534
|
size: 16,
|
|
1553
1535
|
isOpen: true,
|
|
1554
|
-
title: intl.formatMessage(sharedMessages.
|
|
1555
|
-
resourceType: resourceTypeToDisplayName$1({
|
|
1556
|
-
resourceType: state.resourceType,
|
|
1557
|
-
isPlural: true
|
|
1558
|
-
})
|
|
1559
|
-
}),
|
|
1536
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1560
1537
|
onClose: () => onClose(),
|
|
1561
1538
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1562
1539
|
scale: "l",
|
|
@@ -1669,12 +1646,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1669
1646
|
return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1670
1647
|
size: 16,
|
|
1671
1648
|
isOpen: true,
|
|
1672
|
-
title: intl.formatMessage(sharedMessages.
|
|
1673
|
-
resourceType: resourceTypeToDisplayName$1({
|
|
1674
|
-
resourceType: state.resourceType,
|
|
1675
|
-
isPlural: true
|
|
1676
|
-
})
|
|
1677
|
-
}),
|
|
1649
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1678
1650
|
onClose: onClose,
|
|
1679
1651
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1680
1652
|
scale: "l",
|
|
@@ -1772,16 +1744,10 @@ const Uploading = () => {
|
|
|
1772
1744
|
state = _useImportResourcesCo.state,
|
|
1773
1745
|
actions = _useImportResourcesCo.actions,
|
|
1774
1746
|
onClose = _useImportResourcesCo.onClose;
|
|
1775
|
-
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1776
|
-
resourceType: state.resourceType,
|
|
1777
|
-
isPlural: true
|
|
1778
|
-
});
|
|
1779
1747
|
if (state.droppedFile?.name) return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1780
1748
|
size: 16,
|
|
1781
1749
|
isOpen: true,
|
|
1782
|
-
title: intl.formatMessage(sharedMessages.
|
|
1783
|
-
resourceType: resourceTypePlural
|
|
1784
|
-
}),
|
|
1750
|
+
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1785
1751
|
onClose: () => onClose({
|
|
1786
1752
|
shouldDeleteImportContainer: true
|
|
1787
1753
|
}),
|
|
@@ -1856,11 +1822,11 @@ var messages$1 = reactIntl.defineMessages({
|
|
|
1856
1822
|
|
|
1857
1823
|
const resourceTypeToDisplayName = resourceType => {
|
|
1858
1824
|
switch (resourceType) {
|
|
1859
|
-
case
|
|
1825
|
+
case IMPORTABLE_RESOURCES.PRODUCT:
|
|
1860
1826
|
return messages$1.products;
|
|
1861
|
-
case
|
|
1827
|
+
case IMPORTABLE_RESOURCES.INVENTORY:
|
|
1862
1828
|
return messages$1.inventories;
|
|
1863
|
-
case
|
|
1829
|
+
case IMPORTABLE_RESOURCES.CATEGORY:
|
|
1864
1830
|
return messages$1.categories;
|
|
1865
1831
|
default:
|
|
1866
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.0",
|
|
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.6.0",
|
|
49
|
+
"@commercetools-uikit/data-table": "19.6.0",
|
|
50
|
+
"@commercetools-uikit/design-system": "19.6.0",
|
|
51
|
+
"@commercetools-uikit/icons": "19.6.0",
|
|
52
|
+
"@commercetools-uikit/select-field": "19.6.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.6.0",
|
|
74
|
+
"@commercetools-uikit/data-table": "19.6.0",
|
|
75
|
+
"@commercetools-uikit/design-system": "19.6.0",
|
|
76
|
+
"@commercetools-uikit/icons": "19.6.0",
|
|
77
77
|
"react-intl": "6.x",
|
|
78
78
|
"react-redux": "7.x",
|
|
79
79
|
"redux": "4.x"
|