@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.
@@ -16,7 +16,6 @@ var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
16
16
  var React = require('react');
17
17
  var sdk = require('@commercetools-frontend/sdk');
18
18
  var constants = require('@commercetools-frontend/constants');
19
- var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
20
19
  var pluralize = require('pluralize');
21
20
  var _Promise = require('@babel/runtime-corejs3/core-js-stable/promise');
22
21
  var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
@@ -27,7 +26,6 @@ var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/i
27
26
  var Papa = require('papaparse');
28
27
  var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
29
28
  var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
30
- var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
31
29
  require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
32
30
  require('querystring');
33
31
  require('ramda');
@@ -35,15 +33,16 @@ var applicationShell = require('@commercetools-frontend/application-shell');
35
33
  var _Reflect$construct = require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
36
34
  var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
37
35
  var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
38
- var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
39
36
  var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
40
37
  var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
38
+ var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
41
39
  var _wrapNativeSuper = require('@babel/runtime-corejs3/helpers/wrapNativeSuper');
42
40
  var jsxRuntime = require('@emotion/react/jsx-runtime');
43
41
  var applicationComponents = require('@commercetools-frontend/application-components');
44
42
  var uiKit = require('@commercetools-frontend/ui-kit');
45
43
  var actionsGlobal = require('@commercetools-frontend/actions-global');
46
44
  var sentry = require('@commercetools-frontend/sentry');
45
+ var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
47
46
  var reactDropzone = require('react-dropzone');
48
47
  var _styled = require('@emotion/styled/base');
49
48
  var react = require('@emotion/react');
@@ -63,7 +62,6 @@ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$def
63
62
  var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
64
63
  var _everyInstanceProperty__default = /*#__PURE__*/_interopDefault(_everyInstanceProperty);
65
64
  var React__default = /*#__PURE__*/_interopDefault(React);
66
- var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
67
65
  var _Promise__default = /*#__PURE__*/_interopDefault(_Promise);
68
66
  var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
69
67
  var _flatMapInstanceProperty__default = /*#__PURE__*/_interopDefault(_flatMapInstanceProperty);
@@ -73,8 +71,8 @@ var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesI
73
71
  var Papa__default = /*#__PURE__*/_interopDefault(Papa);
74
72
  var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
75
73
  var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
76
- var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
77
74
  var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
75
+ var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
78
76
  var _styled__default = /*#__PURE__*/_interopDefault(_styled);
79
77
  var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
80
78
  var DataTable__default = /*#__PURE__*/_interopDefault(DataTable);
@@ -89,7 +87,7 @@ function isResourceType(maybeResourceType) {
89
87
  }
90
88
  function assertResourceType(maybeResourceType) {
91
89
  if (isResourceType(maybeResourceType)) return;
92
- throw new Error("Invalid value: ".concat(maybeResourceType));
90
+ throw new Error(`Invalid value: ${maybeResourceType}`);
93
91
  }
