@commercetools-frontend-extensions/import-resources-modal 1.3.14 → 1.3.16
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-41ed9b4e.cjs.prod.js → active-drag-drop-area-1990c888.cjs.prod.js} +2 -2
- package/dist/{active-drag-drop-area-0d158ff3.esm.js → active-drag-drop-area-245e26d9.esm.js} +2 -2
- package/dist/{active-drag-drop-area-342ec29f.cjs.dev.js → active-drag-drop-area-a07d4eb3.cjs.dev.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-9db1db62.esm.js → enabled-drop-area-118cf588.esm.js} +2 -2
- package/dist/{enabled-drop-area-481fc8cb.cjs.dev.js → enabled-drop-area-11c61ee2.cjs.dev.js} +2 -2
- package/dist/{enabled-drop-area-be322b30.cjs.prod.js → enabled-drop-area-2c8702cd.cjs.prod.js} +2 -2
- package/dist/{es-934f3c93.cjs.prod.js → es-08b25677.cjs.dev.js} +1 -1
- package/dist/{es-40cea2f4.cjs.dev.js → es-231d6889.cjs.prod.js} +1 -1
- package/dist/{es-b38875bc.esm.js → es-4cfa2244.esm.js} +1 -1
- package/dist/{file-dropped-area-6ae3952f.cjs.prod.js → file-dropped-area-19c71ab9.cjs.prod.js} +2 -2
- package/dist/{file-dropped-area-61f35952.cjs.dev.js → file-dropped-area-59803011.cjs.dev.js} +2 -2
- package/dist/{file-dropped-area-04b18c45.esm.js → file-dropped-area-ef80a054.esm.js} +2 -2
- package/dist/{index-ec8576ff.cjs.prod.js → index-50af68b8.cjs.prod.js} +78 -44
- package/dist/{index-6d3efd4e.esm.js → index-a799ed10.esm.js} +77 -43
- package/dist/{index-ec4f6311.cjs.dev.js → index-aa4cebbf.cjs.dev.js} +78 -44
- 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
|
},
|
|
@@ -685,13 +702,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
685
702
|
return /*#__PURE__*/react.css(process.env.NODE_ENV === "production" ? "" : ";label:getDefaultDropWrapperStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRyb3AtYXJlYS13cmFwcGVyLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE0QlkiLCJmaWxlIjoiZHJvcC1hcmVhLXdyYXBwZXIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgdHlwZSBEcm9wem9uZVJvb3RQcm9wcyB9IGZyb20gJ3JlYWN0LWRyb3B6b25lJ1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCdcbmltcG9ydCB7IHN0eWxlcyB9IGZyb20gJy4vc3R5bGVzJ1xuaW1wb3J0IHsgdHlwZSBEcm9wQXJlYVN0YXRlIH0gZnJvbSAnLi4vLi4vLi4vQHR5cGVzJ1xuXG5pbnRlcmZhY2UgRHJvcFdyYXBwZXJQcm9wcyBleHRlbmRzIERyb3B6b25lUm9vdFByb3BzIHtcbiAgZHJvcEFyZWFTdGF0ZTogRHJvcEFyZWFTdGF0ZVxufVxuZXhwb3J0IGNvbnN0IERyb3BXcmFwcGVyID0gc3R5bGVkLmRpdjxEcm9wV3JhcHBlclByb3BzPmBcbiAgJHtzdHlsZXMuYmFzZX1cbiAgJHsocHJvcHMpID0+IHtcbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ2Rpc2FibGVkJykge1xuICAgICAgcmV0dXJuIHN0eWxlcy5kaXNhYmxlZFxuICAgIH1cbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ3JlYWR5LWZvci1kcm9wJykge1xuICAgICAgcmV0dXJuIHN0eWxlcy5yZWFkeUZvckRyb3BcbiAgICB9XG4gICAgaWYgKHByb3BzLmRyb3BBcmVhU3RhdGUgPT09ICdhY3RpdmUtZHJhZycpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuYWN0aXZlRHJhZ1xuICAgIH1cbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ2ZpbGUtZHJvcHBlZCcpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuZmlsZURyb3BwZWRcbiAgICB9XG4gICAgcmV0dXJuIGdldERlZmF1bHREcm9wV3JhcHBlclN0eWxlcyhwcm9wcy5kcm9wQXJlYVN0YXRlKVxuICB9fVxuYFxuZnVuY3Rpb24gZ2V0RGVmYXVsdERyb3BXcmFwcGVyU3R5bGVzKF9kcm9wQXJlYVN0YXRlOiBuZXZlcikge1xuICByZXR1cm4gY3NzYGBcbn1cbiJdfQ== */");
|
|
686
703
|
}
|
|
687
704
|
|
|
688
|
-
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-
|
|
705
|
+
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-a07d4eb3.cjs.dev.js' /* webpackChunkName: "active-drag-drop-area" */); }));
|
|
689
706
|
|
|
690
707
|
var DisabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./disabled-drop-area-aa78075b.cjs.dev.js' /* webpackChunkName: "disabled-drop-area" */); }));
|
|
691
708
|
|
|
692
|
-
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-
|
|
709
|
+
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-11c61ee2.cjs.dev.js' /* webpackChunkName: "enabled-drop-area" */); }));
|
|
693
710
|
|
|
694
|
-
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-
|
|
711
|
+
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-59803011.cjs.dev.js' /* webpackChunkName: "filed-dropped-area" */); }));
|
|
695
712
|
|
|
696
713
|
function getDropArea(_ref) {
|
|
697
714
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -820,7 +837,7 @@ var messages$5 = reactIntl.defineMessages({
|
|
|
820
837
|
dropAreaWrongDelimiterDescription: {
|
|
821
838
|
id: 'ImportResourcesModal.wrongDelimiterDescription',
|
|
822
839
|
description: 'Message within the drop area when a CSV file uses an unexpected delimiter',
|
|
823
|
-
defaultMessage: 'The file is using
|
|
840
|
+
defaultMessage: 'The file is using an incorrect delimiter. Please use comma (,) instead.'
|
|
824
841
|
},
|
|
825
842
|
dropAreaNotEnoughRowsTitle: {
|
|
826
843
|
id: 'ImportResourcesModal.dropAreaNotEnoughRowsTitle',
|
|
@@ -837,10 +854,20 @@ var messages$5 = reactIntl.defineMessages({
|
|
|
837
854
|
description: 'Generic notification message when file upload fails',
|
|
838
855
|
defaultMessage: 'An unexpected error occurred during the file upload. Please try again, or contact support if this error occurs again.'
|
|
839
856
|
},
|
|
857
|
+
missingRequiredField: {
|
|
858
|
+
id: 'ImportResourcesModal.missingRequiredField',
|
|
859
|
+
description: 'Error message displayed when a required field is missing',
|
|
860
|
+
defaultMessage: 'Missing required field'
|
|
861
|
+
},
|
|
840
862
|
missingKeyError: {
|
|
841
863
|
id: 'ImportResourcesModal.missingKeyError',
|
|
842
864
|
description: 'Error message displayed when the uploaded file is missing the key field',
|
|
843
865
|
defaultMessage: "The 'key' field is missing or incomplete in some rows. Please ensure every row has a 'key' value."
|
|
866
|
+
},
|
|
867
|
+
missingRequiredKeys: {
|
|
868
|
+
id: 'ImportResourcesModal.missingRequiredKeys',
|
|
869
|
+
description: 'Error message displayed when the uploaded file is missing required keys',
|
|
870
|
+
defaultMessage: 'Make sure the file contains required keys for the elements including {fieldNames}'
|
|
844
871
|
}
|
|
845
872
|
});
|
|
846
873
|
|
|
@@ -862,9 +889,7 @@ const useUpload = () => {
|
|
|
862
889
|
const delimiterCheck = await checkDelimiter(file);
|
|
863
890
|
if (!delimiterCheck.isValid) errors.push({
|
|
864
891
|
title: intl.formatMessage(messages$5.dropAreaWrongDelimiterTitle),
|
|
865
|
-
description: intl.formatMessage(messages$5.dropAreaWrongDelimiterDescription
|
|
866
|
-
delimiter: delimiterCheck.delimiter
|
|
867
|
-
})
|
|
892
|
+
description: intl.formatMessage(messages$5.dropAreaWrongDelimiterDescription)
|
|
868
893
|
});
|
|
869
894
|
const rowCount = await getRowCount(file);
|
|
870
895
|
if (rowCount < 1) errors.push({
|
|
@@ -884,7 +909,7 @@ const useUpload = () => {
|
|
|
884
909
|
})
|
|
885
910
|
});
|
|
886
911
|
if (errors.length > 0) {
|
|
887
|
-
actions.
|
|
912
|
+
actions.setFileUploadErrors(errors);
|
|
888
913
|
actions.setCurrentStep(3);
|
|
889
914
|
return false;
|
|
890
915
|
}
|
|
@@ -897,12 +922,21 @@ const useUpload = () => {
|
|
|
897
922
|
}
|
|
898
923
|
if (error instanceof HttpError) {
|
|
899
924
|
if (error.errorData?.code === 'MISSING_KEY_ERROR') {
|
|
900
|
-
actions.
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
925
|
+
actions.setFileUploadErrors([{
|
|
926
|
+
title: intl.formatMessage(messages$5.missingRequiredField),
|
|
927
|
+
description: intl.formatMessage(messages$5.missingKeyError)
|
|
928
|
+
}]);
|
|
929
|
+
actions.setCurrentStep(3);
|
|
930
|
+
} else if (error.errorData?.code === 'MissingCsvFieldIdentifier') {
|
|
931
|
+
const MissingCsvFieldIdentifierError = error.errorData;
|
|
932
|
+
const fieldNames = formatKeys(MissingCsvFieldIdentifierError.rowValue);
|
|
933
|
+
actions.setFileUploadErrors([{
|
|
934
|
+
title: intl.formatMessage(messages$5.missingRequiredField),
|
|
935
|
+
description: intl.formatMessage(messages$5.missingRequiredKeys, {
|
|
936
|
+
fieldNames
|
|
937
|
+
})
|
|
938
|
+
}]);
|
|
939
|
+
actions.setCurrentStep(3);
|
|
906
940
|
} else if (error.errorData?.invalid > 0) {
|
|
907
941
|
actions.setUploadFileResponse(error.errorData);
|
|
908
942
|
actions.setCurrentStep(3);
|
|
@@ -1168,10 +1202,10 @@ var messages$4 = reactIntl.defineMessages({
|
|
|
1168
1202
|
description: 'In Upload file error modal - "Details" column',
|
|
1169
1203
|
defaultMessage: 'Details'
|
|
1170
1204
|
},
|
|
1171
|
-
|
|
1172
|
-
id: 'ImportResourcesModal.
|
|
1205
|
+
uploadErrorDescription: {
|
|
1206
|
+
id: 'ImportResourcesModal.uploadErrorDescription',
|
|
1173
1207
|
description: 'Title when errors detected while uploading file',
|
|
1174
|
-
defaultMessage: 'There are <b>{errorsCount}</b> errors detected while uploading the file <b>{fileName}</b>.'
|
|
1208
|
+
defaultMessage: 'There {errorsCount, plural, one {is <b>{errorsCount}</b> error} other {are <b>{errorsCount}</b> errors}} detected while uploading the file <b>{fileName}</b>.'
|
|
1175
1209
|
},
|
|
1176
1210
|
supportedValuesDocumentation: {
|
|
1177
1211
|
id: 'ImportResourcesModal.supportedValuesDocumentation',
|
|
@@ -1195,7 +1229,7 @@ const getColumns$1 = () => [{
|
|
|
1195
1229
|
key: 'details',
|
|
1196
1230
|
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$a({}, messages$4.details))
|
|
1197
1231
|
}];
|
|
1198
|
-
const
|
|
1232
|
+
const UploadErrorTable = props => {
|
|
1199
1233
|
var _context;
|
|
1200
1234
|
const pagination = uiKit.usePaginationState({
|
|
1201
1235
|
perPage: 10
|
|
@@ -1238,13 +1272,13 @@ function itemRenderer$1(item, column) {
|
|
|
1238
1272
|
|
|
1239
1273
|
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; }
|
|
1240
1274
|
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; }
|
|
1241
|
-
const
|
|
1275
|
+
const UploadErrorsModal = () => {
|
|
1242
1276
|
const intl = reactIntl.useIntl();
|
|
1243
1277
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1244
1278
|
state = _useImportResourcesCo.state,
|
|
1245
1279
|
actions = _useImportResourcesCo.actions,
|
|
1246
1280
|
onClose = _useImportResourcesCo.onClose;
|
|
1247
|
-
const errorsCount = state.
|
|
1281
|
+
const errorsCount = state.fileUploadErrors.length;
|
|
1248
1282
|
return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1249
1283
|
size: 16,
|
|
1250
1284
|
isOpen: true,
|
|
@@ -1255,7 +1289,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1255
1289
|
scale: "l",
|
|
1256
1290
|
children: [jsxRuntime.jsx(fullstory.Masking.Mask, {
|
|
1257
1291
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1258
|
-
intlMessage: _objectSpread$9(_objectSpread$9({}, messages$4.
|
|
1292
|
+
intlMessage: _objectSpread$9(_objectSpread$9({}, messages$4.uploadErrorDescription), {}, {
|
|
1259
1293
|
values: {
|
|
1260
1294
|
fileName: state.droppedFile?.name,
|
|
1261
1295
|
errorsCount: intl.formatNumber(errorsCount),
|
|
@@ -1263,8 +1297,8 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1263
1297
|
}
|
|
1264
1298
|
})
|
|
1265
1299
|
})
|
|
1266
|
-
}), jsxRuntime.jsx(
|
|
1267
|
-
rows:
|
|
1300
|
+
}), jsxRuntime.jsx(UploadErrorTable, {
|
|
1301
|
+
rows: mapFileUploadErrorsToUploadFileErrorRows(state.fileUploadErrors)
|
|
1268
1302
|
}), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1269
1303
|
scale: "m",
|
|
1270
1304
|
justifyContent: "flex-end",
|
|
@@ -1303,7 +1337,7 @@ const getColumns = () => [{
|
|
|
1303
1337
|
key: 'details',
|
|
1304
1338
|
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$8({}, messages$4.details))
|
|
1305
1339
|
}];
|
|
1306
|
-
const
|
|
1340
|
+
const UploadRowErrorTable = props => {
|
|
1307
1341
|
var _context;
|
|
1308
1342
|
const pagination = uiKit.usePaginationState({
|
|
1309
1343
|
perPage: 10
|
|
@@ -1334,7 +1368,7 @@ function itemRenderer(item, column) {
|
|
|
1334
1368
|
case 'errorType':
|
|
1335
1369
|
return jsxRuntime.jsx(uiKit.Stamp, {
|
|
1336
1370
|
isCondensed: true,
|
|
1337
|
-
label: item.code,
|
|
1371
|
+
label: formatErrorCode(item.code),
|
|
1338
1372
|
tone: "critical"
|
|
1339
1373
|
});
|
|
1340
1374
|
case 'details':
|
|
@@ -1354,7 +1388,7 @@ function itemRenderer(item, column) {
|
|
|
1354
1388
|
|
|
1355
1389
|
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; }
|
|
1356
1390
|
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; }
|
|
1357
|
-
const
|
|
1391
|
+
const UploadRowErrorsModal = () => {
|
|
1358
1392
|
const intl = reactIntl.useIntl();
|
|
1359
1393
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1360
1394
|
state = _useImportResourcesCo.state,
|
|
@@ -1374,7 +1408,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1374
1408
|
scale: "xs",
|
|
1375
1409
|
children: [jsxRuntime.jsx(fullstory.Masking.Mask, {
|
|
1376
1410
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1377
|
-
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$4.
|
|
1411
|
+
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$4.uploadErrorDescription), {}, {
|
|
1378
1412
|
values: {
|
|
1379
1413
|
fileName: state.droppedFile?.name,
|
|
1380
1414
|
errorsCount: intl.formatNumber(errorsCount),
|
|
@@ -1394,7 +1428,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1394
1428
|
}
|
|
1395
1429
|
})
|
|
1396
1430
|
})]
|
|
1397
|
-
}), jsxRuntime.jsx(
|
|
1431
|
+
}), jsxRuntime.jsx(UploadRowErrorTable, {
|
|
1398
1432
|
rows: mapUploadFileErrorsResponseToUploadFileErrorRows(state.uploadFileResponse?.results)
|
|
1399
1433
|
}), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1400
1434
|
scale: "m",
|
|
@@ -1802,8 +1836,8 @@ function getBold(msg) {
|
|
|
1802
1836
|
const UploadResult = () => {
|
|
1803
1837
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1804
1838
|
state = _useImportResourcesCo.state;
|
|
1805
|
-
if (state.
|
|
1806
|
-
if (state.uploadFileResponse?.invalid > 0) return jsxRuntime.jsx(
|
|
1839
|
+
if (state.fileUploadErrors.length > 0) return jsxRuntime.jsx(UploadErrorsModal, {});
|
|
1840
|
+
if (state.uploadFileResponse?.invalid > 0) return jsxRuntime.jsx(UploadRowErrorsModal, {});
|
|
1807
1841
|
return jsxRuntime.jsx(UploadPreviewModal, {});
|
|
1808
1842
|
};
|
|
1809
1843
|
|
|
@@ -2046,7 +2080,7 @@ const getChunkImport = locale => {
|
|
|
2046
2080
|
case 'de':
|
|
2047
2081
|
return Promise.resolve().then(function () { return require(/* webpackChunkName: "import-resources-modal-i18n-de" */'./de-a34c5dd4.cjs.dev.js'); });
|
|
2048
2082
|
case 'es':
|
|
2049
|
-
return Promise.resolve().then(function () { return require(/* webpackChunkName: "import-resources-modal-i18n-es" */'./es-
|
|
2083
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "import-resources-modal-i18n-es" */'./es-08b25677.cjs.dev.js'); });
|
|
2050
2084
|
case 'fr-FR':
|
|
2051
2085
|
return Promise.resolve().then(function () { return require(/* webpackChunkName: "import-resources-modal-i18n-fr-FR" */'./fr-FR-e7126fcc.cjs.dev.js'); });
|
|
2052
2086
|
case 'zh-CN':
|
package/package.json
CHANGED