@commercetools-frontend-extensions/import-resources-modal 2.2.0 → 2.3.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.
|
@@ -77,7 +77,12 @@ function reducer(state, action) {
|
|
|
77
77
|
uploadFileResponse: action.uploadFileResponse
|
|
78
78
|
});
|
|
79
79
|
if (action.type === 'setResourceType') return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
80
|
-
resourceType: action.resourceType
|
|
80
|
+
resourceType: action.resourceType,
|
|
81
|
+
// Reset the publish setting so it doesn't carry over between resource
|
|
82
|
+
// types (for example, from Products to Tailored Products).
|
|
83
|
+
settings: _objectSpread$a(_objectSpread$a({}, state.settings), {}, {
|
|
84
|
+
publish: undefined
|
|
85
|
+
})
|
|
81
86
|
});
|
|
82
87
|
if (action.type === 'setContainerKey') return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
83
88
|
containerKey: action.containerKey
|
|
@@ -442,6 +447,11 @@ var messages$6 = reactIntl.defineMessages({
|
|
|
442
447
|
description: 'Label for the publish products checkbox',
|
|
443
448
|
defaultMessage: 'Publish all products in the file'
|
|
444
449
|
},
|
|
450
|
+
publishTailoredProducts: {
|
|
451
|
+
id: 'ImportResourcesModal.settings.publishTailoredProducts',
|
|
452
|
+
description: 'Label for the publish tailored products checkbox',
|
|
453
|
+
defaultMessage: 'Publish all tailored products in the file'
|
|
454
|
+
},
|
|
445
455
|
separatorTitle: {
|
|
446
456
|
id: 'ImportResourcesModal.uploadSeparator.separatorTitle',
|
|
447
457
|
description: 'Title for the separator selection',
|
|
@@ -1072,7 +1082,7 @@ const useUpload = () => {
|
|
|
1072
1082
|
const abortController = new AbortController();
|
|
1073
1083
|
actions.setAbortController(abortController);
|
|
1074
1084
|
actions.setCurrentStep(CurrentStep$1.Uploading);
|
|
1075
|
-
const shouldApplyPublishSettings = state.resourceType
|
|
1085
|
+
const shouldApplyPublishSettings = operations.isPublishableResourceType(state.resourceType);
|
|
1076
1086
|
const uploadSettings = _objectSpread$8({
|
|
1077
1087
|
format: 'CSV',
|
|
1078
1088
|
decimalSeparator: state.settings?.decimalSeparator
|
|
@@ -1355,8 +1365,8 @@ const Upload = () => {
|
|
|
1355
1365
|
publish: checked
|
|
1356
1366
|
});
|
|
1357
1367
|
},
|
|
1358
|
-
publishProductsLabel: intl.formatMessage(messages$6.publishProducts),
|
|
1359
|
-
dataTrackingTarget:
|
|
1368
|
+
publishProductsLabel: intl.formatMessage(state.resourceType === 'product-tailoring' ? messages$6.publishTailoredProducts : messages$6.publishProducts),
|
|
1369
|
+
dataTrackingTarget: operations.getPublishCheckboxTrackingTarget(state.resourceType),
|
|
1360
1370
|
canPublishProducts: canPublishProducts
|
|
1361
1371
|
})]
|
|
1362
1372
|
})
|
|
@@ -77,7 +77,12 @@ function reducer(state, action) {
|
|
|
77
77
|
uploadFileResponse: action.uploadFileResponse
|
|
78
78
|
});
|
|
79
79
|
if (action.type === 'setResourceType') return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
80
|
-
resourceType: action.resourceType
|
|
80
|
+
resourceType: action.resourceType,
|
|
81
|
+
// Reset the publish setting so it doesn't carry over between resource
|
|
82
|
+
// types (for example, from Products to Tailored Products).
|
|
83
|
+
settings: _objectSpread$a(_objectSpread$a({}, state.settings), {}, {
|
|
84
|
+
publish: undefined
|
|
85
|
+
})
|
|
81
86
|
});
|
|
82
87
|
if (action.type === 'setContainerKey') return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
83
88
|
containerKey: action.containerKey
|
|
@@ -442,6 +447,11 @@ var messages$6 = reactIntl.defineMessages({
|
|
|
442
447
|
description: 'Label for the publish products checkbox',
|
|
443
448
|
defaultMessage: 'Publish all products in the file'
|
|
444
449
|
},
|
|
450
|
+
publishTailoredProducts: {
|
|
451
|
+
id: 'ImportResourcesModal.settings.publishTailoredProducts',
|
|
452
|
+
description: 'Label for the publish tailored products checkbox',
|
|
453
|
+
defaultMessage: 'Publish all tailored products in the file'
|
|
454
|
+
},
|
|
445
455
|
separatorTitle: {
|
|
446
456
|
id: 'ImportResourcesModal.uploadSeparator.separatorTitle',
|
|
447
457
|
description: 'Title for the separator selection',
|
|
@@ -1072,7 +1082,7 @@ const useUpload = () => {
|
|
|
1072
1082
|
const abortController = new AbortController();
|
|
1073
1083
|
actions.setAbortController(abortController);
|
|
1074
1084
|
actions.setCurrentStep(CurrentStep$1.Uploading);
|
|
1075
|
-
const shouldApplyPublishSettings = state.resourceType
|
|
1085
|
+
const shouldApplyPublishSettings = operations.isPublishableResourceType(state.resourceType);
|
|
1076
1086
|
const uploadSettings = _objectSpread$8({
|
|
1077
1087
|
format: 'CSV',
|
|
1078
1088
|
decimalSeparator: state.settings?.decimalSeparator
|
|
@@ -1355,8 +1365,8 @@ const Upload = () => {
|
|
|
1355
1365
|
publish: checked
|
|
1356
1366
|
});
|
|
1357
1367
|
},
|
|
1358
|
-
publishProductsLabel: intl.formatMessage(messages$6.publishProducts),
|
|
1359
|
-
dataTrackingTarget:
|
|
1368
|
+
publishProductsLabel: intl.formatMessage(state.resourceType === 'product-tailoring' ? messages$6.publishTailoredProducts : messages$6.publishProducts),
|
|
1369
|
+
dataTrackingTarget: operations.getPublishCheckboxTrackingTarget(state.resourceType),
|
|
1360
1370
|
canPublishProducts: canPublishProducts
|
|
1361
1371
|
})]
|
|
1362
1372
|
})
|
|
@@ -10,7 +10,7 @@ import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
|
10
10
|
import _everyInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/every';
|
|
11
11
|
import { defineMessages, useIntl, FormattedMessage, IntlProvider } from 'react-intl';
|
|
12
12
|
import { useApplicationContext } from '@commercetools-frontend/application-shell-connectors';
|
|
13
|
-
import { deleteImportContainer, FileDroppedArea, DisabledDropArea, EnabledDropArea, ActiveDragDropArea, COLUMN_DELIMITERS, useFileUpload, validateDelimiter, getRowCount, toBytes, IMPORT_MAX_FILE_SIZE_MB, IMPORT_MAX_ITEM_COUNT, isAbortError, HttpError, formatKeys, PollingTimeoutError, isError, assertResourceType, FileDropArea as FileDropArea$1, InfoBox, CT_API_DOCS_URL, UploadSeparator, UploadSettings, useFetchFileImportJobRecords, mapUploadFileErrorsResponseToUploadFileErrorRows, UnexpectedColumnError, extractErrorDescriptionFromValidationMessage, formatErrorCode, RESOURCE_TYPE_DOCUMENTATION_LINKS, mapFileUploadErrorsToUploadFileErrorRows, getValidatedColumns, processFileImportJob, processUploadedFile, UploadingModal, UnexpectedResourceTypeError as UnexpectedResourceTypeError$1, RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS, isResourceType } from '@commercetools-frontend-extensions/operations';
|
|
13
|
+
import { deleteImportContainer, FileDroppedArea, DisabledDropArea, EnabledDropArea, ActiveDragDropArea, COLUMN_DELIMITERS, useFileUpload, isPublishableResourceType, validateDelimiter, getRowCount, toBytes, IMPORT_MAX_FILE_SIZE_MB, IMPORT_MAX_ITEM_COUNT, isAbortError, HttpError, formatKeys, PollingTimeoutError, isError, assertResourceType, FileDropArea as FileDropArea$1, InfoBox, CT_API_DOCS_URL, UploadSeparator, UploadSettings, getPublishCheckboxTrackingTarget, useFetchFileImportJobRecords, mapUploadFileErrorsResponseToUploadFileErrorRows, UnexpectedColumnError, extractErrorDescriptionFromValidationMessage, formatErrorCode, RESOURCE_TYPE_DOCUMENTATION_LINKS, mapFileUploadErrorsToUploadFileErrorRows, getValidatedColumns, processFileImportJob, processUploadedFile, UploadingModal, UnexpectedResourceTypeError as UnexpectedResourceTypeError$1, RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS, isResourceType } from '@commercetools-frontend-extensions/operations';
|
|
14
14
|
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
15
15
|
import React, { useContext, useMemo, useState, useEffect } from 'react';
|
|
16
16
|
import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
@@ -56,7 +56,12 @@ function reducer(state, action) {
|
|
|
56
56
|
uploadFileResponse: action.uploadFileResponse
|
|
57
57
|
});
|
|
58
58
|
if (action.type === 'setResourceType') return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
59
|
-
resourceType: action.resourceType
|
|
59
|
+
resourceType: action.resourceType,
|
|
60
|
+
// Reset the publish setting so it doesn't carry over between resource
|
|
61
|
+
// types (for example, from Products to Tailored Products).
|
|
62
|
+
settings: _objectSpread$a(_objectSpread$a({}, state.settings), {}, {
|
|
63
|
+
publish: undefined
|
|
64
|
+
})
|
|
60
65
|
});
|
|
61
66
|
if (action.type === 'setContainerKey') return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
62
67
|
containerKey: action.containerKey
|
|
@@ -421,6 +426,11 @@ var messages$6 = defineMessages({
|
|
|
421
426
|
description: 'Label for the publish products checkbox',
|
|
422
427
|
defaultMessage: 'Publish all products in the file'
|
|
423
428
|
},
|
|
429
|
+
publishTailoredProducts: {
|
|
430
|
+
id: 'ImportResourcesModal.settings.publishTailoredProducts',
|
|
431
|
+
description: 'Label for the publish tailored products checkbox',
|
|
432
|
+
defaultMessage: 'Publish all tailored products in the file'
|
|
433
|
+
},
|
|
424
434
|
separatorTitle: {
|
|
425
435
|
id: 'ImportResourcesModal.uploadSeparator.separatorTitle',
|
|
426
436
|
description: 'Title for the separator selection',
|
|
@@ -1051,7 +1061,7 @@ const useUpload = () => {
|
|
|
1051
1061
|
const abortController = new AbortController();
|
|
1052
1062
|
actions.setAbortController(abortController);
|
|
1053
1063
|
actions.setCurrentStep(CurrentStep$1.Uploading);
|
|
1054
|
-
const shouldApplyPublishSettings = state.resourceType
|
|
1064
|
+
const shouldApplyPublishSettings = isPublishableResourceType(state.resourceType);
|
|
1055
1065
|
const uploadSettings = _objectSpread$8({
|
|
1056
1066
|
format: 'CSV',
|
|
1057
1067
|
decimalSeparator: state.settings?.decimalSeparator
|
|
@@ -1334,8 +1344,8 @@ const Upload = () => {
|
|
|
1334
1344
|
publish: checked
|
|
1335
1345
|
});
|
|
1336
1346
|
},
|
|
1337
|
-
publishProductsLabel: intl.formatMessage(messages$6.publishProducts),
|
|
1338
|
-
dataTrackingTarget:
|
|
1347
|
+
publishProductsLabel: intl.formatMessage(state.resourceType === 'product-tailoring' ? messages$6.publishTailoredProducts : messages$6.publishProducts),
|
|
1348
|
+
dataTrackingTarget: getPublishCheckboxTrackingTarget(state.resourceType),
|
|
1339
1349
|
canPublishProducts: canPublishProducts
|
|
1340
1350
|
})]
|
|
1341
1351
|
})
|
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.
|
|
4
|
+
"version": "2.3.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.
|
|
34
|
+
"@commercetools-frontend-extensions/operations": "4.3.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@commercetools-frontend/actions-global": "27.5.1",
|