@commercetools-frontend-extensions/export-resources-modal 0.0.0-canary-20240507102123 → 0.0.0-canary-20240513133343
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 +107 -90
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.prod.js +107 -90
- package/dist/commercetools-frontend-extensions-export-resources-modal.esm.js +107 -89
- package/dist/de-a34c5dd4.cjs.dev.js +6 -0
- package/dist/de-cd6c45d3.esm.js +4 -0
- package/dist/de-d954fe3d.cjs.prod.js +6 -0
- package/dist/declarations/src/@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-3a9aa2d4.esm.js +4 -0
- package/dist/en-6b3694f6.cjs.dev.js +6 -0
- package/dist/en-c7757448.cjs.prod.js +6 -0
- package/dist/es-042343bd.cjs.prod.js +6 -0
- package/dist/es-8b3ecab1.cjs.dev.js +6 -0
- package/dist/es-e544023d.esm.js +4 -0
- package/dist/fr-FR-9d9081ee.esm.js +4 -0
- package/dist/fr-FR-e7126fcc.cjs.dev.js +6 -0
- package/dist/fr-FR-fce1ca96.cjs.prod.js +6 -0
- package/dist/ja-37632763.cjs.prod.js +6 -0
- package/dist/ja-73c088a7.esm.js +4 -0
- package/dist/ja-9bd5f452.cjs.dev.js +6 -0
- package/dist/pt-BR-b37d730b.esm.js +4 -0
- package/dist/pt-BR-ea6b3251.cjs.dev.js +6 -0
- package/dist/pt-BR-ec2a1a11.cjs.prod.js +6 -0
- package/dist/zh-CN-4780d88e.esm.js +4 -0
- package/dist/zh-CN-52baa549.cjs.prod.js +6 -0
- package/dist/zh-CN-d4bc6d26.cjs.dev.js +6 -0
- package/package.json +14 -7
|
@@ -7,13 +7,13 @@ import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-st
|
|
|
7
7
|
import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
8
8
|
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
9
9
|
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
10
|
+
import { defineMessages, FormattedMessage, useIntl, IntlProvider } from 'react-intl';
|
|
11
|
+
import { useApplicationContext } from '@commercetools-frontend/application-shell-connectors';
|
|
10
12
|
import { Text, TextInput, Link, Spacings, ExportIcon, SelectField, TextField, CheckboxInput, Card, designTokens, SearchTextInput, Grid } from '@commercetools-frontend/ui-kit';
|
|
11
13
|
import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
12
14
|
import '@commercetools-uikit/design-system';
|
|
13
|
-
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|
14
15
|
import _valuesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/values';
|
|
15
16
|
import { FormDialog } from '@commercetools-frontend/application-components';
|
|
16
|
-
import { useApplicationContext } from '@commercetools-frontend/application-shell-connectors';
|
|
17
17
|
import _Reflect$construct from '@babel/runtime-corejs3/core-js-stable/reflect/construct';
|
|
18
18
|
import _createClass from '@babel/runtime-corejs3/helpers/esm/createClass';
|
|
19
19
|
import _classCallCheck from '@babel/runtime-corejs3/helpers/esm/classCallCheck';
|
|
@@ -21,19 +21,16 @@ import _inherits from '@babel/runtime-corejs3/helpers/esm/inherits';
|
|
|
21
21
|
import _possibleConstructorReturn from '@babel/runtime-corejs3/helpers/esm/possibleConstructorReturn';
|
|
22
22
|
import _getPrototypeOf from '@babel/runtime-corejs3/helpers/esm/getPrototypeOf';
|
|
23
23
|
import _wrapNativeSuper from '@babel/runtime-corejs3/helpers/esm/wrapNativeSuper';
|
|
24
|
-
import React, { useContext, createContext } from 'react';
|
|
25
|
-
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/esm/objectWithoutProperties';
|
|
26
|
-
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
24
|
+
import React, { useContext, createContext, useState, useEffect } from 'react';
|
|
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
35
|
import { actions, useAsyncDispatch } from '@commercetools-frontend/sdk';
|
|
39
36
|
import { useShowNotification } from '@commercetools-frontend/actions-global';
|
|
@@ -49,6 +46,8 @@ import { css } from '@emotion/react';
|
|
|
49
46
|
import get from 'lodash/get';
|
|
50
47
|
import PropTypes from 'prop-types';
|
|
51
48
|
import { useFormik } from 'formik';
|
|
49
|
+
import { reportErrorToSentry } from '@commercetools-frontend/sentry';
|
|
50
|
+
import { mapLocaleToIntlLocale } from '@commercetools-frontend/i18n';
|
|
52
51
|
|
|
53
52
|
function getBold(msg) {
|
|
54
53
|
return jsx(Text.Body, {
|
|
@@ -182,21 +181,6 @@ var messages = defineMessages({
|
|
|
182
181
|
description: 'Label for "Field definitions" link',
|
|
183
182
|
defaultMessage: 'Field definitions'
|
|
184
183
|
},
|
|
185
|
-
allGeneralFields: {
|
|
186
|
-
id: 'ExportResourcesModal.allGeneralFields',
|
|
187
|
-
description: 'Label for "All general fields" checkbox',
|
|
188
|
-
defaultMessage: 'All general fields'
|
|
189
|
-
},
|
|
190
|
-
allCustomFields: {
|
|
191
|
-
id: 'ExportResourcesModal.allCustomFields',
|
|
192
|
-
description: 'Label for "All custom fields" checkbox',
|
|
193
|
-
defaultMessage: 'All custom fields'
|
|
194
|
-
},
|
|
195
|
-
customTypeKeyAndTypeId: {
|
|
196
|
-
id: 'ExportResourcesModal.customTypeKeyAndTypeId',
|
|
197
|
-
description: 'Label for "Custom type key and typeId" checkbox',
|
|
198
|
-
defaultMessage: 'Custom type key and typeId'
|
|
199
|
-
},
|
|
200
184
|
unexpectedError: {
|
|
201
185
|
id: 'ExportResourcesModal.unexpectedError',
|
|
202
186
|
description: 'Generic notification message when starting export process fails',
|
|
@@ -229,14 +213,14 @@ var messages = defineMessages({
|
|
|
229
213
|
}
|
|
230
214
|
});
|
|
231
215
|
|
|
232
|
-
function ownKeys$
|
|
233
|
-
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; }
|
|
234
218
|
function renderFileNameError(key) {
|
|
235
219
|
switch (key) {
|
|
236
220
|
case 'missing':
|
|
237
|
-
return jsx(FormattedMessage, _objectSpread$
|
|
221
|
+
return jsx(FormattedMessage, _objectSpread$4({}, messages.missingFileNameError));
|
|
238
222
|
case 'invalidInput':
|
|
239
|
-
return jsx(FormattedMessage, _objectSpread$
|
|
223
|
+
return jsx(FormattedMessage, _objectSpread$4({}, messages.invalidFileNameError));
|
|
240
224
|
default:
|
|
241
225
|
return null;
|
|
242
226
|
}
|
|
@@ -244,7 +228,7 @@ function renderFileNameError(key) {
|
|
|
244
228
|
function renderLocaleError(key) {
|
|
245
229
|
switch (key) {
|
|
246
230
|
case 'missing':
|
|
247
|
-
return jsx(FormattedMessage, _objectSpread$
|
|
231
|
+
return jsx(FormattedMessage, _objectSpread$4({}, messages.missingLocaleError));
|
|
248
232
|
default:
|
|
249
233
|
return null;
|
|
250
234
|
}
|
|
@@ -339,7 +323,7 @@ let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
|
|
|
339
323
|
function UnexpectedResourceTypeError(resourceType) {
|
|
340
324
|
var _this;
|
|
341
325
|
_classCallCheck(this, UnexpectedResourceTypeError);
|
|
342
|
-
_this = _super.call(this, "Unexpected resource type
|
|
326
|
+
_this = _super.call(this, "Unexpected resource type \"".concat(resourceType, "\""));
|
|
343
327
|
_this.name = 'UnexpectedResourceTypeError';
|
|
344
328
|
return _this;
|
|
345
329
|
}
|
|
@@ -413,8 +397,6 @@ function validate(_ref) {
|
|
|
413
397
|
return omitEmpty(errors);
|
|
414
398
|
}
|
|
415
399
|
|
|
416
|
-
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; }
|
|
417
|
-
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; }
|
|
418
400
|
function resourceTypeToDisplayName(_ref) {
|
|
419
401
|
let resourceType = _ref.resourceType,
|
|
420
402
|
_ref$isUpperCase = _ref.isUpperCase,
|
|
@@ -433,7 +415,7 @@ function resourceTypeToDisplayName(_ref) {
|
|
|
433
415
|
displayName = isPlural ? 'Discount codes' : 'Discount code';
|
|
434
416
|
break;
|
|
435
417
|
default:
|
|
436
|
-
throw UnexpectedResourceTypeError(resourceType);
|
|
418
|
+
throw new UnexpectedResourceTypeError(resourceType);
|
|
437
419
|
}
|
|
438
420
|
return isUpperCase ? displayName : displayName.toLowerCase();
|
|
439
421
|
}
|
|
@@ -452,42 +434,12 @@ function appendCsvOrJsonExtensionIfAbsent(fileName, fileFormat) {
|
|
|
452
434
|
if (!extensionRegex.test(fileName)) return _concatInstanceProperty(_context = "".concat(fileName, ".")).call(_context, fileFormat);
|
|
453
435
|
return fileName;
|
|
454
436
|
}
|
|
455
|
-
function flattenNestedFields(fields) {
|
|
456
|
-
const result = (fields === null || fields === void 0 ? void 0 : _mapInstanceProperty(fields).call(fields, field => {
|
|
457
|
-
if (isFilledArray(field.fields)) {
|
|
458
|
-
var _context2;
|
|
459
|
-
return _mapInstanceProperty(_context2 = flattenNestedFields(field.fields)).call(_context2, nestedField => {
|
|
460
|
-
var _context3;
|
|
461
|
-
return _objectSpread$5(_objectSpread$5({}, nestedField), {}, {
|
|
462
|
-
name: _concatInstanceProperty(_context3 = "".concat(field.name, ".")).call(_context3, nestedField.name)
|
|
463
|
-
});
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
return field;
|
|
467
|
-
})) || [];
|
|
468
|
-
return _flatInstanceProperty(result).call(result);
|
|
469
|
-
}
|
|
470
|
-
function checkRequiredFields(fields) {
|
|
471
|
-
return _mapInstanceProperty(fields).call(fields, field => field.isRequired ? _objectSpread$5(_objectSpread$5({}, field), {}, {
|
|
472
|
-
isChecked: true
|
|
473
|
-
}) : field);
|
|
474
|
-
}
|
|
475
437
|
function getExportLogsLink(projectKey, msg) {
|
|
476
438
|
return jsx(Link, {
|
|
477
439
|
to: "/".concat(projectKey, "/operations/export/logs"),
|
|
478
440
|
children: msg
|
|
479
441
|
});
|
|
480
442
|
}
|
|
481
|
-
function setInitialCheckedStateForCustomFields(customFields) {
|
|
482
|
-
return _mapInstanceProperty(customFields).call(customFields, customType => {
|
|
483
|
-
var _context4;
|
|
484
|
-
return _objectSpread$5(_objectSpread$5({}, customType), {}, {
|
|
485
|
-
fields: _mapInstanceProperty(_context4 = customType.fields).call(_context4, field => _objectSpread$5(_objectSpread$5({}, field), {}, {
|
|
486
|
-
isChecked: false
|
|
487
|
-
}))
|
|
488
|
-
});
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
443
|
const extractFieldNamesAndAdditionalFieldExtensions = fields => {
|
|
492
444
|
const result = _reduceInstanceProperty(fields).call(fields, (acc, field) => {
|
|
493
445
|
if (field.additionalFieldExtensions) {
|
|
@@ -524,8 +476,8 @@ function tmpBuildFilters(selectedResourceIds) {
|
|
|
524
476
|
return ["id in (".concat(formattedIds, ")")];
|
|
525
477
|
}
|
|
526
478
|
|
|
527
|
-
function ownKeys$
|
|
528
|
-
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; }
|
|
529
481
|
const updateFieldGroupsWithIsCheckedValue = groups => {
|
|
530
482
|
const updateFields = (fields, parentChecked) => {
|
|
531
483
|
return _mapInstanceProperty(fields).call(fields, field => {
|
|
@@ -536,14 +488,14 @@ const updateFieldGroupsWithIsCheckedValue = groups => {
|
|
|
536
488
|
isChecked = false;
|
|
537
489
|
field.fields = updatedFields;
|
|
538
490
|
}
|
|
539
|
-
return _objectSpread$
|
|
491
|
+
return _objectSpread$3(_objectSpread$3({}, field), {}, {
|
|
540
492
|
isChecked
|
|
541
493
|
});
|
|
542
494
|
});
|
|
543
495
|
};
|
|
544
496
|
return _mapInstanceProperty(groups).call(groups, group => {
|
|
545
497
|
const updatedFields = updateFields(group.fields, false);
|
|
546
|
-
return _objectSpread$
|
|
498
|
+
return _objectSpread$3(_objectSpread$3({}, group), {}, {
|
|
547
499
|
fields: updatedFields
|
|
548
500
|
});
|
|
549
501
|
});
|
|
@@ -555,51 +507,38 @@ const updateFieldGroupWithAdditionalFieldExtensions = groups => {
|
|
|
555
507
|
if (field.fields) {
|
|
556
508
|
field.fields = updateAdditionalFieldExtensions(field.fields, updatedAdditionalFieldExtensions);
|
|
557
509
|
}
|
|
558
|
-
return _objectSpread$
|
|
510
|
+
return _objectSpread$3(_objectSpread$3({}, field), {}, {
|
|
559
511
|
additionalFieldExtensions: updatedAdditionalFieldExtensions
|
|
560
512
|
});
|
|
561
513
|
});
|
|
562
514
|
}
|
|
563
515
|
return _mapInstanceProperty(groups).call(groups, group => {
|
|
564
|
-
return _objectSpread$
|
|
516
|
+
return _objectSpread$3(_objectSpread$3({}, group), {}, {
|
|
565
517
|
fields: updateAdditionalFieldExtensions(group.fields, group.additionalFieldExtensions || [])
|
|
566
518
|
});
|
|
567
519
|
});
|
|
568
520
|
};
|
|
569
521
|
|
|
570
|
-
const _excluded = ["isSelectedByDefault"];
|
|
571
|
-
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; }
|
|
572
|
-
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; }
|
|
573
522
|
const useInitialValues = props => {
|
|
574
|
-
var _context;
|
|
575
523
|
const todayFormatted = moment().format('DD-MM-YY_HH-mm');
|
|
576
524
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
577
525
|
locale: applicationContext.dataLocale
|
|
578
526
|
})),
|
|
579
527
|
locale = _useApplicationContex.locale;
|
|
580
|
-
const fields = _mapInstanceProperty(_context = flattenNestedFields(props.fields)).call(_context, _ref => {
|
|
581
|
-
let isSelectedByDefault = _ref.isSelectedByDefault,
|
|
582
|
-
field = _objectWithoutProperties(_ref, _excluded);
|
|
583
|
-
return _objectSpread$3(_objectSpread$3({}, field), {}, {
|
|
584
|
-
isChecked: isSelectedByDefault !== null && isSelectedByDefault !== void 0 ? isSelectedByDefault : true
|
|
585
|
-
});
|
|
586
|
-
});
|
|
587
528
|
const groups = updateFieldGroupsWithIsCheckedValue(props.fieldGroups);
|
|
588
529
|
return React.useMemo(() => {
|
|
589
|
-
var
|
|
530
|
+
var _context;
|
|
590
531
|
return {
|
|
591
532
|
outputFormat: props.outputFormat,
|
|
592
|
-
fileName: _concatInstanceProperty(
|
|
533
|
+
fileName: _concatInstanceProperty(_context = "".concat(resourceTypeToDisplayName({
|
|
593
534
|
resourceType: props.resourceType,
|
|
594
535
|
isUpperCase: true,
|
|
595
536
|
isPlural: true
|
|
596
|
-
}), "_Export_")).call(
|
|
537
|
+
}), "_Export_")).call(_context, todayFormatted),
|
|
597
538
|
locales: [locale],
|
|
598
|
-
fields: checkRequiredFields(fields),
|
|
599
|
-
customFields: setInitialCheckedStateForCustomFields(props.customFields),
|
|
600
539
|
groups: updateFieldGroupWithAdditionalFieldExtensions(groups)
|
|
601
540
|
};
|
|
602
|
-
}, [props, locale, todayFormatted,
|
|
541
|
+
}, [props, locale, todayFormatted, groups]);
|
|
603
542
|
};
|
|
604
543
|
|
|
605
544
|
async function createExportOperation(_ref) {
|
|
@@ -614,6 +553,7 @@ async function createExportOperation(_ref) {
|
|
|
614
553
|
const uri = "/proxy/export/".concat(projectKey, "/export-operations");
|
|
615
554
|
const response = await asyncDispatchFn(actions.post({
|
|
616
555
|
// FIXME: EXPORT is undefined
|
|
556
|
+
// @ts-ignore
|
|
617
557
|
mcApiProxyTarget: MC_API_PROXY_TARGETS.EXPORT,
|
|
618
558
|
uri: uri,
|
|
619
559
|
headers: {
|
|
@@ -1198,13 +1138,92 @@ const CurrentStep = () => {
|
|
|
1198
1138
|
return steps[currentStep] || null;
|
|
1199
1139
|
};
|
|
1200
1140
|
|
|
1141
|
+
const loadMessages = locale => {
|
|
1142
|
+
const intlLocale = mapLocaleToIntlLocale(locale);
|
|
1143
|
+
switch (intlLocale) {
|
|
1144
|
+
case 'de':
|
|
1145
|
+
return import( /* webpackChunkName: "export-resources-modal-i18n-de" */'./de-cd6c45d3.esm.js');
|
|
1146
|
+
case 'es':
|
|
1147
|
+
return import( /* webpackChunkName: "export-resources-modal-i18n-es" */'./es-e544023d.esm.js');
|
|
1148
|
+
case 'fr-FR':
|
|
1149
|
+
return import( /* webpackChunkName: "export-resources-modal-i18n-fr-FR" */'./fr-FR-9d9081ee.esm.js');
|
|
1150
|
+
case 'zh-CN':
|
|
1151
|
+
return import( /* webpackChunkName: "export-resources-modal-i18n-zh-CN" */'./zh-CN-4780d88e.esm.js');
|
|
1152
|
+
case 'ja':
|
|
1153
|
+
return import( /* webpackChunkName: "export-resources-modal-i18n-ja" */'./ja-73c088a7.esm.js');
|
|
1154
|
+
case 'pt-BR':
|
|
1155
|
+
return import( /* webpackChunkName: "change-history-i18n-pt-BR" */'./pt-BR-b37d730b.esm.js');
|
|
1156
|
+
default:
|
|
1157
|
+
return import( /* webpackChunkName: "export-resources-modal-i18n-en" */'./en-3a9aa2d4.esm.js');
|
|
1158
|
+
}
|
|
1159
|
+
};
|
|
1160
|
+
|
|
1161
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
1162
|
+
const loadI18n = async locale => {
|
|
1163
|
+
try {
|
|
1164
|
+
const messages = await loadMessages(locale);
|
|
1165
|
+
return messages.default || messages;
|
|
1166
|
+
} catch (error) {
|
|
1167
|
+
// eslint-disable-next-line no-console
|
|
1168
|
+
console.warn("Something went wrong while loading the export-resources-modal messages for ".concat(locale), error);
|
|
1169
|
+
reportErrorToSentry(new Error("Something went wrong while loading the export-resources-modal messages for ".concat(locale)), {
|
|
1170
|
+
extra: error
|
|
1171
|
+
});
|
|
1172
|
+
return {};
|
|
1173
|
+
}
|
|
1174
|
+
};
|
|
1175
|
+
|
|
1176
|
+
const useAsyncIntlMessages = (locale, loader) => {
|
|
1177
|
+
const _useState = useState({
|
|
1178
|
+
isLoading: true,
|
|
1179
|
+
messages: undefined,
|
|
1180
|
+
error: undefined
|
|
1181
|
+
}),
|
|
1182
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1183
|
+
state = _useState2[0],
|
|
1184
|
+
setState = _useState2[1];
|
|
1185
|
+
useEffect(() => {
|
|
1186
|
+
let _isUnmounting = false;
|
|
1187
|
+
async function load() {
|
|
1188
|
+
try {
|
|
1189
|
+
if (!_isUnmounting) {
|
|
1190
|
+
const messages = await loader(locale);
|
|
1191
|
+
setState({
|
|
1192
|
+
isLoading: false,
|
|
1193
|
+
messages
|
|
1194
|
+
});
|
|
1195
|
+
}
|
|
1196
|
+
} catch (error) {
|
|
1197
|
+
setState({
|
|
1198
|
+
isLoading: false,
|
|
1199
|
+
error
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
if (locale) load();
|
|
1204
|
+
return () => {
|
|
1205
|
+
_isUnmounting = true;
|
|
1206
|
+
};
|
|
1207
|
+
}, [locale, loader]);
|
|
1208
|
+
return state;
|
|
1209
|
+
};
|
|
1210
|
+
|
|
1201
1211
|
function ownKeys(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; }
|
|
1202
1212
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1203
1213
|
const ExportResourcesModal = props => {
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1214
|
+
const _useApplicationContex = useApplicationContext(context => ({
|
|
1215
|
+
locale: context.user && context.user.locale
|
|
1216
|
+
})),
|
|
1217
|
+
locale = _useApplicationContex.locale;
|
|
1218
|
+
const messages = useAsyncIntlMessages('en', loadI18n);
|
|
1219
|
+
if (!props.isOpen || messages.isLoading) return null;
|
|
1220
|
+
return jsx(IntlProvider, {
|
|
1221
|
+
locale: locale,
|
|
1222
|
+
messages: messages.messages,
|
|
1223
|
+
children: jsx(ExportResourcesProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
1224
|
+
children: jsx(CurrentStep, {})
|
|
1225
|
+
}))
|
|
1226
|
+
});
|
|
1208
1227
|
};
|
|
1209
1228
|
ExportResourcesModal.displayName = 'ExportResourcesModal';
|
|
1210
1229
|
ExportResourcesModal.defaultProps = {
|
|
@@ -1212,7 +1231,6 @@ ExportResourcesModal.defaultProps = {
|
|
|
1212
1231
|
selectedResourceIds: [],
|
|
1213
1232
|
exportType: EXPORT_TYPES.ALL,
|
|
1214
1233
|
outputFormat: OUTPUT_FORMATS.CSV,
|
|
1215
|
-
customFields: [],
|
|
1216
1234
|
fieldGroups: []
|
|
1217
1235
|
};
|
|
1218
1236
|
|
|
@@ -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;
|