@commercetools-frontend-extensions/export-resources-modal 0.0.0-canary-20240508124931 → 0.0.0-canary-20240517195613
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-export-resources-modal.cjs.d.ts +3 -0
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.dev.js +65 -89
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.prod.js +65 -89
- package/dist/commercetools-frontend-extensions-export-resources-modal.esm.js +64 -87
- package/dist/declarations/src/@constants/delimiters.d.ts +4 -0
- package/dist/declarations/src/@constants/export-operation-states.d.ts +5 -0
- package/dist/declarations/src/@constants/export-types.d.ts +5 -0
- package/dist/declarations/src/@constants/exportable-resources.d.ts +5 -0
- package/dist/declarations/src/@constants/index.d.ts +7 -0
- package/dist/declarations/src/@constants/misc.d.ts +1 -0
- package/dist/declarations/src/@constants/output-formats.d.ts +8 -0
- package/dist/declarations/src/@constants/urls.d.ts +3 -0
- package/dist/declarations/src/@types/export-resources-modal-shape.d.ts +27 -0
- package/dist/declarations/src/@types/formik.d.ts +11 -0
- package/dist/declarations/src/@types/index.d.ts +2 -0
- package/dist/declarations/src/export-resources-modal.d.ts +13 -0
- package/dist/declarations/src/index.d.ts +3 -0
- package/dist/en-1f28eeaa.esm.js +123 -0
- package/dist/en-30e710ff.cjs.dev.js +125 -0
- package/dist/en-7a050c00.cjs.prod.js +125 -0
- package/package.json +24 -25
- package/dist/en-3a9aa2d4.esm.js +0 -4
- package/dist/en-6b3694f6.cjs.dev.js +0 -6
- package/dist/en-c7757448.cjs.prod.js +0 -6
|
@@ -22,20 +22,16 @@ import _possibleConstructorReturn from '@babel/runtime-corejs3/helpers/esm/possi
|
|
|
22
22
|
import _getPrototypeOf from '@babel/runtime-corejs3/helpers/esm/getPrototypeOf';
|
|
23
23
|
import _wrapNativeSuper from '@babel/runtime-corejs3/helpers/esm/wrapNativeSuper';
|
|
24
24
|
import React, { useContext, createContext, useState, useEffect } from 'react';
|
|
25
|
-
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/esm/objectWithoutProperties';
|
|
26
|
-
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
27
25
|
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
28
26
|
import moment from 'moment';
|
|
29
27
|
import _someInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/some';
|
|
30
28
|
import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
|
|
31
29
|
import omitEmpty from 'omit-empty-es';
|
|
30
|
+
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
32
31
|
import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
|
|
33
|
-
import _flatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/flat';
|
|
34
32
|
import _Set from '@babel/runtime-corejs3/core-js-stable/set';
|
|
35
33
|
import _sortInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/sort';
|
|
36
|
-
import '@babel/runtime-corejs3/core-js-stable/instance/starts-with';
|
|
37
34
|
import _indexOfInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/index-of';
|
|
38
|
-
import { UnexpectedResourceTypeError, InvalidResponseError } from '@commercetools-local/shared';
|
|
39
35
|
import { actions, useAsyncDispatch } from '@commercetools-frontend/sdk';
|
|
40
36
|
import { useShowNotification } from '@commercetools-frontend/actions-global';
|
|
41
37
|
import { MC_API_PROXY_TARGETS, DOMAINS } from '@commercetools-frontend/constants';
|
|
@@ -51,7 +47,7 @@ import get from 'lodash/get';
|
|
|
51
47
|
import PropTypes from 'prop-types';
|
|
52
48
|
import { useFormik } from 'formik';
|
|
53
49
|
import { reportErrorToSentry } from '@commercetools-frontend/sentry';
|
|
54
|
-
import { mapLocaleToIntlLocale } from '@commercetools-frontend/i18n';
|
|
50
|
+
import { parseChunkImport, mapLocaleToIntlLocale } from '@commercetools-frontend/i18n';
|
|
55
51
|
|
|
56
52
|
function getBold(msg) {
|
|
57
53
|
return jsx(Text.Body, {
|
|
@@ -217,14 +213,14 @@ var messages = defineMessages({
|
|
|
217
213
|
}
|
|
218
214
|
});
|
|
219
215
|
|
|
220
|
-
function ownKeys$
|
|
221
|
-
function _objectSpread$
|
|
216
|
+
function ownKeys$4(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
217
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$4(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$4(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
222
218
|
function renderFileNameError(key) {
|
|
223
219
|
switch (key) {
|
|
224
220
|
case 'missing':
|
|
225
|
-
return jsx(FormattedMessage, _objectSpread$
|
|
221
|
+
return jsx(FormattedMessage, _objectSpread$4({}, messages.missingFileNameError));
|
|
226
222
|
case 'invalidInput':
|
|
227
|
-
return jsx(FormattedMessage, _objectSpread$
|
|
223
|
+
return jsx(FormattedMessage, _objectSpread$4({}, messages.invalidFileNameError));
|
|
228
224
|
default:
|
|
229
225
|
return null;
|
|
230
226
|
}
|
|
@@ -232,7 +228,7 @@ function renderFileNameError(key) {
|
|
|
232
228
|
function renderLocaleError(key) {
|
|
233
229
|
switch (key) {
|
|
234
230
|
case 'missing':
|
|
235
|
-
return jsx(FormattedMessage, _objectSpread$
|
|
231
|
+
return jsx(FormattedMessage, _objectSpread$4({}, messages.missingLocaleError));
|
|
236
232
|
default:
|
|
237
233
|
return null;
|
|
238
234
|
}
|
|
@@ -274,11 +270,11 @@ const FIELD_DEFINITIONS_URLS = {
|
|
|
274
270
|
category: 'https://docs.commercetools.com/merchant-center/import-categories#supported-headers-and-values'
|
|
275
271
|
};
|
|
276
272
|
|
|
277
|
-
function _createSuper$
|
|
278
|
-
function _isNativeReflectConstruct$
|
|
273
|
+
function _createSuper$4(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$4(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
274
|
+
function _isNativeReflectConstruct$4() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$4 = function () { return !!t; })(); }
|
|
279
275
|
let UnexpectedExportTypeError = /*#__PURE__*/function (_Error) {
|
|
280
276
|
_inherits(UnexpectedExportTypeError, _Error);
|
|
281
|
-
var _super = _createSuper$
|
|
277
|
+
var _super = _createSuper$4(UnexpectedExportTypeError);
|
|
282
278
|
function UnexpectedExportTypeError(exportType) {
|
|
283
279
|
var _this;
|
|
284
280
|
_classCallCheck(this, UnexpectedExportTypeError);
|
|
@@ -289,11 +285,11 @@ let UnexpectedExportTypeError = /*#__PURE__*/function (_Error) {
|
|
|
289
285
|
return _createClass(UnexpectedExportTypeError);
|
|
290
286
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
291
287
|
|
|
292
|
-
function _createSuper$
|
|
293
|
-
function _isNativeReflectConstruct$
|
|
288
|
+
function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
289
|
+
function _isNativeReflectConstruct$3() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$3 = function () { return !!t; })(); }
|
|
294
290
|
let MissingExportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
295
291
|
_inherits(MissingExportResourceProviderError, _Error);
|
|
296
|
-
var _super = _createSuper$
|
|
292
|
+
var _super = _createSuper$3(MissingExportResourceProviderError);
|
|
297
293
|
function MissingExportResourceProviderError() {
|
|
298
294
|
var _this;
|
|
299
295
|
_classCallCheck(this, MissingExportResourceProviderError);
|
|
@@ -304,11 +300,11 @@ let MissingExportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
|
304
300
|
return _createClass(MissingExportResourceProviderError);
|
|
305
301
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
306
302
|
|
|
307
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
308
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
303
|
+
function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
304
|
+
function _isNativeReflectConstruct$2() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$2 = function () { return !!t; })(); }
|
|
309
305
|
let UnexpectedExportOperationStateError = /*#__PURE__*/function (_Error) {
|
|
310
306
|
_inherits(UnexpectedExportOperationStateError, _Error);
|
|
311
|
-
var _super = _createSuper(UnexpectedExportOperationStateError);
|
|
307
|
+
var _super = _createSuper$2(UnexpectedExportOperationStateError);
|
|
312
308
|
function UnexpectedExportOperationStateError(state) {
|
|
313
309
|
var _this;
|
|
314
310
|
_classCallCheck(this, UnexpectedExportOperationStateError);
|
|
@@ -319,6 +315,36 @@ let UnexpectedExportOperationStateError = /*#__PURE__*/function (_Error) {
|
|
|
319
315
|
return _createClass(UnexpectedExportOperationStateError);
|
|
320
316
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
321
317
|
|
|
318
|
+
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
319
|
+
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function () { return !!t; })(); }
|
|
320
|
+
let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
|
|
321
|
+
_inherits(UnexpectedResourceTypeError, _Error);
|
|
322
|
+
var _super = _createSuper$1(UnexpectedResourceTypeError);
|
|
323
|
+
function UnexpectedResourceTypeError(resourceType) {
|
|
324
|
+
var _this;
|
|
325
|
+
_classCallCheck(this, UnexpectedResourceTypeError);
|
|
326
|
+
_this = _super.call(this, "Unexpected resource type \"".concat(resourceType, "\""));
|
|
327
|
+
_this.name = 'UnexpectedResourceTypeError';
|
|
328
|
+
return _this;
|
|
329
|
+
}
|
|
330
|
+
return _createClass(UnexpectedResourceTypeError);
|
|
331
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
332
|
+
|
|
333
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
334
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
335
|
+
let InvalidResponseError = /*#__PURE__*/function (_Error) {
|
|
336
|
+
_inherits(InvalidResponseError, _Error);
|
|
337
|
+
var _super = _createSuper(InvalidResponseError);
|
|
338
|
+
function InvalidResponseError(message) {
|
|
339
|
+
var _this;
|
|
340
|
+
_classCallCheck(this, InvalidResponseError);
|
|
341
|
+
_this = _super.call(this, message);
|
|
342
|
+
_this.name = 'InvalidResponseError';
|
|
343
|
+
return _this;
|
|
344
|
+
}
|
|
345
|
+
return _createClass(InvalidResponseError);
|
|
346
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
347
|
+
|
|
322
348
|
function useExportResourcesContext() {
|
|
323
349
|
const context = useContext(ExportResourcesContext);
|
|
324
350
|
if (!context) {
|
|
@@ -371,8 +397,6 @@ function validate(_ref) {
|
|
|
371
397
|
return omitEmpty(errors);
|
|
372
398
|
}
|
|
373
399
|
|
|
374
|
-
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; }
|
|
375
|
-
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context5 = ownKeys$5(Object(t), !0)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context6 = ownKeys$5(Object(t))).call(_context6, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
376
400
|
function resourceTypeToDisplayName(_ref) {
|
|
377
401
|
let resourceType = _ref.resourceType,
|
|
378
402
|
_ref$isUpperCase = _ref.isUpperCase,
|
|
@@ -391,7 +415,7 @@ function resourceTypeToDisplayName(_ref) {
|
|
|
391
415
|
displayName = isPlural ? 'Discount codes' : 'Discount code';
|
|
392
416
|
break;
|
|
393
417
|
default:
|
|
394
|
-
throw UnexpectedResourceTypeError(resourceType);
|
|
418
|
+
throw new UnexpectedResourceTypeError(resourceType);
|
|
395
419
|
}
|
|
396
420
|
return isUpperCase ? displayName : displayName.toLowerCase();
|
|
397
421
|
}
|
|
@@ -410,42 +434,12 @@ function appendCsvOrJsonExtensionIfAbsent(fileName, fileFormat) {
|
|
|
410
434
|
if (!extensionRegex.test(fileName)) return _concatInstanceProperty(_context = "".concat(fileName, ".")).call(_context, fileFormat);
|
|
411
435
|
return fileName;
|
|
412
436
|
}
|
|
413
|
-
function flattenNestedFields(fields) {
|
|
414
|
-
const result = (fields === null || fields === void 0 ? void 0 : _mapInstanceProperty(fields).call(fields, field => {
|
|
415
|
-
if (isFilledArray(field.fields)) {
|
|
416
|
-
var _context2;
|
|
417
|
-
return _mapInstanceProperty(_context2 = flattenNestedFields(field.fields)).call(_context2, nestedField => {
|
|
418
|
-
var _context3;
|
|
419
|
-
return _objectSpread$5(_objectSpread$5({}, nestedField), {}, {
|
|
420
|
-
name: _concatInstanceProperty(_context3 = "".concat(field.name, ".")).call(_context3, nestedField.name)
|
|
421
|
-
});
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
return field;
|
|
425
|
-
})) || [];
|
|
426
|
-
return _flatInstanceProperty(result).call(result);
|
|
427
|
-
}
|
|
428
|
-
function checkRequiredFields(fields) {
|
|
429
|
-
return _mapInstanceProperty(fields).call(fields, field => field.isRequired ? _objectSpread$5(_objectSpread$5({}, field), {}, {
|
|
430
|
-
isChecked: true
|
|
431
|
-
}) : field);
|
|
432
|
-
}
|
|
433
437
|
function getExportLogsLink(projectKey, msg) {
|
|
434
438
|
return jsx(Link, {
|
|
435
439
|
to: "/".concat(projectKey, "/operations/export/logs"),
|
|
436
440
|
children: msg
|
|
437
441
|
});
|
|
438
442
|
}
|
|
439
|
-
function setInitialCheckedStateForCustomFields(customFields) {
|
|
440
|
-
return _mapInstanceProperty(customFields).call(customFields, customType => {
|
|
441
|
-
var _context4;
|
|
442
|
-
return _objectSpread$5(_objectSpread$5({}, customType), {}, {
|
|
443
|
-
fields: _mapInstanceProperty(_context4 = customType.fields).call(_context4, field => _objectSpread$5(_objectSpread$5({}, field), {}, {
|
|
444
|
-
isChecked: false
|
|
445
|
-
}))
|
|
446
|
-
});
|
|
447
|
-
});
|
|
448
|
-
}
|
|
449
443
|
const extractFieldNamesAndAdditionalFieldExtensions = fields => {
|
|
450
444
|
const result = _reduceInstanceProperty(fields).call(fields, (acc, field) => {
|
|
451
445
|
if (field.additionalFieldExtensions) {
|
|
@@ -482,8 +476,8 @@ function tmpBuildFilters(selectedResourceIds) {
|
|
|
482
476
|
return ["id in (".concat(formattedIds, ")")];
|
|
483
477
|
}
|
|
484
478
|
|
|
485
|
-
function ownKeys$
|
|
486
|
-
function _objectSpread$
|
|
479
|
+
function ownKeys$3(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
480
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$3(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$3(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
487
481
|
const updateFieldGroupsWithIsCheckedValue = groups => {
|
|
488
482
|
const updateFields = (fields, parentChecked) => {
|
|
489
483
|
return _mapInstanceProperty(fields).call(fields, field => {
|
|
@@ -494,14 +488,14 @@ const updateFieldGroupsWithIsCheckedValue = groups => {
|
|
|
494
488
|
isChecked = false;
|
|
495
489
|
field.fields = updatedFields;
|
|
496
490
|
}
|
|
497
|
-
return _objectSpread$
|
|
491
|
+
return _objectSpread$3(_objectSpread$3({}, field), {}, {
|
|
498
492
|
isChecked
|
|
499
493
|
});
|
|
500
494
|
});
|
|
501
495
|
};
|
|
502
496
|
return _mapInstanceProperty(groups).call(groups, group => {
|
|
503
497
|
const updatedFields = updateFields(group.fields, false);
|
|
504
|
-
return _objectSpread$
|
|
498
|
+
return _objectSpread$3(_objectSpread$3({}, group), {}, {
|
|
505
499
|
fields: updatedFields
|
|
506
500
|
});
|
|
507
501
|
});
|
|
@@ -513,51 +507,38 @@ const updateFieldGroupWithAdditionalFieldExtensions = groups => {
|
|
|
513
507
|
if (field.fields) {
|
|
514
508
|
field.fields = updateAdditionalFieldExtensions(field.fields, updatedAdditionalFieldExtensions);
|
|
515
509
|
}
|
|
516
|
-
return _objectSpread$
|
|
510
|
+
return _objectSpread$3(_objectSpread$3({}, field), {}, {
|
|
517
511
|
additionalFieldExtensions: updatedAdditionalFieldExtensions
|
|
518
512
|
});
|
|
519
513
|
});
|
|
520
514
|
}
|
|
521
515
|
return _mapInstanceProperty(groups).call(groups, group => {
|
|
522
|
-
return _objectSpread$
|
|
516
|
+
return _objectSpread$3(_objectSpread$3({}, group), {}, {
|
|
523
517
|
fields: updateAdditionalFieldExtensions(group.fields, group.additionalFieldExtensions || [])
|
|
524
518
|
});
|
|
525
519
|
});
|
|
526
520
|
};
|
|
527
521
|
|
|
528
|
-
const _excluded = ["isSelectedByDefault"];
|
|
529
|
-
function ownKeys$3(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
530
|
-
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context3 = ownKeys$3(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context4 = ownKeys$3(Object(t))).call(_context4, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
531
522
|
const useInitialValues = props => {
|
|
532
|
-
var _context;
|
|
533
523
|
const todayFormatted = moment().format('DD-MM-YY_HH-mm');
|
|
534
524
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
535
525
|
locale: applicationContext.dataLocale
|
|
536
526
|
})),
|
|
537
527
|
locale = _useApplicationContex.locale;
|
|
538
|
-
const fields = _mapInstanceProperty(_context = flattenNestedFields(props.fields)).call(_context, _ref => {
|
|
539
|
-
let isSelectedByDefault = _ref.isSelectedByDefault,
|
|
540
|
-
field = _objectWithoutProperties(_ref, _excluded);
|
|
541
|
-
return _objectSpread$3(_objectSpread$3({}, field), {}, {
|
|
542
|
-
isChecked: isSelectedByDefault !== null && isSelectedByDefault !== void 0 ? isSelectedByDefault : true
|
|
543
|
-
});
|
|
544
|
-
});
|
|
545
528
|
const groups = updateFieldGroupsWithIsCheckedValue(props.fieldGroups);
|
|
546
529
|
return React.useMemo(() => {
|
|
547
|
-
var
|
|
530
|
+
var _context;
|
|
548
531
|
return {
|
|
549
532
|
outputFormat: props.outputFormat,
|
|
550
|
-
fileName: _concatInstanceProperty(
|
|
533
|
+
fileName: _concatInstanceProperty(_context = "".concat(resourceTypeToDisplayName({
|
|
551
534
|
resourceType: props.resourceType,
|
|
552
535
|
isUpperCase: true,
|
|
553
536
|
isPlural: true
|
|
554
|
-
}), "_Export_")).call(
|
|
537
|
+
}), "_Export_")).call(_context, todayFormatted),
|
|
555
538
|
locales: [locale],
|
|
556
|
-
fields: checkRequiredFields(fields),
|
|
557
|
-
customFields: setInitialCheckedStateForCustomFields(props.customFields),
|
|
558
539
|
groups: updateFieldGroupWithAdditionalFieldExtensions(groups)
|
|
559
540
|
};
|
|
560
|
-
}, [props, locale, todayFormatted,
|
|
541
|
+
}, [props, locale, todayFormatted, groups]);
|
|
561
542
|
};
|
|
562
543
|
|
|
563
544
|
async function createExportOperation(_ref) {
|
|
@@ -569,9 +550,8 @@ async function createExportOperation(_ref) {
|
|
|
569
550
|
locales = _ref.locales,
|
|
570
551
|
filters = _ref.filters,
|
|
571
552
|
asyncDispatchFn = _ref.asyncDispatchFn;
|
|
572
|
-
const uri = "/
|
|
553
|
+
const uri = "/".concat(projectKey, "/export-operations");
|
|
573
554
|
const response = await asyncDispatchFn(actions.post({
|
|
574
|
-
// FIXME: EXPORT is undefined
|
|
575
555
|
mcApiProxyTarget: MC_API_PROXY_TARGETS.EXPORT,
|
|
576
556
|
uri: uri,
|
|
577
557
|
headers: {
|
|
@@ -1156,7 +1136,7 @@ const CurrentStep = () => {
|
|
|
1156
1136
|
return steps[currentStep] || null;
|
|
1157
1137
|
};
|
|
1158
1138
|
|
|
1159
|
-
const
|
|
1139
|
+
const getChunkImport = locale => {
|
|
1160
1140
|
const intlLocale = mapLocaleToIntlLocale(locale);
|
|
1161
1141
|
switch (intlLocale) {
|
|
1162
1142
|
case 'de':
|
|
@@ -1172,15 +1152,13 @@ const loadMessages = locale => {
|
|
|
1172
1152
|
case 'pt-BR':
|
|
1173
1153
|
return import( /* webpackChunkName: "change-history-i18n-pt-BR" */'./pt-BR-b37d730b.esm.js');
|
|
1174
1154
|
default:
|
|
1175
|
-
return import( /* webpackChunkName: "export-resources-modal-i18n-en" */'./en-
|
|
1155
|
+
return import( /* webpackChunkName: "export-resources-modal-i18n-en" */'./en-1f28eeaa.esm.js');
|
|
1176
1156
|
}
|
|
1177
1157
|
};
|
|
1178
|
-
|
|
1179
|
-
// eslint-disable-next-line import/prefer-default-export
|
|
1180
|
-
const loadI18n = async locale => {
|
|
1158
|
+
const loadMessages = async locale => {
|
|
1181
1159
|
try {
|
|
1182
|
-
const
|
|
1183
|
-
return
|
|
1160
|
+
const chunkImport = await getChunkImport(locale);
|
|
1161
|
+
return parseChunkImport(chunkImport);
|
|
1184
1162
|
} catch (error) {
|
|
1185
1163
|
// eslint-disable-next-line no-console
|
|
1186
1164
|
console.warn("Something went wrong while loading the export-resources-modal messages for ".concat(locale), error);
|
|
@@ -1233,7 +1211,7 @@ const ExportResourcesModal = props => {
|
|
|
1233
1211
|
locale: context.user && context.user.locale
|
|
1234
1212
|
})),
|
|
1235
1213
|
locale = _useApplicationContex.locale;
|
|
1236
|
-
const messages = useAsyncIntlMessages(
|
|
1214
|
+
const messages = useAsyncIntlMessages(locale, loadMessages);
|
|
1237
1215
|
if (!props.isOpen || messages.isLoading) return null;
|
|
1238
1216
|
return jsx(IntlProvider, {
|
|
1239
1217
|
locale: locale,
|
|
@@ -1249,7 +1227,6 @@ ExportResourcesModal.defaultProps = {
|
|
|
1249
1227
|
selectedResourceIds: [],
|
|
1250
1228
|
exportType: EXPORT_TYPES.ALL,
|
|
1251
1229
|
outputFormat: OUTPUT_FORMATS.CSV,
|
|
1252
|
-
customFields: [],
|
|
1253
1230
|
fieldGroups: []
|
|
1254
1231
|
};
|
|
1255
1232
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Z_INDEX_DROPDOWN = 30000;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface Field {
|
|
2
|
+
name: string;
|
|
3
|
+
label: string;
|
|
4
|
+
isSelectedByDefault?: boolean;
|
|
5
|
+
isRequired?: boolean;
|
|
6
|
+
isReadOnly?: boolean;
|
|
7
|
+
fields?: Field[];
|
|
8
|
+
additionalFieldExtensions?: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface FieldGroup {
|
|
11
|
+
groupLabel: string;
|
|
12
|
+
additionalFieldExtensions?: string[];
|
|
13
|
+
fields: Field[];
|
|
14
|
+
}
|
|
15
|
+
export interface ExportResourcesModalShape {
|
|
16
|
+
isOpen: boolean;
|
|
17
|
+
resourceType: string;
|
|
18
|
+
outputFormat: string;
|
|
19
|
+
onClose: () => void;
|
|
20
|
+
onExportSuccess: () => void;
|
|
21
|
+
totalResourcesCount: number;
|
|
22
|
+
selectedResourceIds: string[];
|
|
23
|
+
fieldGroups: FieldGroup[];
|
|
24
|
+
exportType: string;
|
|
25
|
+
renderProperties: () => void;
|
|
26
|
+
fieldOrder?: string[];
|
|
27
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Field, FieldGroup } from "./export-resources-modal-shape.js";
|
|
2
|
+
export interface FormikField extends Field {
|
|
3
|
+
isChecked?: boolean;
|
|
4
|
+
fields?: FormikField[];
|
|
5
|
+
additionalFieldExtensions: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface FormikGroup extends FieldGroup {
|
|
8
|
+
isChecked?: boolean;
|
|
9
|
+
fields: FormikField[];
|
|
10
|
+
additionalFieldExtensions?: string[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ExportResourcesModalShape } from "./@types/index.js";
|
|
2
|
+
declare const ExportResourcesModal: {
|
|
3
|
+
(props: ExportResourcesModalShape): import("@emotion/react/types/jsx-namespace").EmotionJSX.Element | null;
|
|
4
|
+
displayName: string;
|
|
5
|
+
defaultProps: {
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
selectedResourceIds: never[];
|
|
8
|
+
exportType: string;
|
|
9
|
+
outputFormat: string;
|
|
10
|
+
fieldGroups: never[];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export default ExportResourcesModal;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
var en = {
|
|
2
|
+
"ExportResourcesModal.back": {
|
|
3
|
+
developer_comment: "Label for \"Back\" button",
|
|
4
|
+
string: "Back"
|
|
5
|
+
},
|
|
6
|
+
"ExportResourcesModal.checkTheSpelling": {
|
|
7
|
+
developer_comment: "In Export fields selection - Check the spelling message",
|
|
8
|
+
string: "Check the spelling."
|
|
9
|
+
},
|
|
10
|
+
"ExportResourcesModal.continue": {
|
|
11
|
+
developer_comment: "Label for \"Continue\" button",
|
|
12
|
+
string: "Continue"
|
|
13
|
+
},
|
|
14
|
+
"ExportResourcesModal.exportAllMessage": {
|
|
15
|
+
developer_comment: "All resources will be exported",
|
|
16
|
+
string: "All <b>{count}</b> {resourceType} will be exported."
|
|
17
|
+
},
|
|
18
|
+
"ExportResourcesModal.exportAllResources": {
|
|
19
|
+
developer_comment: "Export All selection",
|
|
20
|
+
string: "Export all {resourceType} ({count})"
|
|
21
|
+
},
|
|
22
|
+
"ExportResourcesModal.exportBasedOnMyViewsMessage": {
|
|
23
|
+
developer_comment: "Select Export setttings based on my views",
|
|
24
|
+
string: "Select export settings based on:"
|
|
25
|
+
},
|
|
26
|
+
"ExportResourcesModal.exportMatchingMessage": {
|
|
27
|
+
developer_comment: "resources will be exported",
|
|
28
|
+
string: "<b>{count}</b> {resourceType} will be exported."
|
|
29
|
+
},
|
|
30
|
+
"ExportResourcesModal.exportOnlySelectedResources": {
|
|
31
|
+
developer_comment: "Export only selected resources",
|
|
32
|
+
string: "Export selected {resourceType} ({count})"
|
|
33
|
+
},
|
|
34
|
+
"ExportResourcesModal.exportOperationSuccessMessage": {
|
|
35
|
+
developer_comment: "Success message",
|
|
36
|
+
string: "<b>Your export has started.</b> <newline></newline><logsLink>Go to Export logs</logsLink> to view the progress and download the file."
|
|
37
|
+
},
|
|
38
|
+
"ExportResourcesModal.exportSelectedMessage": {
|
|
39
|
+
developer_comment: "resources are selected and will be exported",
|
|
40
|
+
string: "<b>{count}</b> {resourceType} are selected and will be exported."
|
|
41
|
+
},
|
|
42
|
+
"ExportResourcesModal.exportSelection": {
|
|
43
|
+
developer_comment: "Export selection",
|
|
44
|
+
string: "Export selection"
|
|
45
|
+
},
|
|
46
|
+
"ExportResourcesModal.fieldDefinitions": {
|
|
47
|
+
developer_comment: "Label for \"Field definitions\" link",
|
|
48
|
+
string: "Field definitions"
|
|
49
|
+
},
|
|
50
|
+
"ExportResourcesModal.fileName": {
|
|
51
|
+
developer_comment: "exported file name",
|
|
52
|
+
string: "File name"
|
|
53
|
+
},
|
|
54
|
+
"ExportResourcesModal.invalidFileNameError": {
|
|
55
|
+
developer_comment: "Error when file name field is not valid",
|
|
56
|
+
string: "File name may only contain alphanumeric characters, hyphens and underscores"
|
|
57
|
+
},
|
|
58
|
+
"ExportResourcesModal.locale": {
|
|
59
|
+
developer_comment: "Locale",
|
|
60
|
+
string: "Locale"
|
|
61
|
+
},
|
|
62
|
+
"ExportResourcesModal.missingFileNameError": {
|
|
63
|
+
developer_comment: "Error when file name field is missing",
|
|
64
|
+
string: "Please enter a file name"
|
|
65
|
+
},
|
|
66
|
+
"ExportResourcesModal.missingLocaleError": {
|
|
67
|
+
developer_comment: "Error when no locale is selected",
|
|
68
|
+
string: "Please select at least one locale"
|
|
69
|
+
},
|
|
70
|
+
"ExportResourcesModal.modalTitle": {
|
|
71
|
+
developer_comment: "Label for the modal title",
|
|
72
|
+
string: "Export {resourceType}"
|
|
73
|
+
},
|
|
74
|
+
"ExportResourcesModal.myViews": {
|
|
75
|
+
developer_comment: "Label for \"My Views\" Select Field",
|
|
76
|
+
string: "My Views"
|
|
77
|
+
},
|
|
78
|
+
"ExportResourcesModal.nothingApplied": {
|
|
79
|
+
developer_comment: "Shown when there is no filter applied",
|
|
80
|
+
string: "nothing applied"
|
|
81
|
+
},
|
|
82
|
+
"ExportResourcesModal.outputFormat": {
|
|
83
|
+
developer_comment: "File format like (csv, xls, ...etc)",
|
|
84
|
+
string: "File format"
|
|
85
|
+
},
|
|
86
|
+
"ExportResourcesModal.propertiesPanelLabel": {
|
|
87
|
+
developer_comment: "properties panel label",
|
|
88
|
+
string: "Properties"
|
|
89
|
+
},
|
|
90
|
+
"ExportResourcesModal.searchByEnteringTheExactFieldName": {
|
|
91
|
+
developer_comment: "In Export fields selection - Search by entering the exact field name message",
|
|
92
|
+
string: "Try searching by entering the exact field name."
|
|
93
|
+
},
|
|
94
|
+
"ExportResourcesModal.searchForFields": {
|
|
95
|
+
developer_comment: "Placeholder for \"Search for fields\" search input",
|
|
96
|
+
string: "Search for fields"
|
|
97
|
+
},
|
|
98
|
+
"ExportResourcesModal.selectAllLocales": {
|
|
99
|
+
developer_comment: "label for \"Select all locales\" checkbox",
|
|
100
|
+
string: "Select all locales"
|
|
101
|
+
},
|
|
102
|
+
"ExportResourcesModal.selectFieldsToExport": {
|
|
103
|
+
string: "Select fields to export"
|
|
104
|
+
},
|
|
105
|
+
"ExportResourcesModal.startExport": {
|
|
106
|
+
developer_comment: "Label for \"Start export\" button",
|
|
107
|
+
string: "Start export"
|
|
108
|
+
},
|
|
109
|
+
"ExportResourcesModal.suggestions": {
|
|
110
|
+
developer_comment: "In Export fields selection - Suggestions message",
|
|
111
|
+
string: "Suggestions:"
|
|
112
|
+
},
|
|
113
|
+
"ExportResourcesModal.thereAreNoResults": {
|
|
114
|
+
developer_comment: "No search results message",
|
|
115
|
+
string: "There are no results that match your search."
|
|
116
|
+
},
|
|
117
|
+
"ExportResourcesModal.unexpectedError": {
|
|
118
|
+
developer_comment: "Generic notification message when starting export process fails",
|
|
119
|
+
string: "An error occurred while starting the export process. Please try again or contact support if the problem persists."
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export { en as default };
|