@commercetools-frontend-extensions/import-resources-modal 1.3.15 → 1.3.17
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-e62ef22b.cjs.dev.js → active-drag-drop-area-524d69ab.cjs.dev.js} +2 -2
- package/dist/{active-drag-drop-area-c0368c1e.esm.js → active-drag-drop-area-a433b37c.esm.js} +2 -2
- package/dist/{active-drag-drop-area-2b0845a4.cjs.prod.js → active-drag-drop-area-cceb59eb.cjs.prod.js} +2 -2
- package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.dev.js +2 -2
- package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.prod.js +2 -2
- package/dist/commercetools-frontend-extensions-import-resources-modal.esm.js +2 -2
- package/dist/declarations/src/@types/file-upload.d.ts +9 -1
- package/dist/{enabled-drop-area-c0c903b2.esm.js → enabled-drop-area-38bdfda1.esm.js} +2 -2
- package/dist/{enabled-drop-area-134390f4.cjs.prod.js → enabled-drop-area-80a2a4cc.cjs.prod.js} +2 -2
- package/dist/{enabled-drop-area-2429c14d.cjs.dev.js → enabled-drop-area-cfe10e45.cjs.dev.js} +2 -2
- package/dist/{es-08b25677.cjs.dev.js → es-9821e666.cjs.prod.js} +12 -4
- package/dist/{es-231d6889.cjs.prod.js → es-c3c63de8.cjs.dev.js} +12 -4
- package/dist/{es-4cfa2244.esm.js → es-c6b4310c.esm.js} +12 -4
- package/dist/{file-dropped-area-8b7bffb5.cjs.dev.js → file-dropped-area-661a809a.cjs.dev.js} +2 -2
- package/dist/{file-dropped-area-353d39b6.cjs.prod.js → file-dropped-area-c3702252.cjs.prod.js} +2 -2
- package/dist/{file-dropped-area-5560a729.esm.js → file-dropped-area-ef200f92.esm.js} +2 -2
- package/dist/{index-3905ce0c.cjs.prod.js → index-3444254a.cjs.prod.js} +76 -40
- package/dist/{index-704cf74c.esm.js → index-d17115c7.esm.js} +75 -39
- package/dist/{index-bfc0d471.cjs.dev.js → index-d7fa97aa.cjs.dev.js} +76 -40
- package/package.json +1 -1
|
@@ -33,6 +33,7 @@ var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/insta
|
|
|
33
33
|
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
34
34
|
var Papa = require('papaparse');
|
|
35
35
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
36
|
+
var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
|
|
36
37
|
var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
37
38
|
require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
|
|
38
39
|
require('@babel/runtime-corejs3/core-js-stable/url-search-params');
|
|
@@ -47,7 +48,6 @@ var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
|
47
48
|
var _styled = require('@emotion/styled/base');
|
|
48
49
|
var react = require('@emotion/react');
|
|
49
50
|
var sentry = require('@commercetools-frontend/sentry');
|
|
50
|
-
var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
|
|
51
51
|
var DataTable = require('@commercetools-uikit/data-table');
|
|
52
52
|
var i18n = require('@commercetools-frontend/i18n');
|
|
53
53
|
|
|
@@ -72,10 +72,10 @@ var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceP
|
|
|
72
72
|
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
73
73
|
var Papa__default = /*#__PURE__*/_interopDefault(Papa);
|
|
74
74
|
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
75
|
+
var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
|
|
75
76
|
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
76
77
|
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
77
78
|
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
78
|
-
var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
|
|
79
79
|
var DataTable__default = /*#__PURE__*/_interopDefault(DataTable);
|
|
80
80
|
|
|
81
81
|
function ownKeys$g(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; }
|
|
@@ -97,7 +97,7 @@ function reducer(state, action) {
|
|
|
97
97
|
if (action.type === 'cancelImport') return _objectSpread$g(_objectSpread$g({}, state), {}, {
|
|
98
98
|
currentStep: 1,
|
|
99
99
|
containerKey: undefined,
|
|
100
|
-
|
|
100
|
+
fileUploadErrors: [],
|
|
101
101
|
uploadFileResponse: undefined,
|
|
102
102
|
droppedFile: undefined,
|
|
103
103
|
dropAreaState: 'disabled',
|
|
@@ -106,7 +106,7 @@ function reducer(state, action) {
|
|
|
106
106
|
if (action.type === 'uploadNewFile') return _objectSpread$g(_objectSpread$g({}, state), {}, {
|
|
107
107
|
currentStep: 1,
|
|
108
108
|
containerKey: undefined,
|
|
109
|
-
|
|
109
|
+
fileUploadErrors: [],
|
|
110
110
|
uploadFileResponse: undefined,
|
|
111
111
|
droppedFile: undefined,
|
|
112
112
|
dropAreaState: 'ready-for-drop',
|
|
@@ -117,9 +117,9 @@ function reducer(state, action) {
|
|
|
117
117
|
droppedFile: action.droppedFile
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
|
-
if (action.type === '
|
|
120
|
+
if (action.type === 'setFileUploadErrors') {
|
|
121
121
|
return _objectSpread$g(_objectSpread$g({}, state), {}, {
|
|
122
|
-
|
|
122
|
+
fileUploadErrors: action.fileUploadErrors
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
125
|
if (action.type === 'setAbortController') {
|
|
@@ -142,7 +142,7 @@ const initialState = {
|
|
|
142
142
|
abortController: new AbortController(),
|
|
143
143
|
dropAreaState: 'disabled',
|
|
144
144
|
uploadFileResponse: undefined,
|
|
145
|
-
|
|
145
|
+
fileUploadErrors: [],
|
|
146
146
|
resourceType: 'category',
|
|
147
147
|
containerKey: undefined,
|
|
148
148
|
progress: 0
|
|
@@ -364,9 +364,9 @@ const mapUploadFileErrorsResponseToUploadFileErrorRows = uploadFileErrorsRespons
|
|
|
364
364
|
}));
|
|
365
365
|
});
|
|
366
366
|
};
|
|
367
|
-
const
|
|
367
|
+
const mapFileUploadErrorsToUploadFileErrorRows = uploadFileErrors => {
|
|
368
368
|
let idCounter = 1;
|
|
369
|
-
return _mapInstanceProperty__default["default"](
|
|
369
|
+
return _mapInstanceProperty__default["default"](uploadFileErrors).call(uploadFileErrors, uploadFileError => _objectSpread$e(_objectSpread$e({}, uploadFileError), {}, {
|
|
370
370
|
id: String(idCounter++)
|
|
371
371
|
}));
|
|
372
372
|
};
|
|
@@ -415,6 +415,23 @@ function convertFileSizeToKB(sizeInBytes) {
|
|
|
415
415
|
function isAbortError(error) {
|
|
416
416
|
return error instanceof DOMException && error.name === 'AbortError';
|
|
417
417
|
}
|
|
418
|
+
function formatKeys(obj) {
|
|
419
|
+
var _context;
|
|
420
|
+
if (typeof obj !== 'object' || obj === null) return '';
|
|
421
|
+
const keys = _mapInstanceProperty__default["default"](_context = _Object$keys__default["default"](obj)).call(_context, key => key.replace(/([a-z])([A-Z])/g, '$1 $2').toLowerCase());
|
|
422
|
+
if (keys.length === 0) return '';
|
|
423
|
+
if (keys.length === 1) return keys[0];
|
|
424
|
+
return `${_sliceInstanceProperty__default["default"](keys).call(keys, 0, -1).join(', ')} and ${keys[keys.length - 1]}`;
|
|
425
|
+
}
|
|
426
|
+
function formatErrorCode(code) {
|
|
427
|
+
try {
|
|
428
|
+
const formattedCode = code.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/([A-Z])([A-Z][a-z])/g, '$1 $2').toLowerCase();
|
|
429
|
+
let result = formattedCode.charAt(0).toUpperCase() + _sliceInstanceProperty__default["default"](formattedCode).call(formattedCode, 1);
|
|
430
|
+
return result;
|
|
431
|
+
} catch (error) {
|
|
432
|
+
return code;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
418
435
|
|
|
419
436
|
const encodeFileNameWithTimestampToContainerKey = fileName => {
|
|
420
437
|
return btoa(_JSON$stringify__default["default"]({
|
|
@@ -588,9 +605,9 @@ const ImportResourcesProvider = props => {
|
|
|
588
605
|
type: 'setAbortController',
|
|
589
606
|
abortController: abortController
|
|
590
607
|
});
|
|
591
|
-
const
|
|
592
|
-
type: '
|
|
593
|
-
|
|
608
|
+
const setFileUploadErrors = fileUploadErrors => dispatch({
|
|
609
|
+
type: 'setFileUploadErrors',
|
|
610
|
+
fileUploadErrors: fileUploadErrors
|
|
594
611
|
});
|
|
595
612
|
const setProgress = progress => dispatch({
|
|
596
613
|
type: 'setProgress',
|
|
@@ -622,7 +639,7 @@ const ImportResourcesProvider = props => {
|
|
|
622
639
|
setDroppedFile,
|
|
623
640
|
setContainerKey,
|
|
624
641
|
setAbortController,
|
|
625
|
-
|
|
642
|
+
setFileUploadErrors,
|
|
626
643
|
setProgress
|
|
627
644
|
}
|
|
628
645
|
},
|
|
@@ -682,13 +699,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
682
699
|
return /*#__PURE__*/react.css("" , "" );
|
|
683
700
|
}
|
|
684
701
|
|
|
685
|
-
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-
|
|
702
|
+
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-cceb59eb.cjs.prod.js' /* webpackChunkName: "active-drag-drop-area" */); }));
|
|
686
703
|
|
|
687
704
|
var DisabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./disabled-drop-area-99c1fa0b.cjs.prod.js' /* webpackChunkName: "disabled-drop-area" */); }));
|
|
688
705
|
|
|
689
|
-
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-
|
|
706
|
+
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-80a2a4cc.cjs.prod.js' /* webpackChunkName: "enabled-drop-area" */); }));
|
|
690
707
|
|
|
691
|
-
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-
|
|
708
|
+
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-c3702252.cjs.prod.js' /* webpackChunkName: "filed-dropped-area" */); }));
|
|
692
709
|
|
|
693
710
|
function getDropArea(_ref) {
|
|
694
711
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -834,10 +851,20 @@ var messages$5 = reactIntl.defineMessages({
|
|
|
834
851
|
description: 'Generic notification message when file upload fails',
|
|
835
852
|
defaultMessage: 'An unexpected error occurred during the file upload. Please try again, or contact support if this error occurs again.'
|
|
836
853
|
},
|
|
854
|
+
missingRequiredField: {
|
|
855
|
+
id: 'ImportResourcesModal.missingRequiredField',
|
|
856
|
+
description: 'Error message displayed when a required field is missing',
|
|
857
|
+
defaultMessage: 'Missing required field'
|
|
858
|
+
},
|
|
837
859
|
missingKeyError: {
|
|
838
860
|
id: 'ImportResourcesModal.missingKeyError',
|
|
839
861
|
description: 'Error message displayed when the uploaded file is missing the key field',
|
|
840
862
|
defaultMessage: "The 'key' field is missing or incomplete in some rows. Please ensure every row has a 'key' value."
|
|
863
|
+
},
|
|
864
|
+
missingRequiredKeys: {
|
|
865
|
+
id: 'ImportResourcesModal.missingRequiredKeys',
|
|
866
|
+
description: 'Error message displayed when the uploaded file is missing required keys',
|
|
867
|
+
defaultMessage: 'Make sure the file contains required keys for the elements including {fieldNames}'
|
|
841
868
|
}
|
|
842
869
|
});
|
|
843
870
|
|
|
@@ -879,7 +906,7 @@ const useUpload = () => {
|
|
|
879
906
|
})
|
|
880
907
|
});
|
|
881
908
|
if (errors.length > 0) {
|
|
882
|
-
actions.
|
|
909
|
+
actions.setFileUploadErrors(errors);
|
|
883
910
|
actions.setCurrentStep(3);
|
|
884
911
|
return false;
|
|
885
912
|
}
|
|
@@ -892,12 +919,21 @@ const useUpload = () => {
|
|
|
892
919
|
}
|
|
893
920
|
if (error instanceof HttpError) {
|
|
894
921
|
if (error.errorData?.code === 'MISSING_KEY_ERROR') {
|
|
895
|
-
actions.
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
922
|
+
actions.setFileUploadErrors([{
|
|
923
|
+
title: intl.formatMessage(messages$5.missingRequiredField),
|
|
924
|
+
description: intl.formatMessage(messages$5.missingKeyError)
|
|
925
|
+
}]);
|
|
926
|
+
actions.setCurrentStep(3);
|
|
927
|
+
} else if (error.errorData?.code === 'MissingCsvFieldIdentifier') {
|
|
928
|
+
const MissingCsvFieldIdentifierError = error.errorData;
|
|
929
|
+
const fieldNames = formatKeys(MissingCsvFieldIdentifierError.rowValue);
|
|
930
|
+
actions.setFileUploadErrors([{
|
|
931
|
+
title: intl.formatMessage(messages$5.missingRequiredField),
|
|
932
|
+
description: intl.formatMessage(messages$5.missingRequiredKeys, {
|
|
933
|
+
fieldNames
|
|
934
|
+
})
|
|
935
|
+
}]);
|
|
936
|
+
actions.setCurrentStep(3);
|
|
901
937
|
} else if (error.errorData?.invalid > 0) {
|
|
902
938
|
actions.setUploadFileResponse(error.errorData);
|
|
903
939
|
actions.setCurrentStep(3);
|
|
@@ -1163,10 +1199,10 @@ var messages$4 = reactIntl.defineMessages({
|
|
|
1163
1199
|
description: 'In Upload file error modal - "Details" column',
|
|
1164
1200
|
defaultMessage: 'Details'
|
|
1165
1201
|
},
|
|
1166
|
-
|
|
1167
|
-
id: 'ImportResourcesModal.
|
|
1202
|
+
uploadErrorDescription: {
|
|
1203
|
+
id: 'ImportResourcesModal.uploadErrorDescription',
|
|
1168
1204
|
description: 'Title when errors detected while uploading file',
|
|
1169
|
-
defaultMessage: 'There are <b>{errorsCount}</b> errors detected while uploading the file <b>{fileName}</b>.'
|
|
1205
|
+
defaultMessage: 'There {errorsCount, plural, one {is <b>{errorsCount}</b> error} other {are <b>{errorsCount}</b> errors}} detected while uploading the file <b>{fileName}</b>.'
|
|
1170
1206
|
},
|
|
1171
1207
|
supportedValuesDocumentation: {
|
|
1172
1208
|
id: 'ImportResourcesModal.supportedValuesDocumentation',
|
|
@@ -1190,7 +1226,7 @@ const getColumns$1 = () => [{
|
|
|
1190
1226
|
key: 'details',
|
|
1191
1227
|
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$a({}, messages$4.details))
|
|
1192
1228
|
}];
|
|
1193
|
-
const
|
|
1229
|
+
const UploadErrorTable = props => {
|
|
1194
1230
|
var _context;
|
|
1195
1231
|
const pagination = uiKit.usePaginationState({
|
|
1196
1232
|
perPage: 10
|
|
@@ -1233,13 +1269,13 @@ function itemRenderer$1(item, column) {
|
|
|
1233
1269
|
|
|
1234
1270
|
function ownKeys$9(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; }
|
|
1235
1271
|
function _objectSpread$9(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$9(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$9(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1236
|
-
const
|
|
1272
|
+
const UploadErrorsModal = () => {
|
|
1237
1273
|
const intl = reactIntl.useIntl();
|
|
1238
1274
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1239
1275
|
state = _useImportResourcesCo.state,
|
|
1240
1276
|
actions = _useImportResourcesCo.actions,
|
|
1241
1277
|
onClose = _useImportResourcesCo.onClose;
|
|
1242
|
-
const errorsCount = state.
|
|
1278
|
+
const errorsCount = state.fileUploadErrors.length;
|
|
1243
1279
|
return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1244
1280
|
size: 16,
|
|
1245
1281
|
isOpen: true,
|
|
@@ -1250,7 +1286,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1250
1286
|
scale: "l",
|
|
1251
1287
|
children: [jsxRuntime.jsx(fullstory.Masking.Mask, {
|
|
1252
1288
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1253
|
-
intlMessage: _objectSpread$9(_objectSpread$9({}, messages$4.
|
|
1289
|
+
intlMessage: _objectSpread$9(_objectSpread$9({}, messages$4.uploadErrorDescription), {}, {
|
|
1254
1290
|
values: {
|
|
1255
1291
|
fileName: state.droppedFile?.name,
|
|
1256
1292
|
errorsCount: intl.formatNumber(errorsCount),
|
|
@@ -1258,8 +1294,8 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1258
1294
|
}
|
|
1259
1295
|
})
|
|
1260
1296
|
})
|
|
1261
|
-
}), jsxRuntime.jsx(
|
|
1262
|
-
rows:
|
|
1297
|
+
}), jsxRuntime.jsx(UploadErrorTable, {
|
|
1298
|
+
rows: mapFileUploadErrorsToUploadFileErrorRows(state.fileUploadErrors)
|
|
1263
1299
|
}), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1264
1300
|
scale: "m",
|
|
1265
1301
|
justifyContent: "flex-end",
|
|
@@ -1298,7 +1334,7 @@ const getColumns = () => [{
|
|
|
1298
1334
|
key: 'details',
|
|
1299
1335
|
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$8({}, messages$4.details))
|
|
1300
1336
|
}];
|
|
1301
|
-
const
|
|
1337
|
+
const UploadRowErrorTable = props => {
|
|
1302
1338
|
var _context;
|
|
1303
1339
|
const pagination = uiKit.usePaginationState({
|
|
1304
1340
|
perPage: 10
|
|
@@ -1329,7 +1365,7 @@ function itemRenderer(item, column) {
|
|
|
1329
1365
|
case 'errorType':
|
|
1330
1366
|
return jsxRuntime.jsx(uiKit.Stamp, {
|
|
1331
1367
|
isCondensed: true,
|
|
1332
|
-
label: item.code,
|
|
1368
|
+
label: formatErrorCode(item.code),
|
|
1333
1369
|
tone: "critical"
|
|
1334
1370
|
});
|
|
1335
1371
|
case 'details':
|
|
@@ -1349,7 +1385,7 @@ function itemRenderer(item, column) {
|
|
|
1349
1385
|
|
|
1350
1386
|
function ownKeys$7(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; }
|
|
1351
1387
|
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$7(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$7(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1352
|
-
const
|
|
1388
|
+
const UploadRowErrorsModal = () => {
|
|
1353
1389
|
const intl = reactIntl.useIntl();
|
|
1354
1390
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1355
1391
|
state = _useImportResourcesCo.state,
|
|
@@ -1369,7 +1405,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1369
1405
|
scale: "xs",
|
|
1370
1406
|
children: [jsxRuntime.jsx(fullstory.Masking.Mask, {
|
|
1371
1407
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1372
|
-
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$4.
|
|
1408
|
+
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$4.uploadErrorDescription), {}, {
|
|
1373
1409
|
values: {
|
|
1374
1410
|
fileName: state.droppedFile?.name,
|
|
1375
1411
|
errorsCount: intl.formatNumber(errorsCount),
|
|
@@ -1389,7 +1425,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1389
1425
|
}
|
|
1390
1426
|
})
|
|
1391
1427
|
})]
|
|
1392
|
-
}), jsxRuntime.jsx(
|
|
1428
|
+
}), jsxRuntime.jsx(UploadRowErrorTable, {
|
|
1393
1429
|
rows: mapUploadFileErrorsResponseToUploadFileErrorRows(state.uploadFileResponse?.results)
|
|
1394
1430
|
}), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1395
1431
|
scale: "m",
|
|
@@ -1783,8 +1819,8 @@ function getBold(msg) {
|
|
|
1783
1819
|
const UploadResult = () => {
|
|
1784
1820
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1785
1821
|
state = _useImportResourcesCo.state;
|
|
1786
|
-
if (state.
|
|
1787
|
-
if (state.uploadFileResponse?.invalid > 0) return jsxRuntime.jsx(
|
|
1822
|
+
if (state.fileUploadErrors.length > 0) return jsxRuntime.jsx(UploadErrorsModal, {});
|
|
1823
|
+
if (state.uploadFileResponse?.invalid > 0) return jsxRuntime.jsx(UploadRowErrorsModal, {});
|
|
1788
1824
|
return jsxRuntime.jsx(UploadPreviewModal, {});
|
|
1789
1825
|
};
|
|
1790
1826
|
|
|
@@ -2027,7 +2063,7 @@ const getChunkImport = locale => {
|
|
|
2027
2063
|
case 'de':
|
|
2028
2064
|
return Promise.resolve().then(function () { return require(/* webpackChunkName: "import-resources-modal-i18n-de" */'./de-d954fe3d.cjs.prod.js'); });
|
|
2029
2065
|
case 'es':
|
|
2030
|
-
return Promise.resolve().then(function () { return require(/* webpackChunkName: "import-resources-modal-i18n-es" */'./es-
|
|
2066
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "import-resources-modal-i18n-es" */'./es-9821e666.cjs.prod.js'); });
|
|
2031
2067
|
case 'fr-FR':
|
|
2032
2068
|
return Promise.resolve().then(function () { return require(/* webpackChunkName: "import-resources-modal-i18n-fr-FR" */'./fr-FR-fce1ca96.cjs.prod.js'); });
|
|
2033
2069
|
case 'zh-CN':
|
|
@@ -31,6 +31,7 @@ import _findInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instanc
|
|
|
31
31
|
import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
|
|
32
32
|
import Papa from 'papaparse';
|
|
33
33
|
import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
|
|
34
|
+
import _sliceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/slice';
|
|
34
35
|
import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
|
|
35
36
|
import '@babel/runtime-corejs3/core-js-stable/instance/starts-with';
|
|
36
37
|
import '@babel/runtime-corejs3/core-js-stable/url-search-params';
|
|
@@ -45,7 +46,6 @@ import { useShowNotification } from '@commercetools-frontend/actions-global';
|
|
|
45
46
|
import _styled from '@emotion/styled/base';
|
|
46
47
|
import { css } from '@emotion/react';
|
|
47
48
|
import { reportErrorToSentry } from '@commercetools-frontend/sentry';
|
|
48
|
-
import _sliceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/slice';
|
|
49
49
|
import DataTable from '@commercetools-uikit/data-table';
|
|
50
50
|
import { parseChunkImport, mapLocaleToIntlLocale } from '@commercetools-frontend/i18n';
|
|
51
51
|
|
|
@@ -68,7 +68,7 @@ function reducer(state, action) {
|
|
|
68
68
|
if (action.type === 'cancelImport') return _objectSpread$g(_objectSpread$g({}, state), {}, {
|
|
69
69
|
currentStep: 1,
|
|
70
70
|
containerKey: undefined,
|
|
71
|
-
|
|
71
|
+
fileUploadErrors: [],
|
|
72
72
|
uploadFileResponse: undefined,
|
|
73
73
|
droppedFile: undefined,
|
|
74
74
|
dropAreaState: 'disabled',
|
|
@@ -77,7 +77,7 @@ function reducer(state, action) {
|
|
|
77
77
|
if (action.type === 'uploadNewFile') return _objectSpread$g(_objectSpread$g({}, state), {}, {
|
|
78
78
|
currentStep: 1,
|
|
79
79
|
containerKey: undefined,
|
|
80
|
-
|
|
80
|
+
fileUploadErrors: [],
|
|
81
81
|
uploadFileResponse: undefined,
|
|
82
82
|
droppedFile: undefined,
|
|
83
83
|
dropAreaState: 'ready-for-drop',
|
|
@@ -88,9 +88,9 @@ function reducer(state, action) {
|
|
|
88
88
|
droppedFile: action.droppedFile
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
-
if (action.type === '
|
|
91
|
+
if (action.type === 'setFileUploadErrors') {
|
|
92
92
|
return _objectSpread$g(_objectSpread$g({}, state), {}, {
|
|
93
|
-
|
|
93
|
+
fileUploadErrors: action.fileUploadErrors
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
if (action.type === 'setAbortController') {
|
|
@@ -113,7 +113,7 @@ const initialState = {
|
|
|
113
113
|
abortController: new AbortController(),
|
|
114
114
|
dropAreaState: 'disabled',
|
|
115
115
|
uploadFileResponse: undefined,
|
|
116
|
-
|
|
116
|
+
fileUploadErrors: [],
|
|
117
117
|
resourceType: 'category',
|
|
118
118
|
containerKey: undefined,
|
|
119
119
|
progress: 0
|
|
@@ -335,9 +335,9 @@ const mapUploadFileErrorsResponseToUploadFileErrorRows = uploadFileErrorsRespons
|
|
|
335
335
|
}));
|
|
336
336
|
});
|
|
337
337
|
};
|
|
338
|
-
const
|
|
338
|
+
const mapFileUploadErrorsToUploadFileErrorRows = uploadFileErrors => {
|
|
339
339
|
let idCounter = 1;
|
|
340
|
-
return _mapInstanceProperty(
|
|
340
|
+
return _mapInstanceProperty(uploadFileErrors).call(uploadFileErrors, uploadFileError => _objectSpread$e(_objectSpread$e({}, uploadFileError), {}, {
|
|
341
341
|
id: String(idCounter++)
|
|
342
342
|
}));
|
|
343
343
|
};
|
|
@@ -386,6 +386,23 @@ function convertFileSizeToKB(sizeInBytes) {
|
|
|
386
386
|
function isAbortError(error) {
|
|
387
387
|
return error instanceof DOMException && error.name === 'AbortError';
|
|
388
388
|
}
|
|
389
|
+
function formatKeys(obj) {
|
|
390
|
+
var _context;
|
|
391
|
+
if (typeof obj !== 'object' || obj === null) return '';
|
|
392
|
+
const keys = _mapInstanceProperty(_context = _Object$keys(obj)).call(_context, key => key.replace(/([a-z])([A-Z])/g, '$1 $2').toLowerCase());
|
|
393
|
+
if (keys.length === 0) return '';
|
|
394
|
+
if (keys.length === 1) return keys[0];
|
|
395
|
+
return `${_sliceInstanceProperty(keys).call(keys, 0, -1).join(', ')} and ${keys[keys.length - 1]}`;
|
|
396
|
+
}
|
|
397
|
+
function formatErrorCode(code) {
|
|
398
|
+
try {
|
|
399
|
+
const formattedCode = code.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/([A-Z])([A-Z][a-z])/g, '$1 $2').toLowerCase();
|
|
400
|
+
let result = formattedCode.charAt(0).toUpperCase() + _sliceInstanceProperty(formattedCode).call(formattedCode, 1);
|
|
401
|
+
return result;
|
|
402
|
+
} catch (error) {
|
|
403
|
+
return code;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
389
406
|
|
|
390
407
|
const encodeFileNameWithTimestampToContainerKey = fileName => {
|
|
391
408
|
return btoa(_JSON$stringify({
|
|
@@ -559,9 +576,9 @@ const ImportResourcesProvider = props => {
|
|
|
559
576
|
type: 'setAbortController',
|
|
560
577
|
abortController: abortController
|
|
561
578
|
});
|
|
562
|
-
const
|
|
563
|
-
type: '
|
|
564
|
-
|
|
579
|
+
const setFileUploadErrors = fileUploadErrors => dispatch({
|
|
580
|
+
type: 'setFileUploadErrors',
|
|
581
|
+
fileUploadErrors: fileUploadErrors
|
|
565
582
|
});
|
|
566
583
|
const setProgress = progress => dispatch({
|
|
567
584
|
type: 'setProgress',
|
|
@@ -593,7 +610,7 @@ const ImportResourcesProvider = props => {
|
|
|
593
610
|
setDroppedFile,
|
|
594
611
|
setContainerKey,
|
|
595
612
|
setAbortController,
|
|
596
|
-
|
|
613
|
+
setFileUploadErrors,
|
|
597
614
|
setProgress
|
|
598
615
|
}
|
|
599
616
|
},
|
|
@@ -656,13 +673,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
656
673
|
return /*#__PURE__*/css(process.env.NODE_ENV === "production" ? "" : ";label:getDefaultDropWrapperStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRyb3AtYXJlYS13cmFwcGVyLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE0QlkiLCJmaWxlIjoiZHJvcC1hcmVhLXdyYXBwZXIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgdHlwZSBEcm9wem9uZVJvb3RQcm9wcyB9IGZyb20gJ3JlYWN0LWRyb3B6b25lJ1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCdcbmltcG9ydCB7IHN0eWxlcyB9IGZyb20gJy4vc3R5bGVzJ1xuaW1wb3J0IHsgdHlwZSBEcm9wQXJlYVN0YXRlIH0gZnJvbSAnLi4vLi4vLi4vQHR5cGVzJ1xuXG5pbnRlcmZhY2UgRHJvcFdyYXBwZXJQcm9wcyBleHRlbmRzIERyb3B6b25lUm9vdFByb3BzIHtcbiAgZHJvcEFyZWFTdGF0ZTogRHJvcEFyZWFTdGF0ZVxufVxuZXhwb3J0IGNvbnN0IERyb3BXcmFwcGVyID0gc3R5bGVkLmRpdjxEcm9wV3JhcHBlclByb3BzPmBcbiAgJHtzdHlsZXMuYmFzZX1cbiAgJHsocHJvcHMpID0+IHtcbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ2Rpc2FibGVkJykge1xuICAgICAgcmV0dXJuIHN0eWxlcy5kaXNhYmxlZFxuICAgIH1cbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ3JlYWR5LWZvci1kcm9wJykge1xuICAgICAgcmV0dXJuIHN0eWxlcy5yZWFkeUZvckRyb3BcbiAgICB9XG4gICAgaWYgKHByb3BzLmRyb3BBcmVhU3RhdGUgPT09ICdhY3RpdmUtZHJhZycpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuYWN0aXZlRHJhZ1xuICAgIH1cbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ2ZpbGUtZHJvcHBlZCcpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuZmlsZURyb3BwZWRcbiAgICB9XG4gICAgcmV0dXJuIGdldERlZmF1bHREcm9wV3JhcHBlclN0eWxlcyhwcm9wcy5kcm9wQXJlYVN0YXRlKVxuICB9fVxuYFxuZnVuY3Rpb24gZ2V0RGVmYXVsdERyb3BXcmFwcGVyU3R5bGVzKF9kcm9wQXJlYVN0YXRlOiBuZXZlcikge1xuICByZXR1cm4gY3NzYGBcbn1cbiJdfQ== */");
|
|
657
674
|
}
|
|
658
675
|
|
|
659
|
-
var ActiveDragDropArea = /*#__PURE__*/lazy(() => import('./active-drag-drop-area-
|
|
676
|
+
var ActiveDragDropArea = /*#__PURE__*/lazy(() => import('./active-drag-drop-area-a433b37c.esm.js' /* webpackChunkName: "active-drag-drop-area" */));
|
|
660
677
|
|
|
661
678
|
var DisabledDropArea = /*#__PURE__*/lazy(() => import('./disabled-drop-area-2c088477.esm.js' /* webpackChunkName: "disabled-drop-area" */));
|
|
662
679
|
|
|
663
|
-
var EnabledDropArea = /*#__PURE__*/lazy(() => import('./enabled-drop-area-
|
|
680
|
+
var EnabledDropArea = /*#__PURE__*/lazy(() => import('./enabled-drop-area-38bdfda1.esm.js' /* webpackChunkName: "enabled-drop-area" */));
|
|
664
681
|
|
|
665
|
-
var FileDropped = /*#__PURE__*/lazy(() => import('./file-dropped-area-
|
|
682
|
+
var FileDropped = /*#__PURE__*/lazy(() => import('./file-dropped-area-ef200f92.esm.js' /* webpackChunkName: "filed-dropped-area" */));
|
|
666
683
|
|
|
667
684
|
function getDropArea(_ref) {
|
|
668
685
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -808,10 +825,20 @@ var messages$5 = defineMessages({
|
|
|
808
825
|
description: 'Generic notification message when file upload fails',
|
|
809
826
|
defaultMessage: 'An unexpected error occurred during the file upload. Please try again, or contact support if this error occurs again.'
|
|
810
827
|
},
|
|
828
|
+
missingRequiredField: {
|
|
829
|
+
id: 'ImportResourcesModal.missingRequiredField',
|
|
830
|
+
description: 'Error message displayed when a required field is missing',
|
|
831
|
+
defaultMessage: 'Missing required field'
|
|
832
|
+
},
|
|
811
833
|
missingKeyError: {
|
|
812
834
|
id: 'ImportResourcesModal.missingKeyError',
|
|
813
835
|
description: 'Error message displayed when the uploaded file is missing the key field',
|
|
814
836
|
defaultMessage: "The 'key' field is missing or incomplete in some rows. Please ensure every row has a 'key' value."
|
|
837
|
+
},
|
|
838
|
+
missingRequiredKeys: {
|
|
839
|
+
id: 'ImportResourcesModal.missingRequiredKeys',
|
|
840
|
+
description: 'Error message displayed when the uploaded file is missing required keys',
|
|
841
|
+
defaultMessage: 'Make sure the file contains required keys for the elements including {fieldNames}'
|
|
815
842
|
}
|
|
816
843
|
});
|
|
817
844
|
|
|
@@ -853,7 +880,7 @@ const useUpload = () => {
|
|
|
853
880
|
})
|
|
854
881
|
});
|
|
855
882
|
if (errors.length > 0) {
|
|
856
|
-
actions.
|
|
883
|
+
actions.setFileUploadErrors(errors);
|
|
857
884
|
actions.setCurrentStep(3);
|
|
858
885
|
return false;
|
|
859
886
|
}
|
|
@@ -866,12 +893,21 @@ const useUpload = () => {
|
|
|
866
893
|
}
|
|
867
894
|
if (error instanceof HttpError) {
|
|
868
895
|
if (error.errorData?.code === 'MISSING_KEY_ERROR') {
|
|
869
|
-
actions.
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
896
|
+
actions.setFileUploadErrors([{
|
|
897
|
+
title: intl.formatMessage(messages$5.missingRequiredField),
|
|
898
|
+
description: intl.formatMessage(messages$5.missingKeyError)
|
|
899
|
+
}]);
|
|
900
|
+
actions.setCurrentStep(3);
|
|
901
|
+
} else if (error.errorData?.code === 'MissingCsvFieldIdentifier') {
|
|
902
|
+
const MissingCsvFieldIdentifierError = error.errorData;
|
|
903
|
+
const fieldNames = formatKeys(MissingCsvFieldIdentifierError.rowValue);
|
|
904
|
+
actions.setFileUploadErrors([{
|
|
905
|
+
title: intl.formatMessage(messages$5.missingRequiredField),
|
|
906
|
+
description: intl.formatMessage(messages$5.missingRequiredKeys, {
|
|
907
|
+
fieldNames
|
|
908
|
+
})
|
|
909
|
+
}]);
|
|
910
|
+
actions.setCurrentStep(3);
|
|
875
911
|
} else if (error.errorData?.invalid > 0) {
|
|
876
912
|
actions.setUploadFileResponse(error.errorData);
|
|
877
913
|
actions.setCurrentStep(3);
|
|
@@ -1137,10 +1173,10 @@ var messages$4 = defineMessages({
|
|
|
1137
1173
|
description: 'In Upload file error modal - "Details" column',
|
|
1138
1174
|
defaultMessage: 'Details'
|
|
1139
1175
|
},
|
|
1140
|
-
|
|
1141
|
-
id: 'ImportResourcesModal.
|
|
1176
|
+
uploadErrorDescription: {
|
|
1177
|
+
id: 'ImportResourcesModal.uploadErrorDescription',
|
|
1142
1178
|
description: 'Title when errors detected while uploading file',
|
|
1143
|
-
defaultMessage: 'There are <b>{errorsCount}</b> errors detected while uploading the file <b>{fileName}</b>.'
|
|
1179
|
+
defaultMessage: 'There {errorsCount, plural, one {is <b>{errorsCount}</b> error} other {are <b>{errorsCount}</b> errors}} detected while uploading the file <b>{fileName}</b>.'
|
|
1144
1180
|
},
|
|
1145
1181
|
supportedValuesDocumentation: {
|
|
1146
1182
|
id: 'ImportResourcesModal.supportedValuesDocumentation',
|
|
@@ -1164,7 +1200,7 @@ const getColumns$1 = () => [{
|
|
|
1164
1200
|
key: 'details',
|
|
1165
1201
|
label: jsx(FormattedMessage, _objectSpread$a({}, messages$4.details))
|
|
1166
1202
|
}];
|
|
1167
|
-
const
|
|
1203
|
+
const UploadErrorTable = props => {
|
|
1168
1204
|
var _context;
|
|
1169
1205
|
const pagination = usePaginationState({
|
|
1170
1206
|
perPage: 10
|
|
@@ -1207,13 +1243,13 @@ function itemRenderer$1(item, column) {
|
|
|
1207
1243
|
|
|
1208
1244
|
function ownKeys$9(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; }
|
|
1209
1245
|
function _objectSpread$9(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$9(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$9(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1210
|
-
const
|
|
1246
|
+
const UploadErrorsModal = () => {
|
|
1211
1247
|
const intl = useIntl();
|
|
1212
1248
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1213
1249
|
state = _useImportResourcesCo.state,
|
|
1214
1250
|
actions = _useImportResourcesCo.actions,
|
|
1215
1251
|
onClose = _useImportResourcesCo.onClose;
|
|
1216
|
-
const errorsCount = state.
|
|
1252
|
+
const errorsCount = state.fileUploadErrors.length;
|
|
1217
1253
|
return jsx(InfoDialog, {
|
|
1218
1254
|
size: 16,
|
|
1219
1255
|
isOpen: true,
|
|
@@ -1224,7 +1260,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1224
1260
|
scale: "l",
|
|
1225
1261
|
children: [jsx(Masking.Mask, {
|
|
1226
1262
|
children: jsx(Text.Body, {
|
|
1227
|
-
intlMessage: _objectSpread$9(_objectSpread$9({}, messages$4.
|
|
1263
|
+
intlMessage: _objectSpread$9(_objectSpread$9({}, messages$4.uploadErrorDescription), {}, {
|
|
1228
1264
|
values: {
|
|
1229
1265
|
fileName: state.droppedFile?.name,
|
|
1230
1266
|
errorsCount: intl.formatNumber(errorsCount),
|
|
@@ -1232,8 +1268,8 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1232
1268
|
}
|
|
1233
1269
|
})
|
|
1234
1270
|
})
|
|
1235
|
-
}), jsx(
|
|
1236
|
-
rows:
|
|
1271
|
+
}), jsx(UploadErrorTable, {
|
|
1272
|
+
rows: mapFileUploadErrorsToUploadFileErrorRows(state.fileUploadErrors)
|
|
1237
1273
|
}), jsxs(Spacings.Inline, {
|
|
1238
1274
|
scale: "m",
|
|
1239
1275
|
justifyContent: "flex-end",
|
|
@@ -1272,7 +1308,7 @@ const getColumns = () => [{
|
|
|
1272
1308
|
key: 'details',
|
|
1273
1309
|
label: jsx(FormattedMessage, _objectSpread$8({}, messages$4.details))
|
|
1274
1310
|
}];
|
|
1275
|
-
const
|
|
1311
|
+
const UploadRowErrorTable = props => {
|
|
1276
1312
|
var _context;
|
|
1277
1313
|
const pagination = usePaginationState({
|
|
1278
1314
|
perPage: 10
|
|
@@ -1303,7 +1339,7 @@ function itemRenderer(item, column) {
|
|
|
1303
1339
|
case 'errorType':
|
|
1304
1340
|
return jsx(Stamp, {
|
|
1305
1341
|
isCondensed: true,
|
|
1306
|
-
label: item.code,
|
|
1342
|
+
label: formatErrorCode(item.code),
|
|
1307
1343
|
tone: "critical"
|
|
1308
1344
|
});
|
|
1309
1345
|
case 'details':
|
|
@@ -1323,7 +1359,7 @@ function itemRenderer(item, column) {
|
|
|
1323
1359
|
|
|
1324
1360
|
function ownKeys$7(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; }
|
|
1325
1361
|
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$7(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$7(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1326
|
-
const
|
|
1362
|
+
const UploadRowErrorsModal = () => {
|
|
1327
1363
|
const intl = useIntl();
|
|
1328
1364
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1329
1365
|
state = _useImportResourcesCo.state,
|
|
@@ -1343,7 +1379,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1343
1379
|
scale: "xs",
|
|
1344
1380
|
children: [jsx(Masking.Mask, {
|
|
1345
1381
|
children: jsx(Text.Body, {
|
|
1346
|
-
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$4.
|
|
1382
|
+
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$4.uploadErrorDescription), {}, {
|
|
1347
1383
|
values: {
|
|
1348
1384
|
fileName: state.droppedFile?.name,
|
|
1349
1385
|
errorsCount: intl.formatNumber(errorsCount),
|
|
@@ -1363,7 +1399,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1363
1399
|
}
|
|
1364
1400
|
})
|
|
1365
1401
|
})]
|
|
1366
|
-
}), jsx(
|
|
1402
|
+
}), jsx(UploadRowErrorTable, {
|
|
1367
1403
|
rows: mapUploadFileErrorsResponseToUploadFileErrorRows(state.uploadFileResponse?.results)
|
|
1368
1404
|
}), jsxs(Spacings.Inline, {
|
|
1369
1405
|
scale: "m",
|
|
@@ -1771,8 +1807,8 @@ function getBold(msg) {
|
|
|
1771
1807
|
const UploadResult = () => {
|
|
1772
1808
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1773
1809
|
state = _useImportResourcesCo.state;
|
|
1774
|
-
if (state.
|
|
1775
|
-
if (state.uploadFileResponse?.invalid > 0) return jsx(
|
|
1810
|
+
if (state.fileUploadErrors.length > 0) return jsx(UploadErrorsModal, {});
|
|
1811
|
+
if (state.uploadFileResponse?.invalid > 0) return jsx(UploadRowErrorsModal, {});
|
|
1776
1812
|
return jsx(UploadPreviewModal, {});
|
|
1777
1813
|
};
|
|
1778
1814
|
|
|
@@ -2015,7 +2051,7 @@ const getChunkImport = locale => {
|
|
|
2015
2051
|
case 'de':
|
|
2016
2052
|
return import(/* webpackChunkName: "import-resources-modal-i18n-de" */'./de-cd6c45d3.esm.js');
|
|
2017
2053
|
case 'es':
|
|
2018
|
-
return import(/* webpackChunkName: "import-resources-modal-i18n-es" */'./es-
|
|
2054
|
+
return import(/* webpackChunkName: "import-resources-modal-i18n-es" */'./es-c6b4310c.esm.js');
|
|
2019
2055
|
case 'fr-FR':
|
|
2020
2056
|
return import(/* webpackChunkName: "import-resources-modal-i18n-fr-FR" */'./fr-FR-9d9081ee.esm.js');
|
|
2021
2057
|
case 'zh-CN':
|