@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
|
@@ -7,14 +7,13 @@ import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-st
|
|
|
7
7
|
import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
8
8
|
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
9
9
|
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
10
|
+
import _everyInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/every';
|
|
10
11
|
import { defineMessages, useIntl, FormattedMessage, IntlProvider } from 'react-intl';
|
|
11
12
|
import { oidcStorage, useApplicationContext } from '@commercetools-frontend/application-shell-connectors';
|
|
12
13
|
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
13
14
|
import React, { useContext, lazy, useState, useEffect } from 'react';
|
|
14
15
|
import { actions, useAsyncDispatch } from '@commercetools-frontend/sdk';
|
|
15
16
|
import { MC_API_PROXY_TARGETS, DOMAINS } from '@commercetools-frontend/constants';
|
|
16
|
-
import _everyInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/every';
|
|
17
|
-
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
18
17
|
import { plural } from 'pluralize';
|
|
19
18
|
import _Promise from '@babel/runtime-corejs3/core-js-stable/promise';
|
|
20
19
|
import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
|
|
@@ -25,7 +24,6 @@ import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/ins
|
|
|
25
24
|
import Papa from 'papaparse';
|
|
26
25
|
import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
|
|
27
26
|
import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
|
|
28
|
-
import _someInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/some';
|
|
29
27
|
import '@babel/runtime-corejs3/core-js-stable/instance/starts-with';
|
|
30
28
|
import 'querystring';
|
|
31
29
|
import 'ramda';
|
|
@@ -33,15 +31,16 @@ import { createHttpClientOptions, buildApiUrl } from '@commercetools-frontend/ap
|
|
|
33
31
|
import _Reflect$construct from '@babel/runtime-corejs3/core-js-stable/reflect/construct';
|
|
34
32
|
import _createClass from '@babel/runtime-corejs3/helpers/esm/createClass';
|
|
35
33
|
import _classCallCheck from '@babel/runtime-corejs3/helpers/esm/classCallCheck';
|
|
36
|
-
import _inherits from '@babel/runtime-corejs3/helpers/esm/inherits';
|
|
37
34
|
import _possibleConstructorReturn from '@babel/runtime-corejs3/helpers/esm/possibleConstructorReturn';
|
|
38
35
|
import _getPrototypeOf from '@babel/runtime-corejs3/helpers/esm/getPrototypeOf';
|
|
36
|
+
import _inherits from '@babel/runtime-corejs3/helpers/esm/inherits';
|
|
39
37
|
import _wrapNativeSuper from '@babel/runtime-corejs3/helpers/esm/wrapNativeSuper';
|
|
40
38
|
import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
41
39
|
import { FormDialog, PageContentNarrow, ConfirmationDialog, InfoDialog } from '@commercetools-frontend/application-components';
|
|
42
|
-
import { customProperties, Constraints, Spacings, Text, Link, Card, CheckBoldIcon, EyeCrossedIcon, usePaginationState, PageNavigator, Stamp, SecondaryButton, PrimaryButton, ImportIcon, ProgressBar } from '@commercetools-frontend/ui-kit';
|
|
40
|
+
import { customProperties, Constraints, Spacings, Grid, designTokens, Text, Link, Card, CheckBoldIcon, EyeCrossedIcon, usePaginationState, PageNavigator, Stamp, SecondaryButton, PrimaryButton, ImportIcon, ProgressBar, RadioInput } from '@commercetools-frontend/ui-kit';
|
|
43
41
|
import { useShowNotification } from '@commercetools-frontend/actions-global';
|
|
44
42
|
import { reportErrorToSentry } from '@commercetools-frontend/sentry';
|
|
43
|
+
import _someInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/some';
|
|
45
44
|
import { useDropzone } from 'react-dropzone';
|
|
46
45
|
import _styled from '@emotion/styled/base';
|
|
47
46
|
import { css } from '@emotion/react';
|
|
@@ -59,7 +58,7 @@ function isResourceType(maybeResourceType) {
|
|
|
59
58
|
}
|
|
60
59
|
function assertResourceType(maybeResourceType) {
|
|
61
60
|
if (isResourceType(maybeResourceType)) return;
|
|
62
|
-
throw new Error(
|
|
61
|
+
throw new Error(`Invalid value: ${maybeResourceType}`);
|
|
63
62
|
}
|
|
64
63
|
function isError(maybeError) {
|
|
65
64
|
if (maybeError instanceof Error) return true;
|
|
@@ -74,7 +73,6 @@ function hasRequiredFields(maybeValidObject, requiredFields) {
|
|
|
74
73
|
return typeof maybeValidObject === 'object' && maybeValidObject !== null && _everyInstanceProperty(requiredFields).call(requiredFields, property => hasOwnProperty(maybeValidObject, property));
|
|
75
74
|
}
|
|
76
75
|
|
|
77
|
-
var _context;
|
|
78
76
|
const DEFAULT_DELIMITER = ',';
|
|
79
77
|
const INITIAL_COLUMN_DISPLAY_COUNT = 8;
|
|
80
78
|
const IMPORT_TAG_KEYS = {
|
|
@@ -83,7 +81,7 @@ const IMPORT_TAG_KEYS = {
|
|
|
83
81
|
const IMPORT_TAG_VALUES = {
|
|
84
82
|
fileUpload: 'file-upload'
|
|
85
83
|
};
|
|
86
|
-
const TAG_KEY_SOURCE_FILE_UPLOAD =
|
|
84
|
+
const TAG_KEY_SOURCE_FILE_UPLOAD = `${IMPORT_TAG_KEYS.source}:${IMPORT_TAG_VALUES.fileUpload}`;
|
|
87
85
|
|
|
88
86
|
const FILE_SIZE_LIMITS_MB = {
|
|
89
87
|
category: 10,
|
|
@@ -91,9 +89,9 @@ const FILE_SIZE_LIMITS_MB = {
|
|
|
91
89
|
product: 35
|
|
92
90
|
};
|
|
93
91
|
const ROW_LIMITS = {
|
|
94
|
-
category:
|
|
95
|
-
inventory:
|
|
96
|
-
product:
|
|
92
|
+
category: 5_000,
|
|
93
|
+
inventory: 4_000,
|
|
94
|
+
product: 70_000
|
|
97
95
|
};
|
|
98
96
|
const RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS = {
|
|
99
97
|
category: 'https://docs.commercetools.com/merchant-center/downloads/category_import_template.csv',
|
|
@@ -221,76 +219,67 @@ const encodeFileNameWithTimestampToContainerKey = fileName => {
|
|
|
221
219
|
};
|
|
222
220
|
|
|
223
221
|
function getCreateImportContainerURL(projectKey) {
|
|
224
|
-
return
|
|
222
|
+
return `/${projectKey}/import-containers`;
|
|
225
223
|
}
|
|
226
224
|
function getDeleteImportContainerURL(projectKey, containerKey) {
|
|
227
|
-
|
|
228
|
-
return _concatInstanceProperty(_context6 = "/".concat(projectKey, "/import-containers/")).call(_context6, containerKey);
|
|
225
|
+
return `/${projectKey}/import-containers/${containerKey}`;
|
|
229
226
|
}
|
|
230
227
|
function getFileUploadURL(projectKey, resourceType, containerKey) {
|
|
231
|
-
|
|
232
|
-
return _concatInstanceProperty(_context8 = _concatInstanceProperty(_context9 = "/".concat(projectKey, "/")).call(_context9, plural(resourceType), "/import-containers/")).call(_context8, containerKey, "/file-upload");
|
|
228
|
+
return `/${projectKey}/${plural(resourceType)}/import-containers/${containerKey}/file-upload`;
|
|
233
229
|
}
|
|
234
230
|
function getProccessFileURL(projectKey, resourceType, containerKey) {
|
|
235
|
-
|
|
236
|
-
return _concatInstanceProperty(_context10 = _concatInstanceProperty(_context11 = "/".concat(projectKey, "/")).call(_context11, plural(resourceType), "/import-containers/")).call(_context10, containerKey, "/process-file");
|
|
231
|
+
return `/${projectKey}/${plural(resourceType)}/import-containers/${containerKey}/process-file`;
|
|
237
232
|
}
|
|
238
233
|
|
|
239
|
-
function
|
|
234
|
+
function _callSuper$3(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$3() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
240
235
|
function _isNativeReflectConstruct$3() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$3 = function () { return !!t; })(); }
|
|
241
236
|
let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
|
|
242
|
-
_inherits(UnexpectedResourceTypeError, _Error);
|
|
243
|
-
var _super = _createSuper$3(UnexpectedResourceTypeError);
|
|
244
237
|
function UnexpectedResourceTypeError(resourceType) {
|
|
245
238
|
var _this;
|
|
246
239
|
_classCallCheck(this, UnexpectedResourceTypeError);
|
|
247
|
-
_this =
|
|
240
|
+
_this = _callSuper$3(this, UnexpectedResourceTypeError, [`Unexpected resource type "${resourceType}"`]);
|
|
248
241
|
_this.name = 'UnexpectedResourceTypeError';
|
|
249
242
|
return _this;
|
|
250
243
|
}
|
|
244
|
+
_inherits(UnexpectedResourceTypeError, _Error);
|
|
251
245
|
return _createClass(UnexpectedResourceTypeError);
|
|
252
246
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
253
247
|
|
|
254
|
-
function
|
|
248
|
+
function _callSuper$2(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$2() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
255
249
|
function _isNativeReflectConstruct$2() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$2 = function () { return !!t; })(); }
|
|
256
250
|
let MissingImportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
257
|
-
_inherits(MissingImportResourceProviderError, _Error);
|
|
258
|
-
var _super = _createSuper$2(MissingImportResourceProviderError);
|
|
259
251
|
function MissingImportResourceProviderError() {
|
|
260
252
|
var _this;
|
|
261
253
|
_classCallCheck(this, MissingImportResourceProviderError);
|
|
262
|
-
_this =
|
|
254
|
+
_this = _callSuper$2(this, MissingImportResourceProviderError, ['useImportResourcesContext must be used within ImportResourcesProvider']);
|
|
263
255
|
_this.name = 'MissingImportResourceProviderError';
|
|
264
256
|
return _this;
|
|
265
257
|
}
|
|
258
|
+
_inherits(MissingImportResourceProviderError, _Error);
|
|
266
259
|
return _createClass(MissingImportResourceProviderError);
|
|
267
260
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
268
261
|
|
|
269
|
-
function
|
|
262
|
+
function _callSuper$1(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
270
263
|
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function () { return !!t; })(); }
|
|
271
264
|
let UnexpectedColumnError = /*#__PURE__*/function (_Error) {
|
|
272
|
-
_inherits(UnexpectedColumnError, _Error);
|
|
273
|
-
var _super = _createSuper$1(UnexpectedColumnError);
|
|
274
265
|
function UnexpectedColumnError(columnName) {
|
|
275
266
|
var _this;
|
|
276
267
|
_classCallCheck(this, UnexpectedColumnError);
|
|
277
|
-
_this =
|
|
268
|
+
_this = _callSuper$1(this, UnexpectedColumnError, [`Unexpected column "${columnName}"`]);
|
|
278
269
|
_this.name = 'UnexpectedColumnError';
|
|
279
270
|
return _this;
|
|
280
271
|
}
|
|
272
|
+
_inherits(UnexpectedColumnError, _Error);
|
|
281
273
|
return _createClass(UnexpectedColumnError);
|
|
282
274
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
283
275
|
|
|
284
|
-
function
|
|
276
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
285
277
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
286
278
|
let HttpError = /*#__PURE__*/function (_Error) {
|
|
287
|
-
_inherits(HttpError, _Error);
|
|
288
|
-
var _super = _createSuper(HttpError);
|
|
289
279
|
function HttpError(statusCode, statusText, errorData) {
|
|
290
|
-
var _context;
|
|
291
280
|
var _this;
|
|
292
281
|
_classCallCheck(this, HttpError);
|
|
293
|
-
_this =
|
|
282
|
+
_this = _callSuper(this, HttpError, [`HTTP Error! Status code: ${statusCode}, message: "${statusText ? statusText : ''}"`]);
|
|
294
283
|
_this.statusCode = void 0;
|
|
295
284
|
_this.errorData = void 0;
|
|
296
285
|
_this.name = 'HttpError';
|
|
@@ -298,14 +287,14 @@ let HttpError = /*#__PURE__*/function (_Error) {
|
|
|
298
287
|
_this.errorData = errorData;
|
|
299
288
|
return _this;
|
|
300
289
|
}
|
|
290
|
+
_inherits(HttpError, _Error);
|
|
301
291
|
return _createClass(HttpError);
|
|
302
292
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
303
293
|
|
|
304
294
|
function ownKeys$e(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
305
|
-
function _objectSpread$e(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
295
|
+
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(_context2 = ownKeys$e(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys$e(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
306
296
|
const addProxyPrefixToUrl = (uri, proxy) => {
|
|
307
|
-
|
|
308
|
-
return proxy ? _concatInstanceProperty(_context = "/proxy/".concat(proxy)).call(_context, uri) : uri;
|
|
297
|
+
return proxy ? `/proxy/${proxy}${uri}` : uri;
|
|
309
298
|
};
|
|
310
299
|
const fetchUsingXhr = _ref2 => {
|
|
311
300
|
let url = _ref2.url,
|
|
@@ -317,15 +306,15 @@ const fetchUsingXhr = _ref2 => {
|
|
|
317
306
|
const options = createHttpClientOptions({
|
|
318
307
|
headers: _objectSpread$e({
|
|
319
308
|
'Content-Type': 'application/json'
|
|
320
|
-
}, config
|
|
309
|
+
}, config?.headers)
|
|
321
310
|
});
|
|
322
311
|
const xhr = new XMLHttpRequest();
|
|
323
|
-
xhr.open(config
|
|
312
|
+
xhr.open(config?.method, buildApiUrl(addProxyPrefixToUrl(url, config?.proxy)), true);
|
|
324
313
|
// Include cookies in the request
|
|
325
314
|
xhr.withCredentials = true;
|
|
326
315
|
if (options.headers) {
|
|
327
|
-
var
|
|
328
|
-
_forEachInstanceProperty(
|
|
316
|
+
var _context;
|
|
317
|
+
_forEachInstanceProperty(_context = _Object$keys(options.headers)).call(_context, key => {
|
|
329
318
|
xhr.setRequestHeader(key, options.headers[key]);
|
|
330
319
|
});
|
|
331
320
|
}
|
|
@@ -494,7 +483,7 @@ function reducer(state, action) {
|
|
|
494
483
|
throw new Error(getUnknownActionError(action));
|
|
495
484
|
}
|
|
496
485
|
function getUnknownActionError(actionType) {
|
|
497
|
-
return
|
|
486
|
+
return `Unkown type: ${actionType}`;
|
|
498
487
|
}
|
|
499
488
|
const initialState = {
|
|
500
489
|
currentStep: 1,
|
|
@@ -511,16 +500,13 @@ function ownKeys$b(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySy
|
|
|
511
500
|
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(_context = ownKeys$b(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$b(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
512
501
|
const ImportResourcesContext = /*#__PURE__*/React.createContext();
|
|
513
502
|
const ImportResourcesProvider = props => {
|
|
514
|
-
const _useApplicationContex = useApplicationContext(context => {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key
|
|
518
|
-
};
|
|
519
|
-
}),
|
|
503
|
+
const _useApplicationContex = useApplicationContext(context => ({
|
|
504
|
+
projectKey: context.project?.key
|
|
505
|
+
})),
|
|
520
506
|
projectKey = _useApplicationContex.projectKey;
|
|
521
507
|
const asyncDispatch = useAsyncDispatch();
|
|
522
508
|
const _React$useReducer = React.useReducer(reducer, _objectSpread$b(_objectSpread$b({}, initialState), {}, {
|
|
523
|
-
resourceType: props.
|
|
509
|
+
resourceType: props.resourceTypes[0]
|
|
524
510
|
})),
|
|
525
511
|
_React$useReducer2 = _slicedToArray(_React$useReducer, 2),
|
|
526
512
|
state = _React$useReducer2[0],
|
|
@@ -529,13 +515,13 @@ const ImportResourcesProvider = props => {
|
|
|
529
515
|
type: 'setCurrentStep',
|
|
530
516
|
currentStep
|
|
531
517
|
});
|
|
532
|
-
const setUploadFileResponse =
|
|
518
|
+
const setUploadFileResponse = uploadFileResponse => dispatch({
|
|
533
519
|
type: 'setUploadFileResponse',
|
|
534
|
-
uploadFileResponse:
|
|
520
|
+
uploadFileResponse: uploadFileResponse
|
|
535
521
|
});
|
|
536
|
-
const setResourceType =
|
|
522
|
+
const setResourceType = resourceType => dispatch({
|
|
537
523
|
type: 'setResourceType',
|
|
538
|
-
resourceType:
|
|
524
|
+
resourceType: resourceType
|
|
539
525
|
});
|
|
540
526
|
const setContainerKey = containerKey => dispatch({
|
|
541
527
|
type: 'setContainerKey',
|
|
@@ -547,17 +533,17 @@ const ImportResourcesProvider = props => {
|
|
|
547
533
|
const uploadNewFile = () => dispatch({
|
|
548
534
|
type: 'uploadNewFile'
|
|
549
535
|
});
|
|
550
|
-
const setDroppedFile =
|
|
536
|
+
const setDroppedFile = droppedFile => dispatch({
|
|
551
537
|
type: 'setDroppedFile',
|
|
552
|
-
droppedFile:
|
|
538
|
+
droppedFile: droppedFile
|
|
553
539
|
});
|
|
554
|
-
const setAbortController =
|
|
540
|
+
const setAbortController = abortController => dispatch({
|
|
555
541
|
type: 'setAbortController',
|
|
556
|
-
abortController:
|
|
542
|
+
abortController: abortController
|
|
557
543
|
});
|
|
558
|
-
const setFileUploadClientSideErrors =
|
|
544
|
+
const setFileUploadClientSideErrors = fileUploadClientSideErrors => dispatch({
|
|
559
545
|
type: 'setFileUploadClientSideErrors',
|
|
560
|
-
fileUploadClientSideErrors:
|
|
546
|
+
fileUploadClientSideErrors: fileUploadClientSideErrors
|
|
561
547
|
});
|
|
562
548
|
const setProgress = progress => dispatch({
|
|
563
549
|
type: 'setProgress',
|
|
@@ -577,6 +563,7 @@ const ImportResourcesProvider = props => {
|
|
|
577
563
|
return jsx(ImportResourcesContext.Provider, {
|
|
578
564
|
value: {
|
|
579
565
|
state,
|
|
566
|
+
resourceTypes: props.resourceTypes,
|
|
580
567
|
onClose: handleClose,
|
|
581
568
|
onStartImportSuccess: handleStartImportSuccess,
|
|
582
569
|
actions: {
|
|
@@ -604,7 +591,7 @@ function useImportResourcesContext() {
|
|
|
604
591
|
return context;
|
|
605
592
|
}
|
|
606
593
|
|
|
607
|
-
var messages$
|
|
594
|
+
var messages$5 = defineMessages({
|
|
608
595
|
fileSizeExceededTitle: {
|
|
609
596
|
id: 'ImportResourcesModal.sizeExceededTitle',
|
|
610
597
|
defaultMessage: 'File size exceeded'
|
|
@@ -651,10 +638,7 @@ var messages$3 = defineMessages({
|
|
|
651
638
|
|
|
652
639
|
const useUpload = () => {
|
|
653
640
|
const intl = useIntl();
|
|
654
|
-
const projectKey = useApplicationContext(context =>
|
|
655
|
-
var _context$project;
|
|
656
|
-
return (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key;
|
|
657
|
-
});
|
|
641
|
+
const projectKey = useApplicationContext(context => context.project?.key);
|
|
658
642
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
659
643
|
state = _useImportResourcesCo.state,
|
|
660
644
|
actions = _useImportResourcesCo.actions;
|
|
@@ -669,25 +653,25 @@ const useUpload = () => {
|
|
|
669
653
|
const errors = [];
|
|
670
654
|
const delimiterCheck = await checkDelimiter(file);
|
|
671
655
|
if (!delimiterCheck.isValid) errors.push({
|
|
672
|
-
title: intl.formatMessage(messages$
|
|
673
|
-
description: intl.formatMessage(messages$
|
|
656
|
+
title: intl.formatMessage(messages$5.dropAreaWrongDelimiterTitle),
|
|
657
|
+
description: intl.formatMessage(messages$5.dropAreaWrongDelimiterDescription, {
|
|
674
658
|
delimiter: delimiterCheck.delimiter
|
|
675
659
|
})
|
|
676
660
|
});
|
|
677
661
|
const rowCount = await getRowCount(file);
|
|
678
662
|
if (rowCount < 1) errors.push({
|
|
679
|
-
title: intl.formatMessage(messages$
|
|
680
|
-
description: intl.formatMessage(messages$
|
|
663
|
+
title: intl.formatMessage(messages$5.dropAreaNotEnoughRowsTitle),
|
|
664
|
+
description: intl.formatMessage(messages$5.dropAreaNotEnoughRowsDescription)
|
|
681
665
|
});
|
|
682
666
|
if (state.resourceType && file.size > toBytes(FILE_SIZE_LIMITS_MB[state.resourceType])) errors.push({
|
|
683
|
-
title: intl.formatMessage(messages$
|
|
684
|
-
description: intl.formatMessage(messages$
|
|
667
|
+
title: intl.formatMessage(messages$5.fileSizeExceededTitle),
|
|
668
|
+
description: intl.formatMessage(messages$5.fileSizeExceededDescription, {
|
|
685
669
|
fileSizeLimit: intl.formatNumber(FILE_SIZE_LIMITS_MB[state.resourceType])
|
|
686
670
|
})
|
|
687
671
|
});
|
|
688
672
|
if (state.resourceType && rowCount > ROW_LIMITS[state.resourceType]) errors.push({
|
|
689
|
-
title: intl.formatMessage(messages$
|
|
690
|
-
description: intl.formatMessage(messages$
|
|
673
|
+
title: intl.formatMessage(messages$5.rowLimitExceededTitle),
|
|
674
|
+
description: intl.formatMessage(messages$5.rowLimitExceededDescription, {
|
|
691
675
|
rowLimit: intl.formatNumber(ROW_LIMITS[state.resourceType])
|
|
692
676
|
})
|
|
693
677
|
});
|
|
@@ -704,26 +688,24 @@ const useUpload = () => {
|
|
|
704
688
|
return;
|
|
705
689
|
}
|
|
706
690
|
if (error instanceof HttpError) {
|
|
707
|
-
|
|
708
|
-
if (((_error$errorData = error.errorData) === null || _error$errorData === void 0 ? void 0 : _error$errorData.code) === 'MISSING_KEY_ERROR') {
|
|
691
|
+
if (error.errorData?.code === 'MISSING_KEY_ERROR') {
|
|
709
692
|
actions.cancelImport();
|
|
710
693
|
showNotification({
|
|
711
694
|
kind: 'error',
|
|
712
695
|
domain: DOMAINS.PAGE,
|
|
713
696
|
text: error.errorData.message
|
|
714
697
|
});
|
|
715
|
-
} else if (
|
|
698
|
+
} else if (error.errorData?.invalid > 0) {
|
|
716
699
|
actions.setUploadFileResponse(error.errorData);
|
|
717
700
|
} else {
|
|
718
701
|
actions.cancelImport();
|
|
719
702
|
showNotification({
|
|
720
703
|
kind: 'error',
|
|
721
704
|
domain: DOMAINS.PAGE,
|
|
722
|
-
text: intl.formatMessage(messages$
|
|
705
|
+
text: intl.formatMessage(messages$5.unexpectedError)
|
|
723
706
|
});
|
|
724
707
|
}
|
|
725
708
|
} else {
|
|
726
|
-
var _state$droppedFile;
|
|
727
709
|
actions.cancelImport();
|
|
728
710
|
showNotification({
|
|
729
711
|
kind: 'error',
|
|
@@ -736,7 +718,7 @@ const useUpload = () => {
|
|
|
736
718
|
projectKey,
|
|
737
719
|
containerKey: state.containerKey,
|
|
738
720
|
resourceType: state.resourceType,
|
|
739
|
-
fileSizeInBytes:
|
|
721
|
+
fileSizeInBytes: state.droppedFile?.size
|
|
740
722
|
}
|
|
741
723
|
});
|
|
742
724
|
}
|
|
@@ -783,7 +765,7 @@ const useUpload = () => {
|
|
|
783
765
|
};
|
|
784
766
|
};
|
|
785
767
|
|
|
786
|
-
function resourceTypeToDisplayName(_ref) {
|
|
768
|
+
function resourceTypeToDisplayName$1(_ref) {
|
|
787
769
|
let resourceType = _ref.resourceType,
|
|
788
770
|
_ref$isUpperCase = _ref.isUpperCase,
|
|
789
771
|
isUpperCase = _ref$isUpperCase === void 0 ? false : _ref$isUpperCase,
|
|
@@ -797,6 +779,9 @@ function resourceTypeToDisplayName(_ref) {
|
|
|
797
779
|
case 'product':
|
|
798
780
|
displayName = isPlural ? 'Products' : 'Product';
|
|
799
781
|
break;
|
|
782
|
+
case 'inventory':
|
|
783
|
+
displayName = isPlural ? 'Inventories' : 'Inventory';
|
|
784
|
+
break;
|
|
800
785
|
default:
|
|
801
786
|
throw new UnexpectedResourceTypeError(resourceType);
|
|
802
787
|
}
|
|
@@ -814,8 +799,12 @@ const getBorderColor = state => {
|
|
|
814
799
|
const getDashedBorder = function () {
|
|
815
800
|
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
|
|
816
801
|
const color = getBorderColor(state);
|
|
817
|
-
const svgContent =
|
|
818
|
-
|
|
802
|
+
const svgContent = `
|
|
803
|
+
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
|
|
804
|
+
<rect width="100%" height="100%" fill="none" stroke="${color}" stroke-width="2px" stroke-dasharray="6,6" stroke-dashoffset="0" stroke-linecap="square"/>
|
|
805
|
+
</svg>
|
|
806
|
+
`;
|
|
807
|
+
return `data:image/svg+xml,${encodeURIComponent(svgContent)}`;
|
|
819
808
|
};
|
|
820
809
|
const base = /*#__PURE__*/css("border-radius:", 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= */");
|
|
821
810
|
const disabled = /*#__PURE__*/css(process.env.NODE_ENV === "production" ? "" : ";label:disabled;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFnQ29CIiwiZmlsZSI6InN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0J1xuaW1wb3J0IHsgY3VzdG9tUHJvcGVydGllcyB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLWZyb250ZW5kL3VpLWtpdCdcblxudHlwZSBEcm9wQXJlYVN0YXRlID0gJ2RlZmF1bHQnIHwgJ2Vycm9yJyB8ICdhY3RpdmUnXG5cbmNvbnN0IGdldEJvcmRlckNvbG9yID0gKHN0YXRlOiBEcm9wQXJlYVN0YXRlKSA9PiB7XG4gIGNvbnN0IGJvcmRlckNvbG9ycyA9IHtcbiAgICBkZWZhdWx0OiAnIzkwOWRiYycsXG4gICAgZXJyb3I6ICcjZTYwMDUwJyxcbiAgICBhY3RpdmU6IGN1c3RvbVByb3BlcnRpZXMuY29sb3JQcmltYXJ5LFxuICB9XG5cbiAgcmV0dXJuIGJvcmRlckNvbG9yc1tzdGF0ZV0gfHwgYm9yZGVyQ29sb3JzLmRlZmF1bHRcbn1cblxuY29uc3QgZ2V0RGFzaGVkQm9yZGVyID0gKHN0YXRlOiBEcm9wQXJlYVN0YXRlID0gJ2RlZmF1bHQnKSA9PiB7XG4gIGNvbnN0IGNvbG9yID0gZ2V0Qm9yZGVyQ29sb3Ioc3RhdGUpXG4gIGNvbnN0IHN2Z0NvbnRlbnQgPSBgXG4gICAgPHN2ZyB3aWR0aD1cIjEwMCVcIiBoZWlnaHQ9XCIxMDAlXCIgeG1sbnM9XCJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Z1wiPlxuICAgICAgPHJlY3Qgd2lkdGg9XCIxMDAlXCIgaGVpZ2h0PVwiMTAwJVwiIGZpbGw9XCJub25lXCIgc3Ryb2tlPVwiJHtjb2xvcn1cIiBzdHJva2Utd2lkdGg9XCIycHhcIiBzdHJva2UtZGFzaGFycmF5PVwiNiw2XCIgc3Ryb2tlLWRhc2hvZmZzZXQ9XCIwXCIgc3Ryb2tlLWxpbmVjYXA9XCJzcXVhcmVcIi8+XG4gICAgPC9zdmc+XG4gIGBcbiAgcmV0dXJuIGBkYXRhOmltYWdlL3N2Zyt4bWwsJHtlbmNvZGVVUklDb21wb25lbnQoc3ZnQ29udGVudCl9YFxufVxuXG5jb25zdCBiYXNlID0gY3NzYFxuICBib3JkZXItcmFkaXVzOiAke2N1c3RvbVByb3BlcnRpZXMuYm9yZGVyUmFkaXVzNn07XG4gIG1pbi1oZWlnaHQ6IDEzNnB4O1xuICBkaXNwbGF5OiBmbGV4O1xuICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcbiAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbmBcbmNvbnN0IGRpc2FibGVkID0gY3NzYGBcbmNvbnN0IHJlYWR5Rm9yRHJvcCA9IGNzc2BcbiAgYmFja2dyb3VuZC1pbWFnZTogdXJsKFxcXCIke2dldERhc2hlZEJvcmRlcigpfVxcXCIpO1xuICBiYWNrZ3JvdW5kLWNvbG9yOiAke2N1c3RvbVByb3BlcnRpZXMuY29sb3JTdXJmYWNlfTtcbmBcbmNvbnN0IGFjdGl2ZURyYWcgPSBjc3NgXG4gIGJhY2tncm91bmQtaW1hZ2U6IHVybChcXFwiJHtnZXREYXNoZWRCb3JkZXIoJ2FjdGl2ZScpfVxcXCIpO1xuICBiYWNrZ3JvdW5kLWNvbG9yOiAke2N1c3RvbVByb3BlcnRpZXMuY29sb3JQcmltYXJ5OTV9O1xuICBwYWRkaW5nOiAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZzUwfSAxMDBweDtcbmBcbmNvbnN0IGZpbGVEcm9wcGVkID0gY3NzYFxuICBiYWNrZ3JvdW5kLWltYWdlOiB1cmwoXFxcIiR7Z2V0RGFzaGVkQm9yZGVyKCl9XFxcIik7XG4gIGJhY2tncm91bmQtY29sb3I6ICR7Y3VzdG9tUHJvcGVydGllcy5jb2xvclN1cmZhY2V9O1xuICBwYWRkaW5nOiAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZzUwfSAxMDBweDtcbmBcblxuZXhwb3J0IGNvbnN0IHN0eWxlcyA9IHtcbiAgYmFzZSxcbiAgcmVhZHlGb3JEcm9wLFxuICBmaWxlRHJvcHBlZCxcbiAgZGlzYWJsZWQsXG4gIGFjdGl2ZURyYWcsXG59XG4iXX0= */");
|
|
@@ -854,13 +843,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
854
843
|
return /*#__PURE__*/css(process.env.NODE_ENV === "production" ? "" : ";label:getDefaultDropWrapperStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRyb3AtYXJlYS13cmFwcGVyLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE0QlkiLCJmaWxlIjoiZHJvcC1hcmVhLXdyYXBwZXIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnXG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCdcbmltcG9ydCB7IHR5cGUgRHJvcHpvbmVSb290UHJvcHMgfSBmcm9tICdyZWFjdC1kcm9wem9uZSdcbmltcG9ydCB7IHN0eWxlcyB9IGZyb20gJy4vc3R5bGVzJ1xuaW1wb3J0IHsgdHlwZSBEcm9wQXJlYVN0YXRlIH0gZnJvbSAnQHR5cGVzJ1xuXG5pbnRlcmZhY2UgRHJvcFdyYXBwZXJQcm9wcyBleHRlbmRzIERyb3B6b25lUm9vdFByb3BzIHtcbiAgZHJvcEFyZWFTdGF0ZTogRHJvcEFyZWFTdGF0ZVxufVxuZXhwb3J0IGNvbnN0IERyb3BXcmFwcGVyID0gc3R5bGVkLmRpdjxEcm9wV3JhcHBlclByb3BzPmBcbiAgJHtzdHlsZXMuYmFzZX1cbiAgJHsocHJvcHMpID0+IHtcbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ2Rpc2FibGVkJykge1xuICAgICAgcmV0dXJuIHN0eWxlcy5kaXNhYmxlZFxuICAgIH1cbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ3JlYWR5LWZvci1kcm9wJykge1xuICAgICAgcmV0dXJuIHN0eWxlcy5yZWFkeUZvckRyb3BcbiAgICB9XG4gICAgaWYgKHByb3BzLmRyb3BBcmVhU3RhdGUgPT09ICdhY3RpdmUtZHJhZycpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuYWN0aXZlRHJhZ1xuICAgIH1cbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ2ZpbGUtZHJvcHBlZCcpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuZmlsZURyb3BwZWRcbiAgICB9XG4gICAgcmV0dXJuIGdldERlZmF1bHREcm9wV3JhcHBlclN0eWxlcyhwcm9wcy5kcm9wQXJlYVN0YXRlKVxuICB9fVxuYFxuZnVuY3Rpb24gZ2V0RGVmYXVsdERyb3BXcmFwcGVyU3R5bGVzKF9kcm9wQXJlYVN0YXRlOiBuZXZlcikge1xuICByZXR1cm4gY3NzYGBcbn1cbiJdfQ== */");
|
|
855
844
|
}
|
|
856
845
|
|
|
857
|
-
var ActiveDragDropArea = /*#__PURE__*/lazy(() => import('./active-drag-drop-area-
|
|
846
|
+
var ActiveDragDropArea = /*#__PURE__*/lazy(() => import('./active-drag-drop-area-eb0b8dad.esm.js' /* webpackChunkName: "active-drag-drop-area" */));
|
|
858
847
|
|
|
859
848
|
var DisabledDropArea = /*#__PURE__*/lazy(() => import('./disabled-drop-area-2c088477.esm.js' /* webpackChunkName: "disabled-drop-area" */));
|
|
860
849
|
|
|
861
|
-
var EnabledDropArea = /*#__PURE__*/lazy(() => import('./enabled-drop-area-
|
|
850
|
+
var EnabledDropArea = /*#__PURE__*/lazy(() => import('./enabled-drop-area-fc9c086c.esm.js' /* webpackChunkName: "enabled-drop-area" */));
|
|
862
851
|
|
|
863
|
-
var FileDropped = /*#__PURE__*/lazy(() => import('./file-dropped-area-
|
|
852
|
+
var FileDropped = /*#__PURE__*/lazy(() => import('./file-dropped-area-2c96a537.esm.js' /* webpackChunkName: "filed-dropped-area" */));
|
|
864
853
|
|
|
865
854
|
function getDropArea(_ref) {
|
|
866
855
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -898,12 +887,7 @@ function getDropAreaState(flags) {
|
|
|
898
887
|
return 'ready-for-drop';
|
|
899
888
|
}
|
|
900
889
|
|
|
901
|
-
var messages$
|
|
902
|
-
modalDescription: {
|
|
903
|
-
id: 'ImportResourcesModal.modalDescription',
|
|
904
|
-
description: 'Label for the modal category description',
|
|
905
|
-
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>.'
|
|
906
|
-
},
|
|
890
|
+
var messages$4 = defineMessages({
|
|
907
891
|
dragAndDropCSV: {
|
|
908
892
|
id: 'ImportResourcesModal.dragAndDropCSV',
|
|
909
893
|
description: 'The message telling the user to drag and drop CSV file in the file drop area',
|
|
@@ -947,6 +931,16 @@ var messages$2 = defineMessages({
|
|
|
947
931
|
id: 'ImportResourcesModal.genericError',
|
|
948
932
|
description: 'Default error message for unexpected file upload issues (for unhandled cases)',
|
|
949
933
|
defaultMessage: 'Error occurred: Please try uploading the file again or contact our support team for assistance.'
|
|
934
|
+
},
|
|
935
|
+
dataType: {
|
|
936
|
+
id: 'ImportResourcesModal.dataType',
|
|
937
|
+
description: 'Label for the data type selection dropdown',
|
|
938
|
+
defaultMessage: 'Data type'
|
|
939
|
+
},
|
|
940
|
+
instructions: {
|
|
941
|
+
id: 'ImportResourcesModal.instructions',
|
|
942
|
+
description: 'Label for the instructions section',
|
|
943
|
+
defaultMessage: 'Instructions'
|
|
950
944
|
}
|
|
951
945
|
});
|
|
952
946
|
|
|
@@ -981,7 +975,7 @@ const FileDropArea = () => {
|
|
|
981
975
|
showNotification({
|
|
982
976
|
kind: 'error',
|
|
983
977
|
domain: DOMAINS.PAGE,
|
|
984
|
-
text: intl.formatMessage(messages$
|
|
978
|
+
text: intl.formatMessage(messages$4.tooManyFilesError)
|
|
985
979
|
});
|
|
986
980
|
return;
|
|
987
981
|
}
|
|
@@ -989,13 +983,13 @@ const FileDropArea = () => {
|
|
|
989
983
|
showNotification({
|
|
990
984
|
kind: 'error',
|
|
991
985
|
domain: DOMAINS.PAGE,
|
|
992
|
-
text: intl.formatMessage(messages$
|
|
986
|
+
text: intl.formatMessage(messages$4.fileFormatNotSupported)
|
|
993
987
|
});
|
|
994
988
|
} else {
|
|
995
989
|
showNotification({
|
|
996
990
|
kind: 'error',
|
|
997
991
|
domain: DOMAINS.PAGE,
|
|
998
|
-
text: intl.formatMessage(messages$
|
|
992
|
+
text: intl.formatMessage(messages$4.genericError)
|
|
999
993
|
});
|
|
1000
994
|
}
|
|
1001
995
|
}
|
|
@@ -1048,21 +1042,19 @@ var sharedMessages = defineMessages({
|
|
|
1048
1042
|
}
|
|
1049
1043
|
});
|
|
1050
1044
|
|
|
1051
|
-
function ownKeys$9(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1052
|
-
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(_context = ownKeys$9(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$9(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1053
1045
|
const Upload = () => {
|
|
1054
1046
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1055
1047
|
state = _useImportResourcesCo.state,
|
|
1056
|
-
onClose = _useImportResourcesCo.onClose
|
|
1048
|
+
onClose = _useImportResourcesCo.onClose,
|
|
1049
|
+
resourceTypes = _useImportResourcesCo.resourceTypes;
|
|
1057
1050
|
const intl = useIntl();
|
|
1058
|
-
const resourceTypePlural = resourceTypeToDisplayName({
|
|
1051
|
+
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1059
1052
|
resourceType: state.resourceType,
|
|
1060
1053
|
isPlural: true
|
|
1061
1054
|
});
|
|
1062
1055
|
const _useUpload = useUpload(),
|
|
1063
1056
|
handleUploadAndValidation = _useUpload.handleUploadAndValidation;
|
|
1064
|
-
const
|
|
1065
|
-
const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
|
|
1057
|
+
const isMultipleResourceTypes = resourceTypes.length > 1;
|
|
1066
1058
|
return jsx(FormDialog, {
|
|
1067
1059
|
size: 16,
|
|
1068
1060
|
isOpen: true,
|
|
@@ -1080,31 +1072,30 @@ const Upload = () => {
|
|
|
1080
1072
|
}),
|
|
1081
1073
|
children: jsxs(Spacings.Stack, {
|
|
1082
1074
|
scale: "l",
|
|
1083
|
-
children: [
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
}), jsx(FileDropArea, {})]
|
|
1075
|
+
children: [isMultipleResourceTypes ? jsxs(Grid, {
|
|
1076
|
+
gridRowGap: designTokens.spacingL,
|
|
1077
|
+
gridTemplateColumns: `calc(${designTokens.constraint3} + ${designTokens.spacingL}) auto`,
|
|
1078
|
+
children: [jsx(Grid.Item, {
|
|
1079
|
+
children: jsx(Text.Body, {
|
|
1080
|
+
isBold: true,
|
|
1081
|
+
intlMessage: messages$4.dataType
|
|
1082
|
+
})
|
|
1083
|
+
}), jsx(Grid.Item, {
|
|
1084
|
+
children: jsx(ResourceTypeSelection, {})
|
|
1085
|
+
}), jsx(Grid.Item, {
|
|
1086
|
+
children: jsx(Text.Body, {
|
|
1087
|
+
isBold: true,
|
|
1088
|
+
intlMessage: messages$4.instructions
|
|
1089
|
+
})
|
|
1090
|
+
}), jsx(Grid.Item, {
|
|
1091
|
+
children: jsx(Instructions, {})
|
|
1092
|
+
})]
|
|
1093
|
+
}) : jsx(Instructions, {}), jsx(FileDropArea, {})]
|
|
1103
1094
|
})
|
|
1104
1095
|
});
|
|
1105
1096
|
};
|
|
1106
1097
|
|
|
1107
|
-
var messages$
|
|
1098
|
+
var messages$3 = defineMessages({
|
|
1108
1099
|
startImportButton: {
|
|
1109
1100
|
id: 'ImportResourcesModal.startImportButton',
|
|
1110
1101
|
description: 'Label for the modal Start import button',
|
|
@@ -1182,8 +1173,8 @@ var messages$1 = defineMessages({
|
|
|
1182
1173
|
}
|
|
1183
1174
|
});
|
|
1184
1175
|
|
|
1185
|
-
function ownKeys$
|
|
1186
|
-
function _objectSpread$
|
|
1176
|
+
function ownKeys$9(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1177
|
+
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(_context = ownKeys$9(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$9(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1187
1178
|
const truncate = (isExpanded, columns, columnsCount) => {
|
|
1188
1179
|
return isExpanded ? columns.join(' | ') : _sliceInstanceProperty(columns).call(columns, 0, columnsCount).join(' | ') + (columns.length > columnsCount ? '...' : '');
|
|
1189
1180
|
};
|
|
@@ -1212,7 +1203,7 @@ const ColumnList = props => {
|
|
|
1212
1203
|
e.preventDefault();
|
|
1213
1204
|
setIsExpanded(!isExpanded);
|
|
1214
1205
|
},
|
|
1215
|
-
children: isExpanded ? jsx(FormattedMessage, _objectSpread$
|
|
1206
|
+
children: isExpanded ? jsx(FormattedMessage, _objectSpread$9({}, messages$3.showLess)) : jsx(FormattedMessage, _objectSpread$9({}, messages$3.showMore))
|
|
1216
1207
|
})
|
|
1217
1208
|
})]
|
|
1218
1209
|
})
|
|
@@ -1220,8 +1211,8 @@ const ColumnList = props => {
|
|
|
1220
1211
|
});
|
|
1221
1212
|
};
|
|
1222
1213
|
|
|
1223
|
-
function ownKeys$
|
|
1224
|
-
function _objectSpread$
|
|
1214
|
+
function ownKeys$8(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1215
|
+
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(_context = ownKeys$8(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$8(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1225
1216
|
function UploadPreviewModal() {
|
|
1226
1217
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1227
1218
|
state = _useImportResourcesCo.state;
|
|
@@ -1238,7 +1229,7 @@ function UploadPreviewModal() {
|
|
|
1238
1229
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1239
1230
|
resourceType: state.resourceType
|
|
1240
1231
|
}),
|
|
1241
|
-
labelPrimary: intl.formatMessage(messages$
|
|
1232
|
+
labelPrimary: intl.formatMessage(messages$3.continue),
|
|
1242
1233
|
onSecondaryButtonClick: () => onClose({
|
|
1243
1234
|
shouldDeleteImportContainer: true
|
|
1244
1235
|
}),
|
|
@@ -1256,7 +1247,7 @@ function UploadPreviewModal() {
|
|
|
1256
1247
|
children: jsxs(Spacings.Stack, {
|
|
1257
1248
|
scale: "m",
|
|
1258
1249
|
children: [jsx("div", {}), jsx(Text.Body, {
|
|
1259
|
-
intlMessage: messages$
|
|
1250
|
+
intlMessage: messages$3.previewOfYourImport
|
|
1260
1251
|
}), jsx(Card, {
|
|
1261
1252
|
insetScale: "xl",
|
|
1262
1253
|
children: jsxs(Spacings.Stack, {
|
|
@@ -1266,7 +1257,7 @@ function UploadPreviewModal() {
|
|
|
1266
1257
|
children: [jsx(CheckBoldIcon, {
|
|
1267
1258
|
color: "success"
|
|
1268
1259
|
}), jsx(Text.Body, {
|
|
1269
|
-
intlMessage: _objectSpread$
|
|
1260
|
+
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$3.rowsToBeImported), {}, {
|
|
1270
1261
|
values: {
|
|
1271
1262
|
rowCount: intl.formatNumber(state.uploadFileResponse.rowsCount),
|
|
1272
1263
|
b: getBold$3
|
|
@@ -1278,7 +1269,7 @@ function UploadPreviewModal() {
|
|
|
1278
1269
|
children: [jsx(CheckBoldIcon, {
|
|
1279
1270
|
color: "success"
|
|
1280
1271
|
}), jsx(Text.Body, {
|
|
1281
|
-
intlMessage: _objectSpread$
|
|
1272
|
+
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$3.columnsToBeImported), {}, {
|
|
1282
1273
|
values: {
|
|
1283
1274
|
columnCount: intl.formatNumber(validatedColumns.length),
|
|
1284
1275
|
b: getBold$3
|
|
@@ -1298,7 +1289,7 @@ function UploadPreviewModal() {
|
|
|
1298
1289
|
children: [jsx(EyeCrossedIcon, {
|
|
1299
1290
|
color: "neutral60"
|
|
1300
1291
|
}), jsx(Text.Body, {
|
|
1301
|
-
intlMessage: _objectSpread$
|
|
1292
|
+
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$3.columnsToBeIgnored), {}, {
|
|
1302
1293
|
values: {
|
|
1303
1294
|
columnCount: intl.formatNumber(ignoredColumns.length),
|
|
1304
1295
|
b: getBold$3
|
|
@@ -1324,33 +1315,29 @@ function getBold$3(msg) {
|
|
|
1324
1315
|
});
|
|
1325
1316
|
}
|
|
1326
1317
|
|
|
1327
|
-
function ownKeys$
|
|
1328
|
-
function _objectSpread$
|
|
1318
|
+
function ownKeys$7(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1319
|
+
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(_context = ownKeys$7(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$7(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1329
1320
|
const getNewLine = () => jsx("br", {});
|
|
1330
1321
|
const getImportLogsLink = (msg, projectKey) => jsx(Link, {
|
|
1331
|
-
to:
|
|
1322
|
+
to: `/${projectKey}/operations/import/logs`,
|
|
1332
1323
|
children: msg
|
|
1333
1324
|
});
|
|
1334
1325
|
const ImportConfirmationModal = () => {
|
|
1335
|
-
var _state$uploadFileResp;
|
|
1336
1326
|
const intl = useIntl();
|
|
1337
1327
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1338
1328
|
state = _useImportResourcesCo.state,
|
|
1339
1329
|
onStartImportSuccess = _useImportResourcesCo.onStartImportSuccess,
|
|
1340
1330
|
onClose = _useImportResourcesCo.onClose;
|
|
1341
|
-
const _useApplicationContex = useApplicationContext(context => {
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
projectName: (_context$project2 = context.project) === null || _context$project2 === void 0 ? void 0 : _context$project2.name
|
|
1346
|
-
};
|
|
1347
|
-
}),
|
|
1331
|
+
const _useApplicationContex = useApplicationContext(context => ({
|
|
1332
|
+
projectKey: context.project?.key,
|
|
1333
|
+
projectName: context.project?.name
|
|
1334
|
+
})),
|
|
1348
1335
|
projectKey = _useApplicationContex.projectKey,
|
|
1349
1336
|
projectName = _useApplicationContex.projectName;
|
|
1350
1337
|
const asyncDispatch = useAsyncDispatch();
|
|
1351
1338
|
const showNotification = useShowNotification();
|
|
1352
1339
|
const ImportRunningTextNotification = () => jsx(Text.Body, {
|
|
1353
|
-
intlMessage: _objectSpread$
|
|
1340
|
+
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$3.uploadNotificationSuccessMessage), {}, {
|
|
1354
1341
|
values: {
|
|
1355
1342
|
newline: getNewLine,
|
|
1356
1343
|
logsLink: msg => getImportLogsLink(msg, projectKey),
|
|
@@ -1360,12 +1347,12 @@ const ImportConfirmationModal = () => {
|
|
|
1360
1347
|
});
|
|
1361
1348
|
return jsx(ConfirmationDialog, {
|
|
1362
1349
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1363
|
-
resourceType: resourceTypeToDisplayName({
|
|
1350
|
+
resourceType: resourceTypeToDisplayName$1({
|
|
1364
1351
|
resourceType: state.resourceType,
|
|
1365
1352
|
isPlural: true
|
|
1366
1353
|
})
|
|
1367
1354
|
}),
|
|
1368
|
-
labelPrimary: intl.formatMessage(messages$
|
|
1355
|
+
labelPrimary: intl.formatMessage(messages$3.startImportButton),
|
|
1369
1356
|
isOpen: true,
|
|
1370
1357
|
onClose: () => onClose({
|
|
1371
1358
|
shouldDeleteImportContainer: true
|
|
@@ -1381,8 +1368,7 @@ const ImportConfirmationModal = () => {
|
|
|
1381
1368
|
},
|
|
1382
1369
|
onConfirm: async () => {
|
|
1383
1370
|
try {
|
|
1384
|
-
|
|
1385
|
-
const canConfirm = projectKey && state.containerKey && ((_state$droppedFile = state.droppedFile) === null || _state$droppedFile === void 0 ? void 0 : _state$droppedFile.name) && state.resourceType;
|
|
1371
|
+
const canConfirm = projectKey && state.containerKey && state.droppedFile?.name && state.resourceType;
|
|
1386
1372
|
if (!canConfirm) return;
|
|
1387
1373
|
onClose();
|
|
1388
1374
|
await processUploadedFile({
|
|
@@ -1416,18 +1402,18 @@ const ImportConfirmationModal = () => {
|
|
|
1416
1402
|
scale: "xl",
|
|
1417
1403
|
children: [jsxs("div", {
|
|
1418
1404
|
children: [jsx(Text.Body, {
|
|
1419
|
-
intlMessage: _objectSpread$
|
|
1405
|
+
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$3.confirmationBodyText), {}, {
|
|
1420
1406
|
values: {
|
|
1421
1407
|
projectName: projectName,
|
|
1422
|
-
count: intl.formatNumber(
|
|
1408
|
+
count: intl.formatNumber(state?.uploadFileResponse?.rowsCount || 0),
|
|
1423
1409
|
bold: getBold$2
|
|
1424
1410
|
}
|
|
1425
1411
|
})
|
|
1426
1412
|
}), jsx(Text.Body, {
|
|
1427
|
-
intlMessage: messages$
|
|
1413
|
+
intlMessage: messages$3.confirmationBodyNote
|
|
1428
1414
|
})]
|
|
1429
1415
|
}), jsx(Text.Body, {
|
|
1430
|
-
intlMessage: messages$
|
|
1416
|
+
intlMessage: messages$3.confirmationBodyQuestion
|
|
1431
1417
|
})]
|
|
1432
1418
|
})
|
|
1433
1419
|
});
|
|
@@ -1440,7 +1426,7 @@ function getBold$2(msg) {
|
|
|
1440
1426
|
});
|
|
1441
1427
|
}
|
|
1442
1428
|
|
|
1443
|
-
var messages = defineMessages({
|
|
1429
|
+
var messages$2 = defineMessages({
|
|
1444
1430
|
row: {
|
|
1445
1431
|
id: 'ImportResourcesModal.row',
|
|
1446
1432
|
description: 'In Upload file error modal - "Row" column',
|
|
@@ -1473,15 +1459,15 @@ var messages = defineMessages({
|
|
|
1473
1459
|
}
|
|
1474
1460
|
});
|
|
1475
1461
|
|
|
1476
|
-
function ownKeys$
|
|
1477
|
-
function _objectSpread$
|
|
1462
|
+
function ownKeys$6(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1463
|
+
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(_context2 = ownKeys$6(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys$6(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1478
1464
|
const getColumns$1 = () => [{
|
|
1479
1465
|
key: 'errorType',
|
|
1480
|
-
label: jsx(FormattedMessage, _objectSpread$
|
|
1466
|
+
label: jsx(FormattedMessage, _objectSpread$6({}, messages$2.errorType)),
|
|
1481
1467
|
width: 'max-content'
|
|
1482
1468
|
}, {
|
|
1483
1469
|
key: 'details',
|
|
1484
|
-
label: jsx(FormattedMessage, _objectSpread$
|
|
1470
|
+
label: jsx(FormattedMessage, _objectSpread$6({}, messages$2.details))
|
|
1485
1471
|
}];
|
|
1486
1472
|
const UploadClientSideErrorTable = props => {
|
|
1487
1473
|
var _context;
|
|
@@ -1524,10 +1510,9 @@ function itemRenderer$1(item, column) {
|
|
|
1524
1510
|
}
|
|
1525
1511
|
}
|
|
1526
1512
|
|
|
1527
|
-
function ownKeys$
|
|
1528
|
-
function _objectSpread$
|
|
1513
|
+
function ownKeys$5(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1514
|
+
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(_context = ownKeys$5(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$5(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1529
1515
|
const UploadClientSideErrorsModal = () => {
|
|
1530
|
-
var _state$droppedFile;
|
|
1531
1516
|
const intl = useIntl();
|
|
1532
1517
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1533
1518
|
state = _useImportResourcesCo.state,
|
|
@@ -1538,7 +1523,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1538
1523
|
size: 16,
|
|
1539
1524
|
isOpen: true,
|
|
1540
1525
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1541
|
-
resourceType: resourceTypeToDisplayName({
|
|
1526
|
+
resourceType: resourceTypeToDisplayName$1({
|
|
1542
1527
|
resourceType: state.resourceType,
|
|
1543
1528
|
isPlural: true
|
|
1544
1529
|
})
|
|
@@ -1547,9 +1532,9 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1547
1532
|
children: jsxs(Spacings.Stack, {
|
|
1548
1533
|
scale: "l",
|
|
1549
1534
|
children: [jsx(Text.Body, {
|
|
1550
|
-
intlMessage: _objectSpread$
|
|
1535
|
+
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$2.uploadingError), {}, {
|
|
1551
1536
|
values: {
|
|
1552
|
-
fileName:
|
|
1537
|
+
fileName: state.droppedFile?.name,
|
|
1553
1538
|
errorsCount: intl.formatNumber(errorsCount),
|
|
1554
1539
|
b: getBold$1
|
|
1555
1540
|
}
|
|
@@ -1564,7 +1549,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1564
1549
|
onClick: () => onClose()
|
|
1565
1550
|
}), jsx(PrimaryButton, {
|
|
1566
1551
|
iconLeft: jsx(ImportIcon, {}),
|
|
1567
|
-
label: intl.formatMessage(messages.uploadNewFile),
|
|
1552
|
+
label: intl.formatMessage(messages$2.uploadNewFile),
|
|
1568
1553
|
onClick: () => actions.uploadNewFile()
|
|
1569
1554
|
})]
|
|
1570
1555
|
})]
|
|
@@ -1579,19 +1564,19 @@ function getBold$1(msg) {
|
|
|
1579
1564
|
});
|
|
1580
1565
|
}
|
|
1581
1566
|
|
|
1582
|
-
function ownKeys$
|
|
1583
|
-
function _objectSpread$
|
|
1567
|
+
function ownKeys$4(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1568
|
+
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(_context2 = ownKeys$4(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys$4(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1584
1569
|
const getColumns = () => [{
|
|
1585
1570
|
key: 'row',
|
|
1586
|
-
label: jsx(FormattedMessage, _objectSpread$
|
|
1571
|
+
label: jsx(FormattedMessage, _objectSpread$4({}, messages$2.row)),
|
|
1587
1572
|
width: 'max-content'
|
|
1588
1573
|
}, {
|
|
1589
1574
|
key: 'errorType',
|
|
1590
|
-
label: jsx(FormattedMessage, _objectSpread$
|
|
1575
|
+
label: jsx(FormattedMessage, _objectSpread$4({}, messages$2.errorType)),
|
|
1591
1576
|
width: 'max-content'
|
|
1592
1577
|
}, {
|
|
1593
1578
|
key: 'details',
|
|
1594
|
-
label: jsx(FormattedMessage, _objectSpread$
|
|
1579
|
+
label: jsx(FormattedMessage, _objectSpread$4({}, messages$2.details))
|
|
1595
1580
|
}];
|
|
1596
1581
|
const UploadServerSideErrorTable = props => {
|
|
1597
1582
|
var _context;
|
|
@@ -1642,22 +1627,21 @@ function itemRenderer(item, column) {
|
|
|
1642
1627
|
}
|
|
1643
1628
|
}
|
|
1644
1629
|
|
|
1645
|
-
function ownKeys$
|
|
1646
|
-
function _objectSpread$
|
|
1630
|
+
function ownKeys$3(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1631
|
+
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(_context = ownKeys$3(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$3(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1647
1632
|
const UploadServerSideErrorsModal = () => {
|
|
1648
|
-
var _state$uploadFileResp, _state$droppedFile, _state$uploadFileResp2;
|
|
1649
1633
|
const intl = useIntl();
|
|
1650
1634
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1651
1635
|
state = _useImportResourcesCo.state,
|
|
1652
1636
|
actions = _useImportResourcesCo.actions,
|
|
1653
1637
|
onClose = _useImportResourcesCo.onClose;
|
|
1654
|
-
const errorsCount = getFileUploadErrorsCount(
|
|
1638
|
+
const errorsCount = getFileUploadErrorsCount(state.uploadFileResponse?.results);
|
|
1655
1639
|
const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
|
|
1656
1640
|
return jsx(InfoDialog, {
|
|
1657
1641
|
size: 16,
|
|
1658
1642
|
isOpen: true,
|
|
1659
1643
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1660
|
-
resourceType: resourceTypeToDisplayName({
|
|
1644
|
+
resourceType: resourceTypeToDisplayName$1({
|
|
1661
1645
|
resourceType: state.resourceType,
|
|
1662
1646
|
isPlural: true
|
|
1663
1647
|
})
|
|
@@ -1668,15 +1652,15 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1668
1652
|
children: [jsxs(Spacings.Stack, {
|
|
1669
1653
|
scale: "xs",
|
|
1670
1654
|
children: [jsx(Text.Body, {
|
|
1671
|
-
intlMessage: _objectSpread$
|
|
1655
|
+
intlMessage: _objectSpread$3(_objectSpread$3({}, messages$2.uploadingError), {}, {
|
|
1672
1656
|
values: {
|
|
1673
|
-
fileName:
|
|
1657
|
+
fileName: state.droppedFile?.name,
|
|
1674
1658
|
errorsCount: intl.formatNumber(errorsCount),
|
|
1675
1659
|
b: getBold
|
|
1676
1660
|
}
|
|
1677
1661
|
})
|
|
1678
1662
|
}), jsx(Text.Body, {
|
|
1679
|
-
intlMessage: _objectSpread$
|
|
1663
|
+
intlMessage: _objectSpread$3(_objectSpread$3({}, messages$2.supportedValuesDocumentation), {}, {
|
|
1680
1664
|
values: {
|
|
1681
1665
|
documentationLink: msg => jsx(Link, {
|
|
1682
1666
|
tone: "secondary",
|
|
@@ -1688,7 +1672,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1688
1672
|
})
|
|
1689
1673
|
})]
|
|
1690
1674
|
}), jsx(UploadServerSideErrorTable, {
|
|
1691
|
-
rows: mapUploadFileErrorsResponseToUploadFileErrorRows(
|
|
1675
|
+
rows: mapUploadFileErrorsResponseToUploadFileErrorRows(state.uploadFileResponse?.results)
|
|
1692
1676
|
}), jsxs(Spacings.Inline, {
|
|
1693
1677
|
scale: "m",
|
|
1694
1678
|
justifyContent: "flex-end",
|
|
@@ -1697,7 +1681,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1697
1681
|
onClick: () => onClose()
|
|
1698
1682
|
}), jsx(PrimaryButton, {
|
|
1699
1683
|
iconLeft: jsx(ImportIcon, {}),
|
|
1700
|
-
label: intl.formatMessage(messages.uploadNewFile),
|
|
1684
|
+
label: intl.formatMessage(messages$2.uploadNewFile),
|
|
1701
1685
|
onClick: () => actions.uploadNewFile()
|
|
1702
1686
|
})]
|
|
1703
1687
|
})]
|
|
@@ -1713,18 +1697,17 @@ function getBold(msg) {
|
|
|
1713
1697
|
}
|
|
1714
1698
|
|
|
1715
1699
|
const UploadResult = () => {
|
|
1716
|
-
var _state$uploadFileResp;
|
|
1717
1700
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1718
1701
|
state = _useImportResourcesCo.state;
|
|
1719
1702
|
if (state.fileUploadClientSideErrors.length > 0) return jsx(UploadClientSideErrorsModal, {});
|
|
1720
|
-
if (
|
|
1703
|
+
if (state.uploadFileResponse?.invalid > 0) return jsx(UploadServerSideErrorsModal, {});
|
|
1721
1704
|
return jsx(UploadPreviewModal, {});
|
|
1722
1705
|
};
|
|
1723
1706
|
|
|
1724
|
-
function ownKeys$
|
|
1725
|
-
function _objectSpread$
|
|
1707
|
+
function ownKeys$2(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1708
|
+
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(_context = ownKeys$2(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$2(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1726
1709
|
var FileIcon = function FileIcon(props) {
|
|
1727
|
-
return jsxs("svg", _objectSpread$
|
|
1710
|
+
return jsxs("svg", _objectSpread$2(_objectSpread$2({}, props), {}, {
|
|
1728
1711
|
children: [jsx("mask", {
|
|
1729
1712
|
id: "a",
|
|
1730
1713
|
style: {
|
|
@@ -1755,17 +1738,16 @@ FileIcon.defaultProps = {
|
|
|
1755
1738
|
xmlns: "http://www.w3.org/2000/svg"
|
|
1756
1739
|
};
|
|
1757
1740
|
const Uploading = () => {
|
|
1758
|
-
var _state$droppedFile;
|
|
1759
1741
|
const intl = useIntl();
|
|
1760
1742
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1761
1743
|
state = _useImportResourcesCo.state,
|
|
1762
1744
|
actions = _useImportResourcesCo.actions,
|
|
1763
1745
|
onClose = _useImportResourcesCo.onClose;
|
|
1764
|
-
const resourceTypePlural = resourceTypeToDisplayName({
|
|
1746
|
+
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1765
1747
|
resourceType: state.resourceType,
|
|
1766
1748
|
isPlural: true
|
|
1767
1749
|
});
|
|
1768
|
-
if (
|
|
1750
|
+
if (state.droppedFile?.name) return jsx(InfoDialog, {
|
|
1769
1751
|
size: 16,
|
|
1770
1752
|
isOpen: true,
|
|
1771
1753
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
@@ -1825,6 +1807,97 @@ const CurrentStep = () => {
|
|
|
1825
1807
|
return steps[state.currentStep] || null;
|
|
1826
1808
|
};
|
|
1827
1809
|
|
|
1810
|
+
var messages$1 = defineMessages({
|
|
1811
|
+
products: {
|
|
1812
|
+
id: 'ImportResourcesModal.radio.products',
|
|
1813
|
+
description: 'Label for the products radio button',
|
|
1814
|
+
defaultMessage: 'Products (including variants, assets, prices and images)'
|
|
1815
|
+
},
|
|
1816
|
+
inventories: {
|
|
1817
|
+
id: 'ImportResourcesModal.radio.inventories',
|
|
1818
|
+
description: 'Label for the inventories radio button',
|
|
1819
|
+
defaultMessage: 'Inventories'
|
|
1820
|
+
},
|
|
1821
|
+
categories: {
|
|
1822
|
+
id: 'ImportResourcesModal.radio.categories',
|
|
1823
|
+
description: 'Label for the categories radio button',
|
|
1824
|
+
defaultMessage: 'Categories'
|
|
1825
|
+
}
|
|
1826
|
+
});
|
|
1827
|
+
|
|
1828
|
+
const resourceTypeToDisplayName = resourceType => {
|
|
1829
|
+
switch (resourceType) {
|
|
1830
|
+
case 'product':
|
|
1831
|
+
return messages$1.products;
|
|
1832
|
+
case 'inventory':
|
|
1833
|
+
return messages$1.inventories;
|
|
1834
|
+
case 'category':
|
|
1835
|
+
return messages$1.categories;
|
|
1836
|
+
default:
|
|
1837
|
+
throw new Error(`Unknown resource type: ${resourceType}`);
|
|
1838
|
+
}
|
|
1839
|
+
};
|
|
1840
|
+
const ResourceTypeSelection = () => {
|
|
1841
|
+
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1842
|
+
state = _useImportResourcesCo.state,
|
|
1843
|
+
actions = _useImportResourcesCo.actions,
|
|
1844
|
+
resourceTypes = _useImportResourcesCo.resourceTypes;
|
|
1845
|
+
return jsx(RadioInput.Group, {
|
|
1846
|
+
value: state.resourceType,
|
|
1847
|
+
onChange: e => {
|
|
1848
|
+
actions.setResourceType(e.target.value);
|
|
1849
|
+
},
|
|
1850
|
+
direction: "stack",
|
|
1851
|
+
directionProps: {
|
|
1852
|
+
scale: 's'
|
|
1853
|
+
},
|
|
1854
|
+
children: _mapInstanceProperty(resourceTypes).call(resourceTypes, resourceType => jsx(RadioInput.Option, {
|
|
1855
|
+
value: resourceType,
|
|
1856
|
+
children: jsx(Text.Body, {
|
|
1857
|
+
intlMessage: resourceTypeToDisplayName(resourceType)
|
|
1858
|
+
})
|
|
1859
|
+
}, resourceType))
|
|
1860
|
+
});
|
|
1861
|
+
};
|
|
1862
|
+
|
|
1863
|
+
var messages = defineMessages({
|
|
1864
|
+
fileUploadInstructions: {
|
|
1865
|
+
id: 'ImportResourcesModal.fileUploadInstructions',
|
|
1866
|
+
description: 'Label for the modal category description',
|
|
1867
|
+
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>.'
|
|
1868
|
+
}
|
|
1869
|
+
});
|
|
1870
|
+
|
|
1871
|
+
function ownKeys$1(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1872
|
+
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(_context = ownKeys$1(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$1(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1873
|
+
const Instructions = () => {
|
|
1874
|
+
const intl = useIntl();
|
|
1875
|
+
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1876
|
+
state = _useImportResourcesCo.state;
|
|
1877
|
+
const templateLink = RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS[state.resourceType];
|
|
1878
|
+
const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
|
|
1879
|
+
return jsx(Text.Body, {
|
|
1880
|
+
intlMessage: _objectSpread$1(_objectSpread$1({}, messages.fileUploadInstructions), {}, {
|
|
1881
|
+
values: {
|
|
1882
|
+
fileSize: intl.formatNumber(FILE_SIZE_LIMITS_MB[state.resourceType]),
|
|
1883
|
+
rowLimit: intl.formatNumber(ROW_LIMITS[state.resourceType]),
|
|
1884
|
+
csvTemplateLink: msg => jsx(Link, {
|
|
1885
|
+
tone: "secondary",
|
|
1886
|
+
isExternal: true,
|
|
1887
|
+
to: templateLink,
|
|
1888
|
+
children: msg
|
|
1889
|
+
}),
|
|
1890
|
+
documentationLink: msg => jsx(Link, {
|
|
1891
|
+
tone: "secondary",
|
|
1892
|
+
isExternal: true,
|
|
1893
|
+
to: documentationLink,
|
|
1894
|
+
children: msg
|
|
1895
|
+
})
|
|
1896
|
+
}
|
|
1897
|
+
})
|
|
1898
|
+
});
|
|
1899
|
+
};
|
|
1900
|
+
|
|
1828
1901
|
const getChunkImport = locale => {
|
|
1829
1902
|
const intlLocale = mapLocaleToIntlLocale(locale);
|
|
1830
1903
|
switch (intlLocale) {
|
|
@@ -1850,8 +1923,8 @@ const loadMessages = async locale => {
|
|
|
1850
1923
|
return parseChunkImport(chunkImport);
|
|
1851
1924
|
} catch (error) {
|
|
1852
1925
|
// eslint-disable-next-line no-console
|
|
1853
|
-
console.warn(
|
|
1854
|
-
reportErrorToSentry(new Error(
|
|
1926
|
+
console.warn(`Something went wrong while loading the import-resources-modal messages for ${locale}`, error);
|
|
1927
|
+
reportErrorToSentry(new Error(`Something went wrong while loading the import-resources-modal messages for ${locale}`), {
|
|
1855
1928
|
extra: error
|
|
1856
1929
|
});
|
|
1857
1930
|
return {};
|
|
@@ -1894,14 +1967,23 @@ const useAsyncIntlMessages = (locale, loader) => {
|
|
|
1894
1967
|
};
|
|
1895
1968
|
|
|
1896
1969
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1897
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
1970
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1898
1971
|
const ImportResourcesModal = props => {
|
|
1972
|
+
var _context;
|
|
1899
1973
|
const _useApplicationContex = useApplicationContext(context => ({
|
|
1900
1974
|
locale: context.user && context.user.locale
|
|
1901
1975
|
})),
|
|
1902
1976
|
locale = _useApplicationContex.locale;
|
|
1903
1977
|
const messages = useAsyncIntlMessages(locale, loadMessages);
|
|
1904
1978
|
if (!props.isOpen || messages.isLoading) return null;
|
|
1979
|
+
if (!props.resourceTypes?.length) {
|
|
1980
|
+
console.error('No resource types provided for import resources modal');
|
|
1981
|
+
return null;
|
|
1982
|
+
}
|
|
1983
|
+
if (!_everyInstanceProperty(_context = props.resourceTypes).call(_context, isResourceType)) {
|
|
1984
|
+
console.error('Invalid resource types provided for import resources modal');
|
|
1985
|
+
return null;
|
|
1986
|
+
}
|
|
1905
1987
|
return jsx(IntlProvider, {
|
|
1906
1988
|
locale: locale,
|
|
1907
1989
|
messages: messages.messages,
|
|
@@ -1912,4 +1994,4 @@ const ImportResourcesModal = props => {
|
|
|
1912
1994
|
};
|
|
1913
1995
|
ImportResourcesModal.displayName = 'ImportResourcesModal';
|
|
1914
1996
|
|
|
1915
|
-
export { EnabledDropArea as E, FileDropped as F, ImportResourcesModal as I, messages$
|
|
1997
|
+
export { EnabledDropArea as E, FileDropped as F, ImportResourcesModal as I, messages$4 as m, useImportResourcesContext as u };
|