@commercetools-frontend-extensions/export-resources-modal 4.12.3 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -1
- package/dist/active-drag-drop-area-12daa26c.cjs.prod.js +72 -0
- package/dist/active-drag-drop-area-3c408710.cjs.dev.js +72 -0
- package/dist/active-drag-drop-area-b979d5d1.esm.js +70 -0
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.dev.js +71 -2190
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.prod.js +71 -2160
- package/dist/commercetools-frontend-extensions-export-resources-modal.esm.js +62 -2151
- package/dist/declarations/src/@constants/feature-toggles.d.ts +3 -0
- package/dist/declarations/src/@constants/field-selection-modes.d.ts +4 -0
- package/dist/declarations/src/@constants/index.d.ts +2 -0
- package/dist/declarations/src/@constants/misc.d.ts +1 -0
- package/dist/declarations/src/@constants/urls.d.ts +2 -2
- package/dist/declarations/src/@hooks/index.d.ts +1 -0
- package/dist/declarations/src/@hooks/use-start-export-operation.d.ts +2 -2
- package/dist/declarations/src/@hooks/use-validate-imported-headers.d.ts +15 -0
- package/dist/declarations/src/@types/drop-area-state.d.ts +1 -0
- package/dist/declarations/src/@types/export-api.d.ts +9 -2
- package/dist/declarations/src/@types/export-resources-modal-context.d.ts +14 -1
- package/dist/declarations/src/@types/export-resources-modal-types.d.ts +1 -0
- package/dist/declarations/src/@types/field-selection-mode.d.ts +2 -0
- package/dist/declarations/src/@types/field-validation-error-code.d.ts +1 -0
- package/dist/declarations/src/@types/field-validation-error.d.ts +6 -0
- package/dist/declarations/src/@types/form.d.ts +4 -0
- package/dist/declarations/src/@types/grouped-validation-error.d.ts +8 -0
- package/dist/declarations/src/@types/index.d.ts +6 -0
- package/dist/declarations/src/@types/locale-option.d.ts +5 -0
- package/dist/{en-56c15954.cjs.prod.js → en-0a01cd09.cjs.prod.js} +1 -1
- package/dist/{en-9aa667ca.cjs.dev.js → en-2af10351.cjs.dev.js} +1 -1
- package/dist/{en-5b88bfde.esm.js → en-e31f86e7.esm.js} +1 -1
- package/dist/enabled-drop-area-9ca41e63.esm.js +120 -0
- package/dist/enabled-drop-area-a25dfe55.cjs.dev.js +133 -0
- package/dist/enabled-drop-area-ed00d1fd.cjs.prod.js +133 -0
- package/dist/file-dropped-area-65ac353d.esm.js +90 -0
- package/dist/file-dropped-area-cf131b6e.cjs.prod.js +96 -0
- package/dist/file-dropped-area-f19b8e0b.cjs.dev.js +96 -0
- package/dist/index-1a99ddcf.cjs.dev.js +3255 -0
- package/dist/index-b645c74b.esm.js +3206 -0
- package/dist/index-e05daeff.cjs.prod.js +3219 -0
- package/package.json +39 -33
|
@@ -2,2163 +2,74 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
var _valuesInstanceProperty__default = /*#__PURE__*/_interopDefault(_valuesInstanceProperty);
|
|
77
|
-
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
78
|
-
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
79
|
-
var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
|
|
80
|
-
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
81
|
-
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
82
|
-
var omitEmpty__default = /*#__PURE__*/_interopDefault(omitEmpty);
|
|
83
|
-
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
84
|
-
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
85
|
-
var _everyInstanceProperty__default = /*#__PURE__*/_interopDefault(_everyInstanceProperty);
|
|
86
|
-
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
87
|
-
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
88
|
-
var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
89
|
-
var _sortInstanceProperty__default = /*#__PURE__*/_interopDefault(_sortInstanceProperty);
|
|
90
|
-
var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
|
|
91
|
-
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
|
|
92
|
-
var sortBy__default = /*#__PURE__*/_interopDefault(sortBy);
|
|
93
|
-
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
94
|
-
var debounce__default = /*#__PURE__*/_interopDefault(debounce);
|
|
95
|
-
var get__default = /*#__PURE__*/_interopDefault(get);
|
|
96
|
-
|
|
97
|
-
function getBold(msg) {
|
|
98
|
-
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
99
|
-
as: "span",
|
|
100
|
-
isBold: true,
|
|
101
|
-
children: msg
|
|
102
|
-
}, `bold-${msg}`);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function getNewLine() {
|
|
106
|
-
return jsxRuntime.jsx("br", {}, crypto.randomUUID());
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
var messages = reactIntl.defineMessages({
|
|
110
|
-
'modalTitle.category': {
|
|
111
|
-
id: 'ExportResourcesModal.modalTitle.category',
|
|
112
|
-
description: 'Label for the categories modal title',
|
|
113
|
-
defaultMessage: 'Export categories'
|
|
114
|
-
},
|
|
115
|
-
'modalTitle.product': {
|
|
116
|
-
id: 'ExportResourcesModal.modalTitle.product',
|
|
117
|
-
description: 'Label for the products modal title',
|
|
118
|
-
defaultMessage: 'Export products'
|
|
119
|
-
},
|
|
120
|
-
'modalTitle.inventory-entry': {
|
|
121
|
-
id: 'ExportResourcesModal.modalTitle.inventoryEntry',
|
|
122
|
-
description: 'Label for the inventories modal title',
|
|
123
|
-
defaultMessage: 'Export inventories'
|
|
124
|
-
},
|
|
125
|
-
'modalTitle.discount-code': {
|
|
126
|
-
id: 'ExportResourcesModal.modalTitle.discountCode',
|
|
127
|
-
description: 'Label for the discount codes modal title',
|
|
128
|
-
defaultMessage: 'Export discount codes'
|
|
129
|
-
},
|
|
130
|
-
'modalTitle.customer': {
|
|
131
|
-
id: 'ExportResourcesModal.modalTitle.customer',
|
|
132
|
-
description: 'Label for the customers modal title',
|
|
133
|
-
defaultMessage: 'Export customers'
|
|
134
|
-
},
|
|
135
|
-
'modalTitle.order': {
|
|
136
|
-
id: 'ExportResourcesModal.modalTitle.order',
|
|
137
|
-
description: 'Label for the orders modal title',
|
|
138
|
-
defaultMessage: 'Export orders'
|
|
139
|
-
},
|
|
140
|
-
'modalTitle.product-type': {
|
|
141
|
-
id: 'ExportResourcesModal.modalTitle.productType',
|
|
142
|
-
description: 'Label for the product types modal title',
|
|
143
|
-
defaultMessage: 'Export product types'
|
|
144
|
-
},
|
|
145
|
-
outputFormat: {
|
|
146
|
-
id: 'ExportResourcesModal.outputFormat',
|
|
147
|
-
description: 'File format like (csv, xls, ...etc)',
|
|
148
|
-
defaultMessage: 'File format'
|
|
149
|
-
},
|
|
150
|
-
fileName: {
|
|
151
|
-
id: 'ExportResourcesModal.fileName',
|
|
152
|
-
description: 'exported file name',
|
|
153
|
-
defaultMessage: 'File name'
|
|
154
|
-
},
|
|
155
|
-
locale: {
|
|
156
|
-
id: 'ExportResourcesModal.locale',
|
|
157
|
-
description: 'Locale',
|
|
158
|
-
defaultMessage: 'Locale'
|
|
159
|
-
},
|
|
160
|
-
exportBasedOnMyViewsMessage: {
|
|
161
|
-
id: 'ExportResourcesModal.exportBasedOnMyViewsMessage',
|
|
162
|
-
description: 'Select Export setttings based on my views',
|
|
163
|
-
defaultMessage: 'Select export settings based on:'
|
|
164
|
-
},
|
|
165
|
-
propertiesPanelLabel: {
|
|
166
|
-
id: 'ExportResourcesModal.propertiesPanelLabel',
|
|
167
|
-
description: 'properties panel label',
|
|
168
|
-
defaultMessage: 'Properties'
|
|
169
|
-
},
|
|
170
|
-
exportOperationSuccessMessage: {
|
|
171
|
-
id: 'ExportResourcesModal.exportOperationSuccessMessage',
|
|
172
|
-
description: 'Success message',
|
|
173
|
-
defaultMessage: '<b>Your export has started.</b> <newline></newline><logsLink>Go to Export logs</logsLink> to view the progress and download the file.'
|
|
174
|
-
},
|
|
175
|
-
nothingApplied: {
|
|
176
|
-
id: 'ExportResourcesModal.nothingApplied',
|
|
177
|
-
description: 'Shown when there is no filter applied',
|
|
178
|
-
defaultMessage: 'nothing applied'
|
|
179
|
-
},
|
|
180
|
-
includeAllLocales: {
|
|
181
|
-
id: 'ExportResourcesModal.includeAllLocales',
|
|
182
|
-
description: 'label for "Include all locales" checkbox',
|
|
183
|
-
defaultMessage: 'Include all locales'
|
|
184
|
-
},
|
|
185
|
-
missingFileNameError: {
|
|
186
|
-
id: 'ExportResourcesModal.missingFileNameError',
|
|
187
|
-
description: 'Error when file name field is missing',
|
|
188
|
-
defaultMessage: 'Please enter a file name'
|
|
189
|
-
},
|
|
190
|
-
invalidFileNameError: {
|
|
191
|
-
id: 'ExportResourcesModal.invalidFileNameError',
|
|
192
|
-
description: 'Error when file name field is not valid',
|
|
193
|
-
defaultMessage: 'File name may only contain alphanumeric characters, hyphens and underscores'
|
|
194
|
-
},
|
|
195
|
-
missingLocaleError: {
|
|
196
|
-
id: 'ExportResourcesModal.missingLocaleError',
|
|
197
|
-
description: 'Error when no locale is selected',
|
|
198
|
-
defaultMessage: 'Please select at least one locale'
|
|
199
|
-
},
|
|
200
|
-
myViews: {
|
|
201
|
-
id: 'ExportResourcesModal.myViews',
|
|
202
|
-
description: 'Label for "My Views" Select Field',
|
|
203
|
-
defaultMessage: 'My Views'
|
|
204
|
-
},
|
|
205
|
-
selectFieldsToExport: {
|
|
206
|
-
id: 'ExportResourcesModal.selectFieldsToExport',
|
|
207
|
-
defaultMessage: 'Select fields to export'
|
|
208
|
-
},
|
|
209
|
-
back: {
|
|
210
|
-
id: 'ExportResourcesModal.back',
|
|
211
|
-
description: 'Label for "Back" button',
|
|
212
|
-
defaultMessage: 'Back'
|
|
213
|
-
},
|
|
214
|
-
startExport: {
|
|
215
|
-
id: 'ExportResourcesModal.startExport',
|
|
216
|
-
description: 'Label for "Start export" button',
|
|
217
|
-
defaultMessage: 'Start export'
|
|
218
|
-
},
|
|
219
|
-
continue: {
|
|
220
|
-
id: 'ExportResourcesModal.continue',
|
|
221
|
-
description: 'Label for "Continue" button',
|
|
222
|
-
defaultMessage: 'Continue'
|
|
223
|
-
},
|
|
224
|
-
fieldDefinitions: {
|
|
225
|
-
id: 'ExportResourcesModal.fieldDefinitions',
|
|
226
|
-
description: 'Label for "Field definitions" link',
|
|
227
|
-
defaultMessage: 'Field definitions'
|
|
228
|
-
},
|
|
229
|
-
unexpectedError: {
|
|
230
|
-
id: 'ExportResourcesModal.unexpectedError',
|
|
231
|
-
description: 'Generic notification message when starting export process fails',
|
|
232
|
-
defaultMessage: 'An error occurred while starting the export process. Please try again or contact support if the problem persists.'
|
|
233
|
-
},
|
|
234
|
-
searchForFields: {
|
|
235
|
-
id: 'ExportResourcesModal.searchForFields',
|
|
236
|
-
description: 'Placeholder for "Search for fields" search input',
|
|
237
|
-
defaultMessage: 'Search for fields'
|
|
238
|
-
},
|
|
239
|
-
thereAreNoResults: {
|
|
240
|
-
id: 'ExportResourcesModal.thereAreNoResults',
|
|
241
|
-
description: 'No search results message',
|
|
242
|
-
defaultMessage: 'There are no results that match your search.'
|
|
243
|
-
},
|
|
244
|
-
suggestions: {
|
|
245
|
-
id: 'ExportResourcesModal.suggestions',
|
|
246
|
-
description: 'In Export fields selection - Suggestions message',
|
|
247
|
-
defaultMessage: 'Suggestions:'
|
|
248
|
-
},
|
|
249
|
-
checkTheSpelling: {
|
|
250
|
-
id: 'ExportResourcesModal.checkTheSpelling',
|
|
251
|
-
description: 'In Export fields selection - Check the spelling message',
|
|
252
|
-
defaultMessage: 'Check the spelling.'
|
|
253
|
-
},
|
|
254
|
-
searchByEnteringTheExactFieldName: {
|
|
255
|
-
id: 'ExportResourcesModal.searchByEnteringTheExactFieldName',
|
|
256
|
-
description: 'In Export fields selection - Search by entering the exact field name message',
|
|
257
|
-
defaultMessage: 'Try searching by entering the exact field name.'
|
|
258
|
-
},
|
|
259
|
-
exportScope: {
|
|
260
|
-
id: 'ExportResourcesModal.exportScope',
|
|
261
|
-
description: 'Label for Export Scope',
|
|
262
|
-
defaultMessage: 'Scope'
|
|
263
|
-
},
|
|
264
|
-
exportScopeAllCategories: {
|
|
265
|
-
id: 'ExportResourcesModal.exportScopeAllCategories',
|
|
266
|
-
description: 'Label for Export All categories',
|
|
267
|
-
defaultMessage: 'Export all: {total, plural, one {# category} other {# categories}}'
|
|
268
|
-
},
|
|
269
|
-
exportScopeSelectedCategories: {
|
|
270
|
-
id: 'ExportResourcesModal.exportScopeSelectedCategories',
|
|
271
|
-
description: 'Label for Export Selected categories',
|
|
272
|
-
defaultMessage: 'Export selected: {total, plural, one {# category} other {# categories}}'
|
|
273
|
-
},
|
|
274
|
-
exportScopeFilteredCategories: {
|
|
275
|
-
id: 'ExportResourcesModal.exportScopeFilteredCategories',
|
|
276
|
-
description: 'Label for Export Filtered categories',
|
|
277
|
-
defaultMessage: 'Export filtered: {total, plural, one {# category} other {# categories}}'
|
|
278
|
-
},
|
|
279
|
-
exportScopeAllProducts: {
|
|
280
|
-
id: 'ExportResourcesModal.exportScopeAllProducts',
|
|
281
|
-
description: 'Label for Export All products',
|
|
282
|
-
defaultMessage: 'Export all: {total, plural, one {# product} other {# products}}'
|
|
283
|
-
},
|
|
284
|
-
exportScopeSelectedProducts: {
|
|
285
|
-
id: 'ExportResourcesModal.exportScopeSelectedProducts',
|
|
286
|
-
description: 'Label for Export Selected products',
|
|
287
|
-
defaultMessage: 'Export selected: {total, plural, one {# product} other {# products}}'
|
|
288
|
-
},
|
|
289
|
-
exportScopeFilteredProducts: {
|
|
290
|
-
id: 'ExportResourcesModal.exportScopeFilteredProducts',
|
|
291
|
-
description: 'Label for Export Filtered products',
|
|
292
|
-
defaultMessage: 'Export filtered: {total, plural, one {# product} other {# products}}'
|
|
293
|
-
},
|
|
294
|
-
exportScopeAllProductTypes: {
|
|
295
|
-
id: 'ExportResourcesModal.exportScopeAllProductTypes',
|
|
296
|
-
description: 'Label for Export All product types',
|
|
297
|
-
defaultMessage: 'Export all: {total, plural, one {# product type} other {# product types}}'
|
|
298
|
-
},
|
|
299
|
-
exportScopeSelectedProductTypes: {
|
|
300
|
-
id: 'ExportResourcesModal.exportScopeSelectedProductTypes',
|
|
301
|
-
description: 'Label for Export Selected product types',
|
|
302
|
-
defaultMessage: 'Export selected: {total, plural, one {# product type} other {# product types}}'
|
|
303
|
-
},
|
|
304
|
-
exportScopeFilteredProductTypes: {
|
|
305
|
-
id: 'ExportResourcesModal.exportScopeFilteredProductTypes',
|
|
306
|
-
description: 'Label for Export Filtered product types',
|
|
307
|
-
defaultMessage: 'Export filtered: {total, plural, one {# product type} other {# product types}}'
|
|
308
|
-
},
|
|
309
|
-
exportInventoriesForAllProducts: {
|
|
310
|
-
id: 'ExportResourcesModal.exportInventoriesForAllProducts',
|
|
311
|
-
description: 'Label for Export All inventories',
|
|
312
|
-
defaultMessage: 'Export inventories for all {total, plural, one {# product} other {# products}}'
|
|
313
|
-
},
|
|
314
|
-
exportInventoriesForSelectedProducts: {
|
|
315
|
-
id: 'ExportResourcesModal.exportInventoriesForSelectedProducts',
|
|
316
|
-
description: 'Label for Export Selected inventories',
|
|
317
|
-
defaultMessage: 'Export inventories for the {total, plural, one {# selected product} other {# selected products}}'
|
|
318
|
-
},
|
|
319
|
-
exportInventoriesForFilteredProducts: {
|
|
320
|
-
id: 'ExportResourcesModal.exportInventoriesForFilteredProducts',
|
|
321
|
-
description: 'Label for Export Filtered inventories',
|
|
322
|
-
defaultMessage: 'Export inventories for the {total, plural, one {# filtered product} other {# filtered products}}'
|
|
323
|
-
},
|
|
324
|
-
exportScopeAllDiscountCodes: {
|
|
325
|
-
id: 'ExportResourcesModal.exportScopeAllDiscountCodes',
|
|
326
|
-
description: 'Label for Export All discount codes',
|
|
327
|
-
defaultMessage: 'Export all: {total, plural, one {# discount code} other {# discount codes}}'
|
|
328
|
-
},
|
|
329
|
-
exportScopeSelectedDiscountCodes: {
|
|
330
|
-
id: 'ExportResourcesModal.exportScopeSelectedDiscountCodes',
|
|
331
|
-
description: 'Label for Export Selected discount codes',
|
|
332
|
-
defaultMessage: 'Export selected: {total, plural, one {# discount code} other {# discount codes}}'
|
|
333
|
-
},
|
|
334
|
-
exportScopeFilteredDiscountCodes: {
|
|
335
|
-
id: 'ExportResourcesModal.exportScopeFilteredDiscountCodes',
|
|
336
|
-
description: 'Label for Export Filtered discount codes',
|
|
337
|
-
defaultMessage: 'Export filtered: {total, plural, one {# discount code} other {# discount codes}}'
|
|
338
|
-
},
|
|
339
|
-
exportScopeAllOrders: {
|
|
340
|
-
id: 'ExportResourcesModal.exportScopeAllOrders',
|
|
341
|
-
description: 'Label for Export All orders',
|
|
342
|
-
defaultMessage: 'Export all: {total, plural, one {# order} other {# orders}}'
|
|
343
|
-
},
|
|
344
|
-
exportScopeSelectedOrders: {
|
|
345
|
-
id: 'ExportResourcesModal.exportScopeSelectedOrders',
|
|
346
|
-
description: 'Label for Export Selected orders',
|
|
347
|
-
defaultMessage: 'Export selected: {total, plural, one {# order} other {# orders}}'
|
|
348
|
-
},
|
|
349
|
-
exportScopeFilteredOrders: {
|
|
350
|
-
id: 'ExportResourcesModal.exportScopeFilteredOrders',
|
|
351
|
-
description: 'Label for Export Filtered orders',
|
|
352
|
-
defaultMessage: 'Export filtered: {total, plural, one {# order} other {# orders}}'
|
|
353
|
-
},
|
|
354
|
-
exportScopeAllCustomers: {
|
|
355
|
-
id: 'ExportResourcesModal.exportScopeAllCustomers',
|
|
356
|
-
description: 'Label for Export All customers',
|
|
357
|
-
defaultMessage: 'Export all: {total, plural, one {# customer} other {# customers}}'
|
|
358
|
-
},
|
|
359
|
-
exportScopeSelectedCustomers: {
|
|
360
|
-
id: 'ExportResourcesModal.exportScopeSelectedCustomers',
|
|
361
|
-
description: 'Label for Export Selected customers',
|
|
362
|
-
defaultMessage: 'Export selected: {total, plural, one {# customer} other {# customers}}'
|
|
363
|
-
},
|
|
364
|
-
exportScopeFilteredCustomers: {
|
|
365
|
-
id: 'ExportResourcesModal.exportScopeFilteredCustomers',
|
|
366
|
-
description: 'Label for Export Filtered customers',
|
|
367
|
-
defaultMessage: 'Export filtered: {total, plural, one {# customer} other {# customers}}'
|
|
368
|
-
},
|
|
369
|
-
exportScopeSelectedWithoutCount: {
|
|
370
|
-
id: 'ExportResourcesModal.exportScopeSelectedWithoutCount',
|
|
371
|
-
description: 'Label for Export Selected without count',
|
|
372
|
-
defaultMessage: 'Export selected'
|
|
373
|
-
},
|
|
374
|
-
exportScopeFilteredWithoutCount: {
|
|
375
|
-
id: 'ExportResourcesModal.exportScopeFilteredWithoutCount',
|
|
376
|
-
description: 'Label for Export Filtered without count',
|
|
377
|
-
defaultMessage: 'Export filtered'
|
|
378
|
-
},
|
|
379
|
-
exportSettings: {
|
|
380
|
-
id: 'ExportResourcesModal.exportSettings',
|
|
381
|
-
description: 'Label for Export Settings',
|
|
382
|
-
defaultMessage: 'Settings'
|
|
383
|
-
},
|
|
384
|
-
selected: {
|
|
385
|
-
id: 'ExportResourcesModal.selected',
|
|
386
|
-
description: 'Label for total Selected',
|
|
387
|
-
defaultMessage: '{total} selected'
|
|
388
|
-
},
|
|
389
|
-
// Preferences
|
|
390
|
-
exportPreferences: {
|
|
391
|
-
id: 'ExportResourcesModal.exportPreferences',
|
|
392
|
-
description: 'Label for preferences',
|
|
393
|
-
defaultMessage: 'Preferences'
|
|
394
|
-
},
|
|
395
|
-
fillRowsForOrderExport: {
|
|
396
|
-
id: 'ExportResourcesModal.fillRowsForOrderExport',
|
|
397
|
-
description: 'A checkbox label for filling rows for order export',
|
|
398
|
-
defaultMessage: 'Include Order number, id, and states in every row'
|
|
399
|
-
},
|
|
400
|
-
fillRowsForProductExport: {
|
|
401
|
-
id: 'ExportResourcesModal.fillRowsForProductExport',
|
|
402
|
-
description: 'A checkbox label for filling rows for product export',
|
|
403
|
-
defaultMessage: 'Include Product- and Variant-level information in every row'
|
|
404
|
-
},
|
|
405
|
-
loadMoreFields: {
|
|
406
|
-
id: 'ExportResourcesModal.loadMoreFields',
|
|
407
|
-
description: 'Load more fields message',
|
|
408
|
-
defaultMessage: 'Load more fields by using the search functionality'
|
|
409
|
-
},
|
|
410
|
-
itemCount: {
|
|
411
|
-
id: 'ExportResourcesModal.itemCount',
|
|
412
|
-
description: 'Label for item count',
|
|
413
|
-
defaultMessage: '{count, plural, one {# item} other {# items}}'
|
|
414
|
-
}
|
|
415
|
-
});
|
|
416
|
-
|
|
417
|
-
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; }
|
|
418
|
-
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; }
|
|
419
|
-
function renderFileNameError(key) {
|
|
420
|
-
switch (key) {
|
|
421
|
-
case 'missing':
|
|
422
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$8({}, messages.missingFileNameError));
|
|
423
|
-
case 'invalidInput':
|
|
424
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$8({}, messages.invalidFileNameError));
|
|
425
|
-
default:
|
|
426
|
-
return null;
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
function renderLocaleError(key) {
|
|
430
|
-
switch (key) {
|
|
431
|
-
case 'missing':
|
|
432
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$8({}, messages.missingLocaleError));
|
|
433
|
-
default:
|
|
434
|
-
return null;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
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)); }
|
|
439
|
-
function _isNativeReflectConstruct$3() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$3 = function () { return !!t; })(); }
|
|
440
|
-
let MissingExportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
441
|
-
function MissingExportResourceProviderError() {
|
|
442
|
-
var _this;
|
|
443
|
-
_classCallCheck(this, MissingExportResourceProviderError);
|
|
444
|
-
_this = _callSuper$3(this, MissingExportResourceProviderError, ['useExportResourcesModalContext must be used within ExportResourcesProvider']);
|
|
445
|
-
_this.name = 'MissingExportResourceProviderError';
|
|
446
|
-
return _this;
|
|
447
|
-
}
|
|
448
|
-
_inherits(MissingExportResourceProviderError, _Error);
|
|
449
|
-
return _createClass(MissingExportResourceProviderError);
|
|
450
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
451
|
-
|
|
452
|
-
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)); }
|
|
453
|
-
function _isNativeReflectConstruct$2() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$2 = function () { return !!t; })(); }
|
|
454
|
-
let UnexpectedExportOperationStateError = /*#__PURE__*/function (_Error) {
|
|
455
|
-
function UnexpectedExportOperationStateError(state) {
|
|
456
|
-
var _this;
|
|
457
|
-
_classCallCheck(this, UnexpectedExportOperationStateError);
|
|
458
|
-
_this = _callSuper$2(this, UnexpectedExportOperationStateError, [`Unexpected export operation state "${state}"`]);
|
|
459
|
-
_this.name = 'UnexpectedExportOperationStateError';
|
|
460
|
-
return _this;
|
|
461
|
-
}
|
|
462
|
-
_inherits(UnexpectedExportOperationStateError, _Error);
|
|
463
|
-
return _createClass(UnexpectedExportOperationStateError);
|
|
464
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
465
|
-
|
|
466
|
-
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)); }
|
|
467
|
-
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function () { return !!t; })(); }
|
|
468
|
-
let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
|
|
469
|
-
function UnexpectedResourceTypeError(resourceType) {
|
|
470
|
-
var _this;
|
|
471
|
-
_classCallCheck(this, UnexpectedResourceTypeError);
|
|
472
|
-
_this = _callSuper$1(this, UnexpectedResourceTypeError, [`Unexpected resource type "${resourceType}"`]);
|
|
473
|
-
_this.name = 'UnexpectedResourceTypeError';
|
|
474
|
-
return _this;
|
|
475
|
-
}
|
|
476
|
-
_inherits(UnexpectedResourceTypeError, _Error);
|
|
477
|
-
return _createClass(UnexpectedResourceTypeError);
|
|
478
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
479
|
-
|
|
480
|
-
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)); }
|
|
481
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
482
|
-
let InvalidResponseError = /*#__PURE__*/function (_Error) {
|
|
483
|
-
function InvalidResponseError() {
|
|
484
|
-
var _this;
|
|
485
|
-
_classCallCheck(this, InvalidResponseError);
|
|
486
|
-
_this = _callSuper(this, InvalidResponseError, ['Invalid response']);
|
|
487
|
-
_this.name = 'InvalidResponseError';
|
|
488
|
-
return _this;
|
|
489
|
-
}
|
|
490
|
-
_inherits(InvalidResponseError, _Error);
|
|
491
|
-
return _createClass(InvalidResponseError);
|
|
492
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
493
|
-
|
|
494
|
-
function useExportResourcesModalContext() {
|
|
495
|
-
const context = React.useContext(ExportResourcesContext);
|
|
496
|
-
if (!context) {
|
|
497
|
-
throw new MissingExportResourceProviderError();
|
|
498
|
-
}
|
|
499
|
-
return context;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
const Z_INDEX_DROPDOWN = 30000;
|
|
503
|
-
const OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION = 'OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION';
|
|
504
|
-
const OPERATIONS_EXPORT_RESOURCES_MODAL_EXPANDED_GROUP = 'OPERATIONS_EXPORT_RESOURCES_MODAL_EXPANDED_GROUP';
|
|
505
|
-
|
|
506
|
-
const EXPORT_OPERATION_STATES = {
|
|
507
|
-
PROCESSING: 'processing',
|
|
508
|
-
COMPLETED: 'completed',
|
|
509
|
-
FAILED: 'failed',
|
|
510
|
-
QUEUED: 'queued'
|
|
511
|
-
};
|
|
512
|
-
|
|
513
|
-
const EXPORT_TYPES = {
|
|
514
|
-
ALL: 'all',
|
|
515
|
-
FILTERED: 'filtered',
|
|
516
|
-
SELECTED: 'selected'
|
|
517
|
-
};
|
|
518
|
-
|
|
519
|
-
const EXPORTABLE_RESOURCES = {
|
|
520
|
-
CATEGORY: 'category',
|
|
521
|
-
PRODUCT: 'product',
|
|
522
|
-
PRODUCT_TYPE: 'product-type',
|
|
523
|
-
DISCOUNT_CODE: 'discount-code',
|
|
524
|
-
INVENTORY_ENTRY: 'inventory-entry',
|
|
525
|
-
ORDER: 'order',
|
|
526
|
-
CUSTOMER: 'customer'
|
|
527
|
-
};
|
|
528
|
-
|
|
529
|
-
const OUTPUT_FORMATS = {
|
|
530
|
-
JSON: 'json',
|
|
531
|
-
CSV: 'csv'
|
|
532
|
-
};
|
|
533
|
-
const OUTPUT_FORMAT_OPTIONS = [{
|
|
534
|
-
value: OUTPUT_FORMATS.CSV,
|
|
535
|
-
label: 'CSV'
|
|
536
|
-
}, {
|
|
537
|
-
value: OUTPUT_FORMATS.JSON,
|
|
538
|
-
label: 'JSON'
|
|
539
|
-
}];
|
|
540
|
-
|
|
541
|
-
const resourceTypeMessages = {
|
|
542
|
-
[EXPORTABLE_RESOURCES.CATEGORY]: {
|
|
543
|
-
exportScopeAll: messages.exportScopeAllCategories,
|
|
544
|
-
exportScopeSelected: messages.exportScopeSelectedCategories,
|
|
545
|
-
exportScopeFiltered: messages.exportScopeFilteredCategories
|
|
546
|
-
},
|
|
547
|
-
[EXPORTABLE_RESOURCES.PRODUCT]: {
|
|
548
|
-
exportScopeAll: messages.exportScopeAllProducts,
|
|
549
|
-
exportScopeSelected: messages.exportScopeSelectedProducts,
|
|
550
|
-
exportScopeFiltered: messages.exportScopeFilteredProducts
|
|
551
|
-
},
|
|
552
|
-
[EXPORTABLE_RESOURCES.PRODUCT_TYPE]: {
|
|
553
|
-
exportScopeAll: messages.exportScopeAllProductTypes,
|
|
554
|
-
exportScopeSelected: messages.exportScopeSelectedProductTypes,
|
|
555
|
-
exportScopeFiltered: messages.exportScopeFilteredProductTypes
|
|
556
|
-
},
|
|
557
|
-
[EXPORTABLE_RESOURCES.INVENTORY_ENTRY]: {
|
|
558
|
-
exportScopeAll: messages.exportInventoriesForAllProducts,
|
|
559
|
-
exportScopeSelected: messages.exportInventoriesForSelectedProducts,
|
|
560
|
-
exportScopeFiltered: messages.exportInventoriesForFilteredProducts
|
|
561
|
-
},
|
|
562
|
-
[EXPORTABLE_RESOURCES.DISCOUNT_CODE]: {
|
|
563
|
-
exportScopeAll: messages.exportScopeAllDiscountCodes,
|
|
564
|
-
exportScopeSelected: messages.exportScopeSelectedDiscountCodes,
|
|
565
|
-
exportScopeFiltered: messages.exportScopeFilteredDiscountCodes
|
|
566
|
-
},
|
|
567
|
-
[EXPORTABLE_RESOURCES.ORDER]: {
|
|
568
|
-
exportScopeAll: messages.exportScopeAllOrders,
|
|
569
|
-
exportScopeSelected: messages.exportScopeSelectedOrders,
|
|
570
|
-
exportScopeFiltered: messages.exportScopeFilteredOrders
|
|
571
|
-
},
|
|
572
|
-
[EXPORTABLE_RESOURCES.CUSTOMER]: {
|
|
573
|
-
exportScopeAll: messages.exportScopeAllCustomers,
|
|
574
|
-
exportScopeSelected: messages.exportScopeSelectedCustomers,
|
|
575
|
-
exportScopeFiltered: messages.exportScopeFilteredCustomers
|
|
576
|
-
}
|
|
577
|
-
};
|
|
578
|
-
|
|
579
|
-
const isAnyFieldChecked = fields => {
|
|
580
|
-
return _someInstanceProperty__default["default"](fields).call(fields, field => field.isChecked || field.fields && isAnyFieldChecked(field.fields));
|
|
581
|
-
};
|
|
582
|
-
const hasDependentFields = field => {
|
|
583
|
-
var _context;
|
|
584
|
-
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)));
|
|
585
|
-
};
|
|
586
|
-
const isFieldOrNestedFieldChecked = (field, fieldName) => {
|
|
587
|
-
if (field.name === fieldName && field.isChecked) {
|
|
588
|
-
return true;
|
|
589
|
-
}
|
|
590
|
-
if (field.fields) {
|
|
591
|
-
var _context2;
|
|
592
|
-
return _someInstanceProperty__default["default"](_context2 = field.fields).call(_context2, nestedField => {
|
|
593
|
-
return nestedField.isChecked || isFieldOrNestedFieldChecked(nestedField, fieldName);
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
return false;
|
|
597
|
-
};
|
|
598
|
-
const getIndependentFields = group => {
|
|
599
|
-
const independentFields = [];
|
|
600
|
-
const findIndependentFields = fields => {
|
|
601
|
-
_forEachInstanceProperty__default["default"](fields).call(fields, field => {
|
|
602
|
-
if (!field.dependentGroupNames?.length && !field.dependentFieldNames?.length) {
|
|
603
|
-
independentFields.push(field);
|
|
604
|
-
}
|
|
605
|
-
if (field.fields) {
|
|
606
|
-
findIndependentFields(field.fields);
|
|
607
|
-
}
|
|
608
|
-
});
|
|
609
|
-
};
|
|
610
|
-
findIndependentFields(group.fields);
|
|
611
|
-
return independentFields;
|
|
612
|
-
};
|
|
613
|
-
const checkDependentFields = (independentFields, dependentFieldNames) => {
|
|
614
|
-
return _someInstanceProperty__default["default"](dependentFieldNames).call(dependentFieldNames, fieldName => _someInstanceProperty__default["default"](independentFields).call(independentFields, field => {
|
|
615
|
-
if (field.name === fieldName) {
|
|
616
|
-
if (field.fields) {
|
|
617
|
-
var _context3;
|
|
618
|
-
return _someInstanceProperty__default["default"](_context3 = field.fields).call(_context3, nestedField => isFieldOrNestedFieldChecked(nestedField, fieldName));
|
|
619
|
-
}
|
|
620
|
-
if (isFieldOrNestedFieldChecked(field, fieldName)) {
|
|
621
|
-
return true;
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
return false;
|
|
625
|
-
}));
|
|
626
|
-
};
|
|
627
|
-
|
|
628
|
-
/**
|
|
629
|
-
* Checks if any dependent fields are checked within the field groups
|
|
630
|
-
*
|
|
631
|
-
* This function iterates over the provided dependent group names and checks if any fields within those groups
|
|
632
|
-
* are checked. It considers both independent fields and their nested fields within
|
|
633
|
-
* the specified dependent field names
|
|
634
|
-
*
|
|
635
|
-
* @param groups - The array of field groups
|
|
636
|
-
* @param dependentGroupNames - The names of the groups to check for dependencies
|
|
637
|
-
* @param dependentFieldNames - The names of the fields to check within the groups
|
|
638
|
-
* @returns True if any dependent fields are checked otherwise false
|
|
639
|
-
*/
|
|
640
|
-
const isAnyDependentChecked = function (groups) {
|
|
641
|
-
let dependentGroupNames = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
642
|
-
let dependentFieldNames = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
643
|
-
return _someInstanceProperty__default["default"](dependentGroupNames).call(dependentGroupNames, groupName => {
|
|
644
|
-
const group = _findInstanceProperty__default["default"](groups).call(groups, g => g.groupName === groupName);
|
|
645
|
-
if (group) {
|
|
646
|
-
const independentFields = getIndependentFields(group);
|
|
647
|
-
const isADependentFieldChecked = isAnyFieldChecked(independentFields);
|
|
648
|
-
const isFieldDependentChecked = checkDependentFields(independentFields, dependentFieldNames);
|
|
649
|
-
if (dependentFieldNames.length > 0) {
|
|
650
|
-
return isADependentFieldChecked && isFieldDependentChecked;
|
|
651
|
-
}
|
|
652
|
-
return isADependentFieldChecked || isFieldDependentChecked;
|
|
653
|
-
}
|
|
654
|
-
return false;
|
|
655
|
-
});
|
|
656
|
-
};
|
|
657
|
-
const areAllFieldsChecked = fields => {
|
|
658
|
-
return _everyInstanceProperty__default["default"](fields).call(fields, field => field.fields ? areAllFieldsChecked(field.fields) : field.isChecked || field.isRequired || hasDependentFields(field));
|
|
659
|
-
};
|
|
660
|
-
const getGroupSelectedFieldCount = group => {
|
|
661
|
-
const countSelectedFields = fields => {
|
|
662
|
-
return _reduceInstanceProperty__default["default"](fields).call(fields, (total, field) => {
|
|
663
|
-
if (field.fields) {
|
|
664
|
-
return total + countSelectedFields(field.fields);
|
|
665
|
-
}
|
|
666
|
-
return total + (field.isChecked ? 1 : 0);
|
|
667
|
-
}, 0);
|
|
668
|
-
};
|
|
669
|
-
return countSelectedFields(group.fields);
|
|
670
|
-
};
|
|
671
|
-
|
|
672
|
-
let Step = /*#__PURE__*/function (Step) {
|
|
673
|
-
Step["FileSettings"] = "file-settings";
|
|
674
|
-
Step["FieldsSelection"] = "fields-selection";
|
|
675
|
-
return Step;
|
|
676
|
-
}({});
|
|
677
|
-
|
|
678
|
-
function validate(_ref) {
|
|
679
|
-
let values = _valuesInstanceProperty__default["default"](_ref),
|
|
680
|
-
step = _ref.step;
|
|
681
|
-
const fileName = values.fileName,
|
|
682
|
-
locales = values.locales,
|
|
683
|
-
groups = values.groups;
|
|
684
|
-
const errors = {
|
|
685
|
-
fileName: {},
|
|
686
|
-
locales: {},
|
|
687
|
-
fields: {}
|
|
688
|
-
};
|
|
689
|
-
if (uiKit.TextInput.isEmpty(fileName)) {
|
|
690
|
-
errors.fileName.missing = true;
|
|
691
|
-
} else if (!/^[a-zA-Z0-9-_.]+$/.test(fileName)) {
|
|
692
|
-
errors.fileName.invalidInput = true;
|
|
693
|
-
}
|
|
694
|
-
if (locales.length < 1) {
|
|
695
|
-
errors.locales.missing = true;
|
|
696
|
-
}
|
|
697
|
-
if (step === Step.FieldsSelection) {
|
|
698
|
-
const allFields = _reduceInstanceProperty__default["default"](groups).call(groups, (acc, group) => _concatInstanceProperty__default["default"](acc).call(acc, group.fields), []);
|
|
699
|
-
const checkedFieldsCount = _filterInstanceProperty__default["default"](allFields).call(allFields, field => {
|
|
700
|
-
if (field.fields) return isAnyFieldChecked(field.fields);
|
|
701
|
-
return field.isChecked;
|
|
702
|
-
}).length;
|
|
703
|
-
if (checkedFieldsCount < 1) {
|
|
704
|
-
errors.fields.missing = true;
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
return omitEmpty__default["default"](errors);
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
function resourceTypeToFileName(resourceType, locale) {
|
|
711
|
-
var _context;
|
|
712
|
-
const date = new Date();
|
|
713
|
-
const dateFormatter = new Intl.DateTimeFormat(locale, {
|
|
714
|
-
year: '2-digit',
|
|
715
|
-
month: '2-digit',
|
|
716
|
-
day: '2-digit',
|
|
717
|
-
hour: '2-digit',
|
|
718
|
-
minute: '2-digit',
|
|
719
|
-
hour12: false
|
|
720
|
-
});
|
|
721
|
-
const parts = dateFormatter.formatToParts(date);
|
|
722
|
-
const dateParts = _reduceInstanceProperty__default["default"](parts).call(parts, (acc, part) => {
|
|
723
|
-
if (part.type !== 'literal') {
|
|
724
|
-
acc[part.type] = part.value;
|
|
725
|
-
}
|
|
726
|
-
return acc;
|
|
727
|
-
}, {});
|
|
728
|
-
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('-');
|
|
729
|
-
const formattedDate = `${orderedDateParts}_${dateParts.hour}-${dateParts.minute}`;
|
|
730
|
-
const resourceTypeMap = {
|
|
731
|
-
[EXPORTABLE_RESOURCES.CATEGORY]: 'Categories',
|
|
732
|
-
[EXPORTABLE_RESOURCES.PRODUCT]: 'Products',
|
|
733
|
-
[EXPORTABLE_RESOURCES.PRODUCT_TYPE]: 'Product_Types',
|
|
734
|
-
[EXPORTABLE_RESOURCES.DISCOUNT_CODE]: 'Discount_Codes',
|
|
735
|
-
[EXPORTABLE_RESOURCES.INVENTORY_ENTRY]: 'Inventories',
|
|
736
|
-
[EXPORTABLE_RESOURCES.CUSTOMER]: 'Customers',
|
|
737
|
-
[EXPORTABLE_RESOURCES.ORDER]: 'Orders'
|
|
738
|
-
};
|
|
739
|
-
const displayName = resourceTypeMap[resourceType];
|
|
740
|
-
if (!displayName) {
|
|
741
|
-
throw new UnexpectedResourceTypeError(resourceType);
|
|
742
|
-
}
|
|
743
|
-
return `${displayName}_Export_${formattedDate}`;
|
|
744
|
-
}
|
|
745
|
-
function mapLocalesToOptions(locales) {
|
|
746
|
-
return _mapInstanceProperty__default["default"](locales).call(locales, locale => ({
|
|
747
|
-
value: locale,
|
|
748
|
-
label: locale
|
|
749
|
-
}));
|
|
750
|
-
}
|
|
751
|
-
function isFilledArray(maybeArray) {
|
|
752
|
-
return _Array$isArray__default["default"](maybeArray) && maybeArray.length > 0;
|
|
753
|
-
}
|
|
754
|
-
function appendCsvOrJsonExtensionIfAbsent(fileName, fileFormat) {
|
|
755
|
-
const extensionRegex = /\.(csv|json)$/i;
|
|
756
|
-
if (!extensionRegex.test(fileName)) return `${fileName}.${fileFormat}`;
|
|
757
|
-
return fileName;
|
|
758
|
-
}
|
|
759
|
-
function getExportLogsLink(projectKey, msg) {
|
|
760
|
-
return jsxRuntime.jsx(uiKit.Link, {
|
|
761
|
-
to: `/${projectKey}/operations/export/logs`,
|
|
762
|
-
children: msg
|
|
763
|
-
}, "link");
|
|
764
|
-
}
|
|
765
|
-
const extractFieldNamesAndAdditionalFieldExtensions = fields => {
|
|
766
|
-
const result = _reduceInstanceProperty__default["default"](fields).call(fields, (acc, field) => {
|
|
767
|
-
if (field.extendedFieldNames) {
|
|
768
|
-
return [...acc, field.name, ...field.extendedFieldNames];
|
|
769
|
-
}
|
|
770
|
-
return [...acc, field.name];
|
|
771
|
-
}, []);
|
|
772
|
-
return [...new _Set__default["default"](result)];
|
|
773
|
-
};
|
|
774
|
-
function sortFieldsByFieldOrder(_ref) {
|
|
775
|
-
let fieldNames = _ref.fieldNames,
|
|
776
|
-
fieldOrder = _ref.fieldOrder;
|
|
777
|
-
if (isFilledArray(fieldOrder)) {
|
|
778
|
-
return _sortInstanceProperty__default["default"](fieldNames).call(fieldNames, (a, b) => {
|
|
779
|
-
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]);
|
|
780
|
-
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]);
|
|
781
|
-
|
|
782
|
-
// If a field is not 'custom',then consider it as '*'
|
|
783
|
-
orderA = orderA === -1 ? _indexOfInstanceProperty__default["default"](fieldOrder).call(fieldOrder, '*') : orderA;
|
|
784
|
-
orderB = orderB === -1 ? _indexOfInstanceProperty__default["default"](fieldOrder).call(fieldOrder, '*') : orderB;
|
|
785
|
-
return orderA - orderB;
|
|
786
|
-
});
|
|
787
|
-
}
|
|
788
|
-
return fieldNames;
|
|
789
|
-
}
|
|
790
|
-
function buildSelectedExportFilters(selectedResourceIds) {
|
|
791
|
-
if (!selectedResourceIds || selectedResourceIds?.length === 0) return undefined;
|
|
792
|
-
const formattedIds = _mapInstanceProperty__default["default"](selectedResourceIds).call(selectedResourceIds, id => `"${id}"`).join(', ');
|
|
793
|
-
return `id in (${formattedIds})`;
|
|
794
|
-
}
|
|
795
|
-
function isQueryFilter(filters) {
|
|
796
|
-
if (!filters) return false;
|
|
797
|
-
return 'query' in filters;
|
|
798
|
-
}
|
|
799
|
-
function isSearchFilter(filters) {
|
|
800
|
-
if (!filters) return false;
|
|
801
|
-
return 'filters' in filters || 'fullText' in filters;
|
|
802
|
-
}
|
|
803
|
-
function isPredicateFilter(filters) {
|
|
804
|
-
if (!filters) return false;
|
|
805
|
-
return 'where' in filters;
|
|
806
|
-
}
|
|
807
|
-
function validateFilters(filtersObject) {
|
|
808
|
-
if (filtersObject.where && filtersObject.filters) {
|
|
809
|
-
return false;
|
|
810
|
-
}
|
|
811
|
-
return Boolean(isQueryFilter(filtersObject.filters) || isSearchFilter(filtersObject.filters) || isPredicateFilter(filtersObject));
|
|
812
|
-
}
|
|
813
|
-
function areFiltersApplied(filtersObject) {
|
|
814
|
-
var _context2;
|
|
815
|
-
if (!filtersObject) {
|
|
816
|
-
return false;
|
|
817
|
-
}
|
|
818
|
-
if (filtersObject.where && _trimInstanceProperty__default["default"](_context2 = filtersObject.where).call(_context2) !== '') {
|
|
819
|
-
return true;
|
|
820
|
-
}
|
|
821
|
-
if (isQueryFilter(filtersObject.filters)) {
|
|
822
|
-
return Boolean(filtersObject.filters.query);
|
|
823
|
-
}
|
|
824
|
-
if (isSearchFilter(filtersObject.filters)) {
|
|
825
|
-
const _filters = filtersObject.filters;
|
|
826
|
-
return Boolean(_filters.filters?.length || _filters.fullText?.text?.trim());
|
|
827
|
-
}
|
|
828
|
-
return false;
|
|
829
|
-
}
|
|
830
|
-
function getInitialExportType(args) {
|
|
831
|
-
if (args.selectedResourceIds?.length) {
|
|
832
|
-
return EXPORT_TYPES.SELECTED;
|
|
833
|
-
}
|
|
834
|
-
if (args.filters?.total && areFiltersApplied(args.filters)) {
|
|
835
|
-
return EXPORT_TYPES.FILTERED;
|
|
836
|
-
}
|
|
837
|
-
return EXPORT_TYPES.ALL;
|
|
838
|
-
}
|
|
839
|
-
function removeEmptyGroups(groups) {
|
|
840
|
-
return _filterInstanceProperty__default["default"](groups).call(groups, group => group.fields && group.fields.length > 0);
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
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; }
|
|
844
|
-
function _objectSpread$7(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$7(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$7(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
845
|
-
const updateFieldGroupsWithIsCheckedValue = (groups, cachedSelectedGroups) => {
|
|
846
|
-
const updateFields = (fields, isParentChecked, parentFieldPath) => {
|
|
847
|
-
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
848
|
-
let isChecked = false;
|
|
849
|
-
if (field.isRequired) {
|
|
850
|
-
isChecked = true;
|
|
851
|
-
} else {
|
|
852
|
-
if (cachedSelectedGroups[`${parentFieldPath}.${field.name}`] !== undefined) {
|
|
853
|
-
isChecked = cachedSelectedGroups[`${parentFieldPath}.${field.name}`];
|
|
854
|
-
} else if (!hasDependentFields(field) && field.isSelectedByDefault) {
|
|
855
|
-
isChecked = true;
|
|
856
|
-
} else if (isParentChecked) {
|
|
857
|
-
isChecked = true;
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
let updatedFields = field.fields;
|
|
861
|
-
if (field.fields) {
|
|
862
|
-
updatedFields = updateFields(field.fields, isChecked, `${parentFieldPath}.${field.name}`);
|
|
863
|
-
isChecked = false;
|
|
864
|
-
}
|
|
865
|
-
return _objectSpread$7(_objectSpread$7({}, field), {}, {
|
|
866
|
-
isChecked,
|
|
867
|
-
fields: updatedFields
|
|
868
|
-
});
|
|
869
|
-
});
|
|
870
|
-
};
|
|
871
|
-
return _mapInstanceProperty__default["default"](groups).call(groups, group => {
|
|
872
|
-
const updatedFields = updateFields(group.fields, false, group.groupName);
|
|
873
|
-
return _objectSpread$7(_objectSpread$7({}, group), {}, {
|
|
874
|
-
fields: updatedFields
|
|
875
|
-
});
|
|
876
|
-
});
|
|
877
|
-
};
|
|
878
|
-
const updateFieldGroupWithAdditionalFieldExtensions = groups => {
|
|
879
|
-
function updateAdditionalFieldExtensions(fields, extendedFieldNames) {
|
|
880
|
-
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
881
|
-
const updatedAdditionalFieldExtensions = [...extendedFieldNames, ...(field.extendedFieldNames || [])];
|
|
882
|
-
if (field.fields) {
|
|
883
|
-
field.fields = updateAdditionalFieldExtensions(field.fields, updatedAdditionalFieldExtensions);
|
|
884
|
-
}
|
|
885
|
-
return _objectSpread$7(_objectSpread$7({}, field), {}, {
|
|
886
|
-
extendedFieldNames: updatedAdditionalFieldExtensions
|
|
887
|
-
});
|
|
888
|
-
});
|
|
889
|
-
}
|
|
890
|
-
function combineDependentGroupNames(fields) {
|
|
891
|
-
return _reduceInstanceProperty__default["default"](fields).call(fields, (acc, field) => {
|
|
892
|
-
if (field.dependentGroupNames) {
|
|
893
|
-
acc = [...acc, ...field.dependentGroupNames];
|
|
894
|
-
}
|
|
895
|
-
if (field.fields) {
|
|
896
|
-
acc = [...acc, ...combineDependentGroupNames(field.fields)];
|
|
897
|
-
}
|
|
898
|
-
return acc;
|
|
899
|
-
}, []);
|
|
900
|
-
}
|
|
901
|
-
return _mapInstanceProperty__default["default"](groups).call(groups, group => {
|
|
902
|
-
return _objectSpread$7(_objectSpread$7({}, group), {}, {
|
|
903
|
-
dependentGroupNames: combineDependentGroupNames(group.fields),
|
|
904
|
-
fields: updateAdditionalFieldExtensions(group.fields, [])
|
|
905
|
-
});
|
|
906
|
-
});
|
|
907
|
-
};
|
|
908
|
-
const getIsExpanded = (field, groupName, cachedExpandedGroups) => {
|
|
909
|
-
if (!field.isExpandable) {
|
|
910
|
-
return false;
|
|
911
|
-
}
|
|
912
|
-
if (field.fields && field.maxVisibleChildren && field.fields.length > field.maxVisibleChildren) {
|
|
913
|
-
return false;
|
|
914
|
-
}
|
|
915
|
-
const cacheKey = `${groupName}.${field.name}`;
|
|
916
|
-
return cachedExpandedGroups[cacheKey] ?? field.isExpanded ?? false;
|
|
917
|
-
};
|
|
918
|
-
const updateFieldGroupsWithIsExpandedValue = (groups, cachedExpandedGroups) => {
|
|
919
|
-
function updateFields(fields, groupName) {
|
|
920
|
-
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
921
|
-
let isExpanded = null;
|
|
922
|
-
if (field.isExpandable) {
|
|
923
|
-
isExpanded = getIsExpanded(field, groupName, cachedExpandedGroups);
|
|
924
|
-
}
|
|
925
|
-
if (field.fields) {
|
|
926
|
-
field.fields = updateFields(field.fields, groupName);
|
|
927
|
-
}
|
|
928
|
-
if (isExpanded !== null) {
|
|
929
|
-
return _objectSpread$7(_objectSpread$7({}, field), {}, {
|
|
930
|
-
isExpanded
|
|
931
|
-
});
|
|
932
|
-
}
|
|
933
|
-
return field;
|
|
934
|
-
});
|
|
935
|
-
}
|
|
936
|
-
return _mapInstanceProperty__default["default"](groups).call(groups, group => {
|
|
937
|
-
const updatedFields = updateFields(group.fields, group.groupName);
|
|
938
|
-
return _objectSpread$7(_objectSpread$7({}, group), {}, {
|
|
939
|
-
isExpanded: cachedExpandedGroups[group.groupName] ?? group.isExpanded ?? false,
|
|
940
|
-
fields: updatedFields
|
|
941
|
-
});
|
|
942
|
-
});
|
|
943
|
-
};
|
|
944
|
-
const mapFormikErrors = error => {
|
|
945
|
-
if (typeof error === 'string') {
|
|
946
|
-
return {
|
|
947
|
-
[error]: true
|
|
948
|
-
};
|
|
949
|
-
}
|
|
950
|
-
if (_Array$isArray__default["default"](error)) {
|
|
951
|
-
return _reduceInstanceProperty__default["default"](error).call(error, (errorAggregator, currentError) => _objectSpread$7(_objectSpread$7({}, errorAggregator), {}, {
|
|
952
|
-
[currentError]: true
|
|
953
|
-
}), {});
|
|
954
|
-
}
|
|
955
|
-
if (!error) return {};
|
|
956
|
-
return error;
|
|
957
|
-
};
|
|
958
|
-
const updateFieldDependenciesStatus = formik => {
|
|
959
|
-
var _context;
|
|
960
|
-
const updateFields = (fields, path) => {
|
|
961
|
-
_forEachInstanceProperty__default["default"](fields).call(fields, (field, index) => {
|
|
962
|
-
const currentPath = `${path}.fields[${index}]`;
|
|
963
|
-
if (hasDependentFields(field)) {
|
|
964
|
-
formik.setFieldValue(`${currentPath}.isChecked`, isAnyDependentChecked(_valuesInstanceProperty__default["default"](formik).groups, field.dependentGroupNames, field.dependentFieldNames), false);
|
|
965
|
-
}
|
|
966
|
-
if (field.fields) {
|
|
967
|
-
updateFields(field.fields, currentPath);
|
|
968
|
-
}
|
|
969
|
-
});
|
|
970
|
-
};
|
|
971
|
-
_forEachInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](formik).groups).call(_context, (group, index) => {
|
|
972
|
-
updateFields(group.fields, `groups[${index}]`);
|
|
973
|
-
});
|
|
974
|
-
};
|
|
975
|
-
|
|
976
|
-
const useInitialValues = props => {
|
|
977
|
-
var _context;
|
|
978
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
979
|
-
locale: applicationContext.dataLocale,
|
|
980
|
-
userLocale: applicationContext.user?.locale
|
|
981
|
-
})),
|
|
982
|
-
locale = _useApplicationContex.locale,
|
|
983
|
-
userLocale = _useApplicationContex.userLocale;
|
|
984
|
-
const _useApplicationContex2 = applicationShellConnectors.useApplicationContext(context => ({
|
|
985
|
-
projectKey: context.project?.key
|
|
986
|
-
})),
|
|
987
|
-
projectKey = _useApplicationContex2.projectKey;
|
|
988
|
-
const _useStorage = experimentalComponents.useStorage(`${projectKey}/${OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION}`, {}),
|
|
989
|
-
_useStorage2 = _slicedToArray(_useStorage, 1),
|
|
990
|
-
cachedSelectedGroups = _useStorage2[0];
|
|
991
|
-
const _useStorage3 = experimentalComponents.useStorage(`${projectKey}/${OPERATIONS_EXPORT_RESOURCES_MODAL_EXPANDED_GROUP}`, {
|
|
992
|
-
[props.resourceType]: _reduceInstanceProperty__default["default"](_context = props.fieldGroups).call(_context, (acc, group) => {
|
|
993
|
-
acc[group.groupName] = group.isExpanded;
|
|
994
|
-
return acc;
|
|
995
|
-
}, {})
|
|
996
|
-
}),
|
|
997
|
-
_useStorage4 = _slicedToArray(_useStorage3, 1),
|
|
998
|
-
cachedExpandedGroups = _useStorage4[0];
|
|
999
|
-
return React__default["default"].useMemo(() => {
|
|
1000
|
-
let groups = removeEmptyGroups(props.fieldGroups);
|
|
1001
|
-
groups = updateFieldGroupsWithIsCheckedValue(groups, cachedSelectedGroups?.[props.resourceType] || {});
|
|
1002
|
-
groups = updateFieldGroupsWithIsExpandedValue(groups, cachedExpandedGroups?.[props.resourceType] || {});
|
|
1003
|
-
return {
|
|
1004
|
-
outputFormat: props.outputFormat,
|
|
1005
|
-
fileName: `${resourceTypeToFileName(props.resourceType, userLocale)}`,
|
|
1006
|
-
locales: [locale],
|
|
1007
|
-
groups: updateFieldGroupWithAdditionalFieldExtensions(groups),
|
|
1008
|
-
// Preferences
|
|
1009
|
-
fillRows: false
|
|
1010
|
-
};
|
|
1011
|
-
}, [props.fieldGroups, props.resourceType, props.outputFormat, cachedSelectedGroups, cachedExpandedGroups, locale, userLocale]);
|
|
1012
|
-
};
|
|
1013
|
-
|
|
1014
|
-
async function createExportOperation(_ref, asyncDispatchFn) {
|
|
1015
|
-
let projectKey = _ref.projectKey,
|
|
1016
|
-
resourceType = _ref.resourceType,
|
|
1017
|
-
fileName = _ref.fileName,
|
|
1018
|
-
fileFormat = _ref.fileFormat,
|
|
1019
|
-
fields = _ref.fields,
|
|
1020
|
-
locales = _ref.locales,
|
|
1021
|
-
filters = _ref.filters,
|
|
1022
|
-
where = _ref.where,
|
|
1023
|
-
fillRows = _ref.fillRows;
|
|
1024
|
-
const uri = `/${projectKey}/export-operations`;
|
|
1025
|
-
const response = await asyncDispatchFn(sdk.actions.post({
|
|
1026
|
-
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.EXPORT,
|
|
1027
|
-
uri: uri,
|
|
1028
|
-
headers: {
|
|
1029
|
-
accept: 'application/json'
|
|
1030
|
-
},
|
|
1031
|
-
payload: {
|
|
1032
|
-
resourceType,
|
|
1033
|
-
fileName,
|
|
1034
|
-
fileFormat,
|
|
1035
|
-
fields,
|
|
1036
|
-
locales,
|
|
1037
|
-
fillRows,
|
|
1038
|
-
// Query predicate
|
|
1039
|
-
where,
|
|
1040
|
-
// Search API filters or Category API filters
|
|
1041
|
-
filters
|
|
1042
|
-
}
|
|
1043
|
-
}));
|
|
1044
|
-
if (!response || typeof response !== 'object' || !('state' in response)) {
|
|
1045
|
-
throw new InvalidResponseError();
|
|
1046
|
-
}
|
|
1047
|
-
return response;
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
const useStartExportOperation = props => {
|
|
1051
|
-
const intl = reactIntl.useIntl();
|
|
1052
|
-
const asyncDispatch = sdk.useAsyncDispatch();
|
|
1053
|
-
const showNotification = actionsGlobal.useShowNotification();
|
|
1054
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
1055
|
-
locale: applicationContext.dataLocale,
|
|
1056
|
-
projectKey: applicationContext.project?.key
|
|
1057
|
-
})),
|
|
1058
|
-
projectKey = _useApplicationContex.projectKey;
|
|
1059
|
-
const extractFieldNamesFromGroups = groups => {
|
|
1060
|
-
let checkedFields = [];
|
|
1061
|
-
const getCheckedFields = fields => {
|
|
1062
|
-
return _filterInstanceProperty__default["default"](fields).call(fields, field => {
|
|
1063
|
-
if (field.fields) {
|
|
1064
|
-
return getCheckedFields(field.fields);
|
|
1065
|
-
}
|
|
1066
|
-
if (field.isChecked) checkedFields.push(field);
|
|
1067
|
-
return field.isChecked ?? false;
|
|
1068
|
-
});
|
|
1069
|
-
};
|
|
1070
|
-
_forEachInstanceProperty__default["default"](groups).call(groups, group => {
|
|
1071
|
-
getCheckedFields(group.fields);
|
|
1072
|
-
});
|
|
1073
|
-
return sortFieldsByFieldOrder({
|
|
1074
|
-
fieldNames: extractFieldNamesAndAdditionalFieldExtensions(checkedFields),
|
|
1075
|
-
fieldOrder: props.fieldOrder
|
|
1076
|
-
});
|
|
1077
|
-
};
|
|
1078
|
-
const startExportOperation = async (values, exportType) => {
|
|
1079
|
-
try {
|
|
1080
|
-
if (!projectKey) throw new Error('Project key is missing');
|
|
1081
|
-
const fields = extractFieldNamesFromGroups(values.groups);
|
|
1082
|
-
let where = undefined;
|
|
1083
|
-
let filters = undefined;
|
|
1084
|
-
if (exportType === EXPORT_TYPES.SELECTED && props.selectedResourceIds?.length) {
|
|
1085
|
-
where = buildSelectedExportFilters(props.selectedResourceIds);
|
|
1086
|
-
} else if (exportType === EXPORT_TYPES.FILTERED && props.filters) {
|
|
1087
|
-
where = props.filters.where;
|
|
1088
|
-
if (isQueryFilter(props.filters.filters)) {
|
|
1089
|
-
filters = props.filters.filters;
|
|
1090
|
-
} else if (isSearchFilter(props.filters.filters)) {
|
|
1091
|
-
filters = props.filters.filters;
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
const response = await createExportOperation({
|
|
1095
|
-
projectKey,
|
|
1096
|
-
resourceType: props.resourceType,
|
|
1097
|
-
fileName: appendCsvOrJsonExtensionIfAbsent(values.fileName, values.outputFormat),
|
|
1098
|
-
fileFormat: values.outputFormat,
|
|
1099
|
-
locales: values.locales,
|
|
1100
|
-
fillRows: values.fillRows,
|
|
1101
|
-
fields,
|
|
1102
|
-
where,
|
|
1103
|
-
filters
|
|
1104
|
-
}, asyncDispatch);
|
|
1105
|
-
switch (response.state) {
|
|
1106
|
-
case EXPORT_OPERATION_STATES.QUEUED:
|
|
1107
|
-
case EXPORT_OPERATION_STATES.PROCESSING:
|
|
1108
|
-
case EXPORT_OPERATION_STATES.COMPLETED:
|
|
1109
|
-
showNotification({
|
|
1110
|
-
kind: 'info',
|
|
1111
|
-
domain: constants.DOMAINS.SIDE,
|
|
1112
|
-
// @ts-ignore
|
|
1113
|
-
text: intl.formatMessage(messages.exportOperationSuccessMessage, {
|
|
1114
|
-
newline: getNewLine,
|
|
1115
|
-
logsLink: msg => getExportLogsLink(projectKey, msg),
|
|
1116
|
-
b: getBold
|
|
1117
|
-
})
|
|
1118
|
-
}, {
|
|
1119
|
-
dismissAfter: 5000
|
|
1120
|
-
});
|
|
1121
|
-
if (typeof props.onExportSuccess === 'function') props.onExportSuccess();
|
|
1122
|
-
break;
|
|
1123
|
-
default:
|
|
1124
|
-
throw new UnexpectedExportOperationStateError(response.state);
|
|
1125
|
-
}
|
|
1126
|
-
} catch (error) {
|
|
1127
|
-
// TODO: custom error messages for each error type
|
|
1128
|
-
showNotification({
|
|
1129
|
-
text: intl.formatMessage(messages.unexpectedError),
|
|
1130
|
-
kind: 'error',
|
|
1131
|
-
domain: constants.DOMAINS.PAGE
|
|
1132
|
-
});
|
|
1133
|
-
} finally {
|
|
1134
|
-
if (typeof props.onClose === 'function') props.onClose();
|
|
1135
|
-
}
|
|
1136
|
-
};
|
|
1137
|
-
return {
|
|
1138
|
-
startExportOperation
|
|
1139
|
-
};
|
|
1140
|
-
};
|
|
1141
|
-
|
|
1142
|
-
const _excluded$2 = ["fields"];
|
|
1143
|
-
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; }
|
|
1144
|
-
function _objectSpread$6(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$6(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$6(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1145
|
-
const getFieldFullName = _ref => {
|
|
1146
|
-
var _context;
|
|
1147
|
-
let fieldPrefix = _ref.fieldPrefix,
|
|
1148
|
-
fieldName = _ref.fieldName;
|
|
1149
|
-
return _filterInstanceProperty__default["default"](_context = [fieldPrefix, fieldName]).call(_context, Boolean).join('.');
|
|
1150
|
-
};
|
|
1151
|
-
const localizeTypeDefinitionLabels = function () {
|
|
1152
|
-
let fieldDefinitions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1153
|
-
return _mapInstanceProperty__default["default"](fieldDefinitions).call(fieldDefinitions, _ref2 => {
|
|
1154
|
-
let fields = _ref2.fields,
|
|
1155
|
-
fieldsType = _objectWithoutProperties(_ref2, _excluded$2);
|
|
1156
|
-
const isFieldTypeLabelLocalized = _Array$isArray__default["default"](fieldsType.label);
|
|
1157
|
-
return {
|
|
1158
|
-
name: fieldsType.name,
|
|
1159
|
-
label: isFieldTypeLabelLocalized ? l10n.applyTransformedLocalizedFields(fieldsType, [{
|
|
1160
|
-
from: 'label',
|
|
1161
|
-
to: 'label'
|
|
1162
|
-
}]).label : fieldsType.label,
|
|
1163
|
-
fields: fields?.map(field => {
|
|
1164
|
-
const isFieldLabelLocalized = _Array$isArray__default["default"](field.label);
|
|
1165
|
-
if (!isFieldLabelLocalized) {
|
|
1166
|
-
return field;
|
|
1167
|
-
}
|
|
1168
|
-
return _objectSpread$6({}, l10n.applyTransformedLocalizedFields(field, [{
|
|
1169
|
-
from: 'label',
|
|
1170
|
-
to: 'label'
|
|
1171
|
-
}]));
|
|
1172
|
-
}) || []
|
|
1173
|
-
};
|
|
1174
|
-
});
|
|
1175
|
-
};
|
|
1176
|
-
const useConvertFieldDefinitionsForExport = () => {
|
|
1177
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
1178
|
-
language: applicationContext.dataLocale,
|
|
1179
|
-
languages: applicationContext.project?.languages
|
|
1180
|
-
})),
|
|
1181
|
-
language = _useApplicationContex.language,
|
|
1182
|
-
languages = _useApplicationContex.languages;
|
|
1183
|
-
const sortByField = (fields, fieldName) => {
|
|
1184
|
-
if (!fields) return [];
|
|
1185
|
-
if (fieldName) {
|
|
1186
|
-
return sortBy__default["default"](fields, field => {
|
|
1187
|
-
return field[fieldName]?.toLowerCase();
|
|
1188
|
-
});
|
|
1189
|
-
}
|
|
1190
|
-
return fields;
|
|
1191
|
-
};
|
|
1192
|
-
const convertFieldDefinitionsForExport = _ref3 => {
|
|
1193
|
-
let fieldDefinitions = _ref3.fieldDefinitions,
|
|
1194
|
-
fieldPrefix = _ref3.fieldPrefix,
|
|
1195
|
-
_ref3$expandAll = _ref3.expandAll,
|
|
1196
|
-
expandAll = _ref3$expandAll === void 0 ? false : _ref3$expandAll,
|
|
1197
|
-
sortField = _ref3.sortField;
|
|
1198
|
-
if (!fieldDefinitions) return [];
|
|
1199
|
-
const localizedTypeDefinitions = localizeTypeDefinitionLabels(fieldDefinitions);
|
|
1200
|
-
const results = _mapInstanceProperty__default["default"](localizedTypeDefinitions).call(localizedTypeDefinitions, transformedType => {
|
|
1201
|
-
const isTypeLabelLocalized = typeof transformedType.label !== 'string';
|
|
1202
|
-
return {
|
|
1203
|
-
isExpandable: true,
|
|
1204
|
-
isExpanded: expandAll,
|
|
1205
|
-
name: transformedType.name,
|
|
1206
|
-
label: isTypeLabelLocalized ? l10n.formatLocalizedString({
|
|
1207
|
-
label: transformedType.label
|
|
1208
|
-
}, {
|
|
1209
|
-
key: 'label',
|
|
1210
|
-
locale: language,
|
|
1211
|
-
fallbackOrder: languages,
|
|
1212
|
-
fallback: transformedType.name
|
|
1213
|
-
}) : transformedType.label,
|
|
1214
|
-
fields: sortByField(transformedType.fields?.map(fieldDefinition => {
|
|
1215
|
-
const isFieldLabelLocalized = typeof fieldDefinition.label !== 'string';
|
|
1216
|
-
return {
|
|
1217
|
-
name: getFieldFullName({
|
|
1218
|
-
fieldPrefix: fieldPrefix,
|
|
1219
|
-
fieldName: fieldDefinition.name
|
|
1220
|
-
}),
|
|
1221
|
-
label: isFieldLabelLocalized ? l10n.formatLocalizedString({
|
|
1222
|
-
label: fieldDefinition.label
|
|
1223
|
-
}, {
|
|
1224
|
-
key: 'label',
|
|
1225
|
-
locale: language,
|
|
1226
|
-
fallbackOrder: languages,
|
|
1227
|
-
fallback: fieldDefinition.name
|
|
1228
|
-
}) : fieldDefinition.label,
|
|
1229
|
-
extendedFieldNames: fieldDefinition.extendedFieldNames
|
|
1230
|
-
};
|
|
1231
|
-
}), sortField)
|
|
1232
|
-
};
|
|
1233
|
-
});
|
|
1234
|
-
return sortByField(results, sortField);
|
|
1235
|
-
};
|
|
1236
|
-
return {
|
|
1237
|
-
convertFieldDefinitionsForExport
|
|
1238
|
-
};
|
|
1239
|
-
};
|
|
1240
|
-
|
|
1241
|
-
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; }
|
|
1242
|
-
function _objectSpread$5(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$5(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$5(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1243
|
-
const OrderPreferences = () => {
|
|
1244
|
-
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
1245
|
-
formik = _useExportResourcesMo.formik;
|
|
1246
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1247
|
-
children: jsxRuntime.jsx(uiKit.CheckboxInput, {
|
|
1248
|
-
isChecked: _valuesInstanceProperty__default["default"](formik).fillRows,
|
|
1249
|
-
onChange: e => {
|
|
1250
|
-
formik.setFieldValue('fillRows', e.target.checked);
|
|
1251
|
-
},
|
|
1252
|
-
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$5({}, messages.fillRowsForOrderExport))
|
|
1253
|
-
})
|
|
1254
|
-
});
|
|
1255
|
-
};
|
|
1256
|
-
const ProductPreferences = () => {
|
|
1257
|
-
const _useExportResourcesMo2 = useExportResourcesModalContext(),
|
|
1258
|
-
formik = _useExportResourcesMo2.formik;
|
|
1259
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1260
|
-
children: jsxRuntime.jsx(uiKit.CheckboxInput, {
|
|
1261
|
-
isChecked: _valuesInstanceProperty__default["default"](formik).fillRows,
|
|
1262
|
-
onChange: e => {
|
|
1263
|
-
formik.setFieldValue('fillRows', e.target.checked);
|
|
1264
|
-
},
|
|
1265
|
-
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$5({}, messages.fillRowsForProductExport))
|
|
1266
|
-
})
|
|
1267
|
-
});
|
|
1268
|
-
};
|
|
1269
|
-
const ExportPreferenceSection = () => {
|
|
1270
|
-
const _useExportResourcesMo3 = useExportResourcesModalContext(),
|
|
1271
|
-
resourceType = _useExportResourcesMo3.resourceType;
|
|
1272
|
-
if (resourceType === 'order') {
|
|
1273
|
-
return jsxRuntime.jsx(OrderPreferences, {});
|
|
1274
|
-
}
|
|
1275
|
-
if (resourceType === 'product') {
|
|
1276
|
-
return jsxRuntime.jsx(ProductPreferences, {});
|
|
1277
|
-
}
|
|
1278
|
-
return null;
|
|
1279
|
-
};
|
|
1280
|
-
|
|
1281
|
-
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; }
|
|
1282
|
-
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; }
|
|
1283
|
-
function ExportScopeSection() {
|
|
1284
|
-
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
1285
|
-
exportType = _useExportResourcesMo.exportType,
|
|
1286
|
-
totalResourcesCount = _useExportResourcesMo.totalResourcesCount,
|
|
1287
|
-
filters = _useExportResourcesMo.filters,
|
|
1288
|
-
hasFilters = _useExportResourcesMo.hasFilters,
|
|
1289
|
-
selectedResourceIds = _useExportResourcesMo.selectedResourceIds,
|
|
1290
|
-
setExportType = _useExportResourcesMo.setExportType,
|
|
1291
|
-
resourceType = _useExportResourcesMo.resourceType,
|
|
1292
|
-
hideExportSelectedResourcesOption = _useExportResourcesMo.hideExportSelectedResourcesOption;
|
|
1293
|
-
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
1294
|
-
scale: "m",
|
|
1295
|
-
children: jsxRuntime.jsxs(uiKit.RadioInput.Group, {
|
|
1296
|
-
value: exportType,
|
|
1297
|
-
onChange: e => {
|
|
1298
|
-
setExportType(e.target.value);
|
|
1299
|
-
},
|
|
1300
|
-
direction: "stack",
|
|
1301
|
-
directionProps: {
|
|
1302
|
-
scale: 's'
|
|
1303
|
-
},
|
|
1304
|
-
children: [jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
1305
|
-
value: EXPORT_TYPES.ALL,
|
|
1306
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1307
|
-
intlMessage: _objectSpread$4(_objectSpread$4({}, resourceTypeMessages[resourceType].exportScopeAll), {}, {
|
|
1308
|
-
values: {
|
|
1309
|
-
total: totalResourcesCount
|
|
1310
|
-
}
|
|
1311
|
-
})
|
|
1312
|
-
})
|
|
1313
|
-
}), filters && jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
1314
|
-
value: EXPORT_TYPES.FILTERED,
|
|
1315
|
-
isDisabled: !filters.total || !hasFilters,
|
|
1316
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1317
|
-
tone: !filters.total || !hasFilters ? 'tertiary' : undefined,
|
|
1318
|
-
intlMessage: filters.total ? _objectSpread$4(_objectSpread$4({}, resourceTypeMessages[resourceType].exportScopeFiltered), {}, {
|
|
1319
|
-
values: {
|
|
1320
|
-
total: filters.total
|
|
1321
|
-
}
|
|
1322
|
-
}) : messages.exportScopeFilteredWithoutCount
|
|
1323
|
-
})
|
|
1324
|
-
}), !hideExportSelectedResourcesOption && jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
1325
|
-
value: EXPORT_TYPES.SELECTED,
|
|
1326
|
-
isDisabled: !selectedResourceIds?.length,
|
|
1327
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1328
|
-
tone: !selectedResourceIds?.length ? 'tertiary' : undefined,
|
|
1329
|
-
intlMessage: selectedResourceIds?.length ? _objectSpread$4(_objectSpread$4({}, resourceTypeMessages[resourceType].exportScopeSelected), {}, {
|
|
1330
|
-
values: {
|
|
1331
|
-
total: selectedResourceIds.length
|
|
1332
|
-
}
|
|
1333
|
-
}) : messages.exportScopeSelectedWithoutCount
|
|
1334
|
-
})
|
|
1335
|
-
})]
|
|
1336
|
-
})
|
|
1337
|
-
});
|
|
1338
|
-
}
|
|
1339
|
-
|
|
1340
|
-
const ExportFileSettingsStep = () => {
|
|
1341
|
-
var _context;
|
|
1342
|
-
const intl = reactIntl.useIntl();
|
|
1343
|
-
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
1344
|
-
formik = _useExportResourcesMo.formik,
|
|
1345
|
-
resourceType = _useExportResourcesMo.resourceType,
|
|
1346
|
-
onClose = _useExportResourcesMo.onClose;
|
|
1347
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
1348
|
-
locale: applicationContext.dataLocale,
|
|
1349
|
-
locales: applicationContext.project?.languages || []
|
|
1350
|
-
})),
|
|
1351
|
-
locales = _useApplicationContex.locales,
|
|
1352
|
-
locale = _useApplicationContex.locale;
|
|
1353
|
-
const areAllLocalesChecked = _valuesInstanceProperty__default["default"](formik).locales.length === locales.length;
|
|
1354
|
-
// TODO: make this dynamic based on the resource type & output format (more scalable)
|
|
1355
|
-
const shouldShowPreferences = _includesInstanceProperty__default["default"](_context = ['order', 'product']).call(_context, resourceType) && _valuesInstanceProperty__default["default"](formik).outputFormat === 'csv';
|
|
1356
|
-
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
1357
|
-
isOpen: true,
|
|
1358
|
-
title: intl.formatMessage(messages[`modalTitle.${resourceType}`]),
|
|
1359
|
-
labelPrimary: intl.formatMessage(messages.continue),
|
|
1360
|
-
onPrimaryButtonClick: formik.submitForm,
|
|
1361
|
-
isPrimaryButtonDisabled: !formik.isValid,
|
|
1362
|
-
onSecondaryButtonClick: onClose,
|
|
1363
|
-
onClose: onClose,
|
|
1364
|
-
size: 16,
|
|
1365
|
-
children: jsxRuntime.jsx(fullstory.Masking.Unmask, {
|
|
1366
|
-
children: jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
1367
|
-
scale: "xxxl",
|
|
1368
|
-
children: jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
1369
|
-
scale: "l",
|
|
1370
|
-
children: jsxRuntime.jsxs(uiKit.Grid, {
|
|
1371
|
-
gridRowGap: uiKit.designTokens.spacingL,
|
|
1372
|
-
gridTemplateColumns: `calc(${uiKit.designTokens.constraint3} + ${uiKit.designTokens.spacingL}) auto`,
|
|
1373
|
-
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1374
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1375
|
-
intlMessage: messages.exportScope
|
|
1376
|
-
})
|
|
1377
|
-
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1378
|
-
children: jsxRuntime.jsx(ExportScopeSection, {})
|
|
1379
|
-
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1380
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1381
|
-
intlMessage: messages.exportSettings
|
|
1382
|
-
})
|
|
1383
|
-
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1384
|
-
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1385
|
-
scale: "m",
|
|
1386
|
-
children: [jsxRuntime.jsx(uiKit.SelectField, {
|
|
1387
|
-
name: "outputFormat",
|
|
1388
|
-
onChange: formik.handleChange,
|
|
1389
|
-
onBlur: formik.handleBlur,
|
|
1390
|
-
value: _valuesInstanceProperty__default["default"](formik).outputFormat,
|
|
1391
|
-
title: intl.formatMessage(messages.outputFormat),
|
|
1392
|
-
options: OUTPUT_FORMAT_OPTIONS
|
|
1393
|
-
}), jsxRuntime.jsx(fullstory.Masking.Mask, {
|
|
1394
|
-
children: jsxRuntime.jsx(uiKit.TextField, {
|
|
1395
|
-
name: "fileName",
|
|
1396
|
-
onChange: formik.handleChange,
|
|
1397
|
-
onBlur: formik.handleBlur,
|
|
1398
|
-
value: _valuesInstanceProperty__default["default"](formik).fileName,
|
|
1399
|
-
title: intl.formatMessage(messages.fileName),
|
|
1400
|
-
touched: formik.touched.fileName,
|
|
1401
|
-
errors: mapFormikErrors(formik.errors.fileName),
|
|
1402
|
-
renderError: renderFileNameError
|
|
1403
|
-
})
|
|
1404
|
-
}), jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1405
|
-
scale: "xs",
|
|
1406
|
-
children: [jsxRuntime.jsx(uiKit.SelectField, {
|
|
1407
|
-
id: "locales",
|
|
1408
|
-
name: "locales",
|
|
1409
|
-
value: _valuesInstanceProperty__default["default"](formik).locales,
|
|
1410
|
-
title: intl.formatMessage(messages.locale),
|
|
1411
|
-
options: mapLocalesToOptions(locales),
|
|
1412
|
-
isMulti: true,
|
|
1413
|
-
onChange: formik.handleChange,
|
|
1414
|
-
onBlur: formik.handleBlur,
|
|
1415
|
-
touched: formik.touched.locales,
|
|
1416
|
-
errors: mapFormikErrors(formik.errors.locales),
|
|
1417
|
-
renderError: renderLocaleError,
|
|
1418
|
-
menuPortalTarget: document.body,
|
|
1419
|
-
menuPortalZIndex: Z_INDEX_DROPDOWN
|
|
1420
|
-
}), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1421
|
-
scale: "s",
|
|
1422
|
-
alignItems: "center",
|
|
1423
|
-
children: [jsxRuntime.jsx(uiKit.ToggleInput, {
|
|
1424
|
-
"data-testid": "include-all-locales-toggle-input",
|
|
1425
|
-
size: "small",
|
|
1426
|
-
isChecked: areAllLocalesChecked,
|
|
1427
|
-
onChange: e => {
|
|
1428
|
-
if (e.target.checked) formik.setFieldValue('locales', locales);else formik.setFieldValue('locales', [locale]);
|
|
1429
|
-
}
|
|
1430
|
-
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1431
|
-
intlMessage: messages.includeAllLocales
|
|
1432
|
-
})]
|
|
1433
|
-
})]
|
|
1434
|
-
})]
|
|
1435
|
-
})
|
|
1436
|
-
}), shouldShowPreferences && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1437
|
-
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1438
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1439
|
-
intlMessage: messages.exportPreferences
|
|
1440
|
-
})
|
|
1441
|
-
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1442
|
-
children: jsxRuntime.jsx(ExportPreferenceSection, {})
|
|
1443
|
-
})]
|
|
1444
|
-
})]
|
|
1445
|
-
})
|
|
1446
|
-
})
|
|
1447
|
-
})
|
|
1448
|
-
})
|
|
1449
|
-
});
|
|
1450
|
-
};
|
|
1451
|
-
|
|
1452
|
-
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; }
|
|
1453
|
-
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$3(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$3(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1454
|
-
const exportFieldSelectionContextDefaultValues = {
|
|
1455
|
-
updateExpandedGroups: (_name, _value) => {}
|
|
1456
|
-
};
|
|
1457
|
-
const ExportFieldSelectionContext = /*#__PURE__*/React.createContext(exportFieldSelectionContextDefaultValues);
|
|
1458
|
-
const ExportFieldSelectionProvider = _ref => {
|
|
1459
|
-
let resourceType = _ref.resourceType,
|
|
1460
|
-
children = _ref.children;
|
|
1461
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
1462
|
-
projectKey: context.project?.key
|
|
1463
|
-
})),
|
|
1464
|
-
projectKey = _useApplicationContex.projectKey;
|
|
1465
|
-
const _useStorage = experimentalComponents.useStorage(`${projectKey}/${OPERATIONS_EXPORT_RESOURCES_MODAL_EXPANDED_GROUP}`, {}),
|
|
1466
|
-
_useStorage2 = _slicedToArray(_useStorage, 2),
|
|
1467
|
-
cachedExpandedGroups = _useStorage2[0],
|
|
1468
|
-
setCachedExpandedGroups = _useStorage2[1];
|
|
1469
|
-
const updateExpandedGroups = React.useCallback((name, value) => {
|
|
1470
|
-
setCachedExpandedGroups({
|
|
1471
|
-
[resourceType]: _objectSpread$3(_objectSpread$3({}, cachedExpandedGroups?.[resourceType] || {}), {}, {
|
|
1472
|
-
[name]: value
|
|
1473
|
-
})
|
|
1474
|
-
});
|
|
1475
|
-
}, [cachedExpandedGroups, resourceType, setCachedExpandedGroups]);
|
|
1476
|
-
return jsxRuntime.jsx(ExportFieldSelectionContext.Provider, {
|
|
1477
|
-
value: {
|
|
1478
|
-
updateExpandedGroups
|
|
1479
|
-
},
|
|
1480
|
-
children: children
|
|
1481
|
-
});
|
|
1482
|
-
};
|
|
1483
|
-
const useExportFieldSelectionContext = () => {
|
|
1484
|
-
return React.useContext(ExportFieldSelectionContext);
|
|
1485
|
-
};
|
|
1486
|
-
|
|
1487
|
-
const FieldsCountStamp = _ref => {
|
|
1488
|
-
let count = _ref.count;
|
|
1489
|
-
const _useIntl = reactIntl.useIntl(),
|
|
1490
|
-
formatMessage = _useIntl.formatMessage;
|
|
1491
|
-
return jsxRuntime.jsx(uiKit.Stamp, {
|
|
1492
|
-
tone: "information",
|
|
1493
|
-
isCondensed: true,
|
|
1494
|
-
label: formatMessage(messages.itemCount, {
|
|
1495
|
-
count
|
|
1496
|
-
})
|
|
1497
|
-
});
|
|
1498
|
-
};
|
|
1499
|
-
|
|
1500
|
-
const FieldWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1501
|
-
target: "e1judmlm0"
|
|
1502
|
-
} )({
|
|
1503
|
-
name: "9iujih",
|
|
1504
|
-
styles: "position:relative;display:flex;align-items:center"
|
|
1505
|
-
} );
|
|
1506
|
-
const CollapsibleFieldWrapper = _ref => {
|
|
1507
|
-
let isForceExpanded = _ref.isForceExpanded,
|
|
1508
|
-
field = _ref.field,
|
|
1509
|
-
children = _ref.children;
|
|
1510
|
-
if (field.isExpandable) return jsxRuntime.jsx(uiKit.CollapsibleMotion, {
|
|
1511
|
-
isDefaultClosed: isForceExpanded ? false : !field.isExpanded,
|
|
1512
|
-
children: _ref2 => {
|
|
1513
|
-
let isOpen = _ref2.isOpen,
|
|
1514
|
-
toggle = _ref2.toggle,
|
|
1515
|
-
registerContentNode = _ref2.registerContentNode;
|
|
1516
|
-
return children({
|
|
1517
|
-
isOpen,
|
|
1518
|
-
toggle,
|
|
1519
|
-
registerContentNode
|
|
1520
|
-
});
|
|
1521
|
-
}
|
|
1522
|
-
}, `${isForceExpanded}`);
|
|
1523
|
-
return children({
|
|
1524
|
-
isOpen: true,
|
|
1525
|
-
toggle: () => {},
|
|
1526
|
-
registerContentNode: () => {}
|
|
1527
|
-
});
|
|
1528
|
-
};
|
|
1529
|
-
const FieldSection = _ref3 => {
|
|
1530
|
-
let fields = _ref3.fields,
|
|
1531
|
-
parentKeys = _ref3.parentKeys,
|
|
1532
|
-
formik = _ref3.formik,
|
|
1533
|
-
isAnySiblingChecked = _ref3.isAnySiblingChecked,
|
|
1534
|
-
isSearchActive = _ref3.isSearchActive,
|
|
1535
|
-
groupName = _ref3.groupName,
|
|
1536
|
-
maxVisibleChildren = _ref3.maxVisibleChildren;
|
|
1537
|
-
const _useExportFieldSelect = useExportFieldSelectionContext(),
|
|
1538
|
-
updateExpandedGroups = _useExportFieldSelect.updateExpandedGroups;
|
|
1539
|
-
const visibleFields = isSearchActive || !maxVisibleChildren ? fields : fields?.slice(0, maxVisibleChildren);
|
|
1540
|
-
const hasMoreFields = maxVisibleChildren && !isSearchActive && fields && fields.length > maxVisibleChildren;
|
|
1541
|
-
const visibleIndex = field => fields?.filter(f => !f.isHidden).indexOf(field) || -1;
|
|
1542
|
-
const shouldDisplayField = field => {
|
|
1543
|
-
if (field.isHidden) return false;
|
|
1544
|
-
if (!maxVisibleChildren) return true;
|
|
1545
|
-
return maxVisibleChildren && visibleIndex(field) < maxVisibleChildren;
|
|
1546
|
-
};
|
|
1547
|
-
const shouldDisplayChildrenCount = field => {
|
|
1548
|
-
return Boolean(field.maxVisibleChildren);
|
|
1549
|
-
};
|
|
1550
|
-
return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1551
|
-
scale: "s",
|
|
1552
|
-
children: [visibleFields?.map((field, index) => {
|
|
1553
|
-
const isChildrenCountDisplayed = shouldDisplayChildrenCount(field);
|
|
1554
|
-
const hasDependents = Boolean(field.dependentGroupNames?.length || field.dependentFieldNames?.length);
|
|
1555
|
-
const isAnyOfTheChildFieldsChecked = isAnyFieldChecked(field.fields || []);
|
|
1556
|
-
const allFieldsChecked = areAllFieldsChecked(field.fields || []);
|
|
1557
|
-
const getIsChecked = () => {
|
|
1558
|
-
const isParent = Boolean(field.fields && field.fields?.length > 0);
|
|
1559
|
-
if (isParent) return areAllFieldsChecked(field.fields);
|
|
1560
|
-
return field.isChecked;
|
|
1561
|
-
};
|
|
1562
|
-
if (!shouldDisplayField(field)) return null;
|
|
1563
|
-
return jsxRuntime.jsx(CollapsibleFieldWrapper, {
|
|
1564
|
-
isForceExpanded: isSearchActive,
|
|
1565
|
-
field: field,
|
|
1566
|
-
children: _ref4 => {
|
|
1567
|
-
let isOpen = _ref4.isOpen,
|
|
1568
|
-
toggle = _ref4.toggle,
|
|
1569
|
-
registerContentNode = _ref4.registerContentNode;
|
|
1570
|
-
return jsxRuntime.jsxs(React.Fragment, {
|
|
1571
|
-
children: [jsxRuntime.jsxs(FieldWrapper, {
|
|
1572
|
-
children: [field.isExpandable && jsxRuntime.jsx(uiKit.IconButton, {
|
|
1573
|
-
size: "20",
|
|
1574
|
-
style: {
|
|
1575
|
-
position: 'absolute',
|
|
1576
|
-
left: `calc(-1 * ${uiKit.designTokens.spacingXl})`
|
|
1577
|
-
},
|
|
1578
|
-
onClick: () => {
|
|
1579
|
-
if (!isSearchActive) {
|
|
1580
|
-
updateExpandedGroups(`${groupName}.${field.name}`, !isOpen);
|
|
1581
|
-
}
|
|
1582
|
-
toggle();
|
|
1583
|
-
},
|
|
1584
|
-
icon: isOpen ? jsxRuntime.jsx(uiKit.AngleDownIcon, {}) : jsxRuntime.jsx(uiKit.AngleRightIcon, {}),
|
|
1585
|
-
label: ""
|
|
1586
|
-
}), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1587
|
-
scale: "s",
|
|
1588
|
-
alignItems: "center",
|
|
1589
|
-
children: [jsxRuntime.jsxs(uiKit.CheckboxInput, {
|
|
1590
|
-
isIndeterminate: field.isExpandable && !allFieldsChecked && isAnyOfTheChildFieldsChecked,
|
|
1591
|
-
isChecked: getIsChecked(),
|
|
1592
|
-
isReadOnly: hasDependents || field.isRequired,
|
|
1593
|
-
onChange: e => {
|
|
1594
|
-
const path = `${parentKeys.join('.')}.fields[${index}]`;
|
|
1595
|
-
const checked = e.target.checked;
|
|
1596
|
-
// Update all child fields
|
|
1597
|
-
const updateAllChildFieldsChecked = (path, checked) => {
|
|
1598
|
-
const item = get__default["default"](_valuesInstanceProperty__default["default"](formik), path);
|
|
1599
|
-
if (item && item.fields) {
|
|
1600
|
-
var _context;
|
|
1601
|
-
_forEachInstanceProperty__default["default"](_context = item.fields).call(_context, (field, i) => {
|
|
1602
|
-
const fieldPath = `${path}.fields[${i}]`;
|
|
1603
|
-
if (!field.fields?.length) {
|
|
1604
|
-
formik.setFieldValue(`${fieldPath}.isChecked`, checked || field.isRequired,
|
|
1605
|
-
// pass `false` to avoid revalidating the form with intermediate values
|
|
1606
|
-
false);
|
|
1607
|
-
}
|
|
1608
|
-
updateAllChildFieldsChecked(fieldPath, checked);
|
|
1609
|
-
});
|
|
1610
|
-
}
|
|
1611
|
-
};
|
|
1612
|
-
if (!field.fields?.length) {
|
|
1613
|
-
formik.setFieldValue(`${path}.isChecked`, checked || field.isRequired,
|
|
1614
|
-
// pass `false` to avoid revalidating the form with intermediate values
|
|
1615
|
-
false);
|
|
1616
|
-
}
|
|
1617
|
-
updateAllChildFieldsChecked(path, checked);
|
|
1618
|
-
},
|
|
1619
|
-
children: [field.label, (hasDependents || field.isRequired) && ' *']
|
|
1620
|
-
}), isChildrenCountDisplayed && field.fields && field.fields.length > 0 && jsxRuntime.jsx("div", {
|
|
1621
|
-
style: {
|
|
1622
|
-
flex: '0 0 auto'
|
|
1623
|
-
},
|
|
1624
|
-
children: jsxRuntime.jsx(FieldsCountStamp, {
|
|
1625
|
-
count: field.fields.length
|
|
1626
|
-
})
|
|
1627
|
-
})]
|
|
1628
|
-
})]
|
|
1629
|
-
}), field.fields && field.fields.length > 0 && jsxRuntime.jsx(StyledExpandableContent, {
|
|
1630
|
-
ref: registerContentNode,
|
|
1631
|
-
isOpen: isOpen,
|
|
1632
|
-
children: isOpen && jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1633
|
-
scale: "xl",
|
|
1634
|
-
children: [jsxRuntime.jsx("div", {}), jsxRuntime.jsx(FieldSection, {
|
|
1635
|
-
fields: field.fields,
|
|
1636
|
-
maxVisibleChildren: field.maxVisibleChildren,
|
|
1637
|
-
formik: formik,
|
|
1638
|
-
parentKeys: [...parentKeys, `fields[${index}]`],
|
|
1639
|
-
isAnySiblingChecked: isAnySiblingChecked,
|
|
1640
|
-
isSearchActive: isSearchActive,
|
|
1641
|
-
groupName: groupName
|
|
1642
|
-
})]
|
|
1643
|
-
})
|
|
1644
|
-
})]
|
|
1645
|
-
}, `${field.name}-${index}`);
|
|
1646
|
-
}
|
|
1647
|
-
}, `${field.name}.${isSearchActive}`);
|
|
1648
|
-
}), hasMoreFields && jsxRuntime.jsx("div", {
|
|
1649
|
-
css: /*#__PURE__*/react.css("padding-left:", uiKit.designTokens.spacingXs, ";" + ("" ), "" ),
|
|
1650
|
-
children: jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
1651
|
-
tone: "tertiary",
|
|
1652
|
-
intlMessage: messages.loadMoreFields
|
|
1653
|
-
})
|
|
1654
|
-
})]
|
|
1655
|
-
});
|
|
1656
|
-
};
|
|
1657
|
-
|
|
1658
|
-
const SelectedGroupFieldsCountStamp = _ref => {
|
|
1659
|
-
let group = _ref.group;
|
|
1660
|
-
const _useIntl = reactIntl.useIntl(),
|
|
1661
|
-
formatMessage = _useIntl.formatMessage;
|
|
1662
|
-
return jsxRuntime.jsx(uiKit.Card, {
|
|
1663
|
-
type: "flat",
|
|
1664
|
-
insetScale: "m",
|
|
1665
|
-
children: jsxRuntime.jsx(uiKit.Spacings.Inline, {
|
|
1666
|
-
justifyContent: "flex-end",
|
|
1667
|
-
children: jsxRuntime.jsx(uiKit.Stamp, {
|
|
1668
|
-
tone: "secondary",
|
|
1669
|
-
isCondensed: true,
|
|
1670
|
-
label: formatMessage(messages.selected, {
|
|
1671
|
-
total: getGroupSelectedFieldCount(group)
|
|
1672
|
-
})
|
|
1673
|
-
})
|
|
1674
|
-
})
|
|
1675
|
-
});
|
|
1676
|
-
};
|
|
1677
|
-
|
|
1678
|
-
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; }
|
|
1679
|
-
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; }
|
|
1680
|
-
const StyledGroupCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
1681
|
-
target: "e1igkh7t2"
|
|
1682
|
-
} )("height:100%;border-radius:0;", props => props.showTopBorder && /*#__PURE__*/react.css("border-top:", uiKit.designTokens.borderWidth1, " solid ", uiKit.designTokens.colorNeutral90, ";" + ("" ), "" ), ";" + ("" ));
|
|
1683
|
-
const StyledFieldsCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
1684
|
-
target: "e1igkh7t1"
|
|
1685
|
-
} )("border-radius:0;", props => props.showTopBorder && /*#__PURE__*/react.css("border-top:", uiKit.designTokens.borderWidth1, " solid ", uiKit.designTokens.colorNeutral90, ";" + ("" ), "" ), ";" + ("" ));
|
|
1686
|
-
var _ref$1 = {
|
|
1687
|
-
name: "2ce4ng",
|
|
1688
|
-
styles: "overflow:hidden;height:0;margin-top:0!important"
|
|
1689
|
-
} ;
|
|
1690
|
-
const StyledExpandableContent = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1691
|
-
target: "e1igkh7t0"
|
|
1692
|
-
} )(props => !props.isOpen && _ref$1, " ", props => !props.isOpen && props.showTopBorder && /*#__PURE__*/react.css("border-top:", uiKit.designTokens.borderWidth1, " solid ", uiKit.designTokens.colorNeutral90, ";" + ("" ), "" ), ";" + ("" ));
|
|
1693
|
-
const FieldGroupSection = _ref2 => {
|
|
1694
|
-
let group = _ref2.group,
|
|
1695
|
-
index = _ref2.index,
|
|
1696
|
-
formik = _ref2.formik,
|
|
1697
|
-
isSearchActive = _ref2.isSearchActive;
|
|
1698
|
-
const allFieldsChecked = React.useMemo(() => areAllFieldsChecked(group.fields), [group.fields]);
|
|
1699
|
-
const isAnyFieldInGroupChecked = React.useMemo(() => isAnyFieldChecked(group.fields), [group.fields]);
|
|
1700
|
-
const _useExportFieldSelect = useExportFieldSelectionContext(),
|
|
1701
|
-
updateExpandedGroups = _useExportFieldSelect.updateExpandedGroups;
|
|
1702
|
-
const parentKey = `groups[${index}]`;
|
|
1703
|
-
const handleChangeAllFields = e => {
|
|
1704
|
-
const item = get__default["default"](_valuesInstanceProperty__default["default"](formik), parentKey);
|
|
1705
|
-
function updateAllFields(fields, checked) {
|
|
1706
|
-
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
1707
|
-
if (field.fields) {
|
|
1708
|
-
return _objectSpread$2(_objectSpread$2({}, field), {}, {
|
|
1709
|
-
fields: updateAllFields(field.fields, checked)
|
|
1710
|
-
});
|
|
1711
|
-
}
|
|
1712
|
-
if (field.isRequired) return field;
|
|
1713
|
-
return _objectSpread$2(_objectSpread$2({}, field), {}, {
|
|
1714
|
-
isChecked: checked
|
|
1715
|
-
});
|
|
1716
|
-
});
|
|
1717
|
-
}
|
|
1718
|
-
formik.setFieldValue(parentKey, _objectSpread$2(_objectSpread$2({}, item), {}, {
|
|
1719
|
-
fields: updateAllFields(item.fields, e.target.checked)
|
|
1720
|
-
}));
|
|
1721
|
-
};
|
|
1722
|
-
if (group.isHidden) return null;
|
|
1723
|
-
return jsxRuntime.jsx(uiKit.CollapsibleMotion, {
|
|
1724
|
-
isDefaultClosed: isSearchActive ? false : !group.isExpanded
|
|
1725
|
-
// Reset collapse state when search input becomes active/inactive
|
|
1726
|
-
,
|
|
1727
|
-
children: _ref3 => {
|
|
1728
|
-
let isOpen = _ref3.isOpen,
|
|
1729
|
-
toggle = _ref3.toggle,
|
|
1730
|
-
registerContentNode = _ref3.registerContentNode;
|
|
1731
|
-
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1732
|
-
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1733
|
-
children: jsxRuntime.jsx(StyledGroupCard, {
|
|
1734
|
-
type: "flat",
|
|
1735
|
-
insetScale: "m",
|
|
1736
|
-
showTopBorder: index > 0,
|
|
1737
|
-
children: jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1738
|
-
scale: "s",
|
|
1739
|
-
alignItems: "center",
|
|
1740
|
-
children: [jsxRuntime.jsx(uiKit.IconButton, {
|
|
1741
|
-
size: "20",
|
|
1742
|
-
onClick: () => {
|
|
1743
|
-
if (!isSearchActive) {
|
|
1744
|
-
updateExpandedGroups(group.groupName, !isOpen);
|
|
1745
|
-
}
|
|
1746
|
-
toggle();
|
|
1747
|
-
},
|
|
1748
|
-
icon: isOpen ? jsxRuntime.jsx(uiKit.AngleDownIcon, {}) : jsxRuntime.jsx(uiKit.AngleRightIcon, {}),
|
|
1749
|
-
label: ""
|
|
1750
|
-
}), jsxRuntime.jsx(uiKit.CheckboxInput, {
|
|
1751
|
-
isIndeterminate: !allFieldsChecked && isAnyFieldInGroupChecked,
|
|
1752
|
-
isChecked: allFieldsChecked,
|
|
1753
|
-
onChange: handleChangeAllFields,
|
|
1754
|
-
children: group.groupLabel
|
|
1755
|
-
})]
|
|
1756
|
-
})
|
|
1757
|
-
})
|
|
1758
|
-
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1759
|
-
children: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1760
|
-
children: [jsxRuntime.jsx(StyledExpandableContent, {
|
|
1761
|
-
ref: registerContentNode,
|
|
1762
|
-
isOpen: isOpen,
|
|
1763
|
-
showTopBorder: index > 0,
|
|
1764
|
-
children: jsxRuntime.jsx(StyledFieldsCard, {
|
|
1765
|
-
type: "flat",
|
|
1766
|
-
insetScale: "m",
|
|
1767
|
-
showTopBorder: true,
|
|
1768
|
-
children: isOpen && jsxRuntime.jsx(FieldSection, {
|
|
1769
|
-
fields: group.fields,
|
|
1770
|
-
formik: formik,
|
|
1771
|
-
parentKeys: [parentKey],
|
|
1772
|
-
isAnySiblingChecked: isAnyFieldInGroupChecked,
|
|
1773
|
-
groupName: group.groupName,
|
|
1774
|
-
isSearchActive: isSearchActive
|
|
1775
|
-
})
|
|
1776
|
-
})
|
|
1777
|
-
}), !isOpen && jsxRuntime.jsx(SelectedGroupFieldsCountStamp, {
|
|
1778
|
-
group: group
|
|
1779
|
-
})]
|
|
1780
|
-
})
|
|
1781
|
-
})]
|
|
1782
|
-
});
|
|
1783
|
-
}
|
|
1784
|
-
}, `${isSearchActive}`);
|
|
1785
|
-
};
|
|
1786
|
-
|
|
1787
|
-
var _ref = {
|
|
1788
|
-
name: "ti75j2",
|
|
1789
|
-
styles: "margin:0"
|
|
1790
|
-
} ;
|
|
1791
|
-
const NoSearchResults = () => {
|
|
1792
|
-
return jsxRuntime.jsxs(uiKit.Card, {
|
|
1793
|
-
insetScale: "xl",
|
|
1794
|
-
children: [jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1795
|
-
scale: "s",
|
|
1796
|
-
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1797
|
-
fontWeight: "medium",
|
|
1798
|
-
intlMessage: messages.thereAreNoResults
|
|
1799
|
-
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1800
|
-
intlMessage: messages.suggestions
|
|
1801
|
-
})]
|
|
1802
|
-
}), jsxRuntime.jsxs("ul", {
|
|
1803
|
-
css: _ref,
|
|
1804
|
-
children: [jsxRuntime.jsx("li", {
|
|
1805
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1806
|
-
intlMessage: messages.checkTheSpelling
|
|
1807
|
-
})
|
|
1808
|
-
}), jsxRuntime.jsx("li", {
|
|
1809
|
-
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1810
|
-
intlMessage: messages.searchByEnteringTheExactFieldName
|
|
1811
|
-
})
|
|
1812
|
-
})]
|
|
1813
|
-
})]
|
|
1814
|
-
});
|
|
1815
|
-
};
|
|
1816
|
-
|
|
1817
|
-
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; }
|
|
1818
|
-
function _objectSpread$1(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$1(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$1(Object(t))).call(_context6, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1819
|
-
const totalSpacing = 32 * 2 + (
|
|
1820
|
-
// outer modal spacing
|
|
1821
|
-
32 + 40) +
|
|
1822
|
-
// footer (dialog buttons + margin)
|
|
1823
|
-
40 +
|
|
1824
|
-
// search input
|
|
1825
|
-
24 +
|
|
1826
|
-
// search input padding
|
|
1827
|
-
24 +
|
|
1828
|
-
// modal header
|
|
1829
|
-
16 +
|
|
1830
|
-
// modal header margin
|
|
1831
|
-
16 + (
|
|
1832
|
-
// spacing between search input and grid card
|
|
1833
|
-
16 * 2 + 8 * 2) +
|
|
1834
|
-
// modal padding
|
|
1835
|
-
56 +
|
|
1836
|
-
// MC header
|
|
1837
|
-
4; // borders
|
|
1838
|
-
|
|
1839
|
-
const MIN_SEARCH_LENGTH = 3;
|
|
1840
|
-
const StyledGridCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
1841
|
-
target: "e5mvpn60"
|
|
1842
|
-
} )("max-height:calc(100vh - ", totalSpacing, "px);overflow:auto;" + ("" ));
|
|
1843
|
-
const ExportFieldsSelectionStep = () => {
|
|
1844
|
-
const intl = reactIntl.useIntl();
|
|
1845
|
-
const _React$useState = React__default["default"].useState(''),
|
|
1846
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1847
|
-
fieldSearchTerm = _React$useState2[0],
|
|
1848
|
-
setFieldSearchTerm = _React$useState2[1];
|
|
1849
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
1850
|
-
projectKey: context.project?.key
|
|
1851
|
-
})),
|
|
1852
|
-
projectKey = _useApplicationContex.projectKey;
|
|
1853
|
-
const _useStorage = experimentalComponents.useStorage(`${projectKey}/${OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION}`, {}),
|
|
1854
|
-
_useStorage2 = _slicedToArray(_useStorage, 2);
|
|
1855
|
-
_useStorage2[0];
|
|
1856
|
-
const setCachedSelectedGroups = _useStorage2[1];
|
|
1857
|
-
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
1858
|
-
formik = _useExportResourcesMo.formik,
|
|
1859
|
-
setCurrentStep = _useExportResourcesMo.setCurrentStep,
|
|
1860
|
-
resourceType = _useExportResourcesMo.resourceType,
|
|
1861
|
-
onClose = _useExportResourcesMo.onClose;
|
|
1862
|
-
const isSearchActive = fieldSearchTerm?.trim()?.length >= MIN_SEARCH_LENGTH;
|
|
1863
|
-
React__default["default"].useEffect(() => {
|
|
1864
|
-
var _context2;
|
|
1865
|
-
updateFieldDependenciesStatus(formik);
|
|
1866
|
-
const checkedFields = {};
|
|
1867
|
-
function getCheckedFields(field, groupName) {
|
|
1868
|
-
const fieldName = field.name ? `${groupName}.${field.name}` : groupName;
|
|
1869
|
-
if (field.fields) {
|
|
1870
|
-
var _context;
|
|
1871
|
-
return _forEachInstanceProperty__default["default"](_context = field.fields).call(_context, f => getCheckedFields(f, fieldName));
|
|
1872
|
-
}
|
|
1873
|
-
checkedFields[fieldName] = field.isChecked;
|
|
1874
|
-
}
|
|
1875
|
-
_forEachInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](formik).groups).call(_context2, group => {
|
|
1876
|
-
var _context3;
|
|
1877
|
-
_forEachInstanceProperty__default["default"](_context3 = group.fields).call(_context3, field => {
|
|
1878
|
-
getCheckedFields(field, group.groupName);
|
|
1879
|
-
});
|
|
1880
|
-
});
|
|
1881
|
-
setCachedSelectedGroups({
|
|
1882
|
-
[resourceType]: checkedFields
|
|
1883
|
-
});
|
|
1884
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1885
|
-
}, [_valuesInstanceProperty__default["default"](formik).groups]);
|
|
1886
|
-
// adds `isHidden` property to each field based on search term
|
|
1887
|
-
const filteredGroups = React__default["default"].useMemo(() => {
|
|
1888
|
-
const updateFields = (fields, parentMatches) => {
|
|
1889
|
-
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
1890
|
-
var _context4;
|
|
1891
|
-
const matches = _includesInstanceProperty__default["default"](_context4 = field.label.toLowerCase()).call(_context4, fieldSearchTerm.toLowerCase());
|
|
1892
|
-
let isHidden = !matches && !parentMatches;
|
|
1893
|
-
if (field.fields) {
|
|
1894
|
-
const updatedFields = updateFields(field.fields, matches);
|
|
1895
|
-
isHidden = isHidden && _everyInstanceProperty__default["default"](updatedFields).call(updatedFields, f => f.isHidden);
|
|
1896
|
-
field = _objectSpread$1(_objectSpread$1({}, field), {}, {
|
|
1897
|
-
fields: updatedFields
|
|
1898
|
-
});
|
|
1899
|
-
}
|
|
1900
|
-
return _objectSpread$1(_objectSpread$1({}, field), {}, {
|
|
1901
|
-
isHidden
|
|
1902
|
-
});
|
|
1903
|
-
});
|
|
1904
|
-
};
|
|
1905
|
-
if (!isSearchActive) return _valuesInstanceProperty__default["default"](formik).groups;
|
|
1906
|
-
const updateGroups = groups => {
|
|
1907
|
-
return _mapInstanceProperty__default["default"](groups).call(groups, group => {
|
|
1908
|
-
const updatedFields = updateFields(group.fields, false);
|
|
1909
|
-
const isHidden = _everyInstanceProperty__default["default"](updatedFields).call(updatedFields, field => field.isHidden);
|
|
1910
|
-
return _objectSpread$1(_objectSpread$1({}, group), {}, {
|
|
1911
|
-
fields: updatedFields,
|
|
1912
|
-
isHidden
|
|
1913
|
-
});
|
|
1914
|
-
});
|
|
1915
|
-
};
|
|
1916
|
-
return updateGroups(_valuesInstanceProperty__default["default"](formik).groups);
|
|
1917
|
-
}, [_valuesInstanceProperty__default["default"](formik).groups, fieldSearchTerm, isSearchActive]);
|
|
1918
|
-
const onSearchChange = React__default["default"].useCallback(event => {
|
|
1919
|
-
setFieldSearchTerm(event.target.value);
|
|
1920
|
-
}, [setFieldSearchTerm]);
|
|
1921
|
-
const hasResults = Boolean(_findInstanceProperty__default["default"](filteredGroups).call(filteredGroups, group => !group.isHidden));
|
|
1922
|
-
const onSearchChangeDebounced = React__default["default"].useMemo(() => debounce__default["default"](onSearchChange, 500), [onSearchChange]);
|
|
1923
|
-
const onSearchReset = () => {
|
|
1924
|
-
setFieldSearchTerm('');
|
|
1925
|
-
};
|
|
1926
|
-
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
1927
|
-
isOpen: true,
|
|
1928
|
-
title: intl.formatMessage(messages.selectFieldsToExport),
|
|
1929
|
-
labelPrimary: intl.formatMessage(messages.startExport),
|
|
1930
|
-
onPrimaryButtonClick: formik.submitForm,
|
|
1931
|
-
isPrimaryButtonDisabled: !formik.isValid,
|
|
1932
|
-
labelSecondary: intl.formatMessage(messages.back),
|
|
1933
|
-
onSecondaryButtonClick: () => setCurrentStep(Step.FileSettings),
|
|
1934
|
-
onClose: onClose,
|
|
1935
|
-
size: 16,
|
|
1936
|
-
dataAttributesPrimaryButton: {
|
|
1937
|
-
'data-tracking-target': `${resourceType}_export-start_export_button`
|
|
1938
|
-
},
|
|
1939
|
-
children: jsxRuntime.jsx(fullstory.Masking.Unmask, {
|
|
1940
|
-
children: jsxRuntime.jsx(ExportFieldSelectionProvider, {
|
|
1941
|
-
resourceType: resourceType,
|
|
1942
|
-
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1943
|
-
scale: "m",
|
|
1944
|
-
children: [jsxRuntime.jsx(uiKit.SearchTextInput, {
|
|
1945
|
-
placeholder: intl.formatMessage(messages.searchForFields),
|
|
1946
|
-
value: fieldSearchTerm,
|
|
1947
|
-
onChange: onSearchChangeDebounced,
|
|
1948
|
-
onReset: onSearchReset
|
|
1949
|
-
// TODO: `SearchTextInput` props to be improved. The `onSubmit` callback shouldn't be mandatory
|
|
1950
|
-
,
|
|
1951
|
-
onSubmit: () => {},
|
|
1952
|
-
id: "export-fields-search"
|
|
1953
|
-
}), hasResults ? jsxRuntime.jsx(StyledGridCard, {
|
|
1954
|
-
insetScale: "none",
|
|
1955
|
-
children: jsxRuntime.jsx(uiKit.Grid, {
|
|
1956
|
-
gridAutoFlow: "row",
|
|
1957
|
-
gridTemplateColumns: `calc(${uiKit.designTokens.spacingL} + ${uiKit.designTokens.constraint5} + ${uiKit.designTokens.spacingL}) auto`,
|
|
1958
|
-
children: _mapInstanceProperty__default["default"](filteredGroups).call(filteredGroups, (group, index) => jsxRuntime.jsx(FieldGroupSection, {
|
|
1959
|
-
group: group,
|
|
1960
|
-
index: index,
|
|
1961
|
-
formik: formik,
|
|
1962
|
-
isSearchActive: isSearchActive
|
|
1963
|
-
}, group.groupName))
|
|
1964
|
-
})
|
|
1965
|
-
}) : jsxRuntime.jsx(NoSearchResults, {})]
|
|
1966
|
-
})
|
|
1967
|
-
})
|
|
1968
|
-
})
|
|
1969
|
-
});
|
|
1970
|
-
};
|
|
1971
|
-
|
|
1972
|
-
const ExportResourcesContext = /*#__PURE__*/React.createContext();
|
|
1973
|
-
|
|
1974
|
-
const _excluded$1 = ["children"];
|
|
1975
|
-
const ExportResourcesProvider = _ref => {
|
|
1976
|
-
let children = _ref.children,
|
|
1977
|
-
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
1978
|
-
const initialValues = useInitialValues(props);
|
|
1979
|
-
const _React$useState = React__default["default"].useState(Step.FileSettings),
|
|
1980
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1981
|
-
currentStep = _React$useState2[0],
|
|
1982
|
-
setCurrentStep = _React$useState2[1];
|
|
1983
|
-
const _React$useState3 = React__default["default"].useState(() => getInitialExportType({
|
|
1984
|
-
selectedResourceIds: props.selectedResourceIds,
|
|
1985
|
-
filters: props.filters
|
|
1986
|
-
})),
|
|
1987
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
1988
|
-
exportType = _React$useState4[0],
|
|
1989
|
-
setExportType = _React$useState4[1];
|
|
1990
|
-
const _useStartExportOperat = useStartExportOperation(props),
|
|
1991
|
-
startExportOperation = _useStartExportOperat.startExportOperation;
|
|
1992
|
-
const onSubmit = async values => {
|
|
1993
|
-
if (currentStep === Step.FileSettings) {
|
|
1994
|
-
setCurrentStep(Step.FieldsSelection);
|
|
1995
|
-
} else {
|
|
1996
|
-
startExportOperation(values, exportType);
|
|
1997
|
-
}
|
|
1998
|
-
};
|
|
1999
|
-
const formik$1 = formik.useFormik({
|
|
2000
|
-
initialValues,
|
|
2001
|
-
validate: values => validate({
|
|
2002
|
-
values,
|
|
2003
|
-
step: currentStep
|
|
2004
|
-
}),
|
|
2005
|
-
onSubmit
|
|
2006
|
-
});
|
|
2007
|
-
return jsxRuntime.jsx(ExportResourcesContext.Provider, {
|
|
2008
|
-
value: {
|
|
2009
|
-
formik: formik$1,
|
|
2010
|
-
currentStep,
|
|
2011
|
-
setCurrentStep,
|
|
2012
|
-
onClose: props.onClose,
|
|
2013
|
-
resourceType: props.resourceType,
|
|
2014
|
-
exportType: exportType,
|
|
2015
|
-
totalResourcesCount: props.totalResourcesCount,
|
|
2016
|
-
selectedResourceIds: props.selectedResourceIds,
|
|
2017
|
-
hideExportSelectedResourcesOption: props.hideExportSelectedResourcesOption,
|
|
2018
|
-
filters: props.filters,
|
|
2019
|
-
hasFilters: areFiltersApplied(props.filters),
|
|
2020
|
-
setExportType
|
|
2021
|
-
},
|
|
2022
|
-
children: children
|
|
2023
|
-
});
|
|
2024
|
-
};
|
|
2025
|
-
|
|
2026
|
-
const CurrentStep = () => {
|
|
2027
|
-
const _useExportResourcesMo = useExportResourcesModalContext(),
|
|
2028
|
-
currentStep = _useExportResourcesMo.currentStep;
|
|
2029
|
-
const steps = {
|
|
2030
|
-
'file-settings': jsxRuntime.jsx(ExportFileSettingsStep, {}),
|
|
2031
|
-
'fields-selection': jsxRuntime.jsx(ExportFieldsSelectionStep, {})
|
|
2032
|
-
};
|
|
2033
|
-
return steps[currentStep] || null;
|
|
2034
|
-
};
|
|
2035
|
-
|
|
2036
|
-
const getChunkImport = locale => {
|
|
2037
|
-
const intlLocale = i18n.mapLocaleToIntlLocale(locale);
|
|
2038
|
-
switch (intlLocale) {
|
|
2039
|
-
case 'de':
|
|
2040
|
-
return Promise.resolve().then(function () { return require(/* webpackChunkName: "export-resources-modal-i18n-de" */'./de-1903dccf.cjs.prod.js'); });
|
|
2041
|
-
case 'es':
|
|
2042
|
-
return Promise.resolve().then(function () { return require(/* webpackChunkName: "export-resources-modal-i18n-es" */'./es-7959f578.cjs.prod.js'); });
|
|
2043
|
-
case 'fr-FR':
|
|
2044
|
-
return Promise.resolve().then(function () { return require(/* webpackChunkName: "export-resources-modal-i18n-fr-FR" */'./fr-FR-0a721f97.cjs.prod.js'); });
|
|
2045
|
-
case 'ja':
|
|
2046
|
-
return Promise.resolve().then(function () { return require(/* webpackChunkName: "export-resources-modal-i18n-ja" */'./ja-37632763.cjs.prod.js'); });
|
|
2047
|
-
case 'pt-BR':
|
|
2048
|
-
return Promise.resolve().then(function () { return require(/* webpackChunkName: "change-history-i18n-pt-BR" */'./pt-BR-89644b77.cjs.prod.js'); });
|
|
2049
|
-
default:
|
|
2050
|
-
return Promise.resolve().then(function () { return require(/* webpackChunkName: "export-resources-modal-i18n-en" */'./en-56c15954.cjs.prod.js'); });
|
|
2051
|
-
}
|
|
2052
|
-
};
|
|
2053
|
-
const loadMessages = async locale => {
|
|
2054
|
-
try {
|
|
2055
|
-
const chunkImport = await getChunkImport(locale);
|
|
2056
|
-
return i18n.parseChunkImport(chunkImport);
|
|
2057
|
-
} catch (error) {
|
|
2058
|
-
// eslint-disable-next-line no-console
|
|
2059
|
-
console.warn(`Something went wrong while loading the export-resources-modal messages for ${locale}`, error);
|
|
2060
|
-
sentry.reportErrorToSentry(new Error(`Something went wrong while loading the export-resources-modal messages for ${locale}`), {
|
|
2061
|
-
extra: error
|
|
2062
|
-
});
|
|
2063
|
-
return {};
|
|
2064
|
-
}
|
|
2065
|
-
};
|
|
2066
|
-
|
|
2067
|
-
const useAsyncIntlMessages = (locale, loader) => {
|
|
2068
|
-
const _useState = React.useState({
|
|
2069
|
-
isLoading: true,
|
|
2070
|
-
messages: undefined,
|
|
2071
|
-
error: undefined
|
|
2072
|
-
}),
|
|
2073
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
2074
|
-
state = _useState2[0],
|
|
2075
|
-
setState = _useState2[1];
|
|
2076
|
-
React.useEffect(() => {
|
|
2077
|
-
let _isUnmounting = false;
|
|
2078
|
-
async function load() {
|
|
2079
|
-
try {
|
|
2080
|
-
if (!_isUnmounting) {
|
|
2081
|
-
const messages = await loader(locale);
|
|
2082
|
-
setState({
|
|
2083
|
-
isLoading: false,
|
|
2084
|
-
messages
|
|
2085
|
-
});
|
|
2086
|
-
}
|
|
2087
|
-
} catch (error) {
|
|
2088
|
-
setState({
|
|
2089
|
-
isLoading: false,
|
|
2090
|
-
error
|
|
2091
|
-
});
|
|
2092
|
-
}
|
|
2093
|
-
}
|
|
2094
|
-
if (locale) load();
|
|
2095
|
-
return () => {
|
|
2096
|
-
_isUnmounting = true;
|
|
2097
|
-
};
|
|
2098
|
-
}, [locale, loader]);
|
|
2099
|
-
return state;
|
|
2100
|
-
};
|
|
2101
|
-
|
|
2102
|
-
const _excluded = ["isOpen", "selectedResourceIds", "outputFormat", "fieldGroups", "fieldOrder"];
|
|
2103
|
-
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; }
|
|
2104
|
-
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; }
|
|
2105
|
-
function invalidateLaunchDarklyCachedFeatureFlag(flagName) {
|
|
2106
|
-
for (let _ref of _Object$entries__default["default"](localStorage)) {
|
|
2107
|
-
var _ref2 = _slicedToArray(_ref, 1);
|
|
2108
|
-
let key = _ref2[0];
|
|
2109
|
-
// This is the pattern that the LaunchDarkly adapter uses to store the flags
|
|
2110
|
-
if (_startsWithInstanceProperty__default["default"](key).call(key, '@flopflip/launchdarkly-adapter/') && _endsWithInstanceProperty__default["default"](key).call(key, '/flags')) {
|
|
2111
|
-
try {
|
|
2112
|
-
const flags = JSON.parse(localStorage.getItem(key) || '{}');
|
|
2113
|
-
if (flags[flagName] !== undefined) {
|
|
2114
|
-
delete flags[flagName];
|
|
2115
|
-
localStorage.setItem(key, _JSON$stringify__default["default"](flags));
|
|
2116
|
-
}
|
|
2117
|
-
} catch (error) {}
|
|
2118
|
-
}
|
|
2119
|
-
}
|
|
2120
|
-
}
|
|
2121
|
-
invalidateLaunchDarklyCachedFeatureFlag('enableOperationsExport');
|
|
2122
|
-
const ExportResourcesModal = _ref3 => {
|
|
2123
|
-
let _ref3$isOpen = _ref3.isOpen,
|
|
2124
|
-
isOpen = _ref3$isOpen === void 0 ? false : _ref3$isOpen,
|
|
2125
|
-
_ref3$selectedResourc = _ref3.selectedResourceIds,
|
|
2126
|
-
selectedResourceIds = _ref3$selectedResourc === void 0 ? [] : _ref3$selectedResourc,
|
|
2127
|
-
_ref3$outputFormat = _ref3.outputFormat,
|
|
2128
|
-
outputFormat = _ref3$outputFormat === void 0 ? OUTPUT_FORMATS.CSV : _ref3$outputFormat,
|
|
2129
|
-
_ref3$fieldGroups = _ref3.fieldGroups,
|
|
2130
|
-
fieldGroups = _ref3$fieldGroups === void 0 ? [] : _ref3$fieldGroups,
|
|
2131
|
-
_ref3$fieldOrder = _ref3.fieldOrder,
|
|
2132
|
-
fieldOrder = _ref3$fieldOrder === void 0 ? [] : _ref3$fieldOrder,
|
|
2133
|
-
props = _objectWithoutProperties(_ref3, _excluded);
|
|
2134
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
2135
|
-
locale: context.user && context.user.locale
|
|
2136
|
-
})),
|
|
2137
|
-
locale = _useApplicationContex.locale;
|
|
2138
|
-
const messages = useAsyncIntlMessages(locale, loadMessages);
|
|
2139
|
-
if (!isOpen || messages.isLoading) return null;
|
|
2140
|
-
if (props.filters && !validateFilters(props.filters)) {
|
|
2141
|
-
console.error('Invalid filters prop:', props.filters, 'Filters must contain one of these values: `filters` or `where`');
|
|
2142
|
-
return null;
|
|
2143
|
-
}
|
|
2144
|
-
return jsxRuntime.jsx(reactIntl.IntlProvider, {
|
|
2145
|
-
locale: locale,
|
|
2146
|
-
messages: messages.messages,
|
|
2147
|
-
children: jsxRuntime.jsx(ExportResourcesProvider, _objectSpread(_objectSpread({
|
|
2148
|
-
fieldGroups: fieldGroups,
|
|
2149
|
-
fieldOrder: fieldOrder,
|
|
2150
|
-
isOpen: isOpen,
|
|
2151
|
-
outputFormat: outputFormat,
|
|
2152
|
-
selectedResourceIds: selectedResourceIds
|
|
2153
|
-
}, props), {}, {
|
|
2154
|
-
children: jsxRuntime.jsx(CurrentStep, {})
|
|
2155
|
-
}))
|
|
2156
|
-
});
|
|
2157
|
-
};
|
|
2158
|
-
ExportResourcesModal.displayName = 'ExportResourcesModal';
|
|
2159
|
-
|
|
2160
|
-
exports.EXPORTABLE_RESOURCES = EXPORTABLE_RESOURCES;
|
|
2161
|
-
exports.EXPORT_TYPES = EXPORT_TYPES;
|
|
2162
|
-
exports.Step = Step;
|
|
2163
|
-
exports["default"] = ExportResourcesModal;
|
|
2164
|
-
exports.useConvertFieldDefinitionsForExport = useConvertFieldDefinitionsForExport;
|
|
5
|
+
var dist_commercetoolsFrontendExtensionsExportResourcesModal = require('./index-e05daeff.cjs.prod.js');
|
|
6
|
+
require('react');
|
|
7
|
+
require('@commercetools-frontend/ui-kit');
|
|
8
|
+
require('@emotion/react/jsx-runtime');
|
|
9
|
+
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
10
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
11
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
12
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
13
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
14
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
15
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
16
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
17
|
+
require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
18
|
+
require('react-intl');
|
|
19
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
20
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/values');
|
|
21
|
+
require('@commercetools-frontend/application-components');
|
|
22
|
+
require('@commercetools-frontend/fullstory');
|
|
23
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
24
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
25
|
+
require('omit-empty-es');
|
|
26
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
27
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
28
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/every');
|
|
29
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
30
|
+
require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
31
|
+
require('@babel/runtime-corejs3/core-js-stable/set');
|
|
32
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/sort');
|
|
33
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
34
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/trim');
|
|
35
|
+
require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
|
|
36
|
+
require('@babel/runtime-corejs3/helpers/createClass');
|
|
37
|
+
require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
38
|
+
require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
|
|
39
|
+
require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
40
|
+
require('@babel/runtime-corejs3/helpers/inherits');
|
|
41
|
+
require('@babel/runtime-corejs3/helpers/wrapNativeSuper');
|
|
42
|
+
require('@babel/runtime-corejs3/core-js-stable/promise');
|
|
43
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/slice');
|
|
44
|
+
require('@babel/runtime-corejs3/core-js-stable/object/values');
|
|
45
|
+
require('@commercetools-frontend/application-shell-connectors');
|
|
46
|
+
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
47
|
+
require('@emotion/styled/base');
|
|
48
|
+
require('@commercetools-frontend/experimental-components');
|
|
49
|
+
require('lodash/debounce');
|
|
50
|
+
require('@emotion/react');
|
|
51
|
+
require('lodash/get');
|
|
52
|
+
require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
53
|
+
require('formik');
|
|
54
|
+
require('@commercetools-uikit/icons');
|
|
55
|
+
require('react-dropzone');
|
|
56
|
+
require('@commercetools-frontend/actions-global');
|
|
57
|
+
require('@commercetools-frontend/constants');
|
|
58
|
+
require('@commercetools-frontend/sdk');
|
|
59
|
+
require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
60
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
|
|
61
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/ends-with');
|
|
62
|
+
require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
63
|
+
require('@commercetools-frontend/l10n');
|
|
64
|
+
require('lodash/sortBy');
|
|
65
|
+
require('@commercetools-frontend/i18n');
|
|
66
|
+
require('@commercetools-frontend/sentry');
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
exports.EXPORTABLE_RESOURCES = dist_commercetoolsFrontendExtensionsExportResourcesModal.EXPORTABLE_RESOURCES;
|
|
71
|
+
exports.EXPORT_TYPES = dist_commercetoolsFrontendExtensionsExportResourcesModal.EXPORT_TYPES;
|
|
72
|
+
exports.LocaleOption = dist_commercetoolsFrontendExtensionsExportResourcesModal.LocaleOption;
|
|
73
|
+
exports.Step = dist_commercetoolsFrontendExtensionsExportResourcesModal.Step;
|
|
74
|
+
exports["default"] = dist_commercetoolsFrontendExtensionsExportResourcesModal.ExportResourcesModal;
|
|
75
|
+
exports.useConvertFieldDefinitionsForExport = dist_commercetoolsFrontendExtensionsExportResourcesModal.useConvertFieldDefinitionsForExport;
|