@commercetools-frontend-extensions/export-resources-modal 3.6.0 → 4.0.0
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/README.md +166 -138
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.dev.js +517 -391
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.prod.js +510 -387
- package/dist/commercetools-frontend-extensions-export-resources-modal.esm.js +508 -385
- package/dist/de-a34c5dd4.cjs.dev.js +6 -0
- package/dist/de-cd6c45d3.esm.js +4 -0
- package/dist/de-d954fe3d.cjs.prod.js +6 -0
- package/dist/en-3a9aa2d4.esm.js +4 -0
- package/dist/en-6b3694f6.cjs.dev.js +6 -0
- package/dist/en-c7757448.cjs.prod.js +6 -0
- package/dist/es-042343bd.cjs.prod.js +6 -0
- package/dist/es-8b3ecab1.cjs.dev.js +6 -0
- package/dist/es-e544023d.esm.js +4 -0
- package/dist/fr-FR-9d9081ee.esm.js +4 -0
- package/dist/fr-FR-e7126fcc.cjs.dev.js +6 -0
- package/dist/fr-FR-fce1ca96.cjs.prod.js +6 -0
- package/dist/ja-37632763.cjs.prod.js +6 -0
- package/dist/ja-73c088a7.esm.js +4 -0
- package/dist/ja-9bd5f452.cjs.dev.js +6 -0
- package/dist/pt-BR-b37d730b.esm.js +4 -0
- package/dist/pt-BR-ea6b3251.cjs.dev.js +6 -0
- package/dist/pt-BR-ec2a1a11.cjs.prod.js +6 -0
- package/dist/zh-CN-4780d88e.esm.js +4 -0
- package/dist/zh-CN-52baa549.cjs.prod.js +6 -0
- package/dist/zh-CN-d4bc6d26.cjs.dev.js +6 -0
- package/package.json +31 -18
|
@@ -11,14 +11,13 @@ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-
|
|
|
11
11
|
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
12
12
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
13
13
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
14
|
-
var
|
|
14
|
+
var reactIntl = require('react-intl');
|
|
15
|
+
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
15
16
|
var uiKit = require('@commercetools-frontend/ui-kit');
|
|
16
17
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
17
18
|
require('@commercetools-uikit/design-system');
|
|
18
|
-
var reactIntl = require('react-intl');
|
|
19
19
|
var _valuesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/values');
|
|
20
20
|
var applicationComponents = require('@commercetools-frontend/application-components');
|
|
21
|
-
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
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');
|
|
@@ -26,28 +25,37 @@ var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
|
26
25
|
var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
|
|
27
26
|
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
28
27
|
var _wrapNativeSuper = require('@babel/runtime-corejs3/helpers/wrapNativeSuper');
|
|
28
|
+
var React = require('react');
|
|
29
29
|
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
30
30
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
31
31
|
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
32
32
|
var moment = require('moment');
|
|
33
|
+
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
33
34
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
34
35
|
var omitEmpty = require('omit-empty-es');
|
|
35
36
|
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
36
37
|
var _flatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/flat');
|
|
37
|
-
var _flatMapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/flat-map');
|
|
38
38
|
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
39
39
|
var _sortInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/sort');
|
|
40
|
-
|
|
41
|
-
var
|
|
40
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
|
|
41
|
+
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
42
|
+
var shared = require('@commercetools-local/shared');
|
|
42
43
|
var sdk = require('@commercetools-frontend/sdk');
|
|
43
44
|
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
44
45
|
var constants = require('@commercetools-frontend/constants');
|
|
46
|
+
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
45
47
|
var _styled = require('@emotion/styled/base');
|
|
46
48
|
var _everyInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/every');
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
var
|
|
49
|
+
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
50
|
+
var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
|
|
51
|
+
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
52
|
+
var throttle = require('lodash/throttle');
|
|
53
|
+
var react = require('@emotion/react');
|
|
54
|
+
var get = require('lodash/get');
|
|
55
|
+
require('prop-types');
|
|
50
56
|
var formik = require('formik');
|
|
57
|
+
var sentry = require('@commercetools-frontend/sentry');
|
|
58
|
+
var i18n = require('@commercetools-frontend/i18n');
|
|
51
59
|
|
|
52
60
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
53
61
|
|
|
@@ -59,25 +67,27 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachIns
|
|
|
59
67
|
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
|
|
60
68
|
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
61
69
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
62
|
-
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
63
70
|
var _valuesInstanceProperty__default = /*#__PURE__*/_interopDefault(_valuesInstanceProperty);
|
|
64
71
|
var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
|
|
72
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
65
73
|
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
66
74
|
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
67
75
|
var moment__default = /*#__PURE__*/_interopDefault(moment);
|
|
76
|
+
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
68
77
|
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
69
78
|
var omitEmpty__default = /*#__PURE__*/_interopDefault(omitEmpty);
|
|
70
79
|
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
71
80
|
var _flatInstanceProperty__default = /*#__PURE__*/_interopDefault(_flatInstanceProperty);
|
|
72
|
-
var _flatMapInstanceProperty__default = /*#__PURE__*/_interopDefault(_flatMapInstanceProperty);
|
|
73
81
|
var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
74
82
|
var _sortInstanceProperty__default = /*#__PURE__*/_interopDefault(_sortInstanceProperty);
|
|
75
|
-
var
|
|
76
|
-
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
83
|
+
var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
|
|
77
84
|
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
78
85
|
var _everyInstanceProperty__default = /*#__PURE__*/_interopDefault(_everyInstanceProperty);
|
|
79
|
-
var
|
|
80
|
-
var
|
|
86
|
+
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
87
|
+
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
|
|
88
|
+
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
89
|
+
var throttle__default = /*#__PURE__*/_interopDefault(throttle);
|
|
90
|
+
var get__default = /*#__PURE__*/_interopDefault(get);
|
|
81
91
|
|
|
82
92
|
function getBold(msg) {
|
|
83
93
|
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
@@ -211,36 +221,46 @@ var messages = reactIntl.defineMessages({
|
|
|
211
221
|
description: 'Label for "Field definitions" link',
|
|
212
222
|
defaultMessage: 'Field definitions'
|
|
213
223
|
},
|
|
214
|
-
allGeneralFields: {
|
|
215
|
-
id: 'ExportResourcesModal.allGeneralFields',
|
|
216
|
-
description: 'Label for "All general fields" checkbox',
|
|
217
|
-
defaultMessage: 'All general fields'
|
|
218
|
-
},
|
|
219
|
-
allCustomFields: {
|
|
220
|
-
id: 'ExportResourcesModal.allCustomFields',
|
|
221
|
-
description: 'Label for "All custom fields" checkbox',
|
|
222
|
-
defaultMessage: 'All custom fields'
|
|
223
|
-
},
|
|
224
|
-
customTypeKeyAndTypeId: {
|
|
225
|
-
id: 'ExportResourcesModal.customTypeKeyAndTypeId',
|
|
226
|
-
description: 'Label for "Custom type key and typeId" checkbox',
|
|
227
|
-
defaultMessage: 'Custom type key and typeId'
|
|
228
|
-
},
|
|
229
224
|
unexpectedError: {
|
|
230
225
|
id: 'ExportResourcesModal.unexpectedError',
|
|
231
226
|
description: 'Generic notification message when starting export process fails',
|
|
232
227
|
defaultMessage: 'An error occurred while starting the export process. Please try again or contact support if the problem persists.'
|
|
228
|
+
},
|
|
229
|
+
searchForFields: {
|
|
230
|
+
id: 'ExportResourcesModal.searchForFields',
|
|
231
|
+
description: 'Placeholder for "Search for fields" search input',
|
|
232
|
+
defaultMessage: 'Search for fields'
|
|
233
|
+
},
|
|
234
|
+
thereAreNoResults: {
|
|
235
|
+
id: 'ExportResourcesModal.thereAreNoResults',
|
|
236
|
+
description: 'No search results message',
|
|
237
|
+
defaultMessage: 'There are no results that match your search.'
|
|
238
|
+
},
|
|
239
|
+
suggestions: {
|
|
240
|
+
id: 'ExportResourcesModal.suggestions',
|
|
241
|
+
description: 'In Export fields selection - Suggestions message',
|
|
242
|
+
defaultMessage: 'Suggestions:'
|
|
243
|
+
},
|
|
244
|
+
checkTheSpelling: {
|
|
245
|
+
id: 'ExportResourcesModal.checkTheSpelling',
|
|
246
|
+
description: 'In Export fields selection - Check the spelling message',
|
|
247
|
+
defaultMessage: 'Check the spelling.'
|
|
248
|
+
},
|
|
249
|
+
searchByEnteringTheExactFieldName: {
|
|
250
|
+
id: 'ExportResourcesModal.searchByEnteringTheExactFieldName',
|
|
251
|
+
description: 'In Export fields selection - Search by entering the exact field name message',
|
|
252
|
+
defaultMessage: 'Try searching by entering the exact field name.'
|
|
233
253
|
}
|
|
234
254
|
});
|
|
235
255
|
|
|
236
|
-
function ownKeys$
|
|
237
|
-
function _objectSpread$
|
|
256
|
+
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; }
|
|
257
|
+
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; }
|
|
238
258
|
function renderFileNameError(key) {
|
|
239
259
|
switch (key) {
|
|
240
260
|
case 'missing':
|
|
241
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
261
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages.missingFileNameError));
|
|
242
262
|
case 'invalidInput':
|
|
243
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
263
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages.invalidFileNameError));
|
|
244
264
|
default:
|
|
245
265
|
return null;
|
|
246
266
|
}
|
|
@@ -248,7 +268,7 @@ function renderFileNameError(key) {
|
|
|
248
268
|
function renderLocaleError(key) {
|
|
249
269
|
switch (key) {
|
|
250
270
|
case 'missing':
|
|
251
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
271
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages.missingLocaleError));
|
|
252
272
|
default:
|
|
253
273
|
return null;
|
|
254
274
|
}
|
|
@@ -290,11 +310,11 @@ const FIELD_DEFINITIONS_URLS = {
|
|
|
290
310
|
category: 'https://docs.commercetools.com/merchant-center/import-categories#supported-headers-and-values'
|
|
291
311
|
};
|
|
292
312
|
|
|
293
|
-
function _createSuper$
|
|
294
|
-
function _isNativeReflectConstruct$
|
|
313
|
+
function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
314
|
+
function _isNativeReflectConstruct$2() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$2 = function () { return !!t; })(); }
|
|
295
315
|
let UnexpectedExportTypeError = /*#__PURE__*/function (_Error) {
|
|
296
316
|
_inherits(UnexpectedExportTypeError, _Error);
|
|
297
|
-
var _super = _createSuper$
|
|
317
|
+
var _super = _createSuper$2(UnexpectedExportTypeError);
|
|
298
318
|
function UnexpectedExportTypeError(exportType) {
|
|
299
319
|
var _this;
|
|
300
320
|
_classCallCheck(this, UnexpectedExportTypeError);
|
|
@@ -305,11 +325,11 @@ let UnexpectedExportTypeError = /*#__PURE__*/function (_Error) {
|
|
|
305
325
|
return _createClass(UnexpectedExportTypeError);
|
|
306
326
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
307
327
|
|
|
308
|
-
function _createSuper$
|
|
309
|
-
function _isNativeReflectConstruct$
|
|
328
|
+
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
329
|
+
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function () { return !!t; })(); }
|
|
310
330
|
let MissingExportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
311
331
|
_inherits(MissingExportResourceProviderError, _Error);
|
|
312
|
-
var _super = _createSuper$
|
|
332
|
+
var _super = _createSuper$1(MissingExportResourceProviderError);
|
|
313
333
|
function MissingExportResourceProviderError() {
|
|
314
334
|
var _this;
|
|
315
335
|
_classCallCheck(this, MissingExportResourceProviderError);
|
|
@@ -320,11 +340,11 @@ let MissingExportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
|
320
340
|
return _createClass(MissingExportResourceProviderError);
|
|
321
341
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
322
342
|
|
|
323
|
-
function _createSuper
|
|
324
|
-
function _isNativeReflectConstruct
|
|
343
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
344
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
325
345
|
let UnexpectedExportOperationStateError = /*#__PURE__*/function (_Error) {
|
|
326
346
|
_inherits(UnexpectedExportOperationStateError, _Error);
|
|
327
|
-
var _super = _createSuper
|
|
347
|
+
var _super = _createSuper(UnexpectedExportOperationStateError);
|
|
328
348
|
function UnexpectedExportOperationStateError(state) {
|
|
329
349
|
var _this;
|
|
330
350
|
_classCallCheck(this, UnexpectedExportOperationStateError);
|
|
@@ -335,36 +355,6 @@ let UnexpectedExportOperationStateError = /*#__PURE__*/function (_Error) {
|
|
|
335
355
|
return _createClass(UnexpectedExportOperationStateError);
|
|
336
356
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
337
357
|
|
|
338
|
-
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
339
|
-
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function () { return !!t; })(); }
|
|
340
|
-
let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
|
|
341
|
-
_inherits(UnexpectedResourceTypeError, _Error);
|
|
342
|
-
var _super = _createSuper$1(UnexpectedResourceTypeError);
|
|
343
|
-
function UnexpectedResourceTypeError(resourceType) {
|
|
344
|
-
var _this;
|
|
345
|
-
_classCallCheck(this, UnexpectedResourceTypeError);
|
|
346
|
-
_this = _super.call(this, "Unexpected resource type: ".concat(resourceType));
|
|
347
|
-
_this.name = 'UnexpectedResourceTypeError';
|
|
348
|
-
return _this;
|
|
349
|
-
}
|
|
350
|
-
return _createClass(UnexpectedResourceTypeError);
|
|
351
|
-
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
352
|
-
|
|
353
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
354
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
355
|
-
let InvalidResponseError = /*#__PURE__*/function (_Error) {
|
|
356
|
-
_inherits(InvalidResponseError, _Error);
|
|
357
|
-
var _super = _createSuper(InvalidResponseError);
|
|
358
|
-
function InvalidResponseError(message) {
|
|
359
|
-
var _this;
|
|
360
|
-
_classCallCheck(this, InvalidResponseError);
|
|
361
|
-
_this = _super.call(this, message);
|
|
362
|
-
_this.name = 'InvalidResponseError';
|
|
363
|
-
return _this;
|
|
364
|
-
}
|
|
365
|
-
return _createClass(InvalidResponseError);
|
|
366
|
-
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
367
|
-
|
|
368
358
|
function useExportResourcesContext() {
|
|
369
359
|
const context = React.useContext(ExportResourcesContext);
|
|
370
360
|
if (!context) {
|
|
@@ -373,41 +363,52 @@ function useExportResourcesContext() {
|
|
|
373
363
|
return context;
|
|
374
364
|
}
|
|
375
365
|
|
|
366
|
+
function checkAtLeastOneFieldChecked$1(fields) {
|
|
367
|
+
return _someInstanceProperty__default["default"](fields).call(fields, field => {
|
|
368
|
+
if (field.fields) {
|
|
369
|
+
return field.isChecked || checkAtLeastOneFieldChecked$1(field.fields);
|
|
370
|
+
}
|
|
371
|
+
return field.isChecked;
|
|
372
|
+
});
|
|
373
|
+
}
|
|
376
374
|
function validate(_ref) {
|
|
377
375
|
let values = _valuesInstanceProperty__default["default"](_ref),
|
|
378
376
|
step = _ref.step;
|
|
379
377
|
const fileName = values.fileName,
|
|
380
378
|
locales = values.locales,
|
|
381
|
-
|
|
382
|
-
customFields = values.customFields;
|
|
379
|
+
groups = values.groups;
|
|
383
380
|
const errors = {
|
|
384
381
|
fileName: {},
|
|
385
382
|
locales: {},
|
|
386
383
|
fields: {}
|
|
387
384
|
};
|
|
388
385
|
if (uiKit.TextInput.isEmpty(fileName)) {
|
|
386
|
+
// @ts-ignore
|
|
389
387
|
errors.fileName.missing = true;
|
|
390
388
|
} else if (!/^[a-zA-Z0-9-_.]+$/.test(fileName)) {
|
|
389
|
+
// @ts-ignore
|
|
391
390
|
errors.fileName.invalidInput = true;
|
|
392
391
|
}
|
|
393
392
|
if (locales.length < 1) {
|
|
393
|
+
// @ts-ignore
|
|
394
394
|
errors.locales.missing = true;
|
|
395
395
|
}
|
|
396
396
|
if (step === 2) {
|
|
397
|
-
const
|
|
398
|
-
const
|
|
399
|
-
|
|
400
|
-
return
|
|
401
|
-
}
|
|
402
|
-
if (
|
|
397
|
+
const allFields = _reduceInstanceProperty__default["default"](groups).call(groups, (acc, group) => _concatInstanceProperty__default["default"](acc).call(acc, group.fields), []);
|
|
398
|
+
const checkedFieldsCount = _filterInstanceProperty__default["default"](allFields).call(allFields, field => {
|
|
399
|
+
if (field.fields) return checkAtLeastOneFieldChecked$1(field.fields);
|
|
400
|
+
return !field.isRequired && !field.isReadOnly && field.isChecked;
|
|
401
|
+
}).length;
|
|
402
|
+
if (checkedFieldsCount < 1) {
|
|
403
|
+
// @ts-ignore
|
|
403
404
|
errors.fields.missing = true;
|
|
404
405
|
}
|
|
405
406
|
}
|
|
406
407
|
return omitEmpty__default["default"](errors);
|
|
407
408
|
}
|
|
408
409
|
|
|
409
|
-
function ownKeys$
|
|
410
|
-
function _objectSpread$
|
|
410
|
+
function ownKeys$5(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; }
|
|
411
|
+
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context5 = ownKeys$5(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$5(Object(t))).call(_context6, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
411
412
|
function resourceTypeToDisplayName(_ref) {
|
|
412
413
|
let resourceType = _ref.resourceType,
|
|
413
414
|
_ref$isUpperCase = _ref.isUpperCase,
|
|
@@ -426,7 +427,7 @@ function resourceTypeToDisplayName(_ref) {
|
|
|
426
427
|
displayName = isPlural ? 'Discount codes' : 'Discount code';
|
|
427
428
|
break;
|
|
428
429
|
default:
|
|
429
|
-
throw UnexpectedResourceTypeError(resourceType);
|
|
430
|
+
throw shared.UnexpectedResourceTypeError(resourceType);
|
|
430
431
|
}
|
|
431
432
|
return isUpperCase ? displayName : displayName.toLowerCase();
|
|
432
433
|
}
|
|
@@ -451,7 +452,7 @@ function flattenNestedFields(fields) {
|
|
|
451
452
|
var _context2;
|
|
452
453
|
return _mapInstanceProperty__default["default"](_context2 = flattenNestedFields(field.fields)).call(_context2, nestedField => {
|
|
453
454
|
var _context3;
|
|
454
|
-
return _objectSpread$
|
|
455
|
+
return _objectSpread$5(_objectSpread$5({}, nestedField), {}, {
|
|
455
456
|
name: _concatInstanceProperty__default["default"](_context3 = "".concat(field.name, ".")).call(_context3, nestedField.name)
|
|
456
457
|
});
|
|
457
458
|
});
|
|
@@ -460,19 +461,8 @@ function flattenNestedFields(fields) {
|
|
|
460
461
|
})) || [];
|
|
461
462
|
return _flatInstanceProperty__default["default"](result).call(result);
|
|
462
463
|
}
|
|
463
|
-
function getSelectedGeneralFields(fields) {
|
|
464
|
-
return _filterInstanceProperty__default["default"](fields).call(fields, field => field.isChecked);
|
|
465
|
-
}
|
|
466
|
-
function getSelectedCustomFields(customFields) {
|
|
467
|
-
return _mapInstanceProperty__default["default"](customFields).call(customFields, customType => {
|
|
468
|
-
var _context4;
|
|
469
|
-
return _objectSpread$4(_objectSpread$4({}, customType), {}, {
|
|
470
|
-
fields: _filterInstanceProperty__default["default"](_context4 = customType.fields).call(_context4, field => field.isChecked)
|
|
471
|
-
});
|
|
472
|
-
});
|
|
473
|
-
}
|
|
474
464
|
function checkRequiredFields(fields) {
|
|
475
|
-
return _mapInstanceProperty__default["default"](fields).call(fields, field => field.isRequired ? _objectSpread$
|
|
465
|
+
return _mapInstanceProperty__default["default"](fields).call(fields, field => field.isRequired ? _objectSpread$5(_objectSpread$5({}, field), {}, {
|
|
476
466
|
isChecked: true
|
|
477
467
|
}) : field);
|
|
478
468
|
}
|
|
@@ -484,45 +474,38 @@ function getExportLogsLink(projectKey, msg) {
|
|
|
484
474
|
}
|
|
485
475
|
function setInitialCheckedStateForCustomFields(customFields) {
|
|
486
476
|
return _mapInstanceProperty__default["default"](customFields).call(customFields, customType => {
|
|
487
|
-
var
|
|
488
|
-
return _objectSpread$
|
|
489
|
-
fields: _mapInstanceProperty__default["default"](
|
|
477
|
+
var _context4;
|
|
478
|
+
return _objectSpread$5(_objectSpread$5({}, customType), {}, {
|
|
479
|
+
fields: _mapInstanceProperty__default["default"](_context4 = customType.fields).call(_context4, field => _objectSpread$5(_objectSpread$5({}, field), {}, {
|
|
490
480
|
isChecked: false
|
|
491
481
|
}))
|
|
492
482
|
});
|
|
493
483
|
});
|
|
494
484
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
const fields = _flatMapInstanceProperty__default["default"](customFields).call(customFields, customType => {
|
|
500
|
-
var _context6;
|
|
501
|
-
return _flatMapInstanceProperty__default["default"](_context6 = customType.fields).call(_context6, field => {
|
|
502
|
-
return getCustomFieldNameWithPrefix(field, customType.type.resourceTypeIds);
|
|
503
|
-
});
|
|
504
|
-
});
|
|
505
|
-
return [...new _Set__default["default"](fields)];
|
|
506
|
-
}
|
|
507
|
-
function getCustomFieldNameWithPrefix(field, resourceTypeIds) {
|
|
508
|
-
const prefixes = _mapInstanceProperty__default["default"](resourceTypeIds).call(resourceTypeIds, type => {
|
|
509
|
-
switch (type) {
|
|
510
|
-
case 'asset':
|
|
511
|
-
return 'assets.custom.fields.';
|
|
512
|
-
default:
|
|
513
|
-
return 'custom.fields.';
|
|
485
|
+
const extractFieldNamesAndAdditionalFieldExtensions = fields => {
|
|
486
|
+
const result = _reduceInstanceProperty__default["default"](fields).call(fields, (acc, field) => {
|
|
487
|
+
if (field.additionalFieldExtensions) {
|
|
488
|
+
return [...acc, ...field.additionalFieldExtensions, field.name];
|
|
514
489
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
490
|
+
return [...acc, field.name];
|
|
491
|
+
}, []);
|
|
492
|
+
return [...new _Set__default["default"](result)];
|
|
493
|
+
};
|
|
494
|
+
function sortFieldsByFieldOrder(_ref2) {
|
|
495
|
+
let fields = _ref2.fields,
|
|
496
|
+
fieldOrder = _ref2.fieldOrder;
|
|
497
|
+
if (isFilledArray(fieldOrder)) {
|
|
498
|
+
return _sortInstanceProperty__default["default"](fields).call(fields, (a, b) => {
|
|
499
|
+
let orderA = _indexOfInstanceProperty__default["default"](fieldOrder).call(fieldOrder, a) !== -1 ? _indexOfInstanceProperty__default["default"](fieldOrder).call(fieldOrder, a) : _indexOfInstanceProperty__default["default"](fieldOrder).call(fieldOrder, a.split('.')[0]);
|
|
500
|
+
let orderB = _indexOfInstanceProperty__default["default"](fieldOrder).call(fieldOrder, b) !== -1 ? _indexOfInstanceProperty__default["default"](fieldOrder).call(fieldOrder, b) : _indexOfInstanceProperty__default["default"](fieldOrder).call(fieldOrder, b.split('.')[0]);
|
|
521
501
|
|
|
522
|
-
//
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
502
|
+
// If a field is not 'custom',then consider it as '*'
|
|
503
|
+
orderA = orderA === -1 ? _indexOfInstanceProperty__default["default"](fieldOrder).call(fieldOrder, '*') : orderA;
|
|
504
|
+
orderB = orderB === -1 ? _indexOfInstanceProperty__default["default"](fieldOrder).call(fieldOrder, '*') : orderB;
|
|
505
|
+
return orderA - orderB;
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
return fields;
|
|
526
509
|
}
|
|
527
510
|
|
|
528
511
|
// TODO: remove this function when filters are passed directly from parent views
|
|
@@ -535,38 +518,47 @@ function tmpBuildFilters(selectedResourceIds) {
|
|
|
535
518
|
return ["id in (".concat(formattedIds, ")")];
|
|
536
519
|
}
|
|
537
520
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
const
|
|
541
|
-
const
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
default: defaultFieldExtension,
|
|
562
|
-
category: categoryFieldExtension
|
|
521
|
+
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; }
|
|
522
|
+
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; }
|
|
523
|
+
const updateFieldGroupsWithIsCheckedValue = groups => {
|
|
524
|
+
const updateFields = (fields, parentChecked) => {
|
|
525
|
+
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
526
|
+
var _field$isRequired;
|
|
527
|
+
let isChecked = ((_field$isRequired = field.isRequired) !== null && _field$isRequired !== void 0 ? _field$isRequired : !field.isReadOnly && field.isSelectedByDefault) || parentChecked;
|
|
528
|
+
if (field.fields) {
|
|
529
|
+
const updatedFields = updateFields(field.fields, isChecked);
|
|
530
|
+
isChecked = false;
|
|
531
|
+
field.fields = updatedFields;
|
|
532
|
+
}
|
|
533
|
+
return _objectSpread$4(_objectSpread$4({}, field), {}, {
|
|
534
|
+
isChecked
|
|
535
|
+
});
|
|
536
|
+
});
|
|
537
|
+
};
|
|
538
|
+
return _mapInstanceProperty__default["default"](groups).call(groups, group => {
|
|
539
|
+
const updatedFields = updateFields(group.fields, false);
|
|
540
|
+
return _objectSpread$4(_objectSpread$4({}, group), {}, {
|
|
541
|
+
fields: updatedFields
|
|
542
|
+
});
|
|
543
|
+
});
|
|
563
544
|
};
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
545
|
+
const updateFieldGroupWithAdditionalFieldExtensions = groups => {
|
|
546
|
+
function updateAdditionalFieldExtensions(fields, additionalFieldExtensions) {
|
|
547
|
+
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
548
|
+
const updatedAdditionalFieldExtensions = [...additionalFieldExtensions, ...(field.additionalFieldExtensions || [])];
|
|
549
|
+
if (field.fields) {
|
|
550
|
+
field.fields = updateAdditionalFieldExtensions(field.fields, updatedAdditionalFieldExtensions);
|
|
551
|
+
}
|
|
552
|
+
return _objectSpread$4(_objectSpread$4({}, field), {}, {
|
|
553
|
+
additionalFieldExtensions: updatedAdditionalFieldExtensions
|
|
554
|
+
});
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
return _mapInstanceProperty__default["default"](groups).call(groups, group => {
|
|
558
|
+
return _objectSpread$4(_objectSpread$4({}, group), {}, {
|
|
559
|
+
fields: updateAdditionalFieldExtensions(group.fields, group.additionalFieldExtensions || [])
|
|
560
|
+
});
|
|
561
|
+
});
|
|
570
562
|
};
|
|
571
563
|
|
|
572
564
|
const _excluded = ["isSelectedByDefault"];
|
|
@@ -586,6 +578,7 @@ const useInitialValues = props => {
|
|
|
586
578
|
isChecked: isSelectedByDefault !== null && isSelectedByDefault !== void 0 ? isSelectedByDefault : true
|
|
587
579
|
});
|
|
588
580
|
});
|
|
581
|
+
const groups = updateFieldGroupsWithIsCheckedValue(props.fieldGroups);
|
|
589
582
|
return React__default["default"].useMemo(() => {
|
|
590
583
|
var _context2;
|
|
591
584
|
return {
|
|
@@ -597,9 +590,10 @@ const useInitialValues = props => {
|
|
|
597
590
|
}), "_Export_")).call(_context2, todayFormatted),
|
|
598
591
|
locales: [locale],
|
|
599
592
|
fields: checkRequiredFields(fields),
|
|
600
|
-
customFields: setInitialCheckedStateForCustomFields(props.customFields)
|
|
593
|
+
customFields: setInitialCheckedStateForCustomFields(props.customFields),
|
|
594
|
+
groups: updateFieldGroupWithAdditionalFieldExtensions(groups)
|
|
601
595
|
};
|
|
602
|
-
}, [props, locale, todayFormatted, fields]);
|
|
596
|
+
}, [props, locale, todayFormatted, fields, groups]);
|
|
603
597
|
};
|
|
604
598
|
|
|
605
599
|
async function createExportOperation(_ref) {
|
|
@@ -628,7 +622,7 @@ async function createExportOperation(_ref) {
|
|
|
628
622
|
filters
|
|
629
623
|
}
|
|
630
624
|
}));
|
|
631
|
-
if (!response.state) throw new InvalidResponseError('Invalid response');
|
|
625
|
+
if (!response.state) throw new shared.InvalidResponseError('Invalid response');
|
|
632
626
|
return response;
|
|
633
627
|
}
|
|
634
628
|
|
|
@@ -644,12 +638,29 @@ const useStartExportOperation = props => {
|
|
|
644
638
|
};
|
|
645
639
|
}),
|
|
646
640
|
projectKey = _useApplicationContex.projectKey;
|
|
641
|
+
const extractFieldsFromGroups = groups => {
|
|
642
|
+
let selectedGeneralFields = [];
|
|
643
|
+
const getSelectedFields = fields => {
|
|
644
|
+
return _filterInstanceProperty__default["default"](fields).call(fields, field => {
|
|
645
|
+
var _field$isChecked;
|
|
646
|
+
if (field.fields) {
|
|
647
|
+
return getSelectedFields(field.fields);
|
|
648
|
+
}
|
|
649
|
+
if (field.isChecked) selectedGeneralFields.push(field);
|
|
650
|
+
return (_field$isChecked = field.isChecked) !== null && _field$isChecked !== void 0 ? _field$isChecked : false;
|
|
651
|
+
});
|
|
652
|
+
};
|
|
653
|
+
_forEachInstanceProperty__default["default"](groups).call(groups, group => {
|
|
654
|
+
getSelectedFields(group.fields);
|
|
655
|
+
});
|
|
656
|
+
return sortFieldsByFieldOrder({
|
|
657
|
+
fields: extractFieldNamesAndAdditionalFieldExtensions(selectedGeneralFields),
|
|
658
|
+
fieldOrder: props.fieldOrder
|
|
659
|
+
});
|
|
660
|
+
};
|
|
647
661
|
const startExportOperation = async values => {
|
|
648
662
|
try {
|
|
649
|
-
const
|
|
650
|
-
const selectedCustomFields = getSelectedCustomFields(values.customFields);
|
|
651
|
-
const generalFields = extractGeneralFieldNames(selectedGeneralFields);
|
|
652
|
-
const customFields = sortCustomFields(extractCustomFieldNamesWithPrefix(selectedCustomFields));
|
|
663
|
+
const fields = extractFieldsFromGroups(values.groups);
|
|
653
664
|
const filters = tmpBuildFilters(props.selectedResourceIds);
|
|
654
665
|
const response = await createExportOperation({
|
|
655
666
|
projectKey,
|
|
@@ -657,10 +668,7 @@ const useStartExportOperation = props => {
|
|
|
657
668
|
fileName: appendCsvOrJsonExtensionIfAbsent(values.fileName, values.outputFormat),
|
|
658
669
|
fileFormat: values.outputFormat,
|
|
659
670
|
locales: values.locales,
|
|
660
|
-
fields
|
|
661
|
-
resourceType: props.resourceType,
|
|
662
|
-
fields: [...generalFields, ...customFields]
|
|
663
|
-
}),
|
|
671
|
+
fields,
|
|
664
672
|
filters,
|
|
665
673
|
asyncDispatchFn: asyncDispatch
|
|
666
674
|
});
|
|
@@ -670,6 +678,7 @@ const useStartExportOperation = props => {
|
|
|
670
678
|
showNotification({
|
|
671
679
|
kind: 'info',
|
|
672
680
|
domain: constants.DOMAINS.SIDE,
|
|
681
|
+
// @ts-ignore
|
|
673
682
|
text: intl.formatMessage(messages.exportOperationSuccessMessage, {
|
|
674
683
|
newline: getNewLine,
|
|
675
684
|
logsLink: msg => getExportLogsLink(projectKey, msg),
|
|
@@ -827,29 +836,191 @@ const ExportFileSettingsStep = () => {
|
|
|
827
836
|
});
|
|
828
837
|
};
|
|
829
838
|
|
|
839
|
+
var _ref = {
|
|
840
|
+
name: "ti75j2",
|
|
841
|
+
styles: "margin:0"
|
|
842
|
+
} ;
|
|
843
|
+
const NoSearchResults = () => {
|
|
844
|
+
return jsxRuntime.jsxs(uiKit.Card, {
|
|
845
|
+
insetScale: "xl",
|
|
846
|
+
children: [jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
847
|
+
scale: "s",
|
|
848
|
+
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
849
|
+
fontWeight: "medium",
|
|
850
|
+
intlMessage: messages.thereAreNoResults
|
|
851
|
+
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
852
|
+
intlMessage: messages.suggestions
|
|
853
|
+
})]
|
|
854
|
+
}), jsxRuntime.jsxs("ul", {
|
|
855
|
+
css: _ref,
|
|
856
|
+
children: [jsxRuntime.jsx("li", {
|
|
857
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
858
|
+
intlMessage: messages.checkTheSpelling
|
|
859
|
+
})
|
|
860
|
+
}), jsxRuntime.jsx("li", {
|
|
861
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
862
|
+
intlMessage: messages.searchByEnteringTheExactFieldName
|
|
863
|
+
})
|
|
864
|
+
})]
|
|
865
|
+
})]
|
|
866
|
+
});
|
|
867
|
+
};
|
|
868
|
+
|
|
830
869
|
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; }
|
|
831
|
-
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
832
|
-
const
|
|
833
|
-
target: "
|
|
834
|
-
} )("height:100%;
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
870
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context7 = ownKeys$1(Object(t), !0)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context8 = ownKeys$1(Object(t))).call(_context8, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
871
|
+
const StyledGroupCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
872
|
+
target: "e3xiyhb1"
|
|
873
|
+
} )("border-right:", uiKit.designTokens.borderWidth1, " solid ", uiKit.designTokens.colorNeutral90, ";background-color:", uiKit.designTokens.colorNeutral98, ";height:100%;border-radius:0;", props => props.showTopBorder && /*#__PURE__*/react.css("border-top:", uiKit.designTokens.borderWidth1, " solid ", uiKit.designTokens.colorNeutral90, ";" + ("" ), "" ), ";" + ("" ));
|
|
874
|
+
const StyledFieldsCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
875
|
+
target: "e3xiyhb0"
|
|
876
|
+
} )("border-radius:0;", props => props.showTopBorder && /*#__PURE__*/react.css("border-top:", uiKit.designTokens.borderWidth1, " solid ", uiKit.designTokens.colorNeutral90, ";" + ("" ), "" ), ";" + ("" ));
|
|
877
|
+
const FieldSections = _ref => {
|
|
878
|
+
let fields = _ref.fields,
|
|
879
|
+
parentKeys = _ref.parentKeys,
|
|
880
|
+
formik = _ref.formik,
|
|
881
|
+
isAnySiblingChecked = _ref.isAnySiblingChecked;
|
|
882
|
+
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
883
|
+
scale: "s",
|
|
884
|
+
children: fields === null || fields === void 0 ? void 0 : _mapInstanceProperty__default["default"](fields).call(fields, (field, index) => {
|
|
885
|
+
var _context, _field$fields3;
|
|
886
|
+
const isAtleastOneChildChecked = () => {
|
|
887
|
+
function checkAtLeastOneFieldChecked(fields) {
|
|
888
|
+
return fields === null || fields === void 0 ? void 0 : _someInstanceProperty__default["default"](fields).call(fields, field => {
|
|
889
|
+
if (field.fields) {
|
|
890
|
+
return field.isChecked || checkAtLeastOneFieldChecked(field.fields);
|
|
891
|
+
}
|
|
892
|
+
return field.isChecked;
|
|
893
|
+
});
|
|
894
|
+
}
|
|
895
|
+
return checkAtLeastOneFieldChecked(field.fields);
|
|
896
|
+
};
|
|
897
|
+
const isAnyOfTheChildFieldsChecked = isAtleastOneChildChecked();
|
|
898
|
+
if (field.isHidden) return null;
|
|
899
|
+
return jsxRuntime.jsxs(React__default["default"].Fragment, {
|
|
900
|
+
children: [jsxRuntime.jsxs(uiKit.CheckboxInput, {
|
|
901
|
+
isChecked: field.isReadOnly ? isAnySiblingChecked : isAnyOfTheChildFieldsChecked || field.isChecked,
|
|
902
|
+
isReadOnly: field.isReadOnly || field.isRequired,
|
|
903
|
+
onChange: e => {
|
|
904
|
+
var _context2, _field$fields2;
|
|
905
|
+
const path = _concatInstanceProperty__default["default"](_context2 = "".concat(parentKeys.join('.'), ".fields[")).call(_context2, index, "]");
|
|
906
|
+
// Update all child fields
|
|
907
|
+
const updateAllChildFieldsChecked = (path, checked) => {
|
|
908
|
+
const item = get__default["default"](_valuesInstanceProperty__default["default"](formik), path);
|
|
909
|
+
if (item && item.fields) {
|
|
910
|
+
var _context3;
|
|
911
|
+
_forEachInstanceProperty__default["default"](_context3 = item.fields).call(_context3, (field, i) => {
|
|
912
|
+
var _context4, _field$fields;
|
|
913
|
+
const fieldPath = _concatInstanceProperty__default["default"](_context4 = "".concat(path, ".fields[")).call(_context4, i, "]");
|
|
914
|
+
if (!((_field$fields = field.fields) !== null && _field$fields !== void 0 && _field$fields.length)) {
|
|
915
|
+
formik.setFieldValue("".concat(fieldPath, ".isChecked"), checked,
|
|
916
|
+
// pass `false` to avoid revalidating the form with intermediate values
|
|
917
|
+
false);
|
|
918
|
+
}
|
|
919
|
+
updateAllChildFieldsChecked(fieldPath, checked);
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
};
|
|
923
|
+
if (!((_field$fields2 = field.fields) !== null && _field$fields2 !== void 0 && _field$fields2.length)) {
|
|
924
|
+
formik.setFieldValue("".concat(path, ".isChecked"), e.target.checked,
|
|
925
|
+
// pass `false` to avoid revalidating the form with intermediate values
|
|
926
|
+
false);
|
|
927
|
+
}
|
|
928
|
+
updateAllChildFieldsChecked(path, e.target.checked);
|
|
929
|
+
},
|
|
930
|
+
children: [field.label, " ", field.isRequired && '*']
|
|
931
|
+
}), field.fields && ((_field$fields3 = field.fields) === null || _field$fields3 === void 0 ? void 0 : _field$fields3.length) > 0 && jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
932
|
+
scale: "l",
|
|
933
|
+
children: [jsxRuntime.jsx("div", {}), jsxRuntime.jsx(FieldSections, {
|
|
934
|
+
fields: field.fields,
|
|
935
|
+
formik: formik,
|
|
936
|
+
parentKeys: [...parentKeys, "fields[".concat(index, "]")],
|
|
937
|
+
isAnySiblingChecked: isAnySiblingChecked
|
|
938
|
+
})]
|
|
939
|
+
})]
|
|
940
|
+
}, _concatInstanceProperty__default["default"](_context = "".concat(field.name, "-")).call(_context, index));
|
|
941
|
+
})
|
|
942
|
+
});
|
|
943
|
+
};
|
|
944
|
+
function checkAllFieldsSelected(fields) {
|
|
945
|
+
return _everyInstanceProperty__default["default"](fields).call(fields, field => {
|
|
946
|
+
if (field.fields) {
|
|
947
|
+
return checkAllFieldsSelected(field.fields);
|
|
948
|
+
}
|
|
949
|
+
return field.isChecked || field.isRequired || field.isReadOnly;
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
function checkAtLeastOneFieldChecked(fields) {
|
|
953
|
+
return _someInstanceProperty__default["default"](fields).call(fields, field => {
|
|
954
|
+
if (field.fields) {
|
|
955
|
+
return field.isChecked || checkAtLeastOneFieldChecked(field.fields);
|
|
956
|
+
}
|
|
957
|
+
return field.isChecked;
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
const FieldGroupSection = _ref2 => {
|
|
961
|
+
let group = _ref2.group,
|
|
962
|
+
index = _ref2.index,
|
|
963
|
+
formik = _ref2.formik;
|
|
964
|
+
const allAllFieldsSelected = React__default["default"].useMemo(() => checkAllFieldsSelected(group.fields), [group.fields]);
|
|
965
|
+
const isAtleastOneFieldChecked = React__default["default"].useMemo(() => checkAtLeastOneFieldChecked(group.fields), [group.fields]);
|
|
966
|
+
const parentKey = "groups[".concat(index, "]");
|
|
967
|
+
const handleChangeAllFields = e => {
|
|
968
|
+
const item = get__default["default"](_valuesInstanceProperty__default["default"](formik), parentKey);
|
|
969
|
+
function updateAllFields(fields, checked) {
|
|
970
|
+
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
971
|
+
if (field.fields) {
|
|
972
|
+
return _objectSpread$1(_objectSpread$1({}, field), {}, {
|
|
973
|
+
fields: updateAllFields(field.fields, checked)
|
|
974
|
+
});
|
|
975
|
+
}
|
|
976
|
+
if (field.isReadOnly || field.isRequired) return field;
|
|
977
|
+
return _objectSpread$1(_objectSpread$1({}, field), {}, {
|
|
978
|
+
isChecked: checked
|
|
979
|
+
});
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
formik.setFieldValue(parentKey, _objectSpread$1(_objectSpread$1({}, item), {}, {
|
|
983
|
+
fields: updateAllFields(item.fields, e.target.checked)
|
|
984
|
+
}));
|
|
985
|
+
};
|
|
986
|
+
if (group.isHidden) return null;
|
|
987
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
988
|
+
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
989
|
+
children: jsxRuntime.jsx(StyledGroupCard, {
|
|
990
|
+
type: "flat",
|
|
991
|
+
insetScale: "l",
|
|
992
|
+
showTopBorder: true,
|
|
993
|
+
children: jsxRuntime.jsx(uiKit.CheckboxInput, {
|
|
994
|
+
isIndeterminate: !allAllFieldsSelected && isAtleastOneFieldChecked,
|
|
995
|
+
isChecked: allAllFieldsSelected,
|
|
996
|
+
onChange: handleChangeAllFields,
|
|
997
|
+
children: group.groupLabel
|
|
998
|
+
})
|
|
999
|
+
})
|
|
1000
|
+
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1001
|
+
children: jsxRuntime.jsx(StyledFieldsCard, {
|
|
1002
|
+
type: "flat",
|
|
1003
|
+
insetScale: "l",
|
|
1004
|
+
showTopBorder: true,
|
|
1005
|
+
children: jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
1006
|
+
scale: "s",
|
|
1007
|
+
children: jsxRuntime.jsx(FieldSections, {
|
|
1008
|
+
fields: group.fields,
|
|
1009
|
+
formik: formik,
|
|
1010
|
+
parentKeys: [parentKey],
|
|
1011
|
+
isAnySiblingChecked: isAtleastOneFieldChecked
|
|
1012
|
+
})
|
|
1013
|
+
})
|
|
1014
|
+
})
|
|
1015
|
+
})]
|
|
1016
|
+
});
|
|
1017
|
+
};
|
|
850
1018
|
const ExportFieldsSelectionStep = () => {
|
|
851
|
-
var _formik$values$custom;
|
|
852
1019
|
const intl = reactIntl.useIntl();
|
|
1020
|
+
const _React$useState = React__default["default"].useState(''),
|
|
1021
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1022
|
+
fieldSearchTerm = _React$useState2[0],
|
|
1023
|
+
setFieldSearchTerm = _React$useState2[1];
|
|
853
1024
|
const _useExportResourcesCo = useExportResourcesContext(),
|
|
854
1025
|
formik = _useExportResourcesCo.formik,
|
|
855
1026
|
setCurrentStep = _useExportResourcesCo.setCurrentStep,
|
|
@@ -859,24 +1030,48 @@ const ExportFieldsSelectionStep = () => {
|
|
|
859
1030
|
resourceType: resourceType,
|
|
860
1031
|
isPlural: true
|
|
861
1032
|
});
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
}, [_valuesInstanceProperty__default["default"](formik).
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
1033
|
+
React__default["default"].useEffect(() => {
|
|
1034
|
+
formik.validateForm();
|
|
1035
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1036
|
+
}, [_valuesInstanceProperty__default["default"](formik).groups]);
|
|
1037
|
+
// adds `isHidden` property to each field based on search term
|
|
1038
|
+
const filteredGroups = React__default["default"].useMemo(() => {
|
|
1039
|
+
var _fieldSearchTerm$trim, _context6;
|
|
1040
|
+
const updateFields = (fields, parentMatches) => {
|
|
1041
|
+
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
1042
|
+
var _context5;
|
|
1043
|
+
const matches = _includesInstanceProperty__default["default"](_context5 = field.label.toLowerCase()).call(_context5, fieldSearchTerm.toLowerCase());
|
|
1044
|
+
let isHidden = !matches && !parentMatches;
|
|
1045
|
+
if (field.fields) {
|
|
1046
|
+
const updatedFields = updateFields(field.fields, matches);
|
|
1047
|
+
isHidden = isHidden && _everyInstanceProperty__default["default"](updatedFields).call(updatedFields, f => f.isHidden);
|
|
1048
|
+
field = _objectSpread$1(_objectSpread$1({}, field), {}, {
|
|
1049
|
+
fields: updatedFields
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
return _objectSpread$1(_objectSpread$1({}, field), {}, {
|
|
1053
|
+
isHidden
|
|
1054
|
+
});
|
|
1055
|
+
});
|
|
1056
|
+
};
|
|
1057
|
+
if (!(fieldSearchTerm !== null && fieldSearchTerm !== void 0 && (_fieldSearchTerm$trim = _trimInstanceProperty__default["default"](fieldSearchTerm).call(fieldSearchTerm)) !== null && _fieldSearchTerm$trim !== void 0 && _fieldSearchTerm$trim.length)) return _valuesInstanceProperty__default["default"](formik).groups;
|
|
1058
|
+
return _mapInstanceProperty__default["default"](_context6 = _valuesInstanceProperty__default["default"](formik).groups).call(_context6, group => {
|
|
1059
|
+
const updatedFields = updateFields(group.fields, false);
|
|
1060
|
+
const isHidden = _everyInstanceProperty__default["default"](updatedFields).call(updatedFields, field => field.isHidden);
|
|
1061
|
+
return _objectSpread$1(_objectSpread$1({}, group), {}, {
|
|
1062
|
+
fields: updatedFields,
|
|
1063
|
+
isHidden
|
|
1064
|
+
});
|
|
1065
|
+
});
|
|
1066
|
+
}, [_valuesInstanceProperty__default["default"](formik).groups, fieldSearchTerm]);
|
|
1067
|
+
const onSearchChange = React__default["default"].useCallback(event => {
|
|
1068
|
+
setFieldSearchTerm(event.target.value);
|
|
1069
|
+
}, [setFieldSearchTerm]);
|
|
1070
|
+
const hasResults = Boolean(_findInstanceProperty__default["default"](filteredGroups).call(filteredGroups, group => !group.isHidden));
|
|
1071
|
+
const onSearchChangeThrottled = React__default["default"].useMemo(() => throttle__default["default"](onSearchChange, 300), [onSearchChange]);
|
|
1072
|
+
const onSearchReset = () => {
|
|
1073
|
+
setFieldSearchTerm('');
|
|
1074
|
+
};
|
|
880
1075
|
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
881
1076
|
isOpen: true,
|
|
882
1077
|
title: intl.formatMessage(messages.modalTitle, {
|
|
@@ -903,182 +1098,33 @@ const ExportFieldsSelectionStep = () => {
|
|
|
903
1098
|
intlMessage: messages.fieldDefinitions,
|
|
904
1099
|
to: FIELD_DEFINITIONS_URLS[resourceType]
|
|
905
1100
|
})]
|
|
906
|
-
}), jsxRuntime.
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
children: jsxRuntime.jsx(StyledCardRight, {
|
|
927
|
-
isTopRow: true,
|
|
928
|
-
insetScale: "l",
|
|
929
|
-
children: jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
930
|
-
scale: "s",
|
|
931
|
-
children: jsxRuntime.jsx(GeneralFieldsSelection, {
|
|
932
|
-
fields: _valuesInstanceProperty__default["default"](formik).fields,
|
|
933
|
-
setFieldValue: formik.setFieldValue
|
|
934
|
-
})
|
|
935
|
-
})
|
|
936
|
-
})
|
|
937
|
-
}), ((_formik$values$custom = _valuesInstanceProperty__default["default"](formik).customFields) === null || _formik$values$custom === void 0 ? void 0 : _formik$values$custom.length) > 0 && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
938
|
-
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
939
|
-
children: jsxRuntime.jsx(StyledCardLeft, {
|
|
940
|
-
insetScale: "l",
|
|
941
|
-
children: jsxRuntime.jsx(uiKit.CheckboxInput, {
|
|
942
|
-
isIndeterminate: !areAllCustomFieldsChecked && isAtLeastOneCustomFieldChecked,
|
|
943
|
-
isChecked: areAllCustomFieldsChecked,
|
|
944
|
-
onChange: e => {
|
|
945
|
-
var _context5;
|
|
946
|
-
formik.setFieldValue('customFields', _mapInstanceProperty__default["default"](_context5 = _valuesInstanceProperty__default["default"](formik).customFields).call(_context5, customType => {
|
|
947
|
-
var _context6;
|
|
948
|
-
return _objectSpread$1(_objectSpread$1({}, customType), {}, {
|
|
949
|
-
fields: _mapInstanceProperty__default["default"](_context6 = customType.fields).call(_context6, field => _objectSpread$1(_objectSpread$1({}, field), {}, {
|
|
950
|
-
isChecked: e.target.checked
|
|
951
|
-
}))
|
|
952
|
-
});
|
|
953
|
-
}));
|
|
954
|
-
},
|
|
955
|
-
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$1({}, messages.allCustomFields))
|
|
956
|
-
})
|
|
957
|
-
})
|
|
958
|
-
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
959
|
-
children: jsxRuntime.jsx(StyledCardRight, {
|
|
960
|
-
insetScale: "l",
|
|
961
|
-
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
962
|
-
scale: "s",
|
|
963
|
-
children: [jsxRuntime.jsxs(uiKit.CheckboxInput, {
|
|
964
|
-
isReadOnly: true,
|
|
965
|
-
onChange: () => {},
|
|
966
|
-
isChecked: isAtLeastOneCustomFieldChecked,
|
|
967
|
-
children: [jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$1({}, messages.customTypeKeyAndTypeId)), ' ', "*"]
|
|
968
|
-
}), jsxRuntime.jsx(CustomFieldsSelection, {
|
|
969
|
-
customFields: _valuesInstanceProperty__default["default"](formik).customFields,
|
|
970
|
-
setFieldValue: formik.setFieldValue
|
|
971
|
-
})]
|
|
972
|
-
})
|
|
973
|
-
})
|
|
974
|
-
})]
|
|
975
|
-
})]
|
|
976
|
-
})]
|
|
1101
|
+
}), jsxRuntime.jsx(uiKit.SearchTextInput, {
|
|
1102
|
+
placeholder: intl.formatMessage(messages.searchForFields),
|
|
1103
|
+
value: fieldSearchTerm,
|
|
1104
|
+
onChange: onSearchChangeThrottled,
|
|
1105
|
+
onReset: onSearchReset
|
|
1106
|
+
// TODO: `SearchTextInput` props to be improved. The `onSubmit` callback shouldn't be mandatory
|
|
1107
|
+
,
|
|
1108
|
+
onSubmit: () => {}
|
|
1109
|
+
}), hasResults ? jsxRuntime.jsx(uiKit.Card, {
|
|
1110
|
+
insetScale: "none",
|
|
1111
|
+
children: jsxRuntime.jsx(uiKit.Grid, {
|
|
1112
|
+
gridAutoFlow: "row",
|
|
1113
|
+
gridTemplateColumns: "".concat(uiKit.designTokens.constraint5, " auto"),
|
|
1114
|
+
children: _mapInstanceProperty__default["default"](filteredGroups).call(filteredGroups, (group, index) => jsxRuntime.jsx(FieldGroupSection, {
|
|
1115
|
+
group: group,
|
|
1116
|
+
index: index,
|
|
1117
|
+
formik: formik
|
|
1118
|
+
}, group.groupLabel))
|
|
1119
|
+
})
|
|
1120
|
+
}) : jsxRuntime.jsx(NoSearchResults, {})]
|
|
977
1121
|
})
|
|
978
1122
|
})
|
|
979
1123
|
});
|
|
980
1124
|
};
|
|
981
|
-
const GeneralFieldsSelection = _ref5 => {
|
|
982
|
-
let fields = _ref5.fields,
|
|
983
|
-
setFieldValue = _ref5.setFieldValue;
|
|
984
|
-
return _mapInstanceProperty__default["default"](fields).call(fields, field => jsxRuntime.jsxs(uiKit.CheckboxInput, {
|
|
985
|
-
isChecked: field.isChecked,
|
|
986
|
-
isReadOnly: field.isRequired,
|
|
987
|
-
onChange: e => {
|
|
988
|
-
setFieldValue('fields', _mapInstanceProperty__default["default"](fields).call(fields, _field => field.name === _field.name ? _objectSpread$1(_objectSpread$1({}, _field), {}, {
|
|
989
|
-
isChecked: e.target.checked
|
|
990
|
-
}) : _field));
|
|
991
|
-
},
|
|
992
|
-
children: [field.label, " ", field.isRequired && '*']
|
|
993
|
-
}, field.name));
|
|
994
|
-
};
|
|
995
|
-
const CustomFieldsSelection = _ref6 => {
|
|
996
|
-
let customFields = _ref6.customFields,
|
|
997
|
-
setFieldValue = _ref6.setFieldValue;
|
|
998
|
-
return _mapInstanceProperty__default["default"](customFields).call(customFields, customType => {
|
|
999
|
-
var _context7, _context8, _context10;
|
|
1000
|
-
const areAllFieldsChecked = _everyInstanceProperty__default["default"](_context7 = customType.fields).call(_context7, field => field.isChecked);
|
|
1001
|
-
const isAtLeastOneFieldChecked = _someInstanceProperty__default["default"](_context8 = customType.fields).call(_context8, field => field.isChecked);
|
|
1002
|
-
return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1003
|
-
scale: "s",
|
|
1004
|
-
children: [jsxRuntime.jsx(uiKit.CheckboxInput, {
|
|
1005
|
-
isIndeterminate: !areAllFieldsChecked && isAtLeastOneFieldChecked,
|
|
1006
|
-
isChecked: areAllFieldsChecked,
|
|
1007
|
-
onChange: e => {
|
|
1008
|
-
setFieldValue('customFields', _mapInstanceProperty__default["default"](customFields).call(customFields, _customType => {
|
|
1009
|
-
var _context9;
|
|
1010
|
-
return _customType.type.key === customType.type.key ? _objectSpread$1(_objectSpread$1({}, _customType), {}, {
|
|
1011
|
-
fields: _mapInstanceProperty__default["default"](_context9 = _customType.fields).call(_context9, field => _objectSpread$1(_objectSpread$1({}, field), {}, {
|
|
1012
|
-
isChecked: e.target.checked
|
|
1013
|
-
}))
|
|
1014
|
-
}) : _customType;
|
|
1015
|
-
}));
|
|
1016
|
-
},
|
|
1017
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1018
|
-
children: customType.type.label
|
|
1019
|
-
})
|
|
1020
|
-
}), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1021
|
-
scale: "l",
|
|
1022
|
-
children: [jsxRuntime.jsx("div", {}), jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
1023
|
-
scale: "s",
|
|
1024
|
-
children: _mapInstanceProperty__default["default"](_context10 = customType.fields).call(_context10, field => jsxRuntime.jsx(uiKit.CheckboxInput, {
|
|
1025
|
-
isChecked: field.isChecked,
|
|
1026
|
-
onChange: e => {
|
|
1027
|
-
setFieldValue('customFields', _mapInstanceProperty__default["default"](customFields).call(customFields, _customType => {
|
|
1028
|
-
var _context11;
|
|
1029
|
-
return _customType.type.key === customType.type.key ? _objectSpread$1(_objectSpread$1({}, _customType), {}, {
|
|
1030
|
-
fields: _mapInstanceProperty__default["default"](_context11 = _customType.fields).call(_context11, _field => _field.name === field.name ? _objectSpread$1(_objectSpread$1({}, _field), {}, {
|
|
1031
|
-
isChecked: e.target.checked
|
|
1032
|
-
}) : _field)
|
|
1033
|
-
}) : _customType;
|
|
1034
|
-
}));
|
|
1035
|
-
},
|
|
1036
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1037
|
-
children: field.label
|
|
1038
|
-
})
|
|
1039
|
-
}, field.name))
|
|
1040
|
-
})]
|
|
1041
|
-
})]
|
|
1042
|
-
}, customType.type.key);
|
|
1043
|
-
});
|
|
1044
|
-
};
|
|
1045
1125
|
|
|
1046
1126
|
const ExportResourcesContext = /*#__PURE__*/React.createContext();
|
|
1047
1127
|
|
|
1048
|
-
PropTypes__default["default"].shape({
|
|
1049
|
-
isOpen: PropTypes__default["default"].bool,
|
|
1050
|
-
resourceType: PropTypes__default["default"].string.isRequired,
|
|
1051
|
-
outputFormat: PropTypes__default["default"].string,
|
|
1052
|
-
onClose: PropTypes__default["default"].func,
|
|
1053
|
-
onExportSuccess: PropTypes__default["default"].func,
|
|
1054
|
-
totalResourcesCount: PropTypes__default["default"].number.isRequired,
|
|
1055
|
-
selectedResourceIds: PropTypes__default["default"].array,
|
|
1056
|
-
// TODO: Circular reference
|
|
1057
|
-
fields: PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
|
|
1058
|
-
name: PropTypes__default["default"].string.isRequired,
|
|
1059
|
-
label: PropTypes__default["default"].string,
|
|
1060
|
-
fields: PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
|
|
1061
|
-
name: PropTypes__default["default"].string.isRequired,
|
|
1062
|
-
label: PropTypes__default["default"].string,
|
|
1063
|
-
isSelectedByDefault: PropTypes__default["default"].bool,
|
|
1064
|
-
isRequired: PropTypes__default["default"].bool
|
|
1065
|
-
}))
|
|
1066
|
-
})).isRequired,
|
|
1067
|
-
customFields: PropTypes__default["default"].shape({
|
|
1068
|
-
type: PropTypes__default["default"].shape({
|
|
1069
|
-
key: PropTypes__default["default"].string.isRequired,
|
|
1070
|
-
label: PropTypes__default["default"].string.isRequired,
|
|
1071
|
-
resourceTypeIds: PropTypes__default["default"].arrayOf(PropTypes__default["default"].string)
|
|
1072
|
-
}).isRequired,
|
|
1073
|
-
fields: PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
|
|
1074
|
-
name: PropTypes__default["default"].string.isRequired,
|
|
1075
|
-
label: PropTypes__default["default"].string
|
|
1076
|
-
})).isRequired
|
|
1077
|
-
}),
|
|
1078
|
-
exportType: PropTypes__default["default"].string,
|
|
1079
|
-
renderProperties: PropTypes__default["default"].func
|
|
1080
|
-
}).isRequired;
|
|
1081
|
-
|
|
1082
1128
|
const ExportResourcesProvider = props => {
|
|
1083
1129
|
const initialValues = useInitialValues(props);
|
|
1084
1130
|
const _useStartExportOperat = useStartExportOperation(props),
|
|
@@ -1119,8 +1165,6 @@ const ExportResourcesProvider = props => {
|
|
|
1119
1165
|
children: props.children
|
|
1120
1166
|
});
|
|
1121
1167
|
};
|
|
1122
|
-
ExportResourcesProvider.displayName = 'ExportResourcesProvider';
|
|
1123
|
-
ExportResourcesProvider.propTypes = {};
|
|
1124
1168
|
|
|
1125
1169
|
const CurrentStep = () => {
|
|
1126
1170
|
const _useExportResourcesCo = useExportResourcesContext(),
|
|
@@ -1132,22 +1176,101 @@ const CurrentStep = () => {
|
|
|
1132
1176
|
return steps[currentStep] || null;
|
|
1133
1177
|
};
|
|
1134
1178
|
|
|
1179
|
+
const loadMessages = locale => {
|
|
1180
|
+
const intlLocale = i18n.mapLocaleToIntlLocale(locale);
|
|
1181
|
+
switch (intlLocale) {
|
|
1182
|
+
case 'de':
|
|
1183
|
+
return Promise.resolve().then(function () { return require( /* webpackChunkName: "export-resources-modal-i18n-de" */'./de-d954fe3d.cjs.prod.js'); });
|
|
1184
|
+
case 'es':
|
|
1185
|
+
return Promise.resolve().then(function () { return require( /* webpackChunkName: "export-resources-modal-i18n-es" */'./es-042343bd.cjs.prod.js'); });
|
|
1186
|
+
case 'fr-FR':
|
|
1187
|
+
return Promise.resolve().then(function () { return require( /* webpackChunkName: "export-resources-modal-i18n-fr-FR" */'./fr-FR-fce1ca96.cjs.prod.js'); });
|
|
1188
|
+
case 'zh-CN':
|
|
1189
|
+
return Promise.resolve().then(function () { return require( /* webpackChunkName: "export-resources-modal-i18n-zh-CN" */'./zh-CN-52baa549.cjs.prod.js'); });
|
|
1190
|
+
case 'ja':
|
|
1191
|
+
return Promise.resolve().then(function () { return require( /* webpackChunkName: "export-resources-modal-i18n-ja" */'./ja-37632763.cjs.prod.js'); });
|
|
1192
|
+
case 'pt-BR':
|
|
1193
|
+
return Promise.resolve().then(function () { return require( /* webpackChunkName: "change-history-i18n-pt-BR" */'./pt-BR-ec2a1a11.cjs.prod.js'); });
|
|
1194
|
+
default:
|
|
1195
|
+
return Promise.resolve().then(function () { return require( /* webpackChunkName: "export-resources-modal-i18n-en" */'./en-c7757448.cjs.prod.js'); });
|
|
1196
|
+
}
|
|
1197
|
+
};
|
|
1198
|
+
|
|
1199
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
1200
|
+
const loadI18n = async locale => {
|
|
1201
|
+
try {
|
|
1202
|
+
const messages = await loadMessages(locale);
|
|
1203
|
+
return messages.default || messages;
|
|
1204
|
+
} catch (error) {
|
|
1205
|
+
// eslint-disable-next-line no-console
|
|
1206
|
+
console.warn("Something went wrong while loading the export-resources-modal messages for ".concat(locale), error);
|
|
1207
|
+
sentry.reportErrorToSentry(new Error("Something went wrong while loading the export-resources-modal messages for ".concat(locale)), {
|
|
1208
|
+
extra: error
|
|
1209
|
+
});
|
|
1210
|
+
return {};
|
|
1211
|
+
}
|
|
1212
|
+
};
|
|
1213
|
+
|
|
1214
|
+
const useAsyncIntlMessages = (locale, loader) => {
|
|
1215
|
+
const _useState = React.useState({
|
|
1216
|
+
isLoading: true,
|
|
1217
|
+
messages: undefined,
|
|
1218
|
+
error: undefined
|
|
1219
|
+
}),
|
|
1220
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1221
|
+
state = _useState2[0],
|
|
1222
|
+
setState = _useState2[1];
|
|
1223
|
+
React.useEffect(() => {
|
|
1224
|
+
let _isUnmounting = false;
|
|
1225
|
+
async function load() {
|
|
1226
|
+
try {
|
|
1227
|
+
if (!_isUnmounting) {
|
|
1228
|
+
const messages = await loader(locale);
|
|
1229
|
+
setState({
|
|
1230
|
+
isLoading: false,
|
|
1231
|
+
messages
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
} catch (error) {
|
|
1235
|
+
setState({
|
|
1236
|
+
isLoading: false,
|
|
1237
|
+
error
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
if (locale) load();
|
|
1242
|
+
return () => {
|
|
1243
|
+
_isUnmounting = true;
|
|
1244
|
+
};
|
|
1245
|
+
}, [locale, loader]);
|
|
1246
|
+
return state;
|
|
1247
|
+
};
|
|
1248
|
+
|
|
1135
1249
|
function ownKeys(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; }
|
|
1136
1250
|
function _objectSpread(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(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(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1137
1251
|
const ExportResourcesModal = props => {
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1252
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
1253
|
+
locale: context.user && context.user.locale
|
|
1254
|
+
})),
|
|
1255
|
+
locale = _useApplicationContex.locale;
|
|
1256
|
+
const messages = useAsyncIntlMessages('en', loadI18n);
|
|
1257
|
+
if (!props.isOpen || messages.isLoading) return null;
|
|
1258
|
+
return jsxRuntime.jsx(reactIntl.IntlProvider, {
|
|
1259
|
+
locale: locale,
|
|
1260
|
+
messages: messages.messages,
|
|
1261
|
+
children: jsxRuntime.jsx(ExportResourcesProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
1262
|
+
children: jsxRuntime.jsx(CurrentStep, {})
|
|
1263
|
+
}))
|
|
1264
|
+
});
|
|
1142
1265
|
};
|
|
1143
1266
|
ExportResourcesModal.displayName = 'ExportResourcesModal';
|
|
1144
|
-
ExportResourcesModal.propTypes = {};
|
|
1145
1267
|
ExportResourcesModal.defaultProps = {
|
|
1146
1268
|
isOpen: false,
|
|
1147
1269
|
selectedResourceIds: [],
|
|
1148
1270
|
exportType: EXPORT_TYPES.ALL,
|
|
1149
1271
|
outputFormat: OUTPUT_FORMATS.CSV,
|
|
1150
|
-
customFields: []
|
|
1272
|
+
customFields: [],
|
|
1273
|
+
fieldGroups: []
|
|
1151
1274
|
};
|
|
1152
1275
|
|
|
1153
1276
|
exports.EXPORTABLE_RESOURCES = EXPORTABLE_RESOURCES;
|