@commercetools-frontend-extensions/export-resources-modal 5.6.3 → 5.6.4
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 +3562 -71
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.prod.js +3529 -71
- package/dist/commercetools-frontend-extensions-export-resources-modal.esm.js +3518 -62
- package/dist/declarations/src/@constants/delimiters.d.ts +0 -7
- package/dist/declarations/src/@types/index.d.ts +0 -1
- package/package.json +2 -2
- package/dist/active-drag-drop-area-76ccef97.esm.js +0 -70
- package/dist/active-drag-drop-area-d3058dd1.cjs.prod.js +0 -72
- package/dist/active-drag-drop-area-feabbc87.cjs.dev.js +0 -72
- package/dist/declarations/src/@types/drop-area-state.d.ts +0 -1
- package/dist/enabled-drop-area-17cc3d52.cjs.prod.js +0 -133
- package/dist/enabled-drop-area-508bf500.cjs.dev.js +0 -133
- package/dist/enabled-drop-area-ce0e5ab6.esm.js +0 -120
- package/dist/file-dropped-area-3c17fdc0.cjs.dev.js +0 -96
- package/dist/file-dropped-area-59869bec.cjs.prod.js +0 -96
- package/dist/file-dropped-area-84224707.esm.js +0 -90
- package/dist/index-8f378027.cjs.prod.js +0 -3604
- package/dist/index-9307c4c9.cjs.dev.js +0 -3640
- package/dist/index-c3a8da20.esm.js +0 -3590
|
@@ -1,3604 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
4
|
-
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
5
|
-
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
6
|
-
var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
7
|
-
var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
|
|
8
|
-
var _endsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/ends-with');
|
|
9
|
-
var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
10
|
-
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
11
|
-
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
12
|
-
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
13
|
-
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
14
|
-
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
15
|
-
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
16
|
-
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
17
|
-
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
18
|
-
var reactIntl = require('react-intl');
|
|
19
|
-
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
20
|
-
var uiKit = require('@commercetools-frontend/ui-kit');
|
|
21
|
-
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
22
|
-
var _valuesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/values');
|
|
23
|
-
var applicationComponents = require('@commercetools-frontend/application-components');
|
|
24
|
-
var fullstory = require('@commercetools-frontend/fullstory');
|
|
25
|
-
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
26
|
-
var React = require('react');
|
|
27
|
-
var _Reflect$construct = require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
|
|
28
|
-
var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
|
|
29
|
-
var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
30
|
-
var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
|
|
31
|
-
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
32
|
-
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
33
|
-
var _wrapNativeSuper = require('@babel/runtime-corejs3/helpers/wrapNativeSuper');
|
|
34
|
-
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
35
|
-
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
36
|
-
var omitEmpty = require('omit-empty-es');
|
|
37
|
-
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
38
|
-
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
39
|
-
var _everyInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/every');
|
|
40
|
-
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
41
|
-
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
42
|
-
var _sortInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/sort');
|
|
43
|
-
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
44
|
-
var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
|
|
45
|
-
var _bindInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/bind');
|
|
46
|
-
var _Promise = require('@babel/runtime-corejs3/core-js-stable/promise');
|
|
47
|
-
var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
|
|
48
|
-
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
49
|
-
var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
|
|
50
|
-
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
51
|
-
var constants = require('@commercetools-frontend/constants');
|
|
52
|
-
var sdk = require('@commercetools-frontend/sdk');
|
|
53
|
-
var l10n = require('@commercetools-frontend/l10n');
|
|
54
|
-
var sortBy = require('lodash/sortBy');
|
|
55
|
-
var _styled = require('@emotion/styled/base');
|
|
56
|
-
var debounce = require('lodash/debounce');
|
|
57
|
-
var react = require('@emotion/react');
|
|
58
|
-
var get = require('lodash/get');
|
|
59
|
-
var formik = require('formik');
|
|
60
|
-
var icons = require('@commercetools-uikit/icons');
|
|
61
|
-
var reactDropzone = require('react-dropzone');
|
|
62
|
-
var i18n = require('@commercetools-frontend/i18n');
|
|
63
|
-
var sentry = require('@commercetools-frontend/sentry');
|
|
64
|
-
|
|
65
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
66
|
-
|
|
67
|
-
var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries);
|
|
68
|
-
var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
|
|
69
|
-
var _endsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_endsWithInstanceProperty);
|
|
70
|
-
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
71
|
-
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
72
|
-
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
73
|
-
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
74
|
-
var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
|
|
75
|
-
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
76
|
-
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
|
|
77
|
-
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
78
|
-
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
79
|
-
var _valuesInstanceProperty__default = /*#__PURE__*/_interopDefault(_valuesInstanceProperty);
|
|
80
|
-
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
81
|
-
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
82
|
-
var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
|
|
83
|
-
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
84
|
-
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
85
|
-
var omitEmpty__default = /*#__PURE__*/_interopDefault(omitEmpty);
|
|
86
|
-
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
87
|
-
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
88
|
-
var _everyInstanceProperty__default = /*#__PURE__*/_interopDefault(_everyInstanceProperty);
|
|
89
|
-
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
90
|
-
var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
91
|
-
var _sortInstanceProperty__default = /*#__PURE__*/_interopDefault(_sortInstanceProperty);
|
|
92
|
-
var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
|
|
93
|
-
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
|
|
94
|
-
var _bindInstanceProperty__default = /*#__PURE__*/_interopDefault(_bindInstanceProperty);
|
|
95
|
-
var _Promise__default = /*#__PURE__*/_interopDefault(_Promise);
|
|
96
|
-
var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
|
|
97
|
-
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
98
|
-
var _Object$values__default = /*#__PURE__*/_interopDefault(_Object$values);
|
|
99
|
-
var sortBy__default = /*#__PURE__*/_interopDefault(sortBy);
|
|
100
|
-
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
101
|
-
var debounce__default = /*#__PURE__*/_interopDefault(debounce);
|
|
102
|
-
var get__default = /*#__PURE__*/_interopDefault(get);
|
|
103
|
-
|
|
104
|
-
function getBold(msg) {
|
|
105
|
-
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
106
|
-
as: "span",
|
|
107
|
-
isBold: true,
|
|
108
|
-
children: msg
|
|
109
|
-
}, `bold-${msg}`);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function getNewLine() {
|
|
113
|
-
return jsxRuntime.jsx("br", {}, crypto.randomUUID());
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
var messages = reactIntl.defineMessages({
|
|
117
|
-
'modalTitle.category': {
|
|
118
|
-
id: 'ExportResourcesModal.modalTitle.category',
|
|
119
|
-
description: 'Label for the categories modal title',
|
|
120
|
-
defaultMessage: 'Export categories'
|
|
121
|
-
},
|
|
122
|
-
'modalTitle.product': {
|
|
123
|
-
id: 'ExportResourcesModal.modalTitle.product',
|
|
124
|
-
description: 'Label for the products modal title',
|
|
125
|
-
defaultMessage: 'Export products'
|
|
126
|
-
},
|
|
127
|
-
'modalTitle.inventory-entry': {
|
|
128
|
-
id: 'ExportResourcesModal.modalTitle.inventoryEntry',
|
|
129
|
-
description: 'Label for the inventories modal title',
|
|
130
|
-
defaultMessage: 'Export inventories'
|
|
131
|
-
},
|
|
132
|
-
'modalTitle.discount-code': {
|
|
133
|
-
id: 'ExportResourcesModal.modalTitle.discountCode',
|
|
134
|
-
description: 'Label for the discount codes modal title',
|
|
135
|
-
defaultMessage: 'Export discount codes'
|
|
136
|
-
},
|
|
137
|
-
'modalTitle.customer': {
|
|
138
|
-
id: 'ExportResourcesModal.modalTitle.customer',
|
|
139
|
-
description: 'Label for the customers modal title',
|
|
140
|
-
defaultMessage: 'Export customers'
|
|
141
|
-
},
|
|
142
|
-
'modalTitle.order': {
|
|
143
|
-
id: 'ExportResourcesModal.modalTitle.order',
|
|
144
|
-
description: 'Label for the orders modal title',
|
|
145
|
-
defaultMessage: 'Export orders'
|
|
146
|
-
},
|
|
147
|
-
'modalTitle.product-type': {
|
|
148
|
-
id: 'ExportResourcesModal.modalTitle.productType',
|
|
149
|
-
description: 'Label for the product types modal title',
|
|
150
|
-
defaultMessage: 'Export product types'
|
|
151
|
-
},
|
|
152
|
-
'modalTitle.business-unit': {
|
|
153
|
-
id: 'ExportResourcesModal.modalTitle.businessUnit',
|
|
154
|
-
description: 'Label for the business units modal title',
|
|
155
|
-
defaultMessage: 'Export business units'
|
|
156
|
-
},
|
|
157
|
-
outputFormat: {
|
|
158
|
-
id: 'ExportResourcesModal.outputFormat',
|
|
159
|
-
description: 'File format like (csv, xls, ...etc)',
|
|
160
|
-
defaultMessage: 'File format'
|
|
161
|
-
},
|
|
162
|
-
fileName: {
|
|
163
|
-
id: 'ExportResourcesModal.fileName',
|
|
164
|
-
description: 'exported file name',
|
|
165
|
-
defaultMessage: 'File name'
|
|
166
|
-
},
|
|
167
|
-
locales: {
|
|
168
|
-
id: 'ExportResourcesModal.locales',
|
|
169
|
-
description: 'Locales',
|
|
170
|
-
defaultMessage: 'Locales'
|
|
171
|
-
},
|
|
172
|
-
exportBasedOnMyViewsMessage: {
|
|
173
|
-
id: 'ExportResourcesModal.exportBasedOnMyViewsMessage',
|
|
174
|
-
description: 'Select Export setttings based on my views',
|
|
175
|
-
defaultMessage: 'Select export settings based on:'
|
|
176
|
-
},
|
|
177
|
-
propertiesPanelLabel: {
|
|
178
|
-
id: 'ExportResourcesModal.propertiesPanelLabel',
|
|
179
|
-
description: 'properties panel label',
|
|
180
|
-
defaultMessage: 'Properties'
|
|
181
|
-
},
|
|
182
|
-
exportOperationSuccessMessage: {
|
|
183
|
-
id: 'ExportResourcesModal.exportOperationSuccessMessage',
|
|
184
|
-
description: 'Success message',
|
|
185
|
-
defaultMessage: '<b>Your export has started.</b> <newline></newline><logsLink>Go to Export logs</logsLink> to view the progress and download the file.'
|
|
186
|
-
},
|
|
187
|
-
nothingApplied: {
|
|
188
|
-
id: 'ExportResourcesModal.nothingApplied',
|
|
189
|
-
description: 'Shown when there is no filter applied',
|
|
190
|
-
defaultMessage: 'nothing applied'
|
|
191
|
-
},
|
|
192
|
-
includeAllLocales: {
|
|
193
|
-
id: 'ExportResourcesModal.includeAllLocales',
|
|
194
|
-
description: 'label for "Include all locales" checkbox',
|
|
195
|
-
defaultMessage: 'Include all locales'
|
|
196
|
-
},
|
|
197
|
-
includeAllLocalesRadioOption: {
|
|
198
|
-
id: 'ExportResourcesModal.includeAllLocalesRadioOption',
|
|
199
|
-
description: 'label for "all" option in locales radio options',
|
|
200
|
-
defaultMessage: 'all'
|
|
201
|
-
},
|
|
202
|
-
onlyLocalesFoundInCsvFileTooltip: {
|
|
203
|
-
id: 'ExportResourcesModal.onlyLocalesFoundInCsvFileTooltip',
|
|
204
|
-
description: 'Tooltip for "only locales found in the CSV file" option',
|
|
205
|
-
defaultMessage: 'Upload a file first to be able to select this option'
|
|
206
|
-
},
|
|
207
|
-
includeOnlySelectedLocalesRadioOption: {
|
|
208
|
-
id: 'ExportResourcesModal.includeOnlySelectedLocalesRadioOption',
|
|
209
|
-
description: 'label for "only selected" option in locales radio options',
|
|
210
|
-
defaultMessage: 'only selected'
|
|
211
|
-
},
|
|
212
|
-
onlyLocalesFoundInCsvFile: {
|
|
213
|
-
id: 'ExportResourcesModal.onlyLocalesFoundInCsvFile',
|
|
214
|
-
description: 'label for "only locales found in the CSV file" option in locales radio options',
|
|
215
|
-
defaultMessage: 'only locales found in the CSV file'
|
|
216
|
-
},
|
|
217
|
-
missingFileNameError: {
|
|
218
|
-
id: 'ExportResourcesModal.missingFileNameError',
|
|
219
|
-
description: 'Error when file name field is missing',
|
|
220
|
-
defaultMessage: 'Please enter a file name'
|
|
221
|
-
},
|
|
222
|
-
invalidFileNameError: {
|
|
223
|
-
id: 'ExportResourcesModal.invalidFileNameError',
|
|
224
|
-
description: 'Error when file name field is not valid',
|
|
225
|
-
defaultMessage: 'File name may only contain alphanumeric characters, hyphens and underscores'
|
|
226
|
-
},
|
|
227
|
-
missingLocaleError: {
|
|
228
|
-
id: 'ExportResourcesModal.missingLocaleError',
|
|
229
|
-
description: 'Error when no locale is selected',
|
|
230
|
-
defaultMessage: 'Please select at least one locale'
|
|
231
|
-
},
|
|
232
|
-
myViews: {
|
|
233
|
-
id: 'ExportResourcesModal.myViews',
|
|
234
|
-
description: 'Label for "My Views" Select Field',
|
|
235
|
-
defaultMessage: 'My Views'
|
|
236
|
-
},
|
|
237
|
-
selectFieldsToExport: {
|
|
238
|
-
id: 'ExportResourcesModal.selectFieldsToExport',
|
|
239
|
-
defaultMessage: 'Select fields to export'
|
|
240
|
-
},
|
|
241
|
-
back: {
|
|
242
|
-
id: 'ExportResourcesModal.back',
|
|
243
|
-
description: 'Label for "Back" button',
|
|
244
|
-
defaultMessage: 'Back'
|
|
245
|
-
},
|
|
246
|
-
startExport: {
|
|
247
|
-
id: 'ExportResourcesModal.startExport',
|
|
248
|
-
description: 'Label for "Start export" button',
|
|
249
|
-
defaultMessage: 'Start export'
|
|
250
|
-
},
|
|
251
|
-
fieldDefinitions: {
|
|
252
|
-
id: 'ExportResourcesModal.fieldDefinitions',
|
|
253
|
-
description: 'Label for "Field definitions" link',
|
|
254
|
-
defaultMessage: 'Field definitions'
|
|
255
|
-
},
|
|
256
|
-
unexpectedError: {
|
|
257
|
-
id: 'ExportResourcesModal.unexpectedError',
|
|
258
|
-
description: 'Generic notification message when starting export process fails',
|
|
259
|
-
defaultMessage: 'An error occurred while starting the export process. Please try again or contact support if the problem persists.'
|
|
260
|
-
},
|
|
261
|
-
searchForFields: {
|
|
262
|
-
id: 'ExportResourcesModal.searchForFields',
|
|
263
|
-
description: 'Placeholder for "Search for fields" search input',
|
|
264
|
-
defaultMessage: 'Search for fields'
|
|
265
|
-
},
|
|
266
|
-
thereAreNoResults: {
|
|
267
|
-
id: 'ExportResourcesModal.thereAreNoResults',
|
|
268
|
-
description: 'No search results message',
|
|
269
|
-
defaultMessage: 'There are no results that match your search.'
|
|
270
|
-
},
|
|
271
|
-
suggestions: {
|
|
272
|
-
id: 'ExportResourcesModal.suggestions',
|
|
273
|
-
description: 'In Export fields selection - Suggestions message',
|
|
274
|
-
defaultMessage: 'Suggestions:'
|
|
275
|
-
},
|
|
276
|
-
checkTheSpelling: {
|
|
277
|
-
id: 'ExportResourcesModal.checkTheSpelling',
|
|
278
|
-
description: 'In Export fields selection - Check the spelling message',
|
|
279
|
-
defaultMessage: 'Check the spelling.'
|
|
280
|
-
},
|
|
281
|
-
searchByEnteringTheExactFieldName: {
|
|
282
|
-
id: 'ExportResourcesModal.searchByEnteringTheExactFieldName',
|
|
283
|
-
description: 'In Export fields selection - Search by entering the exact field name message',
|
|
284
|
-
defaultMessage: 'Try searching by entering the exact field name.'
|
|
285
|
-
},
|
|
286
|
-
scope: {
|
|
287
|
-
id: 'ExportResourcesModal.scope',
|
|
288
|
-
description: 'Label for "Scope:"',
|
|
289
|
-
defaultMessage: 'Scope:'
|
|
290
|
-
},
|
|
291
|
-
exportScopeAllCategories: {
|
|
292
|
-
id: 'ExportResourcesModal.exportScopeAllCategories',
|
|
293
|
-
description: 'Label for Export All categories',
|
|
294
|
-
defaultMessage: 'Export all: {total, plural, one {# category} other {# categories}}'
|
|
295
|
-
},
|
|
296
|
-
exportScopeSelectedCategories: {
|
|
297
|
-
id: 'ExportResourcesModal.exportScopeSelectedCategories',
|
|
298
|
-
description: 'Label for Export Selected categories',
|
|
299
|
-
defaultMessage: 'Export selected: {total, plural, one {# category} other {# categories}}'
|
|
300
|
-
},
|
|
301
|
-
exportScopeFilteredCategories: {
|
|
302
|
-
id: 'ExportResourcesModal.exportScopeFilteredCategories',
|
|
303
|
-
description: 'Label for Export Filtered categories',
|
|
304
|
-
defaultMessage: 'Export filtered: {total, plural, one {# category} other {# categories}}'
|
|
305
|
-
},
|
|
306
|
-
exportScopeAllProducts: {
|
|
307
|
-
id: 'ExportResourcesModal.exportScopeAllProducts',
|
|
308
|
-
description: 'Label for Export All products',
|
|
309
|
-
defaultMessage: 'Export all: {total, plural, one {# product} other {# products}}'
|
|
310
|
-
},
|
|
311
|
-
exportScopeSelectedProducts: {
|
|
312
|
-
id: 'ExportResourcesModal.exportScopeSelectedProducts',
|
|
313
|
-
description: 'Label for Export Selected products',
|
|
314
|
-
defaultMessage: 'Export selected: {total, plural, one {# product} other {# products}}'
|
|
315
|
-
},
|
|
316
|
-
exportScopeFilteredProducts: {
|
|
317
|
-
id: 'ExportResourcesModal.exportScopeFilteredProducts',
|
|
318
|
-
description: 'Label for Export Filtered products',
|
|
319
|
-
defaultMessage: 'Export filtered: {total, plural, one {# product} other {# products}}'
|
|
320
|
-
},
|
|
321
|
-
exportScopeAllProductTypes: {
|
|
322
|
-
id: 'ExportResourcesModal.exportScopeAllProductTypes',
|
|
323
|
-
description: 'Label for Export All product types',
|
|
324
|
-
defaultMessage: 'Export all: {total, plural, one {# product type} other {# product types}}'
|
|
325
|
-
},
|
|
326
|
-
exportScopeSelectedProductTypes: {
|
|
327
|
-
id: 'ExportResourcesModal.exportScopeSelectedProductTypes',
|
|
328
|
-
description: 'Label for Export Selected product types',
|
|
329
|
-
defaultMessage: 'Export selected: {total, plural, one {# product type} other {# product types}}'
|
|
330
|
-
},
|
|
331
|
-
exportScopeFilteredProductTypes: {
|
|
332
|
-
id: 'ExportResourcesModal.exportScopeFilteredProductTypes',
|
|
333
|
-
description: 'Label for Export Filtered product types',
|
|
334
|
-
defaultMessage: 'Export filtered: {total, plural, one {# product type} other {# product types}}'
|
|
335
|
-
},
|
|
336
|
-
exportInventoriesForAllProducts: {
|
|
337
|
-
id: 'ExportResourcesModal.exportInventoriesForAllProducts',
|
|
338
|
-
description: 'Label for Export All inventories',
|
|
339
|
-
defaultMessage: 'Export inventories for all {total, plural, one {# product} other {# products}}'
|
|
340
|
-
},
|
|
341
|
-
exportInventoriesForSelectedProducts: {
|
|
342
|
-
id: 'ExportResourcesModal.exportInventoriesForSelectedProducts',
|
|
343
|
-
description: 'Label for Export Selected inventories',
|
|
344
|
-
defaultMessage: 'Export inventories for the {total, plural, one {# selected product} other {# selected products}}'
|
|
345
|
-
},
|
|
346
|
-
exportInventoriesForFilteredProducts: {
|
|
347
|
-
id: 'ExportResourcesModal.exportInventoriesForFilteredProducts',
|
|
348
|
-
description: 'Label for Export Filtered inventories',
|
|
349
|
-
defaultMessage: 'Export inventories for the {total, plural, one {# filtered product} other {# filtered products}}'
|
|
350
|
-
},
|
|
351
|
-
exportScopeAllDiscountCodes: {
|
|
352
|
-
id: 'ExportResourcesModal.exportScopeAllDiscountCodes',
|
|
353
|
-
description: 'Label for Export All discount codes',
|
|
354
|
-
defaultMessage: 'Export all: {total, plural, one {# discount code} other {# discount codes}}'
|
|
355
|
-
},
|
|
356
|
-
exportScopeSelectedDiscountCodes: {
|
|
357
|
-
id: 'ExportResourcesModal.exportScopeSelectedDiscountCodes',
|
|
358
|
-
description: 'Label for Export Selected discount codes',
|
|
359
|
-
defaultMessage: 'Export selected: {total, plural, one {# discount code} other {# discount codes}}'
|
|
360
|
-
},
|
|
361
|
-
exportScopeFilteredDiscountCodes: {
|
|
362
|
-
id: 'ExportResourcesModal.exportScopeFilteredDiscountCodes',
|
|
363
|
-
description: 'Label for Export Filtered discount codes',
|
|
364
|
-
defaultMessage: 'Export filtered: {total, plural, one {# discount code} other {# discount codes}}'
|
|
365
|
-
},
|
|
366
|
-
exportScopeAllBusinessUnits: {
|
|
367
|
-
id: 'ExportResourcesModal.exportScopeAllBusinessUnits',
|
|
368
|
-
description: 'Label for Export All business units',
|
|
369
|
-
defaultMessage: 'Export all: {total, plural, one {# business unit} other {# business units}}'
|
|
370
|
-
},
|
|
371
|
-
exportScopeSelectedBusinessUnits: {
|
|
372
|
-
id: 'ExportResourcesModal.exportScopeSelectedBusinessUnits',
|
|
373
|
-
description: 'Label for Export Selected business units',
|
|
374
|
-
defaultMessage: 'Export selected: {total, plural, one {# business unit} other {# business units}}'
|
|
375
|
-
},
|
|
376
|
-
exportScopeFilteredBusinessUnits: {
|
|
377
|
-
id: 'ExportResourcesModal.exportScopeFilteredBusinessUnits',
|
|
378
|
-
description: 'Label for Export Filtered business units',
|
|
379
|
-
defaultMessage: 'Export filtered: {total, plural, one {# business unit} other {# business units}}'
|
|
380
|
-
},
|
|
381
|
-
exportScopeAllOrders: {
|
|
382
|
-
id: 'ExportResourcesModal.exportScopeAllOrders',
|
|
383
|
-
description: 'Label for Export All orders',
|
|
384
|
-
defaultMessage: 'Export all: {total, plural, one {# order} other {# orders}}'
|
|
385
|
-
},
|
|
386
|
-
exportScopeSelectedOrders: {
|
|
387
|
-
id: 'ExportResourcesModal.exportScopeSelectedOrders',
|
|
388
|
-
description: 'Label for Export Selected orders',
|
|
389
|
-
defaultMessage: 'Export selected: {total, plural, one {# order} other {# orders}}'
|
|
390
|
-
},
|
|
391
|
-
exportScopeFilteredOrders: {
|
|
392
|
-
id: 'ExportResourcesModal.exportScopeFilteredOrders',
|
|
393
|
-
description: 'Label for Export Filtered orders',
|
|
394
|
-
defaultMessage: 'Export filtered: {total, plural, one {# order} other {# orders}}'
|
|
395
|
-
},
|
|
396
|
-
exportScopeAllCustomers: {
|
|
397
|
-
id: 'ExportResourcesModal.exportScopeAllCustomers',
|
|
398
|
-
description: 'Label for Export All customers',
|
|
399
|
-
defaultMessage: 'Export all: {total, plural, one {# customer} other {# customers}}'
|
|
400
|
-
},
|
|
401
|
-
exportScopeSelectedCustomers: {
|
|
402
|
-
id: 'ExportResourcesModal.exportScopeSelectedCustomers',
|
|
403
|
-
description: 'Label for Export Selected customers',
|
|
404
|
-
defaultMessage: 'Export selected: {total, plural, one {# customer} other {# customers}}'
|
|
405
|
-
},
|
|
406
|
-
exportScopeFilteredCustomers: {
|
|
407
|
-
id: 'ExportResourcesModal.exportScopeFilteredCustomers',
|
|
408
|
-
description: 'Label for Export Filtered customers',
|
|
409
|
-
defaultMessage: 'Export filtered: {total, plural, one {# customer} other {# customers}}'
|
|
410
|
-
},
|
|
411
|
-
exportScopeSelectedWithoutCount: {
|
|
412
|
-
id: 'ExportResourcesModal.exportScopeSelectedWithoutCount',
|
|
413
|
-
description: 'Label for Export Selected without count',
|
|
414
|
-
defaultMessage: 'Export selected'
|
|
415
|
-
},
|
|
416
|
-
exportScopeFilteredWithoutCount: {
|
|
417
|
-
id: 'ExportResourcesModal.exportScopeFilteredWithoutCount',
|
|
418
|
-
description: 'Label for Export Filtered without count',
|
|
419
|
-
defaultMessage: 'Export filtered'
|
|
420
|
-
},
|
|
421
|
-
exportAllWithoutCount: {
|
|
422
|
-
id: 'ExportResourcesModal.exportAllWithoutCount',
|
|
423
|
-
description: 'Label for Export All without count',
|
|
424
|
-
defaultMessage: 'Export all'
|
|
425
|
-
},
|
|
426
|
-
saveAs: {
|
|
427
|
-
id: 'ExportResourcesModal.saveAs',
|
|
428
|
-
description: 'Label for "Save as:"',
|
|
429
|
-
defaultMessage: 'Save as:'
|
|
430
|
-
},
|
|
431
|
-
selected: {
|
|
432
|
-
id: 'ExportResourcesModal.selected',
|
|
433
|
-
description: 'Label for total Selected',
|
|
434
|
-
defaultMessage: '{total} selected'
|
|
435
|
-
},
|
|
436
|
-
fillRows: {
|
|
437
|
-
id: 'ExportResourcesModal.fillRows',
|
|
438
|
-
description: 'A checkbox label for filling rows with complete data',
|
|
439
|
-
defaultMessage: 'Fill all rows with complete data'
|
|
440
|
-
},
|
|
441
|
-
moreInformation: {
|
|
442
|
-
id: 'ExportResourcesModal.moreInformation',
|
|
443
|
-
description: 'A label for more information',
|
|
444
|
-
defaultMessage: 'For more information, refer to the {documentationLink}'
|
|
445
|
-
},
|
|
446
|
-
documentation: {
|
|
447
|
-
id: 'ExportResourcesModal.documentation',
|
|
448
|
-
description: 'A label for Documentation link',
|
|
449
|
-
defaultMessage: 'Documentation'
|
|
450
|
-
},
|
|
451
|
-
loadMoreFields: {
|
|
452
|
-
id: 'ExportResourcesModal.loadMoreFields',
|
|
453
|
-
description: 'Load more fields message',
|
|
454
|
-
defaultMessage: 'Load more fields by using the search functionality or specify the full list of fields with a CSV file'
|
|
455
|
-
},
|
|
456
|
-
itemCount: {
|
|
457
|
-
id: 'ExportResourcesModal.itemCount',
|
|
458
|
-
description: 'Label for item count',
|
|
459
|
-
defaultMessage: '{count, plural, one {# item} other {# items}}'
|
|
460
|
-
},
|
|
461
|
-
exportPreview: {
|
|
462
|
-
id: 'ExportResourcesModal.exportPreview',
|
|
463
|
-
description: 'Label for export preview step',
|
|
464
|
-
defaultMessage: 'Export preview'
|
|
465
|
-
},
|
|
466
|
-
selectDifferentFields: {
|
|
467
|
-
id: 'ExportResourcesModal.selectDifferentFields',
|
|
468
|
-
description: 'Label for "Select different fields" button',
|
|
469
|
-
defaultMessage: 'Select different fields'
|
|
470
|
-
},
|
|
471
|
-
fieldsToBeExportedInLanguages: {
|
|
472
|
-
id: 'ExportResourcesModal.fieldsToBeExportedInLanguages',
|
|
473
|
-
description: 'Label for fields to be exported in languages',
|
|
474
|
-
defaultMessage: '{fieldCount, plural, one {<b>1</b> field to be exported in {languageCount, plural, one {<b>1</b> language} other {<b>{languageCount}</b> languages}}} other {<b>{fieldCount}</b> fields to be exported in {languageCount, plural, one {<b>1</b> language} other {<b>{languageCount}</b> languages}}}}:'
|
|
475
|
-
},
|
|
476
|
-
fieldsToBeExported: {
|
|
477
|
-
id: 'ExportResourcesModal.fieldsToBeExported',
|
|
478
|
-
description: 'Label for fields to be exported',
|
|
479
|
-
defaultMessage: '{fieldCount, plural, one {<b>1</b> field to be exported} other {<b>{fieldCount}</b> fields to be exported}}:'
|
|
480
|
-
},
|
|
481
|
-
confirmSelection: {
|
|
482
|
-
id: 'ExportResourcesModal.confirmSelection',
|
|
483
|
-
description: 'Label for "Confirm selection" button',
|
|
484
|
-
defaultMessage: 'Confirm selection'
|
|
485
|
-
},
|
|
486
|
-
exportProcessMayTakeAWhile: {
|
|
487
|
-
id: 'ExportResourcesModal.exportProcessMayTakeAWhile',
|
|
488
|
-
description: 'The export process may take a while',
|
|
489
|
-
defaultMessage: 'The export process may take a while. To view the progress and download the file after starting the export, go to <exportLogsLink>Export logs</exportLogsLink> area, located in the <operationsIcon></operationsIcon> Operations menu.'
|
|
490
|
-
},
|
|
491
|
-
showAll: {
|
|
492
|
-
id: 'ExportResourcesModal.showAll',
|
|
493
|
-
description: 'Label for "Show all" button',
|
|
494
|
-
defaultMessage: 'Show all'
|
|
495
|
-
},
|
|
496
|
-
showLess: {
|
|
497
|
-
id: 'ExportResourcesModal.showLess',
|
|
498
|
-
description: 'Label for "Show less" button',
|
|
499
|
-
defaultMessage: 'Show less'
|
|
500
|
-
},
|
|
501
|
-
selectFieldsFromLimitedList: {
|
|
502
|
-
id: 'ExportResourcesModal.selectFieldsFromLimitedList',
|
|
503
|
-
description: 'Label for "Select fields from a limited list" button',
|
|
504
|
-
defaultMessage: 'Select fields from a limited list'
|
|
505
|
-
},
|
|
506
|
-
selectFieldsFromImportedCSV: {
|
|
507
|
-
id: 'ExportResourcesModal.selectFieldsFromImportedCSV',
|
|
508
|
-
description: 'Label for "Select fields from an imported CSV" button',
|
|
509
|
-
defaultMessage: 'Select fields from an imported CSV'
|
|
510
|
-
},
|
|
511
|
-
defineFieldsToIncludeInExport: {
|
|
512
|
-
id: 'ExportResourcesModal.defineFieldsToIncludeInExport',
|
|
513
|
-
description: 'A message to define the fields to include in export',
|
|
514
|
-
defaultMessage: 'Define the fields to include in your export with a CSV file below. The file must contain column headers in the predefined format shown in <templateLink>our template</templateLink>. A previously exported CSV can be used as well.'
|
|
515
|
-
},
|
|
516
|
-
chooseFile: {
|
|
517
|
-
id: 'ExportResourcesModal.chooseFile',
|
|
518
|
-
description: 'Label for "Choose file" button',
|
|
519
|
-
defaultMessage: 'Choose file'
|
|
520
|
-
},
|
|
521
|
-
or: {
|
|
522
|
-
id: 'ExportResourcesModal.or',
|
|
523
|
-
description: 'Label for "or" text',
|
|
524
|
-
defaultMessage: 'or'
|
|
525
|
-
},
|
|
526
|
-
dragAndDropCSV: {
|
|
527
|
-
id: 'ExportResourcesModal.dragAndDropCSV',
|
|
528
|
-
description: 'Label for "Drag and drop CSV" text',
|
|
529
|
-
defaultMessage: 'Drag and drop CSV'
|
|
530
|
-
},
|
|
531
|
-
browseFile: {
|
|
532
|
-
id: 'ExportResourcesModal.browseFile',
|
|
533
|
-
description: 'Label for "Browse file" button',
|
|
534
|
-
defaultMessage: 'browse file'
|
|
535
|
-
},
|
|
536
|
-
stepCount: {
|
|
537
|
-
id: 'ExportResourcesModal.stepCount',
|
|
538
|
-
description: 'Step count',
|
|
539
|
-
defaultMessage: 'Step {currentStep}/{totalSteps}'
|
|
540
|
-
},
|
|
541
|
-
stepNumber: {
|
|
542
|
-
id: 'ExportResourcesModal.stepNumber',
|
|
543
|
-
description: 'Step number',
|
|
544
|
-
defaultMessage: 'Step {stepNumber}'
|
|
545
|
-
},
|
|
546
|
-
selectContentToExport: {
|
|
547
|
-
id: 'ExportResourcesModal.selectContentToExport',
|
|
548
|
-
description: 'Label for "Select content to export" button',
|
|
549
|
-
defaultMessage: 'Select content to export'
|
|
550
|
-
},
|
|
551
|
-
errorType: {
|
|
552
|
-
id: 'ExportResourcesModal.errorType',
|
|
553
|
-
description: 'Label for error type column',
|
|
554
|
-
defaultMessage: 'Error type'
|
|
555
|
-
},
|
|
556
|
-
details: {
|
|
557
|
-
id: 'ExportResourcesModal.details',
|
|
558
|
-
description: 'Label for details column',
|
|
559
|
-
defaultMessage: 'Details'
|
|
560
|
-
},
|
|
561
|
-
backToSelection: {
|
|
562
|
-
id: 'ExportResourcesModal.backToSelection',
|
|
563
|
-
description: 'Label for "Back to selection" button',
|
|
564
|
-
defaultMessage: 'Back to selection'
|
|
565
|
-
},
|
|
566
|
-
uploadDifferentCSV: {
|
|
567
|
-
id: 'ExportResourcesModal.uploadDifferentCSV',
|
|
568
|
-
description: 'Label for "Upload a different CSV file" button',
|
|
569
|
-
defaultMessage: 'Upload a different CSV file'
|
|
570
|
-
},
|
|
571
|
-
csvUploadFailed: {
|
|
572
|
-
id: 'ExportResourcesModal.csvUploadFailed',
|
|
573
|
-
description: 'CSV upload failed title',
|
|
574
|
-
defaultMessage: 'CSV upload failed'
|
|
575
|
-
},
|
|
576
|
-
backToPreviousStep: {
|
|
577
|
-
id: 'ExportResourcesModal.backToPreviousStep',
|
|
578
|
-
description: 'Label for "Back to previous step" button',
|
|
579
|
-
defaultMessage: 'Back to previous step'
|
|
580
|
-
},
|
|
581
|
-
notSupportedField: {
|
|
582
|
-
id: 'ExportResourcesModal.notSupportedField',
|
|
583
|
-
description: 'Not supported field error',
|
|
584
|
-
defaultMessage: 'Not supported field'
|
|
585
|
-
},
|
|
586
|
-
duplicateField: {
|
|
587
|
-
id: 'ExportResourcesModal.duplicateField',
|
|
588
|
-
description: 'Duplicate field error',
|
|
589
|
-
defaultMessage: 'Duplicate field'
|
|
590
|
-
},
|
|
591
|
-
localizedFieldWithoutLocale: {
|
|
592
|
-
id: 'ExportResourcesModal.localizedFieldWithoutLocale',
|
|
593
|
-
description: 'Localized field without locale error',
|
|
594
|
-
defaultMessage: 'Localized field without locale'
|
|
595
|
-
},
|
|
596
|
-
attributeDefinitionNotFound: {
|
|
597
|
-
id: 'ExportResourcesModal.attributeDefinitionNotFound',
|
|
598
|
-
description: 'Attribute definition not found error',
|
|
599
|
-
defaultMessage: 'Attribute definition not found'
|
|
600
|
-
},
|
|
601
|
-
fieldDefinitionNotFound: {
|
|
602
|
-
id: 'ExportResourcesModal.fieldDefinitionNotFound',
|
|
603
|
-
description: 'Field definition not found error',
|
|
604
|
-
defaultMessage: 'Field definition not found'
|
|
605
|
-
},
|
|
606
|
-
incompleteField: {
|
|
607
|
-
id: 'ExportResourcesModal.incompleteField',
|
|
608
|
-
description: 'Incomplete field error',
|
|
609
|
-
defaultMessage: 'Incomplete field'
|
|
610
|
-
},
|
|
611
|
-
notSupportedFieldsTitle: {
|
|
612
|
-
id: 'ExportResourcesModal.notSupportedFieldsTitle',
|
|
613
|
-
description: 'Title for not supported fields error',
|
|
614
|
-
defaultMessage: 'The following fields are not supported for the resource type:'
|
|
615
|
-
},
|
|
616
|
-
localizedFieldWithoutLocaleTitle: {
|
|
617
|
-
id: 'ExportResourcesModal.localizedFieldWithoutLocaleTitle',
|
|
618
|
-
description: 'Title for localized fields without locale error',
|
|
619
|
-
defaultMessage: 'The following localised fields do not specify any locale suffix. Pick a different option in the Locales field or upload a different CSV file:'
|
|
620
|
-
},
|
|
621
|
-
incompleteFieldTitle: {
|
|
622
|
-
id: 'ExportResourcesModal.incompleteFieldTitle',
|
|
623
|
-
description: 'Title for incomplete fields error',
|
|
624
|
-
defaultMessage: 'The following fields are missing a subfield:'
|
|
625
|
-
},
|
|
626
|
-
duplicateFieldTitle: {
|
|
627
|
-
id: 'ExportResourcesModal.duplicateFieldTitle',
|
|
628
|
-
description: 'Title for duplicate fields error',
|
|
629
|
-
defaultMessage: 'The following fields are duplicated. Each field must appear once:'
|
|
630
|
-
},
|
|
631
|
-
attributeDefinitionNotFoundTitle: {
|
|
632
|
-
id: 'ExportResourcesModal.attributeDefinitionNotFoundTitle',
|
|
633
|
-
description: 'Title for attribute definitions not found error',
|
|
634
|
-
defaultMessage: 'The following attribute(s) cannot be found in this project:'
|
|
635
|
-
},
|
|
636
|
-
fieldDefinitionNotFoundTitle: {
|
|
637
|
-
id: 'ExportResourcesModal.fieldDefinitionNotFoundTitle',
|
|
638
|
-
description: 'Title for field definitions not found error',
|
|
639
|
-
defaultMessage: 'The following custom field(s) cannot be found in this project:'
|
|
640
|
-
},
|
|
641
|
-
unknownError: {
|
|
642
|
-
id: 'ExportResourcesModal.unknownError',
|
|
643
|
-
description: 'Unknown error',
|
|
644
|
-
defaultMessage: 'An unknown error occurred'
|
|
645
|
-
},
|
|
646
|
-
uploadErrorsDetected: {
|
|
647
|
-
id: 'ExportResourcesModal.uploadErrorsDetected',
|
|
648
|
-
description: 'Message shown when errors are detected during file upload',
|
|
649
|
-
defaultMessage: 'There are <b>{total}</b> errors detected while uploading the file <b>{fileName}</b>. Use <templateLink>our template</templateLink> to review the right formatting and supported values, try exporting using our field selection first or visit <documentationLink>our documentation</documentationLink> for further information.'
|
|
650
|
-
},
|
|
651
|
-
queryPredicate: {
|
|
652
|
-
id: 'ExportResourcesModal.queryPredicate',
|
|
653
|
-
description: 'Label for query predicate option',
|
|
654
|
-
defaultMessage: 'Query predicate'
|
|
655
|
-
},
|
|
656
|
-
invalidQueryPredicate: {
|
|
657
|
-
id: 'ExportResourcesModal.invalidQueryPredicate',
|
|
658
|
-
description: 'Error when query predicate field is not valid',
|
|
659
|
-
defaultMessage: 'There is an error with the query predicate. Make sure the syntax is correct.'
|
|
660
|
-
},
|
|
661
|
-
missingQueryPredicateError: {
|
|
662
|
-
id: 'ExportResourcesModal.missingQueryPredicateError',
|
|
663
|
-
description: 'Error when query predicate field is missing',
|
|
664
|
-
defaultMessage: 'Please enter a query predicate'
|
|
665
|
-
},
|
|
666
|
-
noResourcesToExportForQueryPredicate: {
|
|
667
|
-
id: 'ExportResourcesModal.noResourcesToExportForQueryPredicate',
|
|
668
|
-
description: 'Error message when there are no resources to export for given query predicate',
|
|
669
|
-
defaultMessage: 'No resources match your query predicate. Please check your query predicate and try again.'
|
|
670
|
-
},
|
|
671
|
-
separators: {
|
|
672
|
-
id: 'ExportResourcesModal.separators',
|
|
673
|
-
description: 'Label for separators',
|
|
674
|
-
defaultMessage: 'Separators'
|
|
675
|
-
},
|
|
676
|
-
separatorsDescription: {
|
|
677
|
-
id: 'ExportResourcesModal.separatorsDescription',
|
|
678
|
-
description: 'Description for column separators',
|
|
679
|
-
defaultMessage: 'Configure how columns are separated in the exported file'
|
|
680
|
-
},
|
|
681
|
-
columns: {
|
|
682
|
-
id: 'ExportResourcesModal.columns',
|
|
683
|
-
description: 'Label for column separator select',
|
|
684
|
-
defaultMessage: 'Columns'
|
|
685
|
-
},
|
|
686
|
-
decimals: {
|
|
687
|
-
id: 'ExportResourcesModal.decimals',
|
|
688
|
-
description: 'Label for decimal separator select',
|
|
689
|
-
defaultMessage: 'Decimals'
|
|
690
|
-
},
|
|
691
|
-
columnSeparatorComma: {
|
|
692
|
-
id: 'ExportResourcesModal.columnSeparatorComma',
|
|
693
|
-
description: 'Label for comma column separator option',
|
|
694
|
-
defaultMessage: 'comma (,)'
|
|
695
|
-
},
|
|
696
|
-
columnSeparatorSemicolon: {
|
|
697
|
-
id: 'ExportResourcesModal.columnSeparatorSemicolon',
|
|
698
|
-
description: 'Label for semicolon column separator option',
|
|
699
|
-
defaultMessage: 'semicolon (;)'
|
|
700
|
-
},
|
|
701
|
-
decimalSeparatorPoint: {
|
|
702
|
-
id: 'ExportResourcesModal.decimalSeparatorPoint',
|
|
703
|
-
description: 'Label for point decimal separator option',
|
|
704
|
-
defaultMessage: 'point (.)'
|
|
705
|
-
},
|
|
706
|
-
decimalSeparatorComma: {
|
|
707
|
-
id: 'ExportResourcesModal.decimalSeparatorComma',
|
|
708
|
-
description: 'Label for comma decimal separator option',
|
|
709
|
-
defaultMessage: 'comma (,)'
|
|
710
|
-
},
|
|
711
|
-
columnSeparatorTab: {
|
|
712
|
-
id: 'ExportResourcesModal.columnSeparatorTab',
|
|
713
|
-
description: 'Label for tab column separator option',
|
|
714
|
-
defaultMessage: 'tab (\\t)'
|
|
715
|
-
},
|
|
716
|
-
columnSeparatorPipe: {
|
|
717
|
-
id: 'ExportResourcesModal.columnSeparatorPipe',
|
|
718
|
-
description: 'Label for pipe column separator option',
|
|
719
|
-
defaultMessage: 'pipe (|)'
|
|
720
|
-
},
|
|
721
|
-
csvSettings: {
|
|
722
|
-
id: 'ExportResourcesModal.csvSettings',
|
|
723
|
-
description: 'Label for CSV settings section',
|
|
724
|
-
defaultMessage: 'CSV settings:'
|
|
725
|
-
},
|
|
726
|
-
excelOptimized: {
|
|
727
|
-
id: 'ExportResourcesModal.excelOptimized',
|
|
728
|
-
description: 'Label for Excel-optimized CSV export checkbox',
|
|
729
|
-
defaultMessage: 'CSV file optimized for Excel'
|
|
730
|
-
},
|
|
731
|
-
excelOptimizedDescription: {
|
|
732
|
-
id: 'ExportResourcesModal.excelOptimizedDescription',
|
|
733
|
-
description: 'Description for Excel-optimized CSV export checkbox',
|
|
734
|
-
defaultMessage: 'Checking this option will prevent Excel from interpreting the data of the file.'
|
|
735
|
-
},
|
|
736
|
-
readMoreOnDocumentation: {
|
|
737
|
-
id: 'ExportResourcesModal.readMoreOnDocumentation',
|
|
738
|
-
description: 'Read more on documentation',
|
|
739
|
-
defaultMessage: 'Read more on the {documentationLink}'
|
|
740
|
-
}
|
|
741
|
-
});
|
|
742
|
-
|
|
743
|
-
function ownKeys$h(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; }
|
|
744
|
-
function _objectSpread$h(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$h(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$h(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
745
|
-
function renderFileNameError(key) {
|
|
746
|
-
switch (key) {
|
|
747
|
-
case 'missing':
|
|
748
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$h({}, messages.missingFileNameError));
|
|
749
|
-
case 'invalidInput':
|
|
750
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$h({}, messages.invalidFileNameError));
|
|
751
|
-
default:
|
|
752
|
-
return null;
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
function renderLocaleError(key) {
|
|
756
|
-
switch (key) {
|
|
757
|
-
case 'missing':
|
|
758
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$h({}, messages.missingLocaleError));
|
|
759
|
-
default:
|
|
760
|
-
return null;
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
const renderQueryPredicateError = key => {
|
|
764
|
-
switch (key) {
|
|
765
|
-
case 'missing':
|
|
766
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$h({}, messages.missingQueryPredicateError));
|
|
767
|
-
case 'invalidInput':
|
|
768
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$h({}, messages.invalidQueryPredicate));
|
|
769
|
-
case 'noResourcesToExportForQueryPredicate':
|
|
770
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$h({}, messages.noResourcesToExportForQueryPredicate));
|
|
771
|
-
default:
|
|
772
|
-
return null;
|
|
773
|
-
}
|
|
774
|
-
};
|
|
775
|
-
|
|
776
|
-
const Z_INDEX_DROPDOWN = 30000;
|
|
777
|
-
const OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION = 'OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION';
|
|
778
|
-
const OPERATIONS_EXPORT_RESOURCES_MODAL_EXPANDED_GROUP = 'OPERATIONS_EXPORT_RESOURCES_MODAL_EXPANDED_GROUP';
|
|
779
|
-
const TOTAL_STEPS = 3;
|
|
780
|
-
|
|
781
|
-
const DELIMITERS$1 = {
|
|
782
|
-
COMMA: ',',
|
|
783
|
-
SEMICOLON: ';',
|
|
784
|
-
POINT: '.',
|
|
785
|
-
TAB: '\t',
|
|
786
|
-
PIPE: '|'
|
|
787
|
-
};
|
|
788
|
-
const COLUMN_DELIMITER_OPTIONS = [{
|
|
789
|
-
label: messages.columnSeparatorComma,
|
|
790
|
-
value: DELIMITERS$1.COMMA
|
|
791
|
-
}, {
|
|
792
|
-
label: messages.columnSeparatorSemicolon,
|
|
793
|
-
value: DELIMITERS$1.SEMICOLON
|
|
794
|
-
}, {
|
|
795
|
-
label: messages.columnSeparatorTab,
|
|
796
|
-
value: DELIMITERS$1.TAB
|
|
797
|
-
}, {
|
|
798
|
-
label: messages.columnSeparatorPipe,
|
|
799
|
-
value: DELIMITERS$1.PIPE
|
|
800
|
-
}];
|
|
801
|
-
const DECIMAL_DELIMITER_OPTIONS = [{
|
|
802
|
-
label: messages.decimalSeparatorPoint,
|
|
803
|
-
value: DELIMITERS$1.POINT
|
|
804
|
-
}, {
|
|
805
|
-
label: messages.decimalSeparatorComma,
|
|
806
|
-
value: DELIMITERS$1.COMMA
|
|
807
|
-
}];
|
|
808
|
-
|
|
809
|
-
const EXPORT_OPERATION_STATES = {
|
|
810
|
-
PROCESSING: 'processing',
|
|
811
|
-
COMPLETED: 'completed',
|
|
812
|
-
FAILED: 'failed',
|
|
813
|
-
QUEUED: 'queued'
|
|
814
|
-
};
|
|
815
|
-
|
|
816
|
-
const EXPORT_TYPES = {
|
|
817
|
-
ALL: 'all',
|
|
818
|
-
FILTERED: 'filtered',
|
|
819
|
-
SELECTED: 'selected',
|
|
820
|
-
QUERY_PREDICATE: 'query-predicate'
|
|
821
|
-
};
|
|
822
|
-
|
|
823
|
-
const EXPORTABLE_RESOURCES = {
|
|
824
|
-
CATEGORY: 'category',
|
|
825
|
-
PRODUCT: 'product',
|
|
826
|
-
PRODUCT_TYPE: 'product-type',
|
|
827
|
-
DISCOUNT_CODE: 'discount-code',
|
|
828
|
-
INVENTORY_ENTRY: 'inventory-entry',
|
|
829
|
-
ORDER: 'order',
|
|
830
|
-
CUSTOMER: 'customer',
|
|
831
|
-
BUSINESS_UNIT: 'business-unit'
|
|
832
|
-
};
|
|
833
|
-
|
|
834
|
-
const OUTPUT_FORMATS = {
|
|
835
|
-
JSON: 'json',
|
|
836
|
-
CSV: 'csv'
|
|
837
|
-
};
|
|
838
|
-
const OUTPUT_FORMAT_OPTIONS = [{
|
|
839
|
-
value: OUTPUT_FORMATS.CSV,
|
|
840
|
-
label: 'CSV'
|
|
841
|
-
}, {
|
|
842
|
-
value: OUTPUT_FORMATS.JSON,
|
|
843
|
-
label: 'JSON'
|
|
844
|
-
}];
|
|
845
|
-
|
|
846
|
-
const EXPORT_DATA_DOCUMENTATION_LINK = 'https://docs.commercetools.com/merchant-center/export-data';
|
|
847
|
-
const CSV_TEMPLATES_LINK = 'https://docs.commercetools.com/merchant-center/import-data#download-a-template';
|
|
848
|
-
const CSV_STRUCTURE_DOCUMENTATION_LINK = 'https://docs.commercetools.com/merchant-center/export-data#structure-of-exported-csv-files';
|
|
849
|
-
const EXPORT_EXCEL_DOCUMENTATION_LINK = 'https://docs.commercetools.com/merchant-center/export-data#optimize-csv-file-for-microsoft-excel';
|
|
850
|
-
|
|
851
|
-
const resourceTypeMessages = {
|
|
852
|
-
[EXPORTABLE_RESOURCES.CATEGORY]: {
|
|
853
|
-
exportScopeAll: messages.exportScopeAllCategories,
|
|
854
|
-
exportScopeSelected: messages.exportScopeSelectedCategories,
|
|
855
|
-
exportScopeFiltered: messages.exportScopeFilteredCategories
|
|
856
|
-
},
|
|
857
|
-
[EXPORTABLE_RESOURCES.PRODUCT]: {
|
|
858
|
-
exportScopeAll: messages.exportScopeAllProducts,
|
|
859
|
-
exportScopeSelected: messages.exportScopeSelectedProducts,
|
|
860
|
-
exportScopeFiltered: messages.exportScopeFilteredProducts
|
|
861
|
-
},
|
|
862
|
-
[EXPORTABLE_RESOURCES.PRODUCT_TYPE]: {
|
|
863
|
-
exportScopeAll: messages.exportScopeAllProductTypes,
|
|
864
|
-
exportScopeSelected: messages.exportScopeSelectedProductTypes,
|
|
865
|
-
exportScopeFiltered: messages.exportScopeFilteredProductTypes
|
|
866
|
-
},
|
|
867
|
-
[EXPORTABLE_RESOURCES.INVENTORY_ENTRY]: {
|
|
868
|
-
exportScopeAll: messages.exportInventoriesForAllProducts,
|
|
869
|
-
exportScopeSelected: messages.exportInventoriesForSelectedProducts,
|
|
870
|
-
exportScopeFiltered: messages.exportInventoriesForFilteredProducts
|
|
871
|
-
},
|
|
872
|
-
[EXPORTABLE_RESOURCES.DISCOUNT_CODE]: {
|
|
873
|
-
exportScopeAll: messages.exportAllWithoutCount,
|
|
874
|
-
exportScopeSelected: messages.exportScopeSelectedWithoutCount,
|
|
875
|
-
exportScopeFiltered: messages.exportScopeFilteredWithoutCount
|
|
876
|
-
},
|
|
877
|
-
[EXPORTABLE_RESOURCES.ORDER]: {
|
|
878
|
-
exportScopeAll: messages.exportScopeAllOrders,
|
|
879
|
-
exportScopeSelected: messages.exportScopeSelectedOrders,
|
|
880
|
-
exportScopeFiltered: messages.exportScopeFilteredOrders
|
|
881
|
-
},
|
|
882
|
-
[EXPORTABLE_RESOURCES.CUSTOMER]: {
|
|
883
|
-
exportScopeAll: messages.exportScopeAllCustomers,
|
|
884
|
-
exportScopeSelected: messages.exportScopeSelectedCustomers,
|
|
885
|
-
exportScopeFiltered: messages.exportScopeFilteredCustomers
|
|
886
|
-
},
|
|
887
|
-
[EXPORTABLE_RESOURCES.BUSINESS_UNIT]: {
|
|
888
|
-
exportScopeAll: messages.exportScopeAllBusinessUnits,
|
|
889
|
-
exportScopeSelected: messages.exportScopeSelectedBusinessUnits,
|
|
890
|
-
exportScopeFiltered: messages.exportScopeFilteredBusinessUnits
|
|
891
|
-
}
|
|
892
|
-
};
|
|
893
|
-
|
|
894
|
-
const FIELD_SELECTION_MODES = {
|
|
895
|
-
SELECTED_FIELDS: 'selected-fields',
|
|
896
|
-
IMPORTED_CSV_TEMPLATE: 'imported-csv-template'
|
|
897
|
-
};
|
|
898
|
-
|
|
899
|
-
function ownKeys$g(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; }
|
|
900
|
-
function _objectSpread$g(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$g(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$g(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
901
|
-
const DEFAULT_SHORT_LIVED_FLAGS = {};
|
|
902
|
-
const DEFAULT_LONG_LIVED_FLAGS = {};
|
|
903
|
-
_objectSpread$g(_objectSpread$g({}, DEFAULT_SHORT_LIVED_FLAGS), DEFAULT_LONG_LIVED_FLAGS);
|
|
904
|
-
|
|
905
|
-
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)); }
|
|
906
|
-
function _isNativeReflectConstruct$3() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$3 = function () { return !!t; })(); }
|
|
907
|
-
let MissingExportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
908
|
-
function MissingExportResourceProviderError() {
|
|
909
|
-
var _this;
|
|
910
|
-
_classCallCheck(this, MissingExportResourceProviderError);
|
|
911
|
-
_this = _callSuper$3(this, MissingExportResourceProviderError, ['useExportResourcesModalContext must be used within ExportResourcesProvider']);
|
|
912
|
-
_this.name = 'MissingExportResourceProviderError';
|
|
913
|
-
return _this;
|
|
914
|
-
}
|
|
915
|
-
_inherits(MissingExportResourceProviderError, _Error);
|
|
916
|
-
return _createClass(MissingExportResourceProviderError);
|
|
917
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
918
|
-
|
|
919
|
-
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)); }
|
|
920
|
-
function _isNativeReflectConstruct$2() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$2 = function () { return !!t; })(); }
|
|
921
|
-
let UnexpectedExportOperationStateError = /*#__PURE__*/function (_Error) {
|
|
922
|
-
function UnexpectedExportOperationStateError(state) {
|
|
923
|
-
var _this;
|
|
924
|
-
_classCallCheck(this, UnexpectedExportOperationStateError);
|
|
925
|
-
_this = _callSuper$2(this, UnexpectedExportOperationStateError, [`Unexpected export operation state "${state}"`]);
|
|
926
|
-
_this.name = 'UnexpectedExportOperationStateError';
|
|
927
|
-
return _this;
|
|
928
|
-
}
|
|
929
|
-
_inherits(UnexpectedExportOperationStateError, _Error);
|
|
930
|
-
return _createClass(UnexpectedExportOperationStateError);
|
|
931
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
932
|
-
|
|
933
|
-
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)); }
|
|
934
|
-
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function () { return !!t; })(); }
|
|
935
|
-
let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
|
|
936
|
-
function UnexpectedResourceTypeError(resourceType) {
|
|
937
|
-
var _this;
|
|
938
|
-
_classCallCheck(this, UnexpectedResourceTypeError);
|
|
939
|
-
_this = _callSuper$1(this, UnexpectedResourceTypeError, [`Unexpected resource type "${resourceType}"`]);
|
|
940
|
-
_this.name = 'UnexpectedResourceTypeError';
|
|
941
|
-
return _this;
|
|
942
|
-
}
|
|
943
|
-
_inherits(UnexpectedResourceTypeError, _Error);
|
|
944
|
-
return _createClass(UnexpectedResourceTypeError);
|
|
945
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
946
|
-
|
|
947
|
-
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)); }
|
|
948
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
949
|
-
let InvalidResponseError = /*#__PURE__*/function (_Error) {
|
|
950
|
-
function InvalidResponseError() {
|
|
951
|
-
var _this;
|
|
952
|
-
let message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Invalid API response';
|
|
953
|
-
_classCallCheck(this, InvalidResponseError);
|
|
954
|
-
_this = _callSuper(this, InvalidResponseError, [message]);
|
|
955
|
-
_this.name = 'InvalidResponseError';
|
|
956
|
-
return _this;
|
|
957
|
-
}
|
|
958
|
-
_inherits(InvalidResponseError, _Error);
|
|
959
|
-
return _createClass(InvalidResponseError);
|
|
960
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
961
|
-
|
|
962
|
-
function useExportResourcesModalContext() {
|
|
963
|
-
const context = React.useContext(ExportResourcesContext);
|
|
964
|
-
if (!context) {
|
|
965
|
-
throw new MissingExportResourceProviderError();
|
|
966
|
-
}
|
|
967
|
-
return context;
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
function ownKeys$f(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; }
|
|
971
|
-
function _objectSpread$f(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$f(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$f(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
972
|
-
const defaultOptions = {
|
|
973
|
-
storageType: 'local',
|
|
974
|
-
segregateByUser: true
|
|
975
|
-
};
|
|
976
|
-
const safeParse = value => {
|
|
977
|
-
if (value === null) return value;
|
|
978
|
-
try {
|
|
979
|
-
return JSON.parse(value);
|
|
980
|
-
} catch {
|
|
981
|
-
return value;
|
|
982
|
-
}
|
|
983
|
-
};
|
|
984
|
-
const serialize = value => _JSON$stringify__default["default"](value);
|
|
985
|
-
const getStorage = storageType => storageType === 'session' ? sessionStorage : localStorage;
|
|
986
|
-
const isNil = value => typeof value === 'undefined' || value === null;
|
|
987
|
-
const useStorage = (storageKey, initialStorageValue, options) => {
|
|
988
|
-
var _context;
|
|
989
|
-
const mergedOptions = _objectSpread$f(_objectSpread$f({}, defaultOptions), options);
|
|
990
|
-
const userId = applicationShellConnectors.useApplicationContext(context => context.user?.id);
|
|
991
|
-
const scopedStorageKey = _filterInstanceProperty__default["default"](_context = [mergedOptions.segregateByUser && userId, storageKey]).call(_context, Boolean).join('/');
|
|
992
|
-
const readFromStorage = React.useCallback(() => {
|
|
993
|
-
const rawStorageValue = getStorage(mergedOptions.storageType).getItem(scopedStorageKey);
|
|
994
|
-
|
|
995
|
-
/**
|
|
996
|
-
* NOTE:
|
|
997
|
-
* We prior wrote `undefined` or `null` to storage which when written
|
|
998
|
-
* to storage via `setItem` results in `"undefined"` or `"null"`
|
|
999
|
-
* being written polluting the storage.
|
|
1000
|
-
*/
|
|
1001
|
-
if (rawStorageValue === 'undefined' || rawStorageValue === 'null') {
|
|
1002
|
-
getStorage(mergedOptions.storageType).removeItem(scopedStorageKey);
|
|
1003
|
-
return null;
|
|
1004
|
-
}
|
|
1005
|
-
const parsedStorageValue = safeParse(rawStorageValue);
|
|
1006
|
-
return parsedStorageValue;
|
|
1007
|
-
}, [mergedOptions.storageType, scopedStorageKey]);
|
|
1008
|
-
const initializeStorageValue = () => {
|
|
1009
|
-
// default the storage value to the initial provided value when provided
|
|
1010
|
-
return readFromStorage() ?? initialStorageValue ?? null;
|
|
1011
|
-
};
|
|
1012
|
-
const _useState = React.useState(initializeStorageValue),
|
|
1013
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1014
|
-
actualStorageValue = _useState2[0],
|
|
1015
|
-
setActualStorageValue = _useState2[1];
|
|
1016
|
-
const writeToStorage = React.useCallback(nextStorageValue => {
|
|
1017
|
-
getStorage(mergedOptions.storageType).setItem(scopedStorageKey, serialize(nextStorageValue));
|
|
1018
|
-
setActualStorageValue(nextStorageValue);
|
|
1019
|
-
}, [scopedStorageKey, mergedOptions.storageType]);
|
|
1020
|
-
|
|
1021
|
-
// set the initial storage value in the storage. The reason why this is not
|
|
1022
|
-
// done in initializeStorageValue is the state initializer function should
|
|
1023
|
-
// be pure.
|
|
1024
|
-
// https://beta.reactjs.org/apis/react/useState#my-initializer-or-updater-function-runs-twice
|
|
1025
|
-
React.useEffect(() => {
|
|
1026
|
-
if (isNil(readFromStorage()) && !isNil(initialStorageValue)) {
|
|
1027
|
-
writeToStorage(initialStorageValue);
|
|
1028
|
-
}
|
|
1029
|
-
}, [actualStorageValue, initialStorageValue, readFromStorage, writeToStorage]);
|
|
1030
|
-
return [actualStorageValue, writeToStorage, readFromStorage];
|
|
1031
|
-
};
|
|
1032
|
-
|
|
1033
|
-
function resourceTypeToFileName(resourceType, locale) {
|
|
1034
|
-
var _context;
|
|
1035
|
-
const date = new Date();
|
|
1036
|
-
const dateFormatter = new Intl.DateTimeFormat(locale, {
|
|
1037
|
-
year: '2-digit',
|
|
1038
|
-
month: '2-digit',
|
|
1039
|
-
day: '2-digit',
|
|
1040
|
-
hour: '2-digit',
|
|
1041
|
-
minute: '2-digit',
|
|
1042
|
-
hour12: false
|
|
1043
|
-
});
|
|
1044
|
-
const parts = dateFormatter.formatToParts(date);
|
|
1045
|
-
const dateParts = _reduceInstanceProperty__default["default"](parts).call(parts, (acc, part) => {
|
|
1046
|
-
if (part.type !== 'literal') {
|
|
1047
|
-
acc[part.type] = part.value;
|
|
1048
|
-
}
|
|
1049
|
-
return acc;
|
|
1050
|
-
}, {});
|
|
1051
|
-
const orderedDateParts = _mapInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](parts).call(parts, part => part.type === 'day' || part.type === 'month' || part.type === 'year')).call(_context, part => dateParts[part.type]).join('-');
|
|
1052
|
-
const formattedDate = `${orderedDateParts}_${dateParts.hour}-${dateParts.minute}`;
|
|
1053
|
-
const resourceTypeMap = {
|
|
1054
|
-
[EXPORTABLE_RESOURCES.CATEGORY]: 'Categories',
|
|
1055
|
-
[EXPORTABLE_RESOURCES.PRODUCT]: 'Products',
|
|
1056
|
-
[EXPORTABLE_RESOURCES.PRODUCT_TYPE]: 'Product_Types',
|
|
1057
|
-
[EXPORTABLE_RESOURCES.DISCOUNT_CODE]: 'Discount_Codes',
|
|
1058
|
-
[EXPORTABLE_RESOURCES.INVENTORY_ENTRY]: 'Inventories',
|
|
1059
|
-
[EXPORTABLE_RESOURCES.CUSTOMER]: 'Customers',
|
|
1060
|
-
[EXPORTABLE_RESOURCES.ORDER]: 'Orders',
|
|
1061
|
-
[EXPORTABLE_RESOURCES.BUSINESS_UNIT]: 'Business_Units'
|
|
1062
|
-
};
|
|
1063
|
-
const displayName = resourceTypeMap[resourceType];
|
|
1064
|
-
if (!displayName) {
|
|
1065
|
-
throw new UnexpectedResourceTypeError(resourceType);
|
|
1066
|
-
}
|
|
1067
|
-
return `${displayName}_Export_${formattedDate}`;
|
|
1068
|
-
}
|
|
1069
|
-
function mapLocalesToOptions(locales) {
|
|
1070
|
-
return _mapInstanceProperty__default["default"](locales).call(locales, locale => ({
|
|
1071
|
-
value: locale,
|
|
1072
|
-
label: locale
|
|
1073
|
-
}));
|
|
1074
|
-
}
|
|
1075
|
-
function isFilledArray(maybeArray) {
|
|
1076
|
-
return _Array$isArray__default["default"](maybeArray) && maybeArray.length > 0;
|
|
1077
|
-
}
|
|
1078
|
-
function appendCsvOrJsonExtensionIfAbsent(fileName, fileFormat) {
|
|
1079
|
-
const extensionRegex = /\.(csv|json)$/i;
|
|
1080
|
-
if (!extensionRegex.test(fileName)) return `${fileName}.${fileFormat}`;
|
|
1081
|
-
return fileName;
|
|
1082
|
-
}
|
|
1083
|
-
const extractFieldNamesAndAdditionalFieldExtensions = fields => {
|
|
1084
|
-
const result = _reduceInstanceProperty__default["default"](fields).call(fields, (acc, field) => {
|
|
1085
|
-
if (field.extendedFieldNames) {
|
|
1086
|
-
return [...acc, field.name, ...field.extendedFieldNames];
|
|
1087
|
-
}
|
|
1088
|
-
return [...acc, field.name];
|
|
1089
|
-
}, []);
|
|
1090
|
-
return [...new _Set__default["default"](result)];
|
|
1091
|
-
};
|
|
1092
|
-
function sortFieldsByFieldOrder(_ref) {
|
|
1093
|
-
let fieldNames = _ref.fieldNames,
|
|
1094
|
-
fieldOrder = _ref.fieldOrder;
|
|
1095
|
-
if (isFilledArray(fieldOrder)) {
|
|
1096
|
-
return _sortInstanceProperty__default["default"](fieldNames).call(fieldNames, (a, b) => {
|
|
1097
|
-
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]);
|
|
1098
|
-
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]);
|
|
1099
|
-
|
|
1100
|
-
// If a field is not 'custom',then consider it as '*'
|
|
1101
|
-
orderA = orderA === -1 ? _indexOfInstanceProperty__default["default"](fieldOrder).call(fieldOrder, '*') : orderA;
|
|
1102
|
-
orderB = orderB === -1 ? _indexOfInstanceProperty__default["default"](fieldOrder).call(fieldOrder, '*') : orderB;
|
|
1103
|
-
return orderA - orderB;
|
|
1104
|
-
});
|
|
1105
|
-
}
|
|
1106
|
-
return fieldNames;
|
|
1107
|
-
}
|
|
1108
|
-
function buildSelectedExportFilters(selectedResourceIds) {
|
|
1109
|
-
if (!selectedResourceIds || selectedResourceIds?.length === 0) return undefined;
|
|
1110
|
-
const formattedIds = _mapInstanceProperty__default["default"](selectedResourceIds).call(selectedResourceIds, id => `"${id}"`).join(', ');
|
|
1111
|
-
return `id in (${formattedIds})`;
|
|
1112
|
-
}
|
|
1113
|
-
function isQueryFilter(filters) {
|
|
1114
|
-
if (!filters) return false;
|
|
1115
|
-
return 'query' in filters;
|
|
1116
|
-
}
|
|
1117
|
-
function isSearchFilter(filters) {
|
|
1118
|
-
if (!filters) return false;
|
|
1119
|
-
return 'filters' in filters || 'fullText' in filters;
|
|
1120
|
-
}
|
|
1121
|
-
function isPredicateFilter(filters) {
|
|
1122
|
-
if (!filters) return false;
|
|
1123
|
-
return 'where' in filters;
|
|
1124
|
-
}
|
|
1125
|
-
function validateFilters(filtersObject) {
|
|
1126
|
-
if (filtersObject.where && filtersObject.filters) {
|
|
1127
|
-
return false;
|
|
1128
|
-
}
|
|
1129
|
-
return Boolean(isQueryFilter(filtersObject.filters) || isSearchFilter(filtersObject.filters) || isPredicateFilter(filtersObject));
|
|
1130
|
-
}
|
|
1131
|
-
function areFiltersApplied(filtersObject) {
|
|
1132
|
-
var _context2;
|
|
1133
|
-
if (!filtersObject) {
|
|
1134
|
-
return false;
|
|
1135
|
-
}
|
|
1136
|
-
if (filtersObject.where && _trimInstanceProperty__default["default"](_context2 = filtersObject.where).call(_context2) !== '') {
|
|
1137
|
-
return true;
|
|
1138
|
-
}
|
|
1139
|
-
if (isQueryFilter(filtersObject.filters)) {
|
|
1140
|
-
return Boolean(filtersObject.filters.query);
|
|
1141
|
-
}
|
|
1142
|
-
if (isSearchFilter(filtersObject.filters)) {
|
|
1143
|
-
var _context3, _context4;
|
|
1144
|
-
const _filters = filtersObject.filters;
|
|
1145
|
-
return Boolean(_filters.filters?.length || ((_context3 = _filters.fullText?.text) == null ? void 0 : _bindInstanceProperty__default["default"](_context4 = Function.call).call(_context4, _trimInstanceProperty__default["default"](_context3), _context3))?.());
|
|
1146
|
-
}
|
|
1147
|
-
return false;
|
|
1148
|
-
}
|
|
1149
|
-
function getInitialExportType(args) {
|
|
1150
|
-
if (args.selectedResourceIds?.length) {
|
|
1151
|
-
return EXPORT_TYPES.SELECTED;
|
|
1152
|
-
}
|
|
1153
|
-
if (args.filters?.total && areFiltersApplied(args.filters)) {
|
|
1154
|
-
return EXPORT_TYPES.FILTERED;
|
|
1155
|
-
}
|
|
1156
|
-
return EXPORT_TYPES.ALL;
|
|
1157
|
-
}
|
|
1158
|
-
function removeEmptyGroups(groups) {
|
|
1159
|
-
return _filterInstanceProperty__default["default"](groups).call(groups, group => group.fields && group.fields.length > 0);
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
const isAnyFieldChecked = fields => {
|
|
1163
|
-
return _someInstanceProperty__default["default"](fields).call(fields, field => field.isChecked || field.fields && isAnyFieldChecked(field.fields));
|
|
1164
|
-
};
|
|
1165
|
-
const hasDependentFields = field => {
|
|
1166
|
-
var _context;
|
|
1167
|
-
return Boolean(field?.dependentGroupNames && field.dependentGroupNames.length > 0 || field?.dependentFieldNames && field.dependentFieldNames.length > 0 || field?.fields && _someInstanceProperty__default["default"](_context = field.fields).call(_context, nestedField => hasDependentFields(nestedField)));
|
|
1168
|
-
};
|
|
1169
|
-
const isFieldOrNestedFieldChecked = (field, fieldName) => {
|
|
1170
|
-
if (field.name === fieldName && field.isChecked) {
|
|
1171
|
-
return true;
|
|
1172
|
-
}
|
|
1173
|
-
if (field.fields) {
|
|
1174
|
-
var _context2;
|
|
1175
|
-
return _someInstanceProperty__default["default"](_context2 = field.fields).call(_context2, nestedField => {
|
|
1176
|
-
return nestedField.isChecked || isFieldOrNestedFieldChecked(nestedField, fieldName);
|
|
1177
|
-
});
|
|
1178
|
-
}
|
|
1179
|
-
return false;
|
|
1180
|
-
};
|
|
1181
|
-
const getIndependentFields = group => {
|
|
1182
|
-
const independentFields = [];
|
|
1183
|
-
const findIndependentFields = fields => {
|
|
1184
|
-
_forEachInstanceProperty__default["default"](fields).call(fields, field => {
|
|
1185
|
-
if (!field.dependentGroupNames?.length && !field.dependentFieldNames?.length) {
|
|
1186
|
-
independentFields.push(field);
|
|
1187
|
-
}
|
|
1188
|
-
if (field.fields) {
|
|
1189
|
-
findIndependentFields(field.fields);
|
|
1190
|
-
}
|
|
1191
|
-
});
|
|
1192
|
-
};
|
|
1193
|
-
findIndependentFields(group.fields);
|
|
1194
|
-
return independentFields;
|
|
1195
|
-
};
|
|
1196
|
-
const checkDependentFields = (independentFields, dependentFieldNames) => {
|
|
1197
|
-
return _someInstanceProperty__default["default"](dependentFieldNames).call(dependentFieldNames, fieldName => _someInstanceProperty__default["default"](independentFields).call(independentFields, field => {
|
|
1198
|
-
if (field.name === fieldName) {
|
|
1199
|
-
if (field.fields) {
|
|
1200
|
-
var _context3;
|
|
1201
|
-
return _someInstanceProperty__default["default"](_context3 = field.fields).call(_context3, nestedField => isFieldOrNestedFieldChecked(nestedField, fieldName));
|
|
1202
|
-
}
|
|
1203
|
-
if (isFieldOrNestedFieldChecked(field, fieldName)) {
|
|
1204
|
-
return true;
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
return false;
|
|
1208
|
-
}));
|
|
1209
|
-
};
|
|
1210
|
-
|
|
1211
|
-
/**
|
|
1212
|
-
* Checks if any dependent fields are checked within the field groups
|
|
1213
|
-
*
|
|
1214
|
-
* This function iterates over the provided dependent group names and checks if any fields within those groups
|
|
1215
|
-
* are checked. It considers both independent fields and their nested fields within
|
|
1216
|
-
* the specified dependent field names
|
|
1217
|
-
*
|
|
1218
|
-
* @param groups - The array of field groups
|
|
1219
|
-
* @param dependentGroupNames - The names of the groups to check for dependencies
|
|
1220
|
-
* @param dependentFieldNames - The names of the fields to check within the groups
|
|
1221
|
-
* @returns True if any dependent fields are checked otherwise false
|
|
1222
|
-
*/
|
|
1223
|
-
const isAnyDependentChecked = function (groups) {
|
|
1224
|
-
let dependentGroupNames = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
1225
|
-
let dependentFieldNames = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
1226
|
-
return _someInstanceProperty__default["default"](dependentGroupNames).call(dependentGroupNames, groupName => {
|
|
1227
|
-
const group = _findInstanceProperty__default["default"](groups).call(groups, g => g.groupName === groupName);
|
|
1228
|
-
if (group) {
|
|
1229
|
-
const independentFields = getIndependentFields(group);
|
|
1230
|
-
const isADependentFieldChecked = isAnyFieldChecked(independentFields);
|
|
1231
|
-
const isFieldDependentChecked = checkDependentFields(independentFields, dependentFieldNames);
|
|
1232
|
-
if (dependentFieldNames.length > 0) {
|
|
1233
|
-
return isADependentFieldChecked && isFieldDependentChecked;
|
|
1234
|
-
}
|
|
1235
|
-
return isADependentFieldChecked || isFieldDependentChecked;
|
|
1236
|
-
}
|
|
1237
|
-
return false;
|
|
1238
|
-
});
|
|
1239
|
-
};
|
|
1240
|
-
const areAllFieldsChecked = fields => {
|
|
1241
|
-
return _everyInstanceProperty__default["default"](fields).call(fields, field => field.fields ? areAllFieldsChecked(field.fields) : field.isChecked || field.isRequired || hasDependentFields(field));
|
|
1242
|
-
};
|
|
1243
|
-
const getGroupSelectedFieldCount = group => {
|
|
1244
|
-
const countSelectedFields = fields => {
|
|
1245
|
-
return _reduceInstanceProperty__default["default"](fields).call(fields, (total, field) => {
|
|
1246
|
-
if (field.fields) {
|
|
1247
|
-
return total + countSelectedFields(field.fields);
|
|
1248
|
-
}
|
|
1249
|
-
return total + (field.isChecked ? 1 : 0);
|
|
1250
|
-
}, 0);
|
|
1251
|
-
};
|
|
1252
|
-
return countSelectedFields(group.fields);
|
|
1253
|
-
};
|
|
1254
|
-
const getAllSelectedFieldCount = groups => {
|
|
1255
|
-
return _reduceInstanceProperty__default["default"](groups).call(groups, (total, group) => total + getGroupSelectedFieldCount(group), 0);
|
|
1256
|
-
};
|
|
1257
|
-
const getGroupsWithSelectedFields = groups => {
|
|
1258
|
-
return _filterInstanceProperty__default["default"](groups).call(groups, group => getGroupSelectedFieldCount(group) > 0);
|
|
1259
|
-
};
|
|
1260
|
-
const getSelectedFieldLabels = group => {
|
|
1261
|
-
const selectedLabels = [];
|
|
1262
|
-
const findSelectedFieldLabels = fields => {
|
|
1263
|
-
_forEachInstanceProperty__default["default"](fields).call(fields, field => {
|
|
1264
|
-
if (field.isChecked && !field.fields) {
|
|
1265
|
-
selectedLabels.push(field.label);
|
|
1266
|
-
}
|
|
1267
|
-
if (field.fields) {
|
|
1268
|
-
findSelectedFieldLabels(field.fields);
|
|
1269
|
-
}
|
|
1270
|
-
});
|
|
1271
|
-
};
|
|
1272
|
-
findSelectedFieldLabels(group.fields);
|
|
1273
|
-
return selectedLabels;
|
|
1274
|
-
};
|
|
1275
|
-
const extractFieldNamesFromGroups = (groups, fieldOrder) => {
|
|
1276
|
-
let checkedFields = [];
|
|
1277
|
-
const getCheckedFields = fields => {
|
|
1278
|
-
return _filterInstanceProperty__default["default"](fields).call(fields, field => {
|
|
1279
|
-
if (field.fields) {
|
|
1280
|
-
return getCheckedFields(field.fields);
|
|
1281
|
-
}
|
|
1282
|
-
if (field.isChecked) checkedFields.push(field);
|
|
1283
|
-
return field.isChecked ?? false;
|
|
1284
|
-
});
|
|
1285
|
-
};
|
|
1286
|
-
_forEachInstanceProperty__default["default"](groups).call(groups, group => {
|
|
1287
|
-
getCheckedFields(group.fields);
|
|
1288
|
-
});
|
|
1289
|
-
return sortFieldsByFieldOrder({
|
|
1290
|
-
fieldNames: extractFieldNamesAndAdditionalFieldExtensions(checkedFields),
|
|
1291
|
-
fieldOrder
|
|
1292
|
-
});
|
|
1293
|
-
};
|
|
1294
|
-
|
|
1295
|
-
let Step = /*#__PURE__*/function (Step) {
|
|
1296
|
-
Step["FileSettings"] = "file-settings";
|
|
1297
|
-
Step["FieldsSelection"] = "fields-selection";
|
|
1298
|
-
Step["ConfirmExport"] = "confirm-export";
|
|
1299
|
-
Step["ValidationErrors"] = "validation-errors";
|
|
1300
|
-
return Step;
|
|
1301
|
-
}({});
|
|
1302
|
-
|
|
1303
|
-
let LocaleOption = /*#__PURE__*/function (LocaleOption) {
|
|
1304
|
-
LocaleOption["Selected"] = "selected";
|
|
1305
|
-
LocaleOption["All"] = "all";
|
|
1306
|
-
LocaleOption["OnlyLocalesFoundInCsvFile"] = "onlyLocalesFoundInCsvFile";
|
|
1307
|
-
return LocaleOption;
|
|
1308
|
-
}({});
|
|
1309
|
-
|
|
1310
|
-
function validate(_ref) {
|
|
1311
|
-
let values = _valuesInstanceProperty__default["default"](_ref),
|
|
1312
|
-
step = _ref.step,
|
|
1313
|
-
fieldSelectionMode = _ref.fieldSelectionMode,
|
|
1314
|
-
importedHeaders = _ref.importedHeaders,
|
|
1315
|
-
exportType = _ref.exportType;
|
|
1316
|
-
const fileName = values.fileName,
|
|
1317
|
-
queryPredicate = values.queryPredicate,
|
|
1318
|
-
locales = values.locales,
|
|
1319
|
-
groups = values.groups;
|
|
1320
|
-
const errors = {
|
|
1321
|
-
fileName: {},
|
|
1322
|
-
locales: {},
|
|
1323
|
-
fields: {},
|
|
1324
|
-
importedCsvTemplateFile: {},
|
|
1325
|
-
queryPredicate: {}
|
|
1326
|
-
};
|
|
1327
|
-
if (uiKit.TextInput.isEmpty(fileName)) {
|
|
1328
|
-
errors.fileName.missing = true;
|
|
1329
|
-
} else if (!/^[a-zA-Z0-9-_.]+$/.test(fileName)) {
|
|
1330
|
-
errors.fileName.invalidInput = true;
|
|
1331
|
-
}
|
|
1332
|
-
if (exportType === 'query-predicate' && uiKit.TextInput.isEmpty(queryPredicate)) {
|
|
1333
|
-
errors.queryPredicate.missing = true;
|
|
1334
|
-
}
|
|
1335
|
-
if (step === Step.FieldsSelection) {
|
|
1336
|
-
if (fieldSelectionMode === 'selected-fields') {
|
|
1337
|
-
const allFields = _reduceInstanceProperty__default["default"](groups).call(groups, (acc, group) => _concatInstanceProperty__default["default"](acc).call(acc, group.fields), []);
|
|
1338
|
-
const checkedFieldsCount = _filterInstanceProperty__default["default"](allFields).call(allFields, field => {
|
|
1339
|
-
if (field.fields) return isAnyFieldChecked(field.fields);
|
|
1340
|
-
return field.isChecked;
|
|
1341
|
-
}).length;
|
|
1342
|
-
if (checkedFieldsCount < 1) {
|
|
1343
|
-
errors.fields.missing = true;
|
|
1344
|
-
}
|
|
1345
|
-
}
|
|
1346
|
-
if (fieldSelectionMode === 'imported-csv-template') {
|
|
1347
|
-
if (!values.importedCsvTemplateFile || importedHeaders.length === 0) {
|
|
1348
|
-
errors.importedCsvTemplateFile = {
|
|
1349
|
-
missing: true
|
|
1350
|
-
};
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
if (locales.length < 1) {
|
|
1354
|
-
errors.locales.missing = true;
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
|
-
return omitEmpty__default["default"](errors);
|
|
1358
|
-
}
|
|
1359
|
-
function isFieldNameValid(header) {
|
|
1360
|
-
const processedHeader = header.replace(/\.\*\./g, '.');
|
|
1361
|
-
return /^[a-zA-Z0-9._-]+$/.test(processedHeader);
|
|
1362
|
-
}
|
|
1363
|
-
|
|
1364
|
-
function ownKeys$e(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; }
|
|
1365
|
-
function _objectSpread$e(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$e(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$e(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1366
|
-
const updateFieldGroupsWithIsCheckedValue = (groups, cachedSelectedGroups) => {
|
|
1367
|
-
const updateFields = (fields, isParentChecked, parentFieldPath) => {
|
|
1368
|
-
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
1369
|
-
let isChecked = false;
|
|
1370
|
-
if (field.isRequired) {
|
|
1371
|
-
isChecked = true;
|
|
1372
|
-
} else {
|
|
1373
|
-
if (cachedSelectedGroups[`${parentFieldPath}.${field.name}`] !== undefined) {
|
|
1374
|
-
isChecked = cachedSelectedGroups[`${parentFieldPath}.${field.name}`];
|
|
1375
|
-
} else if (!hasDependentFields(field) && field.isSelectedByDefault) {
|
|
1376
|
-
isChecked = true;
|
|
1377
|
-
} else if (isParentChecked) {
|
|
1378
|
-
isChecked = true;
|
|
1379
|
-
}
|
|
1380
|
-
}
|
|
1381
|
-
let updatedFields = field.fields;
|
|
1382
|
-
if (field.fields) {
|
|
1383
|
-
updatedFields = updateFields(field.fields, isChecked, `${parentFieldPath}.${field.name}`);
|
|
1384
|
-
isChecked = false;
|
|
1385
|
-
}
|
|
1386
|
-
return _objectSpread$e(_objectSpread$e({}, field), {}, {
|
|
1387
|
-
isChecked,
|
|
1388
|
-
fields: updatedFields
|
|
1389
|
-
});
|
|
1390
|
-
});
|
|
1391
|
-
};
|
|
1392
|
-
return _mapInstanceProperty__default["default"](groups).call(groups, group => {
|
|
1393
|
-
const updatedFields = updateFields(group.fields, false, group.groupName);
|
|
1394
|
-
return _objectSpread$e(_objectSpread$e({}, group), {}, {
|
|
1395
|
-
fields: updatedFields
|
|
1396
|
-
});
|
|
1397
|
-
});
|
|
1398
|
-
};
|
|
1399
|
-
const updateFieldGroupWithAdditionalFieldExtensions = groups => {
|
|
1400
|
-
function updateAdditionalFieldExtensions(fields, extendedFieldNames) {
|
|
1401
|
-
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
1402
|
-
const updatedAdditionalFieldExtensions = [...extendedFieldNames, ...(field.extendedFieldNames || [])];
|
|
1403
|
-
if (field.fields) {
|
|
1404
|
-
field.fields = updateAdditionalFieldExtensions(field.fields, updatedAdditionalFieldExtensions);
|
|
1405
|
-
}
|
|
1406
|
-
return _objectSpread$e(_objectSpread$e({}, field), {}, {
|
|
1407
|
-
extendedFieldNames: updatedAdditionalFieldExtensions
|
|
1408
|
-
});
|
|
1409
|
-
});
|
|
1410
|
-
}
|
|
1411
|
-
function combineDependentGroupNames(fields) {
|
|
1412
|
-
return _reduceInstanceProperty__default["default"](fields).call(fields, (acc, field) => {
|
|
1413
|
-
if (field.dependentGroupNames) {
|
|
1414
|
-
acc = [...acc, ...field.dependentGroupNames];
|
|
1415
|
-
}
|
|
1416
|
-
if (field.fields) {
|
|
1417
|
-
acc = [...acc, ...combineDependentGroupNames(field.fields)];
|
|
1418
|
-
}
|
|
1419
|
-
return acc;
|
|
1420
|
-
}, []);
|
|
1421
|
-
}
|
|
1422
|
-
return _mapInstanceProperty__default["default"](groups).call(groups, group => {
|
|
1423
|
-
return _objectSpread$e(_objectSpread$e({}, group), {}, {
|
|
1424
|
-
dependentGroupNames: combineDependentGroupNames(group.fields),
|
|
1425
|
-
fields: updateAdditionalFieldExtensions(group.fields, [])
|
|
1426
|
-
});
|
|
1427
|
-
});
|
|
1428
|
-
};
|
|
1429
|
-
const getIsExpanded = (field, groupName, cachedExpandedGroups) => {
|
|
1430
|
-
if (!field.isExpandable) {
|
|
1431
|
-
return false;
|
|
1432
|
-
}
|
|
1433
|
-
if (field.fields && field.maxVisibleChildren && field.fields.length > field.maxVisibleChildren) {
|
|
1434
|
-
return false;
|
|
1435
|
-
}
|
|
1436
|
-
const cacheKey = `${groupName}.${field.name}`;
|
|
1437
|
-
return cachedExpandedGroups[cacheKey] ?? field.isExpanded ?? false;
|
|
1438
|
-
};
|
|
1439
|
-
const updateFieldGroupsWithIsExpandedValue = (groups, cachedExpandedGroups) => {
|
|
1440
|
-
function updateFields(fields, groupName) {
|
|
1441
|
-
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
1442
|
-
let isExpanded = null;
|
|
1443
|
-
if (field.isExpandable) {
|
|
1444
|
-
isExpanded = getIsExpanded(field, groupName, cachedExpandedGroups);
|
|
1445
|
-
}
|
|
1446
|
-
if (field.fields) {
|
|
1447
|
-
field.fields = updateFields(field.fields, groupName);
|
|
1448
|
-
}
|
|
1449
|
-
if (isExpanded !== null) {
|
|
1450
|
-
return _objectSpread$e(_objectSpread$e({}, field), {}, {
|
|
1451
|
-
isExpanded
|
|
1452
|
-
});
|
|
1453
|
-
}
|
|
1454
|
-
return field;
|
|
1455
|
-
});
|
|
1456
|
-
}
|
|
1457
|
-
return _mapInstanceProperty__default["default"](groups).call(groups, group => {
|
|
1458
|
-
const updatedFields = updateFields(group.fields, group.groupName);
|
|
1459
|
-
return _objectSpread$e(_objectSpread$e({}, group), {}, {
|
|
1460
|
-
isExpanded: cachedExpandedGroups[group.groupName] ?? group.isExpanded ?? false,
|
|
1461
|
-
fields: updatedFields
|
|
1462
|
-
});
|
|
1463
|
-
});
|
|
1464
|
-
};
|
|
1465
|
-
const mapFormikErrors = error => {
|
|
1466
|
-
if (typeof error === 'string') {
|
|
1467
|
-
return {
|
|
1468
|
-
[error]: true
|
|
1469
|
-
};
|
|
1470
|
-
}
|
|
1471
|
-
if (_Array$isArray__default["default"](error)) {
|
|
1472
|
-
return _reduceInstanceProperty__default["default"](error).call(error, (errorAggregator, currentError) => _objectSpread$e(_objectSpread$e({}, errorAggregator), {}, {
|
|
1473
|
-
[currentError]: true
|
|
1474
|
-
}), {});
|
|
1475
|
-
}
|
|
1476
|
-
if (!error) return {};
|
|
1477
|
-
return error;
|
|
1478
|
-
};
|
|
1479
|
-
const updateFieldDependenciesStatus = formik => {
|
|
1480
|
-
var _context;
|
|
1481
|
-
const updateFields = (fields, path) => {
|
|
1482
|
-
_forEachInstanceProperty__default["default"](fields).call(fields, (field, index) => {
|
|
1483
|
-
const currentPath = `${path}.fields[${index}]`;
|
|
1484
|
-
if (hasDependentFields(field)) {
|
|
1485
|
-
formik.setFieldValue(`${currentPath}.isChecked`, isAnyDependentChecked(_valuesInstanceProperty__default["default"](formik).groups, field.dependentGroupNames, field.dependentFieldNames), false);
|
|
1486
|
-
}
|
|
1487
|
-
if (field.fields) {
|
|
1488
|
-
updateFields(field.fields, currentPath);
|
|
1489
|
-
}
|
|
1490
|
-
});
|
|
1491
|
-
};
|
|
1492
|
-
_forEachInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](formik).groups).call(_context, (group, index) => {
|
|
1493
|
-
updateFields(group.fields, `groups[${index}]`);
|
|
1494
|
-
});
|
|
1495
|
-
};
|
|
1496
|
-
|
|
1497
|
-
const EXCLUDED_COLUMNS = ['data-object'];
|
|
1498
|
-
const CHUNK_SIZE = 10 * 1024;
|
|
1499
|
-
const DELIMITERS = [',', ';', '\t', ' ', '|'];
|
|
1500
|
-
const getCsvHeaders = file => {
|
|
1501
|
-
return new _Promise__default["default"](resolve => {
|
|
1502
|
-
const reader = new FileReader();
|
|
1503
|
-
let headers = [];
|
|
1504
|
-
let offset = 0;
|
|
1505
|
-
let entireFile = '';
|
|
1506
|
-
const readChunk = () => {
|
|
1507
|
-
const blobSlice = _sliceInstanceProperty__default["default"](file).call(file, offset, offset + CHUNK_SIZE);
|
|
1508
|
-
reader.readAsText(blobSlice);
|
|
1509
|
-
offset += CHUNK_SIZE;
|
|
1510
|
-
};
|
|
1511
|
-
reader.onload = e => {
|
|
1512
|
-
try {
|
|
1513
|
-
var _context, _context2;
|
|
1514
|
-
const text = e.target?.result;
|
|
1515
|
-
entireFile += text;
|
|
1516
|
-
const firstLineEnd = _indexOfInstanceProperty__default["default"](entireFile).call(entireFile, '\n');
|
|
1517
|
-
if (firstLineEnd === -1 && offset < file.size) {
|
|
1518
|
-
readChunk();
|
|
1519
|
-
return;
|
|
1520
|
-
}
|
|
1521
|
-
const headerLine = entireFile.substring(0, firstLineEnd === -1 ? entireFile.length : firstLineEnd);
|
|
1522
|
-
const delimiter = _reduceInstanceProperty__default["default"](DELIMITERS).call(DELIMITERS, (a, b) => headerLine.split(a).length > headerLine.split(b).length ? a : b);
|
|
1523
|
-
headers = _filterInstanceProperty__default["default"](_context = _mapInstanceProperty__default["default"](_context2 = headerLine.split(delimiter)).call(_context2, header => _trimInstanceProperty__default["default"](header).call(header))).call(_context, header => header !== '' && !_includesInstanceProperty__default["default"](EXCLUDED_COLUMNS).call(EXCLUDED_COLUMNS, header));
|
|
1524
|
-
resolve(headers);
|
|
1525
|
-
} catch (error) {
|
|
1526
|
-
resolve([]);
|
|
1527
|
-
}
|
|
1528
|
-
};
|
|
1529
|
-
reader.onerror = () => {
|
|
1530
|
-
resolve([]);
|
|
1531
|
-
};
|
|
1532
|
-
readChunk();
|
|
1533
|
-
});
|
|
1534
|
-
};
|
|
1535
|
-
|
|
1536
|
-
function ownKeys$d(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; }
|
|
1537
|
-
function _objectSpread$d(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$d(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$d(Object(t))).call(_context6, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1538
|
-
function groupFieldValidationErrors(errors, intl) {
|
|
1539
|
-
var _context2, _context4;
|
|
1540
|
-
const errorsByCode = _reduceInstanceProperty__default["default"](errors).call(errors, (groups, error) => {
|
|
1541
|
-
var _context;
|
|
1542
|
-
const group = groups[error.code] || {
|
|
1543
|
-
code: error.code,
|
|
1544
|
-
originalErrors: [],
|
|
1545
|
-
fieldNames: []
|
|
1546
|
-
};
|
|
1547
|
-
if (error.field && !_includesInstanceProperty__default["default"](_context = group.fieldNames).call(_context, error.field)) {
|
|
1548
|
-
group.fieldNames.push(error.field);
|
|
1549
|
-
}
|
|
1550
|
-
group.originalErrors.push(error);
|
|
1551
|
-
groups[error.code] = group;
|
|
1552
|
-
return groups;
|
|
1553
|
-
}, {});
|
|
1554
|
-
_forEachInstanceProperty__default["default"](_context2 = _Object$values__default["default"](errorsByCode)).call(_context2, group => {
|
|
1555
|
-
var _context3;
|
|
1556
|
-
_sortInstanceProperty__default["default"](_context3 = group.fieldNames).call(_context3);
|
|
1557
|
-
});
|
|
1558
|
-
return _mapInstanceProperty__default["default"](_context4 = _Object$values__default["default"](errorsByCode)).call(_context4, group => {
|
|
1559
|
-
let messageTitle;
|
|
1560
|
-
switch (group.code) {
|
|
1561
|
-
case 'NotSupportedField':
|
|
1562
|
-
messageTitle = intl.formatMessage(messages.notSupportedFieldsTitle);
|
|
1563
|
-
break;
|
|
1564
|
-
case 'LocalizedFieldWithoutLocale':
|
|
1565
|
-
messageTitle = intl.formatMessage(messages.localizedFieldWithoutLocaleTitle);
|
|
1566
|
-
break;
|
|
1567
|
-
case 'IncompleteField':
|
|
1568
|
-
messageTitle = intl.formatMessage(messages.incompleteFieldTitle);
|
|
1569
|
-
break;
|
|
1570
|
-
case 'DuplicateFields':
|
|
1571
|
-
messageTitle = intl.formatMessage(messages.duplicateFieldTitle);
|
|
1572
|
-
break;
|
|
1573
|
-
case 'AttributeDefinitionNotFound':
|
|
1574
|
-
messageTitle = intl.formatMessage(messages.attributeDefinitionNotFoundTitle);
|
|
1575
|
-
break;
|
|
1576
|
-
case 'FieldDefinitionNotFound':
|
|
1577
|
-
messageTitle = intl.formatMessage(messages.fieldDefinitionNotFoundTitle);
|
|
1578
|
-
break;
|
|
1579
|
-
default:
|
|
1580
|
-
messageTitle = group.originalErrors[0]?.message || intl.formatMessage(messages.unknownError);
|
|
1581
|
-
}
|
|
1582
|
-
return _objectSpread$d(_objectSpread$d({}, group), {}, {
|
|
1583
|
-
messageTitle
|
|
1584
|
-
});
|
|
1585
|
-
});
|
|
1586
|
-
}
|
|
1587
|
-
|
|
1588
|
-
function isExportApiSuccessResponse(response) {
|
|
1589
|
-
return 'id' in response && 'state' in response && 'resourceType' in response && 'resourceCount' in response;
|
|
1590
|
-
}
|
|
1591
|
-
function isExportApiErrorResponse(error) {
|
|
1592
|
-
return Boolean(error && typeof error === 'object' && 'body' in error && error.body && typeof error.body === 'object' && ('validationErrors' in error.body || 'errors' in error.body) && 'message' in error.body && 'statusCode' in error.body && 'error' in error.body);
|
|
1593
|
-
}
|
|
1594
|
-
|
|
1595
|
-
const useInitialValues = props => {
|
|
1596
|
-
var _context;
|
|
1597
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
1598
|
-
locale: applicationContext.dataLocale,
|
|
1599
|
-
userLocale: applicationContext.user?.locale
|
|
1600
|
-
})),
|
|
1601
|
-
locale = _useApplicationContex.locale,
|
|
1602
|
-
userLocale = _useApplicationContex.userLocale;
|
|
1603
|
-
const _useApplicationContex2 = applicationShellConnectors.useApplicationContext(context => ({
|
|
1604
|
-
projectKey: context.project?.key
|
|
1605
|
-
})),
|
|
1606
|
-
projectKey = _useApplicationContex2.projectKey;
|
|
1607
|
-
const _useStorage = useStorage(`${projectKey}/${OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION}`, {}),
|
|
1608
|
-
_useStorage2 = _slicedToArray(_useStorage, 1),
|
|
1609
|
-
cachedSelectedGroups = _useStorage2[0];
|
|
1610
|
-
const _useStorage3 = useStorage(`${projectKey}/${OPERATIONS_EXPORT_RESOURCES_MODAL_EXPANDED_GROUP}`, {
|
|
1611
|
-
[props.resourceType]: _reduceInstanceProperty__default["default"](_context = props.fieldGroups).call(_context, (acc, group) => {
|
|
1612
|
-
acc[group.groupName] = group.isExpanded;
|
|
1613
|
-
return acc;
|
|
1614
|
-
}, {})
|
|
1615
|
-
}),
|
|
1616
|
-
_useStorage4 = _slicedToArray(_useStorage3, 1),
|
|
1617
|
-
cachedExpandedGroups = _useStorage4[0];
|
|
1618
|
-
return React__default["default"].useMemo(() => {
|
|
1619
|
-
let groups = removeEmptyGroups(props.fieldGroups);
|
|
1620
|
-
groups = updateFieldGroupsWithIsCheckedValue(groups, cachedSelectedGroups?.[props.resourceType] || {});
|
|
1621
|
-
groups = updateFieldGroupsWithIsExpandedValue(groups, cachedExpandedGroups?.[props.resourceType] || {});
|
|
1622
|
-
return {
|
|
1623
|
-
fileName: `${resourceTypeToFileName(props.resourceType, userLocale)}`,
|
|
1624
|
-
locales: [locale],
|
|
1625
|
-
groups: updateFieldGroupWithAdditionalFieldExtensions(groups),
|
|
1626
|
-
queryPredicate: '',
|
|
1627
|
-
fillRows: false,
|
|
1628
|
-
excelCompatible: false,
|
|
1629
|
-
outputFormat: props.outputFormat,
|
|
1630
|
-
columnSeparator: DELIMITERS$1.COMMA,
|
|
1631
|
-
decimalSeparator: DELIMITERS$1.POINT,
|
|
1632
|
-
importedCsvTemplateFile: null
|
|
1633
|
-
};
|
|
1634
|
-
}, [props.fieldGroups, props.resourceType, props.outputFormat, cachedSelectedGroups, cachedExpandedGroups, locale, userLocale]);
|
|
1635
|
-
};
|
|
1636
|
-
|
|
1637
|
-
const _excluded$3 = ["projectKey"];
|
|
1638
|
-
function ownKeys$c(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; }
|
|
1639
|
-
function _objectSpread$c(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$c(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$c(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1640
|
-
async function makeExportRequest(params, asyncDispatchFn) {
|
|
1641
|
-
const projectKey = params.projectKey,
|
|
1642
|
-
requestData = _objectWithoutProperties(params, _excluded$3);
|
|
1643
|
-
const uri = `/${projectKey}/export-operations`;
|
|
1644
|
-
const requestAction = sdk.actions.post({
|
|
1645
|
-
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.EXPORT,
|
|
1646
|
-
uri,
|
|
1647
|
-
headers: {
|
|
1648
|
-
accept: 'application/json'
|
|
1649
|
-
},
|
|
1650
|
-
payload: requestData
|
|
1651
|
-
});
|
|
1652
|
-
const response = await asyncDispatchFn(requestAction);
|
|
1653
|
-
if (!response || typeof response !== 'object') {
|
|
1654
|
-
throw new InvalidResponseError();
|
|
1655
|
-
}
|
|
1656
|
-
if (!('state' in response)) {
|
|
1657
|
-
throw new InvalidResponseError('Response missing state field');
|
|
1658
|
-
}
|
|
1659
|
-
return response;
|
|
1660
|
-
}
|
|
1661
|
-
function createExportOperation(params, asyncDispatchFn) {
|
|
1662
|
-
return makeExportRequest(params, asyncDispatchFn);
|
|
1663
|
-
}
|
|
1664
|
-
function validateExportOperation(params, asyncDispatchFn) {
|
|
1665
|
-
return makeExportRequest(_objectSpread$c(_objectSpread$c({}, params), {}, {
|
|
1666
|
-
dryRun: true
|
|
1667
|
-
}), asyncDispatchFn);
|
|
1668
|
-
}
|
|
1669
|
-
|
|
1670
|
-
const useStartExportOperation = props => {
|
|
1671
|
-
const intl = reactIntl.useIntl();
|
|
1672
|
-
const asyncDispatch = sdk.useAsyncDispatch();
|
|
1673
|
-
const showNotification = actionsGlobal.useShowNotification();
|
|
1674
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
1675
|
-
locale: applicationContext.dataLocale,
|
|
1676
|
-
projectKey: applicationContext.project?.key
|
|
1677
|
-
})),
|
|
1678
|
-
projectKey = _useApplicationContex.projectKey;
|
|
1679
|
-
const startExportOperation = async (values, exportType, fieldSelectionMode, localeOption, importedHeaders) => {
|
|
1680
|
-
try {
|
|
1681
|
-
if (!projectKey) throw new Error('Project key is missing');
|
|
1682
|
-
let fields = [];
|
|
1683
|
-
if (fieldSelectionMode === 'imported-csv-template' && values.importedCsvTemplateFile) {
|
|
1684
|
-
fields = importedHeaders;
|
|
1685
|
-
} else {
|
|
1686
|
-
fields = extractFieldNamesFromGroups(values.groups, props.fieldOrder);
|
|
1687
|
-
}
|
|
1688
|
-
let where = undefined;
|
|
1689
|
-
let filters = undefined;
|
|
1690
|
-
if (exportType === EXPORT_TYPES.SELECTED && props.selectedResourceIds?.length) {
|
|
1691
|
-
where = buildSelectedExportFilters(props.selectedResourceIds);
|
|
1692
|
-
} else if (exportType === EXPORT_TYPES.FILTERED && props.filters) {
|
|
1693
|
-
where = props.filters.where;
|
|
1694
|
-
if (isQueryFilter(props.filters.filters)) {
|
|
1695
|
-
filters = props.filters.filters;
|
|
1696
|
-
} else if (isSearchFilter(props.filters.filters)) {
|
|
1697
|
-
filters = props.filters.filters;
|
|
1698
|
-
}
|
|
1699
|
-
} else if (exportType === EXPORT_TYPES.QUERY_PREDICATE) {
|
|
1700
|
-
var _context;
|
|
1701
|
-
where = _trimInstanceProperty__default["default"](_context = values.queryPredicate).call(_context);
|
|
1702
|
-
}
|
|
1703
|
-
let locales = undefined;
|
|
1704
|
-
if (localeOption !== 'onlyLocalesFoundInCsvFile') {
|
|
1705
|
-
locales = values.locales;
|
|
1706
|
-
}
|
|
1707
|
-
const isCsv = values.outputFormat === 'csv';
|
|
1708
|
-
const response = await createExportOperation({
|
|
1709
|
-
projectKey,
|
|
1710
|
-
resourceType: props.resourceType,
|
|
1711
|
-
fileName: appendCsvOrJsonExtensionIfAbsent(values.fileName, values.outputFormat),
|
|
1712
|
-
fileFormat: values.outputFormat,
|
|
1713
|
-
locales,
|
|
1714
|
-
fillRows: isCsv && values.fillRows,
|
|
1715
|
-
excelCompatible: isCsv && values.excelCompatible,
|
|
1716
|
-
separator: isCsv ? {
|
|
1717
|
-
columns: values.columnSeparator,
|
|
1718
|
-
decimal: values.decimalSeparator
|
|
1719
|
-
} : undefined,
|
|
1720
|
-
fields,
|
|
1721
|
-
where,
|
|
1722
|
-
filters
|
|
1723
|
-
}, asyncDispatch);
|
|
1724
|
-
if (isExportApiSuccessResponse(response)) {
|
|
1725
|
-
switch (response.state) {
|
|
1726
|
-
case EXPORT_OPERATION_STATES.QUEUED:
|
|
1727
|
-
case EXPORT_OPERATION_STATES.PROCESSING:
|
|
1728
|
-
case EXPORT_OPERATION_STATES.COMPLETED:
|
|
1729
|
-
showNotification({
|
|
1730
|
-
kind: 'info',
|
|
1731
|
-
domain: constants.DOMAINS.SIDE,
|
|
1732
|
-
// @ts-ignore
|
|
1733
|
-
text: intl.formatMessage(messages.exportOperationSuccessMessage, {
|
|
1734
|
-
newline: getNewLine,
|
|
1735
|
-
logsLink: msg => jsxRuntime.jsx(ExportLogsLink, {
|
|
1736
|
-
projectKey: projectKey
|
|
1737
|
-
// @ts-ignore the `msg` parameter type is not compatible with the `string` type
|
|
1738
|
-
,
|
|
1739
|
-
msg: msg
|
|
1740
|
-
}, "export-logs-link"),
|
|
1741
|
-
b: getBold
|
|
1742
|
-
})
|
|
1743
|
-
}, {
|
|
1744
|
-
dismissAfter: 5000
|
|
1745
|
-
});
|
|
1746
|
-
if (typeof props.onExportSuccess === 'function') props.onExportSuccess();
|
|
1747
|
-
break;
|
|
1748
|
-
default:
|
|
1749
|
-
throw new UnexpectedExportOperationStateError(response.state);
|
|
1750
|
-
}
|
|
1751
|
-
} else {
|
|
1752
|
-
throw new Error(response.message || 'Unknown error occurred during export operation');
|
|
1753
|
-
}
|
|
1754
|
-
} catch (error) {
|
|
1755
|
-
showNotification({
|
|
1756
|
-
text: intl.formatMessage(messages.unexpectedError),
|
|
1757
|
-
kind: 'error',
|
|
1758
|
-
domain: constants.DOMAINS.PAGE
|
|
1759
|
-
});
|
|
1760
|
-
} finally {
|
|
1761
|
-
if (typeof props.onClose === 'function') props.onClose();
|
|
1762
|
-
}
|
|
1763
|
-
};
|
|
1764
|
-
return {
|
|
1765
|
-
startExportOperation
|
|
1766
|
-
};
|
|
1767
|
-
};
|
|
1768
|
-
|
|
1769
|
-
const _excluded$2 = ["fields"];
|
|
1770
|
-
function ownKeys$b(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; }
|
|
1771
|
-
function _objectSpread$b(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$b(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$b(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1772
|
-
const getFieldFullName = _ref => {
|
|
1773
|
-
var _context;
|
|
1774
|
-
let fieldPrefix = _ref.fieldPrefix,
|
|
1775
|
-
fieldName = _ref.fieldName;
|
|
1776
|
-
return _filterInstanceProperty__default["default"](_context = [fieldPrefix, fieldName]).call(_context, Boolean).join('.');
|
|
1777
|
-
};
|
|
1778
|
-
const localizeTypeDefinitionLabels = function () {
|
|
1779
|
-
let fieldDefinitions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1780
|
-
return _mapInstanceProperty__default["default"](fieldDefinitions).call(fieldDefinitions, _ref2 => {
|
|
1781
|
-
var _context2, _context3;
|
|
1782
|
-
let fields = _ref2.fields,
|
|
1783
|
-
fieldsType = _objectWithoutProperties(_ref2, _excluded$2);
|
|
1784
|
-
const isFieldTypeLabelLocalized = _Array$isArray__default["default"](fieldsType.label);
|
|
1785
|
-
return {
|
|
1786
|
-
name: fieldsType.name,
|
|
1787
|
-
label: isFieldTypeLabelLocalized ? l10n.applyTransformedLocalizedFields(fieldsType, [{
|
|
1788
|
-
from: 'label',
|
|
1789
|
-
to: 'label'
|
|
1790
|
-
}]).label : fieldsType.label,
|
|
1791
|
-
fields: ((_context2 = fields) == null ? void 0 : _bindInstanceProperty__default["default"](_context3 = Function.call).call(_context3, _mapInstanceProperty__default["default"](_context2), _context2))?.(field => {
|
|
1792
|
-
const isFieldLabelLocalized = _Array$isArray__default["default"](field.label);
|
|
1793
|
-
if (!isFieldLabelLocalized) {
|
|
1794
|
-
return field;
|
|
1795
|
-
}
|
|
1796
|
-
return _objectSpread$b({}, l10n.applyTransformedLocalizedFields(field, [{
|
|
1797
|
-
from: 'label',
|
|
1798
|
-
to: 'label'
|
|
1799
|
-
}]));
|
|
1800
|
-
}) || []
|
|
1801
|
-
};
|
|
1802
|
-
});
|
|
1803
|
-
};
|
|
1804
|
-
const useConvertFieldDefinitionsForExport = () => {
|
|
1805
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
1806
|
-
language: applicationContext.dataLocale,
|
|
1807
|
-
languages: applicationContext.project?.languages
|
|
1808
|
-
})),
|
|
1809
|
-
language = _useApplicationContex.language,
|
|
1810
|
-
languages = _useApplicationContex.languages;
|
|
1811
|
-
const sortByField = (fields, fieldName) => {
|
|
1812
|
-
if (!fields) return [];
|
|
1813
|
-
if (fieldName) {
|
|
1814
|
-
return sortBy__default["default"](fields, field => {
|
|
1815
|
-
return field[fieldName]?.toLowerCase();
|
|
1816
|
-
});
|
|
1817
|
-
}
|
|
1818
|
-
return fields;
|
|
1819
|
-
};
|
|
1820
|
-
const convertFieldDefinitionsForExport = _ref3 => {
|
|
1821
|
-
let fieldDefinitions = _ref3.fieldDefinitions,
|
|
1822
|
-
fieldPrefix = _ref3.fieldPrefix,
|
|
1823
|
-
_ref3$expandAll = _ref3.expandAll,
|
|
1824
|
-
expandAll = _ref3$expandAll === void 0 ? false : _ref3$expandAll,
|
|
1825
|
-
sortField = _ref3.sortField;
|
|
1826
|
-
if (!fieldDefinitions) return [];
|
|
1827
|
-
const localizedTypeDefinitions = localizeTypeDefinitionLabels(fieldDefinitions);
|
|
1828
|
-
const results = _mapInstanceProperty__default["default"](localizedTypeDefinitions).call(localizedTypeDefinitions, transformedType => {
|
|
1829
|
-
var _context4, _context5;
|
|
1830
|
-
const isTypeLabelLocalized = typeof transformedType.label !== 'string';
|
|
1831
|
-
return {
|
|
1832
|
-
isExpandable: true,
|
|
1833
|
-
isExpanded: expandAll,
|
|
1834
|
-
name: transformedType.name,
|
|
1835
|
-
label: isTypeLabelLocalized ? l10n.formatLocalizedString({
|
|
1836
|
-
label: transformedType.label
|
|
1837
|
-
}, {
|
|
1838
|
-
key: 'label',
|
|
1839
|
-
locale: language,
|
|
1840
|
-
fallbackOrder: languages,
|
|
1841
|
-
fallback: transformedType.name
|
|
1842
|
-
}) : transformedType.label,
|
|
1843
|
-
fields: sortByField(((_context4 = transformedType.fields) == null ? void 0 : _bindInstanceProperty__default["default"](_context5 = Function.call).call(_context5, _mapInstanceProperty__default["default"](_context4), _context4))?.(fieldDefinition => {
|
|
1844
|
-
const isFieldLabelLocalized = typeof fieldDefinition.label !== 'string';
|
|
1845
|
-
return {
|
|
1846
|
-
name: getFieldFullName({
|
|
1847
|
-
fieldPrefix: fieldPrefix,
|
|
1848
|
-
fieldName: fieldDefinition.name
|
|
1849
|
-
}),
|
|
1850
|
-
label: isFieldLabelLocalized ? l10n.formatLocalizedString({
|
|
1851
|
-
label: fieldDefinition.label
|
|
1852
|
-
}, {
|
|
1853
|
-
key: 'label',
|
|
1854
|
-
locale: language,
|
|
1855
|
-
fallbackOrder: languages,
|
|
1856
|
-
fallback: fieldDefinition.name
|
|
1857
|
-
}) : fieldDefinition.label,
|
|
1858
|
-
extendedFieldNames: fieldDefinition.extendedFieldNames
|
|
1859
|
-
};
|
|
1860
|
-
}), sortField)
|
|
1861
|
-
};
|
|
1862
|
-
});
|
|
1863
|
-
return sortByField(results, sortField);
|
|
1864
|
-
};
|
|
1865
|
-
return {
|
|
1866
|
-
convertFieldDefinitionsForExport
|
|
1867
|
-
};
|
|
1868
|
-
};
|
|
1869
|
-
|
|
1870
|
-
const useValidateExportOperation = () => {
|
|
1871
|
-
const intl = reactIntl.useIntl();
|
|
1872
|
-
const asyncDispatch = sdk.useAsyncDispatch();
|
|
1873
|
-
const showNotification = actionsGlobal.useShowNotification();
|
|
1874
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
1875
|
-
projectKey: context.project?.key
|
|
1876
|
-
})),
|
|
1877
|
-
projectKey = _useApplicationContex.projectKey;
|
|
1878
|
-
const validateExport = async params => {
|
|
1879
|
-
try {
|
|
1880
|
-
var _context, _context2, _context3;
|
|
1881
|
-
if (!projectKey) return;
|
|
1882
|
-
const invalidFields = _filterInstanceProperty__default["default"](_context = params.fields).call(_context, field => !isFieldNameValid(field));
|
|
1883
|
-
if (invalidFields.length > 0) {
|
|
1884
|
-
return {
|
|
1885
|
-
success: false,
|
|
1886
|
-
validationErrors: _mapInstanceProperty__default["default"](invalidFields).call(invalidFields, field => ({
|
|
1887
|
-
code: 'NotSupportedField',
|
|
1888
|
-
field: field
|
|
1889
|
-
}))
|
|
1890
|
-
};
|
|
1891
|
-
}
|
|
1892
|
-
const response = await validateExportOperation({
|
|
1893
|
-
projectKey,
|
|
1894
|
-
resourceType: params.resourceType,
|
|
1895
|
-
fileName: params.fileName,
|
|
1896
|
-
fileFormat: params.outputFormat,
|
|
1897
|
-
fields: params.fields,
|
|
1898
|
-
locales: params.locales,
|
|
1899
|
-
where: ((_context2 = params.queryPredicate) == null ? void 0 : _bindInstanceProperty__default["default"](_context3 = Function.call).call(_context3, _trimInstanceProperty__default["default"](_context2), _context2))?.() || undefined
|
|
1900
|
-
}, asyncDispatch);
|
|
1901
|
-
if (isExportApiSuccessResponse(response) && response.resourceCount === 0) {
|
|
1902
|
-
return {
|
|
1903
|
-
success: false,
|
|
1904
|
-
noResourcesToExportForQueryPredicate: true
|
|
1905
|
-
};
|
|
1906
|
-
}
|
|
1907
|
-
return {
|
|
1908
|
-
success: true
|
|
1909
|
-
};
|
|
1910
|
-
} catch (error) {
|
|
1911
|
-
if (isExportApiErrorResponse(error)) {
|
|
1912
|
-
if (error.body.errors?.length) {
|
|
1913
|
-
var _context4;
|
|
1914
|
-
const whereError = _findInstanceProperty__default["default"](_context4 = error.body.errors).call(_context4, error => {
|
|
1915
|
-
var _context5;
|
|
1916
|
-
return error.message && _includesInstanceProperty__default["default"](_context5 = error.message).call(_context5, 'Malformed parameter: where');
|
|
1917
|
-
});
|
|
1918
|
-
if (whereError) {
|
|
1919
|
-
return {
|
|
1920
|
-
success: false,
|
|
1921
|
-
invalidQueryPredicate: true
|
|
1922
|
-
};
|
|
1923
|
-
}
|
|
1924
|
-
}
|
|
1925
|
-
if (error.body.validationErrors?.length) {
|
|
1926
|
-
return {
|
|
1927
|
-
success: false,
|
|
1928
|
-
validationErrors: error.body.validationErrors
|
|
1929
|
-
};
|
|
1930
|
-
}
|
|
1931
|
-
}
|
|
1932
|
-
showNotification({
|
|
1933
|
-
text: intl.formatMessage(messages.unexpectedError),
|
|
1934
|
-
kind: 'error',
|
|
1935
|
-
domain: constants.DOMAINS.PAGE
|
|
1936
|
-
});
|
|
1937
|
-
return {
|
|
1938
|
-
success: false,
|
|
1939
|
-
validationErrors: []
|
|
1940
|
-
};
|
|
1941
|
-
}
|
|
1942
|
-
};
|
|
1943
|
-
return {
|
|
1944
|
-
validateExport
|
|
1945
|
-
};
|
|
1946
|
-
};
|
|
1947
|
-
|
|
1948
|
-
function ownKeys$a(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; }
|
|
1949
|
-
function _objectSpread$a(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$a(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$a(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1950
|
-
const ExportPreferenceSection = () => {
|
|
1951
|
-
const intl = reactIntl.useIntl();
|
|
1952
|
-
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
1953
|
-
formik = _useExportResourcesMo.formik;
|
|
1954
|
-
const columnSeparatorOptions = _mapInstanceProperty__default["default"](COLUMN_DELIMITER_OPTIONS).call(COLUMN_DELIMITER_OPTIONS, option => _objectSpread$a(_objectSpread$a({}, option), {}, {
|
|
1955
|
-
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$a({}, option.label))
|
|
1956
|
-
}));
|
|
1957
|
-
const decimalSeparatorOptions = _mapInstanceProperty__default["default"](DECIMAL_DELIMITER_OPTIONS).call(DECIMAL_DELIMITER_OPTIONS, option => _objectSpread$a(_objectSpread$a({}, option), {}, {
|
|
1958
|
-
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$a({}, option.label))
|
|
1959
|
-
}));
|
|
1960
|
-
return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1961
|
-
scale: "l",
|
|
1962
|
-
children: [jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1963
|
-
scale: "s",
|
|
1964
|
-
children: [jsxRuntime.jsxs("div", {
|
|
1965
|
-
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1966
|
-
intlMessage: messages.separators
|
|
1967
|
-
}), jsxRuntime.jsx(uiKit.Text.Caption, {
|
|
1968
|
-
intlMessage: messages.separatorsDescription
|
|
1969
|
-
})]
|
|
1970
|
-
}), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1971
|
-
scale: "s",
|
|
1972
|
-
children: [jsxRuntime.jsx(uiKit.SelectField, {
|
|
1973
|
-
title: intl.formatMessage(messages.columns),
|
|
1974
|
-
isSearchable: false,
|
|
1975
|
-
options: columnSeparatorOptions,
|
|
1976
|
-
value: _valuesInstanceProperty__default["default"](formik).columnSeparator,
|
|
1977
|
-
onChange: e => {
|
|
1978
|
-
formik.setFieldValue('columnSeparator', e.target.value);
|
|
1979
|
-
},
|
|
1980
|
-
menuPortalTarget: document.body,
|
|
1981
|
-
menuPortalZIndex: Z_INDEX_DROPDOWN
|
|
1982
|
-
}), jsxRuntime.jsx(uiKit.SelectField, {
|
|
1983
|
-
title: intl.formatMessage(messages.decimals),
|
|
1984
|
-
isSearchable: false,
|
|
1985
|
-
options: decimalSeparatorOptions,
|
|
1986
|
-
value: _valuesInstanceProperty__default["default"](formik).decimalSeparator,
|
|
1987
|
-
onChange: e => {
|
|
1988
|
-
formik.setFieldValue('decimalSeparator', e.target.value);
|
|
1989
|
-
},
|
|
1990
|
-
menuPortalTarget: document.body,
|
|
1991
|
-
menuPortalZIndex: Z_INDEX_DROPDOWN
|
|
1992
|
-
})]
|
|
1993
|
-
})]
|
|
1994
|
-
}), jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1995
|
-
scale: "m",
|
|
1996
|
-
children: [jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1997
|
-
scale: "m",
|
|
1998
|
-
children: [jsxRuntime.jsx(uiKit.CheckboxInput, {
|
|
1999
|
-
isChecked: _valuesInstanceProperty__default["default"](formik).excelCompatible,
|
|
2000
|
-
onChange: e => {
|
|
2001
|
-
formik.setFieldValue('excelCompatible', e.target.checked);
|
|
2002
|
-
},
|
|
2003
|
-
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$a({}, messages.excelOptimized))
|
|
2004
|
-
}), _valuesInstanceProperty__default["default"](formik).excelCompatible && jsxRuntime.jsx(uiKit.ContentNotification, {
|
|
2005
|
-
type: "info",
|
|
2006
|
-
children: jsxRuntime.jsx(uiKit.Spacings.Inset, {
|
|
2007
|
-
scale: "xs",
|
|
2008
|
-
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
2009
|
-
children: [jsxRuntime.jsx("div", {
|
|
2010
|
-
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$a({}, messages.excelOptimizedDescription))
|
|
2011
|
-
}), jsxRuntime.jsx("div", {
|
|
2012
|
-
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$a(_objectSpread$a({}, messages.readMoreOnDocumentation), {}, {
|
|
2013
|
-
values: {
|
|
2014
|
-
documentationLink: jsxRuntime.jsx(uiKit.Link, {
|
|
2015
|
-
intlMessage: messages.documentation,
|
|
2016
|
-
isExternal: true,
|
|
2017
|
-
to: EXPORT_EXCEL_DOCUMENTATION_LINK
|
|
2018
|
-
}, "documentation-link")
|
|
2019
|
-
}
|
|
2020
|
-
}))
|
|
2021
|
-
})]
|
|
2022
|
-
})
|
|
2023
|
-
})
|
|
2024
|
-
})]
|
|
2025
|
-
}), jsxRuntime.jsxs("div", {
|
|
2026
|
-
children: [jsxRuntime.jsx(uiKit.CheckboxInput, {
|
|
2027
|
-
isChecked: _valuesInstanceProperty__default["default"](formik).fillRows,
|
|
2028
|
-
onChange: e => {
|
|
2029
|
-
formik.setFieldValue('fillRows', e.target.checked);
|
|
2030
|
-
},
|
|
2031
|
-
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$a({}, messages.fillRows))
|
|
2032
|
-
}), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
2033
|
-
scale: "xl",
|
|
2034
|
-
children: [jsxRuntime.jsx("div", {}), jsxRuntime.jsx(uiKit.Text.Caption, {
|
|
2035
|
-
intlMessage: _objectSpread$a(_objectSpread$a({}, messages.moreInformation), {}, {
|
|
2036
|
-
values: {
|
|
2037
|
-
documentationLink: jsxRuntime.jsx(uiKit.Link, {
|
|
2038
|
-
intlMessage: messages.documentation,
|
|
2039
|
-
isExternal: true,
|
|
2040
|
-
to: CSV_STRUCTURE_DOCUMENTATION_LINK
|
|
2041
|
-
}, "documentation-link")
|
|
2042
|
-
}
|
|
2043
|
-
})
|
|
2044
|
-
})]
|
|
2045
|
-
})]
|
|
2046
|
-
})]
|
|
2047
|
-
})]
|
|
2048
|
-
});
|
|
2049
|
-
};
|
|
2050
|
-
|
|
2051
|
-
function ownKeys$9(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; }
|
|
2052
|
-
function _objectSpread$9(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$9(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$9(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
2053
|
-
function ExportScopeSection() {
|
|
2054
|
-
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
2055
|
-
formik = _useExportResourcesMo.formik,
|
|
2056
|
-
exportType = _useExportResourcesMo.exportType,
|
|
2057
|
-
totalResourcesCount = _useExportResourcesMo.totalResourcesCount,
|
|
2058
|
-
filters = _useExportResourcesMo.filters,
|
|
2059
|
-
hasFilters = _useExportResourcesMo.hasFilters,
|
|
2060
|
-
selectedResourceIds = _useExportResourcesMo.selectedResourceIds,
|
|
2061
|
-
setExportType = _useExportResourcesMo.setExportType,
|
|
2062
|
-
resourceType = _useExportResourcesMo.resourceType,
|
|
2063
|
-
hideExportSelectedResourcesOption = _useExportResourcesMo.hideExportSelectedResourcesOption,
|
|
2064
|
-
showQueryPredicateOption = _useExportResourcesMo.showQueryPredicateOption;
|
|
2065
|
-
const shouldShowQueryPredicateField = exportType === EXPORT_TYPES.QUERY_PREDICATE;
|
|
2066
|
-
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2067
|
-
children: [jsxRuntime.jsxs(uiKit.RadioInput.Group, {
|
|
2068
|
-
value: exportType,
|
|
2069
|
-
onChange: e => {
|
|
2070
|
-
setExportType(e.target.value);
|
|
2071
|
-
},
|
|
2072
|
-
direction: "stack",
|
|
2073
|
-
directionProps: {
|
|
2074
|
-
scale: 's'
|
|
2075
|
-
},
|
|
2076
|
-
children: [jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
2077
|
-
value: EXPORT_TYPES.ALL,
|
|
2078
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
2079
|
-
intlMessage: _objectSpread$9(_objectSpread$9({}, resourceTypeMessages[resourceType].exportScopeAll), {}, {
|
|
2080
|
-
values: {
|
|
2081
|
-
total: totalResourcesCount
|
|
2082
|
-
}
|
|
2083
|
-
})
|
|
2084
|
-
})
|
|
2085
|
-
}), filters && jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
2086
|
-
value: EXPORT_TYPES.FILTERED,
|
|
2087
|
-
isDisabled: !filters.total || !hasFilters,
|
|
2088
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
2089
|
-
tone: !filters.total || !hasFilters ? 'tertiary' : undefined,
|
|
2090
|
-
intlMessage: filters.total ? _objectSpread$9(_objectSpread$9({}, resourceTypeMessages[resourceType].exportScopeFiltered), {}, {
|
|
2091
|
-
values: {
|
|
2092
|
-
total: filters.total
|
|
2093
|
-
}
|
|
2094
|
-
}) : messages.exportScopeFilteredWithoutCount
|
|
2095
|
-
})
|
|
2096
|
-
}), !hideExportSelectedResourcesOption && jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
2097
|
-
value: EXPORT_TYPES.SELECTED,
|
|
2098
|
-
isDisabled: !selectedResourceIds?.length,
|
|
2099
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
2100
|
-
tone: !selectedResourceIds?.length ? 'tertiary' : undefined,
|
|
2101
|
-
intlMessage: selectedResourceIds?.length ? _objectSpread$9(_objectSpread$9({}, resourceTypeMessages[resourceType].exportScopeSelected), {}, {
|
|
2102
|
-
values: {
|
|
2103
|
-
total: selectedResourceIds.length
|
|
2104
|
-
}
|
|
2105
|
-
}) : messages.exportScopeSelectedWithoutCount
|
|
2106
|
-
})
|
|
2107
|
-
}), showQueryPredicateOption && jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
2108
|
-
value: EXPORT_TYPES.QUERY_PREDICATE,
|
|
2109
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
2110
|
-
intlMessage: messages.queryPredicate
|
|
2111
|
-
})
|
|
2112
|
-
})]
|
|
2113
|
-
}), shouldShowQueryPredicateField && jsxRuntime.jsx(uiKit.TextField, {
|
|
2114
|
-
name: "queryPredicate",
|
|
2115
|
-
"data-testid": "query-predicate-field",
|
|
2116
|
-
title: "",
|
|
2117
|
-
onChange: formik.handleChange,
|
|
2118
|
-
onBlur: formik.handleBlur,
|
|
2119
|
-
value: _valuesInstanceProperty__default["default"](formik).queryPredicate,
|
|
2120
|
-
touched: formik.touched.queryPredicate,
|
|
2121
|
-
errors: mapFormikErrors(formik.errors.queryPredicate),
|
|
2122
|
-
renderError: renderQueryPredicateError
|
|
2123
|
-
})]
|
|
2124
|
-
});
|
|
2125
|
-
}
|
|
2126
|
-
|
|
2127
|
-
const ExportFileSettingsStep = () => {
|
|
2128
|
-
const intl = reactIntl.useIntl();
|
|
2129
|
-
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
2130
|
-
formik = _useExportResourcesMo.formik,
|
|
2131
|
-
resourceType = _useExportResourcesMo.resourceType,
|
|
2132
|
-
setFieldSelectionMode = _useExportResourcesMo.setFieldSelectionMode,
|
|
2133
|
-
setLocaleOption = _useExportResourcesMo.setLocaleOption,
|
|
2134
|
-
onClose = _useExportResourcesMo.onClose;
|
|
2135
|
-
const handleOutputFormatChange = event => {
|
|
2136
|
-
formik.handleChange(event);
|
|
2137
|
-
if (event.target.value === OUTPUT_FORMATS.JSON) {
|
|
2138
|
-
setFieldSelectionMode(FIELD_SELECTION_MODES.SELECTED_FIELDS);
|
|
2139
|
-
setLocaleOption(LocaleOption.Selected);
|
|
2140
|
-
}
|
|
2141
|
-
};
|
|
2142
|
-
const shouldShowPreferences = _valuesInstanceProperty__default["default"](formik).outputFormat === 'csv';
|
|
2143
|
-
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
2144
|
-
isOpen: true,
|
|
2145
|
-
title: `${intl.formatMessage(messages.stepCount, {
|
|
2146
|
-
currentStep: 1,
|
|
2147
|
-
totalSteps: TOTAL_STEPS
|
|
2148
|
-
})}: ${intl.formatMessage(messages[`modalTitle.${resourceType}`])}`,
|
|
2149
|
-
labelPrimary: `${intl.formatMessage(messages.stepNumber, {
|
|
2150
|
-
stepNumber: 2
|
|
2151
|
-
})}: ${intl.formatMessage(messages.selectContentToExport)}`,
|
|
2152
|
-
iconLeftPrimaryButton: jsxRuntime.jsx(uiKit.AngleRightIcon, {}),
|
|
2153
|
-
onPrimaryButtonClick: formik.submitForm,
|
|
2154
|
-
isPrimaryButtonDisabled: !formik.isValid,
|
|
2155
|
-
onSecondaryButtonClick: onClose,
|
|
2156
|
-
onClose: onClose,
|
|
2157
|
-
size: 16,
|
|
2158
|
-
children: jsxRuntime.jsx(fullstory.Masking.Unmask, {
|
|
2159
|
-
children: jsxRuntime.jsxs(uiKit.Grid, {
|
|
2160
|
-
gridRowGap: uiKit.designTokens.spacingXl,
|
|
2161
|
-
gridTemplateColumns: `calc(${uiKit.designTokens.constraint3} + ${uiKit.designTokens.spacingL}) auto`,
|
|
2162
|
-
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
2163
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
2164
|
-
intlMessage: messages.scope
|
|
2165
|
-
})
|
|
2166
|
-
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
2167
|
-
children: jsxRuntime.jsx(ExportScopeSection, {})
|
|
2168
|
-
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
2169
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
2170
|
-
intlMessage: messages.saveAs
|
|
2171
|
-
})
|
|
2172
|
-
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
2173
|
-
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
2174
|
-
scale: "m",
|
|
2175
|
-
children: [jsxRuntime.jsx(fullstory.Masking.Mask, {
|
|
2176
|
-
children: jsxRuntime.jsx(uiKit.TextField, {
|
|
2177
|
-
name: "fileName",
|
|
2178
|
-
onChange: formik.handleChange,
|
|
2179
|
-
onBlur: formik.handleBlur,
|
|
2180
|
-
value: _valuesInstanceProperty__default["default"](formik).fileName,
|
|
2181
|
-
title: intl.formatMessage(messages.fileName),
|
|
2182
|
-
touched: formik.touched.fileName,
|
|
2183
|
-
errors: mapFormikErrors(formik.errors.fileName),
|
|
2184
|
-
renderError: renderFileNameError
|
|
2185
|
-
})
|
|
2186
|
-
}), jsxRuntime.jsx(uiKit.SelectField, {
|
|
2187
|
-
name: "outputFormat",
|
|
2188
|
-
onChange: handleOutputFormatChange,
|
|
2189
|
-
onBlur: formik.handleBlur,
|
|
2190
|
-
value: _valuesInstanceProperty__default["default"](formik).outputFormat,
|
|
2191
|
-
title: intl.formatMessage(messages.outputFormat),
|
|
2192
|
-
options: OUTPUT_FORMAT_OPTIONS,
|
|
2193
|
-
menuPortalTarget: document.body,
|
|
2194
|
-
menuPortalZIndex: Z_INDEX_DROPDOWN
|
|
2195
|
-
})]
|
|
2196
|
-
})
|
|
2197
|
-
}), shouldShowPreferences && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2198
|
-
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
2199
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
2200
|
-
intlMessage: messages.csvSettings
|
|
2201
|
-
})
|
|
2202
|
-
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
2203
|
-
children: jsxRuntime.jsx(ExportPreferenceSection, {})
|
|
2204
|
-
})]
|
|
2205
|
-
})]
|
|
2206
|
-
})
|
|
2207
|
-
})
|
|
2208
|
-
});
|
|
2209
|
-
};
|
|
2210
|
-
|
|
2211
|
-
const ExportLocaleSelectField = () => {
|
|
2212
|
-
const intl = reactIntl.useIntl();
|
|
2213
|
-
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
2214
|
-
formik = _useExportResourcesMo.formik,
|
|
2215
|
-
fieldSelectionMode = _useExportResourcesMo.fieldSelectionMode,
|
|
2216
|
-
localeOption = _useExportResourcesMo.localeOption,
|
|
2217
|
-
setLocaleOption = _useExportResourcesMo.setLocaleOption;
|
|
2218
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
2219
|
-
locale: applicationContext.dataLocale,
|
|
2220
|
-
locales: applicationContext.project?.languages || []
|
|
2221
|
-
})),
|
|
2222
|
-
locales = _useApplicationContex.locales,
|
|
2223
|
-
locale = _useApplicationContex.locale;
|
|
2224
|
-
const isOnlyLocalesFoundInCsvFileOptionDisabled = React__default["default"].useMemo(() => {
|
|
2225
|
-
return fieldSelectionMode !== 'imported-csv-template' || !_valuesInstanceProperty__default["default"](formik).importedCsvTemplateFile;
|
|
2226
|
-
}, [fieldSelectionMode, _valuesInstanceProperty__default["default"](formik).importedCsvTemplateFile]);
|
|
2227
|
-
const isLocalesSelectFieldDisabled = React__default["default"].useMemo(() => {
|
|
2228
|
-
return localeOption === LocaleOption.OnlyLocalesFoundInCsvFile;
|
|
2229
|
-
}, [localeOption]);
|
|
2230
|
-
const isCSVOutputFormat = _valuesInstanceProperty__default["default"](formik).outputFormat === OUTPUT_FORMATS.CSV;
|
|
2231
|
-
const localeChangeHandler = React__default["default"].useCallback(e => {
|
|
2232
|
-
const nextValue = e.target.value;
|
|
2233
|
-
if (nextValue === LocaleOption.All) formik.setFieldValue('locales', locales);else if (nextValue === LocaleOption.Selected) formik.setFieldValue('locales', [locale]);
|
|
2234
|
-
setLocaleOption(nextValue);
|
|
2235
|
-
}, [setLocaleOption, locales, locale, formik]);
|
|
2236
|
-
return jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
2237
|
-
scale: "xs",
|
|
2238
|
-
children: [jsxRuntime.jsx(uiKit.FieldLabel, {
|
|
2239
|
-
horizontalConstraint: 3,
|
|
2240
|
-
hasRequiredIndicator: true,
|
|
2241
|
-
title: intl.formatMessage(messages.locales),
|
|
2242
|
-
htmlFor: "locales-select-field"
|
|
2243
|
-
}), jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
2244
|
-
max: "scale",
|
|
2245
|
-
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
2246
|
-
scale: "xs",
|
|
2247
|
-
children: [jsxRuntime.jsxs(uiKit.RadioInput.Group, {
|
|
2248
|
-
onChange: localeChangeHandler,
|
|
2249
|
-
name: "locale-option",
|
|
2250
|
-
value: localeOption,
|
|
2251
|
-
direction: "inline",
|
|
2252
|
-
children: [jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
2253
|
-
value: LocaleOption.Selected,
|
|
2254
|
-
children: intl.formatMessage(messages.includeOnlySelectedLocalesRadioOption)
|
|
2255
|
-
}), jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
2256
|
-
"data-testid": "include-all-locales-toggle-input",
|
|
2257
|
-
value: LocaleOption.All,
|
|
2258
|
-
children: intl.formatMessage(messages.includeAllLocalesRadioOption)
|
|
2259
|
-
}), isCSVOutputFormat && jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
2260
|
-
"data-testid": "only-locales-found-in-the-csv-file",
|
|
2261
|
-
value: LocaleOption.OnlyLocalesFoundInCsvFile,
|
|
2262
|
-
isDisabled: isOnlyLocalesFoundInCsvFileOptionDisabled,
|
|
2263
|
-
children: jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
2264
|
-
scale: "s",
|
|
2265
|
-
alignItems: "center",
|
|
2266
|
-
children: [jsxRuntime.jsx("div", {
|
|
2267
|
-
children: intl.formatMessage(messages.onlyLocalesFoundInCsvFile)
|
|
2268
|
-
}), jsxRuntime.jsx(uiKit.Tooltip, {
|
|
2269
|
-
title: intl.formatMessage(messages.onlyLocalesFoundInCsvFileTooltip),
|
|
2270
|
-
children: jsxRuntime.jsx(uiKit.SupportIcon, {
|
|
2271
|
-
color: "primary",
|
|
2272
|
-
size: "20"
|
|
2273
|
-
})
|
|
2274
|
-
})]
|
|
2275
|
-
})
|
|
2276
|
-
})]
|
|
2277
|
-
}), jsxRuntime.jsx(uiKit.SelectField, {
|
|
2278
|
-
id: "locales-select-field",
|
|
2279
|
-
name: "locales",
|
|
2280
|
-
"data-testid": "locales-select-field",
|
|
2281
|
-
isDisabled: isLocalesSelectFieldDisabled,
|
|
2282
|
-
title: "",
|
|
2283
|
-
value: _valuesInstanceProperty__default["default"](formik).locales,
|
|
2284
|
-
options: mapLocalesToOptions(locales),
|
|
2285
|
-
isMulti: true,
|
|
2286
|
-
onChange: formik.handleChange,
|
|
2287
|
-
onBlur: formik.handleBlur,
|
|
2288
|
-
touched: formik.touched.locales,
|
|
2289
|
-
errors: mapFormikErrors(formik.errors.locales),
|
|
2290
|
-
renderError: renderLocaleError,
|
|
2291
|
-
menuPortalTarget: document.body,
|
|
2292
|
-
menuPortalZIndex: Z_INDEX_DROPDOWN,
|
|
2293
|
-
horizontalConstraint: 16,
|
|
2294
|
-
isClearable: false
|
|
2295
|
-
})]
|
|
2296
|
-
})
|
|
2297
|
-
})]
|
|
2298
|
-
});
|
|
2299
|
-
};
|
|
2300
|
-
|
|
2301
|
-
function ownKeys$8(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; }
|
|
2302
|
-
function _objectSpread$8(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$8(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$8(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
2303
|
-
const ImportedCsvTemplateFieldsForm = () => {
|
|
2304
|
-
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
2305
|
-
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
2306
|
-
scale: "m",
|
|
2307
|
-
children: [jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
2308
|
-
scale: "xs",
|
|
2309
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
2310
|
-
intlMessage: _objectSpread$8(_objectSpread$8({}, messages.defineFieldsToIncludeInExport), {}, {
|
|
2311
|
-
values: {
|
|
2312
|
-
templateLink: msg => jsxRuntime.jsx(uiKit.Link, {
|
|
2313
|
-
tone: "secondary",
|
|
2314
|
-
to: CSV_TEMPLATES_LINK,
|
|
2315
|
-
isExternal: true,
|
|
2316
|
-
children: msg
|
|
2317
|
-
}, "link")
|
|
2318
|
-
}
|
|
2319
|
-
})
|
|
2320
|
-
})
|
|
2321
|
-
}), jsxRuntime.jsx(FileDropArea, {})]
|
|
2322
|
-
})
|
|
2323
|
-
});
|
|
2324
|
-
};
|
|
2325
|
-
|
|
2326
|
-
function ownKeys$7(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; }
|
|
2327
|
-
function _objectSpread$7(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$7(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$7(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
2328
|
-
const exportFieldSelectionContextDefaultValues = {
|
|
2329
|
-
updateExpandedGroups: (_name, _value) => {}
|
|
2330
|
-
};
|
|
2331
|
-
const ExportFieldSelectionContext = /*#__PURE__*/React.createContext(exportFieldSelectionContextDefaultValues);
|
|
2332
|
-
const ExportFieldSelectionProvider = _ref => {
|
|
2333
|
-
let resourceType = _ref.resourceType,
|
|
2334
|
-
children = _ref.children;
|
|
2335
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
2336
|
-
projectKey: context.project?.key
|
|
2337
|
-
})),
|
|
2338
|
-
projectKey = _useApplicationContex.projectKey;
|
|
2339
|
-
const _useStorage = useStorage(`${projectKey}/${OPERATIONS_EXPORT_RESOURCES_MODAL_EXPANDED_GROUP}`, {}),
|
|
2340
|
-
_useStorage2 = _slicedToArray(_useStorage, 2),
|
|
2341
|
-
cachedExpandedGroups = _useStorage2[0],
|
|
2342
|
-
setCachedExpandedGroups = _useStorage2[1];
|
|
2343
|
-
const updateExpandedGroups = React.useCallback((name, value) => {
|
|
2344
|
-
setCachedExpandedGroups({
|
|
2345
|
-
[resourceType]: _objectSpread$7(_objectSpread$7({}, cachedExpandedGroups?.[resourceType] || {}), {}, {
|
|
2346
|
-
[name]: value
|
|
2347
|
-
})
|
|
2348
|
-
});
|
|
2349
|
-
}, [cachedExpandedGroups, resourceType, setCachedExpandedGroups]);
|
|
2350
|
-
return jsxRuntime.jsx(ExportFieldSelectionContext.Provider, {
|
|
2351
|
-
value: {
|
|
2352
|
-
updateExpandedGroups
|
|
2353
|
-
},
|
|
2354
|
-
children: children
|
|
2355
|
-
});
|
|
2356
|
-
};
|
|
2357
|
-
const useExportFieldSelectionContext = () => {
|
|
2358
|
-
return React.useContext(ExportFieldSelectionContext);
|
|
2359
|
-
};
|
|
2360
|
-
|
|
2361
|
-
const FieldsCountStamp = _ref => {
|
|
2362
|
-
let count = _ref.count;
|
|
2363
|
-
const _useIntl = reactIntl.useIntl(),
|
|
2364
|
-
formatMessage = _useIntl.formatMessage;
|
|
2365
|
-
return jsxRuntime.jsx(uiKit.Stamp, {
|
|
2366
|
-
tone: "information",
|
|
2367
|
-
isCondensed: true,
|
|
2368
|
-
label: formatMessage(messages.itemCount, {
|
|
2369
|
-
count
|
|
2370
|
-
})
|
|
2371
|
-
});
|
|
2372
|
-
};
|
|
2373
|
-
|
|
2374
|
-
const FieldWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
2375
|
-
target: "e1judmlm0"
|
|
2376
|
-
} )({
|
|
2377
|
-
name: "9iujih",
|
|
2378
|
-
styles: "position:relative;display:flex;align-items:center"
|
|
2379
|
-
} );
|
|
2380
|
-
const CollapsibleFieldWrapper = _ref => {
|
|
2381
|
-
let isForceExpanded = _ref.isForceExpanded,
|
|
2382
|
-
field = _ref.field,
|
|
2383
|
-
children = _ref.children;
|
|
2384
|
-
if (field.isExpandable) return jsxRuntime.jsx(uiKit.CollapsibleMotion, {
|
|
2385
|
-
isDefaultClosed: isForceExpanded ? false : !field.isExpanded,
|
|
2386
|
-
children: _ref2 => {
|
|
2387
|
-
let isOpen = _ref2.isOpen,
|
|
2388
|
-
toggle = _ref2.toggle,
|
|
2389
|
-
registerContentNode = _ref2.registerContentNode;
|
|
2390
|
-
return children({
|
|
2391
|
-
isOpen,
|
|
2392
|
-
toggle,
|
|
2393
|
-
registerContentNode
|
|
2394
|
-
});
|
|
2395
|
-
}
|
|
2396
|
-
}, `${isForceExpanded}`);
|
|
2397
|
-
return children({
|
|
2398
|
-
isOpen: true,
|
|
2399
|
-
toggle: () => {},
|
|
2400
|
-
registerContentNode: () => {}
|
|
2401
|
-
});
|
|
2402
|
-
};
|
|
2403
|
-
const FieldSection = _ref3 => {
|
|
2404
|
-
var _context, _context2, _context7, _context8;
|
|
2405
|
-
let fields = _ref3.fields,
|
|
2406
|
-
parentKeys = _ref3.parentKeys,
|
|
2407
|
-
formik = _ref3.formik,
|
|
2408
|
-
isAnySiblingChecked = _ref3.isAnySiblingChecked,
|
|
2409
|
-
isSearchActive = _ref3.isSearchActive,
|
|
2410
|
-
groupName = _ref3.groupName,
|
|
2411
|
-
maxVisibleChildren = _ref3.maxVisibleChildren;
|
|
2412
|
-
const _useExportFieldSelect = useExportFieldSelectionContext(),
|
|
2413
|
-
updateExpandedGroups = _useExportFieldSelect.updateExpandedGroups;
|
|
2414
|
-
const visibleFields = isSearchActive || !maxVisibleChildren ? fields : ((_context = fields) == null ? void 0 : _bindInstanceProperty__default["default"](_context2 = Function.call).call(_context2, _sliceInstanceProperty__default["default"](_context), _context))?.(0, maxVisibleChildren);
|
|
2415
|
-
const hasMoreFields = maxVisibleChildren && !isSearchActive && fields && fields.length > maxVisibleChildren;
|
|
2416
|
-
const visibleIndex = field => {
|
|
2417
|
-
var _context3, _context4, _context5, _context6;
|
|
2418
|
-
return ((_context3 = ((_context4 = fields) == null ? void 0 : _bindInstanceProperty__default["default"](_context5 = Function.call).call(_context5, _filterInstanceProperty__default["default"](_context4), _context4))?.(f => !f.isHidden)) == null ? void 0 : _bindInstanceProperty__default["default"](_context6 = Function.call).call(_context6, _indexOfInstanceProperty__default["default"](_context3), _context3))?.(field) || -1;
|
|
2419
|
-
};
|
|
2420
|
-
const shouldDisplayField = field => {
|
|
2421
|
-
if (field.isHidden) return false;
|
|
2422
|
-
if (!maxVisibleChildren) return true;
|
|
2423
|
-
return maxVisibleChildren && visibleIndex(field) < maxVisibleChildren;
|
|
2424
|
-
};
|
|
2425
|
-
const shouldDisplayChildrenCount = field => {
|
|
2426
|
-
return Boolean(field.maxVisibleChildren);
|
|
2427
|
-
};
|
|
2428
|
-
return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
2429
|
-
scale: "s",
|
|
2430
|
-
children: [((_context7 = visibleFields) == null ? void 0 : _bindInstanceProperty__default["default"](_context8 = Function.call).call(_context8, _mapInstanceProperty__default["default"](_context7), _context7))?.((field, index) => {
|
|
2431
|
-
const isChildrenCountDisplayed = shouldDisplayChildrenCount(field);
|
|
2432
|
-
const hasDependents = Boolean(field.dependentGroupNames?.length || field.dependentFieldNames?.length);
|
|
2433
|
-
const isAnyOfTheChildFieldsChecked = isAnyFieldChecked(field.fields || []);
|
|
2434
|
-
const allFieldsChecked = areAllFieldsChecked(field.fields || []);
|
|
2435
|
-
const getIsChecked = () => {
|
|
2436
|
-
const isParent = Boolean(field.fields && field.fields?.length > 0);
|
|
2437
|
-
if (isParent) return areAllFieldsChecked(field.fields);
|
|
2438
|
-
return field.isChecked;
|
|
2439
|
-
};
|
|
2440
|
-
if (!shouldDisplayField(field)) return null;
|
|
2441
|
-
return jsxRuntime.jsx(CollapsibleFieldWrapper, {
|
|
2442
|
-
isForceExpanded: isSearchActive,
|
|
2443
|
-
field: field,
|
|
2444
|
-
children: _ref4 => {
|
|
2445
|
-
let isOpen = _ref4.isOpen,
|
|
2446
|
-
toggle = _ref4.toggle,
|
|
2447
|
-
registerContentNode = _ref4.registerContentNode;
|
|
2448
|
-
return jsxRuntime.jsxs(React.Fragment, {
|
|
2449
|
-
children: [jsxRuntime.jsxs(FieldWrapper, {
|
|
2450
|
-
children: [field.isExpandable && jsxRuntime.jsx(uiKit.IconButton, {
|
|
2451
|
-
size: "20",
|
|
2452
|
-
style: {
|
|
2453
|
-
position: 'absolute',
|
|
2454
|
-
left: `calc(-1 * ${uiKit.designTokens.spacingXl})`
|
|
2455
|
-
},
|
|
2456
|
-
onClick: () => {
|
|
2457
|
-
if (!isSearchActive) {
|
|
2458
|
-
updateExpandedGroups(`${groupName}.${field.name}`, !isOpen);
|
|
2459
|
-
}
|
|
2460
|
-
toggle();
|
|
2461
|
-
},
|
|
2462
|
-
icon: isOpen ? jsxRuntime.jsx(uiKit.AngleDownIcon, {}) : jsxRuntime.jsx(uiKit.AngleRightIcon, {}),
|
|
2463
|
-
label: ""
|
|
2464
|
-
}), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
2465
|
-
scale: "s",
|
|
2466
|
-
alignItems: "center",
|
|
2467
|
-
children: [jsxRuntime.jsxs(uiKit.CheckboxInput, {
|
|
2468
|
-
isIndeterminate: field.isExpandable && !allFieldsChecked && isAnyOfTheChildFieldsChecked,
|
|
2469
|
-
isChecked: getIsChecked(),
|
|
2470
|
-
isReadOnly: hasDependents || field.isRequired,
|
|
2471
|
-
onChange: e => {
|
|
2472
|
-
const path = `${parentKeys.join('.')}.fields[${index}]`;
|
|
2473
|
-
const checked = e.target.checked;
|
|
2474
|
-
// Update all child fields
|
|
2475
|
-
const updateAllChildFieldsChecked = (path, checked) => {
|
|
2476
|
-
const item = get__default["default"](_valuesInstanceProperty__default["default"](formik), path);
|
|
2477
|
-
if (item && item.fields) {
|
|
2478
|
-
var _context9;
|
|
2479
|
-
_forEachInstanceProperty__default["default"](_context9 = item.fields).call(_context9, (field, i) => {
|
|
2480
|
-
const fieldPath = `${path}.fields[${i}]`;
|
|
2481
|
-
if (!field.fields?.length) {
|
|
2482
|
-
formik.setFieldValue(`${fieldPath}.isChecked`, checked || field.isRequired,
|
|
2483
|
-
// pass `false` to avoid revalidating the form with intermediate values
|
|
2484
|
-
false);
|
|
2485
|
-
}
|
|
2486
|
-
updateAllChildFieldsChecked(fieldPath, checked);
|
|
2487
|
-
});
|
|
2488
|
-
}
|
|
2489
|
-
};
|
|
2490
|
-
if (!field.fields?.length) {
|
|
2491
|
-
formik.setFieldValue(`${path}.isChecked`, checked || field.isRequired,
|
|
2492
|
-
// pass `false` to avoid revalidating the form with intermediate values
|
|
2493
|
-
false);
|
|
2494
|
-
}
|
|
2495
|
-
updateAllChildFieldsChecked(path, checked);
|
|
2496
|
-
},
|
|
2497
|
-
children: [field.label, (hasDependents || field.isRequired) && ' *']
|
|
2498
|
-
}), isChildrenCountDisplayed && field.fields && field.fields.length > 0 && jsxRuntime.jsx("div", {
|
|
2499
|
-
style: {
|
|
2500
|
-
flex: '0 0 auto'
|
|
2501
|
-
},
|
|
2502
|
-
children: jsxRuntime.jsx(FieldsCountStamp, {
|
|
2503
|
-
count: field.fields.length
|
|
2504
|
-
})
|
|
2505
|
-
})]
|
|
2506
|
-
})]
|
|
2507
|
-
}), field.fields && field.fields.length > 0 && jsxRuntime.jsx(StyledExpandableContent, {
|
|
2508
|
-
ref: registerContentNode,
|
|
2509
|
-
isOpen: isOpen,
|
|
2510
|
-
children: isOpen && jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
2511
|
-
scale: "xl",
|
|
2512
|
-
children: [jsxRuntime.jsx("div", {}), jsxRuntime.jsx(FieldSection, {
|
|
2513
|
-
fields: field.fields,
|
|
2514
|
-
maxVisibleChildren: field.maxVisibleChildren,
|
|
2515
|
-
formik: formik,
|
|
2516
|
-
parentKeys: [...parentKeys, `fields[${index}]`],
|
|
2517
|
-
isAnySiblingChecked: isAnySiblingChecked,
|
|
2518
|
-
isSearchActive: isSearchActive,
|
|
2519
|
-
groupName: groupName
|
|
2520
|
-
})]
|
|
2521
|
-
})
|
|
2522
|
-
})]
|
|
2523
|
-
}, `${field.name}-${index}`);
|
|
2524
|
-
}
|
|
2525
|
-
}, `${field.name}.${isSearchActive}`);
|
|
2526
|
-
}), hasMoreFields && jsxRuntime.jsx("div", {
|
|
2527
|
-
css: /*#__PURE__*/react.css("padding-left:", uiKit.designTokens.spacingXs, ";" + ("" ), "" ),
|
|
2528
|
-
children: jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
2529
|
-
tone: "tertiary",
|
|
2530
|
-
intlMessage: messages.loadMoreFields
|
|
2531
|
-
})
|
|
2532
|
-
})]
|
|
2533
|
-
});
|
|
2534
|
-
};
|
|
2535
|
-
|
|
2536
|
-
const SelectedGroupFieldsCountStamp = _ref => {
|
|
2537
|
-
let group = _ref.group;
|
|
2538
|
-
const _useIntl = reactIntl.useIntl(),
|
|
2539
|
-
formatMessage = _useIntl.formatMessage;
|
|
2540
|
-
return jsxRuntime.jsx(uiKit.Card, {
|
|
2541
|
-
type: "flat",
|
|
2542
|
-
insetScale: "m",
|
|
2543
|
-
children: jsxRuntime.jsx(uiKit.Spacings.Inline, {
|
|
2544
|
-
justifyContent: "flex-end",
|
|
2545
|
-
children: jsxRuntime.jsx(uiKit.Stamp, {
|
|
2546
|
-
tone: "secondary",
|
|
2547
|
-
isCondensed: true,
|
|
2548
|
-
label: formatMessage(messages.selected, {
|
|
2549
|
-
total: getGroupSelectedFieldCount(group)
|
|
2550
|
-
})
|
|
2551
|
-
})
|
|
2552
|
-
})
|
|
2553
|
-
});
|
|
2554
|
-
};
|
|
2555
|
-
|
|
2556
|
-
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; }
|
|
2557
|
-
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; }
|
|
2558
|
-
const StyledGroupCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
2559
|
-
target: "e1igkh7t2"
|
|
2560
|
-
} )("height:100%;border-radius:0;", props => props.showTopBorder && /*#__PURE__*/react.css("border-top:", uiKit.designTokens.borderWidth1, " solid ", uiKit.designTokens.colorNeutral90, ";" + ("" ), "" ), ";" + ("" ));
|
|
2561
|
-
const StyledFieldsCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
2562
|
-
target: "e1igkh7t1"
|
|
2563
|
-
} )("border-radius:0;", props => props.showTopBorder && /*#__PURE__*/react.css("border-top:", uiKit.designTokens.borderWidth1, " solid ", uiKit.designTokens.colorNeutral90, ";" + ("" ), "" ), ";" + ("" ));
|
|
2564
|
-
var _ref$1 = {
|
|
2565
|
-
name: "2ce4ng",
|
|
2566
|
-
styles: "overflow:hidden;height:0;margin-top:0!important"
|
|
2567
|
-
} ;
|
|
2568
|
-
const StyledExpandableContent = /*#__PURE__*/_styled__default["default"]("div", {
|
|
2569
|
-
target: "e1igkh7t0"
|
|
2570
|
-
} )(props => !props.isOpen && _ref$1, " ", props => !props.isOpen && props.showTopBorder && /*#__PURE__*/react.css("border-top:", uiKit.designTokens.borderWidth1, " solid ", uiKit.designTokens.colorNeutral90, ";" + ("" ), "" ), ";" + ("" ));
|
|
2571
|
-
const FieldGroupSection = _ref2 => {
|
|
2572
|
-
let group = _ref2.group,
|
|
2573
|
-
index = _ref2.index,
|
|
2574
|
-
formik = _ref2.formik,
|
|
2575
|
-
isSearchActive = _ref2.isSearchActive;
|
|
2576
|
-
const allFieldsChecked = React.useMemo(() => areAllFieldsChecked(group.fields), [group.fields]);
|
|
2577
|
-
const isAnyFieldInGroupChecked = React.useMemo(() => isAnyFieldChecked(group.fields), [group.fields]);
|
|
2578
|
-
const _useExportFieldSelect = useExportFieldSelectionContext(),
|
|
2579
|
-
updateExpandedGroups = _useExportFieldSelect.updateExpandedGroups;
|
|
2580
|
-
const parentKey = `groups[${index}]`;
|
|
2581
|
-
const handleChangeAllFields = e => {
|
|
2582
|
-
const item = get__default["default"](_valuesInstanceProperty__default["default"](formik), parentKey);
|
|
2583
|
-
function updateAllFields(fields, checked) {
|
|
2584
|
-
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
2585
|
-
if (field.fields) {
|
|
2586
|
-
return _objectSpread$6(_objectSpread$6({}, field), {}, {
|
|
2587
|
-
fields: updateAllFields(field.fields, checked)
|
|
2588
|
-
});
|
|
2589
|
-
}
|
|
2590
|
-
if (field.isRequired) return field;
|
|
2591
|
-
return _objectSpread$6(_objectSpread$6({}, field), {}, {
|
|
2592
|
-
isChecked: checked
|
|
2593
|
-
});
|
|
2594
|
-
});
|
|
2595
|
-
}
|
|
2596
|
-
formik.setFieldValue(parentKey, _objectSpread$6(_objectSpread$6({}, item), {}, {
|
|
2597
|
-
fields: updateAllFields(item.fields, e.target.checked)
|
|
2598
|
-
}));
|
|
2599
|
-
};
|
|
2600
|
-
if (group.isHidden) return null;
|
|
2601
|
-
return jsxRuntime.jsx(uiKit.CollapsibleMotion, {
|
|
2602
|
-
isDefaultClosed: isSearchActive ? false : !group.isExpanded
|
|
2603
|
-
// Reset collapse state when search input becomes active/inactive
|
|
2604
|
-
,
|
|
2605
|
-
children: _ref3 => {
|
|
2606
|
-
let isOpen = _ref3.isOpen,
|
|
2607
|
-
toggle = _ref3.toggle,
|
|
2608
|
-
registerContentNode = _ref3.registerContentNode;
|
|
2609
|
-
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2610
|
-
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
2611
|
-
children: jsxRuntime.jsx(StyledGroupCard, {
|
|
2612
|
-
type: "flat",
|
|
2613
|
-
insetScale: "m",
|
|
2614
|
-
showTopBorder: index > 0,
|
|
2615
|
-
children: jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
2616
|
-
scale: "s",
|
|
2617
|
-
alignItems: "center",
|
|
2618
|
-
children: [jsxRuntime.jsx(uiKit.IconButton, {
|
|
2619
|
-
size: "20",
|
|
2620
|
-
onClick: () => {
|
|
2621
|
-
if (!isSearchActive) {
|
|
2622
|
-
updateExpandedGroups(group.groupName, !isOpen);
|
|
2623
|
-
}
|
|
2624
|
-
toggle();
|
|
2625
|
-
},
|
|
2626
|
-
icon: isOpen ? jsxRuntime.jsx(uiKit.AngleDownIcon, {}) : jsxRuntime.jsx(uiKit.AngleRightIcon, {}),
|
|
2627
|
-
label: ""
|
|
2628
|
-
}), jsxRuntime.jsx(uiKit.CheckboxInput, {
|
|
2629
|
-
isIndeterminate: !allFieldsChecked && isAnyFieldInGroupChecked,
|
|
2630
|
-
isChecked: allFieldsChecked,
|
|
2631
|
-
onChange: handleChangeAllFields,
|
|
2632
|
-
children: group.groupLabel
|
|
2633
|
-
})]
|
|
2634
|
-
})
|
|
2635
|
-
})
|
|
2636
|
-
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
2637
|
-
children: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2638
|
-
children: [jsxRuntime.jsx(StyledExpandableContent, {
|
|
2639
|
-
ref: registerContentNode,
|
|
2640
|
-
isOpen: isOpen,
|
|
2641
|
-
showTopBorder: index > 0,
|
|
2642
|
-
children: jsxRuntime.jsx(StyledFieldsCard, {
|
|
2643
|
-
type: "flat",
|
|
2644
|
-
insetScale: "m",
|
|
2645
|
-
showTopBorder: true,
|
|
2646
|
-
children: isOpen && jsxRuntime.jsx(FieldSection, {
|
|
2647
|
-
fields: group.fields,
|
|
2648
|
-
formik: formik,
|
|
2649
|
-
parentKeys: [parentKey],
|
|
2650
|
-
isAnySiblingChecked: isAnyFieldInGroupChecked,
|
|
2651
|
-
groupName: group.groupName,
|
|
2652
|
-
isSearchActive: isSearchActive
|
|
2653
|
-
})
|
|
2654
|
-
})
|
|
2655
|
-
}), !isOpen && jsxRuntime.jsx(SelectedGroupFieldsCountStamp, {
|
|
2656
|
-
group: group
|
|
2657
|
-
})]
|
|
2658
|
-
})
|
|
2659
|
-
})]
|
|
2660
|
-
});
|
|
2661
|
-
}
|
|
2662
|
-
}, `${isSearchActive}`);
|
|
2663
|
-
};
|
|
2664
|
-
|
|
2665
|
-
var _ref = {
|
|
2666
|
-
name: "ti75j2",
|
|
2667
|
-
styles: "margin:0"
|
|
2668
|
-
} ;
|
|
2669
|
-
const NoSearchResults = () => {
|
|
2670
|
-
return jsxRuntime.jsxs(uiKit.Card, {
|
|
2671
|
-
insetScale: "xl",
|
|
2672
|
-
children: [jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
2673
|
-
scale: "s",
|
|
2674
|
-
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
2675
|
-
fontWeight: "medium",
|
|
2676
|
-
intlMessage: messages.thereAreNoResults
|
|
2677
|
-
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
2678
|
-
intlMessage: messages.suggestions
|
|
2679
|
-
})]
|
|
2680
|
-
}), jsxRuntime.jsxs("ul", {
|
|
2681
|
-
css: _ref,
|
|
2682
|
-
children: [jsxRuntime.jsx("li", {
|
|
2683
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
2684
|
-
intlMessage: messages.checkTheSpelling
|
|
2685
|
-
})
|
|
2686
|
-
}), jsxRuntime.jsx("li", {
|
|
2687
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
2688
|
-
intlMessage: messages.searchByEnteringTheExactFieldName
|
|
2689
|
-
})
|
|
2690
|
-
})]
|
|
2691
|
-
})]
|
|
2692
|
-
});
|
|
2693
|
-
};
|
|
2694
|
-
|
|
2695
|
-
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; }
|
|
2696
|
-
function _objectSpread$5(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$5(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$5(Object(t))).call(_context8, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
2697
|
-
const totalSpacing = 56 +
|
|
2698
|
-
// MC header
|
|
2699
|
-
32 * 2 + (
|
|
2700
|
-
// outer modal spacing
|
|
2701
|
-
32 + 40) +
|
|
2702
|
-
// footer (dialog buttons + margin)
|
|
2703
|
-
40 +
|
|
2704
|
-
// search input
|
|
2705
|
-
24 +
|
|
2706
|
-
// search input padding
|
|
2707
|
-
24 +
|
|
2708
|
-
// modal header
|
|
2709
|
-
16 +
|
|
2710
|
-
// modal header margin
|
|
2711
|
-
8 + (
|
|
2712
|
-
// spacing between search input and grid card
|
|
2713
|
-
16 * 2 + 8 * 2) +
|
|
2714
|
-
// modal paddings
|
|
2715
|
-
26 +
|
|
2716
|
-
// "Select fields from a limited list" radio button height
|
|
2717
|
-
26 +
|
|
2718
|
-
// "Select fields from an imported CSV template" radio button height
|
|
2719
|
-
48 +
|
|
2720
|
-
// Inset paddings (top + bottom)
|
|
2721
|
-
1 +
|
|
2722
|
-
// 1st Divider height
|
|
2723
|
-
1 +
|
|
2724
|
-
// 2nd Divider height
|
|
2725
|
-
8 + 8 +
|
|
2726
|
-
// Divider margins
|
|
2727
|
-
86 +
|
|
2728
|
-
// locale selector
|
|
2729
|
-
32 +
|
|
2730
|
-
// locales selector margin
|
|
2731
|
-
4; // borders
|
|
2732
|
-
|
|
2733
|
-
const MIN_SEARCH_LENGTH = 3;
|
|
2734
|
-
const StyledGridCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
2735
|
-
target: "e1odwg620"
|
|
2736
|
-
} )("max-height:calc(100vh - ", totalSpacing, "px);overflow:auto;" + ("" ));
|
|
2737
|
-
const SelectedFieldsForm = () => {
|
|
2738
|
-
var _context, _context2;
|
|
2739
|
-
const intl = reactIntl.useIntl();
|
|
2740
|
-
const _React$useState = React__default["default"].useState(''),
|
|
2741
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2742
|
-
fieldSearchTerm = _React$useState2[0],
|
|
2743
|
-
setFieldSearchTerm = _React$useState2[1];
|
|
2744
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
2745
|
-
projectKey: context.project?.key
|
|
2746
|
-
})),
|
|
2747
|
-
projectKey = _useApplicationContex.projectKey;
|
|
2748
|
-
const _useStorage = useStorage(`${projectKey}/${OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION}`, {}),
|
|
2749
|
-
_useStorage2 = _slicedToArray(_useStorage, 2);
|
|
2750
|
-
_useStorage2[0];
|
|
2751
|
-
const setCachedSelectedGroups = _useStorage2[1];
|
|
2752
|
-
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
2753
|
-
formik = _useExportResourcesMo.formik,
|
|
2754
|
-
resourceType = _useExportResourcesMo.resourceType;
|
|
2755
|
-
const isSearchActive = ((_context = fieldSearchTerm) == null ? void 0 : _bindInstanceProperty__default["default"](_context2 = Function.call).call(_context2, _trimInstanceProperty__default["default"](_context), _context))?.()?.length >= MIN_SEARCH_LENGTH;
|
|
2756
|
-
React__default["default"].useEffect(() => {
|
|
2757
|
-
var _context4;
|
|
2758
|
-
updateFieldDependenciesStatus(formik);
|
|
2759
|
-
const checkedFields = {};
|
|
2760
|
-
function getCheckedFields(field, groupName) {
|
|
2761
|
-
const fieldName = field.name ? `${groupName}.${field.name}` : groupName;
|
|
2762
|
-
if (field.fields) {
|
|
2763
|
-
var _context3;
|
|
2764
|
-
return _forEachInstanceProperty__default["default"](_context3 = field.fields).call(_context3, f => getCheckedFields(f, fieldName));
|
|
2765
|
-
}
|
|
2766
|
-
checkedFields[fieldName] = field.isChecked;
|
|
2767
|
-
}
|
|
2768
|
-
_forEachInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](formik).groups).call(_context4, group => {
|
|
2769
|
-
var _context5;
|
|
2770
|
-
_forEachInstanceProperty__default["default"](_context5 = group.fields).call(_context5, field => {
|
|
2771
|
-
getCheckedFields(field, group.groupName);
|
|
2772
|
-
});
|
|
2773
|
-
});
|
|
2774
|
-
setCachedSelectedGroups({
|
|
2775
|
-
[resourceType]: checkedFields
|
|
2776
|
-
});
|
|
2777
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2778
|
-
}, [_valuesInstanceProperty__default["default"](formik).groups]);
|
|
2779
|
-
// adds `isHidden` property to each field based on search term
|
|
2780
|
-
const filteredGroups = React__default["default"].useMemo(() => {
|
|
2781
|
-
const updateFields = (fields, parentMatches) => {
|
|
2782
|
-
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
2783
|
-
var _context6;
|
|
2784
|
-
const matches = _includesInstanceProperty__default["default"](_context6 = field.label.toLowerCase()).call(_context6, fieldSearchTerm.toLowerCase());
|
|
2785
|
-
let isHidden = !matches && !parentMatches;
|
|
2786
|
-
if (field.fields) {
|
|
2787
|
-
const updatedFields = updateFields(field.fields, matches);
|
|
2788
|
-
isHidden = isHidden && _everyInstanceProperty__default["default"](updatedFields).call(updatedFields, f => f.isHidden);
|
|
2789
|
-
field = _objectSpread$5(_objectSpread$5({}, field), {}, {
|
|
2790
|
-
fields: updatedFields
|
|
2791
|
-
});
|
|
2792
|
-
}
|
|
2793
|
-
return _objectSpread$5(_objectSpread$5({}, field), {}, {
|
|
2794
|
-
isHidden
|
|
2795
|
-
});
|
|
2796
|
-
});
|
|
2797
|
-
};
|
|
2798
|
-
if (!isSearchActive) return _valuesInstanceProperty__default["default"](formik).groups;
|
|
2799
|
-
const updateGroups = groups => {
|
|
2800
|
-
return _mapInstanceProperty__default["default"](groups).call(groups, group => {
|
|
2801
|
-
const updatedFields = updateFields(group.fields, false);
|
|
2802
|
-
const isHidden = _everyInstanceProperty__default["default"](updatedFields).call(updatedFields, field => field.isHidden);
|
|
2803
|
-
return _objectSpread$5(_objectSpread$5({}, group), {}, {
|
|
2804
|
-
fields: updatedFields,
|
|
2805
|
-
isHidden
|
|
2806
|
-
});
|
|
2807
|
-
});
|
|
2808
|
-
};
|
|
2809
|
-
return updateGroups(_valuesInstanceProperty__default["default"](formik).groups);
|
|
2810
|
-
}, [_valuesInstanceProperty__default["default"](formik).groups, fieldSearchTerm, isSearchActive]);
|
|
2811
|
-
const onSearchChange = React__default["default"].useCallback(event => {
|
|
2812
|
-
setFieldSearchTerm(event.target.value);
|
|
2813
|
-
}, [setFieldSearchTerm]);
|
|
2814
|
-
const hasResults = Boolean(_findInstanceProperty__default["default"](filteredGroups).call(filteredGroups, group => !group.isHidden));
|
|
2815
|
-
const onSearchChangeDebounced = React__default["default"].useMemo(() => debounce__default["default"](onSearchChange, 500), [onSearchChange]);
|
|
2816
|
-
const onSearchReset = () => {
|
|
2817
|
-
setFieldSearchTerm('');
|
|
2818
|
-
};
|
|
2819
|
-
return jsxRuntime.jsx(ExportFieldSelectionProvider, {
|
|
2820
|
-
resourceType: resourceType,
|
|
2821
|
-
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
2822
|
-
scale: "s",
|
|
2823
|
-
children: [jsxRuntime.jsx(uiKit.SearchTextInput, {
|
|
2824
|
-
placeholder: intl.formatMessage(messages.searchForFields),
|
|
2825
|
-
value: fieldSearchTerm,
|
|
2826
|
-
onChange: onSearchChangeDebounced,
|
|
2827
|
-
onReset: onSearchReset
|
|
2828
|
-
// TODO: `SearchTextInput` props to be improved. The `onSubmit` callback shouldn't be mandatory
|
|
2829
|
-
,
|
|
2830
|
-
onSubmit: () => {},
|
|
2831
|
-
id: "export-fields-search"
|
|
2832
|
-
}), hasResults ? jsxRuntime.jsx(StyledGridCard, {
|
|
2833
|
-
insetScale: "none",
|
|
2834
|
-
children: jsxRuntime.jsx(uiKit.Grid, {
|
|
2835
|
-
gridAutoFlow: "row",
|
|
2836
|
-
gridTemplateColumns: `calc(${uiKit.designTokens.spacingL} + ${uiKit.designTokens.constraint5} + ${uiKit.designTokens.spacingL}) auto`,
|
|
2837
|
-
children: _mapInstanceProperty__default["default"](filteredGroups).call(filteredGroups, (group, index) => jsxRuntime.jsx(FieldGroupSection, {
|
|
2838
|
-
group: group,
|
|
2839
|
-
index: index,
|
|
2840
|
-
formik: formik,
|
|
2841
|
-
isSearchActive: isSearchActive
|
|
2842
|
-
}, group.groupName))
|
|
2843
|
-
})
|
|
2844
|
-
}) : jsxRuntime.jsx(NoSearchResults, {})]
|
|
2845
|
-
})
|
|
2846
|
-
});
|
|
2847
|
-
};
|
|
2848
|
-
|
|
2849
|
-
const Divider = /*#__PURE__*/_styled__default["default"]("hr", {
|
|
2850
|
-
target: "e1flfma0"
|
|
2851
|
-
} )("display:block;height:1px;border:0;border-top:1px solid ", uiKit.designTokens.colorNeutral90, ";margin:0;padding:0;" + ("" ));
|
|
2852
|
-
|
|
2853
|
-
const ExportFieldsSelectionStep = () => {
|
|
2854
|
-
const intl = reactIntl.useIntl();
|
|
2855
|
-
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
2856
|
-
formik = _useExportResourcesMo.formik,
|
|
2857
|
-
setCurrentStep = _useExportResourcesMo.setCurrentStep,
|
|
2858
|
-
onClose = _useExportResourcesMo.onClose,
|
|
2859
|
-
resourceType = _useExportResourcesMo.resourceType,
|
|
2860
|
-
fieldSelectionMode = _useExportResourcesMo.fieldSelectionMode,
|
|
2861
|
-
setFieldSelectionMode = _useExportResourcesMo.setFieldSelectionMode,
|
|
2862
|
-
setLocaleOption = _useExportResourcesMo.setLocaleOption;
|
|
2863
|
-
const shouldDisableImportedCsvTemplateOption = _valuesInstanceProperty__default["default"](formik).outputFormat === OUTPUT_FORMATS.JSON;
|
|
2864
|
-
const isUsingImportedCsvTemplate = fieldSelectionMode === 'imported-csv-template';
|
|
2865
|
-
const handleFieldSelectionModeChange = event => {
|
|
2866
|
-
const newFieldSelectionMode = event.target.value;
|
|
2867
|
-
setFieldSelectionMode(newFieldSelectionMode);
|
|
2868
|
-
if (newFieldSelectionMode !== 'imported-csv-template') {
|
|
2869
|
-
setLocaleOption(LocaleOption.Selected);
|
|
2870
|
-
}
|
|
2871
|
-
};
|
|
2872
|
-
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
2873
|
-
isOpen: true,
|
|
2874
|
-
title: `${intl.formatMessage(messages.stepCount, {
|
|
2875
|
-
currentStep: 2,
|
|
2876
|
-
totalSteps: TOTAL_STEPS
|
|
2877
|
-
})}: ${intl.formatMessage(messages.selectFieldsToExport)}`,
|
|
2878
|
-
labelPrimary: `${intl.formatMessage(messages.stepNumber, {
|
|
2879
|
-
stepNumber: 3
|
|
2880
|
-
})}: ${intl.formatMessage(messages.confirmSelection)}`,
|
|
2881
|
-
iconLeftPrimaryButton: jsxRuntime.jsx(uiKit.AngleRightIcon, {}),
|
|
2882
|
-
onPrimaryButtonClick: formik.submitForm,
|
|
2883
|
-
isPrimaryButtonDisabled: !formik.isValid,
|
|
2884
|
-
labelSecondary: intl.formatMessage(messages.back),
|
|
2885
|
-
onSecondaryButtonClick: () => setCurrentStep(Step.FileSettings),
|
|
2886
|
-
onClose: onClose,
|
|
2887
|
-
size: 16,
|
|
2888
|
-
dataAttributesPrimaryButton: {
|
|
2889
|
-
'data-tracking-target': `${resourceType}_export-start_export_button`
|
|
2890
|
-
},
|
|
2891
|
-
children: jsxRuntime.jsx(fullstory.Masking.Unmask, {
|
|
2892
|
-
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
2893
|
-
scale: "xl",
|
|
2894
|
-
children: [jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
2895
|
-
scale: isUsingImportedCsvTemplate ? 'l' : 'xs',
|
|
2896
|
-
children: [jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
2897
|
-
children: [jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
2898
|
-
value: FIELD_SELECTION_MODES.SELECTED_FIELDS,
|
|
2899
|
-
isChecked: fieldSelectionMode === FIELD_SELECTION_MODES.SELECTED_FIELDS,
|
|
2900
|
-
onChange: handleFieldSelectionModeChange,
|
|
2901
|
-
children: intl.formatMessage(messages.selectFieldsFromLimitedList)
|
|
2902
|
-
}), jsxRuntime.jsx(Divider, {}), fieldSelectionMode === FIELD_SELECTION_MODES.SELECTED_FIELDS && jsxRuntime.jsx(uiKit.Spacings.Inset, {
|
|
2903
|
-
scale: "l",
|
|
2904
|
-
children: jsxRuntime.jsx(SelectedFieldsForm, {})
|
|
2905
|
-
})]
|
|
2906
|
-
}), jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
2907
|
-
children: [jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
2908
|
-
isDisabled: shouldDisableImportedCsvTemplateOption,
|
|
2909
|
-
value: FIELD_SELECTION_MODES.IMPORTED_CSV_TEMPLATE,
|
|
2910
|
-
isChecked: fieldSelectionMode === FIELD_SELECTION_MODES.IMPORTED_CSV_TEMPLATE,
|
|
2911
|
-
onChange: handleFieldSelectionModeChange,
|
|
2912
|
-
children: intl.formatMessage(messages.selectFieldsFromImportedCSV)
|
|
2913
|
-
}), jsxRuntime.jsx(Divider, {}), fieldSelectionMode === FIELD_SELECTION_MODES.IMPORTED_CSV_TEMPLATE && jsxRuntime.jsx(uiKit.Spacings.Inset, {
|
|
2914
|
-
scale: "l",
|
|
2915
|
-
children: jsxRuntime.jsx(ImportedCsvTemplateFieldsForm, {})
|
|
2916
|
-
})]
|
|
2917
|
-
})]
|
|
2918
|
-
}), jsxRuntime.jsx(ExportLocaleSelectField, {})]
|
|
2919
|
-
})
|
|
2920
|
-
})
|
|
2921
|
-
});
|
|
2922
|
-
};
|
|
2923
|
-
|
|
2924
|
-
const ExportResourcesContext = /*#__PURE__*/React.createContext();
|
|
2925
|
-
|
|
2926
|
-
const _excluded$1 = ["children"];
|
|
2927
|
-
const ExportResourcesProvider = _ref => {
|
|
2928
|
-
let children = _ref.children,
|
|
2929
|
-
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
2930
|
-
const initialValues = useInitialValues(props);
|
|
2931
|
-
const _React$useState = React__default["default"].useState(Step.FileSettings),
|
|
2932
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2933
|
-
currentStep = _React$useState2[0],
|
|
2934
|
-
setCurrentStep = _React$useState2[1];
|
|
2935
|
-
const _React$useState3 = React__default["default"].useState(() => getInitialExportType({
|
|
2936
|
-
selectedResourceIds: props.selectedResourceIds,
|
|
2937
|
-
filters: props.filters
|
|
2938
|
-
})),
|
|
2939
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
2940
|
-
exportType = _React$useState4[0],
|
|
2941
|
-
setExportType = _React$useState4[1];
|
|
2942
|
-
const _React$useState5 = React__default["default"].useState(LocaleOption.Selected),
|
|
2943
|
-
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
2944
|
-
localeOption = _React$useState6[0],
|
|
2945
|
-
setLocaleOption = _React$useState6[1];
|
|
2946
|
-
const _React$useState7 = React__default["default"].useState('selected-fields'),
|
|
2947
|
-
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
2948
|
-
fieldSelectionMode = _React$useState8[0],
|
|
2949
|
-
setFieldSelectionMode = _React$useState8[1];
|
|
2950
|
-
const _React$useState9 = React__default["default"].useState([]),
|
|
2951
|
-
_React$useState0 = _slicedToArray(_React$useState9, 2),
|
|
2952
|
-
importedHeaders = _React$useState0[0],
|
|
2953
|
-
setImportedHeaders = _React$useState0[1];
|
|
2954
|
-
const _React$useState1 = React__default["default"].useState([]),
|
|
2955
|
-
_React$useState10 = _slicedToArray(_React$useState1, 2),
|
|
2956
|
-
validationErrors = _React$useState10[0],
|
|
2957
|
-
setValidationErrors = _React$useState10[1];
|
|
2958
|
-
const _useStartExportOperat = useStartExportOperation(props),
|
|
2959
|
-
startExportOperation = _useStartExportOperat.startExportOperation;
|
|
2960
|
-
const _useValidateExportOpe = useValidateExportOperation(),
|
|
2961
|
-
validateExport = _useValidateExportOpe.validateExport;
|
|
2962
|
-
const formik$1 = formik.useFormik({
|
|
2963
|
-
initialValues,
|
|
2964
|
-
validate: values => validate({
|
|
2965
|
-
values,
|
|
2966
|
-
step: currentStep,
|
|
2967
|
-
fieldSelectionMode,
|
|
2968
|
-
importedHeaders,
|
|
2969
|
-
exportType
|
|
2970
|
-
}),
|
|
2971
|
-
onSubmit: async values => {
|
|
2972
|
-
if (currentStep === Step.FileSettings) {
|
|
2973
|
-
if (exportType === EXPORT_TYPES.QUERY_PREDICATE) {
|
|
2974
|
-
const validationResult = await validateExport({
|
|
2975
|
-
fileName: values.fileName,
|
|
2976
|
-
outputFormat: values.outputFormat,
|
|
2977
|
-
resourceType: props.resourceType,
|
|
2978
|
-
fields: extractFieldNamesFromGroups(values.groups, props.fieldOrder),
|
|
2979
|
-
locales: values.locales,
|
|
2980
|
-
queryPredicate: values.queryPredicate
|
|
2981
|
-
});
|
|
2982
|
-
if (validationResult?.invalidQueryPredicate) {
|
|
2983
|
-
formik$1.setFieldError('queryPredicate', 'invalidInput');
|
|
2984
|
-
return;
|
|
2985
|
-
}
|
|
2986
|
-
if (validationResult?.noResourcesToExportForQueryPredicate) {
|
|
2987
|
-
formik$1.setFieldError('queryPredicate', 'noResourcesToExportForQueryPredicate');
|
|
2988
|
-
return;
|
|
2989
|
-
}
|
|
2990
|
-
}
|
|
2991
|
-
setCurrentStep(Step.FieldsSelection);
|
|
2992
|
-
} else if (currentStep === Step.FieldsSelection) {
|
|
2993
|
-
if (fieldSelectionMode !== 'imported-csv-template') {
|
|
2994
|
-
setCurrentStep(Step.ConfirmExport);
|
|
2995
|
-
return;
|
|
2996
|
-
}
|
|
2997
|
-
const isUsingImportedCsvLocales = localeOption === 'onlyLocalesFoundInCsvFile';
|
|
2998
|
-
const validationResult = await validateExport({
|
|
2999
|
-
fileName: values.fileName,
|
|
3000
|
-
outputFormat: values.outputFormat,
|
|
3001
|
-
resourceType: props.resourceType,
|
|
3002
|
-
fields: importedHeaders,
|
|
3003
|
-
locales: isUsingImportedCsvLocales ? undefined : values.locales,
|
|
3004
|
-
queryPredicate: values.queryPredicate
|
|
3005
|
-
});
|
|
3006
|
-
if (validationResult?.success) {
|
|
3007
|
-
setCurrentStep(Step.ConfirmExport);
|
|
3008
|
-
} else {
|
|
3009
|
-
setValidationErrors(validationResult?.validationErrors);
|
|
3010
|
-
setCurrentStep(Step.ValidationErrors);
|
|
3011
|
-
}
|
|
3012
|
-
} else {
|
|
3013
|
-
startExportOperation(values, exportType, fieldSelectionMode, localeOption, importedHeaders);
|
|
3014
|
-
}
|
|
3015
|
-
}
|
|
3016
|
-
});
|
|
3017
|
-
React__default["default"].useEffect(() => {
|
|
3018
|
-
formik$1.validateForm();
|
|
3019
|
-
}, [currentStep, fieldSelectionMode, importedHeaders, exportType]);
|
|
3020
|
-
return jsxRuntime.jsx(ExportResourcesContext.Provider, {
|
|
3021
|
-
value: {
|
|
3022
|
-
formik: formik$1,
|
|
3023
|
-
currentStep,
|
|
3024
|
-
setCurrentStep,
|
|
3025
|
-
onClose: props.onClose,
|
|
3026
|
-
resourceType: props.resourceType,
|
|
3027
|
-
exportType: exportType,
|
|
3028
|
-
totalResourcesCount: props.totalResourcesCount,
|
|
3029
|
-
selectedResourceIds: props.selectedResourceIds,
|
|
3030
|
-
hideExportSelectedResourcesOption: props.hideExportSelectedResourcesOption,
|
|
3031
|
-
showQueryPredicateOption: props.showQueryPredicateOption,
|
|
3032
|
-
filters: props.filters,
|
|
3033
|
-
hasFilters: areFiltersApplied(props.filters),
|
|
3034
|
-
setExportType,
|
|
3035
|
-
fieldSelectionMode,
|
|
3036
|
-
setFieldSelectionMode,
|
|
3037
|
-
localeOption,
|
|
3038
|
-
setLocaleOption,
|
|
3039
|
-
importedHeaders,
|
|
3040
|
-
setImportedHeaders,
|
|
3041
|
-
validationErrors
|
|
3042
|
-
},
|
|
3043
|
-
children: children
|
|
3044
|
-
});
|
|
3045
|
-
};
|
|
3046
|
-
|
|
3047
|
-
const ExportLogsLink = props => {
|
|
3048
|
-
return jsxRuntime.jsx(uiKit.Link, {
|
|
3049
|
-
to: `/${props.projectKey}/operations/export/logs`,
|
|
3050
|
-
tone: props.tone,
|
|
3051
|
-
children: props.msg
|
|
3052
|
-
}, "link");
|
|
3053
|
-
};
|
|
3054
|
-
|
|
3055
|
-
const DEFAULT_MAX_VISIBLE_FIELDS = 10;
|
|
3056
|
-
const FieldsPreview = _ref => {
|
|
3057
|
-
let previewGroupLabel = _ref.previewGroupLabel,
|
|
3058
|
-
fields = _ref.fields;
|
|
3059
|
-
const intl = reactIntl.useIntl();
|
|
3060
|
-
const _React$useState = React__default["default"].useState(false),
|
|
3061
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3062
|
-
isExpanded = _React$useState2[0],
|
|
3063
|
-
setIsExpanded = _React$useState2[1];
|
|
3064
|
-
const hasMoreFields = fields.length > DEFAULT_MAX_VISIBLE_FIELDS;
|
|
3065
|
-
const visibleFields = isExpanded ? fields : _sliceInstanceProperty__default["default"](fields).call(fields, 0, DEFAULT_MAX_VISIBLE_FIELDS);
|
|
3066
|
-
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
3067
|
-
children: jsxRuntime.jsxs(uiKit.TagList, {
|
|
3068
|
-
children: [previewGroupLabel && jsxRuntime.jsxs(uiKit.Text.Detail, {
|
|
3069
|
-
as: "span",
|
|
3070
|
-
fontWeight: "bold",
|
|
3071
|
-
children: [previewGroupLabel, ":"]
|
|
3072
|
-
}), _mapInstanceProperty__default["default"](visibleFields).call(visibleFields, (field, index) => jsxRuntime.jsx(uiKit.Stamp, {
|
|
3073
|
-
isCondensed: true,
|
|
3074
|
-
tone: "secondary",
|
|
3075
|
-
label: field
|
|
3076
|
-
}, index)), hasMoreFields && jsxRuntime.jsx(uiKit.FlatButton, {
|
|
3077
|
-
onClick: () => setIsExpanded(!isExpanded),
|
|
3078
|
-
icon: isExpanded ? jsxRuntime.jsx(uiKit.AngleUpIcon, {
|
|
3079
|
-
size: "small"
|
|
3080
|
-
}) : jsxRuntime.jsx(uiKit.AngleDownIcon, {
|
|
3081
|
-
size: "small"
|
|
3082
|
-
}),
|
|
3083
|
-
label: intl.formatMessage(isExpanded ? messages.showLess : messages.showAll)
|
|
3084
|
-
})]
|
|
3085
|
-
})
|
|
3086
|
-
});
|
|
3087
|
-
};
|
|
3088
|
-
|
|
3089
|
-
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; }
|
|
3090
|
-
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; }
|
|
3091
|
-
const ExportConfirmationStep = () => {
|
|
3092
|
-
const intl = reactIntl.useIntl();
|
|
3093
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
3094
|
-
projectKey: applicationContext.project?.key
|
|
3095
|
-
})),
|
|
3096
|
-
projectKey = _useApplicationContex.projectKey;
|
|
3097
|
-
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
3098
|
-
formik = _useExportResourcesMo.formik,
|
|
3099
|
-
fieldSelectionMode = _useExportResourcesMo.fieldSelectionMode,
|
|
3100
|
-
importedHeaders = _useExportResourcesMo.importedHeaders,
|
|
3101
|
-
localeOption = _useExportResourcesMo.localeOption,
|
|
3102
|
-
setCurrentStep = _useExportResourcesMo.setCurrentStep,
|
|
3103
|
-
onClose = _useExportResourcesMo.onClose;
|
|
3104
|
-
const groupsWithSelectedFields = getGroupsWithSelectedFields(_valuesInstanceProperty__default["default"](formik).groups);
|
|
3105
|
-
const isUsingImportedCsvTemplate = fieldSelectionMode === 'imported-csv-template';
|
|
3106
|
-
const isUsingImportedCsvLocales = localeOption === 'onlyLocalesFoundInCsvFile';
|
|
3107
|
-
const allSelectedFieldCount = isUsingImportedCsvTemplate ? importedHeaders.length : getAllSelectedFieldCount(_valuesInstanceProperty__default["default"](formik).groups);
|
|
3108
|
-
const returnToFieldsSelection = () => setCurrentStep(Step.FieldsSelection);
|
|
3109
|
-
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
3110
|
-
isOpen: true,
|
|
3111
|
-
title: `${intl.formatMessage(messages.stepCount, {
|
|
3112
|
-
currentStep: 3,
|
|
3113
|
-
totalSteps: TOTAL_STEPS
|
|
3114
|
-
})}: ${intl.formatMessage(messages.exportPreview)}`,
|
|
3115
|
-
labelPrimary: intl.formatMessage(messages.startExport),
|
|
3116
|
-
onPrimaryButtonClick: formik.submitForm,
|
|
3117
|
-
labelSecondary: intl.formatMessage(messages.selectDifferentFields),
|
|
3118
|
-
onSecondaryButtonClick: returnToFieldsSelection,
|
|
3119
|
-
onClose: onClose,
|
|
3120
|
-
size: 16,
|
|
3121
|
-
children: jsxRuntime.jsx(fullstory.Masking.Unmask, {
|
|
3122
|
-
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
3123
|
-
scale: "m",
|
|
3124
|
-
children: [jsxRuntime.jsx(uiKit.Card, {
|
|
3125
|
-
insetScale: "l",
|
|
3126
|
-
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
3127
|
-
children: [jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
3128
|
-
alignItems: "center",
|
|
3129
|
-
children: [jsxRuntime.jsx(uiKit.CheckBoldIcon, {
|
|
3130
|
-
size: "40",
|
|
3131
|
-
color: "success"
|
|
3132
|
-
}), isUsingImportedCsvLocales ? jsxRuntime.jsx(uiKit.Text.Body, {
|
|
3133
|
-
intlMessage: _objectSpread$4(_objectSpread$4({}, messages.fieldsToBeExported), {}, {
|
|
3134
|
-
values: {
|
|
3135
|
-
fieldCount: allSelectedFieldCount,
|
|
3136
|
-
b: msg => jsxRuntime.jsx("b", {
|
|
3137
|
-
children: msg
|
|
3138
|
-
}, crypto.randomUUID())
|
|
3139
|
-
}
|
|
3140
|
-
})
|
|
3141
|
-
}) : jsxRuntime.jsx(uiKit.Text.Body, {
|
|
3142
|
-
intlMessage: _objectSpread$4(_objectSpread$4({}, messages.fieldsToBeExportedInLanguages), {}, {
|
|
3143
|
-
values: {
|
|
3144
|
-
fieldCount: allSelectedFieldCount,
|
|
3145
|
-
languageCount: _valuesInstanceProperty__default["default"](formik).locales.length,
|
|
3146
|
-
b: msg => jsxRuntime.jsx("b", {
|
|
3147
|
-
children: msg
|
|
3148
|
-
}, crypto.randomUUID())
|
|
3149
|
-
}
|
|
3150
|
-
})
|
|
3151
|
-
})]
|
|
3152
|
-
}), isUsingImportedCsvTemplate ? jsxRuntime.jsx(FieldsPreview, {
|
|
3153
|
-
fields: importedHeaders
|
|
3154
|
-
}) : _mapInstanceProperty__default["default"](groupsWithSelectedFields).call(groupsWithSelectedFields, group => {
|
|
3155
|
-
const selectedFields = getSelectedFieldLabels(group);
|
|
3156
|
-
return jsxRuntime.jsx(FieldsPreview, {
|
|
3157
|
-
previewGroupLabel: group.previewGroupLabel,
|
|
3158
|
-
fields: selectedFields
|
|
3159
|
-
}, group.groupName);
|
|
3160
|
-
})]
|
|
3161
|
-
})
|
|
3162
|
-
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
3163
|
-
intlMessage: _objectSpread$4(_objectSpread$4({}, messages.exportProcessMayTakeAWhile), {}, {
|
|
3164
|
-
values: {
|
|
3165
|
-
exportLogsLink: msg => jsxRuntime.jsx(ExportLogsLink, {
|
|
3166
|
-
projectKey: projectKey,
|
|
3167
|
-
tone: "secondary"
|
|
3168
|
-
// @ts-ignore the `msg` parameter type is not compatible with the `string` type
|
|
3169
|
-
,
|
|
3170
|
-
msg: msg
|
|
3171
|
-
}, "export-logs-link"),
|
|
3172
|
-
operationsIcon: () => jsxRuntime.jsx(icons.OperationsIcon, {
|
|
3173
|
-
size: "40"
|
|
3174
|
-
}, "operations-icon")
|
|
3175
|
-
}
|
|
3176
|
-
})
|
|
3177
|
-
})]
|
|
3178
|
-
})
|
|
3179
|
-
})
|
|
3180
|
-
});
|
|
3181
|
-
};
|
|
3182
|
-
|
|
3183
|
-
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; }
|
|
3184
|
-
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys$3(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys$3(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
3185
|
-
const getColumns = () => [{
|
|
3186
|
-
key: 'errorType',
|
|
3187
|
-
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$3({}, messages.errorType)),
|
|
3188
|
-
width: 'max-content'
|
|
3189
|
-
}, {
|
|
3190
|
-
key: 'details',
|
|
3191
|
-
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$3({}, messages.details))
|
|
3192
|
-
}];
|
|
3193
|
-
const ErrorTable = props => {
|
|
3194
|
-
var _context;
|
|
3195
|
-
const intl = reactIntl.useIntl();
|
|
3196
|
-
const rows = _mapInstanceProperty__default["default"](_context = props.errors).call(_context, row => _objectSpread$3(_objectSpread$3({}, row), {}, {
|
|
3197
|
-
id: row.code
|
|
3198
|
-
}));
|
|
3199
|
-
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
3200
|
-
scale: "l",
|
|
3201
|
-
children: jsxRuntime.jsx(uiKit.DataTable, {
|
|
3202
|
-
verticalCellAlignment: "center",
|
|
3203
|
-
isCondensed: true,
|
|
3204
|
-
rows: rows,
|
|
3205
|
-
columns: getColumns(),
|
|
3206
|
-
itemRenderer: (item, column) => itemRenderer(item, column, intl)
|
|
3207
|
-
})
|
|
3208
|
-
});
|
|
3209
|
-
};
|
|
3210
|
-
function itemRenderer(item, column, intl) {
|
|
3211
|
-
var _context2;
|
|
3212
|
-
switch (column.key) {
|
|
3213
|
-
case 'errorType':
|
|
3214
|
-
return jsxRuntime.jsx(uiKit.Stamp, {
|
|
3215
|
-
isCondensed: true,
|
|
3216
|
-
label: getErrorTypeLabel(item.code, intl),
|
|
3217
|
-
tone: "critical"
|
|
3218
|
-
});
|
|
3219
|
-
case 'details':
|
|
3220
|
-
return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
3221
|
-
scale: "xs",
|
|
3222
|
-
children: [jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
3223
|
-
children: item.messageTitle
|
|
3224
|
-
}), jsxRuntime.jsx("ul", {
|
|
3225
|
-
style: {
|
|
3226
|
-
margin: 0,
|
|
3227
|
-
paddingLeft: uiKit.designTokens.spacingL
|
|
3228
|
-
},
|
|
3229
|
-
children: _mapInstanceProperty__default["default"](_context2 = item.fieldNames).call(_context2, (field, index) => jsxRuntime.jsx("li", {
|
|
3230
|
-
children: jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
3231
|
-
children: field
|
|
3232
|
-
})
|
|
3233
|
-
}, index))
|
|
3234
|
-
})]
|
|
3235
|
-
});
|
|
3236
|
-
default:
|
|
3237
|
-
// eslint-disable-next-line no-console
|
|
3238
|
-
console.warn('Unknown column key', column.key);
|
|
3239
|
-
return null;
|
|
3240
|
-
}
|
|
3241
|
-
}
|
|
3242
|
-
function getErrorTypeLabel(errorCode, intl) {
|
|
3243
|
-
switch (errorCode) {
|
|
3244
|
-
case 'NotSupportedField':
|
|
3245
|
-
return intl.formatMessage(messages.notSupportedField);
|
|
3246
|
-
case 'DuplicateFields':
|
|
3247
|
-
return intl.formatMessage(messages.duplicateField);
|
|
3248
|
-
case 'LocalizedFieldWithoutLocale':
|
|
3249
|
-
return intl.formatMessage(messages.localizedFieldWithoutLocale);
|
|
3250
|
-
case 'AttributeDefinitionNotFound':
|
|
3251
|
-
return intl.formatMessage(messages.attributeDefinitionNotFound);
|
|
3252
|
-
case 'FieldDefinitionNotFound':
|
|
3253
|
-
return intl.formatMessage(messages.fieldDefinitionNotFound);
|
|
3254
|
-
case 'IncompleteField':
|
|
3255
|
-
return intl.formatMessage(messages.incompleteField);
|
|
3256
|
-
default:
|
|
3257
|
-
return errorCode;
|
|
3258
|
-
}
|
|
3259
|
-
}
|
|
3260
|
-
|
|
3261
|
-
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; }
|
|
3262
|
-
function _objectSpread$2(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$2(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$2(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
3263
|
-
const ExportValidationErrorsStep = () => {
|
|
3264
|
-
const intl = reactIntl.useIntl();
|
|
3265
|
-
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
3266
|
-
formik = _useExportResourcesMo.formik,
|
|
3267
|
-
setCurrentStep = _useExportResourcesMo.setCurrentStep,
|
|
3268
|
-
onClose = _useExportResourcesMo.onClose,
|
|
3269
|
-
validationErrors = _useExportResourcesMo.validationErrors,
|
|
3270
|
-
setImportedHeaders = _useExportResourcesMo.setImportedHeaders;
|
|
3271
|
-
const groupedErrors = groupFieldValidationErrors(validationErrors, intl);
|
|
3272
|
-
const returnToFieldsSelection = () => setCurrentStep(Step.FieldsSelection);
|
|
3273
|
-
const uploadDifferentCSV = () => {
|
|
3274
|
-
formik.setFieldValue('importedCsvTemplateFile', undefined);
|
|
3275
|
-
setImportedHeaders([]);
|
|
3276
|
-
setCurrentStep(Step.FieldsSelection);
|
|
3277
|
-
};
|
|
3278
|
-
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
3279
|
-
isOpen: true,
|
|
3280
|
-
"aria-label": intl.formatMessage(messages.csvUploadFailed),
|
|
3281
|
-
title: jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
3282
|
-
alignItems: "center",
|
|
3283
|
-
children: [jsxRuntime.jsx(icons.WarningIcon, {
|
|
3284
|
-
size: "20",
|
|
3285
|
-
color: "warning"
|
|
3286
|
-
}), jsxRuntime.jsx(uiKit.Text.Headline, {
|
|
3287
|
-
tone: "inherit",
|
|
3288
|
-
as: "h3",
|
|
3289
|
-
children: intl.formatMessage(messages.csvUploadFailed)
|
|
3290
|
-
})]
|
|
3291
|
-
}),
|
|
3292
|
-
labelPrimary: intl.formatMessage(messages.uploadDifferentCSV),
|
|
3293
|
-
iconLeftPrimaryButton: jsxRuntime.jsx(icons.ImportIcon, {}),
|
|
3294
|
-
onPrimaryButtonClick: uploadDifferentCSV,
|
|
3295
|
-
labelSecondary: intl.formatMessage(messages.backToPreviousStep),
|
|
3296
|
-
onSecondaryButtonClick: returnToFieldsSelection,
|
|
3297
|
-
onClose: onClose,
|
|
3298
|
-
size: 16,
|
|
3299
|
-
children: jsxRuntime.jsx(fullstory.Masking.Unmask, {
|
|
3300
|
-
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
3301
|
-
scale: "m",
|
|
3302
|
-
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
3303
|
-
intlMessage: _objectSpread$2(_objectSpread$2({}, messages.uploadErrorsDetected), {}, {
|
|
3304
|
-
values: {
|
|
3305
|
-
total: intl.formatNumber(validationErrors.length),
|
|
3306
|
-
fileName: _valuesInstanceProperty__default["default"](formik).importedCsvTemplateFile?.name,
|
|
3307
|
-
b: msg => jsxRuntime.jsx("b", {
|
|
3308
|
-
children: msg
|
|
3309
|
-
}, crypto.randomUUID()),
|
|
3310
|
-
templateLink: msg => jsxRuntime.jsx(uiKit.Link, {
|
|
3311
|
-
tone: "secondary",
|
|
3312
|
-
to: CSV_TEMPLATES_LINK,
|
|
3313
|
-
isExternal: true,
|
|
3314
|
-
children: msg
|
|
3315
|
-
}, "template-link"),
|
|
3316
|
-
documentationLink: msg => jsxRuntime.jsx(uiKit.Link, {
|
|
3317
|
-
tone: "secondary",
|
|
3318
|
-
to: EXPORT_DATA_DOCUMENTATION_LINK,
|
|
3319
|
-
isExternal: true,
|
|
3320
|
-
children: msg
|
|
3321
|
-
}, "documentation-link")
|
|
3322
|
-
}
|
|
3323
|
-
})
|
|
3324
|
-
}), jsxRuntime.jsx(ErrorTable, {
|
|
3325
|
-
errors: groupedErrors
|
|
3326
|
-
})]
|
|
3327
|
-
})
|
|
3328
|
-
})
|
|
3329
|
-
});
|
|
3330
|
-
};
|
|
3331
|
-
|
|
3332
|
-
const CurrentStep = () => {
|
|
3333
|
-
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
3334
|
-
currentStep = _useExportResourcesMo.currentStep;
|
|
3335
|
-
const steps = {
|
|
3336
|
-
[Step.FileSettings]: jsxRuntime.jsx(ExportFileSettingsStep, {}),
|
|
3337
|
-
[Step.FieldsSelection]: jsxRuntime.jsx(ExportFieldsSelectionStep, {}),
|
|
3338
|
-
[Step.ConfirmExport]: jsxRuntime.jsx(ExportConfirmationStep, {}),
|
|
3339
|
-
[Step.ValidationErrors]: jsxRuntime.jsx(ExportValidationErrorsStep, {})
|
|
3340
|
-
};
|
|
3341
|
-
return steps[currentStep] || null;
|
|
3342
|
-
};
|
|
3343
|
-
|
|
3344
|
-
const getBorderColor = state => {
|
|
3345
|
-
const borderColors = {
|
|
3346
|
-
default: uiKit.designTokens.colorNeutral60,
|
|
3347
|
-
'active-drag': uiKit.designTokens.colorPrimary
|
|
3348
|
-
};
|
|
3349
|
-
return borderColors[state] || borderColors.default;
|
|
3350
|
-
};
|
|
3351
|
-
const getDashedBorder = function () {
|
|
3352
|
-
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
|
|
3353
|
-
const color = getBorderColor(state);
|
|
3354
|
-
const svgContent = `
|
|
3355
|
-
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
|
|
3356
|
-
<rect width="100%" height="100%" fill="none" stroke="${color}" stroke-width="2px" stroke-dasharray="6,6" stroke-dashoffset="0" stroke-linecap="square"/>
|
|
3357
|
-
</svg>
|
|
3358
|
-
`;
|
|
3359
|
-
return `data:image/svg+xml,${encodeURIComponent(svgContent)}`;
|
|
3360
|
-
};
|
|
3361
|
-
const base = /*#__PURE__*/react.css("border-radius:", uiKit.designTokens.borderRadius6, ";min-height:136px;display:flex;justify-content:center;align-items:center;" + ("" ), "" );
|
|
3362
|
-
const readyForDrop = /*#__PURE__*/react.css("background-image:url(\"", getDashedBorder(), "\");background-color:", uiKit.designTokens.colorSurface, ";" + ("" ), "" );
|
|
3363
|
-
const activeDrag = /*#__PURE__*/react.css("background-image:url(\"", getDashedBorder('active-drag'), "\");background-color:", uiKit.designTokens.colorPrimary95, ";padding:", uiKit.designTokens.spacing50, " 100px;" + ("" ), "" );
|
|
3364
|
-
const fileDropped = /*#__PURE__*/react.css("background-image:url(\"", getDashedBorder(), "\");background-color:", uiKit.designTokens.colorSurface, ";padding:", uiKit.designTokens.spacing50, " 100px;" + ("" ), "" );
|
|
3365
|
-
const styles = {
|
|
3366
|
-
base,
|
|
3367
|
-
readyForDrop,
|
|
3368
|
-
fileDropped,
|
|
3369
|
-
activeDrag
|
|
3370
|
-
};
|
|
3371
|
-
|
|
3372
|
-
const DropWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
3373
|
-
target: "emczgw60"
|
|
3374
|
-
} )(styles.base, " ", props => {
|
|
3375
|
-
if (props.dropAreaState === 'default') {
|
|
3376
|
-
return styles.readyForDrop;
|
|
3377
|
-
}
|
|
3378
|
-
if (props.dropAreaState === 'active-drag') {
|
|
3379
|
-
return styles.activeDrag;
|
|
3380
|
-
}
|
|
3381
|
-
if (props.dropAreaState === 'file-dropped') {
|
|
3382
|
-
return styles.fileDropped;
|
|
3383
|
-
}
|
|
3384
|
-
return getDefaultDropWrapperStyles(props.dropAreaState);
|
|
3385
|
-
}, ";" + ("" ));
|
|
3386
|
-
function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
3387
|
-
return /*#__PURE__*/react.css("" , "" );
|
|
3388
|
-
}
|
|
3389
|
-
|
|
3390
|
-
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-d3058dd1.cjs.prod.js'); }));
|
|
3391
|
-
|
|
3392
|
-
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-17cc3d52.cjs.prod.js'); }));
|
|
3393
|
-
|
|
3394
|
-
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-59869bec.cjs.prod.js'); }));
|
|
3395
|
-
|
|
3396
|
-
function getDropArea(_ref) {
|
|
3397
|
-
let dropAreaState = _ref.dropAreaState,
|
|
3398
|
-
isFileDropped = _ref.isFileDropped;
|
|
3399
|
-
if (dropAreaState === 'file-dropped') {
|
|
3400
|
-
return jsxRuntime.jsx(FileDropped, {});
|
|
3401
|
-
}
|
|
3402
|
-
if (dropAreaState === 'default') {
|
|
3403
|
-
return jsxRuntime.jsx(EnabledDropArea, {});
|
|
3404
|
-
}
|
|
3405
|
-
if (dropAreaState === 'active-drag') {
|
|
3406
|
-
return jsxRuntime.jsx(ActiveDragDropArea, {
|
|
3407
|
-
isFileDropped: isFileDropped
|
|
3408
|
-
});
|
|
3409
|
-
}
|
|
3410
|
-
return fallbackDropArea();
|
|
3411
|
-
}
|
|
3412
|
-
function fallbackDropArea(_invalidDropAreaState) {
|
|
3413
|
-
return jsxRuntime.jsx(EnabledDropArea, {});
|
|
3414
|
-
}
|
|
3415
|
-
function getDropAreaState(flags) {
|
|
3416
|
-
if (flags.isDragActive) {
|
|
3417
|
-
return 'active-drag';
|
|
3418
|
-
}
|
|
3419
|
-
if (flags.isReady) {
|
|
3420
|
-
return 'file-dropped';
|
|
3421
|
-
}
|
|
3422
|
-
return 'default';
|
|
3423
|
-
}
|
|
3424
|
-
|
|
3425
|
-
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; }
|
|
3426
|
-
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; }
|
|
3427
|
-
const FileDropArea = () => {
|
|
3428
|
-
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
3429
|
-
formik = _useExportResourcesMo.formik,
|
|
3430
|
-
setImportedHeaders = _useExportResourcesMo.setImportedHeaders;
|
|
3431
|
-
const onDrop = React__default["default"].useCallback(async _ref => {
|
|
3432
|
-
let _ref2 = _slicedToArray(_ref, 1),
|
|
3433
|
-
file = _ref2[0];
|
|
3434
|
-
if (!file) return;
|
|
3435
|
-
formik.setFieldValue('importedCsvTemplateFile', file);
|
|
3436
|
-
const csvHeaders = await getCsvHeaders(file);
|
|
3437
|
-
setImportedHeaders(csvHeaders);
|
|
3438
|
-
}, [formik, setImportedHeaders]);
|
|
3439
|
-
const _useDropzone = reactDropzone.useDropzone({
|
|
3440
|
-
onDrop,
|
|
3441
|
-
multiple: false,
|
|
3442
|
-
accept: {
|
|
3443
|
-
'text/csv': ['.csv']
|
|
3444
|
-
},
|
|
3445
|
-
// TODO: Add error handling
|
|
3446
|
-
onDropRejected: () => {}
|
|
3447
|
-
}),
|
|
3448
|
-
getRootProps = _useDropzone.getRootProps,
|
|
3449
|
-
getInputProps = _useDropzone.getInputProps,
|
|
3450
|
-
isDragActive = _useDropzone.isDragActive;
|
|
3451
|
-
const dropAreaState = React__default["default"].useMemo(() => getDropAreaState({
|
|
3452
|
-
isReady: Boolean(_valuesInstanceProperty__default["default"](formik).importedCsvTemplateFile),
|
|
3453
|
-
isDragActive
|
|
3454
|
-
}), [formik, isDragActive]);
|
|
3455
|
-
const dropArea = getDropArea({
|
|
3456
|
-
dropAreaState,
|
|
3457
|
-
isFileDropped: Boolean(_valuesInstanceProperty__default["default"](formik).importedCsvTemplateFile)
|
|
3458
|
-
});
|
|
3459
|
-
return jsxRuntime.jsxs(DropWrapper, _objectSpread$1(_objectSpread$1({
|
|
3460
|
-
role: "presentation"
|
|
3461
|
-
}, getRootProps()), {}, {
|
|
3462
|
-
dropAreaState: dropAreaState,
|
|
3463
|
-
children: [jsxRuntime.jsx("input", _objectSpread$1({
|
|
3464
|
-
"data-testid": "file-input"
|
|
3465
|
-
}, getInputProps())), jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
3466
|
-
children: dropArea
|
|
3467
|
-
})]
|
|
3468
|
-
}));
|
|
3469
|
-
};
|
|
3470
|
-
|
|
3471
|
-
const getChunkImport = locale => {
|
|
3472
|
-
const intlLocale = i18n.mapLocaleToIntlLocale(locale);
|
|
3473
|
-
switch (intlLocale) {
|
|
3474
|
-
case 'de':
|
|
3475
|
-
return Promise.resolve().then(function () { return require('./de-695b76fd.cjs.prod.js'); });
|
|
3476
|
-
case 'es':
|
|
3477
|
-
return Promise.resolve().then(function () { return require('./es-ef77023b.cjs.prod.js'); });
|
|
3478
|
-
case 'fr-FR':
|
|
3479
|
-
return Promise.resolve().then(function () { return require('./fr-FR-ce630bc6.cjs.prod.js'); });
|
|
3480
|
-
case 'ja':
|
|
3481
|
-
return Promise.resolve().then(function () { return require('./ja-37632763.cjs.prod.js'); });
|
|
3482
|
-
case 'pt-BR':
|
|
3483
|
-
return Promise.resolve().then(function () { return require('./pt-BR-f792a0c2.cjs.prod.js'); });
|
|
3484
|
-
default:
|
|
3485
|
-
return Promise.resolve().then(function () { return require('./en-14598f2e.cjs.prod.js'); });
|
|
3486
|
-
}
|
|
3487
|
-
};
|
|
3488
|
-
const loadMessages = async locale => {
|
|
3489
|
-
try {
|
|
3490
|
-
const chunkImport = await getChunkImport(locale);
|
|
3491
|
-
return i18n.parseChunkImport(chunkImport);
|
|
3492
|
-
} catch (error) {
|
|
3493
|
-
// eslint-disable-next-line no-console
|
|
3494
|
-
console.warn(`Something went wrong while loading the export-resources-modal messages for ${locale}`, error);
|
|
3495
|
-
sentry.reportErrorToSentry(new Error(`Something went wrong while loading the export-resources-modal messages for ${locale}`), {
|
|
3496
|
-
extra: error
|
|
3497
|
-
});
|
|
3498
|
-
return {};
|
|
3499
|
-
}
|
|
3500
|
-
};
|
|
3501
|
-
|
|
3502
|
-
const useAsyncIntlMessages = (locale, loader) => {
|
|
3503
|
-
const _useState = React.useState({
|
|
3504
|
-
isLoading: true,
|
|
3505
|
-
messages: undefined,
|
|
3506
|
-
error: undefined
|
|
3507
|
-
}),
|
|
3508
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
3509
|
-
state = _useState2[0],
|
|
3510
|
-
setState = _useState2[1];
|
|
3511
|
-
React.useEffect(() => {
|
|
3512
|
-
let _isUnmounting = false;
|
|
3513
|
-
async function load() {
|
|
3514
|
-
try {
|
|
3515
|
-
if (!_isUnmounting) {
|
|
3516
|
-
const messages = await loader(locale);
|
|
3517
|
-
setState({
|
|
3518
|
-
isLoading: false,
|
|
3519
|
-
messages
|
|
3520
|
-
});
|
|
3521
|
-
}
|
|
3522
|
-
} catch (error) {
|
|
3523
|
-
setState({
|
|
3524
|
-
isLoading: false,
|
|
3525
|
-
error
|
|
3526
|
-
});
|
|
3527
|
-
}
|
|
3528
|
-
}
|
|
3529
|
-
if (locale) load();
|
|
3530
|
-
return () => {
|
|
3531
|
-
_isUnmounting = true;
|
|
3532
|
-
};
|
|
3533
|
-
}, [locale, loader]);
|
|
3534
|
-
return state;
|
|
3535
|
-
};
|
|
3536
|
-
|
|
3537
|
-
const _excluded = ["isOpen", "selectedResourceIds", "outputFormat", "fieldGroups", "fieldOrder"];
|
|
3538
|
-
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; }
|
|
3539
|
-
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; }
|
|
3540
|
-
function invalidateLaunchDarklyCachedFeatureFlag(flagName) {
|
|
3541
|
-
for (let _ref of _Object$entries__default["default"](localStorage)) {
|
|
3542
|
-
var _ref2 = _slicedToArray(_ref, 1);
|
|
3543
|
-
let key = _ref2[0];
|
|
3544
|
-
// This is the pattern that the LaunchDarkly adapter uses to store the flags
|
|
3545
|
-
if (_startsWithInstanceProperty__default["default"](key).call(key, '@flopflip/launchdarkly-adapter/') && _endsWithInstanceProperty__default["default"](key).call(key, '/flags')) {
|
|
3546
|
-
try {
|
|
3547
|
-
const flags = JSON.parse(localStorage.getItem(key) || '{}');
|
|
3548
|
-
if (flags[flagName] !== undefined) {
|
|
3549
|
-
delete flags[flagName];
|
|
3550
|
-
localStorage.setItem(key, _JSON$stringify__default["default"](flags));
|
|
3551
|
-
}
|
|
3552
|
-
} catch (error) {}
|
|
3553
|
-
}
|
|
3554
|
-
}
|
|
3555
|
-
}
|
|
3556
|
-
invalidateLaunchDarklyCachedFeatureFlag('enableOperationsExport');
|
|
3557
|
-
const ExportResourcesModal = _ref3 => {
|
|
3558
|
-
let _ref3$isOpen = _ref3.isOpen,
|
|
3559
|
-
isOpen = _ref3$isOpen === void 0 ? false : _ref3$isOpen,
|
|
3560
|
-
_ref3$selectedResourc = _ref3.selectedResourceIds,
|
|
3561
|
-
selectedResourceIds = _ref3$selectedResourc === void 0 ? [] : _ref3$selectedResourc,
|
|
3562
|
-
_ref3$outputFormat = _ref3.outputFormat,
|
|
3563
|
-
outputFormat = _ref3$outputFormat === void 0 ? OUTPUT_FORMATS.CSV : _ref3$outputFormat,
|
|
3564
|
-
_ref3$fieldGroups = _ref3.fieldGroups,
|
|
3565
|
-
fieldGroups = _ref3$fieldGroups === void 0 ? [] : _ref3$fieldGroups,
|
|
3566
|
-
_ref3$fieldOrder = _ref3.fieldOrder,
|
|
3567
|
-
fieldOrder = _ref3$fieldOrder === void 0 ? [] : _ref3$fieldOrder,
|
|
3568
|
-
props = _objectWithoutProperties(_ref3, _excluded);
|
|
3569
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
3570
|
-
locale: context.user && context.user.locale
|
|
3571
|
-
})),
|
|
3572
|
-
locale = _useApplicationContex.locale;
|
|
3573
|
-
const messages = useAsyncIntlMessages(locale, loadMessages);
|
|
3574
|
-
if (!isOpen || messages.isLoading) return null;
|
|
3575
|
-
if (props.filters && !validateFilters(props.filters)) {
|
|
3576
|
-
console.error('Invalid filters prop:', props.filters, 'Filters must contain one of these values: `filters` or `where`');
|
|
3577
|
-
return null;
|
|
3578
|
-
}
|
|
3579
|
-
return jsxRuntime.jsx(reactIntl.IntlProvider, {
|
|
3580
|
-
locale: locale,
|
|
3581
|
-
messages: messages.messages,
|
|
3582
|
-
children: jsxRuntime.jsx(ExportResourcesProvider, _objectSpread(_objectSpread({
|
|
3583
|
-
fieldGroups: fieldGroups,
|
|
3584
|
-
fieldOrder: fieldOrder,
|
|
3585
|
-
isOpen: isOpen,
|
|
3586
|
-
outputFormat: outputFormat,
|
|
3587
|
-
selectedResourceIds: selectedResourceIds
|
|
3588
|
-
}, props), {}, {
|
|
3589
|
-
children: jsxRuntime.jsx(CurrentStep, {})
|
|
3590
|
-
}))
|
|
3591
|
-
});
|
|
3592
|
-
};
|
|
3593
|
-
ExportResourcesModal.displayName = 'ExportResourcesModal';
|
|
3594
|
-
|
|
3595
|
-
exports.EXPORTABLE_RESOURCES = EXPORTABLE_RESOURCES;
|
|
3596
|
-
exports.EXPORT_TYPES = EXPORT_TYPES;
|
|
3597
|
-
exports.EnabledDropArea = EnabledDropArea;
|
|
3598
|
-
exports.ExportResourcesModal = ExportResourcesModal;
|
|
3599
|
-
exports.FileDropped = FileDropped;
|
|
3600
|
-
exports.LocaleOption = LocaleOption;
|
|
3601
|
-
exports.Step = Step;
|
|
3602
|
-
exports.messages = messages;
|
|
3603
|
-
exports.useConvertFieldDefinitionsForExport = useConvertFieldDefinitionsForExport;
|
|
3604
|
-
exports.useExportResourcesModalContext = useExportResourcesModalContext;
|