@commercetools-frontend-extensions/import-resources-modal 1.11.6 → 1.13.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$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; }
68
+ 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; }
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$b(_objectSpread$b({}, 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$b(_objectSpread$b({}, 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$b(_objectSpread$b({}, 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$b(_objectSpread$b({}, 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$b(_objectSpread$b({}, 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$b(_objectSpread$b({}, 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$b(_objectSpread$b({}, 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$b(_objectSpread$b({}, 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$b(_objectSpread$b({}, 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$b(_objectSpread$b({}, 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$b(_objectSpread$b({}, state), {}, {
134
+ settings: _objectSpread$b(_objectSpread$b({}, state.settings), action.settings)
135
+ });
136
+ }
137
+ if (action.type === 'setJobId') {
138
+ return _objectSpread$b(_objectSpread$b({}, state), {}, {
139
+ jobId: action.jobId
140
+ });
141
+ }
142
+ if (action.type === 'setTotalResourceCount') {
143
+ return _objectSpread$b(_objectSpread$b({}, state), {}, {
144
+ totalResourceCount: action.totalResourceCount
145
+ });
146
+ }
147
+ if (action.type === 'setValidationProgress') {
148
+ return _objectSpread$b(_objectSpread$b({}, 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$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; }
221
+ 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; }
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$a(_objectSpread$a({}, 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$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; }
960
+ 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; }
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$9(_objectSpread$9({}, DEFAULT_SHORT_LIVED_FLAGS), DEFAULT_LONG_LIVED_FLAGS);
967
+
968
+ 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; }
969
+ 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; }
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$8({
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,186 @@ 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$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; }
1374
+ 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; }
1375
+ const PER_PAGE = 20;
1376
+ const columns = [{
1377
+ key: 'row',
1378
+ label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$7({}, messages$4.row)),
1379
+ width: 'max-content'
1380
+ }, {
1244
1381
  key: 'errorType',
1245
- label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$8({}, messages$3.errorType)),
1382
+ label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$7({}, messages$4.errorType)),
1246
1383
  width: 'max-content'
1247
1384
  }, {
1248
1385
  key: 'details',
1249
- label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$8({}, messages$3.details))
1386
+ label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$7({}, messages$4.details))
1250
1387
  }];
1251
- const UploadErrorTable = props => {
1252
- var _context;
1388
+ const ServerPaginatedErrorTable = _ref => {
1389
+ let jobId = _ref.jobId,
1390
+ containerKey = _ref.containerKey,
1391
+ totalInvalid = _ref.totalInvalid;
1392
+ const projectKey = applicationShellConnectors.useApplicationContext(context => context.project?.key);
1253
1393
  const pagination = uiKit.usePaginationState({
1254
- perPage: 10
1394
+ perPage: PER_PAGE
1255
1395
  });
1256
- const startIndex = (pagination.page.value - 1) * pagination.perPage.value;
1257
- 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;
1396
+ const offset = (pagination.page.value - 1) * PER_PAGE;
1397
+ const totalPages = Math.ceil(totalInvalid / PER_PAGE);
1398
+ const _useFetchFileImportJo = operations.useFetchFileImportJobRecords({
1399
+ projectKey: projectKey,
1400
+ importContainerKey: containerKey,
1401
+ jobId,
1402
+ offset,
1403
+ limit: PER_PAGE,
1404
+ isValid: false
1405
+ }),
1406
+ data = _useFetchFileImportJo.data,
1407
+ isLoading = _useFetchFileImportJo.isLoading;
1408
+ const rows = React__default["default"].useMemo(() => data ? operations.mapUploadFileErrorsResponseToUploadFileErrorRows(data.results) : [], [data]);
1409
+ const showInitialLoading = isLoading && !data;
1410
+ if (showInitialLoading) {
1411
+ return jsxRuntime.jsx(uiKit.Spacings.Stack, {
1412
+ alignItems: "center",
1413
+ children: jsxRuntime.jsx(uiKit.LoadingSpinner, {})
1414
+ });
1415
+ }
1260
1416
  return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
1261
1417
  scale: "l",
1262
1418
  children: [jsxRuntime.jsx(uiKit.DataTable, {
1263
1419
  verticalCellAlignment: "center",
1264
1420
  isCondensed: true,
1265
- rows: currentPageRows,
1266
- columns: getColumns$1(),
1267
- itemRenderer: itemRenderer$1
1268
- }), shouldShowPagination && jsxRuntime.jsx(uiKit.PageNavigator, {
1421
+ rows: rows,
1422
+ columns: columns,
1423
+ itemRenderer: itemRenderer
1424
+ }), totalPages > 1 && jsxRuntime.jsx(uiKit.PageNavigator, {
1269
1425
  onPageChange: pagination.page.onChange,
1270
1426
  page: pagination.page.value,
1271
- totalPages: Math.ceil(props.rows.length / pagination.perPage.value)
1427
+ totalPages: totalPages
1272
1428
  })]
1273
1429
  });
1274
1430
  };
1275
- function itemRenderer$1(item, column) {
1431
+ function itemRenderer(item, column) {
1276
1432
  switch (column.key) {
1433
+ case 'row':
1434
+ return item.row;
1277
1435
  case 'errorType':
1278
1436
  return jsxRuntime.jsx(uiKit.Stamp, {
1279
1437
  isCondensed: true,
1280
- label: item.title,
1438
+ label: operations.formatErrorCode(item.code),
1281
1439
  tone: "critical"
1282
1440
  });
1283
1441
  case 'details':
1284
- return jsxRuntime.jsx(uiKit.Text.Body, {
1285
- children: item.description
1442
+ return jsxRuntime.jsxs(uiKit.Spacings.Inline, {
1443
+ scale: "xs",
1444
+ children: [jsxRuntime.jsx(uiKit.Text.Body, {
1445
+ tone: "information",
1446
+ children: item.field
1447
+ }), jsxRuntime.jsx(uiKit.Text.Body, {
1448
+ children: operations.extractErrorDescriptionFromValidationMessage(item.validationMessage)
1449
+ })]
1286
1450
  });
1287
1451
  default:
1288
1452
  throw new operations.UnexpectedColumnError(column.key);
1289
1453
  }
1290
1454
  }
1291
1455
 
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
1456
  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 = () => [{
1457
+ 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; }
1458
+ const fileLevelColumns = [{
1459
+ key: 'errorType',
1460
+ label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$4.errorType)),
1461
+ width: 'max-content'
1462
+ }, {
1463
+ key: 'details',
1464
+ label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$4.details))
1465
+ }];
1466
+ const rowLevelColumns = [{
1348
1467
  key: 'row',
1349
- label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$3.row)),
1468
+ label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$4.row)),
1350
1469
  width: 'max-content'
1351
1470
  }, {
1352
1471
  key: 'errorType',
1353
- label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$3.errorType)),
1472
+ label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$4.errorType)),
1354
1473
  width: 'max-content'
1355
1474
  }, {
1356
1475
  key: 'details',
1357
- label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$3.details))
1476
+ label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$4.details))
1358
1477
  }];
