@commercetools-frontend-extensions/export-resources-modal 3.6.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md 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
- fields={[
35
- {
36
- name: 'key',
37
- label: 'Category key',
38
- isRequired: true
39
- },
34
+ fieldGroups={[
40
35
  {
41
- name: 'externalId',
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: 'name',
53
- label: 'Parent name',
39
+ name: 'key',
40
+ label: 'Category key',
41
+ isRequired: true,
54
42
  },
55
43
  {
56
- name: 'key',
57
- label: 'Parent key',
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: 'season',
77
- label: 'Season',
53
+ name: 'lastModifiedAt',
54
+ label: 'Last modified at',
55
+ isSelectedByDefault: true,
78
56
  },
57
+ { name: 'name', label: 'Name', isSelectedByDefault: true },
79
58
  {
80
- name: 'target-audience',
81
- label: 'Target audience',
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
- type:{
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: 'genre',
94
- label: 'Genre',
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: 'age-group',
98
- label: 'Age group',
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
- name: 'key',
123
- label: 'Category key',
124
- isRequired: true,
125
- },
126
- {
127
- name: 'externalId',
128
- label: 'External id',
129
- isSelectedByDefault: false,
130
- },
131
- { name: 'createdAt', label: 'Created at' },
132
- { name: 'lastModifiedAt', label: 'Last modified at' },
133
- { name: 'name', label: 'Name' },
134
- {
135
- name: 'parent',
136
- fields: [
137
- {
138
- name: 'name',
139
- label: 'Parent name',
140
- },
141
- {
142
- name: 'key',
143
- label: 'Parent key',
144
- },
145
- ],
146
- },
147
- {
148
- name: 'id',
149
- label: 'Id',
150
- isSelectedByDefault: false,
151
- },
152
- ]}
153
- customFields={[
154
- {
155
- type:{
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
- fields: [
178
- {
179
- name: 'genre',
180
- label: 'Genre',
181
- },
182
- {
183
- name: 'age-group',
184
- label: 'Age group',
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 | Type | Required | Default | Description |
203
- | ------------------------------------- | ------------------------------------------------------- | :--------------------------------------------------: | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
204
- | `isOpen` | `boolean` | | `false` | Controls whether the export modal is open or closed |
205
- | `outputFormat` | `string`<br/>Possible values: `csv`, `json` | | `csv` | The file format to export |
206
- | `onExportSuccess` | `function` | | | Callback function that is called when the export operation is successful |
207
- | `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 |
208
- | `resourceType` | `string` | ✅ | | The type of the resource, example: `category`, `product`... |
209
- | `totalResourcesCount` | `number` | (✅) Required only if the `exportType` is `all` | | The count of all resources of identified `resourceType` |
210
- | `exportType` | `string` <br/>Possible values:<br/>`all` and `selected` | | `all` | The type of export, so either export `all` resources or export only `selected` resources |
211
- | `selectedResourceIds` | `array` | (✅) Required only if the `exportType` is `selected` | | Array of Ids of the selected resources |
212
- | `fields` | `array` | ✅ | | Array of the fields to export. The fields must align with the [commercetools API schema](https://docs.commercetools.com/api/) |
213
- | `fields[].name` | `string` | ✅ | | A string that represents the unique identifier for each field |
214
- | `fields[].label` | `string` | ✅ | | The label of the field to be shown in the export modal |
215
- | `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 |
216
- | `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. |
217
- | `customFields` | `array` | | | Array of objects, each representing a group of custom fields defined under a specific type. |
218
- | `customFields[].type` | `string` | | | The type object. |
219
- | `customFields[].type.key` | `string` | | | The unique identifier for the type. |
220
- | `customFields[].type.label` | `string` | | | The label of the type to be shown in the export modal. |
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.