@commercetools-frontend-extensions/import-resources-modal 0.0.0-canary-20240613091651 → 0.0.0-canary-20240619085132
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/README.md +2 -2
- package/dist/{active-drag-drop-area-2628f8b5.esm.js → active-drag-drop-area-411713e9.esm.js} +2 -2
- package/dist/{active-drag-drop-area-14a9ac54.cjs.dev.js → active-drag-drop-area-afab9a53.cjs.dev.js} +2 -2
- package/dist/{active-drag-drop-area-1ce20a9e.cjs.prod.js → active-drag-drop-area-f3c34dec.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/import-resources-modal-props.d.ts +1 -1
- package/dist/declarations/src/import-resources-modal.d.ts +1 -1
- package/dist/{enabled-drop-area-c976838f.cjs.prod.js → enabled-drop-area-1c5689e6.cjs.prod.js} +2 -2
- package/dist/{enabled-drop-area-859b8fca.esm.js → enabled-drop-area-45d0624e.esm.js} +2 -2
- package/dist/{enabled-drop-area-7280acfd.cjs.dev.js → enabled-drop-area-958a1553.cjs.dev.js} +2 -2
- package/dist/{file-dropped-area-d5448c72.cjs.dev.js → file-dropped-area-847a7088.cjs.dev.js} +1 -1
- package/dist/{file-dropped-area-9d536c9e.cjs.prod.js → file-dropped-area-cab83f88.cjs.prod.js} +1 -1
- package/dist/{file-dropped-area-61e339b0.esm.js → file-dropped-area-f586d767.esm.js} +1 -1
- package/dist/{index-75e4313b.esm.js → index-206edb9b.esm.js} +216 -109
- package/dist/{index-1582b8fc.cjs.dev.js → index-23d51703.cjs.dev.js} +216 -109
- package/dist/{index-f962601e.cjs.prod.js → index-3dfbefe0.cjs.prod.js} +216 -109
- package/package.json +1 -1
|
@@ -7,13 +7,13 @@ import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-st
|
|
|
7
7
|
import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
8
8
|
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
9
9
|
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
10
|
+
import _everyInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/every';
|
|
10
11
|
import { defineMessages, useIntl, FormattedMessage, IntlProvider } from 'react-intl';
|
|
11
12
|
import { oidcStorage, useApplicationContext } from '@commercetools-frontend/application-shell-connectors';
|
|
12
13
|
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
13
14
|
import React, { useContext, lazy, useState, useEffect } from 'react';
|
|
14
15
|
import { actions, useAsyncDispatch } from '@commercetools-frontend/sdk';
|
|
15
16
|
import { MC_API_PROXY_TARGETS, DOMAINS } from '@commercetools-frontend/constants';
|
|
16
|
-
import _everyInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/every';
|
|
17
17
|
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
18
18
|
import { plural } from 'pluralize';
|
|
19
19
|
import _Promise from '@babel/runtime-corejs3/core-js-stable/promise';
|
|
@@ -39,7 +39,7 @@ import _getPrototypeOf from '@babel/runtime-corejs3/helpers/esm/getPrototypeOf';
|
|
|
39
39
|
import _wrapNativeSuper from '@babel/runtime-corejs3/helpers/esm/wrapNativeSuper';
|
|
40
40
|
import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
41
41
|
import { FormDialog, PageContentNarrow, ConfirmationDialog, InfoDialog } from '@commercetools-frontend/application-components';
|
|
42
|
-
import { customProperties, Constraints, Spacings, Text, Link, Card, CheckBoldIcon, EyeCrossedIcon, usePaginationState, PageNavigator, Stamp, SecondaryButton, PrimaryButton, ImportIcon, ProgressBar } from '@commercetools-frontend/ui-kit';
|
|
42
|
+
import { customProperties, Constraints, Spacings, Grid, designTokens, Text, Link, Card, CheckBoldIcon, EyeCrossedIcon, usePaginationState, PageNavigator, Stamp, SecondaryButton, PrimaryButton, ImportIcon, ProgressBar, RadioInput } from '@commercetools-frontend/ui-kit';
|
|
43
43
|
import { useShowNotification } from '@commercetools-frontend/actions-global';
|
|
44
44
|
import { reportErrorToSentry } from '@commercetools-frontend/sentry';
|
|
45
45
|
import { useDropzone } from 'react-dropzone';
|
|
@@ -92,7 +92,7 @@ const FILE_SIZE_LIMITS_MB = {
|
|
|
92
92
|
};
|
|
93
93
|
const ROW_LIMITS = {
|
|
94
94
|
category: 5000,
|
|
95
|
-
inventory:
|
|
95
|
+
inventory: 4000,
|
|
96
96
|
product: 70000
|
|
97
97
|
};
|
|
98
98
|
const RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS = {
|
|
@@ -520,7 +520,7 @@ const ImportResourcesProvider = props => {
|
|
|
520
520
|
projectKey = _useApplicationContex.projectKey;
|
|
521
521
|
const asyncDispatch = useAsyncDispatch();
|
|
522
522
|
const _React$useReducer = React.useReducer(reducer, _objectSpread$b(_objectSpread$b({}, initialState), {}, {
|
|
523
|
-
resourceType: props.
|
|
523
|
+
resourceType: props.resourceTypes[0]
|
|
524
524
|
})),
|
|
525
525
|
_React$useReducer2 = _slicedToArray(_React$useReducer, 2),
|
|
526
526
|
state = _React$useReducer2[0],
|
|
@@ -529,13 +529,13 @@ const ImportResourcesProvider = props => {
|
|
|
529
529
|
type: 'setCurrentStep',
|
|
530
530
|
currentStep
|
|
531
531
|
});
|
|
532
|
-
const setUploadFileResponse =
|
|
532
|
+
const setUploadFileResponse = uploadFileResponse => dispatch({
|
|
533
533
|
type: 'setUploadFileResponse',
|
|
534
|
-
uploadFileResponse:
|
|
534
|
+
uploadFileResponse: uploadFileResponse
|
|
535
535
|
});
|
|
536
|
-
const setResourceType =
|
|
536
|
+
const setResourceType = resourceType => dispatch({
|
|
537
537
|
type: 'setResourceType',
|
|
538
|
-
resourceType:
|
|
538
|
+
resourceType: resourceType
|
|
539
539
|
});
|
|
540
540
|
const setContainerKey = containerKey => dispatch({
|
|
541
541
|
type: 'setContainerKey',
|
|
@@ -547,17 +547,17 @@ const ImportResourcesProvider = props => {
|
|
|
547
547
|
const uploadNewFile = () => dispatch({
|
|
548
548
|
type: 'uploadNewFile'
|
|
549
549
|
});
|
|
550
|
-
const setDroppedFile =
|
|
550
|
+
const setDroppedFile = droppedFile => dispatch({
|
|
551
551
|
type: 'setDroppedFile',
|
|
552
|
-
droppedFile:
|
|
552
|
+
droppedFile: droppedFile
|
|
553
553
|
});
|
|
554
|
-
const setAbortController =
|
|
554
|
+
const setAbortController = abortController => dispatch({
|
|
555
555
|
type: 'setAbortController',
|
|
556
|
-
abortController:
|
|
556
|
+
abortController: abortController
|
|
557
557
|
});
|
|
558
|
-
const setFileUploadClientSideErrors =
|
|
558
|
+
const setFileUploadClientSideErrors = fileUploadClientSideErrors => dispatch({
|
|
559
559
|
type: 'setFileUploadClientSideErrors',
|
|
560
|
-
fileUploadClientSideErrors:
|
|
560
|
+
fileUploadClientSideErrors: fileUploadClientSideErrors
|
|
561
561
|
});
|
|
562
562
|
const setProgress = progress => dispatch({
|
|
563
563
|
type: 'setProgress',
|
|
@@ -577,6 +577,7 @@ const ImportResourcesProvider = props => {
|
|
|
577
577
|
return jsx(ImportResourcesContext.Provider, {
|
|
578
578
|
value: {
|
|
579
579
|
state,
|
|
580
|
+
resourceTypes: props.resourceTypes,
|
|
580
581
|
onClose: handleClose,
|
|
581
582
|
onStartImportSuccess: handleStartImportSuccess,
|
|
582
583
|
actions: {
|
|
@@ -604,7 +605,7 @@ function useImportResourcesContext() {
|
|
|
604
605
|
return context;
|
|
605
606
|
}
|
|
606
607
|
|
|
607
|
-
var messages$
|
|
608
|
+
var messages$5 = defineMessages({
|
|
608
609
|
fileSizeExceededTitle: {
|
|
609
610
|
id: 'ImportResourcesModal.sizeExceededTitle',
|
|
610
611
|
defaultMessage: 'File size exceeded'
|
|
@@ -669,25 +670,25 @@ const useUpload = () => {
|
|
|
669
670
|
const errors = [];
|
|
670
671
|
const delimiterCheck = await checkDelimiter(file);
|
|
671
672
|
if (!delimiterCheck.isValid) errors.push({
|
|
672
|
-
title: intl.formatMessage(messages$
|
|
673
|
-
description: intl.formatMessage(messages$
|
|
673
|
+
title: intl.formatMessage(messages$5.dropAreaWrongDelimiterTitle),
|
|
674
|
+
description: intl.formatMessage(messages$5.dropAreaWrongDelimiterDescription, {
|
|
674
675
|
delimiter: delimiterCheck.delimiter
|
|
675
676
|
})
|
|
676
677
|
});
|
|
677
678
|
const rowCount = await getRowCount(file);
|
|
678
679
|
if (rowCount < 1) errors.push({
|
|
679
|
-
title: intl.formatMessage(messages$
|
|
680
|
-
description: intl.formatMessage(messages$
|
|
680
|
+
title: intl.formatMessage(messages$5.dropAreaNotEnoughRowsTitle),
|
|
681
|
+
description: intl.formatMessage(messages$5.dropAreaNotEnoughRowsDescription)
|
|
681
682
|
});
|
|
682
683
|
if (state.resourceType && file.size > toBytes(FILE_SIZE_LIMITS_MB[state.resourceType])) errors.push({
|
|
683
|
-
title: intl.formatMessage(messages$
|
|
684
|
-
description: intl.formatMessage(messages$
|
|
684
|
+
title: intl.formatMessage(messages$5.fileSizeExceededTitle),
|
|
685
|
+
description: intl.formatMessage(messages$5.fileSizeExceededDescription, {
|
|
685
686
|
fileSizeLimit: intl.formatNumber(FILE_SIZE_LIMITS_MB[state.resourceType])
|
|
686
687
|
})
|
|
687
688
|
});
|
|
688
689
|
if (state.resourceType && rowCount > ROW_LIMITS[state.resourceType]) errors.push({
|
|
689
|
-
title: intl.formatMessage(messages$
|
|
690
|
-
description: intl.formatMessage(messages$
|
|
690
|
+
title: intl.formatMessage(messages$5.rowLimitExceededTitle),
|
|
691
|
+
description: intl.formatMessage(messages$5.rowLimitExceededDescription, {
|
|
691
692
|
rowLimit: intl.formatNumber(ROW_LIMITS[state.resourceType])
|
|
692
693
|
})
|
|
693
694
|
});
|
|
@@ -719,7 +720,7 @@ const useUpload = () => {
|
|
|
719
720
|
showNotification({
|
|
720
721
|
kind: 'error',
|
|
721
722
|
domain: DOMAINS.PAGE,
|
|
722
|
-
text: intl.formatMessage(messages$
|
|
723
|
+
text: intl.formatMessage(messages$5.unexpectedError)
|
|
723
724
|
});
|
|
724
725
|
}
|
|
725
726
|
} else {
|
|
@@ -783,7 +784,7 @@ const useUpload = () => {
|
|
|
783
784
|
};
|
|
784
785
|
};
|
|
785
786
|
|
|
786
|
-
function resourceTypeToDisplayName(_ref) {
|
|
787
|
+
function resourceTypeToDisplayName$1(_ref) {
|
|
787
788
|
let resourceType = _ref.resourceType,
|
|
788
789
|
_ref$isUpperCase = _ref.isUpperCase,
|
|
789
790
|
isUpperCase = _ref$isUpperCase === void 0 ? false : _ref$isUpperCase,
|
|
@@ -797,6 +798,9 @@ function resourceTypeToDisplayName(_ref) {
|
|
|
797
798
|
case 'product':
|
|
798
799
|
displayName = isPlural ? 'Products' : 'Product';
|
|
799
800
|
break;
|
|
801
|
+
case 'inventory':
|
|
802
|
+
displayName = isPlural ? 'Inventories' : 'Inventory';
|
|
803
|
+
break;
|
|
800
804
|
default:
|
|
801
805
|
throw new UnexpectedResourceTypeError(resourceType);
|
|
802
806
|
}
|
|
@@ -854,13 +858,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
854
858
|
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== */");
|
|
855
859
|
}
|
|
856
860
|
|
|
857
|
-
var ActiveDragDropArea = /*#__PURE__*/lazy(() => import('./active-drag-drop-area-
|
|
861
|
+
var ActiveDragDropArea = /*#__PURE__*/lazy(() => import('./active-drag-drop-area-411713e9.esm.js' /* webpackChunkName: "active-drag-drop-area" */));
|
|
858
862
|
|
|
859
863
|
var DisabledDropArea = /*#__PURE__*/lazy(() => import('./disabled-drop-area-2c088477.esm.js' /* webpackChunkName: "disabled-drop-area" */));
|
|
860
864
|
|
|
861
|
-
var EnabledDropArea = /*#__PURE__*/lazy(() => import('./enabled-drop-area-
|
|
865
|
+
var EnabledDropArea = /*#__PURE__*/lazy(() => import('./enabled-drop-area-45d0624e.esm.js' /* webpackChunkName: "enabled-drop-area" */));
|
|
862
866
|
|
|
863
|
-
var FileDropped = /*#__PURE__*/lazy(() => import('./file-dropped-area-
|
|
867
|
+
var FileDropped = /*#__PURE__*/lazy(() => import('./file-dropped-area-f586d767.esm.js' /* webpackChunkName: "filed-dropped-area" */));
|
|
864
868
|
|
|
865
869
|
function getDropArea(_ref) {
|
|
866
870
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -898,12 +902,7 @@ function getDropAreaState(flags) {
|
|
|
898
902
|
return 'ready-for-drop';
|
|
899
903
|
}
|
|
900
904
|
|
|
901
|
-
var messages$
|
|
902
|
-
modalDescription: {
|
|
903
|
-
id: 'ImportResourcesModal.modalDescription',
|
|
904
|
-
description: 'Label for the modal category description',
|
|
905
|
-
defaultMessage: 'Maximum file size is {fileSize} MB with a limit of {rowLimit} rows. Download <csvTemplateLink>the CSV template</csvTemplateLink> or refer to <documentationLink>the documentation</documentationLink>.'
|
|
906
|
-
},
|
|
905
|
+
var messages$4 = defineMessages({
|
|
907
906
|
dragAndDropCSV: {
|
|
908
907
|
id: 'ImportResourcesModal.dragAndDropCSV',
|
|
909
908
|
description: 'The message telling the user to drag and drop CSV file in the file drop area',
|
|
@@ -947,6 +946,16 @@ var messages$2 = defineMessages({
|
|
|
947
946
|
id: 'ImportResourcesModal.genericError',
|
|
948
947
|
description: 'Default error message for unexpected file upload issues (for unhandled cases)',
|
|
949
948
|
defaultMessage: 'Error occurred: Please try uploading the file again or contact our support team for assistance.'
|
|
949
|
+
},
|
|
950
|
+
dataType: {
|
|
951
|
+
id: 'ImportResourcesModal.dataType',
|
|
952
|
+
description: 'Label for the data type selection dropdown',
|
|
953
|
+
defaultMessage: 'Data type'
|
|
954
|
+
},
|
|
955
|
+
instructions: {
|
|
956
|
+
id: 'ImportResourcesModal.instructions',
|
|
957
|
+
description: 'Label for the instructions section',
|
|
958
|
+
defaultMessage: 'Instructions'
|
|
950
959
|
}
|
|
951
960
|
});
|
|
952
961
|
|
|
@@ -981,7 +990,7 @@ const FileDropArea = () => {
|
|
|
981
990
|
showNotification({
|
|
982
991
|
kind: 'error',
|
|
983
992
|
domain: DOMAINS.PAGE,
|
|
984
|
-
text: intl.formatMessage(messages$
|
|
993
|
+
text: intl.formatMessage(messages$4.tooManyFilesError)
|
|
985
994
|
});
|
|
986
995
|
return;
|
|
987
996
|
}
|
|
@@ -989,13 +998,13 @@ const FileDropArea = () => {
|
|
|
989
998
|
showNotification({
|
|
990
999
|
kind: 'error',
|
|
991
1000
|
domain: DOMAINS.PAGE,
|
|
992
|
-
text: intl.formatMessage(messages$
|
|
1001
|
+
text: intl.formatMessage(messages$4.fileFormatNotSupported)
|
|
993
1002
|
});
|
|
994
1003
|
} else {
|
|
995
1004
|
showNotification({
|
|
996
1005
|
kind: 'error',
|
|
997
1006
|
domain: DOMAINS.PAGE,
|
|
998
|
-
text: intl.formatMessage(messages$
|
|
1007
|
+
text: intl.formatMessage(messages$4.genericError)
|
|
999
1008
|
});
|
|
1000
1009
|
}
|
|
1001
1010
|
}
|
|
@@ -1048,21 +1057,20 @@ var sharedMessages = defineMessages({
|
|
|
1048
1057
|
}
|
|
1049
1058
|
});
|
|
1050
1059
|
|
|
1051
|
-
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; }
|
|
1052
|
-
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; }
|
|
1053
1060
|
const Upload = () => {
|
|
1061
|
+
var _context;
|
|
1054
1062
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1055
1063
|
state = _useImportResourcesCo.state,
|
|
1056
|
-
onClose = _useImportResourcesCo.onClose
|
|
1064
|
+
onClose = _useImportResourcesCo.onClose,
|
|
1065
|
+
resourceTypes = _useImportResourcesCo.resourceTypes;
|
|
1057
1066
|
const intl = useIntl();
|
|
1058
|
-
const resourceTypePlural = resourceTypeToDisplayName({
|
|
1067
|
+
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1059
1068
|
resourceType: state.resourceType,
|
|
1060
1069
|
isPlural: true
|
|
1061
1070
|
});
|
|
1062
1071
|
const _useUpload = useUpload(),
|
|
1063
1072
|
handleUploadAndValidation = _useUpload.handleUploadAndValidation;
|
|
1064
|
-
const
|
|
1065
|
-
const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
|
|
1073
|
+
const isMultipleResourceTypes = resourceTypes.length > 1;
|
|
1066
1074
|
return jsx(FormDialog, {
|
|
1067
1075
|
size: 16,
|
|
1068
1076
|
isOpen: true,
|
|
@@ -1080,31 +1088,30 @@ const Upload = () => {
|
|
|
1080
1088
|
}),
|
|
1081
1089
|
children: jsxs(Spacings.Stack, {
|
|
1082
1090
|
scale: "l",
|
|
1083
|
-
children: [
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
}), jsx(FileDropArea, {})]
|
|
1091
|
+
children: [isMultipleResourceTypes ? jsxs(Grid, {
|
|
1092
|
+
gridRowGap: designTokens.spacingL,
|
|
1093
|
+
gridTemplateColumns: _concatInstanceProperty(_context = "calc(".concat(designTokens.constraint3, " + ")).call(_context, designTokens.spacingL, ") auto"),
|
|
1094
|
+
children: [jsx(Grid.Item, {
|
|
1095
|
+
children: jsx(Text.Body, {
|
|
1096
|
+
isBold: true,
|
|
1097
|
+
intlMessage: messages$4.dataType
|
|
1098
|
+
})
|
|
1099
|
+
}), jsx(Grid.Item, {
|
|
1100
|
+
children: jsx(ResourceTypeSelection, {})
|
|
1101
|
+
}), jsx(Grid.Item, {
|
|
1102
|
+
children: jsx(Text.Body, {
|
|
1103
|
+
isBold: true,
|
|
1104
|
+
intlMessage: messages$4.instructions
|
|
1105
|
+
})
|
|
1106
|
+
}), jsx(Grid.Item, {
|
|
1107
|
+
children: jsx(Instructions, {})
|
|
1108
|
+
})]
|
|
1109
|
+
}) : jsx(Instructions, {}), jsx(FileDropArea, {})]
|
|
1103
1110
|
})
|
|
1104
1111
|
});
|
|
1105
1112
|
};
|
|
1106
1113
|
|
|
1107
|
-
var messages$
|
|
1114
|
+
var messages$3 = defineMessages({
|
|
1108
1115
|
startImportButton: {
|
|
1109
1116
|
id: 'ImportResourcesModal.startImportButton',
|
|
1110
1117
|
description: 'Label for the modal Start import button',
|
|
@@ -1182,8 +1189,8 @@ var messages$1 = defineMessages({
|
|
|
1182
1189
|
}
|
|
1183
1190
|
});
|
|
1184
1191
|
|
|
1185
|
-
function ownKeys$
|
|
1186
|
-
function _objectSpread$
|
|
1192
|
+
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; }
|
|
1193
|
+
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; }
|
|
1187
1194
|
const truncate = (isExpanded, columns, columnsCount) => {
|
|
1188
1195
|
return isExpanded ? columns.join(' | ') : _sliceInstanceProperty(columns).call(columns, 0, columnsCount).join(' | ') + (columns.length > columnsCount ? '...' : '');
|
|
1189
1196
|
};
|
|
@@ -1212,7 +1219,7 @@ const ColumnList = props => {
|
|
|
1212
1219
|
e.preventDefault();
|
|
1213
1220
|
setIsExpanded(!isExpanded);
|
|
1214
1221
|
},
|
|
1215
|
-
children: isExpanded ? jsx(FormattedMessage, _objectSpread$
|
|
1222
|
+
children: isExpanded ? jsx(FormattedMessage, _objectSpread$9({}, messages$3.showLess)) : jsx(FormattedMessage, _objectSpread$9({}, messages$3.showMore))
|
|
1216
1223
|
})
|
|
1217
1224
|
})]
|
|
1218
1225
|
})
|
|
@@ -1220,8 +1227,8 @@ const ColumnList = props => {
|
|
|
1220
1227
|
});
|
|
1221
1228
|
};
|
|
1222
1229
|
|
|
1223
|
-
function ownKeys$
|
|
1224
|
-
function _objectSpread$
|
|
1230
|
+
function ownKeys$8(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; }
|
|
1231
|
+
function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$8(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$8(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1225
1232
|
function UploadPreviewModal() {
|
|
1226
1233
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1227
1234
|
state = _useImportResourcesCo.state;
|
|
@@ -1238,7 +1245,7 @@ function UploadPreviewModal() {
|
|
|
1238
1245
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1239
1246
|
resourceType: state.resourceType
|
|
1240
1247
|
}),
|
|
1241
|
-
labelPrimary: intl.formatMessage(messages$
|
|
1248
|
+
labelPrimary: intl.formatMessage(messages$3.continue),
|
|
1242
1249
|
onSecondaryButtonClick: () => onClose({
|
|
1243
1250
|
shouldDeleteImportContainer: true
|
|
1244
1251
|
}),
|
|
@@ -1256,7 +1263,7 @@ function UploadPreviewModal() {
|
|
|
1256
1263
|
children: jsxs(Spacings.Stack, {
|
|
1257
1264
|
scale: "m",
|
|
1258
1265
|
children: [jsx("div", {}), jsx(Text.Body, {
|
|
1259
|
-
intlMessage: messages$
|
|
1266
|
+
intlMessage: messages$3.previewOfYourImport
|
|
1260
1267
|
}), jsx(Card, {
|
|
1261
1268
|
insetScale: "xl",
|
|
1262
1269
|
children: jsxs(Spacings.Stack, {
|
|
@@ -1266,7 +1273,7 @@ function UploadPreviewModal() {
|
|
|
1266
1273
|
children: [jsx(CheckBoldIcon, {
|
|
1267
1274
|
color: "success"
|
|
1268
1275
|
}), jsx(Text.Body, {
|
|
1269
|
-
intlMessage: _objectSpread$
|
|
1276
|
+
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$3.rowsToBeImported), {}, {
|
|
1270
1277
|
values: {
|
|
1271
1278
|
rowCount: intl.formatNumber(state.uploadFileResponse.rowsCount),
|
|
1272
1279
|
b: getBold$3
|
|
@@ -1278,7 +1285,7 @@ function UploadPreviewModal() {
|
|
|
1278
1285
|
children: [jsx(CheckBoldIcon, {
|
|
1279
1286
|
color: "success"
|
|
1280
1287
|
}), jsx(Text.Body, {
|
|
1281
|
-
intlMessage: _objectSpread$
|
|
1288
|
+
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$3.columnsToBeImported), {}, {
|
|
1282
1289
|
values: {
|
|
1283
1290
|
columnCount: intl.formatNumber(validatedColumns.length),
|
|
1284
1291
|
b: getBold$3
|
|
@@ -1298,7 +1305,7 @@ function UploadPreviewModal() {
|
|
|
1298
1305
|
children: [jsx(EyeCrossedIcon, {
|
|
1299
1306
|
color: "neutral60"
|
|
1300
1307
|
}), jsx(Text.Body, {
|
|
1301
|
-
intlMessage: _objectSpread$
|
|
1308
|
+
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$3.columnsToBeIgnored), {}, {
|
|
1302
1309
|
values: {
|
|
1303
1310
|
columnCount: intl.formatNumber(ignoredColumns.length),
|
|
1304
1311
|
b: getBold$3
|
|
@@ -1324,8 +1331,8 @@ function getBold$3(msg) {
|
|
|
1324
1331
|
});
|
|
1325
1332
|
}
|
|
1326
1333
|
|
|
1327
|
-
function ownKeys$
|
|
1328
|
-
function _objectSpread$
|
|
1334
|
+
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; }
|
|
1335
|
+
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; }
|
|
1329
1336
|
const getNewLine = () => jsx("br", {});
|
|
1330
1337
|
const getImportLogsLink = (msg, projectKey) => jsx(Link, {
|
|
1331
1338
|
to: "/".concat(projectKey, "/operations/import/logs"),
|
|
@@ -1350,7 +1357,7 @@ const ImportConfirmationModal = () => {
|
|
|
1350
1357
|
const asyncDispatch = useAsyncDispatch();
|
|
1351
1358
|
const showNotification = useShowNotification();
|
|
1352
1359
|
const ImportRunningTextNotification = () => jsx(Text.Body, {
|
|
1353
|
-
intlMessage: _objectSpread$
|
|
1360
|
+
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$3.uploadNotificationSuccessMessage), {}, {
|
|
1354
1361
|
values: {
|
|
1355
1362
|
newline: getNewLine,
|
|
1356
1363
|
logsLink: msg => getImportLogsLink(msg, projectKey),
|
|
@@ -1360,12 +1367,12 @@ const ImportConfirmationModal = () => {
|
|
|
1360
1367
|
});
|
|
1361
1368
|
return jsx(ConfirmationDialog, {
|
|
1362
1369
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1363
|
-
resourceType: resourceTypeToDisplayName({
|
|
1370
|
+
resourceType: resourceTypeToDisplayName$1({
|
|
1364
1371
|
resourceType: state.resourceType,
|
|
1365
1372
|
isPlural: true
|
|
1366
1373
|
})
|
|
1367
1374
|
}),
|
|
1368
|
-
labelPrimary: intl.formatMessage(messages$
|
|
1375
|
+
labelPrimary: intl.formatMessage(messages$3.startImportButton),
|
|
1369
1376
|
isOpen: true,
|
|
1370
1377
|
onClose: () => onClose({
|
|
1371
1378
|
shouldDeleteImportContainer: true
|
|
@@ -1416,7 +1423,7 @@ const ImportConfirmationModal = () => {
|
|
|
1416
1423
|
scale: "xl",
|
|
1417
1424
|
children: [jsxs("div", {
|
|
1418
1425
|
children: [jsx(Text.Body, {
|
|
1419
|
-
intlMessage: _objectSpread$
|
|
1426
|
+
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$3.confirmationBodyText), {}, {
|
|
1420
1427
|
values: {
|
|
1421
1428
|
projectName: projectName,
|
|
1422
1429
|
count: intl.formatNumber((state === null || state === void 0 || (_state$uploadFileResp = state.uploadFileResponse) === null || _state$uploadFileResp === void 0 ? void 0 : _state$uploadFileResp.rowsCount) || 0),
|
|
@@ -1424,10 +1431,10 @@ const ImportConfirmationModal = () => {
|
|
|
1424
1431
|
}
|
|
1425
1432
|
})
|
|
1426
1433
|
}), jsx(Text.Body, {
|
|
1427
|
-
intlMessage: messages$
|
|
1434
|
+
intlMessage: messages$3.confirmationBodyNote
|
|
1428
1435
|
})]
|
|
1429
1436
|
}), jsx(Text.Body, {
|
|
1430
|
-
intlMessage: messages$
|
|
1437
|
+
intlMessage: messages$3.confirmationBodyQuestion
|
|
1431
1438
|
})]
|
|
1432
1439
|
})
|
|
1433
1440
|
});
|
|
@@ -1440,7 +1447,7 @@ function getBold$2(msg) {
|
|
|
1440
1447
|
});
|
|
1441
1448
|
}
|
|
1442
1449
|
|
|
1443
|
-
var messages = defineMessages({
|
|
1450
|
+
var messages$2 = defineMessages({
|
|
1444
1451
|
row: {
|
|
1445
1452
|
id: 'ImportResourcesModal.row',
|
|
1446
1453
|
description: 'In Upload file error modal - "Row" column',
|
|
@@ -1473,15 +1480,15 @@ var messages = defineMessages({
|
|
|
1473
1480
|
}
|
|
1474
1481
|
});
|
|
1475
1482
|
|
|
1476
|
-
function ownKeys$
|
|
1477
|
-
function _objectSpread$
|
|
1483
|
+
function ownKeys$6(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; }
|
|
1484
|
+
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys$6(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys$6(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1478
1485
|
const getColumns$1 = () => [{
|
|
1479
1486
|
key: 'errorType',
|
|
1480
|
-
label: jsx(FormattedMessage, _objectSpread$
|
|
1487
|
+
label: jsx(FormattedMessage, _objectSpread$6({}, messages$2.errorType)),
|
|
1481
1488
|
width: 'max-content'
|
|
1482
1489
|
}, {
|
|
1483
1490
|
key: 'details',
|
|
1484
|
-
label: jsx(FormattedMessage, _objectSpread$
|
|
1491
|
+
label: jsx(FormattedMessage, _objectSpread$6({}, messages$2.details))
|
|
1485
1492
|
}];
|
|
1486
1493
|
const UploadClientSideErrorTable = props => {
|
|
1487
1494
|
var _context;
|
|
@@ -1524,8 +1531,8 @@ function itemRenderer$1(item, column) {
|
|
|
1524
1531
|
}
|
|
1525
1532
|
}
|
|
1526
1533
|
|
|
1527
|
-
function ownKeys$
|
|
1528
|
-
function _objectSpread$
|
|
1534
|
+
function ownKeys$5(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; }
|
|
1535
|
+
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$5(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$5(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1529
1536
|
const UploadClientSideErrorsModal = () => {
|
|
1530
1537
|
var _state$droppedFile;
|
|
1531
1538
|
const intl = useIntl();
|
|
@@ -1538,7 +1545,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1538
1545
|
size: 16,
|
|
1539
1546
|
isOpen: true,
|
|
1540
1547
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1541
|
-
resourceType: resourceTypeToDisplayName({
|
|
1548
|
+
resourceType: resourceTypeToDisplayName$1({
|
|
1542
1549
|
resourceType: state.resourceType,
|
|
1543
1550
|
isPlural: true
|
|
1544
1551
|
})
|
|
@@ -1547,7 +1554,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1547
1554
|
children: jsxs(Spacings.Stack, {
|
|
1548
1555
|
scale: "l",
|
|
1549
1556
|
children: [jsx(Text.Body, {
|
|
1550
|
-
intlMessage: _objectSpread$
|
|
1557
|
+
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$2.uploadingError), {}, {
|
|
1551
1558
|
values: {
|
|
1552
1559
|
fileName: (_state$droppedFile = state.droppedFile) === null || _state$droppedFile === void 0 ? void 0 : _state$droppedFile.name,
|
|
1553
1560
|
errorsCount: intl.formatNumber(errorsCount),
|
|
@@ -1564,7 +1571,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1564
1571
|
onClick: () => onClose()
|
|
1565
1572
|
}), jsx(PrimaryButton, {
|
|
1566
1573
|
iconLeft: jsx(ImportIcon, {}),
|
|
1567
|
-
label: intl.formatMessage(messages.uploadNewFile),
|
|
1574
|
+
label: intl.formatMessage(messages$2.uploadNewFile),
|
|
1568
1575
|
onClick: () => actions.uploadNewFile()
|
|
1569
1576
|
})]
|
|
1570
1577
|
})]
|
|
@@ -1579,19 +1586,19 @@ function getBold$1(msg) {
|
|
|
1579
1586
|
});
|
|
1580
1587
|
}
|
|
1581
1588
|
|
|
1582
|
-
function ownKeys$
|
|
1583
|
-
function _objectSpread$
|
|
1589
|
+
function ownKeys$4(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; }
|
|
1590
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys$4(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys$4(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1584
1591
|
const getColumns = () => [{
|
|
1585
1592
|
key: 'row',
|
|
1586
|
-
label: jsx(FormattedMessage, _objectSpread$
|
|
1593
|
+
label: jsx(FormattedMessage, _objectSpread$4({}, messages$2.row)),
|
|
1587
1594
|
width: 'max-content'
|
|
1588
1595
|
}, {
|
|
1589
1596
|
key: 'errorType',
|
|
1590
|
-
label: jsx(FormattedMessage, _objectSpread$
|
|
1597
|
+
label: jsx(FormattedMessage, _objectSpread$4({}, messages$2.errorType)),
|
|
1591
1598
|
width: 'max-content'
|
|
1592
1599
|
}, {
|
|
1593
1600
|
key: 'details',
|
|
1594
|
-
label: jsx(FormattedMessage, _objectSpread$
|
|
1601
|
+
label: jsx(FormattedMessage, _objectSpread$4({}, messages$2.details))
|
|
1595
1602
|
}];
|
|
1596
1603
|
const UploadServerSideErrorTable = props => {
|
|
1597
1604
|
var _context;
|
|
@@ -1642,8 +1649,8 @@ function itemRenderer(item, column) {
|
|
|
1642
1649
|
}
|
|
1643
1650
|
}
|
|
1644
1651
|
|
|
1645
|
-
function ownKeys$
|
|
1646
|
-
function _objectSpread$
|
|
1652
|
+
function ownKeys$3(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; }
|
|
1653
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$3(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$3(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1647
1654
|
const UploadServerSideErrorsModal = () => {
|
|
1648
1655
|
var _state$uploadFileResp, _state$droppedFile, _state$uploadFileResp2;
|
|
1649
1656
|
const intl = useIntl();
|
|
@@ -1657,7 +1664,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1657
1664
|
size: 16,
|
|
1658
1665
|
isOpen: true,
|
|
1659
1666
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1660
|
-
resourceType: resourceTypeToDisplayName({
|
|
1667
|
+
resourceType: resourceTypeToDisplayName$1({
|
|
1661
1668
|
resourceType: state.resourceType,
|
|
1662
1669
|
isPlural: true
|
|
1663
1670
|
})
|
|
@@ -1668,7 +1675,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1668
1675
|
children: [jsxs(Spacings.Stack, {
|
|
1669
1676
|
scale: "xs",
|
|
1670
1677
|
children: [jsx(Text.Body, {
|
|
1671
|
-
intlMessage: _objectSpread$
|
|
1678
|
+
intlMessage: _objectSpread$3(_objectSpread$3({}, messages$2.uploadingError), {}, {
|
|
1672
1679
|
values: {
|
|
1673
1680
|
fileName: (_state$droppedFile = state.droppedFile) === null || _state$droppedFile === void 0 ? void 0 : _state$droppedFile.name,
|
|
1674
1681
|
errorsCount: intl.formatNumber(errorsCount),
|
|
@@ -1676,7 +1683,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1676
1683
|
}
|
|
1677
1684
|
})
|
|
1678
1685
|
}), jsx(Text.Body, {
|
|
1679
|
-
intlMessage: _objectSpread$
|
|
1686
|
+
intlMessage: _objectSpread$3(_objectSpread$3({}, messages$2.supportedValuesDocumentation), {}, {
|
|
1680
1687
|
values: {
|
|
1681
1688
|
documentationLink: msg => jsx(Link, {
|
|
1682
1689
|
tone: "secondary",
|
|
@@ -1697,7 +1704,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1697
1704
|
onClick: () => onClose()
|
|
1698
1705
|
}), jsx(PrimaryButton, {
|
|
1699
1706
|
iconLeft: jsx(ImportIcon, {}),
|
|
1700
|
-
label: intl.formatMessage(messages.uploadNewFile),
|
|
1707
|
+
label: intl.formatMessage(messages$2.uploadNewFile),
|
|
1701
1708
|
onClick: () => actions.uploadNewFile()
|
|
1702
1709
|
})]
|
|
1703
1710
|
})]
|
|
@@ -1721,10 +1728,10 @@ const UploadResult = () => {
|
|
|
1721
1728
|
return jsx(UploadPreviewModal, {});
|
|
1722
1729
|
};
|
|
1723
1730
|
|
|
1724
|
-
function ownKeys$
|
|
1725
|
-
function _objectSpread$
|
|
1731
|
+
function ownKeys$2(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; }
|
|
1732
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$2(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$2(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1726
1733
|
var FileIcon = function FileIcon(props) {
|
|
1727
|
-
return jsxs("svg", _objectSpread$
|
|
1734
|
+
return jsxs("svg", _objectSpread$2(_objectSpread$2({}, props), {}, {
|
|
1728
1735
|
children: [jsx("mask", {
|
|
1729
1736
|
id: "a",
|
|
1730
1737
|
style: {
|
|
@@ -1761,7 +1768,7 @@ const Uploading = () => {
|
|
|
1761
1768
|
state = _useImportResourcesCo.state,
|
|
1762
1769
|
actions = _useImportResourcesCo.actions,
|
|
1763
1770
|
onClose = _useImportResourcesCo.onClose;
|
|
1764
|
-
const resourceTypePlural = resourceTypeToDisplayName({
|
|
1771
|
+
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1765
1772
|
resourceType: state.resourceType,
|
|
1766
1773
|
isPlural: true
|
|
1767
1774
|
});
|
|
@@ -1825,6 +1832,97 @@ const CurrentStep = () => {
|
|
|
1825
1832
|
return steps[state.currentStep] || null;
|
|
1826
1833
|
};
|
|
1827
1834
|
|
|
1835
|
+
var messages$1 = defineMessages({
|
|
1836
|
+
products: {
|
|
1837
|
+
id: 'ImportResourcesModal.radio.products',
|
|
1838
|
+
description: 'Label for the products radio button',
|
|
1839
|
+
defaultMessage: 'Products (including variants, assets, prices and images)'
|
|
1840
|
+
},
|
|
1841
|
+
inventories: {
|
|
1842
|
+
id: 'ImportResourcesModal.radio.inventories',
|
|
1843
|
+
description: 'Label for the inventories radio button',
|
|
1844
|
+
defaultMessage: 'Inventories'
|
|
1845
|
+
},
|
|
1846
|
+
categories: {
|
|
1847
|
+
id: 'ImportResourcesModal.radio.categories',
|
|
1848
|
+
description: 'Label for the categories radio button',
|
|
1849
|
+
defaultMessage: 'Categories'
|
|
1850
|
+
}
|
|
1851
|
+
});
|
|
1852
|
+
|
|
1853
|
+
const resourceTypeToDisplayName = resourceType => {
|
|
1854
|
+
switch (resourceType) {
|
|
1855
|
+
case 'product':
|
|
1856
|
+
return messages$1.products;
|
|
1857
|
+
case 'inventory':
|
|
1858
|
+
return messages$1.inventories;
|
|
1859
|
+
case 'category':
|
|
1860
|
+
return messages$1.categories;
|
|
1861
|
+
default:
|
|
1862
|
+
throw new Error("Unknown resource type: ".concat(resourceType));
|
|
1863
|
+
}
|
|
1864
|
+
};
|
|
1865
|
+
const ResourceTypeSelection = () => {
|
|
1866
|
+
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1867
|
+
state = _useImportResourcesCo.state,
|
|
1868
|
+
actions = _useImportResourcesCo.actions,
|
|
1869
|
+
resourceTypes = _useImportResourcesCo.resourceTypes;
|
|
1870
|
+
return jsx(RadioInput.Group, {
|
|
1871
|
+
value: state.resourceType,
|
|
1872
|
+
onChange: e => {
|
|
1873
|
+
actions.setResourceType(e.target.value);
|
|
1874
|
+
},
|
|
1875
|
+
direction: "stack",
|
|
1876
|
+
directionProps: {
|
|
1877
|
+
scale: 's'
|
|
1878
|
+
},
|
|
1879
|
+
children: _mapInstanceProperty(resourceTypes).call(resourceTypes, resourceType => jsx(RadioInput.Option, {
|
|
1880
|
+
value: resourceType,
|
|
1881
|
+
children: jsx(Text.Body, {
|
|
1882
|
+
intlMessage: resourceTypeToDisplayName(resourceType)
|
|
1883
|
+
})
|
|
1884
|
+
}, resourceType))
|
|
1885
|
+
});
|
|
1886
|
+
};
|
|
1887
|
+
|
|
1888
|
+
var messages = defineMessages({
|
|
1889
|
+
fileUploadInstructions: {
|
|
1890
|
+
id: 'ImportResourcesModal.fileUploadInstructions',
|
|
1891
|
+
description: 'Label for the modal category description',
|
|
1892
|
+
defaultMessage: 'Maximum file size is {fileSize} MB with a limit of {rowLimit} rows. Download <csvTemplateLink>the CSV template</csvTemplateLink> or refer to <documentationLink>the documentation</documentationLink>.'
|
|
1893
|
+
}
|
|
1894
|
+
});
|
|
1895
|
+
|
|
1896
|
+
function ownKeys$1(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; }
|
|
1897
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$1(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$1(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1898
|
+
const Instructions = () => {
|
|
1899
|
+
const intl = useIntl();
|
|
1900
|
+
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1901
|
+
state = _useImportResourcesCo.state;
|
|
1902
|
+
const templateLink = RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS[state.resourceType];
|
|
1903
|
+
const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
|
|
1904
|
+
return jsx(Text.Body, {
|
|
1905
|
+
intlMessage: _objectSpread$1(_objectSpread$1({}, messages.fileUploadInstructions), {}, {
|
|
1906
|
+
values: {
|
|
1907
|
+
fileSize: intl.formatNumber(FILE_SIZE_LIMITS_MB[state.resourceType]),
|
|
1908
|
+
rowLimit: intl.formatNumber(ROW_LIMITS[state.resourceType]),
|
|
1909
|
+
csvTemplateLink: msg => jsx(Link, {
|
|
1910
|
+
tone: "secondary",
|
|
1911
|
+
isExternal: true,
|
|
1912
|
+
to: templateLink,
|
|
1913
|
+
children: msg
|
|
1914
|
+
}),
|
|
1915
|
+
documentationLink: msg => jsx(Link, {
|
|
1916
|
+
tone: "secondary",
|
|
1917
|
+
isExternal: true,
|
|
1918
|
+
to: documentationLink,
|
|
1919
|
+
children: msg
|
|
1920
|
+
})
|
|
1921
|
+
}
|
|
1922
|
+
})
|
|
1923
|
+
});
|
|
1924
|
+
};
|
|
1925
|
+
|
|
1828
1926
|
const getChunkImport = locale => {
|
|
1829
1927
|
const intlLocale = mapLocaleToIntlLocale(locale);
|
|
1830
1928
|
switch (intlLocale) {
|
|
@@ -1894,14 +1992,23 @@ const useAsyncIntlMessages = (locale, loader) => {
|
|
|
1894
1992
|
};
|
|
1895
1993
|
|
|
1896
1994
|
function ownKeys(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; }
|
|
1897
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
1995
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1898
1996
|
const ImportResourcesModal = props => {
|
|
1997
|
+
var _props$resourceTypes, _context;
|
|
1899
1998
|
const _useApplicationContex = useApplicationContext(context => ({
|
|
1900
1999
|
locale: context.user && context.user.locale
|
|
1901
2000
|
})),
|
|
1902
2001
|
locale = _useApplicationContex.locale;
|
|
1903
2002
|
const messages = useAsyncIntlMessages(locale, loadMessages);
|
|
1904
2003
|
if (!props.isOpen || messages.isLoading) return null;
|
|
2004
|
+
if (!((_props$resourceTypes = props.resourceTypes) !== null && _props$resourceTypes !== void 0 && _props$resourceTypes.length)) {
|
|
2005
|
+
console.error('No resource types provided for import resources modal');
|
|
2006
|
+
return null;
|
|
2007
|
+
}
|
|
2008
|
+
if (!_everyInstanceProperty(_context = props.resourceTypes).call(_context, isResourceType)) {
|
|
2009
|
+
console.error('Invalid resource types provided for import resources modal');
|
|
2010
|
+
return null;
|
|
2011
|
+
}
|
|
1905
2012
|
return jsx(IntlProvider, {
|
|
1906
2013
|
locale: locale,
|
|
1907
2014
|
messages: messages.messages,
|
|
@@ -1912,4 +2019,4 @@ const ImportResourcesModal = props => {
|
|
|
1912
2019
|
};
|
|
1913
2020
|
ImportResourcesModal.displayName = 'ImportResourcesModal';
|
|
1914
2021
|
|
|
1915
|
-
export { EnabledDropArea as E, FileDropped as F, ImportResourcesModal as I, messages$
|
|
2022
|
+
export { EnabledDropArea as E, FileDropped as F, ImportResourcesModal as I, messages$4 as m, useImportResourcesContext as u };
|