@commercetools-frontend-extensions/export-resources-modal 3.7.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +166 -138
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.d.ts +3 -0
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.dev.js +417 -412
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.prod.js +410 -402
- package/dist/commercetools-frontend-extensions-export-resources-modal.esm.js +410 -405
- package/dist/de-a34c5dd4.cjs.dev.js +6 -0
- package/dist/de-cd6c45d3.esm.js +4 -0
- package/dist/de-d954fe3d.cjs.prod.js +6 -0
- package/dist/declarations/src/@constants/delimiters.d.ts +4 -0
- package/dist/declarations/src/@constants/export-operation-states.d.ts +5 -0
- package/dist/declarations/src/@constants/export-types.d.ts +5 -0
- package/dist/declarations/src/@constants/exportable-resources.d.ts +5 -0
- package/dist/declarations/src/@constants/index.d.ts +7 -0
- package/dist/declarations/src/@constants/misc.d.ts +1 -0
- package/dist/declarations/src/@constants/output-formats.d.ts +8 -0
- package/dist/declarations/src/@constants/urls.d.ts +3 -0
- package/dist/declarations/src/@types/export-resources-modal-shape.d.ts +27 -0
- package/dist/declarations/src/@types/formik.d.ts +11 -0
- package/dist/declarations/src/@types/index.d.ts +2 -0
- package/dist/declarations/src/export-resources-modal.d.ts +13 -0
- package/dist/declarations/src/index.d.ts +3 -0
- package/dist/en-3a9aa2d4.esm.js +4 -0
- package/dist/en-6b3694f6.cjs.dev.js +6 -0
- package/dist/en-c7757448.cjs.prod.js +6 -0
- package/dist/es-042343bd.cjs.prod.js +6 -0
- package/dist/es-8b3ecab1.cjs.dev.js +6 -0
- package/dist/es-e544023d.esm.js +4 -0
- package/dist/fr-FR-9d9081ee.esm.js +4 -0
- package/dist/fr-FR-e7126fcc.cjs.dev.js +6 -0
- package/dist/fr-FR-fce1ca96.cjs.prod.js +6 -0
- package/dist/ja-37632763.cjs.prod.js +6 -0
- package/dist/ja-73c088a7.esm.js +4 -0
- package/dist/ja-9bd5f452.cjs.dev.js +6 -0
- package/dist/pt-BR-b37d730b.esm.js +4 -0
- package/dist/pt-BR-ea6b3251.cjs.dev.js +6 -0
- package/dist/pt-BR-ec2a1a11.cjs.prod.js +6 -0
- package/dist/zh-CN-4780d88e.esm.js +4 -0
- package/dist/zh-CN-52baa549.cjs.prod.js +6 -0
- package/dist/zh-CN-d4bc6d26.cjs.dev.js +6 -0
- package/package.json +30 -19
package/README.md
CHANGED
|
@@ -31,75 +31,92 @@ import { ExportResourcesModal } from '@commercetools-frontend-extensions/export-
|
|
|
31
31
|
outputFormat="csv"
|
|
32
32
|
resourceType="category"
|
|
33
33
|
totalResourcesCount={143}
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
name: 'key',
|
|
37
|
-
label: 'Category key',
|
|
38
|
-
isRequired: true
|
|
39
|
-
},
|
|
34
|
+
fieldGroups={[
|
|
40
35
|
{
|
|
41
|
-
|
|
42
|
-
label: 'External id',
|
|
43
|
-
isSelectedByDefault: false,
|
|
44
|
-
},
|
|
45
|
-
{ name: 'createdAt', label: 'Created at' },
|
|
46
|
-
{ name: 'lastModifiedAt', label: 'Last modified at' },
|
|
47
|
-
{ name: 'name', label: 'Name' },
|
|
48
|
-
{
|
|
49
|
-
name: 'parent',
|
|
36
|
+
groupLabel: 'All general fields',
|
|
50
37
|
fields: [
|
|
51
38
|
{
|
|
52
|
-
name: '
|
|
53
|
-
label: '
|
|
39
|
+
name: 'key',
|
|
40
|
+
label: 'Category key',
|
|
41
|
+
isRequired: true,
|
|
54
42
|
},
|
|
55
43
|
{
|
|
56
|
-
name: '
|
|
57
|
-
label: '
|
|
44
|
+
name: 'externalId',
|
|
45
|
+
label: 'External id',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'createdAt',
|
|
49
|
+
label: 'Created at',
|
|
50
|
+
isSelectedByDefault: true,
|
|
58
51
|
},
|
|
59
|
-
],
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: 'id',
|
|
63
|
-
label: 'Id',
|
|
64
|
-
isSelectedByDefault: false,
|
|
65
|
-
},
|
|
66
|
-
]}
|
|
67
|
-
customFields={[
|
|
68
|
-
{
|
|
69
|
-
type:{
|
|
70
|
-
key: 'general-category-attributes',
|
|
71
|
-
label: 'General category attributes',
|
|
72
|
-
resourceTypeIds: ['category'],
|
|
73
|
-
},
|
|
74
|
-
fields: [
|
|
75
52
|
{
|
|
76
|
-
name: '
|
|
77
|
-
label: '
|
|
53
|
+
name: 'lastModifiedAt',
|
|
54
|
+
label: 'Last modified at',
|
|
55
|
+
isSelectedByDefault: true,
|
|
78
56
|
},
|
|
57
|
+
{ name: 'name', label: 'Name', isSelectedByDefault: true },
|
|
79
58
|
{
|
|
80
|
-
name: '
|
|
81
|
-
label: '
|
|
59
|
+
name: 'parent',
|
|
60
|
+
label: 'parent',
|
|
61
|
+
isSelectedByDefault: true,
|
|
62
|
+
fields: [
|
|
63
|
+
{
|
|
64
|
+
name: 'parent.name',
|
|
65
|
+
label: 'Parent name',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'parent.key',
|
|
69
|
+
label: 'Parent key',
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'id',
|
|
75
|
+
label: 'Id',
|
|
76
|
+
isSelectedByDefault: true,
|
|
82
77
|
},
|
|
83
78
|
],
|
|
84
79
|
},
|
|
85
80
|
{
|
|
86
|
-
|
|
87
|
-
key: 'book-category-attributes',
|
|
88
|
-
label: 'Book category attributes',
|
|
89
|
-
resourceTypeIds: ['category', 'asset'],
|
|
90
|
-
},
|
|
81
|
+
groupLabel: 'All custom fields',
|
|
91
82
|
fields: [
|
|
92
83
|
{
|
|
93
|
-
name: '
|
|
94
|
-
label: '
|
|
84
|
+
name: 'custom-type-key-and-type-id',
|
|
85
|
+
label: 'Custom type key and typeId',
|
|
86
|
+
isReadOnly: true,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'general-category-attributes',
|
|
90
|
+
label: 'General category attributes',
|
|
91
|
+
fields: [
|
|
92
|
+
{
|
|
93
|
+
name: 'custom.fields.season',
|
|
94
|
+
label: 'Season',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'custom.fields.target-audience',
|
|
98
|
+
label: 'Target audience',
|
|
99
|
+
},
|
|
100
|
+
],
|
|
95
101
|
},
|
|
96
102
|
{
|
|
97
|
-
name: '
|
|
98
|
-
label: '
|
|
103
|
+
name: 'book-category-attributes',
|
|
104
|
+
label: 'Book category attributes',
|
|
105
|
+
fields: [
|
|
106
|
+
{
|
|
107
|
+
name: 'custom.fields.genre',
|
|
108
|
+
label: 'Genre',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: 'custom.fields.age-group',
|
|
112
|
+
label: 'Age group',
|
|
113
|
+
},
|
|
114
|
+
],
|
|
99
115
|
},
|
|
100
116
|
],
|
|
101
|
-
}
|
|
117
|
+
},
|
|
102
118
|
]}
|
|
119
|
+
fieldOrder={['*', 'custom']}
|
|
103
120
|
renderProperties={()=>(
|
|
104
121
|
<>
|
|
105
122
|
- The category parent is referenced by externalId or key.
|
|
@@ -119,72 +136,84 @@ import { ExportResourcesModal } from '@commercetools-frontend-extensions/export-
|
|
|
119
136
|
selectedResourceIds={['02ed9a7d-7c1f-40da-b2b7-4cca6752bf29', '04051276-1641-4e01-a03e-d4de16b7e4eb', 'ac7d9f7b-5c7d-4dd3-b82b-8555ab4a2a6e']}
|
|
120
137
|
fields={[
|
|
121
138
|
{
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
key: 'general-category-attributes',
|
|
157
|
-
label: 'General category attributes',
|
|
158
|
-
resourceTypeIds: ['category'],
|
|
159
|
-
},
|
|
160
|
-
fields: [
|
|
161
|
-
{
|
|
162
|
-
name: 'season',
|
|
163
|
-
label: 'Season',
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
name: 'target-audience',
|
|
167
|
-
label: 'Target audience',
|
|
168
|
-
},
|
|
169
|
-
],
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
type:{
|
|
173
|
-
key: 'book-category-attributes',
|
|
174
|
-
label: 'Book category attributes',
|
|
175
|
-
resourceTypeIds: ['category', 'asset'],
|
|
139
|
+
groupLabel: 'All General fields',
|
|
140
|
+
fields:[
|
|
141
|
+
{
|
|
142
|
+
name: 'key',
|
|
143
|
+
label: 'Category key',
|
|
144
|
+
isRequired: true,
|
|
145
|
+
isSelectedByDefault: true,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'externalId',
|
|
149
|
+
label: 'External id',
|
|
150
|
+
},
|
|
151
|
+
{ name: 'createdAt', label: 'Created at', isSelectedByDefault: true, },
|
|
152
|
+
{ name: 'lastModifiedAt', label: 'Last modified at', isSelectedByDefault: true, },
|
|
153
|
+
{ name: 'name', label: 'Name', isSelectedByDefault: true, },
|
|
154
|
+
{
|
|
155
|
+
name: 'parent',
|
|
156
|
+
isSelectedByDefault: true,
|
|
157
|
+
fields: [
|
|
158
|
+
{
|
|
159
|
+
name: 'parent.name',
|
|
160
|
+
label: 'Parent name',
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: 'parent.key',
|
|
164
|
+
label: 'Parent key',
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: 'id',
|
|
170
|
+
label: 'Id',
|
|
171
|
+
},
|
|
172
|
+
]
|
|
176
173
|
},
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
174
|
+
{
|
|
175
|
+
groupLabel: 'All custom fields',
|
|
176
|
+
fields: [
|
|
177
|
+
{
|
|
178
|
+
name: 'custom-type-key-and-typeid',
|
|
179
|
+
label: 'Custom type key and typeId',
|
|
180
|
+
isReadOnly: true,
|
|
181
|
+
isSelectedByDefault: false,
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: 'general-category-attributes',
|
|
185
|
+
label: 'General category attributes',
|
|
186
|
+
resourceTypeIds: ['category'],
|
|
187
|
+
isSelectedByDefault: false,
|
|
188
|
+
fields: [
|
|
189
|
+
{
|
|
190
|
+
name: 'season',
|
|
191
|
+
label: 'Season',
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: 'target-audience',
|
|
195
|
+
label: 'Target audience',
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
name: 'book-category-attributes',
|
|
201
|
+
label: 'Book category attributes',
|
|
202
|
+
resourceTypeIds: ['category', 'asset'],
|
|
203
|
+
isSelectedByDefault: false,
|
|
204
|
+
fields: [
|
|
205
|
+
{
|
|
206
|
+
name: 'genre',
|
|
207
|
+
label: 'Genre',
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: 'age-group',
|
|
211
|
+
label: 'Age group',
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
]
|
|
216
|
+
}
|
|
188
217
|
]}
|
|
189
218
|
renderProperties={()=>(
|
|
190
219
|
<>
|
|
@@ -199,30 +228,25 @@ import { ExportResourcesModal } from '@commercetools-frontend-extensions/export-
|
|
|
199
228
|
|
|
200
229
|
## Properties
|
|
201
230
|
|
|
202
|
-
| Props
|
|
203
|
-
|
|
|
204
|
-
| `isOpen`
|
|
205
|
-
| `outputFormat`
|
|
206
|
-
| `onExportSuccess`
|
|
207
|
-
| `onClose`
|
|
208
|
-
| `resourceType`
|
|
209
|
-
| `totalResourcesCount`
|
|
210
|
-
| `exportType`
|
|
211
|
-
| `selectedResourceIds`
|
|
212
|
-
| `
|
|
213
|
-
| `
|
|
214
|
-
| `
|
|
215
|
-
| `fields[].
|
|
216
|
-
| `fields[].
|
|
217
|
-
| `
|
|
218
|
-
| `
|
|
219
|
-
| `
|
|
220
|
-
| `
|
|
221
|
-
| `customFields[].type.resourceTypeIds` | `string[]` | | | An array of [resource type IDs](https://docs.commercetools.com/api/projects/types#ctp:api:type:ResourceTypeId) for which the type is defined. |
|
|
222
|
-
| `customFields[].fields` | `array` | | | An array of objects with custom fields defined under the type represented by `type.key`. |
|
|
223
|
-
| `customFields[].fields[].name` | `string` | | | The name of the custom field. |
|
|
224
|
-
| `customFields[].fields[].label` | `string` | | | The label of the custom field to be shown in the export modal. This should match the label of the custom field in the selected locale. |
|
|
225
|
-
| `renderProperties` | `function` | | | A prop to render properties that are resource-specific |
|
|
231
|
+
| Props | Type | Required | Default | Description |
|
|
232
|
+
| -------------------------------------------- | ------------------------------------------------------- | :--------------------------------------------------: | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
233
|
+
| `isOpen` | `boolean` | | `false` | Controls whether the export modal is open or closed |
|
|
234
|
+
| `outputFormat` | `string`<br/>Possible values: `csv`, `json` | | `csv` | The file format to export |
|
|
235
|
+
| `onExportSuccess` | `function` | | | Callback function that is called when the export operation is successful |
|
|
236
|
+
| `onClose` | `function` | | | Callback function invoked when the modal is requested to close (on overlay click, close button click or `ESC` press). This function is also called after an export operation regardless of its success or failure |
|
|
237
|
+
| `resourceType` | `string` | ✅ | | The type of the resource, example: `category`, `product`... |
|
|
238
|
+
| `totalResourcesCount` | `number` | (✅) Required only if the `exportType` is `all` | | The count of all resources of identified `resourceType` |
|
|
239
|
+
| `exportType` | `string` <br/>Possible values:<br/>`all` and `selected` | | `all` | The type of export, so either export `all` resources or export only `selected` resources |
|
|
240
|
+
| `selectedResourceIds` | `array` | (✅) Required only if the `exportType` is `selected` | | Array of Ids of the selected resources |
|
|
241
|
+
| `fieldGroups` | `array` | ✅ | | Array of the grouped `fields` to export. |
|
|
242
|
+
| `fieldGroups[].groupLabel` | `array` | ✅ | | Array of the grouped `fields` to export. |
|
|
243
|
+
| `fieldGroups[].fields` | `array` | ✅ | | Array of the fields to export. The fields must align with the [commercetools API schema](https://docs.commercetools.com/api/). Field can have nested `fields` array. |
|
|
244
|
+
| `fieldGroups[].fields[].name` | `string` | ✅ | | A string that represents the unique identifier for each field |
|
|
245
|
+
| `fieldGroups[].fields[].label` | `string` | ✅ | | The label of the field to be shown in the export modal |
|
|
246
|
+
| `fieldGroups[].fields[].isRequired` | `boolean` | | `false` | `isRequired` field indicates whether a field is required for the export process. If `true` the field will be selected by default and cannot be deselected by the user. This is useful for fields that are essential for the export process. Fields marked as required will have a `*` appended to their label in the UI |
|
|
247
|
+
| `fieldGroups[].fields[].isSelectedByDefault` | `boolean` | | `true` | This field is a part of the `fields` array is used to control the default state of the corresponding checkbox in the UI. If `isSelectedByDefault` is set to true, the checkbox for that particular field will be checked by default when the component loads. The default value of this attribute is `true` which means unless explicitly set to `false`, the checkbox for the field will be checked on initial load. |
|
|
248
|
+
| `renderProperties` | `function` | | | A prop to render properties that are resource-specific |
|
|
249
|
+
| `fieldOrder` | `string[]` | | | The field names are sorted based on the order passed. The value `*` can be passed to denote any fields and for example fieldOrder=['*', 'custom'] will push all the fields that starts with custom to the last in the list and any other fields will be at the beginning of the list |
|
|
226
250
|
|
|
227
251
|
## Releasing
|
|
228
252
|
|
|
@@ -242,6 +266,10 @@ In case you want to publish a new version with the latest changes you need to:
|
|
|
242
266
|
6. Make sure that everything is correct and then merge `Version Packages` PR.
|
|
243
267
|
7. Wait until the new version is available in NPM and then deploy the custom in CircleCI.
|
|
244
268
|
|
|
269
|
+
### Canary releases
|
|
270
|
+
|
|
271
|
+
Canary releases are automatically published to the distribution channel via CI following a successful build and merge to the **main** branch.
|
|
272
|
+
|
|
245
273
|
## i18n
|
|
246
274
|
|
|
247
275
|
The repo is configured with an integration with Transifex. The process for i18n is the same as the Merchant Center uses.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export * from "./declarations/src/index";
|
|
2
|
+
export { default } from "./declarations/src/index";
|
|
3
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbWVyY2V0b29scy1mcm9udGVuZC1leHRlbnNpb25zLWV4cG9ydC1yZXNvdXJjZXMtbW9kYWwuY2pzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuL2RlY2xhcmF0aW9ucy9zcmMvaW5kZXguZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9
|