@commercetools-frontend-extensions/export-resources-modal 4.6.10 → 4.6.12
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.
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
6
|
+
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
7
|
+
var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
8
|
+
var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
|
|
9
|
+
var _endsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/ends-with');
|
|
10
|
+
var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
5
11
|
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
6
12
|
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
7
13
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
@@ -10,7 +16,6 @@ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/in
|
|
|
10
16
|
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
11
17
|
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
12
18
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
13
|
-
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
14
19
|
var reactIntl = require('react-intl');
|
|
15
20
|
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
16
21
|
var uiKit = require('@commercetools-frontend/ui-kit');
|
|
@@ -26,7 +31,6 @@ var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibl
|
|
|
26
31
|
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
27
32
|
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
28
33
|
var _wrapNativeSuper = require('@babel/runtime-corejs3/helpers/wrapNativeSuper');
|
|
29
|
-
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
30
34
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
31
35
|
var experimentalComponents = require('@commercetools-frontend/experimental-components');
|
|
32
36
|
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
@@ -39,7 +43,6 @@ var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-arr
|
|
|
39
43
|
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
40
44
|
var _sortInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/sort');
|
|
41
45
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
42
|
-
var moment = require('moment');
|
|
43
46
|
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
44
47
|
var constants = require('@commercetools-frontend/constants');
|
|
45
48
|
var sdk = require('@commercetools-frontend/sdk');
|
|
@@ -57,6 +60,10 @@ var sentry = require('@commercetools-frontend/sentry');
|
|
|
57
60
|
|
|
58
61
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
59
62
|
|
|
63
|
+
var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries);
|
|
64
|
+
var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
|
|
65
|
+
var _endsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_endsWithInstanceProperty);
|
|
66
|
+
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
60
67
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
61
68
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
62
69
|
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
@@ -79,7 +86,6 @@ var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
|
79
86
|
var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
80
87
|
var _sortInstanceProperty__default = /*#__PURE__*/_interopDefault(_sortInstanceProperty);
|
|
81
88
|
var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
|
|
82
|
-
var moment__default = /*#__PURE__*/_interopDefault(moment);
|
|
83
89
|
var sortBy__default = /*#__PURE__*/_interopDefault(sortBy);
|
|
84
90
|
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
85
91
|
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
@@ -485,7 +491,7 @@ let MissingExportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
|
485
491
|
}
|
|
486
492
|
_inherits(MissingExportResourceProviderError, _Error);
|
|
487
493
|
return _createClass(MissingExportResourceProviderError);
|
|
488
|
-
}(
|
|
494
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
489
495
|
|
|
490
496
|
function _callSuper$2(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$2() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
491
497
|
function _isNativeReflectConstruct$2() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$2 = function () { return !!t; })(); }
|
|
@@ -499,7 +505,7 @@ let UnexpectedExportOperationStateError = /*#__PURE__*/function (_Error) {
|
|
|
499
505
|
}
|
|
500
506
|
_inherits(UnexpectedExportOperationStateError, _Error);
|
|
501
507
|
return _createClass(UnexpectedExportOperationStateError);
|
|
502
|
-
}(
|
|
508
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
503
509
|
|
|
504
510
|
function _callSuper$1(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
505
511
|
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function () { return !!t; })(); }
|
|
@@ -513,7 +519,7 @@ let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
|
|
|
513
519
|
}
|
|
514
520
|
_inherits(UnexpectedResourceTypeError, _Error);
|
|
515
521
|
return _createClass(UnexpectedResourceTypeError);
|
|
516
|
-
}(
|
|
522
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
517
523
|
|
|
518
524
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
519
525
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
@@ -527,7 +533,7 @@ let InvalidResponseError = /*#__PURE__*/function (_Error) {
|
|
|
527
533
|
}
|
|
528
534
|
_inherits(InvalidResponseError, _Error);
|
|
529
535
|
return _createClass(InvalidResponseError);
|
|
530
|
-
}(
|
|
536
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
531
537
|
|
|
532
538
|
function useExportResourcesModalContext() {
|
|
533
539
|
const context = React.useContext(ExportResourcesContext);
|
|
@@ -662,8 +668,26 @@ function validate(_ref) {
|
|
|
662
668
|
return omitEmpty__default["default"](errors);
|
|
663
669
|
}
|
|
664
670
|
|
|
665
|
-
function resourceTypeToFileName(resourceType) {
|
|
666
|
-
|
|
671
|
+
function resourceTypeToFileName(resourceType, locale) {
|
|
672
|
+
var _context;
|
|
673
|
+
const date = new Date();
|
|
674
|
+
const dateFormatter = new Intl.DateTimeFormat(locale, {
|
|
675
|
+
year: '2-digit',
|
|
676
|
+
month: '2-digit',
|
|
677
|
+
day: '2-digit',
|
|
678
|
+
hour: '2-digit',
|
|
679
|
+
minute: '2-digit',
|
|
680
|
+
hour12: false
|
|
681
|
+
});
|
|
682
|
+
const parts = dateFormatter.formatToParts(date);
|
|
683
|
+
const dateParts = _reduceInstanceProperty__default["default"](parts).call(parts, (acc, part) => {
|
|
684
|
+
if (part.type !== 'literal') {
|
|
685
|
+
acc[part.type] = part.value;
|
|
686
|
+
}
|
|
687
|
+
return acc;
|
|
688
|
+
}, {});
|
|
689
|
+
const orderedDateParts = _mapInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](parts).call(parts, part => part.type === 'day' || part.type === 'month' || part.type === 'year')).call(_context, part => dateParts[part.type]).join('-');
|
|
690
|
+
const formattedDate = `${orderedDateParts}_${dateParts.hour}-${dateParts.minute}`;
|
|
667
691
|
const resourceTypeMap = {
|
|
668
692
|
[EXPORTABLE_RESOURCES.CATEGORY]: 'Categories',
|
|
669
693
|
[EXPORTABLE_RESOURCES.PRODUCT]: 'Products',
|
|
@@ -677,7 +701,7 @@ function resourceTypeToFileName(resourceType) {
|
|
|
677
701
|
if (!displayName) {
|
|
678
702
|
throw new UnexpectedResourceTypeError(resourceType);
|
|
679
703
|
}
|
|
680
|
-
return `${displayName}_Export_${
|
|
704
|
+
return `${displayName}_Export_${formattedDate}`;
|
|
681
705
|
}
|
|
682
706
|
function mapLocalesToOptions(locales) {
|
|
683
707
|
return _mapInstanceProperty__default["default"](locales).call(locales, locale => ({
|
|
@@ -881,9 +905,11 @@ const updateFieldDependenciesStatus = formik => {
|
|
|
881
905
|
const useInitialValues = props => {
|
|
882
906
|
var _context;
|
|
883
907
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
884
|
-
locale: applicationContext.dataLocale
|
|
908
|
+
locale: applicationContext.dataLocale,
|
|
909
|
+
userLocale: applicationContext.user?.locale
|
|
885
910
|
})),
|
|
886
|
-
locale = _useApplicationContex.locale
|
|
911
|
+
locale = _useApplicationContex.locale,
|
|
912
|
+
userLocale = _useApplicationContex.userLocale;
|
|
887
913
|
const _useApplicationContex2 = applicationShellConnectors.useApplicationContext(context => ({
|
|
888
914
|
projectKey: context.project?.key
|
|
889
915
|
})),
|
|
@@ -904,11 +930,11 @@ const useInitialValues = props => {
|
|
|
904
930
|
groups = updateFieldGroupsWithIsExpandedValue(groups, cachedExpandedGroups[props.resourceType] || {});
|
|
905
931
|
return {
|
|
906
932
|
outputFormat: props.outputFormat,
|
|
907
|
-
fileName: `${resourceTypeToFileName(props.resourceType)}`,
|
|
933
|
+
fileName: `${resourceTypeToFileName(props.resourceType, userLocale)}`,
|
|
908
934
|
locales: [locale],
|
|
909
935
|
groups: updateFieldGroupWithAdditionalFieldExtensions(groups)
|
|
910
936
|
};
|
|
911
|
-
}, [props.fieldGroups, props.resourceType, props.outputFormat, cachedSelectedGroups, cachedExpandedGroups, locale]);
|
|
937
|
+
}, [props.fieldGroups, props.resourceType, props.outputFormat, cachedSelectedGroups, cachedExpandedGroups, locale, userLocale]);
|
|
912
938
|
};
|
|
913
939
|
|
|
914
940
|
async function createExportOperation(_ref, asyncDispatchFn) {
|
|
@@ -1871,19 +1897,19 @@ const getChunkImport = locale => {
|
|
|
1871
1897
|
const intlLocale = i18n.mapLocaleToIntlLocale(locale);
|
|
1872
1898
|
switch (intlLocale) {
|
|
1873
1899
|
case 'de':
|
|
1874
|
-
return Promise.resolve().then(function () { return require(
|
|
1900
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "export-resources-modal-i18n-de" */'./de-d4a85a4f.cjs.dev.js'); });
|
|
1875
1901
|
case 'es':
|
|
1876
|
-
return Promise.resolve().then(function () { return require(
|
|
1902
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "export-resources-modal-i18n-es" */'./es-b1808cc2.cjs.dev.js'); });
|
|
1877
1903
|
case 'fr-FR':
|
|
1878
|
-
return Promise.resolve().then(function () { return require(
|
|
1904
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "export-resources-modal-i18n-fr-FR" */'./fr-FR-bf242ea4.cjs.dev.js'); });
|
|
1879
1905
|
case 'zh-CN':
|
|
1880
|
-
return Promise.resolve().then(function () { return require(
|
|
1906
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "export-resources-modal-i18n-zh-CN" */'./zh-CN-03a85de5.cjs.dev.js'); });
|
|
1881
1907
|
case 'ja':
|
|
1882
|
-
return Promise.resolve().then(function () { return require(
|
|
1908
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "export-resources-modal-i18n-ja" */'./ja-9bd5f452.cjs.dev.js'); });
|
|
1883
1909
|
case 'pt-BR':
|
|
1884
|
-
return Promise.resolve().then(function () { return require(
|
|
1910
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "change-history-i18n-pt-BR" */'./pt-BR-6754aa85.cjs.dev.js'); });
|
|
1885
1911
|
default:
|
|
1886
|
-
return Promise.resolve().then(function () { return require(
|
|
1912
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "export-resources-modal-i18n-en" */'./en-f3054f24.cjs.dev.js'); });
|
|
1887
1913
|
}
|
|
1888
1914
|
};
|
|
1889
1915
|
const loadMessages = async locale => {
|
|
@@ -1937,6 +1963,23 @@ const useAsyncIntlMessages = (locale, loader) => {
|
|
|
1937
1963
|
|
|
1938
1964
|
function ownKeys(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; }
|
|
1939
1965
|
function _objectSpread(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(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(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1966
|
+
function invalidateLaunchDarklyCachedFeatureFlag(flagName) {
|
|
1967
|
+
for (let _ref of _Object$entries__default["default"](localStorage)) {
|
|
1968
|
+
var _ref2 = _slicedToArray(_ref, 1);
|
|
1969
|
+
let key = _ref2[0];
|
|
1970
|
+
// This is the pattern that the LaunchDarkly adapter uses to store the flags
|
|
1971
|
+
if (_startsWithInstanceProperty__default["default"](key).call(key, '@flopflip/launchdarkly-adapter/') && _endsWithInstanceProperty__default["default"](key).call(key, '/flags')) {
|
|
1972
|
+
try {
|
|
1973
|
+
const flags = JSON.parse(localStorage.getItem(key) || '{}');
|
|
1974
|
+
if (flags[flagName] !== undefined) {
|
|
1975
|
+
delete flags[flagName];
|
|
1976
|
+
localStorage.setItem(key, _JSON$stringify__default["default"](flags));
|
|
1977
|
+
}
|
|
1978
|
+
} catch (error) {}
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
invalidateLaunchDarklyCachedFeatureFlag('enableOperationsExport');
|
|
1940
1983
|
const ExportResourcesModal = props => {
|
|
1941
1984
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
1942
1985
|
locale: context.user && context.user.locale
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
6
|
+
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
7
|
+
var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
8
|
+
var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
|
|
9
|
+
var _endsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/ends-with');
|
|
10
|
+
var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
5
11
|
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
6
12
|
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
7
13
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
@@ -10,7 +16,6 @@ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/in
|
|
|
10
16
|
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
11
17
|
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
12
18
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
13
|
-
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
14
19
|
var reactIntl = require('react-intl');
|
|
15
20
|
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
16
21
|
var uiKit = require('@commercetools-frontend/ui-kit');
|
|
@@ -26,7 +31,6 @@ var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibl
|
|
|
26
31
|
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
27
32
|
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
28
33
|
var _wrapNativeSuper = require('@babel/runtime-corejs3/helpers/wrapNativeSuper');
|
|
29
|
-
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
30
34
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
31
35
|
var experimentalComponents = require('@commercetools-frontend/experimental-components');
|
|
32
36
|
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
@@ -39,7 +43,6 @@ var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-arr
|
|
|
39
43
|
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
40
44
|
var _sortInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/sort');
|
|
41
45
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
42
|
-
var moment = require('moment');
|
|
43
46
|
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
44
47
|
var constants = require('@commercetools-frontend/constants');
|
|
45
48
|
var sdk = require('@commercetools-frontend/sdk');
|
|
@@ -57,6 +60,10 @@ var sentry = require('@commercetools-frontend/sentry');
|
|
|
57
60
|
|
|
58
61
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
59
62
|
|
|
63
|
+
var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries);
|
|
64
|
+
var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
|
|
65
|
+
var _endsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_endsWithInstanceProperty);
|
|
66
|
+
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
60
67
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
61
68
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
62
69
|
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
@@ -79,7 +86,6 @@ var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
|
79
86
|
var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
80
87
|
var _sortInstanceProperty__default = /*#__PURE__*/_interopDefault(_sortInstanceProperty);
|
|
81
88
|
var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
|
|
82
|
-
var moment__default = /*#__PURE__*/_interopDefault(moment);
|
|
83
89
|
var sortBy__default = /*#__PURE__*/_interopDefault(sortBy);
|
|
84
90
|
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
85
91
|
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
@@ -485,7 +491,7 @@ let MissingExportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
|
485
491
|
}
|
|
486
492
|
_inherits(MissingExportResourceProviderError, _Error);
|
|
487
493
|
return _createClass(MissingExportResourceProviderError);
|
|
488
|
-
}(
|
|
494
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
489
495
|
|
|
490
496
|
function _callSuper$2(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$2() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
491
497
|
function _isNativeReflectConstruct$2() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$2 = function () { return !!t; })(); }
|
|
@@ -499,7 +505,7 @@ let UnexpectedExportOperationStateError = /*#__PURE__*/function (_Error) {
|
|
|
499
505
|
}
|
|
500
506
|
_inherits(UnexpectedExportOperationStateError, _Error);
|
|
501
507
|
return _createClass(UnexpectedExportOperationStateError);
|
|
502
|
-
}(
|
|
508
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
503
509
|
|
|
504
510
|
function _callSuper$1(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
505
511
|
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function () { return !!t; })(); }
|
|
@@ -513,7 +519,7 @@ let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
|
|
|
513
519
|
}
|
|
514
520
|
_inherits(UnexpectedResourceTypeError, _Error);
|
|
515
521
|
return _createClass(UnexpectedResourceTypeError);
|
|
516
|
-
}(
|
|
522
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
517
523
|
|
|
518
524
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
519
525
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
@@ -527,7 +533,7 @@ let InvalidResponseError = /*#__PURE__*/function (_Error) {
|
|
|
527
533
|
}
|
|
528
534
|
_inherits(InvalidResponseError, _Error);
|
|
529
535
|
return _createClass(InvalidResponseError);
|
|
530
|
-
}(
|
|
536
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
531
537
|
|
|
532
538
|
function useExportResourcesModalContext() {
|
|
533
539
|
const context = React.useContext(ExportResourcesContext);
|
|
@@ -662,8 +668,26 @@ function validate(_ref) {
|
|
|
662
668
|
return omitEmpty__default["default"](errors);
|
|
663
669
|
}
|
|
664
670
|
|
|
665
|
-
function resourceTypeToFileName(resourceType) {
|
|
666
|
-
|
|
671
|
+
function resourceTypeToFileName(resourceType, locale) {
|
|
672
|
+
var _context;
|
|
673
|
+
const date = new Date();
|
|
674
|
+
const dateFormatter = new Intl.DateTimeFormat(locale, {
|
|
675
|
+
year: '2-digit',
|
|
676
|
+
month: '2-digit',
|
|
677
|
+
day: '2-digit',
|
|
678
|
+
hour: '2-digit',
|
|
679
|
+
minute: '2-digit',
|
|
680
|
+
hour12: false
|
|
681
|
+
});
|
|
682
|
+
const parts = dateFormatter.formatToParts(date);
|
|
683
|
+
const dateParts = _reduceInstanceProperty__default["default"](parts).call(parts, (acc, part) => {
|
|
684
|
+
if (part.type !== 'literal') {
|
|
685
|
+
acc[part.type] = part.value;
|
|
686
|
+
}
|
|
687
|
+
return acc;
|
|
688
|
+
}, {});
|
|
689
|
+
const orderedDateParts = _mapInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](parts).call(parts, part => part.type === 'day' || part.type === 'month' || part.type === 'year')).call(_context, part => dateParts[part.type]).join('-');
|
|
690
|
+
const formattedDate = `${orderedDateParts}_${dateParts.hour}-${dateParts.minute}`;
|
|
667
691
|
const resourceTypeMap = {
|
|
668
692
|
[EXPORTABLE_RESOURCES.CATEGORY]: 'Categories',
|
|
669
693
|
[EXPORTABLE_RESOURCES.PRODUCT]: 'Products',
|
|
@@ -677,7 +701,7 @@ function resourceTypeToFileName(resourceType) {
|
|
|
677
701
|
if (!displayName) {
|
|
678
702
|
throw new UnexpectedResourceTypeError(resourceType);
|
|
679
703
|
}
|
|
680
|
-
return `${displayName}_Export_${
|
|
704
|
+
return `${displayName}_Export_${formattedDate}`;
|
|
681
705
|
}
|
|
682
706
|
function mapLocalesToOptions(locales) {
|
|
683
707
|
return _mapInstanceProperty__default["default"](locales).call(locales, locale => ({
|
|
@@ -881,9 +905,11 @@ const updateFieldDependenciesStatus = formik => {
|
|
|
881
905
|
const useInitialValues = props => {
|
|
882
906
|
var _context;
|
|
883
907
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
884
|
-
locale: applicationContext.dataLocale
|
|
908
|
+
locale: applicationContext.dataLocale,
|
|
909
|
+
userLocale: applicationContext.user?.locale
|
|
885
910
|
})),
|
|
886
|
-
locale = _useApplicationContex.locale
|
|
911
|
+
locale = _useApplicationContex.locale,
|
|
912
|
+
userLocale = _useApplicationContex.userLocale;
|
|
887
913
|
const _useApplicationContex2 = applicationShellConnectors.useApplicationContext(context => ({
|
|
888
914
|
projectKey: context.project?.key
|
|
889
915
|
})),
|
|
@@ -904,11 +930,11 @@ const useInitialValues = props => {
|
|
|
904
930
|
groups = updateFieldGroupsWithIsExpandedValue(groups, cachedExpandedGroups[props.resourceType] || {});
|
|
905
931
|
return {
|
|
906
932
|
outputFormat: props.outputFormat,
|
|
907
|
-
fileName: `${resourceTypeToFileName(props.resourceType)}`,
|
|
933
|
+
fileName: `${resourceTypeToFileName(props.resourceType, userLocale)}`,
|
|
908
934
|
locales: [locale],
|
|
909
935
|
groups: updateFieldGroupWithAdditionalFieldExtensions(groups)
|
|
910
936
|
};
|
|
911
|
-
}, [props.fieldGroups, props.resourceType, props.outputFormat, cachedSelectedGroups, cachedExpandedGroups, locale]);
|
|
937
|
+
}, [props.fieldGroups, props.resourceType, props.outputFormat, cachedSelectedGroups, cachedExpandedGroups, locale, userLocale]);
|
|
912
938
|
};
|
|
913
939
|
|
|
914
940
|
async function createExportOperation(_ref, asyncDispatchFn) {
|
|
@@ -1838,19 +1864,19 @@ const getChunkImport = locale => {
|
|
|
1838
1864
|
const intlLocale = i18n.mapLocaleToIntlLocale(locale);
|
|
1839
1865
|
switch (intlLocale) {
|
|
1840
1866
|
case 'de':
|
|
1841
|
-
return Promise.resolve().then(function () { return require(
|
|
1867
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "export-resources-modal-i18n-de" */'./de-16b6e603.cjs.prod.js'); });
|
|
1842
1868
|
case 'es':
|
|
1843
|
-
return Promise.resolve().then(function () { return require(
|
|
1869
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "export-resources-modal-i18n-es" */'./es-f37701ea.cjs.prod.js'); });
|
|
1844
1870
|
case 'fr-FR':
|
|
1845
|
-
return Promise.resolve().then(function () { return require(
|
|
1871
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "export-resources-modal-i18n-fr-FR" */'./fr-FR-66c381ea.cjs.prod.js'); });
|
|
1846
1872
|
case 'zh-CN':
|
|
1847
|
-
return Promise.resolve().then(function () { return require(
|
|
1873
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "export-resources-modal-i18n-zh-CN" */'./zh-CN-e22002dc.cjs.prod.js'); });
|
|
1848
1874
|
case 'ja':
|
|
1849
|
-
return Promise.resolve().then(function () { return require(
|
|
1875
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "export-resources-modal-i18n-ja" */'./ja-37632763.cjs.prod.js'); });
|
|
1850
1876
|
case 'pt-BR':
|
|
1851
|
-
return Promise.resolve().then(function () { return require(
|
|
1877
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "change-history-i18n-pt-BR" */'./pt-BR-ebc555b4.cjs.prod.js'); });
|
|
1852
1878
|
default:
|
|
1853
|
-
return Promise.resolve().then(function () { return require(
|
|
1879
|
+
return Promise.resolve().then(function () { return require(/* webpackChunkName: "export-resources-modal-i18n-en" */'./en-6be5d801.cjs.prod.js'); });
|
|
1854
1880
|
}
|
|
1855
1881
|
};
|
|
1856
1882
|
const loadMessages = async locale => {
|
|
@@ -1904,6 +1930,23 @@ const useAsyncIntlMessages = (locale, loader) => {
|
|
|
1904
1930
|
|
|
1905
1931
|
function ownKeys(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; }
|
|
1906
1932
|
function _objectSpread(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(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(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1933
|
+
function invalidateLaunchDarklyCachedFeatureFlag(flagName) {
|
|
1934
|
+
for (let _ref of _Object$entries__default["default"](localStorage)) {
|
|
1935
|
+
var _ref2 = _slicedToArray(_ref, 1);
|
|
1936
|
+
let key = _ref2[0];
|
|
1937
|
+
// This is the pattern that the LaunchDarkly adapter uses to store the flags
|
|
1938
|
+
if (_startsWithInstanceProperty__default["default"](key).call(key, '@flopflip/launchdarkly-adapter/') && _endsWithInstanceProperty__default["default"](key).call(key, '/flags')) {
|
|
1939
|
+
try {
|
|
1940
|
+
const flags = JSON.parse(localStorage.getItem(key) || '{}');
|
|
1941
|
+
if (flags[flagName] !== undefined) {
|
|
1942
|
+
delete flags[flagName];
|
|
1943
|
+
localStorage.setItem(key, _JSON$stringify__default["default"](flags));
|
|
1944
|
+
}
|
|
1945
|
+
} catch (error) {}
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
invalidateLaunchDarklyCachedFeatureFlag('enableOperationsExport');
|
|
1907
1950
|
const ExportResourcesModal = props => {
|
|
1908
1951
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
1909
1952
|
locale: context.user && context.user.locale
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
2
|
+
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
3
|
+
import _Object$entries from '@babel/runtime-corejs3/core-js-stable/object/entries';
|
|
4
|
+
import _startsWithInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/starts-with';
|
|
5
|
+
import _endsWithInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/ends-with';
|
|
6
|
+
import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
|
|
1
7
|
import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
2
8
|
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
3
9
|
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
@@ -6,7 +12,6 @@ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/inst
|
|
|
6
12
|
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
|
7
13
|
import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
8
14
|
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
9
|
-
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
10
15
|
import { defineMessages, FormattedMessage, useIntl, IntlProvider } from 'react-intl';
|
|
11
16
|
import { useApplicationContext } from '@commercetools-frontend/application-shell-connectors';
|
|
12
17
|
import { Text, TextInput, Link, Spacings, RadioInput, Grid, designTokens, SelectField, TextField, CheckboxInput, Card, Stamp, IconButton, AngleDownIcon, AngleRightIcon, CollapsibleMotion, SearchTextInput } from '@commercetools-frontend/ui-kit';
|
|
@@ -22,7 +27,6 @@ import _possibleConstructorReturn from '@babel/runtime-corejs3/helpers/esm/possi
|
|
|
22
27
|
import _getPrototypeOf from '@babel/runtime-corejs3/helpers/esm/getPrototypeOf';
|
|
23
28
|
import _inherits from '@babel/runtime-corejs3/helpers/esm/inherits';
|
|
24
29
|
import _wrapNativeSuper from '@babel/runtime-corejs3/helpers/esm/wrapNativeSuper';
|
|
25
|
-
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
26
30
|
import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
|
|
27
31
|
import { useStorage } from '@commercetools-frontend/experimental-components';
|
|
28
32
|
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
@@ -35,7 +39,6 @@ import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array
|
|
|
35
39
|
import _Set from '@babel/runtime-corejs3/core-js-stable/set';
|
|
36
40
|
import _sortInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/sort';
|
|
37
41
|
import _indexOfInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/index-of';
|
|
38
|
-
import moment from 'moment';
|
|
39
42
|
import { useShowNotification } from '@commercetools-frontend/actions-global';
|
|
40
43
|
import { MC_API_PROXY_TARGETS, DOMAINS } from '@commercetools-frontend/constants';
|
|
41
44
|
import { actions, useAsyncDispatch } from '@commercetools-frontend/sdk';
|
|
@@ -450,7 +453,7 @@ let MissingExportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
|
450
453
|
}
|
|
451
454
|
_inherits(MissingExportResourceProviderError, _Error);
|
|
452
455
|
return _createClass(MissingExportResourceProviderError);
|
|
453
|
-
}(
|
|
456
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
454
457
|
|
|
455
458
|
function _callSuper$2(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$2() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
456
459
|
function _isNativeReflectConstruct$2() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$2 = function () { return !!t; })(); }
|
|
@@ -464,7 +467,7 @@ let UnexpectedExportOperationStateError = /*#__PURE__*/function (_Error) {
|
|
|
464
467
|
}
|
|
465
468
|
_inherits(UnexpectedExportOperationStateError, _Error);
|
|
466
469
|
return _createClass(UnexpectedExportOperationStateError);
|
|
467
|
-
}(
|
|
470
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
468
471
|
|
|
469
472
|
function _callSuper$1(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
470
473
|
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function () { return !!t; })(); }
|
|
@@ -478,7 +481,7 @@ let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
|
|
|
478
481
|
}
|
|
479
482
|
_inherits(UnexpectedResourceTypeError, _Error);
|
|
480
483
|
return _createClass(UnexpectedResourceTypeError);
|
|
481
|
-
}(
|
|
484
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
482
485
|
|
|
483
486
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
484
487
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
@@ -492,7 +495,7 @@ let InvalidResponseError = /*#__PURE__*/function (_Error) {
|
|
|
492
495
|
}
|
|
493
496
|
_inherits(InvalidResponseError, _Error);
|
|
494
497
|
return _createClass(InvalidResponseError);
|
|
495
|
-
}(
|
|
498
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
496
499
|
|
|
497
500
|
function useExportResourcesModalContext() {
|
|
498
501
|
const context = useContext(ExportResourcesContext);
|
|
@@ -627,8 +630,26 @@ function validate(_ref) {
|
|
|
627
630
|
return omitEmpty(errors);
|
|
628
631
|
}
|
|
629
632
|
|
|
630
|
-
function resourceTypeToFileName(resourceType) {
|
|
631
|
-
|
|
633
|
+
function resourceTypeToFileName(resourceType, locale) {
|
|
634
|
+
var _context;
|
|
635
|
+
const date = new Date();
|
|
636
|
+
const dateFormatter = new Intl.DateTimeFormat(locale, {
|
|
637
|
+
year: '2-digit',
|
|
638
|
+
month: '2-digit',
|
|
639
|
+
day: '2-digit',
|
|
640
|
+
hour: '2-digit',
|
|
641
|
+
minute: '2-digit',
|
|
642
|
+
hour12: false
|
|
643
|
+
});
|
|
644
|
+
const parts = dateFormatter.formatToParts(date);
|
|
645
|
+
const dateParts = _reduceInstanceProperty(parts).call(parts, (acc, part) => {
|
|
646
|
+
if (part.type !== 'literal') {
|
|
647
|
+
acc[part.type] = part.value;
|
|
648
|
+
}
|
|
649
|
+
return acc;
|
|
650
|
+
}, {});
|
|
651
|
+
const orderedDateParts = _mapInstanceProperty(_context = _filterInstanceProperty(parts).call(parts, part => part.type === 'day' || part.type === 'month' || part.type === 'year')).call(_context, part => dateParts[part.type]).join('-');
|
|
652
|
+
const formattedDate = `${orderedDateParts}_${dateParts.hour}-${dateParts.minute}`;
|
|
632
653
|
const resourceTypeMap = {
|
|
633
654
|
[EXPORTABLE_RESOURCES.CATEGORY]: 'Categories',
|
|
634
655
|
[EXPORTABLE_RESOURCES.PRODUCT]: 'Products',
|
|
@@ -642,7 +663,7 @@ function resourceTypeToFileName(resourceType) {
|
|
|
642
663
|
if (!displayName) {
|
|
643
664
|
throw new UnexpectedResourceTypeError(resourceType);
|
|
644
665
|
}
|
|
645
|
-
return `${displayName}_Export_${
|
|
666
|
+
return `${displayName}_Export_${formattedDate}`;
|
|
646
667
|
}
|
|
647
668
|
function mapLocalesToOptions(locales) {
|
|
648
669
|
return _mapInstanceProperty(locales).call(locales, locale => ({
|
|
@@ -846,9 +867,11 @@ const updateFieldDependenciesStatus = formik => {
|
|
|
846
867
|
const useInitialValues = props => {
|
|
847
868
|
var _context;
|
|
848
869
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
849
|
-
locale: applicationContext.dataLocale
|
|
870
|
+
locale: applicationContext.dataLocale,
|
|
871
|
+
userLocale: applicationContext.user?.locale
|
|
850
872
|
})),
|
|
851
|
-
locale = _useApplicationContex.locale
|
|
873
|
+
locale = _useApplicationContex.locale,
|
|
874
|
+
userLocale = _useApplicationContex.userLocale;
|
|
852
875
|
const _useApplicationContex2 = useApplicationContext(context => ({
|
|
853
876
|
projectKey: context.project?.key
|
|
854
877
|
})),
|
|
@@ -869,11 +892,11 @@ const useInitialValues = props => {
|
|
|
869
892
|
groups = updateFieldGroupsWithIsExpandedValue(groups, cachedExpandedGroups[props.resourceType] || {});
|
|
870
893
|
return {
|
|
871
894
|
outputFormat: props.outputFormat,
|
|
872
|
-
fileName: `${resourceTypeToFileName(props.resourceType)}`,
|
|
895
|
+
fileName: `${resourceTypeToFileName(props.resourceType, userLocale)}`,
|
|
873
896
|
locales: [locale],
|
|
874
897
|
groups: updateFieldGroupWithAdditionalFieldExtensions(groups)
|
|
875
898
|
};
|
|
876
|
-
}, [props.fieldGroups, props.resourceType, props.outputFormat, cachedSelectedGroups, cachedExpandedGroups, locale]);
|
|
899
|
+
}, [props.fieldGroups, props.resourceType, props.outputFormat, cachedSelectedGroups, cachedExpandedGroups, locale, userLocale]);
|
|
877
900
|
};
|
|
878
901
|
|
|
879
902
|
async function createExportOperation(_ref, asyncDispatchFn) {
|
|
@@ -1836,19 +1859,19 @@ const getChunkImport = locale => {
|
|
|
1836
1859
|
const intlLocale = mapLocaleToIntlLocale(locale);
|
|
1837
1860
|
switch (intlLocale) {
|
|
1838
1861
|
case 'de':
|
|
1839
|
-
return import(
|
|
1862
|
+
return import(/* webpackChunkName: "export-resources-modal-i18n-de" */'./de-d065df9f.esm.js');
|
|
1840
1863
|
case 'es':
|
|
1841
|
-
return import(
|
|
1864
|
+
return import(/* webpackChunkName: "export-resources-modal-i18n-es" */'./es-3072d392.esm.js');
|
|
1842
1865
|
case 'fr-FR':
|
|
1843
|
-
return import(
|
|
1866
|
+
return import(/* webpackChunkName: "export-resources-modal-i18n-fr-FR" */'./fr-FR-9be90155.esm.js');
|
|
1844
1867
|
case 'zh-CN':
|
|
1845
|
-
return import(
|
|
1868
|
+
return import(/* webpackChunkName: "export-resources-modal-i18n-zh-CN" */'./zh-CN-1da404c0.esm.js');
|
|
1846
1869
|
case 'ja':
|
|
1847
|
-
return import(
|
|
1870
|
+
return import(/* webpackChunkName: "export-resources-modal-i18n-ja" */'./ja-73c088a7.esm.js');
|
|
1848
1871
|
case 'pt-BR':
|
|
1849
|
-
return import(
|
|
1872
|
+
return import(/* webpackChunkName: "change-history-i18n-pt-BR" */'./pt-BR-5cf442aa.esm.js');
|
|
1850
1873
|
default:
|
|
1851
|
-
return import(
|
|
1874
|
+
return import(/* webpackChunkName: "export-resources-modal-i18n-en" */'./en-489b5062.esm.js');
|
|
1852
1875
|
}
|
|
1853
1876
|
};
|
|
1854
1877
|
const loadMessages = async locale => {
|
|
@@ -1902,6 +1925,23 @@ const useAsyncIntlMessages = (locale, loader) => {
|
|
|
1902
1925
|
|
|
1903
1926
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1904
1927
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1928
|
+
function invalidateLaunchDarklyCachedFeatureFlag(flagName) {
|
|
1929
|
+
for (let _ref of _Object$entries(localStorage)) {
|
|
1930
|
+
var _ref2 = _slicedToArray(_ref, 1);
|
|
1931
|
+
let key = _ref2[0];
|
|
1932
|
+
// This is the pattern that the LaunchDarkly adapter uses to store the flags
|
|
1933
|
+
if (_startsWithInstanceProperty(key).call(key, '@flopflip/launchdarkly-adapter/') && _endsWithInstanceProperty(key).call(key, '/flags')) {
|
|
1934
|
+
try {
|
|
1935
|
+
const flags = JSON.parse(localStorage.getItem(key) || '{}');
|
|
1936
|
+
if (flags[flagName] !== undefined) {
|
|
1937
|
+
delete flags[flagName];
|
|
1938
|
+
localStorage.setItem(key, _JSON$stringify(flags));
|
|
1939
|
+
}
|
|
1940
|
+
} catch (error) {}
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
invalidateLaunchDarklyCachedFeatureFlag('enableOperationsExport');
|
|
1905
1945
|
const ExportResourcesModal = props => {
|
|
1906
1946
|
const _useApplicationContex = useApplicationContext(context => ({
|
|
1907
1947
|
locale: context.user && context.user.locale
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend-extensions/export-resources-modal",
|
|
3
3
|
"description": "Shared export modal for exporting resources",
|
|
4
|
-
"version": "4.6.
|
|
4
|
+
"version": "4.6.12",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@babel/runtime": "7.25.6",
|
|
19
19
|
"@babel/runtime-corejs3": "7.25.6",
|
|
20
|
-
"@commercetools-frontend/experimental-components": "6.2.
|
|
20
|
+
"@commercetools-frontend/experimental-components": "6.2.1",
|
|
21
21
|
"@commercetools-frontend/fullstory": "2.4.5",
|
|
22
22
|
"@emotion/react": "11.13.3",
|
|
23
23
|
"@emotion/styled": "11.13.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@types/jest": "29.5.13",
|
|
48
48
|
"@types/testing-library__jest-dom": "^5.14.5",
|
|
49
49
|
"msw": "1.3.4",
|
|
50
|
-
"react-intl": "6.
|
|
50
|
+
"react-intl": "6.7.0",
|
|
51
51
|
"react-redux": "7.2.9",
|
|
52
52
|
"redux": "4.2.1",
|
|
53
53
|
"rimraf": "6.0.1"
|