@commercetools-frontend-extensions/unpublish-products-modal 1.2.6 → 1.2.8
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 +1140 -43
- package/dist/commercetools-frontend-extensions-unpublish-products-modal.cjs.prod.js +1131 -43
- package/dist/commercetools-frontend-extensions-unpublish-products-modal.esm.js +1129 -42
- package/dist/declarations/src/@types/index.d.ts +0 -2
- package/package.json +3 -2
- package/dist/active-drag-drop-area-272fc575.esm.js +0 -51
- package/dist/active-drag-drop-area-d4747efc.cjs.dev.js +0 -53
- package/dist/active-drag-drop-area-fc551a0e.cjs.prod.js +0 -53
- package/dist/declarations/src/@types/file-upload.d.ts +0 -42
- package/dist/declarations/src/@types/import-container.d.ts +0 -11
- package/dist/enabled-drop-area-a750ea18.cjs.prod.js +0 -70
- package/dist/enabled-drop-area-c3902695.esm.js +0 -68
- package/dist/enabled-drop-area-c750b6ba.cjs.dev.js +0 -70
- package/dist/file-dropped-area-0d73f0f6.cjs.dev.js +0 -73
- package/dist/file-dropped-area-23cc482a.cjs.prod.js +0 -73
- package/dist/file-dropped-area-dad90f26.esm.js +0 -71
- package/dist/index-21e8e348.cjs.dev.js +0 -1547
- package/dist/index-7a25a6ee.esm.js +0 -1517
- package/dist/index-a2aa0229.cjs.prod.js +0 -1535
|
@@ -2,50 +2,1147 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('@babel/runtime-corejs3/core-js-stable/object/
|
|
7
|
-
require('@babel/runtime-corejs3/core-js-stable/
|
|
8
|
-
require('@babel/runtime-corejs3/core-js-stable/
|
|
9
|
-
require('@babel/runtime-corejs3/core-js-stable/
|
|
10
|
-
require('@babel/runtime-corejs3/core-js-stable/
|
|
11
|
-
require('@babel/runtime-corejs3/core-js-stable/object/
|
|
12
|
-
require('@babel/runtime-corejs3/core-js-stable/object/define-
|
|
13
|
-
require('@babel/runtime-corejs3/
|
|
14
|
-
require('
|
|
15
|
-
require('
|
|
16
|
-
require('@
|
|
17
|
-
require('
|
|
18
|
-
require('
|
|
19
|
-
require('@
|
|
20
|
-
require('@
|
|
21
|
-
require('@commercetools-frontend/
|
|
22
|
-
require('@
|
|
23
|
-
require('@
|
|
24
|
-
require('@
|
|
25
|
-
require('@babel/runtime-corejs3/core-js-stable/
|
|
26
|
-
require('@babel/runtime-corejs3/
|
|
27
|
-
require('
|
|
28
|
-
require('@
|
|
29
|
-
require('@
|
|
30
|
-
require('@
|
|
31
|
-
require('@
|
|
32
|
-
require('@
|
|
33
|
-
require('
|
|
34
|
-
require('@commercetools-frontend/actions-global');
|
|
35
|
-
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');
|
|
36
34
|
require('@emotion/react');
|
|
37
|
-
require('@
|
|
38
|
-
require('@babel/runtime-corejs3/helpers/createClass');
|
|
39
|
-
require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
40
|
-
require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
|
|
41
|
-
require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
42
|
-
require('@babel/runtime-corejs3/helpers/inherits');
|
|
43
|
-
require('@babel/runtime-corejs3/helpers/wrapNativeSuper');
|
|
44
|
-
require('@commercetools-frontend/sentry');
|
|
45
|
-
require('@commercetools-frontend/application-shell');
|
|
46
|
-
require('@babel/runtime-corejs3/core-js-stable/instance/slice');
|
|
47
|
-
require('@commercetools-frontend/i18n');
|
|
35
|
+
var i18n = require('@commercetools-frontend/i18n');
|
|
48
36
|
|
|
37
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
49
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);
|
|
50
50
|
|
|
51
|
-
|
|
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 UnpublishProductsContext = /*#__PURE__*/React__default["default"].createContext({
|
|
145
|
+
state: initialState,
|
|
146
|
+
actions: initialActions,
|
|
147
|
+
onClose: () => {}
|
|
148
|
+
});
|
|
149
|
+
const UnpublishProductsProvider = 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(UnpublishProductsContext.Provider, {
|
|
207
|
+
value: {
|
|
208
|
+
state,
|
|
209
|
+
onClose: handleClose,
|
|
210
|
+
actions: {
|
|
211
|
+
setCurrentStep,
|
|
212
|
+
cancelImport,
|
|
213
|
+
uploadNewFile,
|
|
214
|
+
setDroppedFile,
|
|
215
|
+
setUploadFileResponse,
|
|
216
|
+
setFileUploadErrors,
|
|
217
|
+
setContainerKey,
|
|
218
|
+
setAbortController,
|
|
219
|
+
setProgress
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
children: props.children
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
function getDropArea(_ref) {
|
|
227
|
+
let dropAreaState = _ref.dropAreaState,
|
|
228
|
+
isFileDropped = _ref.isFileDropped,
|
|
229
|
+
fileName = _ref.fileName,
|
|
230
|
+
messages = _ref.messages;
|
|
231
|
+
if (dropAreaState === 'ready-for-drop') {
|
|
232
|
+
return jsxRuntime.jsx(operations.EnabledDropArea, {
|
|
233
|
+
dragAndDropText: messages.dragAndDropCSV,
|
|
234
|
+
orText: messages.or,
|
|
235
|
+
browseFileText: messages.browseButton
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
if (dropAreaState === 'file-dropped') {
|
|
239
|
+
return jsxRuntime.jsx(operations.FileDroppedArea, {
|
|
240
|
+
fileName: fileName,
|
|
241
|
+
chooseFileLabel: messages.chooseFile
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
if (dropAreaState === 'active-drag') {
|
|
245
|
+
return jsxRuntime.jsx(operations.ActiveDragDropArea, {
|
|
246
|
+
isFileDropped: isFileDropped,
|
|
247
|
+
fileName: fileName,
|
|
248
|
+
chooseFileLabel: messages.chooseFile,
|
|
249
|
+
dragAndDropText: messages.dragAndDropCSV,
|
|
250
|
+
orText: messages.or,
|
|
251
|
+
browseFileText: messages.browseButton
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
return fallbackDropArea(dropAreaState, fileName, messages);
|
|
255
|
+
}
|
|
256
|
+
function fallbackDropArea(_dropAreaState, fileName, messages) {
|
|
257
|
+
return jsxRuntime.jsx(operations.FileDroppedArea, {
|
|
258
|
+
fileName: fileName,
|
|
259
|
+
chooseFileLabel: messages.chooseFile
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
function getDropAreaState(flags) {
|
|
263
|
+
if (flags.isDragActive) {
|
|
264
|
+
return 'active-drag';
|
|
265
|
+
}
|
|
266
|
+
if (flags.isReady) {
|
|
267
|
+
return 'file-dropped';
|
|
268
|
+
}
|
|
269
|
+
return 'ready-for-drop';
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
var messages$4 = reactIntl.defineMessages({
|
|
273
|
+
dragAndDropCSV: {
|
|
274
|
+
id: 'UnpublishProductsModal.dragAndDropCSV',
|
|
275
|
+
description: 'The message telling the user to drag and drop CSV file in the file drop area',
|
|
276
|
+
defaultMessage: 'Drag and drop CSV'
|
|
277
|
+
},
|
|
278
|
+
or: {
|
|
279
|
+
id: 'UnpublishProductsModal.or',
|
|
280
|
+
description: 'The word "or" in the drag and drop message',
|
|
281
|
+
defaultMessage: 'or'
|
|
282
|
+
},
|
|
283
|
+
browseButton: {
|
|
284
|
+
id: 'UnpublishProductsModal.browseFile',
|
|
285
|
+
defaultMessage: 'Browse file'
|
|
286
|
+
},
|
|
287
|
+
uploadAndPreview: {
|
|
288
|
+
id: 'UnpublishProductsModal.uploadAndPreview',
|
|
289
|
+
description: 'Label for the button that uploads the file and shows the preview',
|
|
290
|
+
defaultMessage: 'Upload and preview'
|
|
291
|
+
},
|
|
292
|
+
chooseFile: {
|
|
293
|
+
id: 'UnpublishProductsModal.chooseFile',
|
|
294
|
+
description: 'Label for a button on the file upload page, shown on ready to upload state',
|
|
295
|
+
defaultMessage: 'Choose file'
|
|
296
|
+
},
|
|
297
|
+
fileUploadFailed: {
|
|
298
|
+
id: 'UnpublishProductsModal.fileUploadFailed',
|
|
299
|
+
description: 'A title on the file upload page, shown on file upload error state',
|
|
300
|
+
defaultMessage: 'File upload failed'
|
|
301
|
+
},
|
|
302
|
+
fileFormatNotSupported: {
|
|
303
|
+
id: 'UnpublishProductsModal.fileFormatNotSupported',
|
|
304
|
+
description: 'Error message displayed when a user drags and drops a non-CSV file',
|
|
305
|
+
defaultMessage: 'Invalid file format: The file is not in CSV format and cannot be processed.'
|
|
306
|
+
},
|
|
307
|
+
tooManyFilesError: {
|
|
308
|
+
id: 'UnpublishProductsModal.tooManyFilesError',
|
|
309
|
+
description: 'Error message displayed when a user drags and drops multiple files at once',
|
|
310
|
+
defaultMessage: 'Multiple files detected: You can only drag and drop one file at a time.'
|
|
311
|
+
},
|
|
312
|
+
genericError: {
|
|
313
|
+
id: 'UnpublishProductsModal.genericError',
|
|
314
|
+
description: 'Default error message for unexpected file upload issues (for unhandled cases)',
|
|
315
|
+
defaultMessage: 'Error occurred: Please try uploading the file again or contact our support team for assistance.'
|
|
316
|
+
},
|
|
317
|
+
dataType: {
|
|
318
|
+
id: 'UnpublishProductsModal.dataType',
|
|
319
|
+
description: 'Label for the data type selection dropdown',
|
|
320
|
+
defaultMessage: 'Data type'
|
|
321
|
+
},
|
|
322
|
+
instructions: {
|
|
323
|
+
id: 'UnpublishProductsModal.instructions',
|
|
324
|
+
description: 'Label for the instructions section',
|
|
325
|
+
defaultMessage: 'Instructions'
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
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)); }
|
|
330
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
331
|
+
let MissingUnpublishProductsProviderError = /*#__PURE__*/function (_Error) {
|
|
332
|
+
function MissingUnpublishProductsProviderError() {
|
|
333
|
+
var _this;
|
|
334
|
+
_classCallCheck(this, MissingUnpublishProductsProviderError);
|
|
335
|
+
_this = _callSuper(this, MissingUnpublishProductsProviderError, ['useUnpublishProductsProviderError must be used within MissingUnpublishProductsProviderError']);
|
|
336
|
+
_this.name = 'MissingUnpublishProductsProviderError';
|
|
337
|
+
return _this;
|
|
338
|
+
}
|
|
339
|
+
_inherits(MissingUnpublishProductsProviderError, _Error);
|
|
340
|
+
return _createClass(MissingUnpublishProductsProviderError);
|
|
341
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
342
|
+
|
|
343
|
+
const useUnpublishProductsContext = () => {
|
|
344
|
+
const context = React.useContext(UnpublishProductsContext);
|
|
345
|
+
if (!context) {
|
|
346
|
+
throw new MissingUnpublishProductsProviderError();
|
|
347
|
+
}
|
|
348
|
+
return context;
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
var messages$3 = reactIntl.defineMessages({
|
|
352
|
+
fileSizeExceededTitle: {
|
|
353
|
+
id: 'UnpublishProductsModal.sizeExceededTitle',
|
|
354
|
+
defaultMessage: 'File size exceeded'
|
|
355
|
+
},
|
|
356
|
+
fileSizeExceededDescription: {
|
|
357
|
+
id: 'UnpublishProductsModal.sizeExceededDescription',
|
|
358
|
+
description: 'Error description when the file size exceeds the allowable limit',
|
|
359
|
+
defaultMessage: 'The file exceeds the maximum allowed size of {fileSizeLimit} MB'
|
|
360
|
+
},
|
|
361
|
+
rowLimitExceededTitle: {
|
|
362
|
+
id: 'UnpublishProductsModal.rowLimitExceededTitle',
|
|
363
|
+
defaultMessage: 'Row limit exceeded'
|
|
364
|
+
},
|
|
365
|
+
rowLimitExceededDescription: {
|
|
366
|
+
id: 'UnpublishProductsModal.rowLimitExceededDescription',
|
|
367
|
+
description: 'Error description when the file contains more rows than the allowable maximum',
|
|
368
|
+
defaultMessage: 'The file contains more than the allowable maximum of {rowLimit} rows'
|
|
369
|
+
},
|
|
370
|
+
dropAreaNotEnoughRowsTitle: {
|
|
371
|
+
id: 'UnpublishProductsModal.dropAreaNotEnoughRowsTitle',
|
|
372
|
+
description: 'Error title shown when the uploaded CSV file does not contain a header and at least one row of data',
|
|
373
|
+
defaultMessage: 'Invalid CSV file'
|
|
374
|
+
},
|
|
375
|
+
dropAreaNotEnoughRowsDescription: {
|
|
376
|
+
id: 'UnpublishProductsModal.dropAreaNotEnoughRowsDescription',
|
|
377
|
+
description: 'Error description shown when the uploaded CSV file does not contain a header and at least one row of data',
|
|
378
|
+
defaultMessage: 'Make sure the file contains a header and at least one row of data'
|
|
379
|
+
},
|
|
380
|
+
unexpectedError: {
|
|
381
|
+
id: 'UnpublishProductsModal.unexpectedError',
|
|
382
|
+
description: 'Generic notification message when file upload fails',
|
|
383
|
+
defaultMessage: 'An unexpected error occurred during the file upload. Please try again, or contact support if this error occurs again.'
|
|
384
|
+
},
|
|
385
|
+
missingRequiredField: {
|
|
386
|
+
id: 'UnpublishProductsModal.missingRequiredField',
|
|
387
|
+
description: 'Error message displayed when a required field is missing',
|
|
388
|
+
defaultMessage: 'Missing required field'
|
|
389
|
+
},
|
|
390
|
+
missingKeyError: {
|
|
391
|
+
id: 'UnpublishProductsModal.missingKeyError',
|
|
392
|
+
description: 'Error message displayed when the uploaded file is missing the key field',
|
|
393
|
+
defaultMessage: "The 'key' field is missing or incomplete in some rows. Please ensure every row has a 'key' value."
|
|
394
|
+
},
|
|
395
|
+
csvFormatErrorTitle: {
|
|
396
|
+
id: 'UnpublishProductsModal.csvFormatErrorTitle',
|
|
397
|
+
description: 'Error title shown when the uploaded CSV file is not formatted correctly',
|
|
398
|
+
defaultMessage: 'Invalid CSV file'
|
|
399
|
+
},
|
|
400
|
+
csvFormatErrorDescription: {
|
|
401
|
+
id: 'UnpublishProductsModal.csvFormatErrorDescription',
|
|
402
|
+
description: 'Error message displayed when the CSV file is not formatted correctly',
|
|
403
|
+
defaultMessage: "Your CSV file is not formatted correctly. Make sure the file contains only one column named 'key', which includes the product keys"
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
const useUpload = () => {
|
|
408
|
+
const intl = reactIntl.useIntl();
|
|
409
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
410
|
+
projectKey: context.project?.key
|
|
411
|
+
})),
|
|
412
|
+
projectKey = _useApplicationContex.projectKey;
|
|
413
|
+
const _useUnpublishProducts = useUnpublishProductsContext(),
|
|
414
|
+
state = _useUnpublishProducts.state,
|
|
415
|
+
actions = _useUnpublishProducts.actions;
|
|
416
|
+
const showNotification = actionsGlobal.useShowNotification();
|
|
417
|
+
const _useImportContainerUp = operations.useImportContainerUpload({
|
|
418
|
+
projectKey: projectKey
|
|
419
|
+
}),
|
|
420
|
+
upload = _useImportContainerUp.upload;
|
|
421
|
+
React__default["default"].useEffect(() => {
|
|
422
|
+
return () => {
|
|
423
|
+
if (state.abortController) state.abortController.abort();
|
|
424
|
+
};
|
|
425
|
+
}, [state.abortController]);
|
|
426
|
+
const isFileValid = async file => {
|
|
427
|
+
const errors = [];
|
|
428
|
+
const rowCount = await operations.getRowCount(file);
|
|
429
|
+
if (rowCount < 1) errors.push({
|
|
430
|
+
title: intl.formatMessage(messages$3.dropAreaNotEnoughRowsTitle),
|
|
431
|
+
description: intl.formatMessage(messages$3.dropAreaNotEnoughRowsDescription)
|
|
432
|
+
});
|
|
433
|
+
if (file.size > operations.toBytes(operations.MAX_FILE_SIZE_MB)) errors.push({
|
|
434
|
+
title: intl.formatMessage(messages$3.fileSizeExceededTitle),
|
|
435
|
+
description: intl.formatMessage(messages$3.fileSizeExceededDescription, {
|
|
436
|
+
fileSizeLimit: intl.formatNumber(operations.MAX_FILE_SIZE_MB)
|
|
437
|
+
})
|
|
438
|
+
});
|
|
439
|
+
if (!(await operations.hasSingleKeyColumn(file))) {
|
|
440
|
+
errors.push({
|
|
441
|
+
title: intl.formatMessage(messages$3.csvFormatErrorTitle),
|
|
442
|
+
description: intl.formatMessage(messages$3.csvFormatErrorDescription)
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
if (rowCount > operations.MAX_ROW_COUNT) errors.push({
|
|
446
|
+
title: intl.formatMessage(messages$3.rowLimitExceededTitle),
|
|
447
|
+
description: intl.formatMessage(messages$3.rowLimitExceededDescription, {
|
|
448
|
+
rowLimit: intl.formatNumber(operations.MAX_ROW_COUNT)
|
|
449
|
+
})
|
|
450
|
+
});
|
|
451
|
+
if (errors.length > 0) {
|
|
452
|
+
actions.setFileUploadErrors(errors);
|
|
453
|
+
actions.setCurrentStep('upload-error');
|
|
454
|
+
return false;
|
|
455
|
+
}
|
|
456
|
+
return true;
|
|
457
|
+
};
|
|
458
|
+
const handleUploadError = error => {
|
|
459
|
+
if (operations.isAbortError(error)) {
|
|
460
|
+
actions.cancelImport();
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
if (error instanceof operations.HttpError) {
|
|
464
|
+
if (error.errorData?.code === 'MISSING_KEY_ERROR') {
|
|
465
|
+
actions.setFileUploadErrors([{
|
|
466
|
+
title: intl.formatMessage(messages$3.missingRequiredField),
|
|
467
|
+
description: intl.formatMessage(messages$3.missingKeyError)
|
|
468
|
+
}]);
|
|
469
|
+
actions.setCurrentStep('upload-error');
|
|
470
|
+
} else {
|
|
471
|
+
actions.cancelImport();
|
|
472
|
+
showNotification({
|
|
473
|
+
kind: 'error',
|
|
474
|
+
domain: constants.DOMAINS.PAGE,
|
|
475
|
+
text: intl.formatMessage(messages$3.unexpectedError)
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
} else {
|
|
479
|
+
actions.cancelImport();
|
|
480
|
+
showNotification({
|
|
481
|
+
kind: 'error',
|
|
482
|
+
domain: constants.DOMAINS.PAGE,
|
|
483
|
+
text: String(error)
|
|
484
|
+
});
|
|
485
|
+
sentry.reportErrorToSentry(new Error('Upload File Error: An unexpected issue occurred while uploading the file'), {
|
|
486
|
+
extra: {
|
|
487
|
+
error,
|
|
488
|
+
fileSizeInBytes: state.droppedFile?.size
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
const handleUploadAndValidation = async () => {
|
|
494
|
+
if (!state.droppedFile) return;
|
|
495
|
+
const canUpload = await isFileValid(state.droppedFile);
|
|
496
|
+
if (!canUpload) return;
|
|
497
|
+
actions.setCurrentStep('uploading');
|
|
498
|
+
try {
|
|
499
|
+
const xhr = await upload({
|
|
500
|
+
file: state.droppedFile,
|
|
501
|
+
resourceType: 'product',
|
|
502
|
+
settings: {
|
|
503
|
+
resourceType: 'product-draft',
|
|
504
|
+
format: 'CSV',
|
|
505
|
+
options: {
|
|
506
|
+
unpublishAllChanges: true
|
|
507
|
+
}
|
|
508
|
+
},
|
|
509
|
+
onSuccess: (fileUploadResponse, containerKey) => {
|
|
510
|
+
actions.setContainerKey(containerKey);
|
|
511
|
+
actions.setUploadFileResponse(fileUploadResponse);
|
|
512
|
+
actions.setCurrentStep('upload-preview');
|
|
513
|
+
},
|
|
514
|
+
onProgress: progress => {
|
|
515
|
+
actions.setProgress(progress);
|
|
516
|
+
},
|
|
517
|
+
onError: handleUploadError
|
|
518
|
+
});
|
|
519
|
+
actions.setAbortController(xhr);
|
|
520
|
+
} catch (error) {
|
|
521
|
+
handleUploadError(error);
|
|
522
|
+
}
|
|
523
|
+
};
|
|
524
|
+
return {
|
|
525
|
+
handleUploadAndValidation
|
|
526
|
+
};
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
const FileDropArea = () => {
|
|
530
|
+
const intl = reactIntl.useIntl();
|
|
531
|
+
const _useUnpublishProducts = useUnpublishProductsContext(),
|
|
532
|
+
state = _useUnpublishProducts.state,
|
|
533
|
+
actions = _useUnpublishProducts.actions;
|
|
534
|
+
const showNotification = actionsGlobal.useShowNotification();
|
|
535
|
+
const onDrop = React__default["default"].useCallback(_ref => {
|
|
536
|
+
let _ref2 = _slicedToArray(_ref, 1),
|
|
537
|
+
file = _ref2[0];
|
|
538
|
+
if (!file) return;
|
|
539
|
+
actions.setDroppedFile(file);
|
|
540
|
+
}, [actions]);
|
|
541
|
+
const handleDropRejected = React__default["default"].useCallback(errorType => {
|
|
542
|
+
const errorMessageMap = {
|
|
543
|
+
'too-many-files': messages$4.tooManyFilesError,
|
|
544
|
+
'invalid-type': messages$4.fileFormatNotSupported,
|
|
545
|
+
generic: messages$4.genericError
|
|
546
|
+
};
|
|
547
|
+
showNotification({
|
|
548
|
+
kind: 'error',
|
|
549
|
+
domain: constants.DOMAINS.PAGE,
|
|
550
|
+
text: intl.formatMessage(errorMessageMap[errorType])
|
|
551
|
+
});
|
|
552
|
+
}, [intl, showNotification]);
|
|
553
|
+
const getState = React__default["default"].useCallback(isDragActive => getDropAreaState({
|
|
554
|
+
isReady: Boolean(state.droppedFile),
|
|
555
|
+
isDragActive
|
|
556
|
+
}), [state.droppedFile]);
|
|
557
|
+
return jsxRuntime.jsx(operations.FileDropArea, {
|
|
558
|
+
onDrop: onDrop,
|
|
559
|
+
onDropRejected: handleDropRejected,
|
|
560
|
+
accept: {
|
|
561
|
+
'text/csv': ['.csv']
|
|
562
|
+
},
|
|
563
|
+
getDropAreaState: getState,
|
|
564
|
+
children: dropAreaState => getDropArea({
|
|
565
|
+
dropAreaState,
|
|
566
|
+
isFileDropped: Boolean(state.droppedFile),
|
|
567
|
+
fileName: state.droppedFile?.name,
|
|
568
|
+
messages: {
|
|
569
|
+
dragAndDropCSV: intl.formatMessage(messages$4.dragAndDropCSV),
|
|
570
|
+
or: intl.formatMessage(messages$4.or),
|
|
571
|
+
browseButton: intl.formatMessage(messages$4.browseButton),
|
|
572
|
+
chooseFile: intl.formatMessage(messages$4.chooseFile)
|
|
573
|
+
}
|
|
574
|
+
})
|
|
575
|
+
});
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
var sharedMessages = reactIntl.defineMessages({
|
|
579
|
+
unpublishModalTitle: {
|
|
580
|
+
id: 'UnpublishProductsModal.unpublishModalTitle',
|
|
581
|
+
description: 'The title of the modal',
|
|
582
|
+
defaultMessage: 'Bulk unpublish via CSV'
|
|
583
|
+
},
|
|
584
|
+
startBulkUnpublish: {
|
|
585
|
+
id: 'UnpublishProductsModal.startBulkUnpublish',
|
|
586
|
+
description: 'Start bulk unpublish button',
|
|
587
|
+
defaultMessage: 'Start bulk unpublish'
|
|
588
|
+
},
|
|
589
|
+
cancel: {
|
|
590
|
+
id: 'UnpublishProductsModal.cancel',
|
|
591
|
+
description: 'The label for the cancel button',
|
|
592
|
+
defaultMessage: 'Cancel'
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
var messages$2 = reactIntl.defineMessages({
|
|
597
|
+
fileUploadInstructions: {
|
|
598
|
+
id: 'UnpublishProductsModal.fileUploadInstructions',
|
|
599
|
+
description: 'Instructions for uploading a CSV file with product keys to unpublish',
|
|
600
|
+
defaultMessage: "The CSV file must contain the product keys to be unpublished under the header 'key'. 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>."
|
|
601
|
+
}
|
|
602
|
+
});
|
|
603
|
+
|
|
604
|
+
const DOCUMENTATION_LINK = 'https://docs.commercetools.com/merchant-center/product-list#bulk-unpublish-via-csv-import';
|
|
605
|
+
const TEMPLATE_DOWNLOAD_LINK = 'https://docs.commercetools.com/merchant-center/downloads/product_unpublish_import_template.csv';
|
|
606
|
+
|
|
607
|
+
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; }
|
|
608
|
+
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; }
|
|
609
|
+
const Instructions = () => {
|
|
610
|
+
const intl = reactIntl.useIntl();
|
|
611
|
+
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
612
|
+
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$2.fileUploadInstructions), {}, {
|
|
613
|
+
values: {
|
|
614
|
+
maxFileSize: intl.formatNumber(operations.MAX_FILE_SIZE_MB),
|
|
615
|
+
maxRowCount: intl.formatNumber(operations.MAX_ROW_COUNT),
|
|
616
|
+
csvTemplateLink: msg => jsxRuntime.jsx(uiKit.Link, {
|
|
617
|
+
tone: "secondary",
|
|
618
|
+
isExternal: true,
|
|
619
|
+
to: TEMPLATE_DOWNLOAD_LINK,
|
|
620
|
+
children: msg
|
|
621
|
+
}, "csvTemplateLink"),
|
|
622
|
+
documentationLink: msg => jsxRuntime.jsx(uiKit.Link, {
|
|
623
|
+
tone: "secondary",
|
|
624
|
+
isExternal: true,
|
|
625
|
+
to: DOCUMENTATION_LINK,
|
|
626
|
+
children: msg
|
|
627
|
+
}, "documentationLink")
|
|
628
|
+
}
|
|
629
|
+
})
|
|
630
|
+
});
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
const Upload = () => {
|
|
634
|
+
const _useUnpublishProducts = useUnpublishProductsContext(),
|
|
635
|
+
state = _useUnpublishProducts.state,
|
|
636
|
+
onClose = _useUnpublishProducts.onClose;
|
|
637
|
+
const intl = reactIntl.useIntl();
|
|
638
|
+
const _useUpload = useUpload(),
|
|
639
|
+
handleUploadAndValidation = _useUpload.handleUploadAndValidation;
|
|
640
|
+
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
641
|
+
size: 16,
|
|
642
|
+
isOpen: true,
|
|
643
|
+
title: intl.formatMessage(sharedMessages.unpublishModalTitle),
|
|
644
|
+
labelPrimary: intl.formatMessage(messages$4.uploadAndPreview),
|
|
645
|
+
onPrimaryButtonClick: handleUploadAndValidation,
|
|
646
|
+
isPrimaryButtonDisabled: !Boolean(state.droppedFile),
|
|
647
|
+
onSecondaryButtonClick: () => onClose({
|
|
648
|
+
shouldDeleteImportContainer: true
|
|
649
|
+
}),
|
|
650
|
+
onClose: () => onClose({
|
|
651
|
+
shouldDeleteImportContainer: true
|
|
652
|
+
}),
|
|
653
|
+
children: jsxRuntime.jsx(fullstory.Masking.Unmask, {
|
|
654
|
+
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
655
|
+
scale: "m",
|
|
656
|
+
children: [jsxRuntime.jsx(Instructions, {}), jsxRuntime.jsx(FileDropArea, {})]
|
|
657
|
+
})
|
|
658
|
+
})
|
|
659
|
+
});
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
const Uploading = () => {
|
|
663
|
+
const intl = reactIntl.useIntl();
|
|
664
|
+
const _useUnpublishProducts = useUnpublishProductsContext(),
|
|
665
|
+
state = _useUnpublishProducts.state,
|
|
666
|
+
actions = _useUnpublishProducts.actions,
|
|
667
|
+
onClose = _useUnpublishProducts.onClose;
|
|
668
|
+
if (!state.droppedFile?.name) return null;
|
|
669
|
+
return jsxRuntime.jsx(operations.UploadingModal, {
|
|
670
|
+
isOpen: true,
|
|
671
|
+
title: intl.formatMessage(sharedMessages.unpublishModalTitle),
|
|
672
|
+
fileName: state.droppedFile.name,
|
|
673
|
+
fileSize: state.droppedFile.size,
|
|
674
|
+
progress: state.progress,
|
|
675
|
+
cancelLabel: intl.formatMessage(sharedMessages.cancel),
|
|
676
|
+
onCancel: () => {
|
|
677
|
+
actions.setCurrentStep('upload');
|
|
678
|
+
state.abortController.abort();
|
|
679
|
+
},
|
|
680
|
+
onClose: () => onClose({
|
|
681
|
+
shouldDeleteImportContainer: true
|
|
682
|
+
})
|
|
683
|
+
});
|
|
684
|
+
};
|
|
685
|
+
|
|
686
|
+
var messages$1 = reactIntl.defineMessages({
|
|
687
|
+
uploadNewFile: {
|
|
688
|
+
id: 'UnpublishProductsModal.uploadNewFile',
|
|
689
|
+
defaultMessage: 'Upload new file'
|
|
690
|
+
},
|
|
691
|
+
uploadErrorDescription: {
|
|
692
|
+
id: 'UnpublishProductsModal.uploadError',
|
|
693
|
+
description: 'Title when errors detected while uploading file',
|
|
694
|
+
defaultMessage: 'There {errorsCount, plural, one {is <b>1</b> error} other {are <b>{errorsCount}</b> errors}} detected while uploading the file "{fileName}".'
|
|
695
|
+
},
|
|
696
|
+
errorType: {
|
|
697
|
+
id: 'UnpublishProductsModal.errorType',
|
|
698
|
+
description: 'Error type" column',
|
|
699
|
+
defaultMessage: 'Error type'
|
|
700
|
+
},
|
|
701
|
+
details: {
|
|
702
|
+
id: 'UnpublishProductsModal.details',
|
|
703
|
+
description: '"Details" column',
|
|
704
|
+
defaultMessage: 'Details'
|
|
705
|
+
}
|
|
706
|
+
});
|
|
707
|
+
|
|
708
|
+
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; }
|
|
709
|
+
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; }
|
|
710
|
+
const getColumns = () => [{
|
|
711
|
+
key: 'errorType',
|
|
712
|
+
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages$1.errorType)),
|
|
713
|
+
width: 'max-content'
|
|
714
|
+
}, {
|
|
715
|
+
key: 'details',
|
|
716
|
+
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages$1.details))
|
|
717
|
+
}];
|
|
718
|
+
const UploadErrorTable = props => {
|
|
719
|
+
var _context;
|
|
720
|
+
const pagination = uiKit.usePaginationState({
|
|
721
|
+
perPage: 10
|
|
722
|
+
});
|
|
723
|
+
const startIndex = (pagination.page.value - 1) * pagination.perPage.value;
|
|
724
|
+
const endIndex = startIndex + pagination.perPage.value;
|
|
725
|
+
const currentPageRows = _sliceInstanceProperty__default["default"](_context = props.rows).call(_context, startIndex, endIndex);
|
|
726
|
+
const shouldShowPagination = props.rows.length > pagination.perPage.value;
|
|
727
|
+
return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
728
|
+
scale: "l",
|
|
729
|
+
children: [jsxRuntime.jsx(uiKit.DataTable, {
|
|
730
|
+
verticalCellAlignment: "center",
|
|
731
|
+
isCondensed: true,
|
|
732
|
+
rows: currentPageRows,
|
|
733
|
+
columns: getColumns(),
|
|
734
|
+
itemRenderer: itemRenderer
|
|
735
|
+
}), shouldShowPagination && jsxRuntime.jsx(uiKit.PageNavigator, {
|
|
736
|
+
onPageChange: pagination.page.onChange,
|
|
737
|
+
page: pagination.page.value,
|
|
738
|
+
totalPages: Math.ceil(props.rows.length / pagination.perPage.value)
|
|
739
|
+
})]
|
|
740
|
+
});
|
|
741
|
+
};
|
|
742
|
+
function itemRenderer(item, column) {
|
|
743
|
+
switch (column.key) {
|
|
744
|
+
case 'errorType':
|
|
745
|
+
return jsxRuntime.jsx(uiKit.Stamp, {
|
|
746
|
+
isCondensed: true,
|
|
747
|
+
label: item.title,
|
|
748
|
+
tone: "critical"
|
|
749
|
+
});
|
|
750
|
+
case 'details':
|
|
751
|
+
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
752
|
+
children: item.description
|
|
753
|
+
});
|
|
754
|
+
default:
|
|
755
|
+
return null;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
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; }
|
|
760
|
+
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; }
|
|
761
|
+
const UploadErrorsModal = () => {
|
|
762
|
+
const intl = reactIntl.useIntl();
|
|
763
|
+
const _useUnpublishProducts = useUnpublishProductsContext(),
|
|
764
|
+
state = _useUnpublishProducts.state,
|
|
765
|
+
actions = _useUnpublishProducts.actions,
|
|
766
|
+
onClose = _useUnpublishProducts.onClose;
|
|
767
|
+
const errorsCount = state.fileUploadErrors.length;
|
|
768
|
+
return jsxRuntime.jsx(applicationComponents.InfoDialog, {
|
|
769
|
+
size: 16,
|
|
770
|
+
isOpen: true,
|
|
771
|
+
title: intl.formatMessage(sharedMessages.unpublishModalTitle),
|
|
772
|
+
onClose: () => onClose(),
|
|
773
|
+
children: jsxRuntime.jsx(fullstory.Masking.Unmask, {
|
|
774
|
+
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
775
|
+
scale: "l",
|
|
776
|
+
children: [jsxRuntime.jsx(fullstory.Masking.Mask, {
|
|
777
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
778
|
+
intlMessage: _objectSpread$3(_objectSpread$3({}, messages$1.uploadErrorDescription), {}, {
|
|
779
|
+
values: {
|
|
780
|
+
fileName: state.droppedFile?.name,
|
|
781
|
+
errorsCount: intl.formatNumber(errorsCount),
|
|
782
|
+
b: getBold$2
|
|
783
|
+
}
|
|
784
|
+
})
|
|
785
|
+
})
|
|
786
|
+
}), jsxRuntime.jsx(UploadErrorTable, {
|
|
787
|
+
rows: operations.mapFileUploadErrorsToUploadFileErrorRows(state.fileUploadErrors)
|
|
788
|
+
}), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
789
|
+
scale: "m",
|
|
790
|
+
justifyContent: "flex-end",
|
|
791
|
+
children: [jsxRuntime.jsx(uiKit.SecondaryButton, {
|
|
792
|
+
label: intl.formatMessage(sharedMessages.cancel),
|
|
793
|
+
onClick: () => onClose()
|
|
794
|
+
}), jsxRuntime.jsx(uiKit.PrimaryButton, {
|
|
795
|
+
iconLeft: jsxRuntime.jsx(uiKit.ImportIcon, {}),
|
|
796
|
+
label: intl.formatMessage(messages$1.uploadNewFile),
|
|
797
|
+
onClick: () => actions.uploadNewFile()
|
|
798
|
+
})]
|
|
799
|
+
})]
|
|
800
|
+
})
|
|
801
|
+
})
|
|
802
|
+
});
|
|
803
|
+
};
|
|
804
|
+
function getBold$2(msg) {
|
|
805
|
+
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
806
|
+
as: "span",
|
|
807
|
+
isBold: true,
|
|
808
|
+
children: msg
|
|
809
|
+
}, crypto.randomUUID());
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
var messages = reactIntl.defineMessages({
|
|
813
|
+
continue: {
|
|
814
|
+
id: 'UnpublishProductsModal.continue',
|
|
815
|
+
description: 'Continue button',
|
|
816
|
+
defaultMessage: 'Continue'
|
|
817
|
+
},
|
|
818
|
+
heresAPreview: {
|
|
819
|
+
id: 'UnpublishProductsModal.heresAPreview',
|
|
820
|
+
description: 'Here is a preview',
|
|
821
|
+
defaultMessage: "Here's a preview:"
|
|
822
|
+
},
|
|
823
|
+
productsToBeUnpublished: {
|
|
824
|
+
id: 'UnpublishProductsModal.productsToBeUnpublished',
|
|
825
|
+
description: 'Products to be unpublished',
|
|
826
|
+
defaultMessage: '{count, plural, one {<b>{count}</b> product to be unpublished} other {<b>{count}</b> products to be unpublished}}'
|
|
827
|
+
},
|
|
828
|
+
confirmationQuestion: {
|
|
829
|
+
id: 'UnpublishProductsModal.confirmationQuestion',
|
|
830
|
+
description: 'Confirmation question',
|
|
831
|
+
defaultMessage: 'Are you sure you want to unpublish the products? '
|
|
832
|
+
},
|
|
833
|
+
confirmationText: {
|
|
834
|
+
id: 'UnpublishProductsModal.confirmationText',
|
|
835
|
+
description: 'Confirmation text',
|
|
836
|
+
defaultMessage: '{count, plural, one {You are about to unpublish <b>{count}</b> product in the project: <b>{projectName}</b>.} other {You are about to unpublish <b>{count}</b> products in the project: <b>{projectName}</b>.}}'
|
|
837
|
+
},
|
|
838
|
+
importStarted: {
|
|
839
|
+
id: 'UnpublishProductsModal.importStarted',
|
|
840
|
+
description: 'Import started',
|
|
841
|
+
defaultMessage: '<b>Your import for bulk unpublish has started.</b><newline></newline>Go to <logsLink>Import logs</logsLink> to view the progress.'
|
|
842
|
+
},
|
|
843
|
+
preparingImport: {
|
|
844
|
+
id: 'UnpublishProductsModal.preparingImport',
|
|
845
|
+
description: 'Preparing import',
|
|
846
|
+
defaultMessage: '<b>Prepare bulk unpublish.</b><newline></newline>Once preparation is complete, you can track the progress <logsLink>in the Import logs</logsLink>. The data will be unpublished after the import is finalized.'
|
|
847
|
+
}
|
|
848
|
+
});
|
|
849
|
+
|
|
850
|
+
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; }
|
|
851
|
+
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; }
|
|
852
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
853
|
+
const getNewLine = () => jsxRuntime.jsx("br", {}, "break");
|
|
854
|
+
const getImportLogsLink = (msg, projectKey) => jsxRuntime.jsx(uiKit.Link, {
|
|
855
|
+
to: `/${projectKey}/operations/import/logs`,
|
|
856
|
+
children: msg
|
|
857
|
+
}, "link");
|
|
858
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
859
|
+
name: "1vs9i7r",
|
|
860
|
+
styles: "width:360px"
|
|
861
|
+
} : {
|
|
862
|
+
name: "g36yzl-ImportRunningTextNotification",
|
|
863
|
+
styles: "width:360px;label:ImportRunningTextNotification;/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInVucHVibGlzaC1wcm9kdWN0cy1jb25maXJtYXRpb24tbW9kYWwudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXNCWSIsImZpbGUiOiJ1bnB1Ymxpc2gtcHJvZHVjdHMtY29uZmlybWF0aW9uLW1vZGFsLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHVzZUludGwgfSBmcm9tICdyZWFjdC1pbnRsJ1xuaW1wb3J0IHsgdXNlU2hvd05vdGlmaWNhdGlvbiB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLWZyb250ZW5kL2FjdGlvbnMtZ2xvYmFsJ1xuaW1wb3J0IHsgQ29uZmlybWF0aW9uRGlhbG9nIH0gZnJvbSAnQGNvbW1lcmNldG9vbHMtZnJvbnRlbmQvYXBwbGljYXRpb24tY29tcG9uZW50cydcbmltcG9ydCB7IHVzZUFwcGxpY2F0aW9uQ29udGV4dCB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLWZyb250ZW5kL2FwcGxpY2F0aW9uLXNoZWxsLWNvbm5lY3RvcnMnXG5pbXBvcnQgeyBET01BSU5TIH0gZnJvbSAnQGNvb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hdGUuZHJvcHBlZEZpbGU/Lm5hbWVcbiAgICAgICAgICBpZiAoIWNhbkNvbmZpcm0pIHJldHVyblxuICAgICAgICAgIG9uQ2xvc2UoKVxuICAgICAgICAgIHNob3dOb3RpZmljYXRpb24oXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIGtpbmQ6ICdpbmZvJyxcbiAgICAgICAgICAgICAgZG9tYWluOiBET01BSU5TLlNJREUsXG4gICAgICAgICAgICAgIC8vIEB0cy1pZ25vcmVcbiAgICAgICAgICAgICAgdGV4dDogPEltcG9ydFByZXBhcmluZ1RleHROb3RpZmljYXRpb24gcHJvamVjdEtleT17cHJvamVjdEtleX0gLz4sXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBkaXNtaXNzQWZ0ZXI6IDUwMDAsXG4gICAgICAgICAgICB9XG4gICAgICAgICAgKVxuICAgICAgICAgIGF3YWl0IHByb2Nlc3NVcGxvYWRlZEZpbGUoe1xuICAgICAgICAgICAgcHJvamVjdEtleSxcbiAgICAgICAgICAgIHJlc291cmNlVHlwZTogJ3Byb2R1Y3QnLFxuICAgICAgICAgICAgaW1wb3J0Q29udGFpbmVyS2V5OiBzdGF0ZS5jb250YWluZXJLZXkhLFxuICAgICAgICAgIH0pXG4gICAgICAgICAgc2hvd05vdGlmaWNhdGlvbihcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAga2luZDogJ2luZm8nLFxuICAgICAgICAgICAgICBkb21haW46IERPTUFJTlMuU0lERSxcbiAgICAgICAgICAgICAgLy8gQHRzLWlnbm9yZVxuICAgICAgICAgICAgICB0ZXh0OiA8SW1wb3J0UnVubmluZ1RleHROb3RpZmljYXRpb24gcHJvamVjdEtleT17cHJvamVjdEtleX0gLz4sXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBkaXNtaXNzQWZ0ZXI6IDUwMDAsXG4gICAgICAgICAgICB9XG4gICAgICAgICAgKVxuICAgICAgICB9IGNhdGNoIChlcnJvcikge1xuICAgICAgICAgIG9uQ2xvc2UoeyBzaG91bGREZWxldGVJbXBvcnRDb250YWluZXI6IHRydWUgfSlcbiAgICAgICAgICBzaG93Tm90aWZpY2F0aW9uKHtcbiAgICAgICAgICAgIGtpbmQ6ICdlcnJvcicsXG4gICAgICAgICAgICBkb21haW46IERPTUFJTlMuUEFHRSxcbiAgICAgICAgICAgIHRleHQ6IFN0cmluZyhlcnJvciksXG4gICAgICAgICAgfSlcbiAgICAgICAgfVxuICAgICAgfX1cbiAgICAgIHNpemU9ezE2fVxuICAgID5cbiAgICAgIDxGdWxsU3RvcnlNYXNraW5nLlVubWFzaz5cbiAgICAgICAgPFNwYWNpbmdzLlN0YWNrIHNjYWxlPVwieGxcIj5cbiAgICAgICAgICA8VGV4dC5Cb2R5XG4gICAgICAgICAgICBpbnRsTWVzc2FnZT17e1xuICAgICAgICAgICAgICAuLi5tZXNzYWdlcy5jb25maXJtYXRpb25UZXh0LFxuICAgICAgICAgICAgICB2YWx1ZXM6IHtcbiAgICAgICAgICAgICAgICBwcm9qZWN0TmFtZTogcHJvamVjdE5hbWUsXG4gICAgICAgICAgICAgICAgLy8gVE9ETzogUmVwbGFjZSB3aXRoIGFjdHVhbCBjb3VudFxuICAgICAgICAgICAgICAgIGNvdW50OiBpbnRsLmZvcm1hdE51bWJlcihzdGF0ZS51cGxvYWRGaWxlUmVzcG9uc2U/LnJvd3NDb3VudCksXG4gICAgICAgICAgICAgICAgYjogZ2V0Qm9sZCxcbiAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIH19XG4gICAgICAgICAgLz5cbiAgICAgICAgICA8VGV4dC5Cb2R5IGludGxNZXNzYWdlPXttZXNzYWdlcy5jb25maXJtYXRpb25RdWVzdGlvbn0gLz5cbiAgICAgICAgPC9TcGFjaW5ncy5TdGFjaz5cbiAgICAgIDwvRnVsbFN0b3J5TWFza2luZy5Vbm1hc2s+XG4gICAgPC9Db25maXJtYXRpb25EaWFsb2c+XG4gIClcbn1cblxuZnVuY3Rpb24gZ2V0Qm9sZChtc2cpIHtcbiAgcmV0dXJuIChcbiAgICA8VGV4dC5Cb2R5IGFzPVwic3BhblwiIGlzQm9sZCBrZXk9e2NyeXB0by5yYW5kb21VVUlEKCl9PlxuICAgICAge21zZ31cbiAgICA8L1RleHQuQm9keT5cbiAgKVxufVxuIl19 */",
|
|
864
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
865
|
+
};
|
|
866
|
+
const ImportRunningTextNotification = props => jsxRuntime.jsx("div", {
|
|
867
|
+
css: _ref2,
|
|
868
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
869
|
+
intlMessage: _objectSpread$2(_objectSpread$2({}, messages.importStarted), {}, {
|
|
870
|
+
values: {
|
|
871
|
+
newline: getNewLine,
|
|
872
|
+
logsLink: msg => getImportLogsLink(msg, props.projectKey),
|
|
873
|
+
b: getBold$1
|
|
874
|
+
}
|
|
875
|
+
})
|
|
876
|
+
})
|
|
877
|
+
});
|
|
878
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
879
|
+
name: "1vs9i7r",
|
|
880
|
+
styles: "width:360px"
|
|
881
|
+
} : {
|
|
882
|
+
name: "mjwslu-ImportPreparingTextNotification",
|
|
883
|
+
styles: "width:360px;label:ImportPreparingTextNotification;/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInVucHVibGlzaC1wcm9kdWN0cy1jb25maXJtYXRpb24tbW9kYWwudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXlDWSIsImZpbGUiOiJ1bnB1Ymxpc2gtcHJvZHVjdHMtY29uZmlybWF0aW9uLW1vZGFsLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHVzZUludGwgfSBmcm9tICdyZWFjdC1pbnRsJ1xuaW1wb3J0IHsgdXNlU2hvd05vdGlmaWNhdGlvbiB9IGZyb20gJ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tZGlhbG9nLWNvbmZpcm0nLFxuICAgICAgfX1cbiAgICAgIGRhdGFBdHRyaWJ1dGVzU2Vjb25kYXJ5QnV0dG9uPXt7XG4gICAgICAgICdkYXRhLXRlc3QtaWQnOiAnY29uZmlybWF0aW9uLWRpYWxvZy1jYW5jZWwnLFxuICAgICAgfX1cbiAgICAgIG9uQ29uZmlybT17YXN5bmMgKCkgPT4ge1xuICAgICAgICB0cnkge1xuICAgICAgICAgIGNvbnN0IGNhbkNvbmZpcm0gPVxuICAgICAgICAgICAgcHJvamVjdEtleSAmJiBzdGF0ZS5jb250YWluZXJLZXkgJiYgc3RhdGUuZHJvcHBlZEZpbGU/Lm5hbWVcbiAgICAgICAgICBpZiAoIWNhbkNvbmZpcm0pIHJldHVyblxuICAgICAgICAgIG9uQ2xvc2UoKVxuICAgICAgICAgIHNob3dOb3RpZmljYXRpb24oXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIGtpbmQ6ICdpbmZvJyxcbiAgICAgICAgICAgICAgZG9tYWluOiBET01BSU5TLlNJREUsXG4gICAgICAgICAgICAgIC8vIEB0cy1pZ25vcmVcbiAgICAgICAgICAgICAgdGV4dDogPEltcG9ydFByZXBhcmluZ1RleHROb3RpZmljYXRpb24gcHJvamVjdEtleT17cHJvamVjdEtleX0gLz4sXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBkaXNtaXNzQWZ0ZXI6IDUwMDAsXG4gICAgICAgICAgICB9XG4gICAgICAgICAgKVxuICAgICAgICAgIGF3YWl0IHByb2Nlc3NVcGxvYWRlZEZpbGUoe1xuICAgICAgICAgICAgcHJvamVjdEtleSxcbiAgICAgICAgICAgIHJlc291cmNlVHlwZTogJ3Byb2R1Y3QnLFxuICAgICAgICAgICAgaW1wb3J0Q29udGFpbmVyS2V5OiBzdGF0ZS5jb250YWluZXJLZXkhLFxuICAgICAgICAgIH0pXG4gICAgICAgICAgc2hvd05vdGlmaWNhdGlvbihcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAga2luZDogJ2luZm8nLFxuICAgICAgICAgICAgICBkb21haW46IERPTUFJTlMuU0lERSxcbiAgICAgICAgICAgICAgLy8gQHRzLWlnbm9yZVxuICAgICAgICAgICAgICB0ZXh0OiA8SW1wb3J0UnVubmluZ1RleHROb3RpZmljYXRpb24gcHJvamVjdEtleT17cHJvamVjdEtleX0gLz4sXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBkaXNtaXNzQWZ0ZXI6IDUwMDAsXG4gICAgICAgICAgICB9XG4gICAgICAgICAgKVxuICAgICAgICB9IGNhdGNoIChlcnJvcikge1xuICAgICAgICAgIG9uQ2xvc2UoeyBzaG91bGREZWxldGVJbXBvcnRDb250YWluZXI6IHRydWUgfSlcbiAgICAgICAgICBzaG93Tm90aWZpY2F0aW9uKHtcbiAgICAgICAgICAgIGtpbmQ6ICdlcnJvcicsXG4gICAgICAgICAgICBkb21haW46IERPTUFJTlMuUEFHRSxcbiAgICAgICAgICAgIHRleHQ6IFN0cmluZyhlcnJvciksXG4gICAgICAgICAgfSlcbiAgICAgICAgfVxuICAgICAgfX1cbiAgICAgIHNpemU9ezE2fVxuICAgID5cbiAgICAgIDxGdWxsU3RvcnlNYXNraW5nLlVubWFzaz5cbiAgICAgICAgPFNwYWNpbmdzLlN0YWNrIHNjYWxlPVwieGxcIj5cbiAgICAgICAgICA8VGV4dC5Cb2R5XG4gICAgICAgICAgICBpbnRsTWVzc2FnZT17e1xuICAgICAgICAgICAgICAuLi5tZXNzYWdlcy5jb25maXJtYXRpb25UZXh0LFxuICAgICAgICAgICAgICB2YWx1ZXM6IHtcbiAgICAgICAgICAgICAgICBwcm9qZWN0TmFtZTogcHJvamVjdE5hbWUsXG4gICAgICAgICAgICAgICAgLy8gVE9ETzogUmVwbGFjZSB3aXRoIGFjdHVhbCBjb3VudFxuICAgICAgICAgICAgICAgIGNvdW50OiBpbnRsLmZvcm1hdE51bWJlcihzdGF0ZS51cGxvYWRGaWxlUmVzcG9uc2U/LnJvd3NDb3VudCksXG4gICAgICAgICAgICAgICAgYjogZ2V0Qm9sZCxcbiAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIH19XG4gICAgICAgICAgLz5cbiAgICAgICAgICA8VGV4dC5Cb2R5IGludGxNZXNzYWdlPXttZXNzYWdlcy5jb25maXJtYXRpb25RdWVzdGlvbn0gLz5cbiAgICAgICAgPC9TcGFjaW5ncy5TdGFjaz5cbiAgICAgIDwvRnVsbFN0b3J5TWFza2luZy5Vbm1hc2s+XG4gICAgPC9Db25maXJtYXRpb25EaWFsb2c+XG4gIClcbn1cblxuZnVuY3Rpb24gZ2V0Qm9sZChtc2cpIHtcbiAgcmV0dXJuIChcbiAgICA8VGV4dC5Cb2R5IGFzPVwic3BhblwiIGlzQm9sZCBrZXk9e2NyeXB0by5yYW5kb21VVUlEKCl9PlxuICAgICAge21zZ31cbiAgICA8L1RleHQuQm9keT5cbiAgKVxufVxuIl19 */",
|
|
884
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
885
|
+
};
|
|
886
|
+
const ImportPreparingTextNotification = props => jsxRuntime.jsx("div", {
|
|
887
|
+
css: _ref,
|
|
888
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
889
|
+
intlMessage: _objectSpread$2(_objectSpread$2({}, messages.preparingImport), {}, {
|
|
890
|
+
values: {
|
|
891
|
+
newline: getNewLine,
|
|
892
|
+
logsLink: msg => getImportLogsLink(msg, props.projectKey),
|
|
893
|
+
b: getBold$1
|
|
894
|
+
}
|
|
895
|
+
})
|
|
896
|
+
})
|
|
897
|
+
});
|
|
898
|
+
const UnpublishProductsConfirmationModal = () => {
|
|
899
|
+
const intl = reactIntl.useIntl();
|
|
900
|
+
const _useUnpublishProducts = useUnpublishProductsContext(),
|
|
901
|
+
state = _useUnpublishProducts.state,
|
|
902
|
+
onClose = _useUnpublishProducts.onClose;
|
|
903
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
904
|
+
projectKey: context.project?.key,
|
|
905
|
+
projectName: context.project?.name
|
|
906
|
+
})),
|
|
907
|
+
projectKey = _useApplicationContex.projectKey,
|
|
908
|
+
projectName = _useApplicationContex.projectName;
|
|
909
|
+
const showNotification = actionsGlobal.useShowNotification();
|
|
910
|
+
return jsxRuntime.jsx(applicationComponents.ConfirmationDialog, {
|
|
911
|
+
title: intl.formatMessage(sharedMessages.unpublishModalTitle),
|
|
912
|
+
labelPrimary: intl.formatMessage(sharedMessages.startBulkUnpublish),
|
|
913
|
+
isOpen: true,
|
|
914
|
+
onClose: () => onClose({
|
|
915
|
+
shouldDeleteImportContainer: true
|
|
916
|
+
}),
|
|
917
|
+
onCancel: () => onClose({
|
|
918
|
+
shouldDeleteImportContainer: true
|
|
919
|
+
}),
|
|
920
|
+
dataAttributesPrimaryButton: {
|
|
921
|
+
'data-test-id': 'confirmation-dialog-confirm'
|
|
922
|
+
},
|
|
923
|
+
dataAttributesSecondaryButton: {
|
|
924
|
+
'data-test-id': 'confirmation-dialog-cancel'
|
|
925
|
+
},
|
|
926
|
+
onConfirm: async () => {
|
|
927
|
+
try {
|
|
928
|
+
const canConfirm = projectKey && state.containerKey && state.droppedFile?.name;
|
|
929
|
+
if (!canConfirm) return;
|
|
930
|
+
onClose();
|
|
931
|
+
showNotification({
|
|
932
|
+
kind: 'info',
|
|
933
|
+
domain: constants.DOMAINS.SIDE,
|
|
934
|
+
// @ts-ignore
|
|
935
|
+
text: jsxRuntime.jsx(ImportPreparingTextNotification, {
|
|
936
|
+
projectKey: projectKey
|
|
937
|
+
})
|
|
938
|
+
}, {
|
|
939
|
+
dismissAfter: 5000
|
|
940
|
+
});
|
|
941
|
+
await operations.processUploadedFile({
|
|
942
|
+
projectKey,
|
|
943
|
+
resourceType: 'product',
|
|
944
|
+
importContainerKey: state.containerKey
|
|
945
|
+
});
|
|
946
|
+
showNotification({
|
|
947
|
+
kind: 'info',
|
|
948
|
+
domain: constants.DOMAINS.SIDE,
|
|
949
|
+
// @ts-ignore
|
|
950
|
+
text: jsxRuntime.jsx(ImportRunningTextNotification, {
|
|
951
|
+
projectKey: projectKey
|
|
952
|
+
})
|
|
953
|
+
}, {
|
|
954
|
+
dismissAfter: 5000
|
|
955
|
+
});
|
|
956
|
+
} catch (error) {
|
|
957
|
+
onClose({
|
|
958
|
+
shouldDeleteImportContainer: true
|
|
959
|
+
});
|
|
960
|
+
showNotification({
|
|
961
|
+
kind: 'error',
|
|
962
|
+
domain: constants.DOMAINS.PAGE,
|
|
963
|
+
text: String(error)
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
},
|
|
967
|
+
size: 16,
|
|
968
|
+
children: jsxRuntime.jsx(fullstory.Masking.Unmask, {
|
|
969
|
+
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
970
|
+
scale: "xl",
|
|
971
|
+
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
972
|
+
intlMessage: _objectSpread$2(_objectSpread$2({}, messages.confirmationText), {}, {
|
|
973
|
+
values: {
|
|
974
|
+
projectName: projectName,
|
|
975
|
+
// TODO: Replace with actual count
|
|
976
|
+
count: intl.formatNumber(state.uploadFileResponse?.rowsCount),
|
|
977
|
+
b: getBold$1
|
|
978
|
+
}
|
|
979
|
+
})
|
|
980
|
+
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
981
|
+
intlMessage: messages.confirmationQuestion
|
|
982
|
+
})]
|
|
983
|
+
})
|
|
984
|
+
})
|
|
985
|
+
});
|
|
986
|
+
};
|
|
987
|
+
function getBold$1(msg) {
|
|
988
|
+
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
989
|
+
as: "span",
|
|
990
|
+
isBold: true,
|
|
991
|
+
children: msg
|
|
992
|
+
}, crypto.randomUUID());
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
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; }
|
|
996
|
+
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; }
|
|
997
|
+
function UploadPreviewModal() {
|
|
998
|
+
const _useUnpublishProducts = useUnpublishProductsContext(),
|
|
999
|
+
state = _useUnpublishProducts.state,
|
|
1000
|
+
onClose = _useUnpublishProducts.onClose,
|
|
1001
|
+
actions = _useUnpublishProducts.actions;
|
|
1002
|
+
const intl = reactIntl.useIntl();
|
|
1003
|
+
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
1004
|
+
size: 16,
|
|
1005
|
+
isOpen: true,
|
|
1006
|
+
title: intl.formatMessage(sharedMessages.unpublishModalTitle),
|
|
1007
|
+
labelPrimary: intl.formatMessage(messages.continue),
|
|
1008
|
+
onSecondaryButtonClick: () => onClose({
|
|
1009
|
+
shouldDeleteImportContainer: true
|
|
1010
|
+
}),
|
|
1011
|
+
onPrimaryButtonClick: () => {
|
|
1012
|
+
actions.setCurrentStep('unpublish-confirmation');
|
|
1013
|
+
},
|
|
1014
|
+
onClose: () => onClose({
|
|
1015
|
+
shouldDeleteImportContainer: true
|
|
1016
|
+
}),
|
|
1017
|
+
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1018
|
+
scale: "m",
|
|
1019
|
+
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1020
|
+
intlMessage: messages.heresAPreview
|
|
1021
|
+
}), jsxRuntime.jsx(uiKit.Card, {
|
|
1022
|
+
insetScale: "xl",
|
|
1023
|
+
children: jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1024
|
+
scale: "m",
|
|
1025
|
+
alignItems: "center",
|
|
1026
|
+
children: [jsxRuntime.jsx(uiKit.CloseBoldIcon, {
|
|
1027
|
+
size: "40",
|
|
1028
|
+
color: "neutral60"
|
|
1029
|
+
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1030
|
+
intlMessage: _objectSpread$1(_objectSpread$1({}, messages.productsToBeUnpublished), {}, {
|
|
1031
|
+
values: {
|
|
1032
|
+
count: intl.formatNumber(state.uploadFileResponse?.rowsCount),
|
|
1033
|
+
b: getBold
|
|
1034
|
+
}
|
|
1035
|
+
})
|
|
1036
|
+
})]
|
|
1037
|
+
})
|
|
1038
|
+
})]
|
|
1039
|
+
})
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
function getBold(msg) {
|
|
1043
|
+
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1044
|
+
as: "span",
|
|
1045
|
+
isBold: true,
|
|
1046
|
+
children: msg
|
|
1047
|
+
}, crypto.randomUUID());
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
const steps = {
|
|
1051
|
+
upload: jsxRuntime.jsx(Upload, {}),
|
|
1052
|
+
uploading: jsxRuntime.jsx(Uploading, {}),
|
|
1053
|
+
'upload-preview': jsxRuntime.jsx(UploadPreviewModal, {}),
|
|
1054
|
+
'upload-error': jsxRuntime.jsx(UploadErrorsModal, {}),
|
|
1055
|
+
'unpublish-confirmation': jsxRuntime.jsx(UnpublishProductsConfirmationModal, {})
|
|
1056
|
+
};
|
|
1057
|
+
const CurrentStep = () => {
|
|
1058
|
+
const _useUnpublishProducts = useUnpublishProductsContext(),
|
|
1059
|
+
state = _useUnpublishProducts.state;
|
|
1060
|
+
return steps[state.currentStep] || null;
|
|
1061
|
+
};
|
|
1062
|
+
|
|
1063
|
+
const getChunkImport = locale => {
|
|
1064
|
+
const intlLocale = i18n.mapLocaleToIntlLocale(locale);
|
|
1065
|
+
switch (intlLocale) {
|
|
1066
|
+
case 'de':
|
|
1067
|
+
return Promise.resolve().then(function () { return require('./de-d3d76e3c.cjs.dev.js'); });
|
|
1068
|
+
case 'es':
|
|
1069
|
+
return Promise.resolve().then(function () { return require('./es-4955e68e.cjs.dev.js'); });
|
|
1070
|
+
case 'fr-FR':
|
|
1071
|
+
return Promise.resolve().then(function () { return require('./fr-FR-01187000.cjs.dev.js'); });
|
|
1072
|
+
case 'ja':
|
|
1073
|
+
return Promise.resolve().then(function () { return require('./ja-9bd5f452.cjs.dev.js'); });
|
|
1074
|
+
case 'pt-BR':
|
|
1075
|
+
return Promise.resolve().then(function () { return require('./pt-BR-872a8cea.cjs.dev.js'); });
|
|
1076
|
+
default:
|
|
1077
|
+
return Promise.resolve().then(function () { return require('./en-b170969b.cjs.dev.js'); });
|
|
1078
|
+
}
|
|
1079
|
+
};
|
|
1080
|
+
const loadMessages = async locale => {
|
|
1081
|
+
try {
|
|
1082
|
+
const chunkImport = await getChunkImport(locale);
|
|
1083
|
+
return i18n.parseChunkImport(chunkImport);
|
|
1084
|
+
} catch (error) {
|
|
1085
|
+
// eslint-disable-next-line no-console
|
|
1086
|
+
console.warn(`Something went wrong while loading the unpublish-products-modal messages for ${locale}`, error);
|
|
1087
|
+
sentry.reportErrorToSentry(new Error(`Something went wrong while loading the unpublish-products-modal messages for ${locale}`), {
|
|
1088
|
+
extra: error
|
|
1089
|
+
});
|
|
1090
|
+
return {};
|
|
1091
|
+
}
|
|
1092
|
+
};
|
|
1093
|
+
|
|
1094
|
+
const useAsyncIntlMessages = (locale, loader) => {
|
|
1095
|
+
const _useState = React.useState({
|
|
1096
|
+
isLoading: true,
|
|
1097
|
+
messages: undefined,
|
|
1098
|
+
error: undefined
|
|
1099
|
+
}),
|
|
1100
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1101
|
+
state = _useState2[0],
|
|
1102
|
+
setState = _useState2[1];
|
|
1103
|
+
React.useEffect(() => {
|
|
1104
|
+
let _isUnmounting = false;
|
|
1105
|
+
async function load() {
|
|
1106
|
+
try {
|
|
1107
|
+
if (!_isUnmounting) {
|
|
1108
|
+
const messages = await loader(locale);
|
|
1109
|
+
setState({
|
|
1110
|
+
isLoading: false,
|
|
1111
|
+
messages
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
} catch (error) {
|
|
1115
|
+
setState({
|
|
1116
|
+
isLoading: false,
|
|
1117
|
+
error
|
|
1118
|
+
});
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
if (locale) load();
|
|
1122
|
+
return () => {
|
|
1123
|
+
_isUnmounting = true;
|
|
1124
|
+
};
|
|
1125
|
+
}, [locale, loader]);
|
|
1126
|
+
return state;
|
|
1127
|
+
};
|
|
1128
|
+
|
|
1129
|
+
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; }
|
|
1130
|
+
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; }
|
|
1131
|
+
const UnpublishProductsModal = props => {
|
|
1132
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
1133
|
+
locale: context.user && context.user.locale
|
|
1134
|
+
})),
|
|
1135
|
+
locale = _useApplicationContex.locale;
|
|
1136
|
+
const messages = useAsyncIntlMessages(locale, loadMessages);
|
|
1137
|
+
if (!props.isOpen || messages.isLoading) return null;
|
|
1138
|
+
return jsxRuntime.jsx(reactIntl.IntlProvider, {
|
|
1139
|
+
locale: locale,
|
|
1140
|
+
messages: messages.messages,
|
|
1141
|
+
children: jsxRuntime.jsx(UnpublishProductsProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
1142
|
+
children: jsxRuntime.jsx(CurrentStep, {})
|
|
1143
|
+
}))
|
|
1144
|
+
});
|
|
1145
|
+
};
|
|
1146
|
+
UnpublishProductsModal.displayName = 'UnpublishProductsModal';
|
|
1147
|
+
|
|
1148
|
+
exports["default"] = UnpublishProductsModal;
|