@commercetools-frontend-extensions/import-resources-modal 1.2.1 → 1.2.2
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-1ac31437.cjs.prod.js → active-drag-drop-area-1d0d6132.cjs.dev.js} +4 -3
- package/dist/{active-drag-drop-area-b8f17528.cjs.dev.js → active-drag-drop-area-381456f1.cjs.prod.js} +4 -3
- package/dist/{active-drag-drop-area-7c8d7f16.esm.js → active-drag-drop-area-ab529798.esm.js} +4 -3
- package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.dev.js +4 -3
- package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.prod.js +4 -3
- package/dist/commercetools-frontend-extensions-import-resources-modal.esm.js +4 -3
- package/dist/{enabled-drop-area-c93b15af.cjs.dev.js → enabled-drop-area-0147fe23.cjs.prod.js} +4 -3
- package/dist/{enabled-drop-area-8d33207e.esm.js → enabled-drop-area-cfdacefe.esm.js} +4 -3
- package/dist/{enabled-drop-area-bb340df2.cjs.prod.js → enabled-drop-area-f165c524.cjs.dev.js} +4 -3
- package/dist/{file-dropped-area-c0f3932c.esm.js → file-dropped-area-e865c7d8.esm.js} +6 -4
- package/dist/{file-dropped-area-5b0aa739.cjs.dev.js → file-dropped-area-f3d703d5.cjs.prod.js} +6 -4
- package/dist/{file-dropped-area-5632c032.cjs.prod.js → file-dropped-area-fca08393.cjs.dev.js} +6 -4
- package/dist/{index-bea140f8.cjs.dev.js → index-3975e58d.cjs.dev.js} +102 -77
- package/dist/{index-06262b8c.cjs.prod.js → index-958cc529.cjs.prod.js} +99 -74
- package/dist/{index-79e36c76.esm.js → index-f65b5175.esm.js} +100 -76
- package/package.json +32 -32
|
@@ -16,6 +16,7 @@ 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');
|
|
19
20
|
var pluralize = require('pluralize');
|
|
20
21
|
var _Promise = require('@babel/runtime-corejs3/core-js-stable/promise');
|
|
21
22
|
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
@@ -26,6 +27,7 @@ var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/i
|
|
|
26
27
|
var Papa = require('papaparse');
|
|
27
28
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
28
29
|
var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
30
|
+
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
29
31
|
require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
|
|
30
32
|
require('querystring');
|
|
31
33
|
require('ramda');
|
|
@@ -33,16 +35,15 @@ var applicationShell = require('@commercetools-frontend/application-shell');
|
|
|
33
35
|
var _Reflect$construct = require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
|
|
34
36
|
var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
|
|
35
37
|
var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
38
|
+
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
36
39
|
var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
|
|
37
40
|
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
38
|
-
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
39
41
|
var _wrapNativeSuper = require('@babel/runtime-corejs3/helpers/wrapNativeSuper');
|
|
40
42
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
41
43
|
var applicationComponents = require('@commercetools-frontend/application-components');
|
|
42
44
|
var uiKit = require('@commercetools-frontend/ui-kit');
|
|
43
45
|
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
44
46
|
var sentry = require('@commercetools-frontend/sentry');
|
|
45
|
-
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
46
47
|
var reactDropzone = require('react-dropzone');
|
|
47
48
|
var _styled = require('@emotion/styled/base');
|
|
48
49
|
var react = require('@emotion/react');
|
|
@@ -62,6 +63,7 @@ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$def
|
|
|
62
63
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
63
64
|
var _everyInstanceProperty__default = /*#__PURE__*/_interopDefault(_everyInstanceProperty);
|
|
64
65
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
66
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
65
67
|
var _Promise__default = /*#__PURE__*/_interopDefault(_Promise);
|
|
66
68
|
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
67
69
|
var _flatMapInstanceProperty__default = /*#__PURE__*/_interopDefault(_flatMapInstanceProperty);
|
|
@@ -71,8 +73,8 @@ var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesI
|
|
|
71
73
|
var Papa__default = /*#__PURE__*/_interopDefault(Papa);
|
|
72
74
|
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
73
75
|
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
74
|
-
var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
|
|
75
76
|
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
77
|
+
var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
|
|
76
78
|
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
77
79
|
var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
|
|
78
80
|
var DataTable__default = /*#__PURE__*/_interopDefault(DataTable);
|
|
@@ -88,7 +90,7 @@ function isResourceType(maybeResourceType) {
|
|
|
88
90
|
}
|
|
89
91
|
function assertResourceType(maybeResourceType) {
|
|
90
92
|
if (isResourceType(maybeResourceType)) return;
|
|
91
|
-
throw new Error(
|
|
93
|
+
throw new Error("Invalid value: ".concat(maybeResourceType));
|
|
92
94
|
}
|
|
93
95
|
function isError(maybeError) {
|
|
94
96
|
if (maybeError instanceof Error) return true;
|
|
@@ -103,6 +105,7 @@ function hasRequiredFields(maybeValidObject, requiredFields) {
|
|
|
103
105
|
return typeof maybeValidObject === 'object' && maybeValidObject !== null && _everyInstanceProperty__default["default"](requiredFields).call(requiredFields, property => hasOwnProperty(maybeValidObject, property));
|
|
104
106
|
}
|
|
105
107
|
|
|
108
|
+
var _context;
|
|
106
109
|
const DEFAULT_DELIMITER = ',';
|
|
107
110
|
const INITIAL_COLUMN_DISPLAY_COUNT = 8;
|
|
108
111
|
const IMPORT_TAG_KEYS = {
|
|
@@ -111,7 +114,7 @@ const IMPORT_TAG_KEYS = {
|
|
|
111
114
|
const IMPORT_TAG_VALUES = {
|
|
112
115
|
fileUpload: 'file-upload'
|
|
113
116
|
};
|
|
114
|
-
const TAG_KEY_SOURCE_FILE_UPLOAD =
|
|
117
|
+
const TAG_KEY_SOURCE_FILE_UPLOAD = _concatInstanceProperty__default["default"](_context = "".concat(IMPORT_TAG_KEYS.source, ":")).call(_context, IMPORT_TAG_VALUES.fileUpload);
|
|
115
118
|
|
|
116
119
|
const IMPORTABLE_RESOURCES = {
|
|
117
120
|
CATEGORY: 'category',
|
|
@@ -127,10 +130,10 @@ const FILE_SIZE_LIMITS_MB = {
|
|
|
127
130
|
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 10
|
|
128
131
|
};
|
|
129
132
|
const ROW_LIMITS = {
|
|
130
|
-
[IMPORTABLE_RESOURCES.CATEGORY]:
|
|
131
|
-
[IMPORTABLE_RESOURCES.INVENTORY]:
|
|
132
|
-
[IMPORTABLE_RESOURCES.PRODUCT]:
|
|
133
|
-
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]:
|
|
133
|
+
[IMPORTABLE_RESOURCES.CATEGORY]: 5000,
|
|
134
|
+
[IMPORTABLE_RESOURCES.INVENTORY]: 4000,
|
|
135
|
+
[IMPORTABLE_RESOURCES.PRODUCT]: 70000,
|
|
136
|
+
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 4000
|
|
134
137
|
};
|
|
135
138
|
const RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS = {
|
|
136
139
|
[IMPORTABLE_RESOURCES.CATEGORY]: 'https://docs.commercetools.com/merchant-center/downloads/category_import_template.csv',
|
|
@@ -260,53 +263,61 @@ const encodeFileNameWithTimestampToContainerKey = fileName => {
|
|
|
260
263
|
};
|
|
261
264
|
|
|
262
265
|
function getCreateImportContainerURL(projectKey) {
|
|
263
|
-
return
|
|
266
|
+
return "/".concat(projectKey, "/import-containers");
|
|
264
267
|
}
|
|
265
268
|
function getDeleteImportContainerURL(projectKey, containerKey) {
|
|
266
|
-
|
|
269
|
+
var _context6;
|
|
270
|
+
return _concatInstanceProperty__default["default"](_context6 = "/".concat(projectKey, "/import-containers/")).call(_context6, containerKey);
|
|
267
271
|
}
|
|
268
272
|
function getFileUploadURL(projectKey, resourceType, containerKey) {
|
|
269
|
-
|
|
273
|
+
var _context8, _context9;
|
|
274
|
+
return _concatInstanceProperty__default["default"](_context8 = _concatInstanceProperty__default["default"](_context9 = "/".concat(projectKey, "/")).call(_context9, pluralize.plural(resourceType), "/import-containers/")).call(_context8, containerKey, "/file-upload");
|
|
270
275
|
}
|
|
271
276
|
function getProccessFileURL(projectKey, resourceType, containerKey) {
|
|
272
|
-
|
|
277
|
+
var _context10, _context11;
|
|
278
|
+
return _concatInstanceProperty__default["default"](_context10 = _concatInstanceProperty__default["default"](_context11 = "/".concat(projectKey, "/")).call(_context11, pluralize.plural(resourceType), "/import-containers/")).call(_context10, containerKey, "/process-file");
|
|
273
279
|
}
|
|
274
280
|
|
|
275
|
-
function
|
|
281
|
+
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); }; }
|
|
276
282
|
function _isNativeReflectConstruct$2() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$2 = function () { return !!t; })(); }
|
|
277
283
|
let MissingImportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
284
|
+
_inherits(MissingImportResourceProviderError, _Error);
|
|
285
|
+
var _super = _createSuper$2(MissingImportResourceProviderError);
|
|
278
286
|
function MissingImportResourceProviderError() {
|
|
279
287
|
var _this;
|
|
280
288
|
_classCallCheck(this, MissingImportResourceProviderError);
|
|
281
|
-
_this =
|
|
289
|
+
_this = _super.call(this, 'useImportResourcesContext must be used within ImportResourcesProvider');
|
|
282
290
|
_this.name = 'MissingImportResourceProviderError';
|
|
283
291
|
return _this;
|
|
284
292
|
}
|
|
285
|
-
_inherits(MissingImportResourceProviderError, _Error);
|
|
286
293
|
return _createClass(MissingImportResourceProviderError);
|
|
287
294
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
288
295
|
|
|
289
|
-
function
|
|
296
|
+
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); }; }
|
|
290
297
|
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function () { return !!t; })(); }
|
|
291
298
|
let UnexpectedColumnError = /*#__PURE__*/function (_Error) {
|
|
299
|
+
_inherits(UnexpectedColumnError, _Error);
|
|
300
|
+
var _super = _createSuper$1(UnexpectedColumnError);
|
|
292
301
|
function UnexpectedColumnError(columnName) {
|
|
293
302
|
var _this;
|
|
294
303
|
_classCallCheck(this, UnexpectedColumnError);
|
|
295
|
-
_this =
|
|
304
|
+
_this = _super.call(this, "Unexpected column \"".concat(columnName, "\""));
|
|
296
305
|
_this.name = 'UnexpectedColumnError';
|
|
297
306
|
return _this;
|
|
298
307
|
}
|
|
299
|
-
_inherits(UnexpectedColumnError, _Error);
|
|
300
308
|
return _createClass(UnexpectedColumnError);
|
|
301
309
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
302
310
|
|
|
303
|
-
function
|
|
311
|
+
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); }; }
|
|
304
312
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
305
313
|
let HttpError = /*#__PURE__*/function (_Error) {
|
|
314
|
+
_inherits(HttpError, _Error);
|
|
315
|
+
var _super = _createSuper(HttpError);
|
|
306
316
|
function HttpError(statusCode, statusText, errorData) {
|
|
317
|
+
var _context;
|
|
307
318
|
var _this;
|
|
308
319
|
_classCallCheck(this, HttpError);
|
|
309
|
-
_this =
|
|
320
|
+
_this = _super.call(this, _concatInstanceProperty__default["default"](_context = "HTTP Error! Status code: ".concat(statusCode, ", message: \"")).call(_context, statusText ? statusText : '', "\""));
|
|
310
321
|
_this.statusCode = void 0;
|
|
311
322
|
_this.errorData = void 0;
|
|
312
323
|
_this.name = 'HttpError';
|
|
@@ -314,14 +325,14 @@ let HttpError = /*#__PURE__*/function (_Error) {
|
|
|
314
325
|
_this.errorData = errorData;
|
|
315
326
|
return _this;
|
|
316
327
|
}
|
|
317
|
-
_inherits(HttpError, _Error);
|
|
318
328
|
return _createClass(HttpError);
|
|
319
329
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
320
330
|
|
|
321
331
|
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; }
|
|
322
|
-
function _objectSpread$e(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
332
|
+
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; }
|
|
323
333
|
const addProxyPrefixToUrl = (uri, proxy) => {
|
|
324
|
-
|
|
334
|
+
var _context;
|
|
335
|
+
return proxy ? _concatInstanceProperty__default["default"](_context = "/proxy/".concat(proxy)).call(_context, uri) : uri;
|
|
325
336
|
};
|
|
326
337
|
const fetchUsingXhr = _ref2 => {
|
|
327
338
|
let url = _ref2.url,
|
|
@@ -333,15 +344,15 @@ const fetchUsingXhr = _ref2 => {
|
|
|
333
344
|
const options = applicationShell.createHttpClientOptions({
|
|
334
345
|
headers: _objectSpread$e({
|
|
335
346
|
'Content-Type': 'application/json'
|
|
336
|
-
}, config
|
|
347
|
+
}, config === null || config === void 0 ? void 0 : config.headers)
|
|
337
348
|
});
|
|
338
349
|
const xhr = new XMLHttpRequest();
|
|
339
|
-
xhr.open(config
|
|
350
|
+
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);
|
|
340
351
|
// Include cookies in the request
|
|
341
352
|
xhr.withCredentials = true;
|
|
342
353
|
if (options.headers) {
|
|
343
|
-
var
|
|
344
|
-
_forEachInstanceProperty__default["default"](
|
|
354
|
+
var _context2;
|
|
355
|
+
_forEachInstanceProperty__default["default"](_context2 = _Object$keys__default["default"](options.headers)).call(_context2, key => {
|
|
345
356
|
xhr.setRequestHeader(key, options.headers[key]);
|
|
346
357
|
});
|
|
347
358
|
}
|
|
@@ -510,7 +521,7 @@ function reducer(state, action) {
|
|
|
510
521
|
throw new Error(getUnknownActionError(action));
|
|
511
522
|
}
|
|
512
523
|
function getUnknownActionError(actionType) {
|
|
513
|
-
return
|
|
524
|
+
return "Unkown type: ".concat(actionType);
|
|
514
525
|
}
|
|
515
526
|
const initialState = {
|
|
516
527
|
currentStep: 1,
|
|
@@ -527,9 +538,12 @@ function ownKeys$b(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
527
538
|
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; }
|
|
528
539
|
const ImportResourcesContext = /*#__PURE__*/React__default["default"].createContext();
|
|
529
540
|
const ImportResourcesProvider = props => {
|
|
530
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context =>
|
|
531
|
-
|
|
532
|
-
|
|
541
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => {
|
|
542
|
+
var _context$project;
|
|
543
|
+
return {
|
|
544
|
+
projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key
|
|
545
|
+
};
|
|
546
|
+
}),
|
|
533
547
|
projectKey = _useApplicationContex.projectKey;
|
|
534
548
|
const asyncDispatch = sdk.useAsyncDispatch();
|
|
535
549
|
const _React$useReducer = React__default["default"].useReducer(reducer, _objectSpread$b(_objectSpread$b({}, initialState), {}, {
|
|
@@ -670,7 +684,10 @@ var messages$5 = reactIntl.defineMessages({
|
|
|
670
684
|
|
|
671
685
|
const useUpload = () => {
|
|
672
686
|
const intl = reactIntl.useIntl();
|
|
673
|
-
const projectKey = applicationShellConnectors.useApplicationContext(context =>
|
|
687
|
+
const projectKey = applicationShellConnectors.useApplicationContext(context => {
|
|
688
|
+
var _context$project;
|
|
689
|
+
return (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key;
|
|
690
|
+
});
|
|
674
691
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
675
692
|
state = _useImportResourcesCo.state,
|
|
676
693
|
actions = _useImportResourcesCo.actions;
|
|
@@ -720,14 +737,15 @@ const useUpload = () => {
|
|
|
720
737
|
return;
|
|
721
738
|
}
|
|
722
739
|
if (error instanceof HttpError) {
|
|
723
|
-
|
|
740
|
+
var _error$errorData, _error$errorData2;
|
|
741
|
+
if (((_error$errorData = error.errorData) === null || _error$errorData === void 0 ? void 0 : _error$errorData.code) === 'MISSING_KEY_ERROR') {
|
|
724
742
|
actions.cancelImport();
|
|
725
743
|
showNotification({
|
|
726
744
|
kind: 'error',
|
|
727
745
|
domain: constants.DOMAINS.PAGE,
|
|
728
746
|
text: intl.formatMessage(messages$5.unexpectedError)
|
|
729
747
|
});
|
|
730
|
-
} else if (error.errorData
|
|
748
|
+
} else if (((_error$errorData2 = error.errorData) === null || _error$errorData2 === void 0 ? void 0 : _error$errorData2.invalid) > 0) {
|
|
731
749
|
actions.setUploadFileResponse(error.errorData);
|
|
732
750
|
} else {
|
|
733
751
|
actions.cancelImport();
|
|
@@ -738,6 +756,7 @@ const useUpload = () => {
|
|
|
738
756
|
});
|
|
739
757
|
}
|
|
740
758
|
} else {
|
|
759
|
+
var _state$droppedFile;
|
|
741
760
|
actions.cancelImport();
|
|
742
761
|
showNotification({
|
|
743
762
|
kind: 'error',
|
|
@@ -750,7 +769,7 @@ const useUpload = () => {
|
|
|
750
769
|
projectKey,
|
|
751
770
|
containerKey: state.containerKey,
|
|
752
771
|
resourceType: state.resourceType,
|
|
753
|
-
fileSizeInBytes: state.droppedFile
|
|
772
|
+
fileSizeInBytes: (_state$droppedFile = state.droppedFile) === null || _state$droppedFile === void 0 ? void 0 : _state$droppedFile.size
|
|
754
773
|
}
|
|
755
774
|
});
|
|
756
775
|
}
|
|
@@ -808,12 +827,8 @@ const getBorderColor = state => {
|
|
|
808
827
|
const getDashedBorder = function () {
|
|
809
828
|
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
|
|
810
829
|
const color = getBorderColor(state);
|
|
811
|
-
const svgContent =
|
|
812
|
-
|
|
813
|
-
<rect width="100%" height="100%" fill="none" stroke="${color}" stroke-width="2px" stroke-dasharray="6,6" stroke-dashoffset="0" stroke-linecap="square"/>
|
|
814
|
-
</svg>
|
|
815
|
-
`;
|
|
816
|
-
return `data:image/svg+xml,${encodeURIComponent(svgContent)}`;
|
|
830
|
+
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 ");
|
|
831
|
+
return "data:image/svg+xml,".concat(encodeURIComponent(svgContent));
|
|
817
832
|
};
|
|
818
833
|
const base = /*#__PURE__*/react.css("border-radius:", uiKit.customProperties.borderRadius6, ";min-height:136px;display:flex;justify-content:center;align-items:center;" + ("" ), "" );
|
|
819
834
|
const disabled = /*#__PURE__*/react.css("" , "" );
|
|
@@ -849,13 +864,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
849
864
|
return /*#__PURE__*/react.css("" , "" );
|
|
850
865
|
}
|
|
851
866
|
|
|
852
|
-
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-
|
|
867
|
+
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-381456f1.cjs.prod.js' /* webpackChunkName: "active-drag-drop-area" */); }));
|
|
853
868
|
|
|
854
869
|
var DisabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./disabled-drop-area-99c1fa0b.cjs.prod.js' /* webpackChunkName: "disabled-drop-area" */); }));
|
|
855
870
|
|
|
856
|
-
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-
|
|
871
|
+
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-0147fe23.cjs.prod.js' /* webpackChunkName: "enabled-drop-area" */); }));
|
|
857
872
|
|
|
858
|
-
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-
|
|
873
|
+
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-f3d703d5.cjs.prod.js' /* webpackChunkName: "filed-dropped-area" */); }));
|
|
859
874
|
|
|
860
875
|
function getDropArea(_ref) {
|
|
861
876
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -1026,22 +1041,22 @@ const FileDropArea = () => {
|
|
|
1026
1041
|
};
|
|
1027
1042
|
|
|
1028
1043
|
var sharedMessages = reactIntl.defineMessages({
|
|
1029
|
-
[
|
|
1044
|
+
["modalTitle.".concat(IMPORTABLE_RESOURCES.CATEGORY)]: {
|
|
1030
1045
|
id: 'ImportResourcesModal.modalTitle.category',
|
|
1031
1046
|
description: 'Label for the categories modal title',
|
|
1032
1047
|
defaultMessage: 'Import categories by CSV'
|
|
1033
1048
|
},
|
|
1034
|
-
[
|
|
1049
|
+
["modalTitle.".concat(IMPORTABLE_RESOURCES.PRODUCT)]: {
|
|
1035
1050
|
id: 'ImportResourcesModal.modalTitle.product',
|
|
1036
1051
|
description: 'Label for the products modal title',
|
|
1037
1052
|
defaultMessage: 'Import products by CSV'
|
|
1038
1053
|
},
|
|
1039
|
-
[
|
|
1054
|
+
["modalTitle.".concat(IMPORTABLE_RESOURCES.INVENTORY)]: {
|
|
1040
1055
|
id: 'ImportResourcesModal.modalTitle.inventoryEntry',
|
|
1041
1056
|
description: 'Label for the inventories modal title',
|
|
1042
1057
|
defaultMessage: 'Import inventories by CSV'
|
|
1043
1058
|
},
|
|
1044
|
-
[
|
|
1059
|
+
["modalTitle.".concat(IMPORTABLE_RESOURCES.DISCOUNT_CODE)]: {
|
|
1045
1060
|
id: 'ImportResourcesModal.modalTitle.discountCode',
|
|
1046
1061
|
description: 'Label for the inventories modal title',
|
|
1047
1062
|
defaultMessage: 'Import discount codes by CSV'
|
|
@@ -1064,6 +1079,7 @@ var sharedMessages = reactIntl.defineMessages({
|
|
|
1064
1079
|
});
|
|
1065
1080
|
|
|
1066
1081
|
const Upload = () => {
|
|
1082
|
+
var _context;
|
|
1067
1083
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1068
1084
|
state = _useImportResourcesCo.state,
|
|
1069
1085
|
onClose = _useImportResourcesCo.onClose,
|
|
@@ -1075,7 +1091,7 @@ const Upload = () => {
|
|
|
1075
1091
|
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
1076
1092
|
size: 16,
|
|
1077
1093
|
isOpen: true,
|
|
1078
|
-
title: intl.formatMessage(sharedMessages[
|
|
1094
|
+
title: intl.formatMessage(sharedMessages["modalTitle.".concat(state.resourceType)]),
|
|
1079
1095
|
labelPrimary: intl.formatMessage(sharedMessages.uploadButton),
|
|
1080
1096
|
onPrimaryButtonClick: handleUploadAndValidation,
|
|
1081
1097
|
isPrimaryButtonDisabled: !Boolean(state.droppedFile),
|
|
@@ -1089,7 +1105,7 @@ const Upload = () => {
|
|
|
1089
1105
|
scale: "l",
|
|
1090
1106
|
children: [isMultipleResourceTypes ? jsxRuntime.jsxs(uiKit.Grid, {
|
|
1091
1107
|
gridRowGap: uiKit.designTokens.spacingL,
|
|
1092
|
-
gridTemplateColumns:
|
|
1108
|
+
gridTemplateColumns: _concatInstanceProperty__default["default"](_context = "calc(".concat(uiKit.designTokens.constraint3, " + ")).call(_context, uiKit.designTokens.spacingL, ") auto"),
|
|
1093
1109
|
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1094
1110
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1095
1111
|
isBold: true,
|
|
@@ -1238,7 +1254,7 @@ function UploadPreviewModal() {
|
|
|
1238
1254
|
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
1239
1255
|
size: 16,
|
|
1240
1256
|
isOpen: true,
|
|
1241
|
-
title: intl.formatMessage(sharedMessages[
|
|
1257
|
+
title: intl.formatMessage(sharedMessages["modalTitle.".concat(state.resourceType)]),
|
|
1242
1258
|
labelPrimary: intl.formatMessage(messages$3.continue),
|
|
1243
1259
|
onSecondaryButtonClick: () => onClose({
|
|
1244
1260
|
shouldDeleteImportContainer: true
|
|
@@ -1329,19 +1345,23 @@ function ownKeys$7(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
1329
1345
|
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; }
|
|
1330
1346
|
const getNewLine = () => jsxRuntime.jsx("br", {});
|
|
1331
1347
|
const getImportLogsLink = (msg, projectKey) => jsxRuntime.jsx(uiKit.Link, {
|
|
1332
|
-
to:
|
|
1348
|
+
to: "/".concat(projectKey, "/operations/import/logs"),
|
|
1333
1349
|
children: msg
|
|
1334
1350
|
});
|
|
1335
1351
|
const ImportConfirmationModal = () => {
|
|
1352
|
+
var _state$uploadFileResp;
|
|
1336
1353
|
const intl = reactIntl.useIntl();
|
|
1337
1354
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1338
1355
|
state = _useImportResourcesCo.state,
|
|
1339
1356
|
onStartImportSuccess = _useImportResourcesCo.onStartImportSuccess,
|
|
1340
1357
|
onClose = _useImportResourcesCo.onClose;
|
|
1341
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context =>
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1358
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => {
|
|
1359
|
+
var _context$project, _context$project2;
|
|
1360
|
+
return {
|
|
1361
|
+
projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key,
|
|
1362
|
+
projectName: (_context$project2 = context.project) === null || _context$project2 === void 0 ? void 0 : _context$project2.name
|
|
1363
|
+
};
|
|
1364
|
+
}),
|
|
1345
1365
|
projectKey = _useApplicationContex.projectKey,
|
|
1346
1366
|
projectName = _useApplicationContex.projectName;
|
|
1347
1367
|
const asyncDispatch = sdk.useAsyncDispatch();
|
|
@@ -1356,7 +1376,7 @@ const ImportConfirmationModal = () => {
|
|
|
1356
1376
|
})
|
|
1357
1377
|
});
|
|
1358
1378
|
return jsxRuntime.jsx(applicationComponents.ConfirmationDialog, {
|
|
1359
|
-
title: intl.formatMessage(sharedMessages[
|
|
1379
|
+
title: intl.formatMessage(sharedMessages["modalTitle.".concat(state.resourceType)]),
|
|
1360
1380
|
labelPrimary: intl.formatMessage(messages$3.startImportButton),
|
|
1361
1381
|
isOpen: true,
|
|
1362
1382
|
onClose: () => onClose({
|
|
@@ -1373,7 +1393,8 @@ const ImportConfirmationModal = () => {
|
|
|
1373
1393
|
},
|
|
1374
1394
|
onConfirm: async () => {
|
|
1375
1395
|
try {
|
|
1376
|
-
|
|
1396
|
+
var _state$droppedFile;
|
|
1397
|
+
const canConfirm = projectKey && state.containerKey && ((_state$droppedFile = state.droppedFile) === null || _state$droppedFile === void 0 ? void 0 : _state$droppedFile.name) && state.resourceType;
|
|
1377
1398
|
if (!canConfirm) return;
|
|
1378
1399
|
onClose();
|
|
1379
1400
|
await processUploadedFile({
|
|
@@ -1410,7 +1431,7 @@ const ImportConfirmationModal = () => {
|
|
|
1410
1431
|
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$3.confirmationBodyText), {}, {
|
|
1411
1432
|
values: {
|
|
1412
1433
|
projectName: projectName,
|
|
1413
|
-
count: intl.formatNumber(state
|
|
1434
|
+
count: intl.formatNumber((state === null || state === void 0 || (_state$uploadFileResp = state.uploadFileResponse) === null || _state$uploadFileResp === void 0 ? void 0 : _state$uploadFileResp.rowsCount) || 0),
|
|
1414
1435
|
bold: getBold$2
|
|
1415
1436
|
}
|
|
1416
1437
|
})
|
|
@@ -1518,6 +1539,7 @@ function itemRenderer$1(item, column) {
|
|
|
1518
1539
|
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; }
|
|
1519
1540
|
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; }
|
|
1520
1541
|
const UploadClientSideErrorsModal = () => {
|
|
1542
|
+
var _state$droppedFile;
|
|
1521
1543
|
const intl = reactIntl.useIntl();
|
|
1522
1544
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1523
1545
|
state = _useImportResourcesCo.state,
|
|
@@ -1527,14 +1549,14 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1527
1549
|
return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1528
1550
|
size: 16,
|
|
1529
1551
|
isOpen: true,
|
|
1530
|
-
title: intl.formatMessage(sharedMessages[
|
|
1552
|
+
title: intl.formatMessage(sharedMessages["modalTitle.".concat(state.resourceType)]),
|
|
1531
1553
|
onClose: () => onClose(),
|
|
1532
1554
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1533
1555
|
scale: "l",
|
|
1534
1556
|
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1535
1557
|
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$2.uploadingError), {}, {
|
|
1536
1558
|
values: {
|
|
1537
|
-
fileName: state.droppedFile
|
|
1559
|
+
fileName: (_state$droppedFile = state.droppedFile) === null || _state$droppedFile === void 0 ? void 0 : _state$droppedFile.name,
|
|
1538
1560
|
errorsCount: intl.formatNumber(errorsCount),
|
|
1539
1561
|
b: getBold$1
|
|
1540
1562
|
}
|
|
@@ -1630,17 +1652,18 @@ function itemRenderer(item, column) {
|
|
|
1630
1652
|
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; }
|
|
1631
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__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; }
|
|
1632
1654
|
const UploadServerSideErrorsModal = () => {
|
|
1655
|
+
var _state$uploadFileResp, _state$droppedFile, _state$uploadFileResp2;
|
|
1633
1656
|
const intl = reactIntl.useIntl();
|
|
1634
1657
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1635
1658
|
state = _useImportResourcesCo.state,
|
|
1636
1659
|
actions = _useImportResourcesCo.actions,
|
|
1637
1660
|
onClose = _useImportResourcesCo.onClose;
|
|
1638
|
-
const errorsCount = getFileUploadErrorsCount(state.uploadFileResponse
|
|
1661
|
+
const errorsCount = getFileUploadErrorsCount((_state$uploadFileResp = state.uploadFileResponse) === null || _state$uploadFileResp === void 0 ? void 0 : _state$uploadFileResp.results);
|
|
1639
1662
|
const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
|
|
1640
1663
|
return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1641
1664
|
size: 16,
|
|
1642
1665
|
isOpen: true,
|
|
1643
|
-
title: intl.formatMessage(sharedMessages[
|
|
1666
|
+
title: intl.formatMessage(sharedMessages["modalTitle.".concat(state.resourceType)]),
|
|
1644
1667
|
onClose: onClose,
|
|
1645
1668
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1646
1669
|
scale: "l",
|
|
@@ -1649,7 +1672,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1649
1672
|
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1650
1673
|
intlMessage: _objectSpread$3(_objectSpread$3({}, messages$2.uploadingError), {}, {
|
|
1651
1674
|
values: {
|
|
1652
|
-
fileName: state.droppedFile
|
|
1675
|
+
fileName: (_state$droppedFile = state.droppedFile) === null || _state$droppedFile === void 0 ? void 0 : _state$droppedFile.name,
|
|
1653
1676
|
errorsCount: intl.formatNumber(errorsCount),
|
|
1654
1677
|
b: getBold
|
|
1655
1678
|
}
|
|
@@ -1667,7 +1690,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1667
1690
|
})
|
|
1668
1691
|
})]
|
|
1669
1692
|
}), jsxRuntime.jsx(UploadServerSideErrorTable, {
|
|
1670
|
-
rows: mapUploadFileErrorsResponseToUploadFileErrorRows(state.uploadFileResponse
|
|
1693
|
+
rows: mapUploadFileErrorsResponseToUploadFileErrorRows((_state$uploadFileResp2 = state.uploadFileResponse) === null || _state$uploadFileResp2 === void 0 ? void 0 : _state$uploadFileResp2.results)
|
|
1671
1694
|
}), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1672
1695
|
scale: "m",
|
|
1673
1696
|
justifyContent: "flex-end",
|
|
@@ -1692,10 +1715,11 @@ function getBold(msg) {
|
|
|
1692
1715
|
}
|
|
1693
1716
|
|
|
1694
1717
|
const UploadResult = () => {
|
|
1718
|
+
var _state$uploadFileResp;
|
|
1695
1719
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1696
1720
|
state = _useImportResourcesCo.state;
|
|
1697
1721
|
if (state.fileUploadClientSideErrors.length > 0) return jsxRuntime.jsx(UploadClientSideErrorsModal, {});
|
|
1698
|
-
if (state.uploadFileResponse
|
|
1722
|
+
if (((_state$uploadFileResp = state.uploadFileResponse) === null || _state$uploadFileResp === void 0 ? void 0 : _state$uploadFileResp.invalid) > 0) return jsxRuntime.jsx(UploadServerSideErrorsModal, {});
|
|
1699
1723
|
return jsxRuntime.jsx(UploadPreviewModal, {});
|
|
1700
1724
|
};
|
|
1701
1725
|
|
|
@@ -1733,15 +1757,16 @@ FileIcon.defaultProps = {
|
|
|
1733
1757
|
xmlns: "http://www.w3.org/2000/svg"
|
|
1734
1758
|
};
|
|
1735
1759
|
const Uploading = () => {
|
|
1760
|
+
var _state$droppedFile;
|
|
1736
1761
|
const intl = reactIntl.useIntl();
|
|
1737
1762
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1738
1763
|
state = _useImportResourcesCo.state,
|
|
1739
1764
|
actions = _useImportResourcesCo.actions,
|
|
1740
1765
|
onClose = _useImportResourcesCo.onClose;
|
|
1741
|
-
if (state.droppedFile
|
|
1766
|
+
if ((_state$droppedFile = state.droppedFile) !== null && _state$droppedFile !== void 0 && _state$droppedFile.name) return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1742
1767
|
size: 16,
|
|
1743
1768
|
isOpen: true,
|
|
1744
|
-
title: intl.formatMessage(sharedMessages[
|
|
1769
|
+
title: intl.formatMessage(sharedMessages["modalTitle.".concat(state.resourceType)]),
|
|
1745
1770
|
onClose: () => onClose({
|
|
1746
1771
|
shouldDeleteImportContainer: true
|
|
1747
1772
|
}),
|
|
@@ -1823,7 +1848,7 @@ const resourceTypeToDisplayName = resourceType => {
|
|
|
1823
1848
|
case IMPORTABLE_RESOURCES.CATEGORY:
|
|
1824
1849
|
return messages$1.categories;
|
|
1825
1850
|
default:
|
|
1826
|
-
throw new Error(
|
|
1851
|
+
throw new Error("Unknown resource type: ".concat(resourceType));
|
|
1827
1852
|
}
|
|
1828
1853
|
};
|
|
1829
1854
|
const ResourceTypeSelection = () => {
|
|
@@ -1912,8 +1937,8 @@ const loadMessages = async locale => {
|
|
|
1912
1937
|
return i18n.parseChunkImport(chunkImport);
|
|
1913
1938
|
} catch (error) {
|
|
1914
1939
|
// eslint-disable-next-line no-console
|
|
1915
|
-
console.warn(
|
|
1916
|
-
sentry.reportErrorToSentry(new Error(
|
|
1940
|
+
console.warn("Something went wrong while loading the import-resources-modal messages for ".concat(locale), error);
|
|
1941
|
+
sentry.reportErrorToSentry(new Error("Something went wrong while loading the import-resources-modal messages for ".concat(locale)), {
|
|
1917
1942
|
extra: error
|
|
1918
1943
|
});
|
|
1919
1944
|
return {};
|
|
@@ -1958,14 +1983,14 @@ const useAsyncIntlMessages = (locale, loader) => {
|
|
|
1958
1983
|
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; }
|
|
1959
1984
|
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; }
|
|
1960
1985
|
const ImportResourcesModal = props => {
|
|
1961
|
-
var _context;
|
|
1986
|
+
var _props$resourceTypes, _context;
|
|
1962
1987
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
1963
1988
|
locale: context.user && context.user.locale
|
|
1964
1989
|
})),
|
|
1965
1990
|
locale = _useApplicationContex.locale;
|
|
1966
1991
|
const messages = useAsyncIntlMessages(locale, loadMessages);
|
|
1967
1992
|
if (!props.isOpen || messages.isLoading) return null;
|
|
1968
|
-
if (!props.resourceTypes
|
|
1993
|
+
if (!((_props$resourceTypes = props.resourceTypes) !== null && _props$resourceTypes !== void 0 && _props$resourceTypes.length)) {
|
|
1969
1994
|
console.error('No resource types provided for import resources modal');
|
|
1970
1995
|
return null;
|
|
1971
1996
|
}
|