@commercetools-frontend-extensions/import-resources-modal 0.0.0-canary-20240619085132 → 0.0.0-canary-20240626134256
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-411713e9.esm.js → active-drag-drop-area-a783f50a.esm.js} +3 -4
- package/dist/{active-drag-drop-area-afab9a53.cjs.dev.js → active-drag-drop-area-aaf97b5f.cjs.dev.js} +3 -4
- package/dist/{active-drag-drop-area-f3c34dec.cjs.prod.js → active-drag-drop-area-afef4ad4.cjs.prod.js} +3 -4
- package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.dev.js +3 -4
- package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.prod.js +3 -4
- package/dist/commercetools-frontend-extensions-import-resources-modal.esm.js +3 -4
- package/dist/{enabled-drop-area-958a1553.cjs.dev.js → enabled-drop-area-07280b47.cjs.prod.js} +3 -4
- package/dist/{enabled-drop-area-45d0624e.esm.js → enabled-drop-area-832cb9fd.esm.js} +3 -4
- package/dist/{enabled-drop-area-1c5689e6.cjs.prod.js → enabled-drop-area-8cf1b3a0.cjs.dev.js} +3 -4
- package/dist/{file-dropped-area-847a7088.cjs.dev.js → file-dropped-area-556d1073.cjs.dev.js} +4 -6
- package/dist/{file-dropped-area-f586d767.esm.js → file-dropped-area-6f4eea4a.esm.js} +4 -6
- package/dist/{file-dropped-area-cab83f88.cjs.prod.js → file-dropped-area-8fe656cb.cjs.prod.js} +4 -6
- package/dist/{index-206edb9b.esm.js → index-041dc905.esm.js} +71 -91
- package/dist/{index-3dfbefe0.cjs.prod.js → index-10f45596.cjs.prod.js} +72 -93
- package/dist/{index-23d51703.cjs.dev.js → index-90ff93d0.cjs.dev.js} +72 -93
- package/package.json +1 -1
|
@@ -14,7 +14,6 @@ import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
|
14
14
|
import React, { useContext, lazy, useState, useEffect } from 'react';
|
|
15
15
|
import { actions, useAsyncDispatch } from '@commercetools-frontend/sdk';
|
|
16
16
|
import { MC_API_PROXY_TARGETS, DOMAINS } from '@commercetools-frontend/constants';
|
|
17
|
-
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
18
17
|
import { plural } from 'pluralize';
|
|
19
18
|
import _Promise from '@babel/runtime-corejs3/core-js-stable/promise';
|
|
20
19
|
import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
|
|
@@ -25,7 +24,6 @@ import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/ins
|
|
|
25
24
|
import Papa from 'papaparse';
|
|
26
25
|
import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
|
|
27
26
|
import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
|
|
28
|
-
import _someInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/some';
|
|
29
27
|
import '@babel/runtime-corejs3/core-js-stable/instance/starts-with';
|
|
30
28
|
import 'querystring';
|
|
31
29
|
import 'ramda';
|
|
@@ -33,15 +31,16 @@ import { createHttpClientOptions, buildApiUrl } from '@commercetools-frontend/ap
|
|
|
33
31
|
import _Reflect$construct from '@babel/runtime-corejs3/core-js-stable/reflect/construct';
|
|
34
32
|
import _createClass from '@babel/runtime-corejs3/helpers/esm/createClass';
|
|
35
33
|
import _classCallCheck from '@babel/runtime-corejs3/helpers/esm/classCallCheck';
|
|
36
|
-
import _inherits from '@babel/runtime-corejs3/helpers/esm/inherits';
|
|
37
34
|
import _possibleConstructorReturn from '@babel/runtime-corejs3/helpers/esm/possibleConstructorReturn';
|
|
38
35
|
import _getPrototypeOf from '@babel/runtime-corejs3/helpers/esm/getPrototypeOf';
|
|
36
|
+
import _inherits from '@babel/runtime-corejs3/helpers/esm/inherits';
|
|
39
37
|
import _wrapNativeSuper from '@babel/runtime-corejs3/helpers/esm/wrapNativeSuper';
|
|
40
38
|
import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
41
39
|
import { FormDialog, PageContentNarrow, ConfirmationDialog, InfoDialog } from '@commercetools-frontend/application-components';
|
|
42
40
|
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
41
|
import { useShowNotification } from '@commercetools-frontend/actions-global';
|
|
44
42
|
import { reportErrorToSentry } from '@commercetools-frontend/sentry';
|
|
43
|
+
import _someInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/some';
|
|
45
44
|
import { useDropzone } from 'react-dropzone';
|
|
46
45
|
import _styled from '@emotion/styled/base';
|
|
47
46
|
import { css } from '@emotion/react';
|
|
@@ -59,7 +58,7 @@ function isResourceType(maybeResourceType) {
|
|
|
59
58
|
}
|
|
60
59
|
function assertResourceType(maybeResourceType) {
|
|
61
60
|
if (isResourceType(maybeResourceType)) return;
|
|
62
|
-
throw new Error(
|
|
61
|
+
throw new Error(`Invalid value: ${maybeResourceType}`);
|
|
63
62
|
}
|
|
64
63
|
function isError(maybeError) {
|
|
65
64
|
if (maybeError instanceof Error) return true;
|
|
@@ -74,7 +73,6 @@ function hasRequiredFields(maybeValidObject, requiredFields) {
|
|
|
74
73
|
return typeof maybeValidObject === 'object' && maybeValidObject !== null && _everyInstanceProperty(requiredFields).call(requiredFields, property => hasOwnProperty(maybeValidObject, property));
|
|
75
74
|
}
|
|
76
75
|
|
|
77
|
-
var _context;
|
|
78
76
|
const DEFAULT_DELIMITER = ',';
|
|
79
77
|
const INITIAL_COLUMN_DISPLAY_COUNT = 8;
|
|
80
78
|
const IMPORT_TAG_KEYS = {
|
|
@@ -83,7 +81,7 @@ const IMPORT_TAG_KEYS = {
|
|
|
83
81
|
const IMPORT_TAG_VALUES = {
|
|
84
82
|
fileUpload: 'file-upload'
|
|
85
83
|
};
|
|
86
|
-
const TAG_KEY_SOURCE_FILE_UPLOAD =
|
|
84
|
+
const TAG_KEY_SOURCE_FILE_UPLOAD = `${IMPORT_TAG_KEYS.source}:${IMPORT_TAG_VALUES.fileUpload}`;
|
|
87
85
|
|
|
88
86
|
const FILE_SIZE_LIMITS_MB = {
|
|
89
87
|
category: 10,
|
|
@@ -91,9 +89,9 @@ const FILE_SIZE_LIMITS_MB = {
|
|
|
91
89
|
product: 35
|
|
92
90
|
};
|
|
93
91
|
const ROW_LIMITS = {
|
|
94
|
-
category:
|
|
95
|
-
inventory:
|
|
96
|
-
product:
|
|
92
|
+
category: 5_000,
|
|
93
|
+
inventory: 4_000,
|
|
94
|
+
product: 70_000
|
|
97
95
|
};
|
|
98
96
|
const RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS = {
|
|
99
97
|
category: 'https://docs.commercetools.com/merchant-center/downloads/category_import_template.csv',
|
|
@@ -221,76 +219,67 @@ const encodeFileNameWithTimestampToContainerKey = fileName => {
|
|
|
221
219
|
};
|
|
222
220
|
|
|
223
221
|
function getCreateImportContainerURL(projectKey) {
|
|
224
|
-
return
|
|
222
|
+
return `/${projectKey}/import-containers`;
|
|
225
223
|
}
|
|
226
224
|
function getDeleteImportContainerURL(projectKey, containerKey) {
|
|
227
|
-
|
|
228
|
-
return _concatInstanceProperty(_context6 = "/".concat(projectKey, "/import-containers/")).call(_context6, containerKey);
|
|
225
|
+
return `/${projectKey}/import-containers/${containerKey}`;
|
|
229
226
|
}
|
|
230
227
|
function getFileUploadURL(projectKey, resourceType, containerKey) {
|
|
231
|
-
|
|
232
|
-
return _concatInstanceProperty(_context8 = _concatInstanceProperty(_context9 = "/".concat(projectKey, "/")).call(_context9, plural(resourceType), "/import-containers/")).call(_context8, containerKey, "/file-upload");
|
|
228
|
+
return `/${projectKey}/${plural(resourceType)}/import-containers/${containerKey}/file-upload`;
|
|
233
229
|
}
|
|
234
230
|
function getProccessFileURL(projectKey, resourceType, containerKey) {
|
|
235
|
-
|
|
236
|
-
return _concatInstanceProperty(_context10 = _concatInstanceProperty(_context11 = "/".concat(projectKey, "/")).call(_context11, plural(resourceType), "/import-containers/")).call(_context10, containerKey, "/process-file");
|
|
231
|
+
return `/${projectKey}/${plural(resourceType)}/import-containers/${containerKey}/process-file`;
|
|
237
232
|
}
|
|
238
233
|
|
|
239
|
-
function
|
|
234
|
+
function _callSuper$3(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$3() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
240
235
|
function _isNativeReflectConstruct$3() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$3 = function () { return !!t; })(); }
|
|
241
236
|
let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
|
|
242
|
-
_inherits(UnexpectedResourceTypeError, _Error);
|
|
243
|
-
var _super = _createSuper$3(UnexpectedResourceTypeError);
|
|
244
237
|
function UnexpectedResourceTypeError(resourceType) {
|
|
245
238
|
var _this;
|
|
246
239
|
_classCallCheck(this, UnexpectedResourceTypeError);
|
|
247
|
-
_this =
|
|
240
|
+
_this = _callSuper$3(this, UnexpectedResourceTypeError, [`Unexpected resource type "${resourceType}"`]);
|
|
248
241
|
_this.name = 'UnexpectedResourceTypeError';
|
|
249
242
|
return _this;
|
|
250
243
|
}
|
|
244
|
+
_inherits(UnexpectedResourceTypeError, _Error);
|
|
251
245
|
return _createClass(UnexpectedResourceTypeError);
|
|
252
246
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
253
247
|
|
|
254
|
-
function
|
|
248
|
+
function _callSuper$2(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$2() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
255
249
|
function _isNativeReflectConstruct$2() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$2 = function () { return !!t; })(); }
|
|
256
250
|
let MissingImportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
257
|
-
_inherits(MissingImportResourceProviderError, _Error);
|
|
258
|
-
var _super = _createSuper$2(MissingImportResourceProviderError);
|
|
259
251
|
function MissingImportResourceProviderError() {
|
|
260
252
|
var _this;
|
|
261
253
|
_classCallCheck(this, MissingImportResourceProviderError);
|
|
262
|
-
_this =
|
|
254
|
+
_this = _callSuper$2(this, MissingImportResourceProviderError, ['useImportResourcesContext must be used within ImportResourcesProvider']);
|
|
263
255
|
_this.name = 'MissingImportResourceProviderError';
|
|
264
256
|
return _this;
|
|
265
257
|
}
|
|
258
|
+
_inherits(MissingImportResourceProviderError, _Error);
|
|
266
259
|
return _createClass(MissingImportResourceProviderError);
|
|
267
260
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
268
261
|
|
|
269
|
-
function
|
|
262
|
+
function _callSuper$1(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
270
263
|
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function () { return !!t; })(); }
|
|
271
264
|
let UnexpectedColumnError = /*#__PURE__*/function (_Error) {
|
|
272
|
-
_inherits(UnexpectedColumnError, _Error);
|
|
273
|
-
var _super = _createSuper$1(UnexpectedColumnError);
|
|
274
265
|
function UnexpectedColumnError(columnName) {
|
|
275
266
|
var _this;
|
|
276
267
|
_classCallCheck(this, UnexpectedColumnError);
|
|
277
|
-
_this =
|
|
268
|
+
_this = _callSuper$1(this, UnexpectedColumnError, [`Unexpected column "${columnName}"`]);
|
|
278
269
|
_this.name = 'UnexpectedColumnError';
|
|
279
270
|
return _this;
|
|
280
271
|
}
|
|
272
|
+
_inherits(UnexpectedColumnError, _Error);
|
|
281
273
|
return _createClass(UnexpectedColumnError);
|
|
282
274
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
283
275
|
|
|
284
|
-
function
|
|
276
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
285
277
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
286
278
|
let HttpError = /*#__PURE__*/function (_Error) {
|
|
287
|
-
_inherits(HttpError, _Error);
|
|
288
|
-
var _super = _createSuper(HttpError);
|
|
289
279
|
function HttpError(statusCode, statusText, errorData) {
|
|
290
|
-
var _context;
|
|
291
280
|
var _this;
|
|
292
281
|
_classCallCheck(this, HttpError);
|
|
293
|
-
_this =
|
|
282
|
+
_this = _callSuper(this, HttpError, [`HTTP Error! Status code: ${statusCode}, message: "${statusText ? statusText : ''}"`]);
|
|
294
283
|
_this.statusCode = void 0;
|
|
295
284
|
_this.errorData = void 0;
|
|
296
285
|
_this.name = 'HttpError';
|
|
@@ -298,14 +287,14 @@ let HttpError = /*#__PURE__*/function (_Error) {
|
|
|
298
287
|
_this.errorData = errorData;
|
|
299
288
|
return _this;
|
|
300
289
|
}
|
|
290
|
+
_inherits(HttpError, _Error);
|
|
301
291
|
return _createClass(HttpError);
|
|
302
292
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
303
293
|
|
|
304
294
|
function ownKeys$e(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; }
|
|
305
|
-
function _objectSpread$e(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
295
|
+
function _objectSpread$e(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys$e(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys$e(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
306
296
|
const addProxyPrefixToUrl = (uri, proxy) => {
|
|
307
|
-
|
|
308
|
-
return proxy ? _concatInstanceProperty(_context = "/proxy/".concat(proxy)).call(_context, uri) : uri;
|
|
297
|
+
return proxy ? `/proxy/${proxy}${uri}` : uri;
|
|
309
298
|
};
|
|
310
299
|
const fetchUsingXhr = _ref2 => {
|
|
311
300
|
let url = _ref2.url,
|
|
@@ -317,15 +306,15 @@ const fetchUsingXhr = _ref2 => {
|
|
|
317
306
|
const options = createHttpClientOptions({
|
|
318
307
|
headers: _objectSpread$e({
|
|
319
308
|
'Content-Type': 'application/json'
|
|
320
|
-
}, config
|
|
309
|
+
}, config?.headers)
|
|
321
310
|
});
|
|
322
311
|
const xhr = new XMLHttpRequest();
|
|
323
|
-
xhr.open(config
|
|
312
|
+
xhr.open(config?.method, buildApiUrl(addProxyPrefixToUrl(url, config?.proxy)), true);
|
|
324
313
|
// Include cookies in the request
|
|
325
314
|
xhr.withCredentials = true;
|
|
326
315
|
if (options.headers) {
|
|
327
|
-
var
|
|
328
|
-
_forEachInstanceProperty(
|
|
316
|
+
var _context;
|
|
317
|
+
_forEachInstanceProperty(_context = _Object$keys(options.headers)).call(_context, key => {
|
|
329
318
|
xhr.setRequestHeader(key, options.headers[key]);
|
|
330
319
|
});
|
|
331
320
|
}
|
|
@@ -494,7 +483,7 @@ function reducer(state, action) {
|
|
|
494
483
|
throw new Error(getUnknownActionError(action));
|
|
495
484
|
}
|
|
496
485
|
function getUnknownActionError(actionType) {
|
|
497
|
-
return
|
|
486
|
+
return `Unkown type: ${actionType}`;
|
|
498
487
|
}
|
|
499
488
|
const initialState = {
|
|
500
489
|
currentStep: 1,
|
|
@@ -511,12 +500,9 @@ function ownKeys$b(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySy
|
|
|
511
500
|
function _objectSpread$b(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$b(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$b(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
512
501
|
const ImportResourcesContext = /*#__PURE__*/React.createContext();
|
|
513
502
|
const ImportResourcesProvider = props => {
|
|
514
|
-
const _useApplicationContex = useApplicationContext(context => {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key
|
|
518
|
-
};
|
|
519
|
-
}),
|
|
503
|
+
const _useApplicationContex = useApplicationContext(context => ({
|
|
504
|
+
projectKey: context.project?.key
|
|
505
|
+
})),
|
|
520
506
|
projectKey = _useApplicationContex.projectKey;
|
|
521
507
|
const asyncDispatch = useAsyncDispatch();
|
|
522
508
|
const _React$useReducer = React.useReducer(reducer, _objectSpread$b(_objectSpread$b({}, initialState), {}, {
|
|
@@ -647,15 +633,17 @@ var messages$5 = defineMessages({
|
|
|
647
633
|
id: 'ImportResourcesModal.unexpectedError',
|
|
648
634
|
description: 'Generic notification message when file upload fails',
|
|
649
635
|
defaultMessage: 'An unexpected error occurred during the file upload. Please try again, or contact support if this error occurs again.'
|
|
636
|
+
},
|
|
637
|
+
missingKeyError: {
|
|
638
|
+
id: 'operations.import.upload.missingKeyError',
|
|
639
|
+
description: 'Error message displayed when the uploaded file is missing the key field',
|
|
640
|
+
defaultMessage: "The 'key' field is missing or incomplete in some rows. Please ensure every row has a 'key' value."
|
|
650
641
|
}
|
|
651
642
|
});
|
|
652
643
|
|
|
653
644
|
const useUpload = () => {
|
|
654
645
|
const intl = useIntl();
|
|
655
|
-
const projectKey = useApplicationContext(context =>
|
|
656
|
-
var _context$project;
|
|
657
|
-
return (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key;
|
|
658
|
-
});
|
|
646
|
+
const projectKey = useApplicationContext(context => context.project?.key);
|
|
659
647
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
660
648
|
state = _useImportResourcesCo.state,
|
|
661
649
|
actions = _useImportResourcesCo.actions;
|
|
@@ -705,15 +693,14 @@ const useUpload = () => {
|
|
|
705
693
|
return;
|
|
706
694
|
}
|
|
707
695
|
if (error instanceof HttpError) {
|
|
708
|
-
|
|
709
|
-
if (((_error$errorData = error.errorData) === null || _error$errorData === void 0 ? void 0 : _error$errorData.code) === 'MISSING_KEY_ERROR') {
|
|
696
|
+
if (error.errorData?.code === 'MISSING_KEY_ERROR') {
|
|
710
697
|
actions.cancelImport();
|
|
711
698
|
showNotification({
|
|
712
699
|
kind: 'error',
|
|
713
700
|
domain: DOMAINS.PAGE,
|
|
714
|
-
text:
|
|
701
|
+
text: intl.formatMessage(messages$5.unexpectedError)
|
|
715
702
|
});
|
|
716
|
-
} else if (
|
|
703
|
+
} else if (error.errorData?.invalid > 0) {
|
|
717
704
|
actions.setUploadFileResponse(error.errorData);
|
|
718
705
|
} else {
|
|
719
706
|
actions.cancelImport();
|
|
@@ -724,7 +711,6 @@ const useUpload = () => {
|
|
|
724
711
|
});
|
|
725
712
|
}
|
|
726
713
|
} else {
|
|
727
|
-
var _state$droppedFile;
|
|
728
714
|
actions.cancelImport();
|
|
729
715
|
showNotification({
|
|
730
716
|
kind: 'error',
|
|
@@ -737,7 +723,7 @@ const useUpload = () => {
|
|
|
737
723
|
projectKey,
|
|
738
724
|
containerKey: state.containerKey,
|
|
739
725
|
resourceType: state.resourceType,
|
|
740
|
-
fileSizeInBytes:
|
|
726
|
+
fileSizeInBytes: state.droppedFile?.size
|
|
741
727
|
}
|
|
742
728
|
});
|
|
743
729
|
}
|
|
@@ -818,8 +804,12 @@ const getBorderColor = state => {
|
|
|
818
804
|
const getDashedBorder = function () {
|
|
819
805
|
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
|
|
820
806
|
const color = getBorderColor(state);
|
|
821
|
-
const svgContent =
|
|
822
|
-
|
|
807
|
+
const svgContent = `
|
|
808
|
+
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
|
|
809
|
+
<rect width="100%" height="100%" fill="none" stroke="${color}" stroke-width="2px" stroke-dasharray="6,6" stroke-dashoffset="0" stroke-linecap="square"/>
|
|
810
|
+
</svg>
|
|
811
|
+
`;
|
|
812
|
+
return `data:image/svg+xml,${encodeURIComponent(svgContent)}`;
|
|
823
813
|
};
|
|
824
814
|
const base = /*#__PURE__*/css("border-radius:", customProperties.borderRadius6, ";min-height:136px;display:flex;justify-content:center;align-items:center;" + (process.env.NODE_ENV === "production" ? "" : ";label:base;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUF5QmdCIiwiZmlsZSI6InN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0J1xuaW1wb3J0IHsgY3VzdG9tUHJvcGVydGllcyB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLWZyb250ZW5kL3VpLWtpdCdcblxudHlwZSBEcm9wQXJlYVN0YXRlID0gJ2Rl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(process.env.NODE_ENV === "production" ? "" : ";label:disabled;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFnQ29CIiwiZmlsZSI6InN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0J1xuaW1wb3J0IHsgY3VzdG9tUHJvcGVydGllcyB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLWZyb250ZW5kL3VpLWtpdCdcblxudHlwZSBEcm9wQXJlYVN0YXRlID0gJ2RlZmF1bHQnIHwgJ2Vycm9yJyB8ICdhY3RpdmUnXG5cbmNvbnN0IGdldEJvcmRlckNvbG9yID0gKHN0YXRlOiBEcm9wQXJlYVN0YXRlKSA9PiB7XG4gIGNvbnN0IGJvcmRlckNvbG9ycyA9IHtcbiAgICBkZWZhdWx0OiAnIzkwOWRiYycsXG4gICAgZXJyb3I6ICcjZTYwMDUwJyxcbiAgICBhY3RpdmU6IGN1c3RvbVByb3BlcnRpZXMuY29sb3JQcmltYXJ5LFxuICB9XG5cbiAgcmV0dXJuIGJvcmRlckNvbG9yc1tzdGF0ZV0gfHwgYm9yZGVyQ29sb3JzLmRlZmF1bHRcbn1cblxuY29uc3QgZ2V0RGFzaGVkQm9yZGVyID0gKHN0YXRlOiBEcm9wQXJlYVN0YXRlID0gJ2RlZmF1bHQnKSA9PiB7XG4gIGNvbnN0IGNvbG9yID0gZ2V0Qm9yZGVyQ29sb3Ioc3RhdGUpXG4gIGNvbnN0IHN2Z0NvbnRlbnQgPSBgXG4gICAgPHN2ZyB3aWR0aD1cIjEwMCVcIiBoZWlnaHQ9XCIxMDAlXCIgeG1sbnM9XCJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Z1wiPlxuICAgICAgPHJlY3Qgd2lkd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0gY3NzYFxuICBiYWNrZ3JvdW5kLWltYWdlOiB1cmwoXFxcIiR7Z2V0RGFzaGVkQm9yZGVyKCl9XFxcIik7XG4gIGJhY2tncm91bmQtY29sb3I6ICR7Y3VzdG9tUHJvcGVydGllcy5jb2xvclN1cmZhY2V9O1xuICBwYWRkaW5nOiAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZzUwfSAxMDBweDtcbmBcblxuZXhwb3J0IGNvbnN0IHN0eWxlcyA9IHtcbiAgYmFzZSxcbiAgcmVhZHlGb3JEcm9wLFxuICBmaWxlRHJvcHBlZCxcbiAgZGlzYWJsZWQsXG4gIGFjdGl2ZURyYWcsXG59XG4iXX0= */");
|
|
@@ -858,13 +848,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
858
848
|
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== */");
|
|
859
849
|
}
|
|
860
850
|
|
|
861
|
-
var ActiveDragDropArea = /*#__PURE__*/lazy(() => import('./active-drag-drop-area-
|
|
851
|
+
var ActiveDragDropArea = /*#__PURE__*/lazy(() => import('./active-drag-drop-area-a783f50a.esm.js' /* webpackChunkName: "active-drag-drop-area" */));
|
|
862
852
|
|
|
863
853
|
var DisabledDropArea = /*#__PURE__*/lazy(() => import('./disabled-drop-area-2c088477.esm.js' /* webpackChunkName: "disabled-drop-area" */));
|
|
864
854
|
|
|
865
|
-
var EnabledDropArea = /*#__PURE__*/lazy(() => import('./enabled-drop-area-
|
|
855
|
+
var EnabledDropArea = /*#__PURE__*/lazy(() => import('./enabled-drop-area-832cb9fd.esm.js' /* webpackChunkName: "enabled-drop-area" */));
|
|
866
856
|
|
|
867
|
-
var FileDropped = /*#__PURE__*/lazy(() => import('./file-dropped-area-
|
|
857
|
+
var FileDropped = /*#__PURE__*/lazy(() => import('./file-dropped-area-6f4eea4a.esm.js' /* webpackChunkName: "filed-dropped-area" */));
|
|
868
858
|
|
|
869
859
|
function getDropArea(_ref) {
|
|
870
860
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -1058,7 +1048,6 @@ var sharedMessages = defineMessages({
|
|
|
1058
1048
|
});
|
|
1059
1049
|
|
|
1060
1050
|
const Upload = () => {
|
|
1061
|
-
var _context;
|
|
1062
1051
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1063
1052
|
state = _useImportResourcesCo.state,
|
|
1064
1053
|
onClose = _useImportResourcesCo.onClose,
|
|
@@ -1090,7 +1079,7 @@ const Upload = () => {
|
|
|
1090
1079
|
scale: "l",
|
|
1091
1080
|
children: [isMultipleResourceTypes ? jsxs(Grid, {
|
|
1092
1081
|
gridRowGap: designTokens.spacingL,
|
|
1093
|
-
gridTemplateColumns:
|
|
1082
|
+
gridTemplateColumns: `calc(${designTokens.constraint3} + ${designTokens.spacingL}) auto`,
|
|
1094
1083
|
children: [jsx(Grid.Item, {
|
|
1095
1084
|
children: jsx(Text.Body, {
|
|
1096
1085
|
isBold: true,
|
|
@@ -1335,23 +1324,19 @@ function ownKeys$7(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySy
|
|
|
1335
1324
|
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; }
|
|
1336
1325
|
const getNewLine = () => jsx("br", {});
|
|
1337
1326
|
const getImportLogsLink = (msg, projectKey) => jsx(Link, {
|
|
1338
|
-
to:
|
|
1327
|
+
to: `/${projectKey}/operations/import/logs`,
|
|
1339
1328
|
children: msg
|
|
1340
1329
|
});
|
|
1341
1330
|
const ImportConfirmationModal = () => {
|
|
1342
|
-
var _state$uploadFileResp;
|
|
1343
1331
|
const intl = useIntl();
|
|
1344
1332
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1345
1333
|
state = _useImportResourcesCo.state,
|
|
1346
1334
|
onStartImportSuccess = _useImportResourcesCo.onStartImportSuccess,
|
|
1347
1335
|
onClose = _useImportResourcesCo.onClose;
|
|
1348
|
-
const _useApplicationContex = useApplicationContext(context => {
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
projectName: (_context$project2 = context.project) === null || _context$project2 === void 0 ? void 0 : _context$project2.name
|
|
1353
|
-
};
|
|
1354
|
-
}),
|
|
1336
|
+
const _useApplicationContex = useApplicationContext(context => ({
|
|
1337
|
+
projectKey: context.project?.key,
|
|
1338
|
+
projectName: context.project?.name
|
|
1339
|
+
})),
|
|
1355
1340
|
projectKey = _useApplicationContex.projectKey,
|
|
1356
1341
|
projectName = _useApplicationContex.projectName;
|
|
1357
1342
|
const asyncDispatch = useAsyncDispatch();
|
|
@@ -1388,8 +1373,7 @@ const ImportConfirmationModal = () => {
|
|
|
1388
1373
|
},
|
|
1389
1374
|
onConfirm: async () => {
|
|
1390
1375
|
try {
|
|
1391
|
-
|
|
1392
|
-
const canConfirm = projectKey && state.containerKey && ((_state$droppedFile = state.droppedFile) === null || _state$droppedFile === void 0 ? void 0 : _state$droppedFile.name) && state.resourceType;
|
|
1376
|
+
const canConfirm = projectKey && state.containerKey && state.droppedFile?.name && state.resourceType;
|
|
1393
1377
|
if (!canConfirm) return;
|
|
1394
1378
|
onClose();
|
|
1395
1379
|
await processUploadedFile({
|
|
@@ -1426,7 +1410,7 @@ const ImportConfirmationModal = () => {
|
|
|
1426
1410
|
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$3.confirmationBodyText), {}, {
|
|
1427
1411
|
values: {
|
|
1428
1412
|
projectName: projectName,
|
|
1429
|
-
count: intl.formatNumber(
|
|
1413
|
+
count: intl.formatNumber(state?.uploadFileResponse?.rowsCount || 0),
|
|
1430
1414
|
bold: getBold$2
|
|
1431
1415
|
}
|
|
1432
1416
|
})
|
|
@@ -1534,7 +1518,6 @@ function itemRenderer$1(item, column) {
|
|
|
1534
1518
|
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
1519
|
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; }
|
|
1536
1520
|
const UploadClientSideErrorsModal = () => {
|
|
1537
|
-
var _state$droppedFile;
|
|
1538
1521
|
const intl = useIntl();
|
|
1539
1522
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1540
1523
|
state = _useImportResourcesCo.state,
|
|
@@ -1556,7 +1539,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1556
1539
|
children: [jsx(Text.Body, {
|
|
1557
1540
|
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$2.uploadingError), {}, {
|
|
1558
1541
|
values: {
|
|
1559
|
-
fileName:
|
|
1542
|
+
fileName: state.droppedFile?.name,
|
|
1560
1543
|
errorsCount: intl.formatNumber(errorsCount),
|
|
1561
1544
|
b: getBold$1
|
|
1562
1545
|
}
|
|
@@ -1652,13 +1635,12 @@ function itemRenderer(item, column) {
|
|
|
1652
1635
|
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
1636
|
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; }
|
|
1654
1637
|
const UploadServerSideErrorsModal = () => {
|
|
1655
|
-
var _state$uploadFileResp, _state$droppedFile, _state$uploadFileResp2;
|
|
1656
1638
|
const intl = useIntl();
|
|
1657
1639
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1658
1640
|
state = _useImportResourcesCo.state,
|
|
1659
1641
|
actions = _useImportResourcesCo.actions,
|
|
1660
1642
|
onClose = _useImportResourcesCo.onClose;
|
|
1661
|
-
const errorsCount = getFileUploadErrorsCount(
|
|
1643
|
+
const errorsCount = getFileUploadErrorsCount(state.uploadFileResponse?.results);
|
|
1662
1644
|
const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
|
|
1663
1645
|
return jsx(InfoDialog, {
|
|
1664
1646
|
size: 16,
|
|
@@ -1677,7 +1659,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1677
1659
|
children: [jsx(Text.Body, {
|
|
1678
1660
|
intlMessage: _objectSpread$3(_objectSpread$3({}, messages$2.uploadingError), {}, {
|
|
1679
1661
|
values: {
|
|
1680
|
-
fileName:
|
|
1662
|
+
fileName: state.droppedFile?.name,
|
|
1681
1663
|
errorsCount: intl.formatNumber(errorsCount),
|
|
1682
1664
|
b: getBold
|
|
1683
1665
|
}
|
|
@@ -1695,7 +1677,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1695
1677
|
})
|
|
1696
1678
|
})]
|
|
1697
1679
|
}), jsx(UploadServerSideErrorTable, {
|
|
1698
|
-
rows: mapUploadFileErrorsResponseToUploadFileErrorRows(
|
|
1680
|
+
rows: mapUploadFileErrorsResponseToUploadFileErrorRows(state.uploadFileResponse?.results)
|
|
1699
1681
|
}), jsxs(Spacings.Inline, {
|
|
1700
1682
|
scale: "m",
|
|
1701
1683
|
justifyContent: "flex-end",
|
|
@@ -1720,11 +1702,10 @@ function getBold(msg) {
|
|
|
1720
1702
|
}
|
|
1721
1703
|
|
|
1722
1704
|
const UploadResult = () => {
|
|
1723
|
-
var _state$uploadFileResp;
|
|
1724
1705
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1725
1706
|
state = _useImportResourcesCo.state;
|
|
1726
1707
|
if (state.fileUploadClientSideErrors.length > 0) return jsx(UploadClientSideErrorsModal, {});
|
|
1727
|
-
if (
|
|
1708
|
+
if (state.uploadFileResponse?.invalid > 0) return jsx(UploadServerSideErrorsModal, {});
|
|
1728
1709
|
return jsx(UploadPreviewModal, {});
|
|
1729
1710
|
};
|
|
1730
1711
|
|
|
@@ -1762,7 +1743,6 @@ FileIcon.defaultProps = {
|
|
|
1762
1743
|
xmlns: "http://www.w3.org/2000/svg"
|
|
1763
1744
|
};
|
|
1764
1745
|
const Uploading = () => {
|
|
1765
|
-
var _state$droppedFile;
|
|
1766
1746
|
const intl = useIntl();
|
|
1767
1747
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1768
1748
|
state = _useImportResourcesCo.state,
|
|
@@ -1772,7 +1752,7 @@ const Uploading = () => {
|
|
|
1772
1752
|
resourceType: state.resourceType,
|
|
1773
1753
|
isPlural: true
|
|
1774
1754
|
});
|
|
1775
|
-
if (
|
|
1755
|
+
if (state.droppedFile?.name) return jsx(InfoDialog, {
|
|
1776
1756
|
size: 16,
|
|
1777
1757
|
isOpen: true,
|
|
1778
1758
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
@@ -1859,7 +1839,7 @@ const resourceTypeToDisplayName = resourceType => {
|
|
|
1859
1839
|
case 'category':
|
|
1860
1840
|
return messages$1.categories;
|
|
1861
1841
|
default:
|
|
1862
|
-
throw new Error(
|
|
1842
|
+
throw new Error(`Unknown resource type: ${resourceType}`);
|
|
1863
1843
|
}
|
|
1864
1844
|
};
|
|
1865
1845
|
const ResourceTypeSelection = () => {
|
|
@@ -1948,8 +1928,8 @@ const loadMessages = async locale => {
|
|
|
1948
1928
|
return parseChunkImport(chunkImport);
|
|
1949
1929
|
} catch (error) {
|
|
1950
1930
|
// eslint-disable-next-line no-console
|
|
1951
|
-
console.warn(
|
|
1952
|
-
reportErrorToSentry(new Error(
|
|
1931
|
+
console.warn(`Something went wrong while loading the import-resources-modal messages for ${locale}`, error);
|
|
1932
|
+
reportErrorToSentry(new Error(`Something went wrong while loading the import-resources-modal messages for ${locale}`), {
|
|
1953
1933
|
extra: error
|
|
1954
1934
|
});
|
|
1955
1935
|
return {};
|
|
@@ -1994,14 +1974,14 @@ const useAsyncIntlMessages = (locale, loader) => {
|
|
|
1994
1974
|
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; }
|
|
1995
1975
|
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; }
|
|
1996
1976
|
const ImportResourcesModal = props => {
|
|
1997
|
-
var
|
|
1977
|
+
var _context;
|
|
1998
1978
|
const _useApplicationContex = useApplicationContext(context => ({
|
|
1999
1979
|
locale: context.user && context.user.locale
|
|
2000
1980
|
})),
|
|
2001
1981
|
locale = _useApplicationContex.locale;
|
|
2002
1982
|
const messages = useAsyncIntlMessages(locale, loadMessages);
|
|
2003
1983
|
if (!props.isOpen || messages.isLoading) return null;
|
|
2004
|
-
if (!
|
|
1984
|
+
if (!props.resourceTypes?.length) {
|
|
2005
1985
|
console.error('No resource types provided for import resources modal');
|
|
2006
1986
|
return null;
|
|
2007
1987
|
}
|