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