@commercetools-frontend-extensions/export-resources-modal 1.3.2 → 1.3.3
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.
|
@@ -22,22 +22,21 @@ 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 _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
|
|
25
|
-
import { TextInput, Text, CollapsiblePanel, Tag, Spacings, AngleRightIcon, customProperties as customProperties$1, Constraints, SelectInput, RadioInput, Card, SelectField, TextField, CheckboxInput
|
|
25
|
+
import { TextInput, Text, CollapsiblePanel, Tag, Spacings, AngleRightIcon, customProperties as customProperties$1, Constraints, SelectInput, Link, RadioInput, Card, SelectField, TextField, CheckboxInput } from '@commercetools-frontend/ui-kit';
|
|
26
26
|
import omitEmpty from 'omit-empty-es';
|
|
27
27
|
import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
28
28
|
import { customProperties, useTheme } from '@commercetools-uikit/design-system';
|
|
29
29
|
import PropTypes from 'prop-types';
|
|
30
|
-
import
|
|
30
|
+
import { Children, useContext, createContext } from 'react';
|
|
31
31
|
import { css } from '@emotion/react';
|
|
32
32
|
import _styled from '@emotion/styled/base';
|
|
33
33
|
import _valuesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/values';
|
|
34
34
|
import { useApplicationContext } from '@commercetools-frontend/application-shell-connectors';
|
|
35
35
|
import { actions, useAsyncDispatch } from '@commercetools-frontend/sdk';
|
|
36
|
-
import {
|
|
37
|
-
import
|
|
36
|
+
import { MC_API_PROXY_TARGETS, DOMAINS } from '@commercetools-frontend/constants';
|
|
37
|
+
import { useShowNotification, showApiErrorNotification } from '@commercetools-frontend/actions-global';
|
|
38
38
|
import { useFormik } from 'formik';
|
|
39
39
|
import moment from 'moment';
|
|
40
|
-
import { MC_API_PROXY_TARGETS } from '@commercetools-frontend/constants';
|
|
41
40
|
|
|
42
41
|
const EXPORT_OPERATION_STATES = {
|
|
43
42
|
PROCESSING: 'processing',
|
|
@@ -367,7 +366,7 @@ var messages = defineMessages({
|
|
|
367
366
|
exportOperationSuccessMessage: {
|
|
368
367
|
id: 'ExportResourcesModal.exportOperationSuccessMessage',
|
|
369
368
|
description: 'Success message',
|
|
370
|
-
defaultMessage: 'Your export has started
|
|
369
|
+
defaultMessage: '<b>Your export has started.</b> <newline></newline><logsLink>Go to Export logs</logsLink> to view the progress and download the file.'
|
|
371
370
|
},
|
|
372
371
|
exportConfirmationLabel: {
|
|
373
372
|
id: 'ExportResourcesModal.exportConfirmationLabel',
|
|
@@ -414,6 +413,10 @@ function getBold(msg) {
|
|
|
414
413
|
});
|
|
415
414
|
}
|
|
416
415
|
|
|
416
|
+
function getNewLine() {
|
|
417
|
+
return jsx("br", {});
|
|
418
|
+
}
|
|
419
|
+
|
|
417
420
|
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)."; }
|
|
418
421
|
const smallTopPadding = /*#__PURE__*/css("padding-top:", customProperties.spacingXs, ";" + (process.env.NODE_ENV === "production" ? "" : ";label:smallTopPadding;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFJMkIiLCJmaWxlIjoic3R5bGVzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8gVE9ETzogQHJlZGVzaWduIGNsZWFudXBcbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0J1xuaW1wb3J0IHsgY3VzdG9tUHJvcGVydGllcyB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLXVpa2l0L2Rlc2lnbi1zeXN0ZW0nXG5cbmNvbnN0IHNtYWxsVG9wUGFkZGluZyA9IGNzc2BcbiAgcGFkZGluZy10b3A6ICR7Y3VzdG9tUHJvcGVydGllcy5zcGFjaW5nWHN9O1xuYFxuXG5jb25zdCB0YWdMaXN0Q29udGFpbmVyID0gKHsgaXNOZXdUaGVtZSB9KSA9PiBjc3NgXG4gIHdpZHRoOiAxMDAlO1xuICBkaXNwbGF5OiBmbGV4O1xuICBmbGV4LXdyYXA6IHdyYXA7XG4gIGRpc3BsYXk6IGlubGluZS1mbGV4O1xuICBwYWRkaW5nOiAwICR7aXNOZXdUaGVtZSA/IDAgOiBjdXN0b21Qcm9wZXJ0aWVzLnNwYWNpbmdMfTtcbiAgJiA+IGRpdiB7XG4gICAgbWFyZ2luOiAwICR7Y3VzdG9tUHJvcGVydGllcy5zcGFjaW5nU30gJHtjdXN0b21Qcm9wZXJ0aWVzLnNwYWNpbmdTfSAwO1xuICB9XG5gXG5cbmNvbnN0IHRhZ0xpc3RJdGVtID0gY3NzYFxuICBtYXJnaW46IDAgJHtjdXN0b21Qcm9wZXJ0aWVzLnNwYWNpbmdYc30gJHtjdXN0b21Qcm9wZXJ0aWVzLnNwYWNpbmdYc30gMDtcbiAgZGlzcGxheTogZmxleDtcbiAgbWluLXdpZHRoOiAwO1xuYFxuXG5jb25zdCBkaXZpZGVyID0gY3NzYFxuICBib3gtc2l6aW5nOiBib3JkZXItYm94O1xuICB3aWR0aDogMTAwJTtcbiAgbWFyZ2luOiAwO1xuICBib3JkZXI6IDA7XG4gIGJvcmRlci10b3A6IDFweCBzb2xpZCAke2N1c3RvbVByb3BlcnRpZXMuY29sb3JOZXV0cmFsNjB9O1xuYFxuXG5jb25zdCBub3RCb2xkID0gY3NzYFxuICBmb250LXdlaWdodDogbm9ybWFsO1xuYFxuXG5jb25zdCBzdWNjZXNzTWVzc2FnZSA9IGNzc2BcbiAgbWFyZ2luLWJvdHRvbTogJHtjdXN0b21Qcm9wZXJ0aWVzLnNwYWNpbmdMfTtcbmBcblxuZXhwb3J0IGNvbnN0IHN0eWxlcyA9IHtcbiAgdGFnTGlzdEl0ZW0sXG4gIHRhZ0xpc3RDb250YWluZXIsXG4gIHNtYWxsVG9wUGFkZGluZyxcbiAgZGl2aWRlcixcbiAgbm90Qm9sZCxcbiAgc3VjY2Vzc01lc3NhZ2UsXG59XG4iXX0= */");
|
|
419
422
|
const tagListContainer = _ref => {
|
|
@@ -461,8 +464,8 @@ TagList.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
461
464
|
'data-testid': PropTypes.string
|
|
462
465
|
} : {};
|
|
463
466
|
|
|
464
|
-
function ownKeys$
|
|
465
|
-
function _objectSpread$
|
|
467
|
+
function ownKeys$a(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
468
|
+
function _objectSpread$a(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys$a(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys$a(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
466
469
|
function AppliedFilters(_ref) {
|
|
467
470
|
let filters = _ref.filters,
|
|
468
471
|
onFilterRemove = _ref.onFilterRemove;
|
|
@@ -472,7 +475,7 @@ function AppliedFilters(_ref) {
|
|
|
472
475
|
condensed: true,
|
|
473
476
|
isDefaultClosed: !Boolean(filters.length),
|
|
474
477
|
header: jsx(Text.Body, {
|
|
475
|
-
intlMessage: _objectSpread$
|
|
478
|
+
intlMessage: _objectSpread$a(_objectSpread$a({}, messages.appliedFiltersMessage), {}, {
|
|
476
479
|
values: {
|
|
477
480
|
filtersCount: filters.length
|
|
478
481
|
}
|
|
@@ -501,7 +504,7 @@ function AppliedFilters(_ref) {
|
|
|
501
504
|
color: "neutral60"
|
|
502
505
|
}), jsx(Text.Body, {
|
|
503
506
|
isBold: true,
|
|
504
|
-
intlMessage: _objectSpread$
|
|
507
|
+
intlMessage: _objectSpread$a(_objectSpread$a({}, messages.appliedFiltersMessage), {}, {
|
|
505
508
|
values: {
|
|
506
509
|
filtersCount: filters.length
|
|
507
510
|
}
|
|
@@ -525,8 +528,8 @@ AppliedFilters.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
525
528
|
onFilterRemove: PropTypes.func.isRequired
|
|
526
529
|
} : {};
|
|
527
530
|
|
|
528
|
-
function ownKeys$
|
|
529
|
-
function _objectSpread$
|
|
531
|
+
function ownKeys$9(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
532
|
+
function _objectSpread$9(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys$9(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys$9(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
530
533
|
const IconPlaceholder = /*#__PURE__*/_styled("div", process.env.NODE_ENV === "production" ? {
|
|
531
534
|
target: "e1oion860"
|
|
532
535
|
} : {
|
|
@@ -541,7 +544,7 @@ function AppliedSearchTerms(_ref) {
|
|
|
541
544
|
condensed: true,
|
|
542
545
|
isDefaultClosed: !Boolean(appliedSearchTerms.length),
|
|
543
546
|
header: jsx(Text.Body, {
|
|
544
|
-
intlMessage: _objectSpread$
|
|
547
|
+
intlMessage: _objectSpread$9(_objectSpread$9({}, messages.appliedSearchTermsMessage), {}, {
|
|
545
548
|
values: {
|
|
546
549
|
searchTermsCount: appliedSearchTerms.length
|
|
547
550
|
}
|
|
@@ -562,7 +565,7 @@ function AppliedSearchTerms(_ref) {
|
|
|
562
565
|
color: "neutral60"
|
|
563
566
|
}), jsx(Text.Body, {
|
|
564
567
|
isBold: true,
|
|
565
|
-
intlMessage: _objectSpread$
|
|
568
|
+
intlMessage: _objectSpread$9(_objectSpread$9({}, messages.appliedSearchTermsMessage), {}, {
|
|
566
569
|
values: {
|
|
567
570
|
searchTermsCount: appliedSearchTerms.length
|
|
568
571
|
}
|
|
@@ -602,14 +605,14 @@ function ExportBasedOnMyViewsSelectField() {
|
|
|
602
605
|
});
|
|
603
606
|
}
|
|
604
607
|
|
|
605
|
-
function ownKeys$
|
|
606
|
-
function _objectSpread$
|
|
608
|
+
function ownKeys$8(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
609
|
+
function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys$8(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys$8(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
607
610
|
function renderFileNameError(key) {
|
|
608
611
|
switch (key) {
|
|
609
612
|
case 'missing':
|
|
610
|
-
return jsx(FormattedMessage, _objectSpread$
|
|
613
|
+
return jsx(FormattedMessage, _objectSpread$8({}, messages.missingFileNameError));
|
|
611
614
|
case 'invalidInput':
|
|
612
|
-
return jsx(FormattedMessage, _objectSpread$
|
|
615
|
+
return jsx(FormattedMessage, _objectSpread$8({}, messages.invalidFileNameError));
|
|
613
616
|
default:
|
|
614
617
|
return null;
|
|
615
618
|
}
|
|
@@ -617,7 +620,7 @@ function renderFileNameError(key) {
|
|
|
617
620
|
function renderLanguageError(key) {
|
|
618
621
|
switch (key) {
|
|
619
622
|
case 'missing':
|
|
620
|
-
return jsx(FormattedMessage, _objectSpread$
|
|
623
|
+
return jsx(FormattedMessage, _objectSpread$8({}, messages.missingLanguageError));
|
|
621
624
|
default:
|
|
622
625
|
return null;
|
|
623
626
|
}
|
|
@@ -650,8 +653,12 @@ async function createExportOperation(_ref) {
|
|
|
650
653
|
return response;
|
|
651
654
|
}
|
|
652
655
|
|
|
653
|
-
function ownKeys$
|
|
654
|
-
function _objectSpread$
|
|
656
|
+
function ownKeys$7(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
657
|
+
function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys$7(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys$7(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
658
|
+
const getExportLogsLink = (projectKey, msg) => jsx(Link, {
|
|
659
|
+
to: "/".concat(projectKey, "/operations/export/logs"),
|
|
660
|
+
children: msg
|
|
661
|
+
});
|
|
655
662
|
function ExportConfirmationModal(props) {
|
|
656
663
|
const _useApplicationContex = useApplicationContext(applicationContext => {
|
|
657
664
|
var _applicationContext$p, _applicationContext$p2;
|
|
@@ -667,8 +674,8 @@ function ExportConfirmationModal(props) {
|
|
|
667
674
|
allResourcesCount = _useExportResourcesCo.allResourcesCount,
|
|
668
675
|
matchingResourcesCount = _useExportResourcesCo.matchingResourcesCount,
|
|
669
676
|
selectedResourceIds = _useExportResourcesCo.selectedResourceIds,
|
|
670
|
-
resourceType = _useExportResourcesCo.resourceType
|
|
671
|
-
|
|
677
|
+
resourceType = _useExportResourcesCo.resourceType;
|
|
678
|
+
const showNotification = useShowNotification();
|
|
672
679
|
const intl = useIntl();
|
|
673
680
|
const asyncDispatch = useAsyncDispatch();
|
|
674
681
|
const resourceTypePlural = resourceTypeToPlural({
|
|
@@ -700,7 +707,6 @@ function ExportConfirmationModal(props) {
|
|
|
700
707
|
onClose: props.closeModal,
|
|
701
708
|
onCancel: props.closeModal,
|
|
702
709
|
onConfirm: async () => {
|
|
703
|
-
setExportOperationStarted(false);
|
|
704
710
|
const graphQuery = buildGraphQuery({
|
|
705
711
|
resourceType: resourceType,
|
|
706
712
|
selectedResourceIds: selectedResourceIds,
|
|
@@ -718,7 +724,16 @@ function ExportConfirmationModal(props) {
|
|
|
718
724
|
switch (response.state) {
|
|
719
725
|
case EXPORT_OPERATION_STATES.PROCESSING:
|
|
720
726
|
case EXPORT_OPERATION_STATES.COMPLETED:
|
|
721
|
-
|
|
727
|
+
showNotification({
|
|
728
|
+
kind: 'success',
|
|
729
|
+
domain: DOMAINS.SIDE,
|
|
730
|
+
text: intl.formatMessage(messages.exportOperationSuccessMessage, {
|
|
731
|
+
newline: getNewLine,
|
|
732
|
+
logsLink: msg => getExportLogsLink(projectKey, msg),
|
|
733
|
+
b: getBold
|
|
734
|
+
})
|
|
735
|
+
});
|
|
736
|
+
props.onCloseParentModal();
|
|
722
737
|
break;
|
|
723
738
|
default:
|
|
724
739
|
throw new UnexpectedExportOperationStateError(response.state);
|
|
@@ -731,7 +746,7 @@ function ExportConfirmationModal(props) {
|
|
|
731
746
|
},
|
|
732
747
|
children: jsxs("div", {
|
|
733
748
|
children: [jsx(Text.Body, {
|
|
734
|
-
intlMessage: _objectSpread$
|
|
749
|
+
intlMessage: _objectSpread$7(_objectSpread$7({}, messages.confirmationBodyPlan), {}, {
|
|
735
750
|
values: {
|
|
736
751
|
resourceType: resourceTypePlural,
|
|
737
752
|
projectName: projectName,
|
|
@@ -748,18 +763,19 @@ function ExportConfirmationModal(props) {
|
|
|
748
763
|
ExportConfirmationModal.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
749
764
|
isOpen: PropTypes.bool.isRequired,
|
|
750
765
|
resourceType: PropTypes.string.isRequired,
|
|
751
|
-
closeModal: PropTypes.func.isRequired
|
|
766
|
+
closeModal: PropTypes.func.isRequired,
|
|
767
|
+
onCloseParentModal: PropTypes.func.isRequired
|
|
752
768
|
} : {};
|
|
753
769
|
|
|
754
|
-
function ownKeys$
|
|
755
|
-
function _objectSpread$
|
|
770
|
+
function ownKeys$6(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
771
|
+
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context3 = ownKeys$6(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context4 = ownKeys$6(Object(source))).call(_context4, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
756
772
|
function normalizeFields(fields) {
|
|
757
773
|
const result = _mapInstanceProperty(fields).call(fields, field => {
|
|
758
774
|
if (isFilledArray(field.fields)) {
|
|
759
775
|
var _context;
|
|
760
776
|
return _mapInstanceProperty(_context = normalizeFields(field.fields)).call(_context, nestedField => {
|
|
761
777
|
var _context2;
|
|
762
|
-
return _objectSpread$
|
|
778
|
+
return _objectSpread$6(_objectSpread$6({}, nestedField), {}, {
|
|
763
779
|
key: _concatInstanceProperty(_context2 = "".concat(field.key, ".")).call(_context2, nestedField.key)
|
|
764
780
|
});
|
|
765
781
|
});
|
|
@@ -789,7 +805,7 @@ function ExportFields(_ref2) {
|
|
|
789
805
|
condensed: true,
|
|
790
806
|
isDefaultClosed: !Boolean(fields.length),
|
|
791
807
|
header: jsx(Text.Body, {
|
|
792
|
-
intlMessage: _objectSpread$
|
|
808
|
+
intlMessage: _objectSpread$6(_objectSpread$6({}, messages.columnsMessage), {}, {
|
|
793
809
|
values: {
|
|
794
810
|
columnsCount: fields.length
|
|
795
811
|
}
|
|
@@ -810,7 +826,7 @@ function ExportFields(_ref2) {
|
|
|
810
826
|
color: "neutral60"
|
|
811
827
|
}), jsx(Text.Body, {
|
|
812
828
|
isBold: true,
|
|
813
|
-
intlMessage: _objectSpread$
|
|
829
|
+
intlMessage: _objectSpread$6(_objectSpread$6({}, messages.columnsMessage), {}, {
|
|
814
830
|
values: {
|
|
815
831
|
columnsCount: fields.length
|
|
816
832
|
}
|
|
@@ -835,8 +851,8 @@ ExportFields.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
835
851
|
})).isRequired
|
|
836
852
|
} : {};
|
|
837
853
|
|
|
838
|
-
function ownKeys$
|
|
839
|
-
function _objectSpread$
|
|
854
|
+
function ownKeys$5(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
855
|
+
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys$5(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys$5(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
840
856
|
function ExportSelectionRadioButtons() {
|
|
841
857
|
const _useTheme = useTheme(),
|
|
842
858
|
isNewTheme = _useTheme.isNewTheme;
|
|
@@ -865,7 +881,7 @@ function ExportSelectionRadioButtons() {
|
|
|
865
881
|
"data-testid": 'test-all-resources',
|
|
866
882
|
children: jsx(Text.Body, {
|
|
867
883
|
isBold: !isNewTheme,
|
|
868
|
-
intlMessage: _objectSpread$
|
|
884
|
+
intlMessage: _objectSpread$5(_objectSpread$5({}, messages.exportAllResources), {}, {
|
|
869
885
|
values: {
|
|
870
886
|
resourceType: resourceTypePlural,
|
|
871
887
|
count: allResourcesCount
|
|
@@ -878,7 +894,7 @@ function ExportSelectionRadioButtons() {
|
|
|
878
894
|
isDisabled: !Boolean(matchingResourcesCount),
|
|
879
895
|
children: jsx(Text.Body, {
|
|
880
896
|
isBold: !isNewTheme,
|
|
881
|
-
intlMessage: _objectSpread$
|
|
897
|
+
intlMessage: _objectSpread$5(_objectSpread$5({}, messages.exportOnlyMatchingResources), {}, {
|
|
882
898
|
values: {
|
|
883
899
|
count: matchingResourcesCount || intl.formatMessage(messages.nothingApplied)
|
|
884
900
|
}
|
|
@@ -890,7 +906,7 @@ function ExportSelectionRadioButtons() {
|
|
|
890
906
|
isDisabled: !Boolean(selectedResourceIds.length),
|
|
891
907
|
children: jsx(Text.Body, {
|
|
892
908
|
isBold: !isNewTheme,
|
|
893
|
-
intlMessage: _objectSpread$
|
|
909
|
+
intlMessage: _objectSpread$5(_objectSpread$5({}, messages.exportOnlySelectedResources), {}, {
|
|
894
910
|
values: {
|
|
895
911
|
resourceType: resourceTypePlural,
|
|
896
912
|
count: selectedResourceIds.length
|
|
@@ -902,8 +918,8 @@ function ExportSelectionRadioButtons() {
|
|
|
902
918
|
});
|
|
903
919
|
}
|
|
904
920
|
|
|
905
|
-
function ownKeys$
|
|
906
|
-
function _objectSpread$
|
|
921
|
+
function ownKeys$4(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
922
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys$4(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys$4(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
907
923
|
function ExportTextMessage() {
|
|
908
924
|
const _useExportResourcesCo = useExportResourcesContext(),
|
|
909
925
|
resourceType = _useExportResourcesCo.resourceType,
|
|
@@ -917,7 +933,7 @@ function ExportTextMessage() {
|
|
|
917
933
|
switch (_valuesInstanceProperty(formik).exportSelectionType) {
|
|
918
934
|
case EXPORT_SELECTION_TYPES.ALL_RESOURCES:
|
|
919
935
|
return jsx(Text.Body, {
|
|
920
|
-
intlMessage: _objectSpread$
|
|
936
|
+
intlMessage: _objectSpread$4(_objectSpread$4({}, messages.exportAllMessage), {}, {
|
|
921
937
|
values: {
|
|
922
938
|
count: allResourcesCount,
|
|
923
939
|
resourceType: resourceTypePlural,
|
|
@@ -927,7 +943,7 @@ function ExportTextMessage() {
|
|
|
927
943
|
});
|
|
928
944
|
case EXPORT_SELECTION_TYPES.ONLY_MATCHING:
|
|
929
945
|
return jsx(Text.Body, {
|
|
930
|
-
intlMessage: _objectSpread$
|
|
946
|
+
intlMessage: _objectSpread$4(_objectSpread$4({}, messages.exportMatchingMessage), {}, {
|
|
931
947
|
values: {
|
|
932
948
|
count: matchingResourcesCount,
|
|
933
949
|
resourceType: resourceTypePlural,
|
|
@@ -937,7 +953,7 @@ function ExportTextMessage() {
|
|
|
937
953
|
});
|
|
938
954
|
case EXPORT_SELECTION_TYPES.ONLY_SELECTED:
|
|
939
955
|
return jsx(Text.Body, {
|
|
940
|
-
intlMessage: _objectSpread$
|
|
956
|
+
intlMessage: _objectSpread$4(_objectSpread$4({}, messages.exportSelectedMessage), {}, {
|
|
941
957
|
values: {
|
|
942
958
|
count: selectedResourceIds.length,
|
|
943
959
|
resourceType: resourceTypePlural,
|
|
@@ -1012,8 +1028,8 @@ const ExportSelection = () => {
|
|
|
1012
1028
|
});
|
|
1013
1029
|
};
|
|
1014
1030
|
|
|
1015
|
-
function ownKeys$
|
|
1016
|
-
function _objectSpread$
|
|
1031
|
+
function ownKeys$3(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1032
|
+
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys$3(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys$3(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1017
1033
|
const ExportProperties = props => {
|
|
1018
1034
|
const _useTheme = useTheme(),
|
|
1019
1035
|
isNewTheme = _useTheme.isNewTheme;
|
|
@@ -1030,7 +1046,7 @@ const ExportProperties = props => {
|
|
|
1030
1046
|
return jsx(CollapsiblePanel, {
|
|
1031
1047
|
header: jsx(Text.Body, {
|
|
1032
1048
|
isBold: true,
|
|
1033
|
-
intlMessage: _objectSpread$
|
|
1049
|
+
intlMessage: _objectSpread$3({}, messages.propertiesPanelLabel)
|
|
1034
1050
|
}),
|
|
1035
1051
|
children: props.renderProperties()
|
|
1036
1052
|
});
|
|
@@ -1039,8 +1055,8 @@ ExportProperties.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
1039
1055
|
renderProperties: PropTypes.func
|
|
1040
1056
|
} : {};
|
|
1041
1057
|
|
|
1042
|
-
function ownKeys$
|
|
1043
|
-
function _objectSpread$
|
|
1058
|
+
function ownKeys$2(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1059
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys$2(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys$2(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1044
1060
|
const outputFormatOptions = [{
|
|
1045
1061
|
value: OUTPUT_FORMATS.JSON,
|
|
1046
1062
|
label: 'JSON'
|
|
@@ -1074,12 +1090,12 @@ function ExportFileSettings(props) {
|
|
|
1074
1090
|
children: [jsx(PageContentNarrow, {
|
|
1075
1091
|
children: jsxs(Spacings.Stack, {
|
|
1076
1092
|
scale: "xl",
|
|
1077
|
-
children: [jsx(SelectField, _objectSpread$
|
|
1093
|
+
children: [jsx(SelectField, _objectSpread$2(_objectSpread$2({
|
|
1078
1094
|
isDisabled: true
|
|
1079
1095
|
}, formik.getFieldProps('outputFormat')), {}, {
|
|
1080
1096
|
title: intl.formatMessage(messages.outputFormat),
|
|
1081
1097
|
options: outputFormatOptions
|
|
1082
|
-
})), jsx(TextField, _objectSpread$
|
|
1098
|
+
})), jsx(TextField, _objectSpread$2(_objectSpread$2({
|
|
1083
1099
|
title: intl.formatMessage(messages.fileName)
|
|
1084
1100
|
}, formik.getFieldProps('fileName')), {}, {
|
|
1085
1101
|
touched: formik.touched.fileName,
|
|
@@ -1087,7 +1103,7 @@ function ExportFileSettings(props) {
|
|
|
1087
1103
|
renderError: renderFileNameError
|
|
1088
1104
|
})), jsxs(Spacings.Stack, {
|
|
1089
1105
|
scale: "xs",
|
|
1090
|
-
children: [jsx(SelectField, _objectSpread$
|
|
1106
|
+
children: [jsx(SelectField, _objectSpread$2(_objectSpread$2({
|
|
1091
1107
|
id: "languages",
|
|
1092
1108
|
title: intl.formatMessage(messages.localLanguage),
|
|
1093
1109
|
options: mapLanguagesToOptions(languages),
|
|
@@ -1124,13 +1140,13 @@ function ExportFileSettings(props) {
|
|
|
1124
1140
|
scale: "l",
|
|
1125
1141
|
children: [jsxs(Spacings.Inline, {
|
|
1126
1142
|
scale: "l",
|
|
1127
|
-
children: [jsx(SelectField, _objectSpread$
|
|
1143
|
+
children: [jsx(SelectField, _objectSpread$2(_objectSpread$2({
|
|
1128
1144
|
isDisabled: true
|
|
1129
1145
|
}, formik.getFieldProps('outputFormat')), {}, {
|
|
1130
1146
|
title: intl.formatMessage(messages.outputFormat),
|
|
1131
1147
|
options: outputFormatOptions,
|
|
1132
1148
|
horizontalConstraint: 7
|
|
1133
|
-
})), jsx(TextField, _objectSpread$
|
|
1149
|
+
})), jsx(TextField, _objectSpread$2(_objectSpread$2({
|
|
1134
1150
|
title: intl.formatMessage(messages.fileName)
|
|
1135
1151
|
}, formik.getFieldProps('fileName')), {}, {
|
|
1136
1152
|
touched: formik.touched.fileName,
|
|
@@ -1139,7 +1155,7 @@ function ExportFileSettings(props) {
|
|
|
1139
1155
|
horizontalConstraint: 7
|
|
1140
1156
|
}))]
|
|
1141
1157
|
}), jsx(Spacings.Inline, {
|
|
1142
|
-
children: jsx(SelectField, _objectSpread$
|
|
1158
|
+
children: jsx(SelectField, _objectSpread$2(_objectSpread$2({
|
|
1143
1159
|
id: "languages",
|
|
1144
1160
|
title: jsxs(Spacings.Inline, {
|
|
1145
1161
|
scale: "s",
|
|
@@ -1181,42 +1197,6 @@ ExportFileSettings.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
1181
1197
|
renderProperties: PropTypes.func
|
|
1182
1198
|
} : {};
|
|
1183
1199
|
|
|
1184
|
-
function ownKeys$2(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1185
|
-
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys$2(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys$2(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1186
|
-
const getExportLogsLink = (projectKey, msg) => jsx(Link, {
|
|
1187
|
-
to: "/".concat(projectKey, "/operations/export/logs"),
|
|
1188
|
-
children: msg
|
|
1189
|
-
});
|
|
1190
|
-
function ExportOperationSuccessMessage(_ref) {
|
|
1191
|
-
let isShown = _ref.isShown;
|
|
1192
|
-
const _useApplicationContex = useApplicationContext(applicationContext => {
|
|
1193
|
-
var _applicationContext$p;
|
|
1194
|
-
return {
|
|
1195
|
-
projectKey: (_applicationContext$p = applicationContext.project) === null || _applicationContext$p === void 0 ? void 0 : _applicationContext$p.key
|
|
1196
|
-
};
|
|
1197
|
-
}),
|
|
1198
|
-
projectKey = _useApplicationContex.projectKey;
|
|
1199
|
-
if (!isShown) return null;
|
|
1200
|
-
return jsx("div", {
|
|
1201
|
-
css: styles.successMessage,
|
|
1202
|
-
"data-testid": "export-started-message",
|
|
1203
|
-
children: jsx(Constraints.Horizontal, {
|
|
1204
|
-
max: 16,
|
|
1205
|
-
children: jsx(ContentNotification, {
|
|
1206
|
-
type: "success",
|
|
1207
|
-
intlMessage: _objectSpread$2(_objectSpread$2({}, messages.exportOperationSuccessMessage), {}, {
|
|
1208
|
-
values: {
|
|
1209
|
-
logsLink: msg => getExportLogsLink(projectKey, msg)
|
|
1210
|
-
}
|
|
1211
|
-
})
|
|
1212
|
-
})
|
|
1213
|
-
})
|
|
1214
|
-
});
|
|
1215
|
-
}
|
|
1216
|
-
ExportOperationSuccessMessage.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
1217
|
-
isShown: PropTypes.bool.isRequired
|
|
1218
|
-
} : {};
|
|
1219
|
-
|
|
1220
1200
|
const ExportResourcesContext = /*#__PURE__*/createContext();
|
|
1221
1201
|
|
|
1222
1202
|
const ExportResourcesModalShape = PropTypes.shape({
|
|
@@ -1269,19 +1249,13 @@ const ExportResourcesContextProvider = props => {
|
|
|
1269
1249
|
},
|
|
1270
1250
|
validate
|
|
1271
1251
|
});
|
|
1272
|
-
const _React$useState = React.useState(false),
|
|
1273
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1274
|
-
exportOperationStarted = _React$useState2[0],
|
|
1275
|
-
setExportOperationStarted = _React$useState2[1];
|
|
1276
1252
|
return jsx(ExportResourcesContext.Provider, {
|
|
1277
1253
|
value: {
|
|
1278
1254
|
formik,
|
|
1279
1255
|
resourceType: props.resourceType,
|
|
1280
1256
|
allResourcesCount: props.allResourcesCount,
|
|
1281
1257
|
matchingResourcesCount: props.matchingResourcesCount,
|
|
1282
|
-
selectedResourceIds: props.selectedResourceIds
|
|
1283
|
-
exportOperationStarted,
|
|
1284
|
-
setExportOperationStarted
|
|
1258
|
+
selectedResourceIds: props.selectedResourceIds
|
|
1285
1259
|
},
|
|
1286
1260
|
children: props.children
|
|
1287
1261
|
});
|
|
@@ -1305,8 +1279,7 @@ const ExportResourcesModal = _ref => {
|
|
|
1305
1279
|
return jsx(ExportResourcesContextProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
1306
1280
|
children: jsx(ExportResourcesContext.Consumer, {
|
|
1307
1281
|
children: _ref2 => {
|
|
1308
|
-
let formik = _ref2.formik
|
|
1309
|
-
exportOperationStarted = _ref2.exportOperationStarted;
|
|
1282
|
+
let formik = _ref2.formik;
|
|
1310
1283
|
return jsxs(FormModalPage, {
|
|
1311
1284
|
title: intl.formatMessage(messages.modalTitle, {
|
|
1312
1285
|
resourceType: resourceTypePlural
|
|
@@ -1323,14 +1296,13 @@ const ExportResourcesModal = _ref => {
|
|
|
1323
1296
|
resourceType: props.resourceType
|
|
1324
1297
|
}),
|
|
1325
1298
|
onPrimaryButtonClick: confirmationModal.openModal,
|
|
1326
|
-
children: [jsx(
|
|
1327
|
-
isShown: exportOperationStarted
|
|
1328
|
-
}), jsx(ExportFileSettings, {
|
|
1299
|
+
children: [jsx(ExportFileSettings, {
|
|
1329
1300
|
renderProperties: renderProperties
|
|
1330
1301
|
}), jsx(ExportConfirmationModal, {
|
|
1331
1302
|
resourceType: props.resourceType,
|
|
1332
1303
|
isOpen: confirmationModal.isModalOpen,
|
|
1333
|
-
closeModal: confirmationModal.closeModal
|
|
1304
|
+
closeModal: confirmationModal.closeModal,
|
|
1305
|
+
onCloseParentModal: props.closeModal
|
|
1334
1306
|
})]
|
|
1335
1307
|
});
|
|
1336
1308
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend-extensions/export-resources-modal",
|
|
3
3
|
"description": "Shared export modal for exporting resources",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.3",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -63,6 +63,6 @@
|
|
|
63
63
|
"test:watch": "jest --config jest.test.config.js --watch",
|
|
64
64
|
"build:bundles": "pnpm build",
|
|
65
65
|
"build:watch": "preconstruct watch",
|
|
66
|
-
"extract-intl": "formatjs extract --format
|
|
66
|
+
"extract-intl": "formatjs extract --format transifex --out-file $(pwd)/src/i18n/data/core.json 'src/**/!(*.spec).js'"
|
|
67
67
|
}
|
|
68
68
|
}
|