@commercetools-frontend-extensions/import-resources-modal 1.0.7 → 1.1.1
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-8456b360.cjs.prod.js} +4 -5
- package/dist/{active-drag-drop-area-f930d60d.cjs.prod.js → active-drag-drop-area-a3479c4b.cjs.dev.js} +4 -5
- package/dist/{active-drag-drop-area-f7b6d1a7.esm.js → active-drag-drop-area-f5c4c801.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-668a7291.cjs.prod.js} +4 -5
- package/dist/{enabled-drop-area-6b9b6762.cjs.prod.js → enabled-drop-area-83b1b98e.cjs.dev.js} +4 -5
- package/dist/{enabled-drop-area-20dad798.esm.js → enabled-drop-area-cc25daca.esm.js} +4 -5
- package/dist/{file-dropped-area-dfd7b665.cjs.dev.js → file-dropped-area-5320497d.cjs.prod.js} +4 -6
- package/dist/{file-dropped-area-89f07d26.esm.js → file-dropped-area-b714e041.esm.js} +4 -6
- package/dist/{file-dropped-area-98af1296.cjs.prod.js → file-dropped-area-fcc62264.cjs.dev.js} +4 -6
- package/dist/{index-c4f11e0f.esm.js → index-339a08f1.esm.js} +279 -192
- package/dist/{index-c1ea2041.cjs.dev.js → index-5b2739bc.cjs.dev.js} +280 -194
- package/dist/{index-28eb8566.cjs.prod.js → index-7498d508.cjs.prod.js} +280 -194
- 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,13 +118,13 @@ 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',
|
|
130
|
-
product: 'https://docs.commercetools.com/merchant-center/import-data#
|
|
127
|
+
product: 'https://docs.commercetools.com/merchant-center/import-data#download-a-csv-template',
|
|
131
128
|
inventory: 'https://docs.commercetools.com/merchant-center/downloads/inventory_entry_import_template.csv'
|
|
132
129
|
};
|
|
133
130
|
const RESOURCE_TYPE_DOCUMENTATION_LINKS = {
|
|
@@ -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'
|
|
@@ -676,15 +662,17 @@ var messages$3 = reactIntl.defineMessages({
|
|
|
676
662
|
id: 'ImportResourcesModal.unexpectedError',
|
|
677
663
|
description: 'Generic notification message when file upload fails',
|
|
678
664
|
defaultMessage: 'An unexpected error occurred during the file upload. Please try again, or contact support if this error occurs again.'
|
|
665
|
+
},
|
|
666
|
+
missingKeyError: {
|
|
667
|
+
id: 'ImportResourcesModal.missingKeyError',
|
|
668
|
+
description: 'Error message displayed when the uploaded file is missing the key field',
|
|
669
|
+
defaultMessage: "The 'key' field is missing or incomplete in some rows. Please ensure every row has a 'key' value."
|
|
679
670
|
}
|
|
680
671
|
});
|
|
681
672
|
|
|
682
673
|
const useUpload = () => {
|
|
683
674
|
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
|
-
});
|
|
675
|
+
const projectKey = applicationShellConnectors.useApplicationContext(context => context.project?.key);
|
|
688
676
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
689
677
|
state = _useImportResourcesCo.state,
|
|
690
678
|
actions = _useImportResourcesCo.actions;
|
|
@@ -699,25 +687,25 @@ const useUpload = () => {
|
|
|
699
687
|
const errors = [];
|
|
700
688
|
const delimiterCheck = await checkDelimiter(file);
|
|
701
689
|
if (!delimiterCheck.isValid) errors.push({
|
|
702
|
-
title: intl.formatMessage(messages$
|
|
703
|
-
description: intl.formatMessage(messages$
|
|
690
|
+
title: intl.formatMessage(messages$5.dropAreaWrongDelimiterTitle),
|
|
691
|
+
description: intl.formatMessage(messages$5.dropAreaWrongDelimiterDescription, {
|
|
704
692
|
delimiter: delimiterCheck.delimiter
|
|
705
693
|
})
|
|
706
694
|
});
|
|
707
695
|
const rowCount = await getRowCount(file);
|
|
708
696
|
if (rowCount < 1) errors.push({
|
|
709
|
-
title: intl.formatMessage(messages$
|
|
710
|
-
description: intl.formatMessage(messages$
|
|
697
|
+
title: intl.formatMessage(messages$5.dropAreaNotEnoughRowsTitle),
|
|
698
|
+
description: intl.formatMessage(messages$5.dropAreaNotEnoughRowsDescription)
|
|
711
699
|
});
|
|
712
700
|
if (state.resourceType && file.size > toBytes(FILE_SIZE_LIMITS_MB[state.resourceType])) errors.push({
|
|
713
|
-
title: intl.formatMessage(messages$
|
|
714
|
-
description: intl.formatMessage(messages$
|
|
701
|
+
title: intl.formatMessage(messages$5.fileSizeExceededTitle),
|
|
702
|
+
description: intl.formatMessage(messages$5.fileSizeExceededDescription, {
|
|
715
703
|
fileSizeLimit: intl.formatNumber(FILE_SIZE_LIMITS_MB[state.resourceType])
|
|
716
704
|
})
|
|
717
705
|
});
|
|
718
706
|
if (state.resourceType && rowCount > ROW_LIMITS[state.resourceType]) errors.push({
|
|
719
|
-
title: intl.formatMessage(messages$
|
|
720
|
-
description: intl.formatMessage(messages$
|
|
707
|
+
title: intl.formatMessage(messages$5.rowLimitExceededTitle),
|
|
708
|
+
description: intl.formatMessage(messages$5.rowLimitExceededDescription, {
|
|
721
709
|
rowLimit: intl.formatNumber(ROW_LIMITS[state.resourceType])
|
|
722
710
|
})
|
|
723
711
|
});
|
|
@@ -734,26 +722,24 @@ const useUpload = () => {
|
|
|
734
722
|
return;
|
|
735
723
|
}
|
|
736
724
|
if (error instanceof HttpError) {
|
|
737
|
-
|
|
738
|
-
if (((_error$errorData = error.errorData) === null || _error$errorData === void 0 ? void 0 : _error$errorData.code) === 'MISSING_KEY_ERROR') {
|
|
725
|
+
if (error.errorData?.code === 'MISSING_KEY_ERROR') {
|
|
739
726
|
actions.cancelImport();
|
|
740
727
|
showNotification({
|
|
741
728
|
kind: 'error',
|
|
742
729
|
domain: constants.DOMAINS.PAGE,
|
|
743
|
-
text:
|
|
730
|
+
text: intl.formatMessage(messages$5.unexpectedError)
|
|
744
731
|
});
|
|
745
|
-
} else if (
|
|
732
|
+
} else if (error.errorData?.invalid > 0) {
|
|
746
733
|
actions.setUploadFileResponse(error.errorData);
|
|
747
734
|
} else {
|
|
748
735
|
actions.cancelImport();
|
|
749
736
|
showNotification({
|
|
750
737
|
kind: 'error',
|
|
751
738
|
domain: constants.DOMAINS.PAGE,
|
|
752
|
-
text: intl.formatMessage(messages$
|
|
739
|
+
text: intl.formatMessage(messages$5.unexpectedError)
|
|
753
740
|
});
|
|
754
741
|
}
|
|
755
742
|
} else {
|
|
756
|
-
var _state$droppedFile;
|
|
757
743
|
actions.cancelImport();
|
|
758
744
|
showNotification({
|
|
759
745
|
kind: 'error',
|
|
@@ -766,7 +752,7 @@ const useUpload = () => {
|
|
|
766
752
|
projectKey,
|
|
767
753
|
containerKey: state.containerKey,
|
|
768
754
|
resourceType: state.resourceType,
|
|
769
|
-
fileSizeInBytes:
|
|
755
|
+
fileSizeInBytes: state.droppedFile?.size
|
|
770
756
|
}
|
|
771
757
|
});
|
|
772
758
|
}
|
|
@@ -813,7 +799,7 @@ const useUpload = () => {
|
|
|
813
799
|
};
|
|
814
800
|
};
|
|
815
801
|
|
|
816
|
-
function resourceTypeToDisplayName(_ref) {
|
|
802
|
+
function resourceTypeToDisplayName$1(_ref) {
|
|
817
803
|
let resourceType = _ref.resourceType,
|
|
818
804
|
_ref$isUpperCase = _ref.isUpperCase,
|
|
819
805
|
isUpperCase = _ref$isUpperCase === void 0 ? false : _ref$isUpperCase,
|
|
@@ -827,6 +813,9 @@ function resourceTypeToDisplayName(_ref) {
|
|
|
827
813
|
case 'product':
|
|
828
814
|
displayName = isPlural ? 'Products' : 'Product';
|
|
829
815
|
break;
|
|
816
|
+
case 'inventory':
|
|
817
|
+
displayName = isPlural ? 'Inventories' : 'Inventory';
|
|
818
|
+
break;
|
|
830
819
|
default:
|
|
831
820
|
throw new UnexpectedResourceTypeError(resourceType);
|
|
832
821
|
}
|
|
@@ -844,8 +833,12 @@ const getBorderColor = state => {
|
|
|
844
833
|
const getDashedBorder = function () {
|
|
845
834
|
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
|
|
846
835
|
const color = getBorderColor(state);
|
|
847
|
-
const svgContent =
|
|
848
|
-
|
|
836
|
+
const svgContent = `
|
|
837
|
+
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
|
|
838
|
+
<rect width="100%" height="100%" fill="none" stroke="${color}" stroke-width="2px" stroke-dasharray="6,6" stroke-dashoffset="0" stroke-linecap="square"/>
|
|
839
|
+
</svg>
|
|
840
|
+
`;
|
|
841
|
+
return `data:image/svg+xml,${encodeURIComponent(svgContent)}`;
|
|
849
842
|
};
|
|
850
843
|
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
844
|
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 +877,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
884
877
|
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
878
|
}
|
|
886
879
|
|
|
887
|
-
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-
|
|
880
|
+
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-a3479c4b.cjs.dev.js' /* webpackChunkName: "active-drag-drop-area" */); }));
|
|
888
881
|
|
|
889
882
|
var DisabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./disabled-drop-area-aa78075b.cjs.dev.js' /* webpackChunkName: "disabled-drop-area" */); }));
|
|
890
883
|
|
|
891
|
-
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-
|
|
884
|
+
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-83b1b98e.cjs.dev.js' /* webpackChunkName: "enabled-drop-area" */); }));
|
|
892
885
|
|
|
893
|
-
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-
|
|
886
|
+
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-fcc62264.cjs.dev.js' /* webpackChunkName: "filed-dropped-area" */); }));
|
|
894
887
|
|
|
895
888
|
function getDropArea(_ref) {
|
|
896
889
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -928,12 +921,7 @@ function getDropAreaState(flags) {
|
|
|
928
921
|
return 'ready-for-drop';
|
|
929
922
|
}
|
|
930
923
|
|
|
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
|
-
},
|
|
924
|
+
var messages$4 = reactIntl.defineMessages({
|
|
937
925
|
dragAndDropCSV: {
|
|
938
926
|
id: 'ImportResourcesModal.dragAndDropCSV',
|
|
939
927
|
description: 'The message telling the user to drag and drop CSV file in the file drop area',
|
|
@@ -977,6 +965,16 @@ var messages$2 = reactIntl.defineMessages({
|
|
|
977
965
|
id: 'ImportResourcesModal.genericError',
|
|
978
966
|
description: 'Default error message for unexpected file upload issues (for unhandled cases)',
|
|
979
967
|
defaultMessage: 'Error occurred: Please try uploading the file again or contact our support team for assistance.'
|
|
968
|
+
},
|
|
969
|
+
dataType: {
|
|
970
|
+
id: 'ImportResourcesModal.dataType',
|
|
971
|
+
description: 'Label for the data type selection dropdown',
|
|
972
|
+
defaultMessage: 'Data type'
|
|
973
|
+
},
|
|
974
|
+
instructions: {
|
|
975
|
+
id: 'ImportResourcesModal.instructions',
|
|
976
|
+
description: 'Label for the instructions section',
|
|
977
|
+
defaultMessage: 'Instructions'
|
|
980
978
|
}
|
|
981
979
|
});
|
|
982
980
|
|
|
@@ -1011,7 +1009,7 @@ const FileDropArea = () => {
|
|
|
1011
1009
|
showNotification({
|
|
1012
1010
|
kind: 'error',
|
|
1013
1011
|
domain: constants.DOMAINS.PAGE,
|
|
1014
|
-
text: intl.formatMessage(messages$
|
|
1012
|
+
text: intl.formatMessage(messages$4.tooManyFilesError)
|
|
1015
1013
|
});
|
|
1016
1014
|
return;
|
|
1017
1015
|
}
|
|
@@ -1019,13 +1017,13 @@ const FileDropArea = () => {
|
|
|
1019
1017
|
showNotification({
|
|
1020
1018
|
kind: 'error',
|
|
1021
1019
|
domain: constants.DOMAINS.PAGE,
|
|
1022
|
-
text: intl.formatMessage(messages$
|
|
1020
|
+
text: intl.formatMessage(messages$4.fileFormatNotSupported)
|
|
1023
1021
|
});
|
|
1024
1022
|
} else {
|
|
1025
1023
|
showNotification({
|
|
1026
1024
|
kind: 'error',
|
|
1027
1025
|
domain: constants.DOMAINS.PAGE,
|
|
1028
|
-
text: intl.formatMessage(messages$
|
|
1026
|
+
text: intl.formatMessage(messages$4.genericError)
|
|
1029
1027
|
});
|
|
1030
1028
|
}
|
|
1031
1029
|
}
|
|
@@ -1078,21 +1076,19 @@ var sharedMessages = reactIntl.defineMessages({
|
|
|
1078
1076
|
}
|
|
1079
1077
|
});
|
|
1080
1078
|
|
|
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
1079
|
const Upload = () => {
|
|
1084
1080
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1085
1081
|
state = _useImportResourcesCo.state,
|
|
1086
|
-
onClose = _useImportResourcesCo.onClose
|
|
1082
|
+
onClose = _useImportResourcesCo.onClose,
|
|
1083
|
+
resourceTypes = _useImportResourcesCo.resourceTypes;
|
|
1087
1084
|
const intl = reactIntl.useIntl();
|
|
1088
|
-
const resourceTypePlural = resourceTypeToDisplayName({
|
|
1085
|
+
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1089
1086
|
resourceType: state.resourceType,
|
|
1090
1087
|
isPlural: true
|
|
1091
1088
|
});
|
|
1092
1089
|
const _useUpload = useUpload(),
|
|
1093
1090
|
handleUploadAndValidation = _useUpload.handleUploadAndValidation;
|
|
1094
|
-
const
|
|
1095
|
-
const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
|
|
1091
|
+
const isMultipleResourceTypes = resourceTypes.length > 1;
|
|
1096
1092
|
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
1097
1093
|
size: 16,
|
|
1098
1094
|
isOpen: true,
|
|
@@ -1110,31 +1106,30 @@ const Upload = () => {
|
|
|
1110
1106
|
}),
|
|
1111
1107
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1112
1108
|
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, {})]
|
|
1109
|
+
children: [isMultipleResourceTypes ? jsxRuntime.jsxs(uiKit.Grid, {
|
|
1110
|
+
gridRowGap: uiKit.designTokens.spacingL,
|
|
1111
|
+
gridTemplateColumns: `calc(${uiKit.designTokens.constraint3} + ${uiKit.designTokens.spacingL}) auto`,
|
|
1112
|
+
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1113
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1114
|
+
isBold: true,
|
|
1115
|
+
intlMessage: messages$4.dataType
|
|
1116
|
+
})
|
|
1117
|
+
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1118
|
+
children: jsxRuntime.jsx(ResourceTypeSelection, {})
|
|
1119
|
+
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1120
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1121
|
+
isBold: true,
|
|
1122
|
+
intlMessage: messages$4.instructions
|
|
1123
|
+
})
|
|
1124
|
+
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1125
|
+
children: jsxRuntime.jsx(Instructions, {})
|
|
1126
|
+
})]
|
|
1127
|
+
}) : jsxRuntime.jsx(Instructions, {}), jsxRuntime.jsx(FileDropArea, {})]
|
|
1133
1128
|
})
|
|
1134
1129
|
});
|
|
1135
1130
|
};
|
|
1136
1131
|
|
|
1137
|
-
var messages$
|
|
1132
|
+
var messages$3 = reactIntl.defineMessages({
|
|
1138
1133
|
startImportButton: {
|
|
1139
1134
|
id: 'ImportResourcesModal.startImportButton',
|
|
1140
1135
|
description: 'Label for the modal Start import button',
|
|
@@ -1212,8 +1207,8 @@ var messages$1 = reactIntl.defineMessages({
|
|
|
1212
1207
|
}
|
|
1213
1208
|
});
|
|
1214
1209
|
|
|
1215
|
-
function ownKeys$
|
|
1216
|
-
function _objectSpread$
|
|
1210
|
+
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; }
|
|
1211
|
+
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
1212
|
const truncate = (isExpanded, columns, columnsCount) => {
|
|
1218
1213
|
return isExpanded ? columns.join(' | ') : _sliceInstanceProperty__default["default"](columns).call(columns, 0, columnsCount).join(' | ') + (columns.length > columnsCount ? '...' : '');
|
|
1219
1214
|
};
|
|
@@ -1242,7 +1237,7 @@ const ColumnList = props => {
|
|
|
1242
1237
|
e.preventDefault();
|
|
1243
1238
|
setIsExpanded(!isExpanded);
|
|
1244
1239
|
},
|
|
1245
|
-
children: isExpanded ? jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
1240
|
+
children: isExpanded ? jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$9({}, messages$3.showLess)) : jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$9({}, messages$3.showMore))
|
|
1246
1241
|
})
|
|
1247
1242
|
})]
|
|
1248
1243
|
})
|
|
@@ -1250,8 +1245,8 @@ const ColumnList = props => {
|
|
|
1250
1245
|
});
|
|
1251
1246
|
};
|
|
1252
1247
|
|
|
1253
|
-
function ownKeys$
|
|
1254
|
-
function _objectSpread$
|
|
1248
|
+
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; }
|
|
1249
|
+
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
1250
|
function UploadPreviewModal() {
|
|
1256
1251
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1257
1252
|
state = _useImportResourcesCo.state;
|
|
@@ -1268,7 +1263,7 @@ function UploadPreviewModal() {
|
|
|
1268
1263
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1269
1264
|
resourceType: state.resourceType
|
|
1270
1265
|
}),
|
|
1271
|
-
labelPrimary: intl.formatMessage(messages$
|
|
1266
|
+
labelPrimary: intl.formatMessage(messages$3.continue),
|
|
1272
1267
|
onSecondaryButtonClick: () => onClose({
|
|
1273
1268
|
shouldDeleteImportContainer: true
|
|
1274
1269
|
}),
|
|
@@ -1286,7 +1281,7 @@ function UploadPreviewModal() {
|
|
|
1286
1281
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1287
1282
|
scale: "m",
|
|
1288
1283
|
children: [jsxRuntime.jsx("div", {}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1289
|
-
intlMessage: messages$
|
|
1284
|
+
intlMessage: messages$3.previewOfYourImport
|
|
1290
1285
|
}), jsxRuntime.jsx(uiKit.Card, {
|
|
1291
1286
|
insetScale: "xl",
|
|
1292
1287
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -1296,7 +1291,7 @@ function UploadPreviewModal() {
|
|
|
1296
1291
|
children: [jsxRuntime.jsx(uiKit.CheckBoldIcon, {
|
|
1297
1292
|
color: "success"
|
|
1298
1293
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1299
|
-
intlMessage: _objectSpread$
|
|
1294
|
+
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$3.rowsToBeImported), {}, {
|
|
1300
1295
|
values: {
|
|
1301
1296
|
rowCount: intl.formatNumber(state.uploadFileResponse.rowsCount),
|
|
1302
1297
|
b: getBold$3
|
|
@@ -1308,7 +1303,7 @@ function UploadPreviewModal() {
|
|
|
1308
1303
|
children: [jsxRuntime.jsx(uiKit.CheckBoldIcon, {
|
|
1309
1304
|
color: "success"
|
|
1310
1305
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1311
|
-
intlMessage: _objectSpread$
|
|
1306
|
+
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$3.columnsToBeImported), {}, {
|
|
1312
1307
|
values: {
|
|
1313
1308
|
columnCount: intl.formatNumber(validatedColumns.length),
|
|
1314
1309
|
b: getBold$3
|
|
@@ -1328,7 +1323,7 @@ function UploadPreviewModal() {
|
|
|
1328
1323
|
children: [jsxRuntime.jsx(uiKit.EyeCrossedIcon, {
|
|
1329
1324
|
color: "neutral60"
|
|
1330
1325
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1331
|
-
intlMessage: _objectSpread$
|
|
1326
|
+
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$3.columnsToBeIgnored), {}, {
|
|
1332
1327
|
values: {
|
|
1333
1328
|
columnCount: intl.formatNumber(ignoredColumns.length),
|
|
1334
1329
|
b: getBold$3
|
|
@@ -1354,33 +1349,29 @@ function getBold$3(msg) {
|
|
|
1354
1349
|
});
|
|
1355
1350
|
}
|
|
1356
1351
|
|
|
1357
|
-
function ownKeys$
|
|
1358
|
-
function _objectSpread$
|
|
1352
|
+
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; }
|
|
1353
|
+
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
1354
|
const getNewLine = () => jsxRuntime.jsx("br", {});
|
|
1360
1355
|
const getImportLogsLink = (msg, projectKey) => jsxRuntime.jsx(uiKit.Link, {
|
|
1361
|
-
to:
|
|
1356
|
+
to: `/${projectKey}/operations/import/logs`,
|
|
1362
1357
|
children: msg
|
|
1363
1358
|
});
|
|
1364
1359
|
const ImportConfirmationModal = () => {
|
|
1365
|
-
var _state$uploadFileResp;
|
|
1366
1360
|
const intl = reactIntl.useIntl();
|
|
1367
1361
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1368
1362
|
state = _useImportResourcesCo.state,
|
|
1369
1363
|
onStartImportSuccess = _useImportResourcesCo.onStartImportSuccess,
|
|
1370
1364
|
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
|
-
}),
|
|
1365
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
1366
|
+
projectKey: context.project?.key,
|
|
1367
|
+
projectName: context.project?.name
|
|
1368
|
+
})),
|
|
1378
1369
|
projectKey = _useApplicationContex.projectKey,
|
|
1379
1370
|
projectName = _useApplicationContex.projectName;
|
|
1380
1371
|
const asyncDispatch = sdk.useAsyncDispatch();
|
|
1381
1372
|
const showNotification = actionsGlobal.useShowNotification();
|
|
1382
1373
|
const ImportRunningTextNotification = () => jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1383
|
-
intlMessage: _objectSpread$
|
|
1374
|
+
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$3.uploadNotificationSuccessMessage), {}, {
|
|
1384
1375
|
values: {
|
|
1385
1376
|
newline: getNewLine,
|
|
1386
1377
|
logsLink: msg => getImportLogsLink(msg, projectKey),
|
|
@@ -1390,12 +1381,12 @@ const ImportConfirmationModal = () => {
|
|
|
1390
1381
|
});
|
|
1391
1382
|
return jsxRuntime.jsx(applicationComponents.ConfirmationDialog, {
|
|
1392
1383
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1393
|
-
resourceType: resourceTypeToDisplayName({
|
|
1384
|
+
resourceType: resourceTypeToDisplayName$1({
|
|
1394
1385
|
resourceType: state.resourceType,
|
|
1395
1386
|
isPlural: true
|
|
1396
1387
|
})
|
|
1397
1388
|
}),
|
|
1398
|
-
labelPrimary: intl.formatMessage(messages$
|
|
1389
|
+
labelPrimary: intl.formatMessage(messages$3.startImportButton),
|
|
1399
1390
|
isOpen: true,
|
|
1400
1391
|
onClose: () => onClose({
|
|
1401
1392
|
shouldDeleteImportContainer: true
|
|
@@ -1411,8 +1402,7 @@ const ImportConfirmationModal = () => {
|
|
|
1411
1402
|
},
|
|
1412
1403
|
onConfirm: async () => {
|
|
1413
1404
|
try {
|
|
1414
|
-
|
|
1415
|
-
const canConfirm = projectKey && state.containerKey && ((_state$droppedFile = state.droppedFile) === null || _state$droppedFile === void 0 ? void 0 : _state$droppedFile.name) && state.resourceType;
|
|
1405
|
+
const canConfirm = projectKey && state.containerKey && state.droppedFile?.name && state.resourceType;
|
|
1416
1406
|
if (!canConfirm) return;
|
|
1417
1407
|
onClose();
|
|
1418
1408
|
await processUploadedFile({
|
|
@@ -1446,18 +1436,18 @@ const ImportConfirmationModal = () => {
|
|
|
1446
1436
|
scale: "xl",
|
|
1447
1437
|
children: [jsxRuntime.jsxs("div", {
|
|
1448
1438
|
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1449
|
-
intlMessage: _objectSpread$
|
|
1439
|
+
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$3.confirmationBodyText), {}, {
|
|
1450
1440
|
values: {
|
|
1451
1441
|
projectName: projectName,
|
|
1452
|
-
count: intl.formatNumber(
|
|
1442
|
+
count: intl.formatNumber(state?.uploadFileResponse?.rowsCount || 0),
|
|
1453
1443
|
bold: getBold$2
|
|
1454
1444
|
}
|
|
1455
1445
|
})
|
|
1456
1446
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1457
|
-
intlMessage: messages$
|
|
1447
|
+
intlMessage: messages$3.confirmationBodyNote
|
|
1458
1448
|
})]
|
|
1459
1449
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1460
|
-
intlMessage: messages$
|
|
1450
|
+
intlMessage: messages$3.confirmationBodyQuestion
|
|
1461
1451
|
})]
|
|
1462
1452
|
})
|
|
1463
1453
|
});
|
|
@@ -1470,7 +1460,7 @@ function getBold$2(msg) {
|
|
|
1470
1460
|
});
|
|
1471
1461
|
}
|
|
1472
1462
|
|
|
1473
|
-
var messages = reactIntl.defineMessages({
|
|
1463
|
+
var messages$2 = reactIntl.defineMessages({
|
|
1474
1464
|
row: {
|
|
1475
1465
|
id: 'ImportResourcesModal.row',
|
|
1476
1466
|
description: 'In Upload file error modal - "Row" column',
|
|
@@ -1503,15 +1493,15 @@ var messages = reactIntl.defineMessages({
|
|
|
1503
1493
|
}
|
|
1504
1494
|
});
|
|
1505
1495
|
|
|
1506
|
-
function ownKeys$
|
|
1507
|
-
function _objectSpread$
|
|
1496
|
+
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; }
|
|
1497
|
+
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
1498
|
const getColumns$1 = () => [{
|
|
1509
1499
|
key: 'errorType',
|
|
1510
|
-
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
1500
|
+
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$2.errorType)),
|
|
1511
1501
|
width: 'max-content'
|
|
1512
1502
|
}, {
|
|
1513
1503
|
key: 'details',
|
|
1514
|
-
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
1504
|
+
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$2.details))
|
|
1515
1505
|
}];
|
|
1516
1506
|
const UploadClientSideErrorTable = props => {
|
|
1517
1507
|
var _context;
|
|
@@ -1554,10 +1544,9 @@ function itemRenderer$1(item, column) {
|
|
|
1554
1544
|
}
|
|
1555
1545
|
}
|
|
1556
1546
|
|
|
1557
|
-
function ownKeys$
|
|
1558
|
-
function _objectSpread$
|
|
1547
|
+
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; }
|
|
1548
|
+
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
1549
|
const UploadClientSideErrorsModal = () => {
|
|
1560
|
-
var _state$droppedFile;
|
|
1561
1550
|
const intl = reactIntl.useIntl();
|
|
1562
1551
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1563
1552
|
state = _useImportResourcesCo.state,
|
|
@@ -1568,7 +1557,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1568
1557
|
size: 16,
|
|
1569
1558
|
isOpen: true,
|
|
1570
1559
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1571
|
-
resourceType: resourceTypeToDisplayName({
|
|
1560
|
+
resourceType: resourceTypeToDisplayName$1({
|
|
1572
1561
|
resourceType: state.resourceType,
|
|
1573
1562
|
isPlural: true
|
|
1574
1563
|
})
|
|
@@ -1577,9 +1566,9 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1577
1566
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1578
1567
|
scale: "l",
|
|
1579
1568
|
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1580
|
-
intlMessage: _objectSpread$
|
|
1569
|
+
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$2.uploadingError), {}, {
|
|
1581
1570
|
values: {
|
|
1582
|
-
fileName:
|
|
1571
|
+
fileName: state.droppedFile?.name,
|
|
1583
1572
|
errorsCount: intl.formatNumber(errorsCount),
|
|
1584
1573
|
b: getBold$1
|
|
1585
1574
|
}
|
|
@@ -1594,7 +1583,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1594
1583
|
onClick: () => onClose()
|
|
1595
1584
|
}), jsxRuntime.jsx(uiKit.PrimaryButton, {
|
|
1596
1585
|
iconLeft: jsxRuntime.jsx(uiKit.ImportIcon, {}),
|
|
1597
|
-
label: intl.formatMessage(messages.uploadNewFile),
|
|
1586
|
+
label: intl.formatMessage(messages$2.uploadNewFile),
|
|
1598
1587
|
onClick: () => actions.uploadNewFile()
|
|
1599
1588
|
})]
|
|
1600
1589
|
})]
|
|
@@ -1609,19 +1598,19 @@ function getBold$1(msg) {
|
|
|
1609
1598
|
});
|
|
1610
1599
|
}
|
|
1611
1600
|
|
|
1612
|
-
function ownKeys$
|
|
1613
|
-
function _objectSpread$
|
|
1601
|
+
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; }
|
|
1602
|
+
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
1603
|
const getColumns = () => [{
|
|
1615
1604
|
key: 'row',
|
|
1616
|
-
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
1605
|
+
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages$2.row)),
|
|
1617
1606
|
width: 'max-content'
|
|
1618
1607
|
}, {
|
|
1619
1608
|
key: 'errorType',
|
|
1620
|
-
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
1609
|
+
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages$2.errorType)),
|
|
1621
1610
|
width: 'max-content'
|
|
1622
1611
|
}, {
|
|
1623
1612
|
key: 'details',
|
|
1624
|
-
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
1613
|
+
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages$2.details))
|
|
1625
1614
|
}];
|
|
1626
1615
|
const UploadServerSideErrorTable = props => {
|
|
1627
1616
|
var _context;
|
|
@@ -1672,22 +1661,21 @@ function itemRenderer(item, column) {
|
|
|
1672
1661
|
}
|
|
1673
1662
|
}
|
|
1674
1663
|
|
|
1675
|
-
function ownKeys$
|
|
1676
|
-
function _objectSpread$
|
|
1664
|
+
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; }
|
|
1665
|
+
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
1666
|
const UploadServerSideErrorsModal = () => {
|
|
1678
|
-
var _state$uploadFileResp, _state$droppedFile, _state$uploadFileResp2;
|
|
1679
1667
|
const intl = reactIntl.useIntl();
|
|
1680
1668
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1681
1669
|
state = _useImportResourcesCo.state,
|
|
1682
1670
|
actions = _useImportResourcesCo.actions,
|
|
1683
1671
|
onClose = _useImportResourcesCo.onClose;
|
|
1684
|
-
const errorsCount = getFileUploadErrorsCount(
|
|
1672
|
+
const errorsCount = getFileUploadErrorsCount(state.uploadFileResponse?.results);
|
|
1685
1673
|
const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
|
|
1686
1674
|
return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1687
1675
|
size: 16,
|
|
1688
1676
|
isOpen: true,
|
|
1689
1677
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1690
|
-
resourceType: resourceTypeToDisplayName({
|
|
1678
|
+
resourceType: resourceTypeToDisplayName$1({
|
|
1691
1679
|
resourceType: state.resourceType,
|
|
1692
1680
|
isPlural: true
|
|
1693
1681
|
})
|
|
@@ -1698,15 +1686,15 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1698
1686
|
children: [jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1699
1687
|
scale: "xs",
|
|
1700
1688
|
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1701
|
-
intlMessage: _objectSpread$
|
|
1689
|
+
intlMessage: _objectSpread$3(_objectSpread$3({}, messages$2.uploadingError), {}, {
|
|
1702
1690
|
values: {
|
|
1703
|
-
fileName:
|
|
1691
|
+
fileName: state.droppedFile?.name,
|
|
1704
1692
|
errorsCount: intl.formatNumber(errorsCount),
|
|
1705
1693
|
b: getBold
|
|
1706
1694
|
}
|
|
1707
1695
|
})
|
|
1708
1696
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1709
|
-
intlMessage: _objectSpread$
|
|
1697
|
+
intlMessage: _objectSpread$3(_objectSpread$3({}, messages$2.supportedValuesDocumentation), {}, {
|
|
1710
1698
|
values: {
|
|
1711
1699
|
documentationLink: msg => jsxRuntime.jsx(uiKit.Link, {
|
|
1712
1700
|
tone: "secondary",
|
|
@@ -1718,7 +1706,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1718
1706
|
})
|
|
1719
1707
|
})]
|
|
1720
1708
|
}), jsxRuntime.jsx(UploadServerSideErrorTable, {
|
|
1721
|
-
rows: mapUploadFileErrorsResponseToUploadFileErrorRows(
|
|
1709
|
+
rows: mapUploadFileErrorsResponseToUploadFileErrorRows(state.uploadFileResponse?.results)
|
|
1722
1710
|
}), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1723
1711
|
scale: "m",
|
|
1724
1712
|
justifyContent: "flex-end",
|
|
@@ -1727,7 +1715,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1727
1715
|
onClick: () => onClose()
|
|
1728
1716
|
}), jsxRuntime.jsx(uiKit.PrimaryButton, {
|
|
1729
1717
|
iconLeft: jsxRuntime.jsx(uiKit.ImportIcon, {}),
|
|
1730
|
-
label: intl.formatMessage(messages.uploadNewFile),
|
|
1718
|
+
label: intl.formatMessage(messages$2.uploadNewFile),
|
|
1731
1719
|
onClick: () => actions.uploadNewFile()
|
|
1732
1720
|
})]
|
|
1733
1721
|
})]
|
|
@@ -1743,18 +1731,17 @@ function getBold(msg) {
|
|
|
1743
1731
|
}
|
|
1744
1732
|
|
|
1745
1733
|
const UploadResult = () => {
|
|
1746
|
-
var _state$uploadFileResp;
|
|
1747
1734
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1748
1735
|
state = _useImportResourcesCo.state;
|
|
1749
1736
|
if (state.fileUploadClientSideErrors.length > 0) return jsxRuntime.jsx(UploadClientSideErrorsModal, {});
|
|
1750
|
-
if (
|
|
1737
|
+
if (state.uploadFileResponse?.invalid > 0) return jsxRuntime.jsx(UploadServerSideErrorsModal, {});
|
|
1751
1738
|
return jsxRuntime.jsx(UploadPreviewModal, {});
|
|
1752
1739
|
};
|
|
1753
1740
|
|
|
1754
|
-
function ownKeys$
|
|
1755
|
-
function _objectSpread$
|
|
1741
|
+
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; }
|
|
1742
|
+
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
1743
|
var FileIcon = function FileIcon(props) {
|
|
1757
|
-
return jsxRuntime.jsxs("svg", _objectSpread$
|
|
1744
|
+
return jsxRuntime.jsxs("svg", _objectSpread$2(_objectSpread$2({}, props), {}, {
|
|
1758
1745
|
children: [jsxRuntime.jsx("mask", {
|
|
1759
1746
|
id: "a",
|
|
1760
1747
|
style: {
|
|
@@ -1785,17 +1772,16 @@ FileIcon.defaultProps = {
|
|
|
1785
1772
|
xmlns: "http://www.w3.org/2000/svg"
|
|
1786
1773
|
};
|
|
1787
1774
|
const Uploading = () => {
|
|
1788
|
-
var _state$droppedFile;
|
|
1789
1775
|
const intl = reactIntl.useIntl();
|
|
1790
1776
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1791
1777
|
state = _useImportResourcesCo.state,
|
|
1792
1778
|
actions = _useImportResourcesCo.actions,
|
|
1793
1779
|
onClose = _useImportResourcesCo.onClose;
|
|
1794
|
-
const resourceTypePlural = resourceTypeToDisplayName({
|
|
1780
|
+
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1795
1781
|
resourceType: state.resourceType,
|
|
1796
1782
|
isPlural: true
|
|
1797
1783
|
});
|
|
1798
|
-
if (
|
|
1784
|
+
if (state.droppedFile?.name) return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
1799
1785
|
size: 16,
|
|
1800
1786
|
isOpen: true,
|
|
1801
1787
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
@@ -1855,6 +1841,97 @@ const CurrentStep = () => {
|
|
|
1855
1841
|
return steps[state.currentStep] || null;
|
|
1856
1842
|
};
|
|
1857
1843
|
|
|
1844
|
+
var messages$1 = reactIntl.defineMessages({
|
|
1845
|
+
products: {
|
|
1846
|
+
id: 'ImportResourcesModal.radio.products',
|
|
1847
|
+
description: 'Label for the products radio button',
|
|
1848
|
+
defaultMessage: 'Products (including variants, assets, prices and images)'
|
|
1849
|
+
},
|
|
1850
|
+
inventories: {
|
|
1851
|
+
id: 'ImportResourcesModal.radio.inventories',
|
|
1852
|
+
description: 'Label for the inventories radio button',
|
|
1853
|
+
defaultMessage: 'Inventories'
|
|
1854
|
+
},
|
|
1855
|
+
categories: {
|
|
1856
|
+
id: 'ImportResourcesModal.radio.categories',
|
|
1857
|
+
description: 'Label for the categories radio button',
|
|
1858
|
+
defaultMessage: 'Categories'
|
|
1859
|
+
}
|
|
1860
|
+
});
|
|
1861
|
+
|
|
1862
|
+
const resourceTypeToDisplayName = resourceType => {
|
|
1863
|
+
switch (resourceType) {
|
|
1864
|
+
case 'product':
|
|
1865
|
+
return messages$1.products;
|
|
1866
|
+
case 'inventory':
|
|
1867
|
+
return messages$1.inventories;
|
|
1868
|
+
case 'category':
|
|
1869
|
+
return messages$1.categories;
|
|
1870
|
+
default:
|
|
1871
|
+
throw new Error(`Unknown resource type: ${resourceType}`);
|
|
1872
|
+
}
|
|
1873
|
+
};
|
|
1874
|
+
const ResourceTypeSelection = () => {
|
|
1875
|
+
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1876
|
+
state = _useImportResourcesCo.state,
|
|
1877
|
+
actions = _useImportResourcesCo.actions,
|
|
1878
|
+
resourceTypes = _useImportResourcesCo.resourceTypes;
|
|
1879
|
+
return jsxRuntime.jsx(uiKit.RadioInput.Group, {
|
|
1880
|
+
value: state.resourceType,
|
|
1881
|
+
onChange: e => {
|
|
1882
|
+
actions.setResourceType(e.target.value);
|
|
1883
|
+
},
|
|
1884
|
+
direction: "stack",
|
|
1885
|
+
directionProps: {
|
|
1886
|
+
scale: 's'
|
|
1887
|
+
},
|
|
1888
|
+
children: _mapInstanceProperty__default["default"](resourceTypes).call(resourceTypes, resourceType => jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
1889
|
+
value: resourceType,
|
|
1890
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1891
|
+
intlMessage: resourceTypeToDisplayName(resourceType)
|
|
1892
|
+
})
|
|
1893
|
+
}, resourceType))
|
|
1894
|
+
});
|
|
1895
|
+
};
|
|
1896
|
+
|
|
1897
|
+
var messages = reactIntl.defineMessages({
|
|
1898
|
+
fileUploadInstructions: {
|
|
1899
|
+
id: 'ImportResourcesModal.fileUploadInstructions',
|
|
1900
|
+
description: 'Label for the modal category description',
|
|
1901
|
+
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>.'
|
|
1902
|
+
}
|
|
1903
|
+
});
|
|
1904
|
+
|
|
1905
|
+
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; }
|
|
1906
|
+
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; }
|
|
1907
|
+
const Instructions = () => {
|
|
1908
|
+
const intl = reactIntl.useIntl();
|
|
1909
|
+
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1910
|
+
state = _useImportResourcesCo.state;
|
|
1911
|
+
const templateLink = RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS[state.resourceType];
|
|
1912
|
+
const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
|
|
1913
|
+
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1914
|
+
intlMessage: _objectSpread$1(_objectSpread$1({}, messages.fileUploadInstructions), {}, {
|
|
1915
|
+
values: {
|
|
1916
|
+
fileSize: intl.formatNumber(FILE_SIZE_LIMITS_MB[state.resourceType]),
|
|
1917
|
+
rowLimit: intl.formatNumber(ROW_LIMITS[state.resourceType]),
|
|
1918
|
+
csvTemplateLink: msg => jsxRuntime.jsx(uiKit.Link, {
|
|
1919
|
+
tone: "secondary",
|
|
1920
|
+
isExternal: true,
|
|
1921
|
+
to: templateLink,
|
|
1922
|
+
children: msg
|
|
1923
|
+
}),
|
|
1924
|
+
documentationLink: msg => jsxRuntime.jsx(uiKit.Link, {
|
|
1925
|
+
tone: "secondary",
|
|
1926
|
+
isExternal: true,
|
|
1927
|
+
to: documentationLink,
|
|
1928
|
+
children: msg
|
|
1929
|
+
})
|
|
1930
|
+
}
|
|
1931
|
+
})
|
|
1932
|
+
});
|
|
1933
|
+
};
|
|
1934
|
+
|
|
1858
1935
|
const getChunkImport = locale => {
|
|
1859
1936
|
const intlLocale = i18n.mapLocaleToIntlLocale(locale);
|
|
1860
1937
|
switch (intlLocale) {
|
|
@@ -1880,8 +1957,8 @@ const loadMessages = async locale => {
|
|
|
1880
1957
|
return i18n.parseChunkImport(chunkImport);
|
|
1881
1958
|
} catch (error) {
|
|
1882
1959
|
// eslint-disable-next-line no-console
|
|
1883
|
-
console.warn(
|
|
1884
|
-
sentry.reportErrorToSentry(new Error(
|
|
1960
|
+
console.warn(`Something went wrong while loading the import-resources-modal messages for ${locale}`, error);
|
|
1961
|
+
sentry.reportErrorToSentry(new Error(`Something went wrong while loading the import-resources-modal messages for ${locale}`), {
|
|
1885
1962
|
extra: error
|
|
1886
1963
|
});
|
|
1887
1964
|
return {};
|
|
@@ -1924,14 +2001,23 @@ const useAsyncIntlMessages = (locale, loader) => {
|
|
|
1924
2001
|
};
|
|
1925
2002
|
|
|
1926
2003
|
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
|
|
2004
|
+
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
2005
|
const ImportResourcesModal = props => {
|
|
2006
|
+
var _context;
|
|
1929
2007
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
1930
2008
|
locale: context.user && context.user.locale
|
|
1931
2009
|
})),
|
|
1932
2010
|
locale = _useApplicationContex.locale;
|
|
1933
2011
|
const messages = useAsyncIntlMessages(locale, loadMessages);
|
|
1934
2012
|
if (!props.isOpen || messages.isLoading) return null;
|
|
2013
|
+
if (!props.resourceTypes?.length) {
|
|
2014
|
+
console.error('No resource types provided for import resources modal');
|
|
2015
|
+
return null;
|
|
2016
|
+
}
|
|
2017
|
+
if (!_everyInstanceProperty__default["default"](_context = props.resourceTypes).call(_context, isResourceType)) {
|
|
2018
|
+
console.error('Invalid resource types provided for import resources modal');
|
|
2019
|
+
return null;
|
|
2020
|
+
}
|
|
1935
2021
|
return jsxRuntime.jsx(reactIntl.IntlProvider, {
|
|
1936
2022
|
locale: locale,
|
|
1937
2023
|
messages: messages.messages,
|
|
@@ -1945,5 +2031,5 @@ ImportResourcesModal.displayName = 'ImportResourcesModal';
|
|
|
1945
2031
|
exports.EnabledDropArea = EnabledDropArea;
|
|
1946
2032
|
exports.FileDropped = FileDropped;
|
|
1947
2033
|
exports.ImportResourcesModal = ImportResourcesModal;
|
|
1948
|
-
exports.messages = messages$
|
|
2034
|
+
exports.messages = messages$4;
|
|
1949
2035
|
exports.useImportResourcesContext = useImportResourcesContext;
|