@commercetools-frontend-extensions/import-resources-modal 2.0.1 → 2.2.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/dist/commercetools-frontend-extensions-import-resources-modal.cjs.dev.js +47 -3
- package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.prod.js +47 -3
- package/dist/commercetools-frontend-extensions-import-resources-modal.esm.js +47 -3
- package/dist/declarations/src/@hooks/use-import-permission.d.ts +2 -0
- package/package.json +2 -2
|
@@ -578,7 +578,9 @@ const IMPORTABLE_RESOURCES = {
|
|
|
578
578
|
CUSTOMER: 'customer',
|
|
579
579
|
ORDER: 'order',
|
|
580
580
|
PRODUCT_TYPE: 'product-type',
|
|
581
|
-
BUSINESS_UNIT: 'business-unit'
|
|
581
|
+
BUSINESS_UNIT: 'business-unit',
|
|
582
|
+
PRODUCT_TAILORING: 'product-tailoring',
|
|
583
|
+
STANDALONE_PRICE: 'standalone-price'
|
|
582
584
|
};
|
|
583
585
|
|
|
584
586
|
var sharedMessages = reactIntl.defineMessages({
|
|
@@ -622,6 +624,16 @@ var sharedMessages = reactIntl.defineMessages({
|
|
|
622
624
|
description: 'Label for the product type modal title',
|
|
623
625
|
defaultMessage: 'Import product types by CSV'
|
|
624
626
|
},
|
|
627
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.PRODUCT_TAILORING}`]: {
|
|
628
|
+
id: 'ImportResourcesModal.modalTitle.productTailoring',
|
|
629
|
+
description: 'Label for the product tailorings modal title',
|
|
630
|
+
defaultMessage: 'Import tailored products by CSV'
|
|
631
|
+
},
|
|
632
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.STANDALONE_PRICE}`]: {
|
|
633
|
+
id: 'ImportResourcesModal.modalTitle.standalonePrice',
|
|
634
|
+
description: 'Label for the standalone prices modal title',
|
|
635
|
+
defaultMessage: 'Import standalone prices by CSV'
|
|
636
|
+
},
|
|
625
637
|
uploadButton: {
|
|
626
638
|
id: 'ImportResourcesModal.uploadButton',
|
|
627
639
|
description: 'Label for the upload button',
|
|
@@ -823,6 +835,16 @@ var sharedMessages = reactIntl.defineMessages({
|
|
|
823
835
|
description: 'Label for the business-units resource type',
|
|
824
836
|
defaultMessage: 'Business units'
|
|
825
837
|
},
|
|
838
|
+
'product-tailoring': {
|
|
839
|
+
id: 'ImportResourcesModal.product-tailoring',
|
|
840
|
+
description: 'Label for the product-tailoring resource type',
|
|
841
|
+
defaultMessage: 'Tailored product'
|
|
842
|
+
},
|
|
843
|
+
'product-tailorings': {
|
|
844
|
+
id: 'ImportResourcesModal.product-tailorings',
|
|
845
|
+
description: 'Label for the product-tailorings resource type',
|
|
846
|
+
defaultMessage: 'Tailored products'
|
|
847
|
+
},
|
|
826
848
|
unknownResourceType: {
|
|
827
849
|
id: 'ImportResourcesModal.unknown-resource-type',
|
|
828
850
|
description: 'Label for the unknown resource type',
|
|
@@ -1132,7 +1154,10 @@ const PERMISSIONS = {
|
|
|
1132
1154
|
ViewKeyValueDocuments: 'ViewKeyValueDocuments',
|
|
1133
1155
|
// BusinessUnits
|
|
1134
1156
|
ManageBusinessUnits: 'ManageBusinessUnits',
|
|
1135
|
-
ViewBusinessUnits: 'ViewBusinessUnits'
|
|
1157
|
+
ViewBusinessUnits: 'ViewBusinessUnits',
|
|
1158
|
+
// StandalonePrices
|
|
1159
|
+
ManageStandalonePrices: 'ManageStandalonePrices',
|
|
1160
|
+
ViewStandalonePrices: 'ViewStandalonePrices'
|
|
1136
1161
|
};
|
|
1137
1162
|
|
|
1138
1163
|
const useImportPermission = () => {
|
|
@@ -1161,6 +1186,9 @@ const useImportPermission = () => {
|
|
|
1161
1186
|
const canManageBusinessUnits = permissions.useIsAuthorized({
|
|
1162
1187
|
demandedPermissions: [PERMISSIONS.ManageBusinessUnits]
|
|
1163
1188
|
});
|
|
1189
|
+
const canManageStandalonePrices = permissions.useIsAuthorized({
|
|
1190
|
+
demandedPermissions: [PERMISSIONS.ManageStandalonePrices]
|
|
1191
|
+
});
|
|
1164
1192
|
const canImportProducts = React.useMemo(() => {
|
|
1165
1193
|
if (!actionRights) return false;
|
|
1166
1194
|
const canAddPrices = actionRights.canAddPrices,
|
|
@@ -1179,7 +1207,9 @@ const useImportPermission = () => {
|
|
|
1179
1207
|
canImportBusinessUnits: canManageBusinessUnits,
|
|
1180
1208
|
canImportInventories: canManageProducts,
|
|
1181
1209
|
canImportProductTypes: canManageProducts,
|
|
1182
|
-
canImportCustomObjects: canManageCustomObjects
|
|
1210
|
+
canImportCustomObjects: canManageCustomObjects,
|
|
1211
|
+
canImportProductTailorings: canManageProducts,
|
|
1212
|
+
canImportStandalonePrices: canManageStandalonePrices
|
|
1183
1213
|
};
|
|
1184
1214
|
};
|
|
1185
1215
|
|
|
@@ -2131,6 +2161,16 @@ var messages$1 = reactIntl.defineMessages({
|
|
|
2131
2161
|
id: 'ImportResourcesModal.radio.categories',
|
|
2132
2162
|
description: 'Label for the categories radio button',
|
|
2133
2163
|
defaultMessage: 'Categories'
|
|
2164
|
+
},
|
|
2165
|
+
productTailorings: {
|
|
2166
|
+
id: 'ImportResourcesModal.radio.productTailorings',
|
|
2167
|
+
description: 'Label for the product tailorings radio button',
|
|
2168
|
+
defaultMessage: 'Tailored products'
|
|
2169
|
+
},
|
|
2170
|
+
standalonePrices: {
|
|
2171
|
+
id: 'ImportResourcesModal.radio.standalonePrices',
|
|
2172
|
+
description: 'Label for the standalone prices radio button',
|
|
2173
|
+
defaultMessage: 'Standalone prices'
|
|
2134
2174
|
}
|
|
2135
2175
|
});
|
|
2136
2176
|
|
|
@@ -2142,6 +2182,10 @@ const resourceTypeToDisplayName = resourceType => {
|
|
|
2142
2182
|
return messages$1.inventories;
|
|
2143
2183
|
case IMPORTABLE_RESOURCES.CATEGORY:
|
|
2144
2184
|
return messages$1.categories;
|
|
2185
|
+
case IMPORTABLE_RESOURCES.PRODUCT_TAILORING:
|
|
2186
|
+
return messages$1.productTailorings;
|
|
2187
|
+
case IMPORTABLE_RESOURCES.STANDALONE_PRICE:
|
|
2188
|
+
return messages$1.standalonePrices;
|
|
2145
2189
|
default:
|
|
2146
2190
|
throw new operations.UnexpectedResourceTypeError(resourceType);
|
|
2147
2191
|
}
|
|
@@ -578,7 +578,9 @@ const IMPORTABLE_RESOURCES = {
|
|
|
578
578
|
CUSTOMER: 'customer',
|
|
579
579
|
ORDER: 'order',
|
|
580
580
|
PRODUCT_TYPE: 'product-type',
|
|
581
|
-
BUSINESS_UNIT: 'business-unit'
|
|
581
|
+
BUSINESS_UNIT: 'business-unit',
|
|
582
|
+
PRODUCT_TAILORING: 'product-tailoring',
|
|
583
|
+
STANDALONE_PRICE: 'standalone-price'
|
|
582
584
|
};
|
|
583
585
|
|
|
584
586
|
var sharedMessages = reactIntl.defineMessages({
|
|
@@ -622,6 +624,16 @@ var sharedMessages = reactIntl.defineMessages({
|
|
|
622
624
|
description: 'Label for the product type modal title',
|
|
623
625
|
defaultMessage: 'Import product types by CSV'
|
|
624
626
|
},
|
|
627
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.PRODUCT_TAILORING}`]: {
|
|
628
|
+
id: 'ImportResourcesModal.modalTitle.productTailoring',
|
|
629
|
+
description: 'Label for the product tailorings modal title',
|
|
630
|
+
defaultMessage: 'Import tailored products by CSV'
|
|
631
|
+
},
|
|
632
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.STANDALONE_PRICE}`]: {
|
|
633
|
+
id: 'ImportResourcesModal.modalTitle.standalonePrice',
|
|
634
|
+
description: 'Label for the standalone prices modal title',
|
|
635
|
+
defaultMessage: 'Import standalone prices by CSV'
|
|
636
|
+
},
|
|
625
637
|
uploadButton: {
|
|
626
638
|
id: 'ImportResourcesModal.uploadButton',
|
|
627
639
|
description: 'Label for the upload button',
|
|
@@ -823,6 +835,16 @@ var sharedMessages = reactIntl.defineMessages({
|
|
|
823
835
|
description: 'Label for the business-units resource type',
|
|
824
836
|
defaultMessage: 'Business units'
|
|
825
837
|
},
|
|
838
|
+
'product-tailoring': {
|
|
839
|
+
id: 'ImportResourcesModal.product-tailoring',
|
|
840
|
+
description: 'Label for the product-tailoring resource type',
|
|
841
|
+
defaultMessage: 'Tailored product'
|
|
842
|
+
},
|
|
843
|
+
'product-tailorings': {
|
|
844
|
+
id: 'ImportResourcesModal.product-tailorings',
|
|
845
|
+
description: 'Label for the product-tailorings resource type',
|
|
846
|
+
defaultMessage: 'Tailored products'
|
|
847
|
+
},
|
|
826
848
|
unknownResourceType: {
|
|
827
849
|
id: 'ImportResourcesModal.unknown-resource-type',
|
|
828
850
|
description: 'Label for the unknown resource type',
|
|
@@ -1132,7 +1154,10 @@ const PERMISSIONS = {
|
|
|
1132
1154
|
ViewKeyValueDocuments: 'ViewKeyValueDocuments',
|
|
1133
1155
|
// BusinessUnits
|
|
1134
1156
|
ManageBusinessUnits: 'ManageBusinessUnits',
|
|
1135
|
-
ViewBusinessUnits: 'ViewBusinessUnits'
|
|
1157
|
+
ViewBusinessUnits: 'ViewBusinessUnits',
|
|
1158
|
+
// StandalonePrices
|
|
1159
|
+
ManageStandalonePrices: 'ManageStandalonePrices',
|
|
1160
|
+
ViewStandalonePrices: 'ViewStandalonePrices'
|
|
1136
1161
|
};
|
|
1137
1162
|
|
|
1138
1163
|
const useImportPermission = () => {
|
|
@@ -1161,6 +1186,9 @@ const useImportPermission = () => {
|
|
|
1161
1186
|
const canManageBusinessUnits = permissions.useIsAuthorized({
|
|
1162
1187
|
demandedPermissions: [PERMISSIONS.ManageBusinessUnits]
|
|
1163
1188
|
});
|
|
1189
|
+
const canManageStandalonePrices = permissions.useIsAuthorized({
|
|
1190
|
+
demandedPermissions: [PERMISSIONS.ManageStandalonePrices]
|
|
1191
|
+
});
|
|
1164
1192
|
const canImportProducts = React.useMemo(() => {
|
|
1165
1193
|
if (!actionRights) return false;
|
|
1166
1194
|
const canAddPrices = actionRights.canAddPrices,
|
|
@@ -1179,7 +1207,9 @@ const useImportPermission = () => {
|
|
|
1179
1207
|
canImportBusinessUnits: canManageBusinessUnits,
|
|
1180
1208
|
canImportInventories: canManageProducts,
|
|
1181
1209
|
canImportProductTypes: canManageProducts,
|
|
1182
|
-
canImportCustomObjects: canManageCustomObjects
|
|
1210
|
+
canImportCustomObjects: canManageCustomObjects,
|
|
1211
|
+
canImportProductTailorings: canManageProducts,
|
|
1212
|
+
canImportStandalonePrices: canManageStandalonePrices
|
|
1183
1213
|
};
|
|
1184
1214
|
};
|
|
1185
1215
|
|
|
@@ -2107,6 +2137,16 @@ var messages$1 = reactIntl.defineMessages({
|
|
|
2107
2137
|
id: 'ImportResourcesModal.radio.categories',
|
|
2108
2138
|
description: 'Label for the categories radio button',
|
|
2109
2139
|
defaultMessage: 'Categories'
|
|
2140
|
+
},
|
|
2141
|
+
productTailorings: {
|
|
2142
|
+
id: 'ImportResourcesModal.radio.productTailorings',
|
|
2143
|
+
description: 'Label for the product tailorings radio button',
|
|
2144
|
+
defaultMessage: 'Tailored products'
|
|
2145
|
+
},
|
|
2146
|
+
standalonePrices: {
|
|
2147
|
+
id: 'ImportResourcesModal.radio.standalonePrices',
|
|
2148
|
+
description: 'Label for the standalone prices radio button',
|
|
2149
|
+
defaultMessage: 'Standalone prices'
|
|
2110
2150
|
}
|
|
2111
2151
|
});
|
|
2112
2152
|
|
|
@@ -2118,6 +2158,10 @@ const resourceTypeToDisplayName = resourceType => {
|
|
|
2118
2158
|
return messages$1.inventories;
|
|
2119
2159
|
case IMPORTABLE_RESOURCES.CATEGORY:
|
|
2120
2160
|
return messages$1.categories;
|
|
2161
|
+
case IMPORTABLE_RESOURCES.PRODUCT_TAILORING:
|
|
2162
|
+
return messages$1.productTailorings;
|
|
2163
|
+
case IMPORTABLE_RESOURCES.STANDALONE_PRICE:
|
|
2164
|
+
return messages$1.standalonePrices;
|
|
2121
2165
|
default:
|
|
2122
2166
|
throw new operations.UnexpectedResourceTypeError(resourceType);
|
|
2123
2167
|
}
|
|
@@ -557,7 +557,9 @@ const IMPORTABLE_RESOURCES = {
|
|
|
557
557
|
CUSTOMER: 'customer',
|
|
558
558
|
ORDER: 'order',
|
|
559
559
|
PRODUCT_TYPE: 'product-type',
|
|
560
|
-
BUSINESS_UNIT: 'business-unit'
|
|
560
|
+
BUSINESS_UNIT: 'business-unit',
|
|
561
|
+
PRODUCT_TAILORING: 'product-tailoring',
|
|
562
|
+
STANDALONE_PRICE: 'standalone-price'
|
|
561
563
|
};
|
|
562
564
|
|
|
563
565
|
var sharedMessages = defineMessages({
|
|
@@ -601,6 +603,16 @@ var sharedMessages = defineMessages({
|
|
|
601
603
|
description: 'Label for the product type modal title',
|
|
602
604
|
defaultMessage: 'Import product types by CSV'
|
|
603
605
|
},
|
|
606
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.PRODUCT_TAILORING}`]: {
|
|
607
|
+
id: 'ImportResourcesModal.modalTitle.productTailoring',
|
|
608
|
+
description: 'Label for the product tailorings modal title',
|
|
609
|
+
defaultMessage: 'Import tailored products by CSV'
|
|
610
|
+
},
|
|
611
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.STANDALONE_PRICE}`]: {
|
|
612
|
+
id: 'ImportResourcesModal.modalTitle.standalonePrice',
|
|
613
|
+
description: 'Label for the standalone prices modal title',
|
|
614
|
+
defaultMessage: 'Import standalone prices by CSV'
|
|
615
|
+
},
|
|
604
616
|
uploadButton: {
|
|
605
617
|
id: 'ImportResourcesModal.uploadButton',
|
|
606
618
|
description: 'Label for the upload button',
|
|
@@ -802,6 +814,16 @@ var sharedMessages = defineMessages({
|
|
|
802
814
|
description: 'Label for the business-units resource type',
|
|
803
815
|
defaultMessage: 'Business units'
|
|
804
816
|
},
|
|
817
|
+
'product-tailoring': {
|
|
818
|
+
id: 'ImportResourcesModal.product-tailoring',
|
|
819
|
+
description: 'Label for the product-tailoring resource type',
|
|
820
|
+
defaultMessage: 'Tailored product'
|
|
821
|
+
},
|
|
822
|
+
'product-tailorings': {
|
|
823
|
+
id: 'ImportResourcesModal.product-tailorings',
|
|
824
|
+
description: 'Label for the product-tailorings resource type',
|
|
825
|
+
defaultMessage: 'Tailored products'
|
|
826
|
+
},
|
|
805
827
|
unknownResourceType: {
|
|
806
828
|
id: 'ImportResourcesModal.unknown-resource-type',
|
|
807
829
|
description: 'Label for the unknown resource type',
|
|
@@ -1111,7 +1133,10 @@ const PERMISSIONS = {
|
|
|
1111
1133
|
ViewKeyValueDocuments: 'ViewKeyValueDocuments',
|
|
1112
1134
|
// BusinessUnits
|
|
1113
1135
|
ManageBusinessUnits: 'ManageBusinessUnits',
|
|
1114
|
-
ViewBusinessUnits: 'ViewBusinessUnits'
|
|
1136
|
+
ViewBusinessUnits: 'ViewBusinessUnits',
|
|
1137
|
+
// StandalonePrices
|
|
1138
|
+
ManageStandalonePrices: 'ManageStandalonePrices',
|
|
1139
|
+
ViewStandalonePrices: 'ViewStandalonePrices'
|
|
1115
1140
|
};
|
|
1116
1141
|
|
|
1117
1142
|
const useImportPermission = () => {
|
|
@@ -1140,6 +1165,9 @@ const useImportPermission = () => {
|
|
|
1140
1165
|
const canManageBusinessUnits = useIsAuthorized({
|
|
1141
1166
|
demandedPermissions: [PERMISSIONS.ManageBusinessUnits]
|
|
1142
1167
|
});
|
|
1168
|
+
const canManageStandalonePrices = useIsAuthorized({
|
|
1169
|
+
demandedPermissions: [PERMISSIONS.ManageStandalonePrices]
|
|
1170
|
+
});
|
|
1143
1171
|
const canImportProducts = useMemo(() => {
|
|
1144
1172
|
if (!actionRights) return false;
|
|
1145
1173
|
const canAddPrices = actionRights.canAddPrices,
|
|
@@ -1158,7 +1186,9 @@ const useImportPermission = () => {
|
|
|
1158
1186
|
canImportBusinessUnits: canManageBusinessUnits,
|
|
1159
1187
|
canImportInventories: canManageProducts,
|
|
1160
1188
|
canImportProductTypes: canManageProducts,
|
|
1161
|
-
canImportCustomObjects: canManageCustomObjects
|
|
1189
|
+
canImportCustomObjects: canManageCustomObjects,
|
|
1190
|
+
canImportProductTailorings: canManageProducts,
|
|
1191
|
+
canImportStandalonePrices: canManageStandalonePrices
|
|
1162
1192
|
};
|
|
1163
1193
|
};
|
|
1164
1194
|
|
|
@@ -2110,6 +2140,16 @@ var messages$1 = defineMessages({
|
|
|
2110
2140
|
id: 'ImportResourcesModal.radio.categories',
|
|
2111
2141
|
description: 'Label for the categories radio button',
|
|
2112
2142
|
defaultMessage: 'Categories'
|
|
2143
|
+
},
|
|
2144
|
+
productTailorings: {
|
|
2145
|
+
id: 'ImportResourcesModal.radio.productTailorings',
|
|
2146
|
+
description: 'Label for the product tailorings radio button',
|
|
2147
|
+
defaultMessage: 'Tailored products'
|
|
2148
|
+
},
|
|
2149
|
+
standalonePrices: {
|
|
2150
|
+
id: 'ImportResourcesModal.radio.standalonePrices',
|
|
2151
|
+
description: 'Label for the standalone prices radio button',
|
|
2152
|
+
defaultMessage: 'Standalone prices'
|
|
2113
2153
|
}
|
|
2114
2154
|
});
|
|
2115
2155
|
|
|
@@ -2121,6 +2161,10 @@ const resourceTypeToDisplayName = resourceType => {
|
|
|
2121
2161
|
return messages$1.inventories;
|
|
2122
2162
|
case IMPORTABLE_RESOURCES.CATEGORY:
|
|
2123
2163
|
return messages$1.categories;
|
|
2164
|
+
case IMPORTABLE_RESOURCES.PRODUCT_TAILORING:
|
|
2165
|
+
return messages$1.productTailorings;
|
|
2166
|
+
case IMPORTABLE_RESOURCES.STANDALONE_PRICE:
|
|
2167
|
+
return messages$1.standalonePrices;
|
|
2124
2168
|
default:
|
|
2125
2169
|
throw new UnexpectedResourceTypeError$1(resourceType);
|
|
2126
2170
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend-extensions/import-resources-modal",
|
|
3
3
|
"description": "Shared import modal for importing resources",
|
|
4
|
-
"version": "2.0
|
|
4
|
+
"version": "2.2.0",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"pluralize": "8.0.0",
|
|
32
32
|
"prop-types": "15.8.1",
|
|
33
33
|
"ramda": "^0.32.0",
|
|
34
|
-
"@commercetools-frontend-extensions/operations": "4.0
|
|
34
|
+
"@commercetools-frontend-extensions/operations": "4.2.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@commercetools-frontend/actions-global": "27.5.1",
|