1359
- const UploadRowErrorTable = props => {
1360
- var _context;
1478
+ const FileLevelErrorTable = _ref => {
1479
+ let rows = _ref.rows;
1361
1480
  const pagination = uiKit.usePaginationState({
1362
1481
  perPage: 10
1363
1482
  });
1364
1483
  const startIndex = (pagination.page.value - 1) * pagination.perPage.value;
1365
1484
  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;
1485
+ const currentPageRows = _sliceInstanceProperty__default["default"](rows).call(rows, startIndex, endIndex);
1486
+ const shouldShowPagination = rows.length > pagination.perPage.value;
1368
1487
  return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
1369
1488
  scale: "l",
1370
1489
  children: [jsxRuntime.jsx(uiKit.DataTable, {
1371
1490
  verticalCellAlignment: "center",
1372
1491
  isCondensed: true,
1373
1492
  rows: currentPageRows,
1374
- columns: getColumns(),
1375
- itemRenderer: itemRenderer
1493
+ columns: fileLevelColumns,
1494
+ itemRenderer: fileLevelItemRenderer
1376
1495
  }), shouldShowPagination && jsxRuntime.jsx(uiKit.PageNavigator, {
1377
1496
  onPageChange: pagination.page.onChange,
1378
1497
  page: pagination.page.value,
1379
- totalPages: Math.ceil(props.rows.length / pagination.perPage.value)
1498
+ totalPages: Math.ceil(rows.length / pagination.perPage.value)
1380
1499
  })]
1381
1500
  });
