@commercetools-frontend-extensions/export-resources-modal 1.2.0 → 1.2.2

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.
@@ -0,0 +1,1513 @@
1
+ import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
2
+ import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
3
+ import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
4
+ import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
5
+ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
6
+ import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
7
+ import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
8
+ import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
9
+ import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
10
+ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/esm/objectWithoutProperties';
11
+ import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
12
+ import { PageContentNarrow, PageContentWide, ConfirmationDialog, useModalState, FormModalPage } from '@commercetools-frontend/application-components';
13
+ import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
14
+ import _flatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/flat';
15
+ import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
16
+ import { query } from 'gql-query-builder';
17
+ import _Reflect$construct from '@babel/runtime-corejs3/core-js-stable/reflect/construct';
18
+ import _createClass from '@babel/runtime-corejs3/helpers/esm/createClass';
19
+ import _classCallCheck from '@babel/runtime-corejs3/helpers/esm/classCallCheck';
20
+ import _inherits from '@babel/runtime-corejs3/helpers/esm/inherits';
21
+ import _possibleConstructorReturn from '@babel/runtime-corejs3/helpers/esm/possibleConstructorReturn';
22
+ import _getPrototypeOf from '@babel/runtime-corejs3/helpers/esm/getPrototypeOf';
23
+ import _wrapNativeSuper from '@babel/runtime-corejs3/helpers/esm/wrapNativeSuper';
24
+ import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
25
+ import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
26
+ import PropTypes from 'prop-types';
27
+ import { useFormik } from 'formik';
28
+ import moment from 'moment';
29
+ import { useApplicationContext } from '@commercetools-frontend/application-shell-connectors';
30
+ import { createContext, useState, useContext, Children } from 'react';
31
+ import { TextInput, Spacings, RadioInput, Text, CollapsiblePanel, Tag, AngleRightIcon, Constraints, SelectInput, customProperties as customProperties$1, Card, SelectField, TextField, CheckboxInput, ContentNotification, Link } from '@commercetools-frontend/ui-kit';
32
+ import omitEmpty from 'omit-empty-es';
33
+ import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
34
+ import _valuesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/values';
35
+ import { customProperties, useTheme } from '@commercetools-uikit/design-system';
36
+ import { css } from '@emotion/react';
37
+ import _styled from '@emotion/styled/base';
38
+ import _asyncToGenerator from '@babel/runtime-corejs3/helpers/esm/asyncToGenerator';
39
+ import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
40
+ import { actions, useAsyncDispatch } from '@commercetools-frontend/sdk';
41
+ import { showApiErrorNotification } from '@commercetools-frontend/actions-global';
42
+ import { MC_API_PROXY_TARGETS } from '@commercetools-frontend/constants';
43
+
44
+ var EXPORTABLE_RESOURCES = {
45
+ CATEGORY: 'category',
46
+ PRODUCT: 'product',
47
+ DISCOUNT_CODE: 'discountCode'
48
+ };
49
+ var EXPORT_SELECTION_TYPES = {
50
+ ALL_RESOURCES: 'allResources',
51
+ ONLY_MATCHING: 'onlyMatching',
52
+ ONLY_SELECTED: 'onlySelected'
53
+ };
54
+ var OUTPUT_FORMATS = {
55
+ JSON: 'json',
56
+ CSV: 'csv'
57
+ };
58
+ var EXPORT_OPERATION_STATES = {
59
+ PROCESSING: 'processing',
60
+ COMPLETED: 'completed',
61
+ FAILED: 'failed'
62
+ };
63
+
64
+ 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); }; }
65
+
66
+ function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
67
+
68
+ var UnexpectedSelectionTypeError = /*#__PURE__*/function (_Error) {
69
+ _inherits(UnexpectedSelectionTypeError, _Error);
70
+
71
+ var _super = _createSuper$3(UnexpectedSelectionTypeError);
72
+
73
+ function UnexpectedSelectionTypeError(exportSelectionType) {
74
+ var _this;
75
+
76
+ _classCallCheck(this, UnexpectedSelectionTypeError);
77
+
78
+ _this = _super.call(this, "Unexpected column: ".concat(exportSelectionType));
79
+ _this.name = 'UnexpectedSelectionTypeError';
80
+ return _this;
81
+ }
82
+
83
+ return _createClass(UnexpectedSelectionTypeError);
84
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
85
+
86
+ 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); }; }
87
+
88
+ function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
89
+
90
+ var MissingExportResourceProviderError = /*#__PURE__*/function (_Error) {
91
+ _inherits(MissingExportResourceProviderError, _Error);
92
+
93
+ var _super = _createSuper$2(MissingExportResourceProviderError);
94
+
95
+ function MissingExportResourceProviderError() {
96
+ var _this;
97
+
98
+ _classCallCheck(this, MissingExportResourceProviderError);
99
+
100
+ _this = _super.call(this, 'useExportResourcesContext must be used within ExportResourcesContextProvider');
101
+ _this.name = 'MissingExportResourceProviderError';
102
+ return _this;
103
+ }
104
+
105
+ return _createClass(MissingExportResourceProviderError);
106
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
107
+
108
+ 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); }; }
109
+
110
+ function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
111
+
112
+ var UnexpectedExportOperationStateError = /*#__PURE__*/function (_Error) {
113
+ _inherits(UnexpectedExportOperationStateError, _Error);
114
+
115
+ var _super = _createSuper$1(UnexpectedExportOperationStateError);
116
+
117
+ function UnexpectedExportOperationStateError(state) {
118
+ var _this;
119
+
120
+ _classCallCheck(this, UnexpectedExportOperationStateError);
121
+
122
+ _this = _super.call(this, "Unexpected export operation state \"".concat(state, "\""));
123
+ _this.name = 'UnexpectedExportOperationStateError';
124
+ return _this;
125
+ }
126
+
127
+ return _createClass(UnexpectedExportOperationStateError);
128
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
129
+
130
+ 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); }; }
131
+
132
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
133
+
134
+ var UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
135
+ _inherits(UnexpectedResourceTypeError, _Error);
136
+
137
+ var _super = _createSuper(UnexpectedResourceTypeError);
138
+
139
+ function UnexpectedResourceTypeError(resourceType) {
140
+ var _this;
141
+
142
+ _classCallCheck(this, UnexpectedResourceTypeError);
143
+
144
+ _this = _super.call(this, "Unexpected resource type: ".concat(resourceType));
145
+ _this.name = 'UnexpectedResourceTypeError';
146
+ return _this;
147
+ }
148
+
149
+ return _createClass(UnexpectedResourceTypeError);
150
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
151
+
152
+ function resourceTypeToPlural(_ref) {
153
+ var resourceType = _ref.resourceType,
154
+ _ref$isUpperCase = _ref.isUpperCase,
155
+ isUpperCase = _ref$isUpperCase === void 0 ? false : _ref$isUpperCase;
156
+
157
+ switch (resourceType) {
158
+ case EXPORTABLE_RESOURCES.CATEGORY:
159
+ return isUpperCase ? 'Categories' : 'categories';
160
+
161
+ case EXPORTABLE_RESOURCES.PRODUCT:
162
+ return isUpperCase ? 'Products' : 'products';
163
+
164
+ case EXPORTABLE_RESOURCES.DISCOUNT_CODE:
165
+ return isUpperCase ? 'Discount codes' : 'discount codes';
166
+
167
+ default:
168
+ throw UnexpectedResourceTypeError(resourceType);
169
+ }
170
+ }
171
+ function resourceTypeToOperationName(resourceType) {
172
+ switch (resourceType) {
173
+ case EXPORTABLE_RESOURCES.CATEGORY:
174
+ return 'categories';
175
+
176
+ case EXPORTABLE_RESOURCES.PRODUCT:
177
+ return 'products';
178
+
179
+ case EXPORTABLE_RESOURCES.DISCOUNT_CODE:
180
+ return 'discountCodes';
181
+
182
+ default:
183
+ throw UnexpectedResourceTypeError(resourceType);
184
+ }
185
+ }
186
+ function replaceSpecialCharsWithUnderscore(string) {
187
+ return string.replace(/[^a-zA-Z0-9]/g, '_');
188
+ }
189
+ function isFilledArray(maybeArray) {
190
+ return _Array$isArray(maybeArray) && maybeArray.length;
191
+ }
192
+
193
+ function buildGraphQuery(exportSettings) {
194
+ var _context;
195
+
196
+ var operation = resourceTypeToOperationName(exportSettings.resourceType);
197
+
198
+ switch (exportSettings.exportSelectionType) {
199
+ case EXPORT_SELECTION_TYPES.ALL_RESOURCES:
200
+ return query({
201
+ operation: operation,
202
+ fields: [{
203
+ results: buildFields({
204
+ fields: exportSettings.fields,
205
+ languages: exportSettings.languages
206
+ })
207
+ }],
208
+ variables: {}
209
+ });
210
+
211
+ case EXPORT_SELECTION_TYPES.ONLY_SELECTED:
212
+ return query({
213
+ operation: operation,
214
+ fields: [{
215
+ results: buildFields({
216
+ fields: exportSettings.fields,
217
+ languages: exportSettings.languages
218
+ })
219
+ }],
220
+ variables: {
221
+ where: "id in (".concat(_mapInstanceProperty(_context = exportSettings.selectedResourceIds).call(_context, function (id) {
222
+ return "\\\"".concat(id, "\\\"");
223
+ }).join(', '), ")")
224
+ }
225
+ });
226
+
227
+ case EXPORT_SELECTION_TYPES.ONLY_MATCHING:
228
+ // TODO: gql query for exporting filtered resources.
229
+ throw new UnexpectedSelectionTypeError(exportSettings.exportSelectionType);
230
+
231
+ default:
232
+ throw new UnexpectedSelectionTypeError(exportSettings.exportSelectionType);
233
+ }
234
+ }
235
+
236
+ function buildFields(_ref) {
237
+ var _context2;
238
+
239
+ var fields = _ref.fields,
240
+ languages = _ref.languages;
241
+ return _flatInstanceProperty(_context2 = _mapInstanceProperty(fields).call(fields, function (field) {
242
+ if (field.isLocalized) return _mapInstanceProperty(languages).call(languages, function (language) {
243
+ var _context3, _context4, _context5;
244
+
245
+ var alias = replaceSpecialCharsWithUnderscore(_concatInstanceProperty(_context3 = "".concat(field.key, "_")).call(_context3, language));
246
+ return _concatInstanceProperty(_context4 = _concatInstanceProperty(_context5 = "".concat(alias, ": ")).call(_context5, field.key, "(locale: \"")).call(_context4, language, "\")");
247
+ });else {
248
+ if (isFilledArray(field.fields)) {
249
+ return _defineProperty({}, field.key, buildFields({
250
+ fields: field.fields,
251
+ languages: languages
252
+ }));
253
+ }
254
+
255
+ return field.key;
256
+ }
257
+ })).call(_context2);
258
+ }
259
+
260
+ var messages = defineMessages({
261
+ modalTitle: {
262
+ id: 'ExportResourcesModal.modalTitle',
263
+ description: 'Label for the modal title',
264
+ defaultMessage: 'Export {resourceType}'
265
+ },
266
+ modalSubTitle: {
267
+ id: 'ExportResourcesModal.modalSubTitle',
268
+ description: 'Label for the modal subtitle',
269
+ defaultMessage: 'Define export settings'
270
+ },
271
+ topBarPreviousPathLabel: {
272
+ id: 'ExportResourcesModal.topBarPreviousPathLabel',
273
+ description: 'Label for the topBar previous label',
274
+ defaultMessage: 'To {resourceType} List'
275
+ },
276
+ exportButton: {
277
+ id: 'ExportResourcesModal.exportButton',
278
+ description: 'Export primary button',
279
+ defaultMessage: 'Export {resourceType}'
280
+ },
281
+ outputFormat: {
282
+ id: 'ExportResourcesModal.outputFormat',
283
+ description: 'File format like (csv, xls, ...etc)',
284
+ defaultMessage: 'File format'
285
+ },
286
+ fileName: {
287
+ id: 'ExportResourcesModal.fileName',
288
+ description: 'exported file name',
289
+ defaultMessage: 'File name'
290
+ },
291
+ localLanguage: {
292
+ id: 'ExportResourcesModal.localLanguage',
293
+ description: 'Local language',
294
+ defaultMessage: 'Local language'
295
+ },
296
+ exportSelection: {
297
+ id: 'ExportResourcesModal.exportSelection',
298
+ description: 'Export selection',
299
+ defaultMessage: 'Export selection'
300
+ },
301
+ exportAllResources: {
302
+ id: 'ExportResourcesModal.exportAllResources',
303
+ description: 'Export All selection',
304
+ defaultMessage: 'Export all {resourceType} ({count})'
305
+ },
306
+ exportOnlyMatchingResources: {
307
+ id: 'ExportResourcesModal.exportOnlyMatchingResources',
308
+ description: 'Export resources only matching search/filter',
309
+ defaultMessage: 'Export list matching search/filter ({count})'
310
+ },
311
+ exportOnlySelectedResources: {
312
+ id: 'ExportResourcesModal.exportOnlySelectedResources',
313
+ description: 'Export only selected resources',
314
+ defaultMessage: 'Export selected {resourceType} ({count})'
315
+ },
316
+ exportAllMessage: {
317
+ id: 'ExportResourcesModal.exportAllMessage',
318
+ description: 'All resources will be exported',
319
+ defaultMessage: 'All <b>{count}</b> {resourceType} will be exported.'
320
+ },
321
+ exportMatchingMessage: {
322
+ id: 'ExportResourcesModal.exportMatchingMessage',
323
+ description: 'resources will be exported',
324
+ defaultMessage: '<b>{count}</b> {resourceType} will be exported.'
325
+ },
326
+ exportSelectedMessage: {
327
+ id: 'ExportResourcesModal.exportSelectedMessage',
328
+ description: 'resources are selected and will be exported',
329
+ defaultMessage: '<b>{count}</b> {resourceType} are selected and will be exported.'
330
+ },
331
+ columnsMessage: {
332
+ id: 'ExportResourcesModal.columnsMessage',
333
+ description: 'Exported columns and attributes based on table settings',
334
+ defaultMessage: 'Exported columns/attributes based on table settings: {columnsCount}'
335
+ },
336
+ appliedSearchTermsMessage: {
337
+ id: 'ExportResourcesModal.appliedSearchTermsMessage',
338
+ description: 'Applied Search Term(s)',
339
+ defaultMessage: 'Applied search term(s): {searchTermsCount}'
340
+ },
341
+ appliedFiltersMessage: {
342
+ id: 'ExportResourcesModal.appliedFiltersMessage',
343
+ description: 'Applied Filter(s)',
344
+ defaultMessage: 'Applied Filter(s): {filtersCount}'
345
+ },
346
+ exportBasedOnMyViewsMessage: {
347
+ id: 'ExportResourcesModal.exportBasedOnMyViewsMessage',
348
+ description: 'Select Export setttings based on my views',
349
+ defaultMessage: 'Select export settings based on:'
350
+ },
351
+ propertiesPanelLabel: {
352
+ id: 'ExportResourcesModal.propertiesPanelLabel',
353
+ description: 'properties panel label',
354
+ defaultMessage: 'Properties'
355
+ },
356
+ confirmationTitle: {
357
+ id: 'ExportResourcesModal.confirmationTitle',
358
+ description: 'Title for the confirmation dialog',
359
+ defaultMessage: 'Export {resourceType} data'
360
+ },
361
+ confirmationBodyPlan: {
362
+ id: 'ExportResourcesModal.confirmationBodyPlan',
363
+ description: 'Confirmation dialog action plan',
364
+ defaultMessage: 'You are about to export <bold>{count}</bold> {resourceType} from the project: <bold>{projectName}</bold>.'
365
+ },
366
+ confirmationBodyQuestion: {
367
+ id: 'ExportResourcesModal.confirmationBodyQuestion',
368
+ description: 'Confirmation question',
369
+ defaultMessage: 'Are you sure you want to continue?'
370
+ },
371
+ exportOperationSuccessMessage: {
372
+ id: 'ExportResourcesModal.exportOperationSuccessMessage',
373
+ description: 'Success message',
374
+ defaultMessage: 'Your export has started. Go to <logsLink>Export logs</logsLink> to view the progress of your export and download it.'
375
+ },
376
+ exportConfirmationLabel: {
377
+ id: 'ExportResourcesModal.exportConfirmationLabel',
378
+ description: 'Label for the export button in confirmation dialog',
379
+ defaultMessage: 'Export {resourceType}'
380
+ },
381
+ nothingApplied: {
382
+ id: 'ExportResourcesModal.nothingApplied',
383
+ description: 'Shown when there is no filter applied',
384
+ defaultMessage: 'nothing applied'
385
+ },
386
+ all: {
387
+ id: 'ExportResourcesModal.all',
388
+ description: 'label for "All languages" checkbox',
389
+ defaultMessage: 'All'
390
+ },
391
+ missingFileNameError: {
392
+ id: 'ExportResourcesModal.missingFileNameError',
393
+ description: 'Error when file name field is missing',
394
+ defaultMessage: 'Please enter a file name'
395
+ },
396
+ invalidFileNameError: {
397
+ id: 'ExportResourcesModal.invalidFileNameError',
398
+ description: 'Error when file name field is not valid',
399
+ defaultMessage: 'File name may only contain alphanumeric characters, hyphens and underscores'
400
+ },
401
+ missingLanguageError: {
402
+ id: 'ExportResourcesModal.missingLanguageError',
403
+ description: 'Error when no local language is selected',
404
+ defaultMessage: 'Please select at least one local language'
405
+ },
406
+ myViews: {
407
+ id: 'ExportResourcesModal.myViews',
408
+ description: 'Label for "My Views" Select Field',
409
+ defaultMessage: 'My Views'
410
+ }
411
+ });
412
+
413
+ var ExportResourcesContext = /*#__PURE__*/createContext();
414
+
415
+ var ExportResourcesModalShape = PropTypes.shape({
416
+ resourceType: PropTypes.string.isRequired,
417
+ outputFormat: PropTypes.string,
418
+ isOpen: PropTypes.bool.isRequired,
419
+ closeModal: PropTypes.func.isRequired,
420
+ allResourcesCount: PropTypes.number.isRequired,
421
+ matchingResourcesCount: PropTypes.number,
422
+ selectedResourceIds: PropTypes.array,
423
+ // TODO: Circular reference
424
+ fields: PropTypes.arrayOf(PropTypes.shape({
425
+ key: PropTypes.string.isRequired,
426
+ label: PropTypes.string,
427
+ isLocalized: PropTypes.bool,
428
+ fields: PropTypes.arrayOf(PropTypes.shape({
429
+ key: PropTypes.string.isRequired,
430
+ label: PropTypes.string,
431
+ isLocalized: PropTypes.bool
432
+ }))
433
+ })).isRequired,
434
+ exportSelectionType: PropTypes.string,
435
+ appliedSearchTerms: PropTypes.array,
436
+ appliedFilters: PropTypes.array,
437
+ renderProperties: PropTypes.func
438
+ }).isRequired;
439
+
440
+ function validate(values) {
441
+ var errors = {
442
+ fileName: {},
443
+ languages: {}
444
+ };
445
+
446
+ if (TextInput.isEmpty(values.fileName)) {
447
+ errors.fileName.missing = true;
448
+ } else if (!/^[a-zA-Z0-9-_]+$/.test(values.fileName)) {
449
+ errors.fileName.invalidInput = true;
450
+ }
451
+
452
+ if (values.languages.length < 1) {
453
+ errors.languages.missing = true;
454
+ }
455
+
456
+ return omitEmpty(errors);
457
+ }
458
+
459
+ function ownKeys$b(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; }
460
+
461
+ function _objectSpread$b(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys$b(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys$b(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
462
+
463
+ var ExportResourcesContextProvider = function ExportResourcesContextProvider(props) {
464
+ var _context;
465
+
466
+ var todayFormatted = moment().format('DD-MM-YY_HH-mm');
467
+
468
+ var _useApplicationContex = useApplicationContext(function (applicationContext) {
469
+ return {
470
+ language: applicationContext.dataLocale
471
+ };
472
+ }),
473
+ language = _useApplicationContex.language;
474
+
475
+ var formik = useFormik({
476
+ initialValues: {
477
+ outputFormat: props.outputFormat,
478
+ fileName: _concatInstanceProperty(_context = "".concat(resourceTypeToPlural({
479
+ resourceType: props.resourceType,
480
+ isUpperCase: true
481
+ }), "_Export_")).call(_context, todayFormatted),
482
+ languages: [language],
483
+ fields: props.fields,
484
+ appliedSearchTerms: props.appliedSearchTerms,
485
+ appliedFilters: props.appliedFilters,
486
+ exportSelectionType: props.exportSelectionType,
487
+ isAllLanguagesChecked: false
488
+ },
489
+ validate: validate
490
+ });
491
+
492
+ var _useState = useState(false),
493
+ _useState2 = _slicedToArray(_useState, 2),
494
+ exportOperationStarted = _useState2[0],
495
+ setExportOperationStarted = _useState2[1];
496
+
497
+ return jsx(ExportResourcesContext.Provider, {
498
+ value: {
499
+ formik: formik,
500
+ resourceType: props.resourceType,
501
+ allResourcesCount: props.allResourcesCount,
502
+ matchingResourcesCount: props.matchingResourcesCount,
503
+ selectedResourceIds: props.selectedResourceIds,
504
+ exportOperationStarted: exportOperationStarted,
505
+ setExportOperationStarted: setExportOperationStarted
506
+ },
507
+ children: props.children
508
+ });
509
+ };
510
+
511
+ ExportResourcesContextProvider.displayName = 'ExportResourcesContextProvider';
512
+ ExportResourcesContextProvider.propTypes = process.env.NODE_ENV !== "production" ? _objectSpread$b(_objectSpread$b({}, ExportResourcesModalShape), {}, {
513
+ children: PropTypes.node
514
+ }) : {};
515
+
516
+ function useExportResourcesContext() {
517
+ var context = useContext(ExportResourcesContext);
518
+
519
+ if (!context) {
520
+ throw new MissingExportResourceProviderError();
521
+ }
522
+
523
+ return context;
524
+ }
525
+
526
+ 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)."; }
527
+ var 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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFJMkIiLCJmaWxlIjoic3R5bGVzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8gVE9ETzogQHJlZGVzaWduIGNsZWFudXBcbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0J1xuaW1wb3J0IHsgY3VzdG9tUHJvcGVydGllcyB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLXVpa2l0L2Rlc2lnbi1zeXN0ZW0nXG5cbmNvbnN0IHNtYWxsVG9wUGFkZGluZyA9IGNzc2BcbiAgcGFkZGluZy10b3A6ICR7Y3VzdG9tUHJvcGVydGllcy5zcGFjaW5nWHN9O1xuYFxuXG5jb25zdCB0YWdMaXN0Q29udGFpbmVyID0gKHsga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c2FnZSxcbn1cblxuZXhwb3J0IGRlZmF1bHQgc3R5bGVzXG4iXX0= */");
528
+
529
+ var tagListContainer = function tagListContainer(_ref) {
530
+ var isNewTheme = _ref.isNewTheme;
531
+ return /*#__PURE__*/css("width:100%;display:flex;flex-wrap:wrap;display:inline-flex;padding:0 ", isNewTheme ? 0 : customProperties.spacingL, ";&>div{margin:0 ", customProperties.spacingS, " ", customProperties.spacingS, " 0;}" + (process.env.NODE_ENV === "production" ? "" : ";label:tagListContainer;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFRZ0QiLCJmaWxlIjoic3R5bGVzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8gVE9ETzogQHJlZGVzaWduIGNsZWFudXBcbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0J1xuaW1wb3J0IHsgY3VzdG9tUHJvcGVydGllcyB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLXVpa2l0L2Rlc2lnbi1zeXN0ZW0nXG5cbmNvbnN0IHNtYWxsVG9wUGFkZGluZyA9IGNzc2BcbiAgcGFkZGluZy10b3A6ICR7Y3VzdG9tUHJvcGVydGllcy5zcGFjaW5nWHN9O1xuYFxuXG5jb25zdCB0YWdMaXN0Q29udGFpbmVyID0gKHsgaXNOZXdUaGVtZSB9KSA9PiBjc3NgXG4gIHdpZHRoOiAxMDAlO1xuICBkaXNwbGF5OiBmbGV4O1xuICBmbGV4LXdyYXA6IHdyYXA7XG4gIGRpc3BsYXk6IGlubGluZS1mbGV4O1xuICBwYWRkaW5nOiAwICR7aXNOZXdUaGVtZSA/IDAgOiBjdXN0b21Qcm9wZXJ0aWVzLnNwYWNpbmdMfTtcbiAgJiA+IGRpdiB7XG4gICAgbWFyZ2luOiAwICR7Y3VzdG9tUHJvcGVydGllcy5zcGFjaW5nU30gJHtjdXN0b21Qcm9wZXJ0aWVzLnNwYWNpbmdTfSAwO1xuICB9XG5gXG5cbmNvbnN0IHRhZ0xpc3RJdGVtID0gY3NzYFxuICBtYXJnaW46IDAgJHtjdXN0b21Qcm9wZXJ0aWVzLnNwYWNpbmdYc30gJHtjdXN0b21Qcm9wZXJ0aWVzLnNwYWNpbmdYc30gMDtcbiAgZGlzcGxheTogZmxleDtcbiAgbWluLXdpZHRoOiAwO1xuYFxuXG5jb25zdCBkaXZpZGVyID0gY3NzYFxuICBib3gtc2l6aW5nOiBib3JkZXItYm94O1xuICB3aWR0aDogMTAwJTtcbiAgbWFyZ2luOiAwO1xuICBib3JkZXI6IDA7XG4gIGJvcmRlci10b3A6IDFweCBzb2xpZCAke2N1c3RvbVByb3BlcnRpZXMuY29sb3JOZXV0cmFsNjB9O1xuYFxuXG5jb25zdCBub3RCb2xkID0gY3NzYFxuICBmb250LXdlaWdodDogbm9ybWFsO1xuYFxuXG5jb25zdCBzdWNjZXNzTWVzc2FnZSA9IGNzc2BcbiAgbWFyZ2luLWJvdHRvbTogJHtjdXN0b21Qcm9wZXJ0aWVzLnNwYWNpbmdMfTtcbmBcblxuY29uc3Qgc3R5bGVzID0ge1xuICB0YWdMaXN0SXRlbSxcbiAgdGFnTGlzdENvbnRhaW5lcixcbiAgc21hbGxUb3BQYWRkaW5nLFxuICBkaXZpZGVyLFxuICBub3RCb2xkLFxuICBzdWNjZXNzTWVzc2FnZSxcbn1cblxuZXhwb3J0IGRlZmF1bHQgc3R5bGVzXG4iXX0= */");
532
+ };
533
+
534
+ var tagListItem = /*#__PURE__*/css("margin:0 ", customProperties.spacingXs, " ", customProperties.spacingXs, " 0;display:flex;min-width:0;" + (process.env.NODE_ENV === "production" ? "" : ";label:tagListItem;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eW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yZGVyOiAwO1xuICBib3JkZXItdG9wOiAxcHggc29saWQgJHtjdXN0b21Qcm9wZXJ0aWVzLmNvbG9yTmV1dHJhbDYwfTtcbmBcblxuY29uc3Qgbm90Qm9sZCA9IGNzc2BcbiAgZm9udC13ZWlnaHQ6IG5vcm1hbDtcbmBcblxuY29uc3Qgc3VjY2Vzc01lc3NhZ2UgPSBjc3NgXG4gIG1hcmdpbi1ib3R0b206ICR7Y3VzdG9tUHJvcGVydGllcy5zcGFjaW5nTH07XG5gXG5cbmNvbnN0IHN0eWxlcyA9IHtcbiAgdGFnTGlzdEl0ZW0sXG4gIHRhZ0xpc3RDb250YWluZXIsXG4gIHNtYWxsVG9wUGFkZGluZyxcbiAgZGl2aWRlcixcbiAgbm90Qm9sZCxcbiAgc3VjY2Vzc01lc3NhZ2UsXG59XG5cbmV4cG9ydCBkZWZhdWx0IHN0eWxlc1xuIl19 */");
535
+ var divider = /*#__PURE__*/css("box-sizing:border-box;width:100%;margin:0;border:0;border-top:1px solid ", customProperties.colorNeutral60, ";" + (process.env.NODE_ENV === "production" ? "" : ";label:divider;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUF5Qm1CIiwiZmlsZSI6InN0eWxlcy5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vIFRPRE86IEByZWRlc2lnbiBjbGVhbnVwXG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCdcbmltcG9ydCB7IGN1c3RvbVByb3BlcnRpZXMgfSBmcm9tICdAY29tbWVyY2V0b29scy11aWtpdC9kZXNpZ24tc3lzdGVtJ1xuXG5jb25zdCBzbWFsbFRvcFBhZGRpbmcgPSBjc3NgXG4gIHBhZGRpbmctdG9wOiAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZ1h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AgZGl2aWRlcixcbiAgbm90Qm9sZCxcbiAgc3VjY2Vzc01lc3NhZ2UsXG59XG5cbmV4cG9ydCBkZWZhdWx0IHN0eWxlc1xuIl19 */");
536
+ var notBold = process.env.NODE_ENV === "production" ? {
537
+ name: "lugakg",
538
+ styles: "font-weight:normal"
539
+ } : {
540
+ name: "w02aau-notBold",
541
+ styles: "font-weight:normal;label:notBold;",
542
+ map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFpQ21CIiwiZmlsZSI6InN0eWxlcy5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vIFRPRE86IEByZWRlc2lnbiBjbGVhbnVwXG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCdcbmltcG9ydCB7IGN1c3RvbVByb3BlcnRpZXMgfSBmcm9tICdAY29tbWVyY2V0b29scy11aWtpdC9kZXNpZ24tc3lzdGVtJ1xuXG5jb25zdCBzbWFsbFRvcFBhZGRpbmcgPSBjc3NgXG4gIHBhZGRpbmctdG9wOiAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZ1hzfTtcbmBcblxuY29uc3QgdGFnTGlzdENvbnRhaW5lciA9ICh7IGlzTmV3VGhlbWUgfSkgPT4gY3NzYFxuICB3aWR0aDogMTAwJTtcbiAgZGlzcGxheTogZmxleDtcbiAgZmxleC13cmFwOiB3cmFwO1xuICBkaXNwbGF5OiBpbmxpbmUtZmxleDtcbiAgcGFkZGluZzogMCAke2lzTmV3VGhlbWUgPyAwIDogY3VzdG9tUHJvcGVydGllcy5zcGFjaW5nTH07XG4gICYgPiBkaXYge1xuICAgIG1hcmdpbjogMCAke2N1c3RvbVByb3BlcnRpZXMuc3BhY2luZ1N9ICR7Y3VzdG9tUHJvcGVydGllcy5zcGFjaW5nU30gMDtcbiAgfVxuYFxuXG5jb25zdCB0YWdMaXN0SXRlbSA9IGNzc2BcbiAgbWFyZ2luOiAwICR7Y3VzdG9tUHJvcGVydGllcy5zcGFjaW5nWHN9ICR7Y3VzdG9tUHJvcGVydGllcy5zcGFjaW5nWHN9IDA7XG4gIGRpc3BsYXk6IGZsZXg7XG4gIG1pbi13aWR0aDogMDtcbmBcblxuY29uc3QgZGl2aWRlciA9IGNzc2BcbiAgYm94LXNpemluZzogYm9yZGVyLWJveDtcbiAgd2lkdGg6IDEwMCU7XG4gIG1hcmdpbjogMDtcbiAgYm9yZGVyOiAwO1xuICBib3JkZXItdG9wOiAxcHggc29saWQgJHtjdXN0b21Qcm9wZXJ0aWVzLmNvbG9yTmV1dHJhbDYwfTtcbmBcblxuY29uc3Qgbm90Qm9sZCA9IGNzc2BcbiAgZm9udC13ZWlnaHQ6IG5vcm1hbDtcbmBcblxuY29uc3Qgc3VjY2Vzc01lc3NhZ2UgPSBjc3NgXG4gIG1hcmdpbi1ib3R0b206ICR7Y3VzdG9tUHJvcGVydGllcy5zcGFjaW5nTH07XG5gXG5cbmNvbnN0IHN0eWxlcyA9IHtcbiAgdGFnTGlzdEl0ZW0sXG4gIHRhZ0xpc3RDb250YWluZXIsXG4gIHNtYWxsVG9wUGFkZGluZyxcbiAgZGl2aWRlcixcbiAgbm90Qm9sZCxcbiAgc3VjY2Vzc01lc3NhZ2UsXG59XG5cbmV4cG9ydCBkZWZhdWx0IHN0eWxlc1xuIl19 */",
543
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
544
+ };
545
+ var successMessage = /*#__PURE__*/css("margin-bottom:", customProperties.spacingL, ";" + (process.env.NODE_ENV === "production" ? "" : ";label:successMessage;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFxQzBCIiwiZmlsZSI6InN0eWxlcy5qc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mV1dHJhbDYwfTtcbmBcblxuY29uc3Qgbm90Qm9sZCA9IGNzc2BcbiAgZm9udC13ZWlnaHQ6IG5vcm1hbDtcbmBcblxuY29uc3Qgc3VjY2Vzc01lc3NhZ2UgPSBjc3NgXG4gIG1hcmdpbi1ib3R0b206ICR7Y3VzdG9tUHJvcGVydGllcy5zcGFjaW5nTH07XG5gXG5cbmNvbnN0IHN0eWxlcyA9IHtcbiAgdGFnTGlzdEl0ZW0sXG4gIHRhZ0xpc3RDb250YWluZXIsXG4gIHNtYWxsVG9wUGFkZGluZyxcbiAgZGl2aWRlcixcbiAgbm90Qm9sZCxcbiAgc3VjY2Vzc01lc3NhZ2UsXG59XG5cbmV4cG9ydCBkZWZhdWx0IHN0eWxlc1xuIl19 */");
546
+ var styles = {
547
+ tagListItem: tagListItem,
548
+ tagListContainer: tagListContainer,
549
+ smallTopPadding: smallTopPadding,
550
+ divider: divider,
551
+ notBold: notBold,
552
+ successMessage: successMessage
553
+ };
554
+
555
+ 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; }
556
+
557
+ 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; }
558
+ function ExportSelectionRadioButtons() {
559
+ var _useTheme = useTheme(),
560
+ isNewTheme = _useTheme.isNewTheme;
561
+
562
+ var intl = useIntl();
563
+
564
+ var _useExportResourcesCo = useExportResourcesContext(),
565
+ formik = _useExportResourcesCo.formik,
566
+ resourceType = _useExportResourcesCo.resourceType,
567
+ allResourcesCount = _useExportResourcesCo.allResourcesCount,
568
+ matchingResourcesCount = _useExportResourcesCo.matchingResourcesCount,
569
+ selectedResourceIds = _useExportResourcesCo.selectedResourceIds;
570
+
571
+ var resourceTypePlural = resourceTypeToPlural({
572
+ resourceType: resourceType
573
+ });
574
+ return jsx(Spacings.Inline, {
575
+ scale: "xl",
576
+ children: jsxs(RadioInput.Group, {
577
+ name: "exportSelectionType",
578
+ value: _valuesInstanceProperty(formik).exportSelectionType,
579
+ direction: "inline",
580
+ directionProps: {
581
+ scale: 'xl'
582
+ },
583
+ onChange: formik.handleChange,
584
+ children: [jsx(RadioInput.Option, {
585
+ value: EXPORT_SELECTION_TYPES.ALL_RESOURCES,
586
+ "data-testid": 'test-all-resources',
587
+ children: jsx(Text.Body, {
588
+ isBold: !isNewTheme,
589
+ intlMessage: _objectSpread$a(_objectSpread$a({}, messages.exportAllResources), {}, {
590
+ values: {
591
+ resourceType: resourceTypePlural,
592
+ count: allResourcesCount
593
+ }
594
+ })
595
+ })
596
+ }), jsx(RadioInput.Option, {
597
+ value: EXPORT_SELECTION_TYPES.ONLY_MATCHING,
598
+ "data-testid": 'test-only-matching',
599
+ isDisabled: !Boolean(matchingResourcesCount),
600
+ children: jsx(Text.Body, {
601
+ isBold: !isNewTheme,
602
+ intlMessage: _objectSpread$a(_objectSpread$a({}, messages.exportOnlyMatchingResources), {}, {
603
+ values: {
604
+ count: matchingResourcesCount || intl.formatMessage(messages.nothingApplied)
605
+ }
606
+ })
607
+ })
608
+ }), jsx(RadioInput.Option, {
609
+ value: EXPORT_SELECTION_TYPES.ONLY_SELECTED,
610
+ "data-testid": 'test-only-selected',
611
+ isDisabled: !Boolean(selectedResourceIds.length),
612
+ children: jsx(Text.Body, {
613
+ isBold: !isNewTheme,
614
+ intlMessage: _objectSpread$a(_objectSpread$a({}, messages.exportOnlySelectedResources), {}, {
615
+ values: {
616
+ resourceType: resourceTypePlural,
617
+ count: selectedResourceIds.length
618
+ }
619
+ })
620
+ })
621
+ })]
622
+ })
623
+ });
624
+ }
625
+
626
+ function getBold(msg) {
627
+ return jsx(Text.Body, {
628
+ as: "span",
629
+ isBold: true,
630
+ children: msg
631
+ });
632
+ }
633
+
634
+ 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; }
635
+
636
+ 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; }
637
+ function ExportTextMessage() {
638
+ var _useExportResourcesCo = useExportResourcesContext(),
639
+ resourceType = _useExportResourcesCo.resourceType,
640
+ allResourcesCount = _useExportResourcesCo.allResourcesCount,
641
+ selectedResourceIds = _useExportResourcesCo.selectedResourceIds,
642
+ matchingResourcesCount = _useExportResourcesCo.matchingResourcesCount,
643
+ formik = _useExportResourcesCo.formik;
644
+
645
+ var resourceTypePlural = resourceTypeToPlural({
646
+ resourceType: resourceType
647
+ });
648
+
649
+ switch (_valuesInstanceProperty(formik).exportSelectionType) {
650
+ case EXPORT_SELECTION_TYPES.ALL_RESOURCES:
651
+ return jsx(Text.Body, {
652
+ intlMessage: _objectSpread$9(_objectSpread$9({}, messages.exportAllMessage), {}, {
653
+ values: {
654
+ count: allResourcesCount,
655
+ resourceType: resourceTypePlural,
656
+ b: getBold
657
+ }
658
+ })
659
+ });
660
+
661
+ case EXPORT_SELECTION_TYPES.ONLY_MATCHING:
662
+ return jsx(Text.Body, {
663
+ intlMessage: _objectSpread$9(_objectSpread$9({}, messages.exportMatchingMessage), {}, {
664
+ values: {
665
+ count: matchingResourcesCount,
666
+ resourceType: resourceTypePlural,
667
+ b: getBold
668
+ }
669
+ })
670
+ });
671
+
672
+ case EXPORT_SELECTION_TYPES.ONLY_SELECTED:
673
+ return jsx(Text.Body, {
674
+ intlMessage: _objectSpread$9(_objectSpread$9({}, messages.exportSelectedMessage), {}, {
675
+ values: {
676
+ count: selectedResourceIds.length,
677
+ resourceType: resourceTypePlural,
678
+ b: getBold
679
+ }
680
+ })
681
+ });
682
+
683
+ default:
684
+ throw new UnexpectedSelectionTypeError(_valuesInstanceProperty(formik).exportSelectionType);
685
+ }
686
+ }
687
+
688
+ function TagList(props) {
689
+ var _useTheme = useTheme(),
690
+ isNewTheme = _useTheme.isNewTheme;
691
+
692
+ return jsx("div", {
693
+ css: styles.tagListContainer({
694
+ isNewTheme: isNewTheme
695
+ }),
696
+ "data-testid": props['data-testid'],
697
+ children: _mapInstanceProperty(Children).call(Children, props.children, function (tag) {
698
+ return jsx("div", {
699
+ css: styles.tagListItem,
700
+ children: tag
701
+ });
702
+ })
703
+ });
704
+ }
705
+ TagList.displayName = 'TagList';
706
+ TagList.propTypes = process.env.NODE_ENV !== "production" ? {
707
+ children: PropTypes.node.isRequired,
708
+ 'data-testid': PropTypes.string
709
+ } : {};
710
+
711
+ 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; }
712
+
713
+ 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; }
714
+ function AppliedFilters(_ref) {
715
+ var filters = _ref.filters,
716
+ onFilterRemove = _ref.onFilterRemove;
717
+
718
+ var _useTheme = useTheme(),
719
+ isNewTheme = _useTheme.isNewTheme;
720
+
721
+ if (isNewTheme) return jsx(CollapsiblePanel, {
722
+ condensed: true,
723
+ isDefaultClosed: !Boolean(filters.length),
724
+ header: jsx(Text.Body, {
725
+ intlMessage: _objectSpread$8(_objectSpread$8({}, messages.appliedFiltersMessage), {}, {
726
+ values: {
727
+ filtersCount: filters.length
728
+ }
729
+ })
730
+ }),
731
+ children: jsx(TagList, {
732
+ children: _mapInstanceProperty(filters).call(filters, function (filter) {
733
+ return jsx("div", {
734
+ "data-testid": "test-filter-".concat(filter),
735
+ children: jsx(Tag, {
736
+ onRemove: function onRemove() {
737
+ onFilterRemove(filter);
738
+ },
739
+ children: filter
740
+ })
741
+ }, filter);
742
+ })
743
+ })
744
+ });
745
+ return jsxs(Spacings.Stack, {
746
+ scale: "s",
747
+ children: [jsxs(Spacings.Inline, {
748
+ scale: "s",
749
+ alignItems: "flex-start",
750
+ children: [jsx(AngleRightIcon, {
751
+ "data-testid": "test-arrowRight",
752
+ size: "medium",
753
+ color: "neutral60"
754
+ }), jsx(Text.Body, {
755
+ isBold: true,
756
+ intlMessage: _objectSpread$8(_objectSpread$8({}, messages.appliedFiltersMessage), {}, {
757
+ values: {
758
+ filtersCount: filters.length
759
+ }
760
+ })
761
+ })]
762
+ }), jsx(TagList, {
763
+ children: _mapInstanceProperty(filters).call(filters, function (filter) {
764
+ return jsx("div", {
765
+ "data-testid": "test-filter-".concat(filter),
766
+ children: jsx(Tag, {
767
+ onRemove: function onRemove() {
768
+ onFilterRemove(filter);
769
+ },
770
+ children: filter
771
+ })
772
+ }, filter);
773
+ })
774
+ })]
775
+ });
776
+ }
777
+ AppliedFilters.propTypes = process.env.NODE_ENV !== "production" ? {
778
+ filters: PropTypes.array.isRequired,
779
+ onFilterRemove: PropTypes.func.isRequired
780
+ } : {};
781
+
782
+ // TODO: @redesign cleanup
783
+ function ExportBasedOnMyViewsSelectField() {
784
+ var _useTheme = useTheme(),
785
+ themedValue = _useTheme.themedValue;
786
+
787
+ return jsxs(Spacings.Inline, {
788
+ scale: "m",
789
+ alignItems: "center",
790
+ children: [jsx(Text.Body, {
791
+ intlMessage: messages.exportBasedOnMyViewsMessage
792
+ }), jsx(Text.Body, {
793
+ intlMessage: messages.myViews
794
+ }), jsx(Constraints.Horizontal, {
795
+ max: themedValue(4, 7),
796
+ children: jsx(SelectInput, {
797
+ isDisabled: true,
798
+ placeholder: "Default"
799
+ })
800
+ })]
801
+ });
802
+ }
803
+
804
+ 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; }
805
+
806
+ 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; }
807
+
808
+ var IconPlaceholder = /*#__PURE__*/_styled("div", process.env.NODE_ENV === "production" ? {
809
+ target: "e1nl5t3e0"
810
+ } : {
811
+ target: "e1nl5t3e0",
812
+ label: "IconPlaceholder"
813
+ })("width:", customProperties$1.spacingM, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcGxpZWQtc2VhcmNoLXRlcm1zLmpzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFha0MiLCJmaWxlIjoiYXBwbGllZC1zZWFyY2gtdGVybXMuanN4Iiwic291cmNlc0NvbnRlbnQiOlsiLy8gVE9ETzogQHJlZGVzaWduIGNsZWFudXBcbmltcG9ydCB7IHVzZVRoZW1lIH0gZnJvbSAnQGNvbW1lcmNldG9vbHMtdWlraXQvZGVzaWduLXN5c3RlbSdcbmltcG9ydCBQcm9wVHlwZXMgZnJvbSAncHJvcC10eXBlcydcbmltcG9ydCB7XG4gIEFuZ2xlUmlnaHRJY29uLFxuICBDb2xsYXBzaWJsZVBhbmVsLFxuICBjdXN0b21Qcm9wZXJ0aWVzLFxuICBTcGFjaW5ncyxcbiAgVGV4dCxcbn0gZnJvbSAnQGNvbW1lcmNldG9vbHMtZnJvbnRlbmQvdWkta2l0J1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnXG5pbXBvcnQgbWVzc2FnZXMgZnJvbSAnLi9tZXNzYWdlcydcblxuY29uc3QgSWNvblBsYWNlaG9sZGVyID0gc3R5bGVkLmRpdmBcbiAgd2lkdGg6ICR7Y3VzdG9tUHJvcGVydGllcy5zcGFjaW5nTX07XG5gXG5cbmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIEFwcGxpZWRTZWFyY2hUZXJtcyh7IGFwcGxpZWRTZWFyY2hUZXJtcyB9KSB7XG4gIGNv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AgICAgICBpbnRsTWVzc2FnZT17e1xuICAgICAgICAgICAgLi4ubWVzc2FnZXMuYXBwbGllZFNlYXJjaFRlcm1zTWVzc2FnZSxcbiAgICAgICAgICAgIHZhbHVlczoge1xuICAgICAgICAgICAgICBzZWFyY2hUZXJtc0NvdW50OiBhcHBsaWVkU2VhcmNoVGVybXMubGVuZ3RoLFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICB9fVxuICAgICAgICAvPlxuICAgICAgPC9TcGFjaW5ncy5JbmxpbmU+XG4gICAgICA8U3BhY2luZ3MuSW5saW5lIHNjYWxlPVwic1wiIGFsaWduSXRlbXM9XCJmbGV4LXN0YXJ0XCI+XG4gICAgICAgIDxJY29uUGxhY2Vob2xkZXIgLz5cbiAgICAgICAgPFRleHQuQm9keT57YXBwbGllZFNlYXJjaFRlcm1zLmpvaW4oJywgJyl9PC9UZXh0LkJvZHk+XG4gICAgICA8L1NwYWNpbmdzLklubGluZT5cbiAgICA8L1NwYWNpbmdzLlN0YWNrPlxuICApXG59XG5BcHBsaWVkU2VhcmNoVGVybXMucHJvcFR5cGVzID0ge1xuICBhcHBsaWVkU2VhcmNoVGVybXM6IFByb3BUeXBlcy5hcnJheS5pc1JlcXVpcmVkLFxufVxuIl19 */"));
814
+
815
+ function AppliedSearchTerms(_ref) {
816
+ var appliedSearchTerms = _ref.appliedSearchTerms;
817
+
818
+ var _useTheme = useTheme(),
819
+ isNewTheme = _useTheme.isNewTheme;
820
+
821
+ if (isNewTheme) return jsx(CollapsiblePanel, {
822
+ condensed: true,
823
+ isDefaultClosed: !Boolean(appliedSearchTerms.length),
824
+ header: jsx(Text.Body, {
825
+ intlMessage: _objectSpread$7(_objectSpread$7({}, messages.appliedSearchTermsMessage), {}, {
826
+ values: {
827
+ searchTermsCount: appliedSearchTerms.length
828
+ }
829
+ })
830
+ }),
831
+ children: jsx(Text.Body, {
832
+ children: appliedSearchTerms.join(', ')
833
+ })
834
+ });
835
+ return jsxs(Spacings.Stack, {
836
+ scale: "s",
837
+ children: [jsxs(Spacings.Inline, {
838
+ scale: "s",
839
+ alignItems: "flex-start",
840
+ children: [jsx(AngleRightIcon, {
841
+ "data-testid": "test-arrowRight",
842
+ size: "medium",
843
+ color: "neutral60"
844
+ }), jsx(Text.Body, {
845
+ isBold: true,
846
+ intlMessage: _objectSpread$7(_objectSpread$7({}, messages.appliedSearchTermsMessage), {}, {
847
+ values: {
848
+ searchTermsCount: appliedSearchTerms.length
849
+ }
850
+ })
851
+ })]
852
+ }), jsxs(Spacings.Inline, {
853
+ scale: "s",
854
+ alignItems: "flex-start",
855
+ children: [jsx(IconPlaceholder, {}), jsx(Text.Body, {
856
+ children: appliedSearchTerms.join(', ')
857
+ })]
858
+ })]
859
+ });
860
+ }
861
+ AppliedSearchTerms.propTypes = process.env.NODE_ENV !== "production" ? {
862
+ appliedSearchTerms: PropTypes.array.isRequired
863
+ } : {};
864
+
865
+ 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; }
866
+
867
+ 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; }
868
+
869
+ function normalizeFields(fields) {
870
+ var result = _mapInstanceProperty(fields).call(fields, function (field) {
871
+ if (isFilledArray(field.fields)) {
872
+ var _context;
873
+
874
+ return _mapInstanceProperty(_context = normalizeFields(field.fields)).call(_context, function (nestedField) {
875
+ var _context2;
876
+
877
+ return _objectSpread$6(_objectSpread$6({}, nestedField), {}, {
878
+ key: _concatInstanceProperty(_context2 = "".concat(field.key, ".")).call(_context2, nestedField.key)
879
+ });
880
+ });
881
+ }
882
+
883
+ return field;
884
+ });
885
+
886
+ return _flatInstanceProperty(result).call(result);
887
+ }
888
+
889
+ function FieldsRenderer(_ref) {
890
+ var fields = _ref.fields;
891
+ var allFields = normalizeFields(fields);
892
+ return jsx(TagList, {
893
+ children: _mapInstanceProperty(allFields).call(allFields, function (field) {
894
+ return jsx("div", {
895
+ "data-testid": "test-field-".concat(field.key),
896
+ children: jsx(Tag, {
897
+ children: field.label || field.key
898
+ })
899
+ }, field.key);
900
+ })
901
+ });
902
+ }
903
+
904
+ FieldsRenderer.propTypes = process.env.NODE_ENV !== "production" ? ExportFields.propTypes : {};
905
+ function ExportFields(_ref2) {
906
+ var fields = _ref2.fields;
907
+
908
+ var _useTheme = useTheme(),
909
+ isNewTheme = _useTheme.isNewTheme;
910
+
911
+ if (isNewTheme) return jsx(CollapsiblePanel, {
912
+ condensed: true,
913
+ isDefaultClosed: !Boolean(fields.length),
914
+ header: jsx(Text.Body, {
915
+ intlMessage: _objectSpread$6(_objectSpread$6({}, messages.columnsMessage), {}, {
916
+ values: {
917
+ columnsCount: fields.length
918
+ }
919
+ })
920
+ }),
921
+ children: jsx(FieldsRenderer, {
922
+ fields: fields
923
+ })
924
+ });
925
+ return jsxs(Spacings.Stack, {
926
+ scale: "s",
927
+ children: [jsxs(Spacings.Inline, {
928
+ scale: "s",
929
+ alignItems: "flex-start",
930
+ children: [jsx(AngleRightIcon, {
931
+ "data-testid": "test-arrowRight",
932
+ size: "medium",
933
+ color: "neutral60"
934
+ }), jsx(Text.Body, {
935
+ isBold: true,
936
+ intlMessage: _objectSpread$6(_objectSpread$6({}, messages.columnsMessage), {}, {
937
+ values: {
938
+ columnsCount: fields.length
939
+ }
940
+ })
941
+ })]
942
+ }), jsx(FieldsRenderer, {
943
+ fields: fields
944
+ })]
945
+ });
946
+ }
947
+ ExportFields.propTypes = process.env.NODE_ENV !== "production" ? {
948
+ // TODO: Circular reference
949
+ fields: PropTypes.arrayOf(PropTypes.shape({
950
+ key: PropTypes.string.isRequired,
951
+ label: PropTypes.string,
952
+ isLocalized: PropTypes.bool,
953
+ fields: PropTypes.arrayOf(PropTypes.shape({
954
+ key: PropTypes.string.isRequired,
955
+ label: PropTypes.string,
956
+ isLocalized: PropTypes.bool
957
+ }))
958
+ })).isRequired
959
+ } : {};
960
+
961
+ var ExportSelection = function ExportSelection() {
962
+ var _useTheme = useTheme(),
963
+ isNewTheme = _useTheme.isNewTheme;
964
+
965
+ var _useExportResourcesCo = useExportResourcesContext(),
966
+ formik = _useExportResourcesCo.formik;
967
+
968
+ var onAppliedFilterRemove = function onAppliedFilterRemove(filter) {
969
+ var _context;
970
+
971
+ formik.setFieldValue('appliedFilters', _filterInstanceProperty(_context = _valuesInstanceProperty(formik).appliedFilters).call(_context, function (appliedFilter) {
972
+ return appliedFilter !== filter;
973
+ }));
974
+ };
975
+
976
+ if (isNewTheme) return jsxs(Spacings.Stack, {
977
+ scale: "xl",
978
+ children: [jsxs(Spacings.Stack, {
979
+ scale: "l",
980
+ children: [jsx(Text.Headline, {
981
+ as: "h2",
982
+ intlMessage: messages.exportSelection
983
+ }), jsx(ExportSelectionRadioButtons, {}), jsx(ExportTextMessage, {})]
984
+ }), _valuesInstanceProperty(formik).exportSelectionType === EXPORT_SELECTION_TYPES.ONLY_MATCHING && jsxs(Fragment, {
985
+ children: [jsx(ExportBasedOnMyViewsSelectField, {}), jsx(AppliedSearchTerms, {
986
+ appliedSearchTerms: _valuesInstanceProperty(formik).appliedSearchTerms
987
+ }), jsx(AppliedFilters, {
988
+ filters: _valuesInstanceProperty(formik).appliedFilters,
989
+ onFilterRemove: onAppliedFilterRemove
990
+ })]
991
+ }), _valuesInstanceProperty(formik).fields.length > 0 && jsx(ExportFields, {
992
+ fields: _valuesInstanceProperty(formik).fields
993
+ })]
994
+ });
995
+ return jsxs(Spacings.Stack, {
996
+ scale: "s",
997
+ children: [jsx(Text.Body, {
998
+ isBold: true,
999
+ intlMessage: messages.exportSelection
1000
+ }), jsxs(Card, {
1001
+ theme: "dark",
1002
+ type: "raised",
1003
+ insetScale: "none",
1004
+ children: [jsx(Spacings.Inset, {
1005
+ scale: "m",
1006
+ children: jsx(ExportSelectionRadioButtons, {})
1007
+ }), jsx("div", {
1008
+ css: styles.divider
1009
+ }), jsx(Spacings.Inset, {
1010
+ scale: "m",
1011
+ children: jsxs(Spacings.Stack, {
1012
+ scale: "l",
1013
+ children: [jsx(ExportTextMessage, {}), _valuesInstanceProperty(formik).exportSelectionType === EXPORT_SELECTION_TYPES.ONLY_MATCHING && jsxs(Fragment, {
1014
+ children: [jsx(ExportBasedOnMyViewsSelectField, {}), jsx(AppliedSearchTerms, {
1015
+ appliedSearchTerms: _valuesInstanceProperty(formik).appliedSearchTerms
1016
+ }), jsx(AppliedFilters, {
1017
+ filters: _valuesInstanceProperty(formik).appliedFilters,
1018
+ onFilterRemove: onAppliedFilterRemove
1019
+ })]
1020
+ }), _valuesInstanceProperty(formik).fields.length > 0 && jsx(ExportFields, {
1021
+ fields: _valuesInstanceProperty(formik).fields
1022
+ })]
1023
+ })
1024
+ })]
1025
+ })]
1026
+ });
1027
+ };
1028
+
1029
+ 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; }
1030
+
1031
+ 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; }
1032
+ var ExportProperties = function ExportProperties(props) {
1033
+ var _useTheme = useTheme(),
1034
+ isNewTheme = _useTheme.isNewTheme;
1035
+
1036
+ if (typeof props.renderProperties !== 'function') return null;
1037
+ if (isNewTheme) return jsxs(Spacings.Stack, {
1038
+ scale: "m",
1039
+ children: [jsx(Text.Headline, {
1040
+ as: "h2",
1041
+ intlMessage: messages.propertiesPanelLabel
1042
+ }), jsx("div", {
1043
+ children: props.renderProperties()
1044
+ })]
1045
+ });
1046
+ return jsx(CollapsiblePanel, {
1047
+ header: jsx(Text.Body, {
1048
+ isBold: true,
1049
+ intlMessage: _objectSpread$5({}, messages.propertiesPanelLabel)
1050
+ }),
1051
+ children: props.renderProperties()
1052
+ });
1053
+ };
1054
+ ExportProperties.propTypes = process.env.NODE_ENV !== "production" ? {
1055
+ renderProperties: PropTypes.func
1056
+ } : {};
1057
+
1058
+ 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; }
1059
+
1060
+ 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; }
1061
+ function renderFileNameError(key) {
1062
+ switch (key) {
1063
+ case 'missing':
1064
+ return jsx(FormattedMessage, _objectSpread$4({}, messages.missingFileNameError));
1065
+
1066
+ case 'invalidInput':
1067
+ return jsx(FormattedMessage, _objectSpread$4({}, messages.invalidFileNameError));
1068
+
1069
+ default:
1070
+ return null;
1071
+ }
1072
+ }
1073
+ function renderLanguageError(key) {
1074
+ switch (key) {
1075
+ case 'missing':
1076
+ return jsx(FormattedMessage, _objectSpread$4({}, messages.missingLanguageError));
1077
+
1078
+ default:
1079
+ return null;
1080
+ }
1081
+ }
1082
+
1083
+ 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; }
1084
+
1085
+ 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; }
1086
+ var outputFormatOptions = [{
1087
+ value: OUTPUT_FORMATS.JSON,
1088
+ label: 'JSON'
1089
+ }, {
1090
+ value: OUTPUT_FORMATS.CSV,
1091
+ label: 'CSV'
1092
+ }];
1093
+
1094
+ function mapLanguagesToOptions(languages) {
1095
+ return _mapInstanceProperty(languages).call(languages, function (language) {
1096
+ return {
1097
+ value: language,
1098
+ label: language
1099
+ };
1100
+ });
1101
+ }
1102
+
1103
+ function ExportFileSettings(props) {
1104
+ var _useTheme = useTheme(),
1105
+ isNewTheme = _useTheme.isNewTheme;
1106
+
1107
+ var intl = useIntl();
1108
+
1109
+ var _useExportResourcesCo = useExportResourcesContext(),
1110
+ formik = _useExportResourcesCo.formik;
1111
+
1112
+ var _useApplicationContex = useApplicationContext(function (applicationContext) {
1113
+ var _applicationContext$p;
1114
+
1115
+ return {
1116
+ language: applicationContext.dataLocale,
1117
+ languages: ((_applicationContext$p = applicationContext.project) === null || _applicationContext$p === void 0 ? void 0 : _applicationContext$p.languages) || []
1118
+ };
1119
+ }),
1120
+ languages = _useApplicationContex.languages,
1121
+ language = _useApplicationContex.language;
1122
+
1123
+ if (isNewTheme) return jsxs(Spacings.Stack, {
1124
+ scale: "xxxl",
1125
+ children: [jsx(PageContentNarrow, {
1126
+ children: jsxs(Spacings.Stack, {
1127
+ scale: "xl",
1128
+ children: [jsx(SelectField, _objectSpread$3(_objectSpread$3({
1129
+ isDisabled: true
1130
+ }, formik.getFieldProps('outputFormat')), {}, {
1131
+ title: intl.formatMessage(messages.outputFormat),
1132
+ options: outputFormatOptions
1133
+ })), jsx(TextField, _objectSpread$3(_objectSpread$3({
1134
+ title: intl.formatMessage(messages.fileName)
1135
+ }, formik.getFieldProps('fileName')), {}, {
1136
+ touched: formik.touched.fileName,
1137
+ errors: formik.errors.fileName,
1138
+ renderError: renderFileNameError
1139
+ })), jsxs(Spacings.Stack, {
1140
+ scale: "xs",
1141
+ children: [jsx(SelectField, _objectSpread$3(_objectSpread$3({
1142
+ id: "languages",
1143
+ title: intl.formatMessage(messages.localLanguage),
1144
+ options: mapLanguagesToOptions(languages),
1145
+ isMulti: true
1146
+ }, formik.getFieldProps('languages')), {}, {
1147
+ onChange: function onChange(e) {
1148
+ formik.handleChange(e);
1149
+ formik.setFieldValue('isAllLanguagesChecked', false);
1150
+ },
1151
+ touched: formik.touched.languages,
1152
+ errors: formik.errors.languages,
1153
+ renderError: renderLanguageError
1154
+ })), jsx(CheckboxInput, {
1155
+ name: "isAllLanguagesChecked",
1156
+ isChecked: _valuesInstanceProperty(formik).isAllLanguagesChecked,
1157
+ onChange: function onChange(e) {
1158
+ if (e.target.checked) formik.setFieldValue('languages', languages);else formik.setFieldValue('languages', [language]);
1159
+ formik.handleChange(e);
1160
+ },
1161
+ children: intl.formatMessage(messages.all)
1162
+ })]
1163
+ })]
1164
+ })
1165
+ }), jsx(PageContentWide, {
1166
+ children: jsxs(Spacings.Stack, {
1167
+ scale: "xxxl",
1168
+ children: [jsx(ExportSelection, {}), jsx(ExportProperties, {
1169
+ renderProperties: props.renderProperties
1170
+ })]
1171
+ })
1172
+ })]
1173
+ });
1174
+ return jsxs(Spacings.Stack, {
1175
+ scale: "l",
1176
+ children: [jsxs(Spacings.Inline, {
1177
+ scale: "l",
1178
+ children: [jsx(SelectField, _objectSpread$3(_objectSpread$3({
1179
+ isDisabled: true
1180
+ }, formik.getFieldProps('outputFormat')), {}, {
1181
+ title: intl.formatMessage(messages.outputFormat),
1182
+ options: outputFormatOptions,
1183
+ horizontalConstraint: 7
1184
+ })), jsx(TextField, _objectSpread$3(_objectSpread$3({
1185
+ title: intl.formatMessage(messages.fileName)
1186
+ }, formik.getFieldProps('fileName')), {}, {
1187
+ touched: formik.touched.fileName,
1188
+ errors: formik.errors.fileName,
1189
+ renderError: renderFileNameError,
1190
+ horizontalConstraint: 7
1191
+ }))]
1192
+ }), jsx(Spacings.Inline, {
1193
+ children: jsx(SelectField, _objectSpread$3(_objectSpread$3({
1194
+ id: "languages",
1195
+ title: jsxs(Spacings.Inline, {
1196
+ scale: "s",
1197
+ children: [jsx("label", {
1198
+ htmlFor: "languages",
1199
+ children: intl.formatMessage(messages.localLanguage)
1200
+ }), jsx(CheckboxInput, {
1201
+ name: "isAllLanguagesChecked",
1202
+ isChecked: _valuesInstanceProperty(formik).isAllLanguagesChecked,
1203
+ onChange: function onChange(e) {
1204
+ if (e.target.checked) formik.setFieldValue('languages', languages);else formik.setFieldValue('languages', [language]);
1205
+ formik.handleChange(e);
1206
+ },
1207
+ children: jsx("div", {
1208
+ css: styles.notBold,
1209
+ children: intl.formatMessage(messages.all)
1210
+ })
1211
+ })]
1212
+ }),
1213
+ options: mapLanguagesToOptions(languages),
1214
+ isMulti: true
1215
+ }, formik.getFieldProps('languages')), {}, {
1216
+ onChange: function onChange(e) {
1217
+ formik.handleChange(e);
1218
+ formik.setFieldValue('isAllLanguagesChecked', false);
1219
+ },
1220
+ touched: formik.touched.languages,
1221
+ errors: formik.errors.languages,
1222
+ renderError: renderLanguageError,
1223
+ horizontalConstraint: 7
1224
+ }))
1225
+ }), jsx(ExportSelection, {}), jsx(ExportProperties, {
1226
+ renderProperties: props.renderProperties
1227
+ })]
1228
+ });
1229
+ }
1230
+ ExportFileSettings.displayName = 'ExportFileSettings';
1231
+ ExportFileSettings.propTypes = process.env.NODE_ENV !== "production" ? {
1232
+ renderProperties: PropTypes.func
1233
+ } : {};
1234
+
1235
+ function createExportOperation(_x) {
1236
+ return _createExportOperation.apply(this, arguments);
1237
+ }
1238
+
1239
+ function _createExportOperation() {
1240
+ _createExportOperation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
1241
+ var projectKey, graphQuery, asyncDispatchFn, uri, response;
1242
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
1243
+ while (1) switch (_context.prev = _context.next) {
1244
+ case 0:
1245
+ projectKey = _ref.projectKey, graphQuery = _ref.graphQuery, asyncDispatchFn = _ref.asyncDispatchFn;
1246
+ uri = "/proxy/export/".concat(projectKey, "/export-operations");
1247
+ _context.next = 4;
1248
+ return asyncDispatchFn(actions.post({
1249
+ // FIXME: EXPORT is undefined
1250
+ mcApiProxyTarget: MC_API_PROXY_TARGETS.EXPORT,
1251
+ uri: uri,
1252
+ headers: {
1253
+ accept: 'application/json'
1254
+ },
1255
+ payload: {
1256
+ query: graphQuery
1257
+ }
1258
+ }));
1259
+
1260
+ case 4:
1261
+ response = _context.sent;
1262
+ return _context.abrupt("return", response);
1263
+
1264
+ case 6:
1265
+ case "end":
1266
+ return _context.stop();
1267
+ }
1268
+ }, _callee);
1269
+ }));
1270
+ return _createExportOperation.apply(this, arguments);
1271
+ }
1272
+
1273
+ 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; }
1274
+
1275
+ function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys$2(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys$2(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
1276
+ function ExportConfirmationModal(props) {
1277
+ var _useApplicationContex = useApplicationContext(function (applicationContext) {
1278
+ var _applicationContext$p, _applicationContext$p2;
1279
+
1280
+ return {
1281
+ projectName: (_applicationContext$p = applicationContext.project) === null || _applicationContext$p === void 0 ? void 0 : _applicationContext$p.name,
1282
+ projectKey: (_applicationContext$p2 = applicationContext.project) === null || _applicationContext$p2 === void 0 ? void 0 : _applicationContext$p2.key
1283
+ };
1284
+ }),
1285
+ projectName = _useApplicationContex.projectName,
1286
+ projectKey = _useApplicationContex.projectKey;
1287
+
1288
+ var _useExportResourcesCo = useExportResourcesContext(),
1289
+ formik = _useExportResourcesCo.formik,
1290
+ allResourcesCount = _useExportResourcesCo.allResourcesCount,
1291
+ matchingResourcesCount = _useExportResourcesCo.matchingResourcesCount,
1292
+ selectedResourceIds = _useExportResourcesCo.selectedResourceIds,
1293
+ resourceType = _useExportResourcesCo.resourceType,
1294
+ setExportOperationStarted = _useExportResourcesCo.setExportOperationStarted;
1295
+
1296
+ var intl = useIntl();
1297
+ var asyncDispatch = useAsyncDispatch();
1298
+ var resourceTypePlural = resourceTypeToPlural({
1299
+ resourceType: props.resourceType
1300
+ });
1301
+
1302
+ var countInConfirmationMessage = function countInConfirmationMessage() {
1303
+ switch (_valuesInstanceProperty(formik).exportSelectionType) {
1304
+ case EXPORT_SELECTION_TYPES.ALL_RESOURCES:
1305
+ return allResourcesCount;
1306
+
1307
+ case EXPORT_SELECTION_TYPES.ONLY_MATCHING:
1308
+ return matchingResourcesCount;
1309
+
1310
+ case EXPORT_SELECTION_TYPES.ONLY_SELECTED:
1311
+ return selectedResourceIds.length;
1312
+
1313
+ default:
1314
+ throw new UnexpectedSelectionTypeError(_valuesInstanceProperty(formik).exportSelectionType);
1315
+ }
1316
+ };
1317
+
1318
+ return jsx(ConfirmationDialog, {
1319
+ dataAttributesPrimaryButton: {
1320
+ 'data-testid': 'confirm-export-button'
1321
+ },
1322
+ title: intl.formatMessage(messages.confirmationTitle, {
1323
+ resourceType: resourceTypePlural
1324
+ }),
1325
+ labelPrimary: intl.formatMessage(messages.exportConfirmationLabel, {
1326
+ resourceType: resourceTypePlural
1327
+ }),
1328
+ isOpen: props.isOpen,
1329
+ onClose: props.closeModal,
1330
+ onCancel: props.closeModal,
1331
+ onConfirm: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
1332
+ var graphQuery, response;
1333
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
1334
+ while (1) switch (_context.prev = _context.next) {
1335
+ case 0:
1336
+ setExportOperationStarted(false);
1337
+ graphQuery = buildGraphQuery({
1338
+ resourceType: resourceType,
1339
+ selectedResourceIds: selectedResourceIds,
1340
+ fields: _valuesInstanceProperty(formik).fields,
1341
+ exportSelectionType: _valuesInstanceProperty(formik).exportSelectionType,
1342
+ languages: _valuesInstanceProperty(formik).languages
1343
+ });
1344
+ props.closeModal();
1345
+ _context.prev = 3;
1346
+ _context.next = 6;
1347
+ return createExportOperation({
1348
+ projectKey: projectKey,
1349
+ graphQuery: graphQuery,
1350
+ asyncDispatchFn: asyncDispatch
1351
+ });
1352
+
1353
+ case 6:
1354
+ response = _context.sent;
1355
+ _context.t0 = response.state;
1356
+ _context.next = _context.t0 === EXPORT_OPERATION_STATES.PROCESSING ? 10 : _context.t0 === EXPORT_OPERATION_STATES.COMPLETED ? 10 : 12;
1357
+ break;
1358
+
1359
+ case 10:
1360
+ setExportOperationStarted(true);
1361
+ return _context.abrupt("break", 13);
1362
+
1363
+ case 12:
1364
+ throw new UnexpectedExportOperationStateError(response.state);
1365
+
1366
+ case 13:
1367
+ _context.next = 18;
1368
+ break;
1369
+
1370
+ case 15:
1371
+ _context.prev = 15;
1372
+ _context.t1 = _context["catch"](3);
1373
+ showApiErrorNotification({
1374
+ errors: _context.t1
1375
+ });
1376
+
1377
+ case 18:
1378
+ case "end":
1379
+ return _context.stop();
1380
+ }
1381
+ }, _callee, null, [[3, 15]]);
1382
+ })),
1383
+ children: jsxs("div", {
1384
+ children: [jsx(Text.Body, {
1385
+ intlMessage: _objectSpread$2(_objectSpread$2({}, messages.confirmationBodyPlan), {}, {
1386
+ values: {
1387
+ resourceType: resourceTypePlural,
1388
+ projectName: projectName,
1389
+ count: countInConfirmationMessage(),
1390
+ bold: getBold
1391
+ }
1392
+ })
1393
+ }), jsx(Text.Body, {
1394
+ intlMessage: messages.confirmationBodyQuestion
1395
+ })]
1396
+ })
1397
+ });
1398
+ }
1399
+ ExportConfirmationModal.propTypes = process.env.NODE_ENV !== "production" ? {
1400
+ isOpen: PropTypes.bool.isRequired,
1401
+ resourceType: PropTypes.string.isRequired,
1402
+ closeModal: PropTypes.func.isRequired
1403
+ } : {};
1404
+
1405
+ function ownKeys$1(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; }
1406
+
1407
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys$1(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys$1(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
1408
+
1409
+ var getExportLogsLink = function getExportLogsLink(projectKey, msg) {
1410
+ return jsx(Link, {
1411
+ to: "/".concat(projectKey, "/operations/export/logs"),
1412
+ children: msg
1413
+ });
1414
+ };
1415
+
1416
+ function ExportOperationSuccessMessage(_ref) {
1417
+ var isShown = _ref.isShown;
1418
+
1419
+ var _useApplicationContex = useApplicationContext(function (applicationContext) {
1420
+ var _applicationContext$p;
1421
+
1422
+ return {
1423
+ projectKey: (_applicationContext$p = applicationContext.project) === null || _applicationContext$p === void 0 ? void 0 : _applicationContext$p.key
1424
+ };
1425
+ }),
1426
+ projectKey = _useApplicationContex.projectKey;
1427
+
1428
+ if (!isShown) return null;
1429
+ return jsx("div", {
1430
+ css: styles.successMessage,
1431
+ "data-testid": "export-started-message",
1432
+ children: jsx(Constraints.Horizontal, {
1433
+ max: 16,
1434
+ children: jsx(ContentNotification, {
1435
+ type: "success",
1436
+ intlMessage: _objectSpread$1(_objectSpread$1({}, messages.exportOperationSuccessMessage), {}, {
1437
+ values: {
1438
+ logsLink: function logsLink(msg) {
1439
+ return getExportLogsLink(projectKey, msg);
1440
+ }
1441
+ }
1442
+ })
1443
+ })
1444
+ })
1445
+ });
1446
+ }
1447
+ ExportOperationSuccessMessage.propTypes = process.env.NODE_ENV !== "production" ? {
1448
+ isShown: PropTypes.bool.isRequired
1449
+ } : {};
1450
+
1451
+ var _excluded = ["renderProperties"];
1452
+
1453
+ function ownKeys(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; }
1454
+
1455
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
1456
+
1457
+ var ExportResourcesModal = function ExportResourcesModal(_ref) {
1458
+ var renderProperties = _ref.renderProperties,
1459
+ props = _objectWithoutProperties(_ref, _excluded);
1460
+
1461
+ var intl = useIntl();
1462
+ var confirmationModal = useModalState();
1463
+ var resourceTypePlural = resourceTypeToPlural({
1464
+ resourceType: props.resourceType
1465
+ });
1466
+ return jsx(ExportResourcesContextProvider, _objectSpread(_objectSpread({}, props), {}, {
1467
+ children: jsx(ExportResourcesContext.Consumer, {
1468
+ children: function children(_ref2) {
1469
+ var formik = _ref2.formik,
1470
+ exportOperationStarted = _ref2.exportOperationStarted;
1471
+ return jsxs(FormModalPage, {
1472
+ title: intl.formatMessage(messages.modalTitle, {
1473
+ resourceType: resourceTypePlural
1474
+ }),
1475
+ isOpen: props.isOpen,
1476
+ onClose: props.closeModal,
1477
+ onSecondaryButtonClick: props.closeModal,
1478
+ isPrimaryButtonDisabled: !formik.isValid,
1479
+ labelPrimaryButton: intl.formatMessage(messages.exportButton, {
1480
+ resourceType: resourceTypePlural
1481
+ }),
1482
+ subtitle: intl.formatMessage(messages.modalSubTitle),
1483
+ topBarPreviousPathLabel: intl.formatMessage(messages.topBarPreviousPathLabel, {
1484
+ resourceType: props.resourceType
1485
+ }),
1486
+ onPrimaryButtonClick: confirmationModal.openModal,
1487
+ children: [jsx(ExportOperationSuccessMessage, {
1488
+ isShown: exportOperationStarted
1489
+ }), jsx(ExportFileSettings, {
1490
+ renderProperties: renderProperties
1491
+ }), jsx(ExportConfirmationModal, {
1492
+ resourceType: props.resourceType,
1493
+ isOpen: confirmationModal.isModalOpen,
1494
+ closeModal: confirmationModal.closeModal
1495
+ })]
1496
+ });
1497
+ }
1498
+ })
1499
+ }));
1500
+ };
1501
+
1502
+ ExportResourcesModal.displayName = 'ExportResourcesModal';
1503
+ ExportResourcesModal.propTypes = process.env.NODE_ENV !== "production" ? ExportResourcesModalShape : {};
1504
+ ExportResourcesModal.defaultProps = {
1505
+ selectedResourceIds: [],
1506
+ appliedSearchTerms: [],
1507
+ appliedFilters: [],
1508
+ matchingResourcesCount: 0,
1509
+ exportSelectionType: EXPORT_SELECTION_TYPES.ALL_RESOURCES,
1510
+ outputFormat: OUTPUT_FORMATS.JSON
1511
+ };
1512
+
1513
+ export { EXPORTABLE_RESOURCES, EXPORT_SELECTION_TYPES, ExportResourcesModal as default };