@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;" + ("" ), "" );
|
|
851
839
|
const disabled = /*#__PURE__*/react.css("" , "" );
|
|
@@ -881,13 +869,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
881
869
|
return /*#__PURE__*/react.css("" , "" );
|
|
882
870
|
}
|
|
883
871
|
|
|
884
|
-
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-
|
|
872
|
+
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-1cac282b.cjs.prod.js' /* webpackChunkName: "active-drag-drop-area" */); }));
|
|
885
873
|
|
|
886
874
|
var DisabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./disabled-drop-area-99c1fa0b.cjs.prod.js' /* webpackChunkName: "disabled-drop-area" */); }));
|
|
887
875
|
|
|
888
|
-
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-
|
|
876
|
+
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-fd89b405.cjs.prod.js' /* webpackChunkName: "enabled-drop-area" */); }));
|
|
889
877
|
|
|
890
|
-
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-
|
|
878
|
+
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-da127fa5.cjs.prod.js' /* webpackChunkName: "filed-dropped-area" */); }));
|
|
891
879
|
|
|
892
880
|
function getDropArea(_ref) {
|
|
893
881
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -925,12 +913,7 @@ function getDropAreaState(flags) {
|
|
|
925
913
|
return 'ready-for-drop';
|
|
926
914
|
}
|
|
927
915
|
|
|
928
|
-
var messages$
|
|
929
|
-
modalDescription: {
|
|
930
|
-
id: 'ImportResourcesModal.modalDescription',
|
|
931
|
-
description: 'Label for the modal category description',
|
|
932
|
-
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>.'
|
|
933
|
-
},
|
|
916
|
+
var messages$4 = reactIntl.defineMessages({
|
|
934
917
|
dragAndDropCSV: {
|
|
935
918
|
id: 'ImportResourcesModal.dragAndDropCSV',
|
|
936
919
|
description: 'The message telling the user to drag and drop CSV file in the file drop area',
|
|
@@ -974,6 +957,16 @@ var messages$2 = reactIntl.defineMessages({
|
|
|
974
957
|
id: 'ImportResourcesModal.genericError',
|
|
975
958
|
description: 'Default error message for unexpected file upload issues (for unhandled cases)',
|
|
976
959
|
defaultMessage: 'Error occurred: Please try uploading the file again or contact our support team for assistance.'
|
|
960
|
+
},
|
|
961
|
+
dataType: {
|
|
962
|
+
id: 'ImportResourcesModal.dataType',
|
|
963
|
+
description: 'Label for the data type selection dropdown',
|
|
964
|
+
defaultMessage: 'Data type'
|
|
965
|
+
},
|
|
966
|
+
instructions: {
|
|
967
|
+
id: 'ImportResourcesModal.instructions',
|
|
968
|
+
description: 'Label for the instructions section',
|
|
969
|
+
defaultMessage: 'Instructions'
|
|
977
970
|
}
|
|
978
971
|
});
|
|
979
972
|
|
|
@@ -1008,7 +1001,7 @@ const FileDropArea = () => {
|
|
|
1008
1001
|
showNotification({
|
|
1009
1002
|
kind: 'error',
|
|
1010
1003
|
domain: constants.DOMAINS.PAGE,
|
|
1011
|
-
text: intl.formatMessage(messages$
|
|
1004
|
+
text: intl.formatMessage(messages$4.tooManyFilesError)
|
|
1012
1005
|
});
|
|
1013
1006
|
return;
|
|
1014
1007
|
}
|
|
@@ -1016,13 +1009,13 @@ const FileDropArea = () => {
|
|
|
1016
1009
|
showNotification({
|
|
1017
1010
|
kind: 'error',
|
|
1018
1011
|
domain: constants.DOMAINS.PAGE,
|
|
1019
|
-
text: intl.formatMessage(messages$
|
|
1012
|
+
text: intl.formatMessage(messages$4.fileFormatNotSupported)
|
|
1020
1013
|
});
|
|
1021
1014
|
} else {
|
|
1022
1015
|
showNotification({
|
|
1023
1016
|
kind: 'error',
|
|
1024
1017
|
domain: constants.DOMAINS.PAGE,
|
|
1025
|
-
text: intl.formatMessage(messages$
|
|
1018
|
+
text: intl.formatMessage(messages$4.genericError)
|
|
1026
1019
|
});
|
|
1027
1020
|
}
|
|
1028
1021
|
}
|
|
@@ -1075,21 +1068,19 @@ var sharedMessages = reactIntl.defineMessages({
|
|
|
1075
1068
|
}
|
|
1076
1069
|
});
|
|
1077
1070
|
|
|
1078
|
-
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; }
|
|
1079
|
-
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; }
|
|
1080
1071
|
const Upload = () => {
|
|
1081
1072
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1082
1073
|
state = _useImportResourcesCo.state,
|
|
1083
|
-
onClose = _useImportResourcesCo.onClose
|
|
1074
|
+
onClose = _useImportResourcesCo.onClose,
|
|
1075
|
+
resourceTypes = _useImportResourcesCo.resourceTypes;
|
|
1084
1076
|
const intl = reactIntl.useIntl();
|
|
1085
|
-
const resourceTypePlural = resourceTypeToDisplayName({
|
|
1077
|
+
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1086
1078
|
resourceType: state.resourceType,
|
|
1087
1079
|
isPlural: true
|
|
1088
1080
|
});
|
|
1089
1081
|
const _useUpload = useUpload(),
|
|
1090
1082
|
handleUploadAndValidation = _useUpload.handleUploadAndValidation;
|
|
1091
|
-
const
|
|
1092
|
-
const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
|
|
1083
|
+
const isMultipleResourceTypes = resourceTypes.length > 1;
|
|
1093
1084
|
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
1094
1085
|
size: 16,
|
|
1095
1086
|
isOpen: true,
|
|
@@ -1107,31 +1098,30 @@ const Upload = () => {
|
|
|
1107
1098
|
}),
|
|
1108
1099
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1109
1100
|
scale: "l",
|
|
1110
|
-
children: [jsxRuntime.
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
}), jsxRuntime.jsx(FileDropArea, {})]
|
|
1101
|
+
children: [isMultipleResourceTypes ? jsxRuntime.jsxs(uiKit.Grid, {
|
|
1102
|
+
gridRowGap: uiKit.designTokens.spacingL,
|
|
1103
|
+
gridTemplateColumns: `calc(${uiKit.designTokens.constraint3} + ${uiKit.designTokens.spacingL}) auto`,
|
|
1104
|
+
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1105
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1106
|
+
isBold: true,
|
|
1107
|
+
intlMessage: messages$4.dataType
|
|
1108
|
+
})
|
|
1109
|
+
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1110
|
+
children: jsxRuntime.jsx(ResourceTypeSelection, {})
|
|
1111
|
+
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1112
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1113
|
+
isBold: true,
|
|
1114
|
+
intlMessage: messages$4.instructions
|
|
1115
|
+
})
|
|
1116
|
+
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1117
|
+
children: jsxRuntime.jsx(Instructions, {})
|
|
1118
|
+
})]
|
|
1119
|
+
}) : jsxRuntime.jsx(Instructions, {}), jsxRuntime.jsx(FileDropArea, {})]
|
|
1130
1120
|
})
|
|
1131
1121
|
});
|
|
1132
1122
|
};
|
|
1133
1123
|
|
|
1134
|
-
var messages$
|
|
1124
|
+
var messages$3 = reactIntl.defineMessages({
|
|
1135
1125
|
startImportButton: {
|
|
1136
1126
|
id: 'ImportResourcesModal.startImportButton',
|
|
1137
1127
|
description: 'Label for the modal Start import button',
|
|
@@ -1209,8 +1199,8 @@ var messages$1 = reactIntl.defineMessages({
|
|
|
1209
1199
|
}
|
|
1210
1200
|
});
|
|
1211
1201
|
|
|
1212
|
-
function ownKeys$
|
|
1213
|
-
function _objectSpread$
|
|
1202
|
+
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; }
|
|
1203
|
+
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; }
|
|
1214
1204
|
const truncate = (isExpanded, columns, columnsCount) => {
|
|
1215
1205
|
return isExpanded ? columns.join(' | ') : _sliceInstanceProperty__default["default"](columns).call(columns, 0, columnsCount).join(' | ') + (columns.length > columnsCount ? '...' : '');
|
|
1216
1206
|
};
|
|
@@ -1236,7 +1226,7 @@ const ColumnList = props => {
|
|
|
1236
1226
|
e.preventDefault();
|
|
1237
1227
|
setIsExpanded(!isExpanded);
|
|
1238
1228
|
},
|
|
1239
|
-
children: isExpanded ? jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
1229
|
+
children: isExpanded ? jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$9({}, messages$3.showLess)) : jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$9({}, messages$3.showMore))
|
|
1240
1230
|
})
|
|
1241
1231
|
})]
|
|
1242
1232
|
})
|
|
@@ -1244,8 +1234,8 @@ const ColumnList = props => {
|
|
|
1244
1234
|
});
|
|
1245
1235
|
};
|
|
1246
1236
|
|
|
1247
|
-
function ownKeys$
|
|
1248
|
-
function _objectSpread$
|
|
1237
|
+
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; }
|
|
1238
|
+
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; }
|
|
1249
1239
|
function UploadPreviewModal() {
|
|
1250
1240
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1251
1241
|
state = _useImportResourcesCo.state;
|
|
@@ -1262,7 +1252,7 @@ function UploadPreviewModal() {
|
|
|
1262
1252
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1263
1253
|
resourceType: state.resourceType
|
|
1264
1254
|
}),
|
|
1265
|
-
labelPrimary: intl.formatMessage(messages$
|
|
1255
|
+
labelPrimary: intl.formatMessage(messages$3.continue),
|
|
1266
1256
|
onSecondaryButtonClick: () => onClose({
|
|
1267
1257
|
shouldDeleteImportContainer: true
|
|
1268
1258
|
}),
|
|
@@ -1280,7 +1270,7 @@ function UploadPreviewModal() {
|
|
|
1280
1270
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1281
1271
|
scale: "m",
|
|
1282
1272
|
children: [jsxRuntime.jsx("div", {}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1283
|
-
intlMessage: messages$
|
|
1273
|
+
intlMessage: messages$3.previewOfYourImport
|
|
1284
1274
|
}), jsxRuntime.jsx(uiKit.Card, {
|
|
1285
1275
|
insetScale: "xl",
|
|
1286
1276
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -1290,7 +1280,7 @@ function UploadPreviewModal() {
|
|
|
1290
1280
|
children: [jsxRuntime.jsx(uiKit.CheckBoldIcon, {
|
|
1291
1281
|
color: "success"
|
|
1292
1282
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1293
|
-
intlMessage: _objectSpread$
|
|
1283
|
+
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$3.rowsToBeImported), {}, {
|
|
1294
1284
|
values: {
|
|
1295
1285
|
rowCount: intl.formatNumber(state.uploadFileResponse.rowsCount),
|
|
1296
1286
|
b: getBold$3
|
|
@@ -1302,7 +1292,7 @@ function UploadPreviewModal() {
|
|
|
1302
1292
|
children: [jsxRuntime.jsx(uiKit.CheckBoldIcon, {
|
|
1303
1293
|
color: "success"
|
|
1304
1294
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1305
|
-
intlMessage: _objectSpread$
|
|
1295
|
+
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$3.columnsToBeImported), {}, {
|
|
1306
1296
|
values: {
|
|
1307
1297
|
columnCount: intl.formatNumber(validatedColumns.length),
|
|
1308
1298
|
b: getBold$3
|
|
@@ -1322,7 +1312,7 @@ function UploadPreviewModal() {
|
|
|
1322
1312
|
children: [jsxRuntime.jsx(uiKit.EyeCrossedIcon, {
|
|
1323
1313
|
color: "neutral60"
|
|
1324
1314
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1325
|
-
intlMessage: _objectSpread$
|
|
1315
|
+
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$3.columnsToBeIgnored), {}, {
|
|
1326
1316
|
values: {
|
|
1327
1317
|
columnCount: intl.formatNumber(ignoredColumns.length),
|
|
1328
1318
|
b: getBold$3
|
|
@@ -1348,33 +1338,29 @@ function getBold$3(msg) {
|
|
|
1348
1338
|
});
|
|
1349
1339
|
}
|
|
1350
1340
|
|
|
1351
|
-
function ownKeys$
|
|
1352
|
-
function _objectSpread$
|
|
1341
|
+
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; }
|
|
1342
|
+
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; }
|
|
1353
1343
|
const getNewLine = () => jsxRuntime.jsx("br", {});
|
|
1354
1344
|
const getImportLogsLink = (msg, projectKey) => jsxRuntime.jsx(uiKit.Link, {
|
|
1355
|
-
to:
|
|
1345
|
+
to: `/${projectKey}/operations/import/logs`,
|
|
1356
1346
|
children: msg
|
|
1357
1347
|
});
|
|
1358
1348
|
const ImportConfirmationModal = () => {
|
|
1359
|
-
var _state$uploadFileResp;
|
|
1360
1349
|
const intl = reactIntl.useIntl();
|
|
1361
1350
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1362
1351
|
state = _useImportResourcesCo.state,
|
|
1363
1352
|
onStartImportSuccess = _useImportResourcesCo.onStartImportSuccess,
|
|
1364
1353
|
onClose = _useImportResourcesCo.onClose;
|
|
1365
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => {
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
projectName: (_context$project2 = context.project) === null || _context$project2 === void 0 ? void 0 : _context$project2.name
|
|
1370
|
-
};
|
|
1371
|
-
}),
|
|
1354
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
1355
|
+
projectKey: context.project?.key,
|
|
1356
|
+
projectName: context.project?.name
|
|
1357
|
+
})),
|
|
1372
1358
|
projectKey = _useApplicationContex.projectKey,
|
|
1373
1359
|
projectName = _useApplicationContex.projectName;
|
|
1374
1360
|
const asyncDispatch = sdk.useAsyncDispatch();
|
|
1375
1361
|
const showNotification = actionsGlobal.useShowNotification();
|
|
1376
1362
|
const ImportRunningTextNotification = () => jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1377
|
-
intlMessage: _objectSpread$
|
|
1363
|
+
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$3.uploadNotificationSuccessMessage), {}, {
|
|
1378
1364
|
values: {
|
|
1379
1365
|
newline: getNewLine,
|
|
1380
1366
|
logsLink: msg => getImportLogsLink(msg, projectKey),
|
|
@@ -1384,12 +1370,12 @@ const ImportConfirmationModal = () => {
|
|
|
1384
1370
|
});
|
|
1385
1371
|
return jsxRuntime.jsx(applicationComponents.ConfirmationDialog, {
|
|
1386
1372
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1387
|
-
resourceType: resourceTypeToDisplayName({
|
|
1373
|
+
resourceType: resourceTypeToDisplayName$1({
|
|
1388
1374
|
resourceType: state.resourceType,
|
|
1389
1375
|
isPlural: true
|
|
1390
1376
|
})
|
|
1391
1377
|
}),
|
|
1392
|
-
labelPrimary: intl.formatMessage(messages$
|
|
1378
|
+
labelPrimary: intl.formatMessage(messages$3.startImportButton),
|
|
1393
1379
|
isOpen: true,
|
|
1394
1380
|
onClose: () => onClose({
|
|
1395
1381
|
shouldDeleteImportContainer: true
|
|
@@ -1405,8 +1391,7 @@ const ImportConfirmationModal = () => {
|
|
|
1405
1391
|
},
|
|
1406
1392
|
onConfirm: async () => {
|
|
1407
1393
|
try {
|
|
1408
|
-
|
|
1409
|
-
const canConfirm = projectKey && state.containerKey && ((_state$droppedFile = state.droppedFile) === null || _state$droppedFile === void 0 ? void 0 : _state$droppedFile.name) && state.resourceType;
|
|
1394
|
+
const canConfirm = projectKey && state.containerKey && state.droppedFile?.name && state.resourceType;
|
|
1410
1395
|
if (!canConfirm) return;
|
|
1411
1396
|
onClose();
|
|
1412
1397
|
await processUploadedFile({
|
|
@@ -1440,18 +1425,18 @@ const ImportConfirmationModal = () => {
|
|
|
1440
1425
|
scale: "xl",
|
|
1441
1426
|
children: [jsxRuntime.jsxs("div", {
|
|
1442
1427
|
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1443
|
-
intlMessage: _objectSpread$
|
|
1428
|
+
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$3.confirmationBodyText), {}, {
|
|
1444
1429
|
values: {
|
|
1445
1430
|
projectName: projectName,
|
|
1446
|
-
count: intl.formatNumber(
|
|
1431
|
+
count: intl.formatNumber(state?.uploadFileResponse?.rowsCount || 0),
|
|
1447
1432
|
bold: getBold$2
|
|
1448
1433
|
}
|
|
1449
1434
|
})
|
|
1450
1435
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1451
|
-
intlMessage: messages$
|
|
1436
|
+
intlMessage: messages$3.confirmationBodyNote
|
|
1452
1437
|
})]
|
|
1453
1438
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1454
|
-
intlMessage: messages$
|
|
1439
|
+
intlMessage: messages$3.confirmationBodyQuestion
|
|
1455
1440
|
})]
|
|
1456
1441
|
})
|
|
1457
1442
|
});
|
|
@@ -1464,7 +1449,7 @@ function getBold$2(msg) {
|
|
|
1464
1449
|
});
|
|
1465
1450
|
}
|
|
1466
1451
|
|
|
1467
|
-
var messages = reactIntl.defineMessages({
|
|
1452
|
+
var messages$2 = reactIntl.defineMessages({
|
|
1468
1453
|
row: {
|
|
1469
1454
|
id: 'ImportResourcesModal.row',
|
|
1470
1455
|
description: 'In Upload file error modal - "Row" column',
|
|
@@ -1497,15 +1482,15 @@ var messages = reactIntl.defineMessages({
|
|
|
1497
1482
|
}
|
|
1498
1483
|
});
|
|
1499
1484
|
|
|
1500
|
-
function ownKeys$
|
|
1501
|
-
function _objectSpread$
|
|
1485
|
+
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; }
|
|
1486
|
+
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; }
|
|
1502
1487
|
const getColumns$1 = () => [{
|
|
1503
1488
|
key: 'errorType',
|
|
1504
|
-
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
1489
|
+
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$2.errorType)),
|
|
1505
1490
|
width: 'max-content'
|
|
1506
1491
|
}, {
|
|
1507
1492
|
key: 'details',
|
|
1508
|
-
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
1493
|
+
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$2.details))
|
|
1509
1494
|
}];
|
|
1510
1495
|
const UploadClientSideErrorTable = props => {
|
|
1511
1496
|
var _context;
|
|
@@ -1548,10 +1533,9 @@ function itemRenderer$1(item, column) {
|
|
|
1548
1533
|
}
|
|
1549
1534
|
}
|
|
1550
1535
|
|
|
1551
|
-
function ownKeys$
|
|
1552
|
-
function _objectSpread$
|
|
1536
|
+
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; }
|
|
1537
|
+
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; }
|
|
1553
1538
|
const UploadClientSideErrorsModal = () => {
|
|
1554
|
-
var _state$droppedFile;
|
|
1555
1539
|
const intl = reactIntl.useIntl();
|
|
1556
1540
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1557
1541
|
state = _useImportResourcesCo.state,
|
|
@@ -1562,7 +1546,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1562
1546
|
size: 16,
|
|
1563
1547
|
isOpen: true,
|
|
1564
1548
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1565
|
-
resourceType: resourceTypeToDisplayName({
|
|
1549
|
+
resourceType: resourceTypeToDisplayName$1({
|
|
1566
1550
|
resourceType: state.resourceType,
|
|
1567
1551
|
isPlural: true
|
|
1568
1552
|
})
|
|
@@ -1571,9 +1555,9 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1571
1555
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1572
1556
|
scale: "l",
|
|
1573
1557
|
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1574
|
-
intlMessage: _objectSpread$
|
|
1558
|
+
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$2.uploadingError), {}, {
|
|
1575
1559
|
values: {
|
|
1576
|
-
fileName:
|
|
1560
|
+
fileName: state.droppedFile?.name,
|
|
1577
1561
|
errorsCount: intl.formatNumber(errorsCount),
|
|
1578
1562
|
b: getBold$1
|
|
1579
1563
|
}
|
|
@@ -1588,7 +1572,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1588
1572
|
onClick: () => onClose()
|
|
1589
1573
|
}), jsxRuntime.jsx(uiKit.PrimaryButton, {
|
|
1590
1574
|
iconLeft: jsxRuntime.jsx(uiKit.ImportIcon, {}),
|
|
1591
|
-
label: intl.formatMessage(messages.uploadNewFile),
|
|
1575
|
+
label: intl.formatMessage(messages$2.uploadNewFile),
|
|
1592
1576
|
onClick: () => actions.uploadNewFile()
|
|
1593
1577
|
})]
|
|
1594
1578
|
})]
|
|
@@ -1603,19 +1587,19 @@ function getBold$1(msg) {
|
|
|
1603
1587
|
});
|
|
1604
1588
|
}
|
|
1605
1589
|
|
|
1606
|
-
function ownKeys$
|
|
1607
|
-
function _objectSpread$
|
|
1590
|
+
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; }
|
|
1591
|
+
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; }
|
|
1608
1592
|
const getColumns = () => [{
|
|
1609
1593
|
key: 'row',
|
|
1610
|
-
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
1594
|
+
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages$2.row)),
|
|
1611
1595
|
width: 'max-content'
|
|
1612
1596
|
}, {
|
|
1613
1597
|
key: 'errorType',
|
|
1614
|
-
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
1598
|
+
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages$2.errorType)),
|
|
1615
1599
|
width: 'max-content'
|
|
1616
1600
|
}, {
|
|
1617
1601
|
key: 'details',
|
|
1618
|
-
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
1602
|
+
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages$2.details))
|
|
1619
1603
|
}];
|
|
1620
1604
|
const UploadServerSideErrorTable = props => {
|
|
1621
1605
|
var _context;
|
|
@@ -1666,22 +1650,21 @@ function itemRenderer(item, column) {
|
|
|
1666
1650
|
}
|
|
1667
1651
|
}
|
|
1668
1652
|
|
|
1669
|
-
function ownKeys$
|
|
1670
|
-
function _objectSpread$
|
|
1653
|
+
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; }
|
|
1654
|
+
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; }
|
|
1671
1655
|
const UploadServerSideErrorsModal = () => {
|
|
1672
|
-
var _state$uploadFileResp, _state$droppedFile, _state$uploadFileResp2;
|
|
1673
1656
|
const intl = reactIntl.useIntl();
|
|
1674
1657
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1675
1658
|
state = _useImportResourcesCo.state,
|
|
1676
1659
|
actions = _useImportResourcesCo.actions,
|
|
1677
1660
|
onClose = _useImportResourcesCo.onClose;
|
|
1678
|
-
const errorsCount = getFileUploadErrorsCount(
|
|
1661
|
+
const errorsCount = getFileUploadErrorsCount(state.uploadFileResponse?.results);
|
|
1679
1662
|
const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
|
|
1680
1663
|
return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1681
1664
|
size: 16,
|
|
1682
1665
|
isOpen: true,
|
|
1683
1666
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1684
|
-
resourceType: resourceTypeToDisplayName({
|
|
1667
|
+
resourceType: resourceTypeToDisplayName$1({
|
|
1685
1668
|
resourceType: state.resourceType,
|
|
1686
1669
|
isPlural: true
|
|
1687
1670
|
})
|
|
@@ -1692,15 +1675,15 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1692
1675
|
children: [jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1693
1676
|
scale: "xs",
|
|
1694
1677
|
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1695
|
-
intlMessage: _objectSpread$
|
|
1678
|
+
intlMessage: _objectSpread$3(_objectSpread$3({}, messages$2.uploadingError), {}, {
|
|
1696
1679
|
values: {
|
|
1697
|
-
fileName:
|
|
1680
|
+
fileName: state.droppedFile?.name,
|
|
1698
1681
|
errorsCount: intl.formatNumber(errorsCount),
|
|
1699
1682
|
b: getBold
|
|
1700
1683
|
}
|
|
1701
1684
|
})
|
|
1702
1685
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1703
|
-
intlMessage: _objectSpread$
|
|
1686
|
+
intlMessage: _objectSpread$3(_objectSpread$3({}, messages$2.supportedValuesDocumentation), {}, {
|
|
1704
1687
|
values: {
|
|
1705
1688
|
documentationLink: msg => jsxRuntime.jsx(uiKit.Link, {
|
|
1706
1689
|
tone: "secondary",
|
|
@@ -1712,7 +1695,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1712
1695
|
})
|
|
1713
1696
|
})]
|
|
1714
1697
|
}), jsxRuntime.jsx(UploadServerSideErrorTable, {
|
|
1715
|
-
rows: mapUploadFileErrorsResponseToUploadFileErrorRows(
|
|
1698
|
+
rows: mapUploadFileErrorsResponseToUploadFileErrorRows(state.uploadFileResponse?.results)
|
|
1716
1699
|
}), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1717
1700
|
scale: "m",
|
|
1718
1701
|
justifyContent: "flex-end",
|
|
@@ -1721,7 +1704,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1721
1704
|
onClick: () => onClose()
|
|
1722
1705
|
}), jsxRuntime.jsx(uiKit.PrimaryButton, {
|
|
1723
1706
|
iconLeft: jsxRuntime.jsx(uiKit.ImportIcon, {}),
|
|
1724
|
-
label: intl.formatMessage(messages.uploadNewFile),
|
|
1707
|
+
label: intl.formatMessage(messages$2.uploadNewFile),
|
|
1725
1708
|
onClick: () => actions.uploadNewFile()
|
|
1726
1709
|
})]
|
|
1727
1710
|
})]
|
|
@@ -1737,18 +1720,17 @@ function getBold(msg) {
|
|
|
1737
1720
|
}
|
|
1738
1721
|
|
|
1739
1722
|
const UploadResult = () => {
|
|
1740
|
-
var _state$uploadFileResp;
|
|
1741
1723
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1742
1724
|
state = _useImportResourcesCo.state;
|
|
1743
1725
|
if (state.fileUploadClientSideErrors.length > 0) return jsxRuntime.jsx(UploadClientSideErrorsModal, {});
|
|
1744
|
-
if (
|
|
1726
|
+
if (state.uploadFileResponse?.invalid > 0) return jsxRuntime.jsx(UploadServerSideErrorsModal, {});
|
|
1745
1727
|
return jsxRuntime.jsx(UploadPreviewModal, {});
|
|
1746
1728
|
};
|
|
1747
1729
|
|
|
1748
|
-
function ownKeys$
|
|
1749
|
-
function _objectSpread$
|
|
1730
|
+
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; }
|
|
1731
|
+
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; }
|
|
1750
1732
|
var FileIcon = function FileIcon(props) {
|
|
1751
|
-
return jsxRuntime.jsxs("svg", _objectSpread$
|
|
1733
|
+
return jsxRuntime.jsxs("svg", _objectSpread$2(_objectSpread$2({}, props), {}, {
|
|
1752
1734
|
children: [jsxRuntime.jsx("mask", {
|
|
1753
1735
|
id: "a",
|
|
1754
1736
|
style: {
|
|
@@ -1779,17 +1761,16 @@ FileIcon.defaultProps = {
|
|
|
1779
1761
|
xmlns: "http://www.w3.org/2000/svg"
|
|
1780
1762
|
};
|
|
1781
1763
|
const Uploading = () => {
|
|
1782
|
-
var _state$droppedFile;
|
|
1783
1764
|
const intl = reactIntl.useIntl();
|
|
1784
1765
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1785
1766
|
state = _useImportResourcesCo.state,
|
|
1786
1767
|
actions = _useImportResourcesCo.actions,
|
|
1787
1768
|
onClose = _useImportResourcesCo.onClose;
|
|
1788
|
-
const resourceTypePlural = resourceTypeToDisplayName({
|
|
1769
|
+
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1789
1770
|
resourceType: state.resourceType,
|
|
1790
1771
|
isPlural: true
|
|
1791
1772
|
});
|
|
1792
|
-
if (
|
|
1773
|
+
if (state.droppedFile?.name) return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1793
1774
|
size: 16,
|
|
1794
1775
|
isOpen: true,
|
|
1795
1776
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
@@ -1849,6 +1830,97 @@ const CurrentStep = () => {
|
|
|
1849
1830
|
return steps[state.currentStep] || null;
|
|
1850
1831
|
};
|
|
1851
1832
|
|
|
1833
|
+
var messages$1 = reactIntl.defineMessages({
|
|
1834
|
+
products: {
|
|
1835
|
+
id: 'ImportResourcesModal.radio.products',
|
|
1836
|
+
description: 'Label for the products radio button',
|
|
1837
|
+
defaultMessage: 'Products (including variants, assets, prices and images)'
|
|
1838
|
+
},
|
|
1839
|
+
inventories: {
|
|
1840
|
+
id: 'ImportResourcesModal.radio.inventories',
|
|
1841
|
+
description: 'Label for the inventories radio button',
|
|
1842
|
+
defaultMessage: 'Inventories'
|
|
1843
|
+
},
|
|
1844
|
+
categories: {
|
|
1845
|
+
id: 'ImportResourcesModal.radio.categories',
|
|
1846
|
+
description: 'Label for the categories radio button',
|
|
1847
|
+
defaultMessage: 'Categories'
|
|
1848
|
+
}
|
|
1849
|
+
});
|
|
1850
|
+
|
|
1851
|
+
const resourceTypeToDisplayName = resourceType => {
|
|
1852
|
+
switch (resourceType) {
|
|
1853
|
+
case 'product':
|
|
1854
|
+
return messages$1.products;
|
|
1855
|
+
case 'inventory':
|
|
1856
|
+
return messages$1.inventories;
|
|
1857
|
+
case 'category':
|
|
1858
|
+
return messages$1.categories;
|
|
1859
|
+
default:
|
|
1860
|
+
throw new Error(`Unknown resource type: ${resourceType}`);
|
|
1861
|
+
}
|
|
1862
|
+
};
|
|
1863
|
+
const ResourceTypeSelection = () => {
|
|
1864
|
+
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1865
|
+
state = _useImportResourcesCo.state,
|
|
1866
|
+
actions = _useImportResourcesCo.actions,
|
|
1867
|
+
resourceTypes = _useImportResourcesCo.resourceTypes;
|
|
1868
|
+
return jsxRuntime.jsx(uiKit.RadioInput.Group, {
|
|
1869
|
+
value: state.resourceType,
|
|
1870
|
+
onChange: e => {
|
|
1871
|
+
actions.setResourceType(e.target.value);
|
|
1872
|
+
},
|
|
1873
|
+
direction: "stack",
|
|
1874
|
+
directionProps: {
|
|
1875
|
+
scale: 's'
|
|
1876
|
+
},
|
|
1877
|
+
children: _mapInstanceProperty__default["default"](resourceTypes).call(resourceTypes, resourceType => jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
1878
|
+
value: resourceType,
|
|
1879
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1880
|
+
intlMessage: resourceTypeToDisplayName(resourceType)
|
|
1881
|
+
})
|
|
1882
|
+
}, resourceType))
|
|
1883
|
+
});
|
|
1884
|
+
};
|
|
1885
|
+
|
|
1886
|
+
var messages = reactIntl.defineMessages({
|
|
1887
|
+
fileUploadInstructions: {
|
|
1888
|
+
id: 'ImportResourcesModal.fileUploadInstructions',
|
|
1889
|
+
description: 'Label for the modal category description',
|
|
1890
|
+
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>.'
|
|
1891
|
+
}
|
|
1892
|
+
});
|
|
1893
|
+
|
|
1894
|
+
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; }
|
|
1895
|
+
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; }
|
|
1896
|
+
const Instructions = () => {
|
|
1897
|
+
const intl = reactIntl.useIntl();
|
|
1898
|
+
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1899
|
+
state = _useImportResourcesCo.state;
|
|
1900
|
+
const templateLink = RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS[state.resourceType];
|
|
1901
|
+
const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
|
|
1902
|
+
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1903
|
+
intlMessage: _objectSpread$1(_objectSpread$1({}, messages.fileUploadInstructions), {}, {
|
|
1904
|
+
values: {
|
|
1905
|
+
fileSize: intl.formatNumber(FILE_SIZE_LIMITS_MB[state.resourceType]),
|
|
1906
|
+
rowLimit: intl.formatNumber(ROW_LIMITS[state.resourceType]),
|
|
1907
|
+
csvTemplateLink: msg => jsxRuntime.jsx(uiKit.Link, {
|
|
1908
|
+
tone: "secondary",
|
|
1909
|
+
isExternal: true,
|
|
1910
|
+
to: templateLink,
|
|
1911
|
+
children: msg
|
|
1912
|
+
}),
|
|
1913
|
+
documentationLink: msg => jsxRuntime.jsx(uiKit.Link, {
|
|
1914
|
+
tone: "secondary",
|
|
1915
|
+
isExternal: true,
|
|
1916
|
+
to: documentationLink,
|
|
1917
|
+
children: msg
|
|
1918
|
+
})
|
|
1919
|
+
}
|
|
1920
|
+
})
|
|
1921
|
+
});
|
|
1922
|
+
};
|
|
1923
|
+
|
|
1852
1924
|
const getChunkImport = locale => {
|
|
1853
1925
|
const intlLocale = i18n.mapLocaleToIntlLocale(locale);
|
|
1854
1926
|
switch (intlLocale) {
|
|
@@ -1874,8 +1946,8 @@ const loadMessages = async locale => {
|
|
|
1874
1946
|
return i18n.parseChunkImport(chunkImport);
|
|
1875
1947
|
} catch (error) {
|
|
1876
1948
|
// eslint-disable-next-line no-console
|
|
1877
|
-
console.warn(
|
|
1878
|
-
sentry.reportErrorToSentry(new Error(
|
|
1949
|
+
console.warn(`Something went wrong while loading the import-resources-modal messages for ${locale}`, error);
|
|
1950
|
+
sentry.reportErrorToSentry(new Error(`Something went wrong while loading the import-resources-modal messages for ${locale}`), {
|
|
1879
1951
|
extra: error
|
|
1880
1952
|
});
|
|
1881
1953
|
return {};
|
|
@@ -1918,14 +1990,23 @@ const useAsyncIntlMessages = (locale, loader) => {
|
|
|
1918
1990
|
};
|
|
1919
1991
|
|
|
1920
1992
|
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; }
|
|
1921
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
1993
|
+
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; }
|
|
1922
1994
|
const ImportResourcesModal = props => {
|
|
1995
|
+
var _context;
|
|
1923
1996
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
1924
1997
|
locale: context.user && context.user.locale
|
|
1925
1998
|
})),
|
|
1926
1999
|
locale = _useApplicationContex.locale;
|
|
1927
2000
|
const messages = useAsyncIntlMessages(locale, loadMessages);
|
|
1928
2001
|
if (!props.isOpen || messages.isLoading) return null;
|
|
2002
|
+
if (!props.resourceTypes?.length) {
|
|
2003
|
+
console.error('No resource types provided for import resources modal');
|
|
2004
|
+
return null;
|
|
2005
|
+
}
|
|
2006
|
+
if (!_everyInstanceProperty__default["default"](_context = props.resourceTypes).call(_context, isResourceType)) {
|
|
2007
|
+
console.error('Invalid resource types provided for import resources modal');
|
|
2008
|
+
return null;
|
|
2009
|
+
}
|
|
1929
2010
|
return jsxRuntime.jsx(reactIntl.IntlProvider, {
|
|
1930
2011
|
locale: locale,
|
|
1931
2012
|
messages: messages.messages,
|
|
@@ -1939,5 +2020,5 @@ ImportResourcesModal.displayName = 'ImportResourcesModal';
|
|
|
1939
2020
|
exports.EnabledDropArea = EnabledDropArea;
|
|
1940
2021
|
exports.FileDropped = FileDropped;
|
|
1941
2022
|
exports.ImportResourcesModal = ImportResourcesModal;
|
|
1942
|
-
exports.messages = messages$
|
|
2023
|
+
exports.messages = messages$4;
|
|
1943
2024
|
exports.useImportResourcesContext = useImportResourcesContext;
|