@commercetools-frontend-extensions/export-resources-modal 4.4.4 → 4.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.dev.js +213 -258
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.prod.js +197 -242
- package/dist/commercetools-frontend-extensions-export-resources-modal.esm.js +211 -255
- package/dist/declarations/src/@types/export-resources-modal-types.d.ts +1 -1
- package/package.json +21 -21
|
@@ -16,42 +16,41 @@ var applicationShellConnectors = require('@commercetools-frontend/application-sh
|
|
|
16
16
|
var uiKit = require('@commercetools-frontend/ui-kit');
|
|
17
17
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
18
18
|
var _valuesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/values');
|
|
19
|
-
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
20
19
|
var applicationComponents = require('@commercetools-frontend/application-components');
|
|
21
20
|
var fullstory = require('@commercetools-frontend/fullstory');
|
|
22
21
|
var React = require('react');
|
|
23
22
|
var _Reflect$construct = require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
|
|
24
23
|
var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
|
|
25
24
|
var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
26
|
-
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
27
25
|
var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
|
|
28
26
|
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
27
|
+
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
29
28
|
var _wrapNativeSuper = require('@babel/runtime-corejs3/helpers/wrapNativeSuper');
|
|
30
29
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
31
30
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
32
|
-
var
|
|
31
|
+
var experimentalComponents = require('@commercetools-frontend/experimental-components');
|
|
32
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
33
33
|
var omitEmpty = require('omit-empty-es');
|
|
34
34
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
35
35
|
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
36
36
|
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
37
37
|
var _sortInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/sort');
|
|
38
38
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
39
|
-
var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
|
|
40
39
|
var moment = require('moment');
|
|
40
|
+
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
41
41
|
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
42
42
|
var _everyInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/every');
|
|
43
|
-
var experimentalComponents = require('@commercetools-frontend/experimental-components');
|
|
44
|
-
var sdk = require('@commercetools-frontend/sdk');
|
|
45
43
|
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
46
44
|
var constants = require('@commercetools-frontend/constants');
|
|
45
|
+
var sdk = require('@commercetools-frontend/sdk');
|
|
47
46
|
var _styled = require('@emotion/styled/base');
|
|
48
47
|
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
49
48
|
var throttle = require('lodash/throttle');
|
|
50
49
|
var react = require('@emotion/react');
|
|
51
50
|
var get = require('lodash/get');
|
|
52
51
|
var formik = require('formik');
|
|
53
|
-
var sentry = require('@commercetools-frontend/sentry');
|
|
54
52
|
var i18n = require('@commercetools-frontend/i18n');
|
|
53
|
+
var sentry = require('@commercetools-frontend/sentry');
|
|
55
54
|
|
|
56
55
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
57
56
|
|
|
@@ -64,19 +63,18 @@ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_O
|
|
|
64
63
|
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
65
64
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
66
65
|
var _valuesInstanceProperty__default = /*#__PURE__*/_interopDefault(_valuesInstanceProperty);
|
|
67
|
-
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
68
66
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
69
67
|
var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
|
|
70
68
|
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
71
|
-
var
|
|
69
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
72
70
|
var omitEmpty__default = /*#__PURE__*/_interopDefault(omitEmpty);
|
|
73
71
|
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
74
72
|
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
75
73
|
var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
76
74
|
var _sortInstanceProperty__default = /*#__PURE__*/_interopDefault(_sortInstanceProperty);
|
|
77
75
|
var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
|
|
78
|
-
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
|
|
79
76
|
var moment__default = /*#__PURE__*/_interopDefault(moment);
|
|
77
|
+
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
80
78
|
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
81
79
|
var _everyInstanceProperty__default = /*#__PURE__*/_interopDefault(_everyInstanceProperty);
|
|
82
80
|
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
@@ -324,63 +322,115 @@ function renderLocaleError(key) {
|
|
|
324
322
|
}
|
|
325
323
|
}
|
|
326
324
|
|
|
327
|
-
|
|
325
|
+
const Z_INDEX_DROPDOWN = 30000;
|
|
326
|
+
const OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION = 'OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION';
|
|
327
|
+
const OPERATIONS_EXPORT_RESOURCES_MODAL_EXPANDED_GROUP = 'OPERATIONS_EXPORT_RESOURCES_MODAL_EXPANDED_GROUP';
|
|
328
|
+
|
|
329
|
+
const EXPORT_OPERATION_STATES = {
|
|
330
|
+
PROCESSING: 'processing',
|
|
331
|
+
COMPLETED: 'completed',
|
|
332
|
+
FAILED: 'failed',
|
|
333
|
+
QUEUED: 'queued'
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
const EXPORT_TYPES = {
|
|
337
|
+
ALL: 'all',
|
|
338
|
+
FILTERED: 'filtered',
|
|
339
|
+
SELECTED: 'selected'
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
const EXPORTABLE_RESOURCES = {
|
|
343
|
+
CATEGORY: 'category',
|
|
344
|
+
PRODUCT: 'product',
|
|
345
|
+
DISCOUNT_CODE: 'discount-code',
|
|
346
|
+
INVENTORY_ENTRY: 'inventory-entry'
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
const OUTPUT_FORMATS = {
|
|
350
|
+
JSON: 'json',
|
|
351
|
+
CSV: 'csv'
|
|
352
|
+
};
|
|
353
|
+
const OUTPUT_FORMAT_OPTIONS = [{
|
|
354
|
+
value: OUTPUT_FORMATS.CSV,
|
|
355
|
+
label: 'CSV'
|
|
356
|
+
}, {
|
|
357
|
+
value: OUTPUT_FORMATS.JSON,
|
|
358
|
+
label: 'JSON'
|
|
359
|
+
}];
|
|
360
|
+
|
|
361
|
+
const resourceTypeMessages = {
|
|
362
|
+
[EXPORTABLE_RESOURCES.CATEGORY]: {
|
|
363
|
+
exportScopeAll: messages.exportScopeAllCategories,
|
|
364
|
+
exportScopeSelected: messages.exportScopeSelectedCategories
|
|
365
|
+
},
|
|
366
|
+
[EXPORTABLE_RESOURCES.PRODUCT]: {
|
|
367
|
+
exportScopeAll: messages.exportScopeAllProducts,
|
|
368
|
+
exportScopeSelected: messages.exportScopeSelectedProducts
|
|
369
|
+
},
|
|
370
|
+
[EXPORTABLE_RESOURCES.INVENTORY_ENTRY]: {
|
|
371
|
+
exportScopeAll: messages.exportScopeAllInventories,
|
|
372
|
+
exportScopeSelected: messages.exportScopeSelectedInventories
|
|
373
|
+
},
|
|
374
|
+
[EXPORTABLE_RESOURCES.DISCOUNT_CODE]: {
|
|
375
|
+
exportScopeAll: messages.exportScopeAllDiscountCodes,
|
|
376
|
+
exportScopeSelected: messages.exportScopeSelectedDiscountCodes,
|
|
377
|
+
exportScopeFiltered: messages.exportScopeFilteredDiscountCodes
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
function _callSuper$3(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$3() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
328
382
|
function _isNativeReflectConstruct$3() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$3 = function () { return !!t; })(); }
|
|
329
383
|
let MissingExportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
330
|
-
_inherits(MissingExportResourceProviderError, _Error);
|
|
331
|
-
var _super = _createSuper$3(MissingExportResourceProviderError);
|
|
332
384
|
function MissingExportResourceProviderError() {
|
|
333
385
|
var _this;
|
|
334
386
|
_classCallCheck(this, MissingExportResourceProviderError);
|
|
335
|
-
_this =
|
|
387
|
+
_this = _callSuper$3(this, MissingExportResourceProviderError, ['useExportResourcesContext must be used within ExportResourcesProvider']);
|
|
336
388
|
_this.name = 'MissingExportResourceProviderError';
|
|
337
389
|
return _this;
|
|
338
390
|
}
|
|
391
|
+
_inherits(MissingExportResourceProviderError, _Error);
|
|
339
392
|
return _createClass(MissingExportResourceProviderError);
|
|
340
393
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
341
394
|
|
|
342
|
-
function
|
|
395
|
+
function _callSuper$2(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$2() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
343
396
|
function _isNativeReflectConstruct$2() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$2 = function () { return !!t; })(); }
|
|
344
397
|
let UnexpectedExportOperationStateError = /*#__PURE__*/function (_Error) {
|
|
345
|
-
_inherits(UnexpectedExportOperationStateError, _Error);
|
|
346
|
-
var _super = _createSuper$2(UnexpectedExportOperationStateError);
|
|
347
398
|
function UnexpectedExportOperationStateError(state) {
|
|
348
399
|
var _this;
|
|
349
400
|
_classCallCheck(this, UnexpectedExportOperationStateError);
|
|
350
|
-
_this =
|
|
401
|
+
_this = _callSuper$2(this, UnexpectedExportOperationStateError, [`Unexpected export operation state "${state}"`]);
|
|
351
402
|
_this.name = 'UnexpectedExportOperationStateError';
|
|
352
403
|
return _this;
|
|
353
404
|
}
|
|
405
|
+
_inherits(UnexpectedExportOperationStateError, _Error);
|
|
354
406
|
return _createClass(UnexpectedExportOperationStateError);
|
|
355
407
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
356
408
|
|
|
357
|
-
function
|
|
409
|
+
function _callSuper$1(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
358
410
|
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function () { return !!t; })(); }
|
|
359
411
|
let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
|
|
360
|
-
_inherits(UnexpectedResourceTypeError, _Error);
|
|
361
|
-
var _super = _createSuper$1(UnexpectedResourceTypeError);
|
|
362
412
|
function UnexpectedResourceTypeError(resourceType) {
|
|
363
413
|
var _this;
|
|
364
414
|
_classCallCheck(this, UnexpectedResourceTypeError);
|
|
365
|
-
_this =
|
|
415
|
+
_this = _callSuper$1(this, UnexpectedResourceTypeError, [`Unexpected resource type "${resourceType}"`]);
|
|
366
416
|
_this.name = 'UnexpectedResourceTypeError';
|
|
367
417
|
return _this;
|
|
368
418
|
}
|
|
419
|
+
_inherits(UnexpectedResourceTypeError, _Error);
|
|
369
420
|
return _createClass(UnexpectedResourceTypeError);
|
|
370
421
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
371
422
|
|
|
372
|
-
function
|
|
423
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
373
424
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
374
425
|
let InvalidResponseError = /*#__PURE__*/function (_Error) {
|
|
375
|
-
_inherits(InvalidResponseError, _Error);
|
|
376
|
-
var _super = _createSuper(InvalidResponseError);
|
|
377
426
|
function InvalidResponseError(message) {
|
|
378
427
|
var _this;
|
|
379
428
|
_classCallCheck(this, InvalidResponseError);
|
|
380
|
-
_this =
|
|
429
|
+
_this = _callSuper(this, InvalidResponseError, [message]);
|
|
381
430
|
_this.name = 'InvalidResponseError';
|
|
382
431
|
return _this;
|
|
383
432
|
}
|
|
433
|
+
_inherits(InvalidResponseError, _Error);
|
|
384
434
|
return _createClass(InvalidResponseError);
|
|
385
435
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
386
436
|
|
|
@@ -393,7 +443,7 @@ function useExportResourcesContext() {
|
|
|
393
443
|
}
|
|
394
444
|
|
|
395
445
|
function checkAtLeastOneFieldChecked(fields) {
|
|
396
|
-
return fields
|
|
446
|
+
return fields?.some(field => {
|
|
397
447
|
if (field.fields) {
|
|
398
448
|
return field.isChecked || checkAtLeastOneFieldChecked(field.fields);
|
|
399
449
|
}
|
|
@@ -436,64 +486,7 @@ function validate(_ref) {
|
|
|
436
486
|
return omitEmpty__default["default"](errors);
|
|
437
487
|
}
|
|
438
488
|
|
|
439
|
-
const Z_INDEX_DROPDOWN = 30000;
|
|
440
|
-
const OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION = 'OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION';
|
|
441
|
-
const OPERATIONS_EXPORT_RESOURCES_MODAL_EXPANDED_GROUP = 'OPERATIONS_EXPORT_RESOURCES_MODAL_EXPANDED_GROUP';
|
|
442
|
-
|
|
443
|
-
const EXPORT_OPERATION_STATES = {
|
|
444
|
-
PROCESSING: 'processing',
|
|
445
|
-
COMPLETED: 'completed',
|
|
446
|
-
FAILED: 'failed',
|
|
447
|
-
QUEUED: 'queued'
|
|
448
|
-
};
|
|
449
|
-
|
|
450
|
-
const EXPORT_TYPES = {
|
|
451
|
-
ALL: 'all',
|
|
452
|
-
FILTERED: 'filtered',
|
|
453
|
-
SELECTED: 'selected'
|
|
454
|
-
};
|
|
455
|
-
|
|
456
|
-
const EXPORTABLE_RESOURCES = {
|
|
457
|
-
CATEGORY: 'category',
|
|
458
|
-
PRODUCT: 'product',
|
|
459
|
-
DISCOUNT_CODE: 'discount-code',
|
|
460
|
-
INVENTORY_ENTRY: 'inventory-entry'
|
|
461
|
-
};
|
|
462
|
-
|
|
463
|
-
const OUTPUT_FORMATS = {
|
|
464
|
-
JSON: 'json',
|
|
465
|
-
CSV: 'csv'
|
|
466
|
-
};
|
|
467
|
-
const OUTPUT_FORMAT_OPTIONS = [{
|
|
468
|
-
value: OUTPUT_FORMATS.CSV,
|
|
469
|
-
label: 'CSV'
|
|
470
|
-
}, {
|
|
471
|
-
value: OUTPUT_FORMATS.JSON,
|
|
472
|
-
label: 'JSON'
|
|
473
|
-
}];
|
|
474
|
-
|
|
475
|
-
const resourceTypeMessages = {
|
|
476
|
-
[EXPORTABLE_RESOURCES.CATEGORY]: {
|
|
477
|
-
exportScopeAll: messages.exportScopeAllCategories,
|
|
478
|
-
exportScopeSelected: messages.exportScopeSelectedCategories
|
|
479
|
-
},
|
|
480
|
-
[EXPORTABLE_RESOURCES.PRODUCT]: {
|
|
481
|
-
exportScopeAll: messages.exportScopeAllProducts,
|
|
482
|
-
exportScopeSelected: messages.exportScopeSelectedProducts
|
|
483
|
-
},
|
|
484
|
-
[EXPORTABLE_RESOURCES.INVENTORY_ENTRY]: {
|
|
485
|
-
exportScopeAll: messages.exportScopeAllInventories,
|
|
486
|
-
exportScopeSelected: messages.exportScopeSelectedInventories
|
|
487
|
-
},
|
|
488
|
-
[EXPORTABLE_RESOURCES.DISCOUNT_CODE]: {
|
|
489
|
-
exportScopeAll: messages.exportScopeAllDiscountCodes,
|
|
490
|
-
exportScopeSelected: messages.exportScopeSelectedDiscountCodes,
|
|
491
|
-
exportScopeFiltered: messages.exportScopeFilteredDiscountCodes
|
|
492
|
-
}
|
|
493
|
-
};
|
|
494
|
-
|
|
495
489
|
function resourceTypeToFileName(resourceType) {
|
|
496
|
-
var _context;
|
|
497
490
|
const todayFormatted = moment__default["default"]().format('DD-MM-YY_HH-mm');
|
|
498
491
|
const resourceTypeMap = {
|
|
499
492
|
[EXPORTABLE_RESOURCES.CATEGORY]: 'Categories',
|
|
@@ -505,7 +498,7 @@ function resourceTypeToFileName(resourceType) {
|
|
|
505
498
|
if (!displayName) {
|
|
506
499
|
throw new UnexpectedResourceTypeError(resourceType);
|
|
507
500
|
}
|
|
508
|
-
return
|
|
501
|
+
return `${displayName}_Export_${todayFormatted}`;
|
|
509
502
|
}
|
|
510
503
|
function mapLocalesToOptions(locales) {
|
|
511
504
|
return _mapInstanceProperty__default["default"](locales).call(locales, locale => ({
|
|
@@ -517,14 +510,13 @@ function isFilledArray(maybeArray) {
|
|
|
517
510
|
return _Array$isArray__default["default"](maybeArray) && maybeArray.length;
|
|
518
511
|
}
|
|
519
512
|
function appendCsvOrJsonExtensionIfAbsent(fileName, fileFormat) {
|
|
520
|
-
var _context2;
|
|
521
513
|
const extensionRegex = /\.(csv|json)$/i;
|
|
522
|
-
if (!extensionRegex.test(fileName)) return
|
|
514
|
+
if (!extensionRegex.test(fileName)) return `${fileName}.${fileFormat}`;
|
|
523
515
|
return fileName;
|
|
524
516
|
}
|
|
525
517
|
function getExportLogsLink(projectKey, msg) {
|
|
526
518
|
return jsxRuntime.jsx(uiKit.Link, {
|
|
527
|
-
to:
|
|
519
|
+
to: `/${projectKey}/operations/export/logs`,
|
|
528
520
|
children: msg
|
|
529
521
|
});
|
|
530
522
|
}
|
|
@@ -554,30 +546,28 @@ function sortFieldsByFieldOrder(_ref) {
|
|
|
554
546
|
return fields;
|
|
555
547
|
}
|
|
556
548
|
function buildSelectedExportFilters(selectedResourceIds) {
|
|
557
|
-
if (!selectedResourceIds ||
|
|
558
|
-
const formattedIds = _mapInstanceProperty__default["default"](selectedResourceIds).call(selectedResourceIds, id => "
|
|
559
|
-
return
|
|
549
|
+
if (!selectedResourceIds || selectedResourceIds?.length === 0) return undefined;
|
|
550
|
+
const formattedIds = _mapInstanceProperty__default["default"](selectedResourceIds).call(selectedResourceIds, id => `"${id}"`).join(', ');
|
|
551
|
+
return `id in (${formattedIds})`;
|
|
560
552
|
}
|
|
561
553
|
function areFiltersApplied(filters) {
|
|
562
|
-
var _filters$where;
|
|
563
554
|
if (!filters) {
|
|
564
555
|
return false;
|
|
565
556
|
}
|
|
566
|
-
return filters.where !== undefined &&
|
|
557
|
+
return filters.where !== undefined && filters.where?.trim() !== '';
|
|
567
558
|
}
|
|
568
559
|
function getInitialExportType(args) {
|
|
569
|
-
|
|
570
|
-
if ((_args$selectedResourc = args.selectedResourceIds) !== null && _args$selectedResourc !== void 0 && _args$selectedResourc.length) {
|
|
560
|
+
if (args.selectedResourceIds?.length) {
|
|
571
561
|
return EXPORT_TYPES.SELECTED;
|
|
572
562
|
}
|
|
573
|
-
if (
|
|
563
|
+
if (args.filters?.total && areFiltersApplied(args.filters)) {
|
|
574
564
|
return EXPORT_TYPES.FILTERED;
|
|
575
565
|
}
|
|
576
566
|
return EXPORT_TYPES.ALL;
|
|
577
567
|
}
|
|
578
568
|
|
|
579
569
|
function ownKeys$6(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
580
|
-
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
570
|
+
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$6(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$6(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
581
571
|
const updateFieldGroupsWithIsCheckedValue = (groups, cachedSelectedGroups) => {
|
|
582
572
|
const updateFields = (fields, parentChecked, fieldName) => {
|
|
583
573
|
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
@@ -585,10 +575,8 @@ const updateFieldGroupsWithIsCheckedValue = (groups, cachedSelectedGroups) => {
|
|
|
585
575
|
if (field.isRequired) {
|
|
586
576
|
isChecked = true;
|
|
587
577
|
} else {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
var _context2;
|
|
591
|
-
isChecked = cachedSelectedGroups[_concatInstanceProperty__default["default"](_context2 = "".concat(fieldName, ".")).call(_context2, field.name)];
|
|
578
|
+
if (cachedSelectedGroups[`${fieldName}.${field.name}`] !== undefined) {
|
|
579
|
+
isChecked = cachedSelectedGroups[`${fieldName}.${field.name}`];
|
|
592
580
|
} else if (!field.isReadOnly && field.isSelectedByDefault) {
|
|
593
581
|
isChecked = true;
|
|
594
582
|
} else if (parentChecked) {
|
|
@@ -596,8 +584,7 @@ const updateFieldGroupsWithIsCheckedValue = (groups, cachedSelectedGroups) => {
|
|
|
596
584
|
}
|
|
597
585
|
}
|
|
598
586
|
if (field.fields) {
|
|
599
|
-
|
|
600
|
-
const updatedFields = updateFields(field.fields, isChecked, _concatInstanceProperty__default["default"](_context3 = "".concat(fieldName, ".")).call(_context3, field.name));
|
|
587
|
+
const updatedFields = updateFields(field.fields, isChecked, `${fieldName}.${field.name}`);
|
|
601
588
|
isChecked = false;
|
|
602
589
|
field.fields = updatedFields;
|
|
603
590
|
}
|
|
@@ -648,8 +635,7 @@ const updateFieldGroupsWithIsExpandedValue = (groups, cachedExpandedGroups) => {
|
|
|
648
635
|
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
649
636
|
let isExpanded = null;
|
|
650
637
|
if (field.isExpandable) {
|
|
651
|
-
|
|
652
|
-
isExpanded = (_ref = (_cachedExpandedGroups = cachedExpandedGroups[_concatInstanceProperty__default["default"](_context4 = "".concat(groupName, ".")).call(_context4, field.name)]) !== null && _cachedExpandedGroups !== void 0 ? _cachedExpandedGroups : field.isExpanded) !== null && _ref !== void 0 ? _ref : false;
|
|
638
|
+
isExpanded = cachedExpandedGroups[`${groupName}.${field.name}`] ?? field.isExpanded ?? false;
|
|
653
639
|
}
|
|
654
640
|
if (field.fields) {
|
|
655
641
|
field.fields = updateFields(field.fields, groupName);
|
|
@@ -663,10 +649,9 @@ const updateFieldGroupsWithIsExpandedValue = (groups, cachedExpandedGroups) => {
|
|
|
663
649
|
});
|
|
664
650
|
}
|
|
665
651
|
return _mapInstanceProperty__default["default"](groups).call(groups, group => {
|
|
666
|
-
var _ref2, _cachedExpandedGroups2;
|
|
667
652
|
const updatedFields = updateFields(group.fields, group.groupName);
|
|
668
653
|
return _objectSpread$6(_objectSpread$6({}, group), {}, {
|
|
669
|
-
isExpanded:
|
|
654
|
+
isExpanded: cachedExpandedGroups[group.groupName] ?? group.isExpanded ?? false,
|
|
670
655
|
fields: updatedFields
|
|
671
656
|
});
|
|
672
657
|
});
|
|
@@ -676,7 +661,7 @@ const isRequiredGroupChecked = function () {
|
|
|
676
661
|
let dependentGroupNames = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
677
662
|
let formik = arguments.length > 1 ? arguments[1] : undefined;
|
|
678
663
|
let result = false;
|
|
679
|
-
if (dependentGroupNames
|
|
664
|
+
if (dependentGroupNames?.length) {
|
|
680
665
|
_someInstanceProperty__default["default"](dependentGroupNames).call(dependentGroupNames, dependentGroupName => {
|
|
681
666
|
var _context;
|
|
682
667
|
const dependentGroup = _findInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](formik).groups).call(_context, group => group.groupName === dependentGroupName);
|
|
@@ -698,23 +683,20 @@ const checkAllFieldsSelected = fields => {
|
|
|
698
683
|
};
|
|
699
684
|
|
|
700
685
|
const useInitialValues = props => {
|
|
701
|
-
var _context
|
|
686
|
+
var _context;
|
|
702
687
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
703
688
|
locale: applicationContext.dataLocale
|
|
704
689
|
})),
|
|
705
690
|
locale = _useApplicationContex.locale;
|
|
706
|
-
const _useApplicationContex2 = applicationShellConnectors.useApplicationContext(context => {
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key
|
|
710
|
-
};
|
|
711
|
-
}),
|
|
691
|
+
const _useApplicationContex2 = applicationShellConnectors.useApplicationContext(context => ({
|
|
692
|
+
projectKey: context.project?.key
|
|
693
|
+
})),
|
|
712
694
|
projectKey = _useApplicationContex2.projectKey;
|
|
713
|
-
const _useStorage = experimentalComponents.useStorage(
|
|
695
|
+
const _useStorage = experimentalComponents.useStorage(`${projectKey}/${OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION}`, {}),
|
|
714
696
|
_useStorage2 = _slicedToArray(_useStorage, 1),
|
|
715
697
|
cachedSelectedGroups = _useStorage2[0];
|
|
716
|
-
const _useStorage3 = experimentalComponents.useStorage(
|
|
717
|
-
[props.resourceType]: _reduceInstanceProperty__default["default"](
|
|
698
|
+
const _useStorage3 = experimentalComponents.useStorage(`${projectKey}/${OPERATIONS_EXPORT_RESOURCES_MODAL_EXPANDED_GROUP}`, {
|
|
699
|
+
[props.resourceType]: _reduceInstanceProperty__default["default"](_context = props.fieldGroups).call(_context, (acc, group) => {
|
|
718
700
|
acc[group.groupName] = group.isExpanded;
|
|
719
701
|
return acc;
|
|
720
702
|
}, {})
|
|
@@ -726,7 +708,7 @@ const useInitialValues = props => {
|
|
|
726
708
|
groups = updateFieldGroupsWithIsExpandedValue(groups, cachedExpandedGroups[props.resourceType] || {});
|
|
727
709
|
return {
|
|
728
710
|
outputFormat: props.outputFormat,
|
|
729
|
-
fileName:
|
|
711
|
+
fileName: `${resourceTypeToFileName(props.resourceType)}`,
|
|
730
712
|
locales: [locale],
|
|
731
713
|
groups: updateFieldGroupWithAdditionalFieldExtensions(groups)
|
|
732
714
|
};
|
|
@@ -742,7 +724,7 @@ async function createExportOperation(_ref) {
|
|
|
742
724
|
locales = _ref.locales,
|
|
743
725
|
filters = _ref.filters,
|
|
744
726
|
asyncDispatchFn = _ref.asyncDispatchFn;
|
|
745
|
-
const uri =
|
|
727
|
+
const uri = `/${projectKey}/export-operations`;
|
|
746
728
|
const response = await asyncDispatchFn(sdk.actions.post({
|
|
747
729
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.EXPORT,
|
|
748
730
|
uri: uri,
|
|
@@ -766,24 +748,20 @@ const useStartExportOperation = props => {
|
|
|
766
748
|
const intl = reactIntl.useIntl();
|
|
767
749
|
const asyncDispatch = sdk.useAsyncDispatch();
|
|
768
750
|
const showNotification = actionsGlobal.useShowNotification();
|
|
769
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => {
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
projectKey: (_applicationContext$p = applicationContext.project) === null || _applicationContext$p === void 0 ? void 0 : _applicationContext$p.key
|
|
774
|
-
};
|
|
775
|
-
}),
|
|
751
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
752
|
+
locale: applicationContext.dataLocale,
|
|
753
|
+
projectKey: applicationContext.project?.key
|
|
754
|
+
})),
|
|
776
755
|
projectKey = _useApplicationContex.projectKey;
|
|
777
756
|
const extractFieldsFromGroups = groups => {
|
|
778
757
|
let selectedGeneralFields = [];
|
|
779
758
|
const getSelectedFields = fields => {
|
|
780
759
|
return _filterInstanceProperty__default["default"](fields).call(fields, field => {
|
|
781
|
-
var _field$isChecked;
|
|
782
760
|
if (field.fields) {
|
|
783
761
|
return getSelectedFields(field.fields);
|
|
784
762
|
}
|
|
785
763
|
if (field.isChecked) selectedGeneralFields.push(field);
|
|
786
|
-
return
|
|
764
|
+
return field.isChecked ?? false;
|
|
787
765
|
});
|
|
788
766
|
};
|
|
789
767
|
_forEachInstanceProperty__default["default"](groups).call(groups, group => {
|
|
@@ -896,10 +874,10 @@ function ExportScopeSection() {
|
|
|
896
874
|
})
|
|
897
875
|
}), jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
898
876
|
value: EXPORT_TYPES.SELECTED,
|
|
899
|
-
isDisabled: !
|
|
877
|
+
isDisabled: !selectedResourceIds?.length,
|
|
900
878
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
901
|
-
tone: !
|
|
902
|
-
intlMessage: selectedResourceIds
|
|
879
|
+
tone: !selectedResourceIds?.length ? 'tertiary' : undefined,
|
|
880
|
+
intlMessage: selectedResourceIds?.length ? _objectSpread$5(_objectSpread$5({}, resourceTypeMessages[resourceType].exportScopeSelected), {}, {
|
|
903
881
|
values: {
|
|
904
882
|
total: intl.formatNumber(selectedResourceIds.length)
|
|
905
883
|
}
|
|
@@ -911,25 +889,21 @@ function ExportScopeSection() {
|
|
|
911
889
|
}
|
|
912
890
|
|
|
913
891
|
const ExportFileSettingsStep = () => {
|
|
914
|
-
var _context;
|
|
915
892
|
const intl = reactIntl.useIntl();
|
|
916
893
|
const _useExportResourcesCo = useExportResourcesContext(),
|
|
917
894
|
formik = _useExportResourcesCo.formik,
|
|
918
895
|
resourceType = _useExportResourcesCo.resourceType,
|
|
919
896
|
onClose = _useExportResourcesCo.onClose;
|
|
920
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => {
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
locales: ((_applicationContext$p = applicationContext.project) === null || _applicationContext$p === void 0 ? void 0 : _applicationContext$p.languages) || []
|
|
925
|
-
};
|
|
926
|
-
}),
|
|
897
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
898
|
+
locale: applicationContext.dataLocale,
|
|
899
|
+
locales: applicationContext.project?.languages || []
|
|
900
|
+
})),
|
|
927
901
|
locales = _useApplicationContex.locales,
|
|
928
902
|
locale = _useApplicationContex.locale;
|
|
929
903
|
const areAllLocalesChecked = _valuesInstanceProperty__default["default"](formik).locales.length === locales.length;
|
|
930
904
|
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
931
905
|
isOpen: true,
|
|
932
|
-
title: intl.formatMessage(messages[
|
|
906
|
+
title: intl.formatMessage(messages[`modalTitle.${resourceType}`]),
|
|
933
907
|
labelPrimary: intl.formatMessage(messages.continue),
|
|
934
908
|
onPrimaryButtonClick: formik.submitForm,
|
|
935
909
|
isPrimaryButtonDisabled: !formik.isValid,
|
|
@@ -943,7 +917,7 @@ const ExportFileSettingsStep = () => {
|
|
|
943
917
|
scale: "l",
|
|
944
918
|
children: jsxRuntime.jsxs(uiKit.Grid, {
|
|
945
919
|
gridRowGap: uiKit.designTokens.spacingL,
|
|
946
|
-
gridTemplateColumns:
|
|
920
|
+
gridTemplateColumns: `calc(${uiKit.designTokens.constraint3} + ${uiKit.designTokens.spacingL}) auto`,
|
|
947
921
|
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
948
922
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
949
923
|
intlMessage: messages.exportScope
|
|
@@ -1008,54 +982,20 @@ const ExportFileSettingsStep = () => {
|
|
|
1008
982
|
});
|
|
1009
983
|
};
|
|
1010
984
|
|
|
1011
|
-
var _ref$1 = {
|
|
1012
|
-
name: "ti75j2",
|
|
1013
|
-
styles: "margin:0"
|
|
1014
|
-
} ;
|
|
1015
|
-
const NoSearchResults = () => {
|
|
1016
|
-
return jsxRuntime.jsxs(uiKit.Card, {
|
|
1017
|
-
insetScale: "xl",
|
|
1018
|
-
children: [jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1019
|
-
scale: "s",
|
|
1020
|
-
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1021
|
-
fontWeight: "medium",
|
|
1022
|
-
intlMessage: messages.thereAreNoResults
|
|
1023
|
-
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1024
|
-
intlMessage: messages.suggestions
|
|
1025
|
-
})]
|
|
1026
|
-
}), jsxRuntime.jsxs("ul", {
|
|
1027
|
-
css: _ref$1,
|
|
1028
|
-
children: [jsxRuntime.jsx("li", {
|
|
1029
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1030
|
-
intlMessage: messages.checkTheSpelling
|
|
1031
|
-
})
|
|
1032
|
-
}), jsxRuntime.jsx("li", {
|
|
1033
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1034
|
-
intlMessage: messages.searchByEnteringTheExactFieldName
|
|
1035
|
-
})
|
|
1036
|
-
})]
|
|
1037
|
-
})]
|
|
1038
|
-
});
|
|
1039
|
-
};
|
|
1040
|
-
|
|
1041
985
|
function ownKeys$4(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1042
|
-
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
986
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$4(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$4(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1043
987
|
const exportFieldSelectionContextDefaultValues = {
|
|
1044
988
|
updateExpandedGroups: (_name, _value) => {}
|
|
1045
989
|
};
|
|
1046
990
|
const ExportFieldSelectionContext = /*#__PURE__*/React.createContext(exportFieldSelectionContextDefaultValues);
|
|
1047
991
|
const ExportFieldSelectionProvider = _ref => {
|
|
1048
|
-
var _context;
|
|
1049
992
|
let resourceType = _ref.resourceType,
|
|
1050
993
|
children = _ref.children;
|
|
1051
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => {
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key
|
|
1055
|
-
};
|
|
1056
|
-
}),
|
|
994
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
995
|
+
projectKey: context.project?.key
|
|
996
|
+
})),
|
|
1057
997
|
projectKey = _useApplicationContex.projectKey;
|
|
1058
|
-
const _useStorage = experimentalComponents.useStorage(
|
|
998
|
+
const _useStorage = experimentalComponents.useStorage(`${projectKey}/${OPERATIONS_EXPORT_RESOURCES_MODAL_EXPANDED_GROUP}`, {}),
|
|
1059
999
|
_useStorage2 = _slicedToArray(_useStorage, 2),
|
|
1060
1000
|
cachedExpandedGroups = _useStorage2[0],
|
|
1061
1001
|
setCachedExpandedGroups = _useStorage2[1];
|
|
@@ -1093,20 +1033,18 @@ const calculateTotalSelectedFields = (group, formik) => {
|
|
|
1093
1033
|
// check `isReadOnly` fields
|
|
1094
1034
|
function countReadOnlyDependentFields(fields) {
|
|
1095
1035
|
_forEachInstanceProperty__default["default"](fields).call(fields, field => {
|
|
1096
|
-
var _field$dependentGroup;
|
|
1097
1036
|
if (field.fields) {
|
|
1098
1037
|
countReadOnlyDependentFields(field.fields);
|
|
1099
|
-
} else if (
|
|
1038
|
+
} else if (field.dependentGroupNames?.length && isRequiredGroupChecked(field.dependentGroupNames, formik)) {
|
|
1100
1039
|
result += 1;
|
|
1101
1040
|
}
|
|
1102
1041
|
});
|
|
1103
1042
|
}
|
|
1104
1043
|
function countReadOnlyFields(fields) {
|
|
1105
1044
|
_forEachInstanceProperty__default["default"](fields).call(fields, field => {
|
|
1106
|
-
var _field$dependentGroup2;
|
|
1107
1045
|
if (field.fields) {
|
|
1108
1046
|
countReadOnlyFields(field.fields);
|
|
1109
|
-
} else if (field.isReadOnly && !
|
|
1047
|
+
} else if (field.isReadOnly && !field.dependentGroupNames?.length) {
|
|
1110
1048
|
result += 1;
|
|
1111
1049
|
}
|
|
1112
1050
|
});
|
|
@@ -1163,7 +1101,7 @@ const CollapsibleFieldWrapper = _ref => {
|
|
|
1163
1101
|
registerContentNode
|
|
1164
1102
|
});
|
|
1165
1103
|
}
|
|
1166
|
-
},
|
|
1104
|
+
}, `${isForceExpanded}`);
|
|
1167
1105
|
return children({
|
|
1168
1106
|
isOpen: true,
|
|
1169
1107
|
toggle: () => {},
|
|
@@ -1181,8 +1119,7 @@ const FieldSection = _ref3 => {
|
|
|
1181
1119
|
updateExpandedGroups = _useExportFieldSelect.updateExpandedGroups;
|
|
1182
1120
|
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
1183
1121
|
scale: "s",
|
|
1184
|
-
children: fields
|
|
1185
|
-
var _context;
|
|
1122
|
+
children: fields?.map((field, index) => {
|
|
1186
1123
|
const isAnyOfTheChildFieldsChecked = checkAtLeastOneFieldChecked(field.fields);
|
|
1187
1124
|
const allAllFieldsSelected = checkAllFieldsSelected(field.fields || []);
|
|
1188
1125
|
const checkIsChecked = () => {
|
|
@@ -1202,7 +1139,6 @@ const FieldSection = _ref3 => {
|
|
|
1202
1139
|
isForceExpanded: isForceExpanded,
|
|
1203
1140
|
field: field,
|
|
1204
1141
|
children: _ref4 => {
|
|
1205
|
-
var _context2, _field$fields3;
|
|
1206
1142
|
let isOpen = _ref4.isOpen,
|
|
1207
1143
|
toggle = _ref4.toggle,
|
|
1208
1144
|
registerContentNode = _ref4.registerContentNode;
|
|
@@ -1212,12 +1148,11 @@ const FieldSection = _ref3 => {
|
|
|
1212
1148
|
size: "20",
|
|
1213
1149
|
style: {
|
|
1214
1150
|
position: 'absolute',
|
|
1215
|
-
left:
|
|
1151
|
+
left: `calc(-1 * ${uiKit.designTokens.spacingXl})`
|
|
1216
1152
|
},
|
|
1217
1153
|
onClick: () => {
|
|
1218
1154
|
if (!isForceExpanded) {
|
|
1219
|
-
|
|
1220
|
-
updateExpandedGroups(_concatInstanceProperty__default["default"](_context3 = "".concat(groupName, ".")).call(_context3, field.name), !isOpen);
|
|
1155
|
+
updateExpandedGroups(`${groupName}.${field.name}`, !isOpen);
|
|
1221
1156
|
}
|
|
1222
1157
|
toggle();
|
|
1223
1158
|
},
|
|
@@ -1231,18 +1166,16 @@ const FieldSection = _ref3 => {
|
|
|
1231
1166
|
isChecked: checkIsChecked(),
|
|
1232
1167
|
isReadOnly: field.isReadOnly || field.isRequired,
|
|
1233
1168
|
onChange: e => {
|
|
1234
|
-
|
|
1235
|
-
const path = _concatInstanceProperty__default["default"](_context4 = "".concat(parentKeys.join('.'), ".fields[")).call(_context4, index, "]");
|
|
1169
|
+
const path = `${parentKeys.join('.')}.fields[${index}]`;
|
|
1236
1170
|
// Update all child fields
|
|
1237
1171
|
const updateAllChildFieldsChecked = (path, checked) => {
|
|
1238
1172
|
const item = get__default["default"](_valuesInstanceProperty__default["default"](formik), path);
|
|
1239
1173
|
if (item && item.fields) {
|
|
1240
|
-
var
|
|
1241
|
-
_forEachInstanceProperty__default["default"](
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
formik.setFieldValue("".concat(fieldPath, ".isChecked"), checked,
|
|
1174
|
+
var _context;
|
|
1175
|
+
_forEachInstanceProperty__default["default"](_context = item.fields).call(_context, (field, i) => {
|
|
1176
|
+
const fieldPath = `${path}.fields[${i}]`;
|
|
1177
|
+
if (!field.fields?.length) {
|
|
1178
|
+
formik.setFieldValue(`${fieldPath}.isChecked`, checked,
|
|
1246
1179
|
// pass `false` to avoid revalidating the form with intermediate values
|
|
1247
1180
|
false);
|
|
1248
1181
|
}
|
|
@@ -1250,8 +1183,8 @@ const FieldSection = _ref3 => {
|
|
|
1250
1183
|
});
|
|
1251
1184
|
}
|
|
1252
1185
|
};
|
|
1253
|
-
if (!
|
|
1254
|
-
formik.setFieldValue(
|
|
1186
|
+
if (!field.fields?.length) {
|
|
1187
|
+
formik.setFieldValue(`${path}.isChecked`, e.target.checked,
|
|
1255
1188
|
// pass `false` to avoid revalidating the form with intermediate values
|
|
1256
1189
|
false);
|
|
1257
1190
|
}
|
|
@@ -1260,7 +1193,7 @@ const FieldSection = _ref3 => {
|
|
|
1260
1193
|
children: [field.label, (field.isReadOnly || field.isRequired) && ' *']
|
|
1261
1194
|
})
|
|
1262
1195
|
})]
|
|
1263
|
-
}), field.fields &&
|
|
1196
|
+
}), field.fields && field.fields?.length > 0 && jsxRuntime.jsx(StyledExpandableContent, {
|
|
1264
1197
|
ref: registerContentNode,
|
|
1265
1198
|
isOpen: isOpen,
|
|
1266
1199
|
children: jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
@@ -1268,16 +1201,16 @@ const FieldSection = _ref3 => {
|
|
|
1268
1201
|
children: [jsxRuntime.jsx("div", {}), jsxRuntime.jsx(FieldSection, {
|
|
1269
1202
|
fields: field.fields,
|
|
1270
1203
|
formik: formik,
|
|
1271
|
-
parentKeys: [...parentKeys,
|
|
1204
|
+
parentKeys: [...parentKeys, `fields[${index}]`],
|
|
1272
1205
|
isAnySiblingChecked: isAnySiblingChecked,
|
|
1273
1206
|
isForceExpanded: isForceExpanded,
|
|
1274
1207
|
groupName: groupName
|
|
1275
1208
|
})]
|
|
1276
1209
|
})
|
|
1277
1210
|
})]
|
|
1278
|
-
},
|
|
1211
|
+
}, `${field.name}-${index}`);
|
|
1279
1212
|
}
|
|
1280
|
-
},
|
|
1213
|
+
}, `${field.name}.${isForceExpanded}`);
|
|
1281
1214
|
})
|
|
1282
1215
|
});
|
|
1283
1216
|
};
|
|
@@ -1290,13 +1223,13 @@ const StyledGroupCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
|
1290
1223
|
const StyledFieldsCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
1291
1224
|
target: "e1igkh7t1"
|
|
1292
1225
|
} )("border-radius:0;", props => props.showTopBorder && /*#__PURE__*/react.css("border-top:", uiKit.designTokens.borderWidth1, " solid ", uiKit.designTokens.colorNeutral90, ";" + ("" ), "" ), ";" + ("" ));
|
|
1293
|
-
var _ref = {
|
|
1226
|
+
var _ref$1 = {
|
|
1294
1227
|
name: "2ce4ng",
|
|
1295
1228
|
styles: "overflow:hidden;height:0;margin-top:0!important"
|
|
1296
1229
|
} ;
|
|
1297
1230
|
const StyledExpandableContent = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1298
1231
|
target: "e1igkh7t0"
|
|
1299
|
-
} )(props => !props.isOpen && _ref, " ", props => !props.isOpen && props.showTopBorder && /*#__PURE__*/react.css("border-top:", uiKit.designTokens.borderWidth1, " solid ", uiKit.designTokens.colorNeutral90, ";" + ("" ), "" ), ";" + ("" ));
|
|
1232
|
+
} )(props => !props.isOpen && _ref$1, " ", props => !props.isOpen && props.showTopBorder && /*#__PURE__*/react.css("border-top:", uiKit.designTokens.borderWidth1, " solid ", uiKit.designTokens.colorNeutral90, ";" + ("" ), "" ), ";" + ("" ));
|
|
1300
1233
|
const FieldGroupSection = _ref2 => {
|
|
1301
1234
|
let group = _ref2.group,
|
|
1302
1235
|
index = _ref2.index,
|
|
@@ -1306,7 +1239,7 @@ const FieldGroupSection = _ref2 => {
|
|
|
1306
1239
|
const isAtleastOneFieldChecked = React.useMemo(() => checkAtLeastOneFieldChecked(group.fields), [group.fields]);
|
|
1307
1240
|
const _useExportFieldSelect = useExportFieldSelectionContext(),
|
|
1308
1241
|
updateExpandedGroups = _useExportFieldSelect.updateExpandedGroups;
|
|
1309
|
-
const parentKey =
|
|
1242
|
+
const parentKey = `groups[${index}]`;
|
|
1310
1243
|
const handleChangeAllFields = e => {
|
|
1311
1244
|
const item = get__default["default"](_valuesInstanceProperty__default["default"](formik), parentKey);
|
|
1312
1245
|
function updateAllFields(fields, checked) {
|
|
@@ -1389,11 +1322,41 @@ const FieldGroupSection = _ref2 => {
|
|
|
1389
1322
|
})]
|
|
1390
1323
|
});
|
|
1391
1324
|
}
|
|
1392
|
-
},
|
|
1325
|
+
}, `${isForceExpanded}`);
|
|
1326
|
+
};
|
|
1327
|
+
|
|
1328
|
+
var _ref = {
|
|
1329
|
+
name: "ti75j2",
|
|
1330
|
+
styles: "margin:0"
|
|
1331
|
+
} ;
|
|
1332
|
+
const NoSearchResults = () => {
|
|
1333
|
+
return jsxRuntime.jsxs(uiKit.Card, {
|
|
1334
|
+
insetScale: "xl",
|
|
1335
|
+
children: [jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1336
|
+
scale: "s",
|
|
1337
|
+
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1338
|
+
fontWeight: "medium",
|
|
1339
|
+
intlMessage: messages.thereAreNoResults
|
|
1340
|
+
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1341
|
+
intlMessage: messages.suggestions
|
|
1342
|
+
})]
|
|
1343
|
+
}), jsxRuntime.jsxs("ul", {
|
|
1344
|
+
css: _ref,
|
|
1345
|
+
children: [jsxRuntime.jsx("li", {
|
|
1346
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1347
|
+
intlMessage: messages.checkTheSpelling
|
|
1348
|
+
})
|
|
1349
|
+
}), jsxRuntime.jsx("li", {
|
|
1350
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1351
|
+
intlMessage: messages.searchByEnteringTheExactFieldName
|
|
1352
|
+
})
|
|
1353
|
+
})]
|
|
1354
|
+
})]
|
|
1355
|
+
});
|
|
1393
1356
|
};
|
|
1394
1357
|
|
|
1395
1358
|
function ownKeys$2(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1396
|
-
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
1359
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context5 = ownKeys$2(Object(t), !0)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context6 = ownKeys$2(Object(t))).call(_context6, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1397
1360
|
const StyledGridCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
1398
1361
|
target: "e5mvpn60"
|
|
1399
1362
|
} )({
|
|
@@ -1401,20 +1364,16 @@ const StyledGridCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
|
1401
1364
|
styles: "max-height:50vh;overflow:auto"
|
|
1402
1365
|
} );
|
|
1403
1366
|
const ExportFieldsSelectionStep = () => {
|
|
1404
|
-
var _context, _context7, _context8;
|
|
1405
1367
|
const intl = reactIntl.useIntl();
|
|
1406
1368
|
const _React$useState = React__default["default"].useState(''),
|
|
1407
1369
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1408
1370
|
fieldSearchTerm = _React$useState2[0],
|
|
1409
1371
|
setFieldSearchTerm = _React$useState2[1];
|
|
1410
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => {
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key
|
|
1414
|
-
};
|
|
1415
|
-
}),
|
|
1372
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
1373
|
+
projectKey: context.project?.key
|
|
1374
|
+
})),
|
|
1416
1375
|
projectKey = _useApplicationContex.projectKey;
|
|
1417
|
-
const _useStorage = experimentalComponents.useStorage(
|
|
1376
|
+
const _useStorage = experimentalComponents.useStorage(`${projectKey}/${OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION}`, {}),
|
|
1418
1377
|
_useStorage2 = _slicedToArray(_useStorage, 2);
|
|
1419
1378
|
_useStorage2[0];
|
|
1420
1379
|
const setCachedSelectedGroups = _useStorage2[1];
|
|
@@ -1424,19 +1383,18 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1424
1383
|
resourceType = _useExportResourcesCo.resourceType,
|
|
1425
1384
|
onClose = _useExportResourcesCo.onClose;
|
|
1426
1385
|
React__default["default"].useEffect(() => {
|
|
1427
|
-
var
|
|
1386
|
+
var _context2;
|
|
1428
1387
|
formik.validateForm();
|
|
1429
1388
|
const selectedFields = {};
|
|
1430
1389
|
function getSelectedFields(field, groupName) {
|
|
1431
|
-
|
|
1432
|
-
const fieldName = field.name ? _concatInstanceProperty__default["default"](_context2 = "".concat(groupName, ".")).call(_context2, field.name) : groupName;
|
|
1390
|
+
const fieldName = field.name ? `${groupName}.${field.name}` : groupName;
|
|
1433
1391
|
if (field.fields) {
|
|
1434
|
-
var
|
|
1435
|
-
return _forEachInstanceProperty__default["default"](
|
|
1392
|
+
var _context;
|
|
1393
|
+
return _forEachInstanceProperty__default["default"](_context = field.fields).call(_context, f => getSelectedFields(f, fieldName));
|
|
1436
1394
|
}
|
|
1437
1395
|
selectedFields[fieldName] = field.isChecked;
|
|
1438
1396
|
}
|
|
1439
|
-
_forEachInstanceProperty__default["default"](
|
|
1397
|
+
_forEachInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](formik).groups).call(_context2, group => getSelectedFields(group, group.groupLabel));
|
|
1440
1398
|
setCachedSelectedGroups({
|
|
1441
1399
|
[resourceType]: selectedFields
|
|
1442
1400
|
});
|
|
@@ -1444,11 +1402,11 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1444
1402
|
}, [_valuesInstanceProperty__default["default"](formik).groups]);
|
|
1445
1403
|
// adds `isHidden` property to each field based on search term
|
|
1446
1404
|
const filteredGroups = React__default["default"].useMemo(() => {
|
|
1447
|
-
var
|
|
1405
|
+
var _context4;
|
|
1448
1406
|
const updateFields = (fields, parentMatches) => {
|
|
1449
1407
|
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
1450
|
-
var
|
|
1451
|
-
const matches = _includesInstanceProperty__default["default"](
|
|
1408
|
+
var _context3;
|
|
1409
|
+
const matches = _includesInstanceProperty__default["default"](_context3 = field.label.toLowerCase()).call(_context3, fieldSearchTerm.toLowerCase());
|
|
1452
1410
|
let isHidden = !matches && !parentMatches;
|
|
1453
1411
|
if (field.fields) {
|
|
1454
1412
|
const updatedFields = updateFields(field.fields, matches);
|
|
@@ -1462,8 +1420,8 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1462
1420
|
});
|
|
1463
1421
|
});
|
|
1464
1422
|
};
|
|
1465
|
-
if (!
|
|
1466
|
-
return _mapInstanceProperty__default["default"](
|
|
1423
|
+
if (!fieldSearchTerm?.trim()?.length) return _valuesInstanceProperty__default["default"](formik).groups;
|
|
1424
|
+
return _mapInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](formik).groups).call(_context4, group => {
|
|
1467
1425
|
const updatedFields = updateFields(group.fields, false);
|
|
1468
1426
|
const isHidden = _everyInstanceProperty__default["default"](updatedFields).call(updatedFields, field => field.isHidden);
|
|
1469
1427
|
return _objectSpread$2(_objectSpread$2({}, group), {}, {
|
|
@@ -1507,16 +1465,13 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1507
1465
|
insetScale: "none",
|
|
1508
1466
|
children: jsxRuntime.jsx(uiKit.Grid, {
|
|
1509
1467
|
gridAutoFlow: "row",
|
|
1510
|
-
gridTemplateColumns:
|
|
1511
|
-
children: _mapInstanceProperty__default["default"](filteredGroups).call(filteredGroups, (group, index) => {
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
isForceExpanded: (fieldSearchTerm === null || fieldSearchTerm === void 0 || (_fieldSearchTerm$trim2 = _trimInstanceProperty__default["default"](fieldSearchTerm).call(fieldSearchTerm)) === null || _fieldSearchTerm$trim2 === void 0 ? void 0 : _fieldSearchTerm$trim2.length) > 0
|
|
1518
|
-
}, group.groupLabel);
|
|
1519
|
-
})
|
|
1468
|
+
gridTemplateColumns: `calc(${uiKit.designTokens.spacingL} + ${uiKit.designTokens.constraint5} + ${uiKit.designTokens.spacingL}) auto`,
|
|
1469
|
+
children: _mapInstanceProperty__default["default"](filteredGroups).call(filteredGroups, (group, index) => jsxRuntime.jsx(FieldGroupSection, {
|
|
1470
|
+
group: group,
|
|
1471
|
+
index: index,
|
|
1472
|
+
formik: formik,
|
|
1473
|
+
isForceExpanded: fieldSearchTerm?.trim()?.length > 0
|
|
1474
|
+
}, group.groupLabel))
|
|
1520
1475
|
})
|
|
1521
1476
|
}) : jsxRuntime.jsx(NoSearchResults, {})]
|
|
1522
1477
|
})
|
|
@@ -1617,8 +1572,8 @@ const loadMessages = async locale => {
|
|
|
1617
1572
|
return i18n.parseChunkImport(chunkImport);
|
|
1618
1573
|
} catch (error) {
|
|
1619
1574
|
// eslint-disable-next-line no-console
|
|
1620
|
-
console.warn(
|
|
1621
|
-
sentry.reportErrorToSentry(new Error(
|
|
1575
|
+
console.warn(`Something went wrong while loading the export-resources-modal messages for ${locale}`, error);
|
|
1576
|
+
sentry.reportErrorToSentry(new Error(`Something went wrong while loading the export-resources-modal messages for ${locale}`), {
|
|
1622
1577
|
extra: error
|
|
1623
1578
|
});
|
|
1624
1579
|
return {};
|