@commercetools-frontend-extensions/import-resources-modal 2.0.1 → 2.1.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 +23 -3
- package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.prod.js +23 -3
- package/dist/commercetools-frontend-extensions-import-resources-modal.esm.js +23 -3
- package/dist/declarations/src/@hooks/use-import-permission.d.ts +1 -0
- package/package.json +2 -2
|
@@ -578,7 +578,8 @@ 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
|
+
STANDALONE_PRICE: 'standalone-price'
|
|
582
583
|
};
|
|
583
584
|
|
|
584
585
|
var sharedMessages = reactIntl.defineMessages({
|
|
@@ -622,6 +623,11 @@ var sharedMessages = reactIntl.defineMessages({
|
|
|
622
623
|
description: 'Label for the product type modal title',
|
|
623
624
|
defaultMessage: 'Import product types by CSV'
|
|
624
625
|
},
|
|
626
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.STANDALONE_PRICE}`]: {
|
|
627
|
+
id: 'ImportResourcesModal.modalTitle.standalonePrice',
|
|
628
|
+
description: 'Label for the standalone prices modal title',
|
|
629
|
+
defaultMessage: 'Import standalone prices by CSV'
|
|
630
|
+
},
|
|
625
631
|
uploadButton: {
|
|
626
632
|
id: 'ImportResourcesModal.uploadButton',
|
|
627
633
|
description: 'Label for the upload button',
|
|
@@ -1132,7 +1138,10 @@ const PERMISSIONS = {
|
|
|
1132
1138
|
ViewKeyValueDocuments: 'ViewKeyValueDocuments',
|
|
1133
1139
|
// BusinessUnits
|
|
1134
1140
|
ManageBusinessUnits: 'ManageBusinessUnits',
|
|
1135
|
-
ViewBusinessUnits: 'ViewBusinessUnits'
|
|
1141
|
+
ViewBusinessUnits: 'ViewBusinessUnits',
|
|
1142
|
+
// StandalonePrices
|
|
1143
|
+
ManageStandalonePrices: 'ManageStandalonePrices',
|
|
1144
|
+
ViewStandalonePrices: 'ViewStandalonePrices'
|
|
1136
1145
|
};
|
|
1137
1146
|
|
|
1138
1147
|
const useImportPermission = () => {
|
|
@@ -1161,6 +1170,9 @@ const useImportPermission = () => {
|
|
|
1161
1170
|
const canManageBusinessUnits = permissions.useIsAuthorized({
|
|
1162
1171
|
demandedPermissions: [PERMISSIONS.ManageBusinessUnits]
|
|
1163
1172
|
});
|
|
1173
|
+
const canManageStandalonePrices = permissions.useIsAuthorized({
|
|
1174
|
+
demandedPermissions: [PERMISSIONS.ManageStandalonePrices]
|
|
1175
|
+
});
|
|
1164
1176
|
const canImportProducts = React.useMemo(() => {
|
|
1165
1177
|
if (!actionRights) return false;
|
|
1166
1178
|
const canAddPrices = actionRights.canAddPrices,
|
|
@@ -1179,7 +1191,8 @@ const useImportPermission = () => {
|
|
|
1179
1191
|
canImportBusinessUnits: canManageBusinessUnits,
|
|
1180
1192
|
canImportInventories: canManageProducts,
|
|
1181
1193
|
canImportProductTypes: canManageProducts,
|
|
1182
|
-
canImportCustomObjects: canManageCustomObjects
|
|
1194
|
+
canImportCustomObjects: canManageCustomObjects,
|
|
1195
|
+
canImportStandalonePrices: canManageStandalonePrices
|
|
1183
1196
|
};
|
|
1184
1197
|
};
|
|
1185
1198
|
|
|
@@ -2131,6 +2144,11 @@ var messages$1 = reactIntl.defineMessages({
|
|
|
2131
2144
|
id: 'ImportResourcesModal.radio.categories',
|
|
2132
2145
|
description: 'Label for the categories radio button',
|
|
2133
2146
|
defaultMessage: 'Categories'
|
|
2147
|
+
},
|
|
2148
|
+
standalonePrices: {
|
|
2149
|
+
id: 'ImportResourcesModal.radio.standalonePrices',
|
|
2150
|
+
description: 'Label for the standalone prices radio button',
|
|
2151
|
+
defaultMessage: 'Standalone prices'
|
|
2134
2152
|
}
|
|
2135
2153
|
});
|
|
2136
2154
|
|
|
@@ -2142,6 +2160,8 @@ const resourceTypeToDisplayName = resourceType => {
|
|
|
2142
2160
|
return messages$1.inventories;
|
|
2143
2161
|
case IMPORTABLE_RESOURCES.CATEGORY:
|
|
2144
2162
|
return messages$1.categories;
|
|
2163
|
+
case IMPORTABLE_RESOURCES.STANDALONE_PRICE:
|
|
2164
|
+
return messages$1.standalonePrices;
|
|
2145
2165
|
default:
|
|
2146
2166
|
throw new operations.UnexpectedResourceTypeError(resourceType);
|
|
2147
2167
|
}
|
|
@@ -578,7 +578,8 @@ 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
|
+
STANDALONE_PRICE: 'standalone-price'
|
|
582
583
|
};
|
|
583
584
|
|
|
584
585
|
var sharedMessages = reactIntl.defineMessages({
|
|
@@ -622,6 +623,11 @@ var sharedMessages = reactIntl.defineMessages({
|
|
|
622
623
|
description: 'Label for the product type modal title',
|
|
623
624
|
defaultMessage: 'Import product types by CSV'
|
|
624
625
|
},
|
|
626
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.STANDALONE_PRICE}`]: {
|
|
627
|
+
id: 'ImportResourcesModal.modalTitle.standalonePrice',
|
|
628
|
+
description: 'Label for the standalone prices modal title',
|
|
629
|
+
defaultMessage: 'Import standalone prices by CSV'
|
|
630
|
+
},
|
|
625
631
|
uploadButton: {
|
|
626
632
|
id: 'ImportResourcesModal.uploadButton',
|
|
627
633
|
description: 'Label for the upload button',
|
|
@@ -1132,7 +1138,10 @@ const PERMISSIONS = {
|
|
|
1132
1138
|
ViewKeyValueDocuments: 'ViewKeyValueDocuments',
|
|
1133
1139
|
// BusinessUnits
|
|
1134
1140
|
ManageBusinessUnits: 'ManageBusinessUnits',
|
|
1135
|
-
ViewBusinessUnits: 'ViewBusinessUnits'
|
|
1141
|
+
ViewBusinessUnits: 'ViewBusinessUnits',
|
|
1142
|
+
// StandalonePrices
|
|
1143
|
+
ManageStandalonePrices: 'ManageStandalonePrices',
|
|
1144
|
+
ViewStandalonePrices: 'ViewStandalonePrices'
|
|
1136
1145
|
};
|
|
1137
1146
|
|
|
1138
1147
|
const useImportPermission = () => {
|
|
@@ -1161,6 +1170,9 @@ const useImportPermission = () => {
|
|
|
1161
1170
|
const canManageBusinessUnits = permissions.useIsAuthorized({
|
|
1162
1171
|
demandedPermissions: [PERMISSIONS.ManageBusinessUnits]
|
|
1163
1172
|
});
|
|
1173
|
+
const canManageStandalonePrices = permissions.useIsAuthorized({
|
|
1174
|
+
demandedPermissions: [PERMISSIONS.ManageStandalonePrices]
|
|
1175
|
+
});
|
|
1164
1176
|
const canImportProducts = React.useMemo(() => {
|
|
1165
1177
|
if (!actionRights) return false;
|
|
1166
1178
|
const canAddPrices = actionRights.canAddPrices,
|
|
@@ -1179,7 +1191,8 @@ const useImportPermission = () => {
|
|
|
1179
1191
|
canImportBusinessUnits: canManageBusinessUnits,
|
|
1180
1192
|
canImportInventories: canManageProducts,
|
|
1181
1193
|
canImportProductTypes: canManageProducts,
|
|
1182
|
-
canImportCustomObjects: canManageCustomObjects
|
|
1194
|
+
canImportCustomObjects: canManageCustomObjects,
|
|
1195
|
+
canImportStandalonePrices: canManageStandalonePrices
|
|
1183
1196
|
};
|
|
1184
1197
|
};
|
|
1185
1198
|
|
|
@@ -2107,6 +2120,11 @@ var messages$1 = reactIntl.defineMessages({
|
|
|
2107
2120
|
id: 'ImportResourcesModal.radio.categories',
|
|
2108
2121
|
description: 'Label for the categories radio button',
|
|
2109
2122
|
defaultMessage: 'Categories'
|
|
2123
|
+
},
|
|
2124
|
+
standalonePrices: {
|
|
2125
|
+
id: 'ImportResourcesModal.radio.standalonePrices',
|
|
2126
|
+
description: 'Label for the standalone prices radio button',
|
|
2127
|
+
defaultMessage: 'Standalone prices'
|
|
2110
2128
|
}
|
|
2111
2129
|
});
|
|
2112
2130
|
|
|
@@ -2118,6 +2136,8 @@ const resourceTypeToDisplayName = resourceType => {
|
|
|
2118
2136
|
return messages$1.inventories;
|
|
2119
2137
|
case IMPORTABLE_RESOURCES.CATEGORY:
|
|
2120
2138
|
return messages$1.categories;
|
|
2139
|
+
case IMPORTABLE_RESOURCES.STANDALONE_PRICE:
|
|
2140
|
+
return messages$1.standalonePrices;
|
|
2121
2141
|
default:
|
|
2122
2142
|
throw new operations.UnexpectedResourceTypeError(resourceType);
|
|
2123
2143
|
}
|
|
@@ -557,7 +557,8 @@ 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
|
+
STANDALONE_PRICE: 'standalone-price'
|
|
561
562
|
};
|
|
562
563
|
|
|
563
564
|
var sharedMessages = defineMessages({
|
|
@@ -601,6 +602,11 @@ var sharedMessages = defineMessages({
|
|
|
601
602
|
description: 'Label for the product type modal title',
|
|
602
603
|
defaultMessage: 'Import product types by CSV'
|
|
603
604
|
},
|
|
605
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.STANDALONE_PRICE}`]: {
|
|
606
|
+
id: 'ImportResourcesModal.modalTitle.standalonePrice',
|
|
607
|
+
description: 'Label for the standalone prices modal title',
|
|
608
|
+
defaultMessage: 'Import standalone prices by CSV'
|
|
609
|
+
},
|
|
604
610
|
uploadButton: {
|
|
605
611
|
id: 'ImportResourcesModal.uploadButton',
|
|
606
612
|
description: 'Label for the upload button',
|
|
@@ -1111,7 +1117,10 @@ const PERMISSIONS = {
|
|
|
1111
1117
|
ViewKeyValueDocuments: 'ViewKeyValueDocuments',
|
|
1112
1118
|
// BusinessUnits
|
|
1113
1119
|
ManageBusinessUnits: 'ManageBusinessUnits',
|
|
1114
|
-
ViewBusinessUnits: 'ViewBusinessUnits'
|
|
1120
|
+
ViewBusinessUnits: 'ViewBusinessUnits',
|
|
1121
|
+
// StandalonePrices
|
|
1122
|
+
ManageStandalonePrices: 'ManageStandalonePrices',
|
|
1123
|
+
ViewStandalonePrices: 'ViewStandalonePrices'
|
|
1115
1124
|
};
|
|
1116
1125
|
|
|
1117
1126
|
const useImportPermission = () => {
|
|
@@ -1140,6 +1149,9 @@ const useImportPermission = () => {
|
|
|
1140
1149
|
const canManageBusinessUnits = useIsAuthorized({
|
|
1141
1150
|
demandedPermissions: [PERMISSIONS.ManageBusinessUnits]
|
|
1142
1151
|
});
|
|
1152
|
+
const canManageStandalonePrices = useIsAuthorized({
|
|
1153
|
+
demandedPermissions: [PERMISSIONS.ManageStandalonePrices]
|
|
1154
|
+
});
|
|
1143
1155
|
const canImportProducts = useMemo(() => {
|
|
1144
1156
|
if (!actionRights) return false;
|
|
1145
1157
|
const canAddPrices = actionRights.canAddPrices,
|
|
@@ -1158,7 +1170,8 @@ const useImportPermission = () => {
|
|
|
1158
1170
|
canImportBusinessUnits: canManageBusinessUnits,
|
|
1159
1171
|
canImportInventories: canManageProducts,
|
|
1160
1172
|
canImportProductTypes: canManageProducts,
|
|
1161
|
-
canImportCustomObjects: canManageCustomObjects
|
|
1173
|
+
canImportCustomObjects: canManageCustomObjects,
|
|
1174
|
+
canImportStandalonePrices: canManageStandalonePrices
|
|
1162
1175
|
};
|
|
1163
1176
|
};
|
|
1164
1177
|
|
|
@@ -2110,6 +2123,11 @@ var messages$1 = defineMessages({
|
|
|
2110
2123
|
id: 'ImportResourcesModal.radio.categories',
|
|
2111
2124
|
description: 'Label for the categories radio button',
|
|
2112
2125
|
defaultMessage: 'Categories'
|
|
2126
|
+
},
|
|
2127
|
+
standalonePrices: {
|
|
2128
|
+
id: 'ImportResourcesModal.radio.standalonePrices',
|
|
2129
|
+
description: 'Label for the standalone prices radio button',
|
|
2130
|
+
defaultMessage: 'Standalone prices'
|
|
2113
2131
|
}
|
|
2114
2132
|
});
|
|
2115
2133
|
|
|
@@ -2121,6 +2139,8 @@ const resourceTypeToDisplayName = resourceType => {
|
|
|
2121
2139
|
return messages$1.inventories;
|
|
2122
2140
|
case IMPORTABLE_RESOURCES.CATEGORY:
|
|
2123
2141
|
return messages$1.categories;
|
|
2142
|
+
case IMPORTABLE_RESOURCES.STANDALONE_PRICE:
|
|
2143
|
+
return messages$1.standalonePrices;
|
|
2124
2144
|
default:
|
|
2125
2145
|
throw new UnexpectedResourceTypeError$1(resourceType);
|
|
2126
2146
|
}
|
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.1.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.1.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@commercetools-frontend/actions-global": "27.5.1",
|