@commercetools-frontend-extensions/delete-resources-modal 1.1.8 → 1.1.10

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.
@@ -2,51 +2,1386 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var dist_commercetoolsFrontendExtensionsDeleteResourcesModal = require('./index-c3fc6f69.cjs.prod.js');
6
- require('@babel/runtime-corejs3/core-js-stable/object/keys');
7
- require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
8
- require('@babel/runtime-corejs3/core-js-stable/instance/filter');
9
- require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
10
- require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
11
- require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
12
- require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
13
- require('@babel/runtime-corejs3/core-js-stable/object/define-property');
14
- require('@babel/runtime-corejs3/helpers/defineProperty');
15
- require('react-intl');
16
- require('@commercetools-frontend/application-shell-connectors');
17
- require('@babel/runtime-corejs3/helpers/slicedToArray');
18
- require('react');
19
- require('@commercetools-frontend/sdk');
20
- require('@commercetools-frontend/constants');
21
- require('pluralize');
22
- require('@babel/runtime-corejs3/core-js-stable/instance/every');
23
- require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
24
- require('@babel/runtime-corejs3/helpers/createClass');
25
- require('@babel/runtime-corejs3/helpers/classCallCheck');
26
- require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
27
- require('@babel/runtime-corejs3/helpers/getPrototypeOf');
28
- require('@babel/runtime-corejs3/helpers/inherits');
29
- require('@babel/runtime-corejs3/helpers/wrapNativeSuper');
30
- require('@babel/runtime-corejs3/core-js-stable/json/stringify');
31
- require('@babel/runtime-corejs3/core-js-stable/promise');
32
- require('@babel/runtime-corejs3/core-js-stable/array/is-array');
33
- require('@babel/runtime-corejs3/core-js-stable/instance/find');
34
- require('@babel/runtime-corejs3/core-js-stable/instance/map');
35
- require('papaparse');
36
- require('@emotion/react/jsx-runtime');
37
- require('@commercetools-frontend/application-components');
38
- require('@commercetools-frontend/fullstory');
39
- require('@commercetools-frontend/ui-kit');
40
- require('@babel/runtime-corejs3/core-js-stable/instance/some');
41
- require('react-dropzone');
42
- require('@commercetools-frontend/actions-global');
43
- require('@emotion/styled/base');
5
+ var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
6
+ var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
7
+ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
8
+ var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
9
+ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
10
+ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
11
+ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
12
+ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
13
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
+ var reactIntl = require('react-intl');
15
+ var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
16
+ var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
17
+ var React = require('react');
18
+ var operations = require('@commercetools-frontend-extensions/operations');
19
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
20
+ var applicationComponents = require('@commercetools-frontend/application-components');
21
+ var fullstory = require('@commercetools-frontend/fullstory');
22
+ var uiKit = require('@commercetools-frontend/ui-kit');
23
+ var actionsGlobal = require('@commercetools-frontend/actions-global');
24
+ var constants = require('@commercetools-frontend/constants');
25
+ var _Reflect$construct = require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
26
+ var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
27
+ var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
28
+ var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
29
+ var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
30
+ var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
31
+ var _wrapNativeSuper = require('@babel/runtime-corejs3/helpers/wrapNativeSuper');
32
+ var sentry = require('@commercetools-frontend/sentry');
33
+ var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
44
34
  require('@emotion/react');
45
- require('@commercetools-frontend/sentry');
46
- require('@commercetools-frontend/application-shell');
47
- require('@babel/runtime-corejs3/core-js-stable/instance/slice');
48
- require('@commercetools-frontend/i18n');
35
+ var i18n = require('@commercetools-frontend/i18n');
49
36
 
37
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
50
38
 
39
+ var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
40
+ var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
41
+ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
42
+ var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
43
+ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
44
+ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
45
+ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
46
+ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
47
+ var React__default = /*#__PURE__*/_interopDefault(React);
48
+ var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
49
+ var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
51
50
 
