@commercetools-frontend-extensions/import-resources-modal 1.8.3 → 1.9.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/dist/{active-drag-drop-area-dc11c9dd.cjs.prod.js → active-drag-drop-area-73dfaf5d.cjs.prod.js} +1 -1
- package/dist/{active-drag-drop-area-4c295594.esm.js → active-drag-drop-area-8e57dd40.esm.js} +1 -1
- package/dist/{active-drag-drop-area-1b036a1a.cjs.dev.js → active-drag-drop-area-ba4a851f.cjs.dev.js} +1 -1
- package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.dev.js +1 -1
- package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.prod.js +1 -1
- package/dist/commercetools-frontend-extensions-import-resources-modal.esm.js +1 -1
- package/dist/{de-ba621f66.cjs.prod.js → de-7ed25bdf.cjs.dev.js} +12 -0
- package/dist/{de-cd1c2b61.cjs.dev.js → de-94201791.cjs.prod.js} +12 -0
- package/dist/{de-4d884a52.esm.js → de-cf302015.esm.js} +12 -0
- package/dist/declarations/src/@hooks/use-import-permission.d.ts +2 -0
- package/dist/declarations/src/@types/resource-type.d.ts +2 -1
- package/dist/{disabled-drop-area-9ea4c457.esm.js → disabled-drop-area-034e0448.esm.js} +1 -1
- package/dist/{disabled-drop-area-377a3c8d.cjs.dev.js → disabled-drop-area-d1e857eb.cjs.dev.js} +1 -1
- package/dist/{disabled-drop-area-40108d06.cjs.prod.js → disabled-drop-area-ddd04658.cjs.prod.js} +1 -1
- package/dist/{en-c4f7d882.cjs.dev.js → en-647cd603.cjs.prod.js} +13 -1
- package/dist/{en-88aad148.esm.js → en-850d8c4a.esm.js} +13 -1
- package/dist/{en-102ccf29.cjs.prod.js → en-b68b87c8.cjs.dev.js} +13 -1
- package/dist/{enabled-drop-area-5629adf7.cjs.prod.js → enabled-drop-area-20a79b9e.cjs.prod.js} +1 -1
- package/dist/{enabled-drop-area-e60beae7.esm.js → enabled-drop-area-89b5985e.esm.js} +1 -1
- package/dist/{enabled-drop-area-1bb3ba2c.cjs.dev.js → enabled-drop-area-a7cc9ec4.cjs.dev.js} +1 -1
- package/dist/{es-09b5f26a.cjs.dev.js → es-02f8a321.cjs.prod.js} +12 -0
- package/dist/{es-d589515f.esm.js → es-21c30725.esm.js} +12 -0
- package/dist/{es-1877968a.cjs.prod.js → es-68d1ba91.cjs.dev.js} +12 -0
- package/dist/{file-dropped-area-f5cd314a.esm.js → file-dropped-area-58e15030.esm.js} +1 -1
- package/dist/{file-dropped-area-00056628.cjs.prod.js → file-dropped-area-72914d0f.cjs.prod.js} +1 -1
- package/dist/{file-dropped-area-f251fc3d.cjs.dev.js → file-dropped-area-bacca40c.cjs.dev.js} +1 -1
- package/dist/{fr-FR-1d2ccb65.cjs.prod.js → fr-FR-078895d6.cjs.prod.js} +12 -0
- package/dist/{fr-FR-d672a357.esm.js → fr-FR-3c6878e4.esm.js} +12 -0
- package/dist/{fr-FR-a5fe152a.cjs.dev.js → fr-FR-a9a6c5c9.cjs.dev.js} +12 -0
- package/dist/{index-bf0ed2a7.cjs.dev.js → index-0a743bd2.cjs.dev.js} +75 -22
- package/dist/{index-42eec0a4.esm.js → index-943152ea.esm.js} +75 -22
- package/dist/{index-e152cdce.cjs.prod.js → index-f01fd89f.cjs.prod.js} +75 -22
- package/dist/{pt-BR-606f307c.cjs.prod.js → pt-BR-a50aa3dd.cjs.prod.js} +12 -0
- package/dist/{pt-BR-0389b318.cjs.dev.js → pt-BR-cd32fb09.cjs.dev.js} +12 -0
- package/dist/{pt-BR-3512c390.esm.js → pt-BR-fa0b65c8.esm.js} +12 -0
- package/package.json +6 -6
|
@@ -85,7 +85,8 @@ const EnabledResourceType = {
|
|
|
85
85
|
'discount-code': true,
|
|
86
86
|
customer: false,
|
|
87
87
|
order: false,
|
|
88
|
-
'product-type': false
|
|
88
|
+
'product-type': false,
|
|
89
|
+
'business-unit': true
|
|
89
90
|
};
|
|
90
91
|
function isResourceType(maybeResourceType) {
|
|
91
92
|
return typeof maybeResourceType === 'string' && maybeResourceType in EnabledResourceType;
|
|
@@ -314,7 +315,8 @@ const IMPORTABLE_RESOURCES = {
|
|
|
314
315
|
DISCOUNT_CODE: 'discount-code',
|
|
315
316
|
CUSTOMER: 'customer',
|
|
316
317
|
ORDER: 'order',
|
|
317
|
-
PRODUCT_TYPE: 'product-type'
|
|
318
|
+
PRODUCT_TYPE: 'product-type',
|
|
319
|
+
BUSINESS_UNIT: 'business-unit'
|
|
318
320
|
};
|
|
319
321
|
|
|
320
322
|
const FILE_SIZE_LIMITS_MB = {
|
|
@@ -324,7 +326,8 @@ const FILE_SIZE_LIMITS_MB = {
|
|
|
324
326
|
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 35,
|
|
325
327
|
[IMPORTABLE_RESOURCES.CUSTOMER]: 0,
|
|
326
328
|
[IMPORTABLE_RESOURCES.ORDER]: 0,
|
|
327
|
-
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 35
|
|
329
|
+
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 35,
|
|
330
|
+
[IMPORTABLE_RESOURCES.BUSINESS_UNIT]: 35
|
|
328
331
|
};
|
|
329
332
|
const ROW_LIMITS = {
|
|
330
333
|
[IMPORTABLE_RESOURCES.CATEGORY]: 80_000,
|
|
@@ -333,7 +336,8 @@ const ROW_LIMITS = {
|
|
|
333
336
|
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 80_000,
|
|
334
337
|
[IMPORTABLE_RESOURCES.CUSTOMER]: 0,
|
|
335
338
|
[IMPORTABLE_RESOURCES.ORDER]: 0,
|
|
336
|
-
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 80_000
|
|
339
|
+
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 80_000,
|
|
340
|
+
[IMPORTABLE_RESOURCES.BUSINESS_UNIT]: 80_000
|
|
337
341
|
};
|
|
338
342
|
const RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS = {
|
|
339
343
|
[IMPORTABLE_RESOURCES.CATEGORY]: 'https://docs.commercetools.com/merchant-center/downloads/category_import_template.csv',
|
|
@@ -342,7 +346,8 @@ const RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS = {
|
|
|
342
346
|
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 'https://docs.commercetools.com/merchant-center/downloads/discount_code_import_template.csv',
|
|
343
347
|
[IMPORTABLE_RESOURCES.CUSTOMER]: 'https://docs.commercetools.com/merchant-center/import-data#download-a-template',
|
|
344
348
|
[IMPORTABLE_RESOURCES.ORDER]: 'https://docs.commercetools.com/merchant-center/import-data#download-a-template',
|
|
345
|
-
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 'https://docs.commercetools.com/merchant-center/downloads/product_type_import_template.csv'
|
|
349
|
+
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 'https://docs.commercetools.com/merchant-center/downloads/product_type_import_template.csv',
|
|
350
|
+
[IMPORTABLE_RESOURCES.BUSINESS_UNIT]: 'https://docs.commercetools.com/merchant-center/downloads/business_unit_import_template.csv'
|
|
346
351
|
};
|
|
347
352
|
const RESOURCE_TYPE_DOCUMENTATION_LINKS = {
|
|
348
353
|
[IMPORTABLE_RESOURCES.CATEGORY]: 'https://docs.commercetools.com/merchant-center/import-categories#supported-headers-and-values',
|
|
@@ -351,7 +356,8 @@ const RESOURCE_TYPE_DOCUMENTATION_LINKS = {
|
|
|
351
356
|
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 'https://docs.commercetools.com/merchant-center/import-discount-codes#supported-headers-and-values',
|
|
352
357
|
[IMPORTABLE_RESOURCES.CUSTOMER]: 'https://docs.commercetools.com/merchant-center/import-customers#supported-headers-and-values',
|
|
353
358
|
[IMPORTABLE_RESOURCES.ORDER]: 'https://docs.commercetools.com/merchant-center/import-orders#supported-headers-and-values',
|
|
354
|
-
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 'https://docs.commercetools.com/merchant-center/import-product-types#supported-headers-and-values'
|
|
359
|
+
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 'https://docs.commercetools.com/merchant-center/import-product-types#supported-headers-and-values',
|
|
360
|
+
[IMPORTABLE_RESOURCES.BUSINESS_UNIT]: 'https://docs.commercetools.com/merchant-center/import-business-units#supported-headers-and-values'
|
|
355
361
|
};
|
|
356
362
|
|
|
357
363
|
const CT_API_DOCS_URL = 'https://docs.commercetools.com/api/';
|
|
@@ -368,7 +374,19 @@ const PERMISSIONS = {
|
|
|
368
374
|
ViewProductTypes: 'ViewProductTypes',
|
|
369
375
|
// DiscountCodes
|
|
370
376
|
ManageDiscountCodes: 'ManageDiscountCodes',
|
|
371
|
-
ViewDiscountCodes: 'ViewDiscountCodes'
|
|
377
|
+
ViewDiscountCodes: 'ViewDiscountCodes',
|
|
378
|
+
// Customers
|
|
379
|
+
ManageCustomers: 'ManageCustomers',
|
|
380
|
+
ViewCustomers: 'ViewCustomers',
|
|
381
|
+
// Orders
|
|
382
|
+
ManageOrders: 'ManageOrders',
|
|
383
|
+
ViewOrders: 'ViewOrders',
|
|
384
|
+
// KeyValueDocuments
|
|
385
|
+
ManageKeyValueDocuments: 'ManageKeyValueDocuments',
|
|
386
|
+
ViewKeyValueDocuments: 'ViewKeyValueDocuments',
|
|
387
|
+
// BusinessUnits
|
|
388
|
+
ManageBusinessUnits: 'ManageBusinessUnits',
|
|
389
|
+
ViewBusinessUnits: 'ViewBusinessUnits'
|
|
372
390
|
};
|
|
373
391
|
const ACTION_RIGHTS = {
|
|
374
392
|
PublishProducts: {
|
|
@@ -408,6 +426,11 @@ var sharedMessages = reactIntl.defineMessages({
|
|
|
408
426
|
description: 'Label for the inventories modal title',
|
|
409
427
|
defaultMessage: 'Import discount codes by CSV'
|
|
410
428
|
},
|
|
429
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.BUSINESS_UNIT}`]: {
|
|
430
|
+
id: 'ImportResourcesModal.modalTitle.businessUnit',
|
|
431
|
+
description: 'Label for the business units modal title',
|
|
432
|
+
defaultMessage: 'Import business units by CSV'
|
|
433
|
+
},
|
|
411
434
|
[`modalTitle.${IMPORTABLE_RESOURCES.CUSTOMER}`]: {
|
|
412
435
|
id: 'ImportResourcesModal.modalTitle.customer',
|
|
413
436
|
description: 'Label for the customers modal title',
|
|
@@ -614,6 +637,16 @@ var sharedMessages = reactIntl.defineMessages({
|
|
|
614
637
|
description: 'Label for the discount-codes resource type',
|
|
615
638
|
defaultMessage: 'Discount codes'
|
|
616
639
|
},
|
|
640
|
+
'business-unit': {
|
|
641
|
+
id: 'ImportResourcesModal.business-unit',
|
|
642
|
+
description: 'Label for the business-unit resource type',
|
|
643
|
+
defaultMessage: 'Business unit'
|
|
644
|
+
},
|
|
645
|
+
'business-units': {
|
|
646
|
+
id: 'ImportResourcesModal.business-units',
|
|
647
|
+
description: 'Label for the business-units resource type',
|
|
648
|
+
defaultMessage: 'Business units'
|
|
649
|
+
},
|
|
617
650
|
unknownResourceType: {
|
|
618
651
|
id: 'ImportResourcesModal.unknown-resource-type',
|
|
619
652
|
description: 'Label for the unknown resource type',
|
|
@@ -785,6 +818,7 @@ function resourceTypeToMessage(resourceType) {
|
|
|
785
818
|
'product-variant-patch': sharedMessages['product-variant-patch'],
|
|
786
819
|
'standalone-price': sharedMessages['standalone-price'],
|
|
787
820
|
'custom-object': sharedMessages['custom-object'],
|
|
821
|
+
'business-unit': sharedMessages['business-unit'],
|
|
788
822
|
type: sharedMessages.type
|
|
789
823
|
};
|
|
790
824
|
const message = resourceTypeMap[resourceType];
|
|
@@ -810,7 +844,8 @@ function resourceTypeToPluralMessage(resourceType) {
|
|
|
810
844
|
'product-draft': sharedMessages['product-drafts'],
|
|
811
845
|
'product-variant': sharedMessages['product-variants'],
|
|
812
846
|
'product-variant-patch': sharedMessages['product-variant-patches'],
|
|
813
|
-
'standalone-price': sharedMessages['standalone-prices']
|
|
847
|
+
'standalone-price': sharedMessages['standalone-prices'],
|
|
848
|
+
'business-unit': sharedMessages['business-units']
|
|
814
849
|
};
|
|
815
850
|
const message = resourceTypePluralMap[resourceType];
|
|
816
851
|
if (!message) {
|
|
@@ -1071,13 +1106,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
1071
1106
|
return /*#__PURE__*/react.css(process.env.NODE_ENV === "production" ? "" : ";label:getDefaultDropWrapperStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRyb3AtYXJlYS13cmFwcGVyLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE0QlkiLCJmaWxlIjoiZHJvcC1hcmVhLXdyYXBwZXIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgdHlwZSBEcm9wem9uZVJvb3RQcm9wcyB9IGZyb20gJ3JlYWN0LWRyb3B6b25lJ1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCdcbmltcG9ydCB7IHN0eWxlcyB9IGZyb20gJy4vc3R5bGVzJ1xuaW1wb3J0IHsgdHlwZSBEcm9wQXJlYVN0YXRlIH0gZnJvbSAnLi4vLi4vLi4vQHR5cGVzJ1xuXG5pbnRlcmZhY2UgRHJvcFdyYXBwZXJQcm9wcyBleHRlbmRzIERyb3B6b25lUm9vdFByb3BzIHtcbiAgZHJvcEFyZWFTdGF0ZTogRHJvcEFyZWFTdGF0ZVxufVxuZXhwb3J0IGNvbnN0IERyb3BXcmFwcGVyID0gc3R5bGVkLmRpdjxEcm9wV3JhcHBlclByb3BzPmBcbiAgJHtzdHlsZXMuYmFzZX1cbiAgJHsocHJvcHMpID0+IHtcbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ2Rpc2FibGVkJykge1xuICAgICAgcmV0dXJuIHN0eWxlcy5kaXNhYmxlZFxuICAgIH1cbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ3JlYWR5LWZvci1kcm9wJykge1xuICAgICAgcmV0dXJuIHN0eWxlcy5yZWFkeUZvckRyb3BcbiAgICB9XG4gICAgaWYgKHByb3BzLmRyb3BBcmVhU3RhdGUgPT09ICdhY3RpdmUtZHJhZycpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuYWN0aXZlRHJhZ1xuICAgIH1cbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ2ZpbGUtZHJvcHBlZCcpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuZmlsZURyb3BwZWRcbiAgICB9XG4gICAgcmV0dXJuIGdldERlZmF1bHREcm9wV3JhcHBlclN0eWxlcyhwcm9wcy5kcm9wQXJlYVN0YXRlKVxuICB9fVxuYFxuZnVuY3Rpb24gZ2V0RGVmYXVsdERyb3BXcmFwcGVyU3R5bGVzKF9kcm9wQXJlYVN0YXRlOiBuZXZlcikge1xuICByZXR1cm4gY3NzYGBcbn1cbiJdfQ== */");
|
|
1072
1107
|
}
|
|
1073
1108
|
|
|
1074
|
-
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-
|
|
1109
|
+
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-ba4a851f.cjs.dev.js'); }));
|
|
1075
1110
|
|
|
1076
|
-
var DisabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./disabled-drop-area-
|
|
1111
|
+
var DisabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./disabled-drop-area-d1e857eb.cjs.dev.js'); }));
|
|
1077
1112
|
|
|
1078
|
-
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-
|
|
1113
|
+
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-a7cc9ec4.cjs.dev.js'); }));
|
|
1079
1114
|
|
|
1080
|
-
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-
|
|
1115
|
+
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-bacca40c.cjs.dev.js'); }));
|
|
1081
1116
|
|
|
1082
1117
|
function getDropArea(_ref) {
|
|
1083
1118
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -1399,12 +1434,24 @@ const useImportPermission = () => {
|
|
|
1399
1434
|
const canManageProducts = permissions.useIsAuthorized({
|
|
1400
1435
|
demandedPermissions: [PERMISSIONS.ManageProducts]
|
|
1401
1436
|
});
|
|
1402
|
-
const
|
|
1437
|
+
const canManageCustomers = permissions.useIsAuthorized({
|
|
1438
|
+
demandedPermissions: [PERMISSIONS.ManageCustomers]
|
|
1439
|
+
});
|
|
1440
|
+
const canManageOrders = permissions.useIsAuthorized({
|
|
1441
|
+
demandedPermissions: [PERMISSIONS.ManageOrders]
|
|
1442
|
+
});
|
|
1443
|
+
const canManageKeyValueDocuments = permissions.useIsAuthorized({
|
|
1444
|
+
demandedPermissions: [PERMISSIONS.ManageKeyValueDocuments]
|
|
1445
|
+
});
|
|
1446
|
+
const canMAnageCategories = permissions.useIsAuthorized({
|
|
1403
1447
|
demandedPermissions: [PERMISSIONS.ManageCategories]
|
|
1404
1448
|
});
|
|
1405
|
-
const
|
|
1449
|
+
const canManageDiscountCodes = permissions.useIsAuthorized({
|
|
1406
1450
|
demandedPermissions: [PERMISSIONS.ManageDiscountCodes]
|
|
1407
1451
|
});
|
|
1452
|
+
const canManageBusinessUnits = permissions.useIsAuthorized({
|
|
1453
|
+
demandedPermissions: [PERMISSIONS.ManageBusinessUnits]
|
|
1454
|
+
});
|
|
1408
1455
|
const canImportProducts = React.useMemo(() => {
|
|
1409
1456
|
if (!actionRights) return false;
|
|
1410
1457
|
const canAddPrices = actionRights.canAddPrices,
|
|
@@ -1413,12 +1460,17 @@ const useImportPermission = () => {
|
|
|
1413
1460
|
canEditPrices = actionRights.canEditPrices;
|
|
1414
1461
|
return canManageProducts && canAddPrices && canAddProducts && canEditAttributesAll && canEditPrices;
|
|
1415
1462
|
}, [canManageProducts, actionRights]);
|
|
1463
|
+
const canManageCustomObjects = React.useMemo(() => {
|
|
1464
|
+
return canManageProducts || canManageCustomers || canManageOrders || canManageKeyValueDocuments;
|
|
1465
|
+
}, [canManageCustomers, canManageOrders, canManageProducts, canManageKeyValueDocuments]);
|
|
1416
1466
|
return {
|
|
1417
1467
|
canImportProducts,
|
|
1418
|
-
canImportCategories,
|
|
1419
|
-
canImportDiscountCodes,
|
|
1468
|
+
canImportCategories: canMAnageCategories,
|
|
1469
|
+
canImportDiscountCodes: canManageDiscountCodes,
|
|
1470
|
+
canImportBusinessUnits: canManageBusinessUnits,
|
|
1420
1471
|
canImportInventories: canManageProducts,
|
|
1421
|
-
canImportProductTypes: canManageProducts
|
|
1472
|
+
canImportProductTypes: canManageProducts,
|
|
1473
|
+
canImportCustomObjects: canManageCustomObjects
|
|
1422
1474
|
};
|
|
1423
1475
|
};
|
|
1424
1476
|
|
|
@@ -1512,6 +1564,7 @@ const UploadProductSettings = () => {
|
|
|
1512
1564
|
state = _useImportResourcesCo.state,
|
|
1513
1565
|
actions = _useImportResourcesCo.actions;
|
|
1514
1566
|
return jsxRuntime.jsx(uiKit.CheckboxInput, {
|
|
1567
|
+
"data-tracking-target": 'product_import-publish_checkbox',
|
|
1515
1568
|
isChecked: state.settings?.publish,
|
|
1516
1569
|
onChange: e => {
|
|
1517
1570
|
actions.setUploadSettings({
|
|
@@ -2491,17 +2544,17 @@ const getChunkImport = locale => {
|
|
|
2491
2544
|
const intlLocale = i18n.mapLocaleToIntlLocale(locale);
|
|
2492
2545
|
switch (intlLocale) {
|
|
2493
2546
|
case 'de':
|
|
2494
|
-
return Promise.resolve().then(function () { return require('./de-
|
|
2547
|
+
return Promise.resolve().then(function () { return require('./de-7ed25bdf.cjs.dev.js'); });
|
|
2495
2548
|
case 'es':
|
|
2496
|
-
return Promise.resolve().then(function () { return require('./es-
|
|
2549
|
+
return Promise.resolve().then(function () { return require('./es-68d1ba91.cjs.dev.js'); });
|
|
2497
2550
|
case 'fr-FR':
|
|
2498
|
-
return Promise.resolve().then(function () { return require('./fr-FR-
|
|
2551
|
+
return Promise.resolve().then(function () { return require('./fr-FR-a9a6c5c9.cjs.dev.js'); });
|
|
2499
2552
|
case 'ja':
|
|
2500
2553
|
return Promise.resolve().then(function () { return require('./ja-9bd5f452.cjs.dev.js'); });
|
|
2501
2554
|
case 'pt-BR':
|
|
2502
|
-
return Promise.resolve().then(function () { return require('./pt-BR-
|
|
2555
|
+
return Promise.resolve().then(function () { return require('./pt-BR-cd32fb09.cjs.dev.js'); });
|
|
2503
2556
|
default:
|
|
2504
|
-
return Promise.resolve().then(function () { return require('./en-
|
|
2557
|
+
return Promise.resolve().then(function () { return require('./en-b68b87c8.cjs.dev.js'); });
|
|
2505
2558
|
}
|
|
2506
2559
|
};
|
|
2507
2560
|
const loadMessages = async locale => {
|
|
@@ -57,7 +57,8 @@ const EnabledResourceType = {
|
|
|
57
57
|
'discount-code': true,
|
|
58
58
|
customer: false,
|
|
59
59
|
order: false,
|
|
60
|
-
'product-type': false
|
|
60
|
+
'product-type': false,
|
|
61
|
+
'business-unit': true
|
|
61
62
|
};
|
|
62
63
|
function isResourceType(maybeResourceType) {
|
|
63
64
|
return typeof maybeResourceType === 'string' && maybeResourceType in EnabledResourceType;
|
|
@@ -286,7 +287,8 @@ const IMPORTABLE_RESOURCES = {
|
|
|
286
287
|
DISCOUNT_CODE: 'discount-code',
|
|
287
288
|
CUSTOMER: 'customer',
|
|
288
289
|
ORDER: 'order',
|
|
289
|
-
PRODUCT_TYPE: 'product-type'
|
|
290
|
+
PRODUCT_TYPE: 'product-type',
|
|
291
|
+
BUSINESS_UNIT: 'business-unit'
|
|
290
292
|
};
|
|
291
293
|
|
|
292
294
|
const FILE_SIZE_LIMITS_MB = {
|
|
@@ -296,7 +298,8 @@ const FILE_SIZE_LIMITS_MB = {
|
|
|
296
298
|
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 35,
|
|
297
299
|
[IMPORTABLE_RESOURCES.CUSTOMER]: 0,
|
|
298
300
|
[IMPORTABLE_RESOURCES.ORDER]: 0,
|
|
299
|
-
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 35
|
|
301
|
+
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 35,
|
|
302
|
+
[IMPORTABLE_RESOURCES.BUSINESS_UNIT]: 35
|
|
300
303
|
};
|
|
301
304
|
const ROW_LIMITS = {
|
|
302
305
|
[IMPORTABLE_RESOURCES.CATEGORY]: 80_000,
|
|
@@ -305,7 +308,8 @@ const ROW_LIMITS = {
|
|
|
305
308
|
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 80_000,
|
|
306
309
|
[IMPORTABLE_RESOURCES.CUSTOMER]: 0,
|
|
307
310
|
[IMPORTABLE_RESOURCES.ORDER]: 0,
|
|
308
|
-
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 80_000
|
|
311
|
+
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 80_000,
|
|
312
|
+
[IMPORTABLE_RESOURCES.BUSINESS_UNIT]: 80_000
|
|
309
313
|
};
|
|
310
314
|
const RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS = {
|
|
311
315
|
[IMPORTABLE_RESOURCES.CATEGORY]: 'https://docs.commercetools.com/merchant-center/downloads/category_import_template.csv',
|
|
@@ -314,7 +318,8 @@ const RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS = {
|
|
|
314
318
|
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 'https://docs.commercetools.com/merchant-center/downloads/discount_code_import_template.csv',
|
|
315
319
|
[IMPORTABLE_RESOURCES.CUSTOMER]: 'https://docs.commercetools.com/merchant-center/import-data#download-a-template',
|
|
316
320
|
[IMPORTABLE_RESOURCES.ORDER]: 'https://docs.commercetools.com/merchant-center/import-data#download-a-template',
|
|
317
|
-
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 'https://docs.commercetools.com/merchant-center/downloads/product_type_import_template.csv'
|
|
321
|
+
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 'https://docs.commercetools.com/merchant-center/downloads/product_type_import_template.csv',
|
|
322
|
+
[IMPORTABLE_RESOURCES.BUSINESS_UNIT]: 'https://docs.commercetools.com/merchant-center/downloads/business_unit_import_template.csv'
|
|
318
323
|
};
|
|
319
324
|
const RESOURCE_TYPE_DOCUMENTATION_LINKS = {
|
|
320
325
|
[IMPORTABLE_RESOURCES.CATEGORY]: 'https://docs.commercetools.com/merchant-center/import-categories#supported-headers-and-values',
|
|
@@ -323,7 +328,8 @@ const RESOURCE_TYPE_DOCUMENTATION_LINKS = {
|
|
|
323
328
|
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 'https://docs.commercetools.com/merchant-center/import-discount-codes#supported-headers-and-values',
|
|
324
329
|
[IMPORTABLE_RESOURCES.CUSTOMER]: 'https://docs.commercetools.com/merchant-center/import-customers#supported-headers-and-values',
|
|
325
330
|
[IMPORTABLE_RESOURCES.ORDER]: 'https://docs.commercetools.com/merchant-center/import-orders#supported-headers-and-values',
|
|
326
|
-
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 'https://docs.commercetools.com/merchant-center/import-product-types#supported-headers-and-values'
|
|
331
|
+
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 'https://docs.commercetools.com/merchant-center/import-product-types#supported-headers-and-values',
|
|
332
|
+
[IMPORTABLE_RESOURCES.BUSINESS_UNIT]: 'https://docs.commercetools.com/merchant-center/import-business-units#supported-headers-and-values'
|
|
327
333
|
};
|
|
328
334
|
|
|
329
335
|
const CT_API_DOCS_URL = 'https://docs.commercetools.com/api/';
|
|
@@ -340,7 +346,19 @@ const PERMISSIONS = {
|
|
|
340
346
|
ViewProductTypes: 'ViewProductTypes',
|
|
341
347
|
// DiscountCodes
|
|
342
348
|
ManageDiscountCodes: 'ManageDiscountCodes',
|
|
343
|
-
ViewDiscountCodes: 'ViewDiscountCodes'
|
|
349
|
+
ViewDiscountCodes: 'ViewDiscountCodes',
|
|
350
|
+
// Customers
|
|
351
|
+
ManageCustomers: 'ManageCustomers',
|
|
352
|
+
ViewCustomers: 'ViewCustomers',
|
|
353
|
+
// Orders
|
|
354
|
+
ManageOrders: 'ManageOrders',
|
|
355
|
+
ViewOrders: 'ViewOrders',
|
|
356
|
+
// KeyValueDocuments
|
|
357
|
+
ManageKeyValueDocuments: 'ManageKeyValueDocuments',
|
|
358
|
+
ViewKeyValueDocuments: 'ViewKeyValueDocuments',
|
|
359
|
+
// BusinessUnits
|
|
360
|
+
ManageBusinessUnits: 'ManageBusinessUnits',
|
|
361
|
+
ViewBusinessUnits: 'ViewBusinessUnits'
|
|
344
362
|
};
|
|
345
363
|
const ACTION_RIGHTS = {
|
|
346
364
|
PublishProducts: {
|
|
@@ -380,6 +398,11 @@ var sharedMessages = defineMessages({
|
|
|
380
398
|
description: 'Label for the inventories modal title',
|
|
381
399
|
defaultMessage: 'Import discount codes by CSV'
|
|
382
400
|
},
|
|
401
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.BUSINESS_UNIT}`]: {
|
|
402
|
+
id: 'ImportResourcesModal.modalTitle.businessUnit',
|
|
403
|
+
description: 'Label for the business units modal title',
|
|
404
|
+
defaultMessage: 'Import business units by CSV'
|
|
405
|
+
},
|
|
383
406
|
[`modalTitle.${IMPORTABLE_RESOURCES.CUSTOMER}`]: {
|
|
384
407
|
id: 'ImportResourcesModal.modalTitle.customer',
|
|
385
408
|
description: 'Label for the customers modal title',
|
|
@@ -586,6 +609,16 @@ var sharedMessages = defineMessages({
|
|
|
586
609
|
description: 'Label for the discount-codes resource type',
|
|
587
610
|
defaultMessage: 'Discount codes'
|
|
588
611
|
},
|
|
612
|
+
'business-unit': {
|
|
613
|
+
id: 'ImportResourcesModal.business-unit',
|
|
614
|
+
description: 'Label for the business-unit resource type',
|
|
615
|
+
defaultMessage: 'Business unit'
|
|
616
|
+
},
|
|
617
|
+
'business-units': {
|
|
618
|
+
id: 'ImportResourcesModal.business-units',
|
|
619
|
+
description: 'Label for the business-units resource type',
|
|
620
|
+
defaultMessage: 'Business units'
|
|
621
|
+
},
|
|
589
622
|
unknownResourceType: {
|
|
590
623
|
id: 'ImportResourcesModal.unknown-resource-type',
|
|
591
624
|
description: 'Label for the unknown resource type',
|
|
@@ -757,6 +790,7 @@ function resourceTypeToMessage(resourceType) {
|
|
|
757
790
|
'product-variant-patch': sharedMessages['product-variant-patch'],
|
|
758
791
|
'standalone-price': sharedMessages['standalone-price'],
|
|
759
792
|
'custom-object': sharedMessages['custom-object'],
|
|
793
|
+
'business-unit': sharedMessages['business-unit'],
|
|
760
794
|
type: sharedMessages.type
|
|
761
795
|
};
|
|
762
796
|
const message = resourceTypeMap[resourceType];
|
|
@@ -782,7 +816,8 @@ function resourceTypeToPluralMessage(resourceType) {
|
|
|
782
816
|
'product-draft': sharedMessages['product-drafts'],
|
|
783
817
|
'product-variant': sharedMessages['product-variants'],
|
|
784
818
|
'product-variant-patch': sharedMessages['product-variant-patches'],
|
|
785
|
-
'standalone-price': sharedMessages['standalone-prices']
|
|
819
|
+
'standalone-price': sharedMessages['standalone-prices'],
|
|
820
|
+
'business-unit': sharedMessages['business-units']
|
|
786
821
|
};
|
|
787
822
|
const message = resourceTypePluralMap[resourceType];
|
|
788
823
|
if (!message) {
|
|
@@ -1043,13 +1078,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
1043
1078
|
return /*#__PURE__*/css(process.env.NODE_ENV === "production" ? "" : ";label:getDefaultDropWrapperStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRyb3AtYXJlYS13cmFwcGVyLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE0QlkiLCJmaWxlIjoiZHJvcC1hcmVhLXdyYXBwZXIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgdHlwZSBEcm9wem9uZVJvb3RQcm9wcyB9IGZyb20gJ3JlYWN0LWRyb3B6b25lJ1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCdcbmltcG9ydCB7IHN0eWxlcyB9IGZyb20gJy4vc3R5bGVzJ1xuaW1wb3J0IHsgdHlwZSBEcm9wQXJlYVN0YXRlIH0gZnJvbSAnLi4vLi4vLi4vQHR5cGVzJ1xuXG5pbnRlcmZhY2UgRHJvcFdyYXBwZXJQcm9wcyBleHRlbmRzIERyb3B6b25lUm9vdFByb3BzIHtcbiAgZHJvcEFyZWFTdGF0ZTogRHJvcEFyZWFTdGF0ZVxufVxuZXhwb3J0IGNvbnN0IERyb3BXcmFwcGVyID0gc3R5bGVkLmRpdjxEcm9wV3JhcHBlclByb3BzPmBcbiAgJHtzdHlsZXMuYmFzZX1cbiAgJHsocHJvcHMpID0+IHtcbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ2Rpc2FibGVkJykge1xuICAgICAgcmV0dXJuIHN0eWxlcy5kaXNhYmxlZFxuICAgIH1cbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ3JlYWR5LWZvci1kcm9wJykge1xuICAgICAgcmV0dXJuIHN0eWxlcy5yZWFkeUZvckRyb3BcbiAgICB9XG4gICAgaWYgKHByb3BzLmRyb3BBcmVhU3RhdGUgPT09ICdhY3RpdmUtZHJhZycpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuYWN0aXZlRHJhZ1xuICAgIH1cbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ2ZpbGUtZHJvcHBlZCcpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuZmlsZURyb3BwZWRcbiAgICB9XG4gICAgcmV0dXJuIGdldERlZmF1bHREcm9wV3JhcHBlclN0eWxlcyhwcm9wcy5kcm9wQXJlYVN0YXRlKVxuICB9fVxuYFxuZnVuY3Rpb24gZ2V0RGVmYXVsdERyb3BXcmFwcGVyU3R5bGVzKF9kcm9wQXJlYVN0YXRlOiBuZXZlcikge1xuICByZXR1cm4gY3NzYGBcbn1cbiJdfQ== */");
|
|
1044
1079
|
}
|
|
1045
1080
|
|
|
1046
|
-
var ActiveDragDropArea = /*#__PURE__*/lazy(() => import('./active-drag-drop-area-
|
|
1081
|
+
var ActiveDragDropArea = /*#__PURE__*/lazy(() => import('./active-drag-drop-area-8e57dd40.esm.js'));
|
|
1047
1082
|
|
|
1048
|
-
var DisabledDropArea = /*#__PURE__*/lazy(() => import('./disabled-drop-area-
|
|
1083
|
+
var DisabledDropArea = /*#__PURE__*/lazy(() => import('./disabled-drop-area-034e0448.esm.js'));
|
|
1049
1084
|
|
|
1050
|
-
var EnabledDropArea = /*#__PURE__*/lazy(() => import('./enabled-drop-area-
|
|
1085
|
+
var EnabledDropArea = /*#__PURE__*/lazy(() => import('./enabled-drop-area-89b5985e.esm.js'));
|
|
1051
1086
|
|
|
1052
|
-
var FileDropped = /*#__PURE__*/lazy(() => import('./file-dropped-area-
|
|
1087
|
+
var FileDropped = /*#__PURE__*/lazy(() => import('./file-dropped-area-58e15030.esm.js'));
|
|
1053
1088
|
|
|
1054
1089
|
function getDropArea(_ref) {
|
|
1055
1090
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -1371,12 +1406,24 @@ const useImportPermission = () => {
|
|
|
1371
1406
|
const canManageProducts = useIsAuthorized({
|
|
1372
1407
|
demandedPermissions: [PERMISSIONS.ManageProducts]
|
|
1373
1408
|
});
|
|
1374
|
-
const
|
|
1409
|
+
const canManageCustomers = useIsAuthorized({
|
|
1410
|
+
demandedPermissions: [PERMISSIONS.ManageCustomers]
|
|
1411
|
+
});
|
|
1412
|
+
const canManageOrders = useIsAuthorized({
|
|
1413
|
+
demandedPermissions: [PERMISSIONS.ManageOrders]
|
|
1414
|
+
});
|
|
1415
|
+
const canManageKeyValueDocuments = useIsAuthorized({
|
|
1416
|
+
demandedPermissions: [PERMISSIONS.ManageKeyValueDocuments]
|
|
1417
|
+
});
|
|
1418
|
+
const canMAnageCategories = useIsAuthorized({
|
|
1375
1419
|
demandedPermissions: [PERMISSIONS.ManageCategories]
|
|
1376
1420
|
});
|
|
1377
|
-
const
|
|
1421
|
+
const canManageDiscountCodes = useIsAuthorized({
|
|
1378
1422
|
demandedPermissions: [PERMISSIONS.ManageDiscountCodes]
|
|
1379
1423
|
});
|
|
1424
|
+
const canManageBusinessUnits = useIsAuthorized({
|
|
1425
|
+
demandedPermissions: [PERMISSIONS.ManageBusinessUnits]
|
|
1426
|
+
});
|
|
1380
1427
|
const canImportProducts = useMemo(() => {
|
|
1381
1428
|
if (!actionRights) return false;
|
|
1382
1429
|
const canAddPrices = actionRights.canAddPrices,
|
|
@@ -1385,12 +1432,17 @@ const useImportPermission = () => {
|
|
|
1385
1432
|
canEditPrices = actionRights.canEditPrices;
|
|
1386
1433
|
return canManageProducts && canAddPrices && canAddProducts && canEditAttributesAll && canEditPrices;
|
|
1387
1434
|
}, [canManageProducts, actionRights]);
|
|
1435
|
+
const canManageCustomObjects = useMemo(() => {
|
|
1436
|
+
return canManageProducts || canManageCustomers || canManageOrders || canManageKeyValueDocuments;
|
|
1437
|
+
}, [canManageCustomers, canManageOrders, canManageProducts, canManageKeyValueDocuments]);
|
|
1388
1438
|
return {
|
|
1389
1439
|
canImportProducts,
|
|
1390
|
-
canImportCategories,
|
|
1391
|
-
canImportDiscountCodes,
|
|
1440
|
+
canImportCategories: canMAnageCategories,
|
|
1441
|
+
canImportDiscountCodes: canManageDiscountCodes,
|
|
1442
|
+
canImportBusinessUnits: canManageBusinessUnits,
|
|
1392
1443
|
canImportInventories: canManageProducts,
|
|
1393
|
-
canImportProductTypes: canManageProducts
|
|
1444
|
+
canImportProductTypes: canManageProducts,
|
|
1445
|
+
canImportCustomObjects: canManageCustomObjects
|
|
1394
1446
|
};
|
|
1395
1447
|
};
|
|
1396
1448
|
|
|
@@ -1484,6 +1536,7 @@ const UploadProductSettings = () => {
|
|
|
1484
1536
|
state = _useImportResourcesCo.state,
|
|
1485
1537
|
actions = _useImportResourcesCo.actions;
|
|
1486
1538
|
return jsx(CheckboxInput, {
|
|
1539
|
+
"data-tracking-target": 'product_import-publish_checkbox',
|
|
1487
1540
|
isChecked: state.settings?.publish,
|
|
1488
1541
|
onChange: e => {
|
|
1489
1542
|
actions.setUploadSettings({
|
|
@@ -2463,17 +2516,17 @@ const getChunkImport = locale => {
|
|
|
2463
2516
|
const intlLocale = mapLocaleToIntlLocale(locale);
|
|
2464
2517
|
switch (intlLocale) {
|
|
2465
2518
|
case 'de':
|
|
2466
|
-
return import('./de-
|
|
2519
|
+
return import('./de-cf302015.esm.js');
|
|
2467
2520
|
case 'es':
|
|
2468
|
-
return import('./es-
|
|
2521
|
+
return import('./es-21c30725.esm.js');
|
|
2469
2522
|
case 'fr-FR':
|
|
2470
|
-
return import('./fr-FR-
|
|
2523
|
+
return import('./fr-FR-3c6878e4.esm.js');
|
|
2471
2524
|
case 'ja':
|
|
2472
2525
|
return import('./ja-73c088a7.esm.js');
|
|
2473
2526
|
case 'pt-BR':
|
|
2474
|
-
return import('./pt-BR-
|
|
2527
|
+
return import('./pt-BR-fa0b65c8.esm.js');
|
|
2475
2528
|
default:
|
|
2476
|
-
return import('./en-
|
|
2529
|
+
return import('./en-850d8c4a.esm.js');
|
|
2477
2530
|
}
|
|
2478
2531
|
};
|
|
2479
2532
|
const loadMessages = async locale => {
|