@commercetools-frontend-extensions/import-resources-modal 1.11.2 → 1.11.4
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/dist/commercetools-frontend-extensions-import-resources-modal.cjs.dev.js +2086 -53
- package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.prod.js +2062 -53
- package/dist/commercetools-frontend-extensions-import-resources-modal.esm.js +2071 -51
- package/dist/declarations/src/@types/index.d.ts +0 -6
- package/package.json +2 -2
- package/dist/active-drag-drop-area-3ad5dd22.esm.js +0 -60
- package/dist/active-drag-drop-area-94cea372.cjs.prod.js +0 -62
- package/dist/active-drag-drop-area-edf9d7a9.cjs.dev.js +0 -62
- package/dist/declarations/src/@types/api.d.ts +0 -13
- package/dist/declarations/src/@types/file-upload.d.ts +0 -60
- package/dist/declarations/src/@types/import-container.d.ts +0 -36
- package/dist/declarations/src/@types/import-states.d.ts +0 -9
- package/dist/declarations/src/@types/import-summary.d.ts +0 -12
- package/dist/declarations/src/@types/shared.d.ts +0 -7
- package/dist/disabled-drop-area-6af7f861.cjs.dev.js +0 -105
- package/dist/disabled-drop-area-d068b119.esm.js +0 -92
- package/dist/disabled-drop-area-d8a66b62.cjs.prod.js +0 -105
- package/dist/enabled-drop-area-819e5dd2.cjs.dev.js +0 -79
- package/dist/enabled-drop-area-b6fe0252.cjs.prod.js +0 -79
- package/dist/enabled-drop-area-d5d394ff.esm.js +0 -77
- package/dist/file-dropped-area-0e55c4a0.cjs.prod.js +0 -82
- package/dist/file-dropped-area-b64c266f.esm.js +0 -80
- package/dist/file-dropped-area-d4d52da4.cjs.dev.js +0 -82
- package/dist/index-c0e77d3f.cjs.dev.js +0 -2733
- package/dist/index-f14adfdc.esm.js +0 -2699
- package/dist/index-f96fadf7.cjs.prod.js +0 -2701
|
@@ -1,2699 +0,0 @@
|
|
|
1
|
-
import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
2
|
-
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
3
|
-
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
4
|
-
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
|
|
5
|
-
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
6
|
-
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
|
7
|
-
import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
8
|
-
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
9
|
-
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
10
|
-
import _everyInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/every';
|
|
11
|
-
import { defineMessages, useIntl, FormattedMessage, IntlProvider } from 'react-intl';
|
|
12
|
-
import { oidcStorage, useApplicationContext } from '@commercetools-frontend/application-shell-connectors';
|
|
13
|
-
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
14
|
-
import React, { lazy, useContext, useMemo, useState, useEffect } from 'react';
|
|
15
|
-
import { actions, useAsyncDispatch } from '@commercetools-frontend/sdk';
|
|
16
|
-
import { MC_API_PROXY_TARGETS, DOMAINS } from '@commercetools-frontend/constants';
|
|
17
|
-
import { createHttpClientOptions, buildApiUrl } from '@commercetools-frontend/application-shell';
|
|
18
|
-
import _Reflect$construct from '@babel/runtime-corejs3/core-js-stable/reflect/construct';
|
|
19
|
-
import _createClass from '@babel/runtime-corejs3/helpers/esm/createClass';
|
|
20
|
-
import _classCallCheck from '@babel/runtime-corejs3/helpers/esm/classCallCheck';
|
|
21
|
-
import _possibleConstructorReturn from '@babel/runtime-corejs3/helpers/esm/possibleConstructorReturn';
|
|
22
|
-
import _getPrototypeOf from '@babel/runtime-corejs3/helpers/esm/getPrototypeOf';
|
|
23
|
-
import _inherits from '@babel/runtime-corejs3/helpers/esm/inherits';
|
|
24
|
-
import _wrapNativeSuper from '@babel/runtime-corejs3/helpers/esm/wrapNativeSuper';
|
|
25
|
-
import { plural } from 'pluralize';
|
|
26
|
-
import _Promise from '@babel/runtime-corejs3/core-js-stable/promise';
|
|
27
|
-
import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
|
|
28
|
-
import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
|
|
29
|
-
import _someInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/some';
|
|
30
|
-
import _flatMapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/flat-map';
|
|
31
|
-
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
32
|
-
import _findInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
33
|
-
import Papa from 'papaparse';
|
|
34
|
-
import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
|
|
35
|
-
import _sliceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/slice';
|
|
36
|
-
import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
|
|
37
|
-
import '@babel/runtime-corejs3/core-js-stable/instance/bind';
|
|
38
|
-
import '@babel/runtime-corejs3/core-js-stable/instance/starts-with';
|
|
39
|
-
import '@babel/runtime-corejs3/core-js-stable/url-search-params';
|
|
40
|
-
import '@babel/runtime-corejs3/core-js-stable/object/entries';
|
|
41
|
-
import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
42
|
-
import { FormDialog, InfoDialog, PageContentNarrow, ConfirmationDialog } from '@commercetools-frontend/application-components';
|
|
43
|
-
import { Masking } from '@commercetools-frontend/fullstory';
|
|
44
|
-
import { customProperties, Constraints, Spacings, Text, SelectField, CheckboxInput, Grid, designTokens, usePaginationState, DataTable, PageNavigator, Stamp, SecondaryButton, PrimaryButton, ImportIcon, Link, TagList, Card, CheckBoldIcon, EyeCrossedIcon, ProgressBar, RadioInput, ContentNotification } from '@commercetools-frontend/ui-kit';
|
|
45
|
-
import { useDropzone } from 'react-dropzone';
|
|
46
|
-
import { useShowNotification } from '@commercetools-frontend/actions-global';
|
|
47
|
-
import _styled from '@emotion/styled/base';
|
|
48
|
-
import { css } from '@emotion/react';
|
|
49
|
-
import { reportErrorToSentry } from '@commercetools-frontend/sentry';
|
|
50
|
-
import { useIsAuthorized } from '@commercetools-frontend/permissions';
|
|
51
|
-
import { parseChunkImport, mapLocaleToIntlLocale } from '@commercetools-frontend/i18n';
|
|
52
|
-
|
|
53
|
-
const EnabledResourceType = {
|
|
54
|
-
category: true,
|
|
55
|
-
product: true,
|
|
56
|
-
inventory: true,
|
|
57
|
-
'discount-code': true,
|
|
58
|
-
customer: false,
|
|
59
|
-
order: false,
|
|
60
|
-
'product-type': false,
|
|
61
|
-
'business-unit': true
|
|
62
|
-
};
|
|
63
|
-
function isResourceType(maybeResourceType) {
|
|
64
|
-
return typeof maybeResourceType === 'string' && maybeResourceType in EnabledResourceType;
|
|
65
|
-
}
|
|
66
|
-
function assertResourceType(maybeResourceType) {
|
|
67
|
-
if (isResourceType(maybeResourceType)) return;
|
|
68
|
-
throw new Error(`Invalid value: ${maybeResourceType}`);
|
|
69
|
-
}
|
|
70
|
-
function isError(maybeError) {
|
|
71
|
-
if (maybeError instanceof Error) return true;
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
76
|
-
function hasOwnProperty(obj, prop) {
|
|
77
|
-
return typeof obj === 'object' && obj !== null && obj.hasOwnProperty(prop);
|
|
78
|
-
}
|
|
79
|
-
function hasRequiredFields(maybeValidObject, requiredFields) {
|
|
80
|
-
return typeof maybeValidObject === 'object' && maybeValidObject !== null && _everyInstanceProperty(requiredFields).call(requiredFields, property => hasOwnProperty(maybeValidObject, property));
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
let CurrentStep$1 = /*#__PURE__*/function (CurrentStep) {
|
|
84
|
-
CurrentStep["Upload"] = "upload";
|
|
85
|
-
CurrentStep["Uploading"] = "uploading";
|
|
86
|
-
CurrentStep["UploadResult"] = "upload-result";
|
|
87
|
-
CurrentStep["ImportConfirmationModal"] = "import-confirmation-modal";
|
|
88
|
-
return CurrentStep;
|
|
89
|
-
}({});
|
|
90
|
-
|
|
91
|
-
function ownKeys$k(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; }
|
|
92
|
-
function _objectSpread$k(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$k(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$k(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
93
|
-
|
|
94
|
-
// TODO: make this resource type specific
|
|
95
|
-
|
|
96
|
-
function reducer(state, action) {
|
|
97
|
-
if (action.type === 'setCurrentStep') return _objectSpread$k(_objectSpread$k({}, state), {}, {
|
|
98
|
-
currentStep: action.currentStep,
|
|
99
|
-
progress: 0
|
|
100
|
-
});
|
|
101
|
-
if (action.type === 'setUploadFileResponse') return _objectSpread$k(_objectSpread$k({}, state), {}, {
|
|
102
|
-
uploadFileResponse: action.uploadFileResponse
|
|
103
|
-
});
|
|
104
|
-
if (action.type === 'setResourceType') return _objectSpread$k(_objectSpread$k({}, state), {}, {
|
|
105
|
-
resourceType: action.resourceType
|
|
106
|
-
});
|
|
107
|
-
if (action.type === 'setContainerKey') return _objectSpread$k(_objectSpread$k({}, state), {}, {
|
|
108
|
-
containerKey: action.containerKey
|
|
109
|
-
});
|
|
110
|
-
if (action.type === 'cancelImport') return _objectSpread$k(_objectSpread$k({}, state), {}, {
|
|
111
|
-
currentStep: CurrentStep$1.Upload,
|
|
112
|
-
containerKey: undefined,
|
|
113
|
-
fileUploadErrors: [],
|
|
114
|
-
uploadFileResponse: undefined,
|
|
115
|
-
droppedFile: undefined,
|
|
116
|
-
dropAreaState: 'disabled',
|
|
117
|
-
progress: 0
|
|
118
|
-
});
|
|
119
|
-
if (action.type === 'uploadNewFile') return _objectSpread$k(_objectSpread$k({}, state), {}, {
|
|
120
|
-
currentStep: CurrentStep$1.Upload,
|
|
121
|
-
containerKey: undefined,
|
|
122
|
-
fileUploadErrors: [],
|
|
123
|
-
uploadFileResponse: undefined,
|
|
124
|
-
droppedFile: undefined,
|
|
125
|
-
dropAreaState: 'ready-for-drop',
|
|
126
|
-
progress: 0
|
|
127
|
-
});
|
|
128
|
-
if (action.type === 'setDroppedFile') {
|
|
129
|
-
return _objectSpread$k(_objectSpread$k({}, state), {}, {
|
|
130
|
-
droppedFile: action.droppedFile
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
if (action.type === 'setFileUploadErrors') {
|
|
134
|
-
return _objectSpread$k(_objectSpread$k({}, state), {}, {
|
|
135
|
-
fileUploadErrors: action.fileUploadErrors
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
if (action.type === 'setAbortController') {
|
|
139
|
-
return _objectSpread$k(_objectSpread$k({}, state), {}, {
|
|
140
|
-
abortController: action.abortController
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
if (action.type === 'setProgress') {
|
|
144
|
-
return _objectSpread$k(_objectSpread$k({}, state), {}, {
|
|
145
|
-
progress: action.progress
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
if (action.type === 'setUploadSettings') {
|
|
149
|
-
return _objectSpread$k(_objectSpread$k({}, state), {}, {
|
|
150
|
-
settings: _objectSpread$k(_objectSpread$k({}, state.settings), action.settings)
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
throw new Error(getUnknownActionError(action));
|
|
154
|
-
}
|
|
155
|
-
function getUnknownActionError(actionType) {
|
|
156
|
-
return `Unkown type: ${actionType}`;
|
|
157
|
-
}
|
|
158
|
-
const initialState = {
|
|
159
|
-
currentStep: CurrentStep$1.Upload,
|
|
160
|
-
abortController: new AbortController(),
|
|
161
|
-
dropAreaState: 'disabled',
|
|
162
|
-
uploadFileResponse: undefined,
|
|
163
|
-
fileUploadErrors: [],
|
|
164
|
-
resourceType: 'category',
|
|
165
|
-
containerKey: undefined,
|
|
166
|
-
progress: 0,
|
|
167
|
-
settings: {
|
|
168
|
-
decimalSeparator: '.'
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
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)); }
|
|
173
|
-
function _isNativeReflectConstruct$2() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$2 = function () { return !!t; })(); }
|
|
174
|
-
let MissingImportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
175
|
-
function MissingImportResourceProviderError() {
|
|
176
|
-
var _this;
|
|
177
|
-
_classCallCheck(this, MissingImportResourceProviderError);
|
|
178
|
-
_this = _callSuper$2(this, MissingImportResourceProviderError, ['useImportResourcesContext must be used within ImportResourcesProvider']);
|
|
179
|
-
_this.name = 'MissingImportResourceProviderError';
|
|
180
|
-
return _this;
|
|
181
|
-
}
|
|
182
|
-
_inherits(MissingImportResourceProviderError, _Error);
|
|
183
|
-
return _createClass(MissingImportResourceProviderError);
|
|
184
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
185
|
-
|
|
186
|
-
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)); }
|
|
187
|
-
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function () { return !!t; })(); }
|
|
188
|
-
let UnexpectedColumnError = /*#__PURE__*/function (_Error) {
|
|
189
|
-
function UnexpectedColumnError(columnName) {
|
|
190
|
-
var _this;
|
|
191
|
-
_classCallCheck(this, UnexpectedColumnError);
|
|
192
|
-
_this = _callSuper$1(this, UnexpectedColumnError, [`Unexpected column "${columnName}"`]);
|
|
193
|
-
_this.name = 'UnexpectedColumnError';
|
|
194
|
-
return _this;
|
|
195
|
-
}
|
|
196
|
-
_inherits(UnexpectedColumnError, _Error);
|
|
197
|
-
return _createClass(UnexpectedColumnError);
|
|
198
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
199
|
-
|
|
200
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
201
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
202
|
-
let HttpError = /*#__PURE__*/function (_Error) {
|
|
203
|
-
function HttpError(statusCode, statusText, errorData) {
|
|
204
|
-
var _this;
|
|
205
|
-
_classCallCheck(this, HttpError);
|
|
206
|
-
_this = _callSuper(this, HttpError, [`HTTP Error! Status code: ${statusCode}, message: "${statusText ? statusText : ''}"`]);
|
|
207
|
-
_this.statusCode = void 0;
|
|
208
|
-
_this.errorData = void 0;
|
|
209
|
-
_this.name = 'HttpError';
|
|
210
|
-
_this.statusCode = statusCode;
|
|
211
|
-
_this.errorData = errorData;
|
|
212
|
-
return _this;
|
|
213
|
-
}
|
|
214
|
-
_inherits(HttpError, _Error);
|
|
215
|
-
return _createClass(HttpError);
|
|
216
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
217
|
-
|
|
218
|
-
function ownKeys$j(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; }
|
|
219
|
-
function _objectSpread$j(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys$j(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys$j(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
220
|
-
const addProxyPrefixToUrl = (uri, proxy) => {
|
|
221
|
-
return proxy ? `/proxy/${proxy}${uri}` : uri;
|
|
222
|
-
};
|
|
223
|
-
const fetchUsingXhr = _ref2 => {
|
|
224
|
-
let url = _ref2.url,
|
|
225
|
-
payload = _ref2.payload,
|
|
226
|
-
config = _ref2.config,
|
|
227
|
-
onProgress = _ref2.onProgress,
|
|
228
|
-
onSuccess = _ref2.onSuccess,
|
|
229
|
-
onError = _ref2.onError;
|
|
230
|
-
const options = createHttpClientOptions({
|
|
231
|
-
headers: _objectSpread$j({
|
|
232
|
-
'Content-Type': 'application/json'
|
|
233
|
-
}, config?.headers)
|
|
234
|
-
});
|
|
235
|
-
const xhr = new XMLHttpRequest();
|
|
236
|
-
xhr.open(config?.method, buildApiUrl(addProxyPrefixToUrl(url, config?.proxy)), true);
|
|
237
|
-
// Include cookies in the request
|
|
238
|
-
xhr.withCredentials = true;
|
|
239
|
-
if (options.headers) {
|
|
240
|
-
var _context;
|
|
241
|
-
_forEachInstanceProperty(_context = _Object$keys(options.headers)).call(_context, key => {
|
|
242
|
-
xhr.setRequestHeader(key, options.headers[key]);
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
xhr.upload.onprogress = function (event) {
|
|
246
|
-
if (event.lengthComputable) {
|
|
247
|
-
const percentComplete = event.loaded / event.total * 100;
|
|
248
|
-
onProgress(percentComplete);
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
xhr.onload = function () {
|
|
252
|
-
const data = JSON.parse(xhr.responseText);
|
|
253
|
-
// Code copied from `executeHttpClientRequest` to replicate the same behavior
|
|
254
|
-
const refreshedSessionToken = xhr.getResponseHeader('x-refreshed-session-token');
|
|
255
|
-
if (refreshedSessionToken) {
|
|
256
|
-
oidcStorage.setActiveSession(refreshedSessionToken);
|
|
257
|
-
}
|
|
258
|
-
if (xhr.status >= 200 && xhr.status < 300) {
|
|
259
|
-
onSuccess(data);
|
|
260
|
-
} else {
|
|
261
|
-
onError(new HttpError(xhr.status, xhr.statusText, data));
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
xhr.onerror = function () {
|
|
265
|
-
const errorData = JSON.parse(xhr.responseText);
|
|
266
|
-
onError(new HttpError(xhr.status, xhr.statusText, errorData));
|
|
267
|
-
};
|
|
268
|
-
xhr.onabort = function () {
|
|
269
|
-
onError(new DOMException('Aborted', 'AbortError'));
|
|
270
|
-
};
|
|
271
|
-
xhr.send(payload);
|
|
272
|
-
return xhr;
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
const DELIMITERS = {
|
|
276
|
-
COMMA: ',',
|
|
277
|
-
SEMICOLON: ';',
|
|
278
|
-
POINT: '.',
|
|
279
|
-
TAB: '\t',
|
|
280
|
-
PIPE: '|'
|
|
281
|
-
};
|
|
282
|
-
const COLUMN_DELIMITERS = [DELIMITERS.COMMA, DELIMITERS.SEMICOLON, DELIMITERS.PIPE, DELIMITERS.TAB];
|
|
283
|
-
const INITIAL_COLUMN_DISPLAY_COUNT = 8;
|
|
284
|
-
const IMPORT_TAG_KEYS = {
|
|
285
|
-
source: 'source'
|
|
286
|
-
};
|
|
287
|
-
const IMPORT_TAG_VALUES = {
|
|
288
|
-
fileUpload: 'file-upload'
|
|
289
|
-
};
|
|
290
|
-
const TAG_KEY_SOURCE_FILE_UPLOAD = `${IMPORT_TAG_KEYS.source}:${IMPORT_TAG_VALUES.fileUpload}`;
|
|
291
|
-
|
|
292
|
-
const IMPORTABLE_RESOURCES = {
|
|
293
|
-
CATEGORY: 'category',
|
|
294
|
-
PRODUCT: 'product',
|
|
295
|
-
INVENTORY: 'inventory',
|
|
296
|
-
DISCOUNT_CODE: 'discount-code',
|
|
297
|
-
CUSTOMER: 'customer',
|
|
298
|
-
ORDER: 'order',
|
|
299
|
-
PRODUCT_TYPE: 'product-type',
|
|
300
|
-
BUSINESS_UNIT: 'business-unit'
|
|
301
|
-
};
|
|
302
|
-
|
|
303
|
-
const FILE_SIZE_LIMITS_MB = {
|
|
304
|
-
[IMPORTABLE_RESOURCES.CATEGORY]: 35,
|
|
305
|
-
[IMPORTABLE_RESOURCES.INVENTORY]: 35,
|
|
306
|
-
[IMPORTABLE_RESOURCES.PRODUCT]: 35,
|
|
307
|
-
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 35,
|
|
308
|
-
[IMPORTABLE_RESOURCES.CUSTOMER]: 0,
|
|
309
|
-
[IMPORTABLE_RESOURCES.ORDER]: 0,
|
|
310
|
-
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 35,
|
|
311
|
-
[IMPORTABLE_RESOURCES.BUSINESS_UNIT]: 35
|
|
312
|
-
};
|
|
313
|
-
const ROW_LIMITS = {
|
|
314
|
-
[IMPORTABLE_RESOURCES.CATEGORY]: 80_000,
|
|
315
|
-
[IMPORTABLE_RESOURCES.INVENTORY]: 80_000,
|
|
316
|
-
[IMPORTABLE_RESOURCES.PRODUCT]: 80_000,
|
|
317
|
-
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 80_000,
|
|
318
|
-
[IMPORTABLE_RESOURCES.CUSTOMER]: 0,
|
|
319
|
-
[IMPORTABLE_RESOURCES.ORDER]: 0,
|
|
320
|
-
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 80_000,
|
|
321
|
-
[IMPORTABLE_RESOURCES.BUSINESS_UNIT]: 80_000
|
|
322
|
-
};
|
|
323
|
-
const RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS = {
|
|
324
|
-
[IMPORTABLE_RESOURCES.CATEGORY]: 'https://docs.commercetools.com/merchant-center/downloads/category_import_template.csv',
|
|
325
|
-
[IMPORTABLE_RESOURCES.PRODUCT]: 'https://docs.commercetools.com/merchant-center/import-data#download-a-template',
|
|
326
|
-
[IMPORTABLE_RESOURCES.INVENTORY]: 'https://docs.commercetools.com/merchant-center/downloads/inventory_entry_import_template.csv',
|
|
327
|
-
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 'https://docs.commercetools.com/merchant-center/downloads/discount_code_import_template.csv',
|
|
328
|
-
[IMPORTABLE_RESOURCES.CUSTOMER]: 'https://docs.commercetools.com/merchant-center/import-data#download-a-template',
|
|
329
|
-
[IMPORTABLE_RESOURCES.ORDER]: 'https://docs.commercetools.com/merchant-center/import-data#download-a-template',
|
|
330
|
-
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 'https://docs.commercetools.com/merchant-center/downloads/product_type_import_template.csv',
|
|
331
|
-
[IMPORTABLE_RESOURCES.BUSINESS_UNIT]: 'https://docs.commercetools.com/merchant-center/downloads/business_unit_import_template.csv'
|
|
332
|
-
};
|
|
333
|
-
const RESOURCE_TYPE_DOCUMENTATION_LINKS = {
|
|
334
|
-
[IMPORTABLE_RESOURCES.CATEGORY]: 'https://docs.commercetools.com/merchant-center/import-categories#supported-headers-and-values',
|
|
335
|
-
[IMPORTABLE_RESOURCES.PRODUCT]: 'https://docs.commercetools.com/merchant-center/import-products#supported-headers-and-values',
|
|
336
|
-
[IMPORTABLE_RESOURCES.INVENTORY]: 'https://docs.commercetools.com/merchant-center/import-inventory#supported-headers-and-values',
|
|
337
|
-
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 'https://docs.commercetools.com/merchant-center/import-discount-codes#supported-headers-and-values',
|
|
338
|
-
[IMPORTABLE_RESOURCES.CUSTOMER]: 'https://docs.commercetools.com/merchant-center/import-customers#supported-headers-and-values',
|
|
339
|
-
[IMPORTABLE_RESOURCES.ORDER]: 'https://docs.commercetools.com/merchant-center/import-orders#supported-headers-and-values',
|
|
340
|
-
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 'https://docs.commercetools.com/merchant-center/import-product-types#supported-headers-and-values',
|
|
341
|
-
[IMPORTABLE_RESOURCES.BUSINESS_UNIT]: 'https://docs.commercetools.com/merchant-center/import-business-units#supported-headers-and-values'
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
const CT_API_DOCS_URL = 'https://docs.commercetools.com/api/';
|
|
345
|
-
|
|
346
|
-
const PERMISSIONS = {
|
|
347
|
-
// Categories
|
|
348
|
-
ManageCategories: 'ManageCategories',
|
|
349
|
-
ViewCategories: 'ViewCategories',
|
|
350
|
-
// Products
|
|
351
|
-
ManageProducts: 'ManageProducts',
|
|
352
|
-
ViewProducts: 'ViewProducts',
|
|
353
|
-
// ProductTypes
|
|
354
|
-
ManageProductTypes: 'ManageProductTypes',
|
|
355
|
-
ViewProductTypes: 'ViewProductTypes',
|
|
356
|
-
// DiscountCodes
|
|
357
|
-
ManageDiscountCodes: 'ManageDiscountCodes',
|
|
358
|
-
ViewDiscountCodes: 'ViewDiscountCodes',
|
|
359
|
-
// Customers
|
|
360
|
-
ManageCustomers: 'ManageCustomers',
|
|
361
|
-
ViewCustomers: 'ViewCustomers',
|
|
362
|
-
// Orders
|
|
363
|
-
ManageOrders: 'ManageOrders',
|
|
364
|
-
ViewOrders: 'ViewOrders',
|
|
365
|
-
// KeyValueDocuments
|
|
366
|
-
ManageKeyValueDocuments: 'ManageKeyValueDocuments',
|
|
367
|
-
ViewKeyValueDocuments: 'ViewKeyValueDocuments',
|
|
368
|
-
// BusinessUnits
|
|
369
|
-
ManageBusinessUnits: 'ManageBusinessUnits',
|
|
370
|
-
ViewBusinessUnits: 'ViewBusinessUnits'
|
|
371
|
-
};
|
|
372
|
-
const ACTION_RIGHTS = {
|
|
373
|
-
PublishProducts: {
|
|
374
|
-
group: 'products',
|
|
375
|
-
name: 'PublishProducts'
|
|
376
|
-
},
|
|
377
|
-
UnpublishProducts: {
|
|
378
|
-
group: 'products',
|
|
379
|
-
name: 'UnpublishProducts'
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
|
|
383
|
-
function ownKeys$i(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; }
|
|
384
|
-
function _objectSpread$i(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$i(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$i(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
385
|
-
const DEFAULT_SHORT_LIVED_FLAGS = {};
|
|
386
|
-
const DEFAULT_LONG_LIVED_FLAGS = {};
|
|
387
|
-
_objectSpread$i(_objectSpread$i({}, DEFAULT_SHORT_LIVED_FLAGS), DEFAULT_LONG_LIVED_FLAGS);
|
|
388
|
-
|
|
389
|
-
var sharedMessages = defineMessages({
|
|
390
|
-
[`modalTitle.${IMPORTABLE_RESOURCES.CATEGORY}`]: {
|
|
391
|
-
id: 'ImportResourcesModal.modalTitle.category',
|
|
392
|
-
description: 'Label for the categories modal title',
|
|
393
|
-
defaultMessage: 'Import categories by CSV'
|
|
394
|
-
},
|
|
395
|
-
[`modalTitle.${IMPORTABLE_RESOURCES.PRODUCT}`]: {
|
|
396
|
-
id: 'ImportResourcesModal.modalTitle.product',
|
|
397
|
-
description: 'Label for the products modal title',
|
|
398
|
-
defaultMessage: 'Import products by CSV'
|
|
399
|
-
},
|
|
400
|
-
[`modalTitle.${IMPORTABLE_RESOURCES.INVENTORY}`]: {
|
|
401
|
-
id: 'ImportResourcesModal.modalTitle.inventoryEntry',
|
|
402
|
-
description: 'Label for the inventories modal title',
|
|
403
|
-
defaultMessage: 'Import inventories by CSV'
|
|
404
|
-
},
|
|
405
|
-
[`modalTitle.${IMPORTABLE_RESOURCES.DISCOUNT_CODE}`]: {
|
|
406
|
-
id: 'ImportResourcesModal.modalTitle.discountCode',
|
|
407
|
-
description: 'Label for the inventories modal title',
|
|
408
|
-
defaultMessage: 'Import discount codes by CSV'
|
|
409
|
-
},
|
|
410
|
-
[`modalTitle.${IMPORTABLE_RESOURCES.BUSINESS_UNIT}`]: {
|
|
411
|
-
id: 'ImportResourcesModal.modalTitle.businessUnit',
|
|
412
|
-
description: 'Label for the business units modal title',
|
|
413
|
-
defaultMessage: 'Import business units by CSV'
|
|
414
|
-
},
|
|
415
|
-
[`modalTitle.${IMPORTABLE_RESOURCES.CUSTOMER}`]: {
|
|
416
|
-
id: 'ImportResourcesModal.modalTitle.customer',
|
|
417
|
-
description: 'Label for the customers modal title',
|
|
418
|
-
defaultMessage: 'Import customers by CSV'
|
|
419
|
-
},
|
|
420
|
-
[`modalTitle.${IMPORTABLE_RESOURCES.ORDER}`]: {
|
|
421
|
-
id: 'ImportResourcesModal.modalTitle.order',
|
|
422
|
-
description: 'Label for the order modal title',
|
|
423
|
-
defaultMessage: 'Import orders by CSV'
|
|
424
|
-
},
|
|
425
|
-
[`modalTitle.${IMPORTABLE_RESOURCES.PRODUCT_TYPE}`]: {
|
|
426
|
-
id: 'ImportResourcesModal.modalTitle.productType',
|
|
427
|
-
description: 'Label for the product type modal title',
|
|
428
|
-
defaultMessage: 'Import product types by CSV'
|
|
429
|
-
},
|
|
430
|
-
uploadButton: {
|
|
431
|
-
id: 'ImportResourcesModal.uploadButton',
|
|
432
|
-
description: 'Label for the upload button',
|
|
433
|
-
defaultMessage: 'Upload and preview'
|
|
434
|
-
},
|
|
435
|
-
cancel: {
|
|
436
|
-
id: 'ImportResourcesModal.cancel',
|
|
437
|
-
description: 'Label for the cancel button',
|
|
438
|
-
defaultMessage: 'Cancel'
|
|
439
|
-
},
|
|
440
|
-
close: {
|
|
441
|
-
id: 'ImportResourcesModal.close',
|
|
442
|
-
description: 'Label for the close button',
|
|
443
|
-
defaultMessage: 'Close'
|
|
444
|
-
},
|
|
445
|
-
listConjunctionOr: {
|
|
446
|
-
id: 'ImportResourcesModal.listConjunctionOr',
|
|
447
|
-
description: 'Label for the list conjunction or',
|
|
448
|
-
defaultMessage: 'or'
|
|
449
|
-
},
|
|
450
|
-
delimiterComma: {
|
|
451
|
-
id: 'ImportResourcesModal.delimiterComma',
|
|
452
|
-
description: 'Label for the delimiter name comma',
|
|
453
|
-
defaultMessage: 'comma'
|
|
454
|
-
},
|
|
455
|
-
delimiterSemicolon: {
|
|
456
|
-
id: 'ImportResourcesModal.delimiterSemicolon',
|
|
457
|
-
description: 'Label for the delimiter name semicolon',
|
|
458
|
-
defaultMessage: 'semicolon'
|
|
459
|
-
},
|
|
460
|
-
delimiterPipe: {
|
|
461
|
-
id: 'ImportResourcesModal.delimiterPipe',
|
|
462
|
-
description: 'Label for the delimiter name pipe',
|
|
463
|
-
defaultMessage: 'pipe'
|
|
464
|
-
},
|
|
465
|
-
delimiterTab: {
|
|
466
|
-
id: 'ImportResourcesModal.delimiterTab',
|
|
467
|
-
description: 'Label for the delimiter name tab',
|
|
468
|
-
defaultMessage: 'tab'
|
|
469
|
-
},
|
|
470
|
-
// Resource types
|
|
471
|
-
product: {
|
|
472
|
-
id: 'ImportResourcesModal.product',
|
|
473
|
-
description: 'Label for the product resource type',
|
|
474
|
-
defaultMessage: 'Product'
|
|
475
|
-
},
|
|
476
|
-
products: {
|
|
477
|
-
id: 'ImportResourcesModal.products',
|
|
478
|
-
description: 'Label for the products resource type',
|
|
479
|
-
defaultMessage: 'Products'
|
|
480
|
-
},
|
|
481
|
-
inventory: {
|
|
482
|
-
id: 'ImportResourcesModal.inventory',
|
|
483
|
-
description: 'Label for the inventory entry resource type',
|
|
484
|
-
defaultMessage: 'Inventory'
|
|
485
|
-
},
|
|
486
|
-
inventories: {
|
|
487
|
-
id: 'ImportResourcesModal.inventories',
|
|
488
|
-
description: 'Label for the inventories entry resource type',
|
|
489
|
-
defaultMessage: 'Inventories'
|
|
490
|
-
},
|
|
491
|
-
category: {
|
|
492
|
-
id: 'ImportResourcesModal.category',
|
|
493
|
-
description: 'Label for the category resource type',
|
|
494
|
-
defaultMessage: 'Category'
|
|
495
|
-
},
|
|
496
|
-
categories: {
|
|
497
|
-
id: 'ImportResourcesModal.categories',
|
|
498
|
-
description: 'Label for the categories resource type',
|
|
499
|
-
defaultMessage: 'Categories'
|
|
500
|
-
},
|
|
501
|
-
'custom-object': {
|
|
502
|
-
id: 'ImportResourcesModal.custom-object',
|
|
503
|
-
description: 'Label for the custom-object resource type',
|
|
504
|
-
defaultMessage: 'Custom object'
|
|
505
|
-
},
|
|
506
|
-
'custom-objects': {
|
|
507
|
-
id: 'ImportResourcesModal.custom-objects',
|
|
508
|
-
description: 'Label for the custom-objects resource type',
|
|
509
|
-
defaultMessage: 'Custom objects'
|
|
510
|
-
},
|
|
511
|
-
customer: {
|
|
512
|
-
id: 'ImportResourcesModal.customer',
|
|
513
|
-
description: 'Label for the customer resource type',
|
|
514
|
-
defaultMessage: 'Customer'
|
|
515
|
-
},
|
|
516
|
-
customers: {
|
|
517
|
-
id: 'ImportResourcesModal.customers',
|
|
518
|
-
description: 'Label for the customers resource type',
|
|
519
|
-
defaultMessage: 'Customers'
|
|
520
|
-
},
|
|
521
|
-
order: {
|
|
522
|
-
id: 'ImportResourcesModal.order',
|
|
523
|
-
description: 'Label for the order resource type',
|
|
524
|
-
defaultMessage: 'Order'
|
|
525
|
-
},
|
|
526
|
-
orders: {
|
|
527
|
-
id: 'ImportResourcesModal.orders',
|
|
528
|
-
description: 'Label for the orders resource type',
|
|
529
|
-
defaultMessage: 'Orders'
|
|
530
|
-
},
|
|
531
|
-
'order-patch': {
|
|
532
|
-
id: 'ImportResourcesModal.order-patch',
|
|
533
|
-
description: 'Label for the order-patch resource type',
|
|
534
|
-
defaultMessage: 'Order patch'
|
|
535
|
-
},
|
|
536
|
-
'order-patches': {
|
|
537
|
-
id: 'ImportResourcesModal.order-patches',
|
|
538
|
-
description: 'Label for the order-patches resource type',
|
|
539
|
-
defaultMessage: 'Order patches'
|
|
540
|
-
},
|
|
541
|
-
price: {
|
|
542
|
-
id: 'ImportResourcesModal.price',
|
|
543
|
-
description: 'Label for the price resource type',
|
|
544
|
-
defaultMessage: 'Price'
|
|
545
|
-
},
|
|
546
|
-
prices: {
|
|
547
|
-
id: 'ImportResourcesModal.prices',
|
|
548
|
-
description: 'Label for the prices resource type',
|
|
549
|
-
defaultMessage: 'Prices'
|
|
550
|
-
},
|
|
551
|
-
'product-draft': {
|
|
552
|
-
id: 'ImportResourcesModal.product-draft',
|
|
553
|
-
description: 'Label for the product-draft resource type',
|
|
554
|
-
defaultMessage: 'Product draft'
|
|
555
|
-
},
|
|
556
|
-
'product-drafts': {
|
|
557
|
-
id: 'ImportResourcesModal.product-drafts',
|
|
558
|
-
description: 'Label for the product-drafts resource type',
|
|
559
|
-
defaultMessage: 'Product drafts'
|
|
560
|
-
},
|
|
561
|
-
'product-type': {
|
|
562
|
-
id: 'ImportResourcesModal.product-type',
|
|
563
|
-
description: 'Label for the product-type resource type',
|
|
564
|
-
defaultMessage: 'Product type'
|
|
565
|
-
},
|
|
566
|
-
'product-types': {
|
|
567
|
-
id: 'ImportResourcesModal.product-types',
|
|
568
|
-
description: 'Label for the product-types resource type',
|
|
569
|
-
defaultMessage: 'Product types'
|
|
570
|
-
},
|
|
571
|
-
'product-variant': {
|
|
572
|
-
id: 'ImportResourcesModal.product-variant',
|
|
573
|
-
description: 'Label for the product-variant resource type',
|
|
574
|
-
defaultMessage: 'Product variant'
|
|
575
|
-
},
|
|
576
|
-
'product-variants': {
|
|
577
|
-
id: 'ImportResourcesModal.product-variants',
|
|
578
|
-
description: 'Label for the product-variants resource type',
|
|
579
|
-
defaultMessage: 'Product variants'
|
|
580
|
-
},
|
|
581
|
-
'product-variant-patch': {
|
|
582
|
-
id: 'ImportResourcesModal.product-variant-patch',
|
|
583
|
-
description: 'Label for the product-variant-patch resource type',
|
|
584
|
-
defaultMessage: 'Product variant patch'
|
|
585
|
-
},
|
|
586
|
-
'product-variant-patches': {
|
|
587
|
-
id: 'ImportResourcesModal.product-variant-patches',
|
|
588
|
-
description: 'Label for the product-variant-patches resource type',
|
|
589
|
-
defaultMessage: 'Product variant patches'
|
|
590
|
-
},
|
|
591
|
-
'standalone-price': {
|
|
592
|
-
id: 'ImportResourcesModal.standalone-price',
|
|
593
|
-
description: 'Label for the standalone-price resource type',
|
|
594
|
-
defaultMessage: 'Standalone price'
|
|
595
|
-
},
|
|
596
|
-
'standalone-prices': {
|
|
597
|
-
id: 'ImportResourcesModal.standalone-prices',
|
|
598
|
-
description: 'Label for the standalone-prices resource type',
|
|
599
|
-
defaultMessage: 'Standalone prices'
|
|
600
|
-
},
|
|
601
|
-
type: {
|
|
602
|
-
id: 'ImportResourcesModal.type',
|
|
603
|
-
description: 'Label for the type resource type',
|
|
604
|
-
defaultMessage: 'Type'
|
|
605
|
-
},
|
|
606
|
-
types: {
|
|
607
|
-
id: 'ImportResourcesModal.types',
|
|
608
|
-
description: 'Label for the types resource type',
|
|
609
|
-
defaultMessage: 'Types'
|
|
610
|
-
},
|
|
611
|
-
'discount-code': {
|
|
612
|
-
id: 'ImportResourcesModal.discount-code',
|
|
613
|
-
description: 'Label for the discount-code resource type',
|
|
614
|
-
defaultMessage: 'Discount code'
|
|
615
|
-
},
|
|
616
|
-
'discount-codes': {
|
|
617
|
-
id: 'ImportResourcesModal.discount-codes',
|
|
618
|
-
description: 'Label for the discount-codes resource type',
|
|
619
|
-
defaultMessage: 'Discount codes'
|
|
620
|
-
},
|
|
621
|
-
'business-unit': {
|
|
622
|
-
id: 'ImportResourcesModal.business-unit',
|
|
623
|
-
description: 'Label for the business-unit resource type',
|
|
624
|
-
defaultMessage: 'Business unit'
|
|
625
|
-
},
|
|
626
|
-
'business-units': {
|
|
627
|
-
id: 'ImportResourcesModal.business-units',
|
|
628
|
-
description: 'Label for the business-units resource type',
|
|
629
|
-
defaultMessage: 'Business units'
|
|
630
|
-
},
|
|
631
|
-
unknownResourceType: {
|
|
632
|
-
id: 'ImportResourcesModal.unknown-resource-type',
|
|
633
|
-
description: 'Label for the unknown resource type',
|
|
634
|
-
defaultMessage: 'Unknown resource type'
|
|
635
|
-
}
|
|
636
|
-
//
|
|
637
|
-
});
|
|
638
|
-
|
|
639
|
-
function ownKeys$h(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; }
|
|
640
|
-
function _objectSpread$h(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context3 = ownKeys$h(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context4 = ownKeys$h(Object(t))).call(_context4, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
641
|
-
|
|
642
|
-
// Delimiters not included in this array may be treated as part of a column content
|
|
643
|
-
// potentially causing the file to be parsed as a single-column CSV and pass this validation
|
|
644
|
-
const NON_ALLOWED_COLUMN_DELIMITERS = ['%', '.', ' '];
|
|
645
|
-
const DELIMITERS_TO_GUESS = [...COLUMN_DELIMITERS, ...NON_ALLOWED_COLUMN_DELIMITERS];
|
|
646
|
-
const validateDelimiter = file => {
|
|
647
|
-
return new _Promise(resolve => {
|
|
648
|
-
Papa.parse(file, {
|
|
649
|
-
delimitersToGuess: DELIMITERS_TO_GUESS,
|
|
650
|
-
preview: 10,
|
|
651
|
-
complete: result => {
|
|
652
|
-
const headerRow = result.data?.[0];
|
|
653
|
-
const isOnlyOneColumn = _Array$isArray(headerRow) && headerRow.length === 1;
|
|
654
|
-
if (isOnlyOneColumn) {
|
|
655
|
-
resolve(true);
|
|
656
|
-
return;
|
|
657
|
-
}
|
|
658
|
-
const detectedDelimiter = result.meta.delimiter;
|
|
659
|
-
let isValid = false;
|
|
660
|
-
if (detectedDelimiter !== null && _includesInstanceProperty(COLUMN_DELIMITERS).call(COLUMN_DELIMITERS, detectedDelimiter)) {
|
|
661
|
-
var _context;
|
|
662
|
-
const isUndetectableDelimiter = _someInstanceProperty(_context = result.errors).call(_context, error => error.code === 'UndetectableDelimiter');
|
|
663
|
-
if (!isUndetectableDelimiter) {
|
|
664
|
-
isValid = true;
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
resolve(isValid);
|
|
668
|
-
}
|
|
669
|
-
});
|
|
670
|
-
});
|
|
671
|
-
};
|
|
672
|
-
const mapUploadFileErrorsResponseToUploadFileErrorRows = uploadFileErrorsResponse => {
|
|
673
|
-
if (!uploadFileErrorsResponse || !_Array$isArray(uploadFileErrorsResponse)) return [];
|
|
674
|
-
let idCounter = 1;
|
|
675
|
-
return _flatMapInstanceProperty(uploadFileErrorsResponse).call(uploadFileErrorsResponse, rowErrorsResponse => {
|
|
676
|
-
var _context2;
|
|
677
|
-
return _mapInstanceProperty(_context2 = rowErrorsResponse.errors).call(_context2, rowError => ({
|
|
678
|
-
// DataTable component requires unique `id` field
|
|
679
|
-
id: String(idCounter++),
|
|
680
|
-
row: rowErrorsResponse.row,
|
|
681
|
-
field: rowError.field,
|
|
682
|
-
code: rowError.code,
|
|
683
|
-
validationMessage: rowError.message
|
|
684
|
-
}));
|
|
685
|
-
});
|
|
686
|
-
};
|
|
687
|
-
const mapFileUploadErrorsToUploadFileErrorRows = uploadFileErrors => {
|
|
688
|
-
let idCounter = 1;
|
|
689
|
-
return _mapInstanceProperty(uploadFileErrors).call(uploadFileErrors, uploadFileError => _objectSpread$h(_objectSpread$h({}, uploadFileError), {}, {
|
|
690
|
-
id: String(idCounter++)
|
|
691
|
-
}));
|
|
692
|
-
};
|
|
693
|
-
const extractErrorDescriptionFromValidationMessage = message => {
|
|
694
|
-
return message.split('"').pop();
|
|
695
|
-
};
|
|
696
|
-
|
|
697
|
-
/**
|
|
698
|
-
* Returns the number of rows in a CSV file excluding the header
|
|
699
|
-
* @param file The CSV file to process.
|
|
700
|
-
* @returns A promise that resolves to the number of rows
|
|
701
|
-
*/
|
|
702
|
-
const getRowCount = file => {
|
|
703
|
-
return new _Promise(resolve => {
|
|
704
|
-
let lineCount = 0;
|
|
705
|
-
Papa.parse(file, {
|
|
706
|
-
step: _ref => {
|
|
707
|
-
let data = _ref.data;
|
|
708
|
-
// empty lines at the end of the file should not be counted
|
|
709
|
-
if (_Array$isArray(data) && _findInstanceProperty(data).call(data, Boolean)) lineCount++;
|
|
710
|
-
},
|
|
711
|
-
complete: () => {
|
|
712
|
-
// Subtract 1 for the header row
|
|
713
|
-
// We use Math.max to make sure the count is not less than 0, this is needed for empty files
|
|
714
|
-
resolve(Math.max(0, lineCount - 1));
|
|
715
|
-
}
|
|
716
|
-
});
|
|
717
|
-
});
|
|
718
|
-
};
|
|
719
|
-
const toBytes = megabytes => megabytes * 1024 * 1024;
|
|
720
|
-
|
|
721
|
-
/**
|
|
722
|
-
* Returns columns from the provided `columns` excluding those specified in the `ignoredColumns`
|
|
723
|
-
*/
|
|
724
|
-
const getValidatedColumns = (columns, ignoredColumns) => {
|
|
725
|
-
return _filterInstanceProperty(columns).call(columns, column => !_includesInstanceProperty(ignoredColumns).call(ignoredColumns, column));
|
|
726
|
-
};
|
|
727
|
-
const formatAllowedDelimitersForMessageDisplay = intl => {
|
|
728
|
-
const localizedOr = intl.formatMessage(sharedMessages.listConjunctionOr);
|
|
729
|
-
const descriptions = _mapInstanceProperty(COLUMN_DELIMITERS).call(COLUMN_DELIMITERS, delimiter => {
|
|
730
|
-
let nameDescriptor;
|
|
731
|
-
switch (delimiter) {
|
|
732
|
-
case ',':
|
|
733
|
-
nameDescriptor = sharedMessages.delimiterComma;
|
|
734
|
-
break;
|
|
735
|
-
case ';':
|
|
736
|
-
nameDescriptor = sharedMessages.delimiterSemicolon;
|
|
737
|
-
break;
|
|
738
|
-
case '|':
|
|
739
|
-
nameDescriptor = sharedMessages.delimiterPipe;
|
|
740
|
-
break;
|
|
741
|
-
case '\t':
|
|
742
|
-
nameDescriptor = sharedMessages.delimiterTab;
|
|
743
|
-
break;
|
|
744
|
-
default:
|
|
745
|
-
nameDescriptor = undefined;
|
|
746
|
-
}
|
|
747
|
-
const name = nameDescriptor ? intl.formatMessage(nameDescriptor) : delimiter;
|
|
748
|
-
return delimiter === '\t' ? name : `${name} (${delimiter})`;
|
|
749
|
-
});
|
|
750
|
-
if (descriptions.length === 1) {
|
|
751
|
-
return descriptions[0];
|
|
752
|
-
}
|
|
753
|
-
const lastDescription = descriptions.pop();
|
|
754
|
-
return `${descriptions.join(', ')} ${localizedOr} ${lastDescription}`;
|
|
755
|
-
};
|
|
756
|
-
|
|
757
|
-
function getFileUploadErrorsCount(errors) {
|
|
758
|
-
if (!errors || !_Array$isArray(errors)) return 0;
|
|
759
|
-
return _reduceInstanceProperty(errors).call(errors, (acc, curr) => acc += curr.errors.length, 0);
|
|
760
|
-
}
|
|
761
|
-
function convertFileSizeToKB(sizeInBytes) {
|
|
762
|
-
return sizeInBytes / 1000;
|
|
763
|
-
}
|
|
764
|
-
function isAbortError(error) {
|
|
765
|
-
return error instanceof DOMException && error.name === 'AbortError';
|
|
766
|
-
}
|
|
767
|
-
function formatKeys(obj) {
|
|
768
|
-
var _context;
|
|
769
|
-
if (typeof obj !== 'object' || obj === null) return '';
|
|
770
|
-
const keys = _mapInstanceProperty(_context = _Object$keys(obj)).call(_context, key => key.replace(/([a-z])([A-Z])/g, '$1 $2').toLowerCase());
|
|
771
|
-
if (keys.length === 0) return '';
|
|
772
|
-
if (keys.length === 1) return keys[0];
|
|
773
|
-
return `${_sliceInstanceProperty(keys).call(keys, 0, -1).join(', ')} and ${keys[keys.length - 1]}`;
|
|
774
|
-
}
|
|
775
|
-
function formatErrorCode(code) {
|
|
776
|
-
try {
|
|
777
|
-
const formattedCode = code.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/([A-Z])([A-Z][a-z])/g, '$1 $2').toLowerCase();
|
|
778
|
-
let result = formattedCode.charAt(0).toUpperCase() + _sliceInstanceProperty(formattedCode).call(formattedCode, 1);
|
|
779
|
-
return result;
|
|
780
|
-
} catch (error) {
|
|
781
|
-
return code;
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
function resourceTypeToMessage(resourceType) {
|
|
785
|
-
const resourceTypeMap = {
|
|
786
|
-
category: sharedMessages.category,
|
|
787
|
-
product: sharedMessages.product,
|
|
788
|
-
'product-type': sharedMessages['product-type'],
|
|
789
|
-
order: sharedMessages.order,
|
|
790
|
-
customer: sharedMessages.customer,
|
|
791
|
-
'discount-code': sharedMessages['discount-code'],
|
|
792
|
-
inventory: sharedMessages.inventory,
|
|
793
|
-
// TODO: remove `inventory` after aligning the resource type names in the file upload API
|
|
794
|
-
'inventory-entry': sharedMessages.inventory,
|
|
795
|
-
'order-patch': sharedMessages['order-patch'],
|
|
796
|
-
price: sharedMessages.price,
|
|
797
|
-
'product-draft': sharedMessages['product-draft'],
|
|
798
|
-
'product-variant': sharedMessages['product-variant'],
|
|
799
|
-
'product-variant-patch': sharedMessages['product-variant-patch'],
|
|
800
|
-
'standalone-price': sharedMessages['standalone-price'],
|
|
801
|
-
'custom-object': sharedMessages['custom-object'],
|
|
802
|
-
'business-unit': sharedMessages['business-unit'],
|
|
803
|
-
type: sharedMessages.type
|
|
804
|
-
};
|
|
805
|
-
const message = resourceTypeMap[resourceType];
|
|
806
|
-
if (!message) {
|
|
807
|
-
return sharedMessages.unknownResourceType;
|
|
808
|
-
}
|
|
809
|
-
return message;
|
|
810
|
-
}
|
|
811
|
-
function resourceTypeToPluralMessage(resourceType) {
|
|
812
|
-
const resourceTypePluralMap = {
|
|
813
|
-
category: sharedMessages.categories,
|
|
814
|
-
'custom-object': sharedMessages['custom-objects'],
|
|
815
|
-
product: sharedMessages.products,
|
|
816
|
-
'product-type': sharedMessages['product-types'],
|
|
817
|
-
order: sharedMessages.orders,
|
|
818
|
-
customer: sharedMessages.customers,
|
|
819
|
-
'discount-code': sharedMessages['discount-codes'],
|
|
820
|
-
inventory: sharedMessages.inventories,
|
|
821
|
-
// TODO: remove `inventory` after aligning the resource type names in the file upload API
|
|
822
|
-
'inventory-entry': sharedMessages.inventories,
|
|
823
|
-
'order-patch': sharedMessages['order-patches'],
|
|
824
|
-
price: sharedMessages.prices,
|
|
825
|
-
'product-draft': sharedMessages['product-drafts'],
|
|
826
|
-
'product-variant': sharedMessages['product-variants'],
|
|
827
|
-
'product-variant-patch': sharedMessages['product-variant-patches'],
|
|
828
|
-
'standalone-price': sharedMessages['standalone-prices'],
|
|
829
|
-
'business-unit': sharedMessages['business-units']
|
|
830
|
-
};
|
|
831
|
-
const message = resourceTypePluralMap[resourceType];
|
|
832
|
-
if (!message) {
|
|
833
|
-
return sharedMessages.unknownResourceType;
|
|
834
|
-
}
|
|
835
|
-
return message;
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
const encodeFileNameWithTimestampToContainerKey = fileName => {
|
|
839
|
-
return btoa(_JSON$stringify({
|
|
840
|
-
timestamp: new Date().getTime(),
|
|
841
|
-
fileName
|
|
842
|
-
})).replace(/=+$/g, '');
|
|
843
|
-
};
|
|
844
|
-
|
|
845
|
-
function getCreateImportContainerURL(projectKey) {
|
|
846
|
-
return `/${projectKey}/import-containers`;
|
|
847
|
-
}
|
|
848
|
-
function getDeleteImportContainerURL(projectKey, containerKey) {
|
|
849
|
-
return `/${projectKey}/import-containers/${containerKey}`;
|
|
850
|
-
}
|
|
851
|
-
function getFileUploadURL(projectKey, resourceType, containerKey) {
|
|
852
|
-
return `/${projectKey}/${plural(resourceType)}/import-containers/${containerKey}/file-upload`;
|
|
853
|
-
}
|
|
854
|
-
function getProccessFileURL(projectKey, resourceType, containerKey) {
|
|
855
|
-
return `/${projectKey}/${plural(resourceType)}/import-containers/${containerKey}/process-file`;
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
function uploadFileForImport(_ref) {
|
|
859
|
-
let projectKey = _ref.projectKey,
|
|
860
|
-
containerKey = _ref.containerKey,
|
|
861
|
-
resourceType = _ref.resourceType,
|
|
862
|
-
file = _ref.file,
|
|
863
|
-
abortSignal = _ref.abortSignal,
|
|
864
|
-
onSuccess = _ref.onSuccess,
|
|
865
|
-
onProgress = _ref.onProgress,
|
|
866
|
-
onError = _ref.onError;
|
|
867
|
-
const uri = getFileUploadURL(projectKey, resourceType, containerKey);
|
|
868
|
-
const formData = new FormData();
|
|
869
|
-
formData.append('file', file, file.name);
|
|
870
|
-
return fetchUsingXhr({
|
|
871
|
-
url: uri,
|
|
872
|
-
payload: formData,
|
|
873
|
-
config: {
|
|
874
|
-
abortSignal,
|
|
875
|
-
proxy: MC_API_PROXY_TARGETS.IMPORT,
|
|
876
|
-
method: 'POST',
|
|
877
|
-
headers: {
|
|
878
|
-
'Content-Type': null
|
|
879
|
-
}
|
|
880
|
-
},
|
|
881
|
-
onProgress,
|
|
882
|
-
onSuccess,
|
|
883
|
-
onError
|
|
884
|
-
});
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
function ownKeys$g(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; }
|
|
888
|
-
function _objectSpread$g(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys$g(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys$g(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
889
|
-
function createImportContainerForFileUpload(importContainerDraft, projectKey, asyncDispatch) {
|
|
890
|
-
return asyncDispatch(actions.post({
|
|
891
|
-
mcApiProxyTarget: MC_API_PROXY_TARGETS.IMPORT,
|
|
892
|
-
uri: getCreateImportContainerURL(projectKey),
|
|
893
|
-
headers: {
|
|
894
|
-
accept: 'application/json',
|
|
895
|
-
'Content-Type': 'application/json'
|
|
896
|
-
},
|
|
897
|
-
payload: _JSON$stringify(_objectSpread$g({
|
|
898
|
-
retentionPolicy: {
|
|
899
|
-
strategy: 'ttl',
|
|
900
|
-
config: {
|
|
901
|
-
timeToLive: '54h' // 2 days and 6 hours
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
}, importContainerDraft))
|
|
905
|
-
}));
|
|
906
|
-
}
|
|
907
|
-
function deleteImportContainer(projectKey, containerKey, asyncDispatch) {
|
|
908
|
-
return asyncDispatch(actions.del({
|
|
909
|
-
mcApiProxyTarget: MC_API_PROXY_TARGETS.IMPORT,
|
|
910
|
-
uri: getDeleteImportContainerURL(projectKey, containerKey),
|
|
911
|
-
headers: {
|
|
912
|
-
accept: 'application/json'
|
|
913
|
-
}
|
|
914
|
-
}));
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
async function processUploadedFile(_ref) {
|
|
918
|
-
let projectKey = _ref.projectKey,
|
|
919
|
-
containerKey = _ref.containerKey,
|
|
920
|
-
resourceType = _ref.resourceType,
|
|
921
|
-
asyncDispatch = _ref.asyncDispatch;
|
|
922
|
-
const uri = getProccessFileURL(projectKey, resourceType, containerKey);
|
|
923
|
-
const response = await asyncDispatch(actions.post({
|
|
924
|
-
mcApiProxyTarget: MC_API_PROXY_TARGETS.IMPORT,
|
|
925
|
-
uri: uri,
|
|
926
|
-
headers: {
|
|
927
|
-
accept: 'application/json',
|
|
928
|
-
'Content-Type': 'application/json'
|
|
929
|
-
},
|
|
930
|
-
payload: {}
|
|
931
|
-
}));
|
|
932
|
-
assertProcessFileResponse(response);
|
|
933
|
-
return response;
|
|
934
|
-
}
|
|
935
|
-
function assertProcessFileResponse(maybeProcessFileResponse) {
|
|
936
|
-
const requiredFields = ['message'];
|
|
937
|
-
if (hasRequiredFields(maybeProcessFileResponse, requiredFields)) return;
|
|
938
|
-
throw new Error('Invalid response');
|
|
939
|
-
}
|
|
940
|
-
|
|
941
|
-
function ownKeys$f(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; }
|
|
942
|
-
function _objectSpread$f(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$f(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$f(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
943
|
-
const ImportResourcesContext = /*#__PURE__*/React.createContext();
|
|
944
|
-
const ImportResourcesProvider = props => {
|
|
945
|
-
const _useApplicationContex = useApplicationContext(context => ({
|
|
946
|
-
projectKey: context.project?.key
|
|
947
|
-
})),
|
|
948
|
-
projectKey = _useApplicationContex.projectKey;
|
|
949
|
-
const asyncDispatch = useAsyncDispatch();
|
|
950
|
-
const _React$useReducer = React.useReducer(reducer, _objectSpread$f(_objectSpread$f({}, initialState), {}, {
|
|
951
|
-
resourceType: props.resourceTypes[0]
|
|
952
|
-
})),
|
|
953
|
-
_React$useReducer2 = _slicedToArray(_React$useReducer, 2),
|
|
954
|
-
state = _React$useReducer2[0],
|
|
955
|
-
dispatch = _React$useReducer2[1];
|
|
956
|
-
const setCurrentStep = currentStep => dispatch({
|
|
957
|
-
type: 'setCurrentStep',
|
|
958
|
-
currentStep
|
|
959
|
-
});
|
|
960
|
-
const setUploadFileResponse = uploadFileResponse => dispatch({
|
|
961
|
-
type: 'setUploadFileResponse',
|
|
962
|
-
uploadFileResponse: uploadFileResponse
|
|
963
|
-
});
|
|
964
|
-
const setResourceType = resourceType => dispatch({
|
|
965
|
-
type: 'setResourceType',
|
|
966
|
-
resourceType: resourceType
|
|
967
|
-
});
|
|
968
|
-
const setContainerKey = containerKey => dispatch({
|
|
969
|
-
type: 'setContainerKey',
|
|
970
|
-
containerKey
|
|
971
|
-
});
|
|
972
|
-
const cancelImport = () => dispatch({
|
|
973
|
-
type: 'cancelImport'
|
|
974
|
-
});
|
|
975
|
-
const uploadNewFile = () => dispatch({
|
|
976
|
-
type: 'uploadNewFile'
|
|
977
|
-
});
|
|
978
|
-
const setDroppedFile = droppedFile => dispatch({
|
|
979
|
-
type: 'setDroppedFile',
|
|
980
|
-
droppedFile: droppedFile
|
|
981
|
-
});
|
|
982
|
-
const setAbortController = abortController => dispatch({
|
|
983
|
-
type: 'setAbortController',
|
|
984
|
-
abortController: abortController
|
|
985
|
-
});
|
|
986
|
-
const setFileUploadErrors = fileUploadErrors => dispatch({
|
|
987
|
-
type: 'setFileUploadErrors',
|
|
988
|
-
fileUploadErrors: fileUploadErrors
|
|
989
|
-
});
|
|
990
|
-
const setProgress = progress => dispatch({
|
|
991
|
-
type: 'setProgress',
|
|
992
|
-
progress
|
|
993
|
-
});
|
|
994
|
-
const setUploadSettings = nextSettings => {
|
|
995
|
-
dispatch({
|
|
996
|
-
type: 'setUploadSettings',
|
|
997
|
-
settings: nextSettings
|
|
998
|
-
});
|
|
999
|
-
};
|
|
1000
|
-
const handleClose = function () {
|
|
1001
|
-
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1002
|
-
shouldDeleteImportContainer = _ref.shouldDeleteImportContainer;
|
|
1003
|
-
if (state.abortController) state.abortController.abort();
|
|
1004
|
-
if (typeof props.onClose === 'function') props.onClose();
|
|
1005
|
-
// Removes the associated import container when the import is closed
|
|
1006
|
-
if (shouldDeleteImportContainer && projectKey && state.containerKey) deleteImportContainer(projectKey, state.containerKey, asyncDispatch);
|
|
1007
|
-
};
|
|
1008
|
-
const handleStartImportSuccess = () => {
|
|
1009
|
-
if (typeof props.onStartImportSuccess === 'function') props.onStartImportSuccess();
|
|
1010
|
-
};
|
|
1011
|
-
return jsx(ImportResourcesContext.Provider, {
|
|
1012
|
-
value: {
|
|
1013
|
-
state,
|
|
1014
|
-
resourceTypes: props.resourceTypes,
|
|
1015
|
-
onClose: handleClose,
|
|
1016
|
-
onStartImportSuccess: handleStartImportSuccess,
|
|
1017
|
-
actions: {
|
|
1018
|
-
setCurrentStep,
|
|
1019
|
-
cancelImport,
|
|
1020
|
-
uploadNewFile,
|
|
1021
|
-
setUploadFileResponse,
|
|
1022
|
-
setResourceType,
|
|
1023
|
-
setDroppedFile,
|
|
1024
|
-
setContainerKey,
|
|
1025
|
-
setAbortController,
|
|
1026
|
-
setFileUploadErrors,
|
|
1027
|
-
setProgress,
|
|
1028
|
-
setUploadSettings
|
|
1029
|
-
}
|
|
1030
|
-
},
|
|
1031
|
-
children: props.children
|
|
1032
|
-
});
|
|
1033
|
-
};
|
|
1034
|
-
|
|
1035
|
-
const getBorderColor = state => {
|
|
1036
|
-
const borderColors = {
|
|
1037
|
-
default: '#909dbc',
|
|
1038
|
-
error: '#e60050',
|
|
1039
|
-
active: customProperties.colorPrimary
|
|
1040
|
-
};
|
|
1041
|
-
return borderColors[state] || borderColors.default;
|
|
1042
|
-
};
|
|
1043
|
-
const getDashedBorder = function () {
|
|
1044
|
-
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
|
|
1045
|
-
const color = getBorderColor(state);
|
|
1046
|
-
const svgContent = `
|
|
1047
|
-
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
|
|
1048
|
-
<rect width="100%" height="100%" fill="none" stroke="${color}" stroke-width="2px" stroke-dasharray="6,6" stroke-dashoffset="0" stroke-linecap="square"/>
|
|
1049
|
-
</svg>
|
|
1050
|
-
`;
|
|
1051
|
-
return `data:image/svg+xml,${encodeURIComponent(svgContent)}`;
|
|
1052
|
-
};
|
|
1053
|
-
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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUF5QmdCIiwiZmlsZSI6InN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGN1c3RvbVByb3BlcnRpZXMgfSBmcm9tICdAY29tbWVyY2V0b29scy1mcm9udGVuZC91aS1raXQ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JvcHBlZCxcbiAgZGlzYWJsZWQsXG4gIGFjdGl2ZURyYWcsXG59XG4iXX0= */");
|
|
1054
|
-
const disabled = /*#__PURE__*/css(process.env.NODE_ENV === "production" ? "" : ";label:disabled;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFnQ29CIiwiZmlsZSI6InN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGN1c3RvbVByb3BlcnRpZXMgfSBmcm9tICdAY29tbWVyY2V0b29scy1mcm9udGVuZC91aS1raXQnXG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCdcblxudHlwZSBEcm9wQXJlYVN0YXRlID0gJ2RlZmF1bHQnIHwgJ2Vycm9yJyB8ICdhY3RpdmUnXG5cbmNvbnN0IGdldEJvcmRlckNvbG9yID0gKHN0YXRlOiBEcm9wQXJlYVN0YXRlKSA9PiB7XG4gIGNvbnN0IGJvcmRlckNvbG9ycyA9IHtcbiAgICBkZWZhdWx0OiAnIzkwOWRiYycsXG4gICAgZXJyb3I6ICcjZTYwMDUwJyxcbiAgICBhY3RpdmU6IGN1c3RvbVByb3BlcnRpZXMuY29sb3JQcmltYXJ5LFxuICB9XG5cbiAgcmV0dXJuIGJvcmRlckNvbG9yc1tzdGF0ZV0gfHwgYm9yZGVyQ29sb3JzLmRlZmF1bHRcbn1cblxuY29uc3QgZ2V0RGFzaGVkQm9yZGVyID0gKHN0YXRlOiBEcm9wQXJlYVN0YXRlID0gJ2RlZmF1bHQnKSA9PiB7XG4gIGNvbnN0IGNvbG9yID0gZ2V0Qm9yZGVyQ29sb3Ioc3RhdGUpXG4gIGNvbnN0IHN2Z0NvbnRlbnQgPSBgXG4gICAgPHN2ZyB3aWR0aD1cIjEwMCVcIiBoZWlnaHQ9X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kaW5nOiAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZzUwfSAxMDBweDtcbmBcbmNvbnN0IGZpbGVEcm9wcGVkID0gY3NzYFxuICBiYWNrZ3JvdW5kLWltYWdlOiB1cmwoXFxcIiR7Z2V0RGFzaGVkQm9yZGVyKCl9XFxcIik7XG4gIGJhY2tncm91bmQtY29sb3I6ICR7Y3VzdG9tUHJvcGVydGllcy5jb2xvclN1cmZhY2V9O1xuICBwYWRkaW5nOiAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZzUwfSAxMDBweDtcbmBcblxuZXhwb3J0IGNvbnN0IHN0eWxlcyA9IHtcbiAgYmFzZSxcbiAgcmVhZHlGb3JEcm9wLFxuICBmaWxlRHJvcHBlZCxcbiAgZGlzYWJsZWQsXG4gIGFjdGl2ZURyYWcsXG59XG4iXX0= */");
|
|
1055
|
-
const readyForDrop = /*#__PURE__*/css("background-image:url(\"", getDashedBorder(), "\");background-color:", customProperties.colorSurface, ";" + (process.env.NODE_ENV === "production" ? "" : ";label:readyForDrop;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFpQ3dCIiwiZmlsZSI6InN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGN1c3RvbVByb3BlcnRpZXMgfSBmcm9tICdAY29tbWVyY2V0b29scy1mcm9udGVuZC91aS1raXQnXG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCdcblxudHlwZSBEcm9wQXJlYVN0YXRlID0gJ2RlZmF1bHQnIHwgJ2Vycm9yJyB8ICdhY3RpdmUnXG5cbmNvbnN0IGdldEJvcmRlckNvbG9yID0gKHN0YXRlOiBEcm9wQXJlYVN0YXRlKSA9PiB7XG4gIGNvbnN0IGJvcmRlckNvbG9yc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lbXM6IGNlbnRlcjtcbmBcbmNvbnN0IGRpc2FibGVkID0gY3NzYGBcbmNvbnN0IHJlYWR5Rm9yRHJvcCA9IGNzc2BcbiAgYmFja2dyb3VuZC1pbWFnZTogdXJsKFxcXCIke2dldERhc2hlZEJvcmRlcigpfVxcXCIpO1xuICBiYWNrZ3JvdW5kLWNvbG9yOiAke2N1c3RvbVByb3BlcnRpZXMuY29sb3JTdXJmYWNlfTtcbmBcbmNvbnN0IGFjdGl2ZURyYWcgPSBjc3NgXG4gIGJhY2tncm91bmQtaW1hZ2U6IHVybChcXFwiJHtnZXREYXNoZWRCb3JkZXIoJ2FjdGl2ZScpfVxcXCIpO1xuICBiYWNrZ3JvdW5kLWNvbG9yOiAke2N1c3RvbVByb3BlcnRpZXMuY29sb3JQcmltYXJ5OTV9O1xuICBwYWRkaW5nOiAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZzUwfSAxMDBweDtcbmBcbmNvbnN0IGZpbGVEcm9wcGVkID0gY3NzYFxuICBiYWNrZ3JvdW5kLWltYWdlOiB1cmwoXFxcIiR7Z2V0RGFzaGVkQm9yZGVyKCl9XFxcIik7XG4gIGJhY2tncm91bmQtY29sb3I6ICR7Y3VzdG9tUHJvcGVydGllcy5jb2xvclN1cmZhY2V9O1xuICBwYWRkaW5nOiAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZzUwfSAxMDBweDtcbmBcblxuZXhwb3J0IGNvbnN0IHN0eWxlcyA9IHtcbiAgYmFzZSxcbiAgcmVhZHlGb3JEcm9wLFxuICBmaWxlRHJvcHBlZCxcbiAgZGlzYWJsZWQsXG4gIGFjdGl2ZURyYWcsXG59XG4iXX0= */");
|
|
1056
|
-
const activeDrag = /*#__PURE__*/css("background-image:url(\"", getDashedBorder('active'), "\");background-color:", customProperties.colorPrimary95, ";padding:", customProperties.spacing50, " 100px;" + (process.env.NODE_ENV === "production" ? "" : ";label:activeDrag;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=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GVyKCl9XFxcIik7XG4gIGJhY2tncm91bmQtY29sb3I6ICR7Y3VzdG9tUHJvcGVydGllcy5jb2xvclN1cmZhY2V9O1xuICBwYWRkaW5nOiAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZzUwfSAxMDBweDtcbmBcblxuZXhwb3J0IGNvbnN0IHN0eWxlcyA9IHtcbiAgYmFzZSxcbiAgcmVhZHlGb3JEcm9wLFxuICBmaWxlRHJvcHBlZCxcbiAgZGlzYWJsZWQsXG4gIGFjdGl2ZURyYWcsXG59XG4iXX0= */");
|
|
1057
|
-
const fileDropped = /*#__PURE__*/css("background-image:url(\"", getDashedBorder(), "\");background-color:", customProperties.colorSurface, ";padding:", customProperties.spacing50, " 100px;" + (process.env.NODE_ENV === "production" ? "" : ";label:fileDropped;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUEwQ3VCIiwiZmlsZSI6InN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGN1c3RvbVByb3BlcnRpZXMgfSBmcm9tICdAY29tbWVyY2V0b29scy1mcm9udGVuZC91aS1raXQnXG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCdcblxudHlwZSBEcm9wQXJlYVN0YXRlID0gJ2RlZmF1bHQnIHwgJ2Vycm9yJyB8ICdhY3RpdmUnXG5cbmNvbnN0IGdldEJvcmRlckNvbG9yID0gKHN0YXRlOiBEcm9wQXJlYVN0YXRlKSA9PiB7XG4gIGNvbnN0IGJvcmRlckNvbG9ycyA9IHtcbiAgICBkZWZhdWx0OiAnIzkwOWRiYycsXG4gICAgZXJyb3I6ICcjZTYwMDUwJyxcbiAgICBhY3RpdmU6IGN1c3RvbVByb3BlcnRpZXMuY29sb3JQcmltYXJ5LFxuICB9XG5c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2hlZEJvcmRlcigpfVxcXCIpO1xuICBiYWNrZ3JvdW5kLWNvbG9yOiAke2N1c3RvbVByb3BlcnRpZXMuY29sb3JTdXJmYWNlfTtcbmBcbmNvbnN0IGFjdGl2ZURyYWcgPSBjc3NgXG4gIGJhY2tncm91bmQtaW1hZ2U6IHVybChcXFwiJHtnZXREYXNoZWRCb3JkZXIoJ2FjdGl2ZScpfVxcXCIpO1xuICBiYWNrZ3JvdW5kLWNvbG9yOiAke2N1c3RvbVByb3BlcnRpZXMuY29sb3JQcmltYXJ5OTV9O1xuICBwYWRkaW5nOiAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZzUwfSAxMDBweDtcbmBcbmNvbnN0IGZpbGVEcm9wcGVkID0gY3NzYFxuICBiYWNrZ3JvdW5kLWltYWdlOiB1cmwoXFxcIiR7Z2V0RGFzaGVkQm9yZGVyKCl9XFxcIik7XG4gIGJhY2tncm91bmQtY29sb3I6ICR7Y3VzdG9tUHJvcGVydGllcy5jb2xvclN1cmZhY2V9O1xuICBwYWRkaW5nOiAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZzUwfSAxMDBweDtcbmBcblxuZXhwb3J0IGNvbnN0IHN0eWxlcyA9IHtcbiAgYmFzZSxcbiAgcmVhZHlGb3JEcm9wLFxuICBmaWxlRHJvcHBlZCxcbiAgZGlzYWJsZWQsXG4gIGFjdGl2ZURyYWcsXG59XG4iXX0= */");
|
|
1058
|
-
const styles = {
|
|
1059
|
-
base,
|
|
1060
|
-
readyForDrop,
|
|
1061
|
-
fileDropped,
|
|
1062
|
-
disabled,
|
|
1063
|
-
activeDrag
|
|
1064
|
-
};
|
|
1065
|
-
|
|
1066
|
-
const DropWrapper = /*#__PURE__*/_styled("div", process.env.NODE_ENV === "production" ? {
|
|
1067
|
-
target: "ef0z5en0"
|
|
1068
|
-
} : {
|
|
1069
|
-
target: "ef0z5en0",
|
|
1070
|
-
label: "DropWrapper"
|
|
1071
|
-
})(styles.base, " ", props => {
|
|
1072
|
-
if (props.dropAreaState === 'disabled') {
|
|
1073
|
-
return styles.disabled;
|
|
1074
|
-
}
|
|
1075
|
-
if (props.dropAreaState === 'ready-for-drop') {
|
|
1076
|
-
return styles.readyForDrop;
|
|
1077
|
-
}
|
|
1078
|
-
if (props.dropAreaState === 'active-drag') {
|
|
1079
|
-
return styles.activeDrag;
|
|
1080
|
-
}
|
|
1081
|
-
if (props.dropAreaState === 'file-dropped') {
|
|
1082
|
-
return styles.fileDropped;
|
|
1083
|
-
}
|
|
1084
|
-
return getDefaultDropWrapperStyles(props.dropAreaState);
|
|
1085
|
-
}, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRyb3AtYXJlYS13cmFwcGVyLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFTdUQiLCJmaWxlIjoiZHJvcC1hcmVhLXdyYXBwZXIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgdHlwZSBEcm9wem9uZVJvb3RQcm9wcyB9IGZyb20gJ3JlYWN0LWRyb3B6b25lJ1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCdcbmltcG9ydCB7IHN0eWxlcyB9IGZyb20gJy4vc3R5bGVzJ1xuaW1wb3J0IHsgdHlwZSBEcm9wQXJlYVN0YXRlIH0gZnJvbSAnLi4vLi4vLi4vQHR5cGVzJ1xuXG5pbnRlcmZhY2UgRHJvcFdyYXBwZXJQcm9wcyBleHRlbmRzIERyb3B6b25lUm9vdFByb3BzIHtcbiAgZHJvcEFyZWFTdGF0ZTogRHJvcEFyZWFTdGF0ZVxufVxuZXhwb3J0IGNvbnN0IERyb3BXcmFwcGVyID0gc3R5bGVkLmRpdjxEcm9wV3JhcHBlclByb3BzPmBcbiAgJHtzdHlsZXMuYmFzZX1cbiAgJHsocHJvcHMpID0+IHtcbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ2Rpc2FibGVkJykge1xuICAgICAgcmV0dXJuIHN0eWxlcy5kaXNhYmxlZFxuICAgIH1cbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ3JlYWR5LWZvci1kcm9wJykge1xuICAgICAgcmV0dXJuIHN0eWxlcy5yZWFkeUZvckRyb3BcbiAgICB9XG4gICAgaWYgKHByb3BzLmRyb3BBcmVhU3RhdGUgPT09ICdhY3RpdmUtZHJhZycpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuYWN0aXZlRHJhZ1xuICAgIH1cbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ2ZpbGUtZHJvcHBlZCcpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuZmlsZURyb3BwZWRcbiAgICB9XG4gICAgcmV0dXJuIGdldERlZmF1bHREcm9wV3JhcHBlclN0eWxlcyhwcm9wcy5kcm9wQXJlYVN0YXRlKVxuICB9fVxuYFxuZnVuY3Rpb24gZ2V0RGVmYXVsdERyb3BXcmFwcGVyU3R5bGVzKF9kcm9wQXJlYVN0YXRlOiBuZXZlcikge1xuICByZXR1cm4gY3NzYGBcbn1cbiJdfQ== */"));
|
|
1086
|
-
function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
1087
|
-
return /*#__PURE__*/css(process.env.NODE_ENV === "production" ? "" : ";label:getDefaultDropWrapperStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRyb3AtYXJlYS13cmFwcGVyLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE0QlkiLCJmaWxlIjoiZHJvcC1hcmVhLXdyYXBwZXIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3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xlcyhwcm9wcy5kcm9wQXJlYVN0YXRlKVxuICB9fVxuYFxuZnVuY3Rpb24gZ2V0RGVmYXVsdERyb3BXcmFwcGVyU3R5bGVzKF9kcm9wQXJlYVN0YXRlOiBuZXZlcikge1xuICByZXR1cm4gY3NzYGBcbn1cbiJdfQ== */");
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1090
|
-
var ActiveDragDropArea = /*#__PURE__*/lazy(() => import('./active-drag-drop-area-3ad5dd22.esm.js'));
|
|
1091
|
-
|
|
1092
|
-
var DisabledDropArea = /*#__PURE__*/lazy(() => import('./disabled-drop-area-d068b119.esm.js'));
|
|
1093
|
-
|
|
1094
|
-
var EnabledDropArea = /*#__PURE__*/lazy(() => import('./enabled-drop-area-d5d394ff.esm.js'));
|
|
1095
|
-
|
|
1096
|
-
var FileDropped = /*#__PURE__*/lazy(() => import('./file-dropped-area-b64c266f.esm.js'));
|
|
1097
|
-
|
|
1098
|
-
function getDropArea(_ref) {
|
|
1099
|
-
let dropAreaState = _ref.dropAreaState,
|
|
1100
|
-
resourceType = _ref.resourceType,
|
|
1101
|
-
isFileDropped = _ref.isFileDropped;
|
|
1102
|
-
if (dropAreaState === 'file-dropped') {
|
|
1103
|
-
return jsx(FileDropped, {});
|
|
1104
|
-
}
|
|
1105
|
-
if (dropAreaState === 'disabled' || !resourceType) {
|
|
1106
|
-
return jsx(DisabledDropArea, {});
|
|
1107
|
-
}
|
|
1108
|
-
if (dropAreaState === 'ready-for-drop') {
|
|
1109
|
-
return jsx(EnabledDropArea, {});
|
|
1110
|
-
}
|
|
1111
|
-
if (dropAreaState === 'active-drag') {
|
|
1112
|
-
return jsx(ActiveDragDropArea, {
|
|
1113
|
-
isFileDropped: isFileDropped
|
|
1114
|
-
});
|
|
1115
|
-
}
|
|
1116
|
-
return fallbackDropArea();
|
|
1117
|
-
}
|
|
1118
|
-
function fallbackDropArea(_invalidDropAreaState) {
|
|
1119
|
-
return jsx(DisabledDropArea, {});
|
|
1120
|
-
}
|
|
1121
|
-
function getDropAreaState(flags) {
|
|
1122
|
-
if (flags.isDragActive) {
|
|
1123
|
-
return 'active-drag';
|
|
1124
|
-
}
|
|
1125
|
-
if (flags.hasResourceType) {
|
|
1126
|
-
return 'disabled';
|
|
1127
|
-
}
|
|
1128
|
-
if (flags.isReady) {
|
|
1129
|
-
return 'file-dropped';
|
|
1130
|
-
}
|
|
1131
|
-
return 'ready-for-drop';
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
var messages$8 = defineMessages({
|
|
1135
|
-
dragAndDropCSV: {
|
|
1136
|
-
id: 'ImportResourcesModal.dragAndDropCSV',
|
|
1137
|
-
description: 'The message telling the user to drag and drop CSV file in the file drop area',
|
|
1138
|
-
defaultMessage: 'Drag and drop CSV'
|
|
1139
|
-
},
|
|
1140
|
-
or: {
|
|
1141
|
-
id: 'ImportResourcesModal.or',
|
|
1142
|
-
description: 'The word "or" in the drag and drop message',
|
|
1143
|
-
defaultMessage: 'or'
|
|
1144
|
-
},
|
|
1145
|
-
browseButton: {
|
|
1146
|
-
id: 'ImportResourcesModal.browseFile',
|
|
1147
|
-
defaultMessage: 'Browse file'
|
|
1148
|
-
},
|
|
1149
|
-
uploadFile: {
|
|
1150
|
-
id: 'ImportResourcesModal.uploadFile',
|
|
1151
|
-
description: 'Label for a button on the file upload page, shown on active drop area state',
|
|
1152
|
-
defaultMessage: 'Upload file'
|
|
1153
|
-
},
|
|
1154
|
-
chooseFile: {
|
|
1155
|
-
id: 'ImportResourcesModal.chooseFile',
|
|
1156
|
-
description: 'Label for a button on the file upload page, shown on ready to upload state',
|
|
1157
|
-
defaultMessage: 'Choose file'
|
|
1158
|
-
},
|
|
1159
|
-
fileUploadFailed: {
|
|
1160
|
-
id: 'ImportResourcesModal.fileUploadFailed',
|
|
1161
|
-
description: 'A title on the file upload page, shown on file upload error state',
|
|
1162
|
-
defaultMessage: 'File upload failed'
|
|
1163
|
-
},
|
|
1164
|
-
fileFormatNotSupported: {
|
|
1165
|
-
id: 'ImportResourcesModal.fileFormatNotSupported',
|
|
1166
|
-
description: 'Error message displayed when a user drags and drops a non-CSV file',
|
|
1167
|
-
defaultMessage: 'Invalid file format: The file is not in CSV format and cannot be processed.'
|
|
1168
|
-
},
|
|
1169
|
-
tooManyFilesError: {
|
|
1170
|
-
id: 'ImportResourcesModal.tooManyFilesError',
|
|
1171
|
-
description: 'Error message displayed when a user drags and drops multiple files at once',
|
|
1172
|
-
defaultMessage: 'Multiple files detected: You can only drag and drop one file at a time.'
|
|
1173
|
-
},
|
|
1174
|
-
genericError: {
|
|
1175
|
-
id: 'ImportResourcesModal.genericError',
|
|
1176
|
-
description: 'Default error message for unexpected file upload issues (for unhandled cases)',
|
|
1177
|
-
defaultMessage: 'Error occurred: Please try uploading the file again or contact our support team for assistance.'
|
|
1178
|
-
},
|
|
1179
|
-
dataType: {
|
|
1180
|
-
id: 'ImportResourcesModal.dataType',
|
|
1181
|
-
description: 'Label for the data type selection dropdown',
|
|
1182
|
-
defaultMessage: 'Data type'
|
|
1183
|
-
},
|
|
1184
|
-
instructions: {
|
|
1185
|
-
id: 'ImportResourcesModal.instructions',
|
|
1186
|
-
description: 'Label for the instructions section',
|
|
1187
|
-
defaultMessage: 'Instructions'
|
|
1188
|
-
}
|
|
1189
|
-
});
|
|
1190
|
-
|
|
1191
|
-
function useImportResourcesContext() {
|
|
1192
|
-
const context = useContext(ImportResourcesContext);
|
|
1193
|
-
if (!context) {
|
|
1194
|
-
throw new MissingImportResourceProviderError();
|
|
1195
|
-
}
|
|
1196
|
-
return context;
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
|
-
var messages$7 = defineMessages({
|
|
1200
|
-
fileSizeExceededTitle: {
|
|
1201
|
-
id: 'ImportResourcesModal.sizeExceededTitle',
|
|
1202
|
-
defaultMessage: 'File size exceeded'
|
|
1203
|
-
},
|
|
1204
|
-
fileSizeExceededDescription: {
|
|
1205
|
-
id: 'ImportResourcesModal.sizeExceededDescription',
|
|
1206
|
-
description: 'Error description when the file size exceeds the allowable limit',
|
|
1207
|
-
defaultMessage: 'The file exceeds the maximum allowed size of {fileSizeLimit} MB'
|
|
1208
|
-
},
|
|
1209
|
-
rowLimitExceededTitle: {
|
|
1210
|
-
id: 'ImportResourcesModal.rowLimitExceededTitle',
|
|
1211
|
-
defaultMessage: 'Row limit exceeded'
|
|
1212
|
-
},
|
|
1213
|
-
rowLimitExceededDescription: {
|
|
1214
|
-
id: 'ImportResourcesModal.rowLimitExceededDescription',
|
|
1215
|
-
description: 'Error description when the file contains more rows than the allowable maximum',
|
|
1216
|
-
defaultMessage: 'The file contains more than the allowable maximum of {rowLimit} rows'
|
|
1217
|
-
},
|
|
1218
|
-
wrongSeparatorTitle: {
|
|
1219
|
-
id: 'ImportResourcesModal.wrongSeparatorTitle',
|
|
1220
|
-
defaultMessage: 'Wrong separator'
|
|
1221
|
-
},
|
|
1222
|
-
wrongSeparatorDescription: {
|
|
1223
|
-
id: 'ImportResourcesModal.wrongSeparatorDescription',
|
|
1224
|
-
description: 'Message within the drop area when a CSV file uses an unexpected separator',
|
|
1225
|
-
defaultMessage: 'The file is using an unsupported separator. Please use one of the allowed separators: {delimiterList}.'
|
|
1226
|
-
},
|
|
1227
|
-
dropAreaNotEnoughRowsTitle: {
|
|
1228
|
-
id: 'ImportResourcesModal.dropAreaNotEnoughRowsTitle',
|
|
1229
|
-
description: 'Error title shown when the uploaded CSV file does not contain a header and at least one row of data',
|
|
1230
|
-
defaultMessage: 'Invalid CSV file'
|
|
1231
|
-
},
|
|
1232
|
-
dropAreaNotEnoughRowsDescription: {
|
|
1233
|
-
id: 'ImportResourcesModal.dropAreaNotEnoughRowsDescription',
|
|
1234
|
-
description: 'Error description shown when the uploaded CSV file does not contain a header and at least one row of data',
|
|
1235
|
-
defaultMessage: 'Make sure the file contains a header and at least one row of data'
|
|
1236
|
-
},
|
|
1237
|
-
unexpectedError: {
|
|
1238
|
-
id: 'ImportResourcesModal.unexpectedError',
|
|
1239
|
-
description: 'Generic notification message when file upload fails',
|
|
1240
|
-
defaultMessage: 'An unexpected error occurred during the file upload. Please try again, or contact support if this error occurs again.'
|
|
1241
|
-
},
|
|
1242
|
-
missingRequiredField: {
|
|
1243
|
-
id: 'ImportResourcesModal.missingRequiredField',
|
|
1244
|
-
description: 'Error message displayed when a required field is missing',
|
|
1245
|
-
defaultMessage: 'Missing required field'
|
|
1246
|
-
},
|
|
1247
|
-
missingKeyError: {
|
|
1248
|
-
id: 'ImportResourcesModal.missingKeyError',
|
|
1249
|
-
description: 'Error message displayed when the uploaded file is missing the key field',
|
|
1250
|
-
defaultMessage: "The 'key' field is missing or incomplete in some rows. Please ensure every row has a 'key' value."
|
|
1251
|
-
},
|
|
1252
|
-
missingRequiredKeys: {
|
|
1253
|
-
id: 'ImportResourcesModal.missingRequiredKeys',
|
|
1254
|
-
description: 'Error message displayed when the uploaded file is missing required keys',
|
|
1255
|
-
defaultMessage: 'Make sure the file contains required keys for the elements including {fieldNames}'
|
|
1256
|
-
}
|
|
1257
|
-
});
|
|
1258
|
-
|
|
1259
|
-
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; }
|
|
1260
|
-
function _objectSpread$e(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$e(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$e(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1261
|
-
const useUpload = () => {
|
|
1262
|
-
const intl = useIntl();
|
|
1263
|
-
const projectKey = useApplicationContext(context => context.project?.key);
|
|
1264
|
-
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1265
|
-
state = _useImportResourcesCo.state,
|
|
1266
|
-
actions = _useImportResourcesCo.actions;
|
|
1267
|
-
const asyncDispatch = useAsyncDispatch();
|
|
1268
|
-
const showNotification = useShowNotification();
|
|
1269
|
-
React.useEffect(() => {
|
|
1270
|
-
return () => {
|
|
1271
|
-
if (state.abortController) state.abortController.abort();
|
|
1272
|
-
};
|
|
1273
|
-
}, [state.abortController]);
|
|
1274
|
-
const isFileValid = async file => {
|
|
1275
|
-
const errors = [];
|
|
1276
|
-
const isDelimiterValid = await validateDelimiter(file);
|
|
1277
|
-
if (!isDelimiterValid) errors.push({
|
|
1278
|
-
title: intl.formatMessage(messages$7.wrongSeparatorTitle),
|
|
1279
|
-
description: intl.formatMessage(messages$7.wrongSeparatorDescription, {
|
|
1280
|
-
delimiterList: formatAllowedDelimitersForMessageDisplay(intl)
|
|
1281
|
-
})
|
|
1282
|
-
});
|
|
1283
|
-
const rowCount = await getRowCount(file);
|
|
1284
|
-
if (rowCount < 1) errors.push({
|
|
1285
|
-
title: intl.formatMessage(messages$7.dropAreaNotEnoughRowsTitle),
|
|
1286
|
-
description: intl.formatMessage(messages$7.dropAreaNotEnoughRowsDescription)
|
|
1287
|
-
});
|
|
1288
|
-
if (state.resourceType && file.size > toBytes(FILE_SIZE_LIMITS_MB[state.resourceType])) errors.push({
|
|
1289
|
-
title: intl.formatMessage(messages$7.fileSizeExceededTitle),
|
|
1290
|
-
description: intl.formatMessage(messages$7.fileSizeExceededDescription, {
|
|
1291
|
-
fileSizeLimit: intl.formatNumber(FILE_SIZE_LIMITS_MB[state.resourceType])
|
|
1292
|
-
})
|
|
1293
|
-
});
|
|
1294
|
-
if (state.resourceType && rowCount > ROW_LIMITS[state.resourceType]) errors.push({
|
|
1295
|
-
title: intl.formatMessage(messages$7.rowLimitExceededTitle),
|
|
1296
|
-
description: intl.formatMessage(messages$7.rowLimitExceededDescription, {
|
|
1297
|
-
rowLimit: intl.formatNumber(ROW_LIMITS[state.resourceType])
|
|
1298
|
-
})
|
|
1299
|
-
});
|
|
1300
|
-
if (errors.length > 0) {
|
|
1301
|
-
actions.setFileUploadErrors(errors);
|
|
1302
|
-
actions.setCurrentStep(CurrentStep$1.UploadResult);
|
|
1303
|
-
return false;
|
|
1304
|
-
}
|
|
1305
|
-
return true;
|
|
1306
|
-
};
|
|
1307
|
-
const handleUploadError = error => {
|
|
1308
|
-
if (isAbortError(error)) {
|
|
1309
|
-
actions.cancelImport();
|
|
1310
|
-
return;
|
|
1311
|
-
}
|
|
1312
|
-
if (error instanceof HttpError) {
|
|
1313
|
-
if (error.errorData?.code === 'MISSING_KEY_ERROR') {
|
|
1314
|
-
actions.setFileUploadErrors([{
|
|
1315
|
-
title: intl.formatMessage(messages$7.missingRequiredField),
|
|
1316
|
-
description: intl.formatMessage(messages$7.missingKeyError)
|
|
1317
|
-
}]);
|
|
1318
|
-
actions.setCurrentStep(CurrentStep$1.UploadResult);
|
|
1319
|
-
} else if (error.errorData?.code === 'MissingCsvFieldIdentifier') {
|
|
1320
|
-
const MissingCsvFieldIdentifierError = error.errorData;
|
|
1321
|
-
const fieldNames = formatKeys(MissingCsvFieldIdentifierError.rowValue);
|
|
1322
|
-
actions.setFileUploadErrors([{
|
|
1323
|
-
title: intl.formatMessage(messages$7.missingRequiredField),
|
|
1324
|
-
description: intl.formatMessage(messages$7.missingRequiredKeys, {
|
|
1325
|
-
fieldNames
|
|
1326
|
-
})
|
|
1327
|
-
}]);
|
|
1328
|
-
actions.setCurrentStep(CurrentStep$1.UploadResult);
|
|
1329
|
-
} else if (error.errorData?.invalid > 0) {
|
|
1330
|
-
actions.setUploadFileResponse(error.errorData);
|
|
1331
|
-
actions.setCurrentStep(CurrentStep$1.UploadResult);
|
|
1332
|
-
} else {
|
|
1333
|
-
actions.cancelImport();
|
|
1334
|
-
showNotification({
|
|
1335
|
-
kind: 'error',
|
|
1336
|
-
domain: DOMAINS.PAGE,
|
|
1337
|
-
text: intl.formatMessage(messages$7.unexpectedError)
|
|
1338
|
-
});
|
|
1339
|
-
}
|
|
1340
|
-
} else {
|
|
1341
|
-
actions.cancelImport();
|
|
1342
|
-
showNotification({
|
|
1343
|
-
kind: 'error',
|
|
1344
|
-
domain: DOMAINS.PAGE,
|
|
1345
|
-
text: isError(error) ? error.toString() : String(error)
|
|
1346
|
-
});
|
|
1347
|
-
reportErrorToSentry(new Error('Upload File Error: An unexpected issue occurred while uploading the file'), {
|
|
1348
|
-
extra: {
|
|
1349
|
-
error,
|
|
1350
|
-
projectKey,
|
|
1351
|
-
containerKey: state.containerKey,
|
|
1352
|
-
resourceType: state.resourceType,
|
|
1353
|
-
fileSizeInBytes: state.droppedFile?.size
|
|
1354
|
-
}
|
|
1355
|
-
});
|
|
1356
|
-
}
|
|
1357
|
-
};
|
|
1358
|
-
const handleUploadAndValidation = async () => {
|
|
1359
|
-
if (!projectKey || !state.droppedFile || !state.resourceType) return;
|
|
1360
|
-
const canUpload = await isFileValid(state.droppedFile);
|
|
1361
|
-
if (!canUpload) return;
|
|
1362
|
-
actions.setCurrentStep(CurrentStep$1.Uploading);
|
|
1363
|
-
const containerKey = encodeFileNameWithTimestampToContainerKey(state.droppedFile.name);
|
|
1364
|
-
actions.setContainerKey(containerKey);
|
|
1365
|
-
try {
|
|
1366
|
-
const shouldApplyPublishSettings = state.resourceType === 'product';
|
|
1367
|
-
await createImportContainerForFileUpload({
|
|
1368
|
-
key: containerKey,
|
|
1369
|
-
resourceType: state.resourceType,
|
|
1370
|
-
tags: [TAG_KEY_SOURCE_FILE_UPLOAD],
|
|
1371
|
-
settings: _objectSpread$e({
|
|
1372
|
-
format: 'CSV',
|
|
1373
|
-
decimalSeparator: state.settings?.decimalSeparator
|
|
1374
|
-
}, shouldApplyPublishSettings ? {
|
|
1375
|
-
resourceType: state.resourceType === 'product' ? 'product-draft' : state.resourceType,
|
|
1376
|
-
options: {
|
|
1377
|
-
publishAllChanges: state.settings?.publish ?? false
|
|
1378
|
-
}
|
|
1379
|
-
} : {})
|
|
1380
|
-
}, projectKey, asyncDispatch);
|
|
1381
|
-
const newAbortController = uploadFileForImport({
|
|
1382
|
-
projectKey,
|
|
1383
|
-
containerKey,
|
|
1384
|
-
resourceType: state.resourceType,
|
|
1385
|
-
file: state.droppedFile,
|
|
1386
|
-
onSuccess: fileUploadResponse => {
|
|
1387
|
-
actions.setUploadFileResponse(fileUploadResponse);
|
|
1388
|
-
actions.setCurrentStep(CurrentStep$1.UploadResult);
|
|
1389
|
-
},
|
|
1390
|
-
onProgress: progress => {
|
|
1391
|
-
actions.setProgress(progress);
|
|
1392
|
-
},
|
|
1393
|
-
onError: error => {
|
|
1394
|
-
deleteImportContainer(projectKey, containerKey, asyncDispatch);
|
|
1395
|
-
handleUploadError(error);
|
|
1396
|
-
}
|
|
1397
|
-
});
|
|
1398
|
-
actions.setAbortController(newAbortController);
|
|
1399
|
-
} catch (error) {
|
|
1400
|
-
deleteImportContainer(projectKey, containerKey, asyncDispatch);
|
|
1401
|
-
handleUploadError(error);
|
|
1402
|
-
actions.setCurrentStep(CurrentStep$1.UploadResult);
|
|
1403
|
-
}
|
|
1404
|
-
};
|
|
1405
|
-
return {
|
|
1406
|
-
handleUploadAndValidation
|
|
1407
|
-
};
|
|
1408
|
-
};
|
|
1409
|
-
|
|
1410
|
-
const useImportPermission = () => {
|
|
1411
|
-
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
1412
|
-
actionRights: applicationContext.actionRights?.products
|
|
1413
|
-
})),
|
|
1414
|
-
actionRights = _useApplicationContex.actionRights;
|
|
1415
|
-
const canManageProducts = useIsAuthorized({
|
|
1416
|
-
demandedPermissions: [PERMISSIONS.ManageProducts]
|
|
1417
|
-
});
|
|
1418
|
-
const canManageCustomers = useIsAuthorized({
|
|
1419
|
-
demandedPermissions: [PERMISSIONS.ManageCustomers]
|
|
1420
|
-
});
|
|
1421
|
-
const canManageOrders = useIsAuthorized({
|
|
1422
|
-
demandedPermissions: [PERMISSIONS.ManageOrders]
|
|
1423
|
-
});
|
|
1424
|
-
const canManageKeyValueDocuments = useIsAuthorized({
|
|
1425
|
-
demandedPermissions: [PERMISSIONS.ManageKeyValueDocuments]
|
|
1426
|
-
});
|
|
1427
|
-
const canMAnageCategories = useIsAuthorized({
|
|
1428
|
-
demandedPermissions: [PERMISSIONS.ManageCategories]
|
|
1429
|
-
});
|
|
1430
|
-
const canManageDiscountCodes = useIsAuthorized({
|
|
1431
|
-
demandedPermissions: [PERMISSIONS.ManageDiscountCodes]
|
|
1432
|
-
});
|
|
1433
|
-
const canManageBusinessUnits = useIsAuthorized({
|
|
1434
|
-
demandedPermissions: [PERMISSIONS.ManageBusinessUnits]
|
|
1435
|
-
});
|
|
1436
|
-
const canImportProducts = useMemo(() => {
|
|
1437
|
-
if (!actionRights) return false;
|
|
1438
|
-
const canAddPrices = actionRights.canAddPrices,
|
|
1439
|
-
canAddProducts = actionRights.canAddProducts,
|
|
1440
|
-
canEditAttributesAll = actionRights['canEditAttributes:all'],
|
|
1441
|
-
canEditPrices = actionRights.canEditPrices;
|
|
1442
|
-
return canManageProducts && canAddPrices && canAddProducts && canEditAttributesAll && canEditPrices;
|
|
1443
|
-
}, [canManageProducts, actionRights]);
|
|
1444
|
-
const canManageCustomObjects = useMemo(() => {
|
|
1445
|
-
return canManageProducts || canManageCustomers || canManageOrders || canManageKeyValueDocuments;
|
|
1446
|
-
}, [canManageCustomers, canManageOrders, canManageProducts, canManageKeyValueDocuments]);
|
|
1447
|
-
return {
|
|
1448
|
-
canImportProducts,
|
|
1449
|
-
canImportCategories: canMAnageCategories,
|
|
1450
|
-
canImportDiscountCodes: canManageDiscountCodes,
|
|
1451
|
-
canImportBusinessUnits: canManageBusinessUnits,
|
|
1452
|
-
canImportInventories: canManageProducts,
|
|
1453
|
-
canImportProductTypes: canManageProducts,
|
|
1454
|
-
canImportCustomObjects: canManageCustomObjects
|
|
1455
|
-
};
|
|
1456
|
-
};
|
|
1457
|
-
|
|
1458
|
-
function ownKeys$d(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; }
|
|
1459
|
-
function _objectSpread$d(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context3 = ownKeys$d(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context4 = ownKeys$d(Object(t))).call(_context4, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1460
|
-
const FileDropArea = () => {
|
|
1461
|
-
const intl = useIntl();
|
|
1462
|
-
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1463
|
-
state = _useImportResourcesCo.state,
|
|
1464
|
-
actions = _useImportResourcesCo.actions;
|
|
1465
|
-
const isResourceTypeSelected = Boolean(state.resourceType);
|
|
1466
|
-
const showNotification = useShowNotification();
|
|
1467
|
-
const onDrop = React.useCallback(_ref => {
|
|
1468
|
-
let _ref2 = _slicedToArray(_ref, 1),
|
|
1469
|
-
file = _ref2[0];
|
|
1470
|
-
if (!file) return;
|
|
1471
|
-
assertResourceType(state.resourceType);
|
|
1472
|
-
actions.setDroppedFile(file);
|
|
1473
|
-
}, [state.resourceType]);
|
|
1474
|
-
const _useDropzone = useDropzone({
|
|
1475
|
-
onDrop,
|
|
1476
|
-
multiple: false,
|
|
1477
|
-
disabled: !isResourceTypeSelected,
|
|
1478
|
-
accept: {
|
|
1479
|
-
'text/csv': ['.csv']
|
|
1480
|
-
},
|
|
1481
|
-
onDropRejected: _ref3 => {
|
|
1482
|
-
var _context, _context2;
|
|
1483
|
-
let _ref4 = _slicedToArray(_ref3, 1),
|
|
1484
|
-
rejectedFile = _ref4[0];
|
|
1485
|
-
if (_someInstanceProperty(_context = rejectedFile.errors).call(_context, error => error.code === 'too-many-files')) {
|
|
1486
|
-
showNotification({
|
|
1487
|
-
kind: 'error',
|
|
1488
|
-
domain: DOMAINS.PAGE,
|
|
1489
|
-
text: intl.formatMessage(messages$8.tooManyFilesError)
|
|
1490
|
-
});
|
|
1491
|
-
return;
|
|
1492
|
-
}
|
|
1493
|
-
if (_someInstanceProperty(_context2 = rejectedFile.errors).call(_context2, error => error.code === 'file-invalid-type')) {
|
|
1494
|
-
showNotification({
|
|
1495
|
-
kind: 'error',
|
|
1496
|
-
domain: DOMAINS.PAGE,
|
|
1497
|
-
text: intl.formatMessage(messages$8.fileFormatNotSupported)
|
|
1498
|
-
});
|
|
1499
|
-
} else {
|
|
1500
|
-
showNotification({
|
|
1501
|
-
kind: 'error',
|
|
1502
|
-
domain: DOMAINS.PAGE,
|
|
1503
|
-
text: intl.formatMessage(messages$8.genericError)
|
|
1504
|
-
});
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
}),
|
|
1508
|
-
getRootProps = _useDropzone.getRootProps,
|
|
1509
|
-
getInputProps = _useDropzone.getInputProps,
|
|
1510
|
-
isDragActive = _useDropzone.isDragActive;
|
|
1511
|
-
const dropAreaState = React.useMemo(() => getDropAreaState({
|
|
1512
|
-
isReady: Boolean(state.droppedFile),
|
|
1513
|
-
hasResourceType: !state.resourceType,
|
|
1514
|
-
isDragActive
|
|
1515
|
-
}), [state.resourceType, state.droppedFile, isDragActive]);
|
|
1516
|
-
const dropArea = getDropArea({
|
|
1517
|
-
dropAreaState,
|
|
1518
|
-
resourceType: 'category',
|
|
1519
|
-
isFileDropped: Boolean(state.droppedFile)
|
|
1520
|
-
});
|
|
1521
|
-
return jsxs(DropWrapper, _objectSpread$d(_objectSpread$d({
|
|
1522
|
-
role: "presentation"
|
|
1523
|
-
}, getRootProps()), {}, {
|
|
1524
|
-
dropAreaState: dropAreaState,
|
|
1525
|
-
children: [jsx("input", _objectSpread$d({
|
|
1526
|
-
"data-testid": "file-input"
|
|
1527
|
-
}, getInputProps())), jsx(Constraints.Horizontal, {
|
|
1528
|
-
children: dropArea
|
|
1529
|
-
})]
|
|
1530
|
-
}));
|
|
1531
|
-
};
|
|
1532
|
-
|
|
1533
|
-
var messages$6 = defineMessages({
|
|
1534
|
-
separatorTitle: {
|
|
1535
|
-
id: 'ImportResourcesModal.uploadSeparator.separatorTitle',
|
|
1536
|
-
description: 'Title for the separator selection',
|
|
1537
|
-
defaultMessage: 'Separator'
|
|
1538
|
-
},
|
|
1539
|
-
decimalsSeparatorDescription: {
|
|
1540
|
-
id: 'ImportResourcesModal.uploadSeparator.decimalsSeparatorDescription',
|
|
1541
|
-
description: 'Description for the decimals separator selection',
|
|
1542
|
-
defaultMessage: 'Select the decimals separator that match your CSV file. The column separator is automatically detected.'
|
|
1543
|
-
},
|
|
1544
|
-
decimalSeparatorPoint: {
|
|
1545
|
-
id: 'ImportResourcesModal.uploadSeparator.decimalSeparatorPoint',
|
|
1546
|
-
description: 'Label for point decimal separator option',
|
|
1547
|
-
defaultMessage: 'point (.)'
|
|
1548
|
-
},
|
|
1549
|
-
decimalSeparatorComma: {
|
|
1550
|
-
id: 'ImportResourcesModal.uploadSeparator.decimalSeparatorComma',
|
|
1551
|
-
description: 'Label for comma decimal separator option',
|
|
1552
|
-
defaultMessage: 'comma (,)'
|
|
1553
|
-
},
|
|
1554
|
-
decimals: {
|
|
1555
|
-
id: 'ImportResourcesModal.uploadSeparator.decimals',
|
|
1556
|
-
description: 'Label for decimal separator select',
|
|
1557
|
-
defaultMessage: 'Decimals'
|
|
1558
|
-
}
|
|
1559
|
-
});
|
|
1560
|
-
|
|
1561
|
-
function ownKeys$c(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; }
|
|
1562
|
-
function _objectSpread$c(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$c(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$c(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1563
|
-
function _EMOTION_STRINGIFIED_CSS_ERROR__$2() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
1564
|
-
const DECIMAL_DELIMITER_OPTIONS = [{
|
|
1565
|
-
label: messages$6.decimalSeparatorPoint,
|
|
1566
|
-
value: DELIMITERS.POINT
|
|
1567
|
-
}, {
|
|
1568
|
-
label: messages$6.decimalSeparatorComma,
|
|
1569
|
-
value: DELIMITERS.COMMA
|
|
1570
|
-
}];
|
|
1571
|
-
const decimalSeparatorOptions = _mapInstanceProperty(DECIMAL_DELIMITER_OPTIONS).call(DECIMAL_DELIMITER_OPTIONS, option => _objectSpread$c(_objectSpread$c({}, option), {}, {
|
|
1572
|
-
label: jsx(FormattedMessage, _objectSpread$c({}, option.label))
|
|
1573
|
-
}));
|
|
1574
|
-
var _ref$1 = process.env.NODE_ENV === "production" ? {
|
|
1575
|
-
name: "lt3z56",
|
|
1576
|
-
styles: "width:calc(50% - 16px)"
|
|
1577
|
-
} : {
|
|
1578
|
-
name: "1vfe1dp-UploadSeparator",
|
|
1579
|
-
styles: "width:calc(50% - 16px);label:UploadSeparator;/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2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AgICAgICBkZWNpbWFsU2VwYXJhdG9yOiBlLnRhcmdldC52YWx1ZSBhcyBEZWNpbWFsU2VwYXJhdG9yLFxuICAgICAgICAgICAgfSlcbiAgICAgICAgICB9fVxuICAgICAgICAvPlxuICAgICAgPC9kaXY+XG4gICAgPC9TcGFjaW5ncy5TdGFjaz5cbiAgKVxufVxuIl19 */",
|
|
1580
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$2
|
|
1581
|
-
};
|
|
1582
|
-
const UploadSeparator = () => {
|
|
1583
|
-
const intl = useIntl();
|
|
1584
|
-
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1585
|
-
state = _useImportResourcesCo.state,
|
|
1586
|
-
actions = _useImportResourcesCo.actions;
|
|
1587
|
-
return jsxs(Spacings.Stack, {
|
|
1588
|
-
scale: "m",
|
|
1589
|
-
children: [jsxs("div", {
|
|
1590
|
-
children: [jsx(Text.Subheadline, {
|
|
1591
|
-
as: "h4",
|
|
1592
|
-
intlMessage: messages$6.separatorTitle
|
|
1593
|
-
}), jsx(Text.Caption, {
|
|
1594
|
-
tone: "tertiary",
|
|
1595
|
-
intlMessage: messages$6.decimalsSeparatorDescription
|
|
1596
|
-
})]
|
|
1597
|
-
}), jsx("div", {
|
|
1598
|
-
css: _ref$1,
|
|
1599
|
-
children: jsx(SelectField, {
|
|
1600
|
-
title: intl.formatMessage(messages$6.decimals),
|
|
1601
|
-
isSearchable: false,
|
|
1602
|
-
options: decimalSeparatorOptions,
|
|
1603
|
-
value: state.settings?.decimalSeparator,
|
|
1604
|
-
onChange: e => {
|
|
1605
|
-
actions.setUploadSettings({
|
|
1606
|
-
decimalSeparator: e.target.value
|
|
1607
|
-
});
|
|
1608
|
-
}
|
|
1609
|
-
})
|
|
1610
|
-
})]
|
|
1611
|
-
});
|
|
1612
|
-
};
|
|
1613
|
-
|
|
1614
|
-
var messages$5 = defineMessages({
|
|
1615
|
-
publishProducts: {
|
|
1616
|
-
id: 'ImportResourcesModal.settings.publishProducts',
|
|
1617
|
-
description: 'Label for the publish products checkbox',
|
|
1618
|
-
defaultMessage: 'Publish all products in the file'
|
|
1619
|
-
}
|
|
1620
|
-
});
|
|
1621
|
-
|
|
1622
|
-
function ownKeys$b(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; }
|
|
1623
|
-
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; }
|
|
1624
|
-
const UploadProductSettings = () => {
|
|
1625
|
-
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1626
|
-
state = _useImportResourcesCo.state,
|
|
1627
|
-
actions = _useImportResourcesCo.actions;
|
|
1628
|
-
return jsx(CheckboxInput, {
|
|
1629
|
-
"data-tracking-target": 'product_import-publish_checkbox',
|
|
1630
|
-
isChecked: state.settings?.publish,
|
|
1631
|
-
onChange: e => {
|
|
1632
|
-
actions.setUploadSettings({
|
|
1633
|
-
publish: e.target.checked
|
|
1634
|
-
});
|
|
1635
|
-
},
|
|
1636
|
-
children: jsx(FormattedMessage, _objectSpread$b({}, messages$5.publishProducts))
|
|
1637
|
-
});
|
|
1638
|
-
};
|
|
1639
|
-
const UploadSettings = () => {
|
|
1640
|
-
const _useImportResourcesCo2 = useImportResourcesContext(),
|
|
1641
|
-
state = _useImportResourcesCo2.state;
|
|
1642
|
-
const canPublishProducts = useIsAuthorized({
|
|
1643
|
-
demandedPermissions: [PERMISSIONS.ManageProducts],
|
|
1644
|
-
demandedActionRights: [ACTION_RIGHTS.PublishProducts]
|
|
1645
|
-
});
|
|
1646
|
-
if (state.resourceType === 'product' && canPublishProducts) return jsx(UploadProductSettings, {});
|
|
1647
|
-
return null;
|
|
1648
|
-
};
|
|
1649
|
-
|
|
1650
|
-
const Upload = () => {
|
|
1651
|
-
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1652
|
-
state = _useImportResourcesCo.state,
|
|
1653
|
-
onClose = _useImportResourcesCo.onClose,
|
|
1654
|
-
resourceTypes = _useImportResourcesCo.resourceTypes;
|
|
1655
|
-
const intl = useIntl();
|
|
1656
|
-
const _useUpload = useUpload(),
|
|
1657
|
-
handleUploadAndValidation = _useUpload.handleUploadAndValidation;
|
|
1658
|
-
const isMultipleResourceTypes = resourceTypes.length > 1;
|
|
1659
|
-
return jsx(FormDialog, {
|
|
1660
|
-
size: 16,
|
|
1661
|
-
isOpen: true,
|
|
1662
|
-
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1663
|
-
labelPrimary: intl.formatMessage(sharedMessages.uploadButton),
|
|
1664
|
-
onPrimaryButtonClick: handleUploadAndValidation,
|
|
1665
|
-
isPrimaryButtonDisabled: !Boolean(state.droppedFile),
|
|
1666
|
-
onSecondaryButtonClick: () => onClose({
|
|
1667
|
-
shouldDeleteImportContainer: true
|
|
1668
|
-
}),
|
|
1669
|
-
onClose: () => onClose({
|
|
1670
|
-
shouldDeleteImportContainer: true
|
|
1671
|
-
}),
|
|
1672
|
-
dataAttributesPrimaryButton: {
|
|
1673
|
-
'data-tracking-target': `${state.resourceType}_import-upload_and_preview_button`
|
|
1674
|
-
},
|
|
1675
|
-
children: jsx(Masking.Unmask, {
|
|
1676
|
-
children: jsxs(Spacings.Stack, {
|
|
1677
|
-
scale: "l",
|
|
1678
|
-
children: [isMultipleResourceTypes ? jsxs(Grid, {
|
|
1679
|
-
gridRowGap: designTokens.spacingL,
|
|
1680
|
-
gridTemplateColumns: `calc(${designTokens.constraint3} + ${designTokens.spacingL}) auto`,
|
|
1681
|
-
children: [jsx(Grid.Item, {
|
|
1682
|
-
children: jsx(Text.Body, {
|
|
1683
|
-
isBold: true,
|
|
1684
|
-
intlMessage: messages$8.dataType
|
|
1685
|
-
})
|
|
1686
|
-
}), jsx(Grid.Item, {
|
|
1687
|
-
children: jsx(ResourceTypeSelection, {})
|
|
1688
|
-
}), jsx(Grid.Item, {
|
|
1689
|
-
children: jsx(Text.Body, {
|
|
1690
|
-
isBold: true,
|
|
1691
|
-
intlMessage: messages$8.instructions
|
|
1692
|
-
})
|
|
1693
|
-
}), jsx(Grid.Item, {
|
|
1694
|
-
children: jsx(Instructions, {})
|
|
1695
|
-
})]
|
|
1696
|
-
}) : jsx(Fragment, {
|
|
1697
|
-
children: jsx(Instructions, {})
|
|
1698
|
-
}), jsx(InfoBox, {}), jsx(UploadSeparator, {}), jsx(Masking.Mask, {
|
|
1699
|
-
children: jsx(FileDropArea, {})
|
|
1700
|
-
}), jsx(UploadSettings, {})]
|
|
1701
|
-
})
|
|
1702
|
-
})
|
|
1703
|
-
});
|
|
1704
|
-
};
|
|
1705
|
-
|
|
1706
|
-
var messages$4 = defineMessages({
|
|
1707
|
-
row: {
|
|
1708
|
-
id: 'ImportResourcesModal.row',
|
|
1709
|
-
description: 'In Upload file error modal - "Row" column',
|
|
1710
|
-
defaultMessage: 'Row'
|
|
1711
|
-
},
|
|
1712
|
-
errorType: {
|
|
1713
|
-
id: 'ImportResourcesModal.errorType',
|
|
1714
|
-
description: 'In Upload file error modal - "Error type" column',
|
|
1715
|
-
defaultMessage: 'Error type'
|
|
1716
|
-
},
|
|
1717
|
-
details: {
|
|
1718
|
-
id: 'ImportResourcesModal.details',
|
|
1719
|
-
description: 'In Upload file error modal - "Details" column',
|
|
1720
|
-
defaultMessage: 'Details'
|
|
1721
|
-
},
|
|
1722
|
-
uploadErrorDescription: {
|
|
1723
|
-
id: 'ImportResourcesModal.uploadErrorDescription',
|
|
1724
|
-
description: 'Title when errors detected while uploading file',
|
|
1725
|
-
defaultMessage: 'There {errorsCount, plural, one {is <b>{errorsCount}</b> error} other {are <b>{errorsCount}</b> errors}} detected while uploading the file <b>{fileName}</b>.'
|
|
1726
|
-
},
|
|
1727
|
-
supportedValuesDocumentation: {
|
|
1728
|
-
id: 'ImportResourcesModal.supportedValuesDocumentation',
|
|
1729
|
-
description: 'Link to the documentation for supported values',
|
|
1730
|
-
defaultMessage: '<documentationLink>View the documentation</documentationLink> for supported values.'
|
|
1731
|
-
},
|
|
1732
|
-
uploadNewFile: {
|
|
1733
|
-
id: 'ImportResourcesModal.uploadNewFile',
|
|
1734
|
-
description: 'Upload new file button',
|
|
1735
|
-
defaultMessage: 'Upload new file'
|
|
1736
|
-
}
|
|
1737
|
-
});
|
|
1738
|
-
|
|
1739
|
-
function ownKeys$a(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; }
|
|
1740
|
-
function _objectSpread$a(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys$a(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys$a(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1741
|
-
const getColumns$1 = () => [{
|
|
1742
|
-
key: 'errorType',
|
|
1743
|
-
label: jsx(FormattedMessage, _objectSpread$a({}, messages$4.errorType)),
|
|
1744
|
-
width: 'max-content'
|
|
1745
|
-
}, {
|
|
1746
|
-
key: 'details',
|
|
1747
|
-
label: jsx(FormattedMessage, _objectSpread$a({}, messages$4.details))
|
|
1748
|
-
}];
|
|
1749
|
-
const UploadErrorTable = props => {
|
|
1750
|
-
var _context;
|
|
1751
|
-
const pagination = usePaginationState({
|
|
1752
|
-
perPage: 10
|
|
1753
|
-
});
|
|
1754
|
-
const startIndex = (pagination.page.value - 1) * pagination.perPage.value;
|
|
1755
|
-
const endIndex = startIndex + pagination.perPage.value;
|
|
1756
|
-
const currentPageRows = _sliceInstanceProperty(_context = props.rows).call(_context, startIndex, endIndex);
|
|
1757
|
-
const shouldShowPagination = props.rows.length > pagination.perPage.value;
|
|
1758
|
-
return jsxs(Spacings.Stack, {
|
|
1759
|
-
scale: "l",
|
|
1760
|
-
children: [jsx(DataTable, {
|
|
1761
|
-
verticalCellAlignment: "center",
|
|
1762
|
-
isCondensed: true,
|
|
1763
|
-
rows: currentPageRows,
|
|
1764
|
-
columns: getColumns$1(),
|
|
1765
|
-
itemRenderer: itemRenderer$1
|
|
1766
|
-
}), shouldShowPagination && jsx(PageNavigator, {
|
|
1767
|
-
onPageChange: pagination.page.onChange,
|
|
1768
|
-
page: pagination.page.value,
|
|
1769
|
-
totalPages: Math.ceil(props.rows.length / pagination.perPage.value)
|
|
1770
|
-
})]
|
|
1771
|
-
});
|
|
1772
|
-
};
|
|
1773
|
-
function itemRenderer$1(item, column) {
|
|
1774
|
-
switch (column.key) {
|
|
1775
|
-
case 'errorType':
|
|
1776
|
-
return jsx(Stamp, {
|
|
1777
|
-
isCondensed: true,
|
|
1778
|
-
label: item.title,
|
|
1779
|
-
tone: "critical"
|
|
1780
|
-
});
|
|
1781
|
-
case 'details':
|
|
1782
|
-
return jsx(Text.Body, {
|
|
1783
|
-
children: item.description
|
|
1784
|
-
});
|
|
1785
|
-
default:
|
|
1786
|
-
throw new UnexpectedColumnError(column.key);
|
|
1787
|
-
}
|
|
1788
|
-
}
|
|
1789
|
-
|
|
1790
|
-
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; }
|
|
1791
|
-
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; }
|
|
1792
|
-
const UploadErrorsModal = () => {
|
|
1793
|
-
const intl = useIntl();
|
|
1794
|
-
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1795
|
-
state = _useImportResourcesCo.state,
|
|
1796
|
-
actions = _useImportResourcesCo.actions,
|
|
1797
|
-
onClose = _useImportResourcesCo.onClose;
|
|
1798
|
-
const errorsCount = state.fileUploadErrors.length;
|
|
1799
|
-
return jsx(InfoDialog, {
|
|
1800
|
-
size: 16,
|
|
1801
|
-
isOpen: true,
|
|
1802
|
-
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1803
|
-
onClose: () => onClose(),
|
|
1804
|
-
children: jsx(Masking.Unmask, {
|
|
1805
|
-
children: jsxs(Spacings.Stack, {
|
|
1806
|
-
scale: "l",
|
|
1807
|
-
children: [jsx(Masking.Mask, {
|
|
1808
|
-
children: jsx(Text.Body, {
|
|
1809
|
-
intlMessage: _objectSpread$9(_objectSpread$9({}, messages$4.uploadErrorDescription), {}, {
|
|
1810
|
-
values: {
|
|
1811
|
-
fileName: state.droppedFile?.name,
|
|
1812
|
-
errorsCount: intl.formatNumber(errorsCount),
|
|
1813
|
-
b: getBold$3
|
|
1814
|
-
}
|
|
1815
|
-
})
|
|
1816
|
-
})
|
|
1817
|
-
}), jsx(UploadErrorTable, {
|
|
1818
|
-
rows: mapFileUploadErrorsToUploadFileErrorRows(state.fileUploadErrors)
|
|
1819
|
-
}), jsxs(Spacings.Inline, {
|
|
1820
|
-
scale: "m",
|
|
1821
|
-
justifyContent: "flex-end",
|
|
1822
|
-
children: [jsx(SecondaryButton, {
|
|
1823
|
-
label: intl.formatMessage(sharedMessages.close),
|
|
1824
|
-
onClick: () => onClose()
|
|
1825
|
-
}), jsx(PrimaryButton, {
|
|
1826
|
-
iconLeft: jsx(ImportIcon, {}),
|
|
1827
|
-
label: intl.formatMessage(messages$4.uploadNewFile),
|
|
1828
|
-
onClick: () => actions.uploadNewFile()
|
|
1829
|
-
})]
|
|
1830
|
-
})]
|
|
1831
|
-
})
|
|
1832
|
-
})
|
|
1833
|
-
});
|
|
1834
|
-
};
|
|
1835
|
-
function getBold$3(msg) {
|
|
1836
|
-
return jsx(Text.Body, {
|
|
1837
|
-
as: "span",
|
|
1838
|
-
isBold: true,
|
|
1839
|
-
children: msg
|
|
1840
|
-
}, crypto.randomUUID());
|
|
1841
|
-
}
|
|
1842
|
-
|
|
1843
|
-
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; }
|
|
1844
|
-
function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys$8(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys$8(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1845
|
-
const getColumns = () => [{
|
|
1846
|
-
key: 'row',
|
|
1847
|
-
label: jsx(FormattedMessage, _objectSpread$8({}, messages$4.row)),
|
|
1848
|
-
width: 'max-content'
|
|
1849
|
-
}, {
|
|
1850
|
-
key: 'errorType',
|
|
1851
|
-
label: jsx(FormattedMessage, _objectSpread$8({}, messages$4.errorType)),
|
|
1852
|
-
width: 'max-content'
|
|
1853
|
-
}, {
|
|
1854
|
-
key: 'details',
|
|
1855
|
-
label: jsx(FormattedMessage, _objectSpread$8({}, messages$4.details))
|
|
1856
|
-
}];
|
|
1857
|
-
const UploadRowErrorTable = props => {
|
|
1858
|
-
var _context;
|
|
1859
|
-
const pagination = usePaginationState({
|
|
1860
|
-
perPage: 10
|
|
1861
|
-
});
|
|
1862
|
-
const startIndex = (pagination.page.value - 1) * pagination.perPage.value;
|
|
1863
|
-
const endIndex = startIndex + pagination.perPage.value;
|
|
1864
|
-
const currentPageRows = _sliceInstanceProperty(_context = props.rows).call(_context, startIndex, endIndex);
|
|
1865
|
-
const shouldShowPagination = props.rows.length > pagination.perPage.value;
|
|
1866
|
-
return jsxs(Spacings.Stack, {
|
|
1867
|
-
scale: "l",
|
|
1868
|
-
children: [jsx(DataTable, {
|
|
1869
|
-
verticalCellAlignment: "center",
|
|
1870
|
-
isCondensed: true,
|
|
1871
|
-
rows: currentPageRows,
|
|
1872
|
-
columns: getColumns(),
|
|
1873
|
-
itemRenderer: itemRenderer
|
|
1874
|
-
}), shouldShowPagination && jsx(PageNavigator, {
|
|
1875
|
-
onPageChange: pagination.page.onChange,
|
|
1876
|
-
page: pagination.page.value,
|
|
1877
|
-
totalPages: Math.ceil(props.rows.length / pagination.perPage.value)
|
|
1878
|
-
})]
|
|
1879
|
-
});
|
|
1880
|
-
};
|
|
1881
|
-
function itemRenderer(item, column) {
|
|
1882
|
-
switch (column.key) {
|
|
1883
|
-
case 'row':
|
|
1884
|
-
return item.row;
|
|
1885
|
-
case 'errorType':
|
|
1886
|
-
return jsx(Stamp, {
|
|
1887
|
-
isCondensed: true,
|
|
1888
|
-
label: formatErrorCode(item.code),
|
|
1889
|
-
tone: "critical"
|
|
1890
|
-
});
|
|
1891
|
-
case 'details':
|
|
1892
|
-
return jsxs(Spacings.Inline, {
|
|
1893
|
-
scale: "xs",
|
|
1894
|
-
children: [jsx(Text.Body, {
|
|
1895
|
-
tone: "information",
|
|
1896
|
-
children: item.field
|
|
1897
|
-
}), jsx(Text.Body, {
|
|
1898
|
-
children: extractErrorDescriptionFromValidationMessage(item.validationMessage)
|
|
1899
|
-
})]
|
|
1900
|
-
});
|
|
1901
|
-
default:
|
|
1902
|
-
throw new UnexpectedColumnError(column.key);
|
|
1903
|
-
}
|
|
1904
|
-
}
|
|
1905
|
-
|
|
1906
|
-
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; }
|
|
1907
|
-
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; }
|
|
1908
|
-
const UploadRowErrorsModal = () => {
|
|
1909
|
-
const intl = useIntl();
|
|
1910
|
-
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1911
|
-
state = _useImportResourcesCo.state,
|
|
1912
|
-
actions = _useImportResourcesCo.actions,
|
|
1913
|
-
onClose = _useImportResourcesCo.onClose;
|
|
1914
|
-
const errorsCount = getFileUploadErrorsCount(state.uploadFileResponse?.results);
|
|
1915
|
-
const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
|
|
1916
|
-
return jsx(InfoDialog, {
|
|
1917
|
-
size: 16,
|
|
1918
|
-
isOpen: true,
|
|
1919
|
-
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
1920
|
-
onClose: onClose,
|
|
1921
|
-
children: jsx(Masking.Unmask, {
|
|
1922
|
-
children: jsxs(Spacings.Stack, {
|
|
1923
|
-
scale: "l",
|
|
1924
|
-
children: [jsxs(Spacings.Stack, {
|
|
1925
|
-
scale: "xs",
|
|
1926
|
-
children: [jsx(Masking.Mask, {
|
|
1927
|
-
children: jsx(Text.Body, {
|
|
1928
|
-
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$4.uploadErrorDescription), {}, {
|
|
1929
|
-
values: {
|
|
1930
|
-
fileName: state.droppedFile?.name,
|
|
1931
|
-
errorsCount: intl.formatNumber(errorsCount),
|
|
1932
|
-
b: getBold$2
|
|
1933
|
-
}
|
|
1934
|
-
})
|
|
1935
|
-
})
|
|
1936
|
-
}), jsx(Text.Body, {
|
|
1937
|
-
intlMessage: _objectSpread$7(_objectSpread$7({}, messages$4.supportedValuesDocumentation), {}, {
|
|
1938
|
-
values: {
|
|
1939
|
-
documentationLink: msg => jsx(Link, {
|
|
1940
|
-
tone: "secondary",
|
|
1941
|
-
isExternal: true,
|
|
1942
|
-
to: documentationLink,
|
|
1943
|
-
children: msg
|
|
1944
|
-
}, "documentationLink")
|
|
1945
|
-
}
|
|
1946
|
-
})
|
|
1947
|
-
})]
|
|
1948
|
-
}), jsx(UploadRowErrorTable, {
|
|
1949
|
-
rows: mapUploadFileErrorsResponseToUploadFileErrorRows(state.uploadFileResponse?.results)
|
|
1950
|
-
}), jsxs(Spacings.Inline, {
|
|
1951
|
-
scale: "m",
|
|
1952
|
-
justifyContent: "flex-end",
|
|
1953
|
-
children: [jsx(SecondaryButton, {
|
|
1954
|
-
label: intl.formatMessage(sharedMessages.close),
|
|
1955
|
-
onClick: () => onClose()
|
|
1956
|
-
}), jsx(PrimaryButton, {
|
|
1957
|
-
iconLeft: jsx(ImportIcon, {}),
|
|
1958
|
-
label: intl.formatMessage(messages$4.uploadNewFile),
|
|
1959
|
-
onClick: () => actions.uploadNewFile()
|
|
1960
|
-
})]
|
|
1961
|
-
})]
|
|
1962
|
-
})
|
|
1963
|
-
})
|
|
1964
|
-
});
|
|
1965
|
-
};
|
|
1966
|
-
function getBold$2(msg) {
|
|
1967
|
-
return jsx(Text.Body, {
|
|
1968
|
-
as: "span",
|
|
1969
|
-
isBold: true,
|
|
1970
|
-
children: msg
|
|
1971
|
-
}, crypto.randomUUID());
|
|
1972
|
-
}
|
|
1973
|
-
|
|
1974
|
-
var messages$3 = defineMessages({
|
|
1975
|
-
startImportButton: {
|
|
1976
|
-
id: 'ImportResourcesModal.startImportButton',
|
|
1977
|
-
description: 'Label for the modal Start import button',
|
|
1978
|
-
defaultMessage: 'Start import'
|
|
1979
|
-
},
|
|
1980
|
-
importNotificationSuccessMessage: {
|
|
1981
|
-
id: 'ImportResourcesModal.successMessage',
|
|
1982
|
-
description: 'Notification success message',
|
|
1983
|
-
defaultMessage: '<b>Your import has started.</b><newline></newline> <logsLink>Go to Import logs</logsLink> to view the progress.'
|
|
1984
|
-
},
|
|
1985
|
-
importNotificationPrepareMessage: {
|
|
1986
|
-
id: 'ImportResourcesModal.prepareMessage',
|
|
1987
|
-
description: 'Notification for preparing import',
|
|
1988
|
-
defaultMessage: '<b>Prepare import</b><newline></newline>Once preparation is complete, you can track the import progress <logsLink>in the Import logs</logsLink>.'
|
|
1989
|
-
},
|
|
1990
|
-
previewOfYourImport: {
|
|
1991
|
-
id: 'ImportResourcesModal.previewOfYourImport',
|
|
1992
|
-
description: 'Label for modal path',
|
|
1993
|
-
defaultMessage: "Here's a preview of your import"
|
|
1994
|
-
},
|
|
1995
|
-
itemsToBeImported: {
|
|
1996
|
-
id: 'ImportResourcesModal.itemsToBeImported',
|
|
1997
|
-
description: 'This message indicates the number of items that are ready to be imported into the project.',
|
|
1998
|
-
defaultMessage: '{itemCount, plural, one {<b>1</b> {resourceType} to be imported{publish, select, true { and published} other {}}} other {<b>{itemCount}</b> {resourceTypePlural} to be imported{publish, select, true { and published} other {}}}}'
|
|
1999
|
-
},
|
|
2000
|
-
columnsToBeImported: {
|
|
2001
|
-
id: 'ImportResourcesModal.columnsToBeImported',
|
|
2002
|
-
description: 'This message indicates the number of columns that are ready to be imported into the system.',
|
|
2003
|
-
defaultMessage: '<b>{columnCount}</b> columns to be imported'
|
|
2004
|
-
},
|
|
2005
|
-
columnsToBeIgnored: {
|
|
2006
|
-
id: 'ImportResourcesModal.columnsToBeIgnored',
|
|
2007
|
-
description: "This message indicates the number of columns that will be deliberately skipped during the import because they can't be imported",
|
|
2008
|
-
defaultMessage: "We will intentionally ignore <b>{columnCount}</b> columns as they can't be imported"
|
|
2009
|
-
},
|
|
2010
|
-
showMore: {
|
|
2011
|
-
id: 'ImportResourcesModal.showMore',
|
|
2012
|
-
description: 'A button label for expanding the import preview to show more details.',
|
|
2013
|
-
defaultMessage: 'Show more'
|
|
2014
|
-
},
|
|
2015
|
-
showLess: {
|
|
2016
|
-
id: 'ImportResourcesModal.showLess',
|
|
2017
|
-
description: 'A button label for collapsing the import preview to show fewer details.',
|
|
2018
|
-
defaultMessage: 'Show less'
|
|
2019
|
-
},
|
|
2020
|
-
continue: {
|
|
2021
|
-
id: 'ImportResourcesModal.continue',
|
|
2022
|
-
description: 'Confirmation dialog continue button',
|
|
2023
|
-
defaultMessage: 'Continue'
|
|
2024
|
-
},
|
|
2025
|
-
confirmationBodyText: {
|
|
2026
|
-
id: 'ImportResourcesModal.confirmationBodyText',
|
|
2027
|
-
description: 'Confirmation dialog text',
|
|
2028
|
-
defaultMessage: 'You are about to import {count, plural, one {<bold>1</bold> row} other {<bold>{count}</bold> rows}} in the project: <bold>{projectName}</bold>.'
|
|
2029
|
-
},
|
|
2030
|
-
confirmationBodyNote: {
|
|
2031
|
-
id: 'ImportResourcesModal.confirmationBodyNote',
|
|
2032
|
-
description: 'Confirmation dialog text',
|
|
2033
|
-
defaultMessage: 'Please be aware that existing values with the same keys will be overwritten by the data included in the CSV.'
|
|
2034
|
-
},
|
|
2035
|
-
confirmationBodyQuestion: {
|
|
2036
|
-
id: 'ImportResourcesModal.confirmationBodyQuestion',
|
|
2037
|
-
description: 'Confirmation question',
|
|
2038
|
-
defaultMessage: 'Proceed with the import?'
|
|
2039
|
-
}
|
|
2040
|
-
});
|
|
2041
|
-
|
|
2042
|
-
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; }
|
|
2043
|
-
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; }
|
|
2044
|
-
function _EMOTION_STRINGIFIED_CSS_ERROR__$1() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
2045
|
-
const AlignedContainer = /*#__PURE__*/_styled("div", process.env.NODE_ENV === "production" ? {
|
|
2046
|
-
target: "e1amawj91"
|
|
2047
|
-
} : {
|
|
2048
|
-
target: "e1amawj91",
|
|
2049
|
-
label: "AlignedContainer"
|
|
2050
|
-
})(process.env.NODE_ENV === "production" ? {
|
|
2051
|
-
name: "1x0d6yz",
|
|
2052
|
-
styles: "padding-top:5px"
|
|
2053
|
-
} : {
|
|
2054
|
-
name: "1x0d6yz",
|
|
2055
|
-
styles: "padding-top:5px/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbHVtbi1saXN0LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFXMEMiLCJmaWxlIjoiY29sdW1uLWxpc3QudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFJlYWN0IGZyb20gJ3JlYWN0J1xuaW1wb3J0IHsgRm9ybWF0dGVkTWVzc2FnZSB9IGZyb20gJ3JlYWN0LWludGwnXG5pbXBvcnQgeyBMaW5rLCBTdGFtcCwgVGFnTGlzdCB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLWZyb250ZW5kL3VpLWtpdCdcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJ1xuaW1wb3J0IG1lc3NhZ2VzIGZyb20gJy4vbWVzc2FnZXMnXG5pbXBvcnQgeyBJTklUSUFMX0NPTFVNTl9ESVNQTEFZX0NPVU5UIH0gZnJvbSAnLi4vLi4vQGNvbnN0YW50cydcblxuaW50ZXJmYWNlIFByb3BzIHtcbiAgY29sdW1uczogQXJyYXk8c3RyaW5nPlxufVxuXG5leHBvcnQgY29uc3QgQWxpZ25lZENvbnRhaW5lciA9IHN0eWxlZC5kaXZgXG4gIHBhZGRpbmctdG9wOiA1cHg7XG5gXG5cbmV4cG9ydCBjb25zdCBNb2RpZmllZFRhZ0xpc3QgPSBzdHlsZWQoVGFnTGlzdClgXG4gID4gZGl2IHtcbiAgICBtYXJnaW46IDhweCA4cHggMCAwO1xuICB9XG5gXG5cbmV4cG9ydCBjb25zdCBDb2x1bW5MaXN0ID0gKHByb3BzOiBSZWFjdC5Qcm9wc1dpdGhDaGlsZH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AgICAgICAgIDxGb3JtYXR0ZWRNZXNzYWdlIHsuLi5tZXNzYWdlcy5zaG93TW9yZX0gLz5cbiAgICAgICAgICAgICl9XG4gICAgICAgICAgPC9MaW5rPlxuICAgICAgICA8L0FsaWduZWRDb250YWluZXI+XG4gICAgICApfVxuICAgIDwvTW9kaWZpZWRUYWdMaXN0PlxuICApXG59XG4iXX0= */",
|
|
2056
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1
|
|
2057
|
-
});
|
|
2058
|
-
const ModifiedTagList = /*#__PURE__*/_styled(TagList, process.env.NODE_ENV === "production" ? {
|
|
2059
|
-
target: "e1amawj90"
|
|
2060
|
-
} : {
|
|
2061
|
-
target: "e1amawj90",
|
|
2062
|
-
label: "ModifiedTagList"
|
|
2063
|
-
})(process.env.NODE_ENV === "production" ? {
|
|
2064
|
-
name: "u9abxe",
|
|
2065
|
-
styles: ">div{margin:8px 8px 0 0;}"
|
|
2066
|
-
} : {
|
|
2067
|
-
name: "u9abxe",
|
|
2068
|
-
styles: ">div{margin:8px 8px 0 0;}/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbHVtbi1saXN0LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFlOEMiLCJmaWxlIjoiY29sdW1uLWxpc3QudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFJlYWN0IGZyb20gJ3JlYWN0J1xuaW1wb3J0IHsgRm9ybWF0dGVkTWVzc2FnZSB9IGZyb20gJ3JlYWN0LWludGwnXG5pbXBvcnQgeyBMaW5rLCBTdGFtcCwgVGFnTGlzdCB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLWZyb250ZW5kL3VpLWtpdCdcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJ1xuaW1wb3J0IG1lc3NhZ2VzIGZyb20gJy4vbWVzc2FnZXMnXG5pbXBvcnQ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mRCdXR0b24gJiYgKFxuICAgICAgICA8QWxpZ25lZENvbnRhaW5lcj5cbiAgICAgICAgICA8TGlua1xuICAgICAgICAgICAgdG89XCJcIlxuICAgICAgICAgICAgdG9uZT1cInNlY29uZGFyeVwiXG4gICAgICAgICAgICBvbkNsaWNrPXsoZSkgPT4ge1xuICAgICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KClcbiAgICAgICAgICAgICAgc2V0SXNFeHBhbmRlZCghaXNFeHBhbmRlZClcbiAgICAgICAgICAgIH19XG4gICAgICAgICAgPlxuICAgICAgICAgICAge2lzRXhwYW5kZWQgPyAoXG4gICAgICAgICAgICAgIDxGb3JtYXR0ZWRNZXNzYWdlIHsuLi5tZXNzYWdlcy5zaG93TGVzc30gLz5cbiAgICAgICAgICAgICkgOiAoXG4gICAgICAgICAgICAgIDxGb3JtYXR0ZWRNZXNzYWdlIHsuLi5tZXNzYWdlcy5zaG93TW9yZX0gLz5cbiAgICAgICAgICAgICl9XG4gICAgICAgICAgPC9MaW5rPlxuICAgICAgICA8L0FsaWduZWRDb250YWluZXI+XG4gICAgICApfVxuICAgIDwvTW9kaWZpZWRUYWdMaXN0PlxuICApXG59XG4iXX0= */",
|
|
2069
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1
|
|
2070
|
-
});
|
|
2071
|
-
const ColumnList = props => {
|
|
2072
|
-
var _context;
|
|
2073
|
-
const _React$useState = React.useState(false),
|
|
2074
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2075
|
-
isExpanded = _React$useState2[0],
|
|
2076
|
-
setIsExpanded = _React$useState2[1];
|
|
2077
|
-
const shouldShowExpandButton = props.columns.length > INITIAL_COLUMN_DISPLAY_COUNT;
|
|
2078
|
-
const finalColumns = isExpanded ? props.columns : _sliceInstanceProperty(_context = props.columns).call(_context, 0, INITIAL_COLUMN_DISPLAY_COUNT);
|
|
2079
|
-
return jsxs(ModifiedTagList, {
|
|
2080
|
-
children: [_mapInstanceProperty(finalColumns).call(finalColumns, (column, index) => jsx(Stamp, {
|
|
2081
|
-
label: column,
|
|
2082
|
-
tone: "secondary"
|
|
2083
|
-
}, index)), shouldShowExpandButton && jsx(AlignedContainer, {
|
|
2084
|
-
children: jsx(Link, {
|
|
2085
|
-
to: "",
|
|
2086
|
-
tone: "secondary",
|
|
2087
|
-
onClick: e => {
|
|
2088
|
-
e.preventDefault();
|
|
2089
|
-
setIsExpanded(!isExpanded);
|
|
2090
|
-
},
|
|
2091
|
-
children: isExpanded ? jsx(FormattedMessage, _objectSpread$6({}, messages$3.showLess)) : jsx(FormattedMessage, _objectSpread$6({}, messages$3.showMore))
|
|
2092
|
-
})
|
|
2093
|
-
})]
|
|
2094
|
-
});
|
|
2095
|
-
};
|
|
2096
|
-
|
|
2097
|
-
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; }
|
|
2098
|
-
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; }
|
|
2099
|
-
function UploadPreviewModal() {
|
|
2100
|
-
const _useImportResourcesCo = useImportResourcesContext(),
|
|
2101
|
-
state = _useImportResourcesCo.state;
|
|
2102
|
-
const intl = useIntl();
|
|
2103
|
-
const _useImportResourcesCo2 = useImportResourcesContext(),
|
|
2104
|
-
actions = _useImportResourcesCo2.actions,
|
|
2105
|
-
onClose = _useImportResourcesCo2.onClose;
|
|
2106
|
-
if (!state.resourceType || !state.uploadFileResponse) return null;
|
|
2107
|
-
const resourceTypeMessage = resourceTypeToMessage(state.resourceType);
|
|
2108
|
-
const resourceType = intl.formatMessage(resourceTypeMessage).toLowerCase();
|
|
2109
|
-
const resourceTypePluralMessage = resourceTypeToPluralMessage(state.resourceType);
|
|
2110
|
-
const resourceTypePlural = intl.formatMessage(resourceTypePluralMessage).toLowerCase();
|
|
2111
|
-
const ignoredColumns = state.uploadFileResponse.ignoredColumns;
|
|
2112
|
-
const validatedColumns = getValidatedColumns(state.uploadFileResponse.columns, ignoredColumns);
|
|
2113
|
-
return jsx(FormDialog, {
|
|
2114
|
-
size: 16,
|
|
2115
|
-
isOpen: true,
|
|
2116
|
-
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
2117
|
-
labelPrimary: intl.formatMessage(messages$3.continue),
|
|
2118
|
-
onSecondaryButtonClick: () => onClose({
|
|
2119
|
-
shouldDeleteImportContainer: true
|
|
2120
|
-
}),
|
|
2121
|
-
onPrimaryButtonClick: () => {
|
|
2122
|
-
actions.setCurrentStep(CurrentStep$1.ImportConfirmationModal);
|
|
2123
|
-
},
|
|
2124
|
-
onClose: () => onClose({
|
|
2125
|
-
shouldDeleteImportContainer: true
|
|
2126
|
-
}),
|
|
2127
|
-
children: jsx(Masking.Unmask, {
|
|
2128
|
-
children: jsx(PageContentNarrow, {
|
|
2129
|
-
children: jsx(Spacings.Stack, {
|
|
2130
|
-
scale: "xxxl",
|
|
2131
|
-
children: jsx(Spacings.Stack, {
|
|
2132
|
-
scale: "xl",
|
|
2133
|
-
children: jsxs(Spacings.Stack, {
|
|
2134
|
-
scale: "m",
|
|
2135
|
-
children: [jsx("div", {}), jsx(Text.Body, {
|
|
2136
|
-
intlMessage: messages$3.previewOfYourImport
|
|
2137
|
-
}), jsx(Card, {
|
|
2138
|
-
insetScale: "xl",
|
|
2139
|
-
children: jsxs(Spacings.Stack, {
|
|
2140
|
-
scale: "s",
|
|
2141
|
-
children: [jsxs(Spacings.Stack, {
|
|
2142
|
-
scale: "xs",
|
|
2143
|
-
children: [jsxs(Spacings.Inline, {
|
|
2144
|
-
alignItems: "center",
|
|
2145
|
-
children: [jsx(CheckBoldIcon, {
|
|
2146
|
-
color: "success"
|
|
2147
|
-
}), jsx(Text.Body, {
|
|
2148
|
-
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$3.itemsToBeImported), {}, {
|
|
2149
|
-
values: {
|
|
2150
|
-
resourceType,
|
|
2151
|
-
resourceTypePlural,
|
|
2152
|
-
itemCount: intl.formatNumber(state.uploadFileResponse.itemsCount),
|
|
2153
|
-
publish: state.resourceType === 'product' && state.settings?.publish,
|
|
2154
|
-
b: getBold$1
|
|
2155
|
-
}
|
|
2156
|
-
})
|
|
2157
|
-
})]
|
|
2158
|
-
}), jsxs(Spacings.Inline, {
|
|
2159
|
-
alignItems: "center",
|
|
2160
|
-
children: [jsx(CheckBoldIcon, {
|
|
2161
|
-
color: "success"
|
|
2162
|
-
}), jsx(Text.Body, {
|
|
2163
|
-
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$3.columnsToBeImported), {}, {
|
|
2164
|
-
values: {
|
|
2165
|
-
columnCount: intl.formatNumber(validatedColumns.length),
|
|
2166
|
-
b: getBold$1
|
|
2167
|
-
}
|
|
2168
|
-
})
|
|
2169
|
-
})]
|
|
2170
|
-
})]
|
|
2171
|
-
}), jsx(ColumnList, {
|
|
2172
|
-
columns: validatedColumns
|
|
2173
|
-
})]
|
|
2174
|
-
})
|
|
2175
|
-
}), ignoredColumns.length > 0 && jsx(Card, {
|
|
2176
|
-
insetScale: "xl",
|
|
2177
|
-
children: jsxs(Spacings.Stack, {
|
|
2178
|
-
scale: "s",
|
|
2179
|
-
children: [jsxs(Spacings.Inline, {
|
|
2180
|
-
alignItems: "center",
|
|
2181
|
-
children: [jsx(EyeCrossedIcon, {
|
|
2182
|
-
color: "neutral60"
|
|
2183
|
-
}), jsx(Text.Body, {
|
|
2184
|
-
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$3.columnsToBeIgnored), {}, {
|
|
2185
|
-
values: {
|
|
2186
|
-
columnCount: intl.formatNumber(ignoredColumns.length),
|
|
2187
|
-
b: getBold$1
|
|
2188
|
-
}
|
|
2189
|
-
})
|
|
2190
|
-
})]
|
|
2191
|
-
}), jsx(ColumnList, {
|
|
2192
|
-
columns: ignoredColumns
|
|
2193
|
-
})]
|
|
2194
|
-
})
|
|
2195
|
-
})]
|
|
2196
|
-
})
|
|
2197
|
-
})
|
|
2198
|
-
})
|
|
2199
|
-
})
|
|
2200
|
-
})
|
|
2201
|
-
});
|
|
2202
|
-
}
|
|
2203
|
-
function getBold$1(msg) {
|
|
2204
|
-
return jsx(Text.Body, {
|
|
2205
|
-
as: "span",
|
|
2206
|
-
isBold: true,
|
|
2207
|
-
children: msg
|
|
2208
|
-
}, crypto.randomUUID());
|
|
2209
|
-
}
|
|
2210
|
-
|
|
2211
|
-
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; }
|
|
2212
|
-
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$4(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$4(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2213
|
-
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
2214
|
-
const getNewLine = () => jsx("br", {}, "break");
|
|
2215
|
-
const getImportLogsLink = (msg, projectKey) => jsx(Link, {
|
|
2216
|
-
to: `/${projectKey}/operations/import/logs`,
|
|
2217
|
-
children: msg
|
|
2218
|
-
}, "link");
|
|
2219
|
-
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
2220
|
-
name: "1vs9i7r",
|
|
2221
|
-
styles: "width:360px"
|
|
2222
|
-
} : {
|
|
2223
|
-
name: "g36yzl-ImportRunningTextNotification",
|
|
2224
|
-
styles: "width:360px;label:ImportRunningTextNotification;/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImltcG9ydC1jb25maXJtYXRpb24tbW9kYWwudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXdCWSIsImZpbGUiOiJpbXBvcnQtY29uZmlybWF0aW9uLW1vZGFsLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHVzZUludGwgfSBmcm9tICdyZWFjdC1pbnRsJ1xuaW1wb3J0IHsgdXNlU2hvd05vdGlmaWNhdGlvbiB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLWZyb250ZW5kL2FjdGlvbnMtZ2xvYmFsJ1xuaW1wb3J0IHsgQ29uZmlybWF0aW9uRGlhbG9nIH0gZnJvbSAnQGNvbW1lcmNldG9vbHMtZnJvbnRlbmQvYXBwbGljYXRpb24tY29tcG9uZW50cydcbmltcG9ydCB7IHVzZUFwcGxpY2F0aW9uQ29udGV4dCB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLWZyb250ZW5kL2FwcGxpY2F0aW9uLXNoZWxsLWNvbm5lY3RvcnMnXG5pbXBvcnQgeyBET01BSU5TIH0gZnJvbSAnQGNvbW1lcmNldG9vbHMtZnJvbnRlbmQvY29uc3RhbnRzJ1xuaW1wb3J0IHsgTWFza2luZyBhcyBGdWx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25maXJtYXRpb24tZGlhbG9nLWNhbmNlbCcsXG4gICAgICAgICdkYXRhLXRyYWNraW5nLXRhcmdldCc6IGAke3N0YXRlLnJlc291cmNlVHlwZX1faW1wb3J0LXN0YXJ0X2ltcG9ydF9idXR0b25gLFxuICAgICAgfX1cbiAgICAgIG9uQ29uZmlybT17YXN5bmMgKCkgPT4ge1xuICAgICAgICB0cnkge1xuICAgICAgICAgIGNvbnN0IGNhbkNvbmZpcm0gPVxuICAgICAgICAgICAgcHJvamVjdEtleSAmJlxuICAgICAgICAgICAgc3RhdGUuY29udGFpbmVyS2V5ICYmXG4gICAgICAgICAgICBzdGF0ZS5kcm9wcGVkRmlsZT8ubmFtZSAmJlxuICAgICAgICAgICAgc3RhdGUucmVzb3VyY2VUeXBlXG4gICAgICAgICAgaWYgKCFjYW5Db25maXJtKSByZXR1cm5cbiAgICAgICAgICBvbkNsb3NlKClcbiAgICAgICAgICBzaG93Tm90aWZpY2F0aW9uKFxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBraW5kOiAnaW5mbycsXG4gICAgICAgICAgICAgIGRvbWFpbjogRE9NQUlOUy5TSURFLFxuICAgICAgICAgICAgICAvLyBAdHMtaWdub3JlXG4gICAgICAgICAgICAgIHRleHQ6IDxJbXBvcnRQcmVwYXJpbmdUZXh0Tm90aWZpY2F0aW9uIHByb2plY3RLZXk9e3Byb2plY3RLZXl9IC8+LFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgZGlzbWlzc0FmdGVyOiA1MDAwLFxuICAgICAgICAgICAgfVxuICAgICAgICAgIClcbiAgICAgICAgICBhd2FpdCBwcm9jZXNzVXBsb2FkZWRGaWxlKHtcbiAgICAgICAgICAgIHByb2plY3RLZXksXG4gICAgICAgICAgICBjb250YWluZXJLZXk6IHN0YXRlLmNvbnRhaW5lcktleSEsXG4gICAgICAgICAgICByZXNvdXJjZVR5cGU6IHN0YXRlLnJlc291cmNlVHlwZSEsXG4gICAgICAgICAgICBhc3luY0Rpc3BhdGNoLFxuICAgICAgICAgIH0pXG4gICAgICAgICAgb25TdGFydEltcG9ydFN1Y2Nlc3MoKVxuICAgICAgICAgIHNob3dOb3RpZmljYXRpb24oXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIGtpbmQ6ICdpbmZvJyxcbiAgICAgICAgICAgICAgZG9tYWluOiBET01BSU5TLlNJREUsXG4gICAgICAgICAgICAgIC8vIEB0cy1pZ25vcmVcbiAgICAgICAgICAgICAgdGV4dDogPEltcG9ydFJ1bm5pbmdUZXh0Tm90aWZpY2F0aW9uIHByb2plY3RLZXk9e3Byb2plY3RLZXl9IC8+LFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgZGlzbWlzc0FmdGVyOiA1MDAwLFxuICAgICAgICAgICAgfVxuICAgICAgICAgIClcbiAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICBvbkNsb3NlKHsgc2hvdWxkRGVsZXRlSW1wb3J0Q29udGFpbmVyOiB0cnVlIH0pXG4gICAgICAgICAgc2hvd05vdGlmaWNhdGlvbih7XG4gICAgICAgICAgICBraW5kOiAnZXJyb3InLFxuICAgICAgICAgICAgZG9tYWluOiBET01BSU5TLlBBR0UsXG4gICAgICAgICAgICB0ZXh0OiBpc0Vycm9yKGVycm9yKSA/IGVycm9yLnRvU3RyaW5nKCkgOiBTdHJpbmcoZXJyb3IpLFxuICAgICAgICAgIH0pXG4gICAgICAgIH1cbiAgICAgIH19XG4gICAgICBzaXplPXsxNn1cbiAgICA+XG4gICAgICA8RnVsbFN0b3J5TWFza2luZy5Vbm1hc2s+XG4gICAgICAgIDxTcGFjaW5ncy5TdGFjayBzY2FsZT1cInhsXCI+XG4gICAgICAgICAgPGRpdj5cbiAgICAgICAgICAgIDxUZXh0LkJvZHlcbiAgICAgICAgICAgICAgaW50bE1lc3NhZ2U9e3tcbiAgICAgICAgICAgICAgICAuLi5tZXNzYWdlcy5jb25maXJtYXRpb25Cb2R5VGV4dCxcbiAgICAgICAgICAgICAgICB2YWx1ZXM6IHtcbiAgICAgICAgICAgICAgICAgIHByb2plY3ROYW1lOiBwcm9qZWN0TmFtZSxcbiAgICAgICAgICAgICAgICAgIGNvdW50OiBpbnRsLmZvcm1hdE51bWJlcihcbiAgICAgICAgICAgICAgICAgICAgc3RhdGU/LnVwbG9hZEZpbGVSZXNwb25zZT8ucm93c0NvdW50IHx8IDBcbiAgICAgICAgICAgICAgICAgICksXG4gICAgICAgICAgICAgICAgICBib2xkOiBnZXRCb2xkLFxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgIH19XG4gICAgICAgICAgICAvPlxuICAgICAgICAgICAgPFRleHQuQm9keSBpbnRsTWVzc2FnZT17bWVzc2FnZXMuY29uZmlybWF0aW9uQm9keU5vdGV9IC8+XG4gICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgPFRleHQuQm9keSBpbnRsTWVzc2FnZT17bWVzc2FnZXMuY29uZmlybWF0aW9uQm9keVF1ZXN0aW9ufSAvPlxuICAgICAgICA8L1NwYWNpbmdzLlN0YWNrPlxuICAgICAgPC9GdWxsU3RvcnlNYXNraW5nLlVubWFzaz5cbiAgICA8L0NvbmZpcm1hdGlvbkRpYWxvZz5cbiAgKVxufVxuXG5mdW5jdGlvbiBnZXRCb2xkKG1zZykge1xuICByZXR1cm4gKFxuICAgIDxUZXh0LkJvZHkgYXM9XCJzcGFuXCIgaXNCb2xkIGtleT17Y3J5cHRvLnJhbmRvbVVVSUQoKX0+XG4gICAgICB7bXNnfVxuICAgIDwvVGV4dC5Cb2R5PlxuICApXG59XG4iXX0= */",
|
|
2225
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
2226
|
-
};
|
|
2227
|
-
const ImportRunningTextNotification = props => jsx("div", {
|
|
2228
|
-
css: _ref2,
|
|
2229
|
-
children: jsx(Text.Body, {
|
|
2230
|
-
intlMessage: _objectSpread$4(_objectSpread$4({}, messages$3.importNotificationSuccessMessage), {}, {
|
|
2231
|
-
values: {
|
|
2232
|
-
newline: getNewLine,
|
|
2233
|
-
logsLink: msg => getImportLogsLink(msg, props.projectKey),
|
|
2234
|
-
b: getBold
|
|
2235
|
-
}
|
|
2236
|
-
})
|
|
2237
|
-
})
|
|
2238
|
-
});
|
|
2239
|
-
var _ref = process.env.NODE_ENV === "production" ? {
|
|
2240
|
-
name: "1vs9i7r",
|
|
2241
|
-
styles: "width:360px"
|
|
2242
|
-
} : {
|
|
2243
|
-
name: "mjwslu-ImportPreparingTextNotification",
|
|
2244
|
-
styles: "width:360px;label:ImportPreparingTextNotification;/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImltcG9ydC1jb25maXJtYXRpb24tbW9kYWwudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTJDWSIsImZpbGUiOiJpbXBvcnQtY29uZmlybWF0aW9uLW1vZGFsLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHVzZUludGwgfSBmcm9tICdyZWFjdC1pbnRsJ1xuaW1wb3J0IHsgdXNlU2hvd05vdGlmaWNhdGlvbiB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLWZyb250ZW5kL2FjdGlvbnMtZ2xvYmFsJ1xuaW1wb3J0IHsgQ29uZmlybWF0aW9uRGlhbG9nIH0gZnJvbSAnQGNvbW1lcmNldG9vbHMtZnJvbnRlbmQvYXBwbGljYXRpb24tY29tcG9uZW50cydcbmltcG9ydCB7IHVzZUFwcGxpY2F0aW9uQ29udGV4dCB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLWZyb250ZW5kL2FwcGxpY2F0aW9uLXNoZWxsLWNvbm5lY3RvcnMnXG5pbXBvcnQgeyBET01BSU5TIH0gZnJvbSAnQGNvbW1lcmNldG9vbHMtZnJvbnRlbmQvY29uc3RhbnRzJ1xuaW1wb3J0IHsgTWFza2luZyBh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c6ICdjb25maXJtYXRpb24tZGlhbG9nLWNhbmNlbCcsXG4gICAgICAgICdkYXRhLXRyYWNraW5nLXRhcmdldCc6IGAke3N0YXRlLnJlc291cmNlVHlwZX1faW1wb3J0LXN0YXJ0X2ltcG9ydF9idXR0b25gLFxuICAgICAgfX1cbiAgICAgIG9uQ29uZmlybT17YXN5bmMgKCkgPT4ge1xuICAgICAgICB0cnkge1xuICAgICAgICAgIGNvbnN0IGNhbkNvbmZpcm0gPVxuICAgICAgICAgICAgcHJvamVjdEtleSAmJlxuICAgICAgICAgICAgc3RhdGUuY29udGFpbmVyS2V5ICYmXG4gICAgICAgICAgICBzdGF0ZS5kcm9wcGVkRmlsZT8ubmFtZSAmJlxuICAgICAgICAgICAgc3RhdGUucmVzb3VyY2VUeXBlXG4gICAgICAgICAgaWYgKCFjYW5Db25maXJtKSByZXR1cm5cbiAgICAgICAgICBvbkNsb3NlKClcbiAgICAgICAgICBzaG93Tm90aWZpY2F0aW9uKFxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBraW5kOiAnaW5mbycsXG4gICAgICAgICAgICAgIGRvbWFpbjogRE9NQUlOUy5TSURFLFxuICAgICAgICAgICAgICAvLyBAdHMtaWdub3JlXG4gICAgICAgICAgICAgIHRleHQ6IDxJbXBvcnRQcmVwYXJpbmdUZXh0Tm90aWZpY2F0aW9uIHByb2plY3RLZXk9e3Byb2plY3RLZXl9IC8+LFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgZGlzbWlzc0FmdGVyOiA1MDAwLFxuICAgICAgICAgICAgfVxuICAgICAgICAgIClcbiAgICAgICAgICBhd2FpdCBwcm9jZXNzVXBsb2FkZWRGaWxlKHtcbiAgICAgICAgICAgIHByb2plY3RLZXksXG4gICAgICAgICAgICBjb250YWluZXJLZXk6IHN0YXRlLmNvbnRhaW5lcktleSEsXG4gICAgICAgICAgICByZXNvdXJjZVR5cGU6IHN0YXRlLnJlc291cmNlVHlwZSEsXG4gICAgICAgICAgICBhc3luY0Rpc3BhdGNoLFxuICAgICAgICAgIH0pXG4gICAgICAgICAgb25TdGFydEltcG9ydFN1Y2Nlc3MoKVxuICAgICAgICAgIHNob3dOb3RpZmljYXRpb24oXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIGtpbmQ6ICdpbmZvJyxcbiAgICAgICAgICAgICAgZG9tYWluOiBET01BSU5TLlNJREUsXG4gICAgICAgICAgICAgIC8vIEB0cy1pZ25vcmVcbiAgICAgICAgICAgICAgdGV4dDogPEltcG9ydFJ1bm5pbmdUZXh0Tm90aWZpY2F0aW9uIHByb2plY3RLZXk9e3Byb2plY3RLZXl9IC8+LFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgZGlzbWlzc0FmdGVyOiA1MDAwLFxuICAgICAgICAgICAgfVxuICAgICAgICAgIClcbiAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICBvbkNsb3NlKHsgc2hvdWxkRGVsZXRlSW1wb3J0Q29udGFpbmVyOiB0cnVlIH0pXG4gICAgICAgICAgc2hvd05vdGlmaWNhdGlvbih7XG4gICAgICAgICAgICBraW5kOiAnZXJyb3InLFxuICAgICAgICAgICAgZG9tYWluOiBET01BSU5TLlBBR0UsXG4gICAgICAgICAgICB0ZXh0OiBpc0Vycm9yKGVycm9yKSA/IGVycm9yLnRvU3RyaW5nKCkgOiBTdHJpbmcoZXJyb3IpLFxuICAgICAgICAgIH0pXG4gICAgICAgIH1cbiAgICAgIH19XG4gICAgICBzaXplPXsxNn1cbiAgICA+XG4gICAgICA8RnVsbFN0b3J5TWFza2luZy5Vbm1hc2s+XG4gICAgICAgIDxTcGFjaW5ncy5TdGFjayBzY2FsZT1cInhsXCI+XG4gICAgICAgICAgPGRpdj5cbiAgICAgICAgICAgIDxUZXh0LkJvZHlcbiAgICAgICAgICAgICAgaW50bE1lc3NhZ2U9e3tcbiAgICAgICAgICAgICAgICAuLi5tZXNzYWdlcy5jb25maXJtYXRpb25Cb2R5VGV4dCxcbiAgICAgICAgICAgICAgICB2YWx1ZXM6IHtcbiAgICAgICAgICAgICAgICAgIHByb2plY3ROYW1lOiBwcm9qZWN0TmFtZSxcbiAgICAgICAgICAgICAgICAgIGNvdW50OiBpbnRsLmZvcm1hdE51bWJlcihcbiAgICAgICAgICAgICAgICAgICAgc3RhdGU/LnVwbG9hZEZpbGVSZXNwb25zZT8ucm93c0NvdW50IHx8IDBcbiAgICAgICAgICAgICAgICAgICksXG4gICAgICAgICAgICAgICAgICBib2xkOiBnZXRCb2xkLFxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgIH19XG4gICAgICAgICAgICAvPlxuICAgICAgICAgICAgPFRleHQuQm9keSBpbnRsTWVzc2FnZT17bWVzc2FnZXMuY29uZmlybWF0aW9uQm9keU5vdGV9IC8+XG4gICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgPFRleHQuQm9keSBpbnRsTWVzc2FnZT17bWVzc2FnZXMuY29uZmlybWF0aW9uQm9keVF1ZXN0aW9ufSAvPlxuICAgICAgICA8L1NwYWNpbmdzLlN0YWNrPlxuICAgICAgPC9GdWxsU3RvcnlNYXNraW5nLlVubWFzaz5cbiAgICA8L0NvbmZpcm1hdGlvbkRpYWxvZz5cbiAgKVxufVxuXG5mdW5jdGlvbiBnZXRCb2xkKG1zZykge1xuICByZXR1cm4gKFxuICAgIDxUZXh0LkJvZHkgYXM9XCJzcGFuXCIgaXNCb2xkIGtleT17Y3J5cHRvLnJhbmRvbVVVSUQoKX0+XG4gICAgICB7bXNnfVxuICAgIDwvVGV4dC5Cb2R5PlxuICApXG59XG4iXX0= */",
|
|
2245
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
2246
|
-
};
|
|
2247
|
-
const ImportPreparingTextNotification = props => jsx("div", {
|
|
2248
|
-
css: _ref,
|
|
2249
|
-
children: jsx(Text.Body, {
|
|
2250
|
-
intlMessage: _objectSpread$4(_objectSpread$4({}, messages$3.importNotificationPrepareMessage), {}, {
|
|
2251
|
-
values: {
|
|
2252
|
-
newline: getNewLine,
|
|
2253
|
-
logsLink: msg => getImportLogsLink(msg, props.projectKey),
|
|
2254
|
-
b: getBold
|
|
2255
|
-
}
|
|
2256
|
-
})
|
|
2257
|
-
})
|
|
2258
|
-
});
|
|
2259
|
-
const ImportConfirmationModal = () => {
|
|
2260
|
-
const intl = useIntl();
|
|
2261
|
-
const _useImportResourcesCo = useImportResourcesContext(),
|
|
2262
|
-
state = _useImportResourcesCo.state,
|
|
2263
|
-
onStartImportSuccess = _useImportResourcesCo.onStartImportSuccess,
|
|
2264
|
-
onClose = _useImportResourcesCo.onClose;
|
|
2265
|
-
const _useApplicationContex = useApplicationContext(context => ({
|
|
2266
|
-
projectKey: context.project?.key,
|
|
2267
|
-
projectName: context.project?.name
|
|
2268
|
-
})),
|
|
2269
|
-
projectKey = _useApplicationContex.projectKey,
|
|
2270
|
-
projectName = _useApplicationContex.projectName;
|
|
2271
|
-
const asyncDispatch = useAsyncDispatch();
|
|
2272
|
-
const showNotification = useShowNotification();
|
|
2273
|
-
return jsx(ConfirmationDialog, {
|
|
2274
|
-
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
2275
|
-
labelPrimary: intl.formatMessage(messages$3.startImportButton),
|
|
2276
|
-
isOpen: true,
|
|
2277
|
-
onClose: () => onClose({
|
|
2278
|
-
shouldDeleteImportContainer: true
|
|
2279
|
-
}),
|
|
2280
|
-
onCancel: () => onClose({
|
|
2281
|
-
shouldDeleteImportContainer: true
|
|
2282
|
-
}),
|
|
2283
|
-
dataAttributesPrimaryButton: {
|
|
2284
|
-
'data-test-id': 'confirmation-dialog-confirm'
|
|
2285
|
-
},
|
|
2286
|
-
dataAttributesSecondaryButton: {
|
|
2287
|
-
'data-test-id': 'confirmation-dialog-cancel',
|
|
2288
|
-
'data-tracking-target': `${state.resourceType}_import-start_import_button`
|
|
2289
|
-
},
|
|
2290
|
-
onConfirm: async () => {
|
|
2291
|
-
try {
|
|
2292
|
-
const canConfirm = projectKey && state.containerKey && state.droppedFile?.name && state.resourceType;
|
|
2293
|
-
if (!canConfirm) return;
|
|
2294
|
-
onClose();
|
|
2295
|
-
showNotification({
|
|
2296
|
-
kind: 'info',
|
|
2297
|
-
domain: DOMAINS.SIDE,
|
|
2298
|
-
// @ts-ignore
|
|
2299
|
-
text: jsx(ImportPreparingTextNotification, {
|
|
2300
|
-
projectKey: projectKey
|
|
2301
|
-
})
|
|
2302
|
-
}, {
|
|
2303
|
-
dismissAfter: 5000
|
|
2304
|
-
});
|
|
2305
|
-
await processUploadedFile({
|
|
2306
|
-
projectKey,
|
|
2307
|
-
containerKey: state.containerKey,
|
|
2308
|
-
resourceType: state.resourceType,
|
|
2309
|
-
asyncDispatch
|
|
2310
|
-
});
|
|
2311
|
-
onStartImportSuccess();
|
|
2312
|
-
showNotification({
|
|
2313
|
-
kind: 'info',
|
|
2314
|
-
domain: DOMAINS.SIDE,
|
|
2315
|
-
// @ts-ignore
|
|
2316
|
-
text: jsx(ImportRunningTextNotification, {
|
|
2317
|
-
projectKey: projectKey
|
|
2318
|
-
})
|
|
2319
|
-
}, {
|
|
2320
|
-
dismissAfter: 5000
|
|
2321
|
-
});
|
|
2322
|
-
} catch (error) {
|
|
2323
|
-
onClose({
|
|
2324
|
-
shouldDeleteImportContainer: true
|
|
2325
|
-
});
|
|
2326
|
-
showNotification({
|
|
2327
|
-
kind: 'error',
|
|
2328
|
-
domain: DOMAINS.PAGE,
|
|
2329
|
-
text: isError(error) ? error.toString() : String(error)
|
|
2330
|
-
});
|
|
2331
|
-
}
|
|
2332
|
-
},
|
|
2333
|
-
size: 16,
|
|
2334
|
-
children: jsx(Masking.Unmask, {
|
|
2335
|
-
children: jsxs(Spacings.Stack, {
|
|
2336
|
-
scale: "xl",
|
|
2337
|
-
children: [jsxs("div", {
|
|
2338
|
-
children: [jsx(Text.Body, {
|
|
2339
|
-
intlMessage: _objectSpread$4(_objectSpread$4({}, messages$3.confirmationBodyText), {}, {
|
|
2340
|
-
values: {
|
|
2341
|
-
projectName: projectName,
|
|
2342
|
-
count: intl.formatNumber(state?.uploadFileResponse?.rowsCount || 0),
|
|
2343
|
-
bold: getBold
|
|
2344
|
-
}
|
|
2345
|
-
})
|
|
2346
|
-
}), jsx(Text.Body, {
|
|
2347
|
-
intlMessage: messages$3.confirmationBodyNote
|
|
2348
|
-
})]
|
|
2349
|
-
}), jsx(Text.Body, {
|
|
2350
|
-
intlMessage: messages$3.confirmationBodyQuestion
|
|
2351
|
-
})]
|
|
2352
|
-
})
|
|
2353
|
-
})
|
|
2354
|
-
});
|
|
2355
|
-
};
|
|
2356
|
-
function getBold(msg) {
|
|
2357
|
-
return jsx(Text.Body, {
|
|
2358
|
-
as: "span",
|
|
2359
|
-
isBold: true,
|
|
2360
|
-
children: msg
|
|
2361
|
-
}, crypto.randomUUID());
|
|
2362
|
-
}
|
|
2363
|
-
|
|
2364
|
-
const UploadResult = () => {
|
|
2365
|
-
const _useImportResourcesCo = useImportResourcesContext(),
|
|
2366
|
-
state = _useImportResourcesCo.state;
|
|
2367
|
-
if (state.fileUploadErrors.length > 0) return jsx(UploadErrorsModal, {});
|
|
2368
|
-
if (state.uploadFileResponse?.invalid > 0) return jsx(UploadRowErrorsModal, {});
|
|
2369
|
-
return jsx(UploadPreviewModal, {});
|
|
2370
|
-
};
|
|
2371
|
-
|
|
2372
|
-
const Uploading = () => {
|
|
2373
|
-
const intl = useIntl();
|
|
2374
|
-
const _useImportResourcesCo = useImportResourcesContext(),
|
|
2375
|
-
state = _useImportResourcesCo.state,
|
|
2376
|
-
actions = _useImportResourcesCo.actions,
|
|
2377
|
-
onClose = _useImportResourcesCo.onClose;
|
|
2378
|
-
if (state.droppedFile?.name) return jsx(InfoDialog, {
|
|
2379
|
-
size: 16,
|
|
2380
|
-
isOpen: true,
|
|
2381
|
-
title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
|
|
2382
|
-
onClose: () => onClose({
|
|
2383
|
-
shouldDeleteImportContainer: true
|
|
2384
|
-
}),
|
|
2385
|
-
children: jsxs(Spacings.Stack, {
|
|
2386
|
-
scale: "m",
|
|
2387
|
-
children: [jsxs(Spacings.Inline, {
|
|
2388
|
-
alignItems: "center",
|
|
2389
|
-
justifyContent: "space-between",
|
|
2390
|
-
children: [jsxs(Spacings.Inline, {
|
|
2391
|
-
alignItems: "center",
|
|
2392
|
-
children: [jsx(FileIcon, {}), jsx(Spacings.Inline, {
|
|
2393
|
-
children: jsx(Constraints.Horizontal, {
|
|
2394
|
-
max: 10,
|
|
2395
|
-
children: jsx(Text.Body, {
|
|
2396
|
-
truncate: true,
|
|
2397
|
-
isBold: true,
|
|
2398
|
-
children: state.droppedFile.name
|
|
2399
|
-
})
|
|
2400
|
-
})
|
|
2401
|
-
}), jsxs(Text.Body, {
|
|
2402
|
-
tone: "secondary",
|
|
2403
|
-
children: ["(", intl.formatNumber(convertFileSizeToKB(state.droppedFile.size)), ' ', "KB)"]
|
|
2404
|
-
})]
|
|
2405
|
-
}), jsx(SecondaryButton, {
|
|
2406
|
-
tone: "secondary",
|
|
2407
|
-
size: "medium",
|
|
2408
|
-
label: intl.formatMessage(sharedMessages.cancel),
|
|
2409
|
-
onClick: () => {
|
|
2410
|
-
actions.setCurrentStep(CurrentStep$1.Upload);
|
|
2411
|
-
state.abortController.abort();
|
|
2412
|
-
}
|
|
2413
|
-
})]
|
|
2414
|
-
}), jsx(ProgressBar, {
|
|
2415
|
-
barWidth: "scale",
|
|
2416
|
-
height: "10",
|
|
2417
|
-
progress: state.progress
|
|
2418
|
-
}), jsx("div", {})]
|
|
2419
|
-
})
|
|
2420
|
-
});
|
|
2421
|
-
return null;
|
|
2422
|
-
};
|
|
2423
|
-
|
|
2424
|
-
const CurrentStep = () => {
|
|
2425
|
-
const _useImportResourcesCo = useImportResourcesContext(),
|
|
2426
|
-
state = _useImportResourcesCo.state;
|
|
2427
|
-
const steps = {
|
|
2428
|
-
upload: jsx(Upload, {}),
|
|
2429
|
-
uploading: jsx(Uploading, {}),
|
|
2430
|
-
'upload-result': jsx(UploadResult, {}),
|
|
2431
|
-
'import-confirmation-modal': jsx(ImportConfirmationModal, {})
|
|
2432
|
-
};
|
|
2433
|
-
return steps[state.currentStep] || null;
|
|
2434
|
-
};
|
|
2435
|
-
|
|
2436
|
-
var messages$2 = defineMessages({
|
|
2437
|
-
products: {
|
|
2438
|
-
id: 'ImportResourcesModal.radio.products',
|
|
2439
|
-
description: 'Label for the products radio button',
|
|
2440
|
-
defaultMessage: 'Products (including variants, assets, prices and images)'
|
|
2441
|
-
},
|
|
2442
|
-
inventories: {
|
|
2443
|
-
id: 'ImportResourcesModal.radio.inventories',
|
|
2444
|
-
description: 'Label for the inventories radio button',
|
|
2445
|
-
defaultMessage: 'Inventories'
|
|
2446
|
-
},
|
|
2447
|
-
categories: {
|
|
2448
|
-
id: 'ImportResourcesModal.radio.categories',
|
|
2449
|
-
description: 'Label for the categories radio button',
|
|
2450
|
-
defaultMessage: 'Categories'
|
|
2451
|
-
}
|
|
2452
|
-
});
|
|
2453
|
-
|
|
2454
|
-
const resourceTypeToDisplayName = resourceType => {
|
|
2455
|
-
switch (resourceType) {
|
|
2456
|
-
case IMPORTABLE_RESOURCES.PRODUCT:
|
|
2457
|
-
return messages$2.products;
|
|
2458
|
-
case IMPORTABLE_RESOURCES.INVENTORY:
|
|
2459
|
-
return messages$2.inventories;
|
|
2460
|
-
case IMPORTABLE_RESOURCES.CATEGORY:
|
|
2461
|
-
return messages$2.categories;
|
|
2462
|
-
default:
|
|
2463
|
-
throw new Error(`Unknown resource type: ${resourceType}`);
|
|
2464
|
-
}
|
|
2465
|
-
};
|
|
2466
|
-
const ResourceTypeSelection = () => {
|
|
2467
|
-
const _useImportResourcesCo = useImportResourcesContext(),
|
|
2468
|
-
state = _useImportResourcesCo.state,
|
|
2469
|
-
actions = _useImportResourcesCo.actions,
|
|
2470
|
-
resourceTypes = _useImportResourcesCo.resourceTypes;
|
|
2471
|
-
return jsx(RadioInput.Group, {
|
|
2472
|
-
value: state.resourceType,
|
|
2473
|
-
onChange: e => {
|
|
2474
|
-
actions.setResourceType(e.target.value);
|
|
2475
|
-
},
|
|
2476
|
-
direction: "stack",
|
|
2477
|
-
directionProps: {
|
|
2478
|
-
scale: 's'
|
|
2479
|
-
},
|
|
2480
|
-
children: _mapInstanceProperty(resourceTypes).call(resourceTypes, resourceType => jsx(RadioInput.Option, {
|
|
2481
|
-
value: resourceType,
|
|
2482
|
-
children: jsx(Text.Body, {
|
|
2483
|
-
intlMessage: resourceTypeToDisplayName(resourceType)
|
|
2484
|
-
})
|
|
2485
|
-
}, resourceType))
|
|
2486
|
-
});
|
|
2487
|
-
};
|
|
2488
|
-
|
|
2489
|
-
var messages$1 = defineMessages({
|
|
2490
|
-
fileUploadInstructions: {
|
|
2491
|
-
id: 'ImportResourcesModal.fileUploadInstructions',
|
|
2492
|
-
description: 'Label for the modal category description',
|
|
2493
|
-
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>.'
|
|
2494
|
-
}
|
|
2495
|
-
});
|
|
2496
|
-
|
|
2497
|
-
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; }
|
|
2498
|
-
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; }
|
|
2499
|
-
const Instructions = () => {
|
|
2500
|
-
const intl = useIntl();
|
|
2501
|
-
const _useImportResourcesCo = useImportResourcesContext(),
|
|
2502
|
-
state = _useImportResourcesCo.state;
|
|
2503
|
-
const templateLink = RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS[state.resourceType];
|
|
2504
|
-
const documentationLink = RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
|
|
2505
|
-
return jsx(Text.Body, {
|
|
2506
|
-
intlMessage: _objectSpread$3(_objectSpread$3({}, messages$1.fileUploadInstructions), {}, {
|
|
2507
|
-
values: {
|
|
2508
|
-
fileSize: intl.formatNumber(FILE_SIZE_LIMITS_MB[state.resourceType]),
|
|
2509
|
-
rowLimit: intl.formatNumber(ROW_LIMITS[state.resourceType]),
|
|
2510
|
-
csvTemplateLink: msg => jsx(Link, {
|
|
2511
|
-
tone: "secondary",
|
|
2512
|
-
isExternal: true,
|
|
2513
|
-
to: templateLink,
|
|
2514
|
-
children: msg
|
|
2515
|
-
}, "csvTemplateLink"),
|
|
2516
|
-
documentationLink: msg => jsx(Link, {
|
|
2517
|
-
tone: "secondary",
|
|
2518
|
-
isExternal: true,
|
|
2519
|
-
to: documentationLink,
|
|
2520
|
-
children: msg
|
|
2521
|
-
}, "documentationLink")
|
|
2522
|
-
}
|
|
2523
|
-
})
|
|
2524
|
-
});
|
|
2525
|
-
};
|
|
2526
|
-
|
|
2527
|
-
var messages = defineMessages({
|
|
2528
|
-
prerequisitesOfImportingData: {
|
|
2529
|
-
id: 'ImportResourcesModal.infoBox.prerequisitesOfImportingData',
|
|
2530
|
-
description: 'A message to guide users to check the prerequisites of importing data',
|
|
2531
|
-
defaultMessage: 'Prerequisites of importing data'
|
|
2532
|
-
},
|
|
2533
|
-
keysForEveryResource: {
|
|
2534
|
-
id: 'ImportResourcesModal.infoBox.keysForEveryResource',
|
|
2535
|
-
description: 'A message to guide users to provide keys for every resource they import',
|
|
2536
|
-
defaultMessage: 'You must provide keys for every resource you import, including embedded resources such as Prices and Assets. Please consult with your admins to assign keys through <link>the HTTP API</link>.'
|
|
2537
|
-
}
|
|
2538
|
-
});
|
|
2539
|
-
|
|
2540
|
-
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; }
|
|
2541
|
-
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; }
|
|
2542
|
-
const InfoBox = () => {
|
|
2543
|
-
const _useImportResourcesCo = useImportResourcesContext(),
|
|
2544
|
-
state = _useImportResourcesCo.state;
|
|
2545
|
-
if (!state.resourceType) return null;
|
|
2546
|
-
return jsx(ContentNotification, {
|
|
2547
|
-
type: "info",
|
|
2548
|
-
children: jsx(Spacings.Inset, {
|
|
2549
|
-
scale: "xs",
|
|
2550
|
-
children: jsxs(Spacings.Stack, {
|
|
2551
|
-
scale: "xs",
|
|
2552
|
-
children: [jsx(Text.Subheadline, {
|
|
2553
|
-
as: "h4",
|
|
2554
|
-
intlMessage: messages.prerequisitesOfImportingData
|
|
2555
|
-
}), jsx(Text.Body, {
|
|
2556
|
-
intlMessage: _objectSpread$2(_objectSpread$2({}, messages.keysForEveryResource), {}, {
|
|
2557
|
-
values: {
|
|
2558
|
-
link: msg => jsx(Link, {
|
|
2559
|
-
tone: "secondary",
|
|
2560
|
-
isExternal: true,
|
|
2561
|
-
to: CT_API_DOCS_URL,
|
|
2562
|
-
children: msg
|
|
2563
|
-
}, "link")
|
|
2564
|
-
}
|
|
2565
|
-
})
|
|
2566
|
-
})]
|
|
2567
|
-
})
|
|
2568
|
-
})
|
|
2569
|
-
});
|
|
2570
|
-
};
|
|
2571
|
-
|
|
2572
|
-
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; }
|
|
2573
|
-
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; }
|
|
2574
|
-
const FileIcon = props => jsxs("svg", _objectSpread$1(_objectSpread$1({
|
|
2575
|
-
width: "32",
|
|
2576
|
-
height: "32",
|
|
2577
|
-
viewBox: "0 0 32 32",
|
|
2578
|
-
fill: "none",
|
|
2579
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
2580
|
-
}, props), {}, {
|
|
2581
|
-
children: [jsx("mask", {
|
|
2582
|
-
id: "mask0_17_6643",
|
|
2583
|
-
style: {
|
|
2584
|
-
maskType: 'alpha'
|
|
2585
|
-
},
|
|
2586
|
-
maskUnits: "userSpaceOnUse",
|
|
2587
|
-
x: "0",
|
|
2588
|
-
y: "0",
|
|
2589
|
-
width: "32",
|
|
2590
|
-
height: "32",
|
|
2591
|
-
children: jsx("rect", {
|
|
2592
|
-
width: "32",
|
|
2593
|
-
height: "32",
|
|
2594
|
-
fill: "#D9D9D9"
|
|
2595
|
-
})
|
|
2596
|
-
}), jsx("g", {
|
|
2597
|
-
mask: "url(#mask0_17_6643)",
|
|
2598
|
-
children: jsx("path", {
|
|
2599
|
-
d: "M14.6667 25.3333H17.3333V19.7667L19.4667 21.9L21.3333 20L16 14.6667L10.6667 20L12.5667 21.8667L14.6667 19.7667V25.3333ZM8 29.3333C7.26667 29.3333 6.63889 29.0722 6.11667 28.55C5.59444 28.0278 5.33333 27.4 5.33333 26.6667V5.33332C5.33333 4.59999 5.59444 3.97221 6.11667 3.44999C6.63889 2.92777 7.26667 2.66666 8 2.66666H18.6667L26.6667 10.6667V26.6667C26.6667 27.4 26.4056 28.0278 25.8833 28.55C25.3611 29.0722 24.7333 29.3333 24 29.3333H8ZM17.3333 12H24L17.3333 5.33332V12Z",
|
|
2600
|
-
fill: "#B1ACFF"
|
|
2601
|
-
})
|
|
2602
|
-
})]
|
|
2603
|
-
}));
|
|
2604
|
-
|
|
2605
|
-
const getChunkImport = locale => {
|
|
2606
|
-
const intlLocale = mapLocaleToIntlLocale(locale);
|
|
2607
|
-
switch (intlLocale) {
|
|
2608
|
-
case 'de':
|
|
2609
|
-
return import('./de-ba5c0732.esm.js');
|
|
2610
|
-
case 'es':
|
|
2611
|
-
return import('./es-44c7763d.esm.js');
|
|
2612
|
-
case 'fr-FR':
|
|
2613
|
-
return import('./fr-FR-58d893b4.esm.js');
|
|
2614
|
-
case 'ja':
|
|
2615
|
-
return import('./ja-73c088a7.esm.js');
|
|
2616
|
-
case 'pt-BR':
|
|
2617
|
-
return import('./pt-BR-365e883e.esm.js');
|
|
2618
|
-
default:
|
|
2619
|
-
return import('./en-30a40b0e.esm.js');
|
|
2620
|
-
}
|
|
2621
|
-
};
|
|
2622
|
-
const loadMessages = async locale => {
|
|
2623
|
-
try {
|
|
2624
|
-
const chunkImport = await getChunkImport(locale);
|
|
2625
|
-
return parseChunkImport(chunkImport);
|
|
2626
|
-
} catch (error) {
|
|
2627
|
-
// eslint-disable-next-line no-console
|
|
2628
|
-
console.warn(`Something went wrong while loading the import-resources-modal messages for ${locale}`, error);
|
|
2629
|
-
reportErrorToSentry(new Error(`Something went wrong while loading the import-resources-modal messages for ${locale}`), {
|
|
2630
|
-
extra: error
|
|
2631
|
-
});
|
|
2632
|
-
return {};
|
|
2633
|
-
}
|
|
2634
|
-
};
|
|
2635
|
-
|
|
2636
|
-
const useAsyncIntlMessages = (locale, loader) => {
|
|
2637
|
-
const _useState = useState({
|
|
2638
|
-
isLoading: true,
|
|
2639
|
-
messages: undefined,
|
|
2640
|
-
error: undefined
|
|
2641
|
-
}),
|
|
2642
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
2643
|
-
state = _useState2[0],
|
|
2644
|
-
setState = _useState2[1];
|
|
2645
|
-
useEffect(() => {
|
|
2646
|
-
let _isUnmounting = false;
|
|
2647
|
-
async function load() {
|
|
2648
|
-
try {
|
|
2649
|
-
if (!_isUnmounting) {
|
|
2650
|
-
const messages = await loader(locale);
|
|
2651
|
-
setState({
|
|
2652
|
-
isLoading: false,
|
|
2653
|
-
messages
|
|
2654
|
-
});
|
|
2655
|
-
}
|
|
2656
|
-
} catch (error) {
|
|
2657
|
-
setState({
|
|
2658
|
-
isLoading: false,
|
|
2659
|
-
error
|
|
2660
|
-
});
|
|
2661
|
-
}
|
|
2662
|
-
}
|
|
2663
|
-
if (locale) load();
|
|
2664
|
-
return () => {
|
|
2665
|
-
_isUnmounting = true;
|
|
2666
|
-
};
|
|
2667
|
-
}, [locale, loader]);
|
|
2668
|
-
return state;
|
|
2669
|
-
};
|
|
2670
|
-
|
|
2671
|
-
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; }
|
|
2672
|
-
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; }
|
|
2673
|
-
const ImportResourcesModal = props => {
|
|
2674
|
-
var _context;
|
|
2675
|
-
const _useApplicationContex = useApplicationContext(context => ({
|
|
2676
|
-
locale: context.user && context.user.locale
|
|
2677
|
-
})),
|
|
2678
|
-
locale = _useApplicationContex.locale;
|
|
2679
|
-
const messages = useAsyncIntlMessages(locale, loadMessages);
|
|
2680
|
-
if (!props.isOpen || messages.isLoading) return null;
|
|
2681
|
-
if (!props.resourceTypes?.length) {
|
|
2682
|
-
console.error('No resource types provided for import resources modal');
|
|
2683
|
-
return null;
|
|
2684
|
-
}
|
|
2685
|
-
if (!_everyInstanceProperty(_context = props.resourceTypes).call(_context, isResourceType)) {
|
|
2686
|
-
console.error('Invalid resource types provided for import resources modal');
|
|
2687
|
-
return null;
|
|
2688
|
-
}
|
|
2689
|
-
return jsx(IntlProvider, {
|
|
2690
|
-
locale: locale,
|
|
2691
|
-
messages: messages.messages,
|
|
2692
|
-
children: jsx(ImportResourcesProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
2693
|
-
children: jsx(CurrentStep, {})
|
|
2694
|
-
}))
|
|
2695
|
-
});
|
|
2696
|
-
};
|
|
2697
|
-
ImportResourcesModal.displayName = 'ImportResourcesModal';
|
|
2698
|
-
|
|
2699
|
-
export { EnabledDropArea as E, FileDropped as F, ImportResourcesModal as I, FileIcon as a, useImportPermission as b, messages$8 as m, useImportResourcesContext as u };
|