52
- exports["default"] = dist_commercetoolsFrontendExtensionsDeleteResourcesModal.DeleteResourcesModal;
51
+ 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; }
52
+ 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; }
53
+ function reducer(state, action) {
54
+ if (action.type === 'setCurrentStep') return _objectSpread$6(_objectSpread$6({}, state), {}, {
55
+ currentStep: action.currentStep,
56
+ progress: 0
57
+ });
58
+ if (action.type === 'setContainerKey') return _objectSpread$6(_objectSpread$6({}, state), {}, {
59
+ containerKey: action.containerKey
60
+ });
61
+ if (action.type === 'cancelImport') return _objectSpread$6(_objectSpread$6({}, state), {}, {
62
+ currentStep: 'upload',
63
+ containerKey: undefined,
64
+ droppedFile: undefined,
65
+ dropAreaState: 'ready-for-drop',
66
+ progress: 0
67
+ });
68
+ if (action.type === 'uploadNewFile') return _objectSpread$6(_objectSpread$6({}, state), {}, {
69
+ currentStep: 'upload',
70
+ containerKey: undefined,
71
+ droppedFile: undefined,
72
+ dropAreaState: 'ready-for-drop',
73
+ progress: 0
74
+ });
75
+ if (action.type === 'setDroppedFile') {
76
+ return _objectSpread$6(_objectSpread$6({}, state), {}, {
77
+ droppedFile: action.droppedFile
78
+ });
79
+ }
80
+ if (action.type === 'setAbortController') {
81
+ return _objectSpread$6(_objectSpread$6({}, state), {}, {
82
+ abortController: action.abortController
83
+ });
84
+ }
85
+ if (action.type === 'setProgress') {
86
+ return _objectSpread$6(_objectSpread$6({}, state), {}, {
87
+ progress: action.progress
88
+ });
89
+ }
90
+ if (action.type === 'setUploadFileResponse') {
91
+ return _objectSpread$6(_objectSpread$6({}, state), {}, {
92
+ uploadFileResponse: action.uploadFileResponse
93
+ });
94
+ }
95
+ if (action.type === 'setFileUploadErrors') {
96
+ return _objectSpread$6(_objectSpread$6({}, state), {}, {
97
+ fileUploadErrors: action.fileUploadErrors
98
+ });
99
+ }
100
+ throw new Error(getUnknownActionError(action));
101
+ }
102
+ function getUnknownActionError(actionType) {
103
+ return `Unkown type: ${actionType}`;
104
+ }
105
+ const initialState = {
106
+ currentStep: 'upload',
107
+ abortController: new AbortController(),
108
+ dropAreaState: 'ready-for-drop',
109
+ containerKey: undefined,
110
+ progress: 0,
111
+ uploadFileResponse: undefined,
112
+ fileUploadErrors: []
113
+ };
114
+ const initialActions = {
115
+ setCurrentStep(_currentStep) {
116
+ /**/
117
+ },
118
+ cancelImport() {
119
+ /**/
120
+ },
121
+ uploadNewFile() {
122
+ /**/
123
+ },
124
+ setDroppedFile(_nextDroppedFile) {
125
+ /**/
126
+ },
127
+ setUploadFileResponse(_uploadFileResponse) {
128
+ /**/
129
+ },
130
+ setFileUploadErrors(_fileUploadErrors) {
131
+ /**/
132
+ },
133
+ setContainerKey(_containerKey) {
134
+ /**/
135
+ },
136
+ setAbortController(_abortController) {
137
+ /**/
138
+ },
139
+ setProgress(_progress) {
140
+ /**/
141
+ }
142
+ };
143
+
144
+ const DeleteResourcesContext = /*#__PURE__*/React__default["default"].createContext({
145
+ state: initialState,
146
+ actions: initialActions,
147
+ onClose: () => {}
148
+ });
149
+ const DeleteResourcesProvider = props => {
150
+ const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
151
+ projectKey: context.project?.key
152
+ })),
153
+ projectKey = _useApplicationContex.projectKey;
154
+ const _React$useReducer = React__default["default"].useReducer(reducer, initialState),
155
+ _React$useReducer2 = _slicedToArray(_React$useReducer, 2),
156
+ state = _React$useReducer2[0],
157
+ dispatch = _React$useReducer2[1];
158
+ const setCurrentStep = currentStep => dispatch({
159
+ type: 'setCurrentStep',
160
+ currentStep
161
+ });
162
+ const setContainerKey = containerKey => dispatch({
163
+ type: 'setContainerKey',
164
+ containerKey
165
+ });
166
+ const cancelImport = () => dispatch({
167
+ type: 'cancelImport'
168
+ });
169
+ const uploadNewFile = () => dispatch({
170
+ type: 'uploadNewFile'
171
+ });
172
+ const setDroppedFile = droppedFile => dispatch({
173
+ type: 'setDroppedFile',
174
+ droppedFile: droppedFile
175
+ });
176
+ const setFileUploadErrors = fileUploadErrors => {
177
+ dispatch({
178
+ type: 'setFileUploadErrors',
179
+ fileUploadErrors
180
+ });
181
+ };
182
+ const setAbortController = abortController => dispatch({
183
+ type: 'setAbortController',
184
+ abortController: abortController
185
+ });
186
+ const setProgress = progress => dispatch({
187
+ type: 'setProgress',
188
+ progress
189
+ });
190
+ const setUploadFileResponse = uploadFileResponse => {
191
+ dispatch({
192
+ type: 'setUploadFileResponse',
193
+ uploadFileResponse
194
+ });
195
+ };
196
+ const handleClose = function () {
197
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
198
+ if (state.abortController) state.abortController.abort();
199
+ if (typeof props.onClose === 'function') props.onClose();
200
+ // Removes the associated import container when the import is closed
201
+ if (options.shouldDeleteImportContainer && projectKey && state.containerKey) operations.deleteImportContainer({
202
+ projectKey,
203
+ importContainerKey: state.containerKey
204
+ });
205
+ };
206
+ return jsxRuntime.jsx(DeleteResourcesContext.Provider, {
207
+ value: {
208
+ resourceType: props.resourceType,
209
+ state,
210
+ onClose: handleClose,
211
+ actions: {
212
+ setCurrentStep,
213
+ cancelImport,
214
+ uploadNewFile,
215
+ setDroppedFile,
216
+ setUploadFileResponse,
217
+ setFileUploadErrors,
218
+ setContainerKey,
219
+ setAbortController,
220
+ setProgress
221
+ }
222
+ },
223
+ children: props.children
224
+ });
225
+ };
226
+
227
+ function getDropArea(_ref) {
228
+ let dropAreaState = _ref.dropAreaState,
229
+ isFileDropped = _ref.isFileDropped,
230
+ fileName = _ref.fileName,
231
+ messages = _ref.messages;
232
+ if (dropAreaState === 'ready-for-drop') {
233
+ return jsxRuntime.jsx(operations.EnabledDropArea, {
234
+ dragAndDropText: messages.dragAndDropCSV,
235
+ orText: messages.or,
236
+ browseFileText: messages.browseButton
237
+ });
238
+ }
239
+ if (dropAreaState === 'file-dropped') {
240
+ return jsxRuntime.jsx(operations.FileDroppedArea, {
241
+ fileName: fileName,
242
+ chooseFileLabel: messages.chooseFile
243
+ });
244
+ }
245
+ if (dropAreaState === 'active-drag') {
246
+ return jsxRuntime.jsx(operations.ActiveDragDropArea, {
247
+ isFileDropped: isFileDropped,
248
+ fileName: fileName,
249
+ chooseFileLabel: messages.chooseFile,
250
+ dragAndDropText: messages.dragAndDropCSV,
251
+ orText: messages.or,
252
+ browseFileText: messages.browseButton
253
+ });
254
+ }
255
+ return fallbackDropArea(dropAreaState, fileName, messages);
256
+ }
257
+ function fallbackDropArea(_dropAreaState, fileName, messages) {
258
+ return jsxRuntime.jsx(operations.FileDroppedArea, {
259
+ fileName: fileName,
260
+ chooseFileLabel: messages.chooseFile
261
+ });
262
+ }
263
+ function getDropAreaState(flags) {
264
+ if (flags.isDragActive) {
265
+ return 'active-drag';
266
+ }
267
+ if (flags.isReady) {
268
+ return 'file-dropped';
269
+ }
270
+ return 'ready-for-drop';
271
+ }
272
+
273
+ var messages$4 = reactIntl.defineMessages({
274
+ dragAndDropCSV: {
275
+ id: 'DeleteResourcesModal.dragAndDropCSV',
276
+ description: 'The message telling the user to drag and drop CSV file in the file drop area',
277
+ defaultMessage: 'Drag and drop CSV'
278
+ },
279
+ or: {
280
+ id: 'DeleteResourcesModal.or',
281
+ description: 'The word "or" in the drag and drop message',
282
+ defaultMessage: 'or'
283
+ },
284
+ browseButton: {
285
+ id: 'DeleteResourcesModal.browseFile',
286
+ defaultMessage: 'Browse file'
287
+ },
288
+ uploadAndPreview: {
289
+ id: 'DeleteResourcesModal.uploadAndPreview',
290
+ description: 'Label for the button that uploads the file and shows the preview',
291
+ defaultMessage: 'Upload and preview'
292
+ },
293
+ chooseFile: {
294
+ id: 'DeleteResourcesModal.chooseFile',
295
+ description: 'Label for a button on the file upload page, shown on ready to upload state',
296
+ defaultMessage: 'Choose file'
297
+ },
298
+ fileUploadFailed: {
299
+ id: 'DeleteResourcesModal.fileUploadFailed',
300
+ description: 'A title on the file upload page, shown on file upload error state',
301
+ defaultMessage: 'File upload failed'
302
+ },
303
+ fileFormatNotSupported: {
304
+ id: 'DeleteResourcesModal.fileFormatNotSupported',
305
+ description: 'Error message displayed when a user drags and drops a non-CSV file',
306
+ defaultMessage: 'Invalid file format: The file is not in CSV format and cannot be processed.'
307
+ },
308
+ tooManyFilesError: {
309
+ id: 'DeleteResourcesModal.tooManyFilesError',
310
+ description: 'Error message displayed when a user drags and drops multiple files at once',
311
+ defaultMessage: 'Multiple files detected: You can only drag and drop one file at a time.'
312
+ },
313
+ genericError: {
314
+ id: 'DeleteResourcesModal.genericError',
315
+ description: 'Default error message for unexpected file upload issues (for unhandled cases)',
316
+ defaultMessage: 'Error occurred: Please try uploading the file again or contact our support team for assistance.'
317
+ },
318
+ dataType: {
319
+ id: 'DeleteResourcesModal.dataType',
320
+ description: 'Label for the data type selection dropdown',
321
+ defaultMessage: 'Data type'
322
+ },
323
+ instructions: {
324
+ id: 'DeleteResourcesModal.instructions',
325
+ description: 'Label for the instructions section',
326
+ defaultMessage: 'Instructions'
327
+ }
328
+ });
329
+
330
+ 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)); }
331
+ function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function () { return !!t; })(); }
332
+ let MissingDeleteResourcesProviderError = /*#__PURE__*/function (_Error) {
333
+ function MissingDeleteResourcesProviderError() {
334
+ var _this;
335
+ _classCallCheck(this, MissingDeleteResourcesProviderError);
336
+ _this = _callSuper$1(this, MissingDeleteResourcesProviderError, ['useDeleteResourcesProviderError must be used within MissingDeleteResourcesProviderError']);
337
+ _this.name = 'MissingDeleteResourcesProviderError';
338
+ return _this;
339
+ }
340
+ _inherits(MissingDeleteResourcesProviderError, _Error);
341
+ return _createClass(MissingDeleteResourcesProviderError);
342
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
343
+
344
+ 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)); }
345
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
346
+ let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
347
+ function UnexpectedResourceTypeError(resourceType) {
348
+ var _this;
349
+ _classCallCheck(this, UnexpectedResourceTypeError);
350
+ _this = _callSuper(this, UnexpectedResourceTypeError, [`Unexpected resource type "${resourceType}"`]);
351
+ _this.name = 'UnexpectedResourceTypeError';
352
+ return _this;
353
+ }
354
+ _inherits(UnexpectedResourceTypeError, _Error);
355
+ return _createClass(UnexpectedResourceTypeError);
356
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
357
+
358
+ const useDeleteResourcesContext = () => {
359
+ const context = React.useContext(DeleteResourcesContext);
360
+ if (!context) {
361
+ throw new MissingDeleteResourcesProviderError();
362
+ }
363
+ return context;
364
+ };
365
+
366
+ var messages$3 = reactIntl.defineMessages({
367
+ fileSizeExceededTitle: {
368
+ id: 'DeleteResourcesModal.sizeExceededTitle',
369
+ defaultMessage: 'File size exceeded'
370
+ },
371
+ fileSizeExceededDescription: {
372
+ id: 'DeleteResourcesModal.sizeExceededDescription',
373
+ description: 'Error description when the file size exceeds the allowable limit',
374
+ defaultMessage: 'The file exceeds the maximum allowed size of {fileSizeLimit} MB'
375
+ },
376
+ rowLimitExceededTitle: {
377
+ id: 'DeleteResourcesModal.rowLimitExceededTitle',
378
+ defaultMessage: 'Row limit exceeded'
379
+ },
380
+ rowLimitExceededDescription: {
381
+ id: 'DeleteResourcesModal.rowLimitExceededDescription',
382
+ description: 'Error description when the file contains more rows than the allowable maximum',
383
+ defaultMessage: 'The file contains more than the allowable maximum of {rowLimit} rows'
384
+ },
385
+ dropAreaNotEnoughRowsTitle: {
386
+ id: 'DeleteResourcesModal.dropAreaNotEnoughRowsTitle',
387
+ description: 'Error title shown when the uploaded CSV file does not contain a header and at least one row of data',
388
+ defaultMessage: 'Invalid CSV file'
389
+ },
390
+ dropAreaNotEnoughRowsDescription: {
391
+ id: 'DeleteResourcesModal.dropAreaNotEnoughRowsDescription',
392
+ description: 'Error description shown when the uploaded CSV file does not contain a header and at least one row of data',
393
+ defaultMessage: 'Make sure the file contains a header and at least one row of data'
394
+ },
395
+ unexpectedError: {
396
+ id: 'DeleteResourcesModal.unexpectedError',
397
+ description: 'Generic notification message when file upload fails',
398
+ defaultMessage: 'An unexpected error occurred during the file upload. Please try again, or contact support if this error occurs again.'
399
+ },
400
+ missingRequiredField: {
401
+ id: 'DeleteResourcesModal.missingRequiredField',
402
+ description: 'Error message displayed when a required field is missing',
403
+ defaultMessage: 'Missing required field'
404
+ },
405
+ missingKeyError: {
406
+ id: 'DeleteResourcesModal.missingKeyError',
407
+ description: 'Error message displayed when the uploaded file is missing the key field',
408
+ defaultMessage: "The 'key' field is missing or incomplete in some rows. Please ensure every row has a 'key' value."
409
+ },
410
+ csvFormatErrorTitle: {
411
+ id: 'DeleteResourcesModal.csvFormatErrorTitle',
412
+ description: 'Error title shown when the uploaded CSV file is not formatted correctly',
413
+ defaultMessage: 'Invalid CSV file'
414
+ },
415
+ csvFormatErrorDescription: {
416
+ id: 'UnpublishProductsModal.csvFormatErrorDescription',
417
+ description: 'Error message displayed when the CSV file is not formatted correctly',
418
+ defaultMessage: "Your CSV file is not formatted correctly. Make sure the file contains only one column named 'key', which includes the product keys"
419
+ }
420
+ });
421
+
422
+ const useUpload = () => {
423
+ const intl = reactIntl.useIntl();
424
+ const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
425
+ projectKey: context.project?.key
426
+ })),
427
+ projectKey = _useApplicationContex.projectKey;
428
+ const _useDeleteResourcesCo = useDeleteResourcesContext(),
429
+ resourceType = _useDeleteResourcesCo.resourceType,
430
+ state = _useDeleteResourcesCo.state,
431
+ actions = _useDeleteResourcesCo.actions;
432
+ const showNotification = actionsGlobal.useShowNotification();
433
+ const _useImportContainerUp = operations.useImportContainerUpload({
434
+ projectKey: projectKey
435
+ }),
436
+ upload = _useImportContainerUp.upload;
437
+ React__default["default"].useEffect(() => {
438
+ return () => {
439
+ if (state.abortController) state.abortController.abort();
440
+ };
441
+ }, [state.abortController]);
442
+ const isFileValid = async file => {
443
+ const errors = [];
444
+ const rowCount = await operations.getRowCount(file);
445
+ if (rowCount < 1) errors.push({
446
+ title: intl.formatMessage(messages$3.dropAreaNotEnoughRowsTitle),
447
+ description: intl.formatMessage(messages$3.dropAreaNotEnoughRowsDescription)
448
+ });
449
+ if (file.size > operations.toBytes(operations.MAX_FILE_SIZE_MB)) errors.push({
450
+ title: intl.formatMessage(messages$3.fileSizeExceededTitle),
451
+ description: intl.formatMessage(messages$3.fileSizeExceededDescription, {
452
+ fileSizeLimit: intl.formatNumber(operations.MAX_FILE_SIZE_MB)
453
+ })
454
+ });
455
+ if (!(await operations.hasSingleKeyColumn(file))) {
456
+ errors.push({
457
+ title: intl.formatMessage(messages$3.csvFormatErrorTitle),
458
+ description: intl.formatMessage(messages$3.csvFormatErrorDescription)
459
+ });
460
+ }
461
+ if (rowCount > operations.MAX_ROW_COUNT) errors.push({
462
+ title: intl.formatMessage(messages$3.rowLimitExceededTitle),
463
+ description: intl.formatMessage(messages$3.rowLimitExceededDescription, {
464
+ rowLimit: intl.formatNumber(operations.MAX_ROW_COUNT)
465
+ })
466
+ });
467
+ if (errors.length > 0) {
468
+ actions.setFileUploadErrors(errors);
469
+ actions.setCurrentStep('upload-error');
470
+ return false;
471
+ }
472
+ return true;
473
+ };
474
+ const handleUploadError = error => {
475
+ if (operations.isAbortError(error)) {
476
+ actions.cancelImport();
477
+ return;
478
+ }
479
+ if (error instanceof operations.HttpError) {
480
+ if (error.errorData?.code === 'MISSING_KEY_ERROR') {
481
+ actions.setFileUploadErrors([{
482
+ title: intl.formatMessage(messages$3.missingRequiredField),
483
+ description: intl.formatMessage(messages$3.missingKeyError)
484
+ }]);
485
+ actions.setCurrentStep('upload-error');
486
+ } else {
487
+ actions.cancelImport();
488
+ showNotification({
489
+ kind: 'error',
490
+ domain: constants.DOMAINS.PAGE,
491
+ text: intl.formatMessage(messages$3.unexpectedError)
492
+ });
493
+ }
494
+ } else {
495
+ actions.cancelImport();
496
+ showNotification({
497
+ kind: 'error',
498
+ domain: constants.DOMAINS.PAGE,
499
+ text: String(error)
500
+ });
501
+ sentry.reportErrorToSentry(new Error('Upload File Error: An unexpected issue occurred while uploading the file'), {
502
+ extra: {
503
+ error,
504
+ fileSizeInBytes: state.droppedFile?.size
505
+ }
506
+ });
507
+ }
508
+ };
509
+ const handleUploadAndValidation = async () => {
510
+ if (!state.droppedFile) return;
511
+ const canUpload = await isFileValid(state.droppedFile);
512
+ if (!canUpload) return;
513
+ actions.setCurrentStep('uploading');
514
+ try {
515
+ const xhr = await upload({
516
+ file: state.droppedFile,
517
+ resourceType,
518
+ onSuccess: (fileUploadResponse, importContainerKey) => {
519
+ actions.setContainerKey(importContainerKey);
520
+ actions.setUploadFileResponse(fileUploadResponse);
521
+ actions.setCurrentStep('upload-preview');
522
+ },
523
+ onProgress: progress => {
524
+ actions.setProgress(progress);
525
+ },
526
+ onError: handleUploadError
527
+ });
528
+ actions.setAbortController(xhr);
529
+ } catch (error) {
530
+ handleUploadError(error);
531
+ }
532
+ };
533
+ return {
534
+ handleUploadAndValidation
535
+ };
536
+ };
537
+
538
+ const FileDropArea = () => {
539
+ const intl = reactIntl.useIntl();
540
+ const _useDeleteResourcesCo = useDeleteResourcesContext(),
541
+ state = _useDeleteResourcesCo.state,
542
+ actions = _useDeleteResourcesCo.actions;
543
+ const showNotification = actionsGlobal.useShowNotification();
544
+ const onDrop = React__default["default"].useCallback(_ref => {
545
+ let _ref2 = _slicedToArray(_ref, 1),
546
+ file = _ref2[0];
547
+ if (!file) return;
548
+ actions.setDroppedFile(file);
549
+ }, [actions]);
550
+ const handleDropRejected = React__default["default"].useCallback(errorType => {
551
+ const errorMessageMap = {
552
+ 'too-many-files': messages$4.tooManyFilesError,
553
+ 'invalid-type': messages$4.fileFormatNotSupported,
554
+ generic: messages$4.genericError
555
+ };
556
+ showNotification({
557
+ kind: 'error',
558
+ domain: constants.DOMAINS.PAGE,
559
+ text: intl.formatMessage(errorMessageMap[errorType])
560
+ });
561
+ }, [intl, showNotification]);
562
+ const getState = React__default["default"].useCallback(isDragActive => getDropAreaState({
563
+ isReady: Boolean(state.droppedFile),
564
+ isDragActive
565
+ }), [state.droppedFile]);
566
+ return jsxRuntime.jsx(operations.FileDropArea, {
567
+ onDrop: onDrop,
568
+ onDropRejected: handleDropRejected,
569
+ accept: {
570
+ 'text/csv': ['.csv']
571
+ },
572
+ getDropAreaState: getState,
573
+ children: dropAreaState => getDropArea({
574
+ dropAreaState,
575
+ isFileDropped: Boolean(state.droppedFile),
576
+ fileName: state.droppedFile?.name,
577
+ messages: {
578
+ dragAndDropCSV: intl.formatMessage(messages$4.dragAndDropCSV),
579
+ or: intl.formatMessage(messages$4.or),
580
+ browseButton: intl.formatMessage(messages$4.browseButton),
581
+ chooseFile: intl.formatMessage(messages$4.chooseFile)
582
+ }
583
+ })
584
+ });
585
+ };
586
+
587
+ var sharedMessages = reactIntl.defineMessages({
588
+ deleteModalTitle: {
589
+ id: 'DeleteResourcesModal.deleteModalTitle',
590
+ description: 'The title of the modal',
591
+ defaultMessage: 'Bulk delete via CSV'
592
+ },
593
+ startBulkDelete: {
594
+ id: 'DeleteResourcesModal.startBulkDelete',
595
+ description: 'Start bulk delete button',
596
+ defaultMessage: 'Start bulk delete'
597
+ },
598
+ cancel: {
599
+ id: 'DeleteResourcesModal.cancel',
600
+ description: 'The label for the cancel button',
601
+ defaultMessage: 'Cancel'
602
+ },
603
+ product: {
604
+ id: 'DeleteResourcesModal.product',
605
+ description: 'Label for the product resource type',
606
+ defaultMessage: 'product'
607
+ },
608
+ products: {
609
+ id: 'DeleteResourcesModal.products',
610
+ description: 'Plural form of product',
611
+ defaultMessage: 'products'
612
+ },
613
+ inventory: {
614
+ id: 'DeleteResourcesModal.inventory',
615
+ description: 'Label for the inventory entry resource type',
616
+ defaultMessage: 'inventory entry'
617
+ },
618
+ inventories: {
619
+ id: 'DeleteResourcesModal.inventories',
620
+ description: 'Plural form of inventory entry',
621
+ defaultMessage: 'inventory entries'
622
+ },
623
+ category: {
624
+ id: 'DeleteResourcesModal.category',
625
+ description: 'Label for the category resource type',
626
+ defaultMessage: 'category'
627
+ },
628
+ categories: {
629
+ id: 'DeleteResourcesModal.categories',
630
+ description: 'Plural form of category',
631
+ defaultMessage: 'categories'
632
+ },
633
+ customer: {
634
+ id: 'DeleteResourcesModal.customer',
635
+ description: 'Label for the customer resource type',
636
+ defaultMessage: 'customer'
637
+ },
638
+ customers: {
639
+ id: 'DeleteResourcesModal.customers',
640
+ description: 'Plural form of customer',
641
+ defaultMessage: 'customers'
642
+ },
643
+ order: {
644
+ id: 'DeleteResourcesModal.order',
645
+ description: 'Label for the order resource type',
646
+ defaultMessage: 'order'
647
+ },
648
+ orders: {
649
+ id: 'DeleteResourcesModal.orders',
650
+ description: 'Plural form of order',
651
+ defaultMessage: 'orders'
652
+ },
653
+ price: {
654
+ id: 'DeleteResourcesModal.price',
655
+ description: 'Label for the price resource type',
656
+ defaultMessage: 'price'
657
+ },
658
+ prices: {
659
+ id: 'DeleteResourcesModal.prices',
660
+ description: 'Plural form of price',
661
+ defaultMessage: 'prices'
662
+ },
663
+ 'product-draft': {
664
+ id: 'DeleteResourcesModal.product-draft',
665
+ description: 'Label for the product-draft resource type',
666
+ defaultMessage: 'product draft'
667
+ },
668
+ 'product-drafts': {
669
+ id: 'DeleteResourcesModal.product-drafts',
670
+ description: 'Plural form of product draft',
671
+ defaultMessage: 'product drafts'
672
+ },
673
+ 'product-type': {
674
+ id: 'DeleteResourcesModal.product-type',
675
+ description: 'Label for the product-type resource type',
676
+ defaultMessage: 'product type'
677
+ },
678
+ 'product-types': {
679
+ id: 'DeleteResourcesModal.product-types',
680
+ description: 'Plural form of product type',
681
+ defaultMessage: 'product types'
682
+ },
683
+ 'product-variant': {
684
+ id: 'DeleteResourcesModal.product-variant',
685
+ description: 'Label for the product-variant resource type',
686
+ defaultMessage: 'product variant'
687
+ },
688
+ 'product-variants': {
689
+ id: 'DeleteResourcesModal.product-variants',
690
+ description: 'Plural form of product variant',
691
+ defaultMessage: 'product variants'
692
+ },
693
+ 'product-variant-patch': {
694
+ id: 'DeleteResourcesModal.product-variant-patch',
695
+ description: 'Label for the product-variant-patch resource type',
696
+ defaultMessage: 'product variant patch'
697
+ },
698
+ 'product-variant-patches': {
699
+ id: 'DeleteResourcesModal.product-variant-patches',
700
+ description: 'Plural form of product variant patch',
701
+ defaultMessage: 'product variant patches'
702
+ },
703
+ 'standalone-price': {
704
+ id: 'DeleteResourcesModal.standalone-price',
705
+ description: 'Label for the standalone-price resource type',
706
+ defaultMessage: 'standalone price'
707
+ },
708
+ 'standalone-prices': {
709
+ id: 'DeleteResourcesModal.standalone-prices',
710
+ description: 'Plural form of standalone price',
711
+ defaultMessage: 'standalone prices'
712
+ },
713
+ 'discount-code': {
714
+ id: 'DeleteResourcesModal.discount-code',
715
+ description: 'Label for the discount-code resource type',
716
+ defaultMessage: 'discount code'
717
+ },
718
+ 'discount-codes': {
719
+ id: 'DeleteResourcesModal.discount-codes',
720
+ description: 'Plural form of discount code',
721
+ defaultMessage: 'discount codes'
722
+ },
723
+ unknownResourceType: {
724
+ id: 'DeleteResourcesModal.unknown-resource-type',
725
+ description: 'Label for the unknown resource type',
726
+ defaultMessage: 'unknown resource type'
727
+ }
728
+ });
729
+
730
+ var messages$2 = reactIntl.defineMessages({
731
+ fileUploadInstruction: {
732
+ id: 'DeleteResourcesModal.fileUploadInstruction',
733
+ description: 'Instructions for uploading a CSV file with resource keys to delete',
734
+ defaultMessage: "The CSV file must contain the {resourceType} keys to be deleted under the header 'key'."
735
+ },
736
+ fileUploadInstructionForMaxFileSize: {
737
+ id: 'DeleteResourcesModal.fileUploadInstructionForMaxFileSize',
738
+ description: 'Instructions for uploading a CSV file with a max file size',
739
+ 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>.'
740
+ },
741
+ unpublishNote: {
742
+ id: 'DeleteResourcesModal.unpublishNote',
743
+ description: 'Note to unpublish products before deleting them',
744
+ defaultMessage: 'Please note that published products <b>must be unpublished</b> before they can be deleted.'
745
+ }
746
+ });
747
+
748
+ const DOCUMENTATION_LINKS = {
749
+ product: 'https://docs.commercetools.com/merchant-center/product-list#bulk-delete-via-csv-import'
750
+ };
751
+ const TEMPLATE_DOWNLOAD_LINKS = {
752
+ product: 'https://docs.commercetools.com/merchant-center/downloads/product_delete_import_template.csv'
753
+ };
754
+
755
+ function resourceTypeToMessage(resourceType) {
756
+ const resourceTypeMap = {
757
+ category: sharedMessages.category,
758
+ product: sharedMessages.product,
759
+ 'product-type': sharedMessages['product-type'],
760
+ order: sharedMessages.order,
761
+ customer: sharedMessages.customer,
762
+ 'discount-code': sharedMessages['discount-code'],
763
+ inventory: sharedMessages.inventory,
764
+ // TODO: remove `inventory` after aligning the resource type names in the file upload API
765
+ 'inventory-entry': sharedMessages.inventory,
766
+ 'order-patch': sharedMessages['order-patch'],
767
+ price: sharedMessages.price,
768
+ 'product-draft': sharedMessages['product-draft'],
769
+ 'product-variant': sharedMessages['product-variant'],
770
+ 'product-variant-patch': sharedMessages['product-variant-patch'],
771
+ 'standalone-price': sharedMessages['standalone-price']
772
+ };
773
+ const message = resourceTypeMap[resourceType];
774
+ if (!message) {
775
+ console.warn(new UnexpectedResourceTypeError(resourceType));
776
+ return sharedMessages.unknownResourceType;
777
+ }
778
+ return message;
779
+ }
780
+ function resourceTypeToPluralMessage(resourceType) {
781
+ const resourceTypePluralMap = {
782
+ category: sharedMessages.categories,
783
+ product: sharedMessages.products,
784
+ 'product-type': sharedMessages['product-types'],
785
+ order: sharedMessages.orders,
786
+ customer: sharedMessages.customers,
787
+ 'discount-code': sharedMessages['discount-codes'],
788
+ inventory: sharedMessages.inventories,
789
+ // TODO: remove `inventory` after aligning the resource type names in the file upload API
790
+ 'inventory-entry': sharedMessages.inventories,
791
+ 'order-patch': sharedMessages['order-patches'],
792
+ price: sharedMessages.prices,
793
+ 'product-draft': sharedMessages['product-drafts'],
794
+ 'product-variant': sharedMessages['product-variants'],
795
+ 'product-variant-patch': sharedMessages['product-variant-patches'],
796
+ 'standalone-price': sharedMessages['standalone-prices']
797
+ };
798
+ const message = resourceTypePluralMap[resourceType];
799
+ if (!message) {
800
+ console.warn(new UnexpectedResourceTypeError(resourceType));
801
+ return sharedMessages.unknownResourceType;
802
+ }
803
+ return message;
804
+ }
805
+
806
+ 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; }
807
+ 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; }
808
+ const Instructions = () => {
809
+ const intl = reactIntl.useIntl();
810
+ const _useDeleteResourcesCo = useDeleteResourcesContext(),
811
+ resourceType = _useDeleteResourcesCo.resourceType;
812
+ const documentTemplateLink = TEMPLATE_DOWNLOAD_LINKS[resourceType];
813
+ const documentationLink = DOCUMENTATION_LINKS[resourceType];
814
+ return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
815
+ scale: "m",
816
+ children: [jsxRuntime.jsxs(uiKit.Text.Body, {
817
+ children: [intl.formatMessage(messages$2.fileUploadInstruction, {
818
+ resourceType: intl.formatMessage(resourceTypeToMessage(resourceType))
819
+ }), ' ', intl.formatMessage(messages$2.unpublishNote, {
820
+ b: msg => jsxRuntime.jsx("b", {
821
+ children: msg
822
+ }, "bold")
823
+ })]
824
+ }), jsxRuntime.jsx(uiKit.Text.Body, {
825
+ intlMessage: _objectSpread$5(_objectSpread$5({}, messages$2.fileUploadInstructionForMaxFileSize), {}, {
826
+ values: {
827
+ maxFileSize: intl.formatNumber(operations.MAX_FILE_SIZE_MB),
828
+ maxRowCount: intl.formatNumber(operations.MAX_ROW_COUNT),
829
+ csvTemplateLink: msg => jsxRuntime.jsx(uiKit.Link, {
830
+ tone: "secondary",
831
+ isExternal: true,
832
+ to: documentTemplateLink,
833
+ children: msg
834
+ }, "csvTemplateLink"),
835
+ documentationLink: msg => jsxRuntime.jsx(uiKit.Link, {
836
+ tone: "secondary",
837
+ isExternal: true,
838
+ to: documentationLink,
839
+ children: msg
840
+ }, "documentationLink")
841
+ }
842
+ })
843
+ })]
844
+ });
845
+ };
846
+
847
+ const Upload = () => {
848
+ const _useDeleteResourcesCo = useDeleteResourcesContext(),
849
+ state = _useDeleteResourcesCo.state,
850
+ onClose = _useDeleteResourcesCo.onClose;
851
+ const intl = reactIntl.useIntl();
852
+ const _useUpload = useUpload(),
853
+ handleUploadAndValidation = _useUpload.handleUploadAndValidation;
854
+ return jsxRuntime.jsx(applicationComponents.FormDialog, {
855
+ size: 16,
856
+ isOpen: true,
857
+ title: intl.formatMessage(sharedMessages.deleteModalTitle),
858
+ labelPrimary: intl.formatMessage(messages$4.uploadAndPreview),
859
+ onPrimaryButtonClick: handleUploadAndValidation,
860
+ isPrimaryButtonDisabled: !Boolean(state.droppedFile),
861
+ onSecondaryButtonClick: () => onClose({
862
+ shouldDeleteImportContainer: true
863
+ }),
864
+ onClose: () => onClose({
865
+ shouldDeleteImportContainer: true
866
+ }),
867
+ children: jsxRuntime.jsx(fullstory.Masking.Unmask, {
868
+ children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
869
+ scale: "m",
870
+ children: [jsxRuntime.jsx(Instructions, {}), jsxRuntime.jsx(FileDropArea, {})]
871
+ })
872
+ })
873
+ });
874
+ };
875
+
876
+ const Uploading = () => {
877
+ const intl = reactIntl.useIntl();
878
+ const _useDeleteResourcesCo = useDeleteResourcesContext(),
879
+ state = _useDeleteResourcesCo.state,
880
+ actions = _useDeleteResourcesCo.actions,
881
+ onClose = _useDeleteResourcesCo.onClose;
882
+ if (!state.droppedFile?.name) return null;
883
+ return jsxRuntime.jsx(operations.UploadingModal, {
884
+ isOpen: true,
885
+ title: intl.formatMessage(sharedMessages.deleteModalTitle),
886
+ fileName: state.droppedFile.name,
887
+ fileSize: state.droppedFile.size,
888
+ progress: state.progress,
889
+ cancelLabel: intl.formatMessage(sharedMessages.cancel),
890
+ onCancel: () => {
891
+ actions.setCurrentStep('upload');
892
+ state.abortController.abort();
893
+ },
894
+ onClose: () => onClose({
895
+ shouldDeleteImportContainer: true
896
+ })
897
+ });
898
+ };
899
+
900
+ var messages$1 = reactIntl.defineMessages({
901
+ uploadNewFile: {
902
+ id: 'DeleteResourcesModal.uploadNewFile',
903
+ defaultMessage: 'Upload new file'
904
+ },
905
+ uploadErrorDescription: {
906
+ id: 'DeleteResourcesModal.uploadError',
907
+ description: 'Title when errors detected while uploading file',
908
+ defaultMessage: 'There {errorsCount, plural, one {is <b>1</b> error} other {are <b>{errorsCount}</b> errors}} detected while uploading the file "{fileName}".'
909
+ },
910
+ errorType: {
911
+ id: 'DeleteResourcesModal.errorType',
912
+ description: 'Error type" column',
913
+ defaultMessage: 'Error type'
914
+ },
915
+ details: {
916
+ id: 'DeleteResourcesModal.details',
917
+ description: '"Details" column',
918
+ defaultMessage: 'Details'
919
+ }
920
+ });
921
+
922
+ 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; }
923
+ 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; }
924
+ const getColumns = () => [{
925
+ key: 'errorType',
926
+ label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages$1.errorType)),
927
+ width: 'max-content'
928
+ }, {
929
+ key: 'details',
930
+ label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages$1.details))
931
+ }];
932
+ const UploadErrorTable = props => {
933
+ var _context;
934
+ const pagination = uiKit.usePaginationState({
935
+ perPage: 10
936
+ });
937
+ const startIndex = (pagination.page.value - 1) * pagination.perPage.value;
938
+ const endIndex = startIndex + pagination.perPage.value;
939
+ const currentPageRows = _sliceInstanceProperty__default["default"](_context = props.rows).call(_context, startIndex, endIndex);
940
+ const shouldShowPagination = props.rows.length > pagination.perPage.value;
941
+ return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
942
+ scale: "l",
943
+ children: [jsxRuntime.jsx(uiKit.DataTable, {
944
+ verticalCellAlignment: "center",
945
+ isCondensed: true,
946
+ rows: currentPageRows,
947
+ columns: getColumns(),
948
+ itemRenderer: itemRenderer
949
+ }), shouldShowPagination && jsxRuntime.jsx(uiKit.PageNavigator, {
950
+ onPageChange: pagination.page.onChange,
951
+ page: pagination.page.value,
952
+ totalPages: Math.ceil(props.rows.length / pagination.perPage.value)
953
+ })]
954
+ });
955
+ };
956
+ function itemRenderer(item, column) {
957
+ switch (column.key) {
958
+ case 'errorType':
959
+ return jsxRuntime.jsx(uiKit.Stamp, {
960
+ isCondensed: true,
961
+ label: item.title,
962
+ tone: "critical"
963
+ });
964
+ case 'details':
965
+ return jsxRuntime.jsx(uiKit.Text.Body, {
966
+ children: item.description
967
+ });
968
+ default:
969
+ return null;
970
+ }
971
+ }
972
+
973
+ 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; }
974
+ 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; }
975
+ const UploadErrorsModal = () => {
976
+ const intl = reactIntl.useIntl();
977
+ const _useDeleteResourcesCo = useDeleteResourcesContext(),
978
+ state = _useDeleteResourcesCo.state,
979
+ actions = _useDeleteResourcesCo.actions,
980
+ onClose = _useDeleteResourcesCo.onClose;
981
+ const errorsCount = state.fileUploadErrors.length;
982
+ return jsxRuntime.jsx(applicationComponents.InfoDialog, {
983
+ size: 16,
984
+ isOpen: true,
985
+ title: intl.formatMessage(sharedMessages.deleteModalTitle),
986
+ onClose: () => onClose(),
987
+ children: jsxRuntime.jsx(fullstory.Masking.Unmask, {
988
+ children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
989
+ scale: "l",
990
+ children: [jsxRuntime.jsx(fullstory.Masking.Mask, {
991
+ children: jsxRuntime.jsx(uiKit.Text.Body, {
992
+ intlMessage: _objectSpread$3(_objectSpread$3({}, messages$1.uploadErrorDescription), {}, {
993
+ values: {
994
+ fileName: state.droppedFile?.name,
995
+ errorsCount: intl.formatNumber(errorsCount),
996
+ b: getBold$2
997
+ }
998
+ })
999
+ })
1000
+ }), jsxRuntime.jsx(UploadErrorTable, {
1001
+ rows: operations.mapFileUploadErrorsToUploadFileErrorRows(state.fileUploadErrors)
1002
+ }), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
1003
+ scale: "m",
1004
+ justifyContent: "flex-end",
1005
+ children: [jsxRuntime.jsx(uiKit.SecondaryButton, {
1006
+ label: intl.formatMessage(sharedMessages.cancel),
1007
+ onClick: () => onClose()
1008
+ }), jsxRuntime.jsx(uiKit.PrimaryButton, {
1009
+ iconLeft: jsxRuntime.jsx(uiKit.ImportIcon, {}),
1010
+ label: intl.formatMessage(messages$1.uploadNewFile),
1011
+ onClick: () => actions.uploadNewFile()
1012
+ })]
1013
+ })]
1014
+ })
1015
+ })
1016
+ });
1017
+ };
1018
+ function getBold$2(msg) {
1019
+ return jsxRuntime.jsx(uiKit.Text.Body, {
1020
+ as: "span",
1021
+ isBold: true,
1022
+ children: msg
1023
+ }, crypto.randomUUID());
1024
+ }
1025
+
1026
+ var messages = reactIntl.defineMessages({
1027
+ continue: {
1028
+ id: 'DeleteResourcesModal.continue',
1029
+ description: 'Continue button',
1030
+ defaultMessage: 'Continue'
1031
+ },
1032
+ heresAPreview: {
1033
+ id: 'DeleteResourcesModal.heresAPreview',
1034
+ description: 'Here is a preview',
1035
+ defaultMessage: "Here's a preview:"
1036
+ },
1037
+ resourcesToBeDeleted: {
1038
+ id: 'DeleteResourcesModal.resourcesToBeDeleted',
1039
+ description: 'Resources to be deleted',
1040
+ defaultMessage: '{count, plural, one {<b>{count}</b> {resourceType} to be deleted} other {<b>{count}</b> {resourceTypePlural} to be deleted}}'
1041
+ },
1042
+ confirmationQuestion: {
1043
+ id: 'DeleteResourcesModal.confirmationQuestion',
1044
+ description: 'Confirmation question',
1045
+ defaultMessage: 'Are you sure you want to delete the {resourceTypePlural}? '
1046
+ },
1047
+ confirmationText: {
1048
+ id: 'DeleteResourcesModal.confirmationText',
1049
+ description: 'Confirmation text',
1050
+ 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>.}}'
1051
+ },
1052
+ cannotBeUndoneNote: {
1053
+ id: 'DeleteResourcesModal.cannotBeUndoneNote',
1054
+ description: 'Cannot be undone note in the confirmation dialog',
1055
+ defaultMessage: 'This action cannot be undone.'
1056
+ },
1057
+ importStarted: {
1058
+ id: 'DeleteResourcesModal.importStarted',
1059
+ description: 'Import started',
1060
+ defaultMessage: '<b>Your import for bulk delete has started.</b><newline></newline>Go to <logsLink>Import logs</logsLink> to view the progress.'
1061
+ },
1062
+ preparingImport: {
1063
+ id: 'DeleteResourcesModal.preparingImport',
1064
+ description: 'Preparing import',
1065
+ 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.'
1066
+ }
1067
+ });
1068
+
1069
+ 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; }
1070
+ 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; }
1071
+ const getNewLine = () => jsxRuntime.jsx("br", {}, "break");
1072
+ const getImportLogsLink = (msg, projectKey) => jsxRuntime.jsx(uiKit.Link, {
1073
+ to: `/${projectKey}/operations/import/logs`,
1074
+ children: msg
1075
+ }, "link");
1076
+ var _ref2 = {
1077
+ name: "1vs9i7r",
1078
+ styles: "width:360px"
1079
+ } ;
1080
+ const ImportRunningTextNotification = props => jsxRuntime.jsx("div", {
1081
+ css: _ref2,
1082
+ children: jsxRuntime.jsx(uiKit.Text.Body, {
1083
+ intlMessage: _objectSpread$2(_objectSpread$2({}, messages.importStarted), {}, {
1084
+ values: {
1085
+ newline: getNewLine,
1086
+ logsLink: msg => getImportLogsLink(msg, props.projectKey),
1087
+ b: getBold$1
1088
+ }
1089
+ })
1090
+ })
1091
+ });
1092
+ var _ref = {
1093
+ name: "1vs9i7r",
1094
+ styles: "width:360px"
1095
+ } ;
1096
+ const ImportPreparingTextNotification = props => jsxRuntime.jsx("div", {
1097
+ css: _ref,
1098
+ children: jsxRuntime.jsx(uiKit.Text.Body, {
1099
+ intlMessage: _objectSpread$2(_objectSpread$2({}, messages.preparingImport), {}, {
1100
+ values: {
1101
+ newline: getNewLine,
1102
+ logsLink: msg => getImportLogsLink(msg, props.projectKey),
1103
+ b: getBold$1
1104
+ }
1105
+ })
1106
+ })
1107
+ });
1108
+ const DeleteResourcesConfirmationModal = () => {
1109
+ const intl = reactIntl.useIntl();
1110
+ const _useDeleteResourcesCo = useDeleteResourcesContext(),
1111
+ resourceType = _useDeleteResourcesCo.resourceType,
1112
+ state = _useDeleteResourcesCo.state,
1113
+ onClose = _useDeleteResourcesCo.onClose;
1114
+ const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
1115
+ projectKey: context.project?.key,
1116
+ projectName: context.project?.name
1117
+ })),
1118
+ projectKey = _useApplicationContex.projectKey,
1119
+ projectName = _useApplicationContex.projectName;
1120
+ const showNotification = actionsGlobal.useShowNotification();
1121
+ const onStartImport = async () => {
1122
+ try {
1123
+ const canConfirm = projectKey && state.containerKey && state.droppedFile?.name;
1124
+ if (!canConfirm) return;
1125
+ onClose();
1126
+ showNotification({
1127
+ kind: 'info',
1128
+ domain: constants.DOMAINS.SIDE,
1129
+ // @ts-ignore
1130
+ text: jsxRuntime.jsx(ImportPreparingTextNotification, {
1131
+ projectKey: projectKey
1132
+ })
1133
+ }, {
1134
+ dismissAfter: 5000
1135
+ });
1136
+ await operations.processUploadedFile({
1137
+ projectKey,
1138
+ importContainerKey: state.containerKey,
1139
+ resourceType,
1140
+ action: 'delete'
1141
+ });
1142
+ showNotification({
1143
+ kind: 'info',
1144
+ domain: constants.DOMAINS.SIDE,
1145
+ // @ts-ignore
1146
+ text: jsxRuntime.jsx(ImportRunningTextNotification, {
1147
+ projectKey: projectKey
1148
+ })
1149
+ }, {
1150
+ dismissAfter: 5000
1151
+ });
1152
+ } catch (error) {
1153
+ onClose({
1154
+ shouldDeleteImportContainer: true
1155
+ });
1156
+ showNotification({
1157
+ kind: 'error',
1158
+ domain: constants.DOMAINS.PAGE,
1159
+ text: String(error)
1160
+ });
1161
+ }
1162
+ };
1163
+ return jsxRuntime.jsx(applicationComponents.InfoDialog, {
1164
+ title: intl.formatMessage(sharedMessages.deleteModalTitle),
1165
+ isOpen: true,
1166
+ onClose: () => onClose({
1167
+ shouldDeleteImportContainer: true
1168
+ }),
1169
+ size: 16,
1170
+ children: jsxRuntime.jsx(fullstory.Masking.Unmask, {
1171
+ children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
1172
+ scale: "xl",
1173
+ children: [jsxRuntime.jsxs(uiKit.Spacings.Stack, {
1174
+ scale: "m",
1175
+ children: [jsxRuntime.jsxs("div", {
1176
+ children: [jsxRuntime.jsx(uiKit.Text.Body, {
1177
+ intlMessage: _objectSpread$2(_objectSpread$2({}, messages.confirmationText), {}, {
1178
+ values: {
1179
+ projectName: projectName,
1180
+ resourceTypePlural: intl.formatMessage(resourceTypeToPluralMessage(resourceType)),
1181
+ resourceType: intl.formatMessage(resourceTypeToMessage(resourceType)),
1182
+ count: intl.formatNumber(state.uploadFileResponse?.rowsCount),
1183
+ b: getBold$1
1184
+ }
1185
+ })
1186
+ }), jsxRuntime.jsx(uiKit.Text.Body, {
1187
+ intlMessage: _objectSpread$2(_objectSpread$2({}, messages.confirmationQuestion), {}, {
1188
+ values: {
1189
+ resourceTypePlural: intl.formatMessage(resourceTypeToPluralMessage(resourceType))
1190
+ }
1191
+ })
1192
+ })]
1193
+ }), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
1194
+ scale: "s",
1195
+ alignItems: "center",
1196
+ children: [jsxRuntime.jsx(uiKit.WarningIcon, {
1197
+ size: "40",
1198
+ color: "warning"
1199
+ }), jsxRuntime.jsx(uiKit.Text.Body, {
1200
+ intlMessage: messages.cannotBeUndoneNote
1201
+ })]
1202
+ })]
1203
+ }), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
1204
+ scale: "m",
1205
+ justifyContent: "flex-end",
1206
+ children: [jsxRuntime.jsx(uiKit.SecondaryButton, {
1207
+ "data-test-id": "confirmation-dialog-cancel",
1208
+ label: intl.formatMessage(sharedMessages.cancel),
1209
+ onClick: () => onClose({
1210
+ shouldDeleteImportContainer: true
1211
+ })
1212
+ }), jsxRuntime.jsx(uiKit.PrimaryButton, {
1213
+ tone: "critical",
1214
+ "data-test-id": "confirmation-dialog-confirm",
1215
+ label: intl.formatMessage(sharedMessages.startBulkDelete),
1216
+ onClick: onStartImport
1217
+ })]
1218
+ })]
1219
+ })
1220
+ })
1221
+ });
1222
+ };
1223
+ function getBold$1(msg) {
1224
+ return jsxRuntime.jsx(uiKit.Text.Body, {
1225
+ as: "span",
1226
+ isBold: true,
1227
+ children: msg
1228
+ }, crypto.randomUUID());
1229
+ }
1230
+
1231
+ 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; }
1232
+ 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; }
1233
+ function UploadPreviewModal() {
1234
+ const _useDeleteResourcesCo = useDeleteResourcesContext(),
1235
+ resourceType = _useDeleteResourcesCo.resourceType,
1236
+ state = _useDeleteResourcesCo.state,
1237
+ onClose = _useDeleteResourcesCo.onClose,
1238
+ actions = _useDeleteResourcesCo.actions;
1239
+ const intl = reactIntl.useIntl();
1240
+ return jsxRuntime.jsx(applicationComponents.FormDialog, {
1241
+ size: 16,
1242
+ isOpen: true,
1243
+ title: intl.formatMessage(sharedMessages.deleteModalTitle),
1244
+ labelPrimary: intl.formatMessage(messages.continue),
1245
+ onSecondaryButtonClick: () => onClose({
1246
+ shouldDeleteImportContainer: true
1247
+ }),
1248
+ onPrimaryButtonClick: () => {
1249
+ actions.setCurrentStep('delete-confirmation');
1250
+ },
1251
+ onClose: () => onClose({
1252
+ shouldDeleteImportContainer: true
1253
+ }),
1254
+ children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
1255
+ scale: "m",
1256
+ children: [jsxRuntime.jsx(uiKit.Text.Body, {
1257
+ intlMessage: messages.heresAPreview
1258
+ }), jsxRuntime.jsx(uiKit.Card, {
1259
+ insetScale: "xl",
1260
+ children: jsxRuntime.jsxs(uiKit.Spacings.Inline, {
1261
+ scale: "m",
1262
+ alignItems: "center",
1263
+ children: [jsxRuntime.jsx(uiKit.BinLinearIcon, {
1264
+ size: "40",
1265
+ color: "neutral60"
1266
+ }), jsxRuntime.jsx(uiKit.Text.Body, {
1267
+ intlMessage: _objectSpread$1(_objectSpread$1({}, messages.resourcesToBeDeleted), {}, {
1268
+ values: {
1269
+ resourceType: intl.formatMessage(resourceTypeToMessage(resourceType)),
1270
+ resourceTypePlural: intl.formatMessage(resourceTypeToPluralMessage(resourceType)),
1271
+ count: intl.formatNumber(state.uploadFileResponse?.rowsCount),
1272
+ b: getBold
1273
+ }
1274
+ })
1275
+ })]
1276
+ })
1277
+ })]
1278
+ })
1279
+ });
1280
+ }
1281
+ function getBold(msg) {
1282
+ return jsxRuntime.jsx(uiKit.Text.Body, {
1283
+ as: "span",
1284
+ isBold: true,
1285
+ children: msg
1286
+ }, `bold-${msg}`);
1287
+ }
1288
+
1289
+ const steps = {
1290
+ upload: jsxRuntime.jsx(Upload, {}),
1291
+ uploading: jsxRuntime.jsx(Uploading, {}),
1292
+ 'upload-preview': jsxRuntime.jsx(UploadPreviewModal, {}),
1293
+ 'upload-error': jsxRuntime.jsx(UploadErrorsModal, {}),
1294
+ 'delete-confirmation': jsxRuntime.jsx(DeleteResourcesConfirmationModal, {})
1295
+ };
1296
+ const CurrentStep = () => {
1297
+ const _useDeleteResourcesCo = useDeleteResourcesContext(),
1298
+ state = _useDeleteResourcesCo.state;
1299
+ return steps[state.currentStep] || null;
1300
+ };
1301
+
1302
+ const getChunkImport = locale => {
1303
+ const intlLocale = i18n.mapLocaleToIntlLocale(locale);
1304
+ switch (intlLocale) {
1305
+ case 'de':
1306
+ return Promise.resolve().then(function () { return require('./de-9dc6c41a.cjs.prod.js'); });
1307
+ case 'es':
1308
+ return Promise.resolve().then(function () { return require('./es-64fd0c08.cjs.prod.js'); });
1309
+ case 'fr-FR':
1310
+ return Promise.resolve().then(function () { return require('./fr-FR-90c7194f.cjs.prod.js'); });
1311
+ case 'ja':
1312
+ return Promise.resolve().then(function () { return require('./ja-37632763.cjs.prod.js'); });
1313
+ case 'pt-BR':
1314
+ return Promise.resolve().then(function () { return require('./pt-BR-2da91387.cjs.prod.js'); });
1315
+ default:
1316
+ return Promise.resolve().then(function () { return require('./en-a983f180.cjs.prod.js'); });
1317
+ }
1318
+ };
1319
+ const loadMessages = async locale => {
1320
+ try {
1321
+ const chunkImport = await getChunkImport(locale);
1322
+ return i18n.parseChunkImport(chunkImport);
1323
+ } catch (error) {
1324
+ // eslint-disable-next-line no-console
1325
+ console.warn(`Something went wrong while loading the delete-resources-modal messages for ${locale}`, error);
1326
+ sentry.reportErrorToSentry(new Error(`Something went wrong while loading the delete-resources-modal messages for ${locale}`), {
1327
+ extra: error
1328
+ });
1329
+ return {};
1330
+ }
1331
+ };
1332
+
1333
+ const useAsyncIntlMessages = (locale, loader) => {
1334
+ const _useState = React.useState({
1335
+ isLoading: true,
1336
+ messages: undefined,
1337
+ error: undefined
1338
+ }),
1339
+ _useState2 = _slicedToArray(_useState, 2),
1340
+ state = _useState2[0],
1341
+ setState = _useState2[1];
1342
+ React.useEffect(() => {
1343
+ let _isUnmounting = false;
1344
+ async function load() {
1345
+ try {
1346
+ if (!_isUnmounting) {
1347
+ const messages = await loader(locale);
1348
+ setState({
1349
+ isLoading: false,
1350
+ messages
1351
+ });
1352
+ }
1353
+ } catch (error) {
1354
+ setState({
1355
+ isLoading: false,
1356
+ error
1357
+ });
1358
+ }
1359
+ }
1360
+ if (locale) load();
1361
+ return () => {
1362
+ _isUnmounting = true;
1363
+ };
1364
+ }, [locale, loader]);
1365
+ return state;
1366
+ };
1367
+
1368
+ 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; }
1369
+ 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; }
1370
+ const DeleteResourcesModal = props => {
1371
+ const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
1372
+ locale: context.user && context.user.locale
1373
+ })),
1374
+ locale = _useApplicationContex.locale;
1375
+ const messages = useAsyncIntlMessages(locale, loadMessages);
1376
+ if (!props.isOpen || messages.isLoading) return null;
1377
+ return jsxRuntime.jsx(reactIntl.IntlProvider, {
1378
+ locale: locale,
1379
+ messages: messages.messages,
1380
+ children: jsxRuntime.jsx(DeleteResourcesProvider, _objectSpread(_objectSpread({}, props), {}, {
1381
+ children: jsxRuntime.jsx(CurrentStep, {})
1382
+ }))
1383
+ });
1384
+ };
1385
+ DeleteResourcesModal.displayName = 'DeleteResourcesModal';
1386
+
1387
+ exports["default"] = DeleteResourcesModal;