@commercetools-frontend-extensions/delete-resources-modal 0.0.0-bw-test-preview-deploy-20250115163227
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/LICENSE +29 -0
- package/README.md +74 -0
- package/dist/active-drag-drop-area-5f79b986.cjs.dev.js +55 -0
- package/dist/active-drag-drop-area-87974335.cjs.prod.js +55 -0
- package/dist/active-drag-drop-area-d02e950a.esm.js +53 -0
- package/dist/commercetools-frontend-extensions-delete-resources-modal.cjs.d.ts +3 -0
- package/dist/commercetools-frontend-extensions-delete-resources-modal.cjs.dev.js +53 -0
- package/dist/commercetools-frontend-extensions-delete-resources-modal.cjs.js +7 -0
- package/dist/commercetools-frontend-extensions-delete-resources-modal.cjs.prod.js +53 -0
- package/dist/commercetools-frontend-extensions-delete-resources-modal.esm.js +45 -0
- package/dist/de-a34c5dd4.cjs.dev.js +6 -0
- package/dist/de-cd6c45d3.esm.js +4 -0
- package/dist/de-d954fe3d.cjs.prod.js +6 -0
- package/dist/declarations/src/@types/delete-resources-modal-props.d.ts +6 -0
- package/dist/declarations/src/@types/file-upload.d.ts +45 -0
- package/dist/declarations/src/@types/import-container.d.ts +4 -0
- package/dist/declarations/src/@types/index.d.ts +3 -0
- package/dist/declarations/src/delete-resources-modal.d.ts +6 -0
- package/dist/declarations/src/index.d.ts +2 -0
- package/dist/en-3a9aa2d4.esm.js +4 -0
- package/dist/en-6b3694f6.cjs.dev.js +6 -0
- package/dist/en-c7757448.cjs.prod.js +6 -0
- package/dist/enabled-drop-area-7516c43a.esm.js +103 -0
- package/dist/enabled-drop-area-8521a9f7.cjs.dev.js +116 -0
- package/dist/enabled-drop-area-d9d086a3.cjs.prod.js +116 -0
- package/dist/es-042343bd.cjs.prod.js +6 -0
- package/dist/es-8b3ecab1.cjs.dev.js +6 -0
- package/dist/es-e544023d.esm.js +4 -0
- package/dist/file-dropped-area-3ff29449.esm.js +73 -0
- package/dist/file-dropped-area-8cd4e78b.cjs.dev.js +75 -0
- package/dist/file-dropped-area-a4cafec7.cjs.prod.js +75 -0
- package/dist/fr-FR-9d9081ee.esm.js +4 -0
- package/dist/fr-FR-e7126fcc.cjs.dev.js +6 -0
- package/dist/fr-FR-fce1ca96.cjs.prod.js +6 -0
- package/dist/index-8626f1fa.cjs.dev.js +1755 -0
- package/dist/index-fe48ced5.cjs.prod.js +1743 -0
- package/dist/index-ffadc0d7.esm.js +1725 -0
- package/dist/ja-37632763.cjs.prod.js +6 -0
- package/dist/ja-73c088a7.esm.js +4 -0
- package/dist/ja-9bd5f452.cjs.dev.js +6 -0
- package/dist/pt-BR-b37d730b.esm.js +4 -0
- package/dist/pt-BR-ea6b3251.cjs.dev.js +6 -0
- package/dist/pt-BR-ec2a1a11.cjs.prod.js +6 -0
- package/dist/zh-CN-4780d88e.esm.js +4 -0
- package/dist/zh-CN-52baa549.cjs.prod.js +6 -0
- package/dist/zh-CN-d4bc6d26.cjs.dev.js +6 -0
- package/package.json +93 -0
|
@@ -0,0 +1,1725 @@
|
|
|
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 { defineMessages, useIntl, FormattedMessage, IntlProvider } from 'react-intl';
|
|
11
|
+
import { useApplicationContext, oidcStorage } from '@commercetools-frontend/application-shell-connectors';
|
|
12
|
+
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
13
|
+
import React, { lazy, useContext, useState, useEffect } from 'react';
|
|
14
|
+
import { actions, useAsyncDispatch } from '@commercetools-frontend/sdk';
|
|
15
|
+
import { MC_API_PROXY_TARGETS, DOMAINS } from '@commercetools-frontend/constants';
|
|
16
|
+
import { plural } from 'pluralize';
|
|
17
|
+
import _everyInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/every';
|
|
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 _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
|
|
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 _findInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
29
|
+
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
30
|
+
import Papa from 'papaparse';
|
|
31
|
+
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
32
|
+
import { FormDialog, InfoDialog } from '@commercetools-frontend/application-components';
|
|
33
|
+
import { Masking } from '@commercetools-frontend/fullstory';
|
|
34
|
+
import { customProperties, Constraints, Spacings, Text, Link, SecondaryButton, ProgressBar, usePaginationState, PageNavigator, Stamp, PrimaryButton, ImportIcon, WarningIcon, Card, BinLinearIcon } from '@commercetools-frontend/ui-kit';
|
|
35
|
+
import _someInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/some';
|
|
36
|
+
import { useDropzone } from 'react-dropzone';
|
|
37
|
+
import { useShowNotification } from '@commercetools-frontend/actions-global';
|
|
38
|
+
import _styled from '@emotion/styled/base';
|
|
39
|
+
import { css } from '@emotion/react';
|
|
40
|
+
import { reportErrorToSentry } from '@commercetools-frontend/sentry';
|
|
41
|
+
import { createHttpClientOptions, buildApiUrl } from '@commercetools-frontend/application-shell';
|
|
42
|
+
import _sliceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/slice';
|
|
43
|
+
import DataTable from '@commercetools-uikit/data-table';
|
|
44
|
+
import { parseChunkImport, mapLocaleToIntlLocale } from '@commercetools-frontend/i18n';
|
|
45
|
+
|
|
46
|
+
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; }
|
|
47
|
+
function _objectSpread$a(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$a(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$a(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
48
|
+
function reducer(state, action) {
|
|
49
|
+
if (action.type === 'setCurrentStep') return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
50
|
+
currentStep: action.currentStep,
|
|
51
|
+
progress: 0
|
|
52
|
+
});
|
|
53
|
+
if (action.type === 'setContainerKey') return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
54
|
+
containerKey: action.containerKey
|
|
55
|
+
});
|
|
56
|
+
if (action.type === 'cancelImport') return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
57
|
+
currentStep: 'upload',
|
|
58
|
+
containerKey: undefined,
|
|
59
|
+
droppedFile: undefined,
|
|
60
|
+
dropAreaState: 'ready-for-drop',
|
|
61
|
+
progress: 0
|
|
62
|
+
});
|
|
63
|
+
if (action.type === 'uploadNewFile') return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
64
|
+
currentStep: 'upload',
|
|
65
|
+
containerKey: undefined,
|
|
66
|
+
droppedFile: undefined,
|
|
67
|
+
dropAreaState: 'ready-for-drop',
|
|
68
|
+
progress: 0
|
|
69
|
+
});
|
|
70
|
+
if (action.type === 'setDroppedFile') {
|
|
71
|
+
return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
72
|
+
droppedFile: action.droppedFile
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
if (action.type === 'setAbortController') {
|
|
76
|
+
return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
77
|
+
abortController: action.abortController
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (action.type === 'setProgress') {
|
|
81
|
+
return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
82
|
+
progress: action.progress
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (action.type === 'setUploadFileResponse') {
|
|
86
|
+
return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
87
|
+
uploadFileResponse: action.uploadFileResponse
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
if (action.type === 'setFileUploadErrors') {
|
|
91
|
+
return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
92
|
+
fileUploadErrors: action.fileUploadErrors
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
throw new Error(getUnknownActionError(action));
|
|
96
|
+
}
|
|
97
|
+
function getUnknownActionError(actionType) {
|
|
98
|
+
return `Unkown type: ${actionType}`;
|
|
99
|
+
}
|
|
100
|
+
const initialState = {
|
|
101
|
+
currentStep: 'upload',
|
|
102
|
+
abortController: new AbortController(),
|
|
103
|
+
dropAreaState: 'ready-for-drop',
|
|
104
|
+
containerKey: undefined,
|
|
105
|
+
progress: 0,
|
|
106
|
+
uploadFileResponse: undefined,
|
|
107
|
+
fileUploadErrors: []
|
|
108
|
+
};
|
|
109
|
+
const initialActions = {
|
|
110
|
+
setCurrentStep(_currentStep) {
|
|
111
|
+
/**/
|
|
112
|
+
},
|
|
113
|
+
cancelImport() {
|
|
114
|
+
/**/
|
|
115
|
+
},
|
|
116
|
+
uploadNewFile() {
|
|
117
|
+
/**/
|
|
118
|
+
},
|
|
119
|
+
setDroppedFile(_nextDroppedFile) {
|
|
120
|
+
/**/
|
|
121
|
+
},
|
|
122
|
+
setUploadFileResponse(_uploadFileResponse) {
|
|
123
|
+
/**/
|
|
124
|
+
},
|
|
125
|
+
setFileUploadErrors(_fileUploadErrors) {
|
|
126
|
+
/**/
|
|
127
|
+
},
|
|
128
|
+
setContainerKey(_containerKey) {
|
|
129
|
+
/**/
|
|
130
|
+
},
|
|
131
|
+
setAbortController(_abortController) {
|
|
132
|
+
/**/
|
|
133
|
+
},
|
|
134
|
+
setProgress(_progress) {
|
|
135
|
+
/**/
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
function getCreateImportContainerURL(projectKey) {
|
|
140
|
+
return `/${projectKey}/import-containers`;
|
|
141
|
+
}
|
|
142
|
+
function getDeleteImportContainerURL(_ref) {
|
|
143
|
+
let projectKey = _ref.projectKey,
|
|
144
|
+
containerKey = _ref.containerKey;
|
|
145
|
+
return `/${projectKey}/import-containers/${containerKey}`;
|
|
146
|
+
}
|
|
147
|
+
function getFileUploadURL(_ref2) {
|
|
148
|
+
let projectKey = _ref2.projectKey,
|
|
149
|
+
containerKey = _ref2.containerKey,
|
|
150
|
+
resourceType = _ref2.resourceType;
|
|
151
|
+
const resourceTypePlural = plural(resourceType);
|
|
152
|
+
return `/${projectKey}/${resourceTypePlural}/import-containers/${containerKey}/file-upload`;
|
|
153
|
+
}
|
|
154
|
+
function getProccessFileURL(_ref3) {
|
|
155
|
+
let projectKey = _ref3.projectKey,
|
|
156
|
+
containerKey = _ref3.containerKey;
|
|
157
|
+
return `/${projectKey}/import-containers/${containerKey}/tasks`;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function createImportContainerForFileUpload(importContainerDraft, projectKey, asyncDispatch) {
|
|
161
|
+
return asyncDispatch(actions.post({
|
|
162
|
+
mcApiProxyTarget: MC_API_PROXY_TARGETS.IMPORT,
|
|
163
|
+
uri: getCreateImportContainerURL(projectKey),
|
|
164
|
+
headers: {
|
|
165
|
+
accept: 'application/json',
|
|
166
|
+
'Content-Type': 'application/json'
|
|
167
|
+
},
|
|
168
|
+
payload: importContainerDraft
|
|
169
|
+
}));
|
|
170
|
+
}
|
|
171
|
+
function deleteImportContainer(projectKey, containerKey, asyncDispatch) {
|
|
172
|
+
return asyncDispatch(actions.del({
|
|
173
|
+
mcApiProxyTarget: MC_API_PROXY_TARGETS.IMPORT,
|
|
174
|
+
uri: getDeleteImportContainerURL({
|
|
175
|
+
projectKey,
|
|
176
|
+
containerKey
|
|
177
|
+
}),
|
|
178
|
+
headers: {
|
|
179
|
+
accept: 'application/json'
|
|
180
|
+
}
|
|
181
|
+
}));
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
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)); }
|
|
185
|
+
function _isNativeReflectConstruct$2() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$2 = function () { return !!t; })(); }
|
|
186
|
+
let HttpError = /*#__PURE__*/function (_Error) {
|
|
187
|
+
function HttpError(statusCode, statusText, errorData) {
|
|
188
|
+
var _this;
|
|
189
|
+
_classCallCheck(this, HttpError);
|
|
190
|
+
_this = _callSuper$2(this, HttpError, [`HTTP Error! Status code: ${statusCode}, message: "${statusText ? statusText : ''}"`]);
|
|
191
|
+
_this.statusCode = void 0;
|
|
192
|
+
_this.errorData = void 0;
|
|
193
|
+
_this.name = 'HttpError';
|
|
194
|
+
_this.statusCode = statusCode;
|
|
195
|
+
_this.errorData = errorData;
|
|
196
|
+
return _this;
|
|
197
|
+
}
|
|
198
|
+
_inherits(HttpError, _Error);
|
|
199
|
+
return _createClass(HttpError);
|
|
200
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
201
|
+
|
|
202
|
+
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)); }
|
|
203
|
+
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function () { return !!t; })(); }
|
|
204
|
+
let MissingDeleteResourcesProviderError = /*#__PURE__*/function (_Error) {
|
|
205
|
+
function MissingDeleteResourcesProviderError() {
|
|
206
|
+
var _this;
|
|
207
|
+
_classCallCheck(this, MissingDeleteResourcesProviderError);
|
|
208
|
+
_this = _callSuper$1(this, MissingDeleteResourcesProviderError, ['useDeleteResourcesProviderError must be used within MissingDeleteResourcesProviderError']);
|
|
209
|
+
_this.name = 'MissingDeleteResourcesProviderError';
|
|
210
|
+
return _this;
|
|
211
|
+
}
|
|
212
|
+
_inherits(MissingDeleteResourcesProviderError, _Error);
|
|
213
|
+
return _createClass(MissingDeleteResourcesProviderError);
|
|
214
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
215
|
+
|
|
216
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
217
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
218
|
+
let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
|
|
219
|
+
function UnexpectedResourceTypeError(resourceType) {
|
|
220
|
+
var _this;
|
|
221
|
+
_classCallCheck(this, UnexpectedResourceTypeError);
|
|
222
|
+
_this = _callSuper(this, UnexpectedResourceTypeError, [`Unexpected resource type "${resourceType}"`]);
|
|
223
|
+
_this.name = 'UnexpectedResourceTypeError';
|
|
224
|
+
return _this;
|
|
225
|
+
}
|
|
226
|
+
_inherits(UnexpectedResourceTypeError, _Error);
|
|
227
|
+
return _createClass(UnexpectedResourceTypeError);
|
|
228
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
229
|
+
|
|
230
|
+
var sharedMessages = defineMessages({
|
|
231
|
+
deleteModalTitle: {
|
|
232
|
+
id: "DeleteResourcesModal.deleteModalTitle",
|
|
233
|
+
defaultMessage: "Bulk delete via CSV"
|
|
234
|
+
},
|
|
235
|
+
startBulkDelete: {
|
|
236
|
+
id: "DeleteResourcesModal.startBulkDelete",
|
|
237
|
+
defaultMessage: "Start bulk delete"
|
|
238
|
+
},
|
|
239
|
+
cancel: {
|
|
240
|
+
id: "DeleteResourcesModal.cancel",
|
|
241
|
+
defaultMessage: "Cancel"
|
|
242
|
+
},
|
|
243
|
+
product: {
|
|
244
|
+
id: "DeleteResourcesModal.product",
|
|
245
|
+
defaultMessage: "product"
|
|
246
|
+
},
|
|
247
|
+
products: {
|
|
248
|
+
id: "DeleteResourcesModal.products",
|
|
249
|
+
defaultMessage: "products"
|
|
250
|
+
},
|
|
251
|
+
inventory: {
|
|
252
|
+
id: "DeleteResourcesModal.inventory",
|
|
253
|
+
defaultMessage: "inventory entry"
|
|
254
|
+
},
|
|
255
|
+
inventories: {
|
|
256
|
+
id: "DeleteResourcesModal.inventories",
|
|
257
|
+
defaultMessage: "inventory entries"
|
|
258
|
+
},
|
|
259
|
+
category: {
|
|
260
|
+
id: "DeleteResourcesModal.category",
|
|
261
|
+
defaultMessage: "category"
|
|
262
|
+
},
|
|
263
|
+
categories: {
|
|
264
|
+
id: "DeleteResourcesModal.categories",
|
|
265
|
+
defaultMessage: "categories"
|
|
266
|
+
},
|
|
267
|
+
customer: {
|
|
268
|
+
id: "DeleteResourcesModal.customer",
|
|
269
|
+
defaultMessage: "customer"
|
|
270
|
+
},
|
|
271
|
+
customers: {
|
|
272
|
+
id: "DeleteResourcesModal.customers",
|
|
273
|
+
defaultMessage: "customers"
|
|
274
|
+
},
|
|
275
|
+
order: {
|
|
276
|
+
id: "DeleteResourcesModal.order",
|
|
277
|
+
defaultMessage: "order"
|
|
278
|
+
},
|
|
279
|
+
orders: {
|
|
280
|
+
id: "DeleteResourcesModal.orders",
|
|
281
|
+
defaultMessage: "orders"
|
|
282
|
+
},
|
|
283
|
+
price: {
|
|
284
|
+
id: "DeleteResourcesModal.price",
|
|
285
|
+
defaultMessage: "price"
|
|
286
|
+
},
|
|
287
|
+
prices: {
|
|
288
|
+
id: "DeleteResourcesModal.prices",
|
|
289
|
+
defaultMessage: "prices"
|
|
290
|
+
},
|
|
291
|
+
'product-draft': {
|
|
292
|
+
id: "DeleteResourcesModal.product-draft",
|
|
293
|
+
defaultMessage: "product draft"
|
|
294
|
+
},
|
|
295
|
+
'product-drafts': {
|
|
296
|
+
id: "DeleteResourcesModal.product-drafts",
|
|
297
|
+
defaultMessage: "product drafts"
|
|
298
|
+
},
|
|
299
|
+
'product-type': {
|
|
300
|
+
id: "DeleteResourcesModal.product-type",
|
|
301
|
+
defaultMessage: "product type"
|
|
302
|
+
},
|
|
303
|
+
'product-types': {
|
|
304
|
+
id: "DeleteResourcesModal.product-types",
|
|
305
|
+
defaultMessage: "product types"
|
|
306
|
+
},
|
|
307
|
+
'product-variant': {
|
|
308
|
+
id: "DeleteResourcesModal.product-variant",
|
|
309
|
+
defaultMessage: "product variant"
|
|
310
|
+
},
|
|
311
|
+
'product-variants': {
|
|
312
|
+
id: "DeleteResourcesModal.product-variants",
|
|
313
|
+
defaultMessage: "product variants"
|
|
314
|
+
},
|
|
315
|
+
'product-variant-patch': {
|
|
316
|
+
id: "DeleteResourcesModal.product-variant-patch",
|
|
317
|
+
defaultMessage: "product variant patch"
|
|
318
|
+
},
|
|
319
|
+
'product-variant-patches': {
|
|
320
|
+
id: "DeleteResourcesModal.product-variant-patches",
|
|
321
|
+
defaultMessage: "product variant patches"
|
|
322
|
+
},
|
|
323
|
+
'standalone-price': {
|
|
324
|
+
id: "DeleteResourcesModal.standalone-price",
|
|
325
|
+
defaultMessage: "standalone price"
|
|
326
|
+
},
|
|
327
|
+
'standalone-prices': {
|
|
328
|
+
id: "DeleteResourcesModal.standalone-prices",
|
|
329
|
+
defaultMessage: "standalone prices"
|
|
330
|
+
},
|
|
331
|
+
'discount-code': {
|
|
332
|
+
id: "DeleteResourcesModal.discount-code",
|
|
333
|
+
defaultMessage: "discount code"
|
|
334
|
+
},
|
|
335
|
+
'discount-codes': {
|
|
336
|
+
id: "DeleteResourcesModal.discount-codes",
|
|
337
|
+
defaultMessage: "discount codes"
|
|
338
|
+
},
|
|
339
|
+
unknownResourceType: {
|
|
340
|
+
id: "DeleteResourcesModal.unknown-resource-type",
|
|
341
|
+
defaultMessage: "unknown resource type"
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
function convertFileSizeToKB(sizeInBytes) {
|
|
346
|
+
return sizeInBytes / 1000;
|
|
347
|
+
}
|
|
348
|
+
function hasOwnProperty(obj, prop) {
|
|
349
|
+
return typeof obj === 'object' && obj !== null && obj.hasOwnProperty(prop);
|
|
350
|
+
}
|
|
351
|
+
function hasRequiredFields(maybeValidObject, requiredFields) {
|
|
352
|
+
return typeof maybeValidObject === 'object' && maybeValidObject !== null && _everyInstanceProperty(requiredFields).call(requiredFields, property => hasOwnProperty(maybeValidObject, property));
|
|
353
|
+
}
|
|
354
|
+
function isAbortError(error) {
|
|
355
|
+
return error instanceof DOMException && error.name === 'AbortError';
|
|
356
|
+
}
|
|
357
|
+
function resourceTypeToMessage(resourceType) {
|
|
358
|
+
const resourceTypeMap = {
|
|
359
|
+
category: sharedMessages.category,
|
|
360
|
+
product: sharedMessages.product,
|
|
361
|
+
'product-type': sharedMessages['product-type'],
|
|
362
|
+
order: sharedMessages.order,
|
|
363
|
+
customer: sharedMessages.customer,
|
|
364
|
+
'discount-code': sharedMessages['discount-code'],
|
|
365
|
+
inventory: sharedMessages.inventory,
|
|
366
|
+
// TODO: remove `inventory` after aligning the resource type names in the file upload API
|
|
367
|
+
'inventory-entry': sharedMessages.inventory,
|
|
368
|
+
'order-patch': sharedMessages['order-patch'],
|
|
369
|
+
price: sharedMessages.price,
|
|
370
|
+
'product-draft': sharedMessages['product-draft'],
|
|
371
|
+
'product-variant': sharedMessages['product-variant'],
|
|
372
|
+
'product-variant-patch': sharedMessages['product-variant-patch'],
|
|
373
|
+
'standalone-price': sharedMessages['standalone-price']
|
|
374
|
+
};
|
|
375
|
+
const message = resourceTypeMap[resourceType];
|
|
376
|
+
if (!message) {
|
|
377
|
+
console.warn(new UnexpectedResourceTypeError(resourceType));
|
|
378
|
+
return sharedMessages.unknownResourceType;
|
|
379
|
+
}
|
|
380
|
+
return message;
|
|
381
|
+
}
|
|
382
|
+
function resourceTypeToPluralMessage(resourceType) {
|
|
383
|
+
const resourceTypePluralMap = {
|
|
384
|
+
category: sharedMessages.categories,
|
|
385
|
+
product: sharedMessages.products,
|
|
386
|
+
'product-type': sharedMessages['product-types'],
|
|
387
|
+
order: sharedMessages.orders,
|
|
388
|
+
customer: sharedMessages.customers,
|
|
389
|
+
'discount-code': sharedMessages['discount-codes'],
|
|
390
|
+
inventory: sharedMessages.inventories,
|
|
391
|
+
// TODO: remove `inventory` after aligning the resource type names in the file upload API
|
|
392
|
+
'inventory-entry': sharedMessages.inventories,
|
|
393
|
+
'order-patch': sharedMessages['order-patches'],
|
|
394
|
+
price: sharedMessages.prices,
|
|
395
|
+
'product-draft': sharedMessages['product-drafts'],
|
|
396
|
+
'product-variant': sharedMessages['product-variants'],
|
|
397
|
+
'product-variant-patch': sharedMessages['product-variant-patches'],
|
|
398
|
+
'standalone-price': sharedMessages['standalone-prices']
|
|
399
|
+
};
|
|
400
|
+
const message = resourceTypePluralMap[resourceType];
|
|
401
|
+
if (!message) {
|
|
402
|
+
console.warn(new UnexpectedResourceTypeError(resourceType));
|
|
403
|
+
return sharedMessages.unknownResourceType;
|
|
404
|
+
}
|
|
405
|
+
return message;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
const encodeFileNameWithTimestampToContainerKey = fileName => {
|
|
409
|
+
return btoa(_JSON$stringify({
|
|
410
|
+
timestamp: new Date().getTime(),
|
|
411
|
+
fileName
|
|
412
|
+
})).replace(/=+$/g, '');
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
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; }
|
|
416
|
+
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; }
|
|
417
|
+
/**
|
|
418
|
+
* Returns the number of rows in a CSV file excluding the header
|
|
419
|
+
* @param file The CSV file to process.
|
|
420
|
+
* @returns A promise that resolves to the number of rows
|
|
421
|
+
*/
|
|
422
|
+
const getRowCount = file => {
|
|
423
|
+
return new _Promise(resolve => {
|
|
424
|
+
let lineCount = 0;
|
|
425
|
+
Papa.parse(file, {
|
|
426
|
+
step: _ref => {
|
|
427
|
+
let data = _ref.data;
|
|
428
|
+
// empty lines at the end of the file should not be counted
|
|
429
|
+
if (_Array$isArray(data) && _findInstanceProperty(data).call(data, Boolean)) lineCount++;
|
|
430
|
+
},
|
|
431
|
+
complete: () => {
|
|
432
|
+
// Subtract 1 for the header row
|
|
433
|
+
// We use Math.max to make sure the count is not less than 0, this is needed for empty files
|
|
434
|
+
resolve(Math.max(0, lineCount - 1));
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
});
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Checks if the CSV file only contains a single column named 'key'
|
|
442
|
+
* @param file The CSV file to process
|
|
443
|
+
* @returns A promise that resolves to true if the file contains only one column named 'key', otherwise false
|
|
444
|
+
*/
|
|
445
|
+
const hasSingleKeyColumn = file => {
|
|
446
|
+
return new _Promise(resolve => {
|
|
447
|
+
Papa.parse(file, {
|
|
448
|
+
header: true,
|
|
449
|
+
// Only parse the first row (header)
|
|
450
|
+
preview: 1,
|
|
451
|
+
complete: results => {
|
|
452
|
+
const fields = results?.meta?.fields;
|
|
453
|
+
resolve(fields.length === 1 && fields[0] === 'key');
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
});
|
|
457
|
+
};
|
|
458
|
+
const toBytes = megabytes => megabytes * 1024 * 1024;
|
|
459
|
+
const mapFileUploadErrorsToUploadFileErrorRows = uploadFileErrors => {
|
|
460
|
+
let idCounter = 1;
|
|
461
|
+
return _mapInstanceProperty(uploadFileErrors).call(uploadFileErrors, uploadFileError => _objectSpread$9(_objectSpread$9({}, uploadFileError), {}, {
|
|
462
|
+
id: String(idCounter++)
|
|
463
|
+
}));
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
async function processUploadedFile(_ref) {
|
|
467
|
+
let projectKey = _ref.projectKey,
|
|
468
|
+
containerKey = _ref.containerKey,
|
|
469
|
+
asyncDispatch = _ref.asyncDispatch,
|
|
470
|
+
resourceType = _ref.resourceType;
|
|
471
|
+
const uri = getProccessFileURL({
|
|
472
|
+
projectKey,
|
|
473
|
+
containerKey
|
|
474
|
+
});
|
|
475
|
+
const response = await asyncDispatch(actions.post({
|
|
476
|
+
mcApiProxyTarget: MC_API_PROXY_TARGETS.IMPORT,
|
|
477
|
+
uri: uri,
|
|
478
|
+
headers: {
|
|
479
|
+
accept: 'application/json',
|
|
480
|
+
'Content-Type': 'application/json'
|
|
481
|
+
},
|
|
482
|
+
payload: {
|
|
483
|
+
task: 'process-file',
|
|
484
|
+
parameter: {
|
|
485
|
+
resourceType,
|
|
486
|
+
action: 'delete'
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}));
|
|
490
|
+
assertProcessFileResponse(response);
|
|
491
|
+
return response;
|
|
492
|
+
}
|
|
493
|
+
function assertProcessFileResponse(maybeProcessFileResponse) {
|
|
494
|
+
const requiredFields = ['message'];
|
|
495
|
+
if (hasRequiredFields(maybeProcessFileResponse, requiredFields)) return;
|
|
496
|
+
throw new Error('Invalid response');
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
const DeleteResourcesContext = /*#__PURE__*/React.createContext({
|
|
500
|
+
state: initialState,
|
|
501
|
+
actions: initialActions,
|
|
502
|
+
onClose: () => {}
|
|
503
|
+
});
|
|
504
|
+
const DeleteResourcesProvider = props => {
|
|
505
|
+
const _useApplicationContex = useApplicationContext(context => ({
|
|
506
|
+
projectKey: context.project?.key
|
|
507
|
+
})),
|
|
508
|
+
projectKey = _useApplicationContex.projectKey;
|
|
509
|
+
const asyncDispatch = useAsyncDispatch();
|
|
510
|
+
const _React$useReducer = React.useReducer(reducer, initialState),
|
|
511
|
+
_React$useReducer2 = _slicedToArray(_React$useReducer, 2),
|
|
512
|
+
state = _React$useReducer2[0],
|
|
513
|
+
dispatch = _React$useReducer2[1];
|
|
514
|
+
const setCurrentStep = currentStep => dispatch({
|
|
515
|
+
type: 'setCurrentStep',
|
|
516
|
+
currentStep
|
|
517
|
+
});
|
|
518
|
+
const setContainerKey = containerKey => dispatch({
|
|
519
|
+
type: 'setContainerKey',
|
|
520
|
+
containerKey
|
|
521
|
+
});
|
|
522
|
+
const cancelImport = () => dispatch({
|
|
523
|
+
type: 'cancelImport'
|
|
524
|
+
});
|
|
525
|
+
const uploadNewFile = () => dispatch({
|
|
526
|
+
type: 'uploadNewFile'
|
|
527
|
+
});
|
|
528
|
+
const setDroppedFile = droppedFile => dispatch({
|
|
529
|
+
type: 'setDroppedFile',
|
|
530
|
+
droppedFile: droppedFile
|
|
531
|
+
});
|
|
532
|
+
const setFileUploadErrors = fileUploadErrors => {
|
|
533
|
+
dispatch({
|
|
534
|
+
type: 'setFileUploadErrors',
|
|
535
|
+
fileUploadErrors
|
|
536
|
+
});
|
|
537
|
+
};
|
|
538
|
+
const setAbortController = abortController => dispatch({
|
|
539
|
+
type: 'setAbortController',
|
|
540
|
+
abortController: abortController
|
|
541
|
+
});
|
|
542
|
+
const setProgress = progress => dispatch({
|
|
543
|
+
type: 'setProgress',
|
|
544
|
+
progress
|
|
545
|
+
});
|
|
546
|
+
const setUploadFileResponse = uploadFileResponse => {
|
|
547
|
+
dispatch({
|
|
548
|
+
type: 'setUploadFileResponse',
|
|
549
|
+
uploadFileResponse
|
|
550
|
+
});
|
|
551
|
+
};
|
|
552
|
+
const handleClose = function () {
|
|
553
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
554
|
+
if (state.abortController) state.abortController.abort();
|
|
555
|
+
if (typeof props.onClose === 'function') props.onClose();
|
|
556
|
+
// Removes the associated import container when the import is closed
|
|
557
|
+
if (options.shouldDeleteImportContainer && projectKey && state.containerKey) deleteImportContainer(projectKey, state.containerKey, asyncDispatch);
|
|
558
|
+
};
|
|
559
|
+
return jsx(DeleteResourcesContext.Provider, {
|
|
560
|
+
value: {
|
|
561
|
+
resourceType: props.resourceType,
|
|
562
|
+
state,
|
|
563
|
+
onClose: handleClose,
|
|
564
|
+
actions: {
|
|
565
|
+
setCurrentStep,
|
|
566
|
+
cancelImport,
|
|
567
|
+
uploadNewFile,
|
|
568
|
+
setDroppedFile,
|
|
569
|
+
setUploadFileResponse,
|
|
570
|
+
setFileUploadErrors,
|
|
571
|
+
setContainerKey,
|
|
572
|
+
setAbortController,
|
|
573
|
+
setProgress
|
|
574
|
+
}
|
|
575
|
+
},
|
|
576
|
+
children: props.children
|
|
577
|
+
});
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
const getBorderColor = state => {
|
|
581
|
+
const borderColors = {
|
|
582
|
+
default: '#909dbc',
|
|
583
|
+
error: '#e60050',
|
|
584
|
+
active: customProperties.colorPrimary
|
|
585
|
+
};
|
|
586
|
+
return borderColors[state] || borderColors.default;
|
|
587
|
+
};
|
|
588
|
+
const getDashedBorder = function () {
|
|
589
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
|
|
590
|
+
const color = getBorderColor(state);
|
|
591
|
+
const svgContent = `
|
|
592
|
+
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
|
|
593
|
+
<rect width="100%" height="100%" fill="none" stroke="${color}" stroke-width="2px" stroke-dasharray="6,6" stroke-dashoffset="0" stroke-linecap="square"/>
|
|
594
|
+
</svg>
|
|
595
|
+
`;
|
|
596
|
+
return `data:image/svg+xml,${encodeURIComponent(svgContent)}`;
|
|
597
|
+
};
|
|
598
|
+
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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUF5QmdCIiwiZmlsZSI6InN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGN1c3RvbVByb3BlcnRpZXMgfSBmcm9tICdAY29tbWVyY2V0b29scy1mcm9udGVuZC91aS1raXQnXG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCdcblxudHlwZSBEcm9wQXJlYVN0YXRlID0gJ2RlZmF1bHQnIHwgJ2Vycm9yJyB8ICdhY3RpdmUnXG5cbmNvbnN0IGdldEJvcmRlckNvbG9yID0gKHN0YXRlOiBEcm9wQXJlYVN0YXRlKSA9PiB7XG4gIGNvbnN0IGJvcmRlckNvbG9ycyA9IHtcbiAgICBkZWZhdWx0OiAnIzkwOWRiYycsXG4gICAgZXJyb3I6ICcjZTYwMDUwJyxcbiAgICBhY3RpdmU6IGN1c3RvbVByb3BlcnRpZXMuY29sb3JQcmltYXJ5LFxuICB9XG5cbiAgcmV0dXJuIGJvcmRlckNvbG9yc1tzdGF0ZV0gfHwgYm9yZGVyQ29sb3JzLmRlZmF1bHRcbn1cblxuY29uc3QgZ2V0RGFzaGVkQm9yZGVyID0gKHN0YXRlOiBEcm9wQXJlYVN0YXRlID0gJ2RlZmF1bHQnKSA9PiB7XG4gIGNvbnN0IGNvbG9yID0gZ2V0Qm9yZGVyQ29sb3Ioc3RhdGUpXG4gIGNvbnN0IHN2Z0NvbnRlbnQgPSBgXG4gICAgPHN2ZyB3aWR0aD1cIjEwMCVcIiBoZWlnaHQ9XCIxMDAlXCIgeG1sbnM9XCJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Z1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NzYFxuICBiYWNrZ3JvdW5kLWltYWdlOiB1cmwoXFxcIiR7Z2V0RGFzaGVkQm9yZGVyKCl9XFxcIik7XG4gIGJhY2tncm91bmQtY29sb3I6ICR7Y3VzdG9tUHJvcGVydGllcy5jb2xvclN1cmZhY2V9O1xuICBwYWRkaW5nOiAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZzUwfSAxMDBweDtcbmBcblxuZXhwb3J0IGNvbnN0IHN0eWxlcyA9IHtcbiAgYmFzZSxcbiAgcmVhZHlGb3JEcm9wLFxuICBmaWxlRHJvcHBlZCxcbiAgYWN0aXZlRHJhZyxcbn1cbiJdfQ== */");
|
|
599
|
+
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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFnQ3dCIiwiZmlsZSI6InN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGN1c3RvbVByb3BlcnRpZXMgfSBmcm9tICdAY29tbWVyY2V0b29scy1mcm9udGVuZC91aS1raXQnXG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCdcblxudHlwZSBEcm9wQXJlYVN0YXRlID0gJ2RlZmF1bHQnIHwgJ2Vycm9yJyB8ICdhY3RpdmUnXG5cbmNvbnN0IGdldEJvcmRlckNvbG9yID0gKHN0YXRlOiBEcm9wQXJlYVN0YXRlKSA9PiB7XG4gIGNvbnN0IGJvcmRlckNvbG9ycyA9IHtcbiAgICBkZWZhdWx0OiAnIzkwOWRiYycsXG4gICAgZXJyb3I6ICcjZTYwMDUwJyxcbiAgICBhY3RpdmU6IGN1c3RvbVByb3BlcnRp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2hlZEJvcmRlcigpfVxcXCIpO1xuICBiYWNrZ3JvdW5kLWNvbG9yOiAke2N1c3RvbVByb3BlcnRpZXMuY29sb3JTdXJmYWNlfTtcbmBcbmNvbnN0IGFjdGl2ZURyYWcgPSBjc3NgXG4gIGJhY2tncm91bmQtaW1hZ2U6IHVybChcXFwiJHtnZXREYXNoZWRCb3JkZXIoJ2FjdGl2ZScpfVxcXCIpO1xuICBiYWNrZ3JvdW5kLWNvbG9yOiAke2N1c3RvbVByb3BlcnRpZXMuY29sb3JQcmltYXJ5OTV9O1xuICBwYWRkaW5nOiAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZzUwfSAxMDBweDtcbmBcbmNvbnN0IGZpbGVEcm9wcGVkID0gY3NzYFxuICBiYWNrZ3JvdW5kLWltYWdlOiB1cmwoXFxcIiR7Z2V0RGFzaGVkQm9yZGVyKCl9XFxcIik7XG4gIGJhY2tncm91bmQtY29sb3I6ICR7Y3VzdG9tUHJvcGVydGllcy5jb2xvclN1cmZhY2V9O1xuICBwYWRkaW5nOiAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZzUwfSAxMDBweDtcbmBcblxuZXhwb3J0IGNvbnN0IHN0eWxlcyA9IHtcbiAgYmFzZSxcbiAgcmVhZHlGb3JEcm9wLFxuICBmaWxlRHJvcHBlZCxcbiAgYWN0aXZlRHJhZyxcbn1cbiJdfQ== */");
|
|
600
|
+
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=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFvQ3NCIiwiZmlsZSI6InN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50I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9IHtcbiAgYmFzZSxcbiAgcmVhZHlGb3JEcm9wLFxuICBmaWxlRHJvcHBlZCxcbiAgYWN0aXZlRHJhZyxcbn1cbiJdfQ== */");
|
|
601
|
+
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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUF5Q3VCIiwiZmlsZSI6InN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGN1c3RvbVByb3BlcnRpZXMgfSBmcm9tICdAY29tbWVyY2V0b29scy1mcm9udGVuZC91aS1raXQnXG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCdcblxudHlwZSBEcm9wQXJlYVN0YXRlID0gJ2RlZmF1bHQnIHwgJ2Vycm9yJyB8ICdhY3RpdmUnXG5cbmNvbnN0IGdldEJvcmRlckNvbG9yID0gKHN0YXRlOiBEcm9wQXJlYVN0YXRlKSA9PiB7XG4gIGNvbnN0IGJvcmRlckNvbG9ycyA9IHtcbiAgICBkZWZhdWx0OiAnIzkwOWRiYycsXG4gICAgZXJyb3I6ICcjZTYwMDUwJyxcbiAgICBhY3RpdmU6IGN1c3RvbVByb3BlcnRpZXMuY29sb3JQcmltYXJ5LFxuICB9XG5cbiAgcmV0dXJuIGJvcmRlckNvbG9yc1tzdGF0ZV0gfHwgYm9yZGVyQ29sb3JzLmRlZmF1bHRcbn1cblxuY29uc3QgZ2V0RGFzaGVkQm9yZGVyID0gKHN0YXRlOiBEcm9wQXJlYVN0YXRlID0gJ2RlZmF1bHQnKSA9PiB7XG4gIGNvbnN0IGNvbG9yID0gZ2V0Qm9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3JvdW5kLWNvbG9yOiAke2N1c3RvbVByb3BlcnRpZXMuY29sb3JQcmltYXJ5OTV9O1xuICBwYWRkaW5nOiAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZzUwfSAxMDBweDtcbmBcbmNvbnN0IGZpbGVEcm9wcGVkID0gY3NzYFxuICBiYWNrZ3JvdW5kLWltYWdlOiB1cmwoXFxcIiR7Z2V0RGFzaGVkQm9yZGVyKCl9XFxcIik7XG4gIGJhY2tncm91bmQtY29sb3I6ICR7Y3VzdG9tUHJvcGVydGllcy5jb2xvclN1cmZhY2V9O1xuICBwYWRkaW5nOiAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZzUwfSAxMDBweDtcbmBcblxuZXhwb3J0IGNvbnN0IHN0eWxlcyA9IHtcbiAgYmFzZSxcbiAgcmVhZHlGb3JEcm9wLFxuICBmaWxlRHJvcHBlZCxcbiAgYWN0aXZlRHJhZyxcbn1cbiJdfQ== */");
|
|
602
|
+
const styles = {
|
|
603
|
+
base,
|
|
604
|
+
readyForDrop,
|
|
605
|
+
fileDropped,
|
|
606
|
+
activeDrag
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
const DropWrapper = /*#__PURE__*/_styled("div", process.env.NODE_ENV === "production" ? {
|
|
610
|
+
target: "e16mdg0x0"
|
|
611
|
+
} : {
|
|
612
|
+
target: "e16mdg0x0",
|
|
613
|
+
label: "DropWrapper"
|
|
614
|
+
})(styles.base, " ", props => {
|
|
615
|
+
if (props.dropAreaState === 'ready-for-drop') {
|
|
616
|
+
return styles.readyForDrop;
|
|
617
|
+
}
|
|
618
|
+
if (props.dropAreaState === 'active-drag') {
|
|
619
|
+
return styles.activeDrag;
|
|
620
|
+
}
|
|
621
|
+
if (props.dropAreaState === 'file-dropped') {
|
|
622
|
+
return styles.fileDropped;
|
|
623
|
+
}
|
|
624
|
+
return getDefaultDropWrapperStyles(props.dropAreaState);
|
|
625
|
+
}, ";" + (process.env.NODE_ENV === "production" ? "" : "/*#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biAgICAgIHJldHVybiBzdHlsZXMuZmlsZURyb3BwZWRcbiAgICB9XG4gICAgcmV0dXJuIGdldERlZmF1bHREcm9wV3JhcHBlclN0eWxlcyhwcm9wcy5kcm9wQXJlYVN0YXRlKVxuICB9fVxuYFxuZnVuY3Rpb24gZ2V0RGVmYXVsdERyb3BXcmFwcGVyU3R5bGVzKF9kcm9wQXJlYVN0YXRlOiBuZXZlcikge1xuICByZXR1cm4gY3NzYGBcbn1cbiJdfQ== */"));
|
|
626
|
+
function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
627
|
+
return /*#__PURE__*/css(process.env.NODE_ENV === "production" ? "" : ";label:getDefaultDropWrapperStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRyb3AtYXJlYS13cmFwcGVyLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUF5QlkiLCJmaWxlIjoiZHJvcC1hcmVhLXdyYXBwZXIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgdHlwZSBEcm9wem9uZVJvb3RQcm9wcyB9IGZyb20gJ3JlYWN0LWRyb3B6b25lJ1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCdcbmltcG9ydCB7IHN0eWxlcyB9IGZyb20gJy4vc3R5bGVzJ1xuaW1wb3J0IHsgdHlwZSBEcm9wQXJlYVN0YXRlIH0gZnJvbSAnLi4vLi4vLi4vQHR5cGVzJ1xuXG5pbnRlcmZhY2UgRHJvcFdyYXBwZXJQcm9wcyBleHRlbmRzIERyb3B6b25lUm9vdFByb3BzIHtcbiAgZHJvcEFyZWFTdGF0ZTogRHJvcEFyZWFTdGF0ZVxufVxuZXhwb3J0IGNvbnN0IERyb3BXcmFwcGVyID0gc3R5bGVkLmRpdjxEcm9wV3JhcHBlclByb3BzPmBcbiAgJHtzdHlsZXMuYmFzZX1cbiAgJHsocHJvcHMpID0+IHtcbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ3JlYWR5LWZvci1kcm9wJykge1xuICAgICAgcmV0dXJuIHN0eWxlcy5yZWFkeUZvckRyb3BcbiAgICB9XG4gICAgaWYgKHByb3BzLmRyb3BBcmVhU3RhdGUgPT09ICdhY3RpdmUtZHJhZycpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuYWN0aXZlRHJhZ1xuICAgIH1cbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ2ZpbGUtZHJvcHBlZCcpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuZmlsZURyb3BwZWRcbiAgICB9XG4gICAgcmV0dXJuIGdldERlZmF1bHREcm9wV3JhcHBlclN0eWxlcyhwcm9wcy5kcm9wQXJlYVN0YXRlKVxuICB9fVxuYFxuZnVuY3Rpb24gZ2V0RGVmYXVsdERyb3BXcmFwcGVyU3R5bGVzKF9kcm9wQXJlYVN0YXRlOiBuZXZlcikge1xuICByZXR1cm4gY3NzYGBcbn1cbiJdfQ== */");
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
var ActiveDragDropArea = /*#__PURE__*/lazy(() => import('./active-drag-drop-area-d02e950a.esm.js' /* webpackChunkName: "active-drag-drop-area" */));
|
|
631
|
+
|
|
632
|
+
var EnabledDropArea = /*#__PURE__*/lazy(() => import('./enabled-drop-area-7516c43a.esm.js' /* webpackChunkName: "enabled-drop-area" */));
|
|
633
|
+
|
|
634
|
+
var FileDropped = /*#__PURE__*/lazy(() => import('./file-dropped-area-3ff29449.esm.js' /* webpackChunkName: "filed-dropped-area" */));
|
|
635
|
+
|
|
636
|
+
function getDropArea(_ref) {
|
|
637
|
+
let dropAreaState = _ref.dropAreaState,
|
|
638
|
+
isFileDropped = _ref.isFileDropped;
|
|
639
|
+
if (dropAreaState === 'ready-for-drop') {
|
|
640
|
+
return jsx(EnabledDropArea, {});
|
|
641
|
+
}
|
|
642
|
+
if (dropAreaState === 'file-dropped') {
|
|
643
|
+
return jsx(FileDropped, {});
|
|
644
|
+
}
|
|
645
|
+
if (dropAreaState === 'active-drag') {
|
|
646
|
+
return jsx(ActiveDragDropArea, {
|
|
647
|
+
isFileDropped: isFileDropped
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
return fallbackDropArea();
|
|
651
|
+
}
|
|
652
|
+
function fallbackDropArea(_invalidDropAreaState) {
|
|
653
|
+
return jsx(FileDropped, {});
|
|
654
|
+
}
|
|
655
|
+
function getDropAreaState(flags) {
|
|
656
|
+
if (flags.isDragActive) {
|
|
657
|
+
return 'active-drag';
|
|
658
|
+
}
|
|
659
|
+
if (flags.isReady) {
|
|
660
|
+
return 'file-dropped';
|
|
661
|
+
}
|
|
662
|
+
return 'ready-for-drop';
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
var messages$4 = defineMessages({
|
|
666
|
+
dragAndDropCSV: {
|
|
667
|
+
id: "DeleteResourcesModal.dragAndDropCSV",
|
|
668
|
+
defaultMessage: "Drag and drop CSV"
|
|
669
|
+
},
|
|
670
|
+
or: {
|
|
671
|
+
id: "DeleteResourcesModal.or",
|
|
672
|
+
defaultMessage: "or"
|
|
673
|
+
},
|
|
674
|
+
browseButton: {
|
|
675
|
+
id: "DeleteResourcesModal.browseFile",
|
|
676
|
+
defaultMessage: "Browse file"
|
|
677
|
+
},
|
|
678
|
+
uploadAndPreview: {
|
|
679
|
+
id: "DeleteResourcesModal.uploadAndPreview",
|
|
680
|
+
defaultMessage: "Upload and preview"
|
|
681
|
+
},
|
|
682
|
+
chooseFile: {
|
|
683
|
+
id: "DeleteResourcesModal.chooseFile",
|
|
684
|
+
defaultMessage: "Choose file"
|
|
685
|
+
},
|
|
686
|
+
fileUploadFailed: {
|
|
687
|
+
id: "DeleteResourcesModal.fileUploadFailed",
|
|
688
|
+
defaultMessage: "File upload failed"
|
|
689
|
+
},
|
|
690
|
+
fileFormatNotSupported: {
|
|
691
|
+
id: "DeleteResourcesModal.fileFormatNotSupported",
|
|
692
|
+
defaultMessage: "Invalid file format: The file is not in CSV format and cannot be processed."
|
|
693
|
+
},
|
|
694
|
+
tooManyFilesError: {
|
|
695
|
+
id: "DeleteResourcesModal.tooManyFilesError",
|
|
696
|
+
defaultMessage: "Multiple files detected: You can only drag and drop one file at a time."
|
|
697
|
+
},
|
|
698
|
+
genericError: {
|
|
699
|
+
id: "DeleteResourcesModal.genericError",
|
|
700
|
+
defaultMessage: "Error occurred: Please try uploading the file again or contact our support team for assistance."
|
|
701
|
+
},
|
|
702
|
+
dataType: {
|
|
703
|
+
id: "DeleteResourcesModal.dataType",
|
|
704
|
+
defaultMessage: "Data type"
|
|
705
|
+
},
|
|
706
|
+
instructions: {
|
|
707
|
+
id: "DeleteResourcesModal.instructions",
|
|
708
|
+
defaultMessage: "Instructions"
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
|
|
712
|
+
const useDeleteResourcesContext = () => {
|
|
713
|
+
const context = useContext(DeleteResourcesContext);
|
|
714
|
+
if (!context) {
|
|
715
|
+
throw new MissingDeleteResourcesProviderError();
|
|
716
|
+
}
|
|
717
|
+
return context;
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
var messages$3 = defineMessages({
|
|
721
|
+
fileSizeExceededTitle: {
|
|
722
|
+
id: "DeleteResourcesModal.sizeExceededTitle",
|
|
723
|
+
defaultMessage: "File size exceeded"
|
|
724
|
+
},
|
|
725
|
+
fileSizeExceededDescription: {
|
|
726
|
+
id: "DeleteResourcesModal.sizeExceededDescription",
|
|
727
|
+
defaultMessage: "The file exceeds the maximum allowed size of {fileSizeLimit} MB"
|
|
728
|
+
},
|
|
729
|
+
rowLimitExceededTitle: {
|
|
730
|
+
id: "DeleteResourcesModal.rowLimitExceededTitle",
|
|
731
|
+
defaultMessage: "Row limit exceeded"
|
|
732
|
+
},
|
|
733
|
+
rowLimitExceededDescription: {
|
|
734
|
+
id: "DeleteResourcesModal.rowLimitExceededDescription",
|
|
735
|
+
defaultMessage: "The file contains more than the allowable maximum of {rowLimit} rows"
|
|
736
|
+
},
|
|
737
|
+
dropAreaNotEnoughRowsTitle: {
|
|
738
|
+
id: "DeleteResourcesModal.dropAreaNotEnoughRowsTitle",
|
|
739
|
+
defaultMessage: "Invalid CSV file"
|
|
740
|
+
},
|
|
741
|
+
dropAreaNotEnoughRowsDescription: {
|
|
742
|
+
id: "DeleteResourcesModal.dropAreaNotEnoughRowsDescription",
|
|
743
|
+
defaultMessage: "Make sure the file contains a header and at least one row of data"
|
|
744
|
+
},
|
|
745
|
+
unexpectedError: {
|
|
746
|
+
id: "DeleteResourcesModal.unexpectedError",
|
|
747
|
+
defaultMessage: "An unexpected error occurred during the file upload. Please try again, or contact support if this error occurs again."
|
|
748
|
+
},
|
|
749
|
+
missingRequiredField: {
|
|
750
|
+
id: "DeleteResourcesModal.missingRequiredField",
|
|
751
|
+
defaultMessage: "Missing required field"
|
|
752
|
+
},
|
|
753
|
+
missingKeyError: {
|
|
754
|
+
id: "DeleteResourcesModal.missingKeyError",
|
|
755
|
+
defaultMessage: "The 'key' field is missing or incomplete in some rows. Please ensure every row has a 'key' value."
|
|
756
|
+
},
|
|
757
|
+
csvFormatErrorTitle: {
|
|
758
|
+
id: "DeleteResourcesModal.csvFormatErrorTitle",
|
|
759
|
+
defaultMessage: "Invalid CSV file"
|
|
760
|
+
},
|
|
761
|
+
csvFormatErrorDescription: {
|
|
762
|
+
id: "UnpublishProductsModal.csvFormatErrorDescription",
|
|
763
|
+
defaultMessage: "Your CSV file is not formatted correctly. Make sure the file contains only one column named 'key', which includes the product keys"
|
|
764
|
+
}
|
|
765
|
+
});
|
|
766
|
+
|
|
767
|
+
const IMPORT_TAG_KEYS = {
|
|
768
|
+
source: 'source'
|
|
769
|
+
};
|
|
770
|
+
const IMPORT_TAG_VALUES = {
|
|
771
|
+
fileUpload: 'file-upload'
|
|
772
|
+
};
|
|
773
|
+
const TAG_KEY_SOURCE_FILE_UPLOAD = `${IMPORT_TAG_KEYS.source}:${IMPORT_TAG_VALUES.fileUpload}`;
|
|
774
|
+
const FILE_SIZE_LIMIT_MB = 35;
|
|
775
|
+
const ROW_COUNT_LIMIT = 80_000;
|
|
776
|
+
const DOCUMENTATION_LINKS = {
|
|
777
|
+
product: 'https://docs.commercetools.com/merchant-center/product-list#bulk-delete-via-csv-import'
|
|
778
|
+
};
|
|
779
|
+
const TEMPLATE_DOWNLOAD_LINKS = {
|
|
780
|
+
product: 'https://docs.commercetools.com/merchant-center/downloads/product_delete_import_template.csv'
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
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; }
|
|
784
|
+
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; }
|
|
785
|
+
const addProxyPrefixToUrl = (uri, proxy) => {
|
|
786
|
+
return proxy ? `/proxy/${proxy}${uri}` : uri;
|
|
787
|
+
};
|
|
788
|
+
const fetchUsingXhr = _ref2 => {
|
|
789
|
+
let url = _ref2.url,
|
|
790
|
+
payload = _ref2.payload,
|
|
791
|
+
config = _ref2.config,
|
|
792
|
+
onProgress = _ref2.onProgress,
|
|
793
|
+
onSuccess = _ref2.onSuccess,
|
|
794
|
+
onError = _ref2.onError;
|
|
795
|
+
const options = createHttpClientOptions({
|
|
796
|
+
headers: _objectSpread$8({
|
|
797
|
+
'Content-Type': 'application/json'
|
|
798
|
+
}, config?.headers)
|
|
799
|
+
});
|
|
800
|
+
const xhr = new XMLHttpRequest();
|
|
801
|
+
xhr.open(config?.method, buildApiUrl(addProxyPrefixToUrl(url, config?.proxy)), true);
|
|
802
|
+
// Include cookies in the request
|
|
803
|
+
xhr.withCredentials = true;
|
|
804
|
+
if (options.headers) {
|
|
805
|
+
var _context;
|
|
806
|
+
_forEachInstanceProperty(_context = _Object$keys(options.headers)).call(_context, key => {
|
|
807
|
+
xhr.setRequestHeader(key, options.headers[key]);
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
xhr.upload.onprogress = function (event) {
|
|
811
|
+
if (event.lengthComputable) {
|
|
812
|
+
const percentComplete = event.loaded / event.total * 100;
|
|
813
|
+
onProgress(percentComplete);
|
|
814
|
+
}
|
|
815
|
+
};
|
|
816
|
+
xhr.onload = function () {
|
|
817
|
+
const data = JSON.parse(xhr.responseText);
|
|
818
|
+
// Code copied from `executeHttpClientRequest` to replicate the same behavior
|
|
819
|
+
const refreshedSessionToken = xhr.getResponseHeader('x-refreshed-session-token');
|
|
820
|
+
if (refreshedSessionToken) {
|
|
821
|
+
oidcStorage.setActiveSession(refreshedSessionToken);
|
|
822
|
+
}
|
|
823
|
+
if (xhr.status >= 200 && xhr.status < 300) {
|
|
824
|
+
onSuccess(data);
|
|
825
|
+
} else {
|
|
826
|
+
onError(new HttpError(xhr.status, xhr.statusText, data));
|
|
827
|
+
}
|
|
828
|
+
};
|
|
829
|
+
xhr.onerror = function () {
|
|
830
|
+
const errorData = JSON.parse(xhr.responseText);
|
|
831
|
+
onError(new HttpError(xhr.status, xhr.statusText, errorData));
|
|
832
|
+
};
|
|
833
|
+
xhr.onabort = function () {
|
|
834
|
+
onError(new DOMException('Aborted', 'AbortError'));
|
|
835
|
+
};
|
|
836
|
+
xhr.send(payload);
|
|
837
|
+
return xhr;
|
|
838
|
+
};
|
|
839
|
+
|
|
840
|
+
function uploadFileForImport(_ref) {
|
|
841
|
+
let projectKey = _ref.projectKey,
|
|
842
|
+
containerKey = _ref.containerKey,
|
|
843
|
+
resourceType = _ref.resourceType,
|
|
844
|
+
file = _ref.file,
|
|
845
|
+
abortSignal = _ref.abortSignal,
|
|
846
|
+
onSuccess = _ref.onSuccess,
|
|
847
|
+
onProgress = _ref.onProgress,
|
|
848
|
+
onError = _ref.onError;
|
|
849
|
+
const uri = getFileUploadURL({
|
|
850
|
+
projectKey,
|
|
851
|
+
containerKey,
|
|
852
|
+
resourceType
|
|
853
|
+
});
|
|
854
|
+
const formData = new FormData();
|
|
855
|
+
formData.append('file', file, file.name);
|
|
856
|
+
return fetchUsingXhr({
|
|
857
|
+
url: uri,
|
|
858
|
+
payload: formData,
|
|
859
|
+
config: {
|
|
860
|
+
abortSignal,
|
|
861
|
+
proxy: MC_API_PROXY_TARGETS.IMPORT,
|
|
862
|
+
method: 'POST',
|
|
863
|
+
headers: {
|
|
864
|
+
'Content-Type': null
|
|
865
|
+
}
|
|
866
|
+
},
|
|
867
|
+
onProgress,
|
|
868
|
+
onSuccess,
|
|
869
|
+
onError
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
const useUpload = () => {
|
|
874
|
+
const intl = useIntl();
|
|
875
|
+
const projectKey = useApplicationContext(context => context.project?.key);
|
|
876
|
+
const _useDeleteResourcesCo = useDeleteResourcesContext(),
|
|
877
|
+
resourceType = _useDeleteResourcesCo.resourceType,
|
|
878
|
+
state = _useDeleteResourcesCo.state,
|
|
879
|
+
actions = _useDeleteResourcesCo.actions;
|
|
880
|
+
const asyncDispatch = useAsyncDispatch();
|
|
881
|
+
const showNotification = useShowNotification();
|
|
882
|
+
React.useEffect(() => {
|
|
883
|
+
return () => {
|
|
884
|
+
if (state.abortController) state.abortController.abort();
|
|
885
|
+
};
|
|
886
|
+
}, [state.abortController]);
|
|
887
|
+
const isFileValid = async file => {
|
|
888
|
+
const errors = [];
|
|
889
|
+
const rowCount = await getRowCount(file);
|
|
890
|
+
if (rowCount < 1) errors.push({
|
|
891
|
+
title: intl.formatMessage(messages$3.dropAreaNotEnoughRowsTitle),
|
|
892
|
+
description: intl.formatMessage(messages$3.dropAreaNotEnoughRowsDescription)
|
|
893
|
+
});
|
|
894
|
+
if (file.size > toBytes(FILE_SIZE_LIMIT_MB)) errors.push({
|
|
895
|
+
title: intl.formatMessage(messages$3.fileSizeExceededTitle),
|
|
896
|
+
description: intl.formatMessage(messages$3.fileSizeExceededDescription, {
|
|
897
|
+
fileSizeLimit: intl.formatNumber(FILE_SIZE_LIMIT_MB)
|
|
898
|
+
})
|
|
899
|
+
});
|
|
900
|
+
if (!(await hasSingleKeyColumn(file))) {
|
|
901
|
+
errors.push({
|
|
902
|
+
title: intl.formatMessage(messages$3.csvFormatErrorTitle),
|
|
903
|
+
description: intl.formatMessage(messages$3.csvFormatErrorDescription)
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
if (rowCount > ROW_COUNT_LIMIT) errors.push({
|
|
907
|
+
title: intl.formatMessage(messages$3.rowLimitExceededTitle),
|
|
908
|
+
description: intl.formatMessage(messages$3.rowLimitExceededDescription, {
|
|
909
|
+
rowLimit: intl.formatNumber(ROW_COUNT_LIMIT)
|
|
910
|
+
})
|
|
911
|
+
});
|
|
912
|
+
if (errors.length > 0) {
|
|
913
|
+
actions.setFileUploadErrors(errors);
|
|
914
|
+
actions.setCurrentStep('upload-error');
|
|
915
|
+
return false;
|
|
916
|
+
}
|
|
917
|
+
return true;
|
|
918
|
+
};
|
|
919
|
+
const handleUploadError = error => {
|
|
920
|
+
if (isAbortError(error)) {
|
|
921
|
+
actions.cancelImport();
|
|
922
|
+
return;
|
|
923
|
+
}
|
|
924
|
+
if (error instanceof HttpError) {
|
|
925
|
+
if (error.errorData?.code === 'MISSING_KEY_ERROR') {
|
|
926
|
+
actions.setFileUploadErrors([{
|
|
927
|
+
title: intl.formatMessage(messages$3.missingRequiredField),
|
|
928
|
+
description: intl.formatMessage(messages$3.missingKeyError)
|
|
929
|
+
}]);
|
|
930
|
+
actions.setCurrentStep('upload-error');
|
|
931
|
+
} else {
|
|
932
|
+
actions.cancelImport();
|
|
933
|
+
showNotification({
|
|
934
|
+
kind: 'error',
|
|
935
|
+
domain: DOMAINS.PAGE,
|
|
936
|
+
text: intl.formatMessage(messages$3.unexpectedError)
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
} else {
|
|
940
|
+
actions.cancelImport();
|
|
941
|
+
showNotification({
|
|
942
|
+
kind: 'error',
|
|
943
|
+
domain: DOMAINS.PAGE,
|
|
944
|
+
text: String(error)
|
|
945
|
+
});
|
|
946
|
+
reportErrorToSentry(new Error('Upload File Error: An unexpected issue occurred while uploading the file'), {
|
|
947
|
+
extra: {
|
|
948
|
+
error,
|
|
949
|
+
projectKey,
|
|
950
|
+
containerKey: state.containerKey,
|
|
951
|
+
fileSizeInBytes: state.droppedFile?.size
|
|
952
|
+
}
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
};
|
|
956
|
+
const handleUploadAndValidation = async () => {
|
|
957
|
+
if (!projectKey || !state.droppedFile) return;
|
|
958
|
+
const canUpload = await isFileValid(state.droppedFile);
|
|
959
|
+
if (!canUpload) return;
|
|
960
|
+
actions.setCurrentStep('uploading');
|
|
961
|
+
const containerKey = encodeFileNameWithTimestampToContainerKey(state.droppedFile.name);
|
|
962
|
+
actions.setContainerKey(containerKey);
|
|
963
|
+
try {
|
|
964
|
+
await createImportContainerForFileUpload({
|
|
965
|
+
key: containerKey,
|
|
966
|
+
tags: [TAG_KEY_SOURCE_FILE_UPLOAD],
|
|
967
|
+
resourceType
|
|
968
|
+
}, projectKey, asyncDispatch);
|
|
969
|
+
const newAbortController = uploadFileForImport({
|
|
970
|
+
projectKey,
|
|
971
|
+
containerKey,
|
|
972
|
+
resourceType,
|
|
973
|
+
file: state.droppedFile,
|
|
974
|
+
onSuccess: fileUploadResponse => {
|
|
975
|
+
actions.setUploadFileResponse(fileUploadResponse);
|
|
976
|
+
actions.setCurrentStep('upload-preview');
|
|
977
|
+
},
|
|
978
|
+
onProgress: progress => {
|
|
979
|
+
actions.setProgress(progress);
|
|
980
|
+
},
|
|
981
|
+
onError: error => {
|
|
982
|
+
deleteImportContainer(projectKey, containerKey, asyncDispatch);
|
|
983
|
+
handleUploadError(error);
|
|
984
|
+
}
|
|
985
|
+
});
|
|
986
|
+
actions.setAbortController(newAbortController);
|
|
987
|
+
} catch (error) {
|
|
988
|
+
deleteImportContainer(projectKey, containerKey, asyncDispatch);
|
|
989
|
+
handleUploadError(error);
|
|
990
|
+
}
|
|
991
|
+
};
|
|
992
|
+
return {
|
|
993
|
+
handleUploadAndValidation
|
|
994
|
+
};
|
|
995
|
+
};
|
|
996
|
+
|
|
997
|
+
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; }
|
|
998
|
+
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context3 = ownKeys$7(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context4 = ownKeys$7(Object(t))).call(_context4, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
999
|
+
const FileDropArea = () => {
|
|
1000
|
+
const intl = useIntl();
|
|
1001
|
+
const _useDeleteResourcesCo = useDeleteResourcesContext(),
|
|
1002
|
+
state = _useDeleteResourcesCo.state,
|
|
1003
|
+
actions = _useDeleteResourcesCo.actions;
|
|
1004
|
+
const showNotification = useShowNotification();
|
|
1005
|
+
const onDrop = React.useCallback(_ref => {
|
|
1006
|
+
let _ref2 = _slicedToArray(_ref, 1),
|
|
1007
|
+
file = _ref2[0];
|
|
1008
|
+
if (!file) return;
|
|
1009
|
+
actions.setDroppedFile(file);
|
|
1010
|
+
}, [actions]);
|
|
1011
|
+
const _useDropzone = useDropzone({
|
|
1012
|
+
onDrop,
|
|
1013
|
+
multiple: false,
|
|
1014
|
+
accept: {
|
|
1015
|
+
'text/csv': ['.csv']
|
|
1016
|
+
},
|
|
1017
|
+
onDropRejected: _ref3 => {
|
|
1018
|
+
var _context, _context2;
|
|
1019
|
+
let _ref4 = _slicedToArray(_ref3, 1),
|
|
1020
|
+
rejectedFile = _ref4[0];
|
|
1021
|
+
if (_someInstanceProperty(_context = rejectedFile.errors).call(_context, error => error.code === 'too-many-files')) {
|
|
1022
|
+
showNotification({
|
|
1023
|
+
kind: 'error',
|
|
1024
|
+
domain: DOMAINS.PAGE,
|
|
1025
|
+
text: intl.formatMessage(messages$4.tooManyFilesError)
|
|
1026
|
+
});
|
|
1027
|
+
return;
|
|
1028
|
+
}
|
|
1029
|
+
if (_someInstanceProperty(_context2 = rejectedFile.errors).call(_context2, error => error.code === 'file-invalid-type')) {
|
|
1030
|
+
showNotification({
|
|
1031
|
+
kind: 'error',
|
|
1032
|
+
domain: DOMAINS.PAGE,
|
|
1033
|
+
text: intl.formatMessage(messages$4.fileFormatNotSupported)
|
|
1034
|
+
});
|
|
1035
|
+
} else {
|
|
1036
|
+
showNotification({
|
|
1037
|
+
kind: 'error',
|
|
1038
|
+
domain: DOMAINS.PAGE,
|
|
1039
|
+
text: intl.formatMessage(messages$4.genericError)
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
}),
|
|
1044
|
+
getRootProps = _useDropzone.getRootProps,
|
|
1045
|
+
getInputProps = _useDropzone.getInputProps,
|
|
1046
|
+
isDragActive = _useDropzone.isDragActive;
|
|
1047
|
+
const dropAreaState = React.useMemo(() => getDropAreaState({
|
|
1048
|
+
isReady: Boolean(state.droppedFile),
|
|
1049
|
+
isDragActive
|
|
1050
|
+
}), [state.droppedFile, isDragActive]);
|
|
1051
|
+
const dropArea = getDropArea({
|
|
1052
|
+
dropAreaState,
|
|
1053
|
+
isFileDropped: Boolean(state.droppedFile)
|
|
1054
|
+
});
|
|
1055
|
+
return jsxs(DropWrapper, _objectSpread$7(_objectSpread$7({
|
|
1056
|
+
role: "presentation"
|
|
1057
|
+
}, getRootProps()), {}, {
|
|
1058
|
+
dropAreaState: dropAreaState,
|
|
1059
|
+
children: [jsx("input", _objectSpread$7({
|
|
1060
|
+
"data-testid": "file-input"
|
|
1061
|
+
}, getInputProps())), jsx(Constraints.Horizontal, {
|
|
1062
|
+
children: dropArea
|
|
1063
|
+
})]
|
|
1064
|
+
}));
|
|
1065
|
+
};
|
|
1066
|
+
|
|
1067
|
+
var messages$2 = defineMessages({
|
|
1068
|
+
fileUploadInstruction: {
|
|
1069
|
+
id: "DeleteResourcesModal.fileUploadInstruction",
|
|
1070
|
+
defaultMessage: "The CSV file must contain the {resourceType} keys to be deleted under the header 'key'."
|
|
1071
|
+
},
|
|
1072
|
+
fileUploadInstructionForMaxFileSize: {
|
|
1073
|
+
id: "DeleteResourcesModal.fileUploadInstructionForMaxFileSize",
|
|
1074
|
+
defaultMessage: "Maximum file size is {maxFileSize} MB with a limit of {maxRowCount} rows. Download <csvTemplateLink>the CSV template</csvTemplateLink> or refer to <documentationLink>the documentation</documentationLink>."
|
|
1075
|
+
},
|
|
1076
|
+
unpublishNote: {
|
|
1077
|
+
id: "DeleteResourcesModal.unpublishNote",
|
|
1078
|
+
defaultMessage: "Please note that published products <b>must be unpublished</b> before they can be deleted."
|
|
1079
|
+
}
|
|
1080
|
+
});
|
|
1081
|
+
|
|
1082
|
+
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; }
|
|
1083
|
+
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$6(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$6(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1084
|
+
const Instructions = () => {
|
|
1085
|
+
const intl = useIntl();
|
|
1086
|
+
const _useDeleteResourcesCo = useDeleteResourcesContext(),
|
|
1087
|
+
resourceType = _useDeleteResourcesCo.resourceType;
|
|
1088
|
+
const documentTemplateLink = TEMPLATE_DOWNLOAD_LINKS[resourceType];
|
|
1089
|
+
const documentationLink = DOCUMENTATION_LINKS[resourceType];
|
|
1090
|
+
return jsxs(Spacings.Stack, {
|
|
1091
|
+
scale: "m",
|
|
1092
|
+
children: [jsxs(Text.Body, {
|
|
1093
|
+
children: [intl.formatMessage(messages$2.fileUploadInstruction, {
|
|
1094
|
+
resourceType: intl.formatMessage(resourceTypeToMessage(resourceType))
|
|
1095
|
+
}), ' ', intl.formatMessage(messages$2.unpublishNote, {
|
|
1096
|
+
b: msg => jsx("b", {
|
|
1097
|
+
children: msg
|
|
1098
|
+
})
|
|
1099
|
+
})]
|
|
1100
|
+
}), jsx(Text.Body, {
|
|
1101
|
+
intlMessage: _objectSpread$6(_objectSpread$6({}, messages$2.fileUploadInstructionForMaxFileSize), {}, {
|
|
1102
|
+
values: {
|
|
1103
|
+
maxFileSize: intl.formatNumber(FILE_SIZE_LIMIT_MB),
|
|
1104
|
+
maxRowCount: intl.formatNumber(ROW_COUNT_LIMIT),
|
|
1105
|
+
csvTemplateLink: msg => jsx(Link, {
|
|
1106
|
+
tone: "secondary",
|
|
1107
|
+
isExternal: true,
|
|
1108
|
+
to: documentTemplateLink,
|
|
1109
|
+
children: msg
|
|
1110
|
+
}),
|
|
1111
|
+
documentationLink: msg => jsx(Link, {
|
|
1112
|
+
tone: "secondary",
|
|
1113
|
+
isExternal: true,
|
|
1114
|
+
to: documentationLink,
|
|
1115
|
+
children: msg
|
|
1116
|
+
})
|
|
1117
|
+
}
|
|
1118
|
+
})
|
|
1119
|
+
})]
|
|
1120
|
+
});
|
|
1121
|
+
};
|
|
1122
|
+
|
|
1123
|
+
const Upload = () => {
|
|
1124
|
+
const _useDeleteResourcesCo = useDeleteResourcesContext(),
|
|
1125
|
+
state = _useDeleteResourcesCo.state,
|
|
1126
|
+
onClose = _useDeleteResourcesCo.onClose;
|
|
1127
|
+
const intl = useIntl();
|
|
1128
|
+
const _useUpload = useUpload(),
|
|
1129
|
+
handleUploadAndValidation = _useUpload.handleUploadAndValidation;
|
|
1130
|
+
return jsx(FormDialog, {
|
|
1131
|
+
size: 16,
|
|
1132
|
+
isOpen: true,
|
|
1133
|
+
title: intl.formatMessage(sharedMessages.deleteModalTitle),
|
|
1134
|
+
labelPrimary: intl.formatMessage(messages$4.uploadAndPreview),
|
|
1135
|
+
onPrimaryButtonClick: handleUploadAndValidation,
|
|
1136
|
+
isPrimaryButtonDisabled: !Boolean(state.droppedFile),
|
|
1137
|
+
onSecondaryButtonClick: () => onClose({
|
|
1138
|
+
shouldDeleteImportContainer: true
|
|
1139
|
+
}),
|
|
1140
|
+
onClose: () => onClose({
|
|
1141
|
+
shouldDeleteImportContainer: true
|
|
1142
|
+
}),
|
|
1143
|
+
children: jsx(Masking.Unmask, {
|
|
1144
|
+
children: jsxs(Spacings.Stack, {
|
|
1145
|
+
scale: "m",
|
|
1146
|
+
children: [jsx(Instructions, {}), jsx(FileDropArea, {})]
|
|
1147
|
+
})
|
|
1148
|
+
})
|
|
1149
|
+
});
|
|
1150
|
+
};
|
|
1151
|
+
|
|
1152
|
+
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; }
|
|
1153
|
+
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; }
|
|
1154
|
+
var FileIcon = function FileIcon(props) {
|
|
1155
|
+
return jsxs("svg", _objectSpread$5(_objectSpread$5({}, props), {}, {
|
|
1156
|
+
children: [jsx("mask", {
|
|
1157
|
+
id: "a",
|
|
1158
|
+
style: {
|
|
1159
|
+
maskType: "alpha"
|
|
1160
|
+
},
|
|
1161
|
+
maskUnits: "userSpaceOnUse",
|
|
1162
|
+
x: "0",
|
|
1163
|
+
y: "0",
|
|
1164
|
+
width: "32",
|
|
1165
|
+
height: "32",
|
|
1166
|
+
children: jsx("path", {
|
|
1167
|
+
fill: "#D9D9D9",
|
|
1168
|
+
d: "M0 0h32v32H0z"
|
|
1169
|
+
})
|
|
1170
|
+
}), jsx("g", {
|
|
1171
|
+
mask: "url(#a)",
|
|
1172
|
+
children: jsx("path", {
|
|
1173
|
+
d: "M14.667 25.333h2.666v-5.566l2.134 2.133 1.866-1.9L16 14.667 10.667 20l1.9 1.867 2.1-2.1v5.566Zm-6.667 4a2.568 2.568 0 0 1-1.883-.783 2.568 2.568 0 0 1-.784-1.883V5.333c0-.733.261-1.36.784-1.883A2.568 2.568 0 0 1 8 2.667h10.667l8 8v16c0 .733-.261 1.36-.784 1.883a2.568 2.568 0 0 1-1.883.783H8ZM17.333 12H24l-6.667-6.667V12Z",
|
|
1174
|
+
fill: "#B1ACFF"
|
|
1175
|
+
})
|
|
1176
|
+
})]
|
|
1177
|
+
}));
|
|
1178
|
+
};
|
|
1179
|
+
FileIcon.defaultProps = {
|
|
1180
|
+
width: "32",
|
|
1181
|
+
height: "32",
|
|
1182
|
+
fill: "none",
|
|
1183
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1184
|
+
};
|
|
1185
|
+
const Uploading = () => {
|
|
1186
|
+
const intl = useIntl();
|
|
1187
|
+
const _useDeleteResourcesCo = useDeleteResourcesContext(),
|
|
1188
|
+
state = _useDeleteResourcesCo.state,
|
|
1189
|
+
actions = _useDeleteResourcesCo.actions,
|
|
1190
|
+
onClose = _useDeleteResourcesCo.onClose;
|
|
1191
|
+
if (state.droppedFile?.name) return jsx(InfoDialog, {
|
|
1192
|
+
size: 16,
|
|
1193
|
+
isOpen: true,
|
|
1194
|
+
title: intl.formatMessage(sharedMessages.deleteModalTitle),
|
|
1195
|
+
onClose: () => onClose({
|
|
1196
|
+
shouldDeleteImportContainer: true
|
|
1197
|
+
}),
|
|
1198
|
+
children: jsxs(Spacings.Stack, {
|
|
1199
|
+
scale: "m",
|
|
1200
|
+
children: [jsxs(Spacings.Inline, {
|
|
1201
|
+
alignItems: "center",
|
|
1202
|
+
justifyContent: "space-between",
|
|
1203
|
+
children: [jsxs(Spacings.Inline, {
|
|
1204
|
+
alignItems: "center",
|
|
1205
|
+
children: [jsx(FileIcon, {}), jsx(Spacings.Inline, {
|
|
1206
|
+
children: jsx(Constraints.Horizontal, {
|
|
1207
|
+
max: 10,
|
|
1208
|
+
children: jsx(Text.Body, {
|
|
1209
|
+
truncate: true,
|
|
1210
|
+
fontWeight: "bold",
|
|
1211
|
+
children: state.droppedFile.name
|
|
1212
|
+
})
|
|
1213
|
+
})
|
|
1214
|
+
}), jsxs(Text.Body, {
|
|
1215
|
+
tone: "secondary",
|
|
1216
|
+
children: ["(", intl.formatNumber(convertFileSizeToKB(state.droppedFile.size)), ' ', "KB)"]
|
|
1217
|
+
})]
|
|
1218
|
+
}), jsx(SecondaryButton, {
|
|
1219
|
+
tone: "secondary",
|
|
1220
|
+
size: "medium",
|
|
1221
|
+
label: intl.formatMessage(sharedMessages.cancel),
|
|
1222
|
+
onClick: () => {
|
|
1223
|
+
actions.setCurrentStep('upload');
|
|
1224
|
+
state.abortController.abort();
|
|
1225
|
+
}
|
|
1226
|
+
})]
|
|
1227
|
+
}), jsx(ProgressBar, {
|
|
1228
|
+
barWidth: "scale",
|
|
1229
|
+
height: "10",
|
|
1230
|
+
progress: state.progress
|
|
1231
|
+
}), jsx("div", {})]
|
|
1232
|
+
})
|
|
1233
|
+
});
|
|
1234
|
+
return null;
|
|
1235
|
+
};
|
|
1236
|
+
|
|
1237
|
+
var messages$1 = defineMessages({
|
|
1238
|
+
uploadNewFile: {
|
|
1239
|
+
id: "DeleteResourcesModal.uploadNewFile",
|
|
1240
|
+
defaultMessage: "Upload new file"
|
|
1241
|
+
},
|
|
1242
|
+
uploadErrorDescription: {
|
|
1243
|
+
id: "DeleteResourcesModal.uploadError",
|
|
1244
|
+
defaultMessage: "There {errorsCount, plural, one {is <b>1</b> error} other {are <b>{errorsCount}</b> errors}} detected while uploading the file \"{fileName}\"."
|
|
1245
|
+
},
|
|
1246
|
+
errorType: {
|
|
1247
|
+
id: "DeleteResourcesModal.errorType",
|
|
1248
|
+
defaultMessage: "Error type"
|
|
1249
|
+
},
|
|
1250
|
+
details: {
|
|
1251
|
+
id: "DeleteResourcesModal.details",
|
|
1252
|
+
defaultMessage: "Details"
|
|
1253
|
+
}
|
|
1254
|
+
});
|
|
1255
|
+
|
|
1256
|
+
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; }
|
|
1257
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys$4(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys$4(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1258
|
+
const getColumns = () => [{
|
|
1259
|
+
key: 'errorType',
|
|
1260
|
+
label: jsx(FormattedMessage, _objectSpread$4({}, messages$1.errorType)),
|
|
1261
|
+
width: 'max-content'
|
|
1262
|
+
}, {
|
|
1263
|
+
key: 'details',
|
|
1264
|
+
label: jsx(FormattedMessage, _objectSpread$4({}, messages$1.details))
|
|
1265
|
+
}];
|
|
1266
|
+
const UploadErrorTable = props => {
|
|
1267
|
+
var _context;
|
|
1268
|
+
const pagination = usePaginationState({
|
|
1269
|
+
perPage: 10
|
|
1270
|
+
});
|
|
1271
|
+
const startIndex = (pagination.page.value - 1) * pagination.perPage.value;
|
|
1272
|
+
const endIndex = startIndex + pagination.perPage.value;
|
|
1273
|
+
const currentPageRows = _sliceInstanceProperty(_context = props.rows).call(_context, startIndex, endIndex);
|
|
1274
|
+
const shouldShowPagination = props.rows.length > pagination.perPage.value;
|
|
1275
|
+
return jsxs(Spacings.Stack, {
|
|
1276
|
+
scale: "l",
|
|
1277
|
+
children: [jsx(DataTable, {
|
|
1278
|
+
verticalCellAlignment: "center",
|
|
1279
|
+
isCondensed: true,
|
|
1280
|
+
rows: currentPageRows,
|
|
1281
|
+
columns: getColumns(),
|
|
1282
|
+
itemRenderer: itemRenderer
|
|
1283
|
+
}), shouldShowPagination && jsx(PageNavigator, {
|
|
1284
|
+
onPageChange: pagination.page.onChange,
|
|
1285
|
+
page: pagination.page.value,
|
|
1286
|
+
totalPages: Math.ceil(props.rows.length / pagination.perPage.value)
|
|
1287
|
+
})]
|
|
1288
|
+
});
|
|
1289
|
+
};
|
|
1290
|
+
function itemRenderer(item, column) {
|
|
1291
|
+
switch (column.key) {
|
|
1292
|
+
case 'errorType':
|
|
1293
|
+
return jsx(Stamp, {
|
|
1294
|
+
isCondensed: true,
|
|
1295
|
+
label: item.title,
|
|
1296
|
+
tone: "critical"
|
|
1297
|
+
});
|
|
1298
|
+
case 'details':
|
|
1299
|
+
return jsx(Text.Body, {
|
|
1300
|
+
children: item.description
|
|
1301
|
+
});
|
|
1302
|
+
default:
|
|
1303
|
+
return null;
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
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; }
|
|
1308
|
+
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; }
|
|
1309
|
+
const UploadErrorsModal = () => {
|
|
1310
|
+
const intl = useIntl();
|
|
1311
|
+
const _useDeleteResourcesCo = useDeleteResourcesContext(),
|
|
1312
|
+
state = _useDeleteResourcesCo.state,
|
|
1313
|
+
actions = _useDeleteResourcesCo.actions,
|
|
1314
|
+
onClose = _useDeleteResourcesCo.onClose;
|
|
1315
|
+
const errorsCount = state.fileUploadErrors.length;
|
|
1316
|
+
return jsx(InfoDialog, {
|
|
1317
|
+
size: 16,
|
|
1318
|
+
isOpen: true,
|
|
1319
|
+
title: intl.formatMessage(sharedMessages.deleteModalTitle),
|
|
1320
|
+
onClose: () => onClose(),
|
|
1321
|
+
children: jsx(Masking.Unmask, {
|
|
1322
|
+
children: jsxs(Spacings.Stack, {
|
|
1323
|
+
scale: "l",
|
|
1324
|
+
children: [jsx(Masking.Mask, {
|
|
1325
|
+
children: jsx(Text.Body, {
|
|
1326
|
+
intlMessage: _objectSpread$3(_objectSpread$3({}, messages$1.uploadErrorDescription), {}, {
|
|
1327
|
+
values: {
|
|
1328
|
+
fileName: state.droppedFile?.name,
|
|
1329
|
+
errorsCount: intl.formatNumber(errorsCount),
|
|
1330
|
+
b: getBold$2
|
|
1331
|
+
}
|
|
1332
|
+
})
|
|
1333
|
+
})
|
|
1334
|
+
}), jsx(UploadErrorTable, {
|
|
1335
|
+
rows: mapFileUploadErrorsToUploadFileErrorRows(state.fileUploadErrors)
|
|
1336
|
+
}), jsxs(Spacings.Inline, {
|
|
1337
|
+
scale: "m",
|
|
1338
|
+
justifyContent: "flex-end",
|
|
1339
|
+
children: [jsx(SecondaryButton, {
|
|
1340
|
+
label: intl.formatMessage(sharedMessages.cancel),
|
|
1341
|
+
onClick: () => onClose()
|
|
1342
|
+
}), jsx(PrimaryButton, {
|
|
1343
|
+
iconLeft: jsx(ImportIcon, {}),
|
|
1344
|
+
label: intl.formatMessage(messages$1.uploadNewFile),
|
|
1345
|
+
onClick: () => actions.uploadNewFile()
|
|
1346
|
+
})]
|
|
1347
|
+
})]
|
|
1348
|
+
})
|
|
1349
|
+
})
|
|
1350
|
+
});
|
|
1351
|
+
};
|
|
1352
|
+
function getBold$2(msg) {
|
|
1353
|
+
return jsx(Text.Body, {
|
|
1354
|
+
as: "span",
|
|
1355
|
+
isBold: true,
|
|
1356
|
+
children: msg
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
var messages = defineMessages({
|
|
1361
|
+
continue: {
|
|
1362
|
+
id: "DeleteResourcesModal.continue",
|
|
1363
|
+
defaultMessage: "Continue"
|
|
1364
|
+
},
|
|
1365
|
+
heresAPreview: {
|
|
1366
|
+
id: "DeleteResourcesModal.heresAPreview",
|
|
1367
|
+
defaultMessage: "Here's a preview:"
|
|
1368
|
+
},
|
|
1369
|
+
resourcesToBeDeleted: {
|
|
1370
|
+
id: "DeleteResourcesModal.resourcesToBeDeleted",
|
|
1371
|
+
defaultMessage: "{count, plural, one {<b>{count}</b> {resourceType} to be deleted} other {<b>{count}</b> {resourceTypePlural} to be deleted}}"
|
|
1372
|
+
},
|
|
1373
|
+
confirmationQuestion: {
|
|
1374
|
+
id: "DeleteResourcesModal.confirmationQuestion",
|
|
1375
|
+
defaultMessage: "Are you sure you want to delete the {resourceTypePlural}?"
|
|
1376
|
+
},
|
|
1377
|
+
confirmationText: {
|
|
1378
|
+
id: "DeleteResourcesModal.confirmationText",
|
|
1379
|
+
defaultMessage: "{count, plural, one {You are about to delete <b>{count}</b> {resourceType} in the project: <b>{projectName}</b>.} other {You are about to deleted <b>{count}</b> {resourceTypePlural} in the project: <b>{projectName}</b>.}}"
|
|
1380
|
+
},
|
|
1381
|
+
cannotBeUndoneNote: {
|
|
1382
|
+
id: "DeleteResourcesModal.cannotBeUndoneNote",
|
|
1383
|
+
defaultMessage: "This action cannot be undone."
|
|
1384
|
+
},
|
|
1385
|
+
importStarted: {
|
|
1386
|
+
id: "DeleteResourcesModal.importStarted",
|
|
1387
|
+
defaultMessage: "<b>Your import for bulk delete has started.</b><newline></newline>Go to <logsLink>Import logs</logsLink> to view the progress."
|
|
1388
|
+
},
|
|
1389
|
+
preparingImport: {
|
|
1390
|
+
id: "DeleteResourcesModal.preparingImport",
|
|
1391
|
+
defaultMessage: "<b>Prepare bulk delete.</b><newline></newline>Once preparation is complete, you can track the progress <logsLink>in the Import logs</logsLink>. The data will be deleted after the import is finalized."
|
|
1392
|
+
}
|
|
1393
|
+
});
|
|
1394
|
+
|
|
1395
|
+
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; }
|
|
1396
|
+
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; }
|
|
1397
|
+
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)."; }
|
|
1398
|
+
const getNewLine = () => jsx("br", {});
|
|
1399
|
+
const getImportLogsLink = (msg, projectKey) => jsx(Link, {
|
|
1400
|
+
to: `/${projectKey}/operations/import/logs`,
|
|
1401
|
+
children: msg
|
|
1402
|
+
});
|
|
1403
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
1404
|
+
name: "1vs9i7r",
|
|
1405
|
+
styles: "width:360px"
|
|
1406
|
+
} : {
|
|
1407
|
+
name: "g36yzl-ImportRunningTextNotification",
|
|
1408
|
+
styles: "width:360px;label:ImportRunningTextNotification;/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRlbGV0ZS1yZXNvdXJjZXMtY29uZmlybW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RpZmljYXRpb24oKVxuXG4gIGNvbnN0IG9uU3RhcnRJbXBvcnQgPSBhc3luYyAoKSA9PiB7XG4gICAgdHJ5IHtcbiAgICAgIGNvbnN0IGNhbkNvbmZpcm0gPVxuICAgICAgICBwcm9qZWN0S2V5ICYmIHN0YXRlLmNvbnRhaW5lcktleSAmJiBzdGF0ZS5kcm9wcGVkRmlsZT8ubmFtZVxuICAgICAgaWYgKCFjYW5Db25maXJtKSByZXR1cm5cbiAgICAgIG9uQ2xvc2UoKVxuICAgICAgc2hvd05vdGlmaWNhdGlvbihcbiAgICAgICAge1xuICAgICAgICAgIGtpbmQ6ICdpbmZvJyxcbiAgICAgICAgICBkb21haW46IERPTUFJTlMuU0lERSxcbiAgICAgICAgICAvLyBAdHMtaWdub3JlXG4gICAgICAgICAgdGV4dDogPEltcG9ydFByZXBhcmluZ1RleHROb3RpZmljYXRpb24gcHJvamVjdEtleT17cHJvamVjdEtleX0gLz4sXG4gICAgICAgIH0sXG4gICAgICAgIHtcbiAgICAgICAgICBkaXNtaXNzQWZ0ZXI6IDUwMDAsXG4gICAgICAgIH1cbiAgICAgIClcbiAgICAgIGF3YWl0IHByb2Nlc3NVcGxvYWRlZEZpbGUoe1xuICAgICAgICBwcm9qZWN0S2V5LFxuICAgICAgICBjb250YWluZXJLZXk6IHN0YXRlLmNvbnRhaW5lcktleSEsXG4gICAgICAgIGFzeW5jRGlzcGF0Y2gsXG4gICAgICAgIHJlc291cmNlVHlwZSxcbiAgICAgIH0pXG4gICAgICBzaG93Tm90aWZpY2F0aW9uKFxuICAgICAgICB7XG4gICAgICAgICAga2luZDogJ2luZm8nLFxuICAgICAgICAgIGRvbWFpbjogRE9NQUlOUy5TSURFLFxuICAgICAgICAgIC8vIEB0cy1pZ25vcmVcbiAgICAgICAgICB0ZXh0OiA8SW1wb3J0UnVubmluZ1RleHROb3RpZmljYXRpb24gcHJvamVjdEtleT17cHJvamVjdEtleX0gLz4sXG4gICAgICAgIH0sXG4gICAgICAgIH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WdlKFxuICAgICAgICAgICAgICAgICAgICAgIHJlc291cmNlVHlwZVRvUGx1cmFsTWVzc2FnZShyZXNvdXJjZVR5cGUpXG4gICAgICAgICAgICAgICAgICAgICksXG4gICAgICAgICAgICAgICAgICAgIHJlc291cmNlVHlwZTogaW50bC5mb3JtYXRNZXNzYWdlKFxuICAgICAgICAgICAgICAgICAgICAgIHJlc291cmNlVHlwZVRvTWVzc2FnZShyZXNvdXJjZVR5cGUpXG4gICAgICAgICAgICAgICAgICAgICksXG4gICAgICAgICAgICAgICAgICAgIGNvdW50OiBpbnRsLmZvcm1hdE51bWJlcihcbiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS51cGxvYWRGaWxlUmVzcG9uc2U/LnJvd3NDb3VudFxuICAgICAgICAgICAgICAgICAgICApLFxuICAgICAgICAgICAgICAgICAgICBiOiBnZXRCb2xkLFxuICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICB9fVxuICAgICAgICAgICAgICAvPlxuICAgICAgICAgICAgICA8VGV4dC5Cb2R5XG4gICAgICAgICAgICAgICAgaW50bE1lc3NhZ2U9e3tcbiAgICAgICAgICAgICAgICAgIC4uLm1lc3NhZ2VzLmNvbmZpcm1hdGlvblF1ZXN0aW9uLFxuICAgICAgICAgICAgICAgICAgdmFsdWVzOiB7XG4gICAgICAgICAgICAgICAgICAgIHJlc291cmNlVHlwZVBsdXJhbDogaW50bC5mb3JtYXRNZXNzYWdlKFxuICAgICAgICAgICAgICAgICAgICAgIHJlc291cmNlVHlwZVRvUGx1cmFsTWVzc2FnZShyZXNvdXJjZVR5cGUpXG4gICAgICAgICAgICAgICAgICAgICksXG4gICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIH19XG4gICAgICAgICAgICAgIC8+XG4gICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgIDxTcGFjaW5ncy5JbmxpbmUgc2NhbGU9XCJzXCIgYWxpZ25JdGVtcz1cImNlbnRlclwiPlxuICAgICAgICAgICAgICA8V2FybmluZ0ljb24gc2l6ZT1cIjQwXCIgY29sb3I9XCJ3YXJuaW5nXCIgLz5cbiAgICAgICAgICAgICAgPFRleHQuQm9keSBpbnRsTWVzc2FnZT17bWVzc2FnZXMuY2Fubm90QmVVbmRvbmVOb3RlfSAvPlxuICAgICAgICAgICAgPC9TcGFjaW5ncy5JbmxpbmU+XG4gICAgICAgICAgPC9TcGFjaW5ncy5TdGFjaz5cbiAgICAgICAgICA8U3BhY2luZ3MuSW5saW5lIHNjYWxlPVwibVwiIGp1c3RpZnlDb250ZW50PVwiZmxleC1lbmRcIj5cbiAgICAgICAgICAgIDxTZWNvbmRhcnlCdXR0b25cbiAgICAgICAgICAgICAgZGF0YS10ZXN0LWlkPVwiY29uZmlybWF0aW9uLWRpYWxvZy1jYW5jZWxcIlxuICAgICAgICAgICAgICBsYWJlbD17aW50bC5mb3JtYXRNZXNzYWdlKHNoYXJlZE1lc3NhZ2VzLmNhbmNlbCl9XG4gICAgICAgICAgICAgIG9uQ2xpY2s9eygpID0+IG9uQ2xvc2UoeyBzaG91bGREZWxldGVJbXBvcnRDb250YWluZXI6IHRydWUgfSl9XG4gICAgICAgICAgICAvPlxuICAgICAgICAgICAgPFByaW1hcnlCdXR0b25cbiAgICAgICAgICAgICAgdG9uZT1cImNyaXRpY2FsXCJcbiAgICAgICAgICAgICAgZGF0YS10ZXN0LWlkPVwiY29uZmlybWF0aW9uLWRpYWxvZy1jb25maXJtXCJcbiAgICAgICAgICAgICAgbGFiZWw9e2ludGwuZm9ybWF0TWVzc2FnZShzaGFyZWRNZXNzYWdlcy5zdGFydEJ1bGtEZWxldGUpfVxuICAgICAgICAgICAgICBvbkNsaWNrPXtvblN0YXJ0SW1wb3J0fVxuICAgICAgICAgICAgLz5cbiAgICAgICAgICA8L1NwYWNpbmdzLklubGluZT5cbiAgICAgICAgPC9TcGFjaW5ncy5TdGFjaz5cbiAgICAgIDwvRnVsbFN0b3J5TWFza2luZy5Vbm1hc2s+XG4gICAgPC9JbmZvRGlhbG9nPlxuICApXG59XG5cbmZ1bmN0aW9uIGdldEJvbGQobXNnOiBzdHJpbmcpIHtcbiAgcmV0dXJuIChcbiAgICA8VGV4dC5Cb2R5IGFzPVwic3BhblwiIGlzQm9sZD5cbiAgICAgIHttc2d9XG4gICAgPC9UZXh0LkJvZHk+XG4gIClcbn1cbiJdfQ== */",
|
|
1409
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
1410
|
+
};
|
|
1411
|
+
const ImportRunningTextNotification = props => jsx("div", {
|
|
1412
|
+
css: _ref2,
|
|
1413
|
+
children: jsx(Text.Body, {
|
|
1414
|
+
intlMessage: _objectSpread$2(_objectSpread$2({}, messages.importStarted), {}, {
|
|
1415
|
+
values: {
|
|
1416
|
+
newline: getNewLine,
|
|
1417
|
+
logsLink: msg => getImportLogsLink(msg, props.projectKey),
|
|
1418
|
+
b: getBold$1
|
|
1419
|
+
}
|
|
1420
|
+
})
|
|
1421
|
+
})
|
|
1422
|
+
});
|
|
1423
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
1424
|
+
name: "1vs9i7r",
|
|
1425
|
+
styles: "width:360px"
|
|
1426
|
+
} : {
|
|
1427
|
+
name: "mjwslu-ImportPreparingTextNotification",
|
|
1428
|
+
styles: "width:360px;label:ImportPreparingTextNotification;/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRlbGV0ZS1yZXNvdXJjZXMtY29uZmlybWF0aW9uLW1vZGFsLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFtRFkiLCJmaWxlIjoiZGVsZXRlLXJlc291cmNlcy1jb25maXJtYXRpb24tbW9kYWwudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgdXNlSW50bCB9IGZyb20gJ3JlYWN0LWludGwnXG5pbXBvcnQgeyB1c2VTaG93Tm90aWZpY2F0aW9uIH0gZnJvbSA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biAgICAgIG9uQ2xvc2UoKVxuICAgICAgc2hvd05vdGlmaWNhdGlvbihcbiAgICAgICAge1xuICAgICAgICAgIGtpbmQ6ICdpbmZvJyxcbiAgICAgICAgICBkb21haW46IERPTUFJTlMuU0lERSxcbiAgICAgICAgICAvLyBAdHMtaWdub3JlXG4gICAgICAgICAgdGV4dDogPEltcG9ydFByZXBhcmluZ1RleHROb3RpZmljYXRpb24gcHJvamVjdEtleT17cHJvamVjdEtleX0gLz4sXG4gICAgICAgIH0sXG4gICAgICAgIHtcbiAgICAgICAgICBkaXNtaXNzQWZ0ZXI6IDUwMDAsXG4gICAgICAgIH1cbiAgICAgIClcbiAgICAgIGF3YWl0IHByb2Nlc3NVcGxvYWRlZEZpbGUoe1xuICAgICAgICBwcm9qZWN0S2V5LFxuICAgICAgICBjb250YWluZXJLZXk6IHN0YXRlLmNvbnRhaW5lcktleSEsXG4gICAgICAgIGFzeW5jRGlzcGF0Y2gsXG4gICAgICAgIHJlc291cmNlVHlwZSxcbiAgICAgIH0pXG4gICAgICBzaG93Tm90aWZpY2F0aW9uKFxuICAgICAgICB7XG4gICAgICAgICAga2luZDogJ2luZm8nLFxuICAgICAgICAgIGRvbWFpbjogRE9NQUlOUy5TSURFLFxuICAgICAgICAgIC8vIEB0cy1pZ25vcmVcbiAgICAgICAgICB0ZXh0OiA8SW1wb3J0UnVubmluZ1RleHROb3RpZmljYXRpb24gcHJvamVjdEtleT17cHJvamVjdEtleX0gLz4sXG4gICAgICAgIH0sXG4gICAgICAgIHtcbiAgICAgICAgICBkaXNtaXNzQWZ0ZXI6IDUwMDAsXG4gICAgICAgIH1cbiAgICAgIClcbiAgICB9IGNhdGNoIChlcnJvcikge1xuICAgICAgb25DbG9zZSh7IHNob3VsZERlbGV0ZUltcG9ydENvbnRhaW5lcjogdHJ1ZSB9KVxuICAgICAgc2hvd05vdGlmaWNhdGlvbih7XG4gICAgICAgIGtpbmQ6ICdlcnJvcicsXG4gICAgICAgIGRvbWFpbjogRE9NQUlOUy5QQUdFLFxuICAgICAgICB0ZXh0OiBTdHJpbmcoZXJyb3IpLFxuICAgICAgfSlcbiAgICB9XG4gIH1cblxuICByZXR1cm4gKFxuICAgIDxJbmZvRGlhbG9nXG4gICAgICB0aXRsZT17aW50bC5mb3JtYXRNZXNzYWdlKHNoYXJlZE1lc3NhZ2VzLmRlbGV0ZU1vZGFsVGl0bGUpfVxuICAgICAgaXNPcGVuXG4gICAgICBvbkNsb3NlPXsoKSA9PiBvbkNsb3NlKHsgc2hvdWxkRGVsZXRlSW1wb3J0Q29udGFpbmVyOiB0cnVlIH0pfVxuICAgICAgc2l6ZT17MTZ9XG4gICAgPlxuICAgICAgPEZ1bGxTdG9yeU1hc2tpbmcuVW5tYXNrPlxuICAgICAgICA8U3BhY2luZ3MuU3RhY2sgc2NhbGU9XCJ4bFwiPlxuICAgICAgICAgIDxTcGFjaW5ncy5TdGFjayBzY2FsZT1cIm1cIj5cbiAgICAgICAgICAgIDxkaXY+XG4gICAgICAgICAgICAgIDxUZXh0LkJvZHlcbiAgICAgICAgICAgICAgICBpbnRsTWVzc2FnZT17e1xuICAgICAgICAgICAgICAgICAgLi4ubWVzc2FnZXMuY29uZmlybWF0aW9uVGV4dCxcbiAgICAgICAgICAgICAgICAgIHZhbHVlczoge1xuICAgICAgICAgICAgICAgICAgICBwcm9qZWN0TmFtZTogcHJvamVjdE5hbWUsXG4gICAgICAgICAgICAgICAgICAgIHJlc291cmNlVHlwZVBsdXJhbDogaW50bC5mb3JtYXRNZXNzYWdlKFxuICAgICAgICAgICAgICAgICAgICAgIHJlc291cmNlVHlwZVRvUGx1cmFsTWVzc2FnZShyZXNvdXJjZVR5cGUpXG4gICAgICAgICAgICAgICAgICAgICksXG4gICAgICAgICAgICAgICAgICAgIHJlc291cmNlVHlwZTogaW50bC5mb3JtYXRNZXNzYWdlKFxuICAgICAgICAgICAgICAgICAgICAgIHJlc291cmNlVHlwZVRvTWVzc2FnZShyZXNvdXJjZVR5cGUpXG4gICAgICAgICAgICAgICAgICAgICksXG4gICAgICAgICAgICAgICAgICAgIGNvdW50OiBpbnRsLmZvcm1hdE51bWJlcihcbiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS51cGxvYWRGaWxlUmVzcG9uc2U/LnJvd3NDb3VudFxuICAgICAgICAgICAgICAgICAgICApLFxuICAgICAgICAgICAgICAgICAgICBiOiBnZXRCb2xkLFxuICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICB9fVxuICAgICAgICAgICAgICAvPlxuICAgICAgICAgICAgICA8VGV4dC5Cb2R5XG4gICAgICAgICAgICAgICAgaW50bE1lc3NhZ2U9e3tcbiAgICAgICAgICAgICAgICAgIC4uLm1lc3NhZ2VzLmNvbmZpcm1hdGlvblF1ZXN0aW9uLFxuICAgICAgICAgICAgICAgICAgdmFsdWVzOiB7XG4gICAgICAgICAgICAgICAgICAgIHJlc291cmNlVHlwZVBsdXJhbDogaW50bC5mb3JtYXRNZXNzYWdlKFxuICAgICAgICAgICAgICAgICAgICAgIHJlc291cmNlVHlwZVRvUGx1cmFsTWVzc2FnZShyZXNvdXJjZVR5cGUpXG4gICAgICAgICAgICAgICAgICAgICksXG4gICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIH19XG4gICAgICAgICAgICAgIC8+XG4gICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgIDxTcGFjaW5ncy5JbmxpbmUgc2NhbGU9XCJzXCIgYWxpZ25JdGVtcz1cImNlbnRlclwiPlxuICAgICAgICAgICAgICA8V2FybmluZ0ljb24gc2l6ZT1cIjQwXCIgY29sb3I9XCJ3YXJuaW5nXCIgLz5cbiAgICAgICAgICAgICAgPFRleHQuQm9keSBpbnRsTWVzc2FnZT17bWVzc2FnZXMuY2Fubm90QmVVbmRvbmVOb3RlfSAvPlxuICAgICAgICAgICAgPC9TcGFjaW5ncy5JbmxpbmU+XG4gICAgICAgICAgPC9TcGFjaW5ncy5TdGFjaz5cbiAgICAgICAgICA8U3BhY2luZ3MuSW5saW5lIHNjYWxlPVwibVwiIGp1c3RpZnlDb250ZW50PVwiZmxleC1lbmRcIj5cbiAgICAgICAgICAgIDxTZWNvbmRhcnlCdXR0b25cbiAgICAgICAgICAgICAgZGF0YS10ZXN0LWlkPVwiY29uZmlybWF0aW9uLWRpYWxvZy1jYW5jZWxcIlxuICAgICAgICAgICAgICBsYWJlbD17aW50bC5mb3JtYXRNZXNzYWdlKHNoYXJlZE1lc3NhZ2VzLmNhbmNlbCl9XG4gICAgICAgICAgICAgIG9uQ2xpY2s9eygpID0+IG9uQ2xvc2UoeyBzaG91bGREZWxldGVJbXBvcnRDb250YWluZXI6IHRydWUgfSl9XG4gICAgICAgICAgICAvPlxuICAgICAgICAgICAgPFByaW1hcnlCdXR0b25cbiAgICAgICAgICAgICAgdG9uZT1cImNyaXRpY2FsXCJcbiAgICAgICAgICAgICAgZGF0YS10ZXN0LWlkPVwiY29uZmlybWF0aW9uLWRpYWxvZy1jb25maXJtXCJcbiAgICAgICAgICAgICAgbGFiZWw9e2ludGwuZm9ybWF0TWVzc2FnZShzaGFyZWRNZXNzYWdlcy5zdGFydEJ1bGtEZWxldGUpfVxuICAgICAgICAgICAgICBvbkNsaWNrPXtvblN0YXJ0SW1wb3J0fVxuICAgICAgICAgICAgLz5cbiAgICAgICAgICA8L1NwYWNpbmdzLklubGluZT5cbiAgICAgICAgPC9TcGFjaW5ncy5TdGFjaz5cbiAgICAgIDwvRnVsbFN0b3J5TWFza2luZy5Vbm1hc2s+XG4gICAgPC9JbmZvRGlhbG9nPlxuICApXG59XG5cbmZ1bmN0aW9uIGdldEJvbGQobXNnOiBzdHJpbmcpIHtcbiAgcmV0dXJuIChcbiAgICA8VGV4dC5Cb2R5IGFzPVwic3BhblwiIGlzQm9sZD5cbiAgICAgIHttc2d9XG4gICAgPC9UZXh0LkJvZHk+XG4gIClcbn1cbiJdfQ== */",
|
|
1429
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
1430
|
+
};
|
|
1431
|
+
const ImportPreparingTextNotification = props => jsx("div", {
|
|
1432
|
+
css: _ref,
|
|
1433
|
+
children: jsx(Text.Body, {
|
|
1434
|
+
intlMessage: _objectSpread$2(_objectSpread$2({}, messages.preparingImport), {}, {
|
|
1435
|
+
values: {
|
|
1436
|
+
newline: getNewLine,
|
|
1437
|
+
logsLink: msg => getImportLogsLink(msg, props.projectKey),
|
|
1438
|
+
b: getBold$1
|
|
1439
|
+
}
|
|
1440
|
+
})
|
|
1441
|
+
})
|
|
1442
|
+
});
|
|
1443
|
+
const DeleteResourcesConfirmationModal = () => {
|
|
1444
|
+
const intl = useIntl();
|
|
1445
|
+
const _useDeleteResourcesCo = useDeleteResourcesContext(),
|
|
1446
|
+
resourceType = _useDeleteResourcesCo.resourceType,
|
|
1447
|
+
state = _useDeleteResourcesCo.state,
|
|
1448
|
+
onClose = _useDeleteResourcesCo.onClose;
|
|
1449
|
+
const _useApplicationContex = useApplicationContext(context => ({
|
|
1450
|
+
projectKey: context.project?.key,
|
|
1451
|
+
projectName: context.project?.name
|
|
1452
|
+
})),
|
|
1453
|
+
projectKey = _useApplicationContex.projectKey,
|
|
1454
|
+
projectName = _useApplicationContex.projectName;
|
|
1455
|
+
const asyncDispatch = useAsyncDispatch();
|
|
1456
|
+
const showNotification = useShowNotification();
|
|
1457
|
+
const onStartImport = async () => {
|
|
1458
|
+
try {
|
|
1459
|
+
const canConfirm = projectKey && state.containerKey && state.droppedFile?.name;
|
|
1460
|
+
if (!canConfirm) return;
|
|
1461
|
+
onClose();
|
|
1462
|
+
showNotification({
|
|
1463
|
+
kind: 'info',
|
|
1464
|
+
domain: DOMAINS.SIDE,
|
|
1465
|
+
// @ts-ignore
|
|
1466
|
+
text: jsx(ImportPreparingTextNotification, {
|
|
1467
|
+
projectKey: projectKey
|
|
1468
|
+
})
|
|
1469
|
+
}, {
|
|
1470
|
+
dismissAfter: 5000
|
|
1471
|
+
});
|
|
1472
|
+
await processUploadedFile({
|
|
1473
|
+
projectKey,
|
|
1474
|
+
containerKey: state.containerKey,
|
|
1475
|
+
asyncDispatch,
|
|
1476
|
+
resourceType
|
|
1477
|
+
});
|
|
1478
|
+
showNotification({
|
|
1479
|
+
kind: 'info',
|
|
1480
|
+
domain: DOMAINS.SIDE,
|
|
1481
|
+
// @ts-ignore
|
|
1482
|
+
text: jsx(ImportRunningTextNotification, {
|
|
1483
|
+
projectKey: projectKey
|
|
1484
|
+
})
|
|
1485
|
+
}, {
|
|
1486
|
+
dismissAfter: 5000
|
|
1487
|
+
});
|
|
1488
|
+
} catch (error) {
|
|
1489
|
+
onClose({
|
|
1490
|
+
shouldDeleteImportContainer: true
|
|
1491
|
+
});
|
|
1492
|
+
showNotification({
|
|
1493
|
+
kind: 'error',
|
|
1494
|
+
domain: DOMAINS.PAGE,
|
|
1495
|
+
text: String(error)
|
|
1496
|
+
});
|
|
1497
|
+
}
|
|
1498
|
+
};
|
|
1499
|
+
return jsx(InfoDialog, {
|
|
1500
|
+
title: intl.formatMessage(sharedMessages.deleteModalTitle),
|
|
1501
|
+
isOpen: true,
|
|
1502
|
+
onClose: () => onClose({
|
|
1503
|
+
shouldDeleteImportContainer: true
|
|
1504
|
+
}),
|
|
1505
|
+
size: 16,
|
|
1506
|
+
children: jsx(Masking.Unmask, {
|
|
1507
|
+
children: jsxs(Spacings.Stack, {
|
|
1508
|
+
scale: "xl",
|
|
1509
|
+
children: [jsxs(Spacings.Stack, {
|
|
1510
|
+
scale: "m",
|
|
1511
|
+
children: [jsxs("div", {
|
|
1512
|
+
children: [jsx(Text.Body, {
|
|
1513
|
+
intlMessage: _objectSpread$2(_objectSpread$2({}, messages.confirmationText), {}, {
|
|
1514
|
+
values: {
|
|
1515
|
+
projectName: projectName,
|
|
1516
|
+
resourceTypePlural: intl.formatMessage(resourceTypeToPluralMessage(resourceType)),
|
|
1517
|
+
resourceType: intl.formatMessage(resourceTypeToMessage(resourceType)),
|
|
1518
|
+
count: intl.formatNumber(state.uploadFileResponse?.rowsCount),
|
|
1519
|
+
b: getBold$1
|
|
1520
|
+
}
|
|
1521
|
+
})
|
|
1522
|
+
}), jsx(Text.Body, {
|
|
1523
|
+
intlMessage: _objectSpread$2(_objectSpread$2({}, messages.confirmationQuestion), {}, {
|
|
1524
|
+
values: {
|
|
1525
|
+
resourceTypePlural: intl.formatMessage(resourceTypeToPluralMessage(resourceType))
|
|
1526
|
+
}
|
|
1527
|
+
})
|
|
1528
|
+
})]
|
|
1529
|
+
}), jsxs(Spacings.Inline, {
|
|
1530
|
+
scale: "s",
|
|
1531
|
+
alignItems: "center",
|
|
1532
|
+
children: [jsx(WarningIcon, {
|
|
1533
|
+
size: "40",
|
|
1534
|
+
color: "warning"
|
|
1535
|
+
}), jsx(Text.Body, {
|
|
1536
|
+
intlMessage: messages.cannotBeUndoneNote
|
|
1537
|
+
})]
|
|
1538
|
+
})]
|
|
1539
|
+
}), jsxs(Spacings.Inline, {
|
|
1540
|
+
scale: "m",
|
|
1541
|
+
justifyContent: "flex-end",
|
|
1542
|
+
children: [jsx(SecondaryButton, {
|
|
1543
|
+
"data-test-id": "confirmation-dialog-cancel",
|
|
1544
|
+
label: intl.formatMessage(sharedMessages.cancel),
|
|
1545
|
+
onClick: () => onClose({
|
|
1546
|
+
shouldDeleteImportContainer: true
|
|
1547
|
+
})
|
|
1548
|
+
}), jsx(PrimaryButton, {
|
|
1549
|
+
tone: "critical",
|
|
1550
|
+
"data-test-id": "confirmation-dialog-confirm",
|
|
1551
|
+
label: intl.formatMessage(sharedMessages.startBulkDelete),
|
|
1552
|
+
onClick: onStartImport
|
|
1553
|
+
})]
|
|
1554
|
+
})]
|
|
1555
|
+
})
|
|
1556
|
+
})
|
|
1557
|
+
});
|
|
1558
|
+
};
|
|
1559
|
+
function getBold$1(msg) {
|
|
1560
|
+
return jsx(Text.Body, {
|
|
1561
|
+
as: "span",
|
|
1562
|
+
isBold: true,
|
|
1563
|
+
children: msg
|
|
1564
|
+
});
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
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; }
|
|
1568
|
+
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; }
|
|
1569
|
+
function UploadPreviewModal() {
|
|
1570
|
+
const _useDeleteResourcesCo = useDeleteResourcesContext(),
|
|
1571
|
+
resourceType = _useDeleteResourcesCo.resourceType,
|
|
1572
|
+
state = _useDeleteResourcesCo.state,
|
|
1573
|
+
onClose = _useDeleteResourcesCo.onClose,
|
|
1574
|
+
actions = _useDeleteResourcesCo.actions;
|
|
1575
|
+
const intl = useIntl();
|
|
1576
|
+
return jsx(FormDialog, {
|
|
1577
|
+
size: 16,
|
|
1578
|
+
isOpen: true,
|
|
1579
|
+
title: intl.formatMessage(sharedMessages.deleteModalTitle),
|
|
1580
|
+
labelPrimary: intl.formatMessage(messages.continue),
|
|
1581
|
+
onSecondaryButtonClick: () => onClose({
|
|
1582
|
+
shouldDeleteImportContainer: true
|
|
1583
|
+
}),
|
|
1584
|
+
onPrimaryButtonClick: () => {
|
|
1585
|
+
actions.setCurrentStep('delete-confirmation');
|
|
1586
|
+
},
|
|
1587
|
+
onClose: () => onClose({
|
|
1588
|
+
shouldDeleteImportContainer: true
|
|
1589
|
+
}),
|
|
1590
|
+
children: jsxs(Spacings.Stack, {
|
|
1591
|
+
scale: "m",
|
|
1592
|
+
children: [jsx(Text.Body, {
|
|
1593
|
+
intlMessage: messages.heresAPreview
|
|
1594
|
+
}), jsx(Card, {
|
|
1595
|
+
insetScale: "xl",
|
|
1596
|
+
children: jsxs(Spacings.Inline, {
|
|
1597
|
+
scale: "m",
|
|
1598
|
+
alignItems: "center",
|
|
1599
|
+
children: [jsx(BinLinearIcon, {
|
|
1600
|
+
size: "40",
|
|
1601
|
+
color: "neutral60"
|
|
1602
|
+
}), jsx(Text.Body, {
|
|
1603
|
+
intlMessage: _objectSpread$1(_objectSpread$1({}, messages.resourcesToBeDeleted), {}, {
|
|
1604
|
+
values: {
|
|
1605
|
+
resourceType: intl.formatMessage(resourceTypeToMessage(resourceType)),
|
|
1606
|
+
resourceTypePlural: intl.formatMessage(resourceTypeToPluralMessage(resourceType)),
|
|
1607
|
+
count: intl.formatNumber(state.uploadFileResponse?.rowsCount),
|
|
1608
|
+
b: getBold
|
|
1609
|
+
}
|
|
1610
|
+
})
|
|
1611
|
+
})]
|
|
1612
|
+
})
|
|
1613
|
+
})]
|
|
1614
|
+
})
|
|
1615
|
+
});
|
|
1616
|
+
}
|
|
1617
|
+
function getBold(msg) {
|
|
1618
|
+
return jsx(Text.Body, {
|
|
1619
|
+
as: "span",
|
|
1620
|
+
isBold: true,
|
|
1621
|
+
children: msg
|
|
1622
|
+
});
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
const steps = {
|
|
1626
|
+
upload: jsx(Upload, {}),
|
|
1627
|
+
uploading: jsx(Uploading, {}),
|
|
1628
|
+
'upload-preview': jsx(UploadPreviewModal, {}),
|
|
1629
|
+
'upload-error': jsx(UploadErrorsModal, {}),
|
|
1630
|
+
'delete-confirmation': jsx(DeleteResourcesConfirmationModal, {})
|
|
1631
|
+
};
|
|
1632
|
+
const CurrentStep = () => {
|
|
1633
|
+
const _useDeleteResourcesCo = useDeleteResourcesContext(),
|
|
1634
|
+
state = _useDeleteResourcesCo.state;
|
|
1635
|
+
return steps[state.currentStep] || null;
|
|
1636
|
+
};
|
|
1637
|
+
|
|
1638
|
+
const getChunkImport = locale => {
|
|
1639
|
+
const intlLocale = mapLocaleToIntlLocale(locale);
|
|
1640
|
+
switch (intlLocale) {
|
|
1641
|
+
case 'de':
|
|
1642
|
+
return import(/* webpackChunkName: "delete-resources-modal-i18n-de" */'./de-cd6c45d3.esm.js');
|
|
1643
|
+
case 'es':
|
|
1644
|
+
return import(/* webpackChunkName: "delete-resources-modal-i18n-es" */'./es-e544023d.esm.js');
|
|
1645
|
+
case 'fr-FR':
|
|
1646
|
+
return import(/* webpackChunkName: "delete-resources-modal-i18n-fr-FR" */'./fr-FR-9d9081ee.esm.js');
|
|
1647
|
+
case 'zh-CN':
|
|
1648
|
+
return import(/* webpackChunkName: "delete-resources-modal-i18n-zh-CN" */'./zh-CN-4780d88e.esm.js');
|
|
1649
|
+
case 'ja':
|
|
1650
|
+
return import(/* webpackChunkName: "delete-resources-modal-i18n-ja" */'./ja-73c088a7.esm.js');
|
|
1651
|
+
case 'pt-BR':
|
|
1652
|
+
return import(/* webpackChunkName: "change-history-i18n-pt-BR" */'./pt-BR-b37d730b.esm.js');
|
|
1653
|
+
default:
|
|
1654
|
+
return import(/* webpackChunkName: "delete-resources-modal-i18n-en" */'./en-3a9aa2d4.esm.js');
|
|
1655
|
+
}
|
|
1656
|
+
};
|
|
1657
|
+
const loadMessages = async locale => {
|
|
1658
|
+
try {
|
|
1659
|
+
const chunkImport = await getChunkImport(locale);
|
|
1660
|
+
return parseChunkImport(chunkImport);
|
|
1661
|
+
} catch (error) {
|
|
1662
|
+
// eslint-disable-next-line no-console
|
|
1663
|
+
console.warn(`Something went wrong while loading the delete-resources-modal messages for ${locale}`, error);
|
|
1664
|
+
reportErrorToSentry(new Error(`Something went wrong while loading the delete-resources-modal messages for ${locale}`), {
|
|
1665
|
+
extra: error
|
|
1666
|
+
});
|
|
1667
|
+
return {};
|
|
1668
|
+
}
|
|
1669
|
+
};
|
|
1670
|
+
|
|
1671
|
+
const useAsyncIntlMessages = (locale, loader) => {
|
|
1672
|
+
const _useState = useState({
|
|
1673
|
+
isLoading: true,
|
|
1674
|
+
messages: undefined,
|
|
1675
|
+
error: undefined
|
|
1676
|
+
}),
|
|
1677
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1678
|
+
state = _useState2[0],
|
|
1679
|
+
setState = _useState2[1];
|
|
1680
|
+
useEffect(() => {
|
|
1681
|
+
let _isUnmounting = false;
|
|
1682
|
+
async function load() {
|
|
1683
|
+
try {
|
|
1684
|
+
if (!_isUnmounting) {
|
|
1685
|
+
const messages = await loader(locale);
|
|
1686
|
+
setState({
|
|
1687
|
+
isLoading: false,
|
|
1688
|
+
messages
|
|
1689
|
+
});
|
|
1690
|
+
}
|
|
1691
|
+
} catch (error) {
|
|
1692
|
+
setState({
|
|
1693
|
+
isLoading: false,
|
|
1694
|
+
error
|
|
1695
|
+
});
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
if (locale) load();
|
|
1699
|
+
return () => {
|
|
1700
|
+
_isUnmounting = true;
|
|
1701
|
+
};
|
|
1702
|
+
}, [locale, loader]);
|
|
1703
|
+
return state;
|
|
1704
|
+
};
|
|
1705
|
+
|
|
1706
|
+
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; }
|
|
1707
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1708
|
+
const DeleteResourcesModal = props => {
|
|
1709
|
+
const _useApplicationContex = useApplicationContext(context => ({
|
|
1710
|
+
locale: context.user && context.user.locale
|
|
1711
|
+
})),
|
|
1712
|
+
locale = _useApplicationContex.locale;
|
|
1713
|
+
const messages = useAsyncIntlMessages(locale, loadMessages);
|
|
1714
|
+
if (!props.isOpen || messages.isLoading) return null;
|
|
1715
|
+
return jsx(IntlProvider, {
|
|
1716
|
+
locale: locale,
|
|
1717
|
+
messages: messages.messages,
|
|
1718
|
+
children: jsx(DeleteResourcesProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
1719
|
+
children: jsx(CurrentStep, {})
|
|
1720
|
+
}))
|
|
1721
|
+
});
|
|
1722
|
+
};
|
|
1723
|
+
DeleteResourcesModal.displayName = 'DeleteResourcesModal';
|
|
1724
|
+
|
|
1725
|
+
export { DeleteResourcesModal as D, EnabledDropArea as E, FileDropped as F, messages$4 as m, useDeleteResourcesContext as u };
|