@commercetools-frontend-extensions/import-resources-modal 1.8.2 → 1.9.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-c8d1c499.cjs.dev.js → active-drag-drop-area-0467c118.cjs.dev.js} +1 -1
- package/dist/{active-drag-drop-area-08d8f60d.esm.js → active-drag-drop-area-294d353d.esm.js} +1 -1
- package/dist/{active-drag-drop-area-ea7d585c.cjs.prod.js → active-drag-drop-area-a995b09d.cjs.prod.js} +1 -1
- package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.dev.js +1 -1
- package/dist/commercetools-frontend-extensions-import-resources-modal.cjs.prod.js +1 -1
- package/dist/commercetools-frontend-extensions-import-resources-modal.esm.js +1 -1
- package/dist/{de-ce1e957d.esm.js → de-19530b12.esm.js} +168 -20
- package/dist/{de-5181e779.cjs.dev.js → de-2836a9ae.cjs.prod.js} +168 -20
- package/dist/{de-3c758072.cjs.prod.js → de-db4fb974.cjs.dev.js} +168 -20
- package/dist/declarations/src/@hooks/use-import-permission.d.ts +2 -0
- package/dist/declarations/src/@types/resource-type.d.ts +2 -1
- package/dist/{disabled-drop-area-3e6427f5.cjs.prod.js → disabled-drop-area-16b58581.cjs.prod.js} +1 -1
- package/dist/{disabled-drop-area-d502e62b.cjs.dev.js → disabled-drop-area-4a639dbf.cjs.dev.js} +1 -1
- package/dist/{disabled-drop-area-0663121b.esm.js → disabled-drop-area-7ca6b04a.esm.js} +1 -1
- package/dist/{en-2f76b27a.esm.js → en-1f091237.esm.js} +168 -20
- package/dist/{en-d7cc7b15.cjs.prod.js → en-cb6893e4.cjs.prod.js} +168 -20
- package/dist/{en-7de3b07a.cjs.dev.js → en-f53130d1.cjs.dev.js} +168 -20
- package/dist/{enabled-drop-area-e0438b2d.cjs.prod.js → enabled-drop-area-1f50b766.cjs.prod.js} +1 -1
- package/dist/{enabled-drop-area-cc374582.esm.js → enabled-drop-area-9bf924fa.esm.js} +1 -1
- package/dist/{enabled-drop-area-314c679f.cjs.dev.js → enabled-drop-area-a4a76650.cjs.dev.js} +1 -1
- package/dist/{es-d9a57b63.cjs.dev.js → es-420f21e1.cjs.dev.js} +169 -21
- package/dist/{es-2b81e0cd.esm.js → es-a9aada13.esm.js} +169 -21
- package/dist/{es-a3c0e9b3.cjs.prod.js → es-f085026e.cjs.prod.js} +169 -21
- package/dist/{file-dropped-area-a31408ab.cjs.prod.js → file-dropped-area-84bc6912.cjs.prod.js} +1 -1
- package/dist/{file-dropped-area-6184d9a7.cjs.dev.js → file-dropped-area-9387283c.cjs.dev.js} +1 -1
- package/dist/{file-dropped-area-5b9a5695.esm.js → file-dropped-area-e6b5a3fa.esm.js} +1 -1
- package/dist/{fr-FR-084be771.esm.js → fr-FR-02bd52fb.esm.js} +169 -21
- package/dist/{fr-FR-cac38097.cjs.dev.js → fr-FR-342599f4.cjs.dev.js} +169 -21
- package/dist/{fr-FR-81499942.cjs.prod.js → fr-FR-dc40a55c.cjs.prod.js} +169 -21
- package/dist/{index-12a56d8e.esm.js → index-10a225f5.esm.js} +108 -47
- package/dist/{index-86e79ec0.cjs.dev.js → index-40da749a.cjs.dev.js} +108 -47
- package/dist/{index-9cf95c7a.cjs.prod.js → index-77194696.cjs.prod.js} +108 -47
- package/dist/{pt-BR-0fda1bcd.cjs.dev.js → pt-BR-31c46d23.cjs.prod.js} +169 -21
- package/dist/{pt-BR-0d2cb8bd.cjs.prod.js → pt-BR-339ed808.cjs.dev.js} +169 -21
- package/dist/{pt-BR-acd3f11d.esm.js → pt-BR-ac1fc192.esm.js} +169 -21
- package/package.json +21 -21
|
@@ -85,7 +85,8 @@ const EnabledResourceType = {
|
|
|
85
85
|
'discount-code': true,
|
|
86
86
|
customer: false,
|
|
87
87
|
order: false,
|
|
88
|
-
'product-type': false
|
|
88
|
+
'product-type': false,
|
|
89
|
+
'business-unit': true
|
|
89
90
|
};
|
|
90
91
|
function isResourceType(maybeResourceType) {
|
|
91
92
|
return typeof maybeResourceType === 'string' && maybeResourceType in EnabledResourceType;
|
|
@@ -115,27 +116,27 @@ let CurrentStep$1 = /*#__PURE__*/function (CurrentStep) {
|
|
|
115
116
|
return CurrentStep;
|
|
116
117
|
}({});
|
|
117
118
|
|
|
118
|
-
function ownKeys$
|
|
119
|
-
function _objectSpread$
|
|
119
|
+
function ownKeys$j(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; }
|
|
120
|
+
function _objectSpread$j(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$j(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$j(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
120
121
|
|
|
121
122
|
// TODO: make this resource type specific
|
|
122
123
|
|
|
123
124
|
function reducer(state, action) {
|
|
124
|
-
if (action.type === 'setCurrentStep') return _objectSpread$
|
|
125
|
+
if (action.type === 'setCurrentStep') return _objectSpread$j(_objectSpread$j({}, state), {}, {
|
|
125
126
|
currentStep: action.currentStep,
|
|
126
127
|
progress: 0
|
|
127
128
|
});
|
|
128
|
-
if (action.type === 'setUploadFileResponse') return _objectSpread$
|
|
129
|
+
if (action.type === 'setUploadFileResponse') return _objectSpread$j(_objectSpread$j({}, state), {}, {
|
|
129
130
|
uploadFileResponse: action.uploadFileResponse
|
|
130
131
|
});
|
|
131
|
-
if (action.type === 'setResourceType') return _objectSpread$
|
|
132
|
+
if (action.type === 'setResourceType') return _objectSpread$j(_objectSpread$j({}, state), {}, {
|
|
132
133
|
settings: undefined,
|
|
133
134
|
resourceType: action.resourceType
|
|
134
135
|
});
|
|
135
|
-
if (action.type === 'setContainerKey') return _objectSpread$
|
|
136
|
+
if (action.type === 'setContainerKey') return _objectSpread$j(_objectSpread$j({}, state), {}, {
|
|
136
137
|
containerKey: action.containerKey
|
|
137
138
|
});
|
|
138
|
-
if (action.type === 'cancelImport') return _objectSpread$
|
|
139
|
+
if (action.type === 'cancelImport') return _objectSpread$j(_objectSpread$j({}, state), {}, {
|
|
139
140
|
currentStep: CurrentStep$1.Upload,
|
|
140
141
|
containerKey: undefined,
|
|
141
142
|
fileUploadErrors: [],
|
|
@@ -144,7 +145,7 @@ function reducer(state, action) {
|
|
|
144
145
|
dropAreaState: 'disabled',
|
|
145
146
|
progress: 0
|
|
146
147
|
});
|
|
147
|
-
if (action.type === 'uploadNewFile') return _objectSpread$
|
|
148
|
+
if (action.type === 'uploadNewFile') return _objectSpread$j(_objectSpread$j({}, state), {}, {
|
|
148
149
|
currentStep: CurrentStep$1.Upload,
|
|
149
150
|
containerKey: undefined,
|
|
150
151
|
fileUploadErrors: [],
|
|
@@ -154,28 +155,28 @@ function reducer(state, action) {
|
|
|
154
155
|
progress: 0
|
|
155
156
|
});
|
|
156
157
|
if (action.type === 'setDroppedFile') {
|
|
157
|
-
return _objectSpread$
|
|
158
|
+
return _objectSpread$j(_objectSpread$j({}, state), {}, {
|
|
158
159
|
droppedFile: action.droppedFile
|
|
159
160
|
});
|
|
160
161
|
}
|
|
161
162
|
if (action.type === 'setFileUploadErrors') {
|
|
162
|
-
return _objectSpread$
|
|
163
|
+
return _objectSpread$j(_objectSpread$j({}, state), {}, {
|
|
163
164
|
fileUploadErrors: action.fileUploadErrors
|
|
164
165
|
});
|
|
165
166
|
}
|
|
166
167
|
if (action.type === 'setAbortController') {
|
|
167
|
-
return _objectSpread$
|
|
168
|
+
return _objectSpread$j(_objectSpread$j({}, state), {}, {
|
|
168
169
|
abortController: action.abortController
|
|
169
170
|
});
|
|
170
171
|
}
|
|
171
172
|
if (action.type === 'setProgress') {
|
|
172
|
-
return _objectSpread$
|
|
173
|
+
return _objectSpread$j(_objectSpread$j({}, state), {}, {
|
|
173
174
|
progress: action.progress
|
|
174
175
|
});
|
|
175
176
|
}
|
|
176
177
|
if (action.type === 'setUploadSettings') {
|
|
177
|
-
return _objectSpread$
|
|
178
|
-
settings: _objectSpread$
|
|
178
|
+
return _objectSpread$j(_objectSpread$j({}, state), {}, {
|
|
179
|
+
settings: _objectSpread$j(_objectSpread$j({}, state.settings), action.settings)
|
|
179
180
|
});
|
|
180
181
|
}
|
|
181
182
|
throw new Error(getUnknownActionError(action));
|
|
@@ -240,8 +241,8 @@ let HttpError = /*#__PURE__*/function (_Error) {
|
|
|
240
241
|
return _createClass(HttpError);
|
|
241
242
|
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
242
243
|
|
|
243
|
-
function ownKeys$
|
|
244
|
-
function _objectSpread$
|
|
244
|
+
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; }
|
|
245
|
+
function _objectSpread$i(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$i(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$i(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
245
246
|
const addProxyPrefixToUrl = (uri, proxy) => {
|
|
246
247
|
return proxy ? `/proxy/${proxy}${uri}` : uri;
|
|
247
248
|
};
|
|
@@ -253,7 +254,7 @@ const fetchUsingXhr = _ref2 => {
|
|
|
253
254
|
onSuccess = _ref2.onSuccess,
|
|
254
255
|
onError = _ref2.onError;
|
|
255
256
|
const options = applicationShell.createHttpClientOptions({
|
|
256
|
-
headers: _objectSpread$
|
|
257
|
+
headers: _objectSpread$i({
|
|
257
258
|
'Content-Type': 'application/json'
|
|
258
259
|
}, config?.headers)
|
|
259
260
|
});
|
|
@@ -314,7 +315,8 @@ const IMPORTABLE_RESOURCES = {
|
|
|
314
315
|
DISCOUNT_CODE: 'discount-code',
|
|
315
316
|
CUSTOMER: 'customer',
|
|
316
317
|
ORDER: 'order',
|
|
317
|
-
PRODUCT_TYPE: 'product-type'
|
|
318
|
+
PRODUCT_TYPE: 'product-type',
|
|
319
|
+
BUSINESS_UNIT: 'business-unit'
|
|
318
320
|
};
|
|
319
321
|
|
|
320
322
|
const FILE_SIZE_LIMITS_MB = {
|
|
@@ -324,7 +326,8 @@ const FILE_SIZE_LIMITS_MB = {
|
|
|
324
326
|
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 35,
|
|
325
327
|
[IMPORTABLE_RESOURCES.CUSTOMER]: 0,
|
|
326
328
|
[IMPORTABLE_RESOURCES.ORDER]: 0,
|
|
327
|
-
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 35
|
|
329
|
+
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 35,
|
|
330
|
+
[IMPORTABLE_RESOURCES.BUSINESS_UNIT]: 35
|
|
328
331
|
};
|
|
329
332
|
const ROW_LIMITS = {
|
|
330
333
|
[IMPORTABLE_RESOURCES.CATEGORY]: 80_000,
|
|
@@ -333,7 +336,8 @@ const ROW_LIMITS = {
|
|
|
333
336
|
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 80_000,
|
|
334
337
|
[IMPORTABLE_RESOURCES.CUSTOMER]: 0,
|
|
335
338
|
[IMPORTABLE_RESOURCES.ORDER]: 0,
|
|
336
|
-
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 80_000
|
|
339
|
+
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 80_000,
|
|
340
|
+
[IMPORTABLE_RESOURCES.BUSINESS_UNIT]: 80_000
|
|
337
341
|
};
|
|
338
342
|
const RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS = {
|
|
339
343
|
[IMPORTABLE_RESOURCES.CATEGORY]: 'https://docs.commercetools.com/merchant-center/downloads/category_import_template.csv',
|
|
@@ -342,7 +346,8 @@ const RESOURCE_TYPE_TEMPLATE_DOWNLOAD_LINKS = {
|
|
|
342
346
|
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 'https://docs.commercetools.com/merchant-center/downloads/discount_code_import_template.csv',
|
|
343
347
|
[IMPORTABLE_RESOURCES.CUSTOMER]: 'https://docs.commercetools.com/merchant-center/import-data#download-a-template',
|
|
344
348
|
[IMPORTABLE_RESOURCES.ORDER]: 'https://docs.commercetools.com/merchant-center/import-data#download-a-template',
|
|
345
|
-
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 'https://docs.commercetools.com/merchant-center/downloads/product_type_import_template.csv'
|
|
349
|
+
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 'https://docs.commercetools.com/merchant-center/downloads/product_type_import_template.csv',
|
|
350
|
+
[IMPORTABLE_RESOURCES.BUSINESS_UNIT]: 'https://docs.commercetools.com/merchant-center/downloads/business_unit_import_template.csv'
|
|
346
351
|
};
|
|
347
352
|
const RESOURCE_TYPE_DOCUMENTATION_LINKS = {
|
|
348
353
|
[IMPORTABLE_RESOURCES.CATEGORY]: 'https://docs.commercetools.com/merchant-center/import-categories#supported-headers-and-values',
|
|
@@ -351,7 +356,8 @@ const RESOURCE_TYPE_DOCUMENTATION_LINKS = {
|
|
|
351
356
|
[IMPORTABLE_RESOURCES.DISCOUNT_CODE]: 'https://docs.commercetools.com/merchant-center/import-discount-codes#supported-headers-and-values',
|
|
352
357
|
[IMPORTABLE_RESOURCES.CUSTOMER]: 'https://docs.commercetools.com/merchant-center/import-customers#supported-headers-and-values',
|
|
353
358
|
[IMPORTABLE_RESOURCES.ORDER]: 'https://docs.commercetools.com/merchant-center/import-orders#supported-headers-and-values',
|
|
354
|
-
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 'https://docs.commercetools.com/merchant-center/import-product-types#supported-headers-and-values'
|
|
359
|
+
[IMPORTABLE_RESOURCES.PRODUCT_TYPE]: 'https://docs.commercetools.com/merchant-center/import-product-types#supported-headers-and-values',
|
|
360
|
+
[IMPORTABLE_RESOURCES.BUSINESS_UNIT]: 'https://docs.commercetools.com/merchant-center/import-business-units#supported-headers-and-values'
|
|
355
361
|
};
|
|
356
362
|
|
|
357
363
|
const CT_API_DOCS_URL = 'https://docs.commercetools.com/api/';
|
|
@@ -368,7 +374,19 @@ const PERMISSIONS = {
|
|
|
368
374
|
ViewProductTypes: 'ViewProductTypes',
|
|
369
375
|
// DiscountCodes
|
|
370
376
|
ManageDiscountCodes: 'ManageDiscountCodes',
|
|
371
|
-
ViewDiscountCodes: 'ViewDiscountCodes'
|
|
377
|
+
ViewDiscountCodes: 'ViewDiscountCodes',
|
|
378
|
+
// Customers
|
|
379
|
+
ManageCustomers: 'ManageCustomers',
|
|
380
|
+
ViewCustomers: 'ViewCustomers',
|
|
381
|
+
// Orders
|
|
382
|
+
ManageOrders: 'ManageOrders',
|
|
383
|
+
ViewOrders: 'ViewOrders',
|
|
384
|
+
// KeyValueDocuments
|
|
385
|
+
ManageKeyValueDocuments: 'ManageKeyValueDocuments',
|
|
386
|
+
ViewKeyValueDocuments: 'ViewKeyValueDocuments',
|
|
387
|
+
// BusinessUnits
|
|
388
|
+
ManageBusinessUnits: 'ManageBusinessUnits',
|
|
389
|
+
ViewBusinessUnits: 'ViewBusinessUnits'
|
|
372
390
|
};
|
|
373
391
|
const ACTION_RIGHTS = {
|
|
374
392
|
PublishProducts: {
|
|
@@ -381,11 +399,11 @@ const ACTION_RIGHTS = {
|
|
|
381
399
|
}
|
|
382
400
|
};
|
|
383
401
|
|
|
384
|
-
function ownKeys$
|
|
385
|
-
function _objectSpread$
|
|
402
|
+
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; }
|
|
403
|
+
function _objectSpread$h(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$h(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$h(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
386
404
|
const DEFAULT_SHORT_LIVED_FLAGS = {};
|
|
387
405
|
const DEFAULT_LONG_LIVED_FLAGS = {};
|
|
388
|
-
_objectSpread$
|
|
406
|
+
_objectSpread$h(_objectSpread$h({}, DEFAULT_SHORT_LIVED_FLAGS), DEFAULT_LONG_LIVED_FLAGS);
|
|
389
407
|
|
|
390
408
|
var sharedMessages = reactIntl.defineMessages({
|
|
391
409
|
[`modalTitle.${IMPORTABLE_RESOURCES.CATEGORY}`]: {
|
|
@@ -408,6 +426,11 @@ var sharedMessages = reactIntl.defineMessages({
|
|
|
408
426
|
description: 'Label for the inventories modal title',
|
|
409
427
|
defaultMessage: 'Import discount codes by CSV'
|
|
410
428
|
},
|
|
429
|
+
[`modalTitle.${IMPORTABLE_RESOURCES.BUSINESS_UNIT}`]: {
|
|
430
|
+
id: 'ImportResourcesModal.modalTitle.businessUnit',
|
|
431
|
+
description: 'Label for the business units modal title',
|
|
432
|
+
defaultMessage: 'Import business units by CSV'
|
|
433
|
+
},
|
|
411
434
|
[`modalTitle.${IMPORTABLE_RESOURCES.CUSTOMER}`]: {
|
|
412
435
|
id: 'ImportResourcesModal.modalTitle.customer',
|
|
413
436
|
description: 'Label for the customers modal title',
|
|
@@ -614,6 +637,16 @@ var sharedMessages = reactIntl.defineMessages({
|
|
|
614
637
|
description: 'Label for the discount-codes resource type',
|
|
615
638
|
defaultMessage: 'Discount codes'
|
|
616
639
|
},
|
|
640
|
+
'business-unit': {
|
|
641
|
+
id: 'ImportResourcesModal.business-unit',
|
|
642
|
+
description: 'Label for the business-unit resource type',
|
|
643
|
+
defaultMessage: 'Business unit'
|
|
644
|
+
},
|
|
645
|
+
'business-units': {
|
|
646
|
+
id: 'ImportResourcesModal.business-units',
|
|
647
|
+
description: 'Label for the business-units resource type',
|
|
648
|
+
defaultMessage: 'Business units'
|
|
649
|
+
},
|
|
617
650
|
unknownResourceType: {
|
|
618
651
|
id: 'ImportResourcesModal.unknown-resource-type',
|
|
619
652
|
description: 'Label for the unknown resource type',
|
|
@@ -622,8 +655,8 @@ var sharedMessages = reactIntl.defineMessages({
|
|
|
622
655
|
//
|
|
623
656
|
});
|
|
624
657
|
|
|
625
|
-
function ownKeys$
|
|
626
|
-
function _objectSpread$
|
|
658
|
+
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; }
|
|
659
|
+
function _objectSpread$g(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$g(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$g(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
627
660
|
|
|
628
661
|
// Delimiters not included in this array may be treated as part of a column content
|
|
629
662
|
// potentially causing the file to be parsed as a single-column CSV and pass this validation
|
|
@@ -672,7 +705,7 @@ const mapUploadFileErrorsResponseToUploadFileErrorRows = uploadFileErrorsRespons
|
|
|
672
705
|
};
|
|
673
706
|
const mapFileUploadErrorsToUploadFileErrorRows = uploadFileErrors => {
|
|
674
707
|
let idCounter = 1;
|
|
675
|
-
return _mapInstanceProperty__default["default"](uploadFileErrors).call(uploadFileErrors, uploadFileError => _objectSpread$
|
|
708
|
+
return _mapInstanceProperty__default["default"](uploadFileErrors).call(uploadFileErrors, uploadFileError => _objectSpread$g(_objectSpread$g({}, uploadFileError), {}, {
|
|
676
709
|
id: String(idCounter++)
|
|
677
710
|
}));
|
|
678
711
|
};
|
|
@@ -785,6 +818,7 @@ function resourceTypeToMessage(resourceType) {
|
|
|
785
818
|
'product-variant-patch': sharedMessages['product-variant-patch'],
|
|
786
819
|
'standalone-price': sharedMessages['standalone-price'],
|
|
787
820
|
'custom-object': sharedMessages['custom-object'],
|
|
821
|
+
'business-unit': sharedMessages['business-unit'],
|
|
788
822
|
type: sharedMessages.type
|
|
789
823
|
};
|
|
790
824
|
const message = resourceTypeMap[resourceType];
|
|
@@ -810,7 +844,8 @@ function resourceTypeToPluralMessage(resourceType) {
|
|
|
810
844
|
'product-draft': sharedMessages['product-drafts'],
|
|
811
845
|
'product-variant': sharedMessages['product-variants'],
|
|
812
846
|
'product-variant-patch': sharedMessages['product-variant-patches'],
|
|
813
|
-
'standalone-price': sharedMessages['standalone-prices']
|
|
847
|
+
'standalone-price': sharedMessages['standalone-prices'],
|
|
848
|
+
'business-unit': sharedMessages['business-units']
|
|
814
849
|
};
|
|
815
850
|
const message = resourceTypePluralMap[resourceType];
|
|
816
851
|
if (!message) {
|
|
@@ -868,6 +903,8 @@ function uploadFileForImport(_ref) {
|
|
|
868
903
|
});
|
|
869
904
|
}
|
|
870
905
|
|
|
906
|
+
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; }
|
|
907
|
+
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; }
|
|
871
908
|
function createImportContainerForFileUpload(importContainerDraft, projectKey, asyncDispatch) {
|
|
872
909
|
return asyncDispatch(sdk.actions.post({
|
|
873
910
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.IMPORT,
|
|
@@ -876,7 +913,14 @@ function createImportContainerForFileUpload(importContainerDraft, projectKey, as
|
|
|
876
913
|
accept: 'application/json',
|
|
877
914
|
'Content-Type': 'application/json'
|
|
878
915
|
},
|
|
879
|
-
payload: _JSON$stringify__default["default"](
|
|
916
|
+
payload: _JSON$stringify__default["default"](_objectSpread$f({
|
|
917
|
+
retentionPolicy: {
|
|
918
|
+
strategy: 'ttl',
|
|
919
|
+
config: {
|
|
920
|
+
timeToLive: '54h' // 2 days and 6 hours
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
}, importContainerDraft))
|
|
880
924
|
}));
|
|
881
925
|
}
|
|
882
926
|
function deleteImportContainer(projectKey, containerKey, asyncDispatch) {
|
|
@@ -1062,13 +1106,13 @@ function getDefaultDropWrapperStyles(_dropAreaState) {
|
|
|
1062
1106
|
return /*#__PURE__*/react.css(process.env.NODE_ENV === "production" ? "" : ";label:getDefaultDropWrapperStyles;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRyb3AtYXJlYS13cmFwcGVyLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE0QlkiLCJmaWxlIjoiZHJvcC1hcmVhLXdyYXBwZXIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgdHlwZSBEcm9wem9uZVJvb3RQcm9wcyB9IGZyb20gJ3JlYWN0LWRyb3B6b25lJ1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCdcbmltcG9ydCB7IHN0eWxlcyB9IGZyb20gJy4vc3R5bGVzJ1xuaW1wb3J0IHsgdHlwZSBEcm9wQXJlYVN0YXRlIH0gZnJvbSAnLi4vLi4vLi4vQHR5cGVzJ1xuXG5pbnRlcmZhY2UgRHJvcFdyYXBwZXJQcm9wcyBleHRlbmRzIERyb3B6b25lUm9vdFByb3BzIHtcbiAgZHJvcEFyZWFTdGF0ZTogRHJvcEFyZWFTdGF0ZVxufVxuZXhwb3J0IGNvbnN0IERyb3BXcmFwcGVyID0gc3R5bGVkLmRpdjxEcm9wV3JhcHBlclByb3BzPmBcbiAgJHtzdHlsZXMuYmFzZX1cbiAgJHsocHJvcHMpID0+IHtcbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ2Rpc2FibGVkJykge1xuICAgICAgcmV0dXJuIHN0eWxlcy5kaXNhYmxlZFxuICAgIH1cbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ3JlYWR5LWZvci1kcm9wJykge1xuICAgICAgcmV0dXJuIHN0eWxlcy5yZWFkeUZvckRyb3BcbiAgICB9XG4gICAgaWYgKHByb3BzLmRyb3BBcmVhU3RhdGUgPT09ICdhY3RpdmUtZHJhZycpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuYWN0aXZlRHJhZ1xuICAgIH1cbiAgICBpZiAocHJvcHMuZHJvcEFyZWFTdGF0ZSA9PT0gJ2ZpbGUtZHJvcHBlZCcpIHtcbiAgICAgIHJldHVybiBzdHlsZXMuZmlsZURyb3BwZWRcbiAgICB9XG4gICAgcmV0dXJuIGdldERlZmF1bHREcm9wV3JhcHBlclN0eWxlcyhwcm9wcy5kcm9wQXJlYVN0YXRlKVxuICB9fVxuYFxuZnVuY3Rpb24gZ2V0RGVmYXVsdERyb3BXcmFwcGVyU3R5bGVzKF9kcm9wQXJlYVN0YXRlOiBuZXZlcikge1xuICByZXR1cm4gY3NzYGBcbn1cbiJdfQ== */");
|
|
1063
1107
|
}
|
|
1064
1108
|
|
|
1065
|
-
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-
|
|
1109
|
+
var ActiveDragDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./active-drag-drop-area-0467c118.cjs.dev.js'); }));
|
|
1066
1110
|
|
|
1067
|
-
var DisabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./disabled-drop-area-
|
|
1111
|
+
var DisabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./disabled-drop-area-4a639dbf.cjs.dev.js'); }));
|
|
1068
1112
|
|
|
1069
|
-
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-
|
|
1113
|
+
var EnabledDropArea = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./enabled-drop-area-a4a76650.cjs.dev.js'); }));
|
|
1070
1114
|
|
|
1071
|
-
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-
|
|
1115
|
+
var FileDropped = /*#__PURE__*/React.lazy(() => Promise.resolve().then(function () { return require('./file-dropped-area-9387283c.cjs.dev.js'); }));
|
|
1072
1116
|
|
|
1073
1117
|
function getDropArea(_ref) {
|
|
1074
1118
|
let dropAreaState = _ref.dropAreaState,
|
|
@@ -1390,12 +1434,24 @@ const useImportPermission = () => {
|
|
|
1390
1434
|
const canManageProducts = permissions.useIsAuthorized({
|
|
1391
1435
|
demandedPermissions: [PERMISSIONS.ManageProducts]
|
|
1392
1436
|
});
|
|
1393
|
-
const
|
|
1437
|
+
const canManageCustomers = permissions.useIsAuthorized({
|
|
1438
|
+
demandedPermissions: [PERMISSIONS.ManageCustomers]
|
|
1439
|
+
});
|
|
1440
|
+
const canManageOrders = permissions.useIsAuthorized({
|
|
1441
|
+
demandedPermissions: [PERMISSIONS.ManageOrders]
|
|
1442
|
+
});
|
|
1443
|
+
const canManageKeyValueDocuments = permissions.useIsAuthorized({
|
|
1444
|
+
demandedPermissions: [PERMISSIONS.ManageKeyValueDocuments]
|
|
1445
|
+
});
|
|
1446
|
+
const canMAnageCategories = permissions.useIsAuthorized({
|
|
1394
1447
|
demandedPermissions: [PERMISSIONS.ManageCategories]
|
|
1395
1448
|
});
|
|
1396
|
-
const
|
|
1449
|
+
const canManageDiscountCodes = permissions.useIsAuthorized({
|
|
1397
1450
|
demandedPermissions: [PERMISSIONS.ManageDiscountCodes]
|
|
1398
1451
|
});
|
|
1452
|
+
const canManageBusinessUnits = permissions.useIsAuthorized({
|
|
1453
|
+
demandedPermissions: [PERMISSIONS.ManageBusinessUnits]
|
|
1454
|
+
});
|
|
1399
1455
|
const canImportProducts = React.useMemo(() => {
|
|
1400
1456
|
if (!actionRights) return false;
|
|
1401
1457
|
const canAddPrices = actionRights.canAddPrices,
|
|
@@ -1404,12 +1460,17 @@ const useImportPermission = () => {
|
|
|
1404
1460
|
canEditPrices = actionRights.canEditPrices;
|
|
1405
1461
|
return canManageProducts && canAddPrices && canAddProducts && canEditAttributesAll && canEditPrices;
|
|
1406
1462
|
}, [canManageProducts, actionRights]);
|
|
1463
|
+
const canManageCustomObjects = React.useMemo(() => {
|
|
1464
|
+
return canManageProducts || canManageCustomers || canManageOrders || canManageKeyValueDocuments;
|
|
1465
|
+
}, [canManageCustomers, canManageOrders, canManageProducts, canManageKeyValueDocuments]);
|
|
1407
1466
|
return {
|
|
1408
1467
|
canImportProducts,
|
|
1409
|
-
canImportCategories,
|
|
1410
|
-
canImportDiscountCodes,
|
|
1468
|
+
canImportCategories: canMAnageCategories,
|
|
1469
|
+
canImportDiscountCodes: canManageDiscountCodes,
|
|
1470
|
+
canImportBusinessUnits: canManageBusinessUnits,
|
|
1411
1471
|
canImportInventories: canManageProducts,
|
|
1412
|
-
canImportProductTypes: canManageProducts
|
|
1472
|
+
canImportProductTypes: canManageProducts,
|
|
1473
|
+
canImportCustomObjects: canManageCustomObjects
|
|
1413
1474
|
};
|
|
1414
1475
|
};
|
|
1415
1476
|
|
|
@@ -2482,17 +2543,17 @@ const getChunkImport = locale => {
|
|
|
2482
2543
|
const intlLocale = i18n.mapLocaleToIntlLocale(locale);
|
|
2483
2544
|
switch (intlLocale) {
|
|
2484
2545
|
case 'de':
|
|
2485
|
-
return Promise.resolve().then(function () { return require(
|
|
2546
|
+
return Promise.resolve().then(function () { return require('./de-db4fb974.cjs.dev.js'); });
|
|
2486
2547
|
case 'es':
|
|
2487
|
-
return Promise.resolve().then(function () { return require(
|
|
2548
|
+
return Promise.resolve().then(function () { return require('./es-420f21e1.cjs.dev.js'); });
|
|
2488
2549
|
case 'fr-FR':
|
|
2489
|
-
return Promise.resolve().then(function () { return require(
|
|
2550
|
+
return Promise.resolve().then(function () { return require('./fr-FR-342599f4.cjs.dev.js'); });
|
|
2490
2551
|
case 'ja':
|
|
2491
|
-
return Promise.resolve().then(function () { return require(
|
|
2552
|
+
return Promise.resolve().then(function () { return require('./ja-9bd5f452.cjs.dev.js'); });
|
|
2492
2553
|
case 'pt-BR':
|
|
2493
|
-
return Promise.resolve().then(function () { return require(
|
|
2554
|
+
return Promise.resolve().then(function () { return require('./pt-BR-339ed808.cjs.dev.js'); });
|
|
2494
2555
|
default:
|
|
2495
|
-
return Promise.resolve().then(function () { return require(
|
|
2556
|
+
return Promise.resolve().then(function () { return require('./en-f53130d1.cjs.dev.js'); });
|
|
2496
2557
|
}
|
|
2497
2558
|
};
|
|
2498
2559
|
const loadMessages = async locale => {
|