@commercetools-frontend-extensions/import-resources-modal 1.7.6 → 1.8.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.
Files changed (20) hide show
  1. package/dist/{active-drag-drop-area-bfd1ac28.esm.js → active-drag-drop-area-34cca429.esm.js} +3 -3
  2. package/dist/{active-drag-drop-area-a4fd91f7.cjs.dev.js → active-drag-drop-area-b645657a.cjs.dev.js} +3 -3
  3. package/dist/{active-drag-drop-area-abe96e04.cjs.prod.js → active-drag-drop-area-cf5791e7.cjs.prod.js} +3 -3
  4. package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.dev.js +7 -7
  5. package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.prod.js +7 -7
  6. package/dist/commercetools-frontend-extensions-import-resources-modal.esm.js +7 -7
  7. package/dist/declarations/src/@types/file-upload.d.ts +0 -4
  8. package/dist/{disabled-drop-area-093742fc.esm.js → disabled-drop-area-460a605b.esm.js} +7 -7
  9. package/dist/{disabled-drop-area-c092ebd0.cjs.dev.js → disabled-drop-area-9a4072d5.cjs.dev.js} +7 -7
  10. package/dist/{disabled-drop-area-25e976d6.cjs.prod.js → disabled-drop-area-c8e04dd6.cjs.prod.js} +7 -7
  11. package/dist/{enabled-drop-area-2e91435a.cjs.dev.js → enabled-drop-area-5d1a684a.cjs.dev.js} +7 -7
  12. package/dist/{enabled-drop-area-db88a5da.esm.js → enabled-drop-area-c2591e72.esm.js} +7 -7
  13. package/dist/{enabled-drop-area-86aff122.cjs.prod.js → enabled-drop-area-c30c7c5f.cjs.prod.js} +7 -7
  14. package/dist/{file-dropped-area-88c05907.cjs.dev.js → file-dropped-area-1c5c2843.cjs.dev.js} +7 -7
  15. package/dist/{file-dropped-area-6279df47.cjs.prod.js → file-dropped-area-27c8a11f.cjs.prod.js} +7 -7
  16. package/dist/{file-dropped-area-70be944b.esm.js → file-dropped-area-cf7278ba.esm.js} +7 -7
  17. package/dist/{index-c388b02a.esm.js → index-066e573b.esm.js} +152 -102
  18. package/dist/{index-6186162d.cjs.prod.js → index-757e3f18.cjs.prod.js} +154 -104
  19. package/dist/{index-98c1d115.cjs.dev.js → index-7e118bb3.cjs.dev.js} +154 -104
  20. package/package.json +35 -34
@@ -25,15 +25,15 @@ import _wrapNativeSuper from '@babel/runtime-corejs3/helpers/esm/wrapNativeSuper
25
25
  import { plural } from 'pluralize';
26
26
  import _Promise from '@babel/runtime-corejs3/core-js-stable/promise';
27
27
  import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
28
+ import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
29
+ import _someInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/some';
28
30
  import _flatMapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/flat-map';
29
31
  import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
30
32
  import _findInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/find';
31
- import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
32
33
  import Papa from 'papaparse';
33
34
  import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
34
35
  import _sliceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/slice';
35
36
  import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
36
- import _someInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/some';
37
37
  import '@babel/runtime-corejs3/core-js-stable/instance/bind';
38
38
  import '@babel/runtime-corejs3/core-js-stable/instance/starts-with';
39
39
  import '@babel/runtime-corejs3/core-js-stable/url-search-params';
@@ -269,7 +269,7 @@ const fetchUsingXhr = _ref2 => {
269
269
  return xhr;
270
270
  };
271
271
 
272
- const DEFAULT_DELIMITER = ',';
272
+ const ALLOWED_DELIMITERS = [',', ';', '|', '\t'];
273
273
  const INITIAL_COLUMN_DISPLAY_COUNT = 8;
