@commercetools-frontend-extensions/export-resources-modal 1.3.3 → 1.3.5
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 +1 -5
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.dev.js +3 -4
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.prod.js +3 -4
- package/dist/commercetools-frontend-extensions-export-resources-modal.esm.js +3 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,7 +26,6 @@ import { ExportResourcesModal } from '@commercetools-frontend-extensions/export-
|
|
|
26
26
|
|
|
27
27
|
// in case export all the resources
|
|
28
28
|
<ExportResourcesModal
|
|
29
|
-
isOpen={true}
|
|
30
29
|
outputFormat="csv"
|
|
31
30
|
resourceType="category"
|
|
32
31
|
allResourcesCount={143}
|
|
@@ -55,7 +54,6 @@ import { ExportResourcesModal } from '@commercetools-frontend-extensions/export-
|
|
|
55
54
|
|
|
56
55
|
// in case export only resources matching filters & search
|
|
57
56
|
<ExportResourcesModal
|
|
58
|
-
isOpen={true}
|
|
59
57
|
outputFormat="csv"
|
|
60
58
|
resourceType="category"
|
|
61
59
|
allResourcesCount={143}
|
|
@@ -92,7 +90,6 @@ import { ExportResourcesModal } from '@commercetools-frontend-extensions/export-
|
|
|
92
90
|
|
|
93
91
|
// in case export only selected resources
|
|
94
92
|
<ExportResourcesModal
|
|
95
|
-
isOpen={true}
|
|
96
93
|
outputFormat="csv"
|
|
97
94
|
resourceType="category"
|
|
98
95
|
allResourcesCount={143}
|
|
@@ -124,8 +121,7 @@ import { ExportResourcesModal } from '@commercetools-frontend-extensions/export-
|
|
|
124
121
|
## Properties
|
|
125
122
|
|
|
126
123
|
| Props | Type | Required | Default | Description |
|
|
127
|
-
| ------------------------ | ----------------------------------------------------------------------------- | :---------------------------------------------------------: | -------------- | -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
128
|
-
| `isOpen` | `boolean` | ✅ Required | | Indicates whether the Modal is open or closed. The parent component needs to manage this state |
|
|
124
|
+
| ------------------------ | ----------------------------------------------------------------------------- | :---------------------------------------------------------: | -------------- | -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
129
125
|
| `outputFormat` | `string`<br/>Possible values: `json`, `csv` | | `json` | The file format to export |
|
|
130
126
|
| `closeModal` | `function` | ✅ Required | | Called when the page closes click on overlay, click on close button, press ESC. If the function is not provided, the page cannot be closed by any of the listed options |
|
|
131
127
|
| `resourceType` | `string` | ✅ Required | | The type of the resource, example: `category`, `product`... |
|
|
@@ -228,7 +228,7 @@ function buildGraphQuery(exportSettings) {
|
|
|
228
228
|
* This function builds the necessary field structure for our GraphQL queries, tt is specifically designed to handle different types of fields
|
|
229
229
|
*
|
|
230
230
|
* For fields whose values change depending on the language aka localised fields, a unique request format is used
|
|
231
|
-
* This format combines the field and the language, separated by '
|
|
231
|
+
* This format combines the field and the language, separated by '______'. This approach is adopted as our system disallows the use of hyphens `-` in these situations
|
|
232
232
|
*
|
|
233
233
|
* Fields that don't vary by language but contain additional subfields (known as 'nested fields') are also addressed
|
|
234
234
|
* In these cases the function is used recursively on these subfields to generate the appropriate request.
|
|
@@ -245,7 +245,7 @@ function buildFields(_ref) {
|
|
|
245
245
|
return _flatInstanceProperty__default["default"](_context2 = _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
246
246
|
if (field.isLocalized) return _mapInstanceProperty__default["default"](languages).call(languages, language => {
|
|
247
247
|
var _context3, _context4, _context5;
|
|
248
|
-
const alias = replaceSpecialCharsWithUnderscore(_concatInstanceProperty__default["default"](_context3 = "".concat(field.key, "
|
|
248
|
+
const alias = replaceSpecialCharsWithUnderscore(_concatInstanceProperty__default["default"](_context3 = "".concat(field.key, "______")).call(_context3, language));
|
|
249
249
|
return _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = "".concat(alias, ": ")).call(_context5, field.key, "(locale: \"")).call(_context4, language, "\")");
|
|
250
250
|
});else {
|
|
251
251
|
if (isFilledArray(field.fields)) {
|
|
@@ -1227,7 +1227,6 @@ const ExportResourcesContext = /*#__PURE__*/react$1.createContext();
|
|
|
1227
1227
|
const ExportResourcesModalShape = PropTypes__default["default"].shape({
|
|
1228
1228
|
resourceType: PropTypes__default["default"].string.isRequired,
|
|
1229
1229
|
outputFormat: PropTypes__default["default"].string,
|
|
1230
|
-
isOpen: PropTypes__default["default"].bool.isRequired,
|
|
1231
1230
|
closeModal: PropTypes__default["default"].func.isRequired,
|
|
1232
1231
|
allResourcesCount: PropTypes__default["default"].number.isRequired,
|
|
1233
1232
|
matchingResourcesCount: PropTypes__default["default"].number,
|
|
@@ -1306,10 +1305,10 @@ const ExportResourcesModal = _ref => {
|
|
|
1306
1305
|
children: _ref2 => {
|
|
1307
1306
|
let formik = _ref2.formik;
|
|
1308
1307
|
return jsxRuntime.jsxs(applicationComponents.FormModalPage, {
|
|
1308
|
+
isOpen: true,
|
|
1309
1309
|
title: intl.formatMessage(messages.modalTitle, {
|
|
1310
1310
|
resourceType: resourceTypePlural
|
|
1311
1311
|
}),
|
|
1312
|
-
isOpen: props.isOpen,
|
|
1313
1312
|
onClose: props.closeModal,
|
|
1314
1313
|
onSecondaryButtonClick: props.closeModal,
|
|
1315
1314
|
isPrimaryButtonDisabled: !formik.isValid,
|
|
@@ -228,7 +228,7 @@ function buildGraphQuery(exportSettings) {
|
|
|
228
228
|
* This function builds the necessary field structure for our GraphQL queries, tt is specifically designed to handle different types of fields
|
|
229
229
|
*
|
|
230
230
|
* For fields whose values change depending on the language aka localised fields, a unique request format is used
|
|
231
|
-
* This format combines the field and the language, separated by '
|
|
231
|
+
* This format combines the field and the language, separated by '______'. This approach is adopted as our system disallows the use of hyphens `-` in these situations
|
|
232
232
|
*
|
|
233
233
|
* Fields that don't vary by language but contain additional subfields (known as 'nested fields') are also addressed
|
|
234
234
|
* In these cases the function is used recursively on these subfields to generate the appropriate request.
|
|
@@ -245,7 +245,7 @@ function buildFields(_ref) {
|
|
|
245
245
|
return _flatInstanceProperty__default["default"](_context2 = _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
246
246
|
if (field.isLocalized) return _mapInstanceProperty__default["default"](languages).call(languages, language => {
|
|
247
247
|
var _context3, _context4, _context5;
|
|
248
|
-
const alias = replaceSpecialCharsWithUnderscore(_concatInstanceProperty__default["default"](_context3 = "".concat(field.key, "
|
|
248
|
+
const alias = replaceSpecialCharsWithUnderscore(_concatInstanceProperty__default["default"](_context3 = "".concat(field.key, "______")).call(_context3, language));
|
|
249
249
|
return _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = "".concat(alias, ": ")).call(_context5, field.key, "(locale: \"")).call(_context4, language, "\")");
|
|
250
250
|
});else {
|
|
251
251
|
if (isFilledArray(field.fields)) {
|
|
@@ -1189,7 +1189,6 @@ const ExportResourcesContext = /*#__PURE__*/react$1.createContext();
|
|
|
1189
1189
|
PropTypes__default["default"].shape({
|
|
1190
1190
|
resourceType: PropTypes__default["default"].string.isRequired,
|
|
1191
1191
|
outputFormat: PropTypes__default["default"].string,
|
|
1192
|
-
isOpen: PropTypes__default["default"].bool.isRequired,
|
|
1193
1192
|
closeModal: PropTypes__default["default"].func.isRequired,
|
|
1194
1193
|
allResourcesCount: PropTypes__default["default"].number.isRequired,
|
|
1195
1194
|
matchingResourcesCount: PropTypes__default["default"].number,
|
|
@@ -1264,10 +1263,10 @@ const ExportResourcesModal = _ref => {
|
|
|
1264
1263
|
children: _ref2 => {
|
|
1265
1264
|
let formik = _ref2.formik;
|
|
1266
1265
|
return jsxRuntime.jsxs(applicationComponents.FormModalPage, {
|
|
1266
|
+
isOpen: true,
|
|
1267
1267
|
title: intl.formatMessage(messages.modalTitle, {
|
|
1268
1268
|
resourceType: resourceTypePlural
|
|
1269
1269
|
}),
|
|
1270
|
-
isOpen: props.isOpen,
|
|
1271
1270
|
onClose: props.closeModal,
|
|
1272
1271
|
onSecondaryButtonClick: props.closeModal,
|
|
1273
1272
|
isPrimaryButtonDisabled: !formik.isValid,
|
|
@@ -203,7 +203,7 @@ function buildGraphQuery(exportSettings) {
|
|
|
203
203
|
* This function builds the necessary field structure for our GraphQL queries, tt is specifically designed to handle different types of fields
|
|
204
204
|
*
|
|
205
205
|
* For fields whose values change depending on the language aka localised fields, a unique request format is used
|
|
206
|
-
* This format combines the field and the language, separated by '
|
|
206
|
+
* This format combines the field and the language, separated by '______'. This approach is adopted as our system disallows the use of hyphens `-` in these situations
|
|
207
207
|
*
|
|
208
208
|
* Fields that don't vary by language but contain additional subfields (known as 'nested fields') are also addressed
|
|
209
209
|
* In these cases the function is used recursively on these subfields to generate the appropriate request.
|
|
@@ -220,7 +220,7 @@ function buildFields(_ref) {
|
|
|
220
220
|
return _flatInstanceProperty(_context2 = _mapInstanceProperty(fields).call(fields, field => {
|
|
221
221
|
if (field.isLocalized) return _mapInstanceProperty(languages).call(languages, language => {
|
|
222
222
|
var _context3, _context4, _context5;
|
|
223
|
-
const alias = replaceSpecialCharsWithUnderscore(_concatInstanceProperty(_context3 = "".concat(field.key, "
|
|
223
|
+
const alias = replaceSpecialCharsWithUnderscore(_concatInstanceProperty(_context3 = "".concat(field.key, "______")).call(_context3, language));
|
|
224
224
|
return _concatInstanceProperty(_context4 = _concatInstanceProperty(_context5 = "".concat(alias, ": ")).call(_context5, field.key, "(locale: \"")).call(_context4, language, "\")");
|
|
225
225
|
});else {
|
|
226
226
|
if (isFilledArray(field.fields)) {
|
|
@@ -1202,7 +1202,6 @@ const ExportResourcesContext = /*#__PURE__*/createContext();
|
|
|
1202
1202
|
const ExportResourcesModalShape = PropTypes.shape({
|
|
1203
1203
|
resourceType: PropTypes.string.isRequired,
|
|
1204
1204
|
outputFormat: PropTypes.string,
|
|
1205
|
-
isOpen: PropTypes.bool.isRequired,
|
|
1206
1205
|
closeModal: PropTypes.func.isRequired,
|
|
1207
1206
|
allResourcesCount: PropTypes.number.isRequired,
|
|
1208
1207
|
matchingResourcesCount: PropTypes.number,
|
|
@@ -1281,10 +1280,10 @@ const ExportResourcesModal = _ref => {
|
|
|
1281
1280
|
children: _ref2 => {
|
|
1282
1281
|
let formik = _ref2.formik;
|
|
1283
1282
|
return jsxs(FormModalPage, {
|
|
1283
|
+
isOpen: true,
|
|
1284
1284
|
title: intl.formatMessage(messages.modalTitle, {
|
|
1285
1285
|
resourceType: resourceTypePlural
|
|
1286
1286
|
}),
|
|
1287
|
-
isOpen: props.isOpen,
|
|
1288
1287
|
onClose: props.closeModal,
|
|
1289
1288
|
onSecondaryButtonClick: props.closeModal,
|
|
1290
1289
|
isPrimaryButtonDisabled: !formik.isValid,
|
package/package.json
CHANGED