1382
1501
  };
1383
- function itemRenderer(item, column) {
1502
+ const RowLevelErrorTable = _ref2 => {
1503
+ let rows = _ref2.rows;
1504
+ const pagination = uiKit.usePaginationState({
1505
+ perPage: 10
1506
+ });
1507
+ const startIndex = (pagination.page.value - 1) * pagination.perPage.value;
1508
+ const endIndex = startIndex + pagination.perPage.value;
1509
+ const currentPageRows = _sliceInstanceProperty__default["default"](rows).call(rows, startIndex, endIndex);
1510
+ const shouldShowPagination = rows.length > pagination.perPage.value;
1511
+ return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
1512
+ scale: "l",
1513
+ children: [jsxRuntime.jsx(uiKit.DataTable, {
1514
+ verticalCellAlignment: "center",
1515
+ isCondensed: true,
1516
+ rows: currentPageRows,
1517
+ columns: rowLevelColumns,
1518
+ itemRenderer: rowLevelItemRenderer
1519
+ }), shouldShowPagination && jsxRuntime.jsx(uiKit.PageNavigator, {
1520
+ onPageChange: pagination.page.onChange,
1521
+ page: pagination.page.value,
1522
+ totalPages: Math.ceil(rows.length / pagination.perPage.value)
1523
+ })]
1524
+ });
1525
+ };
1526
+ const UploadErrorTable = props => {
1527
+ if (props.variant === 'row-level') {
1528
+ return jsxRuntime.jsx(RowLevelErrorTable, {
1529
+ rows: props.rows
1530
+ });
1531
+ }
1532
+ return jsxRuntime.jsx(FileLevelErrorTable, {
1533
+ rows: props.rows
1534
+ });
1535
+ };
1536
+ function fileLevelItemRenderer(item, column) {
1537
+ switch (column.key) {
1538
+ case 'errorType':
1539
+ return jsxRuntime.jsx(uiKit.Stamp, {
1540
+ isCondensed: true,
1541
+ label: item.title,
1542
+ tone: "critical"
1543
+ });
1544
+ case 'details':
1545
+ return jsxRuntime.jsx(uiKit.Text.Body, {
1546
+ children: item.description
1547
+ });
1548
+ default:
1549
+ throw new operations.UnexpectedColumnError(column.key);
1550
+ }
1551
+ }
1552
+ function rowLevelItemRenderer(item, column) {
1384
1553
  switch (column.key) {
1385
1554
  case 'row':
1386
1555
  return item.row;
@@ -1407,19 +1576,23 @@ function itemRenderer(item, column) {
1407
1576
 
1408
1577
  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
1578
  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 = () => {
1579
+ const UploadErrorsModal = () => {
1411
1580
  const intl = reactIntl.useIntl();
1412
1581
  const _useImportResourcesCo = useImportResourcesContext(),
1413
1582
  state = _useImportResourcesCo.state,
1414
1583
  actions = _useImportResourcesCo.actions,
1415
1584
  onClose = _useImportResourcesCo.onClose;
1416
- const errorsCount = operations.getFileUploadErrorsCount(state.uploadFileResponse?.results);
1585
+ const isNewFlow = Boolean(state.jobId);
1586
+ const hasInvalidRecords = (state.uploadFileResponse?.invalid ?? 0) > 0;
1587
+ const isRowLevelErrors = hasInvalidRecords && (state.uploadFileResponse?.results?.length ?? 0) > 0;
1588
+ const isFileLevelErrors = state.fileUploadErrors.length > 0;
1589
+ const errorsCount = isNewFlow ? state.uploadFileResponse?.invalid ?? 0 : isRowLevelErrors ? operations.getFileUploadErrorsCount(state.uploadFileResponse?.results) : state.fileUploadErrors.length;
1417
1590
  const documentationLink = operations.RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
1418
1591
  return jsxRuntime.jsx(applicationComponents.InfoDialog, {
1419
1592
  size: 16,
1420
1593
  isOpen: true,
1421
1594
  title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
1422
- onClose: onClose,
1595
+ onClose: () => onClose(),
1423
1596
  children: jsxRuntime.jsx(fullstory.Masking.Unmask, {
1424
1597
  children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
1425
1598
  scale: "l",
@@ -1427,7 +1600,7 @@ const UploadRowErrorsModal = () => {
1427
1600
  scale: "xs",
1428
1601
  children: [jsxRuntime.jsx(fullstory.Masking.Mask, {
1429
1602
  children: jsxRuntime.jsx(uiKit.Text.Body, {
1430
- intlMessage: _objectSpread$5(_objectSpread$5({}, messages$3.uploadErrorDescription), {}, {
1603
+ intlMessage: _objectSpread$5(_objectSpread$5({}, messages$4.uploadErrorDescription), {}, {
1431
1604
  values: {
1432
1605
  fileName: state.droppedFile?.name,
1433
1606
  errorsCount: intl.formatNumber(errorsCount),
@@ -1435,8 +1608,8 @@ const UploadRowErrorsModal = () => {
1435
1608
  }
1436
1609
  })
1437
1610
  })
1438
- }), jsxRuntime.jsx(uiKit.Text.Body, {
1439
- intlMessage: _objectSpread$5(_objectSpread$5({}, messages$3.supportedValuesDocumentation), {}, {
1611
+ }), hasInvalidRecords && jsxRuntime.jsx(uiKit.Text.Body, {
1612
+ intlMessage: _objectSpread$5(_objectSpread$5({}, messages$4.supportedValuesDocumentation), {}, {
1440
1613
  values: {
1441
1614
  documentationLink: msg => jsxRuntime.jsx(uiKit.Link, {
1442
1615
  tone: "secondary",
@@ -1447,8 +1620,16 @@ const UploadRowErrorsModal = () => {
1447
1620
  }
1448
1621
  })
1449
1622
  })]
1450
- }), jsxRuntime.jsx(UploadRowErrorTable, {
1623
+ }), isNewFlow && hasInvalidRecords && state.containerKey && jsxRuntime.jsx(ServerPaginatedErrorTable, {
1624
+ jobId: state.jobId,
1625
+ containerKey: state.containerKey,
1626
+ totalInvalid: state.uploadFileResponse?.invalid ?? 0
1627
+ }), !isNewFlow && isRowLevelErrors && jsxRuntime.jsx(UploadErrorTable, {
1628
+ variant: "row-level",
1451
1629
  rows: operations.mapUploadFileErrorsResponseToUploadFileErrorRows(state.uploadFileResponse?.results)
1630
+ }), isFileLevelErrors && jsxRuntime.jsx(UploadErrorTable, {
1631
+ variant: "file-level",
1632
+ rows: operations.mapFileUploadErrorsToUploadFileErrorRows(state.fileUploadErrors)
1452
1633
  }), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
1453
1634
  scale: "m",
1454
1635
  justifyContent: "flex-end",
@@ -1457,7 +1638,7 @@ const UploadRowErrorsModal = () => {
1457
1638
  onClick: () => onClose()
1458
1639
  }), jsxRuntime.jsx(uiKit.PrimaryButton, {
1459
1640
  iconLeft: jsxRuntime.jsx(uiKit.ImportIcon, {}),
1460
- label: intl.formatMessage(messages$3.uploadNewFile),
1641
+ label: intl.formatMessage(messages$4.uploadNewFile),
1461
1642
  onClick: () => actions.uploadNewFile()
1462
1643
  })]
1463
1644
  })]
@@ -1473,7 +1654,7 @@ function getBold$2(msg) {
1473
1654
  }, crypto.randomUUID());
1474
1655
  }
1475
1656
 
1476
- var messages$2 = reactIntl.defineMessages({
1657
+ var messages$3 = reactIntl.defineMessages({
1477
1658
  startImportButton: {
1478
1659
  id: 'ImportResourcesModal.startImportButton',
1479
1660
  description: 'Label for the modal Start import button',
@@ -1575,7 +1756,7 @@ const ColumnList = props => {
1575
1756
  e.preventDefault();
1576
1757
  setIsExpanded(!isExpanded);
1577
1758
  },
1578
- children: isExpanded ? jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages$2.showLess)) : jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages$2.showMore))
1759
+ children: isExpanded ? jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages$3.showLess)) : jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages$3.showMore))
1579
1760
  })
1580
1761
  })]
1581
1762
  });