274
274
  const IMPORT_TAG_KEYS = {
275
275
  source: 'source'
@@ -359,41 +359,113 @@ const DEFAULT_SHORT_LIVED_FLAGS = {};
359
359
  const DEFAULT_LONG_LIVED_FLAGS = {};
360
360
  _objectSpread$g(_objectSpread$g({}, DEFAULT_SHORT_LIVED_FLAGS), DEFAULT_LONG_LIVED_FLAGS);
361
361
 
362
+ var sharedMessages = defineMessages({
363
+ [`modalTitle.${IMPORTABLE_RESOURCES.CATEGORY}`]: {
364
+ id: 'ImportResourcesModal.modalTitle.category',
365
+ description: 'Label for the categories modal title',
366
+ defaultMessage: 'Import categories by CSV'
367
+ },
368
+ [`modalTitle.${IMPORTABLE_RESOURCES.PRODUCT}`]: {
369
+ id: 'ImportResourcesModal.modalTitle.product',
370
+ description: 'Label for the products modal title',
371
+ defaultMessage: 'Import products by CSV'
372
+ },
373
+ [`modalTitle.${IMPORTABLE_RESOURCES.INVENTORY}`]: {
374
+ id: 'ImportResourcesModal.modalTitle.inventoryEntry',
375
+ description: 'Label for the inventories modal title',
376
+ defaultMessage: 'Import inventories by CSV'
377
+ },
378
+ [`modalTitle.${IMPORTABLE_RESOURCES.DISCOUNT_CODE}`]: {
379
+ id: 'ImportResourcesModal.modalTitle.discountCode',
380
+ description: 'Label for the inventories modal title',
381
+ defaultMessage: 'Import discount codes by CSV'
382
+ },
383
+ [`modalTitle.${IMPORTABLE_RESOURCES.CUSTOMER}`]: {
384
+ id: 'ImportResourcesModal.modalTitle.customer',
385
+ description: 'Label for the customers modal title',
386
+ defaultMessage: 'Import customers by CSV'
387
+ },
388
+ [`modalTitle.${IMPORTABLE_RESOURCES.ORDER}`]: {
389
+ id: 'ImportResourcesModal.modalTitle.order',
390
+ description: 'Label for the order modal title',
391
+ defaultMessage: 'Import orders by CSV'
392
+ },
393
+ [`modalTitle.${IMPORTABLE_RESOURCES.PRODUCT_TYPE}`]: {
394
+ id: 'ImportResourcesModal.modalTitle.productType',
395
+ description: 'Label for the product type modal title',
396
+ defaultMessage: 'Import product types by CSV'
397
+ },
398
+ uploadButton: {
399
+ id: 'ImportResourcesModal.uploadButton',
400
+ description: 'Label for the upload button',
401
+ defaultMessage: 'Upload and preview'
402
+ },
403
+ cancel: {
404
+ id: 'ImportResourcesModal.cancel',
405
+ description: 'Label for the cancel button',
406
+ defaultMessage: 'Cancel'
407
+ },
408
+ close: {
409
+ id: 'ImportResourcesModal.close',
410
+ description: 'Label for the close button',
411
+ defaultMessage: 'Close'
412
+ },
413
+ listConjunctionOr: {
414
+ id: 'ImportResourcesModal.listConjunctionOr',
415
+ description: 'Label for the list conjunction or',
416
+ defaultMessage: 'or'
417
+ },
418
+ delimiterComma: {
419
+ id: 'ImportResourcesModal.delimiterComma',
420
+ description: 'Label for the delimiter name comma',
421
+ defaultMessage: 'comma'
422
+ },
423
+ delimiterSemicolon: {
424
+ id: 'ImportResourcesModal.delimiterSemicolon',
425
+ description: 'Label for the delimiter name semicolon',
426
+ defaultMessage: 'semicolon'
427
+ },
428
+ delimiterPipe: {
429
+ id: 'ImportResourcesModal.delimiterPipe',
430
+ description: 'Label for the delimiter name pipe',
431
+ defaultMessage: 'pipe'
432
+ },
433
+ delimiterTab: {
434
+ id: 'ImportResourcesModal.delimiterTab',
435
+ description: 'Label for the delimiter name tab',
436
+ defaultMessage: 'tab'
437
+ }
438
+ });
439
+
362
440
  function ownKeys$f(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
363
- function _objectSpread$f(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys$f(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys$f(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
364
- /**
365
- * This function checks if the provided `expectedDelimiter` is used consistently in the first 10 lines of a CSV file.
366
- * Returns a Promise that resolves to an object containing a boolean `isValid` property and the detected delimiter `delimiter`.
367
- *
368
- * @param {File} file - The CSV file to check.
369
- * @param {string} [expectedDelimiter=DEFAULT_DELIMITER] - The expected delimiter to check for in the file.
370
- * @returns {Promise<DelimiterCheck>} A Promise that resolves to a DelimiterCheck object.
371
- */
372
- const checkDelimiter = function (file) {
373
- let expectedDelimiter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_DELIMITER;
441
+ function _objectSpread$f(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context3 = ownKeys$f(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context4 = ownKeys$f(Object(t))).call(_context4, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
442
+
443
+ // Delimiters not included in this array may be treated as part of a column content
444
+ // potentially causing the file to be parsed as a single-column CSV and pass this validation
445
+ const NON_ALLOWED_DELIMITERS = ['%', '.', ' '];
446
+ const DELIMITERS_TO_GUESS = [...ALLOWED_DELIMITERS, ...NON_ALLOWED_DELIMITERS];
447
+ const validateDelimiter = file => {
374
448
  return new _Promise(resolve => {
375
- let lineCount = 0;
376
- let correctDelimiterCount = 0;
377
- let detectedDelimiter = null;
378
449
  Papa.parse(file, {
379
- step: (results, parser) => {
380
- lineCount++;
381
- if (detectedDelimiter === null) {
382
- detectedDelimiter = results.meta.delimiter;
383
- }
384
- if (results.meta.delimiter === expectedDelimiter) {
385
- correctDelimiterCount++;
450
+ delimitersToGuess: DELIMITERS_TO_GUESS,
451
+ preview: 10,
452
+ complete: result => {
453
+ const headerRow = result.data?.[0];
454
+ const isOnlyOneColumn = _Array$isArray(headerRow) && headerRow.length === 1;
455
+ if (isOnlyOneColumn) {
456
+ resolve(true);
457
+ return;
386
458
  }
387
- if (lineCount >= 10) {
388
- parser.abort();
459
+ const detectedDelimiter = result.meta.delimiter;
460
+ let isValid = false;
461
+ if (detectedDelimiter !== null && _includesInstanceProperty(ALLOWED_DELIMITERS).call(ALLOWED_DELIMITERS, detectedDelimiter)) {
462
+ var _context;
463
+ const isUndetectableDelimiter = _someInstanceProperty(_context = result.errors).call(_context, error => error.code === 'UndetectableDelimiter');
464
+ if (!isUndetectableDelimiter) {
465
+ isValid = true;
466
+ }
389
467
  }
390
- },
391
- complete: () => {
392
- const isValid = correctDelimiterCount === lineCount;
393
- resolve({
394
- isValid,
395
- delimiter: detectedDelimiter
396
- });
468
+ resolve(isValid);
397
469
  }
398
470
  });
399
471
  });
@@ -402,8 +474,8 @@ const mapUploadFileErrorsResponseToUploadFileErrorRows = uploadFileErrorsRespons
402
474
  if (!uploadFileErrorsResponse || !_Array$isArray(uploadFileErrorsResponse)) return [];
403
475
  let idCounter = 1;
404
476
  return _flatMapInstanceProperty(uploadFileErrorsResponse).call(uploadFileErrorsResponse, rowErrorsResponse => {
405
- var _context;
406
- return _mapInstanceProperty(_context = rowErrorsResponse.errors).call(_context, rowError => ({
477
+ var _context2;
478
+ return _mapInstanceProperty(_context2 = rowErrorsResponse.errors).call(_context2, rowError => ({
407
479
  // DataTable component requires unique `id` field
408
480
  id: String(idCounter++),
409
481
  row: rowErrorsResponse.row,
@@ -453,6 +525,35 @@ const toBytes = megabytes => megabytes * 1024 * 1024;
453
525
  const getValidatedColumns = (columns, ignoredColumns) => {
454
526
  return _filterInstanceProperty(columns).call(columns, column => !_includesInstanceProperty(ignoredColumns).call(ignoredColumns, column));
455
527
  };
528
+ const formatAllowedDelimitersForMessageDisplay = intl => {
529
+ const localizedOr = intl.formatMessage(sharedMessages.listConjunctionOr);
530
+ const descriptions = _mapInstanceProperty(ALLOWED_DELIMITERS).call(ALLOWED_DELIMITERS, delimiter => {
531
+ let nameDescriptor;
532
+ switch (delimiter) {
533
+ case ',':
534
+ nameDescriptor = sharedMessages.delimiterComma;
535
+ break;
536
+ case ';':
537
+ nameDescriptor = sharedMessages.delimiterSemicolon;
538
+ break;
539
+ case '|':
540
+ nameDescriptor = sharedMessages.delimiterPipe;
541
+ break;
542
+ case '\t':
543
+ nameDescriptor = sharedMessages.delimiterTab;
544
+ break;
545
+ default:
546
+ nameDescriptor = undefined;
547
+ }
548
+ const name = nameDescriptor ? intl.formatMessage(nameDescriptor) : delimiter;
549
+ return delimiter === '\t' ? name : `${name} (${delimiter})`;
550
+ });
551
+ if (descriptions.length === 1) {
552
+ return descriptions[0];
553
+ }
554
+ const lastDescription = descriptions.pop();
555
+ return `${descriptions.join(', ')} ${localizedOr} ${lastDescription}`;
556
+ };
456
557
 
457
558
  function getFileUploadErrorsCount(errors) {
458
559
  if (!errors || !_Array$isArray(errors)) return 0;
@@ -725,13 +826,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
725
826
  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== */");
726
827
  }
727
828
 
728
- var ActiveDragDropArea = /*#__PURE__*/lazy(() => import('./active-drag-drop-area-bfd1ac28.esm.js' /* webpackChunkName: "active-drag-drop-area" */));
829
+ var ActiveDragDropArea = /*#__PURE__*/lazy(() => import('./active-drag-drop-area-34cca429.esm.js' /* webpackChunkName: "active-drag-drop-area" */));
729
830
 
730
- var DisabledDropArea = /*#__PURE__*/lazy(() => import('./disabled-drop-area-093742fc.esm.js' /* webpackChunkName: "disabled-drop-area" */));
831
+ var DisabledDropArea = /*#__PURE__*/lazy(() => import('./disabled-drop-area-460a605b.esm.js' /* webpackChunkName: "disabled-drop-area" */));
731
832
 
732
- var EnabledDropArea = /*#__PURE__*/lazy(() => import('./enabled-drop-area-db88a5da.esm.js' /* webpackChunkName: "enabled-drop-area" */));
833
+ var EnabledDropArea = /*#__PURE__*/lazy(() => import('./enabled-drop-area-c2591e72.esm.js' /* webpackChunkName: "enabled-drop-area" */));
733
834
 
734
- var FileDropped = /*#__PURE__*/lazy(() => import('./file-dropped-area-70be944b.esm.js' /* webpackChunkName: "filed-dropped-area" */));
835
+ var FileDropped = /*#__PURE__*/lazy(() => import('./file-dropped-area-cf7278ba.esm.js' /* webpackChunkName: "filed-dropped-area" */));
735
836
 
736
837
  function getDropArea(_ref) {
737
838
  let dropAreaState = _ref.dropAreaState,
@@ -853,14 +954,14 @@ var messages$6 = defineMessages({
853
954
  description: 'Error description when the file contains more rows than the allowable maximum',
854
955
  defaultMessage: 'The file contains more than the allowable maximum of {rowLimit} rows'
855
956
  },
856
- dropAreaWrongDelimiterTitle: {
857
- id: 'ImportResourcesModal.wrongDelimiterTitle',
858
- defaultMessage: 'Wrong delimiter'
957
+ wrongSeparatorTitle: {
958
+ id: 'ImportResourcesModal.wrongSeparatorTitle',
959
+ defaultMessage: 'Wrong separator'
859
960
  },
860
- dropAreaWrongDelimiterDescription: {
861
- id: 'ImportResourcesModal.wrongDelimiterDescription',
961
+ wrongSeparatorDescription: {
962
+ id: 'ImportResourcesModal.wrongSeparatorDescription',
862
963
  description: 'Message within the drop area when a CSV file uses an unexpected delimiter',
863
- defaultMessage: 'The file is using an incorrect delimiter. Please use comma (,) instead.'
964
+ defaultMessage: 'The file is using an unsupported separator. Please use one of the allowed delimiters: {delimiterList}.'
864
965
  },
865
966
  dropAreaNotEnoughRowsTitle: {
866
967
  id: 'ImportResourcesModal.dropAreaNotEnoughRowsTitle',
@@ -911,10 +1012,12 @@ const useUpload = () => {
911
1012
  }, [state.abortController]);
912
1013
  const isFileValid = async file => {
913
1014
  const errors = [];
914
- const delimiterCheck = await checkDelimiter(file);
915
- if (!delimiterCheck.isValid) errors.push({
916
- title: intl.formatMessage(messages$6.dropAreaWrongDelimiterTitle),
917
- description: intl.formatMessage(messages$6.dropAreaWrongDelimiterDescription)
1015
+ const isDelimiterValid = await validateDelimiter(file);
1016
+ if (!isDelimiterValid) errors.push({
1017
+ title: intl.formatMessage(messages$6.wrongSeparatorTitle),
1018
+ description: intl.formatMessage(messages$6.wrongSeparatorDescription, {
1019
+ delimiterList: formatAllowedDelimitersForMessageDisplay(intl)
1020
+ })
918
1021
  });
919
1022
  const rowCount = await getRowCount(file);
920
1023
  if (rowCount < 1) errors.push({
@@ -1184,59 +1287,6 @@ const UploadSettings = () => {
1184
1287
  return null;
1185
1288
  };
1186
1289
 
1187
- var sharedMessages = defineMessages({
1188
- [`modalTitle.${IMPORTABLE_RESOURCES.CATEGORY}`]: {
1189
- id: 'ImportResourcesModal.modalTitle.category',
1190
- description: 'Label for the categories modal title',
1191
- defaultMessage: 'Import categories by CSV'
1192
- },
1193
- [`modalTitle.${IMPORTABLE_RESOURCES.PRODUCT}`]: {
1194
- id: 'ImportResourcesModal.modalTitle.product',
1195
- description: 'Label for the products modal title',
1196
- defaultMessage: 'Import products by CSV'
1197
- },
1198
- [`modalTitle.${IMPORTABLE_RESOURCES.INVENTORY}`]: {
1199
- id: 'ImportResourcesModal.modalTitle.inventoryEntry',
1200
- description: 'Label for the inventories modal title',
1201
- defaultMessage: 'Import inventories by CSV'
1202
- },
1203
- [`modalTitle.${IMPORTABLE_RESOURCES.DISCOUNT_CODE}`]: {
1204
- id: 'ImportResourcesModal.modalTitle.discountCode',
1205
- description: 'Label for the inventories modal title',
1206
- defaultMessage: 'Import discount codes by CSV'
1207
- },
1208
- [`modalTitle.${IMPORTABLE_RESOURCES.CUSTOMER}`]: {
1209
- id: 'ImportResourcesModal.modalTitle.customer',
1210
- description: 'Label for the customers modal title',
1211
- defaultMessage: 'Import customers by CSV'
1212
- },
1213
- [`modalTitle.${IMPORTABLE_RESOURCES.ORDER}`]: {
1214
- id: 'ImportResourcesModal.modalTitle.order',
1215
- description: 'Label for the order modal title',
1216
- defaultMessage: 'Import orders by CSV'
1217
- },
1218
- [`modalTitle.${IMPORTABLE_RESOURCES.PRODUCT_TYPE}`]: {
1219
- id: 'ImportResourcesModal.modalTitle.productType',
1220
- description: 'Label for the product type modal title',
1221
- defaultMessage: 'Import product types by CSV'
1222
- },
1223
- uploadButton: {
1224
- id: 'ImportResourcesModal.uploadButton',
1225
- description: 'Label for the upload button',
1226
- defaultMessage: 'Upload and preview'
1227
- },
1228
- cancel: {
1229
- id: 'ImportResourcesModal.cancel',
1230
- description: 'Label for the cancel button',
1231
- defaultMessage: 'Cancel'
1232
- },
1233
- close: {
1234
- id: 'ImportResourcesModal.close',
1235
- description: 'Label for the close button',
1236
- defaultMessage: 'Close'
1237
- }
1238
- });
1239
-
1240
1290
  const Upload = () => {
1241
1291
  const _useImportResourcesCo = useImportResourcesContext(),
1242
1292
  state = _useImportResourcesCo.state,