@commercetools-frontend-extensions/import-resources-modal 1.11.5 → 1.12.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.
@@ -31,6 +31,7 @@ var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibl
31
31
  var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
32
32
  var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
33
33
  var _wrapNativeSuper = require('@babel/runtime-corejs3/helpers/wrapNativeSuper');
34
+ var applicationShell = require('@commercetools-frontend/application-shell');
34
35
  var sentry = require('@commercetools-frontend/sentry');
35
36
  var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
36
37
  var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
@@ -63,66 +64,90 @@ let CurrentStep$1 = /*#__PURE__*/function (CurrentStep) {
63
64
  return CurrentStep;
64
65
  }({});
65
66
 
66
- function ownKeys$c(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
67
- function _objectSpread$c(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$c(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$c(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
67
+ function ownKeys$a(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
68
+ function _objectSpread$a(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$a(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$a(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
68
69
 
69
70
  // TODO: make this resource type specific
70
71
 
71
72
  function reducer(state, action) {
72
- if (action.type === 'setCurrentStep') return _objectSpread$c(_objectSpread$c({}, state), {}, {
73
+ if (action.type === 'setCurrentStep') return _objectSpread$a(_objectSpread$a({}, state), {}, {
73
74
  currentStep: action.currentStep,
74
75
  progress: 0
75
76
  });
76
- if (action.type === 'setUploadFileResponse') return _objectSpread$c(_objectSpread$c({}, state), {}, {
77
+ if (action.type === 'setUploadFileResponse') return _objectSpread$a(_objectSpread$a({}, state), {}, {
77
78
  uploadFileResponse: action.uploadFileResponse
78
79
  });
79
- if (action.type === 'setResourceType') return _objectSpread$c(_objectSpread$c({}, state), {}, {
80
+ if (action.type === 'setResourceType') return _objectSpread$a(_objectSpread$a({}, state), {}, {
80
81
  resourceType: action.resourceType
81
82
  });
82
- if (action.type === 'setContainerKey') return _objectSpread$c(_objectSpread$c({}, state), {}, {
83
+ if (action.type === 'setContainerKey') return _objectSpread$a(_objectSpread$a({}, state), {}, {
83
84
  containerKey: action.containerKey
84
85
  });
85
- if (action.type === 'cancelImport') return _objectSpread$c(_objectSpread$c({}, state), {}, {
86
+ if (action.type === 'cancelImport') return _objectSpread$a(_objectSpread$a({}, state), {}, {
86
87
  currentStep: CurrentStep$1.Upload,
87
88
  containerKey: undefined,
89
+ jobId: undefined,
88
90
  fileUploadErrors: [],
89
91
  uploadFileResponse: undefined,
90
92
  droppedFile: undefined,
91
93
  dropAreaState: 'disabled',
92
- progress: 0
94
+ progress: 0,
95
+ totalResourceCount: undefined,
96
+ validationProcessed: undefined,
97
+ isValidating: false
93
98
  });
94
- if (action.type === 'uploadNewFile') return _objectSpread$c(_objectSpread$c({}, state), {}, {
99
+ if (action.type === 'uploadNewFile') return _objectSpread$a(_objectSpread$a({}, state), {}, {
95
100
  currentStep: CurrentStep$1.Upload,
96
101
  containerKey: undefined,
102
+ jobId: undefined,
97
103
  fileUploadErrors: [],
98
104
  uploadFileResponse: undefined,
99
105
  droppedFile: undefined,
100
106
  dropAreaState: 'ready-for-drop',
101
- progress: 0
107
+ progress: 0,
108
+ totalResourceCount: undefined,
109
+ validationProcessed: undefined,
110
+ isValidating: false
102
111
  });
103
112
  if (action.type === 'setDroppedFile') {
104
- return _objectSpread$c(_objectSpread$c({}, state), {}, {
113
+ return _objectSpread$a(_objectSpread$a({}, state), {}, {
105
114
  droppedFile: action.droppedFile
106
115
  });
107
116
  }
108
117
  if (action.type === 'setFileUploadErrors') {
109
- return _objectSpread$c(_objectSpread$c({}, state), {}, {
118
+ return _objectSpread$a(_objectSpread$a({}, state), {}, {
110
119
  fileUploadErrors: action.fileUploadErrors
111
120
  });
112
121
  }
113
122
  if (action.type === 'setAbortController') {
114
- return _objectSpread$c(_objectSpread$c({}, state), {}, {
123
+ return _objectSpread$a(_objectSpread$a({}, state), {}, {
115
124
  abortController: action.abortController
116
125
  });
117
126
  }
118
127
  if (action.type === 'setProgress') {
119
- return _objectSpread$c(_objectSpread$c({}, state), {}, {
128
+ return _objectSpread$a(_objectSpread$a({}, state), {}, {
120
129
  progress: action.progress
121
130
  });
122
131
  }
123
132
  if (action.type === 'setUploadSettings') {
124
- return _objectSpread$c(_objectSpread$c({}, state), {}, {
125
- settings: _objectSpread$c(_objectSpread$c({}, state.settings), action.settings)
133
+ return _objectSpread$a(_objectSpread$a({}, state), {}, {
134
+ settings: _objectSpread$a(_objectSpread$a({}, state.settings), action.settings)
135
+ });
136
+ }
137
+ if (action.type === 'setJobId') {
138
+ return _objectSpread$a(_objectSpread$a({}, state), {}, {
139
+ jobId: action.jobId
140
+ });
141
+ }
142
+ if (action.type === 'setTotalResourceCount') {
143
+ return _objectSpread$a(_objectSpread$a({}, state), {}, {
144
+ totalResourceCount: action.totalResourceCount
145
+ });
146
+ }
147
+ if (action.type === 'setValidationProgress') {
148
+ return _objectSpread$a(_objectSpread$a({}, state), {}, {
149
+ validationProcessed: action.validationProcessed,
150
+ isValidating: action.isValidating
126
151
  });
127
152
  }
128
153
  throw new Error(getUnknownActionError(action));
@@ -138,21 +163,75 @@ const initialState = {
138
163
  fileUploadErrors: [],
139
164
  resourceType: 'category',
140
165
  containerKey: undefined,
166
+ jobId: undefined,
141
167
  progress: 0,
142
168
  settings: {
143
169
  decimalSeparator: '.'
170
+ },
171
+ totalResourceCount: undefined,
172
+ validationProcessed: undefined,
173
+ isValidating: false
174
+ };
175
+ const initialActions = {
176
+ setCurrentStep(_currentStep) {
177
+ /**/
178
+ },
179
+ cancelImport() {
180
+ /**/
181
+ },
182
+ uploadNewFile() {
183
+ /**/
184
+ },
185
+ setUploadFileResponse(_uploadFileResponse) {
186
+ /**/
187
+ },
188
+ setResourceType(_nextResourceType) {
189
+ /**/
190
+ },
191
+ setDroppedFile(_nextDroppedFile) {
192
+ /**/
193
+ },
194
+ setFileUploadErrors(_fileUploadErrors) {
195
+ /**/
196
+ },
197
+ setContainerKey(_containerKey) {
198
+ /**/
199
+ },
200
+ setAbortController(_abortController) {
201
+ /**/
202
+ },
203
+ setUploadSettings(_settings) {
204
+ /**/
205
+ },
206
+ setProgress(_progress) {
207
+ /**/
208
+ },
209
+ setJobId(_jobId) {
210
+ /**/
211
+ },
212
+ setTotalResourceCount(_totalResourceCount) {
213
+ /**/
214
+ },
215
+ setValidationProgress(_params) {
216
+ /**/
144
217
  }
145
218
  };
146
219
 
147
- function ownKeys$b(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
148
- function _objectSpread$b(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$b(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$b(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
149
- const ImportResourcesContext = /*#__PURE__*/React__default["default"].createContext();
220
+ function ownKeys$9(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
221
+ function _objectSpread$9(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$9(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$9(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
222
+ const ImportResourcesContext = /*#__PURE__*/React__default["default"].createContext({
223
+ state: initialState,
224
+ resourceTypes: [],
225
+ onClose: () => {},
226
+ onStartImportSuccess: () => {},
227
+ actions: initialActions
228
+ });
150
229
  const ImportResourcesProvider = props => {
151
230
  const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
152
231
  projectKey: context.project?.key
153
232
  })),
154
233
  projectKey = _useApplicationContex.projectKey;
155
- const _React$useReducer = React__default["default"].useReducer(reducer, _objectSpread$b(_objectSpread$b({}, initialState), {}, {
234
+ const _React$useReducer = React__default["default"].useReducer(reducer, _objectSpread$9(_objectSpread$9({}, initialState), {}, {
156
235
  resourceType: props.resourceTypes[0]
157
236
  })),
158
237
  _React$useReducer2 = _slicedToArray(_React$useReducer, 2),
@@ -202,9 +281,26 @@ const ImportResourcesProvider = props => {
202
281
  settings: nextSettings
203
282
  });
204
283
  };
284
+ const setJobId = jobId => dispatch({
285
+ type: 'setJobId',
286
+ jobId
287
+ });
288
+ const setTotalResourceCount = totalResourceCount => dispatch({
289
+ type: 'setTotalResourceCount',
290
+ totalResourceCount
291
+ });
292
+ const setValidationProgress = _ref => {
293
+ let processed = _ref.processed,
294
+ isValidating = _ref.isValidating;
295
+ return dispatch({
296
+ type: 'setValidationProgress',
297
+ validationProcessed: processed,
298
+ isValidating
299
+ });
300
+ };
205
301
  const handleClose = function () {
206
- let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
207
- shouldDeleteImportContainer = _ref.shouldDeleteImportContainer;
302
+ let _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
303
+ shouldDeleteImportContainer = _ref2.shouldDeleteImportContainer;
208
304
  if (state.abortController) state.abortController.abort();
209
305
  if (typeof props.onClose === 'function') props.onClose();
210
306
  // Removes the associated import container when the import is closed
@@ -230,10 +326,13 @@ const ImportResourcesProvider = props => {
230
326
  setResourceType,
231
327
  setDroppedFile,
232
328
  setContainerKey,
329
+ setJobId,
233
330
  setAbortController,
234
331
  setFileUploadErrors,
235
332
  setProgress,
236
- setUploadSettings
333
+ setUploadSettings,
334
+ setTotalResourceCount,
335
+ setValidationProgress
237
336
  }
238
337
  },
239
338
  children: props.children
@@ -290,7 +389,7 @@ function getDropAreaState(flags) {
290
389
  return 'ready-for-drop';
291
390
  }
292
391
 
293
- var messages$5 = reactIntl.defineMessages({
392
+ var messages$6 = reactIntl.defineMessages({
294
393
  dragAndDropCSV: {
295
394
  id: 'ImportResourcesModal.dragAndDropCSV',
296
395
  description: 'The message telling the user to drag and drop CSV file in the file drop area',
@@ -423,7 +522,7 @@ function useImportResourcesContext() {
423
522
  return context;
424
523
  }
425
524
 
426
- var messages$4 = reactIntl.defineMessages({
525
+ var messages$5 = reactIntl.defineMessages({
427
526
  fileSizeExceededTitle: {
428
527
  id: 'ImportResourcesModal.sizeExceededTitle',
429
528
  defaultMessage: 'File size exceeded'
@@ -828,8 +927,46 @@ function resourceTypeToPluralMessage(resourceType) {
828
927
  return message;
829
928
  }
830
929
 
831
- function ownKeys$a(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
832
- function _objectSpread$a(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$a(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$a(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
930
+ const INITIAL_COLUMN_DISPLAY_COUNT = 8;
931
+
932
+ const PERMISSIONS = {
933
+ // Categories
934
+ ManageCategories: 'ManageCategories',
935
+ ViewCategories: 'ViewCategories',
936
+ // Products
937
+ ManageProducts: 'ManageProducts',
938
+ ViewProducts: 'ViewProducts',
939
+ // ProductTypes
940
+ ManageProductTypes: 'ManageProductTypes',
941
+ ViewProductTypes: 'ViewProductTypes',
942
+ // DiscountCodes
943
+ ManageDiscountCodes: 'ManageDiscountCodes',
944
+ ViewDiscountCodes: 'ViewDiscountCodes',
945
+ // Customers
946
+ ManageCustomers: 'ManageCustomers',
947
+ ViewCustomers: 'ViewCustomers',
948
+ // Orders
949
+ ManageOrders: 'ManageOrders',
950
+ ViewOrders: 'ViewOrders',
951
+ // KeyValueDocuments
952
+ ManageKeyValueDocuments: 'ManageKeyValueDocuments',
953
+ ViewKeyValueDocuments: 'ViewKeyValueDocuments',
954
+ // BusinessUnits
955
+ ManageBusinessUnits: 'ManageBusinessUnits',
956
+ ViewBusinessUnits: 'ViewBusinessUnits'
957
+ };
958
+
959
+ function ownKeys$8(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
960
+ function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$8(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$8(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
961
+ const FILE_IMPORT_JOB_FLOW = 'fileImportJobFlow';
962
+ const DEFAULT_SHORT_LIVED_FLAGS = {
963
+ [FILE_IMPORT_JOB_FLOW]: false
964
+ };
965
+ const DEFAULT_LONG_LIVED_FLAGS = {};
966
+ _objectSpread$8(_objectSpread$8({}, DEFAULT_SHORT_LIVED_FLAGS), DEFAULT_LONG_LIVED_FLAGS);
967
+
968
+ function ownKeys$7(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
969
+ function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$7(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$7(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
833
970
  const useUpload = () => {
834
971
  const intl = reactIntl.useIntl();
835
972
  const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
@@ -840,39 +977,38 @@ const useUpload = () => {
840
977
  state = _useImportResourcesCo.state,
841
978
  actions = _useImportResourcesCo.actions;
842
979
  const showNotification = actionsGlobal.useShowNotification();
843
- const _useImportContainerUp = operations.useImportContainerUpload({
844
- projectKey: projectKey
980
+ const isFileImportJobFlowEnabled = applicationShell.useFeatureToggle(FILE_IMPORT_JOB_FLOW);
981
+ const _useFileUpload = operations.useFileUpload({
982
+ projectKey: projectKey,
983
+ useJobBasedFlow: isFileImportJobFlowEnabled
845
984
  }),
846
- upload = _useImportContainerUp.upload;
847
- React__default["default"].useEffect(() => {
848
- return () => {
849
- if (state.abortController) state.abortController.abort();
850
- };
851
- }, [state.abortController]);
985
+ upload = _useFileUpload.upload;
852
986
  const isFileValid = async file => {
853
987
  const errors = [];
988
+ const maxFileSizeMB = isFileImportJobFlowEnabled ? operations.IMPORT_MAX_FILE_SIZE_MB : operations.IMPORT_LEGACY_MAX_FILE_SIZE_MB;
989
+ const maxItemCount = isFileImportJobFlowEnabled ? operations.IMPORT_MAX_ITEM_COUNT : operations.IMPORT_LEGACY_MAX_ROW_COUNT;
854
990
  const isDelimiterValid = await operations.validateDelimiter(file, operations.COLUMN_DELIMITERS);
855
991
  if (!isDelimiterValid) errors.push({
856
- title: intl.formatMessage(messages$4.wrongSeparatorTitle),
857
- description: intl.formatMessage(messages$4.wrongSeparatorDescription, {
992
+ title: intl.formatMessage(messages$5.wrongSeparatorTitle),
993
+ description: intl.formatMessage(messages$5.wrongSeparatorDescription, {
858
994
  delimiterList: formatAllowedDelimitersForMessageDisplay(intl)
859
995
  })
860
996
  });
861
997
  const rowCount = await operations.getRowCount(file);
862
998
  if (rowCount < 1) errors.push({
863
- title: intl.formatMessage(messages$4.dropAreaNotEnoughRowsTitle),
864
- description: intl.formatMessage(messages$4.dropAreaNotEnoughRowsDescription)
999
+ title: intl.formatMessage(messages$5.dropAreaNotEnoughRowsTitle),
1000
+ description: intl.formatMessage(messages$5.dropAreaNotEnoughRowsDescription)
865
1001
  });
866
- if (state.resourceType && file.size > operations.toBytes(operations.MAX_FILE_SIZE_MB)) errors.push({
867
- title: intl.formatMessage(messages$4.fileSizeExceededTitle),
868
- description: intl.formatMessage(messages$4.fileSizeExceededDescription, {
869
- fileSizeLimit: intl.formatNumber(operations.MAX_FILE_SIZE_MB)
1002
+ if (state.resourceType && file.size > operations.toBytes(maxFileSizeMB)) errors.push({
1003
+ title: intl.formatMessage(messages$5.fileSizeExceededTitle),
1004
+ description: intl.formatMessage(messages$5.fileSizeExceededDescription, {
1005
+ fileSizeLimit: intl.formatNumber(maxFileSizeMB)
870
1006
  })
871
1007
  });
872
- if (state.resourceType && rowCount > operations.MAX_ROW_COUNT) errors.push({
873
- title: intl.formatMessage(messages$4.rowLimitExceededTitle),
874
- description: intl.formatMessage(messages$4.rowLimitExceededDescription, {
875
- rowLimit: intl.formatNumber(operations.MAX_ROW_COUNT)
1008
+ if (state.resourceType && rowCount > maxItemCount) errors.push({
1009
+ title: intl.formatMessage(messages$5.rowLimitExceededTitle),
1010
+ description: intl.formatMessage(messages$5.rowLimitExceededDescription, {
1011
+ rowLimit: intl.formatNumber(maxItemCount)
876
1012
  })
877
1013
  });
878
1014
  if (errors.length > 0) {
@@ -880,6 +1016,10 @@ const useUpload = () => {
880
1016
  actions.setCurrentStep(CurrentStep$1.UploadResult);
881
1017
  return false;
882
1018
  }
1019
+ if (isFileImportJobFlowEnabled) {
1020
+ const resourceCount = await operations.countUniqueResourcesInCsv(file);
1021
+ actions.setTotalResourceCount(resourceCount);
1022
+ }
883
1023
  return true;
884
1024
  };
885
1025
  const handleUploadError = error => {
@@ -888,18 +1028,22 @@ const useUpload = () => {
888
1028
  return;
889
1029
  }
890
1030
  if (error instanceof operations.HttpError) {
1031
+ actions.setValidationProgress({
1032
+ processed: 0,
1033
+ isValidating: false
1034
+ });
891
1035
  if (error.errorData?.code === 'MISSING_KEY_ERROR') {
892
1036
  actions.setFileUploadErrors([{
893
- title: intl.formatMessage(messages$4.missingRequiredField),
894
- description: intl.formatMessage(messages$4.missingKeyError)
1037
+ title: intl.formatMessage(messages$5.missingRequiredField),
1038
+ description: intl.formatMessage(messages$5.missingKeyError)
895
1039
  }]);
896
1040
  actions.setCurrentStep(CurrentStep$1.UploadResult);
897
1041
  } else if (error.errorData?.code === 'MissingCsvFieldIdentifier') {
898
1042
  const MissingCsvFieldIdentifierError = error.errorData;
899
1043
  const fieldNames = operations.formatKeys(MissingCsvFieldIdentifierError.rowValue);
900
1044
  actions.setFileUploadErrors([{
901
- title: intl.formatMessage(messages$4.missingRequiredField),
902
- description: intl.formatMessage(messages$4.missingRequiredKeys, {
1045
+ title: intl.formatMessage(messages$5.missingRequiredField),
1046
+ description: intl.formatMessage(messages$5.missingRequiredKeys, {
903
1047
  fieldNames
904
1048
  })
905
1049
  }]);
@@ -912,7 +1056,7 @@ const useUpload = () => {
912
1056
  showNotification({
913
1057
  kind: 'error',
914
1058
  domain: constants.DOMAINS.PAGE,
915
- text: intl.formatMessage(messages$4.unexpectedError)
1059
+ text: intl.formatMessage(messages$5.unexpectedError)
916
1060
  });
917
1061
  }
918
1062
  } else {
@@ -935,77 +1079,65 @@ const useUpload = () => {
935
1079
  if (!state.droppedFile || !state.resourceType) return;
936
1080
  const canUpload = await isFileValid(state.droppedFile);
937
1081
  if (!canUpload) return;
1082
+ const abortController = new AbortController();
1083
+ actions.setAbortController(abortController);
938
1084
  actions.setCurrentStep(CurrentStep$1.Uploading);
939
- try {
940
- const shouldApplyPublishSettings = state.resourceType === 'product';
941
- const xhr = await upload({
942
- file: state.droppedFile,
943
- resourceType: state.resourceType,
944
- settings: _objectSpread$a({
945
- format: 'CSV',
946
- decimalSeparator: state.settings?.decimalSeparator
947
- }, shouldApplyPublishSettings ? {
948
- resourceType: state.resourceType === 'product' ? 'product-draft' : state.resourceType,
949
- options: {
950
- publishAllChanges: state.settings?.publish ?? false
951
- }
952
- } : {}),
953
- onSuccess: (fileUploadResponse, containerKey) => {
954
- actions.setContainerKey(containerKey);
955
- actions.setUploadFileResponse(fileUploadResponse);
956
- actions.setCurrentStep(CurrentStep$1.UploadResult);
957
- },
958
- onProgress: progress => {
959
- actions.setProgress(progress);
960
- },
961
- onError: handleUploadError
962
- });
963
- actions.setAbortController(xhr);
964
- } catch (error) {
965
- handleUploadError(error);
966
- actions.setCurrentStep(CurrentStep$1.UploadResult);
967
- }
1085
+ const shouldApplyPublishSettings = state.resourceType === 'product';
1086
+ const uploadSettings = _objectSpread$7({
1087
+ format: 'CSV',
1088
+ decimalSeparator: state.settings?.decimalSeparator
1089
+ }, shouldApplyPublishSettings ? {
1090
+ resourceType: state.resourceType === 'product' ? 'product-draft' : state.resourceType,
1091
+ options: {
1092
+ publishAllChanges: state.settings?.publish ?? false
1093
+ }
1094
+ } : {});
1095
+ await upload({
1096
+ file: state.droppedFile,
1097
+ resourceType: state.resourceType,
1098
+ settings: uploadSettings,
1099
+ abortSignal: abortController.signal,
1100
+ onSuccess: result => {
1101
+ actions.setValidationProgress({
1102
+ processed: 0,
1103
+ isValidating: false
1104
+ });
1105
+ actions.setContainerKey(result.containerKey);
1106
+ if (result.jobId) {
1107
+ actions.setJobId(result.jobId);
1108
+ }
1109
+ const fileUploadResponse = {
1110
+ results: result.summary.results,
1111
+ invalid: result.summary.invalid,
1112
+ valid: result.summary.valid,
1113
+ fileName: state.droppedFile?.name || '',
1114
+ itemsCount: result.summary.total,
1115
+ rowsCount: result.summary.total,
1116
+ columnsCount: result.summary.fieldsCount,
1117
+ fields: result.summary.fields,
1118
+ ignoredFields: result.summary.ignoredFields
1119
+ };
1120
+ actions.setUploadFileResponse(fileUploadResponse);
1121
+ actions.setCurrentStep(CurrentStep$1.UploadResult);
1122
+ },
1123
+ onProgress: progress => {
1124
+ actions.setProgress(progress);
1125
+ },
1126
+ onValidationProgress: job => {
1127
+ const processed = job.summary?.total ?? 0;
1128
+ actions.setValidationProgress({
1129
+ processed,
1130
+ isValidating: true
1131
+ });
1132
+ },
1133
+ onError: handleUploadError
1134
+ });
968
1135
  };
969
1136
  return {
970
1137
  handleUploadAndValidation
971
1138
  };
972
1139
  };
973
1140
 
974
- const INITIAL_COLUMN_DISPLAY_COUNT = 8;
975
-
976
- const PERMISSIONS = {
977
- // Categories
978
- ManageCategories: 'ManageCategories',
979
- ViewCategories: 'ViewCategories',
980
- // Products
981
- ManageProducts: 'ManageProducts',
982
- ViewProducts: 'ViewProducts',
983
- // ProductTypes
984
- ManageProductTypes: 'ManageProductTypes',
985
- ViewProductTypes: 'ViewProductTypes',
986
- // DiscountCodes
987
- ManageDiscountCodes: 'ManageDiscountCodes',
988
- ViewDiscountCodes: 'ViewDiscountCodes',
989
- // Customers
990
- ManageCustomers: 'ManageCustomers',
991
- ViewCustomers: 'ViewCustomers',
992
- // Orders
993
- ManageOrders: 'ManageOrders',
994
- ViewOrders: 'ViewOrders',
995
- // KeyValueDocuments
996
- ManageKeyValueDocuments: 'ManageKeyValueDocuments',
997
- ViewKeyValueDocuments: 'ViewKeyValueDocuments',
998
- // BusinessUnits
999
- ManageBusinessUnits: 'ManageBusinessUnits',
1000
- ViewBusinessUnits: 'ViewBusinessUnits'
1001
- };
1002
-
1003
- function ownKeys$9(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
1004
- function _objectSpread$9(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$9(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$9(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
1005
- const DEFAULT_SHORT_LIVED_FLAGS = {};
1006
- const DEFAULT_LONG_LIVED_FLAGS = {};
1007
- _objectSpread$9(_objectSpread$9({}, DEFAULT_SHORT_LIVED_FLAGS), DEFAULT_LONG_LIVED_FLAGS);
1008
-
1009
1141
  const useImportPermission = () => {
1010
1142
  const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
1011
1143
  actionRights: applicationContext.actionRights?.products
@@ -1070,9 +1202,9 @@ const FileDropArea = () => {
1070
1202
  }, [state.resourceType, actions]);
1071
1203
  const handleDropRejected = React__default["default"].useCallback(errorType => {
1072
1204
  const errorMessageMap = {
1073
- 'too-many-files': messages$5.tooManyFilesError,
1074
- 'invalid-type': messages$5.fileFormatNotSupported,
1075
- generic: messages$5.genericError
1205
+ 'too-many-files': messages$6.tooManyFilesError,
1206
+ 'invalid-type': messages$6.fileFormatNotSupported,
1207
+ generic: messages$6.genericError
1076
1208
  };
1077
1209
  showNotification({
1078
1210
  kind: 'error',
@@ -1099,10 +1231,10 @@ const FileDropArea = () => {
1099
1231
  isFileDropped: Boolean(state.droppedFile),
1100
1232
  fileName: state.droppedFile?.name,
1101
1233
  messages: {
1102
- chooseFile: intl.formatMessage(messages$5.chooseFile),
1103
- dragAndDropCSV: intl.formatMessage(messages$5.dragAndDropCSV),
1104
- or: intl.formatMessage(messages$5.or),
1105
- browseButton: intl.formatMessage(messages$5.browseButton)
1234
+ chooseFile: intl.formatMessage(messages$6.chooseFile),
1235
+ dragAndDropCSV: intl.formatMessage(messages$6.dragAndDropCSV),
1236
+ or: intl.formatMessage(messages$6.or),
1237
+ browseButton: intl.formatMessage(messages$6.browseButton)
1106
1238
  }
1107
1239
  })
1108
1240
  });
@@ -1150,14 +1282,14 @@ const Upload = () => {
1150
1282
  children: [jsxRuntime.jsx(uiKit.Grid.Item, {
1151
1283
  children: jsxRuntime.jsx(uiKit.Text.Body, {
1152
1284
  isBold: true,
1153
- intlMessage: messages$5.dataType
1285
+ intlMessage: messages$6.dataType
1154
1286
  })
1155
1287
  }), jsxRuntime.jsx(uiKit.Grid.Item, {
1156
1288
  children: jsxRuntime.jsx(ResourceTypeSelection, {})
1157
1289
  }), jsxRuntime.jsx(uiKit.Grid.Item, {
1158
1290
  children: jsxRuntime.jsx(uiKit.Text.Body, {
1159
1291
  isBold: true,
1160
- intlMessage: messages$5.instructions
1292
+ intlMessage: messages$6.instructions
1161
1293
  })
1162
1294
  }), jsxRuntime.jsx(uiKit.Grid.Item, {
1163
1295
  children: jsxRuntime.jsx(Instructions, {})
@@ -1165,8 +1297,8 @@ const Upload = () => {
1165
1297
  }) : jsxRuntime.jsx(jsxRuntime.Fragment, {
1166
1298
  children: jsxRuntime.jsx(Instructions, {})
1167
1299
  }), jsxRuntime.jsx(operations.InfoBox, {
1168
- title: intl.formatMessage(messages$5.prerequisitesOfImportingData),
1169
- description: intl.formatMessage(messages$5.keysForEveryResource, {
1300
+ title: intl.formatMessage(messages$6.prerequisitesOfImportingData),
1301
+ description: intl.formatMessage(messages$6.keysForEveryResource, {
1170
1302
  link: msg => jsxRuntime.jsx(uiKit.Link, {
1171
1303
  tone: "secondary",
1172
1304
  isExternal: true,
@@ -1181,11 +1313,11 @@ const Upload = () => {
1181
1313
  decimalSeparator
1182
1314
  });
1183
1315
  },
1184
- separatorTitle: intl.formatMessage(messages$5.separatorTitle),
1185
- decimalsSeparatorDescription: intl.formatMessage(messages$5.decimalsSeparatorDescription),
1186
- decimalSeparatorPointLabel: intl.formatMessage(messages$5.decimalSeparatorPoint),
1187
- decimalSeparatorCommaLabel: intl.formatMessage(messages$5.decimalSeparatorComma),
1188
- decimalsLabel: intl.formatMessage(messages$5.decimals)
1316
+ separatorTitle: intl.formatMessage(messages$6.separatorTitle),
1317
+ decimalsSeparatorDescription: intl.formatMessage(messages$6.decimalsSeparatorDescription),
1318
+ decimalSeparatorPointLabel: intl.formatMessage(messages$6.decimalSeparatorPoint),
1319
+ decimalSeparatorCommaLabel: intl.formatMessage(messages$6.decimalSeparatorComma),
1320
+ decimalsLabel: intl.formatMessage(messages$6.decimals)
1189
1321
  }), jsxRuntime.jsx(fullstory.Masking.Mask, {
1190
1322
  children: jsxRuntime.jsx(FileDropArea, {})
1191
1323
  }), jsxRuntime.jsx(operations.UploadSettings, {
@@ -1196,7 +1328,7 @@ const Upload = () => {
1196
1328
  publish: checked
1197
1329
  });
1198
1330
  },
1199
- publishProductsLabel: intl.formatMessage(messages$5.publishProducts),
1331
+ publishProductsLabel: intl.formatMessage(messages$6.publishProducts),
1200
1332
  dataTrackingTarget: "product_import-publish_checkbox",
1201
1333
  canPublishProducts: canPublishProducts
1202
1334
  })]
@@ -1205,7 +1337,7 @@ const Upload = () => {
1205
1337
  });
1206
1338
  };
1207
1339
 
1208
- var messages$3 = reactIntl.defineMessages({
1340
+ var messages$4 = reactIntl.defineMessages({
1209
1341
  row: {
1210
1342
  id: 'ImportResourcesModal.row',
1211
1343
  description: 'In Upload file error modal - "Row" column',
@@ -1238,149 +1370,103 @@ var messages$3 = reactIntl.defineMessages({
1238
1370
  }
1239
1371
  });
1240
1372
 
1241
- function ownKeys$8(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
1242
- function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$8(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$8(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
1243
- const getColumns$1 = () => [{
1373
+ function ownKeys$6(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
1374
+ function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$6(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$6(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
1375
+ const fileLevelColumns = [{
1244
1376
  key: 'errorType',
1245
- label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$8({}, messages$3.errorType)),
1377
+ label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$4.errorType)),
1246
1378
  width: 'max-content'
1247
1379
  }, {
1248
1380
  key: 'details',
1249
- label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$8({}, messages$3.details))
1381
+ label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$4.details))
1250
1382
  }];
1251
- const UploadErrorTable = props => {
1252
- var _context;
1383
+ const rowLevelColumns = [{
1384
+ key: 'row',
1385
+ label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$4.row)),
1386
+ width: 'max-content'
1387
+ }, {
1388
+ key: 'errorType',
1389
+ label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$4.errorType)),
1390
+ width: 'max-content'
1391
+ }, {
1392
+ key: 'details',
1393
+ label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$4.details))
1394
+ }];
1395
+ const FileLevelErrorTable = _ref => {
1396
+ let rows = _ref.rows;
1253
1397
  const pagination = uiKit.usePaginationState({
1254
1398
  perPage: 10
1255
1399
  });
1256
1400
  const startIndex = (pagination.page.value - 1) * pagination.perPage.value;
1257
1401
  const endIndex = startIndex + pagination.perPage.value;
1258
- const currentPageRows = _sliceInstanceProperty__default["default"](_context = props.rows).call(_context, startIndex, endIndex);
1259
- const shouldShowPagination = props.rows.length > pagination.perPage.value;
1402
+ const currentPageRows = _sliceInstanceProperty__default["default"](rows).call(rows, startIndex, endIndex);
1403
+ const shouldShowPagination = rows.length > pagination.perPage.value;
1260
1404
  return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
1261
1405
  scale: "l",
1262
1406
  children: [jsxRuntime.jsx(uiKit.DataTable, {
1263
1407
  verticalCellAlignment: "center",
1264
1408
  isCondensed: true,
1265
1409
  rows: currentPageRows,
1266
- columns: getColumns$1(),
1267
- itemRenderer: itemRenderer$1
1410
+ columns: fileLevelColumns,
1411
+ itemRenderer: fileLevelItemRenderer
1268
1412
  }), shouldShowPagination && jsxRuntime.jsx(uiKit.PageNavigator, {
1269
1413
  onPageChange: pagination.page.onChange,
1270
1414
  page: pagination.page.value,
1271
- totalPages: Math.ceil(props.rows.length / pagination.perPage.value)
1415
+ totalPages: Math.ceil(rows.length / pagination.perPage.value)
1272
1416
  })]
1273
1417
  });
1274
1418
  };
1275
- function itemRenderer$1(item, column) {
1276
- switch (column.key) {
1277
- case 'errorType':
1278
- return jsxRuntime.jsx(uiKit.Stamp, {
1279
- isCondensed: true,
1280
- label: item.title,
1281
- tone: "critical"
1282
- });
1283
- case 'details':
1284
- return jsxRuntime.jsx(uiKit.Text.Body, {
1285
- children: item.description
1286
- });
1287
- default:
1288
- throw new operations.UnexpectedColumnError(column.key);
1289
- }
1290
- }
1291
-
1292
- function ownKeys$7(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
1293
- function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$7(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$7(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
1294
- const UploadErrorsModal = () => {
1295
- const intl = reactIntl.useIntl();
1296
- const _useImportResourcesCo = useImportResourcesContext(),
1297
- state = _useImportResourcesCo.state,
1298
- actions = _useImportResourcesCo.actions,
1299
- onClose = _useImportResourcesCo.onClose;
1300
- const errorsCount = state.fileUploadErrors.length;
1301
- return jsxRuntime.jsx(applicationComponents.InfoDialog, {
1302
- size: 16,
1303
- isOpen: true,
1304
- title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
1305
- onClose: () => onClose(),
1306
- children: jsxRuntime.jsx(fullstory.Masking.Unmask, {
1307
- children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
1308
- scale: "l",
1309
- children: [jsxRuntime.jsx(fullstory.Masking.Mask, {
1310
- children: jsxRuntime.jsx(uiKit.Text.Body, {
1311
- intlMessage: _objectSpread$7(_objectSpread$7({}, messages$3.uploadErrorDescription), {}, {
1312
- values: {
1313
- fileName: state.droppedFile?.name,
1314
- errorsCount: intl.formatNumber(errorsCount),
1315
- b: getBold$3
1316
- }
1317
- })
1318
- })
1319
- }), jsxRuntime.jsx(UploadErrorTable, {
1320
- rows: operations.mapFileUploadErrorsToUploadFileErrorRows(state.fileUploadErrors)
1321
- }), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
1322
- scale: "m",
1323
- justifyContent: "flex-end",
1324
- children: [jsxRuntime.jsx(uiKit.SecondaryButton, {
1325
- label: intl.formatMessage(sharedMessages.close),
1326
- onClick: () => onClose()
1327
- }), jsxRuntime.jsx(uiKit.PrimaryButton, {
1328
- iconLeft: jsxRuntime.jsx(uiKit.ImportIcon, {}),
1329
- label: intl.formatMessage(messages$3.uploadNewFile),
1330
- onClick: () => actions.uploadNewFile()
1331
- })]
1332
- })]
1333
- })
1334
- })
1335
- });
1336
- };
1337
- function getBold$3(msg) {
1338
- return jsxRuntime.jsx(uiKit.Text.Body, {
1339
- as: "span",
1340
- isBold: true,
1341
- children: msg
1342
- }, crypto.randomUUID());
1343
- }
1344
-
1345
- function ownKeys$6(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
1346
- function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$6(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$6(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
1347
- const getColumns = () => [{
1348
- key: 'row',
1349
- label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$3.row)),
1350
- width: 'max-content'
1351
- }, {
1352
- key: 'errorType',
1353
- label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$3.errorType)),
1354
- width: 'max-content'
1355
- }, {
1356
- key: 'details',
1357
- label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$3.details))
1358
- }];
1359
- const UploadRowErrorTable = props => {
1360
- var _context;
1419
+ const RowLevelErrorTable = _ref2 => {
1420
+ let rows = _ref2.rows;
1361
1421
  const pagination = uiKit.usePaginationState({
1362
1422
  perPage: 10
1363
1423
  });
1364
1424
  const startIndex = (pagination.page.value - 1) * pagination.perPage.value;
1365
1425
  const endIndex = startIndex + pagination.perPage.value;
1366
- const currentPageRows = _sliceInstanceProperty__default["default"](_context = props.rows).call(_context, startIndex, endIndex);
1367
- const shouldShowPagination = props.rows.length > pagination.perPage.value;
1426
+ const currentPageRows = _sliceInstanceProperty__default["default"](rows).call(rows, startIndex, endIndex);
1427
+ const shouldShowPagination = rows.length > pagination.perPage.value;
1368
1428
  return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
1369
1429
  scale: "l",
1370
1430
  children: [jsxRuntime.jsx(uiKit.DataTable, {
1371
1431
  verticalCellAlignment: "center",
1372
1432
  isCondensed: true,
1373
1433
  rows: currentPageRows,
1374
- columns: getColumns(),
1375
- itemRenderer: itemRenderer
1434
+ columns: rowLevelColumns,
1435
+ itemRenderer: rowLevelItemRenderer
1376
1436
  }), shouldShowPagination && jsxRuntime.jsx(uiKit.PageNavigator, {
1377
1437
  onPageChange: pagination.page.onChange,
1378
1438
  page: pagination.page.value,
1379
- totalPages: Math.ceil(props.rows.length / pagination.perPage.value)
1439
+ totalPages: Math.ceil(rows.length / pagination.perPage.value)
1380
1440
  })]
1381
1441
  });
1382
1442
  };
1383
- function itemRenderer(item, column) {
1443
+ const UploadErrorTable = props => {
1444
+ if (props.variant === 'row-level') {
1445
+ return jsxRuntime.jsx(RowLevelErrorTable, {
1446
+ rows: props.rows
1447
+ });
1448
+ }
1449
+ return jsxRuntime.jsx(FileLevelErrorTable, {
1450
+ rows: props.rows
1451
+ });
1452
+ };
1453
+ function fileLevelItemRenderer(item, column) {
1454
+ switch (column.key) {
1455
+ case 'errorType':
1456
+ return jsxRuntime.jsx(uiKit.Stamp, {
1457
+ isCondensed: true,
1458
+ label: item.title,
1459
+ tone: "critical"
1460
+ });
1461
+ case 'details':
1462
+ return jsxRuntime.jsx(uiKit.Text.Body, {
1463
+ children: item.description
1464
+ });
1465
+ default:
1466
+ throw new operations.UnexpectedColumnError(column.key);
1467
+ }
1468
+ }
1469
+ function rowLevelItemRenderer(item, column) {
1384
1470
  switch (column.key) {
1385
1471
  case 'row':
1386
1472
  return item.row;
@@ -1407,19 +1493,21 @@ function itemRenderer(item, column) {
1407
1493
 
1408
1494
  function ownKeys$5(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
1409
1495
  function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$5(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$5(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
1410
- const UploadRowErrorsModal = () => {
1496
+ const UploadErrorsModal = () => {
1411
1497
  const intl = reactIntl.useIntl();
1412
1498
  const _useImportResourcesCo = useImportResourcesContext(),
1413
1499
  state = _useImportResourcesCo.state,
1414
1500
  actions = _useImportResourcesCo.actions,
1415
1501
  onClose = _useImportResourcesCo.onClose;
1416
- const errorsCount = operations.getFileUploadErrorsCount(state.uploadFileResponse?.results);
1502
+ const isRowLevelErrors = (state.uploadFileResponse?.invalid ?? 0) > 0 && (state.uploadFileResponse?.results?.length ?? 0) > 0;
1503
+ const isFileLevelErrors = state.fileUploadErrors.length > 0;
1504
+ const errorsCount = isRowLevelErrors ? operations.getFileUploadErrorsCount(state.uploadFileResponse?.results) : state.fileUploadErrors.length;
1417
1505
  const documentationLink = operations.RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
1418
1506
  return jsxRuntime.jsx(applicationComponents.InfoDialog, {
1419
1507
  size: 16,
1420
1508
  isOpen: true,
1421
1509
  title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
1422
- onClose: onClose,
1510
+ onClose: () => onClose(),
1423
1511
  children: jsxRuntime.jsx(fullstory.Masking.Unmask, {
1424
1512
  children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
1425
1513
  scale: "l",
@@ -1427,7 +1515,7 @@ const UploadRowErrorsModal = () => {
1427
1515
  scale: "xs",
1428
1516
  children: [jsxRuntime.jsx(fullstory.Masking.Mask, {
1429
1517
  children: jsxRuntime.jsx(uiKit.Text.Body, {
1430
- intlMessage: _objectSpread$5(_objectSpread$5({}, messages$3.uploadErrorDescription), {}, {
1518
+ intlMessage: _objectSpread$5(_objectSpread$5({}, messages$4.uploadErrorDescription), {}, {
1431
1519
  values: {
1432
1520
  fileName: state.droppedFile?.name,
1433
1521
  errorsCount: intl.formatNumber(errorsCount),
@@ -1435,8 +1523,8 @@ const UploadRowErrorsModal = () => {
1435
1523
  }
1436
1524
  })
1437
1525
  })
1438
- }), jsxRuntime.jsx(uiKit.Text.Body, {
1439
- intlMessage: _objectSpread$5(_objectSpread$5({}, messages$3.supportedValuesDocumentation), {}, {
1526
+ }), isRowLevelErrors && jsxRuntime.jsx(uiKit.Text.Body, {
1527
+ intlMessage: _objectSpread$5(_objectSpread$5({}, messages$4.supportedValuesDocumentation), {}, {
1440
1528
  values: {
1441
1529
  documentationLink: msg => jsxRuntime.jsx(uiKit.Link, {
1442
1530
  tone: "secondary",
@@ -1447,8 +1535,12 @@ const UploadRowErrorsModal = () => {
1447
1535
  }
1448
1536
  })
1449
1537
  })]
1450
- }), jsxRuntime.jsx(UploadRowErrorTable, {
1538
+ }), isRowLevelErrors && jsxRuntime.jsx(UploadErrorTable, {
1539
+ variant: "row-level",
1451
1540
  rows: operations.mapUploadFileErrorsResponseToUploadFileErrorRows(state.uploadFileResponse?.results)
1541
+ }), isFileLevelErrors && jsxRuntime.jsx(UploadErrorTable, {
1542
+ variant: "file-level",
1543
+ rows: operations.mapFileUploadErrorsToUploadFileErrorRows(state.fileUploadErrors)
1452
1544
  }), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
1453
1545
  scale: "m",
1454
1546
  justifyContent: "flex-end",
@@ -1457,7 +1549,7 @@ const UploadRowErrorsModal = () => {
1457
1549
  onClick: () => onClose()
1458
1550
  }), jsxRuntime.jsx(uiKit.PrimaryButton, {
1459
1551
  iconLeft: jsxRuntime.jsx(uiKit.ImportIcon, {}),
1460
- label: intl.formatMessage(messages$3.uploadNewFile),
1552
+ label: intl.formatMessage(messages$4.uploadNewFile),
1461
1553
  onClick: () => actions.uploadNewFile()
1462
1554
  })]
1463
1555
  })]
@@ -1473,7 +1565,7 @@ function getBold$2(msg) {
1473
1565
  }, crypto.randomUUID());
1474
1566
  }
1475
1567
 
1476
- var messages$2 = reactIntl.defineMessages({
1568
+ var messages$3 = reactIntl.defineMessages({
1477
1569
  startImportButton: {
1478
1570
  id: 'ImportResourcesModal.startImportButton',
1479
1571
  description: 'Label for the modal Start import button',
@@ -1575,7 +1667,7 @@ const ColumnList = props => {
1575
1667
  e.preventDefault();
1576
1668
  setIsExpanded(!isExpanded);
1577
1669
  },
1578
- children: isExpanded ? jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages$2.showLess)) : jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages$2.showMore))
1670
+ children: isExpanded ? jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages$3.showLess)) : jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages$3.showMore))
1579
1671
  })
1580
1672
  })]
1581
1673
  });
@@ -1595,13 +1687,13 @@ function UploadPreviewModal() {
1595
1687
  const resourceType = intl.formatMessage(resourceTypeMessage).toLowerCase();
1596
1688
  const resourceTypePluralMessage = resourceTypeToPluralMessage(state.resourceType);
1597
1689
  const resourceTypePlural = intl.formatMessage(resourceTypePluralMessage).toLowerCase();
1598
- const ignoredColumns = state.uploadFileResponse.ignoredColumns;
1599
- const validatedColumns = operations.getValidatedColumns(state.uploadFileResponse.columns, ignoredColumns);
1690
+ const ignoredFields = state.uploadFileResponse.ignoredFields;
1691
+ const validatedFields = operations.getValidatedColumns(state.uploadFileResponse.fields, ignoredFields);
1600
1692
  return jsxRuntime.jsx(applicationComponents.FormDialog, {
1601
1693
  size: 16,
1602
1694
  isOpen: true,
1603
1695
  title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
1604
- labelPrimary: intl.formatMessage(messages$2.continue),
1696
+ labelPrimary: intl.formatMessage(messages$3.continue),
1605
1697
  onSecondaryButtonClick: () => onClose({
1606
1698
  shouldDeleteImportContainer: true
1607
1699
  }),
@@ -1620,7 +1712,7 @@ function UploadPreviewModal() {
1620
1712
  children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
1621
1713
  scale: "m",
1622
1714
  children: [jsxRuntime.jsx("div", {}), jsxRuntime.jsx(uiKit.Text.Body, {
1623
- intlMessage: messages$2.previewOfYourImport
1715
+ intlMessage: messages$3.previewOfYourImport
1624
1716
  }), jsxRuntime.jsx(uiKit.Card, {
1625
1717
  insetScale: "xl",
1626
1718
  children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
@@ -1632,7 +1724,7 @@ function UploadPreviewModal() {
1632
1724
  children: [jsxRuntime.jsx(uiKit.CheckBoldIcon, {
1633
1725
  color: "success"
1634
1726
  }), jsxRuntime.jsx(uiKit.Text.Body, {
1635
- intlMessage: _objectSpread$3(_objectSpread$3({}, messages$2.itemsToBeImported), {}, {
1727
+ intlMessage: _objectSpread$3(_objectSpread$3({}, messages$3.itemsToBeImported), {}, {
1636
1728
  values: {
1637
1729
  resourceType,
1638
1730
  resourceTypePlural,
@@ -1647,19 +1739,19 @@ function UploadPreviewModal() {
1647
1739
  children: [jsxRuntime.jsx(uiKit.CheckBoldIcon, {
1648
1740
  color: "success"
1649
1741
  }), jsxRuntime.jsx(uiKit.Text.Body, {
1650
- intlMessage: _objectSpread$3(_objectSpread$3({}, messages$2.columnsToBeImported), {}, {
1742
+ intlMessage: _objectSpread$3(_objectSpread$3({}, messages$3.columnsToBeImported), {}, {
1651
1743
  values: {
1652
- columnCount: intl.formatNumber(validatedColumns.length),
1744
+ columnCount: intl.formatNumber(validatedFields.length),
1653
1745
  b: getBold$1
1654
1746
  }
1655
1747
  })
1656
1748
  })]
1657
1749
  })]
1658
1750
  }), jsxRuntime.jsx(ColumnList, {
1659
- columns: validatedColumns
1751
+ columns: validatedFields
1660
1752
  })]
1661
1753
  })
1662
- }), ignoredColumns.length > 0 && jsxRuntime.jsx(uiKit.Card, {
1754
+ }), ignoredFields.length > 0 && jsxRuntime.jsx(uiKit.Card, {
1663
1755
  insetScale: "xl",
1664
1756
  children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
1665
1757
  scale: "s",
@@ -1668,15 +1760,15 @@ function UploadPreviewModal() {
1668
1760
  children: [jsxRuntime.jsx(uiKit.EyeCrossedIcon, {
1669
1761
  color: "neutral60"
1670
1762
  }), jsxRuntime.jsx(uiKit.Text.Body, {
1671
- intlMessage: _objectSpread$3(_objectSpread$3({}, messages$2.columnsToBeIgnored), {}, {
1763
+ intlMessage: _objectSpread$3(_objectSpread$3({}, messages$3.columnsToBeIgnored), {}, {
1672
1764
  values: {
1673
- columnCount: intl.formatNumber(ignoredColumns.length),
1765
+ columnCount: intl.formatNumber(ignoredFields.length),
1674
1766
  b: getBold$1
1675
1767
  }
1676
1768
  })
1677
1769
  })]
1678
1770
  }), jsxRuntime.jsx(ColumnList, {
1679
- columns: ignoredColumns
1771
+ columns: ignoredFields
1680
1772
  })]
1681
1773
  })
1682
1774
  })]
@@ -1709,7 +1801,7 @@ var _ref2 = {
1709
1801
  const ImportRunningTextNotification = props => jsxRuntime.jsx("div", {
1710
1802
  css: _ref2,
1711
1803
  children: jsxRuntime.jsx(uiKit.Text.Body, {
1712
- intlMessage: _objectSpread$2(_objectSpread$2({}, messages$2.importNotificationSuccessMessage), {}, {
1804
+ intlMessage: _objectSpread$2(_objectSpread$2({}, messages$3.importNotificationSuccessMessage), {}, {
1713
1805
  values: {
1714
1806
  newline: getNewLine,
1715
1807
  logsLink: msg => getImportLogsLink(msg, props.projectKey),
@@ -1725,7 +1817,7 @@ var _ref = {
1725
1817
  const ImportPreparingTextNotification = props => jsxRuntime.jsx("div", {
1726
1818
  css: _ref,
1727
1819
  children: jsxRuntime.jsx(uiKit.Text.Body, {
1728
- intlMessage: _objectSpread$2(_objectSpread$2({}, messages$2.importNotificationPrepareMessage), {}, {
1820
+ intlMessage: _objectSpread$2(_objectSpread$2({}, messages$3.importNotificationPrepareMessage), {}, {
1729
1821
  values: {
1730
1822
  newline: getNewLine,
1731
1823
  logsLink: msg => getImportLogsLink(msg, props.projectKey),
@@ -1749,7 +1841,7 @@ const ImportConfirmationModal = () => {
1749
1841
  const showNotification = actionsGlobal.useShowNotification();
1750
1842
  return jsxRuntime.jsx(applicationComponents.ConfirmationDialog, {
1751
1843
  title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
1752
- labelPrimary: intl.formatMessage(messages$2.startImportButton),
1844
+ labelPrimary: intl.formatMessage(messages$3.startImportButton),
1753
1845
  isOpen: true,
1754
1846
  onClose: () => onClose({
1755
1847
  shouldDeleteImportContainer: true
@@ -1779,11 +1871,21 @@ const ImportConfirmationModal = () => {
1779
1871
  }, {
1780
1872
  dismissAfter: 5000
1781
1873
  });
1782
- await operations.processUploadedFile({
1783
- projectKey,
1784
- importContainerKey: state.containerKey,
1785
- resourceType: state.resourceType
1786
- });
1874
+ const isJobBasedFlow = !!state.jobId;
1875
+ if (isJobBasedFlow) {
1876
+ await operations.processFileImportJob({
1877
+ projectKey,
1878
+ resourceType: state.resourceType,
1879
+ importContainerKey: state.containerKey,
1880
+ jobId: state.jobId
1881
+ });
1882
+ } else {
1883
+ await operations.processUploadedFile({
1884
+ projectKey,
1885
+ importContainerKey: state.containerKey,
1886
+ resourceType: state.resourceType
1887
+ });
1888
+ }
1787
1889
  onStartImportSuccess();
1788
1890
  showNotification({
1789
1891
  kind: 'info',
@@ -1812,7 +1914,7 @@ const ImportConfirmationModal = () => {
1812
1914
  scale: "xl",
1813
1915
  children: [jsxRuntime.jsxs("div", {
1814
1916
  children: [jsxRuntime.jsx(uiKit.Text.Body, {
1815
- intlMessage: _objectSpread$2(_objectSpread$2({}, messages$2.confirmationBodyText), {}, {
1917
+ intlMessage: _objectSpread$2(_objectSpread$2({}, messages$3.confirmationBodyText), {}, {
1816
1918
  values: {
1817
1919
  projectName: projectName,
1818
1920
  count: intl.formatNumber(state?.uploadFileResponse?.rowsCount || 0),
@@ -1820,10 +1922,10 @@ const ImportConfirmationModal = () => {
1820
1922
  }
1821
1923
  })
1822
1924
  }), jsxRuntime.jsx(uiKit.Text.Body, {
1823
- intlMessage: messages$2.confirmationBodyNote
1925
+ intlMessage: messages$3.confirmationBodyNote
1824
1926
  })]
1825
1927
  }), jsxRuntime.jsx(uiKit.Text.Body, {
1826
- intlMessage: messages$2.confirmationBodyQuestion
1928
+ intlMessage: messages$3.confirmationBodyQuestion
1827
1929
  })]
1828
1930
  })
1829
1931
  })
@@ -1840,11 +1942,21 @@ function getBold(msg) {
1840
1942
  const UploadResult = () => {
1841
1943
  const _useImportResourcesCo = useImportResourcesContext(),
1842
1944
  state = _useImportResourcesCo.state;
1843
- if (state.fileUploadErrors.length > 0) return jsxRuntime.jsx(UploadErrorsModal, {});
1844
- if (state.uploadFileResponse?.invalid > 0) return jsxRuntime.jsx(UploadRowErrorsModal, {});
1945
+ const hasFileLevelErrors = state.fileUploadErrors.length > 0;
1946
+ const hasRowLevelErrors = (state.uploadFileResponse?.invalid ?? 0) > 0 && (state.uploadFileResponse?.results?.length ?? 0) > 0;
1947
+ if (hasFileLevelErrors || hasRowLevelErrors) {
1948
+ return jsxRuntime.jsx(UploadErrorsModal, {});
1949
+ }
1845
1950
  return jsxRuntime.jsx(UploadPreviewModal, {});
1846
1951
  };
1847
1952
 
1953
+ var messages$2 = reactIntl.defineMessages({
1954
+ validatingResources: {
1955
+ id: 'ImportResourcesModal.Uploading.validatingResources',
1956
+ defaultMessage: 'Validating {processed} / {total} {resourceType}'
1957
+ }
1958
+ });
1959
+
1848
1960
  const Uploading = () => {
1849
1961
  const intl = reactIntl.useIntl();
1850
1962
  const _useImportResourcesCo = useImportResourcesContext(),
@@ -1852,6 +1964,12 @@ const Uploading = () => {
1852
1964
  actions = _useImportResourcesCo.actions,
1853
1965
  onClose = _useImportResourcesCo.onClose;
1854
1966
  if (!state.droppedFile?.name) return null;
1967
+ const showValidationProgress = state.isValidating && state.validationProcessed && state.validationProcessed > 0 && state.totalResourceCount && state.resourceType;
1968
+ const statusMessage = showValidationProgress ? intl.formatMessage(messages$2.validatingResources, {
1969
+ processed: intl.formatNumber(state.validationProcessed),
1970
+ total: intl.formatNumber(state.totalResourceCount),
1971
+ resourceType: intl.formatMessage(resourceTypeToPluralMessage(state.resourceType))
1972
+ }) : undefined;
1855
1973
  return jsxRuntime.jsx(operations.UploadingModal, {
1856
1974
  isOpen: true,
1857
1975
  title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
@@ -1865,7 +1983,8 @@ const Uploading = () => {
1865
1983
  },
1866
1984
  onClose: () => onClose({
1867
1985
  shouldDeleteImportContainer: true
1868
- })
1986
+ }),
1987
+ statusMessage: statusMessage
1869
1988
  });
1870
1989
  };
1871
1990
 
@@ -1908,7 +2027,7 @@ const resourceTypeToDisplayName = resourceType => {
1908
2027
  case IMPORTABLE_RESOURCES.CATEGORY:
1909
2028
  return messages$1.categories;
1910
2029
  default:
1911
- throw new Error(`Unknown resource type: ${resourceType}`);
2030
+ throw new operations.UnexpectedResourceTypeError(resourceType);
1912
2031
  }
1913
2032
  };
1914
2033
  const ResourceTypeSelection = () => {
@@ -1948,13 +2067,16 @@ const Instructions = () => {
1948
2067
  const intl = reactIntl.useIntl();
1949
2068
  const _useImportResourcesCo = useImportResourcesContext(),
1950
2069
  state = _useImportResourcesCo.state;
2070
+ const isFileImportJobFlowEnabled = applicationShell.useFeatureToggle(FILE_IMPORT_JOB_FLOW);
1951
2071
  const templateLink = operations.RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS[state.resourceType];
1952
2072
  const documentationLink = operations.RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
2073
+ const maxFileSize = isFileImportJobFlowEnabled ? operations.IMPORT_MAX_FILE_SIZE_MB : operations.IMPORT_LEGACY_MAX_FILE_SIZE_MB;
2074
+ const maxItemCount = isFileImportJobFlowEnabled ? operations.IMPORT_MAX_ITEM_COUNT : operations.IMPORT_LEGACY_MAX_ROW_COUNT;
1953
2075
  return jsxRuntime.jsx(uiKit.Text.Body, {
1954
2076
  intlMessage: _objectSpread$1(_objectSpread$1({}, messages.fileUploadInstructions), {}, {
1955
2077
  values: {
1956
- fileSize: intl.formatNumber(operations.MAX_FILE_SIZE_MB),
1957
- rowLimit: intl.formatNumber(operations.MAX_ROW_COUNT),
2078
+ fileSize: intl.formatNumber(maxFileSize),
2079
+ rowLimit: intl.formatNumber(maxItemCount),
1958
2080
  csvTemplateLink: msg => jsxRuntime.jsx(uiKit.Link, {
1959
2081
  tone: "secondary",
1960
2082
  isExternal: true,