@commercetools-frontend-extensions/import-resources-modal 1.7.5 → 1.8.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-bfd1ac28.esm.js → active-drag-drop-area-34cca429.esm.js} +3 -3
- package/dist/{active-drag-drop-area-a4fd91f7.cjs.dev.js → active-drag-drop-area-b645657a.cjs.dev.js} +3 -3
- package/dist/{active-drag-drop-area-abe96e04.cjs.prod.js → active-drag-drop-area-cf5791e7.cjs.prod.js} +3 -3
- package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.dev.js +7 -7
- package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.prod.js +7 -7
- package/dist/commercetools-frontend-extensions-import-resources-modal.esm.js +7 -7
- package/dist/declarations/src/@types/file-upload.d.ts +0 -4
- package/dist/{disabled-drop-area-093742fc.esm.js → disabled-drop-area-460a605b.esm.js} +7 -7
- package/dist/{disabled-drop-area-c092ebd0.cjs.dev.js → disabled-drop-area-9a4072d5.cjs.dev.js} +7 -7
- package/dist/{disabled-drop-area-25e976d6.cjs.prod.js → disabled-drop-area-c8e04dd6.cjs.prod.js} +7 -7
- package/dist/{enabled-drop-area-2e91435a.cjs.dev.js → enabled-drop-area-5d1a684a.cjs.dev.js} +7 -7
- package/dist/{enabled-drop-area-db88a5da.esm.js → enabled-drop-area-c2591e72.esm.js} +7 -7
- package/dist/{enabled-drop-area-86aff122.cjs.prod.js → enabled-drop-area-c30c7c5f.cjs.prod.js} +7 -7
- package/dist/{file-dropped-area-88c05907.cjs.dev.js → file-dropped-area-1c5c2843.cjs.dev.js} +7 -7
- package/dist/{file-dropped-area-6279df47.cjs.prod.js → file-dropped-area-27c8a11f.cjs.prod.js} +7 -7
- package/dist/{file-dropped-area-70be944b.esm.js → file-dropped-area-cf7278ba.esm.js} +7 -7
- package/dist/{index-c388b02a.esm.js → index-066e573b.esm.js} +152 -102
- package/dist/{index-6186162d.cjs.prod.js → index-757e3f18.cjs.prod.js} +154 -104
- package/dist/{index-98c1d115.cjs.dev.js → index-7e118bb3.cjs.dev.js} +154 -104
- package/package.json +35 -34
|
@@ -27,15 +27,15 @@ var _wrapNativeSuper = require('@babel/runtime-corejs3/helpers/wrapNativeSuper')
|
|
|
27
27
|
var pluralize = require('pluralize');
|
|
28
28
|
var _Promise = require('@babel/runtime-corejs3/core-js-stable/promise');
|
|
29
29
|
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
30
|
+
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
31
|
+
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
30
32
|
var _flatMapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/flat-map');
|
|
31
33
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
32
34
|
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
33
|
-
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
34
35
|
var Papa = require('papaparse');
|
|
35
36
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
36
37
|
var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
|
|
37
38
|
var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
38
|
-
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
39
39
|
require('@babel/runtime-corejs3/core-js-stable/instance/bind');
|
|
40
40
|
require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
|
|
41
41
|
require('@babel/runtime-corejs3/core-js-stable/url-search-params');
|
|
@@ -67,15 +67,15 @@ var React__default = /*#__PURE__*/_interopDefault(React);
|
|
|
67
67
|
var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
|
|
68
68
|
var _Promise__default = /*#__PURE__*/_interopDefault(_Promise);
|
|
69
69
|
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
70
|
+
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
71
|
+
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
70
72
|
var _flatMapInstanceProperty__default = /*#__PURE__*/_interopDefault(_flatMapInstanceProperty);
|
|
71
73
|
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
72
74
|
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
73
|
-
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
74
75
|
var Papa__default = /*#__PURE__*/_interopDefault(Papa);
|
|
75
76
|
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
76
77
|
var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
|
|
77
78
|
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
78
|
-
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
79
79
|
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
80
80
|
|
|
81
81
|
const EnabledResourceType = {
|
|
@@ -297,7 +297,7 @@ const fetchUsingXhr = _ref2 => {
|
|
|
297
297
|
return xhr;
|
|
298
298
|
};
|
|
299
299
|
|
|
300
|
-
const
|
|
300
|
+
const ALLOWED_DELIMITERS = [',', ';', '|', '\t'];
|
|
301
301
|
const INITIAL_COLUMN_DISPLAY_COUNT = 8;
|
|
302
302
|
const IMPORT_TAG_KEYS = {
|
|
303
303
|
source: 'source'
|
|
@@ -387,41 +387,113 @@ const DEFAULT_SHORT_LIVED_FLAGS = {};
|
|
|
387
387
|
const DEFAULT_LONG_LIVED_FLAGS = {};
|
|
388
388
|
_objectSpread$g(_objectSpread$g({}, DEFAULT_SHORT_LIVED_FLAGS), DEFAULT_LONG_LIVED_FLAGS);
|
|
389
389
|
|
|
390
|
+
var sharedMessages = reactIntl.defineMessages({
|
|
391
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.CATEGORY}`]: {
|
|
392
|
+
id: 'ImportResourcesModal.modalTitle.category',
|
|
393
|
+
description: 'Label for the categories modal title',
|
|
394
|
+
defaultMessage: 'Import categories by CSV'
|
|
395
|
+
},
|
|
396
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.PRODUCT}`]: {
|
|
397
|
+
id: 'ImportResourcesModal.modalTitle.product',
|
|
398
|
+
description: 'Label for the products modal title',
|
|
399
|
+
defaultMessage: 'Import products by CSV'
|
|
400
|
+
},
|
|
401
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.INVENTORY}`]: {
|
|
402
|
+
id: 'ImportResourcesModal.modalTitle.inventoryEntry',
|
|
403
|
+
description: 'Label for the inventories modal title',
|
|
404
|
+
defaultMessage: 'Import inventories by CSV'
|
|
405
|
+
},
|
|
406
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.DISCOUNT_CODE}`]: {
|
|
407
|
+
id: 'ImportResourcesModal.modalTitle.discountCode',
|
|
408
|
+
description: 'Label for the inventories modal title',
|
|
409
|
+
defaultMessage: 'Import discount codes by CSV'
|
|
410
|
+
},
|
|
411
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.CUSTOMER}`]: {
|
|
412
|
+
id: 'ImportResourcesModal.modalTitle.customer',
|
|
413
|
+
description: 'Label for the customers modal title',
|
|
414
|
+
defaultMessage: 'Import customers by CSV'
|
|
415
|
+
},
|
|
416
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.ORDER}`]: {
|
|
417
|
+
id: 'ImportResourcesModal.modalTitle.order',
|
|
418
|
+
description: 'Label for the order modal title',
|
|
419
|
+
defaultMessage: 'Import orders by CSV'
|
|
420
|
+
},
|
|
421
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.PRODUCT_TYPE}`]: {
|
|
422
|
+
id: 'ImportResourcesModal.modalTitle.productType',
|
|
423
|
+
description: 'Label for the product type modal title',
|
|
424
|
+
defaultMessage: 'Import product types by CSV'
|
|
425
|
+
},
|
|
426
|
+
uploadButton: {
|
|
427
|
+
id: 'ImportResourcesModal.uploadButton',
|
|
428
|
+
description: 'Label for the upload button',
|
|
429
|
+
defaultMessage: 'Upload and preview'
|
|
430
|
+
},
|
|
431
|
+
cancel: {
|
|
432
|
+
id: 'ImportResourcesModal.cancel',
|
|
433
|
+
description: 'Label for the cancel button',
|
|
434
|
+
defaultMessage: 'Cancel'
|
|
435
|
+
},
|
|
436
|
+
close: {
|
|
437
|
+
id: 'ImportResourcesModal.close',
|
|
438
|
+
description: 'Label for the close button',
|
|
439
|
+
defaultMessage: 'Close'
|
|
440
|
+
},
|
|
441
|
+
listConjunctionOr: {
|
|
442
|
+
id: 'ImportResourcesModal.listConjunctionOr',
|
|
443
|
+
description: 'Label for the list conjunction or',
|
|
444
|
+
defaultMessage: 'or'
|
|
445
|
+
},
|
|
446
|
+
delimiterComma: {
|
|
447
|
+
id: 'ImportResourcesModal.delimiterComma',
|
|
448
|
+
description: 'Label for the delimiter name comma',
|
|
449
|
+
defaultMessage: 'comma'
|
|
450
|
+
},
|
|
451
|
+
delimiterSemicolon: {
|
|
452
|
+
id: 'ImportResourcesModal.delimiterSemicolon',
|
|
453
|
+
description: 'Label for the delimiter name semicolon',
|
|
454
|
+
defaultMessage: 'semicolon'
|
|
455
|
+
},
|
|
456
|
+
delimiterPipe: {
|
|
457
|
+
id: 'ImportResourcesModal.delimiterPipe',
|
|
458
|
+
description: 'Label for the delimiter name pipe',
|
|
459
|
+
defaultMessage: 'pipe'
|
|
460
|
+
},
|
|
461
|
+
delimiterTab: {
|
|
462
|
+
id: 'ImportResourcesModal.delimiterTab',
|
|
463
|
+
description: 'Label for the delimiter name tab',
|
|
464
|
+
defaultMessage: 'tab'
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
|
|
390
468
|
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; }
|
|
391
|
-
function _objectSpread$f(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
* @returns {Promise<DelimiterCheck>} A Promise that resolves to a DelimiterCheck object.
|
|
399
|
-
*/
|
|
400
|
-
const checkDelimiter = function (file) {
|
|
401
|
-
let expectedDelimiter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_DELIMITER;
|
|
469
|
+
function _objectSpread$f(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys$f(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys$f(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
470
|
+
|
|
471
|
+
// Delimiters not included in this array may be treated as part of a column content
|
|
472
|
+
// potentially causing the file to be parsed as a single-column CSV and pass this validation
|
|
473
|
+
const NON_ALLOWED_DELIMITERS = ['%', '.', ' '];
|
|
474
|
+
const DELIMITERS_TO_GUESS = [...ALLOWED_DELIMITERS, ...NON_ALLOWED_DELIMITERS];
|
|
475
|
+
const validateDelimiter = file => {
|
|
402
476
|
return new _Promise__default["default"](resolve => {
|
|
403
|
-
let lineCount = 0;
|
|
404
|
-
let correctDelimiterCount = 0;
|
|
405
|
-
let detectedDelimiter = null;
|
|
406
477
|
Papa__default["default"].parse(file, {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
if (
|
|
413
|
-
|
|
478
|
+
delimitersToGuess: DELIMITERS_TO_GUESS,
|
|
479
|
+
preview: 10,
|
|
480
|
+
complete: result => {
|
|
481
|
+
const headerRow = result.data?.[0];
|
|
482
|
+
const isOnlyOneColumn = _Array$isArray__default["default"](headerRow) && headerRow.length === 1;
|
|
483
|
+
if (isOnlyOneColumn) {
|
|
484
|
+
resolve(true);
|
|
485
|
+
return;
|
|
414
486
|
}
|
|
415
|
-
|
|
416
|
-
|
|
487
|
+
const detectedDelimiter = result.meta.delimiter;
|
|
488
|
+
let isValid = false;
|
|
489
|
+
if (detectedDelimiter !== null && _includesInstanceProperty__default["default"](ALLOWED_DELIMITERS).call(ALLOWED_DELIMITERS, detectedDelimiter)) {
|
|
490
|
+
var _context;
|
|
491
|
+
const isUndetectableDelimiter = _someInstanceProperty__default["default"](_context = result.errors).call(_context, error => error.code === 'UndetectableDelimiter');
|
|
492
|
+
if (!isUndetectableDelimiter) {
|
|
493
|
+
isValid = true;
|
|
494
|
+
}
|
|
417
495
|
}
|
|
418
|
-
|
|
419
|
-
complete: () => {
|
|
420
|
-
const isValid = correctDelimiterCount === lineCount;
|
|
421
|
-
resolve({
|
|
422
|
-
isValid,
|
|
423
|
-
delimiter: detectedDelimiter
|
|
424
|
-
});
|
|
496
|
+
resolve(isValid);
|
|
425
497
|
}
|
|
426
498
|
});
|
|
427
499
|
});
|
|
@@ -430,8 +502,8 @@ const mapUploadFileErrorsResponseToUploadFileErrorRows = uploadFileErrorsRespons
|
|
|
430
502
|
if (!uploadFileErrorsResponse || !_Array$isArray__default["default"](uploadFileErrorsResponse)) return [];
|
|
431
503
|
let idCounter = 1;
|
|
432
504
|
return _flatMapInstanceProperty__default["default"](uploadFileErrorsResponse).call(uploadFileErrorsResponse, rowErrorsResponse => {
|
|
433
|
-
var
|
|
434
|
-
return _mapInstanceProperty__default["default"](
|
|
505
|
+
var _context2;
|
|
506
|
+
return _mapInstanceProperty__default["default"](_context2 = rowErrorsResponse.errors).call(_context2, rowError => ({
|
|
435
507
|
// DataTable component requires unique `id` field
|
|
436
508
|
id: String(idCounter++),
|
|
437
509
|
row: rowErrorsResponse.row,
|
|
@@ -481,6 +553,35 @@ const toBytes = megabytes => megabytes * 1024 * 1024;
|
|
|
481
553
|
const getValidatedColumns = (columns, ignoredColumns) => {
|
|
482
554
|
return _filterInstanceProperty__default["default"](columns).call(columns, column => !_includesInstanceProperty__default["default"](ignoredColumns).call(ignoredColumns, column));
|
|
483
555
|
};
|
|
556
|
+
const formatAllowedDelimitersForMessageDisplay = intl => {
|
|
557
|
+
const localizedOr = intl.formatMessage(sharedMessages.listConjunctionOr);
|
|
558
|
+
const descriptions = _mapInstanceProperty__default["default"](ALLOWED_DELIMITERS).call(ALLOWED_DELIMITERS, delimiter => {
|
|
559
|
+
let nameDescriptor;
|
|
560
|
+
switch (delimiter) {
|
|
561
|
+
case ',':
|
|
562
|
+
nameDescriptor = sharedMessages.delimiterComma;
|
|
563
|
+
break;
|
|
564
|
+
case ';':
|
|
565
|
+
nameDescriptor = sharedMessages.delimiterSemicolon;
|
|
566
|
+
break;
|
|
567
|
+
case '|':
|
|
568
|
+
nameDescriptor = sharedMessages.delimiterPipe;
|
|
569
|
+
break;
|
|
570
|
+
case '\t':
|
|
571
|
+
nameDescriptor = sharedMessages.delimiterTab;
|
|
572
|
+
break;
|
|
573
|
+
default:
|
|
574
|
+
nameDescriptor = undefined;
|
|
575
|
+
}
|
|
576
|
+
const name = nameDescriptor ? intl.formatMessage(nameDescriptor) : delimiter;
|
|
577
|
+
return delimiter === '\t' ? name : `${name} (${delimiter})`;
|
|
578
|
+
});
|
|
579
|
+
if (descriptions.length === 1) {
|
|
580
|
+
return descriptions[0];
|
|
581
|
+
}
|
|
582
|
+
const lastDescription = descriptions.pop();
|
|
583
|
+
return `${descriptions.join(', ')} ${localizedOr} ${lastDescription}`;
|
|
584
|
+
};
|
|
484
585
|
|
|
485
586
|
function getFileUploadErrorsCount(errors) {
|
|
486
587
|
if (!errors || !_Array$isArray__default["default"](errors)) return 0;
|
|
@@ -750,13 +851,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
750
851
|
return /*#__PURE__*/react.css("" , "" );
|
|
751
852
|
}
|
|
752
853
|
|
|
753
|
-
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-
|
|
854
|
+
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-cf5791e7.cjs.prod.js' /* webpackChunkName: "active-drag-drop-area" */); }));
|
|
754
855
|
|
|
755
|
-
var DisabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./disabled-drop-area-
|
|
856
|
+
var DisabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./disabled-drop-area-c8e04dd6.cjs.prod.js' /* webpackChunkName: "disabled-drop-area" */); }));
|
|
756
857
|
|
|
757
|
-
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-
|
|
858
|
+
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-c30c7c5f.cjs.prod.js' /* webpackChunkName: "enabled-drop-area" */); }));
|
|
758
859
|
|
|
759
|
-
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-
|
|
860
|
+
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-27c8a11f.cjs.prod.js' /* webpackChunkName: "filed-dropped-area" */); }));
|
|
760
861
|
|
|
761
862
|
function getDropArea(_ref) {
|
|
762
863
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -878,14 +979,14 @@ var messages$6 = reactIntl.defineMessages({
|
|
|
878
979
|
description: 'Error description when the file contains more rows than the allowable maximum',
|
|
879
980
|
defaultMessage: 'The file contains more than the allowable maximum of {rowLimit} rows'
|
|
880
981
|
},
|
|
881
|
-
|
|
882
|
-
id: 'ImportResourcesModal.
|
|
883
|
-
defaultMessage: 'Wrong
|
|
982
|
+
wrongSeparatorTitle: {
|
|
983
|
+
id: 'ImportResourcesModal.wrongSeparatorTitle',
|
|
984
|
+
defaultMessage: 'Wrong separator'
|
|
884
985
|
},
|
|
885
|
-
|
|
886
|
-
id: 'ImportResourcesModal.
|
|
986
|
+
wrongSeparatorDescription: {
|
|
987
|
+
id: 'ImportResourcesModal.wrongSeparatorDescription',
|
|
887
988
|
description: 'Message within the drop area when a CSV file uses an unexpected delimiter',
|
|
888
|
-
defaultMessage: 'The file is using an
|
|
989
|
+
defaultMessage: 'The file is using an unsupported separator. Please use one of the allowed delimiters: {delimiterList}.'
|
|
889
990
|
},
|
|
890
991
|
dropAreaNotEnoughRowsTitle: {
|
|
891
992
|
id: 'ImportResourcesModal.dropAreaNotEnoughRowsTitle',
|
|
@@ -936,10 +1037,12 @@ const useUpload = () => {
|
|
|
936
1037
|
}, [state.abortController]);
|
|
937
1038
|
const isFileValid = async file => {
|
|
938
1039
|
const errors = [];
|
|
939
|
-
const
|
|
940
|
-
if (!
|
|
941
|
-
title: intl.formatMessage(messages$6.
|
|
942
|
-
description: intl.formatMessage(messages$6.
|
|
1040
|
+
const isDelimiterValid = await validateDelimiter(file);
|
|
1041
|
+
if (!isDelimiterValid) errors.push({
|
|
1042
|
+
title: intl.formatMessage(messages$6.wrongSeparatorTitle),
|
|
1043
|
+
description: intl.formatMessage(messages$6.wrongSeparatorDescription, {
|
|
1044
|
+
delimiterList: formatAllowedDelimitersForMessageDisplay(intl)
|
|
1045
|
+
})
|
|
943
1046
|
});
|
|
944
1047
|
const rowCount = await getRowCount(file);
|
|
945
1048
|
if (rowCount < 1) errors.push({
|
|
@@ -1209,59 +1312,6 @@ const UploadSettings = () => {
|
|
|
1209
1312
|
return null;
|
|
1210
1313
|
};
|
|
1211
1314
|
|
|
1212
|
-
var sharedMessages = reactIntl.defineMessages({
|
|
1213
|
-
[`modalTitle.${IMPORTABLE_RESOURCES.CATEGORY}`]: {
|
|
1214
|
-
id: 'ImportResourcesModal.modalTitle.category',
|
|
1215
|
-
description: 'Label for the categories modal title',
|
|
1216
|
-
defaultMessage: 'Import categories by CSV'
|
|
1217
|
-
},
|
|
1218
|
-
[`modalTitle.${IMPORTABLE_RESOURCES.PRODUCT}`]: {
|
|
1219
|
-
id: 'ImportResourcesModal.modalTitle.product',
|
|
1220
|
-
description: 'Label for the products modal title',
|
|
1221
|
-
defaultMessage: 'Import products by CSV'
|
|
1222
|
-
},
|
|
1223
|
-
[`modalTitle.${IMPORTABLE_RESOURCES.INVENTORY}`]: {
|
|
1224
|
-
id: 'ImportResourcesModal.modalTitle.inventoryEntry',
|
|
1225
|
-
description: 'Label for the inventories modal title',
|
|
1226
|
-
defaultMessage: 'Import inventories by CSV'
|
|
1227
|
-
},
|
|
1228
|
-
[`modalTitle.${IMPORTABLE_RESOURCES.DISCOUNT_CODE}`]: {
|
|
1229
|
-
id: 'ImportResourcesModal.modalTitle.discountCode',
|
|
1230
|
-
description: 'Label for the inventories modal title',
|
|
1231
|
-
defaultMessage: 'Import discount codes by CSV'
|
|
1232
|
-
},
|
|
1233
|
-
[`modalTitle.${IMPORTABLE_RESOURCES.CUSTOMER}`]: {
|
|
1234
|
-
id: 'ImportResourcesModal.modalTitle.customer',
|
|
1235
|
-
description: 'Label for the customers modal title',
|
|
1236
|
-
defaultMessage: 'Import customers by CSV'
|
|
1237
|
-
},
|
|
1238
|
-
[`modalTitle.${IMPORTABLE_RESOURCES.ORDER}`]: {
|
|
1239
|
-
id: 'ImportResourcesModal.modalTitle.order',
|
|
1240
|
-
description: 'Label for the order modal title',
|
|
1241
|
-
defaultMessage: 'Import orders by CSV'
|
|
1242
|
-
},
|
|
1243
|
-
[`modalTitle.${IMPORTABLE_RESOURCES.PRODUCT_TYPE}`]: {
|
|
1244
|
-
id: 'ImportResourcesModal.modalTitle.productType',
|
|
1245
|
-
description: 'Label for the product type modal title',
|
|
1246
|
-
defaultMessage: 'Import product types by CSV'
|
|
1247
|
-
},
|
|
1248
|
-
uploadButton: {
|
|
1249
|
-
id: 'ImportResourcesModal.uploadButton',
|
|
1250
|
-
description: 'Label for the upload button',
|
|
1251
|
-
defaultMessage: 'Upload and preview'
|
|
1252
|
-
},
|
|
1253
|
-
cancel: {
|
|
1254
|
-
id: 'ImportResourcesModal.cancel',
|
|
1255
|
-
description: 'Label for the cancel button',
|
|
1256
|
-
defaultMessage: 'Cancel'
|
|
1257
|
-
},
|
|
1258
|
-
close: {
|
|
1259
|
-
id: 'ImportResourcesModal.close',
|
|
1260
|
-
description: 'Label for the close button',
|
|
1261
|
-
defaultMessage: 'Close'
|
|
1262
|
-
}
|
|
1263
|
-
});
|
|
1264
|
-
|
|
1265
1315
|
const Upload = () => {
|
|
1266
1316
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1267
1317
|
state = _useImportResourcesCo.state,
|