@commercetools-frontend-extensions/import-resources-modal 1.0.7 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/{active-drag-drop-area-427ef7c2.cjs.dev.js → active-drag-drop-area-1cac282b.cjs.prod.js} +4 -5
- package/dist/{active-drag-drop-area-f930d60d.cjs.prod.js → active-drag-drop-area-8ee86fd4.cjs.dev.js} +4 -5
- package/dist/{active-drag-drop-area-f7b6d1a7.esm.js → active-drag-drop-area-eb0b8dad.esm.js} +4 -5
- package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.dev.js +4 -5
- package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.prod.js +4 -5
- package/dist/commercetools-frontend-extensions-import-resources-modal.esm.js +4 -5
- package/dist/declarations/src/@types/import-resources-modal-props.d.ts +1 -1
- package/dist/declarations/src/import-resources-modal.d.ts +1 -1
- package/dist/{enabled-drop-area-efc31de0.cjs.dev.js → enabled-drop-area-a1260be0.cjs.dev.js} +4 -5
- package/dist/{enabled-drop-area-20dad798.esm.js → enabled-drop-area-fc9c086c.esm.js} +4 -5
- package/dist/{enabled-drop-area-6b9b6762.cjs.prod.js → enabled-drop-area-fd89b405.cjs.prod.js} +4 -5
- package/dist/{file-dropped-area-89f07d26.esm.js → file-dropped-area-2c96a537.esm.js} +4 -6
- package/dist/{file-dropped-area-dfd7b665.cjs.dev.js → file-dropped-area-8aae58b3.cjs.dev.js} +4 -6
- package/dist/{file-dropped-area-98af1296.cjs.prod.js → file-dropped-area-da127fa5.cjs.prod.js} +4 -6
- package/dist/{index-c1ea2041.cjs.dev.js → index-369f6a23.cjs.dev.js} +273 -192
- package/dist/{index-c4f11e0f.esm.js → index-851dade8.esm.js} +272 -190
- package/dist/{index-28eb8566.cjs.prod.js → index-f801ad59.cjs.prod.js} +273 -192
- package/package.json +1 -1
|
@@ -9,14 +9,13 @@ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-
|
|
|
9
9
|
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
10
10
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
11
11
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
12
|
+
var _everyInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/every');
|
|
12
13
|
var reactIntl = require('react-intl');
|
|
13
14
|
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
14
15
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
15
16
|
var React = require('react');
|
|
16
17
|
var sdk = require('@commercetools-frontend/sdk');
|
|
17
18
|
var constants = require('@commercetools-frontend/constants');
|
|
18
|
-
var _everyInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/every');
|
|
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');
|
|
@@ -61,9 +60,8 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachIns
|
|
|
61
60
|
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
|
|
62
61
|
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
63
62
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
64
|
-
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
65
63
|
var _everyInstanceProperty__default = /*#__PURE__*/_interopDefault(_everyInstanceProperty);
|
|
66
|
-
var
|
|
64
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
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(
|
|
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 =
|
|
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:
|
|
125
|
-
inventory:
|
|
126
|
-
product:
|
|
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
|
|
251
|
+
return `/${projectKey}/import-containers`;
|
|
255
252
|
}
|
|
256
253
|
function getDeleteImportContainerURL(projectKey, containerKey) {
|
|
257
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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 =
|
|
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
|
|
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 =
|
|
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
|
|
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 =
|
|
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
|
|
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 =
|
|
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
|
|
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
|
-
|
|
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
|
|
338
|
+
}, config?.headers)
|
|
351
339
|
});
|
|
352
340
|
const xhr = new XMLHttpRequest();
|
|
353
|
-
xhr.open(config
|
|
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
|
|
358
|
-
_forEachInstanceProperty__default["default"](
|
|
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
|
|
515
|
+
return `Unkown type: ${actionType}`;
|
|
528
516
|
}
|
|
529
517
|
const initialState = {
|
|
530
518
|
currentStep: 1,
|
|
@@ -541,16 +529,13 @@ 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
|
-
|
|
546
|
-
|
|
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), {}, {
|
|
553
|
-
resourceType: props.
|
|
538
|
+
resourceType: props.resourceTypes[0]
|
|
554
539
|
})),
|
|
555
540
|
_React$useReducer2 = _slicedToArray(_React$useReducer, 2),
|
|
556
541
|
state = _React$useReducer2[0],
|
|
@@ -559,13 +544,13 @@ const ImportResourcesProvider = props => {
|
|
|
559
544
|
type: 'setCurrentStep',
|
|
560
545
|
currentStep
|
|
561
546
|
});
|
|
562
|
-
const setUploadFileResponse =
|
|
547
|
+
const setUploadFileResponse = uploadFileResponse => dispatch({
|
|
563
548
|
type: 'setUploadFileResponse',
|
|
564
|
-
uploadFileResponse:
|
|
549
|
+
uploadFileResponse: uploadFileResponse
|
|
565
550
|
});
|
|
566
|
-
const setResourceType =
|
|
551
|
+
const setResourceType = resourceType => dispatch({
|
|
567
552
|
type: 'setResourceType',
|
|
568
|
-
resourceType:
|
|
553
|
+
resourceType: resourceType
|
|
569
554
|
});
|
|
570
555
|
const setContainerKey = containerKey => dispatch({
|
|
571
556
|
type: 'setContainerKey',
|
|
@@ -577,17 +562,17 @@ const ImportResourcesProvider = props => {
|
|
|
577
562
|
const uploadNewFile = () => dispatch({
|
|
578
563
|
type: 'uploadNewFile'
|
|
579
564
|
});
|
|
580
|
-
const setDroppedFile =
|
|
565
|
+
const setDroppedFile = droppedFile => dispatch({
|
|
581
566
|
type: 'setDroppedFile',
|
|
582
|
-
droppedFile:
|
|
567
|
+
droppedFile: droppedFile
|
|
583
568
|
});
|
|
584
|
-
const setAbortController =
|
|
569
|
+
const setAbortController = abortController => dispatch({
|
|
585
570
|
type: 'setAbortController',
|
|
586
|
-
abortController:
|
|
571
|
+
abortController: abortController
|
|
587
572
|
});
|
|
588
|
-
const setFileUploadClientSideErrors =
|
|
573
|
+
const setFileUploadClientSideErrors = fileUploadClientSideErrors => dispatch({
|
|
589
574
|
type: 'setFileUploadClientSideErrors',
|
|
590
|
-
fileUploadClientSideErrors:
|
|
575
|
+
fileUploadClientSideErrors: fileUploadClientSideErrors
|
|
591
576
|
});
|
|
592
577
|
const setProgress = progress => dispatch({
|
|
593
578
|
type: 'setProgress',
|
|
@@ -607,6 +592,7 @@ const ImportResourcesProvider = props => {
|
|
|
607
592
|
return jsxRuntime.jsx(ImportResourcesContext.Provider, {
|
|
608
593
|
value: {
|
|
609
594
|
state,
|
|
595
|
+
resourceTypes: props.resourceTypes,
|
|
610
596
|
onClose: handleClose,
|
|
611
597
|
onStartImportSuccess: handleStartImportSuccess,
|
|
612
598
|
actions: {
|
|
@@ -634,7 +620,7 @@ function useImportResourcesContext() {
|
|
|
634
620
|
return context;
|
|
635
621
|
}
|
|
636
622
|
|
|
637
|
-
var messages$
|
|
623
|
+
var messages$5 = reactIntl.defineMessages({
|
|
638
624
|
fileSizeExceededTitle: {
|
|
639
625
|
id: 'ImportResourcesModal.sizeExceededTitle',
|
|
640
626
|
defaultMessage: 'File size exceeded'
|
|
@@ -681,10 +667,7 @@ var messages$3 = reactIntl.defineMessages({
|
|
|
681
667
|
|
|
682
668
|
const useUpload = () => {
|
|
683
669
|
const intl = reactIntl.useIntl();
|
|
684
|
-
const projectKey = applicationShellConnectors.useApplicationContext(context =>
|
|
685
|
-
var _context$project;
|
|
686
|
-
return (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key;
|
|
687
|
-
});
|
|
670
|
+
const projectKey = applicationShellConnectors.useApplicationContext(context => context.project?.key);
|
|
688
671
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
689
672
|
state = _useImportResourcesCo.state,
|
|
690
673
|
actions = _useImportResourcesCo.actions;
|
|
@@ -699,25 +682,25 @@ const useUpload = () => {
|
|
|
699
682
|
const errors = [];
|
|
700
683
|
const delimiterCheck = await checkDelimiter(file);
|
|
701
684
|
if (!delimiterCheck.isValid) errors.push({
|
|
702
|
-
title: intl.formatMessage(messages$
|
|
703
|
-
description: intl.formatMessage(messages$
|
|
685
|
+
title: intl.formatMessage(messages$5.dropAreaWrongDelimiterTitle),
|
|
686
|
+
description: intl.formatMessage(messages$5.dropAreaWrongDelimiterDescription, {
|
|
704
687
|
delimiter: delimiterCheck.delimiter
|
|
705
688
|
})
|
|
706
689
|
});
|
|
707
690
|
const rowCount = await getRowCount(file);
|
|
708
691
|
if (rowCount < 1) errors.push({
|
|
709
|
-
title: intl.formatMessage(messages$
|
|
710
|
-
description: intl.formatMessage(messages$
|
|
692
|
+
title: intl.formatMessage(messages$5.dropAreaNotEnoughRowsTitle),
|
|
693
|
+
description: intl.formatMessage(messages$5.dropAreaNotEnoughRowsDescription)
|
|
711
694
|
});
|
|
712
695
|
if (state.resourceType && file.size > toBytes(FILE_SIZE_LIMITS_MB[state.resourceType])) errors.push({
|
|
713
|
-
title: intl.formatMessage(messages$
|
|
714
|
-
description: intl.formatMessage(messages$
|
|
696
|
+
title: intl.formatMessage(messages$5.fileSizeExceededTitle),
|
|
697
|
+
description: intl.formatMessage(messages$5.fileSizeExceededDescription, {
|
|
715
698
|
fileSizeLimit: intl.formatNumber(FILE_SIZE_LIMITS_MB[state.resourceType])
|
|
716
699
|
})
|
|
717
700
|
});
|
|
718
701
|
if (state.resourceType && rowCount > ROW_LIMITS[state.resourceType]) errors.push({
|
|
719
|
-
title: intl.formatMessage(messages$
|
|
720
|
-
description: intl.formatMessage(messages$
|
|
702
|
+
title: intl.formatMessage(messages$5.rowLimitExceededTitle),
|
|
703
|
+
description: intl.formatMessage(messages$5.rowLimitExceededDescription, {
|
|
721
704
|
rowLimit: intl.formatNumber(ROW_LIMITS[state.resourceType])
|
|
722
705
|
})
|
|
723
706
|
});
|
|
@@ -734,26 +717,24 @@ const useUpload = () => {
|
|
|
734
717
|
return;
|
|
735
718
|
}
|
|
736
719
|
if (error instanceof HttpError) {
|
|
737
|
-
|
|
738
|
-
if (((_error$errorData = error.errorData) === null || _error$errorData === void 0 ? void 0 : _error$errorData.code) === 'MISSING_KEY_ERROR') {
|
|
720
|
+
if (error.errorData?.code === 'MISSING_KEY_ERROR') {
|
|
739
721
|
actions.cancelImport();
|
|
740
722
|
showNotification({
|
|
741
723
|
kind: 'error',
|
|
742
724
|
domain: constants.DOMAINS.PAGE,
|
|
743
725
|
text: error.errorData.message
|
|
744
726
|
});
|
|
745
|
-
} else if (
|
|
727
|
+
} else if (error.errorData?.invalid > 0) {
|
|
746
728
|
actions.setUploadFileResponse(error.errorData);
|
|
747
729
|
} else {
|
|
748
730
|
actions.cancelImport();
|
|
749
731
|
showNotification({
|
|
750
732
|
kind: 'error',
|
|
751
733
|
domain: constants.DOMAINS.PAGE,
|
|
752
|
-
text: intl.formatMessage(messages$
|
|
734
|
+
text: intl.formatMessage(messages$5.unexpectedError)
|
|
753
735
|
});
|
|
754
736
|
}
|
|
755
737
|
} else {
|
|
756
|
-
var _state$droppedFile;
|
|
757
738
|
actions.cancelImport();
|
|
758
739
|
showNotification({
|
|
759
740
|
kind: 'error',
|
|
@@ -766,7 +747,7 @@ const useUpload = () => {
|
|
|
766
747
|
projectKey,
|
|
767
748
|
containerKey: state.containerKey,
|
|
768
749
|
resourceType: state.resourceType,
|
|
769
|
-
fileSizeInBytes:
|
|
750
|
+
fileSizeInBytes: state.droppedFile?.size
|
|
770
751
|
}
|
|
771
752
|
});
|
|
772
753
|
}
|
|
@@ -813,7 +794,7 @@ const useUpload = () => {
|
|
|
813
794
|
};
|
|
814
795
|
};
|
|
815
796
|
|
|
816
|
-
function resourceTypeToDisplayName(_ref) {
|
|
797
|
+
function resourceTypeToDisplayName$1(_ref) {
|
|
817
798
|
let resourceType = _ref.resourceType,
|
|
818
799
|
_ref$isUpperCase = _ref.isUpperCase,
|
|
819
800
|
isUpperCase = _ref$isUpperCase === void 0 ? false : _ref$isUpperCase,
|
|
@@ -827,6 +808,9 @@ function resourceTypeToDisplayName(_ref) {
|
|
|
827
808
|
case 'product':
|
|
828
809
|
displayName = isPlural ? 'Products' : 'Product';
|
|
829
810
|
break;
|
|
811
|
+
case 'inventory':
|
|
812
|
+
displayName = isPlural ? 'Inventories' : 'Inventory';
|
|
813
|
+
break;
|
|
830
814
|
default:
|
|
831
815
|
throw new UnexpectedResourceTypeError(resourceType);
|
|
832
816
|
}
|
|
@@ -844,8 +828,12 @@ const getBorderColor = state => {
|
|
|
844
828
|
const getDashedBorder = function () {
|
|
845
829
|
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
|
|
846
830
|
const color = getBorderColor(state);
|
|
847
|
-
const svgContent =
|
|
848
|
-
|
|
831
|
+
const svgContent = `
|
|
832
|
+
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
|
|
833
|
+
<rect width="100%" height="100%" fill="none" stroke="${color}" stroke-width="2px" stroke-dasharray="6,6" stroke-dashoffset="0" stroke-linecap="square"/>
|
|
834
|
+
</svg>
|
|
835
|
+
`;
|
|
836
|
+
return `data:image/svg+xml,${encodeURIComponent(svgContent)}`;
|
|
849
837
|
};
|
|
850
838
|
const base = /*#__PURE__*/react.css("border-radius:", uiKit.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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUF5QmdCIiwiZmlsZSI6InN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0J1xuaW1wb3J0IHsgY3VzdG9tUHJvcGVydGllcyB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLWZyb250ZW5kL3VpLWtpdCdcblxudHlwZSBEcm9wQXJlYVN0YXRlID0gJ2RlZmF1bHQnIHwgJ2Vycm9yJyB8ICdhY3RpdmUnXG5cbmNvbnN0IGdldEJvcmRlckNvbG9yID0gKHN0YXRlOiBEcm9wQXJlYVN0YXRlKSA9PiB7XG4gIGNvbnN0IGJvcmRlckNvbG9ycyA9IHtcbiAgICBkZWZhdWx0OiAnIzkwOWRiYycsXG4gICAgZXJyb3I6ICcjZTYwMDUwJyxcbiAgICBhY3RpdmU6IGN1c3RvbVByb3BlcnRpZXMuY29sb3JQcmltYXJ5LFxuICB9XG5cbiAgcmV0dXJuIGJvcmRlckNvbG9yc1tzdGF0ZV0gfHwgYm9yZGVyQ29sb3JzLmRlZmF1bHRcbn1cblxuY29uc3QgZ2V0RGFzaGVkQm9yZGVyID0gKHN0YXRlOiBEcm9wQXJlYVN0YXRlID0gJ2RlZmF1bHQnKSA9PiB7XG4gIGNvbnN0IGNvbG9yID0gZ2V0Qm9yZGVyQ29sb3Ioc3RhdGUpXG4gIGNvbnN0IHN2Z0NvbnRlbnQgPSBgXG4gICAgPHN2ZyB3aWR0aD1cIjEwMCVcIiBoZWlnaHQ9XCIxMDAlXCIgeG1sbnM9XCJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Z1wiPlxuICAgICAgPHJlY3Qgd2lkdGg9XCIxMDAlXCIgaGVpZ2h0PVwiMTAwJVwiIGZpbGw9XCJub25lXCIgc3Ryb2tlPVwiJHtjb2xvcn1cIiBzdHJva2Utd2lkdGg9XCIycHhcIiBzdHJva2UtZGFzaGFycmF5PVwiNiw2XCIgc3Ryb2tlLWRhc2hvZmZzZXQ9XCIwXCIgc3Ryb2tlLWxpbmVjYXA9XCJzcXVhcmVcIi8+XG4gICAgPC9zdmc+XG4gIGBcbiAgcmV0dXJuIGBkYXRhOmltYWdlL3N2Zyt4bWwsJHtlbmNvZGVVUklDb21wb25lbnQoc3ZnQ29udGVudCl9YFxufVxuXG5jb25zdCBiYXNlID0gY3NzYFxuICBib3JkZXItcmFkaXVzOiAke2N1c3RvbVByb3BlcnRpZXMuYm9yZGVyUmFkaXVzNn07XG4gIG1pbi1oZWlnaHQ6IDEzNnB4O1xuICBkaXNwbGF5OiBmbGV4O1xuICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcbiAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbmBcbmNvbnN0IGRpc2FibGVkID0gY3NzYGBcbmNvbnN0IHJlYWR5Rm9yRHJvcCA9IGNzc2BcbiAgYmFja2dyb3VuZC1pbWFnZTogdXJsKFxcXCIke2dldERhc2hlZEJvcmRlcigpfVxcXCIpO1xuICBiYWNrZ3JvdW5kLWNvbG9yOiAke2N1c3RvbVByb3BlcnRpZXMuY29sb3JTdXJmYWNlfTtcbmBcbmNvbnN0IGFjdGl2ZURyYWcgPSBjc3NgXG4gIGJhY2tncm91bmQtaW1hZ2U6IHVybChcXFwiJHtnZXREYXNoZWRCb3JkZXIoJ2FjdGl2ZScpfVxcXCIpO1xuICBiYWNrZ3JvdW5kLWNvbG9yOiAke2N1c3RvbVByb3BlcnRpZXMuY29sb3JQcmltYXJ5OTV9O1xuICBwYWRkaW5nOiAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZzUwfSAxMDBweDtcbmBcbmNvbnN0IGZpbGVEcm9wcGVkID0gY3NzYFxuICBiYWNrZ3JvdW5kLWltYWdlOiB1cmwoXFxcIiR7Z2V0RGFzaGVkQm9yZGVyKCl9XFxcIik7XG4gIGJhY2tncm91bmQtY29sb3I6ICR7Y3VzdG9tUHJvcGVydGllcy5jb2xvclN1cmZhY2V9O1xuICBwYWRkaW5nOiAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZzUwfSAxMDBweDtcbmBcblxuZXhwb3J0IGNvbnN0IHN0eWxlcyA9IHtcbiAgYmFzZSxcbiAgcmVhZHlGb3JEcm9wLFxuICBmaWxlRHJvcHBlZCxcbiAgZGlzYWJsZWQsXG4gIGFjdGl2ZURyYWcsXG59XG4iXX0= */");
|
|
851
839
|
const disabled = /*#__PURE__*/react.css(process.env.NODE_ENV === "production" ? "" : ";label:disabled;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFnQ29CIiwiZmlsZSI6InN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0J1xuaW1wb3J0IHsgY3VzdG9tUHJvcGVydGllcyB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLWZyb250ZW5kL3VpLWtpdCdcblxudHlwZSBEcm9wQXJlYVN0YXRlID0gJ2RlZmF1bHQnIHwgJ2Vycm9yJyB8ICdhY3RpdmUnXG5cbmNvbnN0IGdldEJvcmRlckNvbG9yID0gKHN0YXRlOiBEcm9wQXJlYVN0YXRlKSA9PiB7XG4gIGNvbnN0IGJvcmRlckNvbG9ycyA9IHtcbiAgICBkZWZhdWx0OiAnIzkwOWRiYycsXG4gICAgZXJyb3I6ICcjZTYwMDUwJyxcbiAgICBhY3RpdmU6IGN1c3RvbVByb3BlcnRpZXMuY29sb3JQcmltYXJ5LFxuICB9XG5cbiAgcmV0dXJuIGJvcmRlckNvbG9yc1tzdGF0ZV0gfHwgYm9yZGVyQ29sb3JzLmRlZmF1bHRcbn1cblxuY29uc3QgZ2V0RGFzaGVkQm9yZGVyID0gKHN0YXRlOiBEcm9wQXJlYVN0YXRlID0gJ2RlZmF1bHQnKSA9PiB7XG4gIGNvbnN0IGNvbG9yID0gZ2V0Qm9yZGVyQ29sb3Ioc3RhdGUpXG4gIGNvbnN0IHN2Z0NvbnRlbnQgPSBgXG4gICAgPHN2ZyB3aWR0aD1cIjEwMCVcIiBoZWlnaHQ9XCIxMDAlXCIgeG1sbnM9XCJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Z1wiPlxuICAgICAgPHJlY3Qgd2lkdGg9XCIxMDAlXCIgaGVpZ2h0PVwiMTAwJVwiIGZpbGw9XCJub25lXCIgc3Ryb2tlPVwiJHtjb2xvcn1cIiBzdHJva2Utd2lkdGg9XCIycHhcIiBzdHJva2UtZGFzaGFycmF5PVwiNiw2XCIgc3Ryb2tlLWRhc2hvZmZzZXQ9XCIwXCIgc3Ryb2tlLWxpbmVjYXA9XCJzcXVhcmVcIi8+XG4gICAgPC9zdmc+XG4gIGBcbiAgcmV0dXJuIGBkYXRhOmltYWdlL3N2Zyt4bWwsJHtlbmNvZGVVUklDb21wb25lbnQoc3ZnQ29udGVudCl9YFxufVxuXG5jb25zdCBiYXNlID0gY3NzYFxuICBib3JkZXItcmFkaXVzOiAke2N1c3RvbVByb3BlcnRpZXMuYm9yZGVyUmFkaXVzNn07XG4gIG1pbi1oZWlnaHQ6IDEzNnB4O1xuICBkaXNwbGF5OiBmbGV4O1xuICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcbiAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbmBcbmNvbnN0IGRpc2FibGVkID0gY3NzYGBcbmNvbnN0IHJlYWR5Rm9yRHJvcCA9IGNzc2BcbiAgYmFja2dyb3VuZC1pbWFnZTogdXJsKFxcXCIke2dldERhc2hlZEJvcmRlcigpfVxcXCIpO1xuICBiYWNrZ3JvdW5kLWNvbG9yOiAke2N1c3RvbVByb3BlcnRpZXMuY29sb3JTdXJmYWNlfTtcbmBcbmNvbnN0IGFjdGl2ZURyYWcgPSBjc3NgXG4gIGJhY2tncm91bmQtaW1hZ2U6IHVybChcXFwiJHtnZXREYXNoZWRCb3JkZXIoJ2FjdGl2ZScpfVxcXCIpO1xuICBiYWNrZ3JvdW5kLWNvbG9yOiAke2N1c3RvbVByb3BlcnRpZXMuY29sb3JQcmltYXJ5OTV9O1xuICBwYWRkaW5nOiAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZzUwfSAxMDBweDtcbmBcbmNvbnN0IGZpbGVEcm9wcGVkID0gY3NzYFxuICBiYWNrZ3JvdW5kLWltYWdlOiB1cmwoXFxcIiR7Z2V0RGFzaGVkQm9yZGVyKCl9XFxcIik7XG4gIGJhY2tncm91bmQtY29sb3I6ICR7Y3VzdG9tUHJvcGVydGllcy5jb2xvclN1cmZhY2V9O1xuICBwYWRkaW5nOiAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZzUwfSAxMDBweDtcbmBcblxuZXhwb3J0IGNvbnN0IHN0eWxlcyA9IHtcbiAgYmFzZSxcbiAgcmVhZHlGb3JEcm9wLFxuICBmaWxlRHJvcHBlZCxcbiAgZGlzYWJsZWQsXG4gIGFjdGl2ZURyYWcsXG59XG4iXX0= */");
|
|
@@ -884,13 +872,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
884
872
|
return /*#__PURE__*/react.css(process.env.NODE_ENV === "production" ? "" : ";label:getDefaultDropWrapperStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRyb3AtYXJlYS13cmFwcGVyLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE0QlkiLCJmaWxlIjoiZHJvcC1hcmVhLXdyYXBwZXIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnXG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCdcbmltcG9ydCB7IHR5cGUgRHJvcHpvbmVSb290UHJvcHMgfSBmcm9tICdyZWFjdC1kcm9wem9uZSdcbmltcG9ydCB7IHN0eWxlcyB9IGZyb20gJy4vc3R5bGVzJ1xuaW1wb3J0IHsgdHlwZSBEcm9wQXJlYVN0YXRlIH0gZnJvbSAnQHR5cGVzJ1xuXG5pbnRlcmZhY2UgRHJvcFdyYXBwZXJQcm9wcyBleHRlbmRzIERyb3B6b25lUm9vdFByb3BzIHtcbiAgZHJvcEFyZWFTdGF0ZTogRHJvcEFyZWFTdGF0ZVxufVxuZXhwb3J0IGNvbnN0IERyb3BXcmFwcGVyID0gc3R5bGVkLmRpdjxEcm9wV3JhcHBlclByb3BzPmBcbiAgJHtzdHlsZXMuYmFzZX1cbiAgJHsocHJvcHMpID0+IHtcbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ2Rpc2FibGVkJykge1xuICAgICAgcmV0dXJuIHN0eWxlcy5kaXNhYmxlZFxuICAgIH1cbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ3JlYWR5LWZvci1kcm9wJykge1xuICAgICAgcmV0dXJuIHN0eWxlcy5yZWFkeUZvckRyb3BcbiAgICB9XG4gICAgaWYgKHByb3BzLmRyb3BBcmVhU3RhdGUgPT09ICdhY3RpdmUtZHJhZycpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuYWN0aXZlRHJhZ1xuICAgIH1cbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ2ZpbGUtZHJvcHBlZCcpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuZmlsZURyb3BwZWRcbiAgICB9XG4gICAgcmV0dXJuIGdldERlZmF1bHREcm9wV3JhcHBlclN0eWxlcyhwcm9wcy5kcm9wQXJlYVN0YXRlKVxuICB9fVxuYFxuZnVuY3Rpb24gZ2V0RGVmYXVsdERyb3BXcmFwcGVyU3R5bGVzKF9kcm9wQXJlYVN0YXRlOiBuZXZlcikge1xuICByZXR1cm4gY3NzYGBcbn1cbiJdfQ== */");
|
|
885
873
|
}
|
|
886
874
|
|
|
887
|
-
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-
|
|
875
|
+
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-8ee86fd4.cjs.dev.js' /* webpackChunkName: "active-drag-drop-area" */); }));
|
|
888
876
|
|
|
889
877
|
var DisabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./disabled-drop-area-aa78075b.cjs.dev.js' /* webpackChunkName: "disabled-drop-area" */); }));
|
|
890
878
|
|
|
891
|
-
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-
|
|
879
|
+
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-a1260be0.cjs.dev.js' /* webpackChunkName: "enabled-drop-area" */); }));
|
|
892
880
|
|
|
893
|
-
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-
|
|
881
|
+
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-8aae58b3.cjs.dev.js' /* webpackChunkName: "filed-dropped-area" */); }));
|
|
894
882
|
|
|
895
883
|
function getDropArea(_ref) {
|
|
896
884
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -928,12 +916,7 @@ function getDropAreaState(flags) {
|
|
|
928
916
|
return 'ready-for-drop';
|
|
929
917
|
}
|
|
930
918
|
|
|
931
|
-
var messages$
|
|
932
|
-
modalDescription: {
|
|
933
|
-
id: 'ImportResourcesModal.modalDescription',
|
|
934
|
-
description: 'Label for the modal category description',
|
|
935
|
-
defaultMessage: 'Maximum file size is {fileSize} MB with a limit of {rowLimit} rows. Download <csvTemplateLink>the CSV template</csvTemplateLink> or refer to <documentationLink>the documentation</documentationLink>.'
|
|
936
|
-
},
|
|
919
|
+
var messages$4 = reactIntl.defineMessages({
|
|
937
920
|
dragAndDropCSV: {
|
|
938
921
|
id: 'ImportResourcesModal.dragAndDropCSV',
|
|
939
922
|
description: 'The message telling the user to drag and drop CSV file in the file drop area',
|
|
@@ -977,6 +960,16 @@ var messages$2 = reactIntl.defineMessages({
|
|
|
977
960
|
id: 'ImportResourcesModal.genericError',
|
|
978
961
|
description: 'Default error message for unexpected file upload issues (for unhandled cases)',
|
|
979
962
|
defaultMessage: 'Error occurred: Please try uploading the file again or contact our support team for assistance.'
|
|
963
|
+
},
|
|
964
|
+
dataType: {
|
|
965
|
+
id: 'ImportResourcesModal.dataType',
|
|
966
|
+
description: 'Label for the data type selection dropdown',
|
|
967
|
+
defaultMessage: 'Data type'
|
|
968
|
+
},
|
|
969
|
+
instructions: {
|
|
970
|
+
id: 'ImportResourcesModal.instructions',
|
|
971
|
+
description: 'Label for the instructions section',
|
|
972
|
+
defaultMessage: 'Instructions'
|
|
980
973
|
}
|
|
981
974
|
});
|
|
982
975
|
|
|
@@ -1011,7 +1004,7 @@ const FileDropArea = () => {
|
|
|
1011
1004
|
showNotification({
|
|
1012
1005
|
kind: 'error',
|
|
1013
1006
|
domain: constants.DOMAINS.PAGE,
|
|
1014
|
-
text: intl.formatMessage(messages$
|
|
1007
|
+
text: intl.formatMessage(messages$4.tooManyFilesError)
|
|
1015
1008
|
});
|
|
1016
1009
|
return;
|
|
1017
1010
|
}
|
|
@@ -1019,13 +1012,13 @@ const FileDropArea = () => {
|
|
|
1019
1012
|
showNotification({
|
|
1020
1013
|
kind: 'error',
|
|
1021
1014
|
domain: constants.DOMAINS.PAGE,
|
|
1022
|
-
text: intl.formatMessage(messages$
|
|
1015
|
+
text: intl.formatMessage(messages$4.fileFormatNotSupported)
|
|
1023
1016
|
});
|
|
1024
1017
|
} else {
|
|
1025
1018
|
showNotification({
|
|
1026
1019
|
kind: 'error',
|
|
1027
1020
|
domain: constants.DOMAINS.PAGE,
|
|
1028
|
-
text: intl.formatMessage(messages$
|
|
1021
|
+
text: intl.formatMessage(messages$4.genericError)
|
|
1029
1022
|
});
|
|
1030
1023
|
}
|
|
1031
1024
|
}
|
|
@@ -1078,21 +1071,19 @@ var sharedMessages = reactIntl.defineMessages({
|
|
|
1078
1071
|
}
|
|
1079
1072
|
});
|
|
1080
1073
|
|
|
1081
|
-
function ownKeys$9(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1082
|
-
function _objectSpread$9(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$9(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$9(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1083
1074
|
const Upload = () => {
|
|
1084
1075
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1085
1076
|
state = _useImportResourcesCo.state,
|
|
1086
|
-
onClose = _useImportResourcesCo.onClose
|
|
1077
|
+
onClose = _useImportResourcesCo.onClose,
|
|
1078
|
+
resourceTypes = _useImportResourcesCo.resourceTypes;
|
|
1087
1079
|
const intl = reactIntl.useIntl();
|
|
1088
|
-
const resourceTypePlural = resourceTypeToDisplayName({
|
|
1080
|
+
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1089
1081
|
resourceType: state.resourceType,
|
|
1090
1082
|
isPlural: true
|
|
1091
1083
|
});
|
|
1092
1084
|
const _useUpload = useUpload(),
|
|
1093
1085
|
handleUploadAndValidation = _useUpload.handleUploadAndValidation;
|
|
1094
|
-
const
|
|
1095
|
-
const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
|
|
1086
|
+
const isMultipleResourceTypes = resourceTypes.length > 1;
|
|
1096
1087
|
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
1097
1088
|
size: 16,
|
|
1098
1089
|
isOpen: true,
|
|
@@ -1110,31 +1101,30 @@ const Upload = () => {
|
|
|
1110
1101
|
}),
|
|
1111
1102
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1112
1103
|
scale: "l",
|
|
1113
|
-
children: [jsxRuntime.
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
}), jsxRuntime.jsx(FileDropArea, {})]
|
|
1104
|
+
children: [isMultipleResourceTypes ? jsxRuntime.jsxs(uiKit.Grid, {
|
|
1105
|
+
gridRowGap: uiKit.designTokens.spacingL,
|
|
1106
|
+
gridTemplateColumns: `calc(${uiKit.designTokens.constraint3} + ${uiKit.designTokens.spacingL}) auto`,
|
|
1107
|
+
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1108
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1109
|
+
isBold: true,
|
|
1110
|
+
intlMessage: messages$4.dataType
|
|
1111
|
+
})
|
|
1112
|
+
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1113
|
+
children: jsxRuntime.jsx(ResourceTypeSelection, {})
|
|
1114
|
+
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1115
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1116
|
+
isBold: true,
|
|
1117
|
+
intlMessage: messages$4.instructions
|
|
1118
|
+
})
|
|
1119
|
+
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1120
|
+
children: jsxRuntime.jsx(Instructions, {})
|
|
1121
|
+
})]
|
|
1122
|
+
}) : jsxRuntime.jsx(Instructions, {}), jsxRuntime.jsx(FileDropArea, {})]
|
|
1133
1123
|
})
|
|
1134
1124
|
});
|
|
1135
1125
|
};
|
|
1136
1126
|
|
|
1137
|
-
var messages$
|
|
1127
|
+
var messages$3 = reactIntl.defineMessages({
|
|
1138
1128
|
startImportButton: {
|
|
1139
1129
|
id: 'ImportResourcesModal.startImportButton',
|
|
1140
1130
|
description: 'Label for the modal Start import button',
|
|
@@ -1212,8 +1202,8 @@ var messages$1 = reactIntl.defineMessages({
|
|
|
1212
1202
|
}
|
|
1213
1203
|
});
|
|
1214
1204
|
|
|
1215
|
-
function ownKeys$
|
|
1216
|
-
function _objectSpread$
|
|
1205
|
+
function ownKeys$9(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1206
|
+
function _objectSpread$9(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$9(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$9(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1217
1207
|
const truncate = (isExpanded, columns, columnsCount) => {
|
|
1218
1208
|
return isExpanded ? columns.join(' | ') : _sliceInstanceProperty__default["default"](columns).call(columns, 0, columnsCount).join(' | ') + (columns.length > columnsCount ? '...' : '');
|
|
1219
1209
|
};
|
|
@@ -1242,7 +1232,7 @@ const ColumnList = props => {
|
|
|
1242
1232
|
e.preventDefault();
|
|
1243
1233
|
setIsExpanded(!isExpanded);
|
|
1244
1234
|
},
|
|
1245
|
-
children: isExpanded ? jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
1235
|
+
children: isExpanded ? jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$9({}, messages$3.showLess)) : jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$9({}, messages$3.showMore))
|
|
1246
1236
|
})
|
|
1247
1237
|
})]
|
|
1248
1238
|
})
|
|
@@ -1250,8 +1240,8 @@ const ColumnList = props => {
|
|
|
1250
1240
|
});
|
|
1251
1241
|
};
|
|
1252
1242
|
|
|
1253
|
-
function ownKeys$
|
|
1254
|
-
function _objectSpread$
|
|
1243
|
+
function ownKeys$8(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; }
|
|
1244
|
+
function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$8(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$8(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1255
1245
|
function UploadPreviewModal() {
|
|
1256
1246
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1257
1247
|
state = _useImportResourcesCo.state;
|
|
@@ -1268,7 +1258,7 @@ function UploadPreviewModal() {
|
|
|
1268
1258
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1269
1259
|
resourceType: state.resourceType
|
|
1270
1260
|
}),
|
|
1271
|
-
labelPrimary: intl.formatMessage(messages$
|
|
1261
|
+
labelPrimary: intl.formatMessage(messages$3.continue),
|
|
1272
1262
|
onSecondaryButtonClick: () => onClose({
|
|
1273
1263
|
shouldDeleteImportContainer: true
|
|
1274
1264
|
}),
|
|
@@ -1286,7 +1276,7 @@ function UploadPreviewModal() {
|
|
|
1286
1276
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1287
1277
|
scale: "m",
|
|
1288
1278
|
children: [jsxRuntime.jsx("div", {}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1289
|
-
intlMessage: messages$
|
|
1279
|
+
intlMessage: messages$3.previewOfYourImport
|
|
1290
1280
|
}), jsxRuntime.jsx(uiKit.Card, {
|
|
1291
1281
|
insetScale: "xl",
|
|
1292
1282
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -1296,7 +1286,7 @@ function UploadPreviewModal() {
|
|
|
1296
1286
|
children: [jsxRuntime.jsx(uiKit.CheckBoldIcon, {
|
|
1297
1287
|
color: "success"
|
|
1298
1288
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1299
|
-
intlMessage: _objectSpread$
|
|
1289
|
+
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$3.rowsToBeImported), {}, {
|
|
1300
1290
|
values: {
|
|
1301
1291
|
rowCount: intl.formatNumber(state.uploadFileResponse.rowsCount),
|
|
1302
1292
|
b: getBold$3
|
|
@@ -1308,7 +1298,7 @@ function UploadPreviewModal() {
|
|
|
1308
1298
|
children: [jsxRuntime.jsx(uiKit.CheckBoldIcon, {
|
|
1309
1299
|
color: "success"
|
|
1310
1300
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1311
|
-
intlMessage: _objectSpread$
|
|
1301
|
+
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$3.columnsToBeImported), {}, {
|
|
1312
1302
|
values: {
|
|
1313
1303
|
columnCount: intl.formatNumber(validatedColumns.length),
|
|
1314
1304
|
b: getBold$3
|
|
@@ -1328,7 +1318,7 @@ function UploadPreviewModal() {
|
|
|
1328
1318
|
children: [jsxRuntime.jsx(uiKit.EyeCrossedIcon, {
|
|
1329
1319
|
color: "neutral60"
|
|
1330
1320
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1331
|
-
intlMessage: _objectSpread$
|
|
1321
|
+
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$3.columnsToBeIgnored), {}, {
|
|
1332
1322
|
values: {
|
|
1333
1323
|
columnCount: intl.formatNumber(ignoredColumns.length),
|
|
1334
1324
|
b: getBold$3
|
|
@@ -1354,33 +1344,29 @@ function getBold$3(msg) {
|
|
|
1354
1344
|
});
|
|
1355
1345
|
}
|
|
1356
1346
|
|
|
1357
|
-
function ownKeys$
|
|
1358
|
-
function _objectSpread$
|
|
1347
|
+
function ownKeys$7(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1348
|
+
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; }
|
|
1359
1349
|
const getNewLine = () => jsxRuntime.jsx("br", {});
|
|
1360
1350
|
const getImportLogsLink = (msg, projectKey) => jsxRuntime.jsx(uiKit.Link, {
|
|
1361
|
-
to:
|
|
1351
|
+
to: `/${projectKey}/operations/import/logs`,
|
|
1362
1352
|
children: msg
|
|
1363
1353
|
});
|
|
1364
1354
|
const ImportConfirmationModal = () => {
|
|
1365
|
-
var _state$uploadFileResp;
|
|
1366
1355
|
const intl = reactIntl.useIntl();
|
|
1367
1356
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1368
1357
|
state = _useImportResourcesCo.state,
|
|
1369
1358
|
onStartImportSuccess = _useImportResourcesCo.onStartImportSuccess,
|
|
1370
1359
|
onClose = _useImportResourcesCo.onClose;
|
|
1371
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => {
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
projectName: (_context$project2 = context.project) === null || _context$project2 === void 0 ? void 0 : _context$project2.name
|
|
1376
|
-
};
|
|
1377
|
-
}),
|
|
1360
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
1361
|
+
projectKey: context.project?.key,
|
|
1362
|
+
projectName: context.project?.name
|
|
1363
|
+
})),
|
|
1378
1364
|
projectKey = _useApplicationContex.projectKey,
|
|
1379
1365
|
projectName = _useApplicationContex.projectName;
|
|
1380
1366
|
const asyncDispatch = sdk.useAsyncDispatch();
|
|
1381
1367
|
const showNotification = actionsGlobal.useShowNotification();
|
|
1382
1368
|
const ImportRunningTextNotification = () => jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1383
|
-
intlMessage: _objectSpread$
|
|
1369
|
+
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$3.uploadNotificationSuccessMessage), {}, {
|
|
1384
1370
|
values: {
|
|
1385
1371
|
newline: getNewLine,
|
|
1386
1372
|
logsLink: msg => getImportLogsLink(msg, projectKey),
|
|
@@ -1390,12 +1376,12 @@ const ImportConfirmationModal = () => {
|
|
|
1390
1376
|
});
|
|
1391
1377
|
return jsxRuntime.jsx(applicationComponents.ConfirmationDialog, {
|
|
1392
1378
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1393
|
-
resourceType: resourceTypeToDisplayName({
|
|
1379
|
+
resourceType: resourceTypeToDisplayName$1({
|
|
1394
1380
|
resourceType: state.resourceType,
|
|
1395
1381
|
isPlural: true
|
|
1396
1382
|
})
|
|
1397
1383
|
}),
|
|
1398
|
-
labelPrimary: intl.formatMessage(messages$
|
|
1384
|
+
labelPrimary: intl.formatMessage(messages$3.startImportButton),
|
|
1399
1385
|
isOpen: true,
|
|
1400
1386
|
onClose: () => onClose({
|
|
1401
1387
|
shouldDeleteImportContainer: true
|
|
@@ -1411,8 +1397,7 @@ const ImportConfirmationModal = () => {
|
|
|
1411
1397
|
},
|
|
1412
1398
|
onConfirm: async () => {
|
|
1413
1399
|
try {
|
|
1414
|
-
|
|
1415
|
-
const canConfirm = projectKey && state.containerKey && ((_state$droppedFile = state.droppedFile) === null || _state$droppedFile === void 0 ? void 0 : _state$droppedFile.name) && state.resourceType;
|
|
1400
|
+
const canConfirm = projectKey && state.containerKey && state.droppedFile?.name && state.resourceType;
|
|
1416
1401
|
if (!canConfirm) return;
|
|
1417
1402
|
onClose();
|
|
1418
1403
|
await processUploadedFile({
|
|
@@ -1446,18 +1431,18 @@ const ImportConfirmationModal = () => {
|
|
|
1446
1431
|
scale: "xl",
|
|
1447
1432
|
children: [jsxRuntime.jsxs("div", {
|
|
1448
1433
|
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1449
|
-
intlMessage: _objectSpread$
|
|
1434
|
+
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$3.confirmationBodyText), {}, {
|
|
1450
1435
|
values: {
|
|
1451
1436
|
projectName: projectName,
|
|
1452
|
-
count: intl.formatNumber(
|
|
1437
|
+
count: intl.formatNumber(state?.uploadFileResponse?.rowsCount || 0),
|
|
1453
1438
|
bold: getBold$2
|
|
1454
1439
|
}
|
|
1455
1440
|
})
|
|
1456
1441
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1457
|
-
intlMessage: messages$
|
|
1442
|
+
intlMessage: messages$3.confirmationBodyNote
|
|
1458
1443
|
})]
|
|
1459
1444
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1460
|
-
intlMessage: messages$
|
|
1445
|
+
intlMessage: messages$3.confirmationBodyQuestion
|
|
1461
1446
|
})]
|
|
1462
1447
|
})
|
|
1463
1448
|
});
|
|
@@ -1470,7 +1455,7 @@ function getBold$2(msg) {
|
|
|
1470
1455
|
});
|
|
1471
1456
|
}
|
|
1472
1457
|
|
|
1473
|
-
var messages = reactIntl.defineMessages({
|
|
1458
|
+
var messages$2 = reactIntl.defineMessages({
|
|
1474
1459
|
row: {
|
|
1475
1460
|
id: 'ImportResourcesModal.row',
|
|
1476
1461
|
description: 'In Upload file error modal - "Row" column',
|
|
@@ -1503,15 +1488,15 @@ var messages = reactIntl.defineMessages({
|
|
|
1503
1488
|
}
|
|
1504
1489
|
});
|
|
1505
1490
|
|
|
1506
|
-
function ownKeys$
|
|
1507
|
-
function _objectSpread$
|
|
1491
|
+
function ownKeys$6(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; }
|
|
1492
|
+
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$6(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$6(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1508
1493
|
const getColumns$1 = () => [{
|
|
1509
1494
|
key: 'errorType',
|
|
1510
|
-
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
1495
|
+
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$2.errorType)),
|
|
1511
1496
|
width: 'max-content'
|
|
1512
1497
|
}, {
|
|
1513
1498
|
key: 'details',
|
|
1514
|
-
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
1499
|
+
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$2.details))
|
|
1515
1500
|
}];
|
|
1516
1501
|
const UploadClientSideErrorTable = props => {
|
|
1517
1502
|
var _context;
|
|
@@ -1554,10 +1539,9 @@ function itemRenderer$1(item, column) {
|
|
|
1554
1539
|
}
|
|
1555
1540
|
}
|
|
1556
1541
|
|
|
1557
|
-
function ownKeys$
|
|
1558
|
-
function _objectSpread$
|
|
1542
|
+
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; }
|
|
1543
|
+
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; }
|
|
1559
1544
|
const UploadClientSideErrorsModal = () => {
|
|
1560
|
-
var _state$droppedFile;
|
|
1561
1545
|
const intl = reactIntl.useIntl();
|
|
1562
1546
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1563
1547
|
state = _useImportResourcesCo.state,
|
|
@@ -1568,7 +1552,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1568
1552
|
size: 16,
|
|
1569
1553
|
isOpen: true,
|
|
1570
1554
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1571
|
-
resourceType: resourceTypeToDisplayName({
|
|
1555
|
+
resourceType: resourceTypeToDisplayName$1({
|
|
1572
1556
|
resourceType: state.resourceType,
|
|
1573
1557
|
isPlural: true
|
|
1574
1558
|
})
|
|
@@ -1577,9 +1561,9 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1577
1561
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1578
1562
|
scale: "l",
|
|
1579
1563
|
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1580
|
-
intlMessage: _objectSpread$
|
|
1564
|
+
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$2.uploadingError), {}, {
|
|
1581
1565
|
values: {
|
|
1582
|
-
fileName:
|
|
1566
|
+
fileName: state.droppedFile?.name,
|
|
1583
1567
|
errorsCount: intl.formatNumber(errorsCount),
|
|
1584
1568
|
b: getBold$1
|
|
1585
1569
|
}
|
|
@@ -1594,7 +1578,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1594
1578
|
onClick: () => onClose()
|
|
1595
1579
|
}), jsxRuntime.jsx(uiKit.PrimaryButton, {
|
|
1596
1580
|
iconLeft: jsxRuntime.jsx(uiKit.ImportIcon, {}),
|
|
1597
|
-
label: intl.formatMessage(messages.uploadNewFile),
|
|
1581
|
+
label: intl.formatMessage(messages$2.uploadNewFile),
|
|
1598
1582
|
onClick: () => actions.uploadNewFile()
|
|
1599
1583
|
})]
|
|
1600
1584
|
})]
|
|
@@ -1609,19 +1593,19 @@ function getBold$1(msg) {
|
|
|
1609
1593
|
});
|
|
1610
1594
|
}
|
|
1611
1595
|
|
|
1612
|
-
function ownKeys$
|
|
1613
|
-
function _objectSpread$
|
|
1596
|
+
function ownKeys$4(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; }
|
|
1597
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$4(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$4(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1614
1598
|
const getColumns = () => [{
|
|
1615
1599
|
key: 'row',
|
|
1616
|
-
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
1600
|
+
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages$2.row)),
|
|
1617
1601
|
width: 'max-content'
|
|
1618
1602
|
}, {
|
|
1619
1603
|
key: 'errorType',
|
|
1620
|
-
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
1604
|
+
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages$2.errorType)),
|
|
1621
1605
|
width: 'max-content'
|
|
1622
1606
|
}, {
|
|
1623
1607
|
key: 'details',
|
|
1624
|
-
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
1608
|
+
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages$2.details))
|
|
1625
1609
|
}];
|
|
1626
1610
|
const UploadServerSideErrorTable = props => {
|
|
1627
1611
|
var _context;
|
|
@@ -1672,22 +1656,21 @@ function itemRenderer(item, column) {
|
|
|
1672
1656
|
}
|
|
1673
1657
|
}
|
|
1674
1658
|
|
|
1675
|
-
function ownKeys$
|
|
1676
|
-
function _objectSpread$
|
|
1659
|
+
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; }
|
|
1660
|
+
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; }
|
|
1677
1661
|
const UploadServerSideErrorsModal = () => {
|
|
1678
|
-
var _state$uploadFileResp, _state$droppedFile, _state$uploadFileResp2;
|
|
1679
1662
|
const intl = reactIntl.useIntl();
|
|
1680
1663
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1681
1664
|
state = _useImportResourcesCo.state,
|
|
1682
1665
|
actions = _useImportResourcesCo.actions,
|
|
1683
1666
|
onClose = _useImportResourcesCo.onClose;
|
|
1684
|
-
const errorsCount = getFileUploadErrorsCount(
|
|
1667
|
+
const errorsCount = getFileUploadErrorsCount(state.uploadFileResponse?.results);
|
|
1685
1668
|
const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
|
|
1686
1669
|
return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1687
1670
|
size: 16,
|
|
1688
1671
|
isOpen: true,
|
|
1689
1672
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1690
|
-
resourceType: resourceTypeToDisplayName({
|
|
1673
|
+
resourceType: resourceTypeToDisplayName$1({
|
|
1691
1674
|
resourceType: state.resourceType,
|
|
1692
1675
|
isPlural: true
|
|
1693
1676
|
})
|
|
@@ -1698,15 +1681,15 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1698
1681
|
children: [jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1699
1682
|
scale: "xs",
|
|
1700
1683
|
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1701
|
-
intlMessage: _objectSpread$
|
|
1684
|
+
intlMessage: _objectSpread$3(_objectSpread$3({}, messages$2.uploadingError), {}, {
|
|
1702
1685
|
values: {
|
|
1703
|
-
fileName:
|
|
1686
|
+
fileName: state.droppedFile?.name,
|
|
1704
1687
|
errorsCount: intl.formatNumber(errorsCount),
|
|
1705
1688
|
b: getBold
|
|
1706
1689
|
}
|
|
1707
1690
|
})
|
|
1708
1691
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1709
|
-
intlMessage: _objectSpread$
|
|
1692
|
+
intlMessage: _objectSpread$3(_objectSpread$3({}, messages$2.supportedValuesDocumentation), {}, {
|
|
1710
1693
|
values: {
|
|
1711
1694
|
documentationLink: msg => jsxRuntime.jsx(uiKit.Link, {
|
|
1712
1695
|
tone: "secondary",
|
|
@@ -1718,7 +1701,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1718
1701
|
})
|
|
1719
1702
|
})]
|
|
1720
1703
|
}), jsxRuntime.jsx(UploadServerSideErrorTable, {
|
|
1721
|
-
rows: mapUploadFileErrorsResponseToUploadFileErrorRows(
|
|
1704
|
+
rows: mapUploadFileErrorsResponseToUploadFileErrorRows(state.uploadFileResponse?.results)
|
|
1722
1705
|
}), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1723
1706
|
scale: "m",
|
|
1724
1707
|
justifyContent: "flex-end",
|
|
@@ -1727,7 +1710,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1727
1710
|
onClick: () => onClose()
|
|
1728
1711
|
}), jsxRuntime.jsx(uiKit.PrimaryButton, {
|
|
1729
1712
|
iconLeft: jsxRuntime.jsx(uiKit.ImportIcon, {}),
|
|
1730
|
-
label: intl.formatMessage(messages.uploadNewFile),
|
|
1713
|
+
label: intl.formatMessage(messages$2.uploadNewFile),
|
|
1731
1714
|
onClick: () => actions.uploadNewFile()
|
|
1732
1715
|
})]
|
|
1733
1716
|
})]
|
|
@@ -1743,18 +1726,17 @@ function getBold(msg) {
|
|
|
1743
1726
|
}
|
|
1744
1727
|
|
|
1745
1728
|
const UploadResult = () => {
|
|
1746
|
-
var _state$uploadFileResp;
|
|
1747
1729
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1748
1730
|
state = _useImportResourcesCo.state;
|
|
1749
1731
|
if (state.fileUploadClientSideErrors.length > 0) return jsxRuntime.jsx(UploadClientSideErrorsModal, {});
|
|
1750
|
-
if (
|
|
1732
|
+
if (state.uploadFileResponse?.invalid > 0) return jsxRuntime.jsx(UploadServerSideErrorsModal, {});
|
|
1751
1733
|
return jsxRuntime.jsx(UploadPreviewModal, {});
|
|
1752
1734
|
};
|
|
1753
1735
|
|
|
1754
|
-
function ownKeys$
|
|
1755
|
-
function _objectSpread$
|
|
1736
|
+
function ownKeys$2(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; }
|
|
1737
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$2(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$2(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1756
1738
|
var FileIcon = function FileIcon(props) {
|
|
1757
|
-
return jsxRuntime.jsxs("svg", _objectSpread$
|
|
1739
|
+
return jsxRuntime.jsxs("svg", _objectSpread$2(_objectSpread$2({}, props), {}, {
|
|
1758
1740
|
children: [jsxRuntime.jsx("mask", {
|
|
1759
1741
|
id: "a",
|
|
1760
1742
|
style: {
|
|
@@ -1785,17 +1767,16 @@ FileIcon.defaultProps = {
|
|
|
1785
1767
|
xmlns: "http://www.w3.org/2000/svg"
|
|
1786
1768
|
};
|
|
1787
1769
|
const Uploading = () => {
|
|
1788
|
-
var _state$droppedFile;
|
|
1789
1770
|
const intl = reactIntl.useIntl();
|
|
1790
1771
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1791
1772
|
state = _useImportResourcesCo.state,
|
|
1792
1773
|
actions = _useImportResourcesCo.actions,
|
|
1793
1774
|
onClose = _useImportResourcesCo.onClose;
|
|
1794
|
-
const resourceTypePlural = resourceTypeToDisplayName({
|
|
1775
|
+
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1795
1776
|
resourceType: state.resourceType,
|
|
1796
1777
|
isPlural: true
|
|
1797
1778
|
});
|
|
1798
|
-
if (
|
|
1779
|
+
if (state.droppedFile?.name) return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1799
1780
|
size: 16,
|
|
1800
1781
|
isOpen: true,
|
|
1801
1782
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
@@ -1855,6 +1836,97 @@ const CurrentStep = () => {
|
|
|
1855
1836
|
return steps[state.currentStep] || null;
|
|
1856
1837
|
};
|
|
1857
1838
|
|
|
1839
|
+
var messages$1 = reactIntl.defineMessages({
|
|
1840
|
+
products: {
|
|
1841
|
+
id: 'ImportResourcesModal.radio.products',
|
|
1842
|
+
description: 'Label for the products radio button',
|
|
1843
|
+
defaultMessage: 'Products (including variants, assets, prices and images)'
|
|
1844
|
+
},
|
|
1845
|
+
inventories: {
|
|
1846
|
+
id: 'ImportResourcesModal.radio.inventories',
|
|
1847
|
+
description: 'Label for the inventories radio button',
|
|
1848
|
+
defaultMessage: 'Inventories'
|
|
1849
|
+
},
|
|
1850
|
+
categories: {
|
|
1851
|
+
id: 'ImportResourcesModal.radio.categories',
|
|
1852
|
+
description: 'Label for the categories radio button',
|
|
1853
|
+
defaultMessage: 'Categories'
|
|
1854
|
+
}
|
|
1855
|
+
});
|
|
1856
|
+
|
|
1857
|
+
const resourceTypeToDisplayName = resourceType => {
|
|
1858
|
+
switch (resourceType) {
|
|
1859
|
+
case 'product':
|
|
1860
|
+
return messages$1.products;
|
|
1861
|
+
case 'inventory':
|
|
1862
|
+
return messages$1.inventories;
|
|
1863
|
+
case 'category':
|
|
1864
|
+
return messages$1.categories;
|
|
1865
|
+
default:
|
|
1866
|
+
throw new Error(`Unknown resource type: ${resourceType}`);
|
|
1867
|
+
}
|
|
1868
|
+
};
|
|
1869
|
+
const ResourceTypeSelection = () => {
|
|
1870
|
+
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1871
|
+
state = _useImportResourcesCo.state,
|
|
1872
|
+
actions = _useImportResourcesCo.actions,
|
|
1873
|
+
resourceTypes = _useImportResourcesCo.resourceTypes;
|
|
1874
|
+
return jsxRuntime.jsx(uiKit.RadioInput.Group, {
|
|
1875
|
+
value: state.resourceType,
|
|
1876
|
+
onChange: e => {
|
|
1877
|
+
actions.setResourceType(e.target.value);
|
|
1878
|
+
},
|
|
1879
|
+
direction: "stack",
|
|
1880
|
+
directionProps: {
|
|
1881
|
+
scale: 's'
|
|
1882
|
+
},
|
|
1883
|
+
children: _mapInstanceProperty__default["default"](resourceTypes).call(resourceTypes, resourceType => jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
1884
|
+
value: resourceType,
|
|
1885
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1886
|
+
intlMessage: resourceTypeToDisplayName(resourceType)
|
|
1887
|
+
})
|
|
1888
|
+
}, resourceType))
|
|
1889
|
+
});
|
|
1890
|
+
};
|
|
1891
|
+
|
|
1892
|
+
var messages = reactIntl.defineMessages({
|
|
1893
|
+
fileUploadInstructions: {
|
|
1894
|
+
id: 'ImportResourcesModal.fileUploadInstructions',
|
|
1895
|
+
description: 'Label for the modal category description',
|
|
1896
|
+
defaultMessage: 'Maximum file size is {fileSize} MB with a limit of {rowLimit} rows. Download <csvTemplateLink>the CSV template</csvTemplateLink> or refer to <documentationLink>the documentation</documentationLink>.'
|
|
1897
|
+
}
|
|
1898
|
+
});
|
|
1899
|
+
|
|
1900
|
+
function ownKeys$1(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; }
|
|
1901
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$1(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$1(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1902
|
+
const Instructions = () => {
|
|
1903
|
+
const intl = reactIntl.useIntl();
|
|
1904
|
+
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1905
|
+
state = _useImportResourcesCo.state;
|
|
1906
|
+
const templateLink = RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS[state.resourceType];
|
|
1907
|
+
const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
|
|
1908
|
+
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1909
|
+
intlMessage: _objectSpread$1(_objectSpread$1({}, messages.fileUploadInstructions), {}, {
|
|
1910
|
+
values: {
|
|
1911
|
+
fileSize: intl.formatNumber(FILE_SIZE_LIMITS_MB[state.resourceType]),
|
|
1912
|
+
rowLimit: intl.formatNumber(ROW_LIMITS[state.resourceType]),
|
|
1913
|
+
csvTemplateLink: msg => jsxRuntime.jsx(uiKit.Link, {
|
|
1914
|
+
tone: "secondary",
|
|
1915
|
+
isExternal: true,
|
|
1916
|
+
to: templateLink,
|
|
1917
|
+
children: msg
|
|
1918
|
+
}),
|
|
1919
|
+
documentationLink: msg => jsxRuntime.jsx(uiKit.Link, {
|
|
1920
|
+
tone: "secondary",
|
|
1921
|
+
isExternal: true,
|
|
1922
|
+
to: documentationLink,
|
|
1923
|
+
children: msg
|
|
1924
|
+
})
|
|
1925
|
+
}
|
|
1926
|
+
})
|
|
1927
|
+
});
|
|
1928
|
+
};
|
|
1929
|
+
|
|
1858
1930
|
const getChunkImport = locale => {
|
|
1859
1931
|
const intlLocale = i18n.mapLocaleToIntlLocale(locale);
|
|
1860
1932
|
switch (intlLocale) {
|
|
@@ -1880,8 +1952,8 @@ const loadMessages = async locale => {
|
|
|
1880
1952
|
return i18n.parseChunkImport(chunkImport);
|
|
1881
1953
|
} catch (error) {
|
|
1882
1954
|
// eslint-disable-next-line no-console
|
|
1883
|
-
console.warn(
|
|
1884
|
-
sentry.reportErrorToSentry(new Error(
|
|
1955
|
+
console.warn(`Something went wrong while loading the import-resources-modal messages for ${locale}`, error);
|
|
1956
|
+
sentry.reportErrorToSentry(new Error(`Something went wrong while loading the import-resources-modal messages for ${locale}`), {
|
|
1885
1957
|
extra: error
|
|
1886
1958
|
});
|
|
1887
1959
|
return {};
|
|
@@ -1924,14 +1996,23 @@ const useAsyncIntlMessages = (locale, loader) => {
|
|
|
1924
1996
|
};
|
|
1925
1997
|
|
|
1926
1998
|
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; }
|
|
1927
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
1999
|
+
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; }
|
|
1928
2000
|
const ImportResourcesModal = props => {
|
|
2001
|
+
var _context;
|
|
1929
2002
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
1930
2003
|
locale: context.user && context.user.locale
|
|
1931
2004
|
})),
|
|
1932
2005
|
locale = _useApplicationContex.locale;
|
|
1933
2006
|
const messages = useAsyncIntlMessages(locale, loadMessages);
|
|
1934
2007
|
if (!props.isOpen || messages.isLoading) return null;
|
|
2008
|
+
if (!props.resourceTypes?.length) {
|
|
2009
|
+
console.error('No resource types provided for import resources modal');
|
|
2010
|
+
return null;
|
|
2011
|
+
}
|
|
2012
|
+
if (!_everyInstanceProperty__default["default"](_context = props.resourceTypes).call(_context, isResourceType)) {
|
|
2013
|
+
console.error('Invalid resource types provided for import resources modal');
|
|
2014
|
+
return null;
|
|
2015
|
+
}
|
|
1935
2016
|
return jsxRuntime.jsx(reactIntl.IntlProvider, {
|
|
1936
2017
|
locale: locale,
|
|
1937
2018
|
messages: messages.messages,
|
|
@@ -1945,5 +2026,5 @@ ImportResourcesModal.displayName = 'ImportResourcesModal';
|
|
|
1945
2026
|
exports.EnabledDropArea = EnabledDropArea;
|
|
1946
2027
|
exports.FileDropped = FileDropped;
|
|
1947
2028
|
exports.ImportResourcesModal = ImportResourcesModal;
|
|
1948
|
-
exports.messages = messages$
|
|
2029
|
+
exports.messages = messages$4;
|
|
1949
2030
|
exports.useImportResourcesContext = useImportResourcesContext;
|