@commercetools-frontend-extensions/import-resources-modal 1.3.18 → 1.4.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.
- package/dist/{active-drag-drop-area-2070870c.esm.js → active-drag-drop-area-02862be1.esm.js} +2 -1
- package/dist/{active-drag-drop-area-7223062d.cjs.prod.js → active-drag-drop-area-3353cf7c.cjs.prod.js} +2 -1
- package/dist/{active-drag-drop-area-71b18c95.cjs.dev.js → active-drag-drop-area-9097bdc0.cjs.dev.js} +2 -1
- package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.dev.js +9 -7
- package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.prod.js +8 -6
- package/dist/commercetools-frontend-extensions-import-resources-modal.esm.js +8 -7
- package/dist/de-22a8eb66.cjs.prod.js +246 -0
- package/dist/de-3d74f145.esm.js +244 -0
- package/dist/de-fd3b70e4.cjs.dev.js +246 -0
- package/dist/declarations/src/@hooks/index.d.ts +3 -0
- package/dist/declarations/src/@hooks/use-import-permission.d.ts +7 -0
- package/dist/declarations/src/@hooks/use-import-resources-context.d.ts +1 -0
- package/dist/declarations/src/@hooks/use-upload.d.ts +3 -0
- package/dist/declarations/src/@types/import-container.d.ts +14 -0
- package/dist/declarations/src/index.d.ts +1 -0
- package/dist/en-0b96b221.cjs.dev.js +246 -0
- package/dist/en-8d84a827.cjs.prod.js +246 -0
- package/dist/en-bfc8cfec.esm.js +244 -0
- package/dist/{enabled-drop-area-f7df6932.cjs.prod.js → enabled-drop-area-71390280.cjs.prod.js} +2 -1
- package/dist/{enabled-drop-area-30f931be.esm.js → enabled-drop-area-cecad6d0.esm.js} +2 -1
- package/dist/{enabled-drop-area-b0e2ad4d.cjs.dev.js → enabled-drop-area-dff17a22.cjs.dev.js} +2 -1
- package/dist/{es-9821e666.cjs.prod.js → es-01b24cea.cjs.prod.js} +9 -9
- package/dist/{es-c6b4310c.esm.js → es-561e774f.esm.js} +9 -9
- package/dist/{es-c3c63de8.cjs.dev.js → es-a45120de.cjs.dev.js} +9 -9
- package/dist/{file-dropped-area-a1b8bc83.cjs.dev.js → file-dropped-area-30e0efb8.cjs.prod.js} +10 -9
- package/dist/{file-dropped-area-0856e6fe.esm.js → file-dropped-area-70859cc8.esm.js} +10 -9
- package/dist/{file-dropped-area-b394c5b4.cjs.prod.js → file-dropped-area-85c3b3a4.cjs.dev.js} +10 -9
- package/dist/fr-FR-1c33adf1.esm.js +244 -0
- package/dist/fr-FR-2a0f5518.cjs.prod.js +246 -0
- package/dist/fr-FR-d51f6a8e.cjs.dev.js +246 -0
- package/dist/{index-fb10311d.cjs.dev.js → index-120dc76b.cjs.dev.js} +262 -129
- package/dist/{index-ed334c08.cjs.prod.js → index-169848a9.cjs.prod.js} +247 -128
- package/dist/{index-bbcef105.esm.js → index-fd6bbcc5.esm.js} +263 -131
- package/dist/pt-BR-6b7a389e.cjs.prod.js +246 -0
- package/dist/pt-BR-8b999c2f.cjs.dev.js +246 -0
- package/dist/pt-BR-c09d735f.esm.js +244 -0
- package/package.json +25 -23
- package/dist/de-a34c5dd4.cjs.dev.js +0 -6
- package/dist/de-cd6c45d3.esm.js +0 -4
- package/dist/de-d954fe3d.cjs.prod.js +0 -6
- package/dist/en-3a9aa2d4.esm.js +0 -4
- package/dist/en-6b3694f6.cjs.dev.js +0 -6
- package/dist/en-c7757448.cjs.prod.js +0 -6
- package/dist/fr-FR-9d9081ee.esm.js +0 -4
- package/dist/fr-FR-e7126fcc.cjs.dev.js +0 -6
- package/dist/fr-FR-fce1ca96.cjs.prod.js +0 -6
- package/dist/pt-BR-b37d730b.esm.js +0 -4
- package/dist/pt-BR-ea6b3251.cjs.dev.js +0 -6
- package/dist/pt-BR-ec2a1a11.cjs.prod.js +0 -6
|
@@ -48,6 +48,7 @@ var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
|
48
48
|
var _styled = require('@emotion/styled/base');
|
|
49
49
|
var react = require('@emotion/react');
|
|
50
50
|
var sentry = require('@commercetools-frontend/sentry');
|
|
51
|
+
var permissions = require('@commercetools-frontend/permissions');
|
|
51
52
|
var DataTable = require('@commercetools-uikit/data-table');
|
|
52
53
|
var i18n = require('@commercetools-frontend/i18n');
|
|
53
54
|
|
|
@@ -78,23 +79,26 @@ var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceP
|
|
|
78
79
|
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
79
80
|
var DataTable__default = /*#__PURE__*/_interopDefault(DataTable);
|
|
80
81
|
|
|
81
|
-
function ownKeys$
|
|
82
|
-
function _objectSpread$
|
|
82
|
+
function ownKeys$i(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; }
|
|
83
|
+
function _objectSpread$i(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$i(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$i(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
84
|
+
// TODO: make this resource type specific
|
|
85
|
+
|
|
83
86
|
function reducer(state, action) {
|
|
84
|
-
if (action.type === 'setCurrentStep') return _objectSpread$
|
|
87
|
+
if (action.type === 'setCurrentStep') return _objectSpread$i(_objectSpread$i({}, state), {}, {
|
|
85
88
|
currentStep: action.currentStep,
|
|
86
89
|
progress: 0
|
|
87
90
|
});
|
|
88
|
-
if (action.type === 'setUploadFileResponse') return _objectSpread$
|
|
91
|
+
if (action.type === 'setUploadFileResponse') return _objectSpread$i(_objectSpread$i({}, state), {}, {
|
|
89
92
|
uploadFileResponse: action.uploadFileResponse
|
|
90
93
|
});
|
|
91
|
-
if (action.type === 'setResourceType') return _objectSpread$
|
|
94
|
+
if (action.type === 'setResourceType') return _objectSpread$i(_objectSpread$i({}, state), {}, {
|
|
95
|
+
settings: undefined,
|
|
92
96
|
resourceType: action.resourceType
|
|
93
97
|
});
|
|
94
|
-
if (action.type === 'setContainerKey') return _objectSpread$
|
|
98
|
+
if (action.type === 'setContainerKey') return _objectSpread$i(_objectSpread$i({}, state), {}, {
|
|
95
99
|
containerKey: action.containerKey
|
|
96
100
|
});
|
|
97
|
-
if (action.type === 'cancelImport') return _objectSpread$
|
|
101
|
+
if (action.type === 'cancelImport') return _objectSpread$i(_objectSpread$i({}, state), {}, {
|
|
98
102
|
currentStep: 1,
|
|
99
103
|
containerKey: undefined,
|
|
100
104
|
fileUploadErrors: [],
|
|
@@ -103,7 +107,7 @@ function reducer(state, action) {
|
|
|
103
107
|
dropAreaState: 'disabled',
|
|
104
108
|
progress: 0
|
|
105
109
|
});
|
|
106
|
-
if (action.type === 'uploadNewFile') return _objectSpread$
|
|
110
|
+
if (action.type === 'uploadNewFile') return _objectSpread$i(_objectSpread$i({}, state), {}, {
|
|
107
111
|
currentStep: 1,
|
|
108
112
|
containerKey: undefined,
|
|
109
113
|
fileUploadErrors: [],
|
|
@@ -113,25 +117,30 @@ function reducer(state, action) {
|
|
|
113
117
|
progress: 0
|
|
114
118
|
});
|
|
115
119
|
if (action.type === 'setDroppedFile') {
|
|
116
|
-
return _objectSpread$
|
|
120
|
+
return _objectSpread$i(_objectSpread$i({}, state), {}, {
|
|
117
121
|
droppedFile: action.droppedFile
|
|
118
122
|
});
|
|
119
123
|
}
|
|
120
124
|
if (action.type === 'setFileUploadErrors') {
|
|
121
|
-
return _objectSpread$
|
|
125
|
+
return _objectSpread$i(_objectSpread$i({}, state), {}, {
|
|
122
126
|
fileUploadErrors: action.fileUploadErrors
|
|
123
127
|
});
|
|
124
128
|
}
|
|
125
129
|
if (action.type === 'setAbortController') {
|
|
126
|
-
return _objectSpread$
|
|
130
|
+
return _objectSpread$i(_objectSpread$i({}, state), {}, {
|
|
127
131
|
abortController: action.abortController
|
|
128
132
|
});
|
|
129
133
|
}
|
|
130
134
|
if (action.type === 'setProgress') {
|
|
131
|
-
return _objectSpread$
|
|
135
|
+
return _objectSpread$i(_objectSpread$i({}, state), {}, {
|
|
132
136
|
progress: action.progress
|
|
133
137
|
});
|
|
134
138
|
}
|
|
139
|
+
if (action.type === 'setUploadSettings') {
|
|
140
|
+
return _objectSpread$i(_objectSpread$i({}, state), {}, {
|
|
141
|
+
settings: _objectSpread$i(_objectSpread$i({}, state.settings), action.settings)
|
|
142
|
+
});
|
|
143
|
+
}
|
|
135
144
|
throw new Error(getUnknownActionError(action));
|
|
136
145
|
}
|
|
137
146
|
function getUnknownActionError(actionType) {
|
|
@@ -194,8 +203,8 @@ let HttpError = /*#__PURE__*/function (_Error) {
|
|
|
194
203
|
return _createClass(HttpError);
|
|
195
204
|
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
196
205
|
|
|
197
|
-
function ownKeys$
|
|
198
|
-
function _objectSpread$
|
|
206
|
+
function ownKeys$h(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; }
|
|
207
|
+
function _objectSpread$h(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$h(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$h(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
199
208
|
const addProxyPrefixToUrl = (uri, proxy) => {
|
|
200
209
|
return proxy ? `/proxy/${proxy}${uri}` : uri;
|
|
201
210
|
};
|
|
@@ -207,7 +216,7 @@ const fetchUsingXhr = _ref2 => {
|
|
|
207
216
|
onSuccess = _ref2.onSuccess,
|
|
208
217
|
onError = _ref2.onError;
|
|
209
218
|
const options = applicationShell.createHttpClientOptions({
|
|
210
|
-
headers: _objectSpread$
|
|
219
|
+
headers: _objectSpread$h({
|
|
211
220
|
'Content-Type': 'application/json'
|
|
212
221
|
}, config?.headers)
|
|
213
222
|
});
|
|
@@ -310,8 +319,39 @@ const RESOURCE_TYPE_DOCUMENTATION_LINKS = {
|
|
|
310
319
|
|
|
311
320
|
const CT__API_DOCS_URL = 'https://docs.commercetools.com/api/';
|
|
312
321
|
|
|
313
|
-
|
|
314
|
-
|
|
322
|
+
const PERMISSIONS = {
|
|
323
|
+
// Categories
|
|
324
|
+
ManageCategories: 'ManageCategories',
|
|
325
|
+
ViewCategories: 'ViewCategories',
|
|
326
|
+
// Products
|
|
327
|
+
ManageProducts: 'ManageProducts',
|
|
328
|
+
ViewProducts: 'ViewProducts',
|
|
329
|
+
// ProductTypes
|
|
330
|
+
ManageProductTypes: 'ManageProductTypes',
|
|
331
|
+
ViewProductTypes: 'ViewProductTypes',
|
|
332
|
+
// DiscountCodes
|
|
333
|
+
ManageDiscountCodes: 'ManageDiscountCodes',
|
|
334
|
+
ViewDiscountCodes: 'ViewDiscountCodes'
|
|
335
|
+
};
|
|
336
|
+
const ACTION_RIGHTS = {
|
|
337
|
+
PublishProducts: {
|
|
338
|
+
group: 'products',
|
|
339
|
+
name: 'PublishProducts'
|
|
340
|
+
},
|
|
341
|
+
UnpublishProducts: {
|
|
342
|
+
group: 'products',
|
|
343
|
+
name: 'UnpublishProducts'
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
function ownKeys$g(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; }
|
|
348
|
+
function _objectSpread$g(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$g(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$g(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
349
|
+
const DEFAULT_SHORT_LIVED_FLAGS = {};
|
|
350
|
+
const DEFAULT_LONG_LIVED_FLAGS = {};
|
|
351
|
+
_objectSpread$g(_objectSpread$g({}, DEFAULT_SHORT_LIVED_FLAGS), DEFAULT_LONG_LIVED_FLAGS);
|
|
352
|
+
|
|
353
|
+
function ownKeys$f(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; }
|
|
354
|
+
function _objectSpread$f(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$f(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$f(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
315
355
|
/**
|
|
316
356
|
* This function checks if the provided `expectedDelimiter` is used consistently in the first 10 lines of a CSV file.
|
|
317
357
|
* Returns a Promise that resolves to an object containing a boolean `isValid` property and the detected delimiter `delimiter`.
|
|
@@ -366,7 +406,7 @@ const mapUploadFileErrorsResponseToUploadFileErrorRows = uploadFileErrorsRespons
|
|
|
366
406
|
};
|
|
367
407
|
const mapFileUploadErrorsToUploadFileErrorRows = uploadFileErrors => {
|
|
368
408
|
let idCounter = 1;
|
|
369
|
-
return _mapInstanceProperty__default["default"](uploadFileErrors).call(uploadFileErrors, uploadFileError => _objectSpread$
|
|
409
|
+
return _mapInstanceProperty__default["default"](uploadFileErrors).call(uploadFileErrors, uploadFileError => _objectSpread$f(_objectSpread$f({}, uploadFileError), {}, {
|
|
370
410
|
id: String(idCounter++)
|
|
371
411
|
}));
|
|
372
412
|
};
|
|
@@ -511,8 +551,6 @@ function uploadFileForImport(_ref) {
|
|
|
511
551
|
});
|
|
512
552
|
}
|
|
513
553
|
|
|
514
|
-
function ownKeys$d(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; }
|
|
515
|
-
function _objectSpread$d(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$d(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$d(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
516
554
|
function createImportContainerForFileUpload(importContainerDraft, projectKey, asyncDispatch) {
|
|
517
555
|
return asyncDispatch(sdk.actions.post({
|
|
518
556
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.IMPORT,
|
|
@@ -521,9 +559,7 @@ function createImportContainerForFileUpload(importContainerDraft, projectKey, as
|
|
|
521
559
|
accept: 'application/json',
|
|
522
560
|
'Content-Type': 'application/json'
|
|
523
561
|
},
|
|
524
|
-
payload: _JSON$stringify__default["default"](
|
|
525
|
-
tags: [TAG_KEY_SOURCE_FILE_UPLOAD]
|
|
526
|
-
}))
|
|
562
|
+
payload: _JSON$stringify__default["default"](importContainerDraft)
|
|
527
563
|
}));
|
|
528
564
|
}
|
|
529
565
|
function deleteImportContainer(projectKey, containerKey, asyncDispatch) {
|
|
@@ -560,8 +596,8 @@ function assertProcessFileResponse(maybeProcessFileResponse) {
|
|
|
560
596
|
throw new Error('Invalid response');
|
|
561
597
|
}
|
|
562
598
|
|
|
563
|
-
function ownKeys$
|
|
564
|
-
function _objectSpread$
|
|
599
|
+
function ownKeys$e(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; }
|
|
600
|
+
function _objectSpread$e(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$e(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$e(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
565
601
|
const ImportResourcesContext = /*#__PURE__*/React__default["default"].createContext();
|
|
566
602
|
const ImportResourcesProvider = props => {
|
|
567
603
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
@@ -569,7 +605,7 @@ const ImportResourcesProvider = props => {
|
|
|
569
605
|
})),
|
|
570
606
|
projectKey = _useApplicationContex.projectKey;
|
|
571
607
|
const asyncDispatch = sdk.useAsyncDispatch();
|
|
572
|
-
const _React$useReducer = React__default["default"].useReducer(reducer, _objectSpread$
|
|
608
|
+
const _React$useReducer = React__default["default"].useReducer(reducer, _objectSpread$e(_objectSpread$e({}, initialState), {}, {
|
|
573
609
|
resourceType: props.resourceTypes[0]
|
|
574
610
|
})),
|
|
575
611
|
_React$useReducer2 = _slicedToArray(_React$useReducer, 2),
|
|
@@ -613,6 +649,12 @@ const ImportResourcesProvider = props => {
|
|
|
613
649
|
type: 'setProgress',
|
|
614
650
|
progress
|
|
615
651
|
});
|
|
652
|
+
const setUploadSettings = nextSettings => {
|
|
653
|
+
dispatch({
|
|
654
|
+
type: 'setUploadSettings',
|
|
655
|
+
settings: nextSettings
|
|
656
|
+
});
|
|
657
|
+
};
|
|
616
658
|
const handleClose = function () {
|
|
617
659
|
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
618
660
|
shouldDeleteImportContainer = _ref.shouldDeleteImportContainer;
|
|
@@ -640,7 +682,8 @@ const ImportResourcesProvider = props => {
|
|
|
640
682
|
setContainerKey,
|
|
641
683
|
setAbortController,
|
|
642
684
|
setFileUploadErrors,
|
|
643
|
-
setProgress
|
|
685
|
+
setProgress,
|
|
686
|
+
setUploadSettings
|
|
644
687
|
}
|
|
645
688
|
},
|
|
646
689
|
children: props.children
|
|
@@ -699,13 +742,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
699
742
|
return /*#__PURE__*/react.css("" , "" );
|
|
700
743
|
}
|
|
701
744
|
|
|
702
|
-
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-
|
|
745
|
+
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-3353cf7c.cjs.prod.js' /* webpackChunkName: "active-drag-drop-area" */); }));
|
|
703
746
|
|
|
704
747
|
var DisabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./disabled-drop-area-99c1fa0b.cjs.prod.js' /* webpackChunkName: "disabled-drop-area" */); }));
|
|
705
748
|
|
|
706
|
-
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-
|
|
749
|
+
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-71390280.cjs.prod.js' /* webpackChunkName: "enabled-drop-area" */); }));
|
|
707
750
|
|
|
708
|
-
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-
|
|
751
|
+
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-30e0efb8.cjs.prod.js' /* webpackChunkName: "filed-dropped-area" */); }));
|
|
709
752
|
|
|
710
753
|
function getDropArea(_ref) {
|
|
711
754
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -743,7 +786,7 @@ function getDropAreaState(flags) {
|
|
|
743
786
|
return 'ready-for-drop';
|
|
744
787
|
}
|
|
745
788
|
|
|
746
|
-
var messages$
|
|
789
|
+
var messages$7 = reactIntl.defineMessages({
|
|
747
790
|
dragAndDropCSV: {
|
|
748
791
|
id: 'ImportResourcesModal.dragAndDropCSV',
|
|
749
792
|
description: 'The message telling the user to drag and drop CSV file in the file drop area',
|
|
@@ -808,7 +851,7 @@ function useImportResourcesContext() {
|
|
|
808
851
|
return context;
|
|
809
852
|
}
|
|
810
853
|
|
|
811
|
-
var messages$
|
|
854
|
+
var messages$6 = reactIntl.defineMessages({
|
|
812
855
|
fileSizeExceededTitle: {
|
|
813
856
|
id: 'ImportResourcesModal.sizeExceededTitle',
|
|
814
857
|
defaultMessage: 'File size exceeded'
|
|
@@ -868,6 +911,8 @@ var messages$5 = reactIntl.defineMessages({
|
|
|
868
911
|
}
|
|
869
912
|
});
|
|
870
913
|
|
|
914
|
+
function ownKeys$d(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; }
|
|
915
|
+
function _objectSpread$d(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$d(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$d(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
871
916
|
const useUpload = () => {
|
|
872
917
|
const intl = reactIntl.useIntl();
|
|
873
918
|
const projectKey = applicationShellConnectors.useApplicationContext(context => context.project?.key);
|
|
@@ -885,23 +930,23 @@ const useUpload = () => {
|
|
|
885
930
|
const errors = [];
|
|
886
931
|
const delimiterCheck = await checkDelimiter(file);
|
|
887
932
|
if (!delimiterCheck.isValid) errors.push({
|
|
888
|
-
title: intl.formatMessage(messages$
|
|
889
|
-
description: intl.formatMessage(messages$
|
|
933
|
+
title: intl.formatMessage(messages$6.dropAreaWrongDelimiterTitle),
|
|
934
|
+
description: intl.formatMessage(messages$6.dropAreaWrongDelimiterDescription)
|
|
890
935
|
});
|
|
891
936
|
const rowCount = await getRowCount(file);
|
|
892
937
|
if (rowCount < 1) errors.push({
|
|
893
|
-
title: intl.formatMessage(messages$
|
|
894
|
-
description: intl.formatMessage(messages$
|
|
938
|
+
title: intl.formatMessage(messages$6.dropAreaNotEnoughRowsTitle),
|
|
939
|
+
description: intl.formatMessage(messages$6.dropAreaNotEnoughRowsDescription)
|
|
895
940
|
});
|
|
896
941
|
if (state.resourceType && file.size > toBytes(FILE_SIZE_LIMITS_MB[state.resourceType])) errors.push({
|
|
897
|
-
title: intl.formatMessage(messages$
|
|
898
|
-
description: intl.formatMessage(messages$
|
|
942
|
+
title: intl.formatMessage(messages$6.fileSizeExceededTitle),
|
|
943
|
+
description: intl.formatMessage(messages$6.fileSizeExceededDescription, {
|
|
899
944
|
fileSizeLimit: intl.formatNumber(FILE_SIZE_LIMITS_MB[state.resourceType])
|
|
900
945
|
})
|
|
901
946
|
});
|
|
902
947
|
if (state.resourceType && rowCount > ROW_LIMITS[state.resourceType]) errors.push({
|
|
903
|
-
title: intl.formatMessage(messages$
|
|
904
|
-
description: intl.formatMessage(messages$
|
|
948
|
+
title: intl.formatMessage(messages$6.rowLimitExceededTitle),
|
|
949
|
+
description: intl.formatMessage(messages$6.rowLimitExceededDescription, {
|
|
905
950
|
rowLimit: intl.formatNumber(ROW_LIMITS[state.resourceType])
|
|
906
951
|
})
|
|
907
952
|
});
|
|
@@ -920,16 +965,16 @@ const useUpload = () => {
|
|
|
920
965
|
if (error instanceof HttpError) {
|
|
921
966
|
if (error.errorData?.code === 'MISSING_KEY_ERROR') {
|
|
922
967
|
actions.setFileUploadErrors([{
|
|
923
|
-
title: intl.formatMessage(messages$
|
|
924
|
-
description: intl.formatMessage(messages$
|
|
968
|
+
title: intl.formatMessage(messages$6.missingRequiredField),
|
|
969
|
+
description: intl.formatMessage(messages$6.missingKeyError)
|
|
925
970
|
}]);
|
|
926
971
|
actions.setCurrentStep(3);
|
|
927
972
|
} else if (error.errorData?.code === 'MissingCsvFieldIdentifier') {
|
|
928
973
|
const MissingCsvFieldIdentifierError = error.errorData;
|
|
929
974
|
const fieldNames = formatKeys(MissingCsvFieldIdentifierError.rowValue);
|
|
930
975
|
actions.setFileUploadErrors([{
|
|
931
|
-
title: intl.formatMessage(messages$
|
|
932
|
-
description: intl.formatMessage(messages$
|
|
976
|
+
title: intl.formatMessage(messages$6.missingRequiredField),
|
|
977
|
+
description: intl.formatMessage(messages$6.missingRequiredKeys, {
|
|
933
978
|
fieldNames
|
|
934
979
|
})
|
|
935
980
|
}]);
|
|
@@ -942,7 +987,7 @@ const useUpload = () => {
|
|
|
942
987
|
showNotification({
|
|
943
988
|
kind: 'error',
|
|
944
989
|
domain: constants.DOMAINS.PAGE,
|
|
945
|
-
text: intl.formatMessage(messages$
|
|
990
|
+
text: intl.formatMessage(messages$6.unexpectedError)
|
|
946
991
|
});
|
|
947
992
|
}
|
|
948
993
|
} else {
|
|
@@ -971,10 +1016,21 @@ const useUpload = () => {
|
|
|
971
1016
|
const containerKey = encodeFileNameWithTimestampToContainerKey(state.droppedFile.name);
|
|
972
1017
|
actions.setContainerKey(containerKey);
|
|
973
1018
|
try {
|
|
974
|
-
|
|
1019
|
+
// TODO: Temporarily apply settings only for products
|
|
1020
|
+
const shouldApplySettings = state.resourceType === 'product';
|
|
1021
|
+
await createImportContainerForFileUpload(_objectSpread$d({
|
|
975
1022
|
key: containerKey,
|
|
976
|
-
resourceType: state.resourceType
|
|
977
|
-
|
|
1023
|
+
resourceType: state.resourceType,
|
|
1024
|
+
tags: [TAG_KEY_SOURCE_FILE_UPLOAD]
|
|
1025
|
+
}, shouldApplySettings ? {
|
|
1026
|
+
settings: {
|
|
1027
|
+
resourceType: state.resourceType === 'product' ? 'product-draft' : state.resourceType,
|
|
1028
|
+
format: 'CSV',
|
|
1029
|
+
options: {
|
|
1030
|
+
publishAllChanges: state.settings?.publish ?? false
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
} : {}), projectKey, asyncDispatch);
|
|
978
1034
|
const newAbortController = uploadFileForImport({
|
|
979
1035
|
projectKey,
|
|
980
1036
|
containerKey,
|
|
@@ -1004,8 +1060,39 @@ const useUpload = () => {
|
|
|
1004
1060
|
};
|
|
1005
1061
|
};
|
|
1006
1062
|
|
|
1007
|
-
|
|
1008
|
-
|
|
1063
|
+
const useImportPermission = () => {
|
|
1064
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
1065
|
+
actionRights: applicationContext.actionRights?.products
|
|
1066
|
+
})),
|
|
1067
|
+
actionRights = _useApplicationContex.actionRights;
|
|
1068
|
+
const canManageProducts = permissions.useIsAuthorized({
|
|
1069
|
+
demandedPermissions: [PERMISSIONS.ManageProducts]
|
|
1070
|
+
});
|
|
1071
|
+
const canImportCategories = permissions.useIsAuthorized({
|
|
1072
|
+
demandedPermissions: [PERMISSIONS.ManageCategories]
|
|
1073
|
+
});
|
|
1074
|
+
const canImportDiscountCodes = permissions.useIsAuthorized({
|
|
1075
|
+
demandedPermissions: [PERMISSIONS.ManageDiscountCodes]
|
|
1076
|
+
});
|
|
1077
|
+
const canImportProducts = React.useMemo(() => {
|
|
1078
|
+
if (!actionRights) return false;
|
|
1079
|
+
const canAddPrices = actionRights.canAddPrices,
|
|
1080
|
+
canAddProducts = actionRights.canAddProducts,
|
|
1081
|
+
canEditAttributesAll = actionRights['canEditAttributes:all'],
|
|
1082
|
+
canEditPrices = actionRights.canEditPrices;
|
|
1083
|
+
return canManageProducts && canAddPrices && canAddProducts && canEditAttributesAll && canEditPrices;
|
|
1084
|
+
}, [canManageProducts, actionRights]);
|
|
1085
|
+
return {
|
|
1086
|
+
canImportProducts,
|
|
1087
|
+
canImportCategories,
|
|
1088
|
+
canImportDiscountCodes,
|
|
1089
|
+
canImportInventories: canManageProducts,
|
|
1090
|
+
canImportProductTypes: canManageProducts
|
|
1091
|
+
};
|
|
1092
|
+
};
|
|
1093
|
+
|
|
1094
|
+
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; }
|
|
1095
|
+
function _objectSpread$c(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys$c(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys$c(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1009
1096
|
const FileDropArea = () => {
|
|
1010
1097
|
const intl = reactIntl.useIntl();
|
|
1011
1098
|
const _useImportResourcesCo = useImportResourcesContext(),
|
|
@@ -1035,7 +1122,7 @@ const FileDropArea = () => {
|
|
|
1035
1122
|
showNotification({
|
|
1036
1123
|
kind: 'error',
|
|
1037
1124
|
domain: constants.DOMAINS.PAGE,
|
|
1038
|
-
text: intl.formatMessage(messages$
|
|
1125
|
+
text: intl.formatMessage(messages$7.tooManyFilesError)
|
|
1039
1126
|
});
|
|
1040
1127
|
return;
|
|
1041
1128
|
}
|
|
@@ -1043,13 +1130,13 @@ const FileDropArea = () => {
|
|
|
1043
1130
|
showNotification({
|
|
1044
1131
|
kind: 'error',
|
|
1045
1132
|
domain: constants.DOMAINS.PAGE,
|
|
1046
|
-
text: intl.formatMessage(messages$
|
|
1133
|
+
text: intl.formatMessage(messages$7.fileFormatNotSupported)
|
|
1047
1134
|
});
|
|
1048
1135
|
} else {
|
|
1049
1136
|
showNotification({
|
|
1050
1137
|
kind: 'error',
|
|
1051
1138
|
domain: constants.DOMAINS.PAGE,
|
|
1052
|
-
text: intl.formatMessage(messages$
|
|
1139
|
+
text: intl.formatMessage(messages$7.genericError)
|
|
1053
1140
|
});
|
|
1054
1141
|
}
|
|
1055
1142
|
}
|
|
@@ -1067,11 +1154,11 @@ const FileDropArea = () => {
|
|
|
1067
1154
|
resourceType: 'category',
|
|
1068
1155
|
isFileDropped: Boolean(state.droppedFile)
|
|
1069
1156
|
});
|
|
1070
|
-
return jsxRuntime.jsxs(DropWrapper, _objectSpread$
|
|
1157
|
+
return jsxRuntime.jsxs(DropWrapper, _objectSpread$c(_objectSpread$c({
|
|
1071
1158
|
role: "presentation"
|
|
1072
1159
|
}, getRootProps()), {}, {
|
|
1073
1160
|
dropAreaState: dropAreaState,
|
|
1074
|
-
children: [jsxRuntime.jsx("input", _objectSpread$
|
|
1161
|
+
children: [jsxRuntime.jsx("input", _objectSpread$c({
|
|
1075
1162
|
"data-testid": "file-input"
|
|
1076
1163
|
}, getInputProps())), jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
1077
1164
|
children: dropArea
|
|
@@ -1079,6 +1166,41 @@ const FileDropArea = () => {
|
|
|
1079
1166
|
}));
|
|
1080
1167
|
};
|
|
1081
1168
|
|
|
1169
|
+
var messages$5 = reactIntl.defineMessages({
|
|
1170
|
+
publishProducts: {
|
|
1171
|
+
id: 'ImportResourcesModal.settings.publishProducts',
|
|
1172
|
+
description: 'Label for the publish products checkbox',
|
|
1173
|
+
defaultMessage: 'Publish all products in the file'
|
|
1174
|
+
}
|
|
1175
|
+
});
|
|
1176
|
+
|
|
1177
|
+
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; }
|
|
1178
|
+
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; }
|
|
1179
|
+
const UploadProductSettings = () => {
|
|
1180
|
+
const _useImportResourcesCo = useImportResourcesContext(),
|
|
1181
|
+
state = _useImportResourcesCo.state,
|
|
1182
|
+
actions = _useImportResourcesCo.actions;
|
|
1183
|
+
return jsxRuntime.jsx(uiKit.CheckboxInput, {
|
|
1184
|
+
isChecked: state.settings?.publish,
|
|
1185
|
+
onChange: e => {
|
|
1186
|
+
actions.setUploadSettings({
|
|
1187
|
+
publish: e.target.checked
|
|
1188
|
+
});
|
|
1189
|
+
},
|
|
1190
|
+
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$b({}, messages$5.publishProducts))
|
|
1191
|
+
});
|
|
1192
|
+
};
|
|
1193
|
+
const UploadSettings = () => {
|
|
1194
|
+
const _useImportResourcesCo2 = useImportResourcesContext(),
|
|
1195
|
+
state = _useImportResourcesCo2.state;
|
|
1196
|
+
const canPublishProducts = permissions.useIsAuthorized({
|
|
1197
|
+
demandedPermissions: [PERMISSIONS.ManageProducts],
|
|
1198
|
+
demandedActionRights: [ACTION_RIGHTS.PublishProducts]
|
|
1199
|
+
});
|
|
1200
|
+
if (state.resourceType === 'product' && canPublishProducts) return jsxRuntime.jsx(UploadProductSettings, {});
|
|
1201
|
+
return null;
|
|
1202
|
+
};
|
|
1203
|
+
|
|
1082
1204
|
var sharedMessages = reactIntl.defineMessages({
|
|
1083
1205
|
[`modalTitle.${IMPORTABLE_RESOURCES.CATEGORY}`]: {
|
|
1084
1206
|
id: 'ImportResourcesModal.modalTitle.category',
|
|
@@ -1163,21 +1285,23 @@ const Upload = () => {
|
|
|
1163
1285
|
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1164
1286
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1165
1287
|
isBold: true,
|
|
1166
|
-
intlMessage: messages$
|
|
1288
|
+
intlMessage: messages$7.dataType
|
|
1167
1289
|
})
|
|
1168
1290
|
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1169
1291
|
children: jsxRuntime.jsx(ResourceTypeSelection, {})
|
|
1170
1292
|
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1171
1293
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1172
1294
|
isBold: true,
|
|
1173
|
-
intlMessage: messages$
|
|
1295
|
+
intlMessage: messages$7.instructions
|
|
1174
1296
|
})
|
|
1175
1297
|
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1176
1298
|
children: jsxRuntime.jsx(Instructions, {})
|
|
1177
1299
|
})]
|
|
1178
|
-
}) : jsxRuntime.jsx(
|
|
1300
|
+
}) : jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1301
|
+
children: jsxRuntime.jsx(Instructions, {})
|
|
1302
|
+
}), jsxRuntime.jsx(InfoBox, {}), jsxRuntime.jsx(fullstory.Masking.Mask, {
|
|
1179
1303
|
children: jsxRuntime.jsx(FileDropArea, {})
|
|
1180
|
-
})]
|
|
1304
|
+
}), jsxRuntime.jsx(UploadSettings, {})]
|
|
1181
1305
|
})
|
|
1182
1306
|
})
|
|
1183
1307
|
});
|
|
@@ -1457,21 +1581,6 @@ var messages$3 = reactIntl.defineMessages({
|
|
|
1457
1581
|
description: 'Label for the modal Start import button',
|
|
1458
1582
|
defaultMessage: 'Start import'
|
|
1459
1583
|
},
|
|
1460
|
-
BodyText: {
|
|
1461
|
-
id: 'ImportResourcesModal.BodyText',
|
|
1462
|
-
description: 'Confirmation dialog text',
|
|
1463
|
-
defaultMessage: 'You are about to import <bold>{count}</bold> rows to the project: <bold>{projectName}</bold>.'
|
|
1464
|
-
},
|
|
1465
|
-
BodyNote: {
|
|
1466
|
-
id: 'ImportResourcesModal.BodyNote',
|
|
1467
|
-
description: 'Confirmation dialog text',
|
|
1468
|
-
defaultMessage: 'Please be aware that existing values with the same keys will be overwritten by the data included in the CSV.'
|
|
1469
|
-
},
|
|
1470
|
-
BodyQuestion: {
|
|
1471
|
-
id: 'ImportResourcesModal.BodyQuestion',
|
|
1472
|
-
description: 'Confirmation question',
|
|
1473
|
-
defaultMessage: 'Proceed with the import?'
|
|
1474
|
-
},
|
|
1475
1584
|
importNotificationSuccessMessage: {
|
|
1476
1585
|
id: 'ImportResourcesModal.successMessage',
|
|
1477
1586
|
description: 'Notification success message',
|
|
@@ -1490,7 +1599,7 @@ var messages$3 = reactIntl.defineMessages({
|
|
|
1490
1599
|
rowsToBeImported: {
|
|
1491
1600
|
id: 'ImportResourcesModal.rowsToBeImported',
|
|
1492
1601
|
description: 'This message indicates the number of rows that are ready to be imported into the system.',
|
|
1493
|
-
defaultMessage: '<b>{rowCount}</b> rows to be imported'
|
|
1602
|
+
defaultMessage: '{rowCount, plural, one {<b>1</b> row to be imported} other {<b>{rowCount}</b> rows to be imported}}{publish, select, true { and published} other {}}'
|
|
1494
1603
|
},
|
|
1495
1604
|
columnsToBeImported: {
|
|
1496
1605
|
id: 'ImportResourcesModal.columnsToBeImported',
|
|
@@ -1520,7 +1629,7 @@ var messages$3 = reactIntl.defineMessages({
|
|
|
1520
1629
|
confirmationBodyText: {
|
|
1521
1630
|
id: 'ImportResourcesModal.confirmationBodyText',
|
|
1522
1631
|
description: 'Confirmation dialog text',
|
|
1523
|
-
defaultMessage: 'You are about to import <bold>{count}</bold> rows
|
|
1632
|
+
defaultMessage: 'You are about to import {count, plural, one {<bold>1</bold> row} other {<bold>{count}</bold> rows}} in the project: <bold>{projectName}</bold>.'
|
|
1524
1633
|
},
|
|
1525
1634
|
confirmationBodyNote: {
|
|
1526
1635
|
id: 'ImportResourcesModal.confirmationBodyNote',
|
|
@@ -1535,35 +1644,40 @@ var messages$3 = reactIntl.defineMessages({
|
|
|
1535
1644
|
});
|
|
1536
1645
|
|
|
1537
1646
|
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; }
|
|
1538
|
-
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
1539
|
-
const
|
|
1540
|
-
|
|
1541
|
-
}
|
|
1542
|
-
|
|
1647
|
+
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; }
|
|
1648
|
+
const AlignedContainer = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1649
|
+
target: "e1amawj91"
|
|
1650
|
+
} )({
|
|
1651
|
+
name: "1x0d6yz",
|
|
1652
|
+
styles: "padding-top:5px"
|
|
1653
|
+
} );
|
|
1654
|
+
const ModifiedTagList = /*#__PURE__*/_styled__default["default"](uiKit.TagList, {
|
|
1543
1655
|
target: "e1amawj90"
|
|
1544
|
-
} )(
|
|
1656
|
+
} )({
|
|
1657
|
+
name: "u9abxe",
|
|
1658
|
+
styles: ">div{margin:8px 8px 0 0;}"
|
|
1659
|
+
} );
|
|
1545
1660
|
const ColumnList = props => {
|
|
1661
|
+
var _context;
|
|
1546
1662
|
const _React$useState = React__default["default"].useState(false),
|
|
1547
1663
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1548
1664
|
isExpanded = _React$useState2[0],
|
|
1549
1665
|
setIsExpanded = _React$useState2[1];
|
|
1550
1666
|
const shouldShowExpandButton = props.columns.length > INITIAL_COLUMN_DISPLAY_COUNT;
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
children: [
|
|
1554
|
-
|
|
1667
|
+
const finalColumns = isExpanded ? props.columns : _sliceInstanceProperty__default["default"](_context = props.columns).call(_context, 0, INITIAL_COLUMN_DISPLAY_COUNT);
|
|
1668
|
+
return jsxRuntime.jsxs(ModifiedTagList, {
|
|
1669
|
+
children: [_mapInstanceProperty__default["default"](finalColumns).call(finalColumns, (column, index) => jsxRuntime.jsx(uiKit.Stamp, {
|
|
1670
|
+
label: column,
|
|
1671
|
+
tone: "secondary"
|
|
1672
|
+
}, index)), shouldShowExpandButton && jsxRuntime.jsx(AlignedContainer, {
|
|
1673
|
+
children: jsxRuntime.jsx(uiKit.Link, {
|
|
1674
|
+
to: "",
|
|
1555
1675
|
tone: "secondary",
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
e.preventDefault();
|
|
1562
|
-
setIsExpanded(!isExpanded);
|
|
1563
|
-
},
|
|
1564
|
-
children: isExpanded ? jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$3.showLess)) : jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$3.showMore))
|
|
1565
|
-
})
|
|
1566
|
-
})]
|
|
1676
|
+
onClick: e => {
|
|
1677
|
+
e.preventDefault();
|
|
1678
|
+
setIsExpanded(!isExpanded);
|
|
1679
|
+
},
|
|
1680
|
+
children: isExpanded ? jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$3.showLess)) : jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$6({}, messages$3.showMore))
|
|
1567
1681
|
})
|
|
1568
1682
|
})]
|
|
1569
1683
|
});
|
|
@@ -1608,30 +1722,34 @@ function UploadPreviewModal() {
|
|
|
1608
1722
|
}), jsxRuntime.jsx(uiKit.Card, {
|
|
1609
1723
|
insetScale: "xl",
|
|
1610
1724
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1611
|
-
scale: "
|
|
1612
|
-
children: [jsxRuntime.jsxs(uiKit.Spacings.
|
|
1613
|
-
|
|
1614
|
-
children: [jsxRuntime.
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1725
|
+
scale: "s",
|
|
1726
|
+
children: [jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1727
|
+
scale: "xs",
|
|
1728
|
+
children: [jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1729
|
+
alignItems: "center",
|
|
1730
|
+
children: [jsxRuntime.jsx(uiKit.CheckBoldIcon, {
|
|
1731
|
+
color: "success"
|
|
1732
|
+
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1733
|
+
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$3.rowsToBeImported), {}, {
|
|
1734
|
+
values: {
|
|
1735
|
+
rowCount: intl.formatNumber(state.uploadFileResponse.rowsCount),
|
|
1736
|
+
publish: state.resourceType === 'product' && state.settings?.publish,
|
|
1737
|
+
b: getBold$1
|
|
1738
|
+
}
|
|
1739
|
+
})
|
|
1740
|
+
})]
|
|
1741
|
+
}), jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1742
|
+
alignItems: "center",
|
|
1743
|
+
children: [jsxRuntime.jsx(uiKit.CheckBoldIcon, {
|
|
1744
|
+
color: "success"
|
|
1745
|
+
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1746
|
+
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$3.columnsToBeImported), {}, {
|
|
1747
|
+
values: {
|
|
1748
|
+
columnCount: intl.formatNumber(validatedColumns.length),
|
|
1749
|
+
b: getBold$1
|
|
1750
|
+
}
|
|
1751
|
+
})
|
|
1752
|
+
})]
|
|
1635
1753
|
})]
|
|
1636
1754
|
}), jsxRuntime.jsx(ColumnList, {
|
|
1637
1755
|
columns: validatedColumns
|
|
@@ -1640,7 +1758,7 @@ function UploadPreviewModal() {
|
|
|
1640
1758
|
}), ignoredColumns.length > 0 && jsxRuntime.jsx(uiKit.Card, {
|
|
1641
1759
|
insetScale: "xl",
|
|
1642
1760
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1643
|
-
scale: "
|
|
1761
|
+
scale: "s",
|
|
1644
1762
|
children: [jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1645
1763
|
alignItems: "center",
|
|
1646
1764
|
children: [jsxRuntime.jsx(uiKit.EyeCrossedIcon, {
|
|
@@ -2061,19 +2179,19 @@ const getChunkImport = locale => {
|
|
|
2061
2179
|
const intlLocale = i18n.mapLocaleToIntlLocale(locale);
|
|
2062
2180
|
switch (intlLocale) {
|
|
2063
2181
|
case 'de':
|
|
2064
|
-
return Promise.resolve().then(function () { return require(/* webpackChunkName: "import-resources-modal-i18n-de" */'./de-
|
|
2182
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "import-resources-modal-i18n-de" */'./de-22a8eb66.cjs.prod.js'); });
|
|
2065
2183
|
case 'es':
|
|
2066
|
-
return Promise.resolve().then(function () { return require(/* webpackChunkName: "import-resources-modal-i18n-es" */'./es-
|
|
2184
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "import-resources-modal-i18n-es" */'./es-01b24cea.cjs.prod.js'); });
|
|
2067
2185
|
case 'fr-FR':
|
|
2068
|
-
return Promise.resolve().then(function () { return require(/* webpackChunkName: "import-resources-modal-i18n-fr-FR" */'./fr-FR-
|
|
2186
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "import-resources-modal-i18n-fr-FR" */'./fr-FR-2a0f5518.cjs.prod.js'); });
|
|
2069
2187
|
case 'zh-CN':
|
|
2070
2188
|
return Promise.resolve().then(function () { return require(/* webpackChunkName: "import-resources-modal-i18n-zh-CN" */'./zh-CN-52baa549.cjs.prod.js'); });
|
|
2071
2189
|
case 'ja':
|
|
2072
2190
|
return Promise.resolve().then(function () { return require(/* webpackChunkName: "import-resources-modal-i18n-ja" */'./ja-37632763.cjs.prod.js'); });
|
|
2073
2191
|
case 'pt-BR':
|
|
2074
|
-
return Promise.resolve().then(function () { return require(/* webpackChunkName: "change-history-i18n-pt-BR" */'./pt-BR-
|
|
2192
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "change-history-i18n-pt-BR" */'./pt-BR-6b7a389e.cjs.prod.js'); });
|
|
2075
2193
|
default:
|
|
2076
|
-
return Promise.resolve().then(function () { return require(/* webpackChunkName: "import-resources-modal-i18n-en" */'./en-
|
|
2194
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "import-resources-modal-i18n-en" */'./en-8d84a827.cjs.prod.js'); });
|
|
2077
2195
|
}
|
|
2078
2196
|
};
|
|
2079
2197
|
const loadMessages = async locale => {
|
|
@@ -2156,5 +2274,6 @@ ImportResourcesModal.displayName = 'ImportResourcesModal';
|
|
|
2156
2274
|
exports.EnabledDropArea = EnabledDropArea;
|
|
2157
2275
|
exports.FileDropped = FileDropped;
|
|
2158
2276
|
exports.ImportResourcesModal = ImportResourcesModal;
|
|
2159
|
-
exports.messages = messages$
|
|
2277
|
+
exports.messages = messages$7;
|
|
2278
|
+
exports.useImportPermission = useImportPermission;
|
|
2160
2279
|
exports.useImportResourcesContext = useImportResourcesContext;
|