@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
|
@@ -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,13 +89,13 @@ 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',
|
|
100
|
-
product: 'https://docs.commercetools.com/merchant-center/import-data#
|
|
98
|
+
product: 'https://docs.commercetools.com/merchant-center/import-data#download-a-csv-template',
|
|
101
99
|
inventory: 'https://docs.commercetools.com/merchant-center/downloads/inventory_entry_import_template.csv'
|
|
102
100
|
};
|
|
103
101
|
const RESOURCE_TYPE_DOCUMENTATION_LINKS = {
|
|
@@ -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'
|
|
@@ -646,15 +633,17 @@ var messages$3 = defineMessages({
|
|
|
646
633
|
id: 'ImportResourcesModal.unexpectedError',
|
|
647
634
|
description: 'Generic notification message when file upload fails',
|
|
648
635
|
defaultMessage: 'An unexpected error occurred during the file upload. Please try again, or contact support if this error occurs again.'
|
|
636
|
+
},
|
|
637
|
+
missingKeyError: {
|
|
638
|
+
id: 'ImportResourcesModal.missingKeyError',
|
|
639
|
+
description: 'Error message displayed when the uploaded file is missing the key field',
|
|
640
|
+
defaultMessage: "The 'key' field is missing or incomplete in some rows. Please ensure every row has a 'key' value."
|
|
649
641
|
}
|
|
650
642
|
});
|
|
651
643
|
|
|
652
644
|
const useUpload = () => {
|
|
653
645
|
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
|
-
});
|
|
646
|
+
const projectKey = useApplicationContext(context => context.project?.key);
|
|
658
647
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
659
648
|
state = _useImportResourcesCo.state,
|
|
660
649
|
actions = _useImportResourcesCo.actions;
|
|
@@ -669,25 +658,25 @@ const useUpload = () => {
|
|
|
669
658
|
const errors = [];
|
|
670
659
|
const delimiterCheck = await checkDelimiter(file);
|
|
671
660
|
if (!delimiterCheck.isValid) errors.push({
|
|
672
|
-
title: intl.formatMessage(messages$
|
|
673
|
-
description: intl.formatMessage(messages$
|
|
661
|
+
title: intl.formatMessage(messages$5.dropAreaWrongDelimiterTitle),
|
|
662
|
+
description: intl.formatMessage(messages$5.dropAreaWrongDelimiterDescription, {
|
|
674
663
|
delimiter: delimiterCheck.delimiter
|
|
675
664
|
})
|
|
676
665
|
});
|
|
677
666
|
const rowCount = await getRowCount(file);
|
|
678
667
|
if (rowCount < 1) errors.push({
|
|
679
|
-
title: intl.formatMessage(messages$
|
|
680
|
-
description: intl.formatMessage(messages$
|
|
668
|
+
title: intl.formatMessage(messages$5.dropAreaNotEnoughRowsTitle),
|
|
669
|
+
description: intl.formatMessage(messages$5.dropAreaNotEnoughRowsDescription)
|
|
681
670
|
});
|
|
682
671
|
if (state.resourceType && file.size > toBytes(FILE_SIZE_LIMITS_MB[state.resourceType])) errors.push({
|
|
683
|
-
title: intl.formatMessage(messages$
|
|
684
|
-
description: intl.formatMessage(messages$
|
|
672
|
+
title: intl.formatMessage(messages$5.fileSizeExceededTitle),
|
|
673
|
+
description: intl.formatMessage(messages$5.fileSizeExceededDescription, {
|
|
685
674
|
fileSizeLimit: intl.formatNumber(FILE_SIZE_LIMITS_MB[state.resourceType])
|
|
686
675
|
})
|
|
687
676
|
});
|
|
688
677
|
if (state.resourceType && rowCount > ROW_LIMITS[state.resourceType]) errors.push({
|
|
689
|
-
title: intl.formatMessage(messages$
|
|
690
|
-
description: intl.formatMessage(messages$
|
|
678
|
+
title: intl.formatMessage(messages$5.rowLimitExceededTitle),
|
|
679
|
+
description: intl.formatMessage(messages$5.rowLimitExceededDescription, {
|
|
691
680
|
rowLimit: intl.formatNumber(ROW_LIMITS[state.resourceType])
|
|
692
681
|
})
|
|
693
682
|
});
|
|
@@ -704,26 +693,24 @@ const useUpload = () => {
|
|
|
704
693
|
return;
|
|
705
694
|
}
|
|
706
695
|
if (error instanceof HttpError) {
|
|
707
|
-
|
|
708
|
-
if (((_error$errorData = error.errorData) === null || _error$errorData === void 0 ? void 0 : _error$errorData.code) === 'MISSING_KEY_ERROR') {
|
|
696
|
+
if (error.errorData?.code === 'MISSING_KEY_ERROR') {
|
|
709
697
|
actions.cancelImport();
|
|
710
698
|
showNotification({
|
|
711
699
|
kind: 'error',
|
|
712
700
|
domain: DOMAINS.PAGE,
|
|
713
|
-
text:
|
|
701
|
+
text: intl.formatMessage(messages$5.unexpectedError)
|
|
714
702
|
});
|
|
715
|
-
} else if (
|
|
703
|
+
} else if (error.errorData?.invalid > 0) {
|
|
716
704
|
actions.setUploadFileResponse(error.errorData);
|
|
717
705
|
} else {
|
|
718
706
|
actions.cancelImport();
|
|
719
707
|
showNotification({
|
|
720
708
|
kind: 'error',
|
|
721
709
|
domain: DOMAINS.PAGE,
|
|
722
|
-
text: intl.formatMessage(messages$
|
|
710
|
+
text: intl.formatMessage(messages$5.unexpectedError)
|
|
723
711
|
});
|
|
724
712
|
}
|
|
725
713
|
} else {
|
|
726
|
-
var _state$droppedFile;
|
|
727
714
|
actions.cancelImport();
|
|
728
715
|
showNotification({
|
|
729
716
|
kind: 'error',
|
|
@@ -736,7 +723,7 @@ const useUpload = () => {
|
|
|
736
723
|
projectKey,
|
|
737
724
|
containerKey: state.containerKey,
|
|
738
725
|
resourceType: state.resourceType,
|
|
739
|
-
fileSizeInBytes:
|
|
726
|
+
fileSizeInBytes: state.droppedFile?.size
|
|
740
727
|
}
|
|
741
728
|
});
|
|
742
729
|
}
|
|
@@ -783,7 +770,7 @@ const useUpload = () => {
|
|
|
783
770
|
};
|
|
784
771
|
};
|
|
785
772
|
|
|
786
|
-
function resourceTypeToDisplayName(_ref) {
|
|
773
|
+
function resourceTypeToDisplayName$1(_ref) {
|
|
787
774
|
let resourceType = _ref.resourceType,
|
|
788
775
|
_ref$isUpperCase = _ref.isUpperCase,
|
|
789
776
|
isUpperCase = _ref$isUpperCase === void 0 ? false : _ref$isUpperCase,
|
|
@@ -797,6 +784,9 @@ function resourceTypeToDisplayName(_ref) {
|
|
|
797
784
|
case 'product':
|
|
798
785
|
displayName = isPlural ? 'Products' : 'Product';
|
|
799
786
|
break;
|
|
787
|
+
case 'inventory':
|
|
788
|
+
displayName = isPlural ? 'Inventories' : 'Inventory';
|
|
789
|
+
break;
|
|
800
790
|
default:
|
|
801
791
|
throw new UnexpectedResourceTypeError(resourceType);
|
|
802
792
|
}
|
|
@@ -814,8 +804,12 @@ const getBorderColor = state => {
|
|
|
814
804
|
const getDashedBorder = function () {
|
|
815
805
|
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
|
|
816
806
|
const color = getBorderColor(state);
|
|
817
|
-
const svgContent =
|
|
818
|
-
|
|
807
|
+
const svgContent = `
|
|
808
|
+
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
|
|
809
|
+
<rect width="100%" height="100%" fill="none" stroke="${color}" stroke-width="2px" stroke-dasharray="6,6" stroke-dashoffset="0" stroke-linecap="square"/>
|
|
810
|
+
</svg>
|
|
811
|
+
`;
|
|
812
|
+
return `data:image/svg+xml,${encodeURIComponent(svgContent)}`;
|
|
819
813
|
};
|
|
820
814
|
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
815
|
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 +848,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
854
848
|
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
849
|
}
|
|
856
850
|
|
|
857
|
-
var ActiveDragDropArea = /*#__PURE__*/lazy(() => import('./active-drag-drop-area-
|
|
851
|
+
var ActiveDragDropArea = /*#__PURE__*/lazy(() => import('./active-drag-drop-area-f5c4c801.esm.js' /* webpackChunkName: "active-drag-drop-area" */));
|
|
858
852
|
|
|
859
853
|
var DisabledDropArea = /*#__PURE__*/lazy(() => import('./disabled-drop-area-2c088477.esm.js' /* webpackChunkName: "disabled-drop-area" */));
|
|
860
854
|
|
|
861
|
-
var EnabledDropArea = /*#__PURE__*/lazy(() => import('./enabled-drop-area-
|
|
855
|
+
var EnabledDropArea = /*#__PURE__*/lazy(() => import('./enabled-drop-area-cc25daca.esm.js' /* webpackChunkName: "enabled-drop-area" */));
|
|
862
856
|
|
|
863
|
-
var FileDropped = /*#__PURE__*/lazy(() => import('./file-dropped-area-
|
|
857
|
+
var FileDropped = /*#__PURE__*/lazy(() => import('./file-dropped-area-b714e041.esm.js' /* webpackChunkName: "filed-dropped-area" */));
|
|
864
858
|
|
|
865
859
|
function getDropArea(_ref) {
|
|
866
860
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -898,12 +892,7 @@ function getDropAreaState(flags) {
|
|
|
898
892
|
return 'ready-for-drop';
|
|
899
893
|
}
|
|
900
894
|
|
|
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
|
-
},
|
|
895
|
+
var messages$4 = defineMessages({
|
|
907
896
|
dragAndDropCSV: {
|
|
908
897
|
id: 'ImportResourcesModal.dragAndDropCSV',
|
|
909
898
|
description: 'The message telling the user to drag and drop CSV file in the file drop area',
|
|
@@ -947,6 +936,16 @@ var messages$2 = defineMessages({
|
|
|
947
936
|
id: 'ImportResourcesModal.genericError',
|
|
948
937
|
description: 'Default error message for unexpected file upload issues (for unhandled cases)',
|
|
949
938
|
defaultMessage: 'Error occurred: Please try uploading the file again or contact our support team for assistance.'
|
|
939
|
+
},
|
|
940
|
+
dataType: {
|
|
941
|
+
id: 'ImportResourcesModal.dataType',
|
|
942
|
+
description: 'Label for the data type selection dropdown',
|
|
943
|
+
defaultMessage: 'Data type'
|
|
944
|
+
},
|
|
945
|
+
instructions: {
|
|
946
|
+
id: 'ImportResourcesModal.instructions',
|
|
947
|
+
description: 'Label for the instructions section',
|
|
948
|
+
defaultMessage: 'Instructions'
|
|
950
949
|
}
|
|
951
950
|
});
|
|
952
951
|
|
|
@@ -981,7 +980,7 @@ const FileDropArea = () => {
|
|
|
981
980
|
showNotification({
|
|
982
981
|
kind: 'error',
|
|
983
982
|
domain: DOMAINS.PAGE,
|
|
984
|
-
text: intl.formatMessage(messages$
|
|
983
|
+
text: intl.formatMessage(messages$4.tooManyFilesError)
|
|
985
984
|
});
|
|
986
985
|
return;
|
|
987
986
|
}
|
|
@@ -989,13 +988,13 @@ const FileDropArea = () => {
|
|
|
989
988
|
showNotification({
|
|
990
989
|
kind: 'error',
|
|
991
990
|
domain: DOMAINS.PAGE,
|
|
992
|
-
text: intl.formatMessage(messages$
|
|
991
|
+
text: intl.formatMessage(messages$4.fileFormatNotSupported)
|
|
993
992
|
});
|
|
994
993
|
} else {
|
|
995
994
|
showNotification({
|
|
996
995
|
kind: 'error',
|
|
997
996
|
domain: DOMAINS.PAGE,
|
|
998
|
-
text: intl.formatMessage(messages$
|
|
997
|
+
text: intl.formatMessage(messages$4.genericError)
|
|
999
998
|
});
|
|
1000
999
|
}
|
|
1001
1000
|
}
|
|
@@ -1048,21 +1047,19 @@ var sharedMessages = defineMessages({
|
|
|
1048
1047
|
}
|
|
1049
1048
|
});
|
|
1050
1049
|
|
|
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
1050
|
const Upload = () => {
|
|
1054
1051
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1055
1052
|
state = _useImportResourcesCo.state,
|
|
1056
|
-
onClose = _useImportResourcesCo.onClose
|
|
1053
|
+
onClose = _useImportResourcesCo.onClose,
|
|
1054
|
+
resourceTypes = _useImportResourcesCo.resourceTypes;
|
|
1057
1055
|
const intl = useIntl();
|
|
1058
|
-
const resourceTypePlural = resourceTypeToDisplayName({
|
|
1056
|
+
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1059
1057
|
resourceType: state.resourceType,
|
|
1060
1058
|
isPlural: true
|
|
1061
1059
|
});
|
|
1062
1060
|
const _useUpload = useUpload(),
|
|
1063
1061
|
handleUploadAndValidation = _useUpload.handleUploadAndValidation;
|
|
1064
|
-
const
|
|
1065
|
-
const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
|
|
1062
|
+
const isMultipleResourceTypes = resourceTypes.length > 1;
|
|
1066
1063
|
return jsx(FormDialog, {
|
|
1067
1064
|
size: 16,
|
|
1068
1065
|
isOpen: true,
|
|
@@ -1080,31 +1077,30 @@ const Upload = () => {
|
|
|
1080
1077
|
}),
|
|
1081
1078
|
children: jsxs(Spacings.Stack, {
|
|
1082
1079
|
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, {})]
|
|
1080
|
+
children: [isMultipleResourceTypes ? jsxs(Grid, {
|
|
1081
|
+
gridRowGap: designTokens.spacingL,
|
|
1082
|
+
gridTemplateColumns: `calc(${designTokens.constraint3} + ${designTokens.spacingL}) auto`,
|
|
1083
|
+
children: [jsx(Grid.Item, {
|
|
1084
|
+
children: jsx(Text.Body, {
|
|
1085
|
+
isBold: true,
|
|
1086
|
+
intlMessage: messages$4.dataType
|
|
1087
|
+
})
|
|
1088
|
+
}), jsx(Grid.Item, {
|
|
1089
|
+
children: jsx(ResourceTypeSelection, {})
|
|
1090
|
+
}), jsx(Grid.Item, {
|
|
1091
|
+
children: jsx(Text.Body, {
|
|
1092
|
+
isBold: true,
|
|
1093
|
+
intlMessage: messages$4.instructions
|
|
1094
|
+
})
|
|
1095
|
+
}), jsx(Grid.Item, {
|
|
1096
|
+
children: jsx(Instructions, {})
|
|
1097
|
+
})]
|
|
1098
|
+
}) : jsx(Instructions, {}), jsx(FileDropArea, {})]
|
|
1103
1099
|
})
|
|
1104
1100
|
});
|
|
1105
1101
|
};
|
|
1106
1102
|
|
|
1107
|
-
var messages$
|
|
1103
|
+
var messages$3 = defineMessages({
|
|
1108
1104
|
startImportButton: {
|
|
1109
1105
|
id: 'ImportResourcesModal.startImportButton',
|
|
1110
1106
|
description: 'Label for the modal Start import button',
|
|
@@ -1182,8 +1178,8 @@ var messages$1 = defineMessages({
|
|
|
1182
1178
|
}
|
|
1183
1179
|
});
|
|
1184
1180
|
|
|
1185
|
-
function ownKeys$
|
|
1186
|
-
function _objectSpread$
|
|
1181
|
+
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; }
|
|
1182
|
+
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
1183
|
const truncate = (isExpanded, columns, columnsCount) => {
|
|
1188
1184
|
return isExpanded ? columns.join(' | ') : _sliceInstanceProperty(columns).call(columns, 0, columnsCount).join(' | ') + (columns.length > columnsCount ? '...' : '');
|
|
1189
1185
|
};
|
|
@@ -1212,7 +1208,7 @@ const ColumnList = props => {
|
|
|
1212
1208
|
e.preventDefault();
|
|
1213
1209
|
setIsExpanded(!isExpanded);
|
|
1214
1210
|
},
|
|
1215
|
-
children: isExpanded ? jsx(FormattedMessage, _objectSpread$
|
|
1211
|
+
children: isExpanded ? jsx(FormattedMessage, _objectSpread$9({}, messages$3.showLess)) : jsx(FormattedMessage, _objectSpread$9({}, messages$3.showMore))
|
|
1216
1212
|
})
|
|
1217
1213
|
})]
|
|
1218
1214
|
})
|
|
@@ -1220,8 +1216,8 @@ const ColumnList = props => {
|
|
|
1220
1216
|
});
|
|
1221
1217
|
};
|
|
1222
1218
|
|
|
1223
|
-
function ownKeys$
|
|
1224
|
-
function _objectSpread$
|
|
1219
|
+
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; }
|
|
1220
|
+
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
1221
|
function UploadPreviewModal() {
|
|
1226
1222
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1227
1223
|
state = _useImportResourcesCo.state;
|
|
@@ -1238,7 +1234,7 @@ function UploadPreviewModal() {
|
|
|
1238
1234
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1239
1235
|
resourceType: state.resourceType
|
|
1240
1236
|
}),
|
|
1241
|
-
labelPrimary: intl.formatMessage(messages$
|
|
1237
|
+
labelPrimary: intl.formatMessage(messages$3.continue),
|
|
1242
1238
|
onSecondaryButtonClick: () => onClose({
|
|
1243
1239
|
shouldDeleteImportContainer: true
|
|
1244
1240
|
}),
|
|
@@ -1256,7 +1252,7 @@ function UploadPreviewModal() {
|
|
|
1256
1252
|
children: jsxs(Spacings.Stack, {
|
|
1257
1253
|
scale: "m",
|
|
1258
1254
|
children: [jsx("div", {}), jsx(Text.Body, {
|
|
1259
|
-
intlMessage: messages$
|
|
1255
|
+
intlMessage: messages$3.previewOfYourImport
|
|
1260
1256
|
}), jsx(Card, {
|
|
1261
1257
|
insetScale: "xl",
|
|
1262
1258
|
children: jsxs(Spacings.Stack, {
|
|
@@ -1266,7 +1262,7 @@ function UploadPreviewModal() {
|
|
|
1266
1262
|
children: [jsx(CheckBoldIcon, {
|
|
1267
1263
|
color: "success"
|
|
1268
1264
|
}), jsx(Text.Body, {
|
|
1269
|
-
intlMessage: _objectSpread$
|
|
1265
|
+
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$3.rowsToBeImported), {}, {
|
|
1270
1266
|
values: {
|
|
1271
1267
|
rowCount: intl.formatNumber(state.uploadFileResponse.rowsCount),
|
|
1272
1268
|
b: getBold$3
|
|
@@ -1278,7 +1274,7 @@ function UploadPreviewModal() {
|
|
|
1278
1274
|
children: [jsx(CheckBoldIcon, {
|
|
1279
1275
|
color: "success"
|
|
1280
1276
|
}), jsx(Text.Body, {
|
|
1281
|
-
intlMessage: _objectSpread$
|
|
1277
|
+
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$3.columnsToBeImported), {}, {
|
|
1282
1278
|
values: {
|
|
1283
1279
|
columnCount: intl.formatNumber(validatedColumns.length),
|
|
1284
1280
|
b: getBold$3
|
|
@@ -1298,7 +1294,7 @@ function UploadPreviewModal() {
|
|
|
1298
1294
|
children: [jsx(EyeCrossedIcon, {
|
|
1299
1295
|
color: "neutral60"
|
|
1300
1296
|
}), jsx(Text.Body, {
|
|
1301
|
-
intlMessage: _objectSpread$
|
|
1297
|
+
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$3.columnsToBeIgnored), {}, {
|
|
1302
1298
|
values: {
|
|
1303
1299
|
columnCount: intl.formatNumber(ignoredColumns.length),
|
|
1304
1300
|
b: getBold$3
|
|
@@ -1324,33 +1320,29 @@ function getBold$3(msg) {
|
|
|
1324
1320
|
});
|
|
1325
1321
|
}
|
|
1326
1322
|
|
|
1327
|
-
function ownKeys$
|
|
1328
|
-
function _objectSpread$
|
|
1323
|
+
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; }
|
|
1324
|
+
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
1325
|
const getNewLine = () => jsx("br", {});
|
|
1330
1326
|
const getImportLogsLink = (msg, projectKey) => jsx(Link, {
|
|
1331
|
-
to:
|
|
1327
|
+
to: `/${projectKey}/operations/import/logs`,
|
|
1332
1328
|
children: msg
|
|
1333
1329
|
});
|
|
1334
1330
|
const ImportConfirmationModal = () => {
|
|
1335
|
-
var _state$uploadFileResp;
|
|
1336
1331
|
const intl = useIntl();
|
|
1337
1332
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1338
1333
|
state = _useImportResourcesCo.state,
|
|
1339
1334
|
onStartImportSuccess = _useImportResourcesCo.onStartImportSuccess,
|
|
1340
1335
|
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
|
-
}),
|
|
1336
|
+
const _useApplicationContex = useApplicationContext(context => ({
|
|
1337
|
+
projectKey: context.project?.key,
|
|
1338
|
+
projectName: context.project?.name
|
|
1339
|
+
})),
|
|
1348
1340
|
projectKey = _useApplicationContex.projectKey,
|
|
1349
1341
|
projectName = _useApplicationContex.projectName;
|
|
1350
1342
|
const asyncDispatch = useAsyncDispatch();
|
|
1351
1343
|
const showNotification = useShowNotification();
|
|
1352
1344
|
const ImportRunningTextNotification = () => jsx(Text.Body, {
|
|
1353
|
-
intlMessage: _objectSpread$
|
|
1345
|
+
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$3.uploadNotificationSuccessMessage), {}, {
|
|
1354
1346
|
values: {
|
|
1355
1347
|
newline: getNewLine,
|
|
1356
1348
|
logsLink: msg => getImportLogsLink(msg, projectKey),
|
|
@@ -1360,12 +1352,12 @@ const ImportConfirmationModal = () => {
|
|
|
1360
1352
|
});
|
|
1361
1353
|
return jsx(ConfirmationDialog, {
|
|
1362
1354
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1363
|
-
resourceType: resourceTypeToDisplayName({
|
|
1355
|
+
resourceType: resourceTypeToDisplayName$1({
|
|
1364
1356
|
resourceType: state.resourceType,
|
|
1365
1357
|
isPlural: true
|
|
1366
1358
|
})
|
|
1367
1359
|
}),
|
|
1368
|
-
labelPrimary: intl.formatMessage(messages$
|
|
1360
|
+
labelPrimary: intl.formatMessage(messages$3.startImportButton),
|
|
1369
1361
|
isOpen: true,
|
|
1370
1362
|
onClose: () => onClose({
|
|
1371
1363
|
shouldDeleteImportContainer: true
|
|
@@ -1381,8 +1373,7 @@ const ImportConfirmationModal = () => {
|
|
|
1381
1373
|
},
|
|
1382
1374
|
onConfirm: async () => {
|
|
1383
1375
|
try {
|
|
1384
|
-
|
|
1385
|
-
const canConfirm = projectKey && state.containerKey && ((_state$droppedFile = state.droppedFile) === null || _state$droppedFile === void 0 ? void 0 : _state$droppedFile.name) && state.resourceType;
|
|
1376
|
+
const canConfirm = projectKey && state.containerKey && state.droppedFile?.name && state.resourceType;
|
|
1386
1377
|
if (!canConfirm) return;
|
|
1387
1378
|
onClose();
|
|
1388
1379
|
await processUploadedFile({
|
|
@@ -1416,18 +1407,18 @@ const ImportConfirmationModal = () => {
|
|
|
1416
1407
|
scale: "xl",
|
|
1417
1408
|
children: [jsxs("div", {
|
|
1418
1409
|
children: [jsx(Text.Body, {
|
|
1419
|
-
intlMessage: _objectSpread$
|
|
1410
|
+
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$3.confirmationBodyText), {}, {
|
|
1420
1411
|
values: {
|
|
1421
1412
|
projectName: projectName,
|
|
1422
|
-
count: intl.formatNumber(
|
|
1413
|
+
count: intl.formatNumber(state?.uploadFileResponse?.rowsCount || 0),
|
|
1423
1414
|
bold: getBold$2
|
|
1424
1415
|
}
|
|
1425
1416
|
})
|
|
1426
1417
|
}), jsx(Text.Body, {
|
|
1427
|
-
intlMessage: messages$
|
|
1418
|
+
intlMessage: messages$3.confirmationBodyNote
|
|
1428
1419
|
})]
|
|
1429
1420
|
}), jsx(Text.Body, {
|
|
1430
|
-
intlMessage: messages$
|
|
1421
|
+
intlMessage: messages$3.confirmationBodyQuestion
|
|
1431
1422
|
})]
|
|
1432
1423
|
})
|
|
1433
1424
|
});
|
|
@@ -1440,7 +1431,7 @@ function getBold$2(msg) {
|
|
|
1440
1431
|
});
|
|
1441
1432
|
}
|
|
1442
1433
|
|
|
1443
|
-
var messages = defineMessages({
|
|
1434
|
+
var messages$2 = defineMessages({
|
|
1444
1435
|
row: {
|
|
1445
1436
|
id: 'ImportResourcesModal.row',
|
|
1446
1437
|
description: 'In Upload file error modal - "Row" column',
|
|
@@ -1473,15 +1464,15 @@ var messages = defineMessages({
|
|
|
1473
1464
|
}
|
|
1474
1465
|
});
|
|
1475
1466
|
|
|
1476
|
-
function ownKeys$
|
|
1477
|
-
function _objectSpread$
|
|
1467
|
+
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; }
|
|
1468
|
+
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
1469
|
const getColumns$1 = () => [{
|
|
1479
1470
|
key: 'errorType',
|
|
1480
|
-
label: jsx(FormattedMessage, _objectSpread$
|
|
1471
|
+
label: jsx(FormattedMessage, _objectSpread$6({}, messages$2.errorType)),
|
|
1481
1472
|
width: 'max-content'
|
|
1482
1473
|
}, {
|
|
1483
1474
|
key: 'details',
|
|
1484
|
-
label: jsx(FormattedMessage, _objectSpread$
|
|
1475
|
+
label: jsx(FormattedMessage, _objectSpread$6({}, messages$2.details))
|
|
1485
1476
|
}];
|
|
1486
1477
|
const UploadClientSideErrorTable = props => {
|
|
1487
1478
|
var _context;
|
|
@@ -1524,10 +1515,9 @@ function itemRenderer$1(item, column) {
|
|
|
1524
1515
|
}
|
|
1525
1516
|
}
|
|
1526
1517
|
|
|
1527
|
-
function ownKeys$
|
|
1528
|
-
function _objectSpread$
|
|
1518
|
+
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; }
|
|
1519
|
+
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
1520
|
const UploadClientSideErrorsModal = () => {
|
|
1530
|
-
var _state$droppedFile;
|
|
1531
1521
|
const intl = useIntl();
|
|
1532
1522
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1533
1523
|
state = _useImportResourcesCo.state,
|
|
@@ -1538,7 +1528,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1538
1528
|
size: 16,
|
|
1539
1529
|
isOpen: true,
|
|
1540
1530
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1541
|
-
resourceType: resourceTypeToDisplayName({
|
|
1531
|
+
resourceType: resourceTypeToDisplayName$1({
|
|
1542
1532
|
resourceType: state.resourceType,
|
|
1543
1533
|
isPlural: true
|
|
1544
1534
|
})
|
|
@@ -1547,9 +1537,9 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1547
1537
|
children: jsxs(Spacings.Stack, {
|
|
1548
1538
|
scale: "l",
|
|
1549
1539
|
children: [jsx(Text.Body, {
|
|
1550
|
-
intlMessage: _objectSpread$
|
|
1540
|
+
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$2.uploadingError), {}, {
|
|
1551
1541
|
values: {
|
|
1552
|
-
fileName:
|
|
1542
|
+
fileName: state.droppedFile?.name,
|
|
1553
1543
|
errorsCount: intl.formatNumber(errorsCount),
|
|
1554
1544
|
b: getBold$1
|
|
1555
1545
|
}
|
|
@@ -1564,7 +1554,7 @@ const UploadClientSideErrorsModal = () => {
|
|
|
1564
1554
|
onClick: () => onClose()
|
|
1565
1555
|
}), jsx(PrimaryButton, {
|
|
1566
1556
|
iconLeft: jsx(ImportIcon, {}),
|
|
1567
|
-
label: intl.formatMessage(messages.uploadNewFile),
|
|
1557
|
+
label: intl.formatMessage(messages$2.uploadNewFile),
|
|
1568
1558
|
onClick: () => actions.uploadNewFile()
|
|
1569
1559
|
})]
|
|
1570
1560
|
})]
|
|
@@ -1579,19 +1569,19 @@ function getBold$1(msg) {
|
|
|
1579
1569
|
});
|
|
1580
1570
|
}
|
|
1581
1571
|
|
|
1582
|
-
function ownKeys$
|
|
1583
|
-
function _objectSpread$
|
|
1572
|
+
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; }
|
|
1573
|
+
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
1574
|
const getColumns = () => [{
|
|
1585
1575
|
key: 'row',
|
|
1586
|
-
label: jsx(FormattedMessage, _objectSpread$
|
|
1576
|
+
label: jsx(FormattedMessage, _objectSpread$4({}, messages$2.row)),
|
|
1587
1577
|
width: 'max-content'
|
|
1588
1578
|
}, {
|
|
1589
1579
|
key: 'errorType',
|
|
1590
|
-
label: jsx(FormattedMessage, _objectSpread$
|
|
1580
|
+
label: jsx(FormattedMessage, _objectSpread$4({}, messages$2.errorType)),
|
|
1591
1581
|
width: 'max-content'
|
|
1592
1582
|
}, {
|
|
1593
1583
|
key: 'details',
|
|
1594
|
-
label: jsx(FormattedMessage, _objectSpread$
|
|
1584
|
+
label: jsx(FormattedMessage, _objectSpread$4({}, messages$2.details))
|
|
1595
1585
|
}];
|
|
1596
1586
|
const UploadServerSideErrorTable = props => {
|
|
1597
1587
|
var _context;
|
|
@@ -1642,22 +1632,21 @@ function itemRenderer(item, column) {
|
|
|
1642
1632
|
}
|
|
1643
1633
|
}
|
|
1644
1634
|
|
|
1645
|
-
function ownKeys$
|
|
1646
|
-
function _objectSpread$
|
|
1635
|
+
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; }
|
|
1636
|
+
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
1637
|
const UploadServerSideErrorsModal = () => {
|
|
1648
|
-
var _state$uploadFileResp, _state$droppedFile, _state$uploadFileResp2;
|
|
1649
1638
|
const intl = useIntl();
|
|
1650
1639
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1651
1640
|
state = _useImportResourcesCo.state,
|
|
1652
1641
|
actions = _useImportResourcesCo.actions,
|
|
1653
1642
|
onClose = _useImportResourcesCo.onClose;
|
|
1654
|
-
const errorsCount = getFileUploadErrorsCount(
|
|
1643
|
+
const errorsCount = getFileUploadErrorsCount(state.uploadFileResponse?.results);
|
|
1655
1644
|
const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
|
|
1656
1645
|
return jsx(InfoDialog, {
|
|
1657
1646
|
size: 16,
|
|
1658
1647
|
isOpen: true,
|
|
1659
1648
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
1660
|
-
resourceType: resourceTypeToDisplayName({
|
|
1649
|
+
resourceType: resourceTypeToDisplayName$1({
|
|
1661
1650
|
resourceType: state.resourceType,
|
|
1662
1651
|
isPlural: true
|
|
1663
1652
|
})
|
|
@@ -1668,15 +1657,15 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1668
1657
|
children: [jsxs(Spacings.Stack, {
|
|
1669
1658
|
scale: "xs",
|
|
1670
1659
|
children: [jsx(Text.Body, {
|
|
1671
|
-
intlMessage: _objectSpread$
|
|
1660
|
+
intlMessage: _objectSpread$3(_objectSpread$3({}, messages$2.uploadingError), {}, {
|
|
1672
1661
|
values: {
|
|
1673
|
-
fileName:
|
|
1662
|
+
fileName: state.droppedFile?.name,
|
|
1674
1663
|
errorsCount: intl.formatNumber(errorsCount),
|
|
1675
1664
|
b: getBold
|
|
1676
1665
|
}
|
|
1677
1666
|
})
|
|
1678
1667
|
}), jsx(Text.Body, {
|
|
1679
|
-
intlMessage: _objectSpread$
|
|
1668
|
+
intlMessage: _objectSpread$3(_objectSpread$3({}, messages$2.supportedValuesDocumentation), {}, {
|
|
1680
1669
|
values: {
|
|
1681
1670
|
documentationLink: msg => jsx(Link, {
|
|
1682
1671
|
tone: "secondary",
|
|
@@ -1688,7 +1677,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1688
1677
|
})
|
|
1689
1678
|
})]
|
|
1690
1679
|
}), jsx(UploadServerSideErrorTable, {
|
|
1691
|
-
rows: mapUploadFileErrorsResponseToUploadFileErrorRows(
|
|
1680
|
+
rows: mapUploadFileErrorsResponseToUploadFileErrorRows(state.uploadFileResponse?.results)
|
|
1692
1681
|
}), jsxs(Spacings.Inline, {
|
|
1693
1682
|
scale: "m",
|
|
1694
1683
|
justifyContent: "flex-end",
|
|
@@ -1697,7 +1686,7 @@ const UploadServerSideErrorsModal = () => {
|
|
|
1697
1686
|
onClick: () => onClose()
|
|
1698
1687
|
}), jsx(PrimaryButton, {
|
|
1699
1688
|
iconLeft: jsx(ImportIcon, {}),
|
|
1700
|
-
label: intl.formatMessage(messages.uploadNewFile),
|
|
1689
|
+
label: intl.formatMessage(messages$2.uploadNewFile),
|
|
1701
1690
|
onClick: () => actions.uploadNewFile()
|
|
1702
1691
|
})]
|
|
1703
1692
|
})]
|
|
@@ -1713,18 +1702,17 @@ function getBold(msg) {
|
|
|
1713
1702
|
}
|
|
1714
1703
|
|
|
1715
1704
|
const UploadResult = () => {
|
|
1716
|
-
var _state$uploadFileResp;
|
|
1717
1705
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1718
1706
|
state = _useImportResourcesCo.state;
|
|
1719
1707
|
if (state.fileUploadClientSideErrors.length > 0) return jsx(UploadClientSideErrorsModal, {});
|
|
1720
|
-
if (
|
|
1708
|
+
if (state.uploadFileResponse?.invalid > 0) return jsx(UploadServerSideErrorsModal, {});
|
|
1721
1709
|
return jsx(UploadPreviewModal, {});
|
|
1722
1710
|
};
|
|
1723
1711
|
|
|
1724
|
-
function ownKeys$
|
|
1725
|
-
function _objectSpread$
|
|
1712
|
+
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; }
|
|
1713
|
+
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
1714
|
var FileIcon = function FileIcon(props) {
|
|
1727
|
-
return jsxs("svg", _objectSpread$
|
|
1715
|
+
return jsxs("svg", _objectSpread$2(_objectSpread$2({}, props), {}, {
|
|
1728
1716
|
children: [jsx("mask", {
|
|
1729
1717
|
id: "a",
|
|
1730
1718
|
style: {
|
|
@@ -1755,17 +1743,16 @@ FileIcon.defaultProps = {
|
|
|
1755
1743
|
xmlns: "http://www.w3.org/2000/svg"
|
|
1756
1744
|
};
|
|
1757
1745
|
const Uploading = () => {
|
|
1758
|
-
var _state$droppedFile;
|
|
1759
1746
|
const intl = useIntl();
|
|
1760
1747
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1761
1748
|
state = _useImportResourcesCo.state,
|
|
1762
1749
|
actions = _useImportResourcesCo.actions,
|
|
1763
1750
|
onClose = _useImportResourcesCo.onClose;
|
|
1764
|
-
const resourceTypePlural = resourceTypeToDisplayName({
|
|
1751
|
+
const resourceTypePlural = resourceTypeToDisplayName$1({
|
|
1765
1752
|
resourceType: state.resourceType,
|
|
1766
1753
|
isPlural: true
|
|
1767
1754
|
});
|
|
1768
|
-
if (
|
|
1755
|
+
if (state.droppedFile?.name) return jsx(InfoDialog, {
|
|
1769
1756
|
size: 16,
|
|
1770
1757
|
isOpen: true,
|
|
1771
1758
|
title: intl.formatMessage(sharedMessages.modalTitle, {
|
|
@@ -1825,6 +1812,97 @@ const CurrentStep = () => {
|
|
|
1825
1812
|
return steps[state.currentStep] || null;
|
|
1826
1813
|
};
|
|
1827
1814
|
|
|
1815
|
+
var messages$1 = defineMessages({
|
|
1816
|
+
products: {
|
|
1817
|
+
id: 'ImportResourcesModal.radio.products',
|
|
1818
|
+
description: 'Label for the products radio button',
|
|
1819
|
+
defaultMessage: 'Products (including variants, assets, prices and images)'
|
|
1820
|
+
},
|
|
1821
|
+
inventories: {
|
|
1822
|
+
id: 'ImportResourcesModal.radio.inventories',
|
|
1823
|
+
description: 'Label for the inventories radio button',
|
|
1824
|
+
defaultMessage: 'Inventories'
|
|
1825
|
+
},
|
|
1826
|
+
categories: {
|
|
1827
|
+
id: 'ImportResourcesModal.radio.categories',
|
|
1828
|
+
description: 'Label for the categories radio button',
|
|
1829
|
+
defaultMessage: 'Categories'
|
|
1830
|
+
}
|
|
1831
|
+
});
|
|
1832
|
+
|
|
1833
|
+
const resourceTypeToDisplayName = resourceType => {
|
|
1834
|
+
switch (resourceType) {
|
|
1835
|
+
case 'product':
|
|
1836
|
+
return messages$1.products;
|
|
1837
|
+
case 'inventory':
|
|
1838
|
+
return messages$1.inventories;
|
|
1839
|
+
case 'category':
|
|
1840
|
+
return messages$1.categories;
|
|
1841
|
+
default:
|
|
1842
|
+
throw new Error(`Unknown resource type: ${resourceType}`);
|
|
1843
|
+
}
|
|
1844
|
+
};
|
|
1845
|
+
const ResourceTypeSelection = () => {
|
|
1846
|
+
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1847
|
+
state = _useImportResourcesCo.state,
|
|
1848
|
+
actions = _useImportResourcesCo.actions,
|
|
1849
|
+
resourceTypes = _useImportResourcesCo.resourceTypes;
|
|
1850
|
+
return jsx(RadioInput.Group, {
|
|
1851
|
+
value: state.resourceType,
|
|
1852
|
+
onChange: e => {
|
|
1853
|
+
actions.setResourceType(e.target.value);
|
|
1854
|
+
},
|
|
1855
|
+
direction: "stack",
|
|
1856
|
+
directionProps: {
|
|
1857
|
+
scale: 's'
|
|
1858
|
+
},
|
|
1859
|
+
children: _mapInstanceProperty(resourceTypes).call(resourceTypes, resourceType => jsx(RadioInput.Option, {
|
|
1860
|
+
value: resourceType,
|
|
1861
|
+
children: jsx(Text.Body, {
|
|
1862
|
+
intlMessage: resourceTypeToDisplayName(resourceType)
|
|
1863
|
+
})
|
|
1864
|
+
}, resourceType))
|
|
1865
|
+
});
|
|
1866
|
+
};
|
|
1867
|
+
|
|
1868
|
+
var messages = defineMessages({
|
|
1869
|
+
fileUploadInstructions: {
|
|
1870
|
+
id: 'ImportResourcesModal.fileUploadInstructions',
|
|
1871
|
+
description: 'Label for the modal category description',
|
|
1872
|
+
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>.'
|
|
1873
|
+
}
|
|
1874
|
+
});
|
|
1875
|
+
|
|
1876
|
+
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; }
|
|
1877
|
+
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; }
|
|
1878
|
+
const Instructions = () => {
|
|
1879
|
+
const intl = useIntl();
|
|
1880
|
+
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1881
|
+
state = _useImportResourcesCo.state;
|
|
1882
|
+
const templateLink = RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS[state.resourceType];
|
|
1883
|
+
const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
|
|
1884
|
+
return jsx(Text.Body, {
|
|
1885
|
+
intlMessage: _objectSpread$1(_objectSpread$1({}, messages.fileUploadInstructions), {}, {
|
|
1886
|
+
values: {
|
|
1887
|
+
fileSize: intl.formatNumber(FILE_SIZE_LIMITS_MB[state.resourceType]),
|
|
1888
|
+
rowLimit: intl.formatNumber(ROW_LIMITS[state.resourceType]),
|
|
1889
|
+
csvTemplateLink: msg => jsx(Link, {
|
|
1890
|
+
tone: "secondary",
|
|
1891
|
+
isExternal: true,
|
|
1892
|
+
to: templateLink,
|
|
1893
|
+
children: msg
|
|
1894
|
+
}),
|
|
1895
|
+
documentationLink: msg => jsx(Link, {
|
|
1896
|
+
tone: "secondary",
|
|
1897
|
+
isExternal: true,
|
|
1898
|
+
to: documentationLink,
|
|
1899
|
+
children: msg
|
|
1900
|
+
})
|
|
1901
|
+
}
|
|
1902
|
+
})
|
|
1903
|
+
});
|
|
1904
|
+
};
|
|
1905
|
+
|
|
1828
1906
|
const getChunkImport = locale => {
|
|
1829
1907
|
const intlLocale = mapLocaleToIntlLocale(locale);
|
|
1830
1908
|
switch (intlLocale) {
|
|
@@ -1850,8 +1928,8 @@ const loadMessages = async locale => {
|
|
|
1850
1928
|
return parseChunkImport(chunkImport);
|
|
1851
1929
|
} catch (error) {
|
|
1852
1930
|
// eslint-disable-next-line no-console
|
|
1853
|
-
console.warn(
|
|
1854
|
-
reportErrorToSentry(new Error(
|
|
1931
|
+
console.warn(`Something went wrong while loading the import-resources-modal messages for ${locale}`, error);
|
|
1932
|
+
reportErrorToSentry(new Error(`Something went wrong while loading the import-resources-modal messages for ${locale}`), {
|
|
1855
1933
|
extra: error
|
|
1856
1934
|
});
|
|
1857
1935
|
return {};
|
|
@@ -1894,14 +1972,23 @@ const useAsyncIntlMessages = (locale, loader) => {
|
|
|
1894
1972
|
};
|
|
1895
1973
|
|
|
1896
1974
|
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
|
|
1975
|
+
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
1976
|
const ImportResourcesModal = props => {
|
|
1977
|
+
var _context;
|
|
1899
1978
|
const _useApplicationContex = useApplicationContext(context => ({
|
|
1900
1979
|
locale: context.user && context.user.locale
|
|
1901
1980
|
})),
|
|
1902
1981
|
locale = _useApplicationContex.locale;
|
|
1903
1982
|
const messages = useAsyncIntlMessages(locale, loadMessages);
|
|
1904
1983
|
if (!props.isOpen || messages.isLoading) return null;
|
|
1984
|
+
if (!props.resourceTypes?.length) {
|
|
1985
|
+
console.error('No resource types provided for import resources modal');
|
|
1986
|
+
return null;
|
|
1987
|
+
}
|
|
1988
|
+
if (!_everyInstanceProperty(_context = props.resourceTypes).call(_context, isResourceType)) {
|
|
1989
|
+
console.error('Invalid resource types provided for import resources modal');
|
|
1990
|
+
return null;
|
|
1991
|
+
}
|
|
1905
1992
|
return jsx(IntlProvider, {
|
|
1906
1993
|
locale: locale,
|
|
1907
1994
|
messages: messages.messages,
|
|
@@ -1912,4 +1999,4 @@ const ImportResourcesModal = props => {
|
|
|
1912
1999
|
};
|
|
1913
2000
|
ImportResourcesModal.displayName = 'ImportResourcesModal';
|
|
1914
2001
|
|
|
1915
|
-
export { EnabledDropArea as E, FileDropped as F, ImportResourcesModal as I, messages$
|
|
2002
|
+
export { EnabledDropArea as E, FileDropped as F, ImportResourcesModal as I, messages$4 as m, useImportResourcesContext as u };
|