@commercetools-frontend/experimental-components 6.0.2 → 6.1.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/commercetools-frontend-experimental-components.cjs.dev.js +911 -757
- package/dist/commercetools-frontend-experimental-components.cjs.prod.js +908 -754
- package/dist/commercetools-frontend-experimental-components.esm.js +905 -756
- package/dist/styles.css +41 -41
- package/package.json +17 -17
|
@@ -30,12 +30,14 @@ var l10n = require('@commercetools-frontend/l10n');
|
|
|
30
30
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
31
31
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
32
32
|
var camelCase = require('lodash/camelCase');
|
|
33
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
33
34
|
var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
|
|
34
35
|
var _sortInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/sort');
|
|
35
36
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
36
37
|
var fastEquals = require('fast-equals');
|
|
37
38
|
var reactIntl = require('react-intl');
|
|
38
39
|
var omitEmpty = require('omit-empty-es');
|
|
40
|
+
var _taggedTemplateLiteral = require('@babel/runtime-corejs3/helpers/taggedTemplateLiteral');
|
|
39
41
|
var oneLine = require('common-tags/lib/oneLine');
|
|
40
42
|
var moment = require('moment-timezone');
|
|
41
43
|
var isNil$1 = require('lodash/isNil');
|
|
@@ -64,7 +66,6 @@ var hooks = require('@apollo/client/react/hooks');
|
|
|
64
66
|
var moment$1 = require('moment');
|
|
65
67
|
var classnames = require('classnames');
|
|
66
68
|
require('react-required-if');
|
|
67
|
-
var _assertThisInitialized = require('@babel/runtime-corejs3/helpers/assertThisInitialized');
|
|
68
69
|
var Textarea = require('react-textarea-autosize');
|
|
69
70
|
var has = require('lodash/has');
|
|
70
71
|
var _toArray = require('@babel/runtime-corejs3/helpers/toArray');
|
|
@@ -78,6 +79,7 @@ var omit = require('lodash/omit');
|
|
|
78
79
|
var isEmpty$3 = require('lodash/isEmpty');
|
|
79
80
|
var _Object$freeze = require('@babel/runtime-corejs3/core-js-stable/object/freeze');
|
|
80
81
|
var originalOmitDeep = require('omit-deep');
|
|
82
|
+
var _findIndexInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find-index');
|
|
81
83
|
var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
|
|
82
84
|
var _parseInt = require('@babel/runtime-corejs3/core-js-stable/parse-int');
|
|
83
85
|
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
@@ -105,14 +107,12 @@ var flatMap = require('lodash/flatMap');
|
|
|
105
107
|
var reactRedux = require('react-redux');
|
|
106
108
|
var commonTags = require('common-tags');
|
|
107
109
|
require('tiny-warning');
|
|
108
|
-
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
109
110
|
var _Math$trunc = require('@babel/runtime-corejs3/core-js-stable/math/trunc');
|
|
110
111
|
var _Number$isNaN = require('@babel/runtime-corejs3/core-js-stable/number/is-nan');
|
|
111
112
|
var isUndefined = require('lodash/isUndefined');
|
|
112
113
|
var isFinite = require('lodash/isFinite');
|
|
113
114
|
var Cleave = require('cleave.js/react');
|
|
114
115
|
var _Object$assign = require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
115
|
-
var _findIndexInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find-index');
|
|
116
116
|
var compact = require('lodash/compact');
|
|
117
117
|
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
118
118
|
require('@babel/runtime-corejs3/helpers/get');
|
|
@@ -139,6 +139,7 @@ var uniqBy__default = /*#__PURE__*/_interopDefault(uniqBy);
|
|
|
139
139
|
var invariant__default = /*#__PURE__*/_interopDefault(invariant);
|
|
140
140
|
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
141
141
|
var camelCase__default = /*#__PURE__*/_interopDefault(camelCase);
|
|
142
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
142
143
|
var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
|
|
143
144
|
var _sortInstanceProperty__default = /*#__PURE__*/_interopDefault(_sortInstanceProperty);
|
|
144
145
|
var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
|
|
@@ -167,6 +168,7 @@ var omit__default = /*#__PURE__*/_interopDefault(omit);
|
|
|
167
168
|
var isEmpty__default = /*#__PURE__*/_interopDefault(isEmpty$3);
|
|
168
169
|
var _Object$freeze__default = /*#__PURE__*/_interopDefault(_Object$freeze);
|
|
169
170
|
var originalOmitDeep__default = /*#__PURE__*/_interopDefault(originalOmitDeep);
|
|
171
|
+
var _findIndexInstanceProperty__default = /*#__PURE__*/_interopDefault(_findIndexInstanceProperty);
|
|
170
172
|
var _Object$values__default = /*#__PURE__*/_interopDefault(_Object$values);
|
|
171
173
|
var _parseInt__default = /*#__PURE__*/_interopDefault(_parseInt);
|
|
172
174
|
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
@@ -184,14 +186,12 @@ var merge__default = /*#__PURE__*/_interopDefault(merge);
|
|
|
184
186
|
var set__default = /*#__PURE__*/_interopDefault(set);
|
|
185
187
|
var memoize__default = /*#__PURE__*/_interopDefault(memoize);
|
|
186
188
|
var flatMap__default = /*#__PURE__*/_interopDefault(flatMap);
|
|
187
|
-
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
188
189
|
var _Math$trunc__default = /*#__PURE__*/_interopDefault(_Math$trunc);
|
|
189
190
|
var _Number$isNaN__default = /*#__PURE__*/_interopDefault(_Number$isNaN);
|
|
190
191
|
var isUndefined__default = /*#__PURE__*/_interopDefault(isUndefined);
|
|
191
192
|
var isFinite__default = /*#__PURE__*/_interopDefault(isFinite);
|
|
192
193
|
var Cleave__default = /*#__PURE__*/_interopDefault(Cleave);
|
|
193
194
|
var _Object$assign__default = /*#__PURE__*/_interopDefault(_Object$assign);
|
|
194
|
-
var _findIndexInstanceProperty__default = /*#__PURE__*/_interopDefault(_findIndexInstanceProperty);
|
|
195
195
|
var compact__default = /*#__PURE__*/_interopDefault(compact);
|
|
196
196
|
var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
197
197
|
var _spliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_spliceInstanceProperty);
|
|
@@ -292,7 +292,7 @@ function filterDataAttributes(obj) {
|
|
|
292
292
|
* duplicated in original values
|
|
293
293
|
*/
|
|
294
294
|
function unique(values, properties) {
|
|
295
|
-
var
|
|
295
|
+
var _context2;
|
|
296
296
|
let ignoredValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['', null, undefined];
|
|
297
297
|
const duplicateValues = [];
|
|
298
298
|
let realValues;
|
|
@@ -301,19 +301,20 @@ function unique(values, properties) {
|
|
|
301
301
|
realValues = _filterInstanceProperty__default["default"](values).call(values, value => !_includesInstanceProperty__default["default"](ignoredValues).call(ignoredValues, value));
|
|
302
302
|
if (!realValues.length) return [];
|
|
303
303
|
if (properties) realValues = _mapInstanceProperty__default["default"](realValues).call(realValues, value => _reduceInstanceProperty__default["default"](properties).call(properties, (prev, curr) => {
|
|
304
|
+
var _context;
|
|
304
305
|
const currentValue = value[curr] || '';
|
|
305
|
-
return
|
|
306
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(prev, ":")).call(_context, currentValue);
|
|
306
307
|
}, ''));else realValues = _sliceInstanceProperty__default["default"](values).call(values, 0);
|
|
307
308
|
|
|
308
309
|
// TODO: checking for dupes like this is slow, find a better way
|
|
309
|
-
_reduceInstanceProperty__default["default"](
|
|
310
|
+
_reduceInstanceProperty__default["default"](_context2 = _sortInstanceProperty__default["default"](realValues).call(realValues)).call(_context2, (prev, curr) => {
|
|
310
311
|
if (curr === null) return curr;
|
|
311
312
|
if (curr !== '' && prev === curr && _indexOfInstanceProperty__default["default"](duplicateValues).call(duplicateValues, curr) === -1) duplicateValues.push(curr);
|
|
312
313
|
return curr;
|
|
313
314
|
});
|
|
314
315
|
if (properties) return _mapInstanceProperty__default["default"](duplicateValues).call(duplicateValues, value => {
|
|
315
|
-
var
|
|
316
|
-
const parts = _sliceInstanceProperty__default["default"](
|
|
316
|
+
var _context3;
|
|
317
|
+
const parts = _sliceInstanceProperty__default["default"](_context3 = value.split(':')).call(_context3, 1);
|
|
317
318
|
return _reduceInstanceProperty__default["default"](properties).call(properties, (prev, curr, index) => {
|
|
318
319
|
// eslint-disable-next-line no-param-reassign
|
|
319
320
|
prev[curr] = parts[index];
|
|
@@ -332,14 +333,14 @@ function unique(values, properties) {
|
|
|
332
333
|
* @return Array<Object> returns an array of objects with all duplicated values
|
|
333
334
|
*/
|
|
334
335
|
function uniqueObjects(items) {
|
|
335
|
-
var
|
|
336
|
+
var _context4;
|
|
336
337
|
const emptyValues = [undefined, null, ''];
|
|
337
|
-
const itemsWorkingSet = items && items.length ? _filterInstanceProperty__default["default"](
|
|
338
|
+
const itemsWorkingSet = items && items.length ? _filterInstanceProperty__default["default"](_context4 = _sliceInstanceProperty__default["default"](items).call(items)).call(_context4, x => !_includesInstanceProperty__default["default"](emptyValues).call(emptyValues, x)) : [];
|
|
338
339
|
const duplicateValues = _reduceInstanceProperty__default["default"](itemsWorkingSet).call(itemsWorkingSet, (acc, item, index) => {
|
|
339
|
-
var
|
|
340
|
+
var _context5;
|
|
340
341
|
if (item === null) return acc;
|
|
341
|
-
const isDuplicate = _reduceInstanceProperty__default["default"](
|
|
342
|
-
).call(
|
|
342
|
+
const isDuplicate = _reduceInstanceProperty__default["default"](_context5 = _sliceInstanceProperty__default["default"](itemsWorkingSet).call(itemsWorkingSet, index + 1) // get sub-array after this index
|
|
343
|
+
).call(_context5, (duplicateAcc, comparisonItem, comparisonIndex) => {
|
|
343
344
|
if (comparisonItem === null) return duplicateAcc;
|
|
344
345
|
|
|
345
346
|
// check if its a dupe
|
|
@@ -435,18 +436,16 @@ function getIndexesOfInvalidValues(values) {
|
|
|
435
436
|
|
|
436
437
|
const withoutEmptyErrorsByField = errorsByField => omitEmpty__default["default"](errorsByField);
|
|
437
438
|
|
|
439
|
+
var _templateObject$4;
|
|
438
440
|
function formatDateRangeValue(value, type) {
|
|
439
441
|
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
440
442
|
locale: 'en',
|
|
441
443
|
timeZone: moment__default["default"].tz.guess()
|
|
442
444
|
};
|
|
443
445
|
if (value.from === value.to) return formatDateTime$1(type, value.from, options);
|
|
444
|
-
if (value.from && value.to) return oneLine__default["default"]
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
`;
|
|
448
|
-
if (value.from) return `from ${formatDateTime$1(type, value.from, options)}`;
|
|
449
|
-
if (value.to) return `to ${formatDateTime$1(type, value.to, options)}`;
|
|
446
|
+
if (value.from && value.to) return oneLine__default["default"](_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteral(["\n ", " -\n ", "\n "])), formatDateTime$1(type, value.from, options), formatDateTime$1(type, value.to, options));
|
|
447
|
+
if (value.from) return "from ".concat(formatDateTime$1(type, value.from, options));
|
|
448
|
+
if (value.to) return "to ".concat(formatDateTime$1(type, value.to, options));
|
|
450
449
|
return '';
|
|
451
450
|
}
|
|
452
451
|
function formatDateTime$1(type, value) {
|
|
@@ -1682,13 +1681,13 @@ const getData = (code, field) => {
|
|
|
1682
1681
|
const getFractionDigit = code => getData(code, 'fractionDigit');
|
|
1683
1682
|
|
|
1684
1683
|
function ownKeys$1q(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; }
|
|
1685
|
-
function _objectSpread$1q(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
1684
|
+
function _objectSpread$1q(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$1q(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$1q(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1686
1685
|
function formatMoneyRangeValue(value, intl) {
|
|
1686
|
+
var _context;
|
|
1687
1687
|
if (value.from === value.to) return formatMoneyValue(value.from, value.currency, intl);
|
|
1688
|
-
if (value.from && value.to) return
|
|
1689
|
-
|
|
1690
|
-
if (value.
|
|
1691
|
-
if (value.to) return `to ${formatMoneyValue(value.to, value.currency, intl)}`;
|
|
1688
|
+
if (value.from && value.to) return _concatInstanceProperty__default["default"](_context = "".concat(formatMoneyValue(value.from, value.currency, intl), " -\n ")).call(_context, formatMoneyValue(value.to, value.currency, intl));
|
|
1689
|
+
if (value.from) return "from ".concat(formatMoneyValue(value.from, value.currency, intl));
|
|
1690
|
+
if (value.to) return "to ".concat(formatMoneyValue(value.to, value.currency, intl));
|
|
1692
1691
|
return '';
|
|
1693
1692
|
}
|
|
1694
1693
|
function formatMoneyValue(amount, currency, intl) {
|
|
@@ -1708,7 +1707,8 @@ function getFractionedAmount(moneyValue) {
|
|
|
1708
1707
|
return amount / 10 ** fractionDigits;
|
|
1709
1708
|
}
|
|
1710
1709
|
function formatMoney$2(moneyValue, intl, options) {
|
|
1711
|
-
|
|
1710
|
+
var _moneyValue$fractione;
|
|
1711
|
+
return intl.formatNumber((_moneyValue$fractione = moneyValue.fractionedAmount) !== null && _moneyValue$fractione !== void 0 ? _moneyValue$fractione : getFractionedAmount(moneyValue), _objectSpread$1q({
|
|
1712
1712
|
style: 'currency',
|
|
1713
1713
|
currency: moneyValue.currencyCode,
|
|
1714
1714
|
minimumFractionDigits: moneyValue.fractionDigits
|
|
@@ -1729,11 +1729,13 @@ var messages$J = reactIntl.defineMessages({
|
|
|
1729
1729
|
});
|
|
1730
1730
|
|
|
1731
1731
|
const formatEnum = _ref => {
|
|
1732
|
+
var _context;
|
|
1732
1733
|
let value = _ref.value,
|
|
1733
1734
|
fallbackValue = _ref.fallbackValue;
|
|
1734
|
-
return value.label ||
|
|
1735
|
+
return value.label || _concatInstanceProperty__default["default"](_context = "".concat(fallbackValue, " (")).call(_context, value.key, ")");
|
|
1735
1736
|
};
|
|
1736
1737
|
const formatLenum = _ref2 => {
|
|
1738
|
+
var _context2;
|
|
1737
1739
|
let value = _ref2.value,
|
|
1738
1740
|
language = _ref2.language,
|
|
1739
1741
|
languages = _ref2.languages,
|
|
@@ -1741,7 +1743,7 @@ const formatLenum = _ref2 => {
|
|
|
1741
1743
|
return l10n.formatLocalizedString(value, {
|
|
1742
1744
|
key: 'label',
|
|
1743
1745
|
locale: language,
|
|
1744
|
-
fallback:
|
|
1746
|
+
fallback: _concatInstanceProperty__default["default"](_context2 = "".concat(fallbackValue, " (")).call(_context2, value.key, ")"),
|
|
1745
1747
|
fallbackOrder: languages
|
|
1746
1748
|
});
|
|
1747
1749
|
};
|
|
@@ -1777,6 +1779,7 @@ const formatDate = _ref6 => {
|
|
|
1777
1779
|
});
|
|
1778
1780
|
};
|
|
1779
1781
|
const formatDateTime = _ref7 => {
|
|
1782
|
+
var _context3;
|
|
1780
1783
|
let value = _ref7.value,
|
|
1781
1784
|
userTimeZone = _ref7.userTimeZone,
|
|
1782
1785
|
intl = _ref7.intl;
|
|
@@ -1792,7 +1795,7 @@ const formatDateTime = _ref7 => {
|
|
|
1792
1795
|
// defaults to utc if timeZone is not provided
|
|
1793
1796
|
timeZone: userTimeZone || 'utc'
|
|
1794
1797
|
});
|
|
1795
|
-
return
|
|
1798
|
+
return _concatInstanceProperty__default["default"](_context3 = "".concat(date, " (")).call(_context3, time, ")");
|
|
1796
1799
|
};
|
|
1797
1800
|
const formatBoolean = _ref8 => {
|
|
1798
1801
|
let value = _ref8.value,
|
|
@@ -1815,7 +1818,7 @@ const formatUnknown = _ref10 => {
|
|
|
1815
1818
|
fallbackValue = _ref10.fallbackValue;
|
|
1816
1819
|
// NOTE This is reporting within the render function, which is supposed to
|
|
1817
1820
|
// be pure. This is quite bad as this is a side-effect in the render fn.
|
|
1818
|
-
sentry.reportErrorToSentry(new Error(
|
|
1821
|
+
sentry.reportErrorToSentry(new Error("Unhandled custom attribute type '".concat(type.name, "' for value")), {
|
|
1819
1822
|
extra: {
|
|
1820
1823
|
value
|
|
1821
1824
|
}
|
|
@@ -1888,9 +1891,10 @@ const attributeTypeNames = {
|
|
|
1888
1891
|
Number: 'number'
|
|
1889
1892
|
};
|
|
1890
1893
|
const convertToAttributeType = customFieldType => {
|
|
1894
|
+
var _customFieldType$elem;
|
|
1891
1895
|
if (isNil__default["default"](customFieldType)) return customFieldType;
|
|
1892
1896
|
const attributeTypeName = attributeTypeNames[customFieldType.name];
|
|
1893
|
-
const elementTypeName = attributeTypeNames[customFieldType.elementType
|
|
1897
|
+
const elementTypeName = attributeTypeNames[(_customFieldType$elem = customFieldType.elementType) === null || _customFieldType$elem === void 0 ? void 0 : _customFieldType$elem.name];
|
|
1894
1898
|
return {
|
|
1895
1899
|
name: attributeTypeName,
|
|
1896
1900
|
elementType: {
|
|
@@ -1953,21 +1957,25 @@ const setDisplayName = nextDisplayName => Component => {
|
|
|
1953
1957
|
return Component;
|
|
1954
1958
|
};
|
|
1955
1959
|
|
|
1956
|
-
const wrapDisplayName = (BaseComponent, hocName) =>
|
|
1960
|
+
const wrapDisplayName = (BaseComponent, hocName) => {
|
|
1961
|
+
var _context;
|
|
1962
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(hocName, "(")).call(_context, getDisplayName(BaseComponent), ")");
|
|
1963
|
+
};
|
|
1957
1964
|
|
|
1958
1965
|
function ownKeys$1p(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; }
|
|
1959
1966
|
function _objectSpread$1p(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$1p(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$1p(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1960
1967
|
const injectDataTablePaginationState = initialValues => Component => {
|
|
1961
1968
|
const WithDataTablePaginationState = props => {
|
|
1969
|
+
var _initialValues$tableS, _initialValues$tableS2;
|
|
1962
1970
|
const _usePaginationState = uiKit.usePaginationState({
|
|
1963
|
-
page: initialValues
|
|
1964
|
-
perPage: initialValues
|
|
1971
|
+
page: initialValues === null || initialValues === void 0 ? void 0 : initialValues.page,
|
|
1972
|
+
perPage: initialValues === null || initialValues === void 0 ? void 0 : initialValues.perPage
|
|
1965
1973
|
}),
|
|
1966
1974
|
page = _usePaginationState.page,
|
|
1967
1975
|
perPage = _usePaginationState.perPage;
|
|
1968
1976
|
const tableSorting = uiKit.useDataTableSortingState({
|
|
1969
|
-
key: initialValues
|
|
1970
|
-
order: initialValues
|
|
1977
|
+
key: initialValues === null || initialValues === void 0 || (_initialValues$tableS = initialValues.tableSorting) === null || _initialValues$tableS === void 0 ? void 0 : _initialValues$tableS.key,
|
|
1978
|
+
order: initialValues === null || initialValues === void 0 || (_initialValues$tableS2 = initialValues.tableSorting) === null || _initialValues$tableS2 === void 0 ? void 0 : _initialValues$tableS2.order
|
|
1971
1979
|
});
|
|
1972
1980
|
return jsxRuntime.jsx(Component, _objectSpread$1p(_objectSpread$1p({}, props), {}, {
|
|
1973
1981
|
dataTablePaginationState: {
|
|
@@ -2001,7 +2009,7 @@ const injectNotifications = function () {
|
|
|
2001
2009
|
[propName]: notifications
|
|
2002
2010
|
}));
|
|
2003
2011
|
};
|
|
2004
|
-
WrappedComponent.displayName =
|
|
2012
|
+
WrappedComponent.displayName = "withNotifications(".concat(getDisplayName(Component));
|
|
2005
2013
|
return WrappedComponent;
|
|
2006
2014
|
};
|
|
2007
2015
|
};
|
|
@@ -2110,7 +2118,10 @@ const isNil = value => typeof value === 'undefined' || value === null;
|
|
|
2110
2118
|
const useStorage = (storageKey, initialStorageValue, options) => {
|
|
2111
2119
|
var _context;
|
|
2112
2120
|
const mergedOptions = _objectSpread$1j(_objectSpread$1j({}, defaultOptions$2), options);
|
|
2113
|
-
const userId = applicationShellConnectors.useApplicationContext(context =>
|
|
2121
|
+
const userId = applicationShellConnectors.useApplicationContext(context => {
|
|
2122
|
+
var _context$user;
|
|
2123
|
+
return (_context$user = context.user) === null || _context$user === void 0 ? void 0 : _context$user.id;
|
|
2124
|
+
});
|
|
2114
2125
|
const scopedStorageKey = _filterInstanceProperty__default["default"](_context = [mergedOptions.segregateByUser && userId, storageKey]).call(_context, Boolean).join('/');
|
|
2115
2126
|
const readFromStorage = React.useCallback(() => {
|
|
2116
2127
|
const rawStorageValue = getStorage(mergedOptions.storageType).getItem(scopedStorageKey);
|
|
@@ -2129,8 +2140,9 @@ const useStorage = (storageKey, initialStorageValue, options) => {
|
|
|
2129
2140
|
return parsedStorageValue;
|
|
2130
2141
|
}, [mergedOptions.storageType, scopedStorageKey]);
|
|
2131
2142
|
const initializeStorageValue = () => {
|
|
2143
|
+
var _ref, _readFromStorage;
|
|
2132
2144
|
// default the storage value to the initial provided value when provided
|
|
2133
|
-
return readFromStorage()
|
|
2145
|
+
return (_ref = (_readFromStorage = readFromStorage()) !== null && _readFromStorage !== void 0 ? _readFromStorage : initialStorageValue) !== null && _ref !== void 0 ? _ref : null;
|
|
2134
2146
|
};
|
|
2135
2147
|
const _useState = React.useState(initializeStorageValue),
|
|
2136
2148
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -2229,14 +2241,16 @@ function ownKeys$1h(e, r) { var t = _Object$keys__default["default"](e); if (_Ob
|
|
|
2229
2241
|
function _objectSpread$1h(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$1h(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$1h(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
2230
2242
|
var FetchStoresQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchStoresQuery" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "limit" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "offset" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "sort" } }, type: { kind: "ListType", type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "where" } }, type: { kind: "NamedType", name: { kind: "Name", value: "String" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "excludeExtendedStoresList" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "excludeProductSelections" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "stores" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "limit" }, value: { kind: "Variable", name: { kind: "Name", value: "limit" } } }, { kind: "Argument", name: { kind: "Name", value: "offset" }, value: { kind: "Variable", name: { kind: "Name", value: "offset" } } }, { kind: "Argument", name: { kind: "Name", value: "sort" }, value: { kind: "Variable", name: { kind: "Name", value: "sort" } } }, { kind: "Argument", name: { kind: "Name", value: "where" }, value: { kind: "Variable", name: { kind: "Name", value: "where" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "count" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "offset" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "FragmentSpread", name: { kind: "Name", value: "StoreBasicInfo" }, directives: [] }, { kind: "Field", name: { kind: "Name", value: "countries" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "code" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "languages" }, arguments: [], directives: [{ kind: "Directive", name: { kind: "Name", value: "skip" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "excludeExtendedStoresList" } } }] }] }, { kind: "Field", name: { kind: "Name", value: "distributionChannelsRef" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "distributionChannels" }, arguments: [], directives: [{ kind: "Directive", name: { kind: "Name", value: "skip" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "excludeExtendedStoresList" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "supplyChannels" }, arguments: [], directives: [{ kind: "Directive", name: { kind: "Name", value: "skip" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "excludeExtendedStoresList" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "productSelections" }, arguments: [], directives: [{ kind: "Directive", name: { kind: "Name", value: "skip" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "excludeProductSelections" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "active" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "productSelection" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "mode" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }] } }] } }] } }] } }, { kind: "FragmentDefinition", name: { kind: "Name", value: "StoreBasicInfo" }, typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Store" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "version" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "createdAt" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "lastModifiedAt" }, arguments: [], directives: [] }] } }], loc: { start: 0, end: 1089, source: { body: "#import '../../utils/graphql/fragments/store-basic-info.ctp.graphql'\n\nquery FetchStoresQuery(\n $limit: Int\n $offset: Int\n $sort: [String!]\n $where: String\n $excludeExtendedStoresList: Boolean!\n $excludeProductSelections: Boolean!\n) {\n stores(limit: $limit, offset: $offset, sort: $sort, where: $where) {\n total\n count\n offset\n results {\n ...StoreBasicInfo\n countries {\n code\n }\n languages @skip(if: $excludeExtendedStoresList)\n distributionChannelsRef {\n id\n }\n distributionChannels @skip(if: $excludeExtendedStoresList) {\n id\n key\n nameAllLocales {\n locale\n value\n }\n }\n supplyChannels @skip(if: $excludeExtendedStoresList) {\n id\n key\n nameAllLocales {\n locale\n value\n }\n }\n productSelections @skip(if: $excludeProductSelections) {\n active\n productSelection {\n id\n mode\n nameAllLocales {\n locale\n value\n }\n }\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
2231
2243
|
const filterStoresOutdatedDanglingProductSelections = storesQueryResult => {
|
|
2244
|
+
var _storesQueryResult$re;
|
|
2232
2245
|
if (!storesQueryResult) return null;
|
|
2233
2246
|
return {
|
|
2234
2247
|
total: storesQueryResult.total,
|
|
2235
2248
|
count: storesQueryResult.count,
|
|
2236
2249
|
offset: storesQueryResult.offset,
|
|
2237
|
-
results: storesQueryResult.results
|
|
2250
|
+
results: (_storesQueryResult$re = storesQueryResult.results) === null || _storesQueryResult$re === void 0 ? void 0 : _mapInstanceProperty__default["default"](_storesQueryResult$re).call(_storesQueryResult$re, store => {
|
|
2251
|
+
var _store$productSelecti;
|
|
2238
2252
|
return _objectSpread$1h(_objectSpread$1h({}, store), {}, {
|
|
2239
|
-
productSelections: store.productSelections
|
|
2253
|
+
productSelections: (_store$productSelecti = store.productSelections) === null || _store$productSelecti === void 0 ? void 0 : _filterInstanceProperty__default["default"](_store$productSelecti).call(_store$productSelecti, productSelectionRef => Boolean(productSelectionRef.productSelection))
|
|
2240
2254
|
});
|
|
2241
2255
|
})
|
|
2242
2256
|
};
|
|
@@ -2248,7 +2262,7 @@ const createQueryVariables$6 = ownProps => {
|
|
|
2248
2262
|
offset: ownProps.offset,
|
|
2249
2263
|
sort: _sortInstanceProperty__default["default"](ownProps)
|
|
2250
2264
|
}, Boolean(ownProps.stores) && {
|
|
2251
|
-
where:
|
|
2265
|
+
where: "key in (".concat(_mapInstanceProperty__default["default"](_context = ownProps.stores).call(_context, store => "\"".concat(store, "\"")).join(', '), ")")
|
|
2252
2266
|
}), {}, {
|
|
2253
2267
|
excludeExtendedStoresList: ownProps.excludeExtendedStoresList,
|
|
2254
2268
|
excludeProductSelections: ownProps.excludeProductSelections
|
|
@@ -2273,7 +2287,10 @@ const useStoresListFetcher = props => {
|
|
|
2273
2287
|
projectKey: props.projectKey
|
|
2274
2288
|
},
|
|
2275
2289
|
fetchPolicy: 'network-only',
|
|
2276
|
-
onError: graphqlErrorResponse =>
|
|
2290
|
+
onError: graphqlErrorResponse => {
|
|
2291
|
+
var _props$onError;
|
|
2292
|
+
return (_props$onError = props.onError) === null || _props$onError === void 0 ? void 0 : _props$onError.call(props, graphqlErrorResponse);
|
|
2293
|
+
}
|
|
2277
2294
|
}),
|
|
2278
2295
|
data = _useQuery.data,
|
|
2279
2296
|
refetch = _useQuery.refetch,
|
|
@@ -2281,7 +2298,7 @@ const useStoresListFetcher = props => {
|
|
|
2281
2298
|
return {
|
|
2282
2299
|
isLoading: loading,
|
|
2283
2300
|
refetch,
|
|
2284
|
-
stores: filterStoresOutdatedDanglingProductSelections(data
|
|
2301
|
+
stores: filterStoresOutdatedDanglingProductSelections(data === null || data === void 0 ? void 0 : data.stores),
|
|
2285
2302
|
refetchQuery: {
|
|
2286
2303
|
query: FetchStoresQuery,
|
|
2287
2304
|
variables: queryVariables,
|
|
@@ -2345,10 +2362,16 @@ const handlers$5 = {
|
|
|
2345
2362
|
}
|
|
2346
2363
|
};
|
|
2347
2364
|
|
|
2348
|
-
const toPermission = (permission, resourceName) =>
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2365
|
+
const toPermission = (permission, resourceName) => {
|
|
2366
|
+
var _context;
|
|
2367
|
+
return camelCase__default["default"](_concatInstanceProperty__default["default"](_context = "can ".concat(permission, " ")).call(_context, resourceName));
|
|
2368
|
+
};
|
|
2369
|
+
const createComposePath = resourceName => permission => {
|
|
2370
|
+
var _context2;
|
|
2371
|
+
return (// e.g applicationContext.dataFences?.store?.orders?.canViewOrders?.values
|
|
2372
|
+
_concatInstanceProperty__default["default"](_context2 = "dataFences.store.".concat(resourceName, ".")).call(_context2, permission, ".values")
|
|
2373
|
+
);
|
|
2374
|
+
};
|
|
2352
2375
|
const useStoreKeysInDataFences = _ref => {
|
|
2353
2376
|
let resourceName = _ref.resourceName,
|
|
2354
2377
|
_ref$permission = _ref.permission,
|
|
@@ -2746,7 +2769,7 @@ const usePersistedTableConfiguration = props => {
|
|
|
2746
2769
|
* Therefore, if it will be missing from the local storage and hence we use the [] as default.
|
|
2747
2770
|
*/
|
|
2748
2771
|
const getVisibleColumns = React.useCallback(() => {
|
|
2749
|
-
if (cachedVisibleTableConfiguration
|
|
2772
|
+
if (cachedVisibleTableConfiguration !== null && cachedVisibleTableConfiguration !== void 0 && cachedVisibleTableConfiguration.columnsConfig) {
|
|
2750
2773
|
return retrieveColumnsWithCachedConfiguration({
|
|
2751
2774
|
allAvailableColumnsConfiguration,
|
|
2752
2775
|
cachedVisibleTableConfiguration: cachedVisibleTableConfiguration.columnsConfig,
|
|
@@ -2760,8 +2783,8 @@ const usePersistedTableConfiguration = props => {
|
|
|
2760
2783
|
return {
|
|
2761
2784
|
visibleColumns,
|
|
2762
2785
|
visibleColumnKeys,
|
|
2763
|
-
cachedVisibleColumnsConfiguration: cachedVisibleTableConfiguration
|
|
2764
|
-
cachedDisplaySettings: cachedVisibleTableConfiguration
|
|
2786
|
+
cachedVisibleColumnsConfiguration: cachedVisibleTableConfiguration === null || cachedVisibleTableConfiguration === void 0 ? void 0 : cachedVisibleTableConfiguration.columnsConfig,
|
|
2787
|
+
cachedDisplaySettings: cachedVisibleTableConfiguration === null || cachedVisibleTableConfiguration === void 0 ? void 0 : cachedVisibleTableConfiguration.displaySettings,
|
|
2765
2788
|
handleCachedTableConfigurationUpdate: update => handleCacheUpdate({
|
|
2766
2789
|
update,
|
|
2767
2790
|
cachedVisibleTableConfiguration,
|
|
@@ -2772,6 +2795,7 @@ const usePersistedTableConfiguration = props => {
|
|
|
2772
2795
|
|
|
2773
2796
|
var FetchProductSelectionsTotal = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchProductSelectionsTotal" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "productSelections" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 74, source: { body: "query FetchProductSelectionsTotal {\n productSelections {\n total\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
2774
2797
|
const useProductSelectionsTotalFetcher = props => {
|
|
2798
|
+
var _data$productSelectio;
|
|
2775
2799
|
const _useQuery = hooks.useQuery(FetchProductSelectionsTotal, {
|
|
2776
2800
|
context: {
|
|
2777
2801
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -2781,7 +2805,7 @@ const useProductSelectionsTotalFetcher = props => {
|
|
|
2781
2805
|
data = _useQuery.data;
|
|
2782
2806
|
return {
|
|
2783
2807
|
isLoading: loading,
|
|
2784
|
-
total: data
|
|
2808
|
+
total: data === null || data === void 0 || (_data$productSelectio = data.productSelections) === null || _data$productSelectio === void 0 ? void 0 : _data$productSelectio.total
|
|
2785
2809
|
};
|
|
2786
2810
|
};
|
|
2787
2811
|
|
|
@@ -2802,7 +2826,7 @@ function _objectSpread$1d(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
|
2802
2826
|
// eslint-disable-next-line import/prefer-default-export
|
|
2803
2827
|
const convertProductSelectionsFromGraphQl = productSelections => {
|
|
2804
2828
|
var _context;
|
|
2805
|
-
return productSelections
|
|
2829
|
+
return (productSelections === null || productSelections === void 0 ? void 0 : productSelections.results) && _objectSpread$1d(_objectSpread$1d({}, productSelections), {}, {
|
|
2806
2830
|
results: _mapInstanceProperty__default["default"](_context = productSelections.results).call(_context, productSelection => _objectSpread$1d({}, l10n.applyTransformedLocalizedFields(productSelection, [{
|
|
2807
2831
|
from: 'nameAllLocales',
|
|
2808
2832
|
to: 'name'
|
|
@@ -2836,7 +2860,7 @@ const useProductSelectionsFetcher = props => {
|
|
|
2836
2860
|
refetch = _useQuery.refetch;
|
|
2837
2861
|
return {
|
|
2838
2862
|
isLoading: loading,
|
|
2839
|
-
productSelections: convertProductSelectionsFromGraphQl(data
|
|
2863
|
+
productSelections: convertProductSelectionsFromGraphQl(data === null || data === void 0 ? void 0 : data.productSelections) || emptyProductSelections,
|
|
2840
2864
|
refetch
|
|
2841
2865
|
};
|
|
2842
2866
|
};
|
|
@@ -2861,6 +2885,7 @@ function validateSingleFilter(_ref) {
|
|
|
2861
2885
|
return _includesInstanceProperty__default["default"](invalidValues).call(invalidValues, value);
|
|
2862
2886
|
}
|
|
2863
2887
|
|
|
2888
|
+
var _templateObject$3, _templateObject2$2;
|
|
2864
2889
|
const dateFormatDayStart$1 = 'YYYY-MM-DDT00:00:00.000';
|
|
2865
2890
|
const dateFormatDayEnd$1 = 'YYYY-MM-DDT23:59:59.999';
|
|
2866
2891
|
const getDateTimeInUTC = (date, timezone, format) => {
|
|
@@ -2870,7 +2895,8 @@ const getDateTimeInUTC = (date, timezone, format) => {
|
|
|
2870
2895
|
const noTimeSpecified = momentDate.hours() === 0 && momentDate.minutes() === 0 && momentDate.seconds() === 0;
|
|
2871
2896
|
// if it's a date then convert it to UTC datetime based on timezone
|
|
2872
2897
|
if (noTimeSpecified) {
|
|
2873
|
-
|
|
2898
|
+
var _moment$tz;
|
|
2899
|
+
const offset = ((_moment$tz = moment__default$1["default"](date).tz(timezone)) === null || _moment$tz === void 0 ? void 0 : _moment$tz.utcOffset()) || 0;
|
|
2874
2900
|
const formattedDate = momentDate.format(format);
|
|
2875
2901
|
const formattedDateWithOffset = moment__default$1["default"](formattedDate).add(offset, 'minutes').format(dateFormat);
|
|
2876
2902
|
// console.log(formattedDateWithOffset);
|
|
@@ -2883,6 +2909,7 @@ const getDateTimeInUTC = (date, timezone, format) => {
|
|
|
2883
2909
|
function dateTransformer$1(filterKey, filters) {
|
|
2884
2910
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator$1;
|
|
2885
2911
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
2912
|
+
var _context, _context2;
|
|
2886
2913
|
let type = _ref.type,
|
|
2887
2914
|
value = _ref.value,
|
|
2888
2915
|
timezone = _ref.timezone;
|
|
@@ -2892,19 +2919,13 @@ function dateTransformer$1(filterKey, filters) {
|
|
|
2892
2919
|
})) return '';
|
|
2893
2920
|
switch (type) {
|
|
2894
2921
|
case FILTER_TYPES.lessThan:
|
|
2895
|
-
return
|
|
2922
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(filterKey, " < \"")).call(_context, getDateTimeInUTC(value, timezone, dateFormatDayStart$1), "\"");
|
|
2896
2923
|
case FILTER_TYPES.moreThan:
|
|
2897
|
-
return
|
|
2924
|
+
return _concatInstanceProperty__default["default"](_context2 = "".concat(filterKey, " > \"")).call(_context2, getDateTimeInUTC(value, timezone, dateFormatDayEnd$1), "\"");
|
|
2898
2925
|
case FILTER_TYPES.equalTo:
|
|
2899
|
-
return oneLine__default["default"]
|
|
2900
|
-
(${filterKey} >= "${getDateTimeInUTC(value, timezone, dateFormatDayStart$1)}"
|
|
2901
|
-
and ${filterKey} <= "${getDateTimeInUTC(value, timezone, dateFormatDayEnd$1)}")
|
|
2902
|
-
`;
|
|
2926
|
+
return oneLine__default["default"](_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n (", " >= \"", "\"\n and ", " <= \"", "\")\n "])), filterKey, getDateTimeInUTC(value, timezone, dateFormatDayStart$1), filterKey, getDateTimeInUTC(value, timezone, dateFormatDayEnd$1));
|
|
2903
2927
|
case FILTER_TYPES.range:
|
|
2904
|
-
return oneLine__default["default"]
|
|
2905
|
-
(${filterKey} >= "${getDateTimeInUTC(value.from, timezone, dateFormatDayStart$1)}"
|
|
2906
|
-
and ${filterKey} <= "${getDateTimeInUTC(value.to, timezone, dateFormatDayEnd$1)}")
|
|
2907
|
-
`;
|
|
2928
|
+
return oneLine__default["default"](_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteral(["\n (", " >= \"", "\"\n and ", " <= \"", "\")\n "])), filterKey, getDateTimeInUTC(value.from, timezone, dateFormatDayStart$1), filterKey, getDateTimeInUTC(value.to, timezone, dateFormatDayEnd$1));
|
|
2908
2929
|
default:
|
|
2909
2930
|
return '';
|
|
2910
2931
|
}
|
|
@@ -2920,7 +2941,7 @@ function dateTransformer$1(filterKey, filters) {
|
|
|
2920
2941
|
* (createdAt >= "2018-02-15T00:00:00.000+01:00" and createdAt <= "2018-02-15T23:59:59.999+01:00")
|
|
2921
2942
|
* ) or some_more_filters
|
|
2922
2943
|
*/
|
|
2923
|
-
return queryString === '' ? null :
|
|
2944
|
+
return queryString === '' ? null : "(".concat(queryString, ")");
|
|
2924
2945
|
}
|
|
2925
2946
|
function defaultFilterValidator$1(_ref2) {
|
|
2926
2947
|
let type = _ref2.type,
|
|
@@ -2936,7 +2957,10 @@ function defaultFilterValidator$1(_ref2) {
|
|
|
2936
2957
|
|
|
2937
2958
|
var localizedTextTransformer = (localizedString => {
|
|
2938
2959
|
var _context;
|
|
2939
|
-
return _mapInstanceProperty__default["default"](_context = _Object$keys__default["default"](localizedString)).call(_context, locale =>
|
|
2960
|
+
return _mapInstanceProperty__default["default"](_context = _Object$keys__default["default"](localizedString)).call(_context, locale => {
|
|
2961
|
+
var _context2;
|
|
2962
|
+
return _concatInstanceProperty__default["default"](_context2 = "".concat(locale, " = \"")).call(_context2, localizedString[locale], "\"");
|
|
2963
|
+
}).join(' and ');
|
|
2940
2964
|
});
|
|
2941
2965
|
|
|
2942
2966
|
var styles$j = {
|
|
@@ -2984,8 +3008,9 @@ function _objectSpread$1c(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
|
2984
3008
|
var GetChannelsQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetChannelsQuery" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "where" } }, type: { kind: "NamedType", name: { kind: "Name", value: "String" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "sortByNamePath" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "channels" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "where" }, value: { kind: "Variable", name: { kind: "Name", value: "where" } } }, { kind: "Argument", name: { kind: "Name", value: "sort" }, value: { kind: "ListValue", values: [{ kind: "Variable", name: { kind: "Name", value: "sortByNamePath" } }, { kind: "StringValue", value: "key", block: false }] } }, { kind: "Argument", name: { kind: "Name", value: "limit" }, value: { kind: "IntValue", value: "60" } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "FragmentSpread", name: { kind: "Name", value: "PickerInputChannel" }, directives: [] }] } }] } }] } }, { kind: "FragmentDefinition", name: { kind: "Name", value: "PickerInputChannel" }, typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Channel" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 392, source: { body: "fragment PickerInputChannel on Channel {\n id\n key\n nameAllLocales {\n locale\n value\n }\n}\n\nquery GetChannelsQuery($where: String, $sortByNamePath: String!) {\n channels(where: $where, sort: [$sortByNamePath, \"key\"], limit: 60) {\n total\n results {\n ...PickerInputChannel\n }\n }\n}\n\nquery GetChannelQuery($id: String) {\n channel(id: $id) {\n ...PickerInputChannel\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
2985
3009
|
var GetChannelQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetChannelQuery" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "id" } }, type: { kind: "NamedType", name: { kind: "Name", value: "String" } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "channel" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "id" }, value: { kind: "Variable", name: { kind: "Name", value: "id" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "FragmentSpread", name: { kind: "Name", value: "PickerInputChannel" }, directives: [] }] } }] } }, { kind: "FragmentDefinition", name: { kind: "Name", value: "PickerInputChannel" }, typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Channel" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 392, source: { body: "fragment PickerInputChannel on Channel {\n id\n key\n nameAllLocales {\n locale\n value\n }\n}\n\nquery GetChannelsQuery($where: String, $sortByNamePath: String!) {\n channels(where: $where, sort: [$sortByNamePath, \"key\"], limit: 60) {\n total\n results {\n ...PickerInputChannel\n }\n }\n}\n\nquery GetChannelQuery($id: String) {\n channel(id: $id) {\n ...PickerInputChannel\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
2986
3010
|
var PickerInputChannel = { kind: "Document", definitions: [{ kind: "FragmentDefinition", name: { kind: "Name", value: "PickerInputChannel" }, typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Channel" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 392, source: { body: "fragment PickerInputChannel on Channel {\n id\n key\n nameAllLocales {\n locale\n value\n }\n}\n\nquery GetChannelsQuery($where: String, $sortByNamePath: String!) {\n channels(where: $where, sort: [$sortByNamePath, \"key\"], limit: 60) {\n total\n results {\n ...PickerInputChannel\n }\n }\n}\n\nquery GetChannelQuery($id: String) {\n channel(id: $id) {\n ...PickerInputChannel\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
2987
|
-
const getRolesClause = roles => roles && roles.length > 0 ?
|
|
3011
|
+
const getRolesClause = roles => roles && roles.length > 0 ? "roles contains any (".concat(_mapInstanceProperty__default["default"](roles).call(roles, role => "\"".concat(role, "\"")).join(','), ")") : undefined;
|
|
2988
3012
|
const ChannelPickerInput = _ref => {
|
|
3013
|
+
var _currentOption$data$l, _currentOption$data;
|
|
2989
3014
|
let isClearable = _ref.isClearable,
|
|
2990
3015
|
isDisabled = _ref.isDisabled,
|
|
2991
3016
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -3005,7 +3030,7 @@ const ChannelPickerInput = _ref => {
|
|
|
3005
3030
|
const variables = React.useMemo(() => {
|
|
3006
3031
|
const rolesClause = getRolesClause(roles);
|
|
3007
3032
|
return _objectSpread$1c({
|
|
3008
|
-
sortByNamePath:
|
|
3033
|
+
sortByNamePath: "name.".concat(dataLocale)
|
|
3009
3034
|
}, rolesClause && {
|
|
3010
3035
|
extraWhere: rolesClause
|
|
3011
3036
|
});
|
|
@@ -3026,7 +3051,7 @@ const ChannelPickerInput = _ref => {
|
|
|
3026
3051
|
}
|
|
3027
3052
|
return channel;
|
|
3028
3053
|
}, [formatLocalizedFieldToString]);
|
|
3029
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
3054
|
+
const prefixSearchFields = React.useMemo(() => ["name.".concat(dataLocale), 'key'], [dataLocale]);
|
|
3030
3055
|
const loadOptions = useLoadOptions({
|
|
3031
3056
|
query: GetChannelsQuery,
|
|
3032
3057
|
variables,
|
|
@@ -3061,13 +3086,13 @@ const ChannelPickerInput = _ref => {
|
|
|
3061
3086
|
setLoadingError(null);
|
|
3062
3087
|
handleInternalInputChange(event);
|
|
3063
3088
|
}, [handleInternalInputChange]);
|
|
3064
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
3089
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption === null || currentOption === void 0 ? void 0 : currentOption.error);
|
|
3065
3090
|
React.useEffect(() => {
|
|
3066
3091
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
3067
3092
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
3068
3093
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
3069
3094
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$G.noChannelsFound), [loadingError, formatMessage]);
|
|
3070
|
-
const tooltipTitle = currentOption
|
|
3095
|
+
const tooltipTitle = (_currentOption$data$l = currentOption === null || currentOption === void 0 || (_currentOption$data = currentOption.data) === null || _currentOption$data === void 0 ? void 0 : _currentOption$data.label) !== null && _currentOption$data$l !== void 0 ? _currentOption$data$l : '';
|
|
3071
3096
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
3072
3097
|
max: "scale",
|
|
3073
3098
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -3077,7 +3102,7 @@ const ChannelPickerInput = _ref => {
|
|
|
3077
3102
|
children: jsxRuntime.jsx(uiKit.AsyncSelectInput, {
|
|
3078
3103
|
id: name,
|
|
3079
3104
|
name: name,
|
|
3080
|
-
placeholder: placeholder
|
|
3105
|
+
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : formatMessage(messages$G.placeholder),
|
|
3081
3106
|
loadOptions: loadOptionsDebounced,
|
|
3082
3107
|
defaultOptions: true,
|
|
3083
3108
|
showOptionGroupDivider: true,
|
|
@@ -3121,26 +3146,26 @@ function _callSuper$9(_this, derived, args) {
|
|
|
3121
3146
|
return _possibleConstructorReturn(_this, isNativeReflectConstruct() ? _Reflect$construct__default["default"](derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args));
|
|
3122
3147
|
}
|
|
3123
3148
|
let FormattedDateTime = /*#__PURE__*/function (_PureComponent) {
|
|
3124
|
-
_inherits(FormattedDateTime, _PureComponent);
|
|
3125
3149
|
function FormattedDateTime() {
|
|
3126
3150
|
_classCallCheck(this, FormattedDateTime);
|
|
3127
3151
|
return _callSuper$9(this, FormattedDateTime, arguments);
|
|
3128
3152
|
}
|
|
3129
|
-
|
|
3153
|
+
_inherits(FormattedDateTime, _PureComponent);
|
|
3154
|
+
return _createClass(FormattedDateTime, [{
|
|
3130
3155
|
key: "render",
|
|
3131
3156
|
value: function render() {
|
|
3132
3157
|
return jsxRuntime.jsx(applicationShellConnectors.ApplicationContext, {
|
|
3133
3158
|
render: _ref => {
|
|
3159
|
+
var _this$props;
|
|
3134
3160
|
let user = _ref.user;
|
|
3135
3161
|
return formatDateTime$1(this.props.type, this.props.value, {
|
|
3136
|
-
timeZone: this
|
|
3162
|
+
timeZone: (this === null || this === void 0 || (_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.timeZone) || (user === null || user === void 0 ? void 0 : user.timeZone),
|
|
3137
3163
|
locale: this.props.intl.locale
|
|
3138
3164
|
});
|
|
3139
3165
|
}
|
|
3140
3166
|
});
|
|
3141
3167
|
}
|
|
3142
3168
|
}]);
|
|
3143
|
-
return FormattedDateTime;
|
|
3144
3169
|
}(React.PureComponent);
|
|
3145
3170
|
FormattedDateTime.displayName = 'FormattedDateTime';
|
|
3146
3171
|
var FormattedDateTime$1 = reactIntl.injectIntl(FormattedDateTime);
|
|
@@ -3165,25 +3190,25 @@ function _callSuper$8(_this, derived, args) {
|
|
|
3165
3190
|
}
|
|
3166
3191
|
const withMouseOverState = BaseComponent => {
|
|
3167
3192
|
let WithMouseOverState = /*#__PURE__*/function (_Component) {
|
|
3168
|
-
_inherits(WithMouseOverState, _Component);
|
|
3169
3193
|
function WithMouseOverState() {
|
|
3170
|
-
var
|
|
3194
|
+
var _this2;
|
|
3171
3195
|
_classCallCheck(this, WithMouseOverState);
|
|
3172
3196
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3173
3197
|
args[_key] = arguments[_key];
|
|
3174
3198
|
}
|
|
3175
|
-
|
|
3176
|
-
|
|
3199
|
+
_this2 = _callSuper$8(this, WithMouseOverState, [...args]);
|
|
3200
|
+
_this2.state = {
|
|
3177
3201
|
isMouseOver: false
|
|
3178
3202
|
};
|
|
3179
|
-
|
|
3203
|
+
_this2.setMouseOver = nextMouseOver => _this2.setState({
|
|
3180
3204
|
isMouseOver: nextMouseOver
|
|
3181
3205
|
});
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
return
|
|
3206
|
+
_this2.handleMouseOver = () => _this2.setMouseOver(true);
|
|
3207
|
+
_this2.handleMouseOut = () => _this2.setMouseOver(false);
|
|
3208
|
+
return _this2;
|
|
3185
3209
|
}
|
|
3186
|
-
|
|
3210
|
+
_inherits(WithMouseOverState, _Component);
|
|
3211
|
+
return _createClass(WithMouseOverState, [{
|
|
3187
3212
|
key: "render",
|
|
3188
3213
|
value: function render() {
|
|
3189
3214
|
const injectedProps = {
|
|
@@ -3194,7 +3219,6 @@ const withMouseOverState = BaseComponent => {
|
|
|
3194
3219
|
return jsxRuntime.jsx(BaseComponent, _objectSpread$1b({}, _objectSpread$1b(_objectSpread$1b({}, this.props), injectedProps)));
|
|
3195
3220
|
}
|
|
3196
3221
|
}]);
|
|
3197
|
-
return WithMouseOverState;
|
|
3198
3222
|
}(React.Component);
|
|
3199
3223
|
WithMouseOverState.displayName = wrapDisplayName(BaseComponent, 'withMouseOverState');
|
|
3200
3224
|
return WithMouseOverState;
|
|
@@ -3229,74 +3253,74 @@ var styles$i = {
|
|
|
3229
3253
|
"granular": "throttled-field-module__granular___2LXJf"
|
|
3230
3254
|
};
|
|
3231
3255
|
let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
3232
|
-
_inherits(ThrottledField, _PureComponent);
|
|
3233
3256
|
function ThrottledField() {
|
|
3234
|
-
var
|
|
3257
|
+
var _this2;
|
|
3235
3258
|
_classCallCheck(this, ThrottledField);
|
|
3236
3259
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3237
3260
|
args[_key] = arguments[_key];
|
|
3238
3261
|
}
|
|
3239
|
-
|
|
3240
|
-
|
|
3262
|
+
_this2 = _callSuper$7(this, ThrottledField, [...args]);
|
|
3263
|
+
_this2.state = {
|
|
3241
3264
|
draftValue: '',
|
|
3242
3265
|
prevValue: ''
|
|
3243
3266
|
};
|
|
3244
|
-
|
|
3245
|
-
clearTimeout(
|
|
3246
|
-
clearTimeout(
|
|
3247
|
-
|
|
3248
|
-
|
|
3267
|
+
_this2.clearPendingUpdates = () => {
|
|
3268
|
+
clearTimeout(_this2.changeTimeout);
|
|
3269
|
+
clearTimeout(_this2.blurTimeout);
|
|
3270
|
+
_this2.changeTimeout = null;
|
|
3271
|
+
_this2.blurTimeout = null;
|
|
3249
3272
|
};
|
|
3250
|
-
|
|
3273
|
+
_this2.handleChange = event => {
|
|
3251
3274
|
// The `SyntheticEvent` is pooled by default for perf reasons.
|
|
3252
3275
|
// See https://facebook.github.io/react/docs/events.html#event-pooling
|
|
3253
3276
|
// To access the event in an async way we need to persist it.
|
|
3254
3277
|
event.persist();
|
|
3255
|
-
|
|
3278
|
+
_this2.setState({
|
|
3256
3279
|
draftValue: event.target.value
|
|
3257
3280
|
});
|
|
3258
|
-
|
|
3281
|
+
_this2.doDelayedUpdate(_this2.props.onChange, event, 'change');
|
|
3259
3282
|
};
|
|
3260
|
-
|
|
3283
|
+
_this2.handleEnter = event => {
|
|
3261
3284
|
if (event.keyCode !== 13) return;
|
|
3262
|
-
if (
|
|
3285
|
+
if (_this2.changeTimeout) {
|
|
3263
3286
|
// Since there are still are some pending updates that are not sent to the
|
|
3264
3287
|
// parent yet we need to call the update here explicitly and clear the
|
|
3265
3288
|
// pending updates
|
|
3266
|
-
|
|
3289
|
+
_this2.props.onChange({
|
|
3267
3290
|
target: {
|
|
3268
|
-
value:
|
|
3291
|
+
value: _this2.state.draftValue
|
|
3269
3292
|
}
|
|
3270
3293
|
});
|
|
3271
3294
|
// we can savely clear the timeout and thus abort all pending changes
|
|
3272
3295
|
// because we just update the parent with the current state
|
|
3273
|
-
clearTimeout(
|
|
3274
|
-
|
|
3296
|
+
clearTimeout(_this2.changeTimeout);
|
|
3297
|
+
_this2.changeTimeout = null;
|
|
3275
3298
|
}
|
|
3276
|
-
|
|
3299
|
+
_this2.props.onEnter(_this2.state.draftValue);
|
|
3277
3300
|
};
|
|
3278
|
-
|
|
3301
|
+
_this2.handleBlur = event => {
|
|
3279
3302
|
// The `SyntheticEvent` is pooled by default for perf reasons.
|
|
3280
3303
|
// See https://facebook.github.io/react/docs/events.html#event-pooling
|
|
3281
3304
|
// To access the event in an async way we need to persist it.
|
|
3282
|
-
if (
|
|
3305
|
+
if (_this2.props.onBlurValue) {
|
|
3283
3306
|
event.persist();
|
|
3284
|
-
|
|
3307
|
+
_this2.doDelayedUpdate(e => _this2.props.onBlurValue(e.target.value), event, 'blur');
|
|
3285
3308
|
}
|
|
3286
3309
|
};
|
|
3287
|
-
|
|
3288
|
-
const self =
|
|
3289
|
-
const timeoutKey =
|
|
3310
|
+
_this2.doDelayedUpdate = (updateFunction, event, eventType) => {
|
|
3311
|
+
const self = _this2;
|
|
3312
|
+
const timeoutKey = "".concat(eventType, "Timeout");
|
|
3290
3313
|
// TODO: can't we just use one variable?
|
|
3291
|
-
clearTimeout(
|
|
3292
|
-
|
|
3314
|
+
clearTimeout(_this2[timeoutKey]);
|
|
3315
|
+
_this2[timeoutKey] = _setTimeout__default["default"](() => {
|
|
3293
3316
|
updateFunction.call(self, event);
|
|
3294
|
-
|
|
3295
|
-
},
|
|
3317
|
+
_this2[timeoutKey] = null;
|
|
3318
|
+
}, _this2.props.throttleMS);
|
|
3296
3319
|
};
|
|
3297
|
-
return
|
|
3320
|
+
return _this2;
|
|
3298
3321
|
}
|
|
3299
|
-
|
|
3322
|
+
_inherits(ThrottledField, _PureComponent);
|
|
3323
|
+
return _createClass(ThrottledField, [{
|
|
3300
3324
|
key: "componentWillUnmount",
|
|
3301
3325
|
value: function componentWillUnmount() {
|
|
3302
3326
|
this.clearPendingUpdates();
|
|
@@ -3316,7 +3340,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
3316
3340
|
}, this.props.onEnter ? {
|
|
3317
3341
|
onKeyDown: this.handleEnter
|
|
3318
3342
|
} : {}), filterDataAttributes(this.props));
|
|
3319
|
-
const inputId =
|
|
3343
|
+
const inputId = "throttled-field-".concat(this.props.name);
|
|
3320
3344
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3321
3345
|
children: [jsxRuntime.jsx(uiKit.AccessibleHidden, {
|
|
3322
3346
|
children: jsxRuntime.jsx("label", {
|
|
@@ -3325,7 +3349,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
3325
3349
|
})
|
|
3326
3350
|
}), this.props.as === 'textarea' ? jsxRuntime.jsx(Textarea__default["default"], _objectSpread$1a(_objectSpread$1a({}, commonProps), {}, {
|
|
3327
3351
|
id: inputId,
|
|
3328
|
-
className: classnames__default["default"](styles$i.textarea, styles$i[
|
|
3352
|
+
className: classnames__default["default"](styles$i.textarea, styles$i["textarea-".concat(this.props.style)], {
|
|
3329
3353
|
[styles$i.invalid]: !this.props.isValid,
|
|
3330
3354
|
[styles$i.disabled]: this.props.disabled
|
|
3331
3355
|
}),
|
|
@@ -3336,7 +3360,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
3336
3360
|
id: inputId,
|
|
3337
3361
|
ref: this.props.inputRef,
|
|
3338
3362
|
type: this.props.as,
|
|
3339
|
-
className: classnames__default["default"](styles$i[
|
|
3363
|
+
className: classnames__default["default"](styles$i["input-".concat(this.props.style)], {
|
|
3340
3364
|
[styles$i.invalid]: !this.props.isValid,
|
|
3341
3365
|
[styles$i.disabled]: this.props.disabled,
|
|
3342
3366
|
[styles$i.granular]: this.props.isGranular
|
|
@@ -3356,7 +3380,6 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
3356
3380
|
return null;
|
|
3357
3381
|
}
|
|
3358
3382
|
}]);
|
|
3359
|
-
return ThrottledField;
|
|
3360
3383
|
}(React.PureComponent);
|
|
3361
3384
|
ThrottledField.displayName = 'ThrottledField';
|
|
3362
3385
|
ThrottledField.defaultProps = {
|
|
@@ -3413,53 +3436,54 @@ var styles$h = {
|
|
|
3413
3436
|
"action": "search-input-module__action___1GqGT"
|
|
3414
3437
|
};
|
|
3415
3438
|
let SearchInput = /*#__PURE__*/function (_Component) {
|
|
3416
|
-
_inherits(SearchInput, _Component);
|
|
3417
3439
|
function SearchInput() {
|
|
3418
|
-
var
|
|
3440
|
+
var _this2;
|
|
3419
3441
|
_classCallCheck(this, SearchInput);
|
|
3420
3442
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3421
3443
|
args[_key] = arguments[_key];
|
|
3422
3444
|
}
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
initialValue:
|
|
3426
|
-
text:
|
|
3445
|
+
_this2 = _callSuper$6(this, SearchInput, [...args]);
|
|
3446
|
+
_this2.state = {
|
|
3447
|
+
initialValue: _this2.props.initialValue,
|
|
3448
|
+
text: _this2.props.initialValue || ''
|
|
3427
3449
|
};
|
|
3428
|
-
|
|
3450
|
+
_this2.handleInputChange = event => {
|
|
3429
3451
|
const value = event.target.value;
|
|
3430
|
-
|
|
3452
|
+
_this2.setState({
|
|
3431
3453
|
text: value
|
|
3432
3454
|
}, () => {
|
|
3433
|
-
if (
|
|
3434
|
-
if (
|
|
3455
|
+
if (_this2.props.shouldSubmitOnInputChange) _this2.props.onSubmit(value, _this2.props.searchMode);
|
|
3456
|
+
if (_this2.props.onChange) _this2.props.onChange(value);
|
|
3435
3457
|
});
|
|
3436
3458
|
};
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
text:
|
|
3459
|
+
_this2.handleEnter = value => {
|
|
3460
|
+
_this2.setState({
|
|
3461
|
+
text: _this2.props.shouldClearOnSubmit ? '' : value
|
|
3440
3462
|
});
|
|
3441
|
-
|
|
3463
|
+
_this2.props.onSubmit(value, _this2.props.searchMode);
|
|
3442
3464
|
};
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3465
|
+
_this2.handleSubmit = () => {
|
|
3466
|
+
_this2.props.onSubmit(_this2.state.text, _this2.props.searchMode);
|
|
3467
|
+
_this2.props.shouldClearOnSubmit && _this2.setState({
|
|
3446
3468
|
text: ''
|
|
3447
3469
|
});
|
|
3448
3470
|
};
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3471
|
+
_this2.handleClear = () => {
|
|
3472
|
+
var _this2$inputRef;
|
|
3473
|
+
(_this2$inputRef = _this2.inputRef) === null || _this2$inputRef === void 0 || _this2$inputRef.focus();
|
|
3474
|
+
_this2.props.onChange(null);
|
|
3475
|
+
_this2.props.onReset();
|
|
3476
|
+
_this2.setState({
|
|
3454
3477
|
text: ''
|
|
3455
3478
|
});
|
|
3456
3479
|
};
|
|
3457
|
-
|
|
3458
|
-
|
|
3480
|
+
_this2.setInputRef = inputRef => {
|
|
3481
|
+
_this2.inputRef = inputRef;
|
|
3459
3482
|
};
|
|
3460
|
-
return
|
|
3483
|
+
return _this2;
|
|
3461
3484
|
}
|
|
3462
|
-
|
|
3485
|
+
_inherits(SearchInput, _Component);
|
|
3486
|
+
return _createClass(SearchInput, [{
|
|
3463
3487
|
key: "shouldComponentUpdate",
|
|
3464
3488
|
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
3465
3489
|
// ignore state, since it is only use to keep track of the text in the child
|
|
@@ -3534,7 +3558,6 @@ let SearchInput = /*#__PURE__*/function (_Component) {
|
|
|
3534
3558
|
return null;
|
|
3535
3559
|
}
|
|
3536
3560
|
}]);
|
|
3537
|
-
return SearchInput;
|
|
3538
3561
|
}(React.Component);
|
|
3539
3562
|
SearchInput.displayName = 'SearchInput';
|
|
3540
3563
|
SearchInput.defaultProps = {
|
|
@@ -3559,12 +3582,12 @@ const useExecuteGraphQLRequest = () => {
|
|
|
3559
3582
|
};
|
|
3560
3583
|
const createSearchProductsFromPIMAction = (searchTerm, projectKey) => sdk.actions.post({
|
|
3561
3584
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.PIM_SEARCH,
|
|
3562
|
-
uri:
|
|
3585
|
+
uri: "/".concat(projectKey, "/search/product-types"),
|
|
3563
3586
|
payload: {
|
|
3564
3587
|
query: {
|
|
3565
3588
|
wildcard: {
|
|
3566
3589
|
field: 'name',
|
|
3567
|
-
value:
|
|
3590
|
+
value: "*".concat(searchTerm, "*"),
|
|
3568
3591
|
caseInsensitive: true
|
|
3569
3592
|
}
|
|
3570
3593
|
},
|
|
@@ -3578,8 +3601,9 @@ const useFetchProductTypesFromPIM = _ref => {
|
|
|
3578
3601
|
const dispatch = sdk.useAsyncDispatch();
|
|
3579
3602
|
const executeGraphQLRequest = useExecuteGraphQLRequest();
|
|
3580
3603
|
const fetchProductTypesFromPim = React.useCallback(async searchTerm => {
|
|
3604
|
+
var _result$hits$map, _result$hits;
|
|
3581
3605
|
const result = await dispatch(createSearchProductsFromPIMAction(searchTerm, projectKey));
|
|
3582
|
-
const ids =
|
|
3606
|
+
const ids = (_result$hits$map = result === null || result === void 0 || (_result$hits = result.hits) === null || _result$hits === void 0 ? void 0 : _mapInstanceProperty__default["default"](_result$hits).call(_result$hits, hit => hit.id)) !== null && _result$hits$map !== void 0 ? _result$hits$map : [];
|
|
3583
3607
|
// Avoid sending any requests if it's clear that nothing is found
|
|
3584
3608
|
if (ids.length === 0) {
|
|
3585
3609
|
return {
|
|
@@ -3614,19 +3638,22 @@ const useFetchProductTypesFromPIM = _ref => {
|
|
|
3614
3638
|
*/
|
|
3615
3639
|
const constructNestedExpression = (reversedPath, predicate) => {
|
|
3616
3640
|
if (reversedPath.length > 0) {
|
|
3617
|
-
return _reduceInstanceProperty__default["default"](reversedPath).call(reversedPath, (nextNestedValue, nestedSelection) =>
|
|
3641
|
+
return _reduceInstanceProperty__default["default"](reversedPath).call(reversedPath, (nextNestedValue, nestedSelection) => {
|
|
3642
|
+
var _context;
|
|
3643
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(nestedSelection, "(")).call(_context, nextNestedValue, ")");
|
|
3644
|
+
}, predicate);
|
|
3618
3645
|
}
|
|
3619
3646
|
return predicate;
|
|
3620
3647
|
};
|
|
3621
3648
|
const constructPrefixSearchPredicate$1 = (prefixSearchFields, lowerBound, upperBound) => {
|
|
3622
3649
|
const constructPrefixSearchExpression = field => {
|
|
3623
|
-
var
|
|
3650
|
+
var _context2, _context3, _context4, _context5;
|
|
3624
3651
|
const parts = field.split('.');
|
|
3625
|
-
const _parts$slice$reverse = _reverseInstanceProperty__default["default"](
|
|
3652
|
+
const _parts$slice$reverse = _reverseInstanceProperty__default["default"](_context2 = _sliceInstanceProperty__default["default"](parts).call(parts)).call(_context2),
|
|
3626
3653
|
_parts$slice$reverse2 = _toArray(_parts$slice$reverse),
|
|
3627
3654
|
valueToNest = _parts$slice$reverse2[0],
|
|
3628
3655
|
reversedPathToNestedValue = _sliceInstanceProperty__default["default"](_parts$slice$reverse2).call(_parts$slice$reverse2, 1);
|
|
3629
|
-
const predicateExpression =
|
|
3656
|
+
const predicateExpression = _concatInstanceProperty__default["default"](_context3 = _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = "".concat(valueToNest, " >= \"")).call(_context5, lowerBound, "\" and ")).call(_context4, valueToNest, " < \"")).call(_context3, upperBound, "\"");
|
|
3630
3657
|
return constructNestedExpression(reversedPathToNestedValue, predicateExpression);
|
|
3631
3658
|
};
|
|
3632
3659
|
return _mapInstanceProperty__default["default"](prefixSearchFields).call(prefixSearchFields, constructPrefixSearchExpression).join(' or ');
|
|
@@ -3634,7 +3661,7 @@ const constructPrefixSearchPredicate$1 = (prefixSearchFields, lowerBound, upperB
|
|
|
3634
3661
|
const constructWherePredicate = (inputValue, prefixSearchFields) => {
|
|
3635
3662
|
const wherePredicate = function () {
|
|
3636
3663
|
if (inputValue.length) {
|
|
3637
|
-
if (isUUID(inputValue)) return
|
|
3664
|
+
if (isUUID(inputValue)) return "id = \"".concat(inputValue, "\"");else {
|
|
3638
3665
|
const _getPrefixSearchBound = getPrefixSearchBounds(inputValue),
|
|
3639
3666
|
_getPrefixSearchBound2 = _slicedToArray(_getPrefixSearchBound, 2),
|
|
3640
3667
|
lowerBound = _getPrefixSearchBound2[0],
|
|
@@ -3659,6 +3686,7 @@ const useFetchProductTypessFromCTP = _ref2 => {
|
|
|
3659
3686
|
}, [prefixSearchFields, executeGraphQLRequest]);
|
|
3660
3687
|
};
|
|
3661
3688
|
const usePimStatus = () => {
|
|
3689
|
+
var _data$indicesExist;
|
|
3662
3690
|
const _useQuery = react.useQuery(FetchIndicesExist$1, {
|
|
3663
3691
|
context: {
|
|
3664
3692
|
target: constants.GRAPHQL_TARGETS.PIM_INDEXER
|
|
@@ -3668,17 +3696,20 @@ const usePimStatus = () => {
|
|
|
3668
3696
|
data = _useQuery.data;
|
|
3669
3697
|
return {
|
|
3670
3698
|
data,
|
|
3671
|
-
isProjectIndexed: Boolean(data
|
|
3699
|
+
isProjectIndexed: Boolean(data === null || data === void 0 || (_data$indicesExist = data.indicesExist) === null || _data$indicesExist === void 0 || (_data$indicesExist = _data$indicesExist.productTypes) === null || _data$indicesExist === void 0 ? void 0 : _data$indicesExist.searchableIndexExists)
|
|
3672
3700
|
};
|
|
3673
3701
|
};
|
|
3674
3702
|
const useProductTypeOptions = _ref3 => {
|
|
3675
3703
|
let prefixSearchFields = _ref3.prefixSearchFields;
|
|
3676
3704
|
const _usePimStatus = usePimStatus(),
|
|
3677
3705
|
isProjectIndexed = _usePimStatus.isProjectIndexed;
|
|
3678
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context =>
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3706
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => {
|
|
3707
|
+
var _context$project;
|
|
3708
|
+
return {
|
|
3709
|
+
dataLocale: context.dataLocale,
|
|
3710
|
+
projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key
|
|
3711
|
+
};
|
|
3712
|
+
}),
|
|
3682
3713
|
dataLocale = _useApplicationContex.dataLocale,
|
|
3683
3714
|
projectKey = _useApplicationContex.projectKey;
|
|
3684
3715
|
const fetchProductTypesFromPim = useFetchProductTypesFromPIM({
|
|
@@ -3742,9 +3773,10 @@ const useHandlers = onChange => {
|
|
|
3742
3773
|
setInputValue(changedValue);
|
|
3743
3774
|
}, []);
|
|
3744
3775
|
const handleChange = useEventCallback(event => {
|
|
3776
|
+
var _event$target$value;
|
|
3745
3777
|
const eventWithExtractedValue = _objectSpread$18(_objectSpread$18({}, event), {}, {
|
|
3746
3778
|
target: _objectSpread$18(_objectSpread$18({}, event.target), {}, {
|
|
3747
|
-
value: event.target.value
|
|
3779
|
+
value: (_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.value
|
|
3748
3780
|
})
|
|
3749
3781
|
});
|
|
3750
3782
|
onChange(eventWithExtractedValue);
|
|
@@ -3754,21 +3786,24 @@ const useHandlers = onChange => {
|
|
|
3754
3786
|
|
|
3755
3787
|
const _excluded$3 = ["extraWhere"];
|
|
3756
3788
|
function ownKeys$17(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; }
|
|
3757
|
-
function _objectSpread$17(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
3789
|
+
function _objectSpread$17(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context7 = ownKeys$17(Object(t), !0)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context8 = ownKeys$17(Object(t))).call(_context8, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
3758
3790
|
const constructPrefixSearchPredicate = function () {
|
|
3759
3791
|
let prefixSearchFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
3760
3792
|
let lowerBound = arguments.length > 1 ? arguments[1] : undefined;
|
|
3761
3793
|
let upperBound = arguments.length > 2 ? arguments[2] : undefined;
|
|
3762
3794
|
const constructPrefixSearchExpression = field => {
|
|
3763
|
-
var _context;
|
|
3795
|
+
var _context, _context2, _context3, _context4;
|
|
3764
3796
|
const path = field.split('.');
|
|
3765
3797
|
const _path$slice$reverse = _reverseInstanceProperty__default["default"](_context = _sliceInstanceProperty__default["default"](path).call(path)).call(_context),
|
|
3766
3798
|
_path$slice$reverse2 = _toArray(_path$slice$reverse),
|
|
3767
3799
|
finalValueInPath = _path$slice$reverse2[0],
|
|
3768
3800
|
remainPathInReverse = _sliceInstanceProperty__default["default"](_path$slice$reverse2).call(_path$slice$reverse2, 1);
|
|
3769
|
-
const comparison =
|
|
3801
|
+
const comparison = _concatInstanceProperty__default["default"](_context2 = _concatInstanceProperty__default["default"](_context3 = _concatInstanceProperty__default["default"](_context4 = "".concat(finalValueInPath, " >= \"")).call(_context4, lowerBound, "\" and ")).call(_context3, finalValueInPath, " < \"")).call(_context2, upperBound, "\"");
|
|
3770
3802
|
if (remainPathInReverse.length) {
|
|
3771
|
-
return _reduceInstanceProperty__default["default"](remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) =>
|
|
3803
|
+
return _reduceInstanceProperty__default["default"](remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) => {
|
|
3804
|
+
var _context5;
|
|
3805
|
+
return _concatInstanceProperty__default["default"](_context5 = "".concat(nextPath, "(")).call(_context5, nestedPath, ")");
|
|
3806
|
+
}, comparison);
|
|
3772
3807
|
}
|
|
3773
3808
|
return comparison;
|
|
3774
3809
|
};
|
|
@@ -3784,7 +3819,7 @@ const useLoadOptions = _ref => {
|
|
|
3784
3819
|
let where;
|
|
3785
3820
|
if (inputValue.length) {
|
|
3786
3821
|
if (isUUID(inputValue)) {
|
|
3787
|
-
where =
|
|
3822
|
+
where = "id = \"".concat(inputValue, "\"");
|
|
3788
3823
|
} else {
|
|
3789
3824
|
const _getPrefixSearchBound = getPrefixSearchBounds(inputValue),
|
|
3790
3825
|
_getPrefixSearchBound2 = _slicedToArray(_getPrefixSearchBound, 2),
|
|
@@ -3793,11 +3828,12 @@ const useLoadOptions = _ref => {
|
|
|
3793
3828
|
where = constructPrefixSearchPredicate(prefixSearchFields, lowerBound, upperBound);
|
|
3794
3829
|
}
|
|
3795
3830
|
}
|
|
3796
|
-
const _ref2 = variables
|
|
3831
|
+
const _ref2 = variables !== null && variables !== void 0 ? variables : {},
|
|
3797
3832
|
extraWhere = _ref2.extraWhere,
|
|
3798
3833
|
restVariables = _objectWithoutProperties(_ref2, _excluded$3);
|
|
3799
3834
|
if (typeof extraWhere === 'string') {
|
|
3800
|
-
|
|
3835
|
+
var _context6;
|
|
3836
|
+
where = where ? _concatInstanceProperty__default["default"](_context6 = "(".concat(where, ") and ")).call(_context6, variables.extraWhere) : variables.extraWhere;
|
|
3801
3837
|
}
|
|
3802
3838
|
return client$1.query({
|
|
3803
3839
|
query,
|
|
@@ -3814,6 +3850,7 @@ const useLoadOptions = _ref => {
|
|
|
3814
3850
|
};
|
|
3815
3851
|
|
|
3816
3852
|
function useCurrentOption(_ref) {
|
|
3853
|
+
var _context;
|
|
3817
3854
|
let id = _ref.id,
|
|
3818
3855
|
typename = _ref.typename,
|
|
3819
3856
|
query = _ref.query,
|
|
@@ -3825,7 +3862,7 @@ function useCurrentOption(_ref) {
|
|
|
3825
3862
|
// load from cache when possible to speed up initial render
|
|
3826
3863
|
const canReadFromCache = id && typename && fragment;
|
|
3827
3864
|
const cacheItem = canReadFromCache ? apolloClient.readFragment({
|
|
3828
|
-
id:
|
|
3865
|
+
id: _concatInstanceProperty__default["default"](_context = "".concat(typename, ":")).call(_context, id),
|
|
3829
3866
|
fragment
|
|
3830
3867
|
}) : undefined;
|
|
3831
3868
|
|
|
@@ -3843,7 +3880,7 @@ function useCurrentOption(_ref) {
|
|
|
3843
3880
|
queryData = _useQuery.data,
|
|
3844
3881
|
queryError = _useQuery.error;
|
|
3845
3882
|
const queryItem = queryData && queryDataToItem(queryData);
|
|
3846
|
-
const item = queryItem
|
|
3883
|
+
const item = queryItem !== null && queryItem !== void 0 ? queryItem : cacheItem;
|
|
3847
3884
|
const loading = item ? false : queryLoading;
|
|
3848
3885
|
const error = item ? undefined : queryError;
|
|
3849
3886
|
const data = item && itemToOption(item);
|
|
@@ -3882,6 +3919,7 @@ const convertProductTypeToOption = productType => {
|
|
|
3882
3919
|
};
|
|
3883
3920
|
};
|
|
3884
3921
|
const ProductTypePickerInput = _ref => {
|
|
3922
|
+
var _currentOption$data$l, _currentOption$data;
|
|
3885
3923
|
let isClearable = _ref.isClearable,
|
|
3886
3924
|
isDisabled = _ref.isDisabled,
|
|
3887
3925
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -3913,8 +3951,9 @@ const ProductTypePickerInput = _ref => {
|
|
|
3913
3951
|
itemToOption: convertProductTypeToOption
|
|
3914
3952
|
});
|
|
3915
3953
|
const handleLoadOptions = React.useCallback(inputValue => loadProductTypes(inputValue).then(_ref3 => {
|
|
3954
|
+
var _data$productTypes;
|
|
3916
3955
|
let data = _ref3.data;
|
|
3917
|
-
return data.productTypes
|
|
3956
|
+
return ((_data$productTypes = data.productTypes) === null || _data$productTypes === void 0 ? void 0 : _data$productTypes.results) || [];
|
|
3918
3957
|
}).then(productTypes => _mapInstanceProperty__default["default"](productTypes).call(productTypes, convertProductTypeToOption)).catch(error => {
|
|
3919
3958
|
setLoadingError(error);
|
|
3920
3959
|
onError(error);
|
|
@@ -3928,12 +3967,12 @@ const ProductTypePickerInput = _ref => {
|
|
|
3928
3967
|
setLoadingError(null);
|
|
3929
3968
|
handleInternalInputChange(event);
|
|
3930
3969
|
}, [handleInternalInputChange]);
|
|
3931
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
3970
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption === null || currentOption === void 0 ? void 0 : currentOption.error);
|
|
3932
3971
|
React.useEffect(() => {
|
|
3933
3972
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
3934
3973
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
3935
3974
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
3936
|
-
const tooltipTitle = currentOption
|
|
3975
|
+
const tooltipTitle = (_currentOption$data$l = currentOption === null || currentOption === void 0 || (_currentOption$data = currentOption.data) === null || _currentOption$data === void 0 ? void 0 : _currentOption$data.label) !== null && _currentOption$data$l !== void 0 ? _currentOption$data$l : '';
|
|
3937
3976
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
3938
3977
|
max: "scale",
|
|
3939
3978
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -3987,6 +4026,7 @@ var messages$C = reactIntl.defineMessages({
|
|
|
3987
4026
|
var GetStatesQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetStatesQuery" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "where" } }, type: { kind: "NamedType", name: { kind: "Name", value: "String" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "sortByNamePath" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "states" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "where" }, value: { kind: "Variable", name: { kind: "Name", value: "where" } } }, { kind: "Argument", name: { kind: "Name", value: "sort" }, value: { kind: "ListValue", values: [{ kind: "Variable", name: { kind: "Name", value: "sortByNamePath" } }, { kind: "StringValue", value: "key", block: false }] } }, { kind: "Argument", name: { kind: "Name", value: "limit" }, value: { kind: "IntValue", value: "60" } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }] } }] } }], loc: { start: 0, end: 377, source: { body: "query GetStatesQuery($where: String, $sortByNamePath: String!) {\n states(where: $where, sort: [$sortByNamePath, \"key\"], limit: 60) {\n total\n results {\n id\n key\n nameAllLocales {\n locale\n value\n }\n }\n }\n}\n\nquery GetStateQuery($id: String) {\n state(id: $id) {\n id\n key\n nameAllLocales {\n locale\n value\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
3988
4027
|
var GetStateQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetStateQuery" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "id" } }, type: { kind: "NamedType", name: { kind: "Name", value: "String" } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "state" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "id" }, value: { kind: "Variable", name: { kind: "Name", value: "id" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }] } }], loc: { start: 0, end: 377, source: { body: "query GetStatesQuery($where: String, $sortByNamePath: String!) {\n states(where: $where, sort: [$sortByNamePath, \"key\"], limit: 60) {\n total\n results {\n id\n key\n nameAllLocales {\n locale\n value\n }\n }\n }\n}\n\nquery GetStateQuery($id: String) {\n state(id: $id) {\n id\n key\n nameAllLocales {\n locale\n value\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
3989
4028
|
const StatePickerInput = _ref => {
|
|
4029
|
+
var _currentOption$data$l, _currentOption$data;
|
|
3990
4030
|
let isClearable = _ref.isClearable,
|
|
3991
4031
|
isDisabled = _ref.isDisabled,
|
|
3992
4032
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -4002,7 +4042,7 @@ const StatePickerInput = _ref => {
|
|
|
4002
4042
|
formatMessage = _useIntl.formatMessage;
|
|
4003
4043
|
const dataLocale = applicationShellConnectors.useApplicationContext(applicationContext => applicationContext.dataLocale);
|
|
4004
4044
|
const variables = React.useMemo(() => ({
|
|
4005
|
-
sortByNamePath:
|
|
4045
|
+
sortByNamePath: "name.".concat(dataLocale)
|
|
4006
4046
|
}), [dataLocale]);
|
|
4007
4047
|
const convertStateToOption = React.useCallback(state => {
|
|
4008
4048
|
const localizedName = formatLocalizedFieldToString(state.nameAllLocales);
|
|
@@ -4017,7 +4057,7 @@ const StatePickerInput = _ref => {
|
|
|
4017
4057
|
_useState2 = _slicedToArray(_useState, 2),
|
|
4018
4058
|
loadingError = _useState2[0],
|
|
4019
4059
|
setLoadingError = _useState2[1];
|
|
4020
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
4060
|
+
const prefixSearchFields = React.useMemo(() => ["name.".concat(dataLocale), 'key'], [dataLocale]);
|
|
4021
4061
|
const loadOptions = useLoadOptions({
|
|
4022
4062
|
query: GetStatesQuery,
|
|
4023
4063
|
variables,
|
|
@@ -4050,13 +4090,13 @@ const StatePickerInput = _ref => {
|
|
|
4050
4090
|
setLoadingError(null);
|
|
4051
4091
|
handleInternalInputChange(event);
|
|
4052
4092
|
}, [handleInternalInputChange]);
|
|
4053
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
4093
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption === null || currentOption === void 0 ? void 0 : currentOption.error);
|
|
4054
4094
|
React.useEffect(() => {
|
|
4055
4095
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
4056
4096
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
4057
4097
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
4058
4098
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$C.noStatesFound), [loadingError, formatMessage]);
|
|
4059
|
-
const tooltipTitle = currentOption
|
|
4099
|
+
const tooltipTitle = (_currentOption$data$l = currentOption === null || currentOption === void 0 || (_currentOption$data = currentOption.data) === null || _currentOption$data === void 0 ? void 0 : _currentOption$data.label) !== null && _currentOption$data$l !== void 0 ? _currentOption$data$l : '';
|
|
4060
4100
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
4061
4101
|
max: "scale",
|
|
4062
4102
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -4124,23 +4164,26 @@ const CustomFieldTooltip = _ref => {
|
|
|
4124
4164
|
|
|
4125
4165
|
const setToArray = function () {
|
|
4126
4166
|
let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4127
|
-
return
|
|
4167
|
+
return "id in (".concat(_mapInstanceProperty__default["default"](values).call(values, value => "\"".concat(value, "\"")).join(', '), ")");
|
|
4128
4168
|
};
|
|
4129
4169
|
|
|
4130
4170
|
function capitalizeFirst(text) {
|
|
4131
4171
|
return text.charAt(0).toUpperCase() + _sliceInstanceProperty__default["default"](text).call(text, 1);
|
|
4132
4172
|
}
|
|
4133
4173
|
|
|
4134
|
-
const getCentAmountClause = (value, operator, locale) =>
|
|
4174
|
+
const getCentAmountClause = (value, operator, locale) => {
|
|
4175
|
+
var _context;
|
|
4176
|
+
return _concatInstanceProperty__default["default"](_context = "centAmount ".concat(operator, " ")).call(_context, uiKit.MoneyInput.convertToMoneyValue(value, locale).centAmount);
|
|
4177
|
+
};
|
|
4135
4178
|
function moneyTransformer(value, option, locale) {
|
|
4136
4179
|
const clauses = [];
|
|
4137
4180
|
if (option === FILTER_TYPES.range) {
|
|
4138
|
-
clauses[0] =
|
|
4181
|
+
clauses[0] = "currencyCode = \"".concat(value.from.currencyCode, "\"");
|
|
4139
4182
|
clauses[1] = getCentAmountClause(value.from, '>=', locale);
|
|
4140
4183
|
clauses[2] = getCentAmountClause(value.to, '<=', locale);
|
|
4141
4184
|
return clauses.join(' and ');
|
|
4142
4185
|
}
|
|
4143
|
-
clauses[0] =
|
|
4186
|
+
clauses[0] = "currencyCode = \"".concat(value.currencyCode, "\"");
|
|
4144
4187
|
switch (option) {
|
|
4145
4188
|
case FILTER_TYPES.lessThan:
|
|
4146
4189
|
clauses[1] = getCentAmountClause(value, '<', locale);
|
|
@@ -4157,6 +4200,7 @@ function moneyTransformer(value, option, locale) {
|
|
|
4157
4200
|
return clauses.join(' and ');
|
|
4158
4201
|
}
|
|
4159
4202
|
|
|
4203
|
+
var _templateObject$2, _templateObject2$1;
|
|
4160
4204
|
const formatTime = 'HH:mm:ss.SSS';
|
|
4161
4205
|
|
|
4162
4206
|
/* TimeInput only allows HH:mm:ss and adds the seconds as 00 and
|
|
@@ -4178,6 +4222,7 @@ const defaultFilterValidator = _ref => {
|
|
|
4178
4222
|
const timeTransformer = function (filterKey, filters) {
|
|
4179
4223
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator;
|
|
4180
4224
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref2 => {
|
|
4225
|
+
var _context, _context2;
|
|
4181
4226
|
let type = _ref2.type,
|
|
4182
4227
|
value = _ref2.value;
|
|
4183
4228
|
if (!filterValidator({
|
|
@@ -4186,19 +4231,13 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4186
4231
|
})) return '';
|
|
4187
4232
|
switch (type) {
|
|
4188
4233
|
case FILTER_TYPES.lessThan:
|
|
4189
|
-
return
|
|
4234
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(filterKey, " < \"")).call(_context, value, "\"");
|
|
4190
4235
|
case FILTER_TYPES.moreThan:
|
|
4191
|
-
return
|
|
4236
|
+
return _concatInstanceProperty__default["default"](_context2 = "".concat(filterKey, " > \"")).call(_context2, value, "\"");
|
|
4192
4237
|
case FILTER_TYPES.equalTo:
|
|
4193
|
-
return oneLine__default["default"]
|
|
4194
|
-
(${filterKey} >= "${value}"
|
|
4195
|
-
and ${filterKey} <= "${getEndOfSecond(value)}")
|
|
4196
|
-
`;
|
|
4238
|
+
return oneLine__default["default"](_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n (", " >= \"", "\"\n and ", " <= \"", "\")\n "])), filterKey, value, filterKey, getEndOfSecond(value));
|
|
4197
4239
|
case FILTER_TYPES.range:
|
|
4198
|
-
return oneLine__default["default"]
|
|
4199
|
-
(${filterKey} >= "${value.from}"
|
|
4200
|
-
and ${filterKey} <= "${getEndOfSecond(value.to)}")
|
|
4201
|
-
`;
|
|
4240
|
+
return oneLine__default["default"](_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n (", " >= \"", "\"\n and ", " <= \"", "\")\n "])), filterKey, value.from, filterKey, getEndOfSecond(value.to));
|
|
4202
4241
|
default:
|
|
4203
4242
|
return '';
|
|
4204
4243
|
}
|
|
@@ -4214,7 +4253,7 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4214
4253
|
* (pickUpTime >= "14:00" and pickUpTime <= "15:00")
|
|
4215
4254
|
* ) or some_more_filters
|
|
4216
4255
|
*/
|
|
4217
|
-
return queryString === '' ? null :
|
|
4256
|
+
return queryString === '' ? null : "(".concat(queryString, ")");
|
|
4218
4257
|
};
|
|
4219
4258
|
|
|
4220
4259
|
// FIXME: delete once prefix search is supported in ctp api
|
|
@@ -4231,8 +4270,9 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4231
4270
|
// e.g
|
|
4232
4271
|
// where: `masterData(current(name(en >= "${lowerBound}" and en < "${upperBound}")))`
|
|
4233
4272
|
const getPrefixSearchBounds = input => {
|
|
4273
|
+
var _context;
|
|
4234
4274
|
const getNextCharacter = character => String.fromCharCode(character.charCodeAt() + 1);
|
|
4235
|
-
return [input,
|
|
4275
|
+
return [input, _concatInstanceProperty__default["default"](_context = "".concat(_sliceInstanceProperty__default["default"](input).call(input, 0, input.length - 1))).call(_context, getNextCharacter(_sliceInstanceProperty__default["default"](input).call(input, input.length - 1)))];
|
|
4236
4276
|
};
|
|
4237
4277
|
|
|
4238
4278
|
const _excluded$2 = ["action"];
|
|
@@ -4425,7 +4465,7 @@ const convertChangeValueAction = actionPayload => {
|
|
|
4425
4465
|
* as its dynamic content can not be typed in SDL for the mutation.
|
|
4426
4466
|
*/
|
|
4427
4467
|
const convertAction = (actionName, actionPayload) => {
|
|
4428
|
-
var _context3, _context4, _context5;
|
|
4468
|
+
var _actionPayload$type, _context3, _actionPayload$geoLoc, _actionPayload$geoLoc2, _actionPayload$shippi, _context4, _context5;
|
|
4429
4469
|
const getNameFromPayload = payload => {
|
|
4430
4470
|
// changeName for `Organizations`
|
|
4431
4471
|
if (typeof payload.name === 'string') return payload;
|
|
@@ -4490,7 +4530,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4490
4530
|
case 'setCustomType':
|
|
4491
4531
|
return {
|
|
4492
4532
|
[actionName]: {
|
|
4493
|
-
typeId: actionPayload.type
|
|
4533
|
+
typeId: (_actionPayload$type = actionPayload.type) === null || _actionPayload$type === void 0 ? void 0 : _actionPayload$type.id,
|
|
4494
4534
|
fields: actionPayload.fields ? _mapInstanceProperty__default["default"](_context3 = _Object$entries__default["default"](actionPayload.fields)).call(_context3, _ref => {
|
|
4495
4535
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
4496
4536
|
customField = _ref2[0],
|
|
@@ -4520,10 +4560,10 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4520
4560
|
};
|
|
4521
4561
|
case 'setGeoLocation':
|
|
4522
4562
|
return {
|
|
4523
|
-
[actionName]: actionPayload
|
|
4563
|
+
[actionName]: actionPayload !== null && actionPayload !== void 0 && actionPayload.geoLocation ? {
|
|
4524
4564
|
geoLocation: {
|
|
4525
4565
|
type: 'Point',
|
|
4526
|
-
coordinates: [_parseFloat__default["default"](actionPayload.geoLocation
|
|
4566
|
+
coordinates: [_parseFloat__default["default"]((_actionPayload$geoLoc = actionPayload.geoLocation) === null || _actionPayload$geoLoc === void 0 ? void 0 : _actionPayload$geoLoc.longitude), _parseFloat__default["default"]((_actionPayload$geoLoc2 = actionPayload.geoLocation) === null || _actionPayload$geoLoc2 === void 0 ? void 0 : _actionPayload$geoLoc2.latitude)]
|
|
4527
4567
|
}
|
|
4528
4568
|
} : {
|
|
4529
4569
|
undefined
|
|
@@ -4659,7 +4699,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4659
4699
|
case 'setShippingRateInputType':
|
|
4660
4700
|
return {
|
|
4661
4701
|
[actionName]: {
|
|
4662
|
-
shippingRateInputType: actionPayload.shippingRateInputType
|
|
4702
|
+
shippingRateInputType: (_actionPayload$shippi = actionPayload.shippingRateInputType) !== null && _actionPayload$shippi !== void 0 && _actionPayload$shippi.type ? {
|
|
4663
4703
|
[actionPayload.shippingRateInputType.type]: {
|
|
4664
4704
|
values: actionPayload.shippingRateInputType.type === 'CartClassification' ? _mapInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](actionPayload.shippingRateInputType)).call(_context4, value => ({
|
|
4665
4705
|
key: value.key,
|
|
@@ -4713,8 +4753,8 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4713
4753
|
case 'addAddress':
|
|
4714
4754
|
case 'changeAddress':
|
|
4715
4755
|
{
|
|
4716
|
-
var _context6;
|
|
4717
|
-
const _ref3 = actionPayload.address
|
|
4756
|
+
var _actionPayload$addres, _context6, _actionPayload$addres2;
|
|
4757
|
+
const _ref3 = ((_actionPayload$addres = actionPayload.address) === null || _actionPayload$addres === void 0 ? void 0 : _actionPayload$addres.custom) || {},
|
|
4718
4758
|
_ref3$fields = _ref3.fields,
|
|
4719
4759
|
fields = _ref3$fields === void 0 ? {} : _ref3$fields;
|
|
4720
4760
|
const customFields = isEmpty__default["default"](fields) ? null : _mapInstanceProperty__default["default"](_context6 = _Object$entries__default["default"](fields)).call(_context6, _ref4 => {
|
|
@@ -4726,7 +4766,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4726
4766
|
value: _JSON$stringify__default["default"](value)
|
|
4727
4767
|
};
|
|
4728
4768
|
});
|
|
4729
|
-
const custom = actionPayload.address
|
|
4769
|
+
const custom = (_actionPayload$addres2 = actionPayload.address) !== null && _actionPayload$addres2 !== void 0 && (_actionPayload$addres2 = _actionPayload$addres2.custom) !== null && _actionPayload$addres2 !== void 0 && (_actionPayload$addres2 = _actionPayload$addres2.type) !== null && _actionPayload$addres2 !== void 0 && _actionPayload$addres2.id ? {
|
|
4730
4770
|
type: {
|
|
4731
4771
|
id: actionPayload.address.custom.type.id
|
|
4732
4772
|
},
|
|
@@ -4757,7 +4797,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4757
4797
|
value: _JSON$stringify__default["default"](value)
|
|
4758
4798
|
};
|
|
4759
4799
|
});
|
|
4760
|
-
const customType = type
|
|
4800
|
+
const customType = type !== null && type !== void 0 && type.id ? {
|
|
4761
4801
|
id: type.id
|
|
4762
4802
|
} : null;
|
|
4763
4803
|
return {
|
|
@@ -4780,10 +4820,11 @@ const createGraphQlUpdateActions = actions => _reduceInstanceProperty__default["
|
|
|
4780
4820
|
return [...previousActions, convertAction(actionName, actionPayload)];
|
|
4781
4821
|
}, []);
|
|
4782
4822
|
const extractErrorFromGraphQlResponse = graphQlResponse => {
|
|
4783
|
-
|
|
4823
|
+
var _graphQlResponse$netw, _graphQlResponse$grap;
|
|
4824
|
+
if (((_graphQlResponse$netw = graphQlResponse.networkError) === null || _graphQlResponse$netw === void 0 || (_graphQlResponse$netw = _graphQlResponse$netw.result) === null || _graphQlResponse$netw === void 0 || (_graphQlResponse$netw = _graphQlResponse$netw.errors) === null || _graphQlResponse$netw === void 0 ? void 0 : _graphQlResponse$netw.length) > 0) {
|
|
4784
4825
|
return graphQlResponse.networkError.result.errors;
|
|
4785
4826
|
}
|
|
4786
|
-
if (graphQlResponse.graphQLErrors
|
|
4827
|
+
if (((_graphQlResponse$grap = graphQlResponse.graphQLErrors) === null || _graphQlResponse$grap === void 0 ? void 0 : _graphQlResponse$grap.length) > 0) {
|
|
4787
4828
|
return graphQlResponse.graphQLErrors;
|
|
4788
4829
|
}
|
|
4789
4830
|
return graphQlResponse;
|
|
@@ -4812,14 +4853,16 @@ function omitDeep(obj, fieldsToOmit) {
|
|
|
4812
4853
|
function ownKeys$14(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; }
|
|
4813
4854
|
function _objectSpread$14(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$14(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$14(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
4814
4855
|
function getPriceChannelName(price) {
|
|
4815
|
-
|
|
4856
|
+
var _ref, _price$channel$name, _price$channel, _price$channel2;
|
|
4857
|
+
return (_ref = (_price$channel$name = (_price$channel = price.channel) === null || _price$channel === void 0 ? void 0 : _price$channel.name) !== null && _price$channel$name !== void 0 ? _price$channel$name : (_price$channel2 = price.channel) === null || _price$channel2 === void 0 ? void 0 : _price$channel2.key) !== null && _ref !== void 0 ? _ref : null;
|
|
4816
4858
|
}
|
|
4817
4859
|
function getDiscountValue(price) {
|
|
4860
|
+
var _price$value, _price$value2, _price$discounted;
|
|
4818
4861
|
let preciseAmount;
|
|
4819
4862
|
let fractionedAmount;
|
|
4820
|
-
if (price.value
|
|
4863
|
+
if (((_price$value = price.value) === null || _price$value === void 0 ? void 0 : _price$value.type) === PRECISION_TYPES.highPrecision && price.discounted.value.type === PRECISION_TYPES.highPrecision) {
|
|
4821
4864
|
preciseAmount = price.value.preciseAmount - price.discounted.value.preciseAmount;
|
|
4822
|
-
} else if (price.value
|
|
4865
|
+
} else if (((_price$value2 = price.value) === null || _price$value2 === void 0 ? void 0 : _price$value2.type) === PRECISION_TYPES.highPrecision && ((_price$discounted = price.discounted) === null || _price$discounted === void 0 || (_price$discounted = _price$discounted.value) === null || _price$discounted === void 0 ? void 0 : _price$discounted.type) === PRECISION_TYPES.centPrecision) {
|
|
4823
4866
|
fractionedAmount = getFractionedAmount(price.value) - getFractionedAmount(price.discounted.value);
|
|
4824
4867
|
}
|
|
4825
4868
|
return price.discounted ? _objectSpread$14(_objectSpread$14({}, price.value), {}, {
|
|
@@ -4833,23 +4876,28 @@ function getDiscountValue(price) {
|
|
|
4833
4876
|
function getSelectedPrice(price) {
|
|
4834
4877
|
return price.discounted ? price.discounted : price;
|
|
4835
4878
|
}
|
|
4836
|
-
function getNetUnitPrice(
|
|
4837
|
-
|
|
4838
|
-
|
|
4879
|
+
function getNetUnitPrice(_ref2) {
|
|
4880
|
+
var _lineItem$perMethodTa, _filteredPerMethodTax;
|
|
4881
|
+
let lineItem = _ref2.lineItem,
|
|
4882
|
+
shouldRoundAmount = _ref2.shouldRoundAmount;
|
|
4839
4883
|
const price = getSelectedPrice(lineItem.price);
|
|
4840
|
-
const filteredPerMethodTaxRate = lineItem
|
|
4884
|
+
const filteredPerMethodTaxRate = lineItem === null || lineItem === void 0 || (_lineItem$perMethodTa = lineItem.perMethodTaxRate) === null || _lineItem$perMethodTa === void 0 ? void 0 : _filterInstanceProperty__default["default"](_lineItem$perMethodTa).call(_lineItem$perMethodTa, perMethodTax => {
|
|
4885
|
+
var _lineItem$shippingDet;
|
|
4886
|
+
return (lineItem === null || lineItem === void 0 || (_lineItem$shippingDet = lineItem.shippingDetails) === null || _lineItem$shippingDet === void 0 || (_lineItem$shippingDet = _lineItem$shippingDet.targets) === null || _lineItem$shippingDet === void 0 ? void 0 : _findIndexInstanceProperty__default["default"](_lineItem$shippingDet).call(_lineItem$shippingDet, target => (target === null || target === void 0 ? void 0 : target.shippingMethodKey) === (perMethodTax === null || perMethodTax === void 0 ? void 0 : perMethodTax.shippingMethodKey))) >= 0;
|
|
4887
|
+
});
|
|
4841
4888
|
|
|
4842
4889
|
// when shipping mode is multi with the same tax rate
|
|
4843
|
-
if (filteredPerMethodTaxRate
|
|
4890
|
+
if ((filteredPerMethodTaxRate === null || filteredPerMethodTaxRate === void 0 ? void 0 : filteredPerMethodTaxRate.length) > 0 && (_filteredPerMethodTax = filteredPerMethodTaxRate[0]) !== null && _filteredPerMethodTax !== void 0 && (_filteredPerMethodTax = _filteredPerMethodTax.taxRate) !== null && _filteredPerMethodTax !== void 0 && _filteredPerMethodTax.includedInPrice) {
|
|
4891
|
+
var _price$value3, _price$value4;
|
|
4844
4892
|
const taxRate = filteredPerMethodTaxRate[0].taxRate;
|
|
4845
4893
|
let centAmount;
|
|
4846
4894
|
// should accept 0 value
|
|
4847
|
-
if (typeof price.value
|
|
4895
|
+
if (typeof ((_price$value3 = price.value) === null || _price$value3 === void 0 ? void 0 : _price$value3.centAmount) === 'number') {
|
|
4848
4896
|
const amount = price.value.centAmount / (1 + taxRate.amount);
|
|
4849
4897
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4850
4898
|
}
|
|
4851
4899
|
let preciseAmount;
|
|
4852
|
-
if (price.value
|
|
4900
|
+
if (((_price$value4 = price.value) === null || _price$value4 === void 0 ? void 0 : _price$value4.type) === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + taxRate.amount);
|
|
4853
4901
|
return _objectSpread$14(_objectSpread$14({}, price.value), {}, {
|
|
4854
4902
|
centAmount,
|
|
4855
4903
|
preciseAmount
|
|
@@ -4858,14 +4906,15 @@ function getNetUnitPrice(_ref) {
|
|
|
4858
4906
|
|
|
4859
4907
|
// when shipping mode is single
|
|
4860
4908
|
if (lineItem.taxRate && lineItem.taxRate.includedInPrice) {
|
|
4909
|
+
var _price$value5, _price$value6;
|
|
4861
4910
|
let centAmount;
|
|
4862
4911
|
// should accept 0 value
|
|
4863
|
-
if (typeof price.value
|
|
4912
|
+
if (typeof ((_price$value5 = price.value) === null || _price$value5 === void 0 ? void 0 : _price$value5.centAmount) === 'number') {
|
|
4864
4913
|
const amount = price.value.centAmount / (1 + lineItem.taxRate.amount);
|
|
4865
4914
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4866
4915
|
}
|
|
4867
4916
|
let preciseAmount;
|
|
4868
|
-
if (price.value
|
|
4917
|
+
if (((_price$value6 = price.value) === null || _price$value6 === void 0 ? void 0 : _price$value6.type) === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + lineItem.taxRate.amount);
|
|
4869
4918
|
return _objectSpread$14(_objectSpread$14({}, price.value), {}, {
|
|
4870
4919
|
centAmount,
|
|
4871
4920
|
preciseAmount
|
|
@@ -4899,18 +4948,18 @@ const transformCustomFieldFromGraphQLResponse = resource => {
|
|
|
4899
4948
|
key: resource.custom.type.key,
|
|
4900
4949
|
name: l10n.transformLocalizedFieldToLocalizedString(resource.custom.type.nameAllLocales),
|
|
4901
4950
|
fieldDefinitions: _mapInstanceProperty__default["default"](_context = resource.custom.type.fieldDefinitions).call(_context, fieldDefinition => {
|
|
4902
|
-
var _context2, _context3;
|
|
4951
|
+
var _fieldDefinition$type, _context2, _fieldDefinition$type2, _context3;
|
|
4903
4952
|
return {
|
|
4904
4953
|
name: fieldDefinition.name,
|
|
4905
4954
|
required: fieldDefinition.required,
|
|
4906
|
-
type: fieldDefinition.type
|
|
4955
|
+
type: ((_fieldDefinition$type = fieldDefinition.type) === null || _fieldDefinition$type === void 0 || (_fieldDefinition$type = _fieldDefinition$type.elementType) === null || _fieldDefinition$type === void 0 ? void 0 : _fieldDefinition$type.name) === 'LocalizedEnum' ? _objectSpread$13(_objectSpread$13({}, fieldDefinition.type), {}, {
|
|
4907
4956
|
elementType: _objectSpread$13(_objectSpread$13({}, fieldDefinition.type.elementType), {}, {
|
|
4908
4957
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
4909
4958
|
key: value.key,
|
|
4910
4959
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
4911
4960
|
}))
|
|
4912
4961
|
})
|
|
4913
|
-
}) : fieldDefinition.type
|
|
4962
|
+
}) : ((_fieldDefinition$type2 = fieldDefinition.type) === null || _fieldDefinition$type2 === void 0 ? void 0 : _fieldDefinition$type2.name) === 'LocalizedEnum' ? _objectSpread$13(_objectSpread$13({}, fieldDefinition.type), {}, {
|
|
4914
4963
|
values: _mapInstanceProperty__default["default"](_context3 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context3, value => ({
|
|
4915
4964
|
key: value.key,
|
|
4916
4965
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -4937,7 +4986,7 @@ const convertProductSelectionFromGraphQl = productSelection => {
|
|
|
4937
4986
|
from: 'nameAllLocales',
|
|
4938
4987
|
to: 'name'
|
|
4939
4988
|
}])), {}, {
|
|
4940
|
-
custom: productSelection
|
|
4989
|
+
custom: productSelection !== null && productSelection !== void 0 && productSelection.custom ? transformCustomFieldFromGraphQLResponse(productSelection) : null
|
|
4941
4990
|
});
|
|
4942
4991
|
};
|
|
4943
4992
|
|
|
@@ -5067,12 +5116,12 @@ function _callSuper$5(_this, derived, args) {
|
|
|
5067
5116
|
var FetchTypeDefinitionsQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchTypeDefinitionsQuery" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "where" } }, type: { kind: "NamedType", name: { kind: "Name", value: "String" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "limit" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "offset" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "typeDefinitions" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "where" }, value: { kind: "Variable", name: { kind: "Name", value: "where" } } }, { kind: "Argument", name: { kind: "Name", value: "limit" }, value: { kind: "Variable", name: { kind: "Name", value: "limit" } } }, { kind: "Argument", name: { kind: "Name", value: "offset" }, value: { kind: "Variable", name: { kind: "Name", value: "offset" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "fieldDefinitions" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "SetType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "elementType" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "EnumType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "values" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "label" }, arguments: [], directives: [] }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "LocalizedEnumType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "values" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }] } }] } }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "EnumType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "values" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "label" }, arguments: [], directives: [] }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "LocalizedEnumType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "values" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ReferenceType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "referenceTypeId" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }] } }] } }] } }] } }] } }], loc: { start: 0, end: 1172, source: { body: "query FetchTypeDefinitionsQuery($where: String, $limit: Int, $offset: Int) {\n typeDefinitions(where: $where, limit: $limit, offset: $offset) {\n results {\n fieldDefinitions {\n type {\n name\n ... on SetType {\n elementType {\n name\n ... on EnumType {\n values {\n key\n label\n }\n }\n ... on LocalizedEnumType {\n values {\n key\n labelAllLocales {\n value\n locale\n }\n }\n }\n }\n }\n ... on EnumType {\n values {\n key\n label\n }\n }\n ... on LocalizedEnumType {\n values {\n key\n labelAllLocales {\n value\n locale\n }\n }\n }\n ... on ReferenceType {\n referenceTypeId\n }\n }\n name\n labelAllLocales {\n value\n locale\n }\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
5068
5117
|
const customizableResources$1 = ['asset', 'category', 'channel', 'customer', 'order', 'discount-code', 'cart-discount', 'inventory-entry', 'line-item', 'custom-line-item', 'product-price', 'payment', 'payment-interface-interaction', 'shopping-list', 'shopping-list-text-line-item', 'standalone-price', 'review'];
|
|
5069
5118
|
let CustomFieldDefinitionsConnector = /*#__PURE__*/function (_Component) {
|
|
5070
|
-
_inherits(CustomFieldDefinitionsConnector, _Component);
|
|
5071
5119
|
function CustomFieldDefinitionsConnector() {
|
|
5072
5120
|
_classCallCheck(this, CustomFieldDefinitionsConnector);
|
|
5073
5121
|
return _callSuper$5(this, CustomFieldDefinitionsConnector, arguments);
|
|
5074
5122
|
}
|
|
5075
|
-
|
|
5123
|
+
_inherits(CustomFieldDefinitionsConnector, _Component);
|
|
5124
|
+
return _createClass(CustomFieldDefinitionsConnector, [{
|
|
5076
5125
|
key: "componentDidMount",
|
|
5077
5126
|
value: function componentDidMount() {
|
|
5078
5127
|
var _context;
|
|
@@ -5090,15 +5139,14 @@ let CustomFieldDefinitionsConnector = /*#__PURE__*/function (_Component) {
|
|
|
5090
5139
|
});
|
|
5091
5140
|
}
|
|
5092
5141
|
}]);
|
|
5093
|
-
return CustomFieldDefinitionsConnector;
|
|
5094
5142
|
}(React.Component);
|
|
5095
5143
|
CustomFieldDefinitionsConnector.displayName = 'CustomFieldDefinitionsConnector';
|
|
5096
5144
|
CustomFieldDefinitionsConnector.defaultProps = {
|
|
5097
5145
|
resources: []
|
|
5098
5146
|
};
|
|
5099
|
-
const stringifyResources$1 = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource =>
|
|
5147
|
+
const stringifyResources$1 = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => "\"".concat(resource, "\"")).join();
|
|
5100
5148
|
const mapPropsToOptions = ownProps => {
|
|
5101
|
-
const where = ownProps.resources.length > 0 ?
|
|
5149
|
+
const where = ownProps.resources.length > 0 ? "resourceTypeIds contains any (".concat(stringifyResources$1(ownProps.resources), ")") : undefined;
|
|
5102
5150
|
return {
|
|
5103
5151
|
variables: {
|
|
5104
5152
|
where,
|
|
@@ -5167,19 +5215,19 @@ const graphQlDocToForm = typeDefinition => {
|
|
|
5167
5215
|
key: typeDefinition.key,
|
|
5168
5216
|
name: l10n.transformLocalizedFieldToLocalizedString(typeDefinition.nameAllLocales),
|
|
5169
5217
|
fieldDefinitions: _mapInstanceProperty__default["default"](_context = typeDefinition.fieldDefinitions).call(_context, fieldDefinition => {
|
|
5170
|
-
var _context2, _context3;
|
|
5218
|
+
var _fieldDefinition$type, _context2, _fieldDefinition$type2, _context3;
|
|
5171
5219
|
return {
|
|
5172
5220
|
name: fieldDefinition.name,
|
|
5173
5221
|
required: fieldDefinition.required,
|
|
5174
5222
|
inputHint: fieldDefinition.inputHint,
|
|
5175
|
-
type: fieldDefinition.type
|
|
5223
|
+
type: ((_fieldDefinition$type = fieldDefinition.type) === null || _fieldDefinition$type === void 0 || (_fieldDefinition$type = _fieldDefinition$type.elementType) === null || _fieldDefinition$type === void 0 ? void 0 : _fieldDefinition$type.name) === 'LocalizedEnum' ? _objectSpread$10(_objectSpread$10({}, fieldDefinition.type), {}, {
|
|
5176
5224
|
elementType: _objectSpread$10(_objectSpread$10({}, fieldDefinition.type.elementType), {}, {
|
|
5177
5225
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
5178
5226
|
key: value.key,
|
|
5179
5227
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
5180
5228
|
}))
|
|
5181
5229
|
})
|
|
5182
|
-
}) : fieldDefinition.type
|
|
5230
|
+
}) : ((_fieldDefinition$type2 = fieldDefinition.type) === null || _fieldDefinition$type2 === void 0 ? void 0 : _fieldDefinition$type2.name) === 'LocalizedEnum' ? _objectSpread$10(_objectSpread$10({}, fieldDefinition.type), {}, {
|
|
5183
5231
|
values: _mapInstanceProperty__default["default"](_context3 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context3, value => ({
|
|
5184
5232
|
key: value.key,
|
|
5185
5233
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -5211,7 +5259,7 @@ const formToGraphQlDoc = formCustomFields => ({
|
|
|
5211
5259
|
// TODO(pa3): find usages and make sure only 1 param is passed
|
|
5212
5260
|
const createEmptyCustomFields = typeDefinition => ({
|
|
5213
5261
|
fields: {},
|
|
5214
|
-
type: typeDefinition
|
|
5262
|
+
type: (typeDefinition === null || typeDefinition === void 0 ? void 0 : typeDefinition.type) || {
|
|
5215
5263
|
fieldDefinitions: []
|
|
5216
5264
|
}
|
|
5217
5265
|
});
|
|
@@ -5238,12 +5286,12 @@ const emptyTypeDefinitions = {
|
|
|
5238
5286
|
results: []
|
|
5239
5287
|
};
|
|
5240
5288
|
let CustomFieldTypeDefinitionsConnector = /*#__PURE__*/function (_Component) {
|
|
5241
|
-
_inherits(CustomFieldTypeDefinitionsConnector, _Component);
|
|
5242
5289
|
function CustomFieldTypeDefinitionsConnector() {
|
|
5243
5290
|
_classCallCheck(this, CustomFieldTypeDefinitionsConnector);
|
|
5244
5291
|
return _callSuper$4(this, CustomFieldTypeDefinitionsConnector, arguments);
|
|
5245
5292
|
}
|
|
5246
|
-
|
|
5293
|
+
_inherits(CustomFieldTypeDefinitionsConnector, _Component);
|
|
5294
|
+
return _createClass(CustomFieldTypeDefinitionsConnector, [{
|
|
5247
5295
|
key: "componentDidMount",
|
|
5248
5296
|
value: function componentDidMount() {
|
|
5249
5297
|
var _context;
|
|
@@ -5261,7 +5309,6 @@ let CustomFieldTypeDefinitionsConnector = /*#__PURE__*/function (_Component) {
|
|
|
5261
5309
|
});
|
|
5262
5310
|
}
|
|
5263
5311
|
}]);
|
|
5264
|
-
return CustomFieldTypeDefinitionsConnector;
|
|
5265
5312
|
}(React.Component);
|
|
5266
5313
|
CustomFieldTypeDefinitionsConnector.displayName = 'CustomFieldTypeDefinitionsConnector';
|
|
5267
5314
|
CustomFieldTypeDefinitionsConnector.defaultProps = {
|
|
@@ -5273,9 +5320,9 @@ CustomFieldTypeDefinitionsConnector.graphQlDocToForm = graphQlDocToForm;
|
|
|
5273
5320
|
CustomFieldTypeDefinitionsConnector.formToRestDoc = formToRestDoc;
|
|
5274
5321
|
CustomFieldTypeDefinitionsConnector.formToGraphQlDoc = formToGraphQlDoc;
|
|
5275
5322
|
CustomFieldTypeDefinitionsConnector.createEmptyCustomFields = createEmptyCustomFields;
|
|
5276
|
-
const stringifyResources = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource =>
|
|
5323
|
+
const stringifyResources = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => "\"".concat(resource, "\"")).join();
|
|
5277
5324
|
const createGraphQlOptions = ownProps => {
|
|
5278
|
-
const where = ownProps.resources.length > 0 ?
|
|
5325
|
+
const where = ownProps.resources.length > 0 ? "resourceTypeIds contains any (".concat(stringifyResources(ownProps.resources), ")") : undefined;
|
|
5279
5326
|
return {
|
|
5280
5327
|
variables: {
|
|
5281
5328
|
where,
|
|
@@ -5351,7 +5398,7 @@ const extractDuplicatedValues = (values, type, language, languages) => {
|
|
|
5351
5398
|
let validatedValues = [];
|
|
5352
5399
|
if (type.name.toLowerCase() === 'money') {
|
|
5353
5400
|
validatedValues = unique(values, ['amount', 'currencyCode']);
|
|
5354
|
-
} else if (type.name.toLowerCase() === 'reference') validatedValues = unique(_filterInstanceProperty__default["default"](values).call(values, value => value
|
|
5401
|
+
} else if (type.name.toLowerCase() === 'reference') validatedValues = unique(_filterInstanceProperty__default["default"](values).call(values, value => value === null || value === void 0 ? void 0 : value.id), ['id']);else if (type.name.toLowerCase() === 'localizedstring') {
|
|
5355
5402
|
validatedValues = unique(values, languages);
|
|
5356
5403
|
} else validatedValues = unique(values);
|
|
5357
5404
|
return validatedValues;
|
|
@@ -5592,6 +5639,7 @@ const getSubfieldLanguage = subfieldName => {
|
|
|
5592
5639
|
return subfieldName.substring(lastDotIndex + 1);
|
|
5593
5640
|
};
|
|
5594
5641
|
function CustomLocalizedTextInput(props) {
|
|
5642
|
+
var _value$language;
|
|
5595
5643
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
5596
5644
|
language: applicationContext.dataLocale,
|
|
5597
5645
|
languages: applicationContext.project.languages
|
|
@@ -5617,7 +5665,7 @@ function CustomLocalizedTextInput(props) {
|
|
|
5617
5665
|
props.renderWarnings && props.handleWarningChange(props.name, props.fieldDefinition, rawValue);
|
|
5618
5666
|
});
|
|
5619
5667
|
const InputComponent = isMultiLine ? uiKit.LocalizedMultilineTextInput : uiKit.LocalizedTextInput;
|
|
5620
|
-
const tooltipTitle = isMultiLine ? '' : value ? value[language]
|
|
5668
|
+
const tooltipTitle = isMultiLine ? '' : value ? (_value$language = value[language]) !== null && _value$language !== void 0 ? _value$language : '' : '';
|
|
5621
5669
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
5622
5670
|
title: tooltipTitle,
|
|
5623
5671
|
children: jsxRuntime.jsx(InputComponent, {
|
|
@@ -5668,7 +5716,8 @@ function CustomBooleanInput(props) {
|
|
|
5668
5716
|
CustomBooleanInput.displayName = 'CustomBooleanInput';
|
|
5669
5717
|
|
|
5670
5718
|
function CustomNumberInput(props) {
|
|
5671
|
-
|
|
5719
|
+
var _props$value;
|
|
5720
|
+
const value = (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : '';
|
|
5672
5721
|
const handleChange = makeChangeHandler(rawValue => {
|
|
5673
5722
|
props.setFieldValue(props.name, !rawValue ? undefined : Number(rawValue));
|
|
5674
5723
|
props.renderWarnings && props.handleWarningChange(props.name, props.fieldDefinition, rawValue);
|
|
@@ -5717,7 +5766,7 @@ const fixAmount = value => {
|
|
|
5717
5766
|
// data user just entered effectively preventing full data from being entered.
|
|
5718
5767
|
const fixEnteredValue = (newValue, initialValue, currencies) => {
|
|
5719
5768
|
const withFixedCurrency = fixCurrencyCode(newValue, currencies);
|
|
5720
|
-
if (!initialValue
|
|
5769
|
+
if (!(initialValue !== null && initialValue !== void 0 && initialValue.amount)) {
|
|
5721
5770
|
return fixAmount(withFixedCurrency);
|
|
5722
5771
|
}
|
|
5723
5772
|
return withFixedCurrency;
|
|
@@ -5787,12 +5836,13 @@ const convertTypeValuesToOptions$1 = reselect.defaultMemoize((type, dataLocale,
|
|
|
5787
5836
|
key: 'label',
|
|
5788
5837
|
locale: dataLocale,
|
|
5789
5838
|
fallbackOrder: languages,
|
|
5790
|
-
fallback:
|
|
5839
|
+
fallback: "".concat(value.key, " (key)")
|
|
5791
5840
|
}),
|
|
5792
5841
|
value: value.key
|
|
5793
5842
|
}));
|
|
5794
5843
|
});
|
|
5795
5844
|
function CustomLocalizedEnumInput(props) {
|
|
5845
|
+
var _options$find$label, _options$find;
|
|
5796
5846
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
5797
5847
|
languages: applicationContext.project.languages,
|
|
5798
5848
|
dataLocale: applicationContext.dataLocale
|
|
@@ -5804,7 +5854,7 @@ function CustomLocalizedEnumInput(props) {
|
|
|
5804
5854
|
props.setFieldValue(props.name, rawValue);
|
|
5805
5855
|
props.renderWarnings && props.handleWarningChange(props.name, props.fieldDefinition, rawValue);
|
|
5806
5856
|
});
|
|
5807
|
-
const tooltipTitle = props.value ? _findInstanceProperty__default["default"](options).call(options, option => option.value === props.value)
|
|
5857
|
+
const tooltipTitle = props.value ? (_options$find$label = (_options$find = _findInstanceProperty__default["default"](options).call(options, option => option.value === props.value)) === null || _options$find === void 0 ? void 0 : _options$find.label) !== null && _options$find$label !== void 0 ? _options$find$label : '' : '';
|
|
5808
5858
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
5809
5859
|
title: tooltipTitle,
|
|
5810
5860
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
@@ -5827,7 +5877,8 @@ function CustomLocalizedEnumInput(props) {
|
|
|
5827
5877
|
CustomLocalizedEnumInput.displayName = 'CustomLocalizedEnumInput';
|
|
5828
5878
|
|
|
5829
5879
|
function CustomRawIdReferenceInput(props) {
|
|
5830
|
-
|
|
5880
|
+
var _props$value;
|
|
5881
|
+
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
5831
5882
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
5832
5883
|
title: value,
|
|
5833
5884
|
children: jsxRuntime.jsx(uiKit.TextInput, {
|
|
@@ -5873,7 +5924,7 @@ function getCategoriesByIds(apolloClient, options) {
|
|
|
5873
5924
|
return apolloClient.query({
|
|
5874
5925
|
query: FetchCategoriesByIds,
|
|
5875
5926
|
variables: {
|
|
5876
|
-
where:
|
|
5927
|
+
where: "id in (".concat(_mapInstanceProperty__default["default"](_context2 = options.ids).call(_context2, id => "\"".concat(id, "\"")).join(', '), ")")
|
|
5877
5928
|
},
|
|
5878
5929
|
context: {
|
|
5879
5930
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -5972,10 +6023,13 @@ const useReferenceSearchItems = _ref => {
|
|
|
5972
6023
|
};
|
|
5973
6024
|
};
|
|
5974
6025
|
function ReferenceSearch(props) {
|
|
5975
|
-
const ids = React.useMemo(() =>
|
|
5976
|
-
|
|
5977
|
-
return
|
|
5978
|
-
|
|
6026
|
+
const ids = React.useMemo(() => {
|
|
6027
|
+
var _props$value, _props$value2;
|
|
6028
|
+
return props.value ? props.isMulti ? (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _mapInstanceProperty__default["default"](_props$value).call(_props$value, _ref2 => {
|
|
6029
|
+
let id = _ref2.id;
|
|
6030
|
+
return id;
|
|
6031
|
+
}) : [(_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.id] : [];
|
|
6032
|
+
}, [props.value, props.isMulti]);
|
|
5979
6033
|
const _useReferenceSearchIt = useReferenceSearchItems({
|
|
5980
6034
|
loadItemsBySearchTerm: props.loadItemsBySearchTerm,
|
|
5981
6035
|
loadItemsByIds: props.loadItemsByIds,
|
|
@@ -5986,14 +6040,14 @@ function ReferenceSearch(props) {
|
|
|
5986
6040
|
areSomeItemsMissing = _useReferenceSearchIt.areSomeItemsMissing,
|
|
5987
6041
|
handleLoadItems = _useReferenceSearchIt.handleLoadItems;
|
|
5988
6042
|
if (areItemsLoading) return null;
|
|
5989
|
-
const value = props.isMulti ? items : items
|
|
6043
|
+
const value = props.isMulti ? items : items === null || items === void 0 ? void 0 : items[0];
|
|
5990
6044
|
let filterValue = null;
|
|
5991
6045
|
if (value) filterValue = props.isMulti ? _mapInstanceProperty__default["default"](value).call(value, props.mapItemToOption) : props.mapItemToOption(value);
|
|
5992
6046
|
const tooltipTitle = value || props.value ? props.mapItemToOption(value || props.value).label : '';
|
|
5993
6047
|
const loadItems = value => _Promise__default["default"].resolve(handleLoadItems(value)).then(items => _mapInstanceProperty__default["default"](items).call(items, item => props.mapItemToOption(item)));
|
|
5994
6048
|
const handleChange = event => {
|
|
5995
|
-
var _context;
|
|
5996
|
-
const option = props.isMulti ? _mapInstanceProperty__default["default"](_context = event.target.value).call(_context, item => item.value) : event.target.value
|
|
6049
|
+
var _context, _event$target$value;
|
|
6050
|
+
const option = props.isMulti ? _mapInstanceProperty__default["default"](_context = event.target.value).call(_context, item => item.value) : ((_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.value) || null;
|
|
5997
6051
|
props.onChange(option);
|
|
5998
6052
|
};
|
|
5999
6053
|
return jsxRuntime.jsxs("div", {
|
|
@@ -6067,8 +6121,9 @@ const messages$B = reactIntl.defineMessages({
|
|
|
6067
6121
|
});
|
|
6068
6122
|
|
|
6069
6123
|
function ownKeys$U(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; }
|
|
6070
|
-
function _objectSpread$U(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
6124
|
+
function _objectSpread$U(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$U(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$U(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
6071
6125
|
function Option$1(props) {
|
|
6126
|
+
var _context, _context2;
|
|
6072
6127
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
6073
6128
|
language: applicationContext.dataLocale,
|
|
6074
6129
|
languages: applicationContext.project.languages
|
|
@@ -6089,19 +6144,19 @@ function Option$1(props) {
|
|
|
6089
6144
|
fallbackOrder: languages
|
|
6090
6145
|
})
|
|
6091
6146
|
}), category.parent && jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
6092
|
-
children:
|
|
6147
|
+
children: _concatInstanceProperty__default["default"](_context = "".concat(formatMessage(messages$B.parentCategory), ": ")).call(_context, l10n.formatLocalizedString(category.parent, {
|
|
6093
6148
|
key: 'name',
|
|
6094
6149
|
locale: language,
|
|
6095
6150
|
fallbackOrder: languages
|
|
6096
|
-
})
|
|
6151
|
+
}))
|
|
6097
6152
|
}), jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
6098
|
-
children:
|
|
6153
|
+
children: "Slug: ".concat(l10n.formatLocalizedString(category, {
|
|
6099
6154
|
key: 'slug',
|
|
6100
6155
|
locale: language,
|
|
6101
6156
|
fallbackOrder: languages
|
|
6102
|
-
})
|
|
6157
|
+
}))
|
|
6103
6158
|
}), category.externalId && jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
6104
|
-
children:
|
|
6159
|
+
children: _concatInstanceProperty__default["default"](_context2 = "".concat(formatMessage(messages$B.externalId), ": ")).call(_context2, category.externalId || constants.NO_VALUE_FALLBACK)
|
|
6105
6160
|
})]
|
|
6106
6161
|
})
|
|
6107
6162
|
}));
|
|
@@ -6165,7 +6220,7 @@ var CategorySearchPickerOptionFragment$1 = { kind: "Document", definitions: [{ k
|
|
|
6165
6220
|
function useCachedCategoryOptions(ids) {
|
|
6166
6221
|
const apolloClient = client.useApolloClient();
|
|
6167
6222
|
const fragments = _mapInstanceProperty__default["default"](ids).call(ids, id => apolloClient.readFragment({
|
|
6168
|
-
id:
|
|
6223
|
+
id: "CategorySearch:".concat(id),
|
|
6169
6224
|
fragment: CategorySearchPickerOptionFragment$1
|
|
6170
6225
|
}));
|
|
6171
6226
|
return _mapInstanceProperty__default["default"](fragments).call(fragments, category => transformLocalizedFieldsForCategory(category, [{
|
|
@@ -6180,8 +6235,8 @@ function useCachedCategoryOptions(ids) {
|
|
|
6180
6235
|
var SearchCartDiscount = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "SearchCartDiscount" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "where" } }, type: { kind: "NamedType", name: { kind: "Name", value: "String" } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "cartDiscounts" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "limit" }, value: { kind: "IntValue", value: "500" } }, { kind: "Argument", name: { kind: "Name", value: "where" }, value: { kind: "Variable", name: { kind: "Name", value: "where" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }] } }] } }], loc: { start: 0, end: 425, source: { body: "query SearchCartDiscount($where: String) {\n cartDiscounts(limit: 500, where: $where) {\n total\n results {\n id\n key\n nameAllLocales {\n locale\n value\n }\n }\n }\n}\n\nquery CartDiscountsCount {\n cartDiscounts {\n total\n }\n}\n\nquery FetchCartDiscountById($cartDiscountId: String!) {\n cartDiscount(id: $cartDiscountId) {\n id\n nameAllLocales {\n locale\n value\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
6181
6236
|
var FetchCartDiscountById = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchCartDiscountById" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "cartDiscountId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "cartDiscount" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "id" }, value: { kind: "Variable", name: { kind: "Name", value: "cartDiscountId" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }] } }], loc: { start: 0, end: 425, source: { body: "query SearchCartDiscount($where: String) {\n cartDiscounts(limit: 500, where: $where) {\n total\n results {\n id\n key\n nameAllLocales {\n locale\n value\n }\n }\n }\n}\n\nquery CartDiscountsCount {\n cartDiscounts {\n total\n }\n}\n\nquery FetchCartDiscountById($cartDiscountId: String!) {\n cartDiscount(id: $cartDiscountId) {\n id\n nameAllLocales {\n locale\n value\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
6182
6237
|
const transformCartDiscountResponse = response => {
|
|
6183
|
-
var _context;
|
|
6184
|
-
return _mapInstanceProperty__default["default"](_context = response.data
|
|
6238
|
+
var _context, _response$data;
|
|
6239
|
+
return _mapInstanceProperty__default["default"](_context = ((_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.cartDiscounts.results) || []).call(_context, cartDiscount => transformLocalizedFieldsForCartDiscount(cartDiscount));
|
|
6185
6240
|
};
|
|
6186
6241
|
function queryCartDiscounts(apolloClient) {
|
|
6187
6242
|
return apolloClient.query({
|
|
@@ -6193,14 +6248,14 @@ function queryCartDiscounts(apolloClient) {
|
|
|
6193
6248
|
}).then(transformCartDiscountResponse);
|
|
6194
6249
|
}
|
|
6195
6250
|
const getWhereClause = function () {
|
|
6196
|
-
var _context2, _context3;
|
|
6251
|
+
var _context2, _context3, _context4;
|
|
6197
6252
|
let searchText = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
6198
6253
|
let language = arguments.length > 1 ? arguments[1] : undefined;
|
|
6199
6254
|
const query = _trimInstanceProperty__default["default"](_context2 = _JSON$stringify__default["default"](searchText)).call(_context2);
|
|
6200
|
-
const idQuery = isUUID(searchText) &&
|
|
6201
|
-
const nameQuery =
|
|
6202
|
-
const keyQuery =
|
|
6203
|
-
return _filterInstanceProperty__default["default"](
|
|
6255
|
+
const idQuery = isUUID(searchText) && "id = ".concat(query);
|
|
6256
|
+
const nameQuery = _concatInstanceProperty__default["default"](_context3 = "name(".concat(language, " = ")).call(_context3, query, ")");
|
|
6257
|
+
const keyQuery = "key = ".concat(query);
|
|
6258
|
+
return _filterInstanceProperty__default["default"](_context4 = [idQuery, nameQuery, keyQuery]).call(_context4, Boolean).join(' or ');
|
|
6204
6259
|
};
|
|
6205
6260
|
function searchCartDiscountsByExactMatch(apolloClient, options) {
|
|
6206
6261
|
return apolloClient.query({
|
|
@@ -6223,7 +6278,10 @@ function getCartDiscountById(apolloClient, options) {
|
|
|
6223
6278
|
context: {
|
|
6224
6279
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
6225
6280
|
}
|
|
6226
|
-
}).then(response =>
|
|
6281
|
+
}).then(response => {
|
|
6282
|
+
var _response$data2;
|
|
6283
|
+
return (_response$data2 = response.data) !== null && _response$data2 !== void 0 && _response$data2.cartDiscount ? transformLocalizedFieldsForCartDiscount(response.data.cartDiscount) : null;
|
|
6284
|
+
});
|
|
6227
6285
|
}
|
|
6228
6286
|
|
|
6229
6287
|
const messages$A = reactIntl.defineMessages({
|
|
@@ -6300,7 +6358,7 @@ function CartDiscountReferenceSearch(props) {
|
|
|
6300
6358
|
}),
|
|
6301
6359
|
loading = _useQuery.loading,
|
|
6302
6360
|
data = _useQuery.data;
|
|
6303
|
-
const isExactMatch = data
|
|
6361
|
+
const isExactMatch = (data === null || data === void 0 ? void 0 : data.cartDiscounts.total) > QUERY_MAX_LIMIT;
|
|
6304
6362
|
const _useIntl = reactIntl.useIntl(),
|
|
6305
6363
|
formatMessage = _useIntl.formatMessage;
|
|
6306
6364
|
const apolloClient = client.useApolloClient();
|
|
@@ -6440,6 +6498,7 @@ const DropdownIndicator = () => jsxRuntime.jsx(uiKit.SearchIcon, {
|
|
|
6440
6498
|
});
|
|
6441
6499
|
DropdownIndicator.displayName = 'DropdownIndicator';
|
|
6442
6500
|
const ProductPickerInput = _ref => {
|
|
6501
|
+
var _currentOption$data$l, _currentOption$data;
|
|
6443
6502
|
let isClearable = _ref.isClearable,
|
|
6444
6503
|
isDisabled = _ref.isDisabled,
|
|
6445
6504
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -6460,19 +6519,20 @@ const ProductPickerInput = _ref => {
|
|
|
6460
6519
|
loadingError = _useState2[0],
|
|
6461
6520
|
setLoadingError = _useState2[1];
|
|
6462
6521
|
const convertProductToOption = React.useCallback(product => {
|
|
6522
|
+
var _masterData$current;
|
|
6463
6523
|
if (!product) return null;
|
|
6464
6524
|
const id = product.id,
|
|
6465
6525
|
key = product.key,
|
|
6466
6526
|
masterData = product.masterData;
|
|
6467
|
-
const localizedName = formatLocalizedFieldToString(masterData.current
|
|
6527
|
+
const localizedName = formatLocalizedFieldToString((_masterData$current = masterData.current) === null || _masterData$current === void 0 ? void 0 : _masterData$current.nameAllLocales);
|
|
6468
6528
|
return {
|
|
6469
|
-
label: localizedName + (key ?
|
|
6529
|
+
label: localizedName + (key ? " (key: ".concat(key, ")") : ''),
|
|
6470
6530
|
value: id,
|
|
6471
6531
|
name: localizedName,
|
|
6472
6532
|
key
|
|
6473
6533
|
};
|
|
6474
6534
|
}, [formatLocalizedFieldToString]);
|
|
6475
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
6535
|
+
const prefixSearchFields = React.useMemo(() => ["masterData.current.name.".concat(dataLocale), 'key'], [dataLocale]);
|
|
6476
6536
|
const loadOptions = useLoadOptions({
|
|
6477
6537
|
query: GetProductsQuery,
|
|
6478
6538
|
prefixSearchFields
|
|
@@ -6503,12 +6563,12 @@ const ProductPickerInput = _ref => {
|
|
|
6503
6563
|
setLoadingError(null);
|
|
6504
6564
|
handleInternalInputChange(event);
|
|
6505
6565
|
}, [handleInternalInputChange]);
|
|
6506
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
6566
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption === null || currentOption === void 0 ? void 0 : currentOption.error);
|
|
6507
6567
|
React.useEffect(() => {
|
|
6508
6568
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
6509
6569
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
6510
6570
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
6511
|
-
const tooltipTitle = currentOption
|
|
6571
|
+
const tooltipTitle = (_currentOption$data$l = currentOption === null || currentOption === void 0 || (_currentOption$data = currentOption.data) === null || _currentOption$data === void 0 ? void 0 : _currentOption$data.label) !== null && _currentOption$data$l !== void 0 ? _currentOption$data$l : '';
|
|
6512
6572
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
6513
6573
|
max: "scale",
|
|
6514
6574
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -6548,7 +6608,8 @@ const ProductPickerInput = _ref => {
|
|
|
6548
6608
|
ProductPickerInput.displayName = 'ProductPickerInput';
|
|
6549
6609
|
|
|
6550
6610
|
function CustomProductReferenceInput(props) {
|
|
6551
|
-
|
|
6611
|
+
var _props$value;
|
|
6612
|
+
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6552
6613
|
return jsxRuntime.jsx(ProductPickerInput, {
|
|
6553
6614
|
value: value,
|
|
6554
6615
|
name: props.name,
|
|
@@ -6566,7 +6627,8 @@ function CustomProductReferenceInput(props) {
|
|
|
6566
6627
|
CustomProductReferenceInput.displayName = 'CustomProductReferenceInput';
|
|
6567
6628
|
|
|
6568
6629
|
function CustomProductTypeReferenceInput(props) {
|
|
6569
|
-
|
|
6630
|
+
var _props$value;
|
|
6631
|
+
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6570
6632
|
return jsxRuntime.jsx(ProductTypePickerInput, {
|
|
6571
6633
|
value: value,
|
|
6572
6634
|
name: props.name,
|
|
@@ -6583,7 +6645,8 @@ function CustomProductTypeReferenceInput(props) {
|
|
|
6583
6645
|
CustomProductTypeReferenceInput.displayName = 'CustomProductTypeReferenceInput';
|
|
6584
6646
|
|
|
6585
6647
|
function CustomChannelReferenceInput(props) {
|
|
6586
|
-
|
|
6648
|
+
var _props$value;
|
|
6649
|
+
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6587
6650
|
return jsxRuntime.jsx(ChannelPickerInput, {
|
|
6588
6651
|
value: value,
|
|
6589
6652
|
name: props.name,
|
|
@@ -6600,7 +6663,8 @@ function CustomChannelReferenceInput(props) {
|
|
|
6600
6663
|
CustomChannelReferenceInput.displayName = 'CustomChannelReferenceInput';
|
|
6601
6664
|
|
|
6602
6665
|
function CustomStateReferenceInput(props) {
|
|
6603
|
-
|
|
6666
|
+
var _props$value;
|
|
6667
|
+
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6604
6668
|
return jsxRuntime.jsx(StatePickerInput, {
|
|
6605
6669
|
value: value,
|
|
6606
6670
|
name: props.name,
|
|
@@ -6716,16 +6780,17 @@ function CustomTimeInput(props) {
|
|
|
6716
6780
|
CustomTimeInput.displayName = 'CustomTimeInput';
|
|
6717
6781
|
|
|
6718
6782
|
const convertTypeValuesToOptions = reselect.defaultMemoize(typeValues => _mapInstanceProperty__default["default"](typeValues).call(typeValues, typeValue => ({
|
|
6719
|
-
label: typeValue.label ||
|
|
6783
|
+
label: typeValue.label || "".concat(typeValue.key, " (key)"),
|
|
6720
6784
|
value: typeValue.key
|
|
6721
6785
|
})));
|
|
6722
6786
|
function CustomEnumInput(props) {
|
|
6787
|
+
var _options$find$label, _options$find;
|
|
6723
6788
|
const options = convertTypeValuesToOptions(_valuesInstanceProperty__default["default"](props.fieldDefinition.type));
|
|
6724
6789
|
const handleChange = makeChangeHandler(rawValue => {
|
|
6725
6790
|
props.setFieldValue(props.name, rawValue);
|
|
6726
6791
|
props.renderWarnings && props.handleWarningChange(props.name, props.fieldDefinition, rawValue);
|
|
6727
6792
|
});
|
|
6728
|
-
const tooltipTitle = props.value ? _findInstanceProperty__default["default"](options).call(options, option => option.value === props.value)
|
|
6793
|
+
const tooltipTitle = props.value ? (_options$find$label = (_options$find = _findInstanceProperty__default["default"](options).call(options, option => option.value === props.value)) === null || _options$find === void 0 ? void 0 : _options$find.label) !== null && _options$find$label !== void 0 ? _options$find$label : '' : '';
|
|
6729
6794
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
6730
6795
|
title: tooltipTitle,
|
|
6731
6796
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
@@ -6803,9 +6868,9 @@ function ownKeys$Q(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
6803
6868
|
function _objectSpread$Q(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context7 = ownKeys$Q(Object(t), !0)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context8 = ownKeys$Q(Object(t))).call(_context8, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
6804
6869
|
const getTypeName = type => type.name.toLowerCase();
|
|
6805
6870
|
const findLabel = (enumType, key) => {
|
|
6806
|
-
var _context;
|
|
6871
|
+
var _enumType$values$find, _enumType$values$find2, _context;
|
|
6807
6872
|
const emptyValue = getTypeName(enumType) === 'enum' ? '' : {};
|
|
6808
|
-
return _findInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](enumType)).call(_context, value => value.key === key)
|
|
6873
|
+
return (_enumType$values$find = (_enumType$values$find2 = _findInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](enumType)).call(_context, value => value.key === key)) === null || _enumType$values$find2 === void 0 ? void 0 : _enumType$values$find2.label) !== null && _enumType$values$find !== void 0 ? _enumType$values$find : emptyValue;
|
|
6809
6874
|
};
|
|
6810
6875
|
const convertEnumValues = (value, attributeDefinition) => {
|
|
6811
6876
|
var _context2, _context3;
|
|
@@ -6871,7 +6936,7 @@ const attributesMapToNameValuePairs = map => {
|
|
|
6871
6936
|
const _excluded$1 = ["WrapperComponent"];
|
|
6872
6937
|
const getAttributeShortName = (fullName, attributesPrefix) => {
|
|
6873
6938
|
if (!attributesPrefix) return fullName;
|
|
6874
|
-
return fullName.replace(
|
|
6939
|
+
return fullName.replace("".concat(attributesPrefix, "."), '');
|
|
6875
6940
|
};
|
|
6876
6941
|
function ProductAttributes(_ref) {
|
|
6877
6942
|
let WrapperComponent = _ref.WrapperComponent,
|
|
@@ -6959,19 +7024,19 @@ function ownKeys$P(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
6959
7024
|
function _objectSpread$P(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context6 = ownKeys$P(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context7 = ownKeys$P(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
6960
7025
|
var FetchProductTypeQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchProductTypeQuery" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "id" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "productType" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "id" }, value: { kind: "Variable", name: { kind: "Name", value: "id" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "attributeDefinitions" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "limit" }, value: { kind: "IntValue", value: "100" } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "isRequired" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "inputHint" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "inputTipAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "SetAttributeDefinitionType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "elementType" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "NestedAttributeDefinitionType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "typeRef" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "EnumAttributeDefinitionType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "values" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "label" }, arguments: [], directives: [] }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "LocalizableEnumAttributeDefinitionType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "values" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ReferenceAttributeDefinitionType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "referenceTypeId" }, arguments: [], directives: [] }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ReferenceAttributeDefinitionType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "referenceTypeId" }, arguments: [], directives: [] }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "NestedAttributeDefinitionType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "typeRef" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "EnumAttributeDefinitionType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "values" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "label" }, arguments: [], directives: [] }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "LocalizableEnumAttributeDefinitionType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "values" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }] } }] } }] } }] } }] } }] } }] } }], loc: { start: 0, end: 1905, source: { body: "query FetchProductTypeQuery($id: String!) {\n productType(id: $id) {\n name\n attributeDefinitions(limit: 100) {\n results {\n name\n isRequired\n inputHint\n inputTipAllLocales {\n value\n locale\n }\n labelAllLocales {\n value\n locale\n }\n type {\n name\n ... on SetAttributeDefinitionType {\n elementType {\n name\n ... on NestedAttributeDefinitionType {\n typeRef {\n id\n }\n }\n ... on EnumAttributeDefinitionType {\n values {\n results {\n key\n label\n }\n }\n }\n ... on LocalizableEnumAttributeDefinitionType {\n values {\n results {\n key\n labelAllLocales {\n locale\n value\n }\n }\n }\n }\n ... on ReferenceAttributeDefinitionType {\n referenceTypeId\n }\n }\n }\n ... on ReferenceAttributeDefinitionType {\n referenceTypeId\n }\n ... on NestedAttributeDefinitionType {\n typeRef {\n id\n }\n }\n ... on EnumAttributeDefinitionType {\n values {\n results {\n key\n label\n }\n }\n }\n ... on LocalizableEnumAttributeDefinitionType {\n values {\n results {\n key\n labelAllLocales {\n locale\n value\n }\n }\n }\n }\n }\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
6961
7026
|
const mapAttributeDefinition = definition => {
|
|
6962
|
-
var _context, _context2, _context3, _context4;
|
|
7027
|
+
var _context, _definition$type, _context2, _context3, _definition$type2, _context4;
|
|
6963
7028
|
return _objectSpread$P(_objectSpread$P({}, definition), {}, {
|
|
6964
7029
|
required: definition.isRequired,
|
|
6965
7030
|
inputTip: l10n.transformLocalizedFieldToLocalizedString(definition.inputTipAllLocales),
|
|
6966
7031
|
label: l10n.transformLocalizedFieldToLocalizedString(definition.labelAllLocales),
|
|
6967
|
-
type: _includesInstanceProperty__default["default"](_context = ['enum', 'lenum']).call(_context, definition.type
|
|
7032
|
+
type: _includesInstanceProperty__default["default"](_context = ['enum', 'lenum']).call(_context, (_definition$type = definition.type) === null || _definition$type === void 0 || (_definition$type = _definition$type.elementType) === null || _definition$type === void 0 ? void 0 : _definition$type.name) ? _objectSpread$P(_objectSpread$P({}, definition.type), {}, {
|
|
6968
7033
|
elementType: _objectSpread$P(_objectSpread$P({}, definition.type.elementType), {}, {
|
|
6969
7034
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](definition.type.elementType).results).call(_context2, value => ({
|
|
6970
7035
|
key: value.key,
|
|
6971
7036
|
label: value.label || l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
6972
7037
|
}))
|
|
6973
7038
|
})
|
|
6974
|
-
}) : _includesInstanceProperty__default["default"](_context3 = ['enum', 'lenum']).call(_context3, definition.type
|
|
7039
|
+
}) : _includesInstanceProperty__default["default"](_context3 = ['enum', 'lenum']).call(_context3, (_definition$type2 = definition.type) === null || _definition$type2 === void 0 ? void 0 : _definition$type2.name) ? _objectSpread$P(_objectSpread$P({}, definition.type), {}, {
|
|
6975
7040
|
values: _mapInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](definition.type).results).call(_context4, value => ({
|
|
6976
7041
|
key: value.key,
|
|
6977
7042
|
label: value.label || l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -7324,7 +7389,7 @@ const ExpandButton = props => props.totalValues > 1 ? jsxRuntime.jsxs(uiKit.Spac
|
|
|
7324
7389
|
}), jsxRuntime.jsx(uiKit.FlatButton, {
|
|
7325
7390
|
tone: "primary",
|
|
7326
7391
|
icon: props.isExpanded ? jsxRuntime.jsx(uiKit.AngleUpIcon, {}) : jsxRuntime.jsx(uiKit.AngleDownIcon, {}),
|
|
7327
|
-
label: props.isExpanded ?
|
|
7392
|
+
label: props.isExpanded ? "Hide set items (".concat(props.totalValues, ")") : "Show all set items (".concat(props.totalValues, ")"),
|
|
7328
7393
|
onClick: props.onExpand
|
|
7329
7394
|
})]
|
|
7330
7395
|
}) : null;
|
|
@@ -7359,7 +7424,7 @@ const SetButtons = props => {
|
|
|
7359
7424
|
SetButtons.displayName = 'SetButtons';
|
|
7360
7425
|
|
|
7361
7426
|
function ownKeys$N(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; }
|
|
7362
|
-
function _objectSpread$N(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
7427
|
+
function _objectSpread$N(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$N(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$N(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
7363
7428
|
const getDuplicateErrors = setValues => {
|
|
7364
7429
|
/* eslint-disable no-plusplus */
|
|
7365
7430
|
const result = [];
|
|
@@ -7400,10 +7465,13 @@ const getItemIndex = name => {
|
|
|
7400
7465
|
return _parseInt__default["default"](rawIndex, 10);
|
|
7401
7466
|
};
|
|
7402
7467
|
const makeKeys = amount => times__default["default"](amount, () => uuid.v4());
|
|
7403
|
-
const makeItemFieldName = (fieldName, index) =>
|
|
7468
|
+
const makeItemFieldName = (fieldName, index) => {
|
|
7469
|
+
var _context;
|
|
7470
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(fieldName, ".[")).call(_context, index, "]");
|
|
7471
|
+
};
|
|
7404
7472
|
const makeMapForAllItems = (fieldName, items, value) => _reduceInstanceProperty__default["default"](items).call(items, (result, item, index) => set__default["default"](result, makeItemFieldName(fieldName, index), value), {});
|
|
7405
7473
|
function CustomInputSet(props) {
|
|
7406
|
-
var
|
|
7474
|
+
var _context2;
|
|
7407
7475
|
const _useToggleState = uiKit.useToggleState(false),
|
|
7408
7476
|
_useToggleState2 = _slicedToArray(_useToggleState, 2),
|
|
7409
7477
|
isExpanded = _useToggleState2[0],
|
|
@@ -7425,7 +7493,7 @@ function CustomInputSet(props) {
|
|
|
7425
7493
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
7426
7494
|
keys = _useState4[0],
|
|
7427
7495
|
setKeys = _useState4[1];
|
|
7428
|
-
const totalAmount = internalValue
|
|
7496
|
+
const totalAmount = internalValue === null || internalValue === void 0 ? void 0 : internalValue.length;
|
|
7429
7497
|
const amountToRender = isExpanded ? totalAmount : 1;
|
|
7430
7498
|
const updateInternalValue = newValue => {
|
|
7431
7499
|
const valueToSet = isEmpty$1(newValue) ? [undefined] : newValue;
|
|
@@ -7472,8 +7540,8 @@ function CustomInputSet(props) {
|
|
|
7472
7540
|
// in <CustomFieldComponent /> where proper component for given field/attribute
|
|
7473
7541
|
// type is selected.
|
|
7474
7542
|
const type = getType(props.fieldDefinition);
|
|
7475
|
-
const typeName = type
|
|
7476
|
-
const areButtonsTopAligned = _includesInstanceProperty__default["default"](
|
|
7543
|
+
const typeName = type === null || type === void 0 ? void 0 : type.name.toLowerCase();
|
|
7544
|
+
const areButtonsTopAligned = _includesInstanceProperty__default["default"](_context2 = [CUSTOM_FIELD_TYPES.lenum, CUSTOM_FIELD_TYPES.localizedenum, CUSTOM_FIELD_TYPES.localizedstring, CUSTOM_FIELD_TYPES.string, CUSTOM_FIELD_TYPES.text, CUSTOM_FIELD_TYPES.ltext, CUSTOM_FIELD_TYPES.reference]).call(_context2, typeName);
|
|
7477
7545
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
7478
7546
|
children: [jsxRuntime.jsx(uiKit.AccessibleHidden, {
|
|
7479
7547
|
children: jsxRuntime.jsx("label", {
|
|
@@ -7555,12 +7623,14 @@ const nonSetComponents = {
|
|
|
7555
7623
|
};
|
|
7556
7624
|
const CustomFieldInput = /*#__PURE__*/React.memo(props => {
|
|
7557
7625
|
const InputComponent = React.useMemo(() => {
|
|
7558
|
-
|
|
7626
|
+
var _props$fieldDefinitio;
|
|
7627
|
+
const typeName = (_props$fieldDefinitio = props.fieldDefinition.type) === null || _props$fieldDefinitio === void 0 ? void 0 : _props$fieldDefinitio.name.toLowerCase();
|
|
7559
7628
|
if (typeName === 'set') {
|
|
7629
|
+
var _getSetElementType;
|
|
7560
7630
|
// Boolean is the only set element with peculiarities (i.e. way more
|
|
7561
7631
|
// convenient for user to work with it as with select input with three values:
|
|
7562
7632
|
// [true], [false] and [true, false]).
|
|
7563
|
-
if (getType(props.fieldDefinition)
|
|
7633
|
+
if (((_getSetElementType = getType(props.fieldDefinition)) === null || _getSetElementType === void 0 ? void 0 : _getSetElementType.name.toLowerCase()) === CUSTOM_FIELD_TYPES.boolean) {
|
|
7564
7634
|
return CustomBooleanInputSet;
|
|
7565
7635
|
}
|
|
7566
7636
|
// All the rest sets are just a fancy wrapper around single-item components
|
|
@@ -7657,9 +7727,9 @@ const CustomFieldErrors = props => {
|
|
|
7657
7727
|
const didFormValidationFail = useDidFormValidationFail();
|
|
7658
7728
|
const errors = _Array$isArray__default["default"](props.errors) ? mergeSetItemsErrors(props.errors) : props.errors;
|
|
7659
7729
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
7660
|
-
children: [props.isTouched || didFormValidationFail && errors
|
|
7730
|
+
children: [props.isTouched || didFormValidationFail && (errors === null || errors === void 0 ? void 0 : errors.missing) && jsxRuntime.jsx(_.ErrorMessage, {
|
|
7661
7731
|
intlMessage: messages$K.required
|
|
7662
|
-
}), props.isTouched || didFormValidationFail && errors
|
|
7732
|
+
}), props.isTouched || didFormValidationFail && (errors === null || errors === void 0 ? void 0 : errors.duplicated) && jsxRuntime.jsx(_.ErrorMessage, {
|
|
7663
7733
|
intlMessage: messages$K.unique
|
|
7664
7734
|
})]
|
|
7665
7735
|
});
|
|
@@ -7708,9 +7778,10 @@ function ownKeys$K(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
7708
7778
|
function _objectSpread$K(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$K(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$K(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
7709
7779
|
var CartDiscountsCount = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "CartDiscountsCount" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "cartDiscounts" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 61, source: { body: "query CartDiscountsCount {\n cartDiscounts {\n total\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
7710
7780
|
const CustomFieldsLabelHint = _ref2 => {
|
|
7781
|
+
var _type$name;
|
|
7711
7782
|
let fieldDefinition = _ref2.fieldDefinition;
|
|
7712
7783
|
const type = getType(fieldDefinition);
|
|
7713
|
-
const isReference = type.name
|
|
7784
|
+
const isReference = ((_type$name = type.name) === null || _type$name === void 0 ? void 0 : _type$name.toLowerCase()) === 'reference';
|
|
7714
7785
|
const referenceTypeId = type.referenceTypeId;
|
|
7715
7786
|
const isCartDiscountsReference = isReference && referenceTypeId === SEARCHABLE_REFERENCES.cartDiscount;
|
|
7716
7787
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
@@ -7728,7 +7799,7 @@ const CustomFieldsLabelHint = _ref2 => {
|
|
|
7728
7799
|
data = _useQuery.data,
|
|
7729
7800
|
loading = _useQuery.loading;
|
|
7730
7801
|
if (loading) return null;
|
|
7731
|
-
if (data
|
|
7802
|
+
if ((data === null || data === void 0 ? void 0 : data.cartDiscounts.total) > QUERY_MAX_LIMIT) {
|
|
7732
7803
|
return jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
7733
7804
|
alignItems: "center",
|
|
7734
7805
|
children: [jsxRuntime.jsx(uiKit.WarningIcon, {
|
|
@@ -7755,17 +7826,17 @@ function CustomFieldsProductTypeReferenceSubtitle() {
|
|
|
7755
7826
|
// TODO(pa3): this logic may be misplaced and probably
|
|
7756
7827
|
// should belong to <CustomReferenceInput /> component instead.
|
|
7757
7828
|
function CustomFieldsLabelSubtitle(_ref3) {
|
|
7758
|
-
var _context;
|
|
7829
|
+
var _type$name2, _context;
|
|
7759
7830
|
let fieldDefinition = _ref3.fieldDefinition;
|
|
7760
7831
|
const _useIntl2 = reactIntl.useIntl(),
|
|
7761
7832
|
formatMessage = _useIntl2.formatMessage;
|
|
7762
7833
|
const type = getType(fieldDefinition);
|
|
7763
|
-
const isReference = type.name
|
|
7834
|
+
const isReference = ((_type$name2 = type.name) === null || _type$name2 === void 0 ? void 0 : _type$name2.toLowerCase()) === 'reference';
|
|
7764
7835
|
if (!isReference) return null;
|
|
7765
7836
|
const referenceTypeId = type.referenceTypeId;
|
|
7766
7837
|
const referenceTypeName = capitalizeFirst(referenceTypeId);
|
|
7767
7838
|
if (_includesInstanceProperty__default["default"](_context = [SEARCHABLE_REFERENCES.category, SEARCHABLE_REFERENCES.cartDiscount]).call(_context, referenceTypeId)) return referenceTypeName;
|
|
7768
|
-
return referenceTypeId === SEARCHABLE_REFERENCES.product ? formatMessage(messages$v.productReferenceLabel) : referenceTypeId === SEARCHABLE_REFERENCES.productType ? jsxRuntime.jsx(CustomFieldsProductTypeReferenceSubtitle, {}) : referenceTypeId === SEARCHABLE_REFERENCES.channel ? formatMessage(messages$v.channelReferenceLabel) : referenceTypeId === SEARCHABLE_REFERENCES.state ? formatMessage(messages$v.stateReferenceLabel) :
|
|
7839
|
+
return referenceTypeId === SEARCHABLE_REFERENCES.product ? formatMessage(messages$v.productReferenceLabel) : referenceTypeId === SEARCHABLE_REFERENCES.productType ? jsxRuntime.jsx(CustomFieldsProductTypeReferenceSubtitle, {}) : referenceTypeId === SEARCHABLE_REFERENCES.channel ? formatMessage(messages$v.channelReferenceLabel) : referenceTypeId === SEARCHABLE_REFERENCES.state ? formatMessage(messages$v.stateReferenceLabel) : "".concat(referenceTypeName, " ID");
|
|
7769
7840
|
}
|
|
7770
7841
|
const Portal = props => /*#__PURE__*/ReactDOM__default["default"].createPortal(props.children, document.body);
|
|
7771
7842
|
var _ref = {
|
|
@@ -7777,7 +7848,7 @@ function CustomFieldsCountIndicator(_ref4) {
|
|
|
7777
7848
|
const formatLocalizedField = useFormatLocalizedFieldToString();
|
|
7778
7849
|
const _useIntl3 = reactIntl.useIntl(),
|
|
7779
7850
|
formatMessage = _useIntl3.formatMessage;
|
|
7780
|
-
return assignedAttributeGroups
|
|
7851
|
+
return (assignedAttributeGroups === null || assignedAttributeGroups === void 0 ? void 0 : assignedAttributeGroups.length) > 1 ? jsxRuntime.jsx(uiKit.Tooltip, {
|
|
7781
7852
|
title: formatMessage(messages$v.attributeGroupCountTooltip, {
|
|
7782
7853
|
attributeGroups: _mapInstanceProperty__default["default"](assignedAttributeGroups).call(assignedAttributeGroups, assignedAttributeGroup => formatLocalizedField(assignedAttributeGroup.nameAllLocales)).join(', '),
|
|
7783
7854
|
count: assignedAttributeGroups.length
|
|
@@ -7836,10 +7907,11 @@ CustomFieldsLabel.displayName = 'CustomFieldsTitle';
|
|
|
7836
7907
|
|
|
7837
7908
|
const _excluded = ["WrapperComponent"];
|
|
7838
7909
|
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; }
|
|
7839
|
-
function _objectSpread$J(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
7910
|
+
function _objectSpread$J(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context6 = ownKeys$J(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context7 = ownKeys$J(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
7840
7911
|
const getFieldName = (parentName, fieldName) => {
|
|
7912
|
+
var _context;
|
|
7841
7913
|
if (!parentName) return fieldName;
|
|
7842
|
-
return
|
|
7914
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(parentName, ".")).call(_context, fieldName);
|
|
7843
7915
|
};
|
|
7844
7916
|
const isNested = fieldDefinition => {
|
|
7845
7917
|
const type = fieldDefinition.type;
|
|
@@ -7870,6 +7942,7 @@ const CustomFieldsInternal = _ref => {
|
|
|
7870
7942
|
return jsxRuntime.jsx(DroppableWrapper, {
|
|
7871
7943
|
onDragEnd: onDragEnd,
|
|
7872
7944
|
children: _mapInstanceProperty__default["default"](fieldDefinitions).call(fieldDefinitions, (fieldDefinition, index) => {
|
|
7945
|
+
var _context2, _context3;
|
|
7873
7946
|
const fieldName = getFieldName(props.name, fieldDefinition.name);
|
|
7874
7947
|
const isTouched = Boolean(formik.getIn(touched, fieldName));
|
|
7875
7948
|
const fieldErrors = formik.getIn(errors, fieldName);
|
|
@@ -7894,7 +7967,7 @@ const CustomFieldsInternal = _ref => {
|
|
|
7894
7967
|
onBlur: handleBlur,
|
|
7895
7968
|
setFieldValue: props.setFieldValue,
|
|
7896
7969
|
hasError: hasError,
|
|
7897
|
-
hasWarning: props.renderWarnings && status
|
|
7970
|
+
hasWarning: props.renderWarnings && (status === null || status === void 0 ? void 0 : status.warnings[fieldName]),
|
|
7898
7971
|
handleWarningChange: props.handleWarningChange,
|
|
7899
7972
|
renderWarnings: props.renderWarnings
|
|
7900
7973
|
};
|
|
@@ -7902,33 +7975,36 @@ const CustomFieldsInternal = _ref => {
|
|
|
7902
7975
|
return jsxRuntime.jsx(formik.FastField, {
|
|
7903
7976
|
name: fieldName,
|
|
7904
7977
|
validate: validate,
|
|
7905
|
-
children: () =>
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
children: jsxRuntime.
|
|
7912
|
-
|
|
7913
|
-
"
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
7978
|
+
children: () => {
|
|
7979
|
+
var _context4, _context5;
|
|
7980
|
+
return jsxRuntime.jsx(DraggableWrapper, {
|
|
7981
|
+
draggableKey: _concatInstanceProperty__default["default"](_context4 = "".concat(fieldName, "-")).call(_context4, index),
|
|
7982
|
+
draggableId: _concatInstanceProperty__default["default"](_context5 = "".concat(fieldName, "-")).call(_context5, index),
|
|
7983
|
+
index: index,
|
|
7984
|
+
children: jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
7985
|
+
scale: "xs",
|
|
7986
|
+
children: jsxRuntime.jsxs("div", {
|
|
7987
|
+
"aria-invalid": _Object$keys__default["default"](fieldErrors !== null && fieldErrors !== void 0 ? fieldErrors : {}).length > 0,
|
|
7988
|
+
"aria-errormessage": "".concat(fieldName, "-error"),
|
|
7989
|
+
id: "".concat(fieldName, "-error"),
|
|
7990
|
+
children: [jsxRuntime.jsx(CustomFieldsLabel, {
|
|
7991
|
+
name: fieldName,
|
|
7992
|
+
fieldDefinition: fieldDefinition
|
|
7993
|
+
}), jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
7994
|
+
scale: "xs",
|
|
7995
|
+
alignItems: "stretch",
|
|
7996
|
+
children: [WrapperComponent ? jsxRuntime.jsx(WrapperComponent, {
|
|
7997
|
+
children: Field
|
|
7998
|
+
}) : Field, props.renderWarnings && (status === null || status === void 0 ? void 0 : status.warnings[fieldName]) && props.renderCustomWarnings(fieldDefinition), jsxRuntime.jsx(CustomFieldErrors, {
|
|
7999
|
+
isTouched: isTouched,
|
|
8000
|
+
errors: fieldErrors
|
|
8001
|
+
})]
|
|
7926
8002
|
})]
|
|
7927
|
-
})
|
|
8003
|
+
})
|
|
7928
8004
|
})
|
|
7929
|
-
})
|
|
7930
|
-
}
|
|
7931
|
-
},
|
|
8005
|
+
});
|
|
8006
|
+
}
|
|
8007
|
+
}, _concatInstanceProperty__default["default"](_context2 = _concatInstanceProperty__default["default"](_context3 = "".concat(fieldName, "-")).call(_context3, index, "-")).call(_context2, fieldKey));
|
|
7932
8008
|
})
|
|
7933
8009
|
});
|
|
7934
8010
|
};
|
|
@@ -7988,7 +8064,7 @@ var pickerMessages = reactIntl.defineMessages({
|
|
|
7988
8064
|
});
|
|
7989
8065
|
|
|
7990
8066
|
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; }
|
|
7991
|
-
function _objectSpread$I(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
8067
|
+
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; }
|
|
7992
8068
|
const PRODUCT_SELECTION_MODES = {
|
|
7993
8069
|
INCLUSION: 'Individual',
|
|
7994
8070
|
EXCLUSION: 'IndividualExclusion'
|
|
@@ -7999,10 +8075,11 @@ const PRODUCT_SELECTION_MODES_LABELS = {
|
|
|
7999
8075
|
};
|
|
8000
8076
|
const getMode = mode => mode === PRODUCT_SELECTION_MODES.INCLUSION || mode === PRODUCT_SELECTION_MODES_LABELS.INCLUSION ? 'inclusion' : 'exclusion';
|
|
8001
8077
|
const addModeToLabel = function (ps) {
|
|
8078
|
+
var _context;
|
|
8002
8079
|
let enableExcludingProducts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
8003
8080
|
if (!ps) return undefined;
|
|
8004
8081
|
return _objectSpread$I(_objectSpread$I({}, ps), {}, {
|
|
8005
|
-
label:
|
|
8082
|
+
label: _concatInstanceProperty__default["default"](_context = "".concat(ps === null || ps === void 0 ? void 0 : ps.label)).call(_context, enableExcludingProducts ? " (type: ".concat(getMode(ps === null || ps === void 0 ? void 0 : ps.mode), ")") : '')
|
|
8006
8083
|
});
|
|
8007
8084
|
};
|
|
8008
8085
|
|
|
@@ -8014,6 +8091,7 @@ const mapProductSelectionsToOptions$1 = memoize__default["default"](function ()
|
|
|
8014
8091
|
let enableExcludingProducts = arguments.length > 4 ? arguments[4] : undefined;
|
|
8015
8092
|
const selectedPSList = _Array$isArray__default["default"](selectedPS) ? selectedPS : [selectedPS];
|
|
8016
8093
|
return _mapInstanceProperty__default["default"](productSelections).call(productSelections, productSelection => {
|
|
8094
|
+
var _context;
|
|
8017
8095
|
const label = l10n.formatLocalizedString(productSelection, {
|
|
8018
8096
|
key: 'name',
|
|
8019
8097
|
locale: dataLocale,
|
|
@@ -8022,13 +8100,14 @@ const mapProductSelectionsToOptions$1 = memoize__default["default"](function ()
|
|
|
8022
8100
|
return {
|
|
8023
8101
|
id: productSelection.id,
|
|
8024
8102
|
value: productSelection.id,
|
|
8025
|
-
label:
|
|
8103
|
+
label: _concatInstanceProperty__default["default"](_context = "".concat(label)).call(_context, _includesInstanceProperty__default["default"](selectedPSList).call(selectedPSList, productSelection.id) && enableExcludingProducts ? " (type: ".concat(getMode(productSelection.mode), ")") : ''),
|
|
8026
8104
|
key: productSelection.key,
|
|
8027
8105
|
mode: getMode(productSelection.mode)
|
|
8028
8106
|
};
|
|
8029
8107
|
});
|
|
8030
8108
|
});
|
|
8031
8109
|
function ProductSelectionBasicSelectDropdown(props) {
|
|
8110
|
+
var _productSelectionsFet, _productSelectionsFet2;
|
|
8032
8111
|
const intl = reactIntl.useIntl();
|
|
8033
8112
|
const enableExcludingProducts = applicationShell.useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
8034
8113
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -8041,10 +8120,10 @@ function ProductSelectionBasicSelectDropdown(props) {
|
|
|
8041
8120
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
8042
8121
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8043
8122
|
if (productSelectionsFetcher.isLoading) return jsxRuntime.jsx(CenteredLoadingSpinner, {});
|
|
8044
|
-
const productSelections = productSelectionsFetcher.productSelections
|
|
8123
|
+
const productSelections = (_productSelectionsFet = (_productSelectionsFet2 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet2 === void 0 ? void 0 : _productSelectionsFet2.results) !== null && _productSelectionsFet !== void 0 ? _productSelectionsFet : [];
|
|
8045
8124
|
const filteredProductSelections = _filterInstanceProperty__default["default"](productSelections).call(productSelections, ps => {
|
|
8046
|
-
var
|
|
8047
|
-
return !_includesInstanceProperty__default["default"](
|
|
8125
|
+
var _context2;
|
|
8126
|
+
return !_includesInstanceProperty__default["default"](_context2 = props.excludedProductSelectionIds).call(_context2, ps.id);
|
|
8048
8127
|
});
|
|
8049
8128
|
const onOptionClick = event => {
|
|
8050
8129
|
const productSelectionId = event.target.value;
|
|
@@ -8097,7 +8176,7 @@ const getValueFromOptions$3 = _ref => {
|
|
|
8097
8176
|
// handle async-select-field value transformation
|
|
8098
8177
|
if (isMulti) {
|
|
8099
8178
|
var _context;
|
|
8100
|
-
return _mapInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](allProductSelectionOptions).call(allProductSelectionOptions, ps => currentlySelectedProductSelections
|
|
8179
|
+
return _mapInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](allProductSelectionOptions).call(allProductSelectionOptions, ps => currentlySelectedProductSelections === null || currentlySelectedProductSelections === void 0 ? void 0 : _includesInstanceProperty__default["default"](currentlySelectedProductSelections).call(currentlySelectedProductSelections, ps.value))).call(_context, ps => addModeToLabel(ps, enableExcludingProducts));
|
|
8101
8180
|
}
|
|
8102
8181
|
|
|
8103
8182
|
// in case it is not multiselect, then a single valued async-select-input is being requested and the value should have proper format
|
|
@@ -8109,6 +8188,7 @@ const emptyStoreOption$1 = intl => [{
|
|
|
8109
8188
|
isDisabled: true
|
|
8110
8189
|
}];
|
|
8111
8190
|
function ProductSelectionsAsyncSelectDropdown(props) {
|
|
8191
|
+
var _productSelectionsFet3;
|
|
8112
8192
|
const intl = reactIntl.useIntl();
|
|
8113
8193
|
const enableExcludingProducts = applicationShell.useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
8114
8194
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -8121,13 +8201,17 @@ function ProductSelectionsAsyncSelectDropdown(props) {
|
|
|
8121
8201
|
})),
|
|
8122
8202
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
8123
8203
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8124
|
-
const productSelections = React.useMemo(() =>
|
|
8204
|
+
const productSelections = React.useMemo(() => {
|
|
8205
|
+
var _productSelectionsFet, _productSelectionsFet2;
|
|
8206
|
+
return (_productSelectionsFet = (_productSelectionsFet2 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet2 === void 0 ? void 0 : _productSelectionsFet2.results) !== null && _productSelectionsFet !== void 0 ? _productSelectionsFet : [];
|
|
8207
|
+
}, [(_productSelectionsFet3 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet3 === void 0 ? void 0 : _productSelectionsFet3.results]);
|
|
8125
8208
|
const filteredProductSelections = _filterInstanceProperty__default["default"](productSelections).call(productSelections, ps => {
|
|
8126
8209
|
var _context2;
|
|
8127
8210
|
return !_includesInstanceProperty__default["default"](_context2 = props.excludedProductSelectionIds).call(_context2, ps.id);
|
|
8128
8211
|
});
|
|
8129
8212
|
const onOptionClick = event => {
|
|
8130
|
-
|
|
8213
|
+
var _event$target$value;
|
|
8214
|
+
const productSelectionId = (_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.value;
|
|
8131
8215
|
const currentProductSelection = _findInstanceProperty__default["default"](productSelections).call(productSelections, productSelection => productSelection.id === productSelectionId);
|
|
8132
8216
|
props.onChange(currentProductSelection);
|
|
8133
8217
|
};
|
|
@@ -8203,11 +8287,15 @@ function ProductSelectionsAsyncSelectDropdown(props) {
|
|
|
8203
8287
|
}
|
|
8204
8288
|
|
|
8205
8289
|
var ProductSelectionsPickerFetcher$1 = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "ProductSelectionsPickerFetcher" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "where" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "productSelections" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "where" }, value: { kind: "Variable", name: { kind: "Name", value: "where" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "version" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "mode" }, arguments: [], directives: [] }] } }] } }] } }], loc: { start: 0, end: 223, source: { body: "query ProductSelectionsPickerFetcher($where: String!) {\n productSelections(where: $where) {\n results {\n id\n key\n version\n nameAllLocales {\n locale\n value\n }\n mode\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
8206
|
-
const createQueryVariables$4 = (productSelections, predicateField) =>
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
|
|
8290
|
+
const createQueryVariables$4 = (productSelections, predicateField) => {
|
|
8291
|
+
var _context;
|
|
8292
|
+
return {
|
|
8293
|
+
where: _concatInstanceProperty__default["default"](_context = "".concat(predicateField, " in (")).call(_context, _mapInstanceProperty__default["default"](productSelections).call(productSelections, ps => "\"".concat(ps, "\"")).join(', '), ")"),
|
|
8294
|
+
limit: 500
|
|
8295
|
+
};
|
|
8296
|
+
};
|
|
8210
8297
|
const useProductSelectionsByFieldFetcher = (productSelections, predicateField) => {
|
|
8298
|
+
var _productSelectionsQue, _productSelectionsQue2;
|
|
8211
8299
|
const productSelectionList = _Array$isArray__default["default"](productSelections) ? productSelections : [productSelections];
|
|
8212
8300
|
const productSelectionsQuery = react.useQuery(ProductSelectionsPickerFetcher$1, {
|
|
8213
8301
|
context: {
|
|
@@ -8217,7 +8305,7 @@ const useProductSelectionsByFieldFetcher = (productSelections, predicateField) =
|
|
|
8217
8305
|
skip: productSelectionList.length === 0
|
|
8218
8306
|
});
|
|
8219
8307
|
return {
|
|
8220
|
-
productSelections: productSelectionsQuery.data
|
|
8308
|
+
productSelections: (_productSelectionsQue = (_productSelectionsQue2 = productSelectionsQuery.data) === null || _productSelectionsQue2 === void 0 ? void 0 : _productSelectionsQue2.productSelections.results) !== null && _productSelectionsQue !== void 0 ? _productSelectionsQue : [],
|
|
8221
8309
|
isLoading: productSelectionsQuery.loading
|
|
8222
8310
|
};
|
|
8223
8311
|
};
|
|
@@ -8258,8 +8346,8 @@ const createQueryVariables$3 = _ref3 => {
|
|
|
8258
8346
|
var _context;
|
|
8259
8347
|
let searchText = _ref3.searchText;
|
|
8260
8348
|
const sanitizedSearchText = sanitize(_trimInstanceProperty__default["default"](searchText).call(searchText, searchText));
|
|
8261
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
8262
|
-
const keyQuery =
|
|
8349
|
+
const idQuery = isUUID(sanitizedSearchText) && "id = \"".concat(sanitizedSearchText, "\"");
|
|
8350
|
+
const keyQuery = "key = \"".concat(sanitizedSearchText, "\"");
|
|
8263
8351
|
const searchTextQuery = _filterInstanceProperty__default["default"](_context = [idQuery, keyQuery]).call(_context, Boolean).join(' or ');
|
|
8264
8352
|
return {
|
|
8265
8353
|
where: searchTextQuery || undefined
|
|
@@ -8282,6 +8370,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8282
8370
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8283
8371
|
const productSelectionsByFieldFetcher = useProductSelectionsByFieldFetcher(props.value, props.renderSelectInputOptionValuesByField);
|
|
8284
8372
|
const handleLoadOptions = async searchText => {
|
|
8373
|
+
var _data$productSelectio, _data$productSelectio2;
|
|
8285
8374
|
const _await$client$query = await client$1.query({
|
|
8286
8375
|
query: ProductSelectionsPickerFetcher,
|
|
8287
8376
|
variables: createQueryVariables$3({
|
|
@@ -8293,7 +8382,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8293
8382
|
fetchPolicy: 'network-only'
|
|
8294
8383
|
}),
|
|
8295
8384
|
data = _await$client$query.data;
|
|
8296
|
-
const matchedProductSelections = data
|
|
8385
|
+
const matchedProductSelections = (_data$productSelectio = data === null || data === void 0 || (_data$productSelectio2 = data.productSelections) === null || _data$productSelectio2 === void 0 ? void 0 : _data$productSelectio2.results) !== null && _data$productSelectio !== void 0 ? _data$productSelectio : [];
|
|
8297
8386
|
const updatedProductSelections = _mapInstanceProperty__default["default"](matchedProductSelections).call(matchedProductSelections, convertProductSelectionFromGraphQl);
|
|
8298
8387
|
const filteredProductSelections = _filterInstanceProperty__default["default"](updatedProductSelections).call(updatedProductSelections, ps => {
|
|
8299
8388
|
var _context2;
|
|
@@ -8309,7 +8398,8 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8309
8398
|
};
|
|
8310
8399
|
const loadOptionsDebounced = debounce__default["default"](handleLoadOptions, 500);
|
|
8311
8400
|
const onOptionClick = event => {
|
|
8312
|
-
|
|
8401
|
+
var _event$target$value;
|
|
8402
|
+
const productSelectionId = (_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.value;
|
|
8313
8403
|
const currentProductSelection = _findInstanceProperty__default["default"](productionSelectionResults).call(productionSelectionResults, productSelection => productSelection.id === productSelectionId);
|
|
8314
8404
|
props.onChange(currentProductSelection);
|
|
8315
8405
|
};
|
|
@@ -8361,11 +8451,11 @@ function ModeSelectInputOption(props) {
|
|
|
8361
8451
|
scale: "xs",
|
|
8362
8452
|
children: [jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
8363
8453
|
isBold: true,
|
|
8364
|
-
children: data
|
|
8454
|
+
children: (data === null || data === void 0 ? void 0 : data.label) || noValueFallback
|
|
8365
8455
|
}), jsxRuntime.jsxs(uiKit.Text.Detail, {
|
|
8366
|
-
children: ["Key: ", data
|
|
8456
|
+
children: ["Key: ", (data === null || data === void 0 ? void 0 : data.key) || noValueFallback]
|
|
8367
8457
|
}), jsxRuntime.jsxs(uiKit.Text.Detail, {
|
|
8368
|
-
children: ["Type: ", data
|
|
8458
|
+
children: ["Type: ", (data === null || data === void 0 ? void 0 : data.mode) || noValueFallback]
|
|
8369
8459
|
})]
|
|
8370
8460
|
})
|
|
8371
8461
|
}));
|
|
@@ -8466,7 +8556,8 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8466
8556
|
var _context2;
|
|
8467
8557
|
const intl = reactIntl.useIntl();
|
|
8468
8558
|
const handleLoadOptions = async searchTerm => {
|
|
8469
|
-
|
|
8559
|
+
var _props$options, _props$options2;
|
|
8560
|
+
const filteredOptions = (_props$options = props.options) === null || _props$options === void 0 ? void 0 : _filterInstanceProperty__default["default"](_props$options).call(_props$options, country => {
|
|
8470
8561
|
var _context;
|
|
8471
8562
|
return _includesInstanceProperty__default["default"](_context = country.label.toLowerCase()).call(_context, searchTerm.toLowerCase());
|
|
8472
8563
|
});
|
|
@@ -8474,7 +8565,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8474
8565
|
return _sliceInstanceProperty__default["default"](filteredOptions).call(filteredOptions, 0, props.countriesAsyncLoadingLimit);
|
|
8475
8566
|
}
|
|
8476
8567
|
return [{
|
|
8477
|
-
options: props.options
|
|
8568
|
+
options: (_props$options2 = props.options) === null || _props$options2 === void 0 ? void 0 : _sliceInstanceProperty__default["default"](_props$options2).call(_props$options2, 0, props.countriesAsyncLoadingLimit)
|
|
8478
8569
|
}, {
|
|
8479
8570
|
options: emptyCountryOption(intl)
|
|
8480
8571
|
}];
|
|
@@ -8483,7 +8574,10 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8483
8574
|
const countries = event.target.value;
|
|
8484
8575
|
props.onChange({
|
|
8485
8576
|
target: _objectSpread$F(_objectSpread$F({}, event.target), {}, {
|
|
8486
|
-
value: _mapInstanceProperty__default["default"](countries).call(countries, country =>
|
|
8577
|
+
value: _mapInstanceProperty__default["default"](countries).call(countries, country => {
|
|
8578
|
+
var _country$value;
|
|
8579
|
+
return (_country$value = country === null || country === void 0 ? void 0 : country.value) !== null && _country$value !== void 0 ? _country$value : country;
|
|
8580
|
+
})
|
|
8487
8581
|
})
|
|
8488
8582
|
});
|
|
8489
8583
|
};
|
|
@@ -8513,7 +8607,8 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8513
8607
|
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; }
|
|
8514
8608
|
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; }
|
|
8515
8609
|
function CountriesPicker(props) {
|
|
8516
|
-
|
|
8610
|
+
var _props$options;
|
|
8611
|
+
const CustomCountriesPicker = ((_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.length) <= props.countriesAsyncLoadingLimit ? CountriesBasicSelectDropdown : CountriesAsyncSelectDropdown;
|
|
8517
8612
|
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
8518
8613
|
children: jsxRuntime.jsx(CustomCountriesPicker, _objectSpread$E({}, props))
|
|
8519
8614
|
});
|
|
@@ -8542,6 +8637,7 @@ var GetCustomerGroupsQuery = { kind: "Document", definitions: [{ kind: "Operatio
|
|
|
8542
8637
|
var GetCustomerGroupQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetCustomerGroupQuery" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "id" } }, type: { kind: "NamedType", name: { kind: "Name", value: "String" } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "customerGroup" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "id" }, value: { kind: "Variable", name: { kind: "Name", value: "id" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "FragmentSpread", name: { kind: "Name", value: "PickerInputCustomerGroups" }, directives: [] }] } }] } }, { kind: "FragmentDefinition", name: { kind: "Name", value: "PickerInputCustomerGroups" }, typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CustomerGroup" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }], loc: { start: 0, end: 406, source: { body: "fragment PickerInputCustomerGroups on CustomerGroup {\n id\n key\n name\n}\n\nquery GetCustomerGroupsQuery($where: String, $sortByNamePath: String!) {\n customerGroups(where: $where, sort: [$sortByNamePath, \"key\"], limit: 60) {\n total\n results {\n ...PickerInputCustomerGroups\n }\n }\n}\n\nquery GetCustomerGroupQuery($id: String) {\n customerGroup(id: $id) {\n ...PickerInputCustomerGroups\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
8543
8638
|
var PickerInputCustomerGroups = { kind: "Document", definitions: [{ kind: "FragmentDefinition", name: { kind: "Name", value: "PickerInputCustomerGroups" }, typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CustomerGroup" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }], loc: { start: 0, end: 406, source: { body: "fragment PickerInputCustomerGroups on CustomerGroup {\n id\n key\n name\n}\n\nquery GetCustomerGroupsQuery($where: String, $sortByNamePath: String!) {\n customerGroups(where: $where, sort: [$sortByNamePath, \"key\"], limit: 60) {\n total\n results {\n ...PickerInputCustomerGroups\n }\n }\n}\n\nquery GetCustomerGroupQuery($id: String) {\n customerGroup(id: $id) {\n ...PickerInputCustomerGroups\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
8544
8639
|
const CustomerGroupPickerInput = _ref => {
|
|
8640
|
+
var _currentOption$data$l, _currentOption$data;
|
|
8545
8641
|
let isClearable = _ref.isClearable,
|
|
8546
8642
|
isDisabled = _ref.isDisabled,
|
|
8547
8643
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -8610,13 +8706,13 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
8610
8706
|
setLoadingError(null);
|
|
8611
8707
|
handleInternalInputChange(event);
|
|
8612
8708
|
}, [handleInternalInputChange]);
|
|
8613
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
8709
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption === null || currentOption === void 0 ? void 0 : currentOption.error);
|
|
8614
8710
|
React.useEffect(() => {
|
|
8615
8711
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
8616
8712
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
8617
8713
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
8618
8714
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$t.noCustomerGroupsFound), [loadingError, formatMessage]);
|
|
8619
|
-
const tooltipTitle = currentOption
|
|
8715
|
+
const tooltipTitle = (_currentOption$data$l = currentOption === null || currentOption === void 0 || (_currentOption$data = currentOption.data) === null || _currentOption$data === void 0 ? void 0 : _currentOption$data.label) !== null && _currentOption$data$l !== void 0 ? _currentOption$data$l : '';
|
|
8620
8716
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
8621
8717
|
max: "scale",
|
|
8622
8718
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -8626,7 +8722,7 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
8626
8722
|
children: jsxRuntime.jsx(uiKit.AsyncSelectInput, {
|
|
8627
8723
|
id: name,
|
|
8628
8724
|
name: name,
|
|
8629
|
-
placeholder: placeholder
|
|
8725
|
+
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : formatMessage(messages$t.placeholder),
|
|
8630
8726
|
loadOptions: loadOptionsDebounced,
|
|
8631
8727
|
defaultOptions: true,
|
|
8632
8728
|
showOptionGroupDivider: true,
|
|
@@ -8655,11 +8751,12 @@ CustomerGroupPickerInput.displayName = 'CustomerGroupPickerInput';
|
|
|
8655
8751
|
const DEFAULT_LENGTH = 50;
|
|
8656
8752
|
const DEFAULT_END = '...';
|
|
8657
8753
|
function truncate (text) {
|
|
8754
|
+
var _context;
|
|
8658
8755
|
let length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_LENGTH;
|
|
8659
8756
|
let end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_END;
|
|
8660
8757
|
if (!text) return '';
|
|
8661
8758
|
if (text.length < length) return text;
|
|
8662
|
-
return
|
|
8759
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(text.substring(0, length))).call(_context, end);
|
|
8663
8760
|
}
|
|
8664
8761
|
|
|
8665
8762
|
const LOWER_STORES_LIMIT = 60;
|
|
@@ -8667,6 +8764,7 @@ const UPPER_STORES_LIMIT = 500;
|
|
|
8667
8764
|
|
|
8668
8765
|
// map store to options
|
|
8669
8766
|
const mapStoresToOptions = _ref => {
|
|
8767
|
+
var _store$productSelecti;
|
|
8670
8768
|
let store = _ref.store,
|
|
8671
8769
|
renderSelectInputOptionValuesByField = _ref.renderSelectInputOptionValuesByField,
|
|
8672
8770
|
dataLocale = _ref.dataLocale;
|
|
@@ -8677,14 +8775,14 @@ const mapStoresToOptions = _ref => {
|
|
|
8677
8775
|
const localizedName = l10n.formatLocalizedString(convertedStore, {
|
|
8678
8776
|
key: 'name',
|
|
8679
8777
|
locale: dataLocale,
|
|
8680
|
-
fallback:
|
|
8778
|
+
fallback: "".concat(store.key, " (key)")
|
|
8681
8779
|
});
|
|
8682
8780
|
return {
|
|
8683
8781
|
label: localizedName,
|
|
8684
8782
|
value: renderSelectInputOptionValuesByField === 'key' ? store.key : store.id,
|
|
8685
8783
|
key: store.key,
|
|
8686
8784
|
id: store.id,
|
|
8687
|
-
productSelections: store.productSelections
|
|
8785
|
+
productSelections: (_store$productSelecti = store.productSelections) === null || _store$productSelecti === void 0 ? void 0 : _mapInstanceProperty__default["default"](_store$productSelecti).call(_store$productSelecti, productSelectionRef => productSelectionRef.productSelection.id)
|
|
8688
8786
|
};
|
|
8689
8787
|
};
|
|
8690
8788
|
|
|
@@ -8751,7 +8849,7 @@ const getValueFromOptions$1 = _ref => {
|
|
|
8751
8849
|
isMulti = _ref.isMulti;
|
|
8752
8850
|
// handle async-select-field value transformation
|
|
8753
8851
|
if (isMulti) {
|
|
8754
|
-
return _filterInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores
|
|
8852
|
+
return _filterInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores === null || currentlySelectedStores === void 0 ? void 0 : _includesInstanceProperty__default["default"](currentlySelectedStores).call(currentlySelectedStores, store.value));
|
|
8755
8853
|
}
|
|
8756
8854
|
|
|
8757
8855
|
// return value as undefined if no options is yet selected. It is needed for cases where users sets initial values as empty string
|
|
@@ -8780,13 +8878,13 @@ const StoresAsyncSelectInput = props => {
|
|
|
8780
8878
|
sort: 'createdAt asc',
|
|
8781
8879
|
excludeExtendedStoresList: true,
|
|
8782
8880
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8783
|
-
stores: keysOfStores
|
|
8881
|
+
stores: (keysOfStores === null || keysOfStores === void 0 ? void 0 : keysOfStores.length) && keysOfStores,
|
|
8784
8882
|
projectKey: props.projectKey
|
|
8785
8883
|
});
|
|
8786
8884
|
const hasError = uiKit.AsyncSelectInput.isTouched(props.touched) && hasErrors$2(props.errors) || props.hasError;
|
|
8787
8885
|
const mappedStoresListOptions = React.useMemo(() => {
|
|
8788
|
-
var _context2;
|
|
8789
|
-
return _mapInstanceProperty__default["default"](_context2 = storesListFetcher.stores
|
|
8886
|
+
var _context2, _storesListFetcher$st;
|
|
8887
|
+
return _mapInstanceProperty__default["default"](_context2 = ((_storesListFetcher$st = storesListFetcher.stores) === null || _storesListFetcher$st === void 0 ? void 0 : _storesListFetcher$st.results) || []).call(_context2, store => mapStoresToOptions({
|
|
8790
8888
|
store,
|
|
8791
8889
|
dataLocale,
|
|
8792
8890
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -8882,25 +8980,26 @@ const StoresBasicSelectInput = props => {
|
|
|
8882
8980
|
sort: 'createdAt asc',
|
|
8883
8981
|
excludeExtendedStoresList: true,
|
|
8884
8982
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8885
|
-
stores: keysOfStores
|
|
8983
|
+
stores: (keysOfStores === null || keysOfStores === void 0 ? void 0 : keysOfStores.length) && keysOfStores,
|
|
8886
8984
|
projectKey: props.projectKey
|
|
8887
8985
|
});
|
|
8888
8986
|
const hasError = uiKit.SelectInput.isTouched(props.touched) && hasErrors$1(props.errors) || props.hasError;
|
|
8889
8987
|
const mappedStoresListOptions = React.useMemo(() => {
|
|
8890
|
-
var _context2;
|
|
8891
|
-
const results = _mapInstanceProperty__default["default"](_context2 = storesListFetcher.stores
|
|
8988
|
+
var _context2, _storesListFetcher$st;
|
|
8989
|
+
const results = _mapInstanceProperty__default["default"](_context2 = ((_storesListFetcher$st = storesListFetcher.stores) === null || _storesListFetcher$st === void 0 ? void 0 : _storesListFetcher$st.results) || []).call(_context2, store => mapStoresToOptions({
|
|
8892
8990
|
store,
|
|
8893
8991
|
dataLocale,
|
|
8894
8992
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
8895
8993
|
}));
|
|
8896
|
-
return props
|
|
8994
|
+
return props !== null && props !== void 0 && props.renderLabel ? [{
|
|
8897
8995
|
options: getCustomGroupLabelOption(props.renderLabel)
|
|
8898
8996
|
}, {
|
|
8899
8997
|
options: results
|
|
8900
8998
|
}] : results;
|
|
8901
|
-
}, [dataLocale, storesListFetcher.stores, props.renderSelectInputOptionValuesByField, props
|
|
8999
|
+
}, [dataLocale, storesListFetcher.stores, props.renderSelectInputOptionValuesByField, props === null || props === void 0 ? void 0 : props.renderLabel]);
|
|
8902
9000
|
const handleChange = event => {
|
|
8903
|
-
|
|
9001
|
+
var _event$target$value$v, _event$target$value;
|
|
9002
|
+
const value = (_event$target$value$v = (_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.value) !== null && _event$target$value$v !== void 0 ? _event$target$value$v : event.target.value;
|
|
8904
9003
|
const currentStore = _findInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => store.value === value);
|
|
8905
9004
|
|
|
8906
9005
|
// We need complete store info including productSelections
|
|
@@ -8958,6 +9057,7 @@ StoresBasicSelectInput.defaultProps = {
|
|
|
8958
9057
|
|
|
8959
9058
|
var TotalNumberOfStores = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "TotalNumberOfStores" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", alias: { kind: "Name", value: "totalNumberOfStores" }, name: { kind: "Name", value: "stores" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 76, source: { body: "query TotalNumberOfStores {\n totalNumberOfStores: stores {\n total\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
8960
9059
|
const useTotalNumberOfStoresFetcher = projectKey => {
|
|
9060
|
+
var _totalNumberOfStoresQ;
|
|
8961
9061
|
const totalNumberOfStoresQuery = react.useQuery(TotalNumberOfStores, {
|
|
8962
9062
|
context: {
|
|
8963
9063
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM,
|
|
@@ -8966,7 +9066,7 @@ const useTotalNumberOfStoresFetcher = projectKey => {
|
|
|
8966
9066
|
fetchPolicy: 'network-only'
|
|
8967
9067
|
});
|
|
8968
9068
|
return {
|
|
8969
|
-
total: totalNumberOfStoresQuery.data
|
|
9069
|
+
total: (_totalNumberOfStoresQ = totalNumberOfStoresQuery.data) === null || _totalNumberOfStoresQ === void 0 ? void 0 : _totalNumberOfStoresQ.totalNumberOfStores.total,
|
|
8970
9070
|
isLoading: totalNumberOfStoresQuery.loading
|
|
8971
9071
|
};
|
|
8972
9072
|
};
|
|
@@ -8984,15 +9084,19 @@ const handlers$1 = {
|
|
|
8984
9084
|
};
|
|
8985
9085
|
|
|
8986
9086
|
var FetchStoresByField = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchStoresByField" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "where" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "excludeProductSelections" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "limit" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", alias: { kind: "Name", value: "storesByField" }, name: { kind: "Name", value: "stores" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "where" }, value: { kind: "Variable", name: { kind: "Name", value: "where" } } }, { kind: "Argument", name: { kind: "Name", value: "limit" }, value: { kind: "Variable", name: { kind: "Name", value: "limit" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "productSelections" }, arguments: [], directives: [{ kind: "Directive", name: { kind: "Name", value: "skip" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "excludeProductSelections" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "active" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "productSelection" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }] } }] } }] } }] } }], loc: { start: 0, end: 473, source: { body: "query FetchStoresByField(\n $where: String!\n $excludeProductSelections: Boolean!\n $limit: Int\n) {\n storesByField: stores(where: $where, limit: $limit) {\n results {\n id\n key\n nameAllLocales {\n locale\n value\n }\n productSelections @skip(if: $excludeProductSelections) {\n active\n productSelection {\n id\n nameAllLocales {\n locale\n value\n }\n }\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
8987
|
-
const createQueryVariables$2 = (stores, predicateField, shouldFetchProductSelections) =>
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
9087
|
+
const createQueryVariables$2 = (stores, predicateField, shouldFetchProductSelections) => {
|
|
9088
|
+
var _context;
|
|
9089
|
+
return {
|
|
9090
|
+
where: _concatInstanceProperty__default["default"](_context = "".concat(predicateField, " in (")).call(_context, _mapInstanceProperty__default["default"](stores).call(stores, store => "\"".concat(store, "\"")).join(', '), ")"),
|
|
9091
|
+
limit: 500,
|
|
9092
|
+
excludeProductSelections: !shouldFetchProductSelections
|
|
9093
|
+
};
|
|
9094
|
+
};
|
|
8992
9095
|
const emptyStoresQueryResult = {
|
|
8993
9096
|
results: []
|
|
8994
9097
|
};
|
|
8995
9098
|
const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
9099
|
+
var _storesQuery$data;
|
|
8996
9100
|
let shouldFetchProductSelections = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
8997
9101
|
// incase of single select input stores are sent as single string literal
|
|
8998
9102
|
const storesList = _Array$isArray__default["default"](stores) ? stores : [stores];
|
|
@@ -9005,13 +9109,13 @@ const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
|
9005
9109
|
skip: storesList.length === 0
|
|
9006
9110
|
});
|
|
9007
9111
|
return {
|
|
9008
|
-
stores: storesQuery.data
|
|
9112
|
+
stores: ((_storesQuery$data = storesQuery.data) === null || _storesQuery$data === void 0 ? void 0 : _storesQuery$data.storesByField) || emptyStoresQueryResult,
|
|
9009
9113
|
isLoading: storesQuery.loading
|
|
9010
9114
|
};
|
|
9011
9115
|
};
|
|
9012
9116
|
|
|
9013
9117
|
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; }
|
|
9014
|
-
function _objectSpread$B(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
9118
|
+
function _objectSpread$B(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context6 = ownKeys$B(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context7 = ownKeys$B(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
9015
9119
|
var FetchStoresByWherePredicate = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchStoresByWherePredicate" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "where" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipFetchingStores" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "excludeProductSelections" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", alias: { kind: "Name", value: "storesByWherePredicate" }, name: { kind: "Name", value: "stores" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "where" }, value: { kind: "Variable", name: { kind: "Name", value: "where" } } }], directives: [{ kind: "Directive", name: { kind: "Name", value: "skip" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "skipFetchingStores" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "productSelections" }, arguments: [], directives: [{ kind: "Directive", name: { kind: "Name", value: "skip" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "excludeProductSelections" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "active" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "productSelection" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }] } }] } }] } }] } }], loc: { start: 0, end: 525, source: { body: "query FetchStoresByWherePredicate(\n $where: String!\n $skipFetchingStores: Boolean!\n $excludeProductSelections: Boolean!\n) {\n storesByWherePredicate: stores(where: $where) @skip(if: $skipFetchingStores) {\n results {\n id\n key\n nameAllLocales {\n locale\n value\n }\n productSelections @skip(if: $excludeProductSelections) {\n active\n productSelection {\n id\n nameAllLocales {\n locale\n value\n }\n }\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
9016
9120
|
var styles$c = {
|
|
9017
9121
|
"renderLabelContainer": "stores-search-selector-module__renderLabelContainer___3_PBc",
|
|
@@ -9022,16 +9126,16 @@ const hasErrors = errors => {
|
|
|
9022
9126
|
return errors && _someInstanceProperty__default["default"](_context = _Object$values__default["default"](errors)).call(_context, Boolean);
|
|
9023
9127
|
};
|
|
9024
9128
|
const createQueryVariables$1 = _ref => {
|
|
9025
|
-
var _context2;
|
|
9129
|
+
var _context2, _context3;
|
|
9026
9130
|
let searchText = _ref.searchText,
|
|
9027
9131
|
dataLocale = _ref.dataLocale,
|
|
9028
9132
|
allAccessibleStoreKeysThroughDataFencePermissions = _ref.allAccessibleStoreKeysThroughDataFencePermissions,
|
|
9029
9133
|
shouldFetchProductSelections = _ref.shouldFetchProductSelections;
|
|
9030
9134
|
const sanitizedSearchText = sanitize(_trimInstanceProperty__default["default"](searchText).call(searchText, searchText));
|
|
9031
|
-
const keyQuery =
|
|
9135
|
+
const keyQuery = "key = \"".concat(sanitizedSearchText, "\"");
|
|
9032
9136
|
|
|
9033
9137
|
// if the user has data fence permissions then we only allow stores to fetched that user has access to
|
|
9034
|
-
if (allAccessibleStoreKeysThroughDataFencePermissions
|
|
9138
|
+
if (allAccessibleStoreKeysThroughDataFencePermissions !== null && allAccessibleStoreKeysThroughDataFencePermissions !== void 0 && allAccessibleStoreKeysThroughDataFencePermissions.length) {
|
|
9035
9139
|
// if the current search term match the accessible stores keys, then proceed with fetching the store
|
|
9036
9140
|
if (_includesInstanceProperty__default["default"](allAccessibleStoreKeysThroughDataFencePermissions).call(allAccessibleStoreKeysThroughDataFencePermissions, sanitizedSearchText)) {
|
|
9037
9141
|
return {
|
|
@@ -9047,9 +9151,9 @@ const createQueryVariables$1 = _ref => {
|
|
|
9047
9151
|
excludeProductSelections: !shouldFetchProductSelections
|
|
9048
9152
|
};
|
|
9049
9153
|
}
|
|
9050
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
9051
|
-
const nameQuery =
|
|
9052
|
-
const searchTextQuery = _filterInstanceProperty__default["default"](
|
|
9154
|
+
const idQuery = isUUID(sanitizedSearchText) && "id = \"".concat(sanitizedSearchText, "\"");
|
|
9155
|
+
const nameQuery = _concatInstanceProperty__default["default"](_context2 = "name(".concat(dataLocale, " = \"")).call(_context2, sanitizedSearchText, "\")");
|
|
9156
|
+
const searchTextQuery = _filterInstanceProperty__default["default"](_context3 = [idQuery, nameQuery, keyQuery]).call(_context3, Boolean).join(' or ');
|
|
9053
9157
|
return {
|
|
9054
9158
|
skipFetchingStores: false,
|
|
9055
9159
|
where: searchTextQuery,
|
|
@@ -9057,6 +9161,7 @@ const createQueryVariables$1 = _ref => {
|
|
|
9057
9161
|
};
|
|
9058
9162
|
};
|
|
9059
9163
|
const getValueFromOptions = _ref2 => {
|
|
9164
|
+
var _storesByFieldFetcher, _context4;
|
|
9060
9165
|
let isMulti = _ref2.isMulti,
|
|
9061
9166
|
value = _ref2.value,
|
|
9062
9167
|
dataLocale = _ref2.dataLocale,
|
|
@@ -9065,7 +9170,7 @@ const getValueFromOptions = _ref2 => {
|
|
|
9065
9170
|
if (!value) {
|
|
9066
9171
|
return undefined;
|
|
9067
9172
|
}
|
|
9068
|
-
const selectedOptions = storesByFieldFetcher.stores
|
|
9173
|
+
const selectedOptions = (_storesByFieldFetcher = storesByFieldFetcher.stores) === null || _storesByFieldFetcher === void 0 ? void 0 : _mapInstanceProperty__default["default"](_context4 = _storesByFieldFetcher.results).call(_context4, store => mapStoresToOptions({
|
|
9069
9174
|
store,
|
|
9070
9175
|
dataLocale,
|
|
9071
9176
|
renderSelectInputOptionValuesByField: renderSelectInputOptionValuesByField
|
|
@@ -9103,8 +9208,9 @@ const StoresSearchSelectInput = props => {
|
|
|
9103
9208
|
},
|
|
9104
9209
|
fetchPolicy: 'network-only'
|
|
9105
9210
|
}).then(_ref3 => {
|
|
9211
|
+
var _data$storesByWherePr, _context5;
|
|
9106
9212
|
let data = _ref3.data;
|
|
9107
|
-
const result = data.storesByWherePredicate
|
|
9213
|
+
const result = (_data$storesByWherePr = data.storesByWherePredicate) === null || _data$storesByWherePr === void 0 ? void 0 : _mapInstanceProperty__default["default"](_context5 = _data$storesByWherePr.results).call(_context5, store => mapStoresToOptions({
|
|
9108
9214
|
store,
|
|
9109
9215
|
dataLocale,
|
|
9110
9216
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -9125,7 +9231,7 @@ const StoresSearchSelectInput = props => {
|
|
|
9125
9231
|
className: styles$c.renderLabelContainer,
|
|
9126
9232
|
children: [jsxRuntime.jsx("div", {
|
|
9127
9233
|
className: styles$c.customLabel,
|
|
9128
|
-
children: props
|
|
9234
|
+
children: (props === null || props === void 0 ? void 0 : props.renderLabel) && (props === null || props === void 0 ? void 0 : props.renderLabel)
|
|
9129
9235
|
}), jsxRuntime.jsx("div", {
|
|
9130
9236
|
children: intl.formatMessage(inputValue ? messages$s.searchSelectInputNoOptionsFoundMessage : messages$s.searchSelectInputNoValueMessage)
|
|
9131
9237
|
})]
|
|
@@ -9304,14 +9410,14 @@ var messages$r = reactIntl.defineMessages({
|
|
|
9304
9410
|
|
|
9305
9411
|
function formatDiscount(discount, currencyCode, intl) {
|
|
9306
9412
|
var _context;
|
|
9307
|
-
if (discount.type === 'relative') return
|
|
9413
|
+
if (discount.type === 'relative') return "".concat(discount.permyriad / 100, "%");
|
|
9308
9414
|
if (!discount.money) return null;
|
|
9309
9415
|
const moneyForCurrencyCode = _findInstanceProperty__default["default"](_context = discount.money).call(_context, discountMoney => discountMoney.currencyCode === currencyCode);
|
|
9310
9416
|
return moneyForCurrencyCode ? formatMoney$2(moneyForCurrencyCode, intl) : null;
|
|
9311
9417
|
}
|
|
9312
9418
|
|
|
9313
9419
|
function formatPercentage(percentage) {
|
|
9314
|
-
return
|
|
9420
|
+
return "".concat(percentage, "%");
|
|
9315
9421
|
}
|
|
9316
9422
|
function convertRatioToPercentage(ratio) {
|
|
9317
9423
|
return _parseFloat__default["default"]((ratio * 100).toFixed(2));
|
|
@@ -9365,8 +9471,8 @@ function validateFilter$2(_ref, intl) {
|
|
|
9365
9471
|
};
|
|
9366
9472
|
}
|
|
9367
9473
|
if (value.option === FILTER_TYPES.range) {
|
|
9368
|
-
const from = validateValue(filterValue
|
|
9369
|
-
const to = from ? null : validateValue(filterValue
|
|
9474
|
+
const from = validateValue(filterValue === null || filterValue === void 0 ? void 0 : filterValue.from, typeName, intl);
|
|
9475
|
+
const to = from ? null : validateValue(filterValue === null || filterValue === void 0 ? void 0 : filterValue.to, typeName, intl);
|
|
9370
9476
|
return from || to ? {
|
|
9371
9477
|
input: {
|
|
9372
9478
|
from,
|
|
@@ -9403,16 +9509,16 @@ function validateFilter$1(_ref, intl) {
|
|
|
9403
9509
|
type = _ref.type;
|
|
9404
9510
|
if (type === 'range') {
|
|
9405
9511
|
if (validateSingleFilter({
|
|
9406
|
-
value: value
|
|
9512
|
+
value: value === null || value === void 0 ? void 0 : value.from
|
|
9407
9513
|
})) return {
|
|
9408
9514
|
from: intl.formatMessage(messages$p.rangeMissingValue)
|
|
9409
9515
|
};
|
|
9410
9516
|
if (validateSingleFilter({
|
|
9411
|
-
value: value
|
|
9517
|
+
value: value === null || value === void 0 ? void 0 : value.to
|
|
9412
9518
|
})) return {
|
|
9413
9519
|
to: intl.formatMessage(messages$p.rangeMissingValue)
|
|
9414
9520
|
};
|
|
9415
|
-
if (moment__default$1["default"](value
|
|
9521
|
+
if (moment__default$1["default"](value === null || value === void 0 ? void 0 : value.to).isBefore(value === null || value === void 0 ? void 0 : value.from)) return {
|
|
9416
9522
|
from: intl.formatMessage(messages$p.rangeToSmallerThanFrom)
|
|
9417
9523
|
};
|
|
9418
9524
|
} else if (type === 'equalTo' || type === 'lessThan' || type === 'moreThan') {
|
|
@@ -9482,8 +9588,10 @@ function isEmptyFilter(_ref) {
|
|
|
9482
9588
|
}
|
|
9483
9589
|
|
|
9484
9590
|
function numberTransformer(filterKey, filters) {
|
|
9591
|
+
var _context3;
|
|
9485
9592
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$2;
|
|
9486
9593
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
9594
|
+
var _context, _context2;
|
|
9487
9595
|
let type = _ref.type,
|
|
9488
9596
|
value = _ref.value;
|
|
9489
9597
|
if (!filterValidator({
|
|
@@ -9492,19 +9600,19 @@ function numberTransformer(filterKey, filters) {
|
|
|
9492
9600
|
})) return '';
|
|
9493
9601
|
switch (type) {
|
|
9494
9602
|
case 'lessThan':
|
|
9495
|
-
return
|
|
9603
|
+
return "(* to ".concat(_parseInt__default["default"](value) - 1, ")");
|
|
9496
9604
|
case 'moreThan':
|
|
9497
|
-
return
|
|
9605
|
+
return "(".concat(_parseInt__default["default"](value) + 1, " to *)");
|
|
9498
9606
|
case 'equalTo':
|
|
9499
|
-
return
|
|
9607
|
+
return _concatInstanceProperty__default["default"](_context = "(".concat(value, " to ")).call(_context, value, ")");
|
|
9500
9608
|
case 'range':
|
|
9501
|
-
return
|
|
9609
|
+
return _concatInstanceProperty__default["default"](_context2 = "(".concat(value.from, " to ")).call(_context2, value.to, ")");
|
|
9502
9610
|
default:
|
|
9503
9611
|
return '';
|
|
9504
9612
|
}
|
|
9505
9613
|
});
|
|
9506
9614
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
9507
|
-
return queryString === '' ? null :
|
|
9615
|
+
return queryString === '' ? null : _concatInstanceProperty__default["default"](_context3 = "".concat(filterKey, ": range")).call(_context3, queryString);
|
|
9508
9616
|
}
|
|
9509
9617
|
function isFilterValid$2(_ref2) {
|
|
9510
9618
|
let type = _ref2.type,
|
|
@@ -9531,9 +9639,11 @@ function graphqlCategoryLevelTransformer(filterKey, filters, filterValidator) {
|
|
|
9531
9639
|
return _filterInstanceProperty__default["default"](_context = [levelFilterQuery, lastLevelFilterQuery]).call(_context, Boolean);
|
|
9532
9640
|
}
|
|
9533
9641
|
|
|
9642
|
+
var _templateObject$1, _templateObject2;
|
|
9534
9643
|
const dateFormatDayStart = 'YYYY-MM-DDT00:00:00.000Z';
|
|
9535
9644
|
const dateFormatDayEnd = 'YYYY-MM-DDT23:59:59.999Z';
|
|
9536
9645
|
function dateTransformer(filterKey, filters) {
|
|
9646
|
+
var _context;
|
|
9537
9647
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$1;
|
|
9538
9648
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
9539
9649
|
let type = _ref.type,
|
|
@@ -9544,25 +9654,19 @@ function dateTransformer(filterKey, filters) {
|
|
|
9544
9654
|
})) return '';
|
|
9545
9655
|
switch (type) {
|
|
9546
9656
|
case 'lessThan':
|
|
9547
|
-
return
|
|
9657
|
+
return "(* to \"".concat(moment__default$1["default"](value).format(dateFormatDayStart), "\")");
|
|
9548
9658
|
case 'moreThan':
|
|
9549
|
-
return
|
|
9659
|
+
return "(\"".concat(moment__default$1["default"](value).format(dateFormatDayEnd), "\" to *)");
|
|
9550
9660
|
case 'equalTo':
|
|
9551
|
-
return oneLine__default["default"]
|
|
9552
|
-
("${moment__default$1["default"](value).format(dateFormatDayStart)}"
|
|
9553
|
-
to "${moment__default$1["default"](value).format(dateFormatDayEnd)}")
|
|
9554
|
-
`;
|
|
9661
|
+
return oneLine__default["default"](_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n (\"", "\"\n to \"", "\")\n "])), moment__default$1["default"](value).format(dateFormatDayStart), moment__default$1["default"](value).format(dateFormatDayEnd));
|
|
9555
9662
|
case 'range':
|
|
9556
|
-
return oneLine__default["default"]
|
|
9557
|
-
("${moment__default$1["default"](value.from).format(dateFormatDayStart)}"
|
|
9558
|
-
to "${moment__default$1["default"](value.to).format(dateFormatDayEnd)}")
|
|
9559
|
-
`;
|
|
9663
|
+
return oneLine__default["default"](_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n (\"", "\"\n to \"", "\")\n "])), moment__default$1["default"](value.from).format(dateFormatDayStart), moment__default$1["default"](value.to).format(dateFormatDayEnd));
|
|
9560
9664
|
default:
|
|
9561
9665
|
return '';
|
|
9562
9666
|
}
|
|
9563
9667
|
});
|
|
9564
9668
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
9565
|
-
return queryString === '' ? null :
|
|
9669
|
+
return queryString === '' ? null : _concatInstanceProperty__default["default"](_context = "".concat(filterKey, ": range")).call(_context, queryString);
|
|
9566
9670
|
}
|
|
9567
9671
|
function isFilterValid$1(_ref2) {
|
|
9568
9672
|
let type = _ref2.type,
|
|
@@ -9577,18 +9681,19 @@ function isFilterValid$1(_ref2) {
|
|
|
9577
9681
|
}
|
|
9578
9682
|
|
|
9579
9683
|
function missingLocaleTransformer(filterKey, filters) {
|
|
9684
|
+
var _context;
|
|
9580
9685
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
9581
9686
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
9582
9687
|
if (filters.length === 0) return null;
|
|
9583
9688
|
const missingLocale = filters[0].value.value;
|
|
9584
|
-
return
|
|
9689
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(filterKey, ".")).call(_context, missingLocale, ":missing");
|
|
9585
9690
|
}
|
|
9586
9691
|
|
|
9587
9692
|
function missingTransformer(filterKey, filters) {
|
|
9588
9693
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
9589
9694
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
9590
9695
|
if (filters.length === 0) return null;
|
|
9591
|
-
return
|
|
9696
|
+
return "".concat(filterKey, ":missing");
|
|
9592
9697
|
}
|
|
9593
9698
|
|
|
9594
9699
|
/**
|
|
@@ -9629,6 +9734,7 @@ function graphqlQueryBuilder(_ref) {
|
|
|
9629
9734
|
}
|
|
9630
9735
|
|
|
9631
9736
|
function referenceTransformer(filterKey, filters) {
|
|
9737
|
+
var _context;
|
|
9632
9738
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid;
|
|
9633
9739
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
9634
9740
|
let type = _ref.type,
|
|
@@ -9639,46 +9745,49 @@ function referenceTransformer(filterKey, filters) {
|
|
|
9639
9745
|
})) return '';
|
|
9640
9746
|
switch (type) {
|
|
9641
9747
|
case 'equalTo':
|
|
9642
|
-
return
|
|
9748
|
+
return "\"".concat(value, "\"");
|
|
9643
9749
|
default:
|
|
9644
9750
|
return '';
|
|
9645
9751
|
}
|
|
9646
9752
|
});
|
|
9647
9753
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
9648
|
-
return queryString === '' ? null :
|
|
9754
|
+
return queryString === '' ? null : _concatInstanceProperty__default["default"](_context = "".concat(filterKey, ".id: ")).call(_context, queryString);
|
|
9649
9755
|
}
|
|
9650
9756
|
function isFilterValid(_ref2) {
|
|
9651
|
-
var
|
|
9757
|
+
var _context2;
|
|
9652
9758
|
let type = _ref2.type,
|
|
9653
9759
|
value = _ref2.value;
|
|
9654
|
-
if (type === 'equalTo' && !_includesInstanceProperty__default["default"](
|
|
9760
|
+
if (type === 'equalTo' && !_includesInstanceProperty__default["default"](_context2 = [null, undefined, '']).call(_context2, value)) return true;
|
|
9655
9761
|
return false;
|
|
9656
9762
|
}
|
|
9657
9763
|
|
|
9658
9764
|
function textTransformer(filterKey, queries) {
|
|
9765
|
+
var _context;
|
|
9659
9766
|
if (queries.length === 0) return null;
|
|
9660
9767
|
|
|
9661
9768
|
// Note: we assume for now that there can only be 1 text filter.
|
|
9662
9769
|
const queryValue = queries[0].value;
|
|
9663
|
-
return queryValue ?
|
|
9770
|
+
return queryValue ? _concatInstanceProperty__default["default"](_context = "".concat(filterKey, ":\"")).call(_context, queryValue, "\"") : null;
|
|
9664
9771
|
}
|
|
9665
9772
|
|
|
9666
9773
|
const composeNumberPredicateFromFilter = (target, value, option) => {
|
|
9774
|
+
var _context, _context2, _context3, _context4, _context5, _context6;
|
|
9667
9775
|
switch (option) {
|
|
9668
9776
|
case FILTER_TYPES.lessThan:
|
|
9669
|
-
return
|
|
9777
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(target, " < ")).call(_context, value);
|
|
9670
9778
|
case FILTER_TYPES.moreThan:
|
|
9671
|
-
return
|
|
9779
|
+
return _concatInstanceProperty__default["default"](_context2 = "".concat(target, " > ")).call(_context2, value);
|
|
9672
9780
|
case FILTER_TYPES.equalTo:
|
|
9673
|
-
return
|
|
9781
|
+
return _concatInstanceProperty__default["default"](_context3 = "".concat(target, " = ")).call(_context3, value);
|
|
9674
9782
|
case FILTER_TYPES.range:
|
|
9675
|
-
return
|
|
9783
|
+
return _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = _concatInstanceProperty__default["default"](_context6 = "".concat(target, " >= ")).call(_context6, value.from, " and ")).call(_context5, target, " <= ")).call(_context4, value.to);
|
|
9676
9784
|
default:
|
|
9677
9785
|
return '';
|
|
9678
9786
|
}
|
|
9679
9787
|
};
|
|
9680
9788
|
function customFields (filter, locale) {
|
|
9681
9789
|
const customFieldsPredicates = _mapInstanceProperty__default["default"](filter).call(filter, customFieldFilter => {
|
|
9790
|
+
var _context7, _context8, _context9, _context10, _context11;
|
|
9682
9791
|
const _customFieldFilter$va = customFieldFilter.value,
|
|
9683
9792
|
target = _customFieldFilter$va.target,
|
|
9684
9793
|
type = _customFieldFilter$va.type,
|
|
@@ -9686,14 +9795,14 @@ function customFields (filter, locale) {
|
|
|
9686
9795
|
option = _customFieldFilter$va.option;
|
|
9687
9796
|
switch (type.name) {
|
|
9688
9797
|
case FIELD_TYPES.Boolean:
|
|
9689
|
-
return
|
|
9798
|
+
return _concatInstanceProperty__default["default"](_context7 = "".concat(target, " = ")).call(_context7, value.value);
|
|
9690
9799
|
case FIELD_TYPES.String:
|
|
9691
|
-
return
|
|
9800
|
+
return _concatInstanceProperty__default["default"](_context8 = "".concat(target, " = \"")).call(_context8, value, "\"");
|
|
9692
9801
|
case FIELD_TYPES.LocalizedString:
|
|
9693
|
-
return
|
|
9802
|
+
return _concatInstanceProperty__default["default"](_context9 = "".concat(target, "(")).call(_context9, localizedTextTransformer(value), ")");
|
|
9694
9803
|
case FIELD_TYPES.Enum:
|
|
9695
9804
|
case FIELD_TYPES.LocalizedEnum:
|
|
9696
|
-
return
|
|
9805
|
+
return _concatInstanceProperty__default["default"](_context10 = "".concat(target, " = \"")).call(_context10, value.value, "\"");
|
|
9697
9806
|
case FIELD_TYPES.Time:
|
|
9698
9807
|
return timeTransformer(target, [{
|
|
9699
9808
|
type: option,
|
|
@@ -9708,14 +9817,14 @@ function customFields (filter, locale) {
|
|
|
9708
9817
|
case FIELD_TYPES.Number:
|
|
9709
9818
|
return composeNumberPredicateFromFilter(target, value, option);
|
|
9710
9819
|
case FIELD_TYPES.Money:
|
|
9711
|
-
return
|
|
9820
|
+
return _concatInstanceProperty__default["default"](_context11 = "".concat(target, "(")).call(_context11, moneyTransformer(value, option, locale), ")");
|
|
9712
9821
|
case FIELD_TYPES.Reference:
|
|
9713
9822
|
case FIELD_TYPES.Set:
|
|
9714
9823
|
default:
|
|
9715
9824
|
throw new Error('Custom field type not recognized');
|
|
9716
9825
|
}
|
|
9717
9826
|
});
|
|
9718
|
-
return
|
|
9827
|
+
return "(custom(fields(".concat(customFieldsPredicates.join(' and '), ")))");
|
|
9719
9828
|
}
|
|
9720
9829
|
|
|
9721
9830
|
// https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/btoa#Unicode_strings
|
|
@@ -9760,7 +9869,7 @@ function ownKeys$z(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
9760
9869
|
function _objectSpread$z(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$z(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$z(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
9761
9870
|
const resourcesWithPlatformLimits = _Object$keys__default["default"](RESOURCES_WITH_PLATFORM_LIMITS);
|
|
9762
9871
|
const createQueryVariables = platformLimit => _reduceInstanceProperty__default["default"](resourcesWithPlatformLimits).call(resourcesWithPlatformLimits, (previousIncludedLimits, nextNameOfLimit) => _objectSpread$z({
|
|
9763
|
-
[camelCase__default["default"](
|
|
9872
|
+
[camelCase__default["default"]("should include ".concat(nextNameOfLimit))]: platformLimit ? nextNameOfLimit === platformLimit : true
|
|
9764
9873
|
}, previousIncludedLimits), {});
|
|
9765
9874
|
|
|
9766
9875
|
var PlatformLimitsFetcherQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "PlatformLimitsFetcherQuery" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeShoppingLists" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeProductDiscounts" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeCartDiscounts" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeStores" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeCustomers" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeCustomerGroups" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeZones" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeTaxCategories" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeShippingMethods" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeCarts" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "limits" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "shoppingLists" }, arguments: [], directives: [{ kind: "Directive", name: { kind: "Name", value: "include" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeShoppingLists" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "limit" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "current" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "lineItems" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "limit" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "textLineItems" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "limit" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "productDiscounts" }, arguments: [], directives: [{ kind: "Directive", name: { kind: "Name", value: "include" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeProductDiscounts" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "totalActive" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "limit" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "current" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "cartDiscounts" }, arguments: [], directives: [{ kind: "Directive", name: { kind: "Name", value: "include" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeCartDiscounts" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "totalActiveWithoutDiscountCodes" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "limit" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "current" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "stores" }, arguments: [], directives: [{ kind: "Directive", name: { kind: "Name", value: "include" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeStores" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "limit" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "current" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "inventorySupplyChannels" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "limit" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "productDistributionChannels" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "limit" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "customers" }, arguments: [], directives: [{ kind: "Directive", name: { kind: "Name", value: "include" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeCustomers" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "limit" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "current" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "customerGroups" }, arguments: [], directives: [{ kind: "Directive", name: { kind: "Name", value: "include" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeCustomerGroups" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "limit" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "current" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "zones" }, arguments: [], directives: [{ kind: "Directive", name: { kind: "Name", value: "include" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeZones" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "limit" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "current" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "taxCategories" }, arguments: [], directives: [{ kind: "Directive", name: { kind: "Name", value: "include" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeTaxCategories" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "limit" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "current" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "shippingMethods" }, arguments: [], directives: [{ kind: "Directive", name: { kind: "Name", value: "include" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeShippingMethods" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "limit" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "current" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "carts" }, arguments: [], directives: [{ kind: "Directive", name: { kind: "Name", value: "include" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeCarts" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "limit" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "current" }, arguments: [], directives: [] }] } }] } }] } }] } }], loc: { start: 0, end: 1820, source: { body: "query PlatformLimitsFetcherQuery(\n $shouldIncludeShoppingLists: Boolean!\n $shouldIncludeProductDiscounts: Boolean!\n $shouldIncludeCartDiscounts: Boolean!\n $shouldIncludeStores: Boolean!\n $shouldIncludeCustomers: Boolean!\n $shouldIncludeCustomerGroups: Boolean!\n $shouldIncludeZones: Boolean!\n $shouldIncludeTaxCategories: Boolean!\n $shouldIncludeShippingMethods: Boolean!\n $shouldIncludeCarts: Boolean!\n) {\n limits {\n shoppingLists @include(if: $shouldIncludeShoppingLists) {\n total {\n limit\n current\n }\n lineItems {\n limit\n }\n textLineItems {\n limit\n }\n }\n productDiscounts @include(if: $shouldIncludeProductDiscounts) {\n totalActive {\n limit\n current\n }\n }\n cartDiscounts @include(if: $shouldIncludeCartDiscounts) {\n totalActiveWithoutDiscountCodes {\n limit\n current\n }\n }\n stores @include(if: $shouldIncludeStores) {\n total {\n limit\n current\n }\n inventorySupplyChannels {\n limit\n }\n productDistributionChannels {\n limit\n }\n }\n customers @include(if: $shouldIncludeCustomers) {\n total {\n limit\n current\n }\n }\n customerGroups @include(if: $shouldIncludeCustomerGroups) {\n total {\n limit\n current\n }\n }\n zones @include(if: $shouldIncludeZones) {\n total {\n limit\n current\n }\n }\n taxCategories @include(if: $shouldIncludeTaxCategories) {\n total {\n limit\n current\n }\n }\n shippingMethods @include(if: $shouldIncludeShippingMethods) {\n total {\n limit\n current\n }\n }\n carts @include(if: $shouldIncludeCarts) {\n total {\n limit\n current\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
@@ -9776,7 +9885,7 @@ const usePlatformLimitsFetcher = platformLimit => {
|
|
|
9776
9885
|
error = _useQuery.error,
|
|
9777
9886
|
data = _useQuery.data,
|
|
9778
9887
|
refetch = _useQuery.refetch;
|
|
9779
|
-
const platformLimits = !loading ? omit__default["default"](data
|
|
9888
|
+
const platformLimits = !loading ? omit__default["default"](data === null || data === void 0 ? void 0 : data.limits, '__typename') : {};
|
|
9780
9889
|
return {
|
|
9781
9890
|
isLoading: loading,
|
|
9782
9891
|
error,
|
|
@@ -9967,10 +10076,11 @@ const getPlatformLimitsStatus = _ref3 => {
|
|
|
9967
10076
|
total = _ref3.total,
|
|
9968
10077
|
intl = _ref3.intl;
|
|
9969
10078
|
if (limit) {
|
|
9970
|
-
|
|
10079
|
+
var _context;
|
|
10080
|
+
return _concatInstanceProperty__default["default"](_context = "(".concat(intl.formatNumber(current), "/")).call(_context, intl.formatNumber(limit), ")");
|
|
9971
10081
|
}
|
|
9972
10082
|
if (total) {
|
|
9973
|
-
return
|
|
10083
|
+
return "(".concat(intl.formatNumber(total), ")");
|
|
9974
10084
|
}
|
|
9975
10085
|
return '';
|
|
9976
10086
|
};
|
|
@@ -9990,17 +10100,18 @@ const useShippingMethodsPlatformLimitsFetcher = () => {
|
|
|
9990
10100
|
};
|
|
9991
10101
|
|
|
9992
10102
|
const useShippingMethodsPlatformLimits = () => {
|
|
10103
|
+
var _platformLimits$shipp;
|
|
9993
10104
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
9994
10105
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
9995
|
-
if (!platformLimits
|
|
10106
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$shipp = platformLimits.shippingMethods) !== null && _platformLimits$shipp !== void 0 && _platformLimits$shipp.total)) {
|
|
9996
10107
|
return {
|
|
9997
10108
|
hasReachedShippingMethodsWarningLimit: false,
|
|
9998
10109
|
hasReachedShippingMethodsErrorLimit: false
|
|
9999
10110
|
};
|
|
10000
10111
|
}
|
|
10001
|
-
const _platformLimits$
|
|
10002
|
-
limit = _platformLimits$
|
|
10003
|
-
current = _platformLimits$
|
|
10112
|
+
const _platformLimits$shipp2 = platformLimits.shippingMethods.total,
|
|
10113
|
+
limit = _platformLimits$shipp2.limit,
|
|
10114
|
+
current = _platformLimits$shipp2.current;
|
|
10004
10115
|
const hasReachedShippingMethodsWarningLimit = getHasExceededWarningThreshold({
|
|
10005
10116
|
limit,
|
|
10006
10117
|
current
|
|
@@ -10016,12 +10127,13 @@ const useShippingMethodsPlatformLimits = () => {
|
|
|
10016
10127
|
};
|
|
10017
10128
|
|
|
10018
10129
|
const PlatformLimitsShippingMethodsNotifications = () => {
|
|
10130
|
+
var _platformLimits$shipp;
|
|
10019
10131
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
10020
10132
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
10021
10133
|
const _useShippingMethodsPl2 = useShippingMethodsPlatformLimits(),
|
|
10022
10134
|
hasReachedShippingMethodsWarningLimit = _useShippingMethodsPl2.hasReachedShippingMethodsWarningLimit,
|
|
10023
10135
|
hasReachedShippingMethodsErrorLimit = _useShippingMethodsPl2.hasReachedShippingMethodsErrorLimit;
|
|
10024
|
-
if (!platformLimits
|
|
10136
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$shipp = platformLimits.shippingMethods) !== null && _platformLimits$shipp !== void 0 && _platformLimits$shipp.total)) {
|
|
10025
10137
|
return null;
|
|
10026
10138
|
}
|
|
10027
10139
|
if (hasReachedShippingMethodsErrorLimit) {
|
|
@@ -10067,12 +10179,13 @@ var messages$k = reactIntl.defineMessages({
|
|
|
10067
10179
|
});
|
|
10068
10180
|
|
|
10069
10181
|
const PlatformLimitsShippingMethodsStatus = _ref => {
|
|
10182
|
+
var _platformLimits$shipp, _platformLimits$shipp2;
|
|
10070
10183
|
let total = _ref.total;
|
|
10071
10184
|
const intl = reactIntl.useIntl();
|
|
10072
10185
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
10073
10186
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
10074
|
-
const current = platformLimits
|
|
10075
|
-
const limit = platformLimits
|
|
10187
|
+
const current = platformLimits === null || platformLimits === void 0 || (_platformLimits$shipp = platformLimits.shippingMethods) === null || _platformLimits$shipp === void 0 || (_platformLimits$shipp = _platformLimits$shipp.total) === null || _platformLimits$shipp === void 0 ? void 0 : _platformLimits$shipp.current;
|
|
10188
|
+
const limit = platformLimits === null || platformLimits === void 0 || (_platformLimits$shipp2 = platformLimits.shippingMethods) === null || _platformLimits$shipp2 === void 0 || (_platformLimits$shipp2 = _platformLimits$shipp2.total) === null || _platformLimits$shipp2 === void 0 ? void 0 : _platformLimits$shipp2.limit;
|
|
10076
10189
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
10077
10190
|
intlMessage: messages$k.shippingMethodsStatus,
|
|
10078
10191
|
children: getPlatformLimitsStatus({
|
|
@@ -10134,17 +10247,18 @@ const useTaxCategoriesPlatformLimitsFetcher = () => {
|
|
|
10134
10247
|
};
|
|
10135
10248
|
|
|
10136
10249
|
const useTaxCategoriesPlatformLimits = () => {
|
|
10250
|
+
var _platformLimits$taxCa;
|
|
10137
10251
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
10138
10252
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
10139
|
-
if (!platformLimits
|
|
10253
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$taxCa = platformLimits.taxCategories) !== null && _platformLimits$taxCa !== void 0 && _platformLimits$taxCa.total)) {
|
|
10140
10254
|
return {
|
|
10141
10255
|
hasReachedTaxCategoriesWarningLimit: false,
|
|
10142
10256
|
hasReachedTaxCategoriesErrorLimit: false
|
|
10143
10257
|
};
|
|
10144
10258
|
}
|
|
10145
|
-
const _platformLimits$
|
|
10146
|
-
limit = _platformLimits$
|
|
10147
|
-
current = _platformLimits$
|
|
10259
|
+
const _platformLimits$taxCa2 = platformLimits.taxCategories.total,
|
|
10260
|
+
limit = _platformLimits$taxCa2.limit,
|
|
10261
|
+
current = _platformLimits$taxCa2.current;
|
|
10148
10262
|
const hasReachedTaxCategoriesWarningLimit = getHasExceededWarningThreshold({
|
|
10149
10263
|
limit,
|
|
10150
10264
|
current
|
|
@@ -10160,12 +10274,13 @@ const useTaxCategoriesPlatformLimits = () => {
|
|
|
10160
10274
|
};
|
|
10161
10275
|
|
|
10162
10276
|
const PlatformLimitsTaxCategoriesNotifications = () => {
|
|
10277
|
+
var _platformLimits$taxCa;
|
|
10163
10278
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
10164
10279
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
10165
10280
|
const _useTaxCategoriesPlat2 = useTaxCategoriesPlatformLimits(),
|
|
10166
10281
|
hasReachedTaxCategoriesWarningLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesWarningLimit,
|
|
10167
10282
|
hasReachedTaxCategoriesErrorLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesErrorLimit;
|
|
10168
|
-
if (!platformLimits
|
|
10283
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$taxCa = platformLimits.taxCategories) !== null && _platformLimits$taxCa !== void 0 && _platformLimits$taxCa.total)) {
|
|
10169
10284
|
return null;
|
|
10170
10285
|
}
|
|
10171
10286
|
if (hasReachedTaxCategoriesErrorLimit) {
|
|
@@ -10211,12 +10326,13 @@ var messages$i = reactIntl.defineMessages({
|
|
|
10211
10326
|
});
|
|
10212
10327
|
|
|
10213
10328
|
const PlatformLimitsTaxCategoriesStatus = _ref => {
|
|
10329
|
+
var _platformLimits$taxCa, _platformLimits$taxCa2;
|
|
10214
10330
|
let total = _ref.total;
|
|
10215
10331
|
const intl = reactIntl.useIntl();
|
|
10216
10332
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
10217
10333
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
10218
|
-
const current = platformLimits
|
|
10219
|
-
const limit = platformLimits
|
|
10334
|
+
const current = platformLimits === null || platformLimits === void 0 || (_platformLimits$taxCa = platformLimits.taxCategories) === null || _platformLimits$taxCa === void 0 || (_platformLimits$taxCa = _platformLimits$taxCa.total) === null || _platformLimits$taxCa === void 0 ? void 0 : _platformLimits$taxCa.current;
|
|
10335
|
+
const limit = platformLimits === null || platformLimits === void 0 || (_platformLimits$taxCa2 = platformLimits.taxCategories) === null || _platformLimits$taxCa2 === void 0 || (_platformLimits$taxCa2 = _platformLimits$taxCa2.total) === null || _platformLimits$taxCa2 === void 0 ? void 0 : _platformLimits$taxCa2.limit;
|
|
10220
10336
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
10221
10337
|
intlMessage: messages$i.taxCategoriesStatus,
|
|
10222
10338
|
children: getPlatformLimitsStatus({
|
|
@@ -10278,17 +10394,18 @@ const useZonesPlatformLimitsFetcher = () => {
|
|
|
10278
10394
|
};
|
|
10279
10395
|
|
|
10280
10396
|
const useZonesPlatformLimits = () => {
|
|
10397
|
+
var _platformLimits$zones;
|
|
10281
10398
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10282
10399
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10283
|
-
if (!platformLimits
|
|
10400
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$zones = platformLimits.zones) !== null && _platformLimits$zones !== void 0 && _platformLimits$zones.total)) {
|
|
10284
10401
|
return {
|
|
10285
10402
|
hasReachedZonesWarningLimit: false,
|
|
10286
10403
|
hasReachedZonesErrorLimit: false
|
|
10287
10404
|
};
|
|
10288
10405
|
}
|
|
10289
|
-
const _platformLimits$
|
|
10290
|
-
limit = _platformLimits$
|
|
10291
|
-
current = _platformLimits$
|
|
10406
|
+
const _platformLimits$zones2 = platformLimits.zones.total,
|
|
10407
|
+
limit = _platformLimits$zones2.limit,
|
|
10408
|
+
current = _platformLimits$zones2.current;
|
|
10292
10409
|
const hasReachedZonesWarningLimit = getHasExceededWarningThreshold({
|
|
10293
10410
|
limit,
|
|
10294
10411
|
current
|
|
@@ -10304,12 +10421,13 @@ const useZonesPlatformLimits = () => {
|
|
|
10304
10421
|
};
|
|
10305
10422
|
|
|
10306
10423
|
const PlatformLimitsZonesNotifications = () => {
|
|
10424
|
+
var _platformLimits$zones;
|
|
10307
10425
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10308
10426
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10309
10427
|
const _useZonesPlatformLimi2 = useZonesPlatformLimits(),
|
|
10310
10428
|
hasReachedZonesWarningLimit = _useZonesPlatformLimi2.hasReachedZonesWarningLimit,
|
|
10311
10429
|
hasReachedZonesErrorLimit = _useZonesPlatformLimi2.hasReachedZonesErrorLimit;
|
|
10312
|
-
if (!platformLimits
|
|
10430
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$zones = platformLimits.zones) !== null && _platformLimits$zones !== void 0 && _platformLimits$zones.total)) {
|
|
10313
10431
|
return null;
|
|
10314
10432
|
}
|
|
10315
10433
|
if (hasReachedZonesErrorLimit) {
|
|
@@ -10355,12 +10473,13 @@ var messages$g = reactIntl.defineMessages({
|
|
|
10355
10473
|
});
|
|
10356
10474
|
|
|
10357
10475
|
const PlatformLimitsZonesStatus = _ref => {
|
|
10476
|
+
var _platformLimits$zones, _platformLimits$zones2;
|
|
10358
10477
|
let total = _ref.total;
|
|
10359
10478
|
const intl = reactIntl.useIntl();
|
|
10360
10479
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10361
10480
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10362
|
-
const current = platformLimits
|
|
10363
|
-
const limit = platformLimits
|
|
10481
|
+
const current = platformLimits === null || platformLimits === void 0 || (_platformLimits$zones = platformLimits.zones) === null || _platformLimits$zones === void 0 || (_platformLimits$zones = _platformLimits$zones.total) === null || _platformLimits$zones === void 0 ? void 0 : _platformLimits$zones.current;
|
|
10482
|
+
const limit = platformLimits === null || platformLimits === void 0 || (_platformLimits$zones2 = platformLimits.zones) === null || _platformLimits$zones2 === void 0 || (_platformLimits$zones2 = _platformLimits$zones2.total) === null || _platformLimits$zones2 === void 0 ? void 0 : _platformLimits$zones2.limit;
|
|
10364
10483
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
10365
10484
|
intlMessage: messages$g.zonesStatus,
|
|
10366
10485
|
children: getPlatformLimitsStatus({
|
|
@@ -10422,17 +10541,18 @@ const useCustomersPlatformLimitsFetcher = () => {
|
|
|
10422
10541
|
};
|
|
10423
10542
|
|
|
10424
10543
|
const useCustomersPlatformLimits$1 = () => {
|
|
10544
|
+
var _platformLimits$custo;
|
|
10425
10545
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10426
10546
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10427
|
-
if (!platformLimits
|
|
10547
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$custo = platformLimits.customers) !== null && _platformLimits$custo !== void 0 && _platformLimits$custo.total)) {
|
|
10428
10548
|
return {
|
|
10429
10549
|
hasReachedCustomersWarningLimit: false,
|
|
10430
10550
|
hasReachedCustomersErrorLimit: false
|
|
10431
10551
|
};
|
|
10432
10552
|
}
|
|
10433
|
-
const _platformLimits$
|
|
10434
|
-
limit = _platformLimits$
|
|
10435
|
-
current = _platformLimits$
|
|
10553
|
+
const _platformLimits$custo2 = platformLimits.customers.total,
|
|
10554
|
+
limit = _platformLimits$custo2.limit,
|
|
10555
|
+
current = _platformLimits$custo2.current;
|
|
10436
10556
|
const hasReachedCustomersWarningLimit = getHasExceededWarningThreshold({
|
|
10437
10557
|
limit,
|
|
10438
10558
|
current
|
|
@@ -10461,12 +10581,13 @@ const useCustomersPlatormLimitsModalState = () => {
|
|
|
10461
10581
|
};
|
|
10462
10582
|
|
|
10463
10583
|
const PlatformLimitsCustomersNotifications = () => {
|
|
10584
|
+
var _platformLimits$custo;
|
|
10464
10585
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10465
10586
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10466
10587
|
const _useCustomersPlatform2 = useCustomersPlatformLimits$1(),
|
|
10467
10588
|
hasReachedCustomersWarningLimit = _useCustomersPlatform2.hasReachedCustomersWarningLimit,
|
|
10468
10589
|
hasReachedCustomersErrorLimit = _useCustomersPlatform2.hasReachedCustomersErrorLimit;
|
|
10469
|
-
if (!platformLimits
|
|
10590
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$custo = platformLimits.customers) !== null && _platformLimits$custo !== void 0 && _platformLimits$custo.total)) {
|
|
10470
10591
|
return jsxRuntime.jsx("div", {});
|
|
10471
10592
|
}
|
|
10472
10593
|
if (hasReachedCustomersErrorLimit) {
|
|
@@ -10517,15 +10638,16 @@ var styles$b = {
|
|
|
10517
10638
|
"status": "platform-limits-customers-status-module__status___3rXYM"
|
|
10518
10639
|
};
|
|
10519
10640
|
const PlatformLimitsCustomersStatus = () => {
|
|
10641
|
+
var _platformLimits$custo;
|
|
10520
10642
|
const intl = reactIntl.useIntl();
|
|
10521
10643
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10522
10644
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10523
|
-
if (!platformLimits
|
|
10645
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$custo = platformLimits.customers) !== null && _platformLimits$custo !== void 0 && _platformLimits$custo.total)) {
|
|
10524
10646
|
return null;
|
|
10525
10647
|
}
|
|
10526
|
-
const _platformLimits$
|
|
10527
|
-
current = _platformLimits$
|
|
10528
|
-
limit = _platformLimits$
|
|
10648
|
+
const _platformLimits$custo2 = platformLimits.customers.total,
|
|
10649
|
+
current = _platformLimits$custo2.current,
|
|
10650
|
+
limit = _platformLimits$custo2.limit;
|
|
10529
10651
|
return jsxRuntime.jsx("div", {
|
|
10530
10652
|
className: styles$b.status,
|
|
10531
10653
|
children: jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
@@ -10759,17 +10881,18 @@ const useCustomerGroupsPlatformLimitsFetcher = () => {
|
|
|
10759
10881
|
};
|
|
10760
10882
|
|
|
10761
10883
|
const useCustomerGroupsPlatformLimitsStatus = () => {
|
|
10884
|
+
var _platformLimits$custo;
|
|
10762
10885
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10763
10886
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10764
|
-
if (!platformLimits
|
|
10887
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$custo = platformLimits.customerGroups) !== null && _platformLimits$custo !== void 0 && _platformLimits$custo.total)) {
|
|
10765
10888
|
return {
|
|
10766
10889
|
hasReachedCustomerGroupsWarningLimit: false,
|
|
10767
10890
|
hasReachedCustomerGroupsErrorLimit: false
|
|
10768
10891
|
};
|
|
10769
10892
|
}
|
|
10770
|
-
const _platformLimits$
|
|
10771
|
-
limit = _platformLimits$
|
|
10772
|
-
current = _platformLimits$
|
|
10893
|
+
const _platformLimits$custo2 = platformLimits.customerGroups.total,
|
|
10894
|
+
limit = _platformLimits$custo2.limit,
|
|
10895
|
+
current = _platformLimits$custo2.current;
|
|
10773
10896
|
const hasReachedCustomerGroupsWarningLimit = getHasExceededWarningThreshold({
|
|
10774
10897
|
limit,
|
|
10775
10898
|
current
|
|
@@ -10798,12 +10921,13 @@ const useCustomerGroupsPlatormLimitsModalState = () => {
|
|
|
10798
10921
|
};
|
|
10799
10922
|
|
|
10800
10923
|
const PlatformLimitsCustomerGroupsNotifications = () => {
|
|
10924
|
+
var _platformLimits$custo;
|
|
10801
10925
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10802
10926
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10803
10927
|
const _useCustomerGroupsPla2 = useCustomerGroupsPlatformLimitsStatus(),
|
|
10804
10928
|
hasReachedCustomerGroupsWarningLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsWarningLimit,
|
|
10805
10929
|
hasReachedCustomerGroupsErrorLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsErrorLimit;
|
|
10806
|
-
if (!platformLimits
|
|
10930
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$custo = platformLimits.customerGroups) !== null && _platformLimits$custo !== void 0 && _platformLimits$custo.total)) {
|
|
10807
10931
|
return jsxRuntime.jsx("div", {});
|
|
10808
10932
|
}
|
|
10809
10933
|
if (hasReachedCustomerGroupsErrorLimit) {
|
|
@@ -10854,15 +10978,16 @@ var styles$9 = {
|
|
|
10854
10978
|
"status": "platform-limits-customer-groups-status-module__status___6099G"
|
|
10855
10979
|
};
|
|
10856
10980
|
const PlatformLimitsCustomerGroupsStatus = () => {
|
|
10981
|
+
var _platformLimits$custo;
|
|
10857
10982
|
const intl = reactIntl.useIntl();
|
|
10858
10983
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10859
10984
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10860
|
-
if (!platformLimits
|
|
10985
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$custo = platformLimits.customerGroups) !== null && _platformLimits$custo !== void 0 && _platformLimits$custo.total)) {
|
|
10861
10986
|
return null;
|
|
10862
10987
|
}
|
|
10863
|
-
const _platformLimits$
|
|
10864
|
-
current = _platformLimits$
|
|
10865
|
-
limit = _platformLimits$
|
|
10988
|
+
const _platformLimits$custo2 = platformLimits.customerGroups.total,
|
|
10989
|
+
current = _platformLimits$custo2.current,
|
|
10990
|
+
limit = _platformLimits$custo2.limit;
|
|
10866
10991
|
return jsxRuntime.jsx("div", {
|
|
10867
10992
|
className: styles$9.status,
|
|
10868
10993
|
children: jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
@@ -11094,7 +11219,7 @@ var fetchPimIndexStatus = ((apolloClient, projectKey) => async dispatch => {
|
|
|
11094
11219
|
try {
|
|
11095
11220
|
await dispatch(sdk.actions.head({
|
|
11096
11221
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.PIM_SEARCH,
|
|
11097
|
-
uri:
|
|
11222
|
+
uri: "/".concat(projectKey, "/search/products")
|
|
11098
11223
|
}));
|
|
11099
11224
|
return {
|
|
11100
11225
|
status: 'indexed'
|
|
@@ -11197,51 +11322,50 @@ const getIndexingJobIds = _ref => {
|
|
|
11197
11322
|
products = _ref$data.products,
|
|
11198
11323
|
productTypes = _ref$data.productTypes;
|
|
11199
11324
|
return {
|
|
11200
|
-
productsJobId: products
|
|
11201
|
-
productTypesJobId: productTypes
|
|
11325
|
+
productsJobId: (products === null || products === void 0 ? void 0 : products.indexingJobId) || (products === null || products === void 0 ? void 0 : products.existingIndexingJobId),
|
|
11326
|
+
productTypesJobId: (productTypes === null || productTypes === void 0 ? void 0 : productTypes.indexingJobId) || (productTypes === null || productTypes === void 0 ? void 0 : productTypes.existingIndexingJobId)
|
|
11202
11327
|
};
|
|
11203
11328
|
};
|
|
11204
11329
|
let PimIndexerProvider = /*#__PURE__*/function (_PureComponent) {
|
|
11205
|
-
_inherits(PimIndexerProvider, _PureComponent);
|
|
11206
11330
|
function PimIndexerProvider() {
|
|
11207
|
-
var
|
|
11331
|
+
var _this2;
|
|
11208
11332
|
_classCallCheck(this, PimIndexerProvider);
|
|
11209
11333
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
11210
11334
|
args[_key] = arguments[_key];
|
|
11211
11335
|
}
|
|
11212
|
-
|
|
11213
|
-
|
|
11336
|
+
_this2 = _callSuper$3(this, PimIndexerProvider, [...args]);
|
|
11337
|
+
_this2.state = {
|
|
11214
11338
|
isLoading: true,
|
|
11215
11339
|
isPimIndexerUnreachable: false,
|
|
11216
11340
|
isProjectIndexedByPim: false,
|
|
11217
11341
|
isProjectBeingIndexedByPim: false
|
|
11218
11342
|
};
|
|
11219
|
-
|
|
11343
|
+
_this2.checkIfProjectIsIndexed = async () => {
|
|
11220
11344
|
var _context;
|
|
11221
|
-
const _await$
|
|
11222
|
-
status = _await$
|
|
11223
|
-
isIndexingProducts = _await$
|
|
11224
|
-
isIndexingProductTypes = _await$
|
|
11345
|
+
const _await$_this2$props$f = await _this2.props.fetchPimIndexStatus(_this2.props.client, _this2.props.projectKey),
|
|
11346
|
+
status = _await$_this2$props$f.status,
|
|
11347
|
+
isIndexingProducts = _await$_this2$props$f.isIndexingProducts,
|
|
11348
|
+
isIndexingProductTypes = _await$_this2$props$f.isIndexingProductTypes;
|
|
11225
11349
|
const isPimIndexerUnreachable = _includesInstanceProperty__default["default"](_context = ['not-configured', 'unreachable']).call(_context, status);
|
|
11226
11350
|
if (status === 'indexing') {
|
|
11227
|
-
|
|
11351
|
+
_this2.monitorIndexingProgress({
|
|
11228
11352
|
isIndexingProducts,
|
|
11229
11353
|
isIndexingProductTypes
|
|
11230
11354
|
});
|
|
11231
11355
|
} else {
|
|
11232
|
-
|
|
11356
|
+
_this2.setState({
|
|
11233
11357
|
isLoading: false,
|
|
11234
11358
|
isPimIndexerUnreachable,
|
|
11235
11359
|
isProjectIndexedByPim: status === 'indexed'
|
|
11236
11360
|
});
|
|
11237
11361
|
}
|
|
11238
11362
|
};
|
|
11239
|
-
|
|
11240
|
-
|
|
11363
|
+
_this2.componentDidMount = () => {
|
|
11364
|
+
_this2.checkIfProjectIsIndexed();
|
|
11241
11365
|
};
|
|
11242
|
-
|
|
11243
|
-
if (
|
|
11244
|
-
return
|
|
11366
|
+
_this2.attemptToRefreshProducts = products => {
|
|
11367
|
+
if (_this2.state.isProjectIndexedByPim) {
|
|
11368
|
+
return _this2.props.refreshProductIndicesByIds({
|
|
11245
11369
|
context: pimIndexerRequestContext,
|
|
11246
11370
|
variables: {
|
|
11247
11371
|
ids: _mapInstanceProperty__default["default"](products).call(products, product => product.id)
|
|
@@ -11258,26 +11382,26 @@ let PimIndexerProvider = /*#__PURE__*/function (_PureComponent) {
|
|
|
11258
11382
|
}
|
|
11259
11383
|
return _Promise__default["default"].resolve();
|
|
11260
11384
|
};
|
|
11261
|
-
|
|
11262
|
-
|
|
11385
|
+
_this2.handleFailedIndexing = () => {
|
|
11386
|
+
_this2.setState({
|
|
11263
11387
|
isProjectBeingIndexedByPim: false,
|
|
11264
11388
|
isProjectIndexedByPim: false
|
|
11265
11389
|
});
|
|
11266
|
-
|
|
11390
|
+
_this2.props.notifications.showNotification({
|
|
11267
11391
|
kind: 'error',
|
|
11268
11392
|
domain: constants.DOMAINS.SIDE,
|
|
11269
|
-
text:
|
|
11393
|
+
text: _this2.props.intl.formatMessage(messages$9.indexingFailed)
|
|
11270
11394
|
});
|
|
11271
11395
|
};
|
|
11272
|
-
|
|
11273
|
-
const result = await
|
|
11396
|
+
_this2.getIndexingProgress = async () => {
|
|
11397
|
+
const result = await _this2.props.client.query({
|
|
11274
11398
|
query: GetIndexingProgress,
|
|
11275
11399
|
context: pimIndexerRequestContext,
|
|
11276
11400
|
variables: {
|
|
11277
|
-
productsJobId:
|
|
11278
|
-
productTypesJobId:
|
|
11279
|
-
shouldIncludeProducts: !!
|
|
11280
|
-
shouldIncludeProductTypes: !!
|
|
11401
|
+
productsJobId: _this2.state.productsJobId || '',
|
|
11402
|
+
productTypesJobId: _this2.state.productTypesJobId || '',
|
|
11403
|
+
shouldIncludeProducts: !!_this2.state.productsJobId,
|
|
11404
|
+
shouldIncludeProductTypes: !!_this2.state.productTypesJobId
|
|
11281
11405
|
},
|
|
11282
11406
|
fetchPolicy: 'network-only'
|
|
11283
11407
|
});
|
|
@@ -11290,24 +11414,24 @@ let PimIndexerProvider = /*#__PURE__*/function (_PureComponent) {
|
|
|
11290
11414
|
productTypes: result.data.productTypes || completedStatus
|
|
11291
11415
|
};
|
|
11292
11416
|
};
|
|
11293
|
-
|
|
11417
|
+
_this2.handleFinishedIndexing = async () => {
|
|
11294
11418
|
try {
|
|
11295
|
-
|
|
11296
|
-
const _await$
|
|
11297
|
-
status = _await$
|
|
11419
|
+
_this2.updateIndexingStatusTimerHandler = null;
|
|
11420
|
+
const _await$_this2$props$f2 = await _this2.props.fetchPimIndexStatus(_this2.props.client, _this2.props.projectKey),
|
|
11421
|
+
status = _await$_this2$props$f2.status;
|
|
11298
11422
|
|
|
11299
11423
|
// There is a delay between indexing jobs reporting
|
|
11300
11424
|
// they are completed, and PIM realizing all the project is indexed.
|
|
11301
11425
|
// So, we have to wait to let PIM update project indexing status.
|
|
11302
11426
|
if (status === 'indexed') {
|
|
11303
|
-
|
|
11427
|
+
_this2.setState({
|
|
11304
11428
|
isProjectBeingIndexedByPim: false,
|
|
11305
11429
|
isProjectIndexedByPim: true
|
|
11306
11430
|
});
|
|
11307
|
-
|
|
11431
|
+
_this2.props.notifications.showNotification({
|
|
11308
11432
|
kind: 'success',
|
|
11309
11433
|
domain: constants.DOMAINS.SIDE,
|
|
11310
|
-
text:
|
|
11434
|
+
text: _this2.props.intl.formatMessage(messages$9.indexingSucceed)
|
|
11311
11435
|
},
|
|
11312
11436
|
// because the indexing may take so long, the success notification
|
|
11313
11437
|
// may be dismissed without being seen by the user. Set `dismissAfter`
|
|
@@ -11316,63 +11440,64 @@ let PimIndexerProvider = /*#__PURE__*/function (_PureComponent) {
|
|
|
11316
11440
|
dismissAfter: 0
|
|
11317
11441
|
});
|
|
11318
11442
|
} else {
|
|
11319
|
-
|
|
11443
|
+
_this2.updateIndexingStatusTimerHandler = _setTimeout__default["default"](_this2.handleFinishedIndexing, 5000);
|
|
11320
11444
|
}
|
|
11321
11445
|
} catch (e) {
|
|
11322
|
-
|
|
11446
|
+
_this2.handleFailedIndexing();
|
|
11323
11447
|
}
|
|
11324
11448
|
};
|
|
11325
|
-
|
|
11449
|
+
_this2.updateIndexingStatus = async () => {
|
|
11326
11450
|
try {
|
|
11327
|
-
const _await$
|
|
11328
|
-
products = _await$
|
|
11329
|
-
productTypes = _await$
|
|
11451
|
+
const _await$_this2$getInde = await _this2.getIndexingProgress(),
|
|
11452
|
+
products = _await$_this2$getInde.products,
|
|
11453
|
+
productTypes = _await$_this2$getInde.productTypes;
|
|
11330
11454
|
const isCompleted = isIndexingCompleted(products, productTypes);
|
|
11331
11455
|
const indexingProgress = calculateProgress(products, productTypes);
|
|
11332
|
-
|
|
11456
|
+
_this2.setState({
|
|
11333
11457
|
indexingProgress
|
|
11334
11458
|
});
|
|
11335
11459
|
if (!isCompleted) {
|
|
11336
|
-
|
|
11460
|
+
_this2.updateIndexingStatusTimerHandler = _setTimeout__default["default"](_this2.updateIndexingStatus, 5000);
|
|
11337
11461
|
} else {
|
|
11338
|
-
|
|
11462
|
+
_this2.setState({
|
|
11339
11463
|
indexingProgress: 100
|
|
11340
11464
|
});
|
|
11341
|
-
|
|
11465
|
+
_this2.handleFinishedIndexing();
|
|
11342
11466
|
}
|
|
11343
11467
|
} catch (e) {
|
|
11344
|
-
|
|
11468
|
+
_this2.handleFailedIndexing();
|
|
11345
11469
|
}
|
|
11346
11470
|
};
|
|
11347
|
-
|
|
11471
|
+
_this2.monitorIndexingProgress = async _ref2 => {
|
|
11348
11472
|
let isIndexingProducts = _ref2.isIndexingProducts,
|
|
11349
11473
|
isIndexingProductTypes = _ref2.isIndexingProductTypes;
|
|
11350
|
-
if (
|
|
11474
|
+
if (_this2.state.isProjectBeingIndexedByPim) return;
|
|
11351
11475
|
try {
|
|
11352
|
-
const indexMutationResult = await
|
|
11476
|
+
const indexMutationResult = await _this2.props.indexProject({
|
|
11353
11477
|
context: pimIndexerRequestContext,
|
|
11354
11478
|
variables: {
|
|
11355
11479
|
shouldIndexProducts: isIndexingProducts,
|
|
11356
11480
|
shouldIndexProductTypes: isIndexingProductTypes
|
|
11357
11481
|
}
|
|
11358
11482
|
});
|
|
11359
|
-
|
|
11483
|
+
_this2.setState(_objectSpread$h(_objectSpread$h({
|
|
11360
11484
|
isLoading: false,
|
|
11361
11485
|
isProjectBeingIndexedByPim: true
|
|
11362
11486
|
}, getIndexingJobIds(indexMutationResult)), {}, {
|
|
11363
11487
|
indexingProgress: 0
|
|
11364
|
-
}), () =>
|
|
11488
|
+
}), () => _this2.updateIndexingStatus());
|
|
11365
11489
|
} catch (e) {
|
|
11366
|
-
|
|
11490
|
+
_this2.handleFailedIndexing();
|
|
11367
11491
|
}
|
|
11368
11492
|
};
|
|
11369
|
-
|
|
11493
|
+
_this2.indexProject = () => _this2.monitorIndexingProgress({
|
|
11370
11494
|
isIndexingProductTypes: true,
|
|
11371
11495
|
isIndexingProducts: true
|
|
11372
11496
|
});
|
|
11373
|
-
return
|
|
11497
|
+
return _this2;
|
|
11374
11498
|
}
|
|
11375
|
-
|
|
11499
|
+
_inherits(PimIndexerProvider, _PureComponent);
|
|
11500
|
+
return _createClass(PimIndexerProvider, [{
|
|
11376
11501
|
key: "componentWillUnmount",
|
|
11377
11502
|
value: function componentWillUnmount() {
|
|
11378
11503
|
if (this.updateIndexingStatusTimerHandler) clearTimeout(this.updateIndexingStatusTimerHandler);
|
|
@@ -11389,7 +11514,6 @@ let PimIndexerProvider = /*#__PURE__*/function (_PureComponent) {
|
|
|
11389
11514
|
});
|
|
11390
11515
|
}
|
|
11391
11516
|
}]);
|
|
11392
|
-
return PimIndexerProvider;
|
|
11393
11517
|
}(React.PureComponent);
|
|
11394
11518
|
PimIndexerProvider.displayName = 'PimIndexerProvider';
|
|
11395
11519
|
var pimIndexerProvider = flowRight__default["default"](applicationShellConnectors.withApplicationContext(applicationContext => ({
|
|
@@ -11417,12 +11541,12 @@ function _callSuper$2(_this, derived, args) {
|
|
|
11417
11541
|
return _possibleConstructorReturn(_this, isNativeReflectConstruct() ? _Reflect$construct__default["default"](derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args));
|
|
11418
11542
|
}
|
|
11419
11543
|
let WithPimIndexer = /*#__PURE__*/function (_PureComponent) {
|
|
11420
|
-
_inherits(WithPimIndexer, _PureComponent);
|
|
11421
11544
|
function WithPimIndexer() {
|
|
11422
11545
|
_classCallCheck(this, WithPimIndexer);
|
|
11423
11546
|
return _callSuper$2(this, WithPimIndexer, arguments);
|
|
11424
11547
|
}
|
|
11425
|
-
|
|
11548
|
+
_inherits(WithPimIndexer, _PureComponent);
|
|
11549
|
+
return _createClass(WithPimIndexer, [{
|
|
11426
11550
|
key: "render",
|
|
11427
11551
|
value: function render() {
|
|
11428
11552
|
return jsxRuntime.jsx(PimIndexerContext.Consumer, {
|
|
@@ -11430,7 +11554,6 @@ let WithPimIndexer = /*#__PURE__*/function (_PureComponent) {
|
|
|
11430
11554
|
});
|
|
11431
11555
|
}
|
|
11432
11556
|
}]);
|
|
11433
|
-
return WithPimIndexer;
|
|
11434
11557
|
}(React.PureComponent);
|
|
11435
11558
|
WithPimIndexer.displayName = 'WithPimIndexer';
|
|
11436
11559
|
|
|
@@ -11472,6 +11595,7 @@ const valueMapping = {
|
|
|
11472
11595
|
all: [true, false]
|
|
11473
11596
|
};
|
|
11474
11597
|
const BooleanField = props => {
|
|
11598
|
+
var _context;
|
|
11475
11599
|
let selectedValue;
|
|
11476
11600
|
if (typeof props.value === 'boolean') selectedValue = getBooleanValue(props.value);else if (props.isMulti && _Array$isArray__default["default"](props.value) && props.value.length) selectedValue = props.value.length === 2 ? 'all' : getBooleanValue(props.value[0]);
|
|
11477
11601
|
const yesLabel = props.intl.formatMessage(messages$8.yes);
|
|
@@ -11485,7 +11609,7 @@ const BooleanField = props => {
|
|
|
11485
11609
|
}];
|
|
11486
11610
|
if (props.isMulti) options.push({
|
|
11487
11611
|
value: 'all',
|
|
11488
|
-
label:
|
|
11612
|
+
label: _concatInstanceProperty__default["default"](_context = "".concat(yesLabel, " / ")).call(_context, noLabel)
|
|
11489
11613
|
});
|
|
11490
11614
|
return jsxRuntime.jsx(uiKit.SelectInput, {
|
|
11491
11615
|
name: props.name,
|
|
@@ -11649,19 +11773,19 @@ const ScrollToFieldError = () => {
|
|
|
11649
11773
|
if (isValid) return;
|
|
11650
11774
|
const firstErrorElement = document.querySelector('[aria-invalid="true"]');
|
|
11651
11775
|
if (firstErrorElement) {
|
|
11776
|
+
var _ref, _ref2, _document$querySelect, _elementToScrollTo$sc;
|
|
11652
11777
|
// Get a reference to the label.
|
|
11653
11778
|
const firstElementId = firstErrorElement.getAttribute('id');
|
|
11654
|
-
const localizedInputIndex = _indexOfInstanceProperty__default["default"](firstElementId).call(firstElementId,
|
|
11779
|
+
const localizedInputIndex = _indexOfInstanceProperty__default["default"](firstElementId).call(firstElementId, ".".concat(dataLocale));
|
|
11655
11780
|
|
|
11656
11781
|
// check if locale is appended then remove it from id
|
|
11657
|
-
const id = localizedInputIndex > -1 ? firstElementId.replace(
|
|
11782
|
+
const id = localizedInputIndex > -1 ? firstElementId.replace(".".concat(dataLocale), '') : firstElementId;
|
|
11658
11783
|
|
|
11659
11784
|
// Scroll to the label (if found), otherwise to the input element itself.
|
|
11660
11785
|
|
|
11661
|
-
const elementToScrollTo =
|
|
11662
|
-
|
|
11663
|
-
|
|
11664
|
-
elementToScrollTo.scrollIntoView?.({
|
|
11786
|
+
const elementToScrollTo = // div is used only for custom fields
|
|
11787
|
+
(_ref = (_ref2 = (_document$querySelect = document.querySelector("div[aria-errormessage=\"".concat(firstElementId, "\"]"))) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector("label[for=\"".concat(id, "\"]"))) !== null && _ref2 !== void 0 ? _ref2 : document.querySelector("label#".concat(id))) !== null && _ref !== void 0 ? _ref : firstErrorElement;
|
|
11788
|
+
(_elementToScrollTo$sc = elementToScrollTo.scrollIntoView) === null || _elementToScrollTo$sc === void 0 || _elementToScrollTo$sc.call(elementToScrollTo, {
|
|
11665
11789
|
behavior: 'smooth'
|
|
11666
11790
|
});
|
|
11667
11791
|
}
|
|
@@ -11687,7 +11811,8 @@ var styles$4 = {
|
|
|
11687
11811
|
"search-mode-menu": "selectable-field-search-input-module__search-mode-menu___Od6Le"
|
|
11688
11812
|
};
|
|
11689
11813
|
const SelectableFieldSearchInput = props => {
|
|
11690
|
-
|
|
11814
|
+
var _props$initialValue, _props$placeholder;
|
|
11815
|
+
const _useState = React.useState((_props$initialValue = props.initialValue) !== null && _props$initialValue !== void 0 ? _props$initialValue : ''),
|
|
11691
11816
|
_useState2 = _slicedToArray(_useState, 2),
|
|
11692
11817
|
searchText = _useState2[0],
|
|
11693
11818
|
setSearchText = _useState2[1];
|
|
@@ -11723,7 +11848,7 @@ const SelectableFieldSearchInput = props => {
|
|
|
11723
11848
|
});
|
|
11724
11849
|
},
|
|
11725
11850
|
onReset: props.onReset,
|
|
11726
|
-
placeholder: props.placeholder
|
|
11851
|
+
placeholder: (_props$placeholder = props.placeholder) !== null && _props$placeholder !== void 0 ? _props$placeholder : intl.formatMessage(messages$5.placeholder),
|
|
11727
11852
|
isDisabled: props.disabled
|
|
11728
11853
|
})
|
|
11729
11854
|
});
|
|
@@ -11784,6 +11909,7 @@ StoreSelectField.defaultProps = {
|
|
|
11784
11909
|
mappedValueField: 'id'
|
|
11785
11910
|
};
|
|
11786
11911
|
|
|
11912
|
+
var _templateObject;
|
|
11787
11913
|
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; }
|
|
11788
11914
|
function _objectSpread$b(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context5 = ownKeys$b(Object(t), !0)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context6 = ownKeys$b(Object(t))).call(_context6, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
11789
11915
|
function _callSuper$1(_this, derived, args) {
|
|
@@ -11868,10 +11994,7 @@ const VALIDATOR_INTEGER = {
|
|
|
11868
11994
|
}
|
|
11869
11995
|
}
|
|
11870
11996
|
});
|
|
11871
|
-
commonTags.oneLineTrim`
|
|
11872
|
-
\`validatedInput\` is no longer supported.
|
|
11873
|
-
Please use \`formik\` instead.
|
|
11874
|
-
`;
|
|
11997
|
+
commonTags.oneLineTrim(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n `validatedInput` is no longer supported.\n Please use `formik` instead.\n"], ["\n \\`validatedInput\\` is no longer supported.\n Please use \\`formik\\` instead.\n"])));
|
|
11875
11998
|
const ToolTipWrapperComponent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
11876
11999
|
let children = _ref.children;
|
|
11877
12000
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
@@ -11904,74 +12027,74 @@ function validatedInput(InnerComponent, validators) {
|
|
|
11904
12027
|
_initialValidState[v.name] = true;
|
|
11905
12028
|
});
|
|
11906
12029
|
let ValidatedInput = /*#__PURE__*/function (_PureComponent) {
|
|
11907
|
-
_inherits(ValidatedInput, _PureComponent);
|
|
11908
12030
|
function ValidatedInput() {
|
|
11909
|
-
var
|
|
12031
|
+
var _this2;
|
|
11910
12032
|
_classCallCheck(this, ValidatedInput);
|
|
11911
12033
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
11912
12034
|
args[_key] = arguments[_key];
|
|
11913
12035
|
}
|
|
11914
|
-
|
|
11915
|
-
|
|
12036
|
+
_this2 = _callSuper$1(this, ValidatedInput, [...args]);
|
|
12037
|
+
_this2.state = {
|
|
11916
12038
|
validStatus: _initialValidState
|
|
11917
12039
|
};
|
|
11918
|
-
|
|
11919
|
-
if (!fastEquals.deepEqual(
|
|
11920
|
-
|
|
12040
|
+
_this2.conditionalSetValidStatus = nextValidStatus => {
|
|
12041
|
+
if (!fastEquals.deepEqual(_this2.state.validStatus, nextValidStatus)) {
|
|
12042
|
+
_this2.setState({
|
|
11921
12043
|
validStatus: nextValidStatus
|
|
11922
12044
|
});
|
|
11923
12045
|
}
|
|
11924
12046
|
};
|
|
11925
|
-
|
|
12047
|
+
_this2.handleChange = function (event) {
|
|
11926
12048
|
let _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
11927
12049
|
_ref4$triggerUpdate = _ref4.triggerUpdate,
|
|
11928
12050
|
triggerUpdate = _ref4$triggerUpdate === void 0 ? true : _ref4$triggerUpdate;
|
|
11929
12051
|
let value = '';
|
|
11930
12052
|
const nextValidStatus = {};
|
|
11931
|
-
const onChange = changeHandler &&
|
|
12053
|
+
const onChange = changeHandler && _this2.props[changeHandler] || _this2.props.onChange;
|
|
11932
12054
|
|
|
11933
12055
|
// If the actual event is passed, validate the value
|
|
11934
12056
|
if (getIsEvent(event)) value = event.target.value;else value = event;
|
|
11935
12057
|
_forEachInstanceProperty__default["default"](_validators).call(_validators, v => {
|
|
11936
|
-
if (v.validators.change) nextValidStatus[v.name] = v.validators.change.call(
|
|
12058
|
+
if (v.validators.change) nextValidStatus[v.name] = v.validators.change.call(_this2, value);else nextValidStatus[v.name] = true;
|
|
11937
12059
|
});
|
|
11938
12060
|
if (onChange && triggerUpdate) onChange(event);
|
|
11939
|
-
|
|
12061
|
+
_this2.conditionalSetValidStatus(nextValidStatus);
|
|
11940
12062
|
};
|
|
11941
12063
|
/**
|
|
11942
12064
|
* Only triggers when there is a value, but its not valid
|
|
11943
12065
|
* so it must be an invalid numeric value
|
|
11944
12066
|
*/
|
|
11945
|
-
|
|
11946
|
-
const nextValidStatus = _objectSpread$b({},
|
|
12067
|
+
_this2.handleInvalid = () => {
|
|
12068
|
+
const nextValidStatus = _objectSpread$b({}, _this2.state.validStatus);
|
|
11947
12069
|
if (has__default["default"](nextValidStatus, 'numeric')) {
|
|
11948
12070
|
nextValidStatus.numeric = false;
|
|
11949
|
-
|
|
12071
|
+
_this2.conditionalSetValidStatus(nextValidStatus);
|
|
11950
12072
|
}
|
|
11951
12073
|
};
|
|
11952
|
-
|
|
12074
|
+
_this2.handleBlur = event => {
|
|
11953
12075
|
let value = '';
|
|
11954
12076
|
const nextValidStatus = {};
|
|
11955
|
-
const onBlur = blurHandler &&
|
|
12077
|
+
const onBlur = blurHandler && _this2.props[blurHandler] || _this2.props.onBlurValue;
|
|
11956
12078
|
|
|
11957
12079
|
// If the actual event is passed, validate the value
|
|
11958
12080
|
if (getIsEvent(event)) value = event.target.value;else value = event;
|
|
11959
12081
|
_forEachInstanceProperty__default["default"](_validators).call(_validators, v => {
|
|
11960
|
-
if (v.validators.blur) nextValidStatus[v.name] = v.validators.blur.call(
|
|
12082
|
+
if (v.validators.blur) nextValidStatus[v.name] = v.validators.blur.call(_this2, value);else nextValidStatus[v.name] = true;
|
|
11961
12083
|
});
|
|
11962
12084
|
if (onBlur) onBlur(event);
|
|
11963
|
-
|
|
12085
|
+
_this2.conditionalSetValidStatus(nextValidStatus);
|
|
11964
12086
|
};
|
|
11965
|
-
|
|
12087
|
+
_this2.resetValidity = () => {
|
|
11966
12088
|
const nextValidStatus = {};
|
|
11967
12089
|
_forEachInstanceProperty__default["default"](_validators).call(_validators, v => {
|
|
11968
12090
|
nextValidStatus[v.name] = true;
|
|
11969
12091
|
});
|
|
11970
|
-
|
|
12092
|
+
_this2.conditionalSetValidStatus(nextValidStatus);
|
|
11971
12093
|
};
|
|
11972
|
-
return
|
|
12094
|
+
return _this2;
|
|
11973
12095
|
}
|
|
11974
|
-
|
|
12096
|
+
_inherits(ValidatedInput, _PureComponent);
|
|
12097
|
+
return _createClass(ValidatedInput, [{
|
|
11975
12098
|
key: "componentDidMount",
|
|
11976
12099
|
value: function componentDidMount() {
|
|
11977
12100
|
}
|
|
@@ -12015,9 +12138,8 @@ function validatedInput(InnerComponent, validators) {
|
|
|
12015
12138
|
});
|
|
12016
12139
|
}
|
|
12017
12140
|
}]);
|
|
12018
|
-
return ValidatedInput;
|
|
12019
12141
|
}(React.PureComponent);
|
|
12020
|
-
ValidatedInput.displayName =
|
|
12142
|
+
ValidatedInput.displayName = "ValidatedInput(".concat(_InnerComponent.displayName, ")");
|
|
12021
12143
|
ValidatedInput.defaultProps = {
|
|
12022
12144
|
isValid: true,
|
|
12023
12145
|
getInputRef: () => {}
|
|
@@ -12025,22 +12147,22 @@ function validatedInput(InnerComponent, validators) {
|
|
|
12025
12147
|
return reactIntl.injectIntl(ValidatedInput);
|
|
12026
12148
|
}
|
|
12027
12149
|
function simpleInput(type) {
|
|
12028
|
-
var
|
|
12029
|
-
return
|
|
12030
|
-
|
|
12031
|
-
|
|
12032
|
-
|
|
12033
|
-
_classCallCheck(this, _class2);
|
|
12150
|
+
var _Class;
|
|
12151
|
+
return _Class = /*#__PURE__*/function (_PureComponent2) {
|
|
12152
|
+
function _Class() {
|
|
12153
|
+
var _this3;
|
|
12154
|
+
_classCallCheck(this, _Class);
|
|
12034
12155
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
12035
12156
|
args[_key2] = arguments[_key2];
|
|
12036
12157
|
}
|
|
12037
|
-
|
|
12038
|
-
|
|
12039
|
-
if (
|
|
12158
|
+
_this3 = _callSuper$1(this, _Class, [...args]);
|
|
12159
|
+
_this3.handleBlur = event => {
|
|
12160
|
+
if (_this3.props.onBlurValue) _this3.props.onBlurValue(event.target.value);
|
|
12040
12161
|
};
|
|
12041
|
-
return
|
|
12162
|
+
return _this3;
|
|
12042
12163
|
}
|
|
12043
|
-
|
|
12164
|
+
_inherits(_Class, _PureComponent2);
|
|
12165
|
+
return _createClass(_Class, [{
|
|
12044
12166
|
key: "render",
|
|
12045
12167
|
value: function render() {
|
|
12046
12168
|
return jsxRuntime.jsx("input", {
|
|
@@ -12057,11 +12179,10 @@ function simpleInput(type) {
|
|
|
12057
12179
|
});
|
|
12058
12180
|
}
|
|
12059
12181
|
}]);
|
|
12060
|
-
|
|
12061
|
-
}(React.PureComponent), _class2.displayName = 'SimpleInput', _class2.defaultProps = {
|
|
12182
|
+
}(React.PureComponent), _Class.displayName = 'SimpleInput', _Class.defaultProps = {
|
|
12062
12183
|
getInputRef: () => {},
|
|
12063
12184
|
name: 'simple-validated-input'
|
|
12064
|
-
},
|
|
12185
|
+
}, _Class;
|
|
12065
12186
|
}
|
|
12066
12187
|
|
|
12067
12188
|
var messages$4 = reactIntl.defineMessages({
|
|
@@ -12158,7 +12279,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
12158
12279
|
truncate: true,
|
|
12159
12280
|
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$2.filterWholeInput), {}, {
|
|
12160
12281
|
values: {
|
|
12161
|
-
values:
|
|
12282
|
+
values: "\"".concat(props.value, "\"")
|
|
12162
12283
|
}
|
|
12163
12284
|
})
|
|
12164
12285
|
})
|
|
@@ -12171,7 +12292,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
12171
12292
|
truncate: true,
|
|
12172
12293
|
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$2.filterSeparateValues), {}, {
|
|
12173
12294
|
values: {
|
|
12174
|
-
values:
|
|
12295
|
+
values: "\"".concat(props.multiValue.join('", "'), "\"") || props.value
|
|
12175
12296
|
}
|
|
12176
12297
|
})
|
|
12177
12298
|
})
|
|
@@ -12306,46 +12427,46 @@ Cleave__default["default"].displayName = 'Cleave';
|
|
|
12306
12427
|
// use isFinite to exclude Infitinty, -Inifinity and NaN
|
|
12307
12428
|
const isValidValue = value => isFinite__default["default"](value) || isNil__default["default"](value);
|
|
12308
12429
|
let NumericFormatInput = /*#__PURE__*/function (_PureComponent) {
|
|
12309
|
-
_inherits(NumericFormatInput, _PureComponent);
|
|
12310
12430
|
function NumericFormatInput() {
|
|
12311
|
-
var
|
|
12431
|
+
var _this2;
|
|
12312
12432
|
_classCallCheck(this, NumericFormatInput);
|
|
12313
12433
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
12314
12434
|
args[_key] = arguments[_key];
|
|
12315
12435
|
}
|
|
12316
|
-
|
|
12317
|
-
|
|
12318
|
-
parsedValue:
|
|
12436
|
+
_this2 = _callSuper(this, NumericFormatInput, [...args]);
|
|
12437
|
+
_this2.state = {
|
|
12438
|
+
parsedValue: _this2.props.value
|
|
12319
12439
|
};
|
|
12320
|
-
|
|
12440
|
+
_this2.setValue = value => {
|
|
12321
12441
|
if (!isValidValue(value)) return;
|
|
12322
|
-
const newValue = !isUndefined__default["default"](value) ?
|
|
12323
|
-
|
|
12442
|
+
const newValue = !isUndefined__default["default"](value) ? _this2.props.formatNumber(value) : undefined;
|
|
12443
|
+
_this2.owner.setRawValue(newValue);
|
|
12324
12444
|
};
|
|
12325
|
-
|
|
12326
|
-
|
|
12327
|
-
|
|
12445
|
+
_this2.handleInit = owner => {
|
|
12446
|
+
_this2.owner = owner;
|
|
12447
|
+
_this2.setValue(_this2.props.value);
|
|
12328
12448
|
};
|
|
12329
|
-
|
|
12449
|
+
_this2.handleChange = event => {
|
|
12330
12450
|
const value = event.target.rawValue;
|
|
12331
|
-
const parsedNumber =
|
|
12332
|
-
if (
|
|
12333
|
-
|
|
12451
|
+
const parsedNumber = _this2.props.parseNumber(value);
|
|
12452
|
+
if (_this2.state.parsedValue === parsedNumber) return;
|
|
12453
|
+
_this2.setState({
|
|
12334
12454
|
parsedValue: parsedNumber
|
|
12335
12455
|
});
|
|
12336
|
-
|
|
12337
|
-
if (!isNumberish(value) &&
|
|
12456
|
+
_this2.props.onChangeValue(parsedNumber);
|
|
12457
|
+
if (!isNumberish(value) && _this2.props.onInvalidValue) _this2.props.onInvalidValue(value);
|
|
12338
12458
|
};
|
|
12339
|
-
|
|
12340
|
-
|
|
12341
|
-
if (
|
|
12459
|
+
_this2.handleBlur = () => {
|
|
12460
|
+
_this2.setValue(_this2.props.value);
|
|
12461
|
+
if (_this2.props.onBlurValue) _this2.props.onBlurValue(_this2.props.value);
|
|
12342
12462
|
};
|
|
12343
|
-
|
|
12344
|
-
|
|
12463
|
+
_this2.registerInputRef = ref => {
|
|
12464
|
+
_this2.textInput = ref;
|
|
12345
12465
|
};
|
|
12346
|
-
return
|
|
12466
|
+
return _this2;
|
|
12347
12467
|
}
|
|
12348
|
-
|
|
12468
|
+
_inherits(NumericFormatInput, _PureComponent);
|
|
12469
|
+
return _createClass(NumericFormatInput, [{
|
|
12349
12470
|
key: "componentDidUpdate",
|
|
12350
12471
|
value: function componentDidUpdate(prevProps) {
|
|
12351
12472
|
if (this.props.value !== prevProps.value && this.props.value !== this.state.parsedValue) {
|
|
@@ -12386,7 +12507,6 @@ let NumericFormatInput = /*#__PURE__*/function (_PureComponent) {
|
|
|
12386
12507
|
}, dataAttributes));
|
|
12387
12508
|
}
|
|
12388
12509
|
}]);
|
|
12389
|
-
return NumericFormatInput;
|
|
12390
12510
|
}(React.PureComponent);
|
|
12391
12511
|
NumericFormatInput.displayName = 'NumericFormatInput';
|
|
12392
12512
|
NumericFormatInput.defaultProps = {
|
|
@@ -12474,16 +12594,17 @@ function isEmpty(value) {
|
|
|
12474
12594
|
}
|
|
12475
12595
|
|
|
12476
12596
|
const buildSearchQuery = (searchQuery, searchMode, fragments) => {
|
|
12597
|
+
var _fragments$searchMode;
|
|
12477
12598
|
if (!searchQuery) return '';
|
|
12478
12599
|
const buildAllFieldsQueryString = query => {
|
|
12479
12600
|
const fragmentsArray = _Object$values__default["default"](fragments);
|
|
12480
|
-
return
|
|
12601
|
+
return "( ".concat(_mapInstanceProperty__default["default"](fragmentsArray).call(fragmentsArray, fragment => fragment.getQuery(query)).join(' or '), " )");
|
|
12481
12602
|
};
|
|
12482
12603
|
const trimmedSearchQuery = oneLine__default["default"](searchQuery);
|
|
12483
12604
|
if (searchMode === 'allFields') {
|
|
12484
12605
|
return buildAllFieldsQueryString(trimmedSearchQuery);
|
|
12485
12606
|
}
|
|
12486
|
-
if (!fragments[searchMode] || typeof fragments[searchMode]
|
|
12607
|
+
if (!fragments[searchMode] || typeof ((_fragments$searchMode = fragments[searchMode]) === null || _fragments$searchMode === void 0 ? void 0 : _fragments$searchMode.getQuery) !== 'function') {
|
|
12487
12608
|
return '';
|
|
12488
12609
|
}
|
|
12489
12610
|
return fragments[searchMode].getQuery(trimmedSearchQuery);
|
|
@@ -12714,11 +12835,11 @@ function createResourceReducer(options) {
|
|
|
12714
12835
|
|
|
12715
12836
|
// TODO: validate constant keys
|
|
12716
12837
|
const actionsMap = {
|
|
12717
|
-
[
|
|
12838
|
+
["".concat(plural, "_FETCHED")]: (_, action) => ({
|
|
12718
12839
|
currentQueryResult: action.payload
|
|
12719
12840
|
}),
|
|
12720
|
-
[
|
|
12721
|
-
[
|
|
12841
|
+
["".concat(single, "_UPDATED_IN_LIST")]: updateStatusInList(mergeData),
|
|
12842
|
+
["".concat(single, "_DELETED_IN_LIST")]: (state, _ref) => {
|
|
12722
12843
|
let payload = _ref.payload;
|
|
12723
12844
|
const results = state.currentQueryResult.results;
|
|
12724
12845
|
return {
|
|
@@ -12730,27 +12851,27 @@ function createResourceReducer(options) {
|
|
|
12730
12851
|
})
|
|
12731
12852
|
};
|
|
12732
12853
|
},
|
|
12733
|
-
[
|
|
12854
|
+
["".concat(single, "_FETCHED")]: (_, _ref3) => {
|
|
12734
12855
|
let payload = _ref3.payload;
|
|
12735
12856
|
return {
|
|
12736
12857
|
currentVisible: payload
|
|
12737
12858
|
};
|
|
12738
12859
|
},
|
|
12739
|
-
[
|
|
12860
|
+
["".concat(single, "_CREATED")]: (_ref4, _ref5) => {
|
|
12740
12861
|
let currentVisible = _ref4.currentVisible;
|
|
12741
12862
|
let payload = _ref5.payload;
|
|
12742
12863
|
return {
|
|
12743
12864
|
currentVisible: mergeData(payload, currentVisible)
|
|
12744
12865
|
};
|
|
12745
12866
|
},
|
|
12746
|
-
[
|
|
12867
|
+
["".concat(single, "_UPDATED")]: (_ref6, _ref7) => {
|
|
12747
12868
|
let currentVisible = _ref6.currentVisible;
|
|
12748
12869
|
let payload = _ref7.payload;
|
|
12749
12870
|
return {
|
|
12750
12871
|
currentVisible: mergeData(payload, currentVisible)
|
|
12751
12872
|
};
|
|
12752
12873
|
},
|
|
12753
|
-
[
|
|
12874
|
+
["".concat(single, "_DELETED")]: () => ({
|
|
12754
12875
|
currentVisible: null
|
|
12755
12876
|
})
|
|
12756
12877
|
};
|
|
@@ -12767,11 +12888,12 @@ function formatCustomerAddress(_ref) {
|
|
|
12767
12888
|
}
|
|
12768
12889
|
|
|
12769
12890
|
function formatCustomerName(_ref) {
|
|
12891
|
+
var _context;
|
|
12770
12892
|
let firstName = _ref.firstName,
|
|
12771
12893
|
lastName = _ref.lastName;
|
|
12772
12894
|
if (firstName && !lastName) return _trimInstanceProperty__default["default"](firstName).call(firstName);
|
|
12773
12895
|
if (!firstName && lastName) return _trimInstanceProperty__default["default"](lastName).call(lastName);
|
|
12774
|
-
if (firstName && lastName) return
|
|
12896
|
+
if (firstName && lastName) return _concatInstanceProperty__default["default"](_context = "".concat(_trimInstanceProperty__default["default"](firstName).call(firstName), " ")).call(_context, _trimInstanceProperty__default["default"](lastName).call(lastName));
|
|
12775
12897
|
return constants.NO_VALUE_FALLBACK;
|
|
12776
12898
|
}
|
|
12777
12899
|
|
|
@@ -12823,7 +12945,10 @@ const validateText = function (text, intl) {
|
|
|
12823
12945
|
* @returns {boolean}
|
|
12824
12946
|
*/
|
|
12825
12947
|
const hasErrorCode = (unmappedApiErrors, errorCode) => {
|
|
12826
|
-
return _Array$isArray__default["default"](unmappedApiErrors) && _someInstanceProperty__default["default"](unmappedApiErrors).call(unmappedApiErrors, error =>
|
|
12948
|
+
return _Array$isArray__default["default"](unmappedApiErrors) && _someInstanceProperty__default["default"](unmappedApiErrors).call(unmappedApiErrors, error => {
|
|
12949
|
+
var _error$extensions;
|
|
12950
|
+
return ((_error$extensions = error.extensions) === null || _error$extensions === void 0 ? void 0 : _error$extensions.code) === errorCode;
|
|
12951
|
+
});
|
|
12827
12952
|
};
|
|
12828
12953
|
|
|
12829
12954
|
const hasInvalidInputError = errors => hasErrorCode(errors, ERROR_CODES.invalidInput);
|
|
@@ -12835,7 +12960,7 @@ function minusify(value) {
|
|
|
12835
12960
|
return minus.concat(value);
|
|
12836
12961
|
}
|
|
12837
12962
|
|
|
12838
|
-
const flattenOperator = (operator, clauses) => compact__default["default"](_reduceInstanceProperty__default["default"](clauses).call(clauses, (result, clause) => _concatInstanceProperty__default["default"](result).call(result, clause
|
|
12963
|
+
const flattenOperator = (operator, clauses) => compact__default["default"](_reduceInstanceProperty__default["default"](clauses).call(clauses, (result, clause) => _concatInstanceProperty__default["default"](result).call(result, (clause === null || clause === void 0 ? void 0 : clause[operator]) || clause), []));
|
|
12839
12964
|
const argsToArray = args => _reduceInstanceProperty__default["default"](args).call(args, (result, item) => _concatInstanceProperty__default["default"](result).call(result, item), []);
|
|
12840
12965
|
const exists = (field, attributeType) => ({
|
|
12841
12966
|
exists: {
|
|
@@ -12892,7 +13017,7 @@ const not = function () {
|
|
|
12892
13017
|
|
|
12893
13018
|
const safelyAddFallback = function (string) {
|
|
12894
13019
|
let fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : constants.NO_VALUE_FALLBACK;
|
|
12895
|
-
return string === '' ? fallback : string
|
|
13020
|
+
return string === '' ? fallback : string !== null && string !== void 0 ? string : fallback;
|
|
12896
13021
|
};
|
|
12897
13022
|
|
|
12898
13023
|
var messages$1 = reactIntl.defineMessages({
|
|
@@ -13027,19 +13152,19 @@ const computedProperties = {
|
|
|
13027
13152
|
// has been deleted. See MC-1925 for further information.
|
|
13028
13153
|
const filteredCategories = _filterInstanceProperty__default["default"](_context6 = product.categories).call(_context6, category => category.obj !== undefined);
|
|
13029
13154
|
return _mapInstanceProperty__default["default"](filteredCategories).call(filteredCategories, category => {
|
|
13155
|
+
var _context7;
|
|
13030
13156
|
const categoryPath = getPathName(category, language, languages);
|
|
13031
13157
|
const ancestors = getAncestors(category, language);
|
|
13032
|
-
const externalIdValue = category.obj.externalId ?
|
|
13033
|
-
// hardcoding "ext. ID" since this is not part of a message to be
|
|
13158
|
+
const externalIdValue = category.obj.externalId ? // hardcoding "ext. ID" since this is not part of a message to be
|
|
13034
13159
|
// translated. This has been communicated with Jenn
|
|
13035
|
-
|
|
13160
|
+
"| ext. ID: ".concat(category.obj.externalId) : '';
|
|
13036
13161
|
return {
|
|
13037
13162
|
id: category.id,
|
|
13038
|
-
name:
|
|
13163
|
+
name: _concatInstanceProperty__default["default"](_context7 = "".concat(l10n.formatLocalizedString(category.obj, {
|
|
13039
13164
|
key: 'name',
|
|
13040
13165
|
locale: language,
|
|
13041
13166
|
fallbackOrder: languages
|
|
13042
|
-
})
|
|
13167
|
+
}), " ")).call(_context7, externalIdValue),
|
|
13043
13168
|
path: categoryPath,
|
|
13044
13169
|
level: ancestors.length
|
|
13045
13170
|
};
|
|
@@ -13076,13 +13201,13 @@ const getAttributeValueByType = _ref12 => {
|
|
|
13076
13201
|
value: value
|
|
13077
13202
|
});
|
|
13078
13203
|
case 'enum':
|
|
13079
|
-
return safelyAddFallback(value.label,
|
|
13204
|
+
return safelyAddFallback(value.label, "".concat(value.key, " (key)"));
|
|
13080
13205
|
case 'lenum':
|
|
13081
13206
|
return safelyAddFallback(l10n.formatLocalizedString(value, {
|
|
13082
13207
|
key: 'label',
|
|
13083
13208
|
locale: projectDataLocale,
|
|
13084
13209
|
fallbackOrder: projectLanguages
|
|
13085
|
-
}),
|
|
13210
|
+
}), "".concat(value.key, " (key)"));
|
|
13086
13211
|
case 'number':
|
|
13087
13212
|
return safelyAddFallback(value);
|
|
13088
13213
|
case 'boolean':
|
|
@@ -13105,7 +13230,7 @@ let RequestCache = /*#__PURE__*/function () {
|
|
|
13105
13230
|
this.result = null;
|
|
13106
13231
|
this.expiryDurationInSeconds = 5 * 60;
|
|
13107
13232
|
}
|
|
13108
|
-
_createClass(RequestCache, [{
|
|
13233
|
+
return _createClass(RequestCache, [{
|
|
13109
13234
|
key: "get",
|
|
13110
13235
|
value: function get(key) {
|
|
13111
13236
|
if (this.isValid(key)) {
|
|
@@ -13144,7 +13269,6 @@ let RequestCache = /*#__PURE__*/function () {
|
|
|
13144
13269
|
this.result = null;
|
|
13145
13270
|
}
|
|
13146
13271
|
}]);
|
|
13147
|
-
return RequestCache;
|
|
13148
13272
|
}();
|
|
13149
13273
|
|
|
13150
13274
|
// copied from
|
|
@@ -13205,6 +13329,7 @@ const reorderArrayItems = (array, from, to) => {
|
|
|
13205
13329
|
const mapTimeZonesToOptions = memoize__default["default"](timeZones => {
|
|
13206
13330
|
var _context;
|
|
13207
13331
|
return _mapInstanceProperty__default["default"](_context = _Object$entries__default["default"](timeZones)).call(_context, _ref => {
|
|
13332
|
+
var _context2;
|
|
13208
13333
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
13209
13334
|
code = _ref2[0],
|
|
13210
13335
|
value = _ref2[1];
|
|
@@ -13213,7 +13338,7 @@ const mapTimeZonesToOptions = memoize__default["default"](timeZones => {
|
|
|
13213
13338
|
//E.g. `(GMT +02:00) Central European Time - Berlin`
|
|
13214
13339
|
// unicode clock hex code: \u25F7
|
|
13215
13340
|
//
|
|
13216
|
-
label:
|
|
13341
|
+
label: _concatInstanceProperty__default["default"](_context2 = "(GMT ".concat(value.offset, ") ")).call(_context2, value.name)
|
|
13217
13342
|
};
|
|
13218
13343
|
});
|
|
13219
13344
|
});
|
|
@@ -13221,9 +13346,12 @@ const getTimeZoneId = memoize__default["default"]((selectedTimeZone, timeZones)
|
|
|
13221
13346
|
if (timeZones[selectedTimeZone]) {
|
|
13222
13347
|
return selectedTimeZone;
|
|
13223
13348
|
} else {
|
|
13224
|
-
var
|
|
13225
|
-
const fallbackTimeZoneId = _findInstanceProperty__default["default"](
|
|
13226
|
-
|
|
13349
|
+
var _context3;
|
|
13350
|
+
const fallbackTimeZoneId = _findInstanceProperty__default["default"](_context3 = _Object$keys__default["default"](timeZones)).call(_context3, timeZoneId => {
|
|
13351
|
+
var _timeZones$timeZoneId;
|
|
13352
|
+
return (_timeZones$timeZoneId = timeZones[timeZoneId]) === null || _timeZones$timeZoneId === void 0 || (_timeZones$timeZoneId = _timeZones$timeZoneId.translationFor) === null || _timeZones$timeZoneId === void 0 ? void 0 : _someInstanceProperty__default["default"](_timeZones$timeZoneId).call(_timeZones$timeZoneId, fallbackTimeZone => fallbackTimeZone === selectedTimeZone);
|
|
13353
|
+
});
|
|
13354
|
+
if (fallbackTimeZoneId !== null && fallbackTimeZoneId !== void 0 && fallbackTimeZoneId.length) {
|
|
13227
13355
|
return fallbackTimeZoneId.toString();
|
|
13228
13356
|
} else {
|
|
13229
13357
|
return 'UTC';
|
|
@@ -13231,9 +13359,10 @@ const getTimeZoneId = memoize__default["default"]((selectedTimeZone, timeZones)
|
|
|
13231
13359
|
}
|
|
13232
13360
|
});
|
|
13233
13361
|
const getTimeZoneLabel = memoize__default["default"]((selectedTimeZone, timeZones) => {
|
|
13362
|
+
var _context4;
|
|
13234
13363
|
const timeZoneId = getTimeZoneId(selectedTimeZone, timeZones);
|
|
13235
13364
|
const timeZoneData = timeZones[timeZoneId];
|
|
13236
|
-
return
|
|
13365
|
+
return _concatInstanceProperty__default["default"](_context4 = "(GMT ".concat(timeZoneData.offset, ") ")).call(_context4, timeZoneData.name);
|
|
13237
13366
|
});
|
|
13238
13367
|
|
|
13239
13368
|
function ownKeys$3(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; }
|
|
@@ -13289,20 +13418,114 @@ var messages = reactIntl.defineMessages({
|
|
|
13289
13418
|
const FIELD_NAME = 'custom';
|
|
13290
13419
|
|
|
13291
13420
|
function ownKeys$2(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; }
|
|
13292
|
-
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
13421
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context7 = ownKeys$2(Object(t), !0)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context8 = ownKeys$2(Object(t))).call(_context8, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
13422
|
+
const transformFieldType = fieldDefinition => {
|
|
13423
|
+
var _fieldDefinition$type, _fieldDefinition$type2;
|
|
13424
|
+
if (((_fieldDefinition$type = fieldDefinition.type) === null || _fieldDefinition$type === void 0 || (_fieldDefinition$type = _fieldDefinition$type.elementType) === null || _fieldDefinition$type === void 0 ? void 0 : _fieldDefinition$type.name) === 'LocalizedEnum') {
|
|
13425
|
+
var _context;
|
|
13426
|
+
return _objectSpread$2(_objectSpread$2({}, fieldDefinition.type), {}, {
|
|
13427
|
+
elementType: _objectSpread$2(_objectSpread$2({}, fieldDefinition.type.elementType), {}, {
|
|
13428
|
+
values: _mapInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](fieldDefinition.type.elementType)).call(_context, value => ({
|
|
13429
|
+
key: value.key,
|
|
13430
|
+
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
13431
|
+
}))
|
|
13432
|
+
})
|
|
13433
|
+
});
|
|
13434
|
+
} else if (((_fieldDefinition$type2 = fieldDefinition.type) === null || _fieldDefinition$type2 === void 0 ? void 0 : _fieldDefinition$type2.name) === 'LocalizedEnum') {
|
|
13435
|
+
var _context2;
|
|
13436
|
+
return _objectSpread$2(_objectSpread$2({}, fieldDefinition.type), {}, {
|
|
13437
|
+
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context2, value => ({
|
|
13438
|
+
key: value.key,
|
|
13439
|
+
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
13440
|
+
}))
|
|
13441
|
+
});
|
|
13442
|
+
} else {
|
|
13443
|
+
return fieldDefinition.type;
|
|
13444
|
+
}
|
|
13445
|
+
};
|
|
13446
|
+
const convertCustomField = resource => {
|
|
13447
|
+
var _context3, _context4;
|
|
13448
|
+
return {
|
|
13449
|
+
type: {
|
|
13450
|
+
typeId: 'type',
|
|
13451
|
+
id: resource.custom.type.id,
|
|
13452
|
+
obj: {
|
|
13453
|
+
key: resource.custom.type.key,
|
|
13454
|
+
name: l10n.transformLocalizedFieldToLocalizedString(resource.custom.type.nameAllLocales),
|
|
13455
|
+
fieldDefinitions: _mapInstanceProperty__default["default"](_context3 = resource.custom.type.fieldDefinitions).call(_context3, fieldDefinition => ({
|
|
13456
|
+
name: fieldDefinition.name,
|
|
13457
|
+
required: fieldDefinition.required,
|
|
13458
|
+
inputHint: fieldDefinition.inputHint,
|
|
13459
|
+
type: transformFieldType(fieldDefinition),
|
|
13460
|
+
label: l10n.transformLocalizedFieldToLocalizedString(fieldDefinition.labelAllLocales)
|
|
13461
|
+
}))
|
|
13462
|
+
}
|
|
13463
|
+
},
|
|
13464
|
+
fields: _reduceInstanceProperty__default["default"](_context4 = resource.custom.customFieldsRaw).call(_context4, (fields, customField) => _objectSpread$2(_objectSpread$2({}, fields), {}, {
|
|
13465
|
+
[customField.name]: customField.value
|
|
13466
|
+
}), {})
|
|
13467
|
+
};
|
|
13468
|
+
};
|
|
13469
|
+
const createFormStateFromResource = resource => {
|
|
13470
|
+
// If there are no custom fields on the resource, don't create a form state
|
|
13471
|
+
if (!resource[FIELD_NAME]) {
|
|
13472
|
+
return {
|
|
13473
|
+
[FIELD_NAME]: undefined
|
|
13474
|
+
};
|
|
13475
|
+
}
|
|
13476
|
+
return {
|
|
13477
|
+
[FIELD_NAME]: convertCustomField(resource)
|
|
13478
|
+
};
|
|
13479
|
+
};
|
|
13480
|
+
const createGraphQlDocFromFormState = formState => {
|
|
13481
|
+
var _formState$FIELD_NAME, _context5;
|
|
13482
|
+
// Unset the custom type if it's not in the form state
|
|
13483
|
+
if (!((_formState$FIELD_NAME = formState[FIELD_NAME]) !== null && _formState$FIELD_NAME !== void 0 && (_formState$FIELD_NAME = _formState$FIELD_NAME.type) !== null && _formState$FIELD_NAME !== void 0 && _formState$FIELD_NAME.id)) {
|
|
13484
|
+
return {
|
|
13485
|
+
[FIELD_NAME]: {}
|
|
13486
|
+
};
|
|
13487
|
+
}
|
|
13488
|
+
return {
|
|
13489
|
+
[FIELD_NAME]: {
|
|
13490
|
+
type: {
|
|
13491
|
+
id: formState[FIELD_NAME].type.id,
|
|
13492
|
+
typeId: 'type'
|
|
13493
|
+
},
|
|
13494
|
+
fields: _mapInstanceProperty__default["default"](_context5 = _Object$entries__default["default"](formState[FIELD_NAME].fields)).call(_context5, _ref => {
|
|
13495
|
+
let _ref2 = _slicedToArray(_ref, 2),
|
|
13496
|
+
name = _ref2[0],
|
|
13497
|
+
value = _ref2[1];
|
|
13498
|
+
return {
|
|
13499
|
+
name,
|
|
13500
|
+
value: _JSON$stringify__default["default"](value)
|
|
13501
|
+
};
|
|
13502
|
+
})
|
|
13503
|
+
}
|
|
13504
|
+
};
|
|
13505
|
+
};
|
|
13506
|
+
|
|
13507
|
+
// Creates a root field name accessor for `custom` form state
|
|
13508
|
+
const createRootFieldName = rootFieldName => {
|
|
13509
|
+
var _context6;
|
|
13510
|
+
return rootFieldName ? _concatInstanceProperty__default["default"](_context6 = "".concat(rootFieldName, ".")).call(_context6, FIELD_NAME) : FIELD_NAME;
|
|
13511
|
+
};
|
|
13512
|
+
|
|
13513
|
+
function ownKeys$1(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; }
|
|
13514
|
+
function _objectSpread$1(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$1(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$1(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
13293
13515
|
const typeDefinitionsExist = typeDefinitions => {
|
|
13294
13516
|
return typeDefinitions.length > 0;
|
|
13295
13517
|
};
|
|
13296
|
-
const typeDefinitionSelected = formValues => {
|
|
13297
|
-
|
|
13518
|
+
const typeDefinitionSelected = (formValues, rootFieldName) => {
|
|
13519
|
+
var _getIn, _getIn2;
|
|
13520
|
+
return ((_getIn = formik.getIn(formValues, rootFieldName)) === null || _getIn === void 0 ? void 0 : _getIn.type) && ((_getIn2 = formik.getIn(formValues, rootFieldName)) === null || _getIn2 === void 0 || (_getIn2 = _getIn2.type) === null || _getIn2 === void 0 ? void 0 : _getIn2.obj);
|
|
13298
13521
|
};
|
|
13299
|
-
const typeDefinitionContainsFieldDefinitions = formValues => {
|
|
13300
|
-
return formValues
|
|
13522
|
+
const typeDefinitionContainsFieldDefinitions = (formValues, rootFieldName) => {
|
|
13523
|
+
return formik.getIn(formValues, rootFieldName).type.obj.key && formik.getIn(formValues, rootFieldName).type.obj.fieldDefinitions.length > 0;
|
|
13301
13524
|
};
|
|
13302
|
-
const fieldDefinitionsWithValues = formValues => {
|
|
13525
|
+
const fieldDefinitionsWithValues = (formValues, rootFieldName) => {
|
|
13303
13526
|
var _context;
|
|
13304
|
-
const fieldValues = formValues
|
|
13305
|
-
return _filterInstanceProperty__default["default"](_context = formValues
|
|
13527
|
+
const fieldValues = formik.getIn(formValues, rootFieldName).fields;
|
|
13528
|
+
return _filterInstanceProperty__default["default"](_context = formik.getIn(formValues, rootFieldName).type.obj.fieldDefinitions).call(_context, _ref => {
|
|
13306
13529
|
let name = _ref.name;
|
|
13307
13530
|
return fieldValues[name] !== undefined;
|
|
13308
13531
|
});
|
|
@@ -13310,34 +13533,36 @@ const fieldDefinitionsWithValues = formValues => {
|
|
|
13310
13533
|
const CustomFieldsInputWrapper = _ref2 => {
|
|
13311
13534
|
let typeDefinitions = _ref2.typeDefinitions,
|
|
13312
13535
|
isReadOnly = _ref2.isReadOnly,
|
|
13313
|
-
hideEmptyFields = _ref2.hideEmptyFields
|
|
13536
|
+
hideEmptyFields = _ref2.hideEmptyFields,
|
|
13537
|
+
rootFormStateFieldName = _ref2.rootFormStateFieldName;
|
|
13314
13538
|
const _useFormikContext = formik.useFormikContext(),
|
|
13315
13539
|
formValues = _valuesInstanceProperty__default["default"](_useFormikContext);
|
|
13540
|
+
const rootFieldName = createRootFieldName(rootFormStateFieldName);
|
|
13316
13541
|
if (!typeDefinitionsExist(typeDefinitions)) {
|
|
13317
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
13542
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$1({}, messages.noTypes));
|
|
13318
13543
|
}
|
|
13319
|
-
if (!typeDefinitionSelected(formValues)) {
|
|
13320
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
13544
|
+
if (!typeDefinitionSelected(formValues, rootFieldName)) {
|
|
13545
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$1({}, messages.noCustomType));
|
|
13321
13546
|
}
|
|
13322
|
-
if (!typeDefinitionContainsFieldDefinitions(formValues)) {
|
|
13323
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
13547
|
+
if (!typeDefinitionContainsFieldDefinitions(formValues, rootFieldName)) {
|
|
13548
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$1({}, messages.noCustomFields));
|
|
13324
13549
|
}
|
|
13325
|
-
if (fieldDefinitionsWithValues(formValues).length === 0 && isReadOnly && hideEmptyFields) {
|
|
13326
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
13550
|
+
if (fieldDefinitionsWithValues(formValues, rootFieldName).length === 0 && isReadOnly && hideEmptyFields) {
|
|
13551
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$1({}, messages.noInputValues));
|
|
13327
13552
|
}
|
|
13328
13553
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
13329
13554
|
max: "scale",
|
|
13330
13555
|
children: jsxRuntime.jsx(CustomFields, {
|
|
13331
13556
|
isReadOnly: isReadOnly,
|
|
13332
|
-
name:
|
|
13333
|
-
fieldDefinitions: isReadOnly && hideEmptyFields ? fieldDefinitionsWithValues(formValues) : formValues
|
|
13557
|
+
name: "".concat(rootFieldName, ".fields"),
|
|
13558
|
+
fieldDefinitions: isReadOnly && hideEmptyFields ? fieldDefinitionsWithValues(formValues, rootFieldName) : formik.getIn(formValues, rootFieldName).type.obj.fieldDefinitions
|
|
13334
13559
|
})
|
|
13335
13560
|
});
|
|
13336
13561
|
};
|
|
13337
13562
|
CustomFieldsInputWrapper.displayName = 'CustomFieldsInputWrapper';
|
|
13338
13563
|
|
|
13339
|
-
function ownKeys
|
|
13340
|
-
function _objectSpread
|
|
13564
|
+
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; }
|
|
13565
|
+
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; }
|
|
13341
13566
|
const mapTypeDefinitionsToOptions = (typeDefinitions, language, languages, selectedTypeDefinitionId) => {
|
|
13342
13567
|
return _mapInstanceProperty__default["default"](typeDefinitions).call(typeDefinitions, typeDefinition => ({
|
|
13343
13568
|
isDisabled: selectedTypeDefinitionId && selectedTypeDefinitionId === typeDefinition.type.id,
|
|
@@ -13364,10 +13589,13 @@ const createFormStateFromTypeDefinition = selectedTypeDefinition => {
|
|
|
13364
13589
|
};
|
|
13365
13590
|
};
|
|
13366
13591
|
const CustomTypeSubform = _ref => {
|
|
13592
|
+
var _getIn3, _getIn4;
|
|
13367
13593
|
let typeDefinitions = _ref.typeDefinitions,
|
|
13368
13594
|
isReadOnly = _ref.isReadOnly,
|
|
13369
13595
|
isCondensed = _ref.isCondensed,
|
|
13370
|
-
hideEmptyFields = _ref.hideEmptyFields
|
|
13596
|
+
hideEmptyFields = _ref.hideEmptyFields,
|
|
13597
|
+
rootFormStateFieldName = _ref.rootFormStateFieldName,
|
|
13598
|
+
panelTitle = _ref.panelTitle;
|
|
13371
13599
|
const _useFormikContext = formik.useFormikContext(),
|
|
13372
13600
|
formValues = _valuesInstanceProperty__default["default"](_useFormikContext),
|
|
13373
13601
|
setFieldValue = _useFormikContext.setFieldValue,
|
|
@@ -13380,22 +13608,24 @@ const CustomTypeSubform = _ref => {
|
|
|
13380
13608
|
})),
|
|
13381
13609
|
language = _useApplicationContex.language,
|
|
13382
13610
|
languages = _useApplicationContex.languages;
|
|
13611
|
+
const rootFieldName = createRootFieldName(rootFormStateFieldName);
|
|
13383
13612
|
const handleTypeDefinitionSelect = React.useCallback(event => {
|
|
13384
13613
|
const selectedTypeDefinition = _findInstanceProperty__default["default"](typeDefinitions).call(typeDefinitions, typeDefinition => typeDefinition.type.key === event.target.value);
|
|
13385
13614
|
if (selectedTypeDefinition) {
|
|
13386
13615
|
const nextCustom = createFormStateFromTypeDefinition(selectedTypeDefinition);
|
|
13387
|
-
setFieldValue(
|
|
13616
|
+
setFieldValue(rootFieldName, nextCustom).then(() => {
|
|
13388
13617
|
validateForm();
|
|
13389
13618
|
});
|
|
13390
13619
|
} else {
|
|
13391
13620
|
// if the dropdown selector is cleared, remove the `custom` field from the form state entirely
|
|
13392
|
-
setFieldValue(
|
|
13621
|
+
setFieldValue(rootFieldName, undefined).then(() => {
|
|
13393
13622
|
validateForm();
|
|
13394
13623
|
});
|
|
13395
13624
|
}
|
|
13396
|
-
}, [typeDefinitions, setFieldValue, validateForm]);
|
|
13625
|
+
}, [typeDefinitions, setFieldValue, validateForm, rootFieldName]);
|
|
13397
13626
|
const typeDefinitionSelected = formValues => {
|
|
13398
|
-
|
|
13627
|
+
var _getIn, _getIn2;
|
|
13628
|
+
return ((_getIn = formik.getIn(formValues, rootFieldName)) === null || _getIn === void 0 ? void 0 : _getIn.type) && ((_getIn2 = formik.getIn(formValues, rootFieldName)) === null || _getIn2 === void 0 || (_getIn2 = _getIn2.type) === null || _getIn2 === void 0 ? void 0 : _getIn2.obj);
|
|
13399
13629
|
};
|
|
13400
13630
|
|
|
13401
13631
|
// if the user has read-only permissions, empty fields are hidden, and no type definition is selected, hide the component
|
|
@@ -13403,16 +13633,16 @@ const CustomTypeSubform = _ref => {
|
|
|
13403
13633
|
return jsxRuntime.jsx(uiKit.CollapsiblePanel, {
|
|
13404
13634
|
header: jsxRuntime.jsx(uiKit.CollapsiblePanel.Header, {
|
|
13405
13635
|
isCondensed: isCondensed,
|
|
13406
|
-
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread
|
|
13636
|
+
children: panelTitle || jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread({}, messages.title))
|
|
13407
13637
|
}),
|
|
13408
13638
|
headerControls: typeDefinitions.length > 0 && jsxRuntime.jsx("div", {
|
|
13409
13639
|
css: /*#__PURE__*/react$1.css("min-width:", uiKit.designTokens.constraint11, ";" + ("" ), "" ),
|
|
13410
13640
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
13411
13641
|
isClearable: true,
|
|
13412
13642
|
"data-testid": "custom-type-select",
|
|
13413
|
-
name:
|
|
13414
|
-
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages, formValues
|
|
13415
|
-
value: formValues
|
|
13643
|
+
name: "".concat(rootFieldName, ".type.obj.key"),
|
|
13644
|
+
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages, (_getIn3 = formik.getIn(formValues, rootFieldName)) === null || _getIn3 === void 0 || (_getIn3 = _getIn3.type) === null || _getIn3 === void 0 ? void 0 : _getIn3.id),
|
|
13645
|
+
value: (_getIn4 = formik.getIn(formValues, rootFieldName)) === null || _getIn4 === void 0 || (_getIn4 = _getIn4.type) === null || _getIn4 === void 0 || (_getIn4 = _getIn4.obj) === null || _getIn4 === void 0 ? void 0 : _getIn4.key,
|
|
13416
13646
|
onChange: handleTypeDefinitionSelect,
|
|
13417
13647
|
placeholder: formatMessage(messages.typesPlaceholder),
|
|
13418
13648
|
isReadOnly: isReadOnly
|
|
@@ -13422,103 +13652,20 @@ const CustomTypeSubform = _ref => {
|
|
|
13422
13652
|
children: jsxRuntime.jsx(CustomFieldsInputWrapper, {
|
|
13423
13653
|
typeDefinitions: typeDefinitions,
|
|
13424
13654
|
isReadOnly: isReadOnly,
|
|
13425
|
-
hideEmptyFields: hideEmptyFields
|
|
13655
|
+
hideEmptyFields: hideEmptyFields,
|
|
13656
|
+
rootFormStateFieldName: rootFormStateFieldName
|
|
13426
13657
|
})
|
|
13427
13658
|
});
|
|
13428
13659
|
};
|
|
13429
13660
|
CustomTypeSubform.displayName = 'CustomTypeSubform';
|
|
13430
13661
|
|
|
13431
|
-
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; }
|
|
13432
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context6 = ownKeys(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context7 = ownKeys(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
13433
|
-
const transformFieldType = fieldDefinition => {
|
|
13434
|
-
if (fieldDefinition.type?.elementType?.name === 'LocalizedEnum') {
|
|
13435
|
-
var _context;
|
|
13436
|
-
return _objectSpread(_objectSpread({}, fieldDefinition.type), {}, {
|
|
13437
|
-
elementType: _objectSpread(_objectSpread({}, fieldDefinition.type.elementType), {}, {
|
|
13438
|
-
values: _mapInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](fieldDefinition.type.elementType)).call(_context, value => ({
|
|
13439
|
-
key: value.key,
|
|
13440
|
-
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
13441
|
-
}))
|
|
13442
|
-
})
|
|
13443
|
-
});
|
|
13444
|
-
} else if (fieldDefinition.type?.name === 'LocalizedEnum') {
|
|
13445
|
-
var _context2;
|
|
13446
|
-
return _objectSpread(_objectSpread({}, fieldDefinition.type), {}, {
|
|
13447
|
-
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context2, value => ({
|
|
13448
|
-
key: value.key,
|
|
13449
|
-
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
13450
|
-
}))
|
|
13451
|
-
});
|
|
13452
|
-
} else {
|
|
13453
|
-
return fieldDefinition.type;
|
|
13454
|
-
}
|
|
13455
|
-
};
|
|
13456
|
-
const convertCustomField = resource => {
|
|
13457
|
-
var _context3, _context4;
|
|
13458
|
-
return {
|
|
13459
|
-
type: {
|
|
13460
|
-
typeId: 'type',
|
|
13461
|
-
id: resource.custom.type.id,
|
|
13462
|
-
obj: {
|
|
13463
|
-
key: resource.custom.type.key,
|
|
13464
|
-
name: l10n.transformLocalizedFieldToLocalizedString(resource.custom.type.nameAllLocales),
|
|
13465
|
-
fieldDefinitions: _mapInstanceProperty__default["default"](_context3 = resource.custom.type.fieldDefinitions).call(_context3, fieldDefinition => ({
|
|
13466
|
-
name: fieldDefinition.name,
|
|
13467
|
-
required: fieldDefinition.required,
|
|
13468
|
-
inputHint: fieldDefinition.inputHint,
|
|
13469
|
-
type: transformFieldType(fieldDefinition),
|
|
13470
|
-
label: l10n.transformLocalizedFieldToLocalizedString(fieldDefinition.labelAllLocales)
|
|
13471
|
-
}))
|
|
13472
|
-
}
|
|
13473
|
-
},
|
|
13474
|
-
fields: _reduceInstanceProperty__default["default"](_context4 = resource.custom.customFieldsRaw).call(_context4, (fields, customField) => _objectSpread(_objectSpread({}, fields), {}, {
|
|
13475
|
-
[customField.name]: customField.value
|
|
13476
|
-
}), {})
|
|
13477
|
-
};
|
|
13478
|
-
};
|
|
13479
|
-
const createFormStateFromResource = resource => {
|
|
13480
|
-
// If there are no custom fields on the resource, don't create a form state
|
|
13481
|
-
if (!resource[FIELD_NAME]) {
|
|
13482
|
-
return {
|
|
13483
|
-
[FIELD_NAME]: undefined
|
|
13484
|
-
};
|
|
13485
|
-
}
|
|
13486
|
-
return {
|
|
13487
|
-
[FIELD_NAME]: convertCustomField(resource)
|
|
13488
|
-
};
|
|
13489
|
-
};
|
|
13490
|
-
const createGraphQlDocFromFormState = formState => {
|
|
13491
|
-
var _context5;
|
|
13492
|
-
// Unset the custom type if it's not in the form state
|
|
13493
|
-
if (!formState[FIELD_NAME]) {
|
|
13494
|
-
return {
|
|
13495
|
-
[FIELD_NAME]: {}
|
|
13496
|
-
};
|
|
13497
|
-
}
|
|
13498
|
-
return {
|
|
13499
|
-
[FIELD_NAME]: {
|
|
13500
|
-
type: {
|
|
13501
|
-
id: formState[FIELD_NAME].type.id,
|
|
13502
|
-
typeId: 'type'
|
|
13503
|
-
},
|
|
13504
|
-
fields: _mapInstanceProperty__default["default"](_context5 = _Object$entries__default["default"](formState[FIELD_NAME].fields)).call(_context5, _ref => {
|
|
13505
|
-
let _ref2 = _slicedToArray(_ref, 2),
|
|
13506
|
-
name = _ref2[0],
|
|
13507
|
-
value = _ref2[1];
|
|
13508
|
-
return {
|
|
13509
|
-
name,
|
|
13510
|
-
value: _JSON$stringify__default["default"](value)
|
|
13511
|
-
};
|
|
13512
|
-
})
|
|
13513
|
-
}
|
|
13514
|
-
};
|
|
13515
|
-
};
|
|
13516
|
-
|
|
13517
13662
|
const CustomFieldsFormField = _ref => {
|
|
13518
13663
|
let resources = _ref.resources,
|
|
13519
13664
|
isReadOnly = _ref.isReadOnly,
|
|
13520
13665
|
isCondensed = _ref.isCondensed,
|
|
13521
|
-
hideEmptyFields = _ref.hideEmptyFields
|
|
13666
|
+
hideEmptyFields = _ref.hideEmptyFields,
|
|
13667
|
+
rootFormStateFieldName = _ref.rootFormStateFieldName,
|
|
13668
|
+
panelTitle = _ref.panelTitle;
|
|
13522
13669
|
const projectKey = applicationShellConnectors.useApplicationContext(applicationContext => applicationContext.project.key);
|
|
13523
13670
|
return jsxRuntime.jsx(CustomFieldTypeDefinitionsConnector$1, {
|
|
13524
13671
|
resources: resources,
|
|
@@ -13536,7 +13683,9 @@ const CustomFieldsFormField = _ref => {
|
|
|
13536
13683
|
typeDefinitions: typeDefinitions,
|
|
13537
13684
|
isReadOnly: isReadOnly,
|
|
13538
13685
|
isCondensed: isCondensed,
|
|
13539
|
-
hideEmptyFields: hideEmptyFields
|
|
13686
|
+
hideEmptyFields: hideEmptyFields,
|
|
13687
|
+
rootFormStateFieldName: rootFormStateFieldName,
|
|
13688
|
+
panelTitle: panelTitle
|
|
13540
13689
|
});
|
|
13541
13690
|
}
|
|
13542
13691
|
});
|
|
@@ -13555,6 +13704,7 @@ exports.CenteredLoadingSpinner = CenteredLoadingSpinner;
|
|
|
13555
13704
|
exports.ChannelPickerInput = ChannelPickerInput;
|
|
13556
13705
|
exports.CountriesPicker = CountriesPicker;
|
|
13557
13706
|
exports.CustomFieldDefinitionsConnector = customFieldDefinitionsConnector;
|
|
13707
|
+
exports.CustomFieldTooltip = CustomFieldTooltip;
|
|
13558
13708
|
exports.CustomFieldTypeDefinitionsConnector = CustomFieldTypeDefinitionsConnector$1;
|
|
13559
13709
|
exports.CustomFields = CustomFields;
|
|
13560
13710
|
exports.CustomFieldsErrorTextNotification = CustomFieldsErrorTextNotification;
|
|
@@ -13569,6 +13719,7 @@ exports.LabelRange = LabelRange;
|
|
|
13569
13719
|
exports.MissingValueField = MissingValueField;
|
|
13570
13720
|
exports.MultiValueSearchInput = MultiValueSearchInput;
|
|
13571
13721
|
exports.NumericFormatInput = numericFormatInput;
|
|
13722
|
+
exports.Option = Option$2;
|
|
13572
13723
|
exports.PRECISION_TYPES = PRECISION_TYPES;
|
|
13573
13724
|
exports.PimIndexerProvider = pimIndexerProvider;
|
|
13574
13725
|
exports.ProductAttributeInput = ProductAttributeInput;
|
|
@@ -13631,6 +13782,7 @@ exports.formatProductAttribute = formatAttribute;
|
|
|
13631
13782
|
exports.getAncestors = getAncestors;
|
|
13632
13783
|
exports.getAttributeValueByType = getAttributeValueByType;
|
|
13633
13784
|
exports.getAttributeValueType = getAttributeValueType;
|
|
13785
|
+
exports.getBottomOption = getBottomOption;
|
|
13634
13786
|
exports.getBulkNotification = getBulkNotification;
|
|
13635
13787
|
exports.getCategoryLevel = getCategoryLevel;
|
|
13636
13788
|
exports.getCountsFromBulkSummary = getCountsFromBulkSummary;
|
|
@@ -13715,11 +13867,13 @@ exports.truncate = truncate;
|
|
|
13715
13867
|
exports.unique = unique;
|
|
13716
13868
|
exports.uniqueObjects = uniqueObjects;
|
|
13717
13869
|
exports.useCachedCategoryOptions = useCachedCategoryOptions;
|
|
13870
|
+
exports.useCurrentOption = useCurrentOption;
|
|
13718
13871
|
exports.useCustomFieldsDnDContext = useDnDContext;
|
|
13719
13872
|
exports.useCustomerGroupsPlatformLimits = useCustomerGroupsPlatformLimits;
|
|
13720
13873
|
exports.useCustomersPlatformLimits = useCustomersPlatformLimits;
|
|
13721
13874
|
exports.useDebouncedPromiseCallback = useDebouncedPromiseCallback;
|
|
13722
13875
|
exports.useFormatLocalizedFieldToString = useFormatLocalizedFieldToString;
|
|
13876
|
+
exports.useLoadOptions = useLoadOptions;
|
|
13723
13877
|
exports.useLocalizedKeyFallback = useLocalizedKeyFallback;
|
|
13724
13878
|
exports.usePendingRequests = usePendingRequests;
|
|
13725
13879
|
exports.usePersistedTableConfiguration = usePersistedTableConfiguration;
|