@commercetools-frontend-extensions/export-resources-modal 4.1.1 → 4.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.dev.js +144 -185
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.prod.js +141 -182
- package/dist/commercetools-frontend-extensions-export-resources-modal.esm.js +142 -182
- package/dist/{de-2053e30c.esm.js → de-46061c8d.esm.js} +20 -0
- package/dist/{de-061f704f.cjs.prod.js → de-82710cdd.cjs.dev.js} +20 -0
- package/dist/{de-ab9aa191.cjs.dev.js → de-b9d63c63.cjs.prod.js} +20 -0
- package/dist/declarations/src/@constants/index.d.ts +1 -0
- package/dist/declarations/src/@constants/resource-type-messages.d.ts +2 -0
- package/dist/declarations/src/@constants/urls.d.ts +2 -3
- package/dist/declarations/src/@types/index.d.ts +1 -0
- package/dist/declarations/src/@types/resource-type.d.ts +7 -0
- package/dist/{en-7a050c00.cjs.prod.js → en-3ff78dd6.cjs.prod.js} +33 -25
- package/dist/{en-30e710ff.cjs.dev.js → en-824a97a4.cjs.dev.js} +33 -25
- package/dist/{en-1f28eeaa.esm.js → en-918b9076.esm.js} +33 -25
- package/dist/{es-294da86d.cjs.prod.js → es-27083d0c.cjs.prod.js} +20 -0
- package/dist/{es-b57ba755.cjs.dev.js → es-4070c248.cjs.dev.js} +20 -0
- package/dist/{es-6f6ac776.esm.js → es-bc8419ea.esm.js} +20 -0
- package/dist/{fr-FR-65460b2c.esm.js → fr-FR-88c9c9ec.esm.js} +20 -0
- package/dist/{fr-FR-5ed7b9c1.cjs.prod.js → fr-FR-8f0fa6f5.cjs.dev.js} +20 -0
- package/dist/{fr-FR-d7209a15.cjs.dev.js → fr-FR-a10662d7.cjs.prod.js} +20 -0
- package/dist/{pt-BR-7c94da38.cjs.dev.js → pt-BR-6dc77a9e.cjs.dev.js} +32 -24
- package/dist/{pt-BR-50312992.esm.js → pt-BR-aef7dfa4.esm.js} +32 -24
- package/dist/{pt-BR-6eb85adb.cjs.prod.js → pt-BR-b8807555.cjs.prod.js} +32 -24
- package/dist/{zh-CN-db13f016.esm.js → zh-CN-5b6b0a01.esm.js} +20 -0
- package/dist/{zh-CN-a4a57cea.cjs.dev.js → zh-CN-8bc9c078.cjs.dev.js} +20 -0
- package/dist/{zh-CN-b1180dfd.cjs.prod.js → zh-CN-ed634d04.cjs.prod.js} +20 -0
- package/package.json +15 -15
|
@@ -16,26 +16,26 @@ 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 React = require('react');
|
|
22
21
|
var _Reflect$construct = require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
|
|
23
22
|
var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
|
|
24
23
|
var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
25
|
-
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
26
24
|
var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
|
|
27
25
|
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
26
|
+
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
28
27
|
var _wrapNativeSuper = require('@babel/runtime-corejs3/helpers/wrapNativeSuper');
|
|
29
28
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
30
|
-
var moment = require('moment');
|
|
31
29
|
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
32
30
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
31
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
33
32
|
var omitEmpty = require('omit-empty-es');
|
|
34
33
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
35
34
|
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
36
35
|
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
37
36
|
var _sortInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/sort');
|
|
38
37
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
38
|
+
var moment = require('moment');
|
|
39
39
|
var experimentalComponents = require('@commercetools-frontend/experimental-components');
|
|
40
40
|
var sdk = require('@commercetools-frontend/sdk');
|
|
41
41
|
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
@@ -43,7 +43,6 @@ var constants = require('@commercetools-frontend/constants');
|
|
|
43
43
|
var _styled = require('@emotion/styled/base');
|
|
44
44
|
var _everyInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/every');
|
|
45
45
|
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
46
|
-
var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
|
|
47
46
|
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
48
47
|
var throttle = require('lodash/throttle');
|
|
49
48
|
var react = require('@emotion/react');
|
|
@@ -64,22 +63,21 @@ 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
|
-
var moment__default = /*#__PURE__*/_interopDefault(moment);
|
|
71
68
|
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
72
69
|
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
70
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
73
71
|
var omitEmpty__default = /*#__PURE__*/_interopDefault(omitEmpty);
|
|
74
72
|
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
75
73
|
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
76
74
|
var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
77
75
|
var _sortInstanceProperty__default = /*#__PURE__*/_interopDefault(_sortInstanceProperty);
|
|
78
76
|
var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
|
|
77
|
+
var moment__default = /*#__PURE__*/_interopDefault(moment);
|
|
79
78
|
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
80
79
|
var _everyInstanceProperty__default = /*#__PURE__*/_interopDefault(_everyInstanceProperty);
|
|
81
80
|
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
82
|
-
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
|
|
83
81
|
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
84
82
|
var throttle__default = /*#__PURE__*/_interopDefault(throttle);
|
|
85
83
|
var get__default = /*#__PURE__*/_interopDefault(get);
|
|
@@ -97,10 +95,15 @@ function getNewLine() {
|
|
|
97
95
|
}
|
|
98
96
|
|
|
99
97
|
var messages = reactIntl.defineMessages({
|
|
100
|
-
modalTitle: {
|
|
101
|
-
id: 'ExportResourcesModal.modalTitle',
|
|
102
|
-
description: 'Label for the modal title',
|
|
103
|
-
defaultMessage: 'Export
|
|
98
|
+
'modalTitle.category': {
|
|
99
|
+
id: 'ExportResourcesModal.modalTitle.category',
|
|
100
|
+
description: 'Label for the categories modal title',
|
|
101
|
+
defaultMessage: 'Export categories'
|
|
102
|
+
},
|
|
103
|
+
'modalTitle.product': {
|
|
104
|
+
id: 'ExportResourcesModal.modalTitle.product',
|
|
105
|
+
description: 'Label for the products modal title',
|
|
106
|
+
defaultMessage: 'Export products'
|
|
104
107
|
},
|
|
105
108
|
outputFormat: {
|
|
106
109
|
id: 'ExportResourcesModal.outputFormat',
|
|
@@ -117,36 +120,6 @@ var messages = reactIntl.defineMessages({
|
|
|
117
120
|
description: 'Locale',
|
|
118
121
|
defaultMessage: 'Locale'
|
|
119
122
|
},
|
|
120
|
-
exportSelection: {
|
|
121
|
-
id: 'ExportResourcesModal.exportSelection',
|
|
122
|
-
description: 'Export selection',
|
|
123
|
-
defaultMessage: 'Export selection'
|
|
124
|
-
},
|
|
125
|
-
exportAllResources: {
|
|
126
|
-
id: 'ExportResourcesModal.exportAllResources',
|
|
127
|
-
description: 'Export All selection',
|
|
128
|
-
defaultMessage: 'Export all {resourceType} ({count})'
|
|
129
|
-
},
|
|
130
|
-
exportOnlySelectedResources: {
|
|
131
|
-
id: 'ExportResourcesModal.exportOnlySelectedResources',
|
|
132
|
-
description: 'Export only selected resources',
|
|
133
|
-
defaultMessage: 'Export selected {resourceType} ({count})'
|
|
134
|
-
},
|
|
135
|
-
exportAllMessage: {
|
|
136
|
-
id: 'ExportResourcesModal.exportAllMessage',
|
|
137
|
-
description: 'All resources will be exported',
|
|
138
|
-
defaultMessage: 'All <b>{count}</b> {resourceType} will be exported.'
|
|
139
|
-
},
|
|
140
|
-
exportMatchingMessage: {
|
|
141
|
-
id: 'ExportResourcesModal.exportMatchingMessage',
|
|
142
|
-
description: 'resources will be exported',
|
|
143
|
-
defaultMessage: '<b>{count}</b> {resourceType} will be exported.'
|
|
144
|
-
},
|
|
145
|
-
exportSelectedMessage: {
|
|
146
|
-
id: 'ExportResourcesModal.exportSelectedMessage',
|
|
147
|
-
description: 'resources are selected and will be exported',
|
|
148
|
-
defaultMessage: '<b>{count}</b> {resourceType} are selected and will be exported.'
|
|
149
|
-
},
|
|
150
123
|
exportBasedOnMyViewsMessage: {
|
|
151
124
|
id: 'ExportResourcesModal.exportBasedOnMyViewsMessage',
|
|
152
125
|
description: 'Select Export setttings based on my views',
|
|
@@ -251,15 +224,30 @@ var messages = reactIntl.defineMessages({
|
|
|
251
224
|
description: 'Label for Export Scope',
|
|
252
225
|
defaultMessage: 'Scope'
|
|
253
226
|
},
|
|
254
|
-
|
|
255
|
-
id: 'ExportResourcesModal.
|
|
256
|
-
description: 'Label for Export All',
|
|
227
|
+
exportScopeAllCategories: {
|
|
228
|
+
id: 'ExportResourcesModal.exportScopeAllCategories',
|
|
229
|
+
description: 'Label for Export All categories',
|
|
257
230
|
defaultMessage: 'Export all: {total} categories'
|
|
258
231
|
},
|
|
259
|
-
|
|
260
|
-
id: 'ExportResourcesModal.
|
|
261
|
-
description: 'Label for Export Selected',
|
|
262
|
-
defaultMessage: 'Export selected
|
|
232
|
+
exportScopeSelectedCategories: {
|
|
233
|
+
id: 'ExportResourcesModal.exportScopeSelectedCategories',
|
|
234
|
+
description: 'Label for Export Selected categories',
|
|
235
|
+
defaultMessage: 'Export selected: {total} categories'
|
|
236
|
+
},
|
|
237
|
+
exportScopeAllProducts: {
|
|
238
|
+
id: 'ExportResourcesModal.exportScopeAllProducts',
|
|
239
|
+
description: 'Label for Export All products',
|
|
240
|
+
defaultMessage: 'Export all: {total} products'
|
|
241
|
+
},
|
|
242
|
+
exportScopeSelectedProducts: {
|
|
243
|
+
id: 'ExportResourcesModal.exportScopeSelectedProducts',
|
|
244
|
+
description: 'Label for Export Selected products',
|
|
245
|
+
defaultMessage: 'Export selected: {total} products'
|
|
246
|
+
},
|
|
247
|
+
exportScopeSelectedWithoutCount: {
|
|
248
|
+
id: 'ExportResourcesModal.exportScopeSelectedWithoutCount',
|
|
249
|
+
description: 'Label for Export Selected without count',
|
|
250
|
+
defaultMessage: 'Export selected'
|
|
263
251
|
},
|
|
264
252
|
exportSettings: {
|
|
265
253
|
id: 'ExportResourcesModal.exportSettings',
|
|
@@ -289,63 +277,59 @@ function renderLocaleError(key) {
|
|
|
289
277
|
}
|
|
290
278
|
}
|
|
291
279
|
|
|
292
|
-
function
|
|
280
|
+
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)); }
|
|
293
281
|
function _isNativeReflectConstruct$3() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$3 = function () { return !!t; })(); }
|
|
294
282
|
let MissingExportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
295
|
-
_inherits(MissingExportResourceProviderError, _Error);
|
|
296
|
-
var _super = _createSuper$3(MissingExportResourceProviderError);
|
|
297
283
|
function MissingExportResourceProviderError() {
|
|
298
284
|
var _this;
|
|
299
285
|
_classCallCheck(this, MissingExportResourceProviderError);
|
|
300
|
-
_this =
|
|
286
|
+
_this = _callSuper$3(this, MissingExportResourceProviderError, ['useExportResourcesContext must be used within ExportResourcesProvider']);
|
|
301
287
|
_this.name = 'MissingExportResourceProviderError';
|
|
302
288
|
return _this;
|
|
303
289
|
}
|
|
290
|
+
_inherits(MissingExportResourceProviderError, _Error);
|
|
304
291
|
return _createClass(MissingExportResourceProviderError);
|
|
305
292
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
306
293
|
|
|
307
|
-
function
|
|
294
|
+
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)); }
|
|
308
295
|
function _isNativeReflectConstruct$2() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$2 = function () { return !!t; })(); }
|
|
309
296
|
let UnexpectedExportOperationStateError = /*#__PURE__*/function (_Error) {
|
|
310
|
-
_inherits(UnexpectedExportOperationStateError, _Error);
|
|
311
|
-
var _super = _createSuper$2(UnexpectedExportOperationStateError);
|
|
312
297
|
function UnexpectedExportOperationStateError(state) {
|
|
313
298
|
var _this;
|
|
314
299
|
_classCallCheck(this, UnexpectedExportOperationStateError);
|
|
315
|
-
_this =
|
|
300
|
+
_this = _callSuper$2(this, UnexpectedExportOperationStateError, [`Unexpected export operation state "${state}"`]);
|
|
316
301
|
_this.name = 'UnexpectedExportOperationStateError';
|
|
317
302
|
return _this;
|
|
318
303
|
}
|
|
304
|
+
_inherits(UnexpectedExportOperationStateError, _Error);
|
|
319
305
|
return _createClass(UnexpectedExportOperationStateError);
|
|
320
306
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
321
307
|
|
|
322
|
-
function
|
|
308
|
+
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)); }
|
|
323
309
|
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function () { return !!t; })(); }
|
|
324
310
|
let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
|
|
325
|
-
_inherits(UnexpectedResourceTypeError, _Error);
|
|
326
|
-
var _super = _createSuper$1(UnexpectedResourceTypeError);
|
|
327
311
|
function UnexpectedResourceTypeError(resourceType) {
|
|
328
312
|
var _this;
|
|
329
313
|
_classCallCheck(this, UnexpectedResourceTypeError);
|
|
330
|
-
_this =
|
|
314
|
+
_this = _callSuper$1(this, UnexpectedResourceTypeError, [`Unexpected resource type "${resourceType}"`]);
|
|
331
315
|
_this.name = 'UnexpectedResourceTypeError';
|
|
332
316
|
return _this;
|
|
333
317
|
}
|
|
318
|
+
_inherits(UnexpectedResourceTypeError, _Error);
|
|
334
319
|
return _createClass(UnexpectedResourceTypeError);
|
|
335
320
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
336
321
|
|
|
337
|
-
function
|
|
322
|
+
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)); }
|
|
338
323
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
339
324
|
let InvalidResponseError = /*#__PURE__*/function (_Error) {
|
|
340
|
-
_inherits(InvalidResponseError, _Error);
|
|
341
|
-
var _super = _createSuper(InvalidResponseError);
|
|
342
325
|
function InvalidResponseError(message) {
|
|
343
326
|
var _this;
|
|
344
327
|
_classCallCheck(this, InvalidResponseError);
|
|
345
|
-
_this =
|
|
328
|
+
_this = _callSuper(this, InvalidResponseError, [message]);
|
|
346
329
|
_this.name = 'InvalidResponseError';
|
|
347
330
|
return _this;
|
|
348
331
|
}
|
|
332
|
+
_inherits(InvalidResponseError, _Error);
|
|
349
333
|
return _createClass(InvalidResponseError);
|
|
350
334
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
351
335
|
|
|
@@ -435,15 +419,28 @@ const OUTPUT_FORMAT_OPTIONS = [{
|
|
|
435
419
|
}];
|
|
436
420
|
|
|
437
421
|
const FIELD_DEFINITIONS_URLS = {
|
|
438
|
-
category: 'https://docs.commercetools.com/merchant-center/import-categories#supported-headers-and-values'
|
|
422
|
+
category: 'https://docs.commercetools.com/merchant-center/import-categories#supported-headers-and-values',
|
|
423
|
+
product: 'https://docs.commercetools.com/merchant-center/import-products#supported-headers-and-values'
|
|
439
424
|
};
|
|
440
425
|
|
|
441
|
-
|
|
426
|
+
const resourceTypeMessages = {
|
|
427
|
+
category: {
|
|
428
|
+
exportScopeAll: messages.exportScopeAllCategories,
|
|
429
|
+
exportScopeSelected: messages.exportScopeSelectedCategories
|
|
430
|
+
},
|
|
431
|
+
product: {
|
|
432
|
+
exportScopeAll: messages.exportScopeAllProducts,
|
|
433
|
+
exportScopeSelected: messages.exportScopeSelectedProducts
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
function resourceTypeToFileName(_ref) {
|
|
442
438
|
let resourceType = _ref.resourceType,
|
|
443
439
|
_ref$isUpperCase = _ref.isUpperCase,
|
|
444
440
|
isUpperCase = _ref$isUpperCase === void 0 ? false : _ref$isUpperCase,
|
|
445
441
|
_ref$isPlural = _ref.isPlural,
|
|
446
442
|
isPlural = _ref$isPlural === void 0 ? false : _ref$isPlural;
|
|
443
|
+
const todayFormatted = moment__default["default"]().format('DD-MM-YY_HH-mm');
|
|
447
444
|
let displayName;
|
|
448
445
|
switch (resourceType) {
|
|
449
446
|
case EXPORTABLE_RESOURCES.CATEGORY:
|
|
@@ -458,7 +455,8 @@ function resourceTypeToDisplayName(_ref) {
|
|
|
458
455
|
default:
|
|
459
456
|
throw new UnexpectedResourceTypeError(resourceType);
|
|
460
457
|
}
|
|
461
|
-
|
|
458
|
+
const result = isUpperCase ? displayName : displayName.toLowerCase();
|
|
459
|
+
return `${result}_Export_${todayFormatted}`;
|
|
462
460
|
}
|
|
463
461
|
function mapLocalesToOptions(locales) {
|
|
464
462
|
return _mapInstanceProperty__default["default"](locales).call(locales, locale => ({
|
|
@@ -470,14 +468,13 @@ function isFilledArray(maybeArray) {
|
|
|
470
468
|
return _Array$isArray__default["default"](maybeArray) && maybeArray.length;
|
|
471
469
|
}
|
|
472
470
|
function appendCsvOrJsonExtensionIfAbsent(fileName, fileFormat) {
|
|
473
|
-
var _context;
|
|
474
471
|
const extensionRegex = /\.(csv|json)$/i;
|
|
475
|
-
if (!extensionRegex.test(fileName)) return
|
|
472
|
+
if (!extensionRegex.test(fileName)) return `${fileName}.${fileFormat}`;
|
|
476
473
|
return fileName;
|
|
477
474
|
}
|
|
478
475
|
function getExportLogsLink(projectKey, msg) {
|
|
479
476
|
return jsxRuntime.jsx(uiKit.Link, {
|
|
480
|
-
to:
|
|
477
|
+
to: `/${projectKey}/operations/export/logs`,
|
|
481
478
|
children: msg
|
|
482
479
|
});
|
|
483
480
|
}
|
|
@@ -512,13 +509,13 @@ function sortFieldsByFieldOrder(_ref2) {
|
|
|
512
509
|
// Later, filters will be passed directly from parent views (category, product...) instead of being built within the Export resources modal
|
|
513
510
|
// The `selectedResourceIds` prop will also be removed
|
|
514
511
|
function tmpBuildFilters(selectedResourceIds) {
|
|
515
|
-
if (!selectedResourceIds ||
|
|
516
|
-
const formattedIds = _mapInstanceProperty__default["default"](selectedResourceIds).call(selectedResourceIds, id => "
|
|
517
|
-
return [
|
|
512
|
+
if (!selectedResourceIds || selectedResourceIds?.length === 0) return undefined;
|
|
513
|
+
const formattedIds = _mapInstanceProperty__default["default"](selectedResourceIds).call(selectedResourceIds, id => `"${id}"`).join(', ');
|
|
514
|
+
return [`id in (${formattedIds})`];
|
|
518
515
|
}
|
|
519
516
|
|
|
520
517
|
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; }
|
|
521
|
-
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
518
|
+
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; }
|
|
522
519
|
const updateFieldGroupsWithIsCheckedValue = (groups, cachedSelectedGroups) => {
|
|
523
520
|
const updateFields = (fields, parentChecked, fieldName) => {
|
|
524
521
|
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
@@ -526,10 +523,8 @@ const updateFieldGroupsWithIsCheckedValue = (groups, cachedSelectedGroups) => {
|
|
|
526
523
|
if (field.isRequired) {
|
|
527
524
|
isChecked = true;
|
|
528
525
|
} else {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
var _context2;
|
|
532
|
-
isChecked = cachedSelectedGroups[_concatInstanceProperty__default["default"](_context2 = "".concat(fieldName, ".")).call(_context2, field.name)];
|
|
526
|
+
if (cachedSelectedGroups[`${fieldName}.${field.name}`] !== undefined) {
|
|
527
|
+
isChecked = cachedSelectedGroups[`${fieldName}.${field.name}`];
|
|
533
528
|
} else if (!field.isReadOnly && field.isSelectedByDefault) {
|
|
534
529
|
isChecked = true;
|
|
535
530
|
} else if (parentChecked) {
|
|
@@ -537,8 +532,7 @@ const updateFieldGroupsWithIsCheckedValue = (groups, cachedSelectedGroups) => {
|
|
|
537
532
|
}
|
|
538
533
|
}
|
|
539
534
|
if (field.fields) {
|
|
540
|
-
|
|
541
|
-
const updatedFields = updateFields(field.fields, isChecked, _concatInstanceProperty__default["default"](_context3 = "".concat(fieldName, ".")).call(_context3, field.name));
|
|
535
|
+
const updatedFields = updateFields(field.fields, isChecked, `${fieldName}.${field.name}`);
|
|
542
536
|
isChecked = false;
|
|
543
537
|
field.fields = updatedFields;
|
|
544
538
|
}
|
|
@@ -574,36 +568,30 @@ const updateFieldGroupWithAdditionalFieldExtensions = groups => {
|
|
|
574
568
|
};
|
|
575
569
|
|
|
576
570
|
const useInitialValues = props => {
|
|
577
|
-
var _context;
|
|
578
|
-
const todayFormatted = moment__default["default"]().format('DD-MM-YY_HH-mm');
|
|
579
571
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
580
572
|
locale: applicationContext.dataLocale
|
|
581
573
|
})),
|
|
582
574
|
locale = _useApplicationContex.locale;
|
|
583
|
-
const _useApplicationContex2 = applicationShellConnectors.useApplicationContext(context => {
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key
|
|
587
|
-
};
|
|
588
|
-
}),
|
|
575
|
+
const _useApplicationContex2 = applicationShellConnectors.useApplicationContext(context => ({
|
|
576
|
+
projectKey: context.project?.key
|
|
577
|
+
})),
|
|
589
578
|
projectKey = _useApplicationContex2.projectKey;
|
|
590
|
-
const _useStorage = experimentalComponents.useStorage(
|
|
579
|
+
const _useStorage = experimentalComponents.useStorage(`${projectKey}/${OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION}`, {}),
|
|
591
580
|
_useStorage2 = _slicedToArray(_useStorage, 1),
|
|
592
581
|
cachedSelectedGroups = _useStorage2[0];
|
|
593
582
|
return React__default["default"].useMemo(() => {
|
|
594
|
-
var _context2;
|
|
595
583
|
const groups = updateFieldGroupsWithIsCheckedValue(props.fieldGroups, cachedSelectedGroups[props.resourceType] || {});
|
|
596
584
|
return {
|
|
597
585
|
outputFormat: props.outputFormat,
|
|
598
|
-
fileName:
|
|
586
|
+
fileName: `${resourceTypeToFileName({
|
|
599
587
|
resourceType: props.resourceType,
|
|
600
588
|
isUpperCase: true,
|
|
601
589
|
isPlural: true
|
|
602
|
-
})
|
|
590
|
+
})}`,
|
|
603
591
|
locales: [locale],
|
|
604
592
|
groups: updateFieldGroupWithAdditionalFieldExtensions(groups)
|
|
605
593
|
};
|
|
606
|
-
}, [props.fieldGroups, props.outputFormat, props.resourceType, cachedSelectedGroups,
|
|
594
|
+
}, [props.fieldGroups, props.outputFormat, props.resourceType, cachedSelectedGroups, locale]);
|
|
607
595
|
};
|
|
608
596
|
|
|
609
597
|
async function createExportOperation(_ref) {
|
|
@@ -615,7 +603,7 @@ async function createExportOperation(_ref) {
|
|
|
615
603
|
locales = _ref.locales,
|
|
616
604
|
filters = _ref.filters,
|
|
617
605
|
asyncDispatchFn = _ref.asyncDispatchFn;
|
|
618
|
-
const uri =
|
|
606
|
+
const uri = `/${projectKey}/export-operations`;
|
|
619
607
|
const response = await asyncDispatchFn(sdk.actions.post({
|
|
620
608
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.EXPORT,
|
|
621
609
|
uri: uri,
|
|
@@ -639,24 +627,20 @@ const useStartExportOperation = props => {
|
|
|
639
627
|
const intl = reactIntl.useIntl();
|
|
640
628
|
const asyncDispatch = sdk.useAsyncDispatch();
|
|
641
629
|
const showNotification = actionsGlobal.useShowNotification();
|
|
642
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => {
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
projectKey: (_applicationContext$p = applicationContext.project) === null || _applicationContext$p === void 0 ? void 0 : _applicationContext$p.key
|
|
647
|
-
};
|
|
648
|
-
}),
|
|
630
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
631
|
+
locale: applicationContext.dataLocale,
|
|
632
|
+
projectKey: applicationContext.project?.key
|
|
633
|
+
})),
|
|
649
634
|
projectKey = _useApplicationContex.projectKey;
|
|
650
635
|
const extractFieldsFromGroups = groups => {
|
|
651
636
|
let selectedGeneralFields = [];
|
|
652
637
|
const getSelectedFields = fields => {
|
|
653
638
|
return _filterInstanceProperty__default["default"](fields).call(fields, field => {
|
|
654
|
-
var _field$isChecked;
|
|
655
639
|
if (field.fields) {
|
|
656
640
|
return getSelectedFields(field.fields);
|
|
657
641
|
}
|
|
658
642
|
if (field.isChecked) selectedGeneralFields.push(field);
|
|
659
|
-
return
|
|
643
|
+
return field.isChecked ?? false;
|
|
660
644
|
});
|
|
661
645
|
};
|
|
662
646
|
_forEachInstanceProperty__default["default"](groups).call(groups, group => {
|
|
@@ -720,12 +704,12 @@ const useStartExportOperation = props => {
|
|
|
720
704
|
function ownKeys$3(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; }
|
|
721
705
|
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$3(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$3(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
722
706
|
function ExportScopeSection() {
|
|
723
|
-
var _originalSelectedReso;
|
|
724
707
|
const _useExportResourcesCo = useExportResourcesContext(),
|
|
725
708
|
exportType = _useExportResourcesCo.exportType,
|
|
726
709
|
totalResourcesCount = _useExportResourcesCo.totalResourcesCount,
|
|
727
710
|
originalSelectedResourceIds = _useExportResourcesCo.originalSelectedResourceIds,
|
|
728
|
-
onScopeChange = _useExportResourcesCo.onScopeChange
|
|
711
|
+
onScopeChange = _useExportResourcesCo.onScopeChange,
|
|
712
|
+
resourceType = _useExportResourcesCo.resourceType;
|
|
729
713
|
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
730
714
|
scale: "m",
|
|
731
715
|
children: jsxRuntime.jsxs(uiKit.RadioInput.Group, {
|
|
@@ -740,7 +724,7 @@ function ExportScopeSection() {
|
|
|
740
724
|
children: [jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
741
725
|
value: EXPORT_TYPES.ALL,
|
|
742
726
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
743
|
-
intlMessage: _objectSpread$3(_objectSpread$3({},
|
|
727
|
+
intlMessage: _objectSpread$3(_objectSpread$3({}, resourceTypeMessages[resourceType].exportScopeAll), {}, {
|
|
744
728
|
values: {
|
|
745
729
|
total: new Intl.NumberFormat().format(totalResourcesCount)
|
|
746
730
|
}
|
|
@@ -748,14 +732,14 @@ function ExportScopeSection() {
|
|
|
748
732
|
})
|
|
749
733
|
}), jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
750
734
|
value: EXPORT_TYPES.SELECTED,
|
|
751
|
-
isDisabled: !
|
|
735
|
+
isDisabled: !originalSelectedResourceIds?.length,
|
|
752
736
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
753
|
-
tone: !
|
|
754
|
-
intlMessage: _objectSpread$3(_objectSpread$3({},
|
|
737
|
+
tone: !originalSelectedResourceIds?.length ? 'tertiary' : undefined,
|
|
738
|
+
intlMessage: originalSelectedResourceIds?.length ? _objectSpread$3(_objectSpread$3({}, resourceTypeMessages[resourceType].exportScopeSelected), {}, {
|
|
755
739
|
values: {
|
|
756
|
-
total: new Intl.NumberFormat().format(
|
|
740
|
+
total: new Intl.NumberFormat().format(originalSelectedResourceIds?.length ?? 0)
|
|
757
741
|
}
|
|
758
|
-
})
|
|
742
|
+
}) : messages.exportScopeSelectedWithoutCount
|
|
759
743
|
})
|
|
760
744
|
})]
|
|
761
745
|
})
|
|
@@ -763,31 +747,21 @@ function ExportScopeSection() {
|
|
|
763
747
|
}
|
|
764
748
|
|
|
765
749
|
const ExportFileSettingsStep = () => {
|
|
766
|
-
var _context;
|
|
767
750
|
const intl = reactIntl.useIntl();
|
|
768
751
|
const _useExportResourcesCo = useExportResourcesContext(),
|
|
769
752
|
formik = _useExportResourcesCo.formik,
|
|
770
753
|
resourceType = _useExportResourcesCo.resourceType,
|
|
771
754
|
onClose = _useExportResourcesCo.onClose;
|
|
772
|
-
const
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => {
|
|
777
|
-
var _applicationContext$p;
|
|
778
|
-
return {
|
|
779
|
-
locale: applicationContext.dataLocale,
|
|
780
|
-
locales: ((_applicationContext$p = applicationContext.project) === null || _applicationContext$p === void 0 ? void 0 : _applicationContext$p.languages) || []
|
|
781
|
-
};
|
|
782
|
-
}),
|
|
755
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
756
|
+
locale: applicationContext.dataLocale,
|
|
757
|
+
locales: applicationContext.project?.languages || []
|
|
758
|
+
})),
|
|
783
759
|
locales = _useApplicationContex.locales,
|
|
784
760
|
locale = _useApplicationContex.locale;
|
|
785
761
|
const areAllLocalesChecked = _valuesInstanceProperty__default["default"](formik).locales.length === locales.length;
|
|
786
762
|
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
787
763
|
isOpen: true,
|
|
788
|
-
title: intl.formatMessage(messages
|
|
789
|
-
resourceType: resourceTypePlural
|
|
790
|
-
}),
|
|
764
|
+
title: intl.formatMessage(messages[`modalTitle.${resourceType}`]),
|
|
791
765
|
labelPrimary: intl.formatMessage(messages.continue),
|
|
792
766
|
onPrimaryButtonClick: formik.submitForm,
|
|
793
767
|
isPrimaryButtonDisabled: !formik.isValid,
|
|
@@ -800,7 +774,7 @@ const ExportFileSettingsStep = () => {
|
|
|
800
774
|
scale: "l",
|
|
801
775
|
children: jsxRuntime.jsxs(uiKit.Grid, {
|
|
802
776
|
gridRowGap: uiKit.designTokens.spacingL,
|
|
803
|
-
gridTemplateColumns:
|
|
777
|
+
gridTemplateColumns: `calc(${uiKit.designTokens.constraint3} + ${uiKit.designTokens.spacingL}) auto`,
|
|
804
778
|
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
805
779
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
806
780
|
intlMessage: messages.exportScope
|
|
@@ -893,7 +867,7 @@ const NoSearchResults = () => {
|
|
|
893
867
|
};
|
|
894
868
|
|
|
895
869
|
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; }
|
|
896
|
-
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
870
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context6 = ownKeys$2(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context7 = ownKeys$2(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
897
871
|
const StyledGridCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
898
872
|
target: "e3xiyhb2"
|
|
899
873
|
} )({
|
|
@@ -913,11 +887,10 @@ const FieldSections = _ref => {
|
|
|
913
887
|
isAnySiblingChecked = _ref.isAnySiblingChecked;
|
|
914
888
|
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
915
889
|
scale: "s",
|
|
916
|
-
children: fields
|
|
917
|
-
var _context, _field$fields3;
|
|
890
|
+
children: fields?.map((field, index) => {
|
|
918
891
|
const isAtleastOneChildChecked = () => {
|
|
919
892
|
function checkAtLeastOneFieldChecked(fields) {
|
|
920
|
-
return fields
|
|
893
|
+
return fields?.some(field => {
|
|
921
894
|
if (field.fields) {
|
|
922
895
|
return field.isChecked || checkAtLeastOneFieldChecked(field.fields);
|
|
923
896
|
}
|
|
@@ -933,18 +906,16 @@ const FieldSections = _ref => {
|
|
|
933
906
|
isChecked: field.isReadOnly ? isAnySiblingChecked : isAnyOfTheChildFieldsChecked || field.isChecked,
|
|
934
907
|
isReadOnly: field.isReadOnly || field.isRequired,
|
|
935
908
|
onChange: e => {
|
|
936
|
-
|
|
937
|
-
const path = _concatInstanceProperty__default["default"](_context2 = "".concat(parentKeys.join('.'), ".fields[")).call(_context2, index, "]");
|
|
909
|
+
const path = `${parentKeys.join('.')}.fields[${index}]`;
|
|
938
910
|
// Update all child fields
|
|
939
911
|
const updateAllChildFieldsChecked = (path, checked) => {
|
|
940
912
|
const item = get__default["default"](_valuesInstanceProperty__default["default"](formik), path);
|
|
941
913
|
if (item && item.fields) {
|
|
942
|
-
var
|
|
943
|
-
_forEachInstanceProperty__default["default"](
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
formik.setFieldValue("".concat(fieldPath, ".isChecked"), checked,
|
|
914
|
+
var _context;
|
|
915
|
+
_forEachInstanceProperty__default["default"](_context = item.fields).call(_context, (field, i) => {
|
|
916
|
+
const fieldPath = `${path}.fields[${i}]`;
|
|
917
|
+
if (!field.fields?.length) {
|
|
918
|
+
formik.setFieldValue(`${fieldPath}.isChecked`, checked,
|
|
948
919
|
// pass `false` to avoid revalidating the form with intermediate values
|
|
949
920
|
false);
|
|
950
921
|
}
|
|
@@ -952,24 +923,24 @@ const FieldSections = _ref => {
|
|
|
952
923
|
});
|
|
953
924
|
}
|
|
954
925
|
};
|
|
955
|
-
if (!
|
|
956
|
-
formik.setFieldValue(
|
|
926
|
+
if (!field.fields?.length) {
|
|
927
|
+
formik.setFieldValue(`${path}.isChecked`, e.target.checked,
|
|
957
928
|
// pass `false` to avoid revalidating the form with intermediate values
|
|
958
929
|
false);
|
|
959
930
|
}
|
|
960
931
|
updateAllChildFieldsChecked(path, e.target.checked);
|
|
961
932
|
},
|
|
962
933
|
children: [field.label, " ", field.isRequired && '*']
|
|
963
|
-
}), field.fields &&
|
|
934
|
+
}), field.fields && field.fields?.length > 0 && jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
964
935
|
scale: "l",
|
|
965
936
|
children: [jsxRuntime.jsx("div", {}), jsxRuntime.jsx(FieldSections, {
|
|
966
937
|
fields: field.fields,
|
|
967
938
|
formik: formik,
|
|
968
|
-
parentKeys: [...parentKeys,
|
|
939
|
+
parentKeys: [...parentKeys, `fields[${index}]`],
|
|
969
940
|
isAnySiblingChecked: isAnySiblingChecked
|
|
970
941
|
})]
|
|
971
942
|
})]
|
|
972
|
-
},
|
|
943
|
+
}, `${field.name}-${index}`);
|
|
973
944
|
})
|
|
974
945
|
});
|
|
975
946
|
};
|
|
@@ -995,7 +966,7 @@ const FieldGroupSection = _ref2 => {
|
|
|
995
966
|
formik = _ref2.formik;
|
|
996
967
|
const allAllFieldsSelected = React__default["default"].useMemo(() => checkAllFieldsSelected(group.fields), [group.fields]);
|
|
997
968
|
const isAtleastOneFieldChecked = React__default["default"].useMemo(() => checkAtLeastOneFieldChecked(group.fields), [group.fields]);
|
|
998
|
-
const parentKey =
|
|
969
|
+
const parentKey = `groups[${index}]`;
|
|
999
970
|
const handleChangeAllFields = e => {
|
|
1000
971
|
const item = get__default["default"](_valuesInstanceProperty__default["default"](formik), parentKey);
|
|
1001
972
|
function updateAllFields(fields, checked) {
|
|
@@ -1048,20 +1019,16 @@ const FieldGroupSection = _ref2 => {
|
|
|
1048
1019
|
});
|
|
1049
1020
|
};
|
|
1050
1021
|
const ExportFieldsSelectionStep = () => {
|
|
1051
|
-
var _context5;
|
|
1052
1022
|
const intl = reactIntl.useIntl();
|
|
1053
1023
|
const _React$useState = React__default["default"].useState(''),
|
|
1054
1024
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1055
1025
|
fieldSearchTerm = _React$useState2[0],
|
|
1056
1026
|
setFieldSearchTerm = _React$useState2[1];
|
|
1057
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => {
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key
|
|
1061
|
-
};
|
|
1062
|
-
}),
|
|
1027
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
1028
|
+
projectKey: context.project?.key
|
|
1029
|
+
})),
|
|
1063
1030
|
projectKey = _useApplicationContex.projectKey;
|
|
1064
|
-
const _useStorage = experimentalComponents.useStorage(
|
|
1031
|
+
const _useStorage = experimentalComponents.useStorage(`${projectKey}/${OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION}`, {}),
|
|
1065
1032
|
_useStorage2 = _slicedToArray(_useStorage, 2);
|
|
1066
1033
|
_useStorage2[0];
|
|
1067
1034
|
const setCachedSelectedGroups = _useStorage2[1];
|
|
@@ -1070,24 +1037,19 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1070
1037
|
setCurrentStep = _useExportResourcesCo.setCurrentStep,
|
|
1071
1038
|
resourceType = _useExportResourcesCo.resourceType,
|
|
1072
1039
|
onClose = _useExportResourcesCo.onClose;
|
|
1073
|
-
const resourceTypePlural = resourceTypeToDisplayName({
|
|
1074
|
-
resourceType: resourceType,
|
|
1075
|
-
isPlural: true
|
|
1076
|
-
});
|
|
1077
1040
|
React__default["default"].useEffect(() => {
|
|
1078
|
-
var
|
|
1041
|
+
var _context3;
|
|
1079
1042
|
formik.validateForm();
|
|
1080
1043
|
const selectedFields = {};
|
|
1081
1044
|
function getSelectedFields(field, groupName) {
|
|
1082
|
-
|
|
1083
|
-
const fieldName = field.name ? _concatInstanceProperty__default["default"](_context6 = "".concat(groupName, ".")).call(_context6, field.name) : groupName;
|
|
1045
|
+
const fieldName = field.name ? `${groupName}.${field.name}` : groupName;
|
|
1084
1046
|
if (field.fields) {
|
|
1085
|
-
var
|
|
1086
|
-
return _forEachInstanceProperty__default["default"](
|
|
1047
|
+
var _context2;
|
|
1048
|
+
return _forEachInstanceProperty__default["default"](_context2 = field.fields).call(_context2, f => getSelectedFields(f, fieldName));
|
|
1087
1049
|
}
|
|
1088
1050
|
selectedFields[fieldName] = field.isChecked;
|
|
1089
1051
|
}
|
|
1090
|
-
_forEachInstanceProperty__default["default"](
|
|
1052
|
+
_forEachInstanceProperty__default["default"](_context3 = _valuesInstanceProperty__default["default"](formik).groups).call(_context3, group => getSelectedFields(group, group.groupLabel));
|
|
1091
1053
|
setCachedSelectedGroups({
|
|
1092
1054
|
[resourceType]: selectedFields
|
|
1093
1055
|
});
|
|
@@ -1095,11 +1057,11 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1095
1057
|
}, [_valuesInstanceProperty__default["default"](formik).groups]);
|
|
1096
1058
|
// adds `isHidden` property to each field based on search term
|
|
1097
1059
|
const filteredGroups = React__default["default"].useMemo(() => {
|
|
1098
|
-
var
|
|
1060
|
+
var _context5;
|
|
1099
1061
|
const updateFields = (fields, parentMatches) => {
|
|
1100
1062
|
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
1101
|
-
var
|
|
1102
|
-
const matches = _includesInstanceProperty__default["default"](
|
|
1063
|
+
var _context4;
|
|
1064
|
+
const matches = _includesInstanceProperty__default["default"](_context4 = field.label.toLowerCase()).call(_context4, fieldSearchTerm.toLowerCase());
|
|
1103
1065
|
let isHidden = !matches && !parentMatches;
|
|
1104
1066
|
if (field.fields) {
|
|
1105
1067
|
const updatedFields = updateFields(field.fields, matches);
|
|
@@ -1113,8 +1075,8 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1113
1075
|
});
|
|
1114
1076
|
});
|
|
1115
1077
|
};
|
|
1116
|
-
if (!
|
|
1117
|
-
return _mapInstanceProperty__default["default"](
|
|
1078
|
+
if (!fieldSearchTerm?.trim()?.length) return _valuesInstanceProperty__default["default"](formik).groups;
|
|
1079
|
+
return _mapInstanceProperty__default["default"](_context5 = _valuesInstanceProperty__default["default"](formik).groups).call(_context5, group => {
|
|
1118
1080
|
const updatedFields = updateFields(group.fields, false);
|
|
1119
1081
|
const isHidden = _everyInstanceProperty__default["default"](updatedFields).call(updatedFields, field => field.isHidden);
|
|
1120
1082
|
return _objectSpread$2(_objectSpread$2({}, group), {}, {
|
|
@@ -1133,9 +1095,7 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1133
1095
|
};
|
|
1134
1096
|
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
1135
1097
|
isOpen: true,
|
|
1136
|
-
title: intl.formatMessage(messages
|
|
1137
|
-
resourceType: resourceTypePlural
|
|
1138
|
-
}),
|
|
1098
|
+
title: intl.formatMessage(messages[`modalTitle.${resourceType}`]),
|
|
1139
1099
|
labelPrimary: intl.formatMessage(messages.startExport),
|
|
1140
1100
|
onPrimaryButtonClick: formik.submitForm,
|
|
1141
1101
|
isPrimaryButtonDisabled: !formik.isValid,
|
|
@@ -1169,7 +1129,7 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1169
1129
|
insetScale: "none",
|
|
1170
1130
|
children: jsxRuntime.jsx(uiKit.Grid, {
|
|
1171
1131
|
gridAutoFlow: "row",
|
|
1172
|
-
gridTemplateColumns:
|
|
1132
|
+
gridTemplateColumns: `${uiKit.designTokens.constraint5} auto`,
|
|
1173
1133
|
children: _mapInstanceProperty__default["default"](filteredGroups).call(filteredGroups, (group, index) => jsxRuntime.jsx(FieldGroupSection, {
|
|
1174
1134
|
group: group,
|
|
1175
1135
|
index: index,
|
|
@@ -1187,14 +1147,13 @@ const ExportResourcesContext = /*#__PURE__*/React.createContext();
|
|
|
1187
1147
|
function ownKeys$1(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; }
|
|
1188
1148
|
function _objectSpread$1(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$1(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$1(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1189
1149
|
const ExportResourcesProvider = props => {
|
|
1190
|
-
var _props$selectedResour;
|
|
1191
1150
|
const initialValues = useInitialValues(props);
|
|
1192
1151
|
const _React$useState = React__default["default"].useState(1),
|
|
1193
1152
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1194
1153
|
currentStep = _React$useState2[0],
|
|
1195
1154
|
setCurrentStep = _React$useState2[1];
|
|
1196
1155
|
const _React$useState3 = React__default["default"].useState({
|
|
1197
|
-
exportType:
|
|
1156
|
+
exportType: props.selectedResourceIds?.length ? EXPORT_TYPES.SELECTED : EXPORT_TYPES.ALL,
|
|
1198
1157
|
selectedResourceIds: props.selectedResourceIds
|
|
1199
1158
|
}),
|
|
1200
1159
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
@@ -1264,19 +1223,19 @@ const getChunkImport = locale => {
|
|
|
1264
1223
|
const intlLocale = i18n.mapLocaleToIntlLocale(locale);
|
|
1265
1224
|
switch (intlLocale) {
|
|
1266
1225
|
case 'de':
|
|
1267
|
-
return Promise.resolve().then(function () { return require( /* webpackChunkName: "export-resources-modal-i18n-de" */'./de-
|
|
1226
|
+
return Promise.resolve().then(function () { return require( /* webpackChunkName: "export-resources-modal-i18n-de" */'./de-b9d63c63.cjs.prod.js'); });
|
|
1268
1227
|
case 'es':
|
|
1269
|
-
return Promise.resolve().then(function () { return require( /* webpackChunkName: "export-resources-modal-i18n-es" */'./es-
|
|
1228
|
+
return Promise.resolve().then(function () { return require( /* webpackChunkName: "export-resources-modal-i18n-es" */'./es-27083d0c.cjs.prod.js'); });
|
|
1270
1229
|
case 'fr-FR':
|
|
1271
|
-
return Promise.resolve().then(function () { return require( /* webpackChunkName: "export-resources-modal-i18n-fr-FR" */'./fr-FR-
|
|
1230
|
+
return Promise.resolve().then(function () { return require( /* webpackChunkName: "export-resources-modal-i18n-fr-FR" */'./fr-FR-a10662d7.cjs.prod.js'); });
|
|
1272
1231
|
case 'zh-CN':
|
|
1273
|
-
return Promise.resolve().then(function () { return require( /* webpackChunkName: "export-resources-modal-i18n-zh-CN" */'./zh-CN-
|
|
1232
|
+
return Promise.resolve().then(function () { return require( /* webpackChunkName: "export-resources-modal-i18n-zh-CN" */'./zh-CN-ed634d04.cjs.prod.js'); });
|
|
1274
1233
|
case 'ja':
|
|
1275
1234
|
return Promise.resolve().then(function () { return require( /* webpackChunkName: "export-resources-modal-i18n-ja" */'./ja-37632763.cjs.prod.js'); });
|
|
1276
1235
|
case 'pt-BR':
|
|
1277
|
-
return Promise.resolve().then(function () { return require( /* webpackChunkName: "change-history-i18n-pt-BR" */'./pt-BR-
|
|
1236
|
+
return Promise.resolve().then(function () { return require( /* webpackChunkName: "change-history-i18n-pt-BR" */'./pt-BR-b8807555.cjs.prod.js'); });
|
|
1278
1237
|
default:
|
|
1279
|
-
return Promise.resolve().then(function () { return require( /* webpackChunkName: "export-resources-modal-i18n-en" */'./en-
|
|
1238
|
+
return Promise.resolve().then(function () { return require( /* webpackChunkName: "export-resources-modal-i18n-en" */'./en-3ff78dd6.cjs.prod.js'); });
|
|
1280
1239
|
}
|
|
1281
1240
|
};
|
|
1282
1241
|
const loadMessages = async locale => {
|
|
@@ -1285,8 +1244,8 @@ const loadMessages = async locale => {
|
|
|
1285
1244
|
return i18n.parseChunkImport(chunkImport);
|
|
1286
1245
|
} catch (error) {
|
|
1287
1246
|
// eslint-disable-next-line no-console
|
|
1288
|
-
console.warn(
|
|
1289
|
-
sentry.reportErrorToSentry(new Error(
|
|
1247
|
+
console.warn(`Something went wrong while loading the export-resources-modal messages for ${locale}`, error);
|
|
1248
|
+
sentry.reportErrorToSentry(new Error(`Something went wrong while loading the export-resources-modal messages for ${locale}`), {
|
|
1290
1249
|
extra: error
|
|
1291
1250
|
});
|
|
1292
1251
|
return {};
|