@@ -1595,13 +1776,13 @@ function UploadPreviewModal() {
1595
1776
  const resourceType = intl.formatMessage(resourceTypeMessage).toLowerCase();
1596
1777
  const resourceTypePluralMessage = resourceTypeToPluralMessage(state.resourceType);
1597
1778
  const resourceTypePlural = intl.formatMessage(resourceTypePluralMessage).toLowerCase();
1598
- const ignoredColumns = state.uploadFileResponse.ignoredColumns;
1599
- const validatedColumns = operations.getValidatedColumns(state.uploadFileResponse.columns, ignoredColumns);
1779
+ const ignoredFields = state.uploadFileResponse.ignoredFields;
1780
+ const validatedFields = operations.getValidatedColumns(state.uploadFileResponse.fields, ignoredFields);
1600
1781
  return jsxRuntime.jsx(applicationComponents.FormDialog, {
1601
1782
  size: 16,
1602
1783
  isOpen: true,
1603
1784
  title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
1604
- labelPrimary: intl.formatMessage(messages$2.continue),
1785
+ labelPrimary: intl.formatMessage(messages$3.continue),
1605
1786
  onSecondaryButtonClick: () => onClose({
1606
1787
  shouldDeleteImportContainer: true
1607
1788
  }),
@@ -1620,7 +1801,7 @@ function UploadPreviewModal() {
1620
1801
  children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
1621
1802
  scale: "m",
1622
1803
  children: [jsxRuntime.jsx("div", {}), jsxRuntime.jsx(uiKit.Text.Body, {
1623
- intlMessage: messages$2.previewOfYourImport
1804
+ intlMessage: messages$3.previewOfYourImport
1624
1805
  }), jsxRuntime.jsx(uiKit.Card, {
1625
1806
  insetScale: "xl",
1626
1807
  children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
@@ -1632,7 +1813,7 @@ function UploadPreviewModal() {
1632
1813
  children: [jsxRuntime.jsx(uiKit.CheckBoldIcon, {
1633
1814
  color: "success"
1634
1815
  }), jsxRuntime.jsx(uiKit.Text.Body, {
1635
- intlMessage: _objectSpread$3(_objectSpread$3({}, messages$2.itemsToBeImported), {}, {
1816
+ intlMessage: _objectSpread$3(_objectSpread$3({}, messages$3.itemsToBeImported), {}, {
1636
1817
  values: {
1637
1818
  resourceType,
1638
1819
  resourceTypePlural,
@@ -1647,19 +1828,19 @@ function UploadPreviewModal() {
1647
1828
  children: [jsxRuntime.jsx(uiKit.CheckBoldIcon, {
1648
1829
  color: "success"
1649
1830
  }), jsxRuntime.jsx(uiKit.Text.Body, {
1650
- intlMessage: _objectSpread$3(_objectSpread$3({}, messages$2.columnsToBeImported), {}, {
1831
+ intlMessage: _objectSpread$3(_objectSpread$3({}, messages$3.columnsToBeImported), {}, {
1651
1832
  values: {
1652
- columnCount: intl.formatNumber(validatedColumns.length),
1833
+ columnCount: intl.formatNumber(validatedFields.length),
1653
1834
  b: getBold$1
1654
1835
  }
1655
1836
  })
1656
1837
  })]
1657
1838
  })]
1658
1839
  }), jsxRuntime.jsx(ColumnList, {
1659
- columns: validatedColumns
1840
+ columns: validatedFields
1660
1841
  })]
1661
1842
  })
1662
- }), ignoredColumns.length > 0 && jsxRuntime.jsx(uiKit.Card, {
1843
+ }), ignoredFields.length > 0 && jsxRuntime.jsx(uiKit.Card, {
1663
1844
  insetScale: "xl",
1664
1845
  children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
1665
1846
  scale: "s",
@@ -1668,15 +1849,15 @@ function UploadPreviewModal() {
1668
1849
  children: [jsxRuntime.jsx(uiKit.EyeCrossedIcon, {
1669
1850
  color: "neutral60"
1670
1851
  }), jsxRuntime.jsx(uiKit.Text.Body, {
1671
- intlMessage: _objectSpread$3(_objectSpread$3({}, messages$2.columnsToBeIgnored), {}, {
1852
+ intlMessage: _objectSpread$3(_objectSpread$3({}, messages$3.columnsToBeIgnored), {}, {
1672
1853
  values: {
1673
- columnCount: intl.formatNumber(ignoredColumns.length),
1854
+ columnCount: intl.formatNumber(ignoredFields.length),
1674
1855
  b: getBold$1
1675
1856
  }
1676
1857
  })
1677
1858
  })]
1678
1859
  }), jsxRuntime.jsx(ColumnList, {
1679
- columns: ignoredColumns
1860
+ columns: ignoredFields
1680
1861
  })]
1681
1862
  })
1682
1863
  })]
@@ -1709,7 +1890,7 @@ var _ref2 = {
1709
1890
  const ImportRunningTextNotification = props => jsxRuntime.jsx("div", {
1710
1891
  css: _ref2,
1711
1892
  children: jsxRuntime.jsx(uiKit.Text.Body, {
1712
- intlMessage: _objectSpread$2(_objectSpread$2({}, messages$2.importNotificationSuccessMessage), {}, {
1893
+ intlMessage: _objectSpread$2(_objectSpread$2({}, messages$3.importNotificationSuccessMessage), {}, {
1713
1894
  values: {
1714
1895
  newline: getNewLine,
1715
1896
  logsLink: msg => getImportLogsLink(msg, props.projectKey),
@@ -1725,7 +1906,7 @@ var _ref = {
1725
1906
  const ImportPreparingTextNotification = props => jsxRuntime.jsx("div", {
1726
1907
  css: _ref,
1727
1908
  children: jsxRuntime.jsx(uiKit.Text.Body, {
1728
- intlMessage: _objectSpread$2(_objectSpread$2({}, messages$2.importNotificationPrepareMessage), {}, {
1909
+ intlMessage: _objectSpread$2(_objectSpread$2({}, messages$3.importNotificationPrepareMessage), {}, {
1729
1910
  values: {
1730
1911
  newline: getNewLine,
1731
1912
  logsLink: msg => getImportLogsLink(msg, props.projectKey),
@@ -1749,7 +1930,7 @@ const ImportConfirmationModal = () => {
1749
1930
  const showNotification = actionsGlobal.useShowNotification();
1750
1931
  return jsxRuntime.jsx(applicationComponents.ConfirmationDialog, {
1751
1932
  title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
1752
- labelPrimary: intl.formatMessage(messages$2.startImportButton),
1933
+ labelPrimary: intl.formatMessage(messages$3.startImportButton),
1753
1934
  isOpen: true,
1754
1935
  onClose: () => onClose({
1755
1936
  shouldDeleteImportContainer: true
@@ -1779,11 +1960,21 @@ const ImportConfirmationModal = () => {
1779
1960
  }, {
1780
1961
  dismissAfter: 5000
1781
1962
  });
1782
- await operations.processUploadedFile({
1783
- projectKey,
1784
- importContainerKey: state.containerKey,
1785
- resourceType: state.resourceType
1786
- });
1963
+ const isJobBasedFlow = !!state.jobId;
1964
+ if (isJobBasedFlow) {
1965
+ await operations.processFileImportJob({
1966
+ projectKey,
1967
+ resourceType: state.resourceType,
1968
+ importContainerKey: state.containerKey,
1969
+ jobId: state.jobId
1970
+ });
1971
+ } else {
1972
+ await operations.processUploadedFile({
1973
+ projectKey,
1974
+ importContainerKey: state.containerKey,
1975
+ resourceType: state.resourceType
1976
+ });
1977
+ }
1787
1978
  onStartImportSuccess();
1788
1979
  showNotification({
1789
1980
  kind: 'info',
@@ -1812,7 +2003,7 @@ const ImportConfirmationModal = () => {
1812
2003
  scale: "xl",
1813
2004
  children: [jsxRuntime.jsxs("div", {
1814
2005
  children: [jsxRuntime.jsx(uiKit.Text.Body, {
1815
- intlMessage: _objectSpread$2(_objectSpread$2({}, messages$2.confirmationBodyText), {}, {
2006
+ intlMessage: _objectSpread$2(_objectSpread$2({}, messages$3.confirmationBodyText), {}, {
1816
2007
  values: {
1817
2008
  projectName: projectName,
1818
2009
  count: intl.formatNumber(state?.uploadFileResponse?.rowsCount || 0),
@@ -1820,10 +2011,10 @@ const ImportConfirmationModal = () => {
1820
2011
  }
1821
2012
  })
1822
2013
  }), jsxRuntime.jsx(uiKit.Text.Body, {
1823
- intlMessage: messages$2.confirmationBodyNote
2014
+ intlMessage: messages$3.confirmationBodyNote
1824
2015
  })]
1825
2016
  }), jsxRuntime.jsx(uiKit.Text.Body, {
1826
- intlMessage: messages$2.confirmationBodyQuestion
2017
+ intlMessage: messages$3.confirmationBodyQuestion
1827
2018
  })]
1828
2019
  })
1829
2020
  })
@@ -1840,11 +2031,21 @@ function getBold(msg) {
1840
2031
  const UploadResult = () => {
1841
2032
  const _useImportResourcesCo = useImportResourcesContext(),
1842
2033
  state = _useImportResourcesCo.state;
1843
- if (state.fileUploadErrors.length > 0) return jsxRuntime.jsx(UploadErrorsModal, {});
1844
- if (state.uploadFileResponse?.invalid > 0) return jsxRuntime.jsx(UploadRowErrorsModal, {});
2034
+ const hasFileLevelErrors = state.fileUploadErrors.length > 0;
2035
+ const hasRowLevelErrors = (state.uploadFileResponse?.invalid ?? 0) > 0;
2036
+ if (hasFileLevelErrors || hasRowLevelErrors) {
2037
+ return jsxRuntime.jsx(UploadErrorsModal, {});
2038
+ }
1845
2039
  return jsxRuntime.jsx(UploadPreviewModal, {});
1846
2040
  };
1847
2041
 
2042
+ var messages$2 = reactIntl.defineMessages({
2043
+ validatingResources: {
2044
+ id: 'ImportResourcesModal.Uploading.validatingResources',
2045
+ defaultMessage: 'Validating {processed} / {total} {resourceType}'
2046
+ }
2047
+ });
2048
+
1848
2049
  const Uploading = () => {
1849
2050
  const intl = reactIntl.useIntl();
1850
2051
  const _useImportResourcesCo = useImportResourcesContext(),
@@ -1852,6 +2053,12 @@ const Uploading = () => {
1852
2053
  actions = _useImportResourcesCo.actions,
1853
2054
  onClose = _useImportResourcesCo.onClose;
1854
2055
  if (!state.droppedFile?.name) return null;
2056
+ const showValidationProgress = state.isValidating && state.validationProcessed && state.validationProcessed > 0 && state.totalResourceCount && state.resourceType;
2057
+ const statusMessage = showValidationProgress ? intl.formatMessage(messages$2.validatingResources, {
2058
+ processed: intl.formatNumber(state.validationProcessed),
2059
+ total: intl.formatNumber(state.totalResourceCount),
2060
+ resourceType: intl.formatMessage(resourceTypeToPluralMessage(state.resourceType))
2061
+ }) : undefined;
1855
2062
  return jsxRuntime.jsx(operations.UploadingModal, {
1856
2063
  isOpen: true,
1857
2064
  title: intl.formatMessage(sharedMessages[`modalTitle.${state.resourceType}`]),
@@ -1865,7 +2072,8 @@ const Uploading = () => {
1865
2072
  },
1866
2073
  onClose: () => onClose({
1867
2074
  shouldDeleteImportContainer: true
1868
- })
2075
+ }),
2076
+ statusMessage: statusMessage
1869
2077
  });
1870
2078
  };
1871
2079
 
@@ -1908,7 +2116,7 @@ const resourceTypeToDisplayName = resourceType => {
1908
2116
  case IMPORTABLE_RESOURCES.CATEGORY:
1909
2117
  return messages$1.categories;
1910
2118
  default:
1911
- throw new Error(`Unknown resource type: ${resourceType}`);
2119
+ throw new operations.UnexpectedResourceTypeError(resourceType);
1912
2120
  }
1913
2121
  };
1914
2122
  const ResourceTypeSelection = () => {
@@ -1948,13 +2156,16 @@ const Instructions = () => {
1948
2156
  const intl = reactIntl.useIntl();
1949
2157
  const _useImportResourcesCo = useImportResourcesContext(),
1950
2158
  state = _useImportResourcesCo.state;
2159
+ const isFileImportJobFlowEnabled = applicationShell.useFeatureToggle(FILE_IMPORT_JOB_FLOW);
1951
2160
  const templateLink = operations.RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS[state.resourceType];
1952
2161
  const documentationLink = operations.RESOURCE_TYPE_DOCUMENTATION_LINKS[state.resourceType];
2162
+ const maxFileSize = isFileImportJobFlowEnabled ? operations.IMPORT_MAX_FILE_SIZE_MB : operations.IMPORT_LEGACY_MAX_FILE_SIZE_MB;
2163
+ const maxItemCount = isFileImportJobFlowEnabled ? operations.IMPORT_MAX_ITEM_COUNT : operations.IMPORT_LEGACY_MAX_ROW_COUNT;
1953
2164
  return jsxRuntime.jsx(uiKit.Text.Body, {
1954
2165
  intlMessage: _objectSpread$1(_objectSpread$1({}, messages.fileUploadInstructions), {}, {
1955
2166
  values: {
1956
- fileSize: intl.formatNumber(operations.MAX_FILE_SIZE_MB),
1957
- rowLimit: intl.formatNumber(operations.MAX_ROW_COUNT),
2167
+ fileSize: intl.formatNumber(maxFileSize),
2168
+ rowLimit: intl.formatNumber(maxItemCount),
1958
2169
  csvTemplateLink: msg => jsxRuntime.jsx(uiKit.Link, {
1959
2170
  tone: "secondary",
1960
2171
  isExternal: true,