94
92
  function isError(maybeError) {
95
93
  if (maybeError instanceof Error) return true;
@@ -104,7 +102,6 @@ function hasRequiredFields(maybeValidObject, requiredFields) {
104
102
  return typeof maybeValidObject === 'object' && maybeValidObject !== null && _everyInstanceProperty__default["default"](requiredFields).call(requiredFields, property => hasOwnProperty(maybeValidObject, property));
105
103
  }
106
104
 
107
- var _context;
108
105
  const DEFAULT_DELIMITER = ',';
109
106
  const INITIAL_COLUMN_DISPLAY_COUNT = 8;
110
107
  const IMPORT_TAG_KEYS = {
@@ -113,7 +110,7 @@ const IMPORT_TAG_KEYS = {
113
110
  const IMPORT_TAG_VALUES = {
114
111
  fileUpload: 'file-upload'
115
112
  };
116
- const TAG_KEY_SOURCE_FILE_UPLOAD = _concatInstanceProperty__default["default"](_context = "".concat(IMPORT_TAG_KEYS.source, ":")).call(_context, IMPORT_TAG_VALUES.fileUpload);
113
+ const TAG_KEY_SOURCE_FILE_UPLOAD = `${IMPORT_TAG_KEYS.source}:${IMPORT_TAG_VALUES.fileUpload}`;
117
114
 
118
115
  const FILE_SIZE_LIMITS_MB = {
119
116
  category: 10,
@@ -121,9 +118,9 @@ const FILE_SIZE_LIMITS_MB = {
121
118
  product: 35
122
119
  };
123
120
  const ROW_LIMITS = {
124
- category: 5000,
125
- inventory: 4000,
126
- product: 70000
121
+ category: 5_000,
122
+ inventory: 4_000,
123
+ product: 70_000
127
124
  };
128
125
  const RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS = {
129
126
  category: 'https://docs.commercetools.com/merchant-center/downloads/category_import_template.csv',
@@ -251,76 +248,67 @@ const encodeFileNameWithTimestampToContainerKey = fileName => {
251
248
  };
252
249
 
253
250
  function getCreateImportContainerURL(projectKey) {
254
- return "/".concat(projectKey, "/import-containers");
251
+ return `/${projectKey}/import-containers`;
255
252
  }
256
253
  function getDeleteImportContainerURL(projectKey, containerKey) {
257
- var _context6;
258
- return _concatInstanceProperty__default["default"](_context6 = "/".concat(projectKey, "/import-containers/")).call(_context6, containerKey);
254
+ return `/${projectKey}/import-containers/${containerKey}`;
259
255
  }
260
256
  function getFileUploadURL(projectKey, resourceType, containerKey) {
261
- var _context8, _context9;
262
- return _concatInstanceProperty__default["default"](_context8 = _concatInstanceProperty__default["default"](_context9 = "/".concat(projectKey, "/")).call(_context9, pluralize.plural(resourceType), "/import-containers/")).call(_context8, containerKey, "/file-upload");
257
+ return `/${projectKey}/${pluralize.plural(resourceType)}/import-containers/${containerKey}/file-upload`;
263
258
  }
264
259
  function getProccessFileURL(projectKey, resourceType, containerKey) {
265
- var _context10, _context11;
266
- return _concatInstanceProperty__default["default"](_context10 = _concatInstanceProperty__default["default"](_context11 = "/".concat(projectKey, "/")).call(_context11, pluralize.plural(resourceType), "/import-containers/")).call(_context10, containerKey, "/process-file");
260
+ return `/${projectKey}/${pluralize.plural(resourceType)}/import-containers/${containerKey}/process-file`;
267
261
  }
268
262
 
269
- function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
263
+ function _callSuper$3(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$3() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
270
264
  function _isNativeReflectConstruct$3() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$3 = function () { return !!t; })(); }
271
265
  let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
272
- _inherits(UnexpectedResourceTypeError, _Error);
273
- var _super = _createSuper$3(UnexpectedResourceTypeError);
274
266
  function UnexpectedResourceTypeError(resourceType) {
275
267
  var _this;
276
268
  _classCallCheck(this, UnexpectedResourceTypeError);
277
- _this = _super.call(this, "Unexpected resource type \"".concat(resourceType, "\""));
269
+ _this = _callSuper$3(this, UnexpectedResourceTypeError, [`Unexpected resource type "${resourceType}"`]);
278
270
  _this.name = 'UnexpectedResourceTypeError';
279
271
  return _this;
280
272
  }
273
+ _inherits(UnexpectedResourceTypeError, _Error);
281
274
  return _createClass(UnexpectedResourceTypeError);
282
275
  }( /*#__PURE__*/_wrapNativeSuper(Error));
283
276
 
284
- function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
277
+ function _callSuper$2(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$2() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
285
278
  function _isNativeReflectConstruct$2() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$2 = function () { return !!t; })(); }
286
279
  let MissingImportResourceProviderError = /*#__PURE__*/function (_Error) {
287
- _inherits(MissingImportResourceProviderError, _Error);
288
- var _super = _createSuper$2(MissingImportResourceProviderError);
289
280
  function MissingImportResourceProviderError() {
290
281
  var _this;
291
282
  _classCallCheck(this, MissingImportResourceProviderError);
292
- _this = _super.call(this, 'useImportResourcesContext must be used within ImportResourcesProvider');
283
+ _this = _callSuper$2(this, MissingImportResourceProviderError, ['useImportResourcesContext must be used within ImportResourcesProvider']);
293
284
  _this.name = 'MissingImportResourceProviderError';
294
285
  return _this;
295
286
  }
287
+ _inherits(MissingImportResourceProviderError, _Error);
296
288
  return _createClass(MissingImportResourceProviderError);
297
289
  }( /*#__PURE__*/_wrapNativeSuper(Error));
298
290
 
299
- function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
291
+ function _callSuper$1(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
300
292
  function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function () { return !!t; })(); }
301
293
  let UnexpectedColumnError = /*#__PURE__*/function (_Error) {
302
- _inherits(UnexpectedColumnError, _Error);
303
- var _super = _createSuper$1(UnexpectedColumnError);
304
294
  function UnexpectedColumnError(columnName) {
305
295
  var _this;
306
296
  _classCallCheck(this, UnexpectedColumnError);
307
- _this = _super.call(this, "Unexpected column \"".concat(columnName, "\""));
297
+ _this = _callSuper$1(this, UnexpectedColumnError, [`Unexpected column "${columnName}"`]);
308
298
  _this.name = 'UnexpectedColumnError';
309
299
  return _this;
310
300
  }
301
+ _inherits(UnexpectedColumnError, _Error);
311
302
  return _createClass(UnexpectedColumnError);
312
303
  }( /*#__PURE__*/_wrapNativeSuper(Error));
313
304
 
314
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
305
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
315
306
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
316
307
  let HttpError = /*#__PURE__*/function (_Error) {
317
- _inherits(HttpError, _Error);
318
- var _super = _createSuper(HttpError);
319
308
  function HttpError(statusCode, statusText, errorData) {
320
- var _context;
321
309
  var _this;
322
310
  _classCallCheck(this, HttpError);
323
- _this = _super.call(this, _concatInstanceProperty__default["default"](_context = "HTTP Error! Status code: ".concat(statusCode, ", message: \"")).call(_context, statusText ? statusText : '', "\""));
311
+ _this = _callSuper(this, HttpError, [`HTTP Error! Status code: ${statusCode}, message: "${statusText ? statusText : ''}"`]);
324
312
  _this.statusCode = void 0;
325
313
  _this.errorData = void 0;
326
314
  _this.name = 'HttpError';
@@ -328,14 +316,14 @@ let HttpError = /*#__PURE__*/function (_Error) {
328
316
  _this.errorData = errorData;
329
317
  return _this;
330
318
  }
319
+ _inherits(HttpError, _Error);
331
320
  return _createClass(HttpError);
332
321
  }( /*#__PURE__*/_wrapNativeSuper(Error));
333
322
 
334
323
  function ownKeys$e(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; }
335
- function _objectSpread$e(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys$e(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys$e(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
324
+ 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__default["default"](_context2 = ownKeys$e(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$e(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
336
325
  const addProxyPrefixToUrl = (uri, proxy) => {
337
- var _context;
338
- return proxy ? _concatInstanceProperty__default["default"](_context = "/proxy/".concat(proxy)).call(_context, uri) : uri;
326
+ return proxy ? `/proxy/${proxy}${uri}` : uri;
339
327
  };
340
328
  const fetchUsingXhr = _ref2 => {
341
329
  let url = _ref2.url,
@@ -347,15 +335,15 @@ const fetchUsingXhr = _ref2 => {
347
335
  const options = applicationShell.createHttpClientOptions({
348
336
  headers: _objectSpread$e({
349
337
  'Content-Type': 'application/json'
350
- }, config === null || config === void 0 ? void 0 : config.headers)
338
+ }, config?.headers)
351
339
  });
352
340
  const xhr = new XMLHttpRequest();
353
- xhr.open(config === null || config === void 0 ? void 0 : config.method, applicationShell.buildApiUrl(addProxyPrefixToUrl(url, config === null || config === void 0 ? void 0 : config.proxy)), true);
341
+ xhr.open(config?.method, applicationShell.buildApiUrl(addProxyPrefixToUrl(url, config?.proxy)), true);
354
342
  // Include cookies in the request
355
343
  xhr.withCredentials = true;
356
344
  if (options.headers) {
357
- var _context2;
358
- _forEachInstanceProperty__default["default"](_context2 = _Object$keys__default["default"](options.headers)).call(_context2, key => {
345
+ var _context;
346
+ _forEachInstanceProperty__default["default"](_context = _Object$keys__default["default"](options.headers)).call(_context, key => {
359
347
  xhr.setRequestHeader(key, options.headers[key]);
360
348
  });
361
349
  }
@@ -524,7 +512,7 @@ function reducer(state, action) {
524
512
  throw new Error(getUnknownActionError(action));
525
513
  }
526
514
  function getUnknownActionError(actionType) {
527
- return "Unkown type: ".concat(actionType);
515
+ return `Unkown type: ${actionType}`;
528
516
  }
529
517
  const initialState = {
530
518
  currentStep: 1,
@@ -541,12 +529,9 @@ function ownKeys$b(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
541
529
  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__default["default"](_context = ownKeys$b(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$b(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
542
530
  const ImportResourcesContext = /*#__PURE__*/React__default["default"].createContext();
543
531
  const ImportResourcesProvider = props => {
544
- const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => {
545
- var _context$project;
546
- return {
547
- projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key
548
- };
549
- }),
532
+ const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
533
+ projectKey: context.project?.key
534
+ })),
550
535
  projectKey = _useApplicationContex.projectKey;
551
536
  const asyncDispatch = sdk.useAsyncDispatch();
552
537
  const _React$useReducer = React__default["default"].useReducer(reducer, _objectSpread$b(_objectSpread$b({}, initialState), {}, {
@@ -677,15 +662,17 @@ var messages$5 = reactIntl.defineMessages({
677
662
  id: 'ImportResourcesModal.unexpectedError',
678
663
  description: 'Generic notification message when file upload fails',
679
664
  defaultMessage: 'An unexpected error occurred during the file upload. Please try again, or contact support if this error occurs again.'
665
+ },
666
+ missingKeyError: {
667
+ id: 'operations.import.upload.missingKeyError',
668
+ description: 'Error message displayed when the uploaded file is missing the key field',
669
+ defaultMessage: "The 'key' field is missing or incomplete in some rows. Please ensure every row has a 'key' value."
680
670
  }
681
671
  });
682
672
 
683
673
  const useUpload = () => {
684
674
  const intl = reactIntl.useIntl();
685
- const projectKey = applicationShellConnectors.useApplicationContext(context => {
686
- var _context$project;
687
- return (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key;
688
- });
675
+ const projectKey = applicationShellConnectors.useApplicationContext(context => context.project?.key);
689
676
  const _useImportResourcesCo = useImportResourcesContext(),
690
677
  state = _useImportResourcesCo.state,
691
678
  actions = _useImportResourcesCo.actions;
@@ -735,15 +722,14 @@ const useUpload = () => {
735
722
  return;
736
723
  }
737
724
  if (error instanceof HttpError) {
738
- var _error$errorData, _error$errorData2;
739
- if (((_error$errorData = error.errorData) === null || _error$errorData === void 0 ? void 0 : _error$errorData.code) === 'MISSING_KEY_ERROR') {
725
+ if (error.errorData?.code === 'MISSING_KEY_ERROR') {
740
726
  actions.cancelImport();
741
727
  showNotification({
742
728
  kind: 'error',
743
729
  domain: constants.DOMAINS.PAGE,
744
- text: error.errorData.message
730
+ text: intl.formatMessage(messages$5.unexpectedError)
745
731
  });
746
- } else if (((_error$errorData2 = error.errorData) === null || _error$errorData2 === void 0 ? void 0 : _error$errorData2.invalid) > 0) {
732
+ } else if (error.errorData?.invalid > 0) {
747
733
  actions.setUploadFileResponse(error.errorData);
748
734
  } else {
749
735
  actions.cancelImport();
@@ -754,7 +740,6 @@ const useUpload = () => {
754
740
  });
755
741
  }
756
742
  } else {
757
- var _state$droppedFile;
758
743
  actions.cancelImport();
759
744
  showNotification({
760
745
  kind: 'error',
@@ -767,7 +752,7 @@ const useUpload = () => {
767
752
  projectKey,
768
753
  containerKey: state.containerKey,
769
754
  resourceType: state.resourceType,
770
- fileSizeInBytes: (_state$droppedFile = state.droppedFile) === null || _state$droppedFile === void 0 ? void 0 : _state$droppedFile.size
755
+ fileSizeInBytes: state.droppedFile?.size
771
756
  }
772
757
  });
773
758
  }
@@ -848,8 +833,12 @@ const getBorderColor = state => {
848
833
  const getDashedBorder = function () {
849
834
  let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
850
835
  const color = getBorderColor(state);
851
- const svgContent = "\n <svg width=\"100%\" height=\"100%\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect width=\"100%\" height=\"100%\" fill=\"none\" stroke=\"".concat(color, "\" stroke-width=\"2px\" stroke-dasharray=\"6,6\" stroke-dashoffset=\"0\" stroke-linecap=\"square\"/>\n </svg>\n ");
852
- return "data:image/svg+xml,".concat(encodeURIComponent(svgContent));
836
+ const svgContent = `
837
+ <svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
838
+ <rect width="100%" height="100%" fill="none" stroke="${color}" stroke-width="2px" stroke-dasharray="6,6" stroke-dashoffset="0" stroke-linecap="square"/>
839
+ </svg>
840
+ `;
841
+ return `data:image/svg+xml,${encodeURIComponent(svgContent)}`;
853
842
  };
854
843
  const base = /*#__PURE__*/react.css("border-radius:", uiKit.customProperties.borderRadius6, ";min-height:136px;display:flex;justify-content:center;align-items:center;" + ("" ), "" );
855
844
  const disabled = /*#__PURE__*/react.css("" , "" );
@@ -885,13 +874,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
885
874
  return /*#__PURE__*/react.css("" , "" );
886
875
  }
887
876
 
888
- var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-f3c34dec.cjs.prod.js' /* webpackChunkName: "active-drag-drop-area" */); }));
877
+ var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-afef4ad4.cjs.prod.js' /* webpackChunkName: "active-drag-drop-area" */); }));
889
878
 
890
879
  var DisabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./disabled-drop-area-99c1fa0b.cjs.prod.js' /* webpackChunkName: "disabled-drop-area" */); }));
891
880
 
892
- var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-1c5689e6.cjs.prod.js' /* webpackChunkName: "enabled-drop-area" */); }));
881
+ var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-07280b47.cjs.prod.js' /* webpackChunkName: "enabled-drop-area" */); }));
893
882
 
894
- var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-cab83f88.cjs.prod.js' /* webpackChunkName: "filed-dropped-area" */); }));
883
+ var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-8fe656cb.cjs.prod.js' /* webpackChunkName: "filed-dropped-area" */); }));
895
884
 
896
885
  function getDropArea(_ref) {
897
886
  let dropAreaState = _ref.dropAreaState,
@@ -1085,7 +1074,6 @@ var sharedMessages = reactIntl.defineMessages({
1085
1074
  });
1086
1075
 
1087
1076
  const Upload = () => {
1088
- var _context;
1089
1077
  const _useImportResourcesCo = useImportResourcesContext(),
1090
1078
  state = _useImportResourcesCo.state,
1091
1079
  onClose = _useImportResourcesCo.onClose,
@@ -1117,7 +1105,7 @@ const Upload = () => {
1117
1105
  scale: "l",
1118
1106
  children: [isMultipleResourceTypes ? jsxRuntime.jsxs(uiKit.Grid, {
1119
1107
  gridRowGap: uiKit.designTokens.spacingL,
1120
- gridTemplateColumns: _concatInstanceProperty__default["default"](_context = "calc(".concat(uiKit.designTokens.constraint3, " + ")).call(_context, uiKit.designTokens.spacingL, ") auto"),
1108
+ gridTemplateColumns: `calc(${uiKit.designTokens.constraint3} + ${uiKit.designTokens.spacingL}) auto`,
1121
1109
  children: [jsxRuntime.jsx(uiKit.Grid.Item, {
1122
1110
  children: jsxRuntime.jsx(uiKit.Text.Body, {
1123
1111
  isBold: true,
@@ -1359,23 +1347,19 @@ function ownKeys$7(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
1359
1347
  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; }
1360
1348
  const getNewLine = () => jsxRuntime.jsx("br", {});
1361
1349
  const getImportLogsLink = (msg, projectKey) => jsxRuntime.jsx(uiKit.Link, {
1362
- to: "/".concat(projectKey, "/operations/import/logs"),
1350
+ to: `/${projectKey}/operations/import/logs`,
1363
1351
  children: msg
1364
1352
  });
1365
1353
  const ImportConfirmationModal = () => {
1366
- var _state$uploadFileResp;
1367
1354
  const intl = reactIntl.useIntl();
1368
1355
  const _useImportResourcesCo = useImportResourcesContext(),
1369
1356
  state = _useImportResourcesCo.state,
1370
1357
  onStartImportSuccess = _useImportResourcesCo.onStartImportSuccess,
1371
1358
  onClose = _useImportResourcesCo.onClose;
1372
- const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => {
1373
- var _context$project, _context$project2;
1374
- return {
1375
- projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key,
1376
- projectName: (_context$project2 = context.project) === null || _context$project2 === void 0 ? void 0 : _context$project2.name
1377
- };
1378
- }),
1359
+ const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
1360
+ projectKey: context.project?.key,
1361
+ projectName: context.project?.name
1362
+ })),
1379
1363
  projectKey = _useApplicationContex.projectKey,
1380
1364
  projectName = _useApplicationContex.projectName;
1381
1365
  const asyncDispatch = sdk.useAsyncDispatch();
@@ -1412,8 +1396,7 @@ const ImportConfirmationModal = () => {
1412
1396
  },
1413
1397
  onConfirm: async () => {
1414
1398
  try {
1415
- var _state$droppedFile;
1416
- const canConfirm = projectKey && state.containerKey && ((_state$droppedFile = state.droppedFile) === null || _state$droppedFile === void 0 ? void 0 : _state$droppedFile.name) && state.resourceType;
1399
+ const canConfirm = projectKey && state.containerKey && state.droppedFile?.name && state.resourceType;
1417
1400
  if (!canConfirm) return;
1418
1401
  onClose();
1419
1402
  await processUploadedFile({
@@ -1450,7 +1433,7 @@ const ImportConfirmationModal = () => {
1450
1433
  intlMessage: _objectSpread$7(_objectSpread$7({}, messages$3.confirmationBodyText), {}, {
1451
1434
  values: {
1452
1435
  projectName: projectName,
1453
- count: intl.formatNumber((state === null || state === void 0 || (_state$uploadFileResp = state.uploadFileResponse) === null || _state$uploadFileResp === void 0 ? void 0 : _state$uploadFileResp.rowsCount) || 0),
1436
+ count: intl.formatNumber(state?.uploadFileResponse?.rowsCount || 0),
1454
1437
  bold: getBold$2
1455
1438
  }
1456
1439
  })
@@ -1558,7 +1541,6 @@ function itemRenderer$1(item, column) {
1558
1541
  function ownKeys$5(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; }
1559
1542
  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__default["default"](_context = ownKeys$5(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$5(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
1560
1543
  const UploadClientSideErrorsModal = () => {
1561
- var _state$droppedFile;
1562
1544
  const intl = reactIntl.useIntl();
1563
1545
  const _useImportResourcesCo = useImportResourcesContext(),
1564
1546
  state = _useImportResourcesCo.state,
@@ -1580,7 +1562,7 @@ const UploadClientSideErrorsModal = () => {
1580
1562
  children: [jsxRuntime.jsx(uiKit.Text.Body, {
1581
1563
  intlMessage: _objectSpread$5(_objectSpread$5({}, messages$2.uploadingError), {}, {
1582
1564
  values: {
1583
- fileName: (_state$droppedFile = state.droppedFile) === null || _state$droppedFile === void 0 ? void 0 : _state$droppedFile.name,
1565
+ fileName: state.droppedFile?.name,
1584
1566
  errorsCount: intl.formatNumber(errorsCount),
1585
1567
  b: getBold$1
1586
1568
  }
@@ -1676,13 +1658,12 @@ function itemRenderer(item, column) {
1676
1658
  function ownKeys$3(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; }
1677
1659
  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__default["default"](_context = ownKeys$3(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$3(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
1678
1660
  const UploadServerSideErrorsModal = () => {
1679
- var _state$uploadFileResp, _state$droppedFile, _state$uploadFileResp2;
1680
1661
  const intl = reactIntl.useIntl();
1681
1662
  const _useImportResourcesCo = useImportResourcesContext(),
1682
1663
  state = _useImportResourcesCo.state,
1683
1664
  actions = _useImportResourcesCo.actions,
1684
1665
  onClose = _useImportResourcesCo.onClose;
1685
- const errorsCount = getFileUploadErrorsCount((_state$uploadFileResp = state.uploadFileResponse) === null || _state$uploadFileResp === void 0 ? void 0 : _state$uploadFileResp.results);
1666
+ const errorsCount = getFileUploadErrorsCount(state.uploadFileResponse?.results);
1686
1667
  const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
1687
1668
  return jsxRuntime.jsx(applicationComponents.InfoDialog, {
1688
1669
  size: 16,
@@ -1701,7 +1682,7 @@ const UploadServerSideErrorsModal = () => {
1701
1682
  children: [jsxRuntime.jsx(uiKit.Text.Body, {
1702
1683
  intlMessage: _objectSpread$3(_objectSpread$3({}, messages$2.uploadingError), {}, {
1703
1684
  values: {
1704
- fileName: (_state$droppedFile = state.droppedFile) === null || _state$droppedFile === void 0 ? void 0 : _state$droppedFile.name,
1685
+ fileName: state.droppedFile?.name,
1705
1686
  errorsCount: intl.formatNumber(errorsCount),
1706
1687
  b: getBold
1707
1688
  }
@@ -1719,7 +1700,7 @@ const UploadServerSideErrorsModal = () => {
1719
1700
  })
1720
1701
  })]
1721
1702
  }), jsxRuntime.jsx(UploadServerSideErrorTable, {
1722
- rows: mapUploadFileErrorsResponseToUploadFileErrorRows((_state$uploadFileResp2 = state.uploadFileResponse) === null || _state$uploadFileResp2 === void 0 ? void 0 : _state$uploadFileResp2.results)
1703
+ rows: mapUploadFileErrorsResponseToUploadFileErrorRows(state.uploadFileResponse?.results)
1723
1704
  }), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
1724
1705
  scale: "m",
1725
1706
  justifyContent: "flex-end",
@@ -1744,11 +1725,10 @@ function getBold(msg) {
1744
1725
  }
1745
1726
 
1746
1727
  const UploadResult = () => {
1747
- var _state$uploadFileResp;
1748
1728
  const _useImportResourcesCo = useImportResourcesContext(),
1749
1729
  state = _useImportResourcesCo.state;
1750
1730
  if (state.fileUploadClientSideErrors.length > 0) return jsxRuntime.jsx(UploadClientSideErrorsModal, {});
1751
- if (((_state$uploadFileResp = state.uploadFileResponse) === null || _state$uploadFileResp === void 0 ? void 0 : _state$uploadFileResp.invalid) > 0) return jsxRuntime.jsx(UploadServerSideErrorsModal, {});
1731
+ if (state.uploadFileResponse?.invalid > 0) return jsxRuntime.jsx(UploadServerSideErrorsModal, {});
1752
1732
  return jsxRuntime.jsx(UploadPreviewModal, {});
1753
1733
  };
1754
1734
 
@@ -1786,7 +1766,6 @@ FileIcon.defaultProps = {
1786
1766
  xmlns: "http://www.w3.org/2000/svg"
1787
1767
  };
1788
1768
  const Uploading = () => {
1789
- var _state$droppedFile;
1790
1769
  const intl = reactIntl.useIntl();
1791
1770
  const _useImportResourcesCo = useImportResourcesContext(),
1792
1771
  state = _useImportResourcesCo.state,
@@ -1796,7 +1775,7 @@ const Uploading = () => {
1796
1775
  resourceType: state.resourceType,
1797
1776
  isPlural: true
1798
1777
  });
1799
- if ((_state$droppedFile = state.droppedFile) !== null && _state$droppedFile !== void 0 && _state$droppedFile.name) return jsxRuntime.jsx(applicationComponents.InfoDialog, {
1778
+ if (state.droppedFile?.name) return jsxRuntime.jsx(applicationComponents.InfoDialog, {
1800
1779
  size: 16,
1801
1780
  isOpen: true,
1802
1781
  title: intl.formatMessage(sharedMessages.modalTitle, {
@@ -1883,7 +1862,7 @@ const resourceTypeToDisplayName = resourceType => {
1883
1862
  case 'category':
1884
1863
  return messages$1.categories;
1885
1864
  default:
1886
- throw new Error("Unknown resource type: ".concat(resourceType));
1865
+ throw new Error(`Unknown resource type: ${resourceType}`);
1887
1866
  }
1888
1867
  };
1889
1868
  const ResourceTypeSelection = () => {
@@ -1972,8 +1951,8 @@ const loadMessages = async locale => {
1972
1951
  return i18n.parseChunkImport(chunkImport);
1973
1952
  } catch (error) {
1974
1953
  // eslint-disable-next-line no-console
1975
- console.warn("Something went wrong while loading the import-resources-modal messages for ".concat(locale), error);
1976
- sentry.reportErrorToSentry(new Error("Something went wrong while loading the import-resources-modal messages for ".concat(locale)), {
1954
+ console.warn(`Something went wrong while loading the import-resources-modal messages for ${locale}`, error);
1955
+ sentry.reportErrorToSentry(new Error(`Something went wrong while loading the import-resources-modal messages for ${locale}`), {
1977
1956
  extra: error
1978
1957
  });
1979
1958
  return {};
@@ -2018,14 +1997,14 @@ const useAsyncIntlMessages = (locale, loader) => {
2018
1997
  function ownKeys(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; }
2019
1998
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
2020
1999
  const ImportResourcesModal = props => {
2021
- var _props$resourceTypes, _context;
2000
+ var _context;
2022
2001
  const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
2023
2002
  locale: context.user && context.user.locale
2024
2003
  })),
2025
2004
  locale = _useApplicationContex.locale;
2026
2005
  const messages = useAsyncIntlMessages(locale, loadMessages);
2027
2006
  if (!props.isOpen || messages.isLoading) return null;
2028
- if (!((_props$resourceTypes = props.resourceTypes) !== null && _props$resourceTypes !== void 0 && _props$resourceTypes.length)) {
2007
+ if (!props.resourceTypes?.length) {
2029
2008
  console.error('No resource types provided for import resources modal');
2030
2009
  return null;
2031
2010
  }