@commercetools-frontend-extensions/unpublish-products-modal 1.2.8 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commercetools-frontend-extensions-unpublish-products-modal.cjs.dev.js +227 -100
- package/dist/commercetools-frontend-extensions-unpublish-products-modal.cjs.prod.js +225 -98
- package/dist/commercetools-frontend-extensions-unpublish-products-modal.esm.js +228 -101
- package/package.json +15 -15
|
@@ -11,7 +11,7 @@ import { defineMessages, useIntl, FormattedMessage, IntlProvider } from 'react-i
|
|
|
11
11
|
import { useApplicationContext } from '@commercetools-frontend/application-shell-connectors';
|
|
12
12
|
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
13
13
|
import React, { useContext, useState, useEffect } from 'react';
|
|
14
|
-
import { deleteImportContainer, EnabledDropArea, FileDroppedArea, ActiveDragDropArea,
|
|
14
|
+
import { deleteImportContainer, EnabledDropArea, FileDroppedArea, ActiveDragDropArea, useFileUpload, getRowCount, toBytes, hasSingleKeyColumn, countUniqueResourcesInCsv, isAbortError, HttpError, IMPORT_MAX_FILE_SIZE_MB, IMPORT_LEGACY_MAX_FILE_SIZE_MB, IMPORT_MAX_ITEM_COUNT, IMPORT_LEGACY_MAX_ROW_COUNT, FileDropArea as FileDropArea$1, UploadingModal, mapFileUploadErrorsToUploadFileErrorRows, processFileImportJob, processUploadedFile } from '@commercetools-frontend-extensions/operations';
|
|
15
15
|
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
16
16
|
import { FormDialog, InfoDialog, ConfirmationDialog } from '@commercetools-frontend/application-components';
|
|
17
17
|
import { Masking } from '@commercetools-frontend/fullstory';
|
|
@@ -25,60 +25,85 @@ import _possibleConstructorReturn from '@babel/runtime-corejs3/helpers/esm/possi
|
|
|
25
25
|
import _getPrototypeOf from '@babel/runtime-corejs3/helpers/esm/getPrototypeOf';
|
|
26
26
|
import _inherits from '@babel/runtime-corejs3/helpers/esm/inherits';
|
|
27
27
|
import _wrapNativeSuper from '@babel/runtime-corejs3/helpers/esm/wrapNativeSuper';
|
|
28
|
+
import { useFeatureToggle } from '@commercetools-frontend/application-shell';
|
|
28
29
|
import { reportErrorToSentry } from '@commercetools-frontend/sentry';
|
|
29
30
|
import _sliceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/slice';
|
|
30
31
|
import '@emotion/react';
|
|
31
32
|
import { parseChunkImport, mapLocaleToIntlLocale } from '@commercetools-frontend/i18n';
|
|
32
33
|
|
|
33
|
-
function ownKeys$
|
|
34
|
-
function _objectSpread$
|
|
34
|
+
function ownKeys$7(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
35
|
+
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$7(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$7(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
35
36
|
function reducer(state, action) {
|
|
36
|
-
if (action.type === 'setCurrentStep') return _objectSpread$
|
|
37
|
+
if (action.type === 'setCurrentStep') return _objectSpread$7(_objectSpread$7({}, state), {}, {
|
|
37
38
|
currentStep: action.currentStep,
|
|
38
39
|
progress: 0
|
|
39
40
|
});
|
|
40
|
-
if (action.type === 'setContainerKey') return _objectSpread$
|
|
41
|
+
if (action.type === 'setContainerKey') return _objectSpread$7(_objectSpread$7({}, state), {}, {
|
|
41
42
|
containerKey: action.containerKey
|
|
42
43
|
});
|
|
43
|
-
if (action.type === 'cancelImport') return _objectSpread$
|
|
44
|
+
if (action.type === 'cancelImport') return _objectSpread$7(_objectSpread$7({}, state), {}, {
|
|
44
45
|
currentStep: 'upload',
|
|
45
46
|
containerKey: undefined,
|
|
46
47
|
droppedFile: undefined,
|
|
47
48
|
dropAreaState: 'ready-for-drop',
|
|
48
|
-
progress: 0
|
|
49
|
+
progress: 0,
|
|
50
|
+
jobId: undefined,
|
|
51
|
+
totalResourceCount: undefined,
|
|
52
|
+
validationProcessed: undefined,
|
|
53
|
+
isValidating: false
|
|
49
54
|
});
|
|
50
|
-
if (action.type === 'uploadNewFile') return _objectSpread$
|
|
55
|
+
if (action.type === 'uploadNewFile') return _objectSpread$7(_objectSpread$7({}, state), {}, {
|
|
51
56
|
currentStep: 'upload',
|
|
52
57
|
containerKey: undefined,
|
|
53
58
|
droppedFile: undefined,
|
|
54
59
|
dropAreaState: 'ready-for-drop',
|
|
55
|
-
progress: 0
|
|
60
|
+
progress: 0,
|
|
61
|
+
jobId: undefined,
|
|
62
|
+
totalResourceCount: undefined,
|
|
63
|
+
validationProcessed: undefined,
|
|
64
|
+
isValidating: false
|
|
56
65
|
});
|
|
57
66
|
if (action.type === 'setDroppedFile') {
|
|
58
|
-
return _objectSpread$
|
|
67
|
+
return _objectSpread$7(_objectSpread$7({}, state), {}, {
|
|
59
68
|
droppedFile: action.droppedFile
|
|
60
69
|
});
|
|
61
70
|
}
|
|
62
71
|
if (action.type === 'setAbortController') {
|
|
63
|
-
return _objectSpread$
|
|
72
|
+
return _objectSpread$7(_objectSpread$7({}, state), {}, {
|
|
64
73
|
abortController: action.abortController
|
|
65
74
|
});
|
|
66
75
|
}
|
|
67
76
|
if (action.type === 'setProgress') {
|
|
68
|
-
return _objectSpread$
|
|
77
|
+
return _objectSpread$7(_objectSpread$7({}, state), {}, {
|
|
69
78
|
progress: action.progress
|
|
70
79
|
});
|
|
71
80
|
}
|
|
72
81
|
if (action.type === 'setUploadFileResponse') {
|
|
73
|
-
return _objectSpread$
|
|
82
|
+
return _objectSpread$7(_objectSpread$7({}, state), {}, {
|
|
74
83
|
uploadFileResponse: action.uploadFileResponse
|
|
75
84
|
});
|
|
76
85
|
}
|
|
77
86
|
if (action.type === 'setFileUploadErrors') {
|
|
78
|
-
return _objectSpread$
|
|
87
|
+
return _objectSpread$7(_objectSpread$7({}, state), {}, {
|
|
79
88
|
fileUploadErrors: action.fileUploadErrors
|
|
80
89
|
});
|
|
81
90
|
}
|
|
91
|
+
if (action.type === 'setJobId') {
|
|
92
|
+
return _objectSpread$7(_objectSpread$7({}, state), {}, {
|
|
93
|
+
jobId: action.jobId
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
if (action.type === 'setTotalResourceCount') {
|
|
97
|
+
return _objectSpread$7(_objectSpread$7({}, state), {}, {
|
|
98
|
+
totalResourceCount: action.totalResourceCount
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
if (action.type === 'setValidationProgress') {
|
|
102
|
+
return _objectSpread$7(_objectSpread$7({}, state), {}, {
|
|
103
|
+
validationProcessed: action.processed,
|
|
104
|
+
isValidating: action.isValidating
|
|
105
|
+
});
|
|
106
|
+
}
|
|
82
107
|
throw new Error(getUnknownActionError(action));
|
|
83
108
|
}
|
|
84
109
|
function getUnknownActionError(actionType) {
|
|
@@ -120,6 +145,15 @@ const initialActions = {
|
|
|
120
145
|
},
|
|
121
146
|
setProgress(_progress) {
|
|
122
147
|
/**/
|
|
148
|
+
},
|
|
149
|
+
setJobId(_jobId) {
|
|
150
|
+
/**/
|
|
151
|
+
},
|
|
152
|
+
setTotalResourceCount(_totalResourceCount) {
|
|
153
|
+
/**/
|
|
154
|
+
},
|
|
155
|
+
setValidationProgress(_params) {
|
|
156
|
+
/**/
|
|
123
157
|
}
|
|
124
158
|
};
|
|
125
159
|
|
|
@@ -175,6 +209,37 @@ const UnpublishProductsProvider = props => {
|
|
|
175
209
|
uploadFileResponse
|
|
176
210
|
});
|
|
177
211
|
};
|
|
212
|
+
const setJobId = jobId => dispatch({
|
|
213
|
+
type: 'setJobId',
|
|
214
|
+
jobId
|
|
215
|
+
});
|
|
216
|
+
const setTotalResourceCount = totalResourceCount => dispatch({
|
|
217
|
+
type: 'setTotalResourceCount',
|
|
218
|
+
totalResourceCount
|
|
219
|
+
});
|
|
220
|
+
const setValidationProgress = _ref => {
|
|
221
|
+
let processed = _ref.processed,
|
|
222
|
+
isValidating = _ref.isValidating;
|
|
223
|
+
return dispatch({
|
|
224
|
+
type: 'setValidationProgress',
|
|
225
|
+
processed,
|
|
226
|
+
isValidating
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
const actions = {
|
|
230
|
+
setCurrentStep,
|
|
231
|
+
cancelImport,
|
|
232
|
+
uploadNewFile,
|
|
233
|
+
setDroppedFile,
|
|
234
|
+
setUploadFileResponse,
|
|
235
|
+
setFileUploadErrors,
|
|
236
|
+
setContainerKey,
|
|
237
|
+
setAbortController,
|
|
238
|
+
setProgress,
|
|
239
|
+
setJobId,
|
|
240
|
+
setTotalResourceCount,
|
|
241
|
+
setValidationProgress
|
|
242
|
+
};
|
|
178
243
|
const handleClose = function () {
|
|
179
244
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
180
245
|
if (state.abortController) state.abortController.abort();
|
|
@@ -189,17 +254,7 @@ const UnpublishProductsProvider = props => {
|
|
|
189
254
|
value: {
|
|
190
255
|
state,
|
|
191
256
|
onClose: handleClose,
|
|
192
|
-
actions
|
|
193
|
-
setCurrentStep,
|
|
194
|
-
cancelImport,
|
|
195
|
-
uploadNewFile,
|
|
196
|
-
setDroppedFile,
|
|
197
|
-
setUploadFileResponse,
|
|
198
|
-
setFileUploadErrors,
|
|
199
|
-
setContainerKey,
|
|
200
|
-
setAbortController,
|
|
201
|
-
setProgress
|
|
202
|
-
}
|
|
257
|
+
actions
|
|
203
258
|
},
|
|
204
259
|
children: props.children
|
|
205
260
|
});
|
|
@@ -251,7 +306,7 @@ function getDropAreaState(flags) {
|
|
|
251
306
|
return 'ready-for-drop';
|
|
252
307
|
}
|
|
253
308
|
|
|
254
|
-
var messages$
|
|
309
|
+
var messages$5 = defineMessages({
|
|
255
310
|
dragAndDropCSV: {
|
|
256
311
|
id: 'UnpublishProductsModal.dragAndDropCSV',
|
|
257
312
|
description: 'The message telling the user to drag and drop CSV file in the file drop area',
|
|
@@ -330,7 +385,7 @@ const useUnpublishProductsContext = () => {
|
|
|
330
385
|
return context;
|
|
331
386
|
};
|
|
332
387
|
|
|
333
|
-
var messages$
|
|
388
|
+
var messages$4 = defineMessages({
|
|
334
389
|
fileSizeExceededTitle: {
|
|
335
390
|
id: 'UnpublishProductsModal.sizeExceededTitle',
|
|
336
391
|
defaultMessage: 'File size exceeded'
|
|
@@ -386,6 +441,18 @@ var messages$3 = defineMessages({
|
|
|
386
441
|
}
|
|
387
442
|
});
|
|
388
443
|
|
|
444
|
+
function ownKeys$6(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
445
|
+
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$6(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$6(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
446
|
+
const FILE_IMPORT_JOB_FLOW = 'fileImportJobFlow';
|
|
447
|
+
const DEFAULT_SHORT_LIVED_FLAGS = {
|
|
448
|
+
[FILE_IMPORT_JOB_FLOW]: false
|
|
449
|
+
};
|
|
450
|
+
const DEFAULT_LONG_LIVED_FLAGS = {};
|
|
451
|
+
_objectSpread$6(_objectSpread$6({}, DEFAULT_SHORT_LIVED_FLAGS), DEFAULT_LONG_LIVED_FLAGS);
|
|
452
|
+
|
|
453
|
+
const DOCUMENTATION_LINK = 'https://docs.commercetools.com/merchant-center/product-list#bulk-unpublish-via-csv-import';
|
|
454
|
+
const TEMPLATE_DOWNLOAD_LINK = 'https://docs.commercetools.com/merchant-center/downloads/product_unpublish_import_template.csv';
|
|
455
|
+
|
|
389
456
|
const useUpload = () => {
|
|
390
457
|
const intl = useIntl();
|
|
391
458
|
const _useApplicationContex = useApplicationContext(context => ({
|
|
@@ -396,38 +463,37 @@ const useUpload = () => {
|
|
|
396
463
|
state = _useUnpublishProducts.state,
|
|
397
464
|
actions = _useUnpublishProducts.actions;
|
|
398
465
|
const showNotification = useShowNotification();
|
|
399
|
-
const
|
|
400
|
-
|
|
466
|
+
const isFileImportJobFlowEnabled = useFeatureToggle(FILE_IMPORT_JOB_FLOW);
|
|
467
|
+
const _useFileUpload = useFileUpload({
|
|
468
|
+
projectKey: projectKey,
|
|
469
|
+
useJobBasedFlow: isFileImportJobFlowEnabled
|
|
401
470
|
}),
|
|
402
|
-
upload =
|
|
403
|
-
React.useEffect(() => {
|
|
404
|
-
return () => {
|
|
405
|
-
if (state.abortController) state.abortController.abort();
|
|
406
|
-
};
|
|
407
|
-
}, [state.abortController]);
|
|
471
|
+
upload = _useFileUpload.upload;
|
|
408
472
|
const isFileValid = async file => {
|
|
409
473
|
const errors = [];
|
|
474
|
+
const maxFileSizeMB = isFileImportJobFlowEnabled ? IMPORT_MAX_FILE_SIZE_MB : IMPORT_LEGACY_MAX_FILE_SIZE_MB;
|
|
475
|
+
const maxItemCount = isFileImportJobFlowEnabled ? IMPORT_MAX_ITEM_COUNT : IMPORT_LEGACY_MAX_ROW_COUNT;
|
|
410
476
|
const rowCount = await getRowCount(file);
|
|
411
477
|
if (rowCount < 1) errors.push({
|
|
412
|
-
title: intl.formatMessage(messages$
|
|
413
|
-
description: intl.formatMessage(messages$
|
|
478
|
+
title: intl.formatMessage(messages$4.dropAreaNotEnoughRowsTitle),
|
|
479
|
+
description: intl.formatMessage(messages$4.dropAreaNotEnoughRowsDescription)
|
|
414
480
|
});
|
|
415
|
-
if (file.size > toBytes(
|
|
416
|
-
title: intl.formatMessage(messages$
|
|
417
|
-
description: intl.formatMessage(messages$
|
|
418
|
-
fileSizeLimit: intl.formatNumber(
|
|
481
|
+
if (file.size > toBytes(maxFileSizeMB)) errors.push({
|
|
482
|
+
title: intl.formatMessage(messages$4.fileSizeExceededTitle),
|
|
483
|
+
description: intl.formatMessage(messages$4.fileSizeExceededDescription, {
|
|
484
|
+
fileSizeLimit: intl.formatNumber(maxFileSizeMB)
|
|
419
485
|
})
|
|
420
486
|
});
|
|
421
487
|
if (!(await hasSingleKeyColumn(file))) {
|
|
422
488
|
errors.push({
|
|
423
|
-
title: intl.formatMessage(messages$
|
|
424
|
-
description: intl.formatMessage(messages$
|
|
489
|
+
title: intl.formatMessage(messages$4.csvFormatErrorTitle),
|
|
490
|
+
description: intl.formatMessage(messages$4.csvFormatErrorDescription)
|
|
425
491
|
});
|
|
426
492
|
}
|
|
427
|
-
if (rowCount >
|
|
428
|
-
title: intl.formatMessage(messages$
|
|
429
|
-
description: intl.formatMessage(messages$
|
|
430
|
-
rowLimit: intl.formatNumber(
|
|
493
|
+
if (rowCount > maxItemCount) errors.push({
|
|
494
|
+
title: intl.formatMessage(messages$4.rowLimitExceededTitle),
|
|
495
|
+
description: intl.formatMessage(messages$4.rowLimitExceededDescription, {
|
|
496
|
+
rowLimit: intl.formatNumber(maxItemCount)
|
|
431
497
|
})
|
|
432
498
|
});
|
|
433
499
|
if (errors.length > 0) {
|
|
@@ -435,6 +501,10 @@ const useUpload = () => {
|
|
|
435
501
|
actions.setCurrentStep('upload-error');
|
|
436
502
|
return false;
|
|
437
503
|
}
|
|
504
|
+
if (isFileImportJobFlowEnabled) {
|
|
505
|
+
const resourceCount = await countUniqueResourcesInCsv(file);
|
|
506
|
+
actions.setTotalResourceCount(resourceCount);
|
|
507
|
+
}
|
|
438
508
|
return true;
|
|
439
509
|
};
|
|
440
510
|
const handleUploadError = error => {
|
|
@@ -443,18 +513,25 @@ const useUpload = () => {
|
|
|
443
513
|
return;
|
|
444
514
|
}
|
|
445
515
|
if (error instanceof HttpError) {
|
|
516
|
+
actions.setValidationProgress({
|
|
517
|
+
processed: 0,
|
|
518
|
+
isValidating: false
|
|
519
|
+
});
|
|
446
520
|
if (error.errorData?.code === 'MISSING_KEY_ERROR') {
|
|
447
521
|
actions.setFileUploadErrors([{
|
|
448
|
-
title: intl.formatMessage(messages$
|
|
449
|
-
description: intl.formatMessage(messages$
|
|
522
|
+
title: intl.formatMessage(messages$4.missingRequiredField),
|
|
523
|
+
description: intl.formatMessage(messages$4.missingKeyError)
|
|
450
524
|
}]);
|
|
451
525
|
actions.setCurrentStep('upload-error');
|
|
526
|
+
} else if (error.errorData?.invalid > 0) {
|
|
527
|
+
actions.setUploadFileResponse(error.errorData);
|
|
528
|
+
actions.setCurrentStep('upload-error');
|
|
452
529
|
} else {
|
|
453
530
|
actions.cancelImport();
|
|
454
531
|
showNotification({
|
|
455
532
|
kind: 'error',
|
|
456
533
|
domain: DOMAINS.PAGE,
|
|
457
|
-
text: intl.formatMessage(messages$
|
|
534
|
+
text: intl.formatMessage(messages$4.unexpectedError)
|
|
458
535
|
});
|
|
459
536
|
}
|
|
460
537
|
} else {
|
|
@@ -476,32 +553,54 @@ const useUpload = () => {
|
|
|
476
553
|
if (!state.droppedFile) return;
|
|
477
554
|
const canUpload = await isFileValid(state.droppedFile);
|
|
478
555
|
if (!canUpload) return;
|
|
556
|
+
const abortController = new AbortController();
|
|
557
|
+
actions.setAbortController(abortController);
|
|
479
558
|
actions.setCurrentStep('uploading');
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
actions.
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
559
|
+
await upload({
|
|
560
|
+
file: state.droppedFile,
|
|
561
|
+
resourceType: 'product',
|
|
562
|
+
settings: {
|
|
563
|
+
format: 'CSV',
|
|
564
|
+
options: {
|
|
565
|
+
unpublishAllChanges: true
|
|
566
|
+
}
|
|
567
|
+
},
|
|
568
|
+
abortSignal: abortController.signal,
|
|
569
|
+
onSuccess: result => {
|
|
570
|
+
actions.setValidationProgress({
|
|
571
|
+
processed: 0,
|
|
572
|
+
isValidating: false
|
|
573
|
+
});
|
|
574
|
+
actions.setContainerKey(result.containerKey);
|
|
575
|
+
if (result.jobId) {
|
|
576
|
+
actions.setJobId(result.jobId);
|
|
577
|
+
}
|
|
578
|
+
const fileUploadResponse = {
|
|
579
|
+
results: result.summary.results,
|
|
580
|
+
invalid: result.summary.invalid,
|
|
581
|
+
valid: result.summary.valid,
|
|
582
|
+
fileName: state.droppedFile?.name || '',
|
|
583
|
+
itemsCount: result.summary.total,
|
|
584
|
+
rowsCount: result.summary.total,
|
|
585
|
+
columnsCount: result.summary.fieldsCount,
|
|
586
|
+
fields: result.summary.fields,
|
|
587
|
+
ignoredFields: result.summary.ignoredFields
|
|
588
|
+
};
|
|
589
|
+
actions.setUploadFileResponse(fileUploadResponse);
|
|
590
|
+
actions.setCurrentStep('upload-preview');
|
|
591
|
+
},
|
|
592
|
+
onProgress: progress => {
|
|
593
|
+
actions.setProgress(progress);
|
|
594
|
+
},
|
|
595
|
+
onValidationProgress: job => {
|
|
596
|
+
const processed = job.summary?.total ?? 0;
|
|
597
|
+
actions.setValidationProgress({
|
|
598
|
+
processed,
|
|
599
|
+
isValidating: true
|
|
600
|
+
});
|
|
601
|
+
},
|
|
602
|
+
onError: handleUploadError
|
|
603
|
+
});
|
|
505
604
|
};
|
|
506
605
|
return {
|
|
507
606
|
handleUploadAndValidation
|
|
@@ -522,9 +621,9 @@ const FileDropArea = () => {
|
|
|
522
621
|
}, [actions]);
|
|
523
622
|
const handleDropRejected = React.useCallback(errorType => {
|
|
524
623
|
const errorMessageMap = {
|
|
525
|
-
'too-many-files': messages$
|
|
526
|
-
'invalid-type': messages$
|
|
527
|
-
generic: messages$
|
|
624
|
+
'too-many-files': messages$5.tooManyFilesError,
|
|
625
|
+
'invalid-type': messages$5.fileFormatNotSupported,
|
|
626
|
+
generic: messages$5.genericError
|
|
528
627
|
};
|
|
529
628
|
showNotification({
|
|
530
629
|
kind: 'error',
|
|
@@ -548,10 +647,10 @@ const FileDropArea = () => {
|
|
|
548
647
|
isFileDropped: Boolean(state.droppedFile),
|
|
549
648
|
fileName: state.droppedFile?.name,
|
|
550
649
|
messages: {
|
|
551
|
-
dragAndDropCSV: intl.formatMessage(messages$
|
|
552
|
-
or: intl.formatMessage(messages$
|
|
553
|
-
browseButton: intl.formatMessage(messages$
|
|
554
|
-
chooseFile: intl.formatMessage(messages$
|
|
650
|
+
dragAndDropCSV: intl.formatMessage(messages$5.dragAndDropCSV),
|
|
651
|
+
or: intl.formatMessage(messages$5.or),
|
|
652
|
+
browseButton: intl.formatMessage(messages$5.browseButton),
|
|
653
|
+
chooseFile: intl.formatMessage(messages$5.chooseFile)
|
|
555
654
|
}
|
|
556
655
|
})
|
|
557
656
|
});
|
|
@@ -572,10 +671,15 @@ var sharedMessages = defineMessages({
|
|
|
572
671
|
id: 'UnpublishProductsModal.cancel',
|
|
573
672
|
description: 'The label for the cancel button',
|
|
574
673
|
defaultMessage: 'Cancel'
|
|
674
|
+
},
|
|
675
|
+
products: {
|
|
676
|
+
id: 'UnpublishProductsModal.products',
|
|
677
|
+
description: 'Products resource type label',
|
|
678
|
+
defaultMessage: 'Products'
|
|
575
679
|
}
|
|
576
680
|
});
|
|
577
681
|
|
|
578
|
-
var messages$
|
|
682
|
+
var messages$3 = defineMessages({
|
|
579
683
|
fileUploadInstructions: {
|
|
580
684
|
id: 'UnpublishProductsModal.fileUploadInstructions',
|
|
581
685
|
description: 'Instructions for uploading a CSV file with product keys to unpublish',
|
|
@@ -583,18 +687,18 @@ var messages$2 = defineMessages({
|
|
|
583
687
|
}
|
|
584
688
|
});
|
|
585
689
|
|
|
586
|
-
const DOCUMENTATION_LINK = 'https://docs.commercetools.com/merchant-center/product-list#bulk-unpublish-via-csv-import';
|
|
587
|
-
const TEMPLATE_DOWNLOAD_LINK = 'https://docs.commercetools.com/merchant-center/downloads/product_unpublish_import_template.csv';
|
|
588
|
-
|
|
589
690
|
function ownKeys$5(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
590
691
|
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$5(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$5(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
591
692
|
const Instructions = () => {
|
|
592
693
|
const intl = useIntl();
|
|
694
|
+
const isFileImportJobFlowEnabled = useFeatureToggle(FILE_IMPORT_JOB_FLOW);
|
|
695
|
+
const maxFileSizeMB = isFileImportJobFlowEnabled ? IMPORT_MAX_FILE_SIZE_MB : IMPORT_LEGACY_MAX_FILE_SIZE_MB;
|
|
696
|
+
const maxItemCount = isFileImportJobFlowEnabled ? IMPORT_MAX_ITEM_COUNT : IMPORT_LEGACY_MAX_ROW_COUNT;
|
|
593
697
|
return jsx(Text.Body, {
|
|
594
|
-
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$
|
|
698
|
+
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$3.fileUploadInstructions), {}, {
|
|
595
699
|
values: {
|
|
596
|
-
maxFileSize: intl.formatNumber(
|
|
597
|
-
maxRowCount: intl.formatNumber(
|
|
700
|
+
maxFileSize: intl.formatNumber(maxFileSizeMB),
|
|
701
|
+
maxRowCount: intl.formatNumber(maxItemCount),
|
|
598
702
|
csvTemplateLink: msg => jsx(Link, {
|
|
599
703
|
tone: "secondary",
|
|
600
704
|
isExternal: true,
|
|
@@ -623,7 +727,7 @@ const Upload = () => {
|
|
|
623
727
|
size: 16,
|
|
624
728
|
isOpen: true,
|
|
625
729
|
title: intl.formatMessage(sharedMessages.unpublishModalTitle),
|
|
626
|
-
labelPrimary: intl.formatMessage(messages$
|
|
730
|
+
labelPrimary: intl.formatMessage(messages$5.uploadAndPreview),
|
|
627
731
|
onPrimaryButtonClick: handleUploadAndValidation,
|
|
628
732
|
isPrimaryButtonDisabled: !Boolean(state.droppedFile),
|
|
629
733
|
onSecondaryButtonClick: () => onClose({
|
|
@@ -641,6 +745,13 @@ const Upload = () => {
|
|
|
641
745
|
});
|
|
642
746
|
};
|
|
643
747
|
|
|
748
|
+
var messages$2 = defineMessages({
|
|
749
|
+
validatingResources: {
|
|
750
|
+
id: 'UnpublishProductsModal.Uploading.validatingResources',
|
|
751
|
+
defaultMessage: 'Validating {processed} / {total} {resourceType}'
|
|
752
|
+
}
|
|
753
|
+
});
|
|
754
|
+
|
|
644
755
|
const Uploading = () => {
|
|
645
756
|
const intl = useIntl();
|
|
646
757
|
const _useUnpublishProducts = useUnpublishProductsContext(),
|
|
@@ -648,12 +759,19 @@ const Uploading = () => {
|
|
|
648
759
|
actions = _useUnpublishProducts.actions,
|
|
649
760
|
onClose = _useUnpublishProducts.onClose;
|
|
650
761
|
if (!state.droppedFile?.name) return null;
|
|
762
|
+
const showValidationProgress = state.isValidating && state.totalResourceCount && (state.validationProcessed ?? 0) > 0;
|
|
763
|
+
const statusMessage = showValidationProgress ? intl.formatMessage(messages$2.validatingResources, {
|
|
764
|
+
processed: intl.formatNumber(state.validationProcessed ?? 0),
|
|
765
|
+
total: intl.formatNumber(state.totalResourceCount ?? 0),
|
|
766
|
+
resourceType: intl.formatMessage(sharedMessages.products)
|
|
767
|
+
}) : undefined;
|
|
651
768
|
return jsx(UploadingModal, {
|
|
652
769
|
isOpen: true,
|
|
653
770
|
title: intl.formatMessage(sharedMessages.unpublishModalTitle),
|
|
654
771
|
fileName: state.droppedFile.name,
|
|
655
772
|
fileSize: state.droppedFile.size,
|
|
656
773
|
progress: state.progress,
|
|
774
|
+
statusMessage: statusMessage,
|
|
657
775
|
cancelLabel: intl.formatMessage(sharedMessages.cancel),
|
|
658
776
|
onCancel: () => {
|
|
659
777
|
actions.setCurrentStep('upload');
|
|
@@ -746,7 +864,7 @@ const UploadErrorsModal = () => {
|
|
|
746
864
|
state = _useUnpublishProducts.state,
|
|
747
865
|
actions = _useUnpublishProducts.actions,
|
|
748
866
|
onClose = _useUnpublishProducts.onClose;
|
|
749
|
-
const errorsCount = state.fileUploadErrors
|
|
867
|
+
const errorsCount = state.fileUploadErrors?.length ?? 0;
|
|
750
868
|
return jsx(InfoDialog, {
|
|
751
869
|
size: 16,
|
|
752
870
|
isOpen: true,
|
|
@@ -766,7 +884,7 @@ const UploadErrorsModal = () => {
|
|
|
766
884
|
})
|
|
767
885
|
})
|
|
768
886
|
}), jsx(UploadErrorTable, {
|
|
769
|
-
rows: mapFileUploadErrorsToUploadFileErrorRows(state.fileUploadErrors)
|
|
887
|
+
rows: mapFileUploadErrorsToUploadFileErrorRows(state.fileUploadErrors ?? [])
|
|
770
888
|
}), jsxs(Spacings.Inline, {
|
|
771
889
|
scale: "m",
|
|
772
890
|
justifyContent: "flex-end",
|
|
@@ -842,7 +960,7 @@ var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
|
842
960
|
styles: "width:360px"
|
|
843
961
|
} : {
|
|
844
962
|
name: "g36yzl-ImportRunningTextNotification",
|
|
845
|
-
styles: "width:360px;label:ImportRunningTextNotification;/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
963
|
+
styles: "width:360px;label:ImportRunningTextNotification;/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInVucHVibGlzaC1wcm9kdWN0cy1jb25maXJtYXRpb24tbW9kYWwudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXlCWSIsImZpbGUiOiJ1bnB1Ymxpc2gtcHJvZHVjdHMtY29uZmlybWF0aW9uLW1vZGFsLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHVzZUludGwgfSBmcm9tICdyZWFjdC1pbnRsJ1xuaW1wb3J0IHsgdXNlU2hvd05vdGlmaWNhdGlvbiB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLWZyb250ZW5kL2FjdGlvbnMtZ2xvYmFsJ1xuaW1wb3J0IHsgQ29uZmlybWF0aW9uRGlhbG9nIH0gZnJvbSAnQGNvbW1lcmNldG9vbHMtZnJvbnRlbmQvYXBwbGljYXRpb24tY29tcG9uZW50cydcbmltcG9ydCB7IHVzZUFwcGxpY2F0aW9uQ29udGV4dCB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLWZyb250ZW5kL2FwcGxpY2F0aW9uLXNoZWxsLWNvbm5lY3RvcnMnXG5pbXBvcnQgeyBET01BSU5TIH0gZnJvbSAnQGNvbW1lcmNldG9vbHMtZnJvbnRlbmQvY29uc3RhbnRzJ1xuaW1wb3J0IHsgTWFza2luZyBhcyBGdWxsU3RvcnlNYXNraW5nIH0gZnJvbSAnQGNvbW1lcmNldG9vbHMtZnJvbnRlbmQvZnVsbHN0b3J5J1xuaW1wb3J0IHsgTGlu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b24oXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIGtpbmQ6ICdpbmZvJyxcbiAgICAgICAgICAgICAgZG9tYWluOiBET01BSU5TLlNJREUsXG4gICAgICAgICAgICAgIC8vIEB0cy1pZ25vcmVcbiAgICAgICAgICAgICAgdGV4dDogPEltcG9ydFByZXBhcmluZ1RleHROb3RpZmljYXRpb24gcHJvamVjdEtleT17cHJvamVjdEtleX0gLz4sXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBkaXNtaXNzQWZ0ZXI6IDUwMDAsXG4gICAgICAgICAgICB9XG4gICAgICAgICAgKVxuICAgICAgICAgIGlmIChzdGF0ZS5qb2JJZCkge1xuICAgICAgICAgICAgYXdhaXQgcHJvY2Vzc0ZpbGVJbXBvcnRKb2Ioe1xuICAgICAgICAgICAgICBwcm9qZWN0S2V5LFxuICAgICAgICAgICAgICBpbXBvcnRDb250YWluZXJLZXk6IHN0YXRlLmNvbnRhaW5lcktleSEsXG4gICAgICAgICAgICAgIGpvYklkOiBzdGF0ZS5qb2JJZCxcbiAgICAgICAgICAgICAgcmVzb3VyY2VUeXBlOiAncHJvZHVjdCcsXG4gICAgICAgICAgICB9KVxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBhd2FpdCBwcm9jZXNzVXBsb2FkZWRGaWxlKHtcbiAgICAgICAgICAgICAgcHJvamVjdEtleSxcbiAgICAgICAgICAgICAgcmVzb3VyY2VUeXBlOiAncHJvZHVjdCcsXG4gICAgICAgICAgICAgIGltcG9ydENvbnRhaW5lcktleTogc3RhdGUuY29udGFpbmVyS2V5ISxcbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgfVxuICAgICAgICAgIHNob3dOb3RpZmljYXRpb24oXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIGtpbmQ6ICdpbmZvJyxcbiAgICAgICAgICAgICAgZG9tYWluOiBET01BSU5TLlNJREUsXG4gICAgICAgICAgICAgIC8vIEB0cy1pZ25vcmVcbiAgICAgICAgICAgICAgdGV4dDogPEltcG9ydFJ1bm5pbmdUZXh0Tm90aWZpY2F0aW9uIHByb2plY3RLZXk9e3Byb2plY3RLZXl9IC8+LFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgZGlzbWlzc0FmdGVyOiA1MDAwLFxuICAgICAgICAgICAgfVxuICAgICAgICAgIClcbiAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICBvbkNsb3NlKHsgc2hvdWxkRGVsZXRlSW1wb3J0Q29udGFpbmVyOiB0cnVlIH0pXG4gICAgICAgICAgc2hvd05vdGlmaWNhdGlvbih7XG4gICAgICAgICAgICBraW5kOiAnZXJyb3InLFxuICAgICAgICAgICAgZG9tYWluOiBET01BSU5TLlBBR0UsXG4gICAgICAgICAgICB0ZXh0OiBTdHJpbmcoZXJyb3IpLFxuICAgICAgICAgIH0pXG4gICAgICAgIH1cbiAgICAgIH19XG4gICAgICBzaXplPXsxNn1cbiAgICA+XG4gICAgICA8RnVsbFN0b3J5TWFza2luZy5Vbm1hc2s+XG4gICAgICAgIDxTcGFjaW5ncy5TdGFjayBzY2FsZT1cInhsXCI+XG4gICAgICAgICAgPFRleHQuQm9keVxuICAgICAgICAgICAgaW50bE1lc3NhZ2U9e3tcbiAgICAgICAgICAgICAgLi4ubWVzc2FnZXMuY29uZmlybWF0aW9uVGV4dCxcbiAgICAgICAgICAgICAgdmFsdWVzOiB7XG4gICAgICAgICAgICAgICAgcHJvamVjdE5hbWU6IHByb2plY3ROYW1lLFxuICAgICAgICAgICAgICAgIC8vIFRPRE86IFJlcGxhY2Ugd2l0aCBhY3R1YWwgY291bnRcbiAgICAgICAgICAgICAgICBjb3VudDogaW50bC5mb3JtYXROdW1iZXIoXG4gICAgICAgICAgICAgICAgICBzdGF0ZS51cGxvYWRGaWxlUmVzcG9uc2U/LnJvd3NDb3VudCA/PyAwXG4gICAgICAgICAgICAgICAgKSxcbiAgICAgICAgICAgICAgICBiOiBnZXRCb2xkLFxuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgfX1cbiAgICAgICAgICAvPlxuICAgICAgICAgIDxUZXh0LkJvZHkgaW50bE1lc3NhZ2U9e21lc3NhZ2VzLmNvbmZpcm1hdGlvblF1ZXN0aW9ufSAvPlxuICAgICAgICA8L1NwYWNpbmdzLlN0YWNrPlxuICAgICAgPC9GdWxsU3RvcnlNYXNraW5nLlVubWFzaz5cbiAgICA8L0NvbmZpcm1hdGlvbkRpYWxvZz5cbiAgKVxufVxuXG5mdW5jdGlvbiBnZXRCb2xkKG1zZykge1xuICByZXR1cm4gKFxuICAgIDxUZXh0LkJvZHkgYXM9XCJzcGFuXCIgaXNCb2xkIGtleT17Y3J5cHRvLnJhbmRvbVVVSUQoKX0+XG4gICAgICB7bXNnfVxuICAgIDwvVGV4dC5Cb2R5PlxuICApXG59XG4iXX0= */",
|
|
846
964
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
847
965
|
};
|
|
848
966
|
const ImportRunningTextNotification = props => jsx("div", {
|
|
@@ -862,7 +980,7 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
862
980
|
styles: "width:360px"
|
|
863
981
|
} : {
|
|
864
982
|
name: "mjwslu-ImportPreparingTextNotification",
|
|
865
|
-
styles: "width:360px;label:ImportPreparingTextNotification;/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
983
|
+
styles: "width:360px;label:ImportPreparingTextNotification;/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInVucHVibGlzaC1wcm9kdWN0cy1jb25maXJtYXRpb24tbW9kYWwudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTRDWSIsImZpbGUiOiJ1bnB1Ymxpc2gtcHJvZHVjdHMtY29uZmlybWF0aW9uLW1vZGFsLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9yd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JbXBvcnRDb250YWluZXI6IHRydWUgfSl9XG4gICAgICBkYXRhQXR0cmlidXRlc1ByaW1hcnlCdXR0b249e3tcbiAgICAgICAgJ2RhdGEtdGVzdC1pZCc6ICdjb25maXJtYXRpb24tZGlhbG9nLWNvbmZpcm0nLFxuICAgICAgfX1cbiAgICAgIGRhdGFBdHRyaWJ1dGVzU2Vjb25kYXJ5QnV0dG9uPXt7XG4gICAgICAgICdkYXRhLXRlc3QtaWQnOiAnY29uZmlybWF0aW9uLWRpYWxvZy1jYW5jZWwnLFxuICAgICAgfX1cbiAgICAgIG9uQ29uZmlybT17YXN5bmMgKCkgPT4ge1xuICAgICAgICB0cnkge1xuICAgICAgICAgIGNvbnN0IGNhbkNvbmZpcm0gPVxuICAgICAgICAgICAgcHJvamVjdEtleSAmJiBzdGF0ZS5jb250YWluZXJLZXkgJiYgc3RhdGUuZHJvcHBlZEZpbGU/Lm5hbWVcbiAgICAgICAgICBpZiAoIWNhbkNvbmZpcm0pIHJldHVyblxuICAgICAgICAgIG9uQ2xvc2UoKVxuICAgICAgICAgIHNob3dOb3RpZmljYXRpb24oXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIGtpbmQ6ICdpbmZvJyxcbiAgICAgICAgICAgICAgZG9tYWluOiBET01BSU5TLlNJREUsXG4gICAgICAgICAgICAgIC8vIEB0cy1pZ25vcmVcbiAgICAgICAgICAgICAgdGV4dDogPEltcG9ydFByZXBhcmluZ1RleHROb3RpZmljYXRpb24gcHJvamVjdEtleT17cHJvamVjdEtleX0gLz4sXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBkaXNtaXNzQWZ0ZXI6IDUwMDAsXG4gICAgICAgICAgICB9XG4gICAgICAgICAgKVxuICAgICAgICAgIGlmIChzdGF0ZS5qb2JJZCkge1xuICAgICAgICAgICAgYXdhaXQgcHJvY2Vzc0ZpbGVJbXBvcnRKb2Ioe1xuICAgICAgICAgICAgICBwcm9qZWN0S2V5LFxuICAgICAgICAgICAgICBpbXBvcnRDb250YWluZXJLZXk6IHN0YXRlLmNvbnRhaW5lcktleSEsXG4gICAgICAgICAgICAgIGpvYklkOiBzdGF0ZS5qb2JJZCxcbiAgICAgICAgICAgICAgcmVzb3VyY2VUeXBlOiAncHJvZHVjdCcsXG4gICAgICAgICAgICB9KVxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBhd2FpdCBwcm9jZXNzVXBsb2FkZWRGaWxlKHtcbiAgICAgICAgICAgICAgcHJvamVjdEtleSxcbiAgICAgICAgICAgICAgcmVzb3VyY2VUeXBlOiAncHJvZHVjdCcsXG4gICAgICAgICAgICAgIGltcG9ydENvbnRhaW5lcktleTogc3RhdGUuY29udGFpbmVyS2V5ISxcbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgfVxuICAgICAgICAgIHNob3dOb3RpZmljYXRpb24oXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIGtpbmQ6ICdpbmZvJyxcbiAgICAgICAgICAgICAgZG9tYWluOiBET01BSU5TLlNJREUsXG4gICAgICAgICAgICAgIC8vIEB0cy1pZ25vcmVcbiAgICAgICAgICAgICAgdGV4dDogPEltcG9ydFJ1bm5pbmdUZXh0Tm90aWZpY2F0aW9uIHByb2plY3RLZXk9e3Byb2plY3RLZXl9IC8+LFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgZGlzbWlzc0FmdGVyOiA1MDAwLFxuICAgICAgICAgICAgfVxuICAgICAgICAgIClcbiAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICBvbkNsb3NlKHsgc2hvdWxkRGVsZXRlSW1wb3J0Q29udGFpbmVyOiB0cnVlIH0pXG4gICAgICAgICAgc2hvd05vdGlmaWNhdGlvbih7XG4gICAgICAgICAgICBraW5kOiAnZXJyb3InLFxuICAgICAgICAgICAgZG9tYWluOiBET01BSU5TLlBBR0UsXG4gICAgICAgICAgICB0ZXh0OiBTdHJpbmcoZXJyb3IpLFxuICAgICAgICAgIH0pXG4gICAgICAgIH1cbiAgICAgIH19XG4gICAgICBzaXplPXsxNn1cbiAgICA+XG4gICAgICA8RnVsbFN0b3J5TWFza2luZy5Vbm1hc2s+XG4gICAgICAgIDxTcGFjaW5ncy5TdGFjayBzY2FsZT1cInhsXCI+XG4gICAgICAgICAgPFRleHQuQm9keVxuICAgICAgICAgICAgaW50bE1lc3NhZ2U9e3tcbiAgICAgICAgICAgICAgLi4ubWVzc2FnZXMuY29uZmlybWF0aW9uVGV4dCxcbiAgICAgICAgICAgICAgdmFsdWVzOiB7XG4gICAgICAgICAgICAgICAgcHJvamVjdE5hbWU6IHByb2plY3ROYW1lLFxuICAgICAgICAgICAgICAgIC8vIFRPRE86IFJlcGxhY2Ugd2l0aCBhY3R1YWwgY291bnRcbiAgICAgICAgICAgICAgICBjb3VudDogaW50bC5mb3JtYXROdW1iZXIoXG4gICAgICAgICAgICAgICAgICBzdGF0ZS51cGxvYWRGaWxlUmVzcG9uc2U/LnJvd3NDb3VudCA/PyAwXG4gICAgICAgICAgICAgICAgKSxcbiAgICAgICAgICAgICAgICBiOiBnZXRCb2xkLFxuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgfX1cbiAgICAgICAgICAvPlxuICAgICAgICAgIDxUZXh0LkJvZHkgaW50bE1lc3NhZ2U9e21lc3NhZ2VzLmNvbmZpcm1hdGlvblF1ZXN0aW9ufSAvPlxuICAgICAgICA8L1NwYWNpbmdzLlN0YWNrPlxuICAgICAgPC9GdWxsU3RvcnlNYXNraW5nLlVubWFzaz5cbiAgICA8L0NvbmZpcm1hdGlvbkRpYWxvZz5cbiAgKVxufVxuXG5mdW5jdGlvbiBnZXRCb2xkKG1zZykge1xuICByZXR1cm4gKFxuICAgIDxUZXh0LkJvZHkgYXM9XCJzcGFuXCIgaXNCb2xkIGtleT17Y3J5cHRvLnJhbmRvbVVVSUQoKX0+XG4gICAgICB7bXNnfVxuICAgIDwvVGV4dC5Cb2R5PlxuICApXG59XG4iXX0= */",
|
|
866
984
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
867
985
|
};
|
|
868
986
|
const ImportPreparingTextNotification = props => jsx("div", {
|
|
@@ -920,11 +1038,20 @@ const UnpublishProductsConfirmationModal = () => {
|
|
|
920
1038
|
}, {
|
|
921
1039
|
dismissAfter: 5000
|
|
922
1040
|
});
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
1041
|
+
if (state.jobId) {
|
|
1042
|
+
await processFileImportJob({
|
|
1043
|
+
projectKey,
|
|
1044
|
+
importContainerKey: state.containerKey,
|
|
1045
|
+
jobId: state.jobId,
|
|
1046
|
+
resourceType: 'product'
|
|
1047
|
+
});
|
|
1048
|
+
} else {
|
|
1049
|
+
await processUploadedFile({
|
|
1050
|
+
projectKey,
|
|
1051
|
+
resourceType: 'product',
|
|
1052
|
+
importContainerKey: state.containerKey
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
928
1055
|
showNotification({
|
|
929
1056
|
kind: 'info',
|
|
930
1057
|
domain: DOMAINS.SIDE,
|
|
@@ -955,7 +1082,7 @@ const UnpublishProductsConfirmationModal = () => {
|
|
|
955
1082
|
values: {
|
|
956
1083
|
projectName: projectName,
|
|
957
1084
|
// TODO: Replace with actual count
|
|
958
|
-
count: intl.formatNumber(state.uploadFileResponse?.rowsCount),
|
|
1085
|
+
count: intl.formatNumber(state.uploadFileResponse?.rowsCount ?? 0),
|
|
959
1086
|
b: getBold$1
|
|
960
1087
|
}
|
|
961
1088
|
})
|
|
@@ -1011,7 +1138,7 @@ function UploadPreviewModal() {
|
|
|
1011
1138
|
}), jsx(Text.Body, {
|
|
1012
1139
|
intlMessage: _objectSpread$1(_objectSpread$1({}, messages.productsToBeUnpublished), {}, {
|
|
1013
1140
|
values: {
|
|
1014
|
-
count: intl.formatNumber(state.uploadFileResponse?.rowsCount),
|
|
1141
|
+
count: intl.formatNumber(state.uploadFileResponse?.rowsCount ?? 0),
|
|
1015
1142
|
b: getBold
|
|
1016
1143
|
}
|
|
1017
1144
|
})
|