@commercetools-frontend/experimental-components 5.4.3 → 5.4.5
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 +483 -614
- package/dist/commercetools-frontend-experimental-components.cjs.prod.js +481 -612
- package/dist/commercetools-frontend-experimental-components.esm.js +481 -612
- package/dist/styles.css +179 -170
- package/package.json +12 -12
|
@@ -30,14 +30,12 @@ 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');
|
|
34
33
|
var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
|
|
35
34
|
var _sortInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/sort');
|
|
36
35
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
37
36
|
var fastEquals = require('fast-equals');
|
|
38
37
|
var reactIntl = require('react-intl');
|
|
39
38
|
var omitEmpty = require('omit-empty-es');
|
|
40
|
-
var _taggedTemplateLiteral = require('@babel/runtime-corejs3/helpers/taggedTemplateLiteral');
|
|
41
39
|
var oneLine = require('common-tags/lib/oneLine');
|
|
42
40
|
var moment = require('moment-timezone');
|
|
43
41
|
var isNil$1 = require('lodash/isNil');
|
|
@@ -72,15 +70,14 @@ var has = require('lodash/has');
|
|
|
72
70
|
var _toArray = require('@babel/runtime-corejs3/helpers/toArray');
|
|
73
71
|
var _reverseInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reverse');
|
|
74
72
|
var sdk = require('@commercetools-frontend/sdk');
|
|
75
|
-
var client = require('@apollo/client');
|
|
76
73
|
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
74
|
+
var client = require('@apollo/client');
|
|
77
75
|
var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
78
76
|
var _parseFloat = require('@babel/runtime-corejs3/core-js-stable/parse-float');
|
|
79
77
|
var omit = require('lodash/omit');
|
|
80
78
|
var isEmpty$3 = require('lodash/isEmpty');
|
|
81
79
|
var _Object$freeze = require('@babel/runtime-corejs3/core-js-stable/object/freeze');
|
|
82
80
|
var originalOmitDeep = require('omit-deep');
|
|
83
|
-
var _findIndexInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find-index');
|
|
84
81
|
var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
|
|
85
82
|
var _parseInt = require('@babel/runtime-corejs3/core-js-stable/parse-int');
|
|
86
83
|
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
@@ -108,12 +105,14 @@ var flatMap = require('lodash/flatMap');
|
|
|
108
105
|
var reactRedux = require('react-redux');
|
|
109
106
|
var commonTags = require('common-tags');
|
|
110
107
|
var warning = require('tiny-warning');
|
|
108
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
111
109
|
var _Math$trunc = require('@babel/runtime-corejs3/core-js-stable/math/trunc');
|
|
112
110
|
var _Number$isNaN = require('@babel/runtime-corejs3/core-js-stable/number/is-nan');
|
|
113
111
|
var isUndefined = require('lodash/isUndefined');
|
|
114
112
|
var isFinite = require('lodash/isFinite');
|
|
115
113
|
var Cleave = require('cleave.js/react');
|
|
116
114
|
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');
|
|
117
116
|
var compact = require('lodash/compact');
|
|
118
117
|
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
119
118
|
require('@babel/runtime-corejs3/helpers/get');
|
|
@@ -140,7 +139,6 @@ var uniqBy__default = /*#__PURE__*/_interopDefault(uniqBy);
|
|
|
140
139
|
var invariant__default = /*#__PURE__*/_interopDefault(invariant);
|
|
141
140
|
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
142
141
|
var camelCase__default = /*#__PURE__*/_interopDefault(camelCase);
|
|
143
|
-
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
144
142
|
var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
|
|
145
143
|
var _sortInstanceProperty__default = /*#__PURE__*/_interopDefault(_sortInstanceProperty);
|
|
146
144
|
var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
|
|
@@ -169,7 +167,6 @@ var omit__default = /*#__PURE__*/_interopDefault(omit);
|
|
|
169
167
|
var isEmpty__default = /*#__PURE__*/_interopDefault(isEmpty$3);
|
|
170
168
|
var _Object$freeze__default = /*#__PURE__*/_interopDefault(_Object$freeze);
|
|
171
169
|
var originalOmitDeep__default = /*#__PURE__*/_interopDefault(originalOmitDeep);
|
|
172
|
-
var _findIndexInstanceProperty__default = /*#__PURE__*/_interopDefault(_findIndexInstanceProperty);
|
|
173
170
|
var _Object$values__default = /*#__PURE__*/_interopDefault(_Object$values);
|
|
174
171
|
var _parseInt__default = /*#__PURE__*/_interopDefault(_parseInt);
|
|
175
172
|
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
@@ -188,12 +185,14 @@ var set__default = /*#__PURE__*/_interopDefault(set);
|
|
|
188
185
|
var memoize__default = /*#__PURE__*/_interopDefault(memoize);
|
|
189
186
|
var flatMap__default = /*#__PURE__*/_interopDefault(flatMap);
|
|
190
187
|
var warning__default = /*#__PURE__*/_interopDefault(warning);
|
|
188
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
191
189
|
var _Math$trunc__default = /*#__PURE__*/_interopDefault(_Math$trunc);
|
|
192
190
|
var _Number$isNaN__default = /*#__PURE__*/_interopDefault(_Number$isNaN);
|
|
193
191
|
var isUndefined__default = /*#__PURE__*/_interopDefault(isUndefined);
|
|
194
192
|
var isFinite__default = /*#__PURE__*/_interopDefault(isFinite);
|
|
195
193
|
var Cleave__default = /*#__PURE__*/_interopDefault(Cleave);
|
|
196
194
|
var _Object$assign__default = /*#__PURE__*/_interopDefault(_Object$assign);
|
|
195
|
+
var _findIndexInstanceProperty__default = /*#__PURE__*/_interopDefault(_findIndexInstanceProperty);
|
|
197
196
|
var compact__default = /*#__PURE__*/_interopDefault(compact);
|
|
198
197
|
var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
199
198
|
var _spliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_spliceInstanceProperty);
|
|
@@ -291,7 +290,7 @@ function filterDataAttributes(obj) {
|
|
|
291
290
|
* duplicated in original values
|
|
292
291
|
*/
|
|
293
292
|
function unique(values, properties) {
|
|
294
|
-
var
|
|
293
|
+
var _context;
|
|
295
294
|
let ignoredValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['', null, undefined];
|
|
296
295
|
const duplicateValues = [];
|
|
297
296
|
let realValues;
|
|
@@ -300,20 +299,19 @@ function unique(values, properties) {
|
|
|
300
299
|
realValues = _filterInstanceProperty__default["default"](values).call(values, value => !_includesInstanceProperty__default["default"](ignoredValues).call(ignoredValues, value));
|
|
301
300
|
if (!realValues.length) return [];
|
|
302
301
|
if (properties) realValues = _mapInstanceProperty__default["default"](realValues).call(realValues, value => _reduceInstanceProperty__default["default"](properties).call(properties, (prev, curr) => {
|
|
303
|
-
var _context;
|
|
304
302
|
const currentValue = value[curr] || '';
|
|
305
|
-
return
|
|
303
|
+
return `${prev}:${currentValue}`;
|
|
306
304
|
}, ''));else realValues = _sliceInstanceProperty__default["default"](values).call(values, 0);
|
|
307
305
|
|
|
308
306
|
// TODO: checking for dupes like this is slow, find a better way
|
|
309
|
-
_reduceInstanceProperty__default["default"](
|
|
307
|
+
_reduceInstanceProperty__default["default"](_context = _sortInstanceProperty__default["default"](realValues).call(realValues)).call(_context, (prev, curr) => {
|
|
310
308
|
if (curr === null) return curr;
|
|
311
309
|
if (curr !== '' && prev === curr && _indexOfInstanceProperty__default["default"](duplicateValues).call(duplicateValues, curr) === -1) duplicateValues.push(curr);
|
|
312
310
|
return curr;
|
|
313
311
|
});
|
|
314
312
|
if (properties) return _mapInstanceProperty__default["default"](duplicateValues).call(duplicateValues, value => {
|
|
315
|
-
var
|
|
316
|
-
const parts = _sliceInstanceProperty__default["default"](
|
|
313
|
+
var _context2;
|
|
314
|
+
const parts = _sliceInstanceProperty__default["default"](_context2 = value.split(':')).call(_context2, 1);
|
|
317
315
|
return _reduceInstanceProperty__default["default"](properties).call(properties, (prev, curr, index) => {
|
|
318
316
|
// eslint-disable-next-line no-param-reassign
|
|
319
317
|
prev[curr] = parts[index];
|
|
@@ -332,14 +330,14 @@ function unique(values, properties) {
|
|
|
332
330
|
* @return Array<Object> returns an array of objects with all duplicated values
|
|
333
331
|
*/
|
|
334
332
|
function uniqueObjects(items) {
|
|
335
|
-
var
|
|
333
|
+
var _context3;
|
|
336
334
|
const emptyValues = [undefined, null, ''];
|
|
337
|
-
const itemsWorkingSet = items && items.length ? _filterInstanceProperty__default["default"](
|
|
335
|
+
const itemsWorkingSet = items && items.length ? _filterInstanceProperty__default["default"](_context3 = _sliceInstanceProperty__default["default"](items).call(items)).call(_context3, x => !_includesInstanceProperty__default["default"](emptyValues).call(emptyValues, x)) : [];
|
|
338
336
|
const duplicateValues = _reduceInstanceProperty__default["default"](itemsWorkingSet).call(itemsWorkingSet, (acc, item, index) => {
|
|
339
|
-
var
|
|
337
|
+
var _context4;
|
|
340
338
|
if (item === null) return acc;
|
|
341
|
-
const isDuplicate = _reduceInstanceProperty__default["default"](
|
|
342
|
-
).call(
|
|
339
|
+
const isDuplicate = _reduceInstanceProperty__default["default"](_context4 = _sliceInstanceProperty__default["default"](itemsWorkingSet).call(itemsWorkingSet, index + 1) // get sub-array after this index
|
|
340
|
+
).call(_context4, (duplicateAcc, comparisonItem, comparisonIndex) => {
|
|
343
341
|
if (comparisonItem === null) return duplicateAcc;
|
|
344
342
|
|
|
345
343
|
// check if its a dupe
|
|
@@ -430,16 +428,18 @@ function getIndexesOfInvalidValues(values) {
|
|
|
430
428
|
|
|
431
429
|
const withoutEmptyErrorsByField = errorsByField => omitEmpty__default["default"](errorsByField);
|
|
432
430
|
|
|
433
|
-
var _templateObject$4;
|
|
434
431
|
function formatDateRangeValue(value, type) {
|
|
435
432
|
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
436
433
|
locale: 'en',
|
|
437
434
|
timeZone: moment__default["default"].tz.guess()
|
|
438
435
|
};
|
|
439
436
|
if (value.from === value.to) return formatDateTime$1(type, value.from, options);
|
|
440
|
-
if (value.from && value.to) return oneLine__default["default"]
|
|
441
|
-
|
|
442
|
-
|
|
437
|
+
if (value.from && value.to) return oneLine__default["default"]`
|
|
438
|
+
${formatDateTime$1(type, value.from, options)} -
|
|
439
|
+
${formatDateTime$1(type, value.to, options)}
|
|
440
|
+
`;
|
|
441
|
+
if (value.from) return `from ${formatDateTime$1(type, value.from, options)}`;
|
|
442
|
+
if (value.to) return `to ${formatDateTime$1(type, value.to, options)}`;
|
|
443
443
|
return '';
|
|
444
444
|
}
|
|
445
445
|
function formatDateTime$1(type, value) {
|
|
@@ -1675,13 +1675,13 @@ const getData = (code, field) => {
|
|
|
1675
1675
|
const getFractionDigit = code => getData(code, 'fractionDigit');
|
|
1676
1676
|
|
|
1677
1677
|
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; }
|
|
1678
|
-
function _objectSpread$1p(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
1678
|
+
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; }
|
|
1679
1679
|
function formatMoneyRangeValue(value, intl) {
|
|
1680
|
-
var _context;
|
|
1681
1680
|
if (value.from === value.to) return formatMoneyValue(value.from, value.currency, intl);
|
|
1682
|
-
if (value.from && value.to) return
|
|
1683
|
-
|
|
1684
|
-
if (value.
|
|
1681
|
+
if (value.from && value.to) return `${formatMoneyValue(value.from, value.currency, intl)} -
|
|
1682
|
+
${formatMoneyValue(value.to, value.currency, intl)}`;
|
|
1683
|
+
if (value.from) return `from ${formatMoneyValue(value.from, value.currency, intl)}`;
|
|
1684
|
+
if (value.to) return `to ${formatMoneyValue(value.to, value.currency, intl)}`;
|
|
1685
1685
|
return '';
|
|
1686
1686
|
}
|
|
1687
1687
|
function formatMoneyValue(amount, currency, intl) {
|
|
@@ -1701,8 +1701,7 @@ function getFractionedAmount(moneyValue) {
|
|
|
1701
1701
|
return amount / 10 ** fractionDigits;
|
|
1702
1702
|
}
|
|
1703
1703
|
function formatMoney$2(moneyValue, intl, options) {
|
|
1704
|
-
|
|
1705
|
-
return intl.formatNumber((_moneyValue$fractione = moneyValue.fractionedAmount) !== null && _moneyValue$fractione !== void 0 ? _moneyValue$fractione : getFractionedAmount(moneyValue), _objectSpread$1p({
|
|
1704
|
+
return intl.formatNumber(moneyValue.fractionedAmount ?? getFractionedAmount(moneyValue), _objectSpread$1p({
|
|
1706
1705
|
style: 'currency',
|
|
1707
1706
|
currency: moneyValue.currencyCode,
|
|
1708
1707
|
minimumFractionDigits: moneyValue.fractionDigits
|
|
@@ -1723,13 +1722,11 @@ var messages$J = reactIntl.defineMessages({
|
|
|
1723
1722
|
});
|
|
1724
1723
|
|
|
1725
1724
|
const formatEnum = _ref => {
|
|
1726
|
-
var _context;
|
|
1727
1725
|
let value = _ref.value,
|
|
1728
1726
|
fallbackValue = _ref.fallbackValue;
|
|
1729
|
-
return value.label ||
|
|
1727
|
+
return value.label || `${fallbackValue} (${value.key})`;
|
|
1730
1728
|
};
|
|
1731
1729
|
const formatLenum = _ref2 => {
|
|
1732
|
-
var _context2;
|
|
1733
1730
|
let value = _ref2.value,
|
|
1734
1731
|
language = _ref2.language,
|
|
1735
1732
|
languages = _ref2.languages,
|
|
@@ -1737,7 +1734,7 @@ const formatLenum = _ref2 => {
|
|
|
1737
1734
|
return l10n.formatLocalizedString(value, {
|
|
1738
1735
|
key: 'label',
|
|
1739
1736
|
locale: language,
|
|
1740
|
-
fallback:
|
|
1737
|
+
fallback: `${fallbackValue} (${value.key})`,
|
|
1741
1738
|
fallbackOrder: languages
|
|
1742
1739
|
});
|
|
1743
1740
|
};
|
|
@@ -1773,7 +1770,6 @@ const formatDate = _ref6 => {
|
|
|
1773
1770
|
});
|
|
1774
1771
|
};
|
|
1775
1772
|
const formatDateTime = _ref7 => {
|
|
1776
|
-
var _context3;
|
|
1777
1773
|
let value = _ref7.value,
|
|
1778
1774
|
userTimeZone = _ref7.userTimeZone,
|
|
1779
1775
|
intl = _ref7.intl;
|
|
@@ -1789,7 +1785,7 @@ const formatDateTime = _ref7 => {
|
|
|
1789
1785
|
// defaults to utc if timeZone is not provided
|
|
1790
1786
|
timeZone: userTimeZone || 'utc'
|
|
1791
1787
|
});
|
|
1792
|
-
return
|
|
1788
|
+
return `${date} (${time})`;
|
|
1793
1789
|
};
|
|
1794
1790
|
const formatBoolean = _ref8 => {
|
|
1795
1791
|
let value = _ref8.value,
|
|
@@ -1812,7 +1808,7 @@ const formatUnknown = _ref10 => {
|
|
|
1812
1808
|
fallbackValue = _ref10.fallbackValue;
|
|
1813
1809
|
// NOTE This is reporting within the render function, which is supposed to
|
|
1814
1810
|
// be pure. This is quite bad as this is a side-effect in the render fn.
|
|
1815
|
-
sentry.reportErrorToSentry(new Error(
|
|
1811
|
+
sentry.reportErrorToSentry(new Error(`Unhandled custom attribute type '${type.name}' for value`), {
|
|
1816
1812
|
extra: {
|
|
1817
1813
|
value
|
|
1818
1814
|
}
|
|
@@ -1885,10 +1881,9 @@ const attributeTypeNames = {
|
|
|
1885
1881
|
Number: 'number'
|
|
1886
1882
|
};
|
|
1887
1883
|
const convertToAttributeType = customFieldType => {
|
|
1888
|
-
var _customFieldType$elem;
|
|
1889
1884
|
if (isNil__default["default"](customFieldType)) return customFieldType;
|
|
1890
1885
|
const attributeTypeName = attributeTypeNames[customFieldType.name];
|
|
1891
|
-
const elementTypeName = attributeTypeNames[
|
|
1886
|
+
const elementTypeName = attributeTypeNames[customFieldType.elementType?.name];
|
|
1892
1887
|
return {
|
|
1893
1888
|
name: attributeTypeName,
|
|
1894
1889
|
elementType: {
|
|
@@ -1951,25 +1946,21 @@ const setDisplayName = nextDisplayName => Component => {
|
|
|
1951
1946
|
return Component;
|
|
1952
1947
|
};
|
|
1953
1948
|
|
|
1954
|
-
const wrapDisplayName = (BaseComponent, hocName) => {
|
|
1955
|
-
var _context;
|
|
1956
|
-
return _concatInstanceProperty__default["default"](_context = "".concat(hocName, "(")).call(_context, getDisplayName(BaseComponent), ")");
|
|
1957
|
-
};
|
|
1949
|
+
const wrapDisplayName = (BaseComponent, hocName) => `${hocName}(${getDisplayName(BaseComponent)})`;
|
|
1958
1950
|
|
|
1959
1951
|
function ownKeys$1o(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; }
|
|
1960
1952
|
function _objectSpread$1o(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$1o(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$1o(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1961
1953
|
const injectDataTablePaginationState = initialValues => Component => {
|
|
1962
1954
|
const WithDataTablePaginationState = props => {
|
|
1963
|
-
var _initialValues$tableS, _initialValues$tableS2;
|
|
1964
1955
|
const _usePaginationState = uiKit.usePaginationState({
|
|
1965
|
-
page: initialValues
|
|
1966
|
-
perPage: initialValues
|
|
1956
|
+
page: initialValues?.page,
|
|
1957
|
+
perPage: initialValues?.perPage
|
|
1967
1958
|
}),
|
|
1968
1959
|
page = _usePaginationState.page,
|
|
1969
1960
|
perPage = _usePaginationState.perPage;
|
|
1970
1961
|
const tableSorting = uiKit.useDataTableSortingState({
|
|
1971
|
-
key: initialValues
|
|
1972
|
-
order: initialValues
|
|
1962
|
+
key: initialValues?.tableSorting?.key,
|
|
1963
|
+
order: initialValues?.tableSorting?.order
|
|
1973
1964
|
});
|
|
1974
1965
|
return jsxRuntime.jsx(Component, _objectSpread$1o(_objectSpread$1o({}, props), {}, {
|
|
1975
1966
|
dataTablePaginationState: {
|
|
@@ -2003,7 +1994,7 @@ const injectNotifications = function () {
|
|
|
2003
1994
|
[propName]: notifications
|
|
2004
1995
|
}));
|
|
2005
1996
|
};
|
|
2006
|
-
WrappedComponent.displayName =
|
|
1997
|
+
WrappedComponent.displayName = `withNotifications(${getDisplayName(Component)}`;
|
|
2007
1998
|
return WrappedComponent;
|
|
2008
1999
|
};
|
|
2009
2000
|
};
|
|
@@ -2112,10 +2103,7 @@ const isNil = value => typeof value === 'undefined' || value === null;
|
|
|
2112
2103
|
const useStorage = (storageKey, initialStorageValue, options) => {
|
|
2113
2104
|
var _context;
|
|
2114
2105
|
const mergedOptions = _objectSpread$1i(_objectSpread$1i({}, defaultOptions$2), options);
|
|
2115
|
-
const userId = applicationShellConnectors.useApplicationContext(context =>
|
|
2116
|
-
var _context$user;
|
|
2117
|
-
return (_context$user = context.user) === null || _context$user === void 0 ? void 0 : _context$user.id;
|
|
2118
|
-
});
|
|
2106
|
+
const userId = applicationShellConnectors.useApplicationContext(context => context.user?.id);
|
|
2119
2107
|
const scopedStorageKey = _filterInstanceProperty__default["default"](_context = [mergedOptions.segregateByUser && userId, storageKey]).call(_context, Boolean).join('/');
|
|
2120
2108
|
const readFromStorage = React.useCallback(() => {
|
|
2121
2109
|
const rawStorageValue = getStorage(mergedOptions.storageType).getItem(scopedStorageKey);
|
|
@@ -2134,9 +2122,8 @@ const useStorage = (storageKey, initialStorageValue, options) => {
|
|
|
2134
2122
|
return parsedStorageValue;
|
|
2135
2123
|
}, [mergedOptions.storageType, scopedStorageKey]);
|
|
2136
2124
|
const initializeStorageValue = () => {
|
|
2137
|
-
var _ref, _readFromStorage;
|
|
2138
2125
|
// default the storage value to the initial provided value when provided
|
|
2139
|
-
return
|
|
2126
|
+
return readFromStorage() ?? initialStorageValue ?? null;
|
|
2140
2127
|
};
|
|
2141
2128
|
const _useState = React.useState(initializeStorageValue),
|
|
2142
2129
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -2235,16 +2222,14 @@ function ownKeys$1g(e, r) { var t = _Object$keys__default["default"](e); if (_Ob
|
|
|
2235
2222
|
function _objectSpread$1g(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$1g(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$1g(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
2236
2223
|
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 } } } };
|
|
2237
2224
|
const filterStoresOutdatedDanglingProductSelections = storesQueryResult => {
|
|
2238
|
-
var _storesQueryResult$re;
|
|
2239
2225
|
if (!storesQueryResult) return null;
|
|
2240
2226
|
return {
|
|
2241
2227
|
total: storesQueryResult.total,
|
|
2242
2228
|
count: storesQueryResult.count,
|
|
2243
2229
|
offset: storesQueryResult.offset,
|
|
2244
|
-
results:
|
|
2245
|
-
var _store$productSelecti;
|
|
2230
|
+
results: storesQueryResult.results?.map(store => {
|
|
2246
2231
|
return _objectSpread$1g(_objectSpread$1g({}, store), {}, {
|
|
2247
|
-
productSelections:
|
|
2232
|
+
productSelections: store.productSelections?.filter(productSelectionRef => Boolean(productSelectionRef.productSelection))
|
|
2248
2233
|
});
|
|
2249
2234
|
})
|
|
2250
2235
|
};
|
|
@@ -2256,7 +2241,7 @@ const createQueryVariables$6 = ownProps => {
|
|
|
2256
2241
|
offset: ownProps.offset,
|
|
2257
2242
|
sort: _sortInstanceProperty__default["default"](ownProps)
|
|
2258
2243
|
}, Boolean(ownProps.stores) && {
|
|
2259
|
-
where:
|
|
2244
|
+
where: `key in (${_mapInstanceProperty__default["default"](_context = ownProps.stores).call(_context, store => `"${store}"`).join(', ')})`
|
|
2260
2245
|
}), {}, {
|
|
2261
2246
|
excludeExtendedStoresList: ownProps.excludeExtendedStoresList,
|
|
2262
2247
|
excludeProductSelections: ownProps.excludeProductSelections
|
|
@@ -2281,10 +2266,7 @@ const useStoresListFetcher = props => {
|
|
|
2281
2266
|
projectKey: props.projectKey
|
|
2282
2267
|
},
|
|
2283
2268
|
fetchPolicy: 'network-only',
|
|
2284
|
-
onError: graphqlErrorResponse =>
|
|
2285
|
-
var _props$onError;
|
|
2286
|
-
return (_props$onError = props.onError) === null || _props$onError === void 0 ? void 0 : _props$onError.call(props, graphqlErrorResponse);
|
|
2287
|
-
}
|
|
2269
|
+
onError: graphqlErrorResponse => props.onError?.(graphqlErrorResponse)
|
|
2288
2270
|
}),
|
|
2289
2271
|
data = _useQuery.data,
|
|
2290
2272
|
refetch = _useQuery.refetch,
|
|
@@ -2292,7 +2274,7 @@ const useStoresListFetcher = props => {
|
|
|
2292
2274
|
return {
|
|
2293
2275
|
isLoading: loading,
|
|
2294
2276
|
refetch,
|
|
2295
|
-
stores: filterStoresOutdatedDanglingProductSelections(data
|
|
2277
|
+
stores: filterStoresOutdatedDanglingProductSelections(data?.stores),
|
|
2296
2278
|
refetchQuery: {
|
|
2297
2279
|
query: FetchStoresQuery,
|
|
2298
2280
|
variables: queryVariables,
|
|
@@ -2356,16 +2338,10 @@ const handlers$5 = {
|
|
|
2356
2338
|
}
|
|
2357
2339
|
};
|
|
2358
2340
|
|
|
2359
|
-
const toPermission = (permission, resourceName) => {
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
}
|
|
2363
|
-
const createComposePath = resourceName => permission => {
|
|
2364
|
-
var _context2;
|
|
2365
|
-
return (// e.g applicationContext.dataFences?.store?.orders?.canViewOrders?.values
|
|
2366
|
-
_concatInstanceProperty__default["default"](_context2 = "dataFences.store.".concat(resourceName, ".")).call(_context2, permission, ".values")
|
|
2367
|
-
);
|
|
2368
|
-
};
|
|
2341
|
+
const toPermission = (permission, resourceName) => camelCase__default["default"](`can ${permission} ${resourceName}`);
|
|
2342
|
+
const createComposePath = resourceName => permission =>
|
|
2343
|
+
// e.g applicationContext.dataFences?.store?.orders?.canViewOrders?.values
|
|
2344
|
+
`dataFences.store.${resourceName}.${permission}.values`;
|
|
2369
2345
|
const useStoreKeysInDataFences = _ref => {
|
|
2370
2346
|
let resourceName = _ref.resourceName,
|
|
2371
2347
|
_ref$permission = _ref.permission,
|
|
@@ -2763,7 +2739,7 @@ const usePersistedTableConfiguration = props => {
|
|
|
2763
2739
|
* Therefore, if it will be missing from the local storage and hence we use the [] as default.
|
|
2764
2740
|
*/
|
|
2765
2741
|
const getVisibleColumns = React.useCallback(() => {
|
|
2766
|
-
if (cachedVisibleTableConfiguration
|
|
2742
|
+
if (cachedVisibleTableConfiguration?.columnsConfig) {
|
|
2767
2743
|
return retrieveColumnsWithCachedConfiguration({
|
|
2768
2744
|
allAvailableColumnsConfiguration,
|
|
2769
2745
|
cachedVisibleTableConfiguration: cachedVisibleTableConfiguration.columnsConfig,
|
|
@@ -2777,8 +2753,8 @@ const usePersistedTableConfiguration = props => {
|
|
|
2777
2753
|
return {
|
|
2778
2754
|
visibleColumns,
|
|
2779
2755
|
visibleColumnKeys,
|
|
2780
|
-
cachedVisibleColumnsConfiguration: cachedVisibleTableConfiguration
|
|
2781
|
-
cachedDisplaySettings: cachedVisibleTableConfiguration
|
|
2756
|
+
cachedVisibleColumnsConfiguration: cachedVisibleTableConfiguration?.columnsConfig,
|
|
2757
|
+
cachedDisplaySettings: cachedVisibleTableConfiguration?.displaySettings,
|
|
2782
2758
|
handleCachedTableConfigurationUpdate: update => handleCacheUpdate({
|
|
2783
2759
|
update,
|
|
2784
2760
|
cachedVisibleTableConfiguration,
|
|
@@ -2789,7 +2765,6 @@ const usePersistedTableConfiguration = props => {
|
|
|
2789
2765
|
|
|
2790
2766
|
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 } } } };
|
|
2791
2767
|
const useProductSelectionsTotalFetcher = props => {
|
|
2792
|
-
var _data$productSelectio;
|
|
2793
2768
|
const _useQuery = hooks.useQuery(FetchProductSelectionsTotal, {
|
|
2794
2769
|
context: {
|
|
2795
2770
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -2799,7 +2774,7 @@ const useProductSelectionsTotalFetcher = props => {
|
|
|
2799
2774
|
data = _useQuery.data;
|
|
2800
2775
|
return {
|
|
2801
2776
|
isLoading: loading,
|
|
2802
|
-
total: data
|
|
2777
|
+
total: data?.productSelections?.total
|
|
2803
2778
|
};
|
|
2804
2779
|
};
|
|
2805
2780
|
|
|
@@ -2820,7 +2795,7 @@ function _objectSpread$1c(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
|
2820
2795
|
// eslint-disable-next-line import/prefer-default-export
|
|
2821
2796
|
const convertProductSelectionsFromGraphQl = productSelections => {
|
|
2822
2797
|
var _context;
|
|
2823
|
-
return
|
|
2798
|
+
return productSelections?.results && _objectSpread$1c(_objectSpread$1c({}, productSelections), {}, {
|
|
2824
2799
|
results: _mapInstanceProperty__default["default"](_context = productSelections.results).call(_context, productSelection => _objectSpread$1c({}, l10n.applyTransformedLocalizedFields(productSelection, [{
|
|
2825
2800
|
from: 'nameAllLocales',
|
|
2826
2801
|
to: 'name'
|
|
@@ -2854,7 +2829,7 @@ const useProductSelectionsFetcher = props => {
|
|
|
2854
2829
|
refetch = _useQuery.refetch;
|
|
2855
2830
|
return {
|
|
2856
2831
|
isLoading: loading,
|
|
2857
|
-
productSelections: convertProductSelectionsFromGraphQl(data
|
|
2832
|
+
productSelections: convertProductSelectionsFromGraphQl(data?.productSelections) || emptyProductSelections,
|
|
2858
2833
|
refetch
|
|
2859
2834
|
};
|
|
2860
2835
|
};
|
|
@@ -2879,7 +2854,6 @@ function validateSingleFilter(_ref) {
|
|
|
2879
2854
|
return _includesInstanceProperty__default["default"](invalidValues).call(invalidValues, value);
|
|
2880
2855
|
}
|
|
2881
2856
|
|
|
2882
|
-
var _templateObject$3, _templateObject2$2;
|
|
2883
2857
|
const dateFormatDayStart$1 = 'YYYY-MM-DDT00:00:00.000';
|
|
2884
2858
|
const dateFormatDayEnd$1 = 'YYYY-MM-DDT23:59:59.999';
|
|
2885
2859
|
const getDateTimeInUTC = (date, timezone, format) => {
|
|
@@ -2889,8 +2863,7 @@ const getDateTimeInUTC = (date, timezone, format) => {
|
|
|
2889
2863
|
const noTimeSpecified = momentDate.hours() === 0 && momentDate.minutes() === 0 && momentDate.seconds() === 0;
|
|
2890
2864
|
// if it's a date then convert it to UTC datetime based on timezone
|
|
2891
2865
|
if (noTimeSpecified) {
|
|
2892
|
-
|
|
2893
|
-
const offset = ((_moment$tz = moment__default$1["default"](date).tz(timezone)) === null || _moment$tz === void 0 ? void 0 : _moment$tz.utcOffset()) || 0;
|
|
2866
|
+
const offset = moment__default$1["default"](date).tz(timezone)?.utcOffset() || 0;
|
|
2894
2867
|
const formattedDate = momentDate.format(format);
|
|
2895
2868
|
const formattedDateWithOffset = moment__default$1["default"](formattedDate).add(offset, 'minutes').format(dateFormat);
|
|
2896
2869
|
// console.log(formattedDateWithOffset);
|
|
@@ -2903,7 +2876,6 @@ const getDateTimeInUTC = (date, timezone, format) => {
|
|
|
2903
2876
|
function dateTransformer$1(filterKey, filters) {
|
|
2904
2877
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator$1;
|
|
2905
2878
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
2906
|
-
var _context, _context2;
|
|
2907
2879
|
let type = _ref.type,
|
|
2908
2880
|
value = _ref.value,
|
|
2909
2881
|
timezone = _ref.timezone;
|
|
@@ -2913,13 +2885,19 @@ function dateTransformer$1(filterKey, filters) {
|
|
|
2913
2885
|
})) return '';
|
|
2914
2886
|
switch (type) {
|
|
2915
2887
|
case FILTER_TYPES.lessThan:
|
|
2916
|
-
return
|
|
2888
|
+
return `${filterKey} < "${getDateTimeInUTC(value, timezone, dateFormatDayStart$1)}"`;
|
|
2917
2889
|
case FILTER_TYPES.moreThan:
|
|
2918
|
-
return
|
|
2890
|
+
return `${filterKey} > "${getDateTimeInUTC(value, timezone, dateFormatDayEnd$1)}"`;
|
|
2919
2891
|
case FILTER_TYPES.equalTo:
|
|
2920
|
-
return oneLine__default["default"]
|
|
2892
|
+
return oneLine__default["default"]`
|
|
2893
|
+
(${filterKey} >= "${getDateTimeInUTC(value, timezone, dateFormatDayStart$1)}"
|
|
2894
|
+
and ${filterKey} <= "${getDateTimeInUTC(value, timezone, dateFormatDayEnd$1)}")
|
|
2895
|
+
`;
|
|
2921
2896
|
case FILTER_TYPES.range:
|
|
2922
|
-
return oneLine__default["default"]
|
|
2897
|
+
return oneLine__default["default"]`
|
|
2898
|
+
(${filterKey} >= "${getDateTimeInUTC(value.from, timezone, dateFormatDayStart$1)}"
|
|
2899
|
+
and ${filterKey} <= "${getDateTimeInUTC(value.to, timezone, dateFormatDayEnd$1)}")
|
|
2900
|
+
`;
|
|
2923
2901
|
default:
|
|
2924
2902
|
return '';
|
|
2925
2903
|
}
|
|
@@ -2935,7 +2913,7 @@ function dateTransformer$1(filterKey, filters) {
|
|
|
2935
2913
|
* (createdAt >= "2018-02-15T00:00:00.000+01:00" and createdAt <= "2018-02-15T23:59:59.999+01:00")
|
|
2936
2914
|
* ) or some_more_filters
|
|
2937
2915
|
*/
|
|
2938
|
-
return queryString === '' ? null :
|
|
2916
|
+
return queryString === '' ? null : `(${queryString})`;
|
|
2939
2917
|
}
|
|
2940
2918
|
function defaultFilterValidator$1(_ref2) {
|
|
2941
2919
|
let type = _ref2.type,
|
|
@@ -2951,10 +2929,7 @@ function defaultFilterValidator$1(_ref2) {
|
|
|
2951
2929
|
|
|
2952
2930
|
var localizedTextTransformer = (localizedString => {
|
|
2953
2931
|
var _context;
|
|
2954
|
-
return _mapInstanceProperty__default["default"](_context = _Object$keys__default["default"](localizedString)).call(_context, locale => {
|
|
2955
|
-
var _context2;
|
|
2956
|
-
return _concatInstanceProperty__default["default"](_context2 = "".concat(locale, " = \"")).call(_context2, localizedString[locale], "\"");
|
|
2957
|
-
}).join(' and ');
|
|
2932
|
+
return _mapInstanceProperty__default["default"](_context = _Object$keys__default["default"](localizedString)).call(_context, locale => `${locale} = "${localizedString[locale]}"`).join(' and ');
|
|
2958
2933
|
});
|
|
2959
2934
|
|
|
2960
2935
|
var styles$i = {
|
|
@@ -3003,7 +2978,6 @@ var GetChannelsQuery = { kind: "Document", definitions: [{ kind: "OperationDefin
|
|
|
3003
2978
|
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 } } } };
|
|
3004
2979
|
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 } } } };
|
|
3005
2980
|
const ChannelPickerInput = _ref => {
|
|
3006
|
-
var _currentOption$data$l, _currentOption$data;
|
|
3007
2981
|
let isClearable = _ref.isClearable,
|
|
3008
2982
|
isDisabled = _ref.isDisabled,
|
|
3009
2983
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -3020,9 +2994,9 @@ const ChannelPickerInput = _ref => {
|
|
|
3020
2994
|
formatMessage = _useIntl.formatMessage;
|
|
3021
2995
|
const dataLocale = applicationShellConnectors.useApplicationContext(applicationContext => applicationContext.dataLocale);
|
|
3022
2996
|
const variables = React.useMemo(() => _objectSpread$1b({
|
|
3023
|
-
sortByNamePath:
|
|
2997
|
+
sortByNamePath: `name.${dataLocale}`
|
|
3024
2998
|
}, role && {
|
|
3025
|
-
|
|
2999
|
+
extraWhere: `roles contains any ("${role}")`
|
|
3026
3000
|
}), [dataLocale, role]);
|
|
3027
3001
|
const _useState = React.useState(),
|
|
3028
3002
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -3040,7 +3014,7 @@ const ChannelPickerInput = _ref => {
|
|
|
3040
3014
|
}
|
|
3041
3015
|
return channel;
|
|
3042
3016
|
}, [formatLocalizedFieldToString]);
|
|
3043
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
3017
|
+
const prefixSearchFields = React.useMemo(() => [`name.${dataLocale}`, 'key'], [dataLocale]);
|
|
3044
3018
|
const loadOptions = useLoadOptions({
|
|
3045
3019
|
query: GetChannelsQuery,
|
|
3046
3020
|
variables,
|
|
@@ -3075,13 +3049,13 @@ const ChannelPickerInput = _ref => {
|
|
|
3075
3049
|
setLoadingError(null);
|
|
3076
3050
|
handleInternalInputChange(event);
|
|
3077
3051
|
}, [handleInternalInputChange]);
|
|
3078
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
3052
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
3079
3053
|
React.useEffect(() => {
|
|
3080
3054
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
3081
3055
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
3082
3056
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
3083
3057
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$G.noChannelsFound), [loadingError, formatMessage]);
|
|
3084
|
-
const tooltipTitle =
|
|
3058
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
3085
3059
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
3086
3060
|
max: "scale",
|
|
3087
3061
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -3091,7 +3065,7 @@ const ChannelPickerInput = _ref => {
|
|
|
3091
3065
|
children: jsxRuntime.jsx(uiKit.AsyncSelectInput, {
|
|
3092
3066
|
id: name,
|
|
3093
3067
|
name: name,
|
|
3094
|
-
placeholder: placeholder
|
|
3068
|
+
placeholder: placeholder ?? formatMessage(messages$G.placeholder),
|
|
3095
3069
|
loadOptions: loadOptionsDebounced,
|
|
3096
3070
|
defaultOptions: true,
|
|
3097
3071
|
showOptionGroupDivider: true,
|
|
@@ -3131,10 +3105,9 @@ let FormattedDateTime = /*#__PURE__*/function (_PureComponent) {
|
|
|
3131
3105
|
value: function render() {
|
|
3132
3106
|
return jsxRuntime.jsx(applicationShellConnectors.ApplicationContext, {
|
|
3133
3107
|
render: _ref => {
|
|
3134
|
-
var _this$props;
|
|
3135
3108
|
let user = _ref.user;
|
|
3136
3109
|
return formatDateTime$1(this.props.type, this.props.value, {
|
|
3137
|
-
timeZone:
|
|
3110
|
+
timeZone: this?.props?.timeZone || user?.timeZone,
|
|
3138
3111
|
locale: this.props.intl.locale
|
|
3139
3112
|
});
|
|
3140
3113
|
}
|
|
@@ -3265,7 +3238,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
3265
3238
|
};
|
|
3266
3239
|
_this.doDelayedUpdate = (updateFunction, event, eventType) => {
|
|
3267
3240
|
const self = _assertThisInitialized(_this);
|
|
3268
|
-
const timeoutKey =
|
|
3241
|
+
const timeoutKey = `${eventType}Timeout`;
|
|
3269
3242
|
// TODO: can't we just use one variable?
|
|
3270
3243
|
clearTimeout(_this[timeoutKey]);
|
|
3271
3244
|
_this[timeoutKey] = _setTimeout__default["default"](() => {
|
|
@@ -3295,7 +3268,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
3295
3268
|
}, this.props.onEnter ? {
|
|
3296
3269
|
onKeyDown: this.handleEnter
|
|
3297
3270
|
} : {}), filterDataAttributes(this.props));
|
|
3298
|
-
const inputId =
|
|
3271
|
+
const inputId = `throttled-field-${this.props.name}`;
|
|
3299
3272
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3300
3273
|
children: [jsxRuntime.jsx(uiKit.AccessibleHidden, {
|
|
3301
3274
|
children: jsxRuntime.jsx("label", {
|
|
@@ -3304,7 +3277,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
3304
3277
|
})
|
|
3305
3278
|
}), this.props.as === 'textarea' ? jsxRuntime.jsx(Textarea__default["default"], _objectSpread$19(_objectSpread$19({}, commonProps), {}, {
|
|
3306
3279
|
id: inputId,
|
|
3307
|
-
className: classnames__default["default"](styles$h.textarea, styles$h[
|
|
3280
|
+
className: classnames__default["default"](styles$h.textarea, styles$h[`textarea-${this.props.style}`], {
|
|
3308
3281
|
[styles$h.invalid]: !this.props.isValid,
|
|
3309
3282
|
[styles$h.disabled]: this.props.disabled
|
|
3310
3283
|
}),
|
|
@@ -3315,7 +3288,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
3315
3288
|
id: inputId,
|
|
3316
3289
|
ref: this.props.inputRef,
|
|
3317
3290
|
type: this.props.as,
|
|
3318
|
-
className: classnames__default["default"](styles$h[
|
|
3291
|
+
className: classnames__default["default"](styles$h[`input-${this.props.style}`], {
|
|
3319
3292
|
[styles$h.invalid]: !this.props.isValid,
|
|
3320
3293
|
[styles$h.disabled]: this.props.disabled,
|
|
3321
3294
|
[styles$h.granular]: this.props.isGranular
|
|
@@ -3415,8 +3388,7 @@ let SearchInput = /*#__PURE__*/function (_Component) {
|
|
|
3415
3388
|
});
|
|
3416
3389
|
};
|
|
3417
3390
|
_this.handleClear = () => {
|
|
3418
|
-
|
|
3419
|
-
(_this$inputRef = _this.inputRef) === null || _this$inputRef === void 0 || _this$inputRef.focus();
|
|
3391
|
+
_this.inputRef?.focus();
|
|
3420
3392
|
_this.props.onChange(null);
|
|
3421
3393
|
_this.props.onReset();
|
|
3422
3394
|
_this.setState({
|
|
@@ -3528,12 +3500,12 @@ const useExecuteGraphQLRequest = () => {
|
|
|
3528
3500
|
};
|
|
3529
3501
|
const createSearchProductsFromPIMAction = (searchTerm, projectKey) => sdk.actions.post({
|
|
3530
3502
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.PIM_SEARCH,
|
|
3531
|
-
uri:
|
|
3503
|
+
uri: `/${projectKey}/search/product-types`,
|
|
3532
3504
|
payload: {
|
|
3533
3505
|
query: {
|
|
3534
3506
|
wildcard: {
|
|
3535
3507
|
field: 'name',
|
|
3536
|
-
value:
|
|
3508
|
+
value: `*${searchTerm}*`,
|
|
3537
3509
|
caseInsensitive: true
|
|
3538
3510
|
}
|
|
3539
3511
|
},
|
|
@@ -3547,9 +3519,8 @@ const useFetchProductTypesFromPIM = _ref => {
|
|
|
3547
3519
|
const dispatch = sdk.useAsyncDispatch();
|
|
3548
3520
|
const executeGraphQLRequest = useExecuteGraphQLRequest();
|
|
3549
3521
|
const fetchProductTypesFromPim = React.useCallback(async searchTerm => {
|
|
3550
|
-
var _result$hits$map, _result$hits;
|
|
3551
3522
|
const result = await dispatch(createSearchProductsFromPIMAction(searchTerm, projectKey));
|
|
3552
|
-
const ids =
|
|
3523
|
+
const ids = result?.hits?.map(hit => hit.id) ?? [];
|
|
3553
3524
|
// Avoid sending any requests if it's clear that nothing is found
|
|
3554
3525
|
if (ids.length === 0) {
|
|
3555
3526
|
return {
|
|
@@ -3584,22 +3555,19 @@ const useFetchProductTypesFromPIM = _ref => {
|
|
|
3584
3555
|
*/
|
|
3585
3556
|
const constructNestedExpression = (reversedPath, predicate) => {
|
|
3586
3557
|
if (reversedPath.length > 0) {
|
|
3587
|
-
return _reduceInstanceProperty__default["default"](reversedPath).call(reversedPath, (nextNestedValue, nestedSelection) => {
|
|
3588
|
-
var _context;
|
|
3589
|
-
return _concatInstanceProperty__default["default"](_context = "".concat(nestedSelection, "(")).call(_context, nextNestedValue, ")");
|
|
3590
|
-
}, predicate);
|
|
3558
|
+
return _reduceInstanceProperty__default["default"](reversedPath).call(reversedPath, (nextNestedValue, nestedSelection) => `${nestedSelection}(${nextNestedValue})`, predicate);
|
|
3591
3559
|
}
|
|
3592
3560
|
return predicate;
|
|
3593
3561
|
};
|
|
3594
3562
|
const constructPrefixSearchPredicate$1 = (prefixSearchFields, lowerBound, upperBound) => {
|
|
3595
3563
|
const constructPrefixSearchExpression = field => {
|
|
3596
|
-
var
|
|
3564
|
+
var _context;
|
|
3597
3565
|
const parts = field.split('.');
|
|
3598
|
-
const _parts$slice$reverse = _reverseInstanceProperty__default["default"](
|
|
3566
|
+
const _parts$slice$reverse = _reverseInstanceProperty__default["default"](_context = _sliceInstanceProperty__default["default"](parts).call(parts)).call(_context),
|
|
3599
3567
|
_parts$slice$reverse2 = _toArray(_parts$slice$reverse),
|
|
3600
3568
|
valueToNest = _parts$slice$reverse2[0],
|
|
3601
3569
|
reversedPathToNestedValue = _sliceInstanceProperty__default["default"](_parts$slice$reverse2).call(_parts$slice$reverse2, 1);
|
|
3602
|
-
const predicateExpression =
|
|
3570
|
+
const predicateExpression = `${valueToNest} >= "${lowerBound}" and ${valueToNest} < "${upperBound}"`;
|
|
3603
3571
|
return constructNestedExpression(reversedPathToNestedValue, predicateExpression);
|
|
3604
3572
|
};
|
|
3605
3573
|
return _mapInstanceProperty__default["default"](prefixSearchFields).call(prefixSearchFields, constructPrefixSearchExpression).join(' or ');
|
|
@@ -3607,7 +3575,7 @@ const constructPrefixSearchPredicate$1 = (prefixSearchFields, lowerBound, upperB
|
|
|
3607
3575
|
const constructWherePredicate = (inputValue, prefixSearchFields) => {
|
|
3608
3576
|
const wherePredicate = function () {
|
|
3609
3577
|
if (inputValue.length) {
|
|
3610
|
-
if (isUUID(inputValue)) return
|
|
3578
|
+
if (isUUID(inputValue)) return `id = "${inputValue}"`;else {
|
|
3611
3579
|
const _getPrefixSearchBound = getPrefixSearchBounds(inputValue),
|
|
3612
3580
|
_getPrefixSearchBound2 = _slicedToArray(_getPrefixSearchBound, 2),
|
|
3613
3581
|
lowerBound = _getPrefixSearchBound2[0],
|
|
@@ -3632,7 +3600,6 @@ const useFetchProductTypessFromCTP = _ref2 => {
|
|
|
3632
3600
|
}, [prefixSearchFields, executeGraphQLRequest]);
|
|
3633
3601
|
};
|
|
3634
3602
|
const usePimStatus = () => {
|
|
3635
|
-
var _data$indicesExist;
|
|
3636
3603
|
const _useQuery = react.useQuery(FetchIndicesExist$1, {
|
|
3637
3604
|
context: {
|
|
3638
3605
|
target: constants.GRAPHQL_TARGETS.PIM_INDEXER
|
|
@@ -3642,20 +3609,17 @@ const usePimStatus = () => {
|
|
|
3642
3609
|
data = _useQuery.data;
|
|
3643
3610
|
return {
|
|
3644
3611
|
data,
|
|
3645
|
-
isProjectIndexed: Boolean(data
|
|
3612
|
+
isProjectIndexed: Boolean(data?.indicesExist?.productTypes?.searchableIndexExists)
|
|
3646
3613
|
};
|
|
3647
3614
|
};
|
|
3648
3615
|
const useProductTypeOptions = _ref3 => {
|
|
3649
3616
|
let prefixSearchFields = _ref3.prefixSearchFields;
|
|
3650
3617
|
const _usePimStatus = usePimStatus(),
|
|
3651
3618
|
isProjectIndexed = _usePimStatus.isProjectIndexed;
|
|
3652
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => {
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key
|
|
3657
|
-
};
|
|
3658
|
-
}),
|
|
3619
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
3620
|
+
dataLocale: context.dataLocale,
|
|
3621
|
+
projectKey: context.project?.key
|
|
3622
|
+
})),
|
|
3659
3623
|
dataLocale = _useApplicationContex.dataLocale,
|
|
3660
3624
|
projectKey = _useApplicationContex.projectKey;
|
|
3661
3625
|
const fetchProductTypesFromPim = useFetchProductTypesFromPIM({
|
|
@@ -3719,10 +3683,9 @@ const useHandlers = onChange => {
|
|
|
3719
3683
|
setInputValue(changedValue);
|
|
3720
3684
|
}, []);
|
|
3721
3685
|
const handleChange = useEventCallback(event => {
|
|
3722
|
-
var _event$target$value;
|
|
3723
3686
|
const eventWithExtractedValue = _objectSpread$17(_objectSpread$17({}, event), {}, {
|
|
3724
3687
|
target: _objectSpread$17(_objectSpread$17({}, event.target), {}, {
|
|
3725
|
-
value:
|
|
3688
|
+
value: event.target.value?.value
|
|
3726
3689
|
})
|
|
3727
3690
|
});
|
|
3728
3691
|
onChange(eventWithExtractedValue);
|
|
@@ -3730,25 +3693,23 @@ const useHandlers = onChange => {
|
|
|
3730
3693
|
return [handleInputChange, handleChange];
|
|
3731
3694
|
};
|
|
3732
3695
|
|
|
3696
|
+
const _excluded$1 = ["extraWhere"];
|
|
3733
3697
|
function ownKeys$16(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; }
|
|
3734
|
-
function _objectSpread$16(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
3698
|
+
function _objectSpread$16(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$16(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$16(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
3735
3699
|
const constructPrefixSearchPredicate = function () {
|
|
3736
3700
|
let prefixSearchFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
3737
3701
|
let lowerBound = arguments.length > 1 ? arguments[1] : undefined;
|
|
3738
3702
|
let upperBound = arguments.length > 2 ? arguments[2] : undefined;
|
|
3739
3703
|
const constructPrefixSearchExpression = field => {
|
|
3740
|
-
var _context
|
|
3704
|
+
var _context;
|
|
3741
3705
|
const path = field.split('.');
|
|
3742
3706
|
const _path$slice$reverse = _reverseInstanceProperty__default["default"](_context = _sliceInstanceProperty__default["default"](path).call(path)).call(_context),
|
|
3743
3707
|
_path$slice$reverse2 = _toArray(_path$slice$reverse),
|
|
3744
3708
|
finalValueInPath = _path$slice$reverse2[0],
|
|
3745
3709
|
remainPathInReverse = _sliceInstanceProperty__default["default"](_path$slice$reverse2).call(_path$slice$reverse2, 1);
|
|
3746
|
-
const comparison =
|
|
3710
|
+
const comparison = `${finalValueInPath} >= "${lowerBound}" and ${finalValueInPath} < "${upperBound}"`;
|
|
3747
3711
|
if (remainPathInReverse.length) {
|
|
3748
|
-
return _reduceInstanceProperty__default["default"](remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) => {
|
|
3749
|
-
var _context5;
|
|
3750
|
-
return _concatInstanceProperty__default["default"](_context5 = "".concat(nextPath, "(")).call(_context5, nestedPath, ")");
|
|
3751
|
-
}, comparison);
|
|
3712
|
+
return _reduceInstanceProperty__default["default"](remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) => `${nextPath}(${nestedPath})`, comparison);
|
|
3752
3713
|
}
|
|
3753
3714
|
return comparison;
|
|
3754
3715
|
};
|
|
@@ -3761,22 +3722,29 @@ const useLoadOptions = _ref => {
|
|
|
3761
3722
|
const client$1 = client.useApolloClient();
|
|
3762
3723
|
const loadOptions = React.useCallback(function () {
|
|
3763
3724
|
let inputValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3725
|
+
let where;
|
|
3726
|
+
if (inputValue.length) {
|
|
3727
|
+
if (isUUID(inputValue)) {
|
|
3728
|
+
where = `id = "${inputValue}"`;
|
|
3729
|
+
} else {
|
|
3730
|
+
const _getPrefixSearchBound = getPrefixSearchBounds(inputValue),
|
|
3731
|
+
_getPrefixSearchBound2 = _slicedToArray(_getPrefixSearchBound, 2),
|
|
3732
|
+
lowerBound = _getPrefixSearchBound2[0],
|
|
3733
|
+
upperBound = _getPrefixSearchBound2[1];
|
|
3734
|
+
where = constructPrefixSearchPredicate(prefixSearchFields, lowerBound, upperBound);
|
|
3773
3735
|
}
|
|
3774
|
-
}
|
|
3736
|
+
}
|
|
3737
|
+
const _ref2 = variables ?? {},
|
|
3738
|
+
extraWhere = _ref2.extraWhere,
|
|
3739
|
+
restVariables = _objectWithoutProperties(_ref2, _excluded$1);
|
|
3740
|
+
if (typeof extraWhere === 'string') {
|
|
3741
|
+
where = where ? `(${where}) and ${variables.extraWhere}` : variables.extraWhere;
|
|
3742
|
+
}
|
|
3775
3743
|
return client$1.query({
|
|
3776
3744
|
query,
|
|
3777
3745
|
variables: _objectSpread$16({
|
|
3778
3746
|
where
|
|
3779
|
-
},
|
|
3747
|
+
}, restVariables),
|
|
3780
3748
|
context: {
|
|
3781
3749
|
target: constants.MC_API_PROXY_TARGETS.COMMERCETOOLS_PLATFORM
|
|
3782
3750
|
},
|
|
@@ -3787,7 +3755,6 @@ const useLoadOptions = _ref => {
|
|
|
3787
3755
|
};
|
|
3788
3756
|
|
|
3789
3757
|
function useCurrentOption(_ref) {
|
|
3790
|
-
var _context;
|
|
3791
3758
|
let id = _ref.id,
|
|
3792
3759
|
typename = _ref.typename,
|
|
3793
3760
|
query = _ref.query,
|
|
@@ -3799,7 +3766,7 @@ function useCurrentOption(_ref) {
|
|
|
3799
3766
|
// load from cache when possible to speed up initial render
|
|
3800
3767
|
const canReadFromCache = id && typename && fragment;
|
|
3801
3768
|
const cacheItem = canReadFromCache ? apolloClient.readFragment({
|
|
3802
|
-
id:
|
|
3769
|
+
id: `${typename}:${id}`,
|
|
3803
3770
|
fragment
|
|
3804
3771
|
}) : undefined;
|
|
3805
3772
|
|
|
@@ -3817,7 +3784,7 @@ function useCurrentOption(_ref) {
|
|
|
3817
3784
|
queryData = _useQuery.data,
|
|
3818
3785
|
queryError = _useQuery.error;
|
|
3819
3786
|
const queryItem = queryData && queryDataToItem(queryData);
|
|
3820
|
-
const item = queryItem
|
|
3787
|
+
const item = queryItem ?? cacheItem;
|
|
3821
3788
|
const loading = item ? false : queryLoading;
|
|
3822
3789
|
const error = item ? undefined : queryError;
|
|
3823
3790
|
const data = item && itemToOption(item);
|
|
@@ -3856,7 +3823,6 @@ const convertProductTypeToOption = productType => {
|
|
|
3856
3823
|
};
|
|
3857
3824
|
};
|
|
3858
3825
|
const ProductTypePickerInput = _ref => {
|
|
3859
|
-
var _currentOption$data$l, _currentOption$data;
|
|
3860
3826
|
let isClearable = _ref.isClearable,
|
|
3861
3827
|
isDisabled = _ref.isDisabled,
|
|
3862
3828
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -3887,9 +3853,8 @@ const ProductTypePickerInput = _ref => {
|
|
|
3887
3853
|
itemToOption: convertProductTypeToOption
|
|
3888
3854
|
});
|
|
3889
3855
|
const handleLoadOptions = React.useCallback(inputValue => loadProductTypes(inputValue).then(_ref3 => {
|
|
3890
|
-
var _data$productTypes;
|
|
3891
3856
|
let data = _ref3.data;
|
|
3892
|
-
return
|
|
3857
|
+
return data.productTypes?.results || [];
|
|
3893
3858
|
}).then(productTypes => _mapInstanceProperty__default["default"](productTypes).call(productTypes, convertProductTypeToOption)).catch(error => {
|
|
3894
3859
|
setLoadingError(error);
|
|
3895
3860
|
onError(error);
|
|
@@ -3903,12 +3868,12 @@ const ProductTypePickerInput = _ref => {
|
|
|
3903
3868
|
setLoadingError(null);
|
|
3904
3869
|
handleInternalInputChange(event);
|
|
3905
3870
|
}, [handleInternalInputChange]);
|
|
3906
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
3871
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
3907
3872
|
React.useEffect(() => {
|
|
3908
3873
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
3909
3874
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
3910
3875
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
3911
|
-
const tooltipTitle =
|
|
3876
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
3912
3877
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
3913
3878
|
max: "scale",
|
|
3914
3879
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -3959,7 +3924,6 @@ var messages$C = reactIntl.defineMessages({
|
|
|
3959
3924
|
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 } } } };
|
|
3960
3925
|
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 } } } };
|
|
3961
3926
|
const StatePickerInput = _ref => {
|
|
3962
|
-
var _currentOption$data$l, _currentOption$data;
|
|
3963
3927
|
let isClearable = _ref.isClearable,
|
|
3964
3928
|
isDisabled = _ref.isDisabled,
|
|
3965
3929
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -3974,7 +3938,7 @@ const StatePickerInput = _ref => {
|
|
|
3974
3938
|
formatMessage = _useIntl.formatMessage;
|
|
3975
3939
|
const dataLocale = applicationShellConnectors.useApplicationContext(applicationContext => applicationContext.dataLocale);
|
|
3976
3940
|
const variables = React.useMemo(() => ({
|
|
3977
|
-
sortByNamePath:
|
|
3941
|
+
sortByNamePath: `name.${dataLocale}`
|
|
3978
3942
|
}), [dataLocale]);
|
|
3979
3943
|
const convertStateToOption = React.useCallback(state => {
|
|
3980
3944
|
const localizedName = formatLocalizedFieldToString(state.nameAllLocales);
|
|
@@ -3989,7 +3953,7 @@ const StatePickerInput = _ref => {
|
|
|
3989
3953
|
_useState2 = _slicedToArray(_useState, 2),
|
|
3990
3954
|
loadingError = _useState2[0],
|
|
3991
3955
|
setLoadingError = _useState2[1];
|
|
3992
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
3956
|
+
const prefixSearchFields = React.useMemo(() => [`name.${dataLocale}`, 'key'], [dataLocale]);
|
|
3993
3957
|
const loadOptions = useLoadOptions({
|
|
3994
3958
|
query: GetStatesQuery,
|
|
3995
3959
|
variables,
|
|
@@ -4022,13 +3986,13 @@ const StatePickerInput = _ref => {
|
|
|
4022
3986
|
setLoadingError(null);
|
|
4023
3987
|
handleInternalInputChange(event);
|
|
4024
3988
|
}, [handleInternalInputChange]);
|
|
4025
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
3989
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
4026
3990
|
React.useEffect(() => {
|
|
4027
3991
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
4028
3992
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
4029
3993
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
4030
3994
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$C.noStatesFound), [loadingError, formatMessage]);
|
|
4031
|
-
const tooltipTitle =
|
|
3995
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
4032
3996
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
4033
3997
|
max: "scale",
|
|
4034
3998
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -4093,26 +4057,23 @@ const CustomFieldTooltip = _ref => {
|
|
|
4093
4057
|
|
|
4094
4058
|
const setToArray = function () {
|
|
4095
4059
|
let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4096
|
-
return
|
|
4060
|
+
return `id in (${_mapInstanceProperty__default["default"](values).call(values, value => `"${value}"`).join(', ')})`;
|
|
4097
4061
|
};
|
|
4098
4062
|
|
|
4099
4063
|
function capitalizeFirst(text) {
|
|
4100
4064
|
return text.charAt(0).toUpperCase() + _sliceInstanceProperty__default["default"](text).call(text, 1);
|
|
4101
4065
|
}
|
|
4102
4066
|
|
|
4103
|
-
const getCentAmountClause = (value, operator, locale) => {
|
|
4104
|
-
var _context;
|
|
4105
|
-
return _concatInstanceProperty__default["default"](_context = "centAmount ".concat(operator, " ")).call(_context, uiKit.MoneyInput.convertToMoneyValue(value, locale).centAmount);
|
|
4106
|
-
};
|
|
4067
|
+
const getCentAmountClause = (value, operator, locale) => `centAmount ${operator} ${uiKit.MoneyInput.convertToMoneyValue(value, locale).centAmount}`;
|
|
4107
4068
|
function moneyTransformer(value, option, locale) {
|
|
4108
4069
|
const clauses = [];
|
|
4109
4070
|
if (option === FILTER_TYPES.range) {
|
|
4110
|
-
clauses[0] =
|
|
4071
|
+
clauses[0] = `currencyCode = "${value.from.currencyCode}"`;
|
|
4111
4072
|
clauses[1] = getCentAmountClause(value.from, '>=', locale);
|
|
4112
4073
|
clauses[2] = getCentAmountClause(value.to, '<=', locale);
|
|
4113
4074
|
return clauses.join(' and ');
|
|
4114
4075
|
}
|
|
4115
|
-
clauses[0] =
|
|
4076
|
+
clauses[0] = `currencyCode = "${value.currencyCode}"`;
|
|
4116
4077
|
switch (option) {
|
|
4117
4078
|
case FILTER_TYPES.lessThan:
|
|
4118
4079
|
clauses[1] = getCentAmountClause(value, '<', locale);
|
|
@@ -4129,7 +4090,6 @@ function moneyTransformer(value, option, locale) {
|
|
|
4129
4090
|
return clauses.join(' and ');
|
|
4130
4091
|
}
|
|
4131
4092
|
|
|
4132
|
-
var _templateObject$2, _templateObject2$1;
|
|
4133
4093
|
const formatTime = 'HH:mm:ss.SSS';
|
|
4134
4094
|
|
|
4135
4095
|
/* TimeInput only allows HH:mm:ss and adds the seconds as 00 and
|
|
@@ -4151,7 +4111,6 @@ const defaultFilterValidator = _ref => {
|
|
|
4151
4111
|
const timeTransformer = function (filterKey, filters) {
|
|
4152
4112
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator;
|
|
4153
4113
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref2 => {
|
|
4154
|
-
var _context, _context2;
|
|
4155
4114
|
let type = _ref2.type,
|
|
4156
4115
|
value = _ref2.value;
|
|
4157
4116
|
if (!filterValidator({
|
|
@@ -4160,13 +4119,19 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4160
4119
|
})) return '';
|
|
4161
4120
|
switch (type) {
|
|
4162
4121
|
case FILTER_TYPES.lessThan:
|
|
4163
|
-
return
|
|
4122
|
+
return `${filterKey} < "${value}"`;
|
|
4164
4123
|
case FILTER_TYPES.moreThan:
|
|
4165
|
-
return
|
|
4124
|
+
return `${filterKey} > "${value}"`;
|
|
4166
4125
|
case FILTER_TYPES.equalTo:
|
|
4167
|
-
return oneLine__default["default"]
|
|
4126
|
+
return oneLine__default["default"]`
|
|
4127
|
+
(${filterKey} >= "${value}"
|
|
4128
|
+
and ${filterKey} <= "${getEndOfSecond(value)}")
|
|
4129
|
+
`;
|
|
4168
4130
|
case FILTER_TYPES.range:
|
|
4169
|
-
return oneLine__default["default"]
|
|
4131
|
+
return oneLine__default["default"]`
|
|
4132
|
+
(${filterKey} >= "${value.from}"
|
|
4133
|
+
and ${filterKey} <= "${getEndOfSecond(value.to)}")
|
|
4134
|
+
`;
|
|
4170
4135
|
default:
|
|
4171
4136
|
return '';
|
|
4172
4137
|
}
|
|
@@ -4182,7 +4147,7 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4182
4147
|
* (pickUpTime >= "14:00" and pickUpTime <= "15:00")
|
|
4183
4148
|
* ) or some_more_filters
|
|
4184
4149
|
*/
|
|
4185
|
-
return queryString === '' ? null :
|
|
4150
|
+
return queryString === '' ? null : `(${queryString})`;
|
|
4186
4151
|
};
|
|
4187
4152
|
|
|
4188
4153
|
// FIXME: delete once prefix search is supported in ctp api
|
|
@@ -4199,9 +4164,8 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4199
4164
|
// e.g
|
|
4200
4165
|
// where: `masterData(current(name(en >= "${lowerBound}" and en < "${upperBound}")))`
|
|
4201
4166
|
const getPrefixSearchBounds = input => {
|
|
4202
|
-
var _context;
|
|
4203
4167
|
const getNextCharacter = character => String.fromCharCode(character.charCodeAt() + 1);
|
|
4204
|
-
return [input,
|
|
4168
|
+
return [input, `${_sliceInstanceProperty__default["default"](input).call(input, 0, input.length - 1)}${getNextCharacter(_sliceInstanceProperty__default["default"](input).call(input, input.length - 1))}`];
|
|
4205
4169
|
};
|
|
4206
4170
|
|
|
4207
4171
|
const _excluded = ["action"];
|
|
@@ -4394,7 +4358,7 @@ const convertChangeValueAction = actionPayload => {
|
|
|
4394
4358
|
* as its dynamic content can not be typed in SDL for the mutation.
|
|
4395
4359
|
*/
|
|
4396
4360
|
const convertAction = (actionName, actionPayload) => {
|
|
4397
|
-
var
|
|
4361
|
+
var _context3, _context4, _context5;
|
|
4398
4362
|
const getNameFromPayload = payload => {
|
|
4399
4363
|
// changeName for `Organizations`
|
|
4400
4364
|
if (typeof payload.name === 'string') return payload;
|
|
@@ -4452,7 +4416,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4452
4416
|
case 'setCustomType':
|
|
4453
4417
|
return {
|
|
4454
4418
|
[actionName]: {
|
|
4455
|
-
typeId:
|
|
4419
|
+
typeId: actionPayload.type?.id,
|
|
4456
4420
|
fields: actionPayload.fields ? _mapInstanceProperty__default["default"](_context3 = _Object$entries__default["default"](actionPayload.fields)).call(_context3, _ref => {
|
|
4457
4421
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
4458
4422
|
customField = _ref2[0],
|
|
@@ -4482,10 +4446,10 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4482
4446
|
};
|
|
4483
4447
|
case 'setGeoLocation':
|
|
4484
4448
|
return {
|
|
4485
|
-
[actionName]: actionPayload
|
|
4449
|
+
[actionName]: actionPayload?.geoLocation ? {
|
|
4486
4450
|
geoLocation: {
|
|
4487
4451
|
type: 'Point',
|
|
4488
|
-
coordinates: [_parseFloat__default["default"](
|
|
4452
|
+
coordinates: [_parseFloat__default["default"](actionPayload.geoLocation?.longitude), _parseFloat__default["default"](actionPayload.geoLocation?.latitude)]
|
|
4489
4453
|
}
|
|
4490
4454
|
} : {
|
|
4491
4455
|
undefined
|
|
@@ -4621,7 +4585,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4621
4585
|
case 'setShippingRateInputType':
|
|
4622
4586
|
return {
|
|
4623
4587
|
[actionName]: {
|
|
4624
|
-
shippingRateInputType:
|
|
4588
|
+
shippingRateInputType: actionPayload.shippingRateInputType?.type ? {
|
|
4625
4589
|
[actionPayload.shippingRateInputType.type]: {
|
|
4626
4590
|
values: actionPayload.shippingRateInputType.type === 'CartClassification' ? _mapInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](actionPayload.shippingRateInputType)).call(_context4, value => ({
|
|
4627
4591
|
key: value.key,
|
|
@@ -4675,8 +4639,8 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4675
4639
|
case 'addAddress':
|
|
4676
4640
|
case 'changeAddress':
|
|
4677
4641
|
{
|
|
4678
|
-
var
|
|
4679
|
-
const _ref3 =
|
|
4642
|
+
var _context6;
|
|
4643
|
+
const _ref3 = actionPayload.address?.custom || {},
|
|
4680
4644
|
_ref3$fields = _ref3.fields,
|
|
4681
4645
|
fields = _ref3$fields === void 0 ? {} : _ref3$fields;
|
|
4682
4646
|
const customFields = isEmpty__default["default"](fields) ? null : _mapInstanceProperty__default["default"](_context6 = _Object$entries__default["default"](fields)).call(_context6, _ref4 => {
|
|
@@ -4688,7 +4652,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4688
4652
|
value: _JSON$stringify__default["default"](value)
|
|
4689
4653
|
};
|
|
4690
4654
|
});
|
|
4691
|
-
const custom =
|
|
4655
|
+
const custom = actionPayload.address?.custom?.type?.id ? {
|
|
4692
4656
|
type: {
|
|
4693
4657
|
id: actionPayload.address.custom.type.id
|
|
4694
4658
|
},
|
|
@@ -4719,7 +4683,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4719
4683
|
value: _JSON$stringify__default["default"](value)
|
|
4720
4684
|
};
|
|
4721
4685
|
});
|
|
4722
|
-
const customType = type
|
|
4686
|
+
const customType = type?.id ? {
|
|
4723
4687
|
id: type.id
|
|
4724
4688
|
} : null;
|
|
4725
4689
|
return {
|
|
@@ -4742,11 +4706,10 @@ const createGraphQlUpdateActions = actions => _reduceInstanceProperty__default["
|
|
|
4742
4706
|
return [...previousActions, convertAction(actionName, actionPayload)];
|
|
4743
4707
|
}, []);
|
|
4744
4708
|
const extractErrorFromGraphQlResponse = graphQlResponse => {
|
|
4745
|
-
|
|
4746
|
-
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) {
|
|
4709
|
+
if (graphQlResponse.networkError?.result?.errors?.length > 0) {
|
|
4747
4710
|
return graphQlResponse.networkError.result.errors;
|
|
4748
4711
|
}
|
|
4749
|
-
if (
|
|
4712
|
+
if (graphQlResponse.graphQLErrors?.length > 0) {
|
|
4750
4713
|
return graphQlResponse.graphQLErrors;
|
|
4751
4714
|
}
|
|
4752
4715
|
return graphQlResponse;
|
|
@@ -4775,16 +4738,14 @@ function omitDeep(obj, fieldsToOmit) {
|
|
|
4775
4738
|
function ownKeys$13(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; }
|
|
4776
4739
|
function _objectSpread$13(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$13(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$13(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
4777
4740
|
function getPriceChannelName(price) {
|
|
4778
|
-
|
|
4779
|
-
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;
|
|
4741
|
+
return price.channel?.name ?? price.channel?.key ?? null;
|
|
4780
4742
|
}
|
|
4781
4743
|
function getDiscountValue(price) {
|
|
4782
|
-
var _price$value, _price$value2, _price$discounted;
|
|
4783
4744
|
let preciseAmount;
|
|
4784
4745
|
let fractionedAmount;
|
|
4785
|
-
if (
|
|
4746
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision && price.discounted.value.type === PRECISION_TYPES.highPrecision) {
|
|
4786
4747
|
preciseAmount = price.value.preciseAmount - price.discounted.value.preciseAmount;
|
|
4787
|
-
} else if (
|
|
4748
|
+
} else if (price.value?.type === PRECISION_TYPES.highPrecision && price.discounted?.value?.type === PRECISION_TYPES.centPrecision) {
|
|
4788
4749
|
fractionedAmount = getFractionedAmount(price.value) - getFractionedAmount(price.discounted.value);
|
|
4789
4750
|
}
|
|
4790
4751
|
return price.discounted ? _objectSpread$13(_objectSpread$13({}, price.value), {}, {
|
|
@@ -4798,28 +4759,23 @@ function getDiscountValue(price) {
|
|
|
4798
4759
|
function getSelectedPrice(price) {
|
|
4799
4760
|
return price.discounted ? price.discounted : price;
|
|
4800
4761
|
}
|
|
4801
|
-
function getNetUnitPrice(
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
shouldRoundAmount = _ref2.shouldRoundAmount;
|
|
4762
|
+
function getNetUnitPrice(_ref) {
|
|
4763
|
+
let lineItem = _ref.lineItem,
|
|
4764
|
+
shouldRoundAmount = _ref.shouldRoundAmount;
|
|
4805
4765
|
const price = getSelectedPrice(lineItem.price);
|
|
4806
|
-
const filteredPerMethodTaxRate = lineItem
|
|
4807
|
-
var _lineItem$shippingDet;
|
|
4808
|
-
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;
|
|
4809
|
-
});
|
|
4766
|
+
const filteredPerMethodTaxRate = lineItem?.perMethodTaxRate?.filter(perMethodTax => lineItem?.shippingDetails?.targets?.findIndex(target => target?.shippingMethodKey === perMethodTax?.shippingMethodKey) >= 0);
|
|
4810
4767
|
|
|
4811
4768
|
// when shipping mode is multi with the same tax rate
|
|
4812
|
-
if (
|
|
4813
|
-
var _price$value3, _price$value4;
|
|
4769
|
+
if (filteredPerMethodTaxRate?.length > 0 && filteredPerMethodTaxRate[0]?.taxRate?.includedInPrice) {
|
|
4814
4770
|
const taxRate = filteredPerMethodTaxRate[0].taxRate;
|
|
4815
4771
|
let centAmount;
|
|
4816
4772
|
// should accept 0 value
|
|
4817
|
-
if (typeof
|
|
4773
|
+
if (typeof price.value?.centAmount === 'number') {
|
|
4818
4774
|
const amount = price.value.centAmount / (1 + taxRate.amount);
|
|
4819
4775
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4820
4776
|
}
|
|
4821
4777
|
let preciseAmount;
|
|
4822
|
-
if (
|
|
4778
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + taxRate.amount);
|
|
4823
4779
|
return _objectSpread$13(_objectSpread$13({}, price.value), {}, {
|
|
4824
4780
|
centAmount,
|
|
4825
4781
|
preciseAmount
|
|
@@ -4828,15 +4784,14 @@ function getNetUnitPrice(_ref2) {
|
|
|
4828
4784
|
|
|
4829
4785
|
// when shipping mode is single
|
|
4830
4786
|
if (lineItem.taxRate && lineItem.taxRate.includedInPrice) {
|
|
4831
|
-
var _price$value5, _price$value6;
|
|
4832
4787
|
let centAmount;
|
|
4833
4788
|
// should accept 0 value
|
|
4834
|
-
if (typeof
|
|
4789
|
+
if (typeof price.value?.centAmount === 'number') {
|
|
4835
4790
|
const amount = price.value.centAmount / (1 + lineItem.taxRate.amount);
|
|
4836
4791
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4837
4792
|
}
|
|
4838
4793
|
let preciseAmount;
|
|
4839
|
-
if (
|
|
4794
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + lineItem.taxRate.amount);
|
|
4840
4795
|
return _objectSpread$13(_objectSpread$13({}, price.value), {}, {
|
|
4841
4796
|
centAmount,
|
|
4842
4797
|
preciseAmount
|
|
@@ -4870,18 +4825,18 @@ const transformCustomFieldFromGraphQLResponse = resource => {
|
|
|
4870
4825
|
key: resource.custom.type.key,
|
|
4871
4826
|
name: l10n.transformLocalizedFieldToLocalizedString(resource.custom.type.nameAllLocales),
|
|
4872
4827
|
fieldDefinitions: _mapInstanceProperty__default["default"](_context = resource.custom.type.fieldDefinitions).call(_context, fieldDefinition => {
|
|
4873
|
-
var
|
|
4828
|
+
var _context2, _context3;
|
|
4874
4829
|
return {
|
|
4875
4830
|
name: fieldDefinition.name,
|
|
4876
4831
|
required: fieldDefinition.required,
|
|
4877
|
-
type:
|
|
4832
|
+
type: fieldDefinition.type?.elementType?.name === 'LocalizedEnum' ? _objectSpread$12(_objectSpread$12({}, fieldDefinition.type), {}, {
|
|
4878
4833
|
elementType: _objectSpread$12(_objectSpread$12({}, fieldDefinition.type.elementType), {}, {
|
|
4879
4834
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
4880
4835
|
key: value.key,
|
|
4881
4836
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
4882
4837
|
}))
|
|
4883
4838
|
})
|
|
4884
|
-
}) :
|
|
4839
|
+
}) : fieldDefinition.type?.name === 'LocalizedEnum' ? _objectSpread$12(_objectSpread$12({}, fieldDefinition.type), {}, {
|
|
4885
4840
|
values: _mapInstanceProperty__default["default"](_context3 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context3, value => ({
|
|
4886
4841
|
key: value.key,
|
|
4887
4842
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -4908,7 +4863,7 @@ const convertProductSelectionFromGraphQl = productSelection => {
|
|
|
4908
4863
|
from: 'nameAllLocales',
|
|
4909
4864
|
to: 'name'
|
|
4910
4865
|
}])), {}, {
|
|
4911
|
-
custom: productSelection
|
|
4866
|
+
custom: productSelection?.custom ? transformCustomFieldFromGraphQLResponse(productSelection) : null
|
|
4912
4867
|
});
|
|
4913
4868
|
};
|
|
4914
4869
|
|
|
@@ -5037,7 +4992,7 @@ let CustomFieldDefinitionsConnector = /*#__PURE__*/function (_Component) {
|
|
|
5037
4992
|
value: function componentDidMount() {
|
|
5038
4993
|
var _context;
|
|
5039
4994
|
const hasUnsupportedResource = _someInstanceProperty__default["default"](_context = this.props.resources).call(_context, resource => !_includesInstanceProperty__default["default"](customizableResources$1).call(customizableResources$1, resource));
|
|
5040
|
-
!!hasUnsupportedResource ? process.env.NODE_ENV !== "production" ? invariant__default["default"](false,
|
|
4995
|
+
!!hasUnsupportedResource ? process.env.NODE_ENV !== "production" ? invariant__default["default"](false, `core/components/custom-field-definitions-connector: some of the specified resources are not supported.`) : invariant__default["default"](false) : void 0;
|
|
5041
4996
|
}
|
|
5042
4997
|
}, {
|
|
5043
4998
|
key: "render",
|
|
@@ -5056,9 +5011,9 @@ CustomFieldDefinitionsConnector.displayName = 'CustomFieldDefinitionsConnector';
|
|
|
5056
5011
|
CustomFieldDefinitionsConnector.defaultProps = {
|
|
5057
5012
|
resources: []
|
|
5058
5013
|
};
|
|
5059
|
-
const stringifyResources$1 = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => "
|
|
5014
|
+
const stringifyResources$1 = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => `"${resource}"`).join();
|
|
5060
5015
|
const mapPropsToOptions = ownProps => {
|
|
5061
|
-
const where = ownProps.resources.length > 0 ?
|
|
5016
|
+
const where = ownProps.resources.length > 0 ? `resourceTypeIds contains any (${stringifyResources$1(ownProps.resources)})` : undefined;
|
|
5062
5017
|
return {
|
|
5063
5018
|
variables: {
|
|
5064
5019
|
where,
|
|
@@ -5127,19 +5082,19 @@ const graphQlDocToForm = typeDefinition => {
|
|
|
5127
5082
|
key: typeDefinition.key,
|
|
5128
5083
|
name: l10n.transformLocalizedFieldToLocalizedString(typeDefinition.nameAllLocales),
|
|
5129
5084
|
fieldDefinitions: _mapInstanceProperty__default["default"](_context = typeDefinition.fieldDefinitions).call(_context, fieldDefinition => {
|
|
5130
|
-
var
|
|
5085
|
+
var _context2, _context3;
|
|
5131
5086
|
return {
|
|
5132
5087
|
name: fieldDefinition.name,
|
|
5133
5088
|
required: fieldDefinition.required,
|
|
5134
5089
|
inputHint: fieldDefinition.inputHint,
|
|
5135
|
-
type:
|
|
5090
|
+
type: fieldDefinition.type?.elementType?.name === 'LocalizedEnum' ? _objectSpread$$(_objectSpread$$({}, fieldDefinition.type), {}, {
|
|
5136
5091
|
elementType: _objectSpread$$(_objectSpread$$({}, fieldDefinition.type.elementType), {}, {
|
|
5137
5092
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
5138
5093
|
key: value.key,
|
|
5139
5094
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
5140
5095
|
}))
|
|
5141
5096
|
})
|
|
5142
|
-
}) :
|
|
5097
|
+
}) : fieldDefinition.type?.name === 'LocalizedEnum' ? _objectSpread$$(_objectSpread$$({}, fieldDefinition.type), {}, {
|
|
5143
5098
|
values: _mapInstanceProperty__default["default"](_context3 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context3, value => ({
|
|
5144
5099
|
key: value.key,
|
|
5145
5100
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -5171,7 +5126,7 @@ const formToGraphQlDoc = formCustomFields => ({
|
|
|
5171
5126
|
// TODO(pa3): find usages and make sure only 1 param is passed
|
|
5172
5127
|
const createEmptyCustomFields = typeDefinition => ({
|
|
5173
5128
|
fields: {},
|
|
5174
|
-
type:
|
|
5129
|
+
type: typeDefinition?.type || {
|
|
5175
5130
|
fieldDefinitions: []
|
|
5176
5131
|
}
|
|
5177
5132
|
});
|
|
@@ -5197,7 +5152,7 @@ let CustomFieldTypeDefinitionsConnector = /*#__PURE__*/function (_Component) {
|
|
|
5197
5152
|
value: function componentDidMount() {
|
|
5198
5153
|
var _context;
|
|
5199
5154
|
const hasUnsupportedResource = _someInstanceProperty__default["default"](_context = this.props.resources).call(_context, resource => !_includesInstanceProperty__default["default"](customizableResources).call(customizableResources, resource));
|
|
5200
|
-
!!hasUnsupportedResource ? process.env.NODE_ENV !== "production" ? invariant__default["default"](false,
|
|
5155
|
+
!!hasUnsupportedResource ? process.env.NODE_ENV !== "production" ? invariant__default["default"](false, `core/components/custom-field-definitions-connector: some of the specified resources are not supported.`) : invariant__default["default"](false) : void 0;
|
|
5201
5156
|
}
|
|
5202
5157
|
}, {
|
|
5203
5158
|
key: "render",
|
|
@@ -5222,9 +5177,9 @@ CustomFieldTypeDefinitionsConnector.graphQlDocToForm = graphQlDocToForm;
|
|
|
5222
5177
|
CustomFieldTypeDefinitionsConnector.formToRestDoc = formToRestDoc;
|
|
5223
5178
|
CustomFieldTypeDefinitionsConnector.formToGraphQlDoc = formToGraphQlDoc;
|
|
5224
5179
|
CustomFieldTypeDefinitionsConnector.createEmptyCustomFields = createEmptyCustomFields;
|
|
5225
|
-
const stringifyResources = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => "
|
|
5180
|
+
const stringifyResources = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => `"${resource}"`).join();
|
|
5226
5181
|
const createGraphQlOptions = ownProps => {
|
|
5227
|
-
const where = ownProps.resources.length > 0 ?
|
|
5182
|
+
const where = ownProps.resources.length > 0 ? `resourceTypeIds contains any (${stringifyResources(ownProps.resources)})` : undefined;
|
|
5228
5183
|
return {
|
|
5229
5184
|
variables: {
|
|
5230
5185
|
where,
|
|
@@ -5300,7 +5255,7 @@ const extractDuplicatedValues = (values, type, language, languages) => {
|
|
|
5300
5255
|
let validatedValues = [];
|
|
5301
5256
|
if (type.name.toLowerCase() === 'money') {
|
|
5302
5257
|
validatedValues = unique(values, ['amount', 'currencyCode']);
|
|
5303
|
-
} else if (type.name.toLowerCase() === 'reference') validatedValues = unique(_filterInstanceProperty__default["default"](values).call(values, value => value
|
|
5258
|
+
} else if (type.name.toLowerCase() === 'reference') validatedValues = unique(_filterInstanceProperty__default["default"](values).call(values, value => value?.id), ['id']);else if (type.name.toLowerCase() === 'localizedstring') {
|
|
5304
5259
|
validatedValues = unique(values, languages);
|
|
5305
5260
|
} else validatedValues = unique(values);
|
|
5306
5261
|
return validatedValues;
|
|
@@ -5419,7 +5374,7 @@ const DraggableWrapper = _ref => {
|
|
|
5419
5374
|
children: jsxRuntime.jsxs(uiKit.Grid, {
|
|
5420
5375
|
gridTemplateColumns: '1fr 20fr',
|
|
5421
5376
|
gridTemplateRows: "auto 1fr auto",
|
|
5422
|
-
gridGap: uiKit.customProperties.
|
|
5377
|
+
gridGap: uiKit.customProperties.spacingM,
|
|
5423
5378
|
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
5424
5379
|
children: jsxRuntime.jsx(DragHandle, _objectSpread$X({}, provided.dragHandleProps))
|
|
5425
5380
|
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
@@ -5516,7 +5471,6 @@ const getSubfieldLanguage = subfieldName => {
|
|
|
5516
5471
|
return subfieldName.substring(lastDotIndex + 1);
|
|
5517
5472
|
};
|
|
5518
5473
|
function CustomLocalizedTextInput(props) {
|
|
5519
|
-
var _value$language;
|
|
5520
5474
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
5521
5475
|
language: applicationContext.dataLocale,
|
|
5522
5476
|
languages: applicationContext.project.languages
|
|
@@ -5541,7 +5495,7 @@ function CustomLocalizedTextInput(props) {
|
|
|
5541
5495
|
props.setFieldValue(props.name, nullifiedIfNeeded);
|
|
5542
5496
|
});
|
|
5543
5497
|
const InputComponent = isMultiLine ? uiKit.LocalizedMultilineTextInput : uiKit.LocalizedTextInput;
|
|
5544
|
-
const tooltipTitle = isMultiLine ? '' : value ?
|
|
5498
|
+
const tooltipTitle = isMultiLine ? '' : value ? value[language] ?? '' : '';
|
|
5545
5499
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
5546
5500
|
title: tooltipTitle,
|
|
5547
5501
|
children: jsxRuntime.jsx(InputComponent, {
|
|
@@ -5585,8 +5539,7 @@ function CustomBooleanInput(props) {
|
|
|
5585
5539
|
CustomBooleanInput.displayName = 'CustomBooleanInput';
|
|
5586
5540
|
|
|
5587
5541
|
function CustomNumberInput(props) {
|
|
5588
|
-
|
|
5589
|
-
const value = (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : '';
|
|
5542
|
+
const value = props.value ?? '';
|
|
5590
5543
|
const handleChange = makeChangeHandler(rawValue => props.setFieldValue(props.name, !rawValue ? undefined : Number(rawValue)));
|
|
5591
5544
|
return jsxRuntime.jsx(uiKit.NumberInput, {
|
|
5592
5545
|
id: props.name,
|
|
@@ -5631,7 +5584,7 @@ const fixAmount = value => {
|
|
|
5631
5584
|
// data user just entered effectively preventing full data from being entered.
|
|
5632
5585
|
const fixEnteredValue = (newValue, initialValue, currencies) => {
|
|
5633
5586
|
const withFixedCurrency = fixCurrencyCode(newValue, currencies);
|
|
5634
|
-
if (!
|
|
5587
|
+
if (!initialValue?.amount) {
|
|
5635
5588
|
return fixAmount(withFixedCurrency);
|
|
5636
5589
|
}
|
|
5637
5590
|
return withFixedCurrency;
|
|
@@ -5697,13 +5650,12 @@ const convertTypeValuesToOptions$1 = reselect.defaultMemoize((type, dataLocale,
|
|
|
5697
5650
|
key: 'label',
|
|
5698
5651
|
locale: dataLocale,
|
|
5699
5652
|
fallbackOrder: languages,
|
|
5700
|
-
fallback:
|
|
5653
|
+
fallback: `${value.key} (key)`
|
|
5701
5654
|
}),
|
|
5702
5655
|
value: value.key
|
|
5703
5656
|
}));
|
|
5704
5657
|
});
|
|
5705
5658
|
function CustomLocalizedEnumInput(props) {
|
|
5706
|
-
var _options$find$label, _options$find;
|
|
5707
5659
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
5708
5660
|
languages: applicationContext.project.languages,
|
|
5709
5661
|
dataLocale: applicationContext.dataLocale
|
|
@@ -5712,7 +5664,7 @@ function CustomLocalizedEnumInput(props) {
|
|
|
5712
5664
|
dataLocale = _useApplicationContex.dataLocale;
|
|
5713
5665
|
const options = convertTypeValuesToOptions$1(props.fieldDefinition.type, dataLocale, languages);
|
|
5714
5666
|
const handleChange = makeChangeHandler(rawValue => props.setFieldValue(props.name, rawValue));
|
|
5715
|
-
const tooltipTitle = props.value ?
|
|
5667
|
+
const tooltipTitle = props.value ? _findInstanceProperty__default["default"](options).call(options, option => option.value === props.value)?.label ?? '' : '';
|
|
5716
5668
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
5717
5669
|
title: tooltipTitle,
|
|
5718
5670
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
@@ -5732,8 +5684,7 @@ function CustomLocalizedEnumInput(props) {
|
|
|
5732
5684
|
CustomLocalizedEnumInput.displayName = 'CustomLocalizedEnumInput';
|
|
5733
5685
|
|
|
5734
5686
|
function CustomRawIdReferenceInput(props) {
|
|
5735
|
-
|
|
5736
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
5687
|
+
const value = props.value?.id || '';
|
|
5737
5688
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
5738
5689
|
title: value,
|
|
5739
5690
|
children: jsxRuntime.jsx(uiKit.TextInput, {
|
|
@@ -5778,7 +5729,7 @@ function getCategoriesByIds(apolloClient, options) {
|
|
|
5778
5729
|
return apolloClient.query({
|
|
5779
5730
|
query: FetchCategoriesByIds,
|
|
5780
5731
|
variables: {
|
|
5781
|
-
where:
|
|
5732
|
+
where: `id in (${_mapInstanceProperty__default["default"](_context2 = options.ids).call(_context2, id => `"${id}"`).join(', ')})`
|
|
5782
5733
|
},
|
|
5783
5734
|
context: {
|
|
5784
5735
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -5877,13 +5828,10 @@ const useReferenceSearchItems = _ref => {
|
|
|
5877
5828
|
};
|
|
5878
5829
|
};
|
|
5879
5830
|
function ReferenceSearch(props) {
|
|
5880
|
-
const ids = React.useMemo(() => {
|
|
5881
|
-
|
|
5882
|
-
return
|
|
5883
|
-
|
|
5884
|
-
return id;
|
|
5885
|
-
}) : [(_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.id] : [];
|
|
5886
|
-
}, [props.value, props.isMulti]);
|
|
5831
|
+
const ids = React.useMemo(() => props.value ? props.isMulti ? props.value?.map(_ref2 => {
|
|
5832
|
+
let id = _ref2.id;
|
|
5833
|
+
return id;
|
|
5834
|
+
}) : [props.value?.id] : [], [props.value, props.isMulti]);
|
|
5887
5835
|
const _useReferenceSearchIt = useReferenceSearchItems({
|
|
5888
5836
|
loadItemsBySearchTerm: props.loadItemsBySearchTerm,
|
|
5889
5837
|
loadItemsByIds: props.loadItemsByIds,
|
|
@@ -5894,14 +5842,14 @@ function ReferenceSearch(props) {
|
|
|
5894
5842
|
areSomeItemsMissing = _useReferenceSearchIt.areSomeItemsMissing,
|
|
5895
5843
|
handleLoadItems = _useReferenceSearchIt.handleLoadItems;
|
|
5896
5844
|
if (areItemsLoading) return null;
|
|
5897
|
-
const value = props.isMulti ? items : items
|
|
5845
|
+
const value = props.isMulti ? items : items?.[0];
|
|
5898
5846
|
let filterValue = null;
|
|
5899
5847
|
if (value) filterValue = props.isMulti ? _mapInstanceProperty__default["default"](value).call(value, props.mapItemToOption) : props.mapItemToOption(value);
|
|
5900
5848
|
const tooltipTitle = value || props.value ? props.mapItemToOption(value || props.value).label : '';
|
|
5901
5849
|
const loadItems = value => _Promise__default["default"].resolve(handleLoadItems(value)).then(items => _mapInstanceProperty__default["default"](items).call(items, item => props.mapItemToOption(item)));
|
|
5902
5850
|
const handleChange = event => {
|
|
5903
|
-
var _context
|
|
5904
|
-
const option = props.isMulti ? _mapInstanceProperty__default["default"](_context = event.target.value).call(_context, item => item.value) :
|
|
5851
|
+
var _context;
|
|
5852
|
+
const option = props.isMulti ? _mapInstanceProperty__default["default"](_context = event.target.value).call(_context, item => item.value) : event.target.value?.value || null;
|
|
5905
5853
|
props.onChange(option);
|
|
5906
5854
|
};
|
|
5907
5855
|
return jsxRuntime.jsxs("div", {
|
|
@@ -5972,9 +5920,8 @@ const messages$B = reactIntl.defineMessages({
|
|
|
5972
5920
|
});
|
|
5973
5921
|
|
|
5974
5922
|
function ownKeys$T(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; }
|
|
5975
|
-
function _objectSpread$T(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
5923
|
+
function _objectSpread$T(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$T(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$T(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
5976
5924
|
function Option$1(props) {
|
|
5977
|
-
var _context, _context2;
|
|
5978
5925
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
5979
5926
|
language: applicationContext.dataLocale,
|
|
5980
5927
|
languages: applicationContext.project.languages
|
|
@@ -5995,19 +5942,19 @@ function Option$1(props) {
|
|
|
5995
5942
|
fallbackOrder: languages
|
|
5996
5943
|
})
|
|
5997
5944
|
}), category.parent && jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
5998
|
-
children:
|
|
5945
|
+
children: `${formatMessage(messages$B.parentCategory)}: ${l10n.formatLocalizedString(category.parent, {
|
|
5999
5946
|
key: 'name',
|
|
6000
5947
|
locale: language,
|
|
6001
5948
|
fallbackOrder: languages
|
|
6002
|
-
})
|
|
5949
|
+
})}`
|
|
6003
5950
|
}), jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
6004
|
-
children:
|
|
5951
|
+
children: `Slug: ${l10n.formatLocalizedString(category, {
|
|
6005
5952
|
key: 'slug',
|
|
6006
5953
|
locale: language,
|
|
6007
5954
|
fallbackOrder: languages
|
|
6008
|
-
})
|
|
5955
|
+
})}`
|
|
6009
5956
|
}), category.externalId && jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
6010
|
-
children:
|
|
5957
|
+
children: `${formatMessage(messages$B.externalId)}: ${category.externalId || constants.NO_VALUE_FALLBACK}`
|
|
6011
5958
|
})]
|
|
6012
5959
|
})
|
|
6013
5960
|
}));
|
|
@@ -6070,7 +6017,7 @@ var CategorySearchPickerOptionFragment$1 = { kind: "Document", definitions: [{ k
|
|
|
6070
6017
|
function useCachedCategoryOptions(ids) {
|
|
6071
6018
|
const apolloClient = client.useApolloClient();
|
|
6072
6019
|
const fragments = _mapInstanceProperty__default["default"](ids).call(ids, id => apolloClient.readFragment({
|
|
6073
|
-
id:
|
|
6020
|
+
id: `CategorySearch:${id}`,
|
|
6074
6021
|
fragment: CategorySearchPickerOptionFragment$1
|
|
6075
6022
|
}));
|
|
6076
6023
|
return _mapInstanceProperty__default["default"](fragments).call(fragments, category => transformLocalizedFieldsForCategory(category, [{
|
|
@@ -6085,8 +6032,8 @@ function useCachedCategoryOptions(ids) {
|
|
|
6085
6032
|
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 } } } };
|
|
6086
6033
|
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 } } } };
|
|
6087
6034
|
const transformCartDiscountResponse = response => {
|
|
6088
|
-
var _context
|
|
6089
|
-
return _mapInstanceProperty__default["default"](_context =
|
|
6035
|
+
var _context;
|
|
6036
|
+
return _mapInstanceProperty__default["default"](_context = response.data?.cartDiscounts.results || []).call(_context, cartDiscount => transformLocalizedFieldsForCartDiscount(cartDiscount));
|
|
6090
6037
|
};
|
|
6091
6038
|
function queryCartDiscounts(apolloClient) {
|
|
6092
6039
|
return apolloClient.query({
|
|
@@ -6098,14 +6045,14 @@ function queryCartDiscounts(apolloClient) {
|
|
|
6098
6045
|
}).then(transformCartDiscountResponse);
|
|
6099
6046
|
}
|
|
6100
6047
|
const getWhereClause = function () {
|
|
6101
|
-
var _context2, _context3
|
|
6048
|
+
var _context2, _context3;
|
|
6102
6049
|
let searchText = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
6103
6050
|
let language = arguments.length > 1 ? arguments[1] : undefined;
|
|
6104
6051
|
const query = _trimInstanceProperty__default["default"](_context2 = _JSON$stringify__default["default"](searchText)).call(_context2);
|
|
6105
|
-
const idQuery = isUUID(searchText) &&
|
|
6106
|
-
const nameQuery =
|
|
6107
|
-
const keyQuery =
|
|
6108
|
-
return _filterInstanceProperty__default["default"](
|
|
6052
|
+
const idQuery = isUUID(searchText) && `id = ${query}`;
|
|
6053
|
+
const nameQuery = `name(${language} = ${query})`;
|
|
6054
|
+
const keyQuery = `key = ${query}`;
|
|
6055
|
+
return _filterInstanceProperty__default["default"](_context3 = [idQuery, nameQuery, keyQuery]).call(_context3, Boolean).join(' or ');
|
|
6109
6056
|
};
|
|
6110
6057
|
function searchCartDiscountsByExactMatch(apolloClient, options) {
|
|
6111
6058
|
return apolloClient.query({
|
|
@@ -6128,10 +6075,7 @@ function getCartDiscountById(apolloClient, options) {
|
|
|
6128
6075
|
context: {
|
|
6129
6076
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
6130
6077
|
}
|
|
6131
|
-
}).then(response =>
|
|
6132
|
-
var _response$data2;
|
|
6133
|
-
return (_response$data2 = response.data) !== null && _response$data2 !== void 0 && _response$data2.cartDiscount ? transformLocalizedFieldsForCartDiscount(response.data.cartDiscount) : null;
|
|
6134
|
-
});
|
|
6078
|
+
}).then(response => response.data?.cartDiscount ? transformLocalizedFieldsForCartDiscount(response.data.cartDiscount) : null);
|
|
6135
6079
|
}
|
|
6136
6080
|
|
|
6137
6081
|
const messages$A = reactIntl.defineMessages({
|
|
@@ -6208,7 +6152,7 @@ function CartDiscountReferenceSearch(props) {
|
|
|
6208
6152
|
}),
|
|
6209
6153
|
loading = _useQuery.loading,
|
|
6210
6154
|
data = _useQuery.data;
|
|
6211
|
-
const isExactMatch =
|
|
6155
|
+
const isExactMatch = data?.cartDiscounts.total > QUERY_MAX_LIMIT;
|
|
6212
6156
|
const _useIntl = reactIntl.useIntl(),
|
|
6213
6157
|
formatMessage = _useIntl.formatMessage;
|
|
6214
6158
|
const apolloClient = client.useApolloClient();
|
|
@@ -6345,7 +6289,6 @@ const DropdownIndicator = () => jsxRuntime.jsx(uiKit.SearchIcon, {
|
|
|
6345
6289
|
});
|
|
6346
6290
|
DropdownIndicator.displayName = 'DropdownIndicator';
|
|
6347
6291
|
const ProductPickerInput = _ref => {
|
|
6348
|
-
var _currentOption$data$l, _currentOption$data;
|
|
6349
6292
|
let isClearable = _ref.isClearable,
|
|
6350
6293
|
isDisabled = _ref.isDisabled,
|
|
6351
6294
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -6365,20 +6308,19 @@ const ProductPickerInput = _ref => {
|
|
|
6365
6308
|
loadingError = _useState2[0],
|
|
6366
6309
|
setLoadingError = _useState2[1];
|
|
6367
6310
|
const convertProductToOption = React.useCallback(product => {
|
|
6368
|
-
var _masterData$current;
|
|
6369
6311
|
if (!product) return null;
|
|
6370
6312
|
const id = product.id,
|
|
6371
6313
|
key = product.key,
|
|
6372
6314
|
masterData = product.masterData;
|
|
6373
|
-
const localizedName = formatLocalizedFieldToString(
|
|
6315
|
+
const localizedName = formatLocalizedFieldToString(masterData.current?.nameAllLocales);
|
|
6374
6316
|
return {
|
|
6375
|
-
label: localizedName + (key ?
|
|
6317
|
+
label: localizedName + (key ? ` (key: ${key})` : ''),
|
|
6376
6318
|
value: id,
|
|
6377
6319
|
name: localizedName,
|
|
6378
6320
|
key
|
|
6379
6321
|
};
|
|
6380
6322
|
}, [formatLocalizedFieldToString]);
|
|
6381
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
6323
|
+
const prefixSearchFields = React.useMemo(() => [`masterData.current.name.${dataLocale}`, 'key'], [dataLocale]);
|
|
6382
6324
|
const loadOptions = useLoadOptions({
|
|
6383
6325
|
query: GetProductsQuery,
|
|
6384
6326
|
prefixSearchFields
|
|
@@ -6409,12 +6351,12 @@ const ProductPickerInput = _ref => {
|
|
|
6409
6351
|
setLoadingError(null);
|
|
6410
6352
|
handleInternalInputChange(event);
|
|
6411
6353
|
}, [handleInternalInputChange]);
|
|
6412
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
6354
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
6413
6355
|
React.useEffect(() => {
|
|
6414
6356
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
6415
6357
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
6416
6358
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
6417
|
-
const tooltipTitle =
|
|
6359
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
6418
6360
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
6419
6361
|
max: "scale",
|
|
6420
6362
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -6451,8 +6393,7 @@ const ProductPickerInput = _ref => {
|
|
|
6451
6393
|
ProductPickerInput.displayName = 'ProductPickerInput';
|
|
6452
6394
|
|
|
6453
6395
|
function CustomProductReferenceInput(props) {
|
|
6454
|
-
|
|
6455
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6396
|
+
const value = props.value?.id || '';
|
|
6456
6397
|
return jsxRuntime.jsx(ProductPickerInput, {
|
|
6457
6398
|
value: value,
|
|
6458
6399
|
name: props.name,
|
|
@@ -6469,8 +6410,7 @@ function CustomProductReferenceInput(props) {
|
|
|
6469
6410
|
CustomProductReferenceInput.displayName = 'CustomProductReferenceInput';
|
|
6470
6411
|
|
|
6471
6412
|
function CustomProductTypeReferenceInput(props) {
|
|
6472
|
-
|
|
6473
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6413
|
+
const value = props.value?.id || '';
|
|
6474
6414
|
return jsxRuntime.jsx(ProductTypePickerInput, {
|
|
6475
6415
|
value: value,
|
|
6476
6416
|
name: props.name,
|
|
@@ -6486,8 +6426,7 @@ function CustomProductTypeReferenceInput(props) {
|
|
|
6486
6426
|
CustomProductTypeReferenceInput.displayName = 'CustomProductTypeReferenceInput';
|
|
6487
6427
|
|
|
6488
6428
|
function CustomChannelReferenceInput(props) {
|
|
6489
|
-
|
|
6490
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6429
|
+
const value = props.value?.id || '';
|
|
6491
6430
|
return jsxRuntime.jsx(ChannelPickerInput, {
|
|
6492
6431
|
value: value,
|
|
6493
6432
|
name: props.name,
|
|
@@ -6503,8 +6442,7 @@ function CustomChannelReferenceInput(props) {
|
|
|
6503
6442
|
CustomChannelReferenceInput.displayName = 'CustomChannelReferenceInput';
|
|
6504
6443
|
|
|
6505
6444
|
function CustomStateReferenceInput(props) {
|
|
6506
|
-
|
|
6507
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6445
|
+
const value = props.value?.id || '';
|
|
6508
6446
|
return jsxRuntime.jsx(StatePickerInput, {
|
|
6509
6447
|
value: value,
|
|
6510
6448
|
name: props.name,
|
|
@@ -6613,14 +6551,13 @@ function CustomTimeInput(props) {
|
|
|
6613
6551
|
CustomTimeInput.displayName = 'CustomTimeInput';
|
|
6614
6552
|
|
|
6615
6553
|
const convertTypeValuesToOptions = reselect.defaultMemoize(typeValues => _mapInstanceProperty__default["default"](typeValues).call(typeValues, typeValue => ({
|
|
6616
|
-
label: typeValue.label ||
|
|
6554
|
+
label: typeValue.label || `${typeValue.key} (key)`,
|
|
6617
6555
|
value: typeValue.key
|
|
6618
6556
|
})));
|
|
6619
6557
|
function CustomEnumInput(props) {
|
|
6620
|
-
var _options$find$label, _options$find;
|
|
6621
6558
|
const options = convertTypeValuesToOptions(_valuesInstanceProperty__default["default"](props.fieldDefinition.type));
|
|
6622
6559
|
const handleChange = makeChangeHandler(rawValue => props.setFieldValue(props.name, rawValue));
|
|
6623
|
-
const tooltipTitle = props.value ?
|
|
6560
|
+
const tooltipTitle = props.value ? _findInstanceProperty__default["default"](options).call(options, option => option.value === props.value)?.label ?? '' : '';
|
|
6624
6561
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
6625
6562
|
title: tooltipTitle,
|
|
6626
6563
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
@@ -6692,9 +6629,9 @@ function ownKeys$P(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
6692
6629
|
function _objectSpread$P(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$P(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$P(Object(t))).call(_context8, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
6693
6630
|
const getTypeName = type => type.name.toLowerCase();
|
|
6694
6631
|
const findLabel = (enumType, key) => {
|
|
6695
|
-
var
|
|
6632
|
+
var _context;
|
|
6696
6633
|
const emptyValue = getTypeName(enumType) === 'enum' ? '' : {};
|
|
6697
|
-
return
|
|
6634
|
+
return _findInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](enumType)).call(_context, value => value.key === key)?.label ?? emptyValue;
|
|
6698
6635
|
};
|
|
6699
6636
|
const convertEnumValues = (value, attributeDefinition) => {
|
|
6700
6637
|
var _context2, _context3;
|
|
@@ -6758,7 +6695,7 @@ const attributesMapToNameValuePairs = map => {
|
|
|
6758
6695
|
|
|
6759
6696
|
const getAttributeShortName = (fullName, attributesPrefix) => {
|
|
6760
6697
|
if (!attributesPrefix) return fullName;
|
|
6761
|
-
return fullName.replace(
|
|
6698
|
+
return fullName.replace(`${attributesPrefix}.`, '');
|
|
6762
6699
|
};
|
|
6763
6700
|
function ProductAttributes(props) {
|
|
6764
6701
|
const formik$1 = formik.useFormikContext();
|
|
@@ -6840,19 +6777,19 @@ function ownKeys$O(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
6840
6777
|
function _objectSpread$O(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$O(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$O(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
6841
6778
|
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 } } } };
|
|
6842
6779
|
const mapAttributeDefinition = definition => {
|
|
6843
|
-
var _context,
|
|
6780
|
+
var _context, _context2, _context3, _context4;
|
|
6844
6781
|
return _objectSpread$O(_objectSpread$O({}, definition), {}, {
|
|
6845
6782
|
required: definition.isRequired,
|
|
6846
6783
|
inputTip: l10n.transformLocalizedFieldToLocalizedString(definition.inputTipAllLocales),
|
|
6847
6784
|
label: l10n.transformLocalizedFieldToLocalizedString(definition.labelAllLocales),
|
|
6848
|
-
type: _includesInstanceProperty__default["default"](_context = ['enum', 'lenum']).call(_context,
|
|
6785
|
+
type: _includesInstanceProperty__default["default"](_context = ['enum', 'lenum']).call(_context, definition.type?.elementType?.name) ? _objectSpread$O(_objectSpread$O({}, definition.type), {}, {
|
|
6849
6786
|
elementType: _objectSpread$O(_objectSpread$O({}, definition.type.elementType), {}, {
|
|
6850
6787
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](definition.type.elementType).results).call(_context2, value => ({
|
|
6851
6788
|
key: value.key,
|
|
6852
6789
|
label: value.label || l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
6853
6790
|
}))
|
|
6854
6791
|
})
|
|
6855
|
-
}) : _includesInstanceProperty__default["default"](_context3 = ['enum', 'lenum']).call(_context3,
|
|
6792
|
+
}) : _includesInstanceProperty__default["default"](_context3 = ['enum', 'lenum']).call(_context3, definition.type?.name) ? _objectSpread$O(_objectSpread$O({}, definition.type), {}, {
|
|
6856
6793
|
values: _mapInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](definition.type).results).call(_context4, value => ({
|
|
6857
6794
|
key: value.key,
|
|
6858
6795
|
label: value.label || l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -7175,15 +7112,21 @@ CustomNestedInput.displayName = 'CustomNestedInput';
|
|
|
7175
7112
|
|
|
7176
7113
|
var styles$d = {
|
|
7177
7114
|
"divider": "divider-module__divider___4-vdy",
|
|
7115
|
+
"divider-horizontal": "divider-module__divider-horizontal___RuUcj",
|
|
7116
|
+
"divider-vertical": "divider-module__divider-vertical___32kJG",
|
|
7178
7117
|
"divider-solid": "divider-module__divider-solid___3Fs4q divider-module__divider___4-vdy",
|
|
7179
7118
|
"divider-dashed": "divider-module__divider-dashed___2Em8A divider-module__divider___4-vdy"
|
|
7180
7119
|
};
|
|
7181
7120
|
function Divider(_ref) {
|
|
7182
|
-
let isDashed = _ref.isDashed
|
|
7121
|
+
let isDashed = _ref.isDashed,
|
|
7122
|
+
_ref$orientation = _ref.orientation,
|
|
7123
|
+
orientation = _ref$orientation === void 0 ? 'horizontal' : _ref$orientation;
|
|
7183
7124
|
return jsxRuntime.jsx("hr", {
|
|
7184
7125
|
className: classnames__default["default"]({
|
|
7185
7126
|
[styles$d['divider-solid']]: !isDashed,
|
|
7186
|
-
[styles$d['divider-dashed']]: isDashed
|
|
7127
|
+
[styles$d['divider-dashed']]: isDashed,
|
|
7128
|
+
[styles$d['divider-horizontal']]: orientation === 'horizontal',
|
|
7129
|
+
[styles$d['divider-vertical']]: orientation === 'vertical'
|
|
7187
7130
|
})
|
|
7188
7131
|
});
|
|
7189
7132
|
}
|
|
@@ -7197,7 +7140,7 @@ const ExpandButton = props => props.totalValues > 1 ? jsxRuntime.jsxs(uiKit.Spac
|
|
|
7197
7140
|
}), jsxRuntime.jsx(uiKit.FlatButton, {
|
|
7198
7141
|
tone: "primary",
|
|
7199
7142
|
icon: props.isExpanded ? jsxRuntime.jsx(uiKit.AngleUpIcon, {}) : jsxRuntime.jsx(uiKit.AngleDownIcon, {}),
|
|
7200
|
-
label: props.isExpanded ?
|
|
7143
|
+
label: props.isExpanded ? `Hide set items (${props.totalValues})` : `Show all set items (${props.totalValues})`,
|
|
7201
7144
|
onClick: props.onExpand
|
|
7202
7145
|
})]
|
|
7203
7146
|
}) : null;
|
|
@@ -7232,7 +7175,7 @@ const SetButtons = props => {
|
|
|
7232
7175
|
SetButtons.displayName = 'SetButtons';
|
|
7233
7176
|
|
|
7234
7177
|
function ownKeys$M(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; }
|
|
7235
|
-
function _objectSpread$M(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
7178
|
+
function _objectSpread$M(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$M(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$M(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
7236
7179
|
const getDuplicateErrors = setValues => {
|
|
7237
7180
|
/* eslint-disable no-plusplus */
|
|
7238
7181
|
const result = [];
|
|
@@ -7273,13 +7216,10 @@ const getItemIndex = name => {
|
|
|
7273
7216
|
return _parseInt__default["default"](rawIndex, 10);
|
|
7274
7217
|
};
|
|
7275
7218
|
const makeKeys = amount => times__default["default"](amount, () => uuid.v4());
|
|
7276
|
-
const makeItemFieldName = (fieldName, index) => {
|
|
7277
|
-
var _context;
|
|
7278
|
-
return _concatInstanceProperty__default["default"](_context = "".concat(fieldName, ".[")).call(_context, index, "]");
|
|
7279
|
-
};
|
|
7219
|
+
const makeItemFieldName = (fieldName, index) => `${fieldName}.[${index}]`;
|
|
7280
7220
|
const makeMapForAllItems = (fieldName, items, value) => _reduceInstanceProperty__default["default"](items).call(items, (result, item, index) => set__default["default"](result, makeItemFieldName(fieldName, index), value), {});
|
|
7281
7221
|
function CustomInputSet(props) {
|
|
7282
|
-
var
|
|
7222
|
+
var _context;
|
|
7283
7223
|
const _useToggleState = uiKit.useToggleState(false),
|
|
7284
7224
|
_useToggleState2 = _slicedToArray(_useToggleState, 2),
|
|
7285
7225
|
isExpanded = _useToggleState2[0],
|
|
@@ -7301,7 +7241,7 @@ function CustomInputSet(props) {
|
|
|
7301
7241
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
7302
7242
|
keys = _useState4[0],
|
|
7303
7243
|
setKeys = _useState4[1];
|
|
7304
|
-
const totalAmount = internalValue
|
|
7244
|
+
const totalAmount = internalValue?.length;
|
|
7305
7245
|
const amountToRender = isExpanded ? totalAmount : 1;
|
|
7306
7246
|
const updateInternalValue = newValue => {
|
|
7307
7247
|
const valueToSet = isEmpty$1(newValue) ? [undefined] : newValue;
|
|
@@ -7348,8 +7288,8 @@ function CustomInputSet(props) {
|
|
|
7348
7288
|
// in <CustomFieldComponent /> where proper component for given field/attribute
|
|
7349
7289
|
// type is selected.
|
|
7350
7290
|
const type = getType(props.fieldDefinition);
|
|
7351
|
-
const typeName = type
|
|
7352
|
-
const areButtonsTopAligned = _includesInstanceProperty__default["default"](
|
|
7291
|
+
const typeName = type?.name.toLowerCase();
|
|
7292
|
+
const areButtonsTopAligned = _includesInstanceProperty__default["default"](_context = [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(_context, typeName);
|
|
7353
7293
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
7354
7294
|
children: [jsxRuntime.jsx(uiKit.AccessibleHidden, {
|
|
7355
7295
|
children: jsxRuntime.jsx("label", {
|
|
@@ -7427,14 +7367,12 @@ const nonSetComponents = {
|
|
|
7427
7367
|
};
|
|
7428
7368
|
const CustomFieldInput = /*#__PURE__*/React.memo(props => {
|
|
7429
7369
|
const InputComponent = React.useMemo(() => {
|
|
7430
|
-
|
|
7431
|
-
const typeName = (_props$fieldDefinitio = props.fieldDefinition.type) === null || _props$fieldDefinitio === void 0 ? void 0 : _props$fieldDefinitio.name.toLowerCase();
|
|
7370
|
+
const typeName = props.fieldDefinition.type?.name.toLowerCase();
|
|
7432
7371
|
if (typeName === 'set') {
|
|
7433
|
-
var _getSetElementType;
|
|
7434
7372
|
// Boolean is the only set element with peculiarities (i.e. way more
|
|
7435
7373
|
// convenient for user to work with it as with select input with three values:
|
|
7436
7374
|
// [true], [false] and [true, false]).
|
|
7437
|
-
if (
|
|
7375
|
+
if (getType(props.fieldDefinition)?.name.toLowerCase() === CUSTOM_FIELD_TYPES.boolean) {
|
|
7438
7376
|
return CustomBooleanInputSet;
|
|
7439
7377
|
}
|
|
7440
7378
|
// All the rest sets are just a fancy wrapper around single-item components
|
|
@@ -7525,9 +7463,9 @@ const CustomFieldErrors = props => {
|
|
|
7525
7463
|
const didFormValidationFail = useDidFormValidationFail();
|
|
7526
7464
|
const errors = _Array$isArray__default["default"](props.errors) ? mergeSetItemsErrors(props.errors) : props.errors;
|
|
7527
7465
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
7528
|
-
children: [props.isTouched || didFormValidationFail &&
|
|
7466
|
+
children: [props.isTouched || didFormValidationFail && errors?.missing && jsxRuntime.jsx(_.ErrorMessage, {
|
|
7529
7467
|
intlMessage: messages$K.required
|
|
7530
|
-
}), props.isTouched || didFormValidationFail &&
|
|
7468
|
+
}), props.isTouched || didFormValidationFail && errors?.duplicated && jsxRuntime.jsx(_.ErrorMessage, {
|
|
7531
7469
|
intlMessage: messages$K.unique
|
|
7532
7470
|
})]
|
|
7533
7471
|
});
|
|
@@ -7577,10 +7515,9 @@ function _objectSpread$J(e) { for (var r = 1; r < arguments.length; r++) { var _
|
|
|
7577
7515
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
7578
7516
|
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 } } } };
|
|
7579
7517
|
const CustomFieldsLabelHint = _ref2 => {
|
|
7580
|
-
var _type$name;
|
|
7581
7518
|
let fieldDefinition = _ref2.fieldDefinition;
|
|
7582
7519
|
const type = getType(fieldDefinition);
|
|
7583
|
-
const isReference =
|
|
7520
|
+
const isReference = type.name?.toLowerCase() === 'reference';
|
|
7584
7521
|
const referenceTypeId = type.referenceTypeId;
|
|
7585
7522
|
const isCartDiscountsReference = isReference && referenceTypeId === SEARCHABLE_REFERENCES.cartDiscount;
|
|
7586
7523
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
@@ -7598,7 +7535,7 @@ const CustomFieldsLabelHint = _ref2 => {
|
|
|
7598
7535
|
data = _useQuery.data,
|
|
7599
7536
|
loading = _useQuery.loading;
|
|
7600
7537
|
if (loading) return null;
|
|
7601
|
-
if (
|
|
7538
|
+
if (data?.cartDiscounts.total > QUERY_MAX_LIMIT) {
|
|
7602
7539
|
return jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
7603
7540
|
alignItems: "center",
|
|
7604
7541
|
children: [jsxRuntime.jsx(uiKit.WarningIcon, {
|
|
@@ -7625,17 +7562,17 @@ function CustomFieldsProductTypeReferenceSubtitle() {
|
|
|
7625
7562
|
// TODO(pa3): this logic may be misplaced and probably
|
|
7626
7563
|
// should belong to <CustomReferenceInput /> component instead.
|
|
7627
7564
|
function CustomFieldsLabelSubtitle(_ref3) {
|
|
7628
|
-
var
|
|
7565
|
+
var _context;
|
|
7629
7566
|
let fieldDefinition = _ref3.fieldDefinition;
|
|
7630
7567
|
const _useIntl2 = reactIntl.useIntl(),
|
|
7631
7568
|
formatMessage = _useIntl2.formatMessage;
|
|
7632
7569
|
const type = getType(fieldDefinition);
|
|
7633
|
-
const isReference =
|
|
7570
|
+
const isReference = type.name?.toLowerCase() === 'reference';
|
|
7634
7571
|
if (!isReference) return null;
|
|
7635
7572
|
const referenceTypeId = type.referenceTypeId;
|
|
7636
7573
|
const referenceTypeName = capitalizeFirst(referenceTypeId);
|
|
7637
7574
|
if (_includesInstanceProperty__default["default"](_context = [SEARCHABLE_REFERENCES.category, SEARCHABLE_REFERENCES.cartDiscount]).call(_context, referenceTypeId)) return referenceTypeName;
|
|
7638
|
-
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) :
|
|
7575
|
+
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) : `${referenceTypeName} ID`;
|
|
7639
7576
|
}
|
|
7640
7577
|
const Portal = props => /*#__PURE__*/ReactDOM__default["default"].createPortal(props.children, document.body);
|
|
7641
7578
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
@@ -7652,7 +7589,7 @@ function CustomFieldsCountIndicator(_ref4) {
|
|
|
7652
7589
|
const formatLocalizedField = useFormatLocalizedFieldToString();
|
|
7653
7590
|
const _useIntl3 = reactIntl.useIntl(),
|
|
7654
7591
|
formatMessage = _useIntl3.formatMessage;
|
|
7655
|
-
return
|
|
7592
|
+
return assignedAttributeGroups?.length > 1 ? jsxRuntime.jsx(uiKit.Tooltip, {
|
|
7656
7593
|
title: formatMessage(messages$v.attributeGroupCountTooltip, {
|
|
7657
7594
|
attributeGroups: _mapInstanceProperty__default["default"](assignedAttributeGroups).call(assignedAttributeGroups, assignedAttributeGroup => formatLocalizedField(assignedAttributeGroup.nameAllLocales)).join(', '),
|
|
7658
7595
|
count: assignedAttributeGroups.length
|
|
@@ -7710,9 +7647,8 @@ const CustomFieldsLabel = /*#__PURE__*/React.memo(_ref5 => {
|
|
|
7710
7647
|
CustomFieldsLabel.displayName = 'CustomFieldsTitle';
|
|
7711
7648
|
|
|
7712
7649
|
const getFieldName = (parentName, fieldName) => {
|
|
7713
|
-
var _context;
|
|
7714
7650
|
if (!parentName) return fieldName;
|
|
7715
|
-
return
|
|
7651
|
+
return `${parentName}.${fieldName}`;
|
|
7716
7652
|
};
|
|
7717
7653
|
const isNested = fieldDefinition => {
|
|
7718
7654
|
const type = fieldDefinition.type;
|
|
@@ -7737,7 +7673,6 @@ const CustomFieldsInternal = props => {
|
|
|
7737
7673
|
isDragAndDropMode = _useDnDContext.isDragAndDropMode;
|
|
7738
7674
|
return jsxRuntime.jsx(DroppableWrapper, {
|
|
7739
7675
|
children: _mapInstanceProperty__default["default"](fieldDefinitions).call(fieldDefinitions, (fieldDefinition, index) => {
|
|
7740
|
-
var _context2;
|
|
7741
7676
|
const fieldName = getFieldName(props.name, fieldDefinition.name);
|
|
7742
7677
|
const isTouched = Boolean(formik.getIn(touched, fieldName));
|
|
7743
7678
|
const fieldErrors = formik.getIn(errors, fieldName);
|
|
@@ -7754,51 +7689,48 @@ const CustomFieldsInternal = props => {
|
|
|
7754
7689
|
return jsxRuntime.jsx(formik.FastField, {
|
|
7755
7690
|
name: fieldName,
|
|
7756
7691
|
validate: validate,
|
|
7757
|
-
children: () => {
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
children: jsxRuntime.
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7692
|
+
children: () => jsxRuntime.jsx(DraggableWrapper, {
|
|
7693
|
+
draggableKey: `${fieldName}-${index}`,
|
|
7694
|
+
draggableId: `${fieldName}-${index}`,
|
|
7695
|
+
index: index,
|
|
7696
|
+
children: jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
7697
|
+
scale: "xs",
|
|
7698
|
+
children: jsxRuntime.jsxs("div", {
|
|
7699
|
+
"aria-invalid": _Object$keys__default["default"](fieldErrors ?? {}).length > 0,
|
|
7700
|
+
"aria-errormessage": `${fieldName}-error`,
|
|
7701
|
+
id: `${fieldName}-error`,
|
|
7702
|
+
children: [jsxRuntime.jsx(CustomFieldsLabel, {
|
|
7703
|
+
name: fieldName,
|
|
7704
|
+
fieldDefinition: fieldDefinition
|
|
7705
|
+
}), jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
7706
|
+
scale: "xs",
|
|
7707
|
+
alignItems: "stretch",
|
|
7708
|
+
children: [isNested(fieldDefinition) ? jsxRuntime.jsx(CustomNestedFieldInput, {
|
|
7709
|
+
name: fieldName,
|
|
7710
|
+
value: value,
|
|
7711
|
+
fieldDefinition: fieldDefinition,
|
|
7712
|
+
isDisabled: props.isDisabled || isDragAndDropMode,
|
|
7713
|
+
isReadOnly: props.isReadOnly,
|
|
7714
|
+
onBlur: handleBlur,
|
|
7715
|
+
setFieldValue: props.setFieldValue
|
|
7716
|
+
}) : jsxRuntime.jsx(CustomFieldInput, {
|
|
7770
7717
|
name: fieldName,
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
onBlur: handleBlur,
|
|
7782
|
-
setFieldValue: props.setFieldValue
|
|
7783
|
-
}) : jsxRuntime.jsx(CustomFieldInput, {
|
|
7784
|
-
name: fieldName,
|
|
7785
|
-
value: value,
|
|
7786
|
-
fieldDefinition: fieldDefinition,
|
|
7787
|
-
isDisabled: props.isDisabled || isDragAndDropMode,
|
|
7788
|
-
isReadOnly: props.isReadOnly,
|
|
7789
|
-
onBlur: handleBlur,
|
|
7790
|
-
setFieldValue: props.setFieldValue,
|
|
7791
|
-
hasError: hasError
|
|
7792
|
-
}), jsxRuntime.jsx(CustomFieldErrors, {
|
|
7793
|
-
isTouched: isTouched,
|
|
7794
|
-
errors: fieldErrors
|
|
7795
|
-
})]
|
|
7718
|
+
value: value,
|
|
7719
|
+
fieldDefinition: fieldDefinition,
|
|
7720
|
+
isDisabled: props.isDisabled || isDragAndDropMode,
|
|
7721
|
+
isReadOnly: props.isReadOnly,
|
|
7722
|
+
onBlur: handleBlur,
|
|
7723
|
+
setFieldValue: props.setFieldValue,
|
|
7724
|
+
hasError: hasError
|
|
7725
|
+
}), jsxRuntime.jsx(CustomFieldErrors, {
|
|
7726
|
+
isTouched: isTouched,
|
|
7727
|
+
errors: fieldErrors
|
|
7796
7728
|
})]
|
|
7797
|
-
})
|
|
7729
|
+
})]
|
|
7798
7730
|
})
|
|
7799
|
-
})
|
|
7800
|
-
}
|
|
7801
|
-
},
|
|
7731
|
+
})
|
|
7732
|
+
})
|
|
7733
|
+
}, `${fieldName}-${index}`);
|
|
7802
7734
|
})
|
|
7803
7735
|
});
|
|
7804
7736
|
};
|
|
@@ -7854,7 +7786,7 @@ var pickerMessages = reactIntl.defineMessages({
|
|
|
7854
7786
|
});
|
|
7855
7787
|
|
|
7856
7788
|
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; }
|
|
7857
|
-
function _objectSpread$I(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
7789
|
+
function _objectSpread$I(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$I(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$I(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
7858
7790
|
const PRODUCT_SELECTION_MODES = {
|
|
7859
7791
|
INCLUSION: 'Individual',
|
|
7860
7792
|
EXCLUSION: 'IndividualExclusion'
|
|
@@ -7865,11 +7797,10 @@ const PRODUCT_SELECTION_MODES_LABELS = {
|
|
|
7865
7797
|
};
|
|
7866
7798
|
const getMode = mode => mode === PRODUCT_SELECTION_MODES.INCLUSION || mode === PRODUCT_SELECTION_MODES_LABELS.INCLUSION ? 'inclusion' : 'exclusion';
|
|
7867
7799
|
const addModeToLabel = function (ps) {
|
|
7868
|
-
var _context;
|
|
7869
7800
|
let enableExcludingProducts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
7870
7801
|
if (!ps) return undefined;
|
|
7871
7802
|
return _objectSpread$I(_objectSpread$I({}, ps), {}, {
|
|
7872
|
-
label:
|
|
7803
|
+
label: `${ps?.label}${enableExcludingProducts ? ` (type: ${getMode(ps?.mode)})` : ''}`
|
|
7873
7804
|
});
|
|
7874
7805
|
};
|
|
7875
7806
|
|
|
@@ -7881,7 +7812,6 @@ const mapProductSelectionsToOptions$1 = memoize__default["default"](function ()
|
|
|
7881
7812
|
let enableExcludingProducts = arguments.length > 4 ? arguments[4] : undefined;
|
|
7882
7813
|
const selectedPSList = _Array$isArray__default["default"](selectedPS) ? selectedPS : [selectedPS];
|
|
7883
7814
|
return _mapInstanceProperty__default["default"](productSelections).call(productSelections, productSelection => {
|
|
7884
|
-
var _context;
|
|
7885
7815
|
const label = l10n.formatLocalizedString(productSelection, {
|
|
7886
7816
|
key: 'name',
|
|
7887
7817
|
locale: dataLocale,
|
|
@@ -7890,14 +7820,13 @@ const mapProductSelectionsToOptions$1 = memoize__default["default"](function ()
|
|
|
7890
7820
|
return {
|
|
7891
7821
|
id: productSelection.id,
|
|
7892
7822
|
value: productSelection.id,
|
|
7893
|
-
label:
|
|
7823
|
+
label: `${label}${_includesInstanceProperty__default["default"](selectedPSList).call(selectedPSList, productSelection.id) && enableExcludingProducts ? ` (type: ${getMode(productSelection.mode)})` : ''}`,
|
|
7894
7824
|
key: productSelection.key,
|
|
7895
7825
|
mode: getMode(productSelection.mode)
|
|
7896
7826
|
};
|
|
7897
7827
|
});
|
|
7898
7828
|
});
|
|
7899
7829
|
function ProductSelectionBasicSelectDropdown(props) {
|
|
7900
|
-
var _productSelectionsFet, _productSelectionsFet2;
|
|
7901
7830
|
const intl = reactIntl.useIntl();
|
|
7902
7831
|
const enableExcludingProducts = applicationShell.useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
7903
7832
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -7910,10 +7839,10 @@ function ProductSelectionBasicSelectDropdown(props) {
|
|
|
7910
7839
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
7911
7840
|
dataLocale = _useApplicationContex.dataLocale;
|
|
7912
7841
|
if (productSelectionsFetcher.isLoading) return jsxRuntime.jsx(CenteredLoadingSpinner, {});
|
|
7913
|
-
const productSelections =
|
|
7842
|
+
const productSelections = productSelectionsFetcher.productSelections?.results ?? [];
|
|
7914
7843
|
const filteredProductSelections = _filterInstanceProperty__default["default"](productSelections).call(productSelections, ps => {
|
|
7915
|
-
var
|
|
7916
|
-
return !_includesInstanceProperty__default["default"](
|
|
7844
|
+
var _context;
|
|
7845
|
+
return !_includesInstanceProperty__default["default"](_context = props.excludedProductSelectionIds).call(_context, ps.id);
|
|
7917
7846
|
});
|
|
7918
7847
|
const onOptionClick = event => {
|
|
7919
7848
|
const productSelectionId = event.target.value;
|
|
@@ -7962,7 +7891,7 @@ const getValueFromOptions$3 = _ref => {
|
|
|
7962
7891
|
// handle async-select-field value transformation
|
|
7963
7892
|
if (isMulti) {
|
|
7964
7893
|
var _context;
|
|
7965
|
-
return _mapInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](allProductSelectionOptions).call(allProductSelectionOptions, ps => currentlySelectedProductSelections
|
|
7894
|
+
return _mapInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](allProductSelectionOptions).call(allProductSelectionOptions, ps => currentlySelectedProductSelections?.includes(ps.value))).call(_context, ps => addModeToLabel(ps, enableExcludingProducts));
|
|
7966
7895
|
}
|
|
7967
7896
|
|
|
7968
7897
|
// in case it is not multiselect, then a single valued async-select-input is being requested and the value should have proper format
|
|
@@ -7974,7 +7903,6 @@ const emptyStoreOption$1 = intl => [{
|
|
|
7974
7903
|
isDisabled: true
|
|
7975
7904
|
}];
|
|
7976
7905
|
function ProductSelectionsAsyncSelectDropdown(props) {
|
|
7977
|
-
var _productSelectionsFet3;
|
|
7978
7906
|
const intl = reactIntl.useIntl();
|
|
7979
7907
|
const enableExcludingProducts = applicationShell.useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
7980
7908
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -7987,17 +7915,13 @@ function ProductSelectionsAsyncSelectDropdown(props) {
|
|
|
7987
7915
|
})),
|
|
7988
7916
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
7989
7917
|
dataLocale = _useApplicationContex.dataLocale;
|
|
7990
|
-
const productSelections = React.useMemo(() =>
|
|
7991
|
-
var _productSelectionsFet, _productSelectionsFet2;
|
|
7992
|
-
return (_productSelectionsFet = (_productSelectionsFet2 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet2 === void 0 ? void 0 : _productSelectionsFet2.results) !== null && _productSelectionsFet !== void 0 ? _productSelectionsFet : [];
|
|
7993
|
-
}, [(_productSelectionsFet3 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet3 === void 0 ? void 0 : _productSelectionsFet3.results]);
|
|
7918
|
+
const productSelections = React.useMemo(() => productSelectionsFetcher.productSelections?.results ?? [], [productSelectionsFetcher.productSelections?.results]);
|
|
7994
7919
|
const filteredProductSelections = _filterInstanceProperty__default["default"](productSelections).call(productSelections, ps => {
|
|
7995
7920
|
var _context2;
|
|
7996
7921
|
return !_includesInstanceProperty__default["default"](_context2 = props.excludedProductSelectionIds).call(_context2, ps.id);
|
|
7997
7922
|
});
|
|
7998
7923
|
const onOptionClick = event => {
|
|
7999
|
-
|
|
8000
|
-
const productSelectionId = (_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.value;
|
|
7924
|
+
const productSelectionId = event.target.value?.value;
|
|
8001
7925
|
const currentProductSelection = _findInstanceProperty__default["default"](productSelections).call(productSelections, productSelection => productSelection.id === productSelectionId);
|
|
8002
7926
|
props.onChange(currentProductSelection);
|
|
8003
7927
|
};
|
|
@@ -8069,15 +7993,11 @@ function ProductSelectionsAsyncSelectDropdown(props) {
|
|
|
8069
7993
|
}
|
|
8070
7994
|
|
|
8071
7995
|
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 } } } };
|
|
8072
|
-
const createQueryVariables$4 = (productSelections, predicateField) => {
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
limit: 500
|
|
8077
|
-
};
|
|
8078
|
-
};
|
|
7996
|
+
const createQueryVariables$4 = (productSelections, predicateField) => ({
|
|
7997
|
+
where: `${predicateField} in (${_mapInstanceProperty__default["default"](productSelections).call(productSelections, ps => `"${ps}"`).join(', ')})`,
|
|
7998
|
+
limit: 500
|
|
7999
|
+
});
|
|
8079
8000
|
const useProductSelectionsByFieldFetcher = (productSelections, predicateField) => {
|
|
8080
|
-
var _productSelectionsQue, _productSelectionsQue2;
|
|
8081
8001
|
const productSelectionList = _Array$isArray__default["default"](productSelections) ? productSelections : [productSelections];
|
|
8082
8002
|
const productSelectionsQuery = react.useQuery(ProductSelectionsPickerFetcher$1, {
|
|
8083
8003
|
context: {
|
|
@@ -8087,7 +8007,7 @@ const useProductSelectionsByFieldFetcher = (productSelections, predicateField) =
|
|
|
8087
8007
|
skip: productSelectionList.length === 0
|
|
8088
8008
|
});
|
|
8089
8009
|
return {
|
|
8090
|
-
productSelections:
|
|
8010
|
+
productSelections: productSelectionsQuery.data?.productSelections.results ?? [],
|
|
8091
8011
|
isLoading: productSelectionsQuery.loading
|
|
8092
8012
|
};
|
|
8093
8013
|
};
|
|
@@ -8128,8 +8048,8 @@ const createQueryVariables$3 = _ref3 => {
|
|
|
8128
8048
|
var _context;
|
|
8129
8049
|
let searchText = _ref3.searchText;
|
|
8130
8050
|
const sanitizedSearchText = sanitize(_trimInstanceProperty__default["default"](searchText).call(searchText, searchText));
|
|
8131
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
8132
|
-
const keyQuery =
|
|
8051
|
+
const idQuery = isUUID(sanitizedSearchText) && `id = "${sanitizedSearchText}"`;
|
|
8052
|
+
const keyQuery = `key = "${sanitizedSearchText}"`;
|
|
8133
8053
|
const searchTextQuery = _filterInstanceProperty__default["default"](_context = [idQuery, keyQuery]).call(_context, Boolean).join(' or ');
|
|
8134
8054
|
return {
|
|
8135
8055
|
where: searchTextQuery || undefined
|
|
@@ -8152,7 +8072,6 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8152
8072
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8153
8073
|
const productSelectionsByFieldFetcher = useProductSelectionsByFieldFetcher(props.value, props.renderSelectInputOptionValuesByField);
|
|
8154
8074
|
const handleLoadOptions = async searchText => {
|
|
8155
|
-
var _data$productSelectio, _data$productSelectio2;
|
|
8156
8075
|
const _await$client$query = await client$1.query({
|
|
8157
8076
|
query: ProductSelectionsPickerFetcher,
|
|
8158
8077
|
variables: createQueryVariables$3({
|
|
@@ -8164,7 +8083,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8164
8083
|
fetchPolicy: 'network-only'
|
|
8165
8084
|
}),
|
|
8166
8085
|
data = _await$client$query.data;
|
|
8167
|
-
const matchedProductSelections =
|
|
8086
|
+
const matchedProductSelections = data?.productSelections?.results ?? [];
|
|
8168
8087
|
const updatedProductSelections = _mapInstanceProperty__default["default"](matchedProductSelections).call(matchedProductSelections, convertProductSelectionFromGraphQl);
|
|
8169
8088
|
const filteredProductSelections = _filterInstanceProperty__default["default"](updatedProductSelections).call(updatedProductSelections, ps => {
|
|
8170
8089
|
var _context2;
|
|
@@ -8180,8 +8099,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8180
8099
|
};
|
|
8181
8100
|
const loadOptionsDebounced = debounce__default["default"](handleLoadOptions, 500);
|
|
8182
8101
|
const onOptionClick = event => {
|
|
8183
|
-
|
|
8184
|
-
const productSelectionId = (_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.value;
|
|
8102
|
+
const productSelectionId = event.target.value?.value;
|
|
8185
8103
|
const currentProductSelection = _findInstanceProperty__default["default"](productionSelectionResults).call(productionSelectionResults, productSelection => productSelection.id === productSelectionId);
|
|
8186
8104
|
props.onChange(currentProductSelection);
|
|
8187
8105
|
};
|
|
@@ -8229,11 +8147,11 @@ function ModeSelectInputOption(props) {
|
|
|
8229
8147
|
scale: "xs",
|
|
8230
8148
|
children: [jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
8231
8149
|
isBold: true,
|
|
8232
|
-
children:
|
|
8150
|
+
children: data?.label || noValueFallback
|
|
8233
8151
|
}), jsxRuntime.jsxs(uiKit.Text.Detail, {
|
|
8234
|
-
children: ["Key: ",
|
|
8152
|
+
children: ["Key: ", data?.key || noValueFallback]
|
|
8235
8153
|
}), jsxRuntime.jsxs(uiKit.Text.Detail, {
|
|
8236
|
-
children: ["Type: ",
|
|
8154
|
+
children: ["Type: ", data?.mode || noValueFallback]
|
|
8237
8155
|
})]
|
|
8238
8156
|
})
|
|
8239
8157
|
}));
|
|
@@ -8334,8 +8252,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8334
8252
|
var _context2;
|
|
8335
8253
|
const intl = reactIntl.useIntl();
|
|
8336
8254
|
const handleLoadOptions = async searchTerm => {
|
|
8337
|
-
|
|
8338
|
-
const filteredOptions = (_props$options = props.options) === null || _props$options === void 0 ? void 0 : _filterInstanceProperty__default["default"](_props$options).call(_props$options, country => {
|
|
8255
|
+
const filteredOptions = props.options?.filter(country => {
|
|
8339
8256
|
var _context;
|
|
8340
8257
|
return _includesInstanceProperty__default["default"](_context = country.label.toLowerCase()).call(_context, searchTerm.toLowerCase());
|
|
8341
8258
|
});
|
|
@@ -8343,7 +8260,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8343
8260
|
return _sliceInstanceProperty__default["default"](filteredOptions).call(filteredOptions, 0, props.countriesAsyncLoadingLimit);
|
|
8344
8261
|
}
|
|
8345
8262
|
return [{
|
|
8346
|
-
options:
|
|
8263
|
+
options: props.options?.slice(0, props.countriesAsyncLoadingLimit)
|
|
8347
8264
|
}, {
|
|
8348
8265
|
options: emptyCountryOption(intl)
|
|
8349
8266
|
}];
|
|
@@ -8352,10 +8269,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8352
8269
|
const countries = event.target.value;
|
|
8353
8270
|
props.onChange({
|
|
8354
8271
|
target: _objectSpread$F(_objectSpread$F({}, event.target), {}, {
|
|
8355
|
-
value: _mapInstanceProperty__default["default"](countries).call(countries, country =>
|
|
8356
|
-
var _country$value;
|
|
8357
|
-
return (_country$value = country === null || country === void 0 ? void 0 : country.value) !== null && _country$value !== void 0 ? _country$value : country;
|
|
8358
|
-
})
|
|
8272
|
+
value: _mapInstanceProperty__default["default"](countries).call(countries, country => country?.value ?? country)
|
|
8359
8273
|
})
|
|
8360
8274
|
});
|
|
8361
8275
|
};
|
|
@@ -8385,8 +8299,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8385
8299
|
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; }
|
|
8386
8300
|
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; }
|
|
8387
8301
|
function CountriesPicker(props) {
|
|
8388
|
-
|
|
8389
|
-
const CustomCountriesPicker = ((_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.length) <= props.countriesAsyncLoadingLimit ? CountriesBasicSelectDropdown : CountriesAsyncSelectDropdown;
|
|
8302
|
+
const CustomCountriesPicker = props.options?.length <= props.countriesAsyncLoadingLimit ? CountriesBasicSelectDropdown : CountriesAsyncSelectDropdown;
|
|
8390
8303
|
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
8391
8304
|
children: jsxRuntime.jsx(CustomCountriesPicker, _objectSpread$E({}, props))
|
|
8392
8305
|
});
|
|
@@ -8415,7 +8328,6 @@ var GetCustomerGroupsQuery = { kind: "Document", definitions: [{ kind: "Operatio
|
|
|
8415
8328
|
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 } } } };
|
|
8416
8329
|
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 } } } };
|
|
8417
8330
|
const CustomerGroupPickerInput = _ref => {
|
|
8418
|
-
var _currentOption$data$l, _currentOption$data;
|
|
8419
8331
|
let isClearable = _ref.isClearable,
|
|
8420
8332
|
isDisabled = _ref.isDisabled,
|
|
8421
8333
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -8484,13 +8396,13 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
8484
8396
|
setLoadingError(null);
|
|
8485
8397
|
handleInternalInputChange(event);
|
|
8486
8398
|
}, [handleInternalInputChange]);
|
|
8487
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
8399
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
8488
8400
|
React.useEffect(() => {
|
|
8489
8401
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
8490
8402
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
8491
8403
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
8492
8404
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$t.noCustomerGroupsFound), [loadingError, formatMessage]);
|
|
8493
|
-
const tooltipTitle =
|
|
8405
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
8494
8406
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
8495
8407
|
max: "scale",
|
|
8496
8408
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -8500,7 +8412,7 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
8500
8412
|
children: jsxRuntime.jsx(uiKit.AsyncSelectInput, {
|
|
8501
8413
|
id: name,
|
|
8502
8414
|
name: name,
|
|
8503
|
-
placeholder: placeholder
|
|
8415
|
+
placeholder: placeholder ?? formatMessage(messages$t.placeholder),
|
|
8504
8416
|
loadOptions: loadOptionsDebounced,
|
|
8505
8417
|
defaultOptions: true,
|
|
8506
8418
|
showOptionGroupDivider: true,
|
|
@@ -8529,12 +8441,11 @@ CustomerGroupPickerInput.displayName = 'CustomerGroupPickerInput';
|
|
|
8529
8441
|
const DEFAULT_LENGTH = 50;
|
|
8530
8442
|
const DEFAULT_END = '...';
|
|
8531
8443
|
function truncate (text) {
|
|
8532
|
-
var _context;
|
|
8533
8444
|
let length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_LENGTH;
|
|
8534
8445
|
let end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_END;
|
|
8535
8446
|
if (!text) return '';
|
|
8536
8447
|
if (text.length < length) return text;
|
|
8537
|
-
return
|
|
8448
|
+
return `${text.substring(0, length)}${end}`;
|
|
8538
8449
|
}
|
|
8539
8450
|
|
|
8540
8451
|
const LOWER_STORES_LIMIT = 60;
|
|
@@ -8542,7 +8453,6 @@ const UPPER_STORES_LIMIT = 500;
|
|
|
8542
8453
|
|
|
8543
8454
|
// map store to options
|
|
8544
8455
|
const mapStoresToOptions = _ref => {
|
|
8545
|
-
var _store$productSelecti;
|
|
8546
8456
|
let store = _ref.store,
|
|
8547
8457
|
renderSelectInputOptionValuesByField = _ref.renderSelectInputOptionValuesByField,
|
|
8548
8458
|
dataLocale = _ref.dataLocale;
|
|
@@ -8553,14 +8463,14 @@ const mapStoresToOptions = _ref => {
|
|
|
8553
8463
|
const localizedName = l10n.formatLocalizedString(convertedStore, {
|
|
8554
8464
|
key: 'name',
|
|
8555
8465
|
locale: dataLocale,
|
|
8556
|
-
fallback:
|
|
8466
|
+
fallback: `${store.key} (key)`
|
|
8557
8467
|
});
|
|
8558
8468
|
return {
|
|
8559
8469
|
label: localizedName,
|
|
8560
8470
|
value: renderSelectInputOptionValuesByField === 'key' ? store.key : store.id,
|
|
8561
8471
|
key: store.key,
|
|
8562
8472
|
id: store.id,
|
|
8563
|
-
productSelections:
|
|
8473
|
+
productSelections: store.productSelections?.map(productSelectionRef => productSelectionRef.productSelection.id)
|
|
8564
8474
|
};
|
|
8565
8475
|
};
|
|
8566
8476
|
|
|
@@ -8622,7 +8532,7 @@ const getValueFromOptions$1 = _ref => {
|
|
|
8622
8532
|
isMulti = _ref.isMulti;
|
|
8623
8533
|
// handle async-select-field value transformation
|
|
8624
8534
|
if (isMulti) {
|
|
8625
|
-
return _filterInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores
|
|
8535
|
+
return _filterInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores?.includes(store.value));
|
|
8626
8536
|
}
|
|
8627
8537
|
|
|
8628
8538
|
// return value as undefined if no options is yet selected. It is needed for cases where users sets initial values as empty string
|
|
@@ -8651,13 +8561,13 @@ const StoresAsyncSelectInput = props => {
|
|
|
8651
8561
|
sort: 'createdAt asc',
|
|
8652
8562
|
excludeExtendedStoresList: true,
|
|
8653
8563
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8654
|
-
stores:
|
|
8564
|
+
stores: keysOfStores?.length && keysOfStores,
|
|
8655
8565
|
projectKey: props.projectKey
|
|
8656
8566
|
});
|
|
8657
8567
|
const hasError = uiKit.AsyncSelectInput.isTouched(props.touched) && hasErrors$2(props.errors) || props.hasError;
|
|
8658
8568
|
const mappedStoresListOptions = React.useMemo(() => {
|
|
8659
|
-
var _context2
|
|
8660
|
-
return _mapInstanceProperty__default["default"](_context2 =
|
|
8569
|
+
var _context2;
|
|
8570
|
+
return _mapInstanceProperty__default["default"](_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8661
8571
|
store,
|
|
8662
8572
|
dataLocale,
|
|
8663
8573
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -8743,21 +8653,20 @@ const StoresBasicSelectInput = props => {
|
|
|
8743
8653
|
sort: 'createdAt asc',
|
|
8744
8654
|
excludeExtendedStoresList: true,
|
|
8745
8655
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8746
|
-
stores:
|
|
8656
|
+
stores: keysOfStores?.length && keysOfStores,
|
|
8747
8657
|
projectKey: props.projectKey
|
|
8748
8658
|
});
|
|
8749
8659
|
const hasError = uiKit.SelectInput.isTouched(props.touched) && hasErrors$1(props.errors) || props.hasError;
|
|
8750
8660
|
const mappedStoresListOptions = React.useMemo(() => {
|
|
8751
|
-
var _context2
|
|
8752
|
-
return _mapInstanceProperty__default["default"](_context2 =
|
|
8661
|
+
var _context2;
|
|
8662
|
+
return _mapInstanceProperty__default["default"](_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8753
8663
|
store,
|
|
8754
8664
|
dataLocale,
|
|
8755
8665
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
8756
8666
|
}));
|
|
8757
8667
|
}, [dataLocale, storesListFetcher.stores, props.renderSelectInputOptionValuesByField]);
|
|
8758
8668
|
const handleChange = event => {
|
|
8759
|
-
|
|
8760
|
-
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;
|
|
8669
|
+
const value = event.target.value?.value ?? event.target.value;
|
|
8761
8670
|
const currentStore = _findInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => store.value === value);
|
|
8762
8671
|
|
|
8763
8672
|
// We need complete store info including productSelections
|
|
@@ -8812,7 +8721,6 @@ StoresBasicSelectInput.defaultProps = {
|
|
|
8812
8721
|
|
|
8813
8722
|
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 } } } };
|
|
8814
8723
|
const useTotalNumberOfStoresFetcher = projectKey => {
|
|
8815
|
-
var _totalNumberOfStoresQ;
|
|
8816
8724
|
const totalNumberOfStoresQuery = react.useQuery(TotalNumberOfStores, {
|
|
8817
8725
|
context: {
|
|
8818
8726
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM,
|
|
@@ -8821,7 +8729,7 @@ const useTotalNumberOfStoresFetcher = projectKey => {
|
|
|
8821
8729
|
fetchPolicy: 'network-only'
|
|
8822
8730
|
});
|
|
8823
8731
|
return {
|
|
8824
|
-
total:
|
|
8732
|
+
total: totalNumberOfStoresQuery.data?.totalNumberOfStores.total,
|
|
8825
8733
|
isLoading: totalNumberOfStoresQuery.loading
|
|
8826
8734
|
};
|
|
8827
8735
|
};
|
|
@@ -8839,19 +8747,15 @@ const handlers$1 = {
|
|
|
8839
8747
|
};
|
|
8840
8748
|
|
|
8841
8749
|
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 } } } };
|
|
8842
|
-
const createQueryVariables$2 = (stores, predicateField, shouldFetchProductSelections) => {
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8847
|
-
excludeProductSelections: !shouldFetchProductSelections
|
|
8848
|
-
};
|
|
8849
|
-
};
|
|
8750
|
+
const createQueryVariables$2 = (stores, predicateField, shouldFetchProductSelections) => ({
|
|
8751
|
+
where: `${predicateField} in (${_mapInstanceProperty__default["default"](stores).call(stores, store => `"${store}"`).join(', ')})`,
|
|
8752
|
+
limit: 500,
|
|
8753
|
+
excludeProductSelections: !shouldFetchProductSelections
|
|
8754
|
+
});
|
|
8850
8755
|
const emptyStoresQueryResult = {
|
|
8851
8756
|
results: []
|
|
8852
8757
|
};
|
|
8853
8758
|
const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
8854
|
-
var _storesQuery$data;
|
|
8855
8759
|
let shouldFetchProductSelections = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
8856
8760
|
// incase of single select input stores are sent as single string literal
|
|
8857
8761
|
const storesList = _Array$isArray__default["default"](stores) ? stores : [stores];
|
|
@@ -8864,29 +8768,29 @@ const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
|
8864
8768
|
skip: storesList.length === 0
|
|
8865
8769
|
});
|
|
8866
8770
|
return {
|
|
8867
|
-
stores:
|
|
8771
|
+
stores: storesQuery.data?.storesByField || emptyStoresQueryResult,
|
|
8868
8772
|
isLoading: storesQuery.loading
|
|
8869
8773
|
};
|
|
8870
8774
|
};
|
|
8871
8775
|
|
|
8872
8776
|
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; }
|
|
8873
|
-
function _objectSpread$B(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
8777
|
+
function _objectSpread$B(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$B(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$B(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
8874
8778
|
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 } } } };
|
|
8875
8779
|
const hasErrors = errors => {
|
|
8876
8780
|
var _context;
|
|
8877
8781
|
return errors && _someInstanceProperty__default["default"](_context = _Object$values__default["default"](errors)).call(_context, Boolean);
|
|
8878
8782
|
};
|
|
8879
8783
|
const createQueryVariables$1 = _ref => {
|
|
8880
|
-
var _context2
|
|
8784
|
+
var _context2;
|
|
8881
8785
|
let searchText = _ref.searchText,
|
|
8882
8786
|
dataLocale = _ref.dataLocale,
|
|
8883
8787
|
allAccessibleStoreKeysThroughDataFencePermissions = _ref.allAccessibleStoreKeysThroughDataFencePermissions,
|
|
8884
8788
|
shouldFetchProductSelections = _ref.shouldFetchProductSelections;
|
|
8885
8789
|
const sanitizedSearchText = sanitize(_trimInstanceProperty__default["default"](searchText).call(searchText, searchText));
|
|
8886
|
-
const keyQuery =
|
|
8790
|
+
const keyQuery = `key = "${sanitizedSearchText}"`;
|
|
8887
8791
|
|
|
8888
8792
|
// if the user has data fence permissions then we only allow stores to fetched that user has access to
|
|
8889
|
-
if (allAccessibleStoreKeysThroughDataFencePermissions
|
|
8793
|
+
if (allAccessibleStoreKeysThroughDataFencePermissions?.length) {
|
|
8890
8794
|
// if the current search term match the accessible stores keys, then proceed with fetching the store
|
|
8891
8795
|
if (_includesInstanceProperty__default["default"](allAccessibleStoreKeysThroughDataFencePermissions).call(allAccessibleStoreKeysThroughDataFencePermissions, sanitizedSearchText)) {
|
|
8892
8796
|
return {
|
|
@@ -8902,9 +8806,9 @@ const createQueryVariables$1 = _ref => {
|
|
|
8902
8806
|
excludeProductSelections: !shouldFetchProductSelections
|
|
8903
8807
|
};
|
|
8904
8808
|
}
|
|
8905
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
8906
|
-
const nameQuery =
|
|
8907
|
-
const searchTextQuery = _filterInstanceProperty__default["default"](
|
|
8809
|
+
const idQuery = isUUID(sanitizedSearchText) && `id = "${sanitizedSearchText}"`;
|
|
8810
|
+
const nameQuery = `name(${dataLocale} = "${sanitizedSearchText}")`;
|
|
8811
|
+
const searchTextQuery = _filterInstanceProperty__default["default"](_context2 = [idQuery, nameQuery, keyQuery]).call(_context2, Boolean).join(' or ');
|
|
8908
8812
|
return {
|
|
8909
8813
|
skipFetchingStores: false,
|
|
8910
8814
|
where: searchTextQuery,
|
|
@@ -8912,7 +8816,6 @@ const createQueryVariables$1 = _ref => {
|
|
|
8912
8816
|
};
|
|
8913
8817
|
};
|
|
8914
8818
|
const getValueFromOptions = _ref2 => {
|
|
8915
|
-
var _storesByFieldFetcher, _context4;
|
|
8916
8819
|
let isMulti = _ref2.isMulti,
|
|
8917
8820
|
value = _ref2.value,
|
|
8918
8821
|
dataLocale = _ref2.dataLocale,
|
|
@@ -8921,7 +8824,7 @@ const getValueFromOptions = _ref2 => {
|
|
|
8921
8824
|
if (!value) {
|
|
8922
8825
|
return undefined;
|
|
8923
8826
|
}
|
|
8924
|
-
const selectedOptions =
|
|
8827
|
+
const selectedOptions = storesByFieldFetcher.stores?.results.map(store => mapStoresToOptions({
|
|
8925
8828
|
store,
|
|
8926
8829
|
dataLocale,
|
|
8927
8830
|
renderSelectInputOptionValuesByField: renderSelectInputOptionValuesByField
|
|
@@ -8959,9 +8862,8 @@ const StoresSearchSelectInput = props => {
|
|
|
8959
8862
|
},
|
|
8960
8863
|
fetchPolicy: 'network-only'
|
|
8961
8864
|
}).then(_ref3 => {
|
|
8962
|
-
var _data$storesByWherePr, _context5;
|
|
8963
8865
|
let data = _ref3.data;
|
|
8964
|
-
return
|
|
8866
|
+
return data.storesByWherePredicate?.results.map(store => mapStoresToOptions({
|
|
8965
8867
|
store,
|
|
8966
8868
|
dataLocale,
|
|
8967
8869
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -9141,14 +9043,14 @@ var messages$r = reactIntl.defineMessages({
|
|
|
9141
9043
|
|
|
9142
9044
|
function formatDiscount(discount, currencyCode, intl) {
|
|
9143
9045
|
var _context;
|
|
9144
|
-
if (discount.type === 'relative') return
|
|
9046
|
+
if (discount.type === 'relative') return `${discount.permyriad / 100}%`;
|
|
9145
9047
|
if (!discount.money) return null;
|
|
9146
9048
|
const moneyForCurrencyCode = _findInstanceProperty__default["default"](_context = discount.money).call(_context, discountMoney => discountMoney.currencyCode === currencyCode);
|
|
9147
9049
|
return moneyForCurrencyCode ? formatMoney$2(moneyForCurrencyCode, intl) : null;
|
|
9148
9050
|
}
|
|
9149
9051
|
|
|
9150
9052
|
function formatPercentage(percentage) {
|
|
9151
|
-
return
|
|
9053
|
+
return `${percentage}%`;
|
|
9152
9054
|
}
|
|
9153
9055
|
function convertRatioToPercentage(ratio) {
|
|
9154
9056
|
return _parseFloat__default["default"]((ratio * 100).toFixed(2));
|
|
@@ -9202,8 +9104,8 @@ function validateFilter$2(_ref, intl) {
|
|
|
9202
9104
|
};
|
|
9203
9105
|
}
|
|
9204
9106
|
if (value.option === FILTER_TYPES.range) {
|
|
9205
|
-
const from = validateValue(filterValue
|
|
9206
|
-
const to = from ? null : validateValue(filterValue
|
|
9107
|
+
const from = validateValue(filterValue?.from, typeName, intl);
|
|
9108
|
+
const to = from ? null : validateValue(filterValue?.to, typeName, intl);
|
|
9207
9109
|
return from || to ? {
|
|
9208
9110
|
input: {
|
|
9209
9111
|
from,
|
|
@@ -9240,16 +9142,16 @@ function validateFilter$1(_ref, intl) {
|
|
|
9240
9142
|
type = _ref.type;
|
|
9241
9143
|
if (type === 'range') {
|
|
9242
9144
|
if (validateSingleFilter({
|
|
9243
|
-
value: value
|
|
9145
|
+
value: value?.from
|
|
9244
9146
|
})) return {
|
|
9245
9147
|
from: intl.formatMessage(messages$p.rangeMissingValue)
|
|
9246
9148
|
};
|
|
9247
9149
|
if (validateSingleFilter({
|
|
9248
|
-
value: value
|
|
9150
|
+
value: value?.to
|
|
9249
9151
|
})) return {
|
|
9250
9152
|
to: intl.formatMessage(messages$p.rangeMissingValue)
|
|
9251
9153
|
};
|
|
9252
|
-
if (moment__default$1["default"](value
|
|
9154
|
+
if (moment__default$1["default"](value?.to).isBefore(value?.from)) return {
|
|
9253
9155
|
from: intl.formatMessage(messages$p.rangeToSmallerThanFrom)
|
|
9254
9156
|
};
|
|
9255
9157
|
} else if (type === 'equalTo' || type === 'lessThan' || type === 'moreThan') {
|
|
@@ -9319,10 +9221,8 @@ function isEmptyFilter(_ref) {
|
|
|
9319
9221
|
}
|
|
9320
9222
|
|
|
9321
9223
|
function numberTransformer(filterKey, filters) {
|
|
9322
|
-
var _context3;
|
|
9323
9224
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$2;
|
|
9324
9225
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
9325
|
-
var _context, _context2;
|
|
9326
9226
|
let type = _ref.type,
|
|
9327
9227
|
value = _ref.value;
|
|
9328
9228
|
if (!filterValidator({
|
|
@@ -9331,19 +9231,19 @@ function numberTransformer(filterKey, filters) {
|
|
|
9331
9231
|
})) return '';
|
|
9332
9232
|
switch (type) {
|
|
9333
9233
|
case 'lessThan':
|
|
9334
|
-
return
|
|
9234
|
+
return `(* to ${value - 1})`;
|
|
9335
9235
|
case 'moreThan':
|
|
9336
|
-
return
|
|
9236
|
+
return `(${value + 1} to *)`;
|
|
9337
9237
|
case 'equalTo':
|
|
9338
|
-
return
|
|
9238
|
+
return `(${value} to ${value})`;
|
|
9339
9239
|
case 'range':
|
|
9340
|
-
return
|
|
9240
|
+
return `(${value.from} to ${value.to})`;
|
|
9341
9241
|
default:
|
|
9342
9242
|
return '';
|
|
9343
9243
|
}
|
|
9344
9244
|
});
|
|
9345
9245
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
9346
|
-
return queryString === '' ? null :
|
|
9246
|
+
return queryString === '' ? null : `${filterKey}: range${queryString}`;
|
|
9347
9247
|
}
|
|
9348
9248
|
function isFilterValid$2(_ref2) {
|
|
9349
9249
|
let type = _ref2.type,
|
|
@@ -9370,11 +9270,9 @@ function graphqlCategoryLevelTransformer(filterKey, filters, filterValidator) {
|
|
|
9370
9270
|
return _filterInstanceProperty__default["default"](_context = [levelFilterQuery, lastLevelFilterQuery]).call(_context, Boolean);
|
|
9371
9271
|
}
|
|
9372
9272
|
|
|
9373
|
-
var _templateObject$1, _templateObject2;
|
|
9374
9273
|
const dateFormatDayStart = 'YYYY-MM-DDT00:00:00.000Z';
|
|
9375
9274
|
const dateFormatDayEnd = 'YYYY-MM-DDT23:59:59.999Z';
|
|
9376
9275
|
function dateTransformer(filterKey, filters) {
|
|
9377
|
-
var _context;
|
|
9378
9276
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$1;
|
|
9379
9277
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
9380
9278
|
let type = _ref.type,
|
|
@@ -9385,19 +9283,25 @@ function dateTransformer(filterKey, filters) {
|
|
|
9385
9283
|
})) return '';
|
|
9386
9284
|
switch (type) {
|
|
9387
9285
|
case 'lessThan':
|
|
9388
|
-
return
|
|
9286
|
+
return `(* to "${moment__default$1["default"](value).format(dateFormatDayStart)}")`;
|
|
9389
9287
|
case 'moreThan':
|
|
9390
|
-
return
|
|
9288
|
+
return `("${moment__default$1["default"](value).format(dateFormatDayEnd)}" to *)`;
|
|
9391
9289
|
case 'equalTo':
|
|
9392
|
-
return oneLine__default["default"]
|
|
9290
|
+
return oneLine__default["default"]`
|
|
9291
|
+
("${moment__default$1["default"](value).format(dateFormatDayStart)}"
|
|
9292
|
+
to "${moment__default$1["default"](value).format(dateFormatDayEnd)}")
|
|
9293
|
+
`;
|
|
9393
9294
|
case 'range':
|
|
9394
|
-
return oneLine__default["default"]
|
|
9295
|
+
return oneLine__default["default"]`
|
|
9296
|
+
("${moment__default$1["default"](value.from).format(dateFormatDayStart)}"
|
|
9297
|
+
to "${moment__default$1["default"](value.to).format(dateFormatDayEnd)}")
|
|
9298
|
+
`;
|
|
9395
9299
|
default:
|
|
9396
9300
|
return '';
|
|
9397
9301
|
}
|
|
9398
9302
|
});
|
|
9399
9303
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
9400
|
-
return queryString === '' ? null :
|
|
9304
|
+
return queryString === '' ? null : `${filterKey}: range${queryString}`;
|
|
9401
9305
|
}
|
|
9402
9306
|
function isFilterValid$1(_ref2) {
|
|
9403
9307
|
let type = _ref2.type,
|
|
@@ -9412,19 +9316,18 @@ function isFilterValid$1(_ref2) {
|
|
|
9412
9316
|
}
|
|
9413
9317
|
|
|
9414
9318
|
function missingLocaleTransformer(filterKey, filters) {
|
|
9415
|
-
var _context;
|
|
9416
9319
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
9417
9320
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
9418
9321
|
if (filters.length === 0) return null;
|
|
9419
9322
|
const missingLocale = filters[0].value.value;
|
|
9420
|
-
return
|
|
9323
|
+
return `${filterKey}.${missingLocale}:missing`;
|
|
9421
9324
|
}
|
|
9422
9325
|
|
|
9423
9326
|
function missingTransformer(filterKey, filters) {
|
|
9424
9327
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
9425
9328
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
9426
9329
|
if (filters.length === 0) return null;
|
|
9427
|
-
return
|
|
9330
|
+
return `${filterKey}:missing`;
|
|
9428
9331
|
}
|
|
9429
9332
|
|
|
9430
9333
|
/**
|
|
@@ -9465,7 +9368,6 @@ function graphqlQueryBuilder(_ref) {
|
|
|
9465
9368
|
}
|
|
9466
9369
|
|
|
9467
9370
|
function referenceTransformer(filterKey, filters) {
|
|
9468
|
-
var _context;
|
|
9469
9371
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid;
|
|
9470
9372
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
9471
9373
|
let type = _ref.type,
|
|
@@ -9476,49 +9378,46 @@ function referenceTransformer(filterKey, filters) {
|
|
|
9476
9378
|
})) return '';
|
|
9477
9379
|
switch (type) {
|
|
9478
9380
|
case 'equalTo':
|
|
9479
|
-
return "
|
|
9381
|
+
return `"${value}"`;
|
|
9480
9382
|
default:
|
|
9481
9383
|
return '';
|
|
9482
9384
|
}
|
|
9483
9385
|
});
|
|
9484
9386
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
9485
|
-
return queryString === '' ? null :
|
|
9387
|
+
return queryString === '' ? null : `${filterKey}.id: ${queryString}`;
|
|
9486
9388
|
}
|
|
9487
9389
|
function isFilterValid(_ref2) {
|
|
9488
|
-
var
|
|
9390
|
+
var _context;
|
|
9489
9391
|
let type = _ref2.type,
|
|
9490
9392
|
value = _ref2.value;
|
|
9491
|
-
if (type === 'equalTo' && !_includesInstanceProperty__default["default"](
|
|
9393
|
+
if (type === 'equalTo' && !_includesInstanceProperty__default["default"](_context = [null, undefined, '']).call(_context, value)) return true;
|
|
9492
9394
|
return false;
|
|
9493
9395
|
}
|
|
9494
9396
|
|
|
9495
9397
|
function textTransformer(filterKey, queries) {
|
|
9496
|
-
var _context;
|
|
9497
9398
|
if (queries.length === 0) return null;
|
|
9498
9399
|
|
|
9499
9400
|
// Note: we assume for now that there can only be 1 text filter.
|
|
9500
9401
|
const queryValue = queries[0].value;
|
|
9501
|
-
return queryValue ?
|
|
9402
|
+
return queryValue ? `${filterKey}:"${queryValue}"` : null;
|
|
9502
9403
|
}
|
|
9503
9404
|
|
|
9504
9405
|
const composeNumberPredicateFromFilter = (target, value, option) => {
|
|
9505
|
-
var _context, _context2, _context3, _context4, _context5, _context6;
|
|
9506
9406
|
switch (option) {
|
|
9507
9407
|
case FILTER_TYPES.lessThan:
|
|
9508
|
-
return
|
|
9408
|
+
return `${target} < ${value}`;
|
|
9509
9409
|
case FILTER_TYPES.moreThan:
|
|
9510
|
-
return
|
|
9410
|
+
return `${target} > ${value}`;
|
|
9511
9411
|
case FILTER_TYPES.equalTo:
|
|
9512
|
-
return
|
|
9412
|
+
return `${target} = ${value}`;
|
|
9513
9413
|
case FILTER_TYPES.range:
|
|
9514
|
-
return
|
|
9414
|
+
return `${target} >= ${value.from} and ${target} <= ${value.to}`;
|
|
9515
9415
|
default:
|
|
9516
9416
|
return '';
|
|
9517
9417
|
}
|
|
9518
9418
|
};
|
|
9519
9419
|
function customFields (filter, locale) {
|
|
9520
9420
|
const customFieldsPredicates = _mapInstanceProperty__default["default"](filter).call(filter, customFieldFilter => {
|
|
9521
|
-
var _context7, _context8, _context9, _context10, _context11;
|
|
9522
9421
|
const _customFieldFilter$va = customFieldFilter.value,
|
|
9523
9422
|
target = _customFieldFilter$va.target,
|
|
9524
9423
|
type = _customFieldFilter$va.type,
|
|
@@ -9526,14 +9425,14 @@ function customFields (filter, locale) {
|
|
|
9526
9425
|
option = _customFieldFilter$va.option;
|
|
9527
9426
|
switch (type.name) {
|
|
9528
9427
|
case FIELD_TYPES.Boolean:
|
|
9529
|
-
return
|
|
9428
|
+
return `${target} = ${value.value}`;
|
|
9530
9429
|
case FIELD_TYPES.String:
|
|
9531
|
-
return
|
|
9430
|
+
return `${target} = "${value}"`;
|
|
9532
9431
|
case FIELD_TYPES.LocalizedString:
|
|
9533
|
-
return
|
|
9432
|
+
return `${target}(${localizedTextTransformer(value)})`;
|
|
9534
9433
|
case FIELD_TYPES.Enum:
|
|
9535
9434
|
case FIELD_TYPES.LocalizedEnum:
|
|
9536
|
-
return
|
|
9435
|
+
return `${target} = "${value.value}"`;
|
|
9537
9436
|
case FIELD_TYPES.Time:
|
|
9538
9437
|
return timeTransformer(target, [{
|
|
9539
9438
|
type: option,
|
|
@@ -9548,14 +9447,14 @@ function customFields (filter, locale) {
|
|
|
9548
9447
|
case FIELD_TYPES.Number:
|
|
9549
9448
|
return composeNumberPredicateFromFilter(target, value, option);
|
|
9550
9449
|
case FIELD_TYPES.Money:
|
|
9551
|
-
return
|
|
9450
|
+
return `${target}(${moneyTransformer(value, option, locale)})`;
|
|
9552
9451
|
case FIELD_TYPES.Reference:
|
|
9553
9452
|
case FIELD_TYPES.Set:
|
|
9554
9453
|
default:
|
|
9555
9454
|
throw new Error('Custom field type not recognized');
|
|
9556
9455
|
}
|
|
9557
9456
|
});
|
|
9558
|
-
return
|
|
9457
|
+
return `(custom(fields(${customFieldsPredicates.join(' and ')})))`;
|
|
9559
9458
|
}
|
|
9560
9459
|
|
|
9561
9460
|
// https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/btoa#Unicode_strings
|
|
@@ -9600,7 +9499,7 @@ function ownKeys$z(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
9600
9499
|
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; }
|
|
9601
9500
|
const resourcesWithPlatformLimits = _Object$keys__default["default"](RESOURCES_WITH_PLATFORM_LIMITS);
|
|
9602
9501
|
const createQueryVariables = platformLimit => _reduceInstanceProperty__default["default"](resourcesWithPlatformLimits).call(resourcesWithPlatformLimits, (previousIncludedLimits, nextNameOfLimit) => _objectSpread$z({
|
|
9603
|
-
[camelCase__default["default"](
|
|
9502
|
+
[camelCase__default["default"](`should include ${nextNameOfLimit}`)]: platformLimit ? nextNameOfLimit === platformLimit : true
|
|
9604
9503
|
}, previousIncludedLimits), {});
|
|
9605
9504
|
|
|
9606
9505
|
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 } } } };
|
|
@@ -9616,7 +9515,7 @@ const usePlatformLimitsFetcher = platformLimit => {
|
|
|
9616
9515
|
error = _useQuery.error,
|
|
9617
9516
|
data = _useQuery.data,
|
|
9618
9517
|
refetch = _useQuery.refetch;
|
|
9619
|
-
const platformLimits = !loading ? omit__default["default"](data
|
|
9518
|
+
const platformLimits = !loading ? omit__default["default"](data?.limits, '__typename') : {};
|
|
9620
9519
|
return {
|
|
9621
9520
|
isLoading: loading,
|
|
9622
9521
|
error,
|
|
@@ -9807,11 +9706,10 @@ const getPlatformLimitsStatus = _ref3 => {
|
|
|
9807
9706
|
total = _ref3.total,
|
|
9808
9707
|
intl = _ref3.intl;
|
|
9809
9708
|
if (limit) {
|
|
9810
|
-
|
|
9811
|
-
return _concatInstanceProperty__default["default"](_context = "(".concat(intl.formatNumber(current), "/")).call(_context, intl.formatNumber(limit), ")");
|
|
9709
|
+
return `(${intl.formatNumber(current)}/${intl.formatNumber(limit)})`;
|
|
9812
9710
|
}
|
|
9813
9711
|
if (total) {
|
|
9814
|
-
return
|
|
9712
|
+
return `(${intl.formatNumber(total)})`;
|
|
9815
9713
|
}
|
|
9816
9714
|
return '';
|
|
9817
9715
|
};
|
|
@@ -9831,18 +9729,17 @@ const useShippingMethodsPlatformLimitsFetcher = () => {
|
|
|
9831
9729
|
};
|
|
9832
9730
|
|
|
9833
9731
|
const useShippingMethodsPlatformLimits = () => {
|
|
9834
|
-
var _platformLimits$shipp;
|
|
9835
9732
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
9836
9733
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
9837
|
-
if (!
|
|
9734
|
+
if (!platformLimits?.shippingMethods?.total) {
|
|
9838
9735
|
return {
|
|
9839
9736
|
hasReachedShippingMethodsWarningLimit: false,
|
|
9840
9737
|
hasReachedShippingMethodsErrorLimit: false
|
|
9841
9738
|
};
|
|
9842
9739
|
}
|
|
9843
|
-
const _platformLimits$
|
|
9844
|
-
limit = _platformLimits$
|
|
9845
|
-
current = _platformLimits$
|
|
9740
|
+
const _platformLimits$shipp = platformLimits.shippingMethods.total,
|
|
9741
|
+
limit = _platformLimits$shipp.limit,
|
|
9742
|
+
current = _platformLimits$shipp.current;
|
|
9846
9743
|
const hasReachedShippingMethodsWarningLimit = getHasExceededWarningThreshold({
|
|
9847
9744
|
limit,
|
|
9848
9745
|
current
|
|
@@ -9858,13 +9755,12 @@ const useShippingMethodsPlatformLimits = () => {
|
|
|
9858
9755
|
};
|
|
9859
9756
|
|
|
9860
9757
|
const PlatformLimitsShippingMethodsNotifications = () => {
|
|
9861
|
-
var _platformLimits$shipp;
|
|
9862
9758
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
9863
9759
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
9864
9760
|
const _useShippingMethodsPl2 = useShippingMethodsPlatformLimits(),
|
|
9865
9761
|
hasReachedShippingMethodsWarningLimit = _useShippingMethodsPl2.hasReachedShippingMethodsWarningLimit,
|
|
9866
9762
|
hasReachedShippingMethodsErrorLimit = _useShippingMethodsPl2.hasReachedShippingMethodsErrorLimit;
|
|
9867
|
-
if (!
|
|
9763
|
+
if (!platformLimits?.shippingMethods?.total) {
|
|
9868
9764
|
return null;
|
|
9869
9765
|
}
|
|
9870
9766
|
if (hasReachedShippingMethodsErrorLimit) {
|
|
@@ -9910,13 +9806,12 @@ var messages$k = reactIntl.defineMessages({
|
|
|
9910
9806
|
});
|
|
9911
9807
|
|
|
9912
9808
|
const PlatformLimitsShippingMethodsStatus = _ref => {
|
|
9913
|
-
var _platformLimits$shipp, _platformLimits$shipp2;
|
|
9914
9809
|
let total = _ref.total;
|
|
9915
9810
|
const intl = reactIntl.useIntl();
|
|
9916
9811
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
9917
9812
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
9918
|
-
const current = platformLimits
|
|
9919
|
-
const limit = platformLimits
|
|
9813
|
+
const current = platformLimits?.shippingMethods?.total?.current;
|
|
9814
|
+
const limit = platformLimits?.shippingMethods?.total?.limit;
|
|
9920
9815
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
9921
9816
|
intlMessage: messages$k.shippingMethodsStatus,
|
|
9922
9817
|
children: getPlatformLimitsStatus({
|
|
@@ -9978,18 +9873,17 @@ const useTaxCategoriesPlatformLimitsFetcher = () => {
|
|
|
9978
9873
|
};
|
|
9979
9874
|
|
|
9980
9875
|
const useTaxCategoriesPlatformLimits = () => {
|
|
9981
|
-
var _platformLimits$taxCa;
|
|
9982
9876
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
9983
9877
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
9984
|
-
if (!
|
|
9878
|
+
if (!platformLimits?.taxCategories?.total) {
|
|
9985
9879
|
return {
|
|
9986
9880
|
hasReachedTaxCategoriesWarningLimit: false,
|
|
9987
9881
|
hasReachedTaxCategoriesErrorLimit: false
|
|
9988
9882
|
};
|
|
9989
9883
|
}
|
|
9990
|
-
const _platformLimits$
|
|
9991
|
-
limit = _platformLimits$
|
|
9992
|
-
current = _platformLimits$
|
|
9884
|
+
const _platformLimits$taxCa = platformLimits.taxCategories.total,
|
|
9885
|
+
limit = _platformLimits$taxCa.limit,
|
|
9886
|
+
current = _platformLimits$taxCa.current;
|
|
9993
9887
|
const hasReachedTaxCategoriesWarningLimit = getHasExceededWarningThreshold({
|
|
9994
9888
|
limit,
|
|
9995
9889
|
current
|
|
@@ -10005,13 +9899,12 @@ const useTaxCategoriesPlatformLimits = () => {
|
|
|
10005
9899
|
};
|
|
10006
9900
|
|
|
10007
9901
|
const PlatformLimitsTaxCategoriesNotifications = () => {
|
|
10008
|
-
var _platformLimits$taxCa;
|
|
10009
9902
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
10010
9903
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
10011
9904
|
const _useTaxCategoriesPlat2 = useTaxCategoriesPlatformLimits(),
|
|
10012
9905
|
hasReachedTaxCategoriesWarningLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesWarningLimit,
|
|
10013
9906
|
hasReachedTaxCategoriesErrorLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesErrorLimit;
|
|
10014
|
-
if (!
|
|
9907
|
+
if (!platformLimits?.taxCategories?.total) {
|
|
10015
9908
|
return null;
|
|
10016
9909
|
}
|
|
10017
9910
|
if (hasReachedTaxCategoriesErrorLimit) {
|
|
@@ -10057,13 +9950,12 @@ var messages$i = reactIntl.defineMessages({
|
|
|
10057
9950
|
});
|
|
10058
9951
|
|
|
10059
9952
|
const PlatformLimitsTaxCategoriesStatus = _ref => {
|
|
10060
|
-
var _platformLimits$taxCa, _platformLimits$taxCa2;
|
|
10061
9953
|
let total = _ref.total;
|
|
10062
9954
|
const intl = reactIntl.useIntl();
|
|
10063
9955
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
10064
9956
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
10065
|
-
const current = platformLimits
|
|
10066
|
-
const limit = platformLimits
|
|
9957
|
+
const current = platformLimits?.taxCategories?.total?.current;
|
|
9958
|
+
const limit = platformLimits?.taxCategories?.total?.limit;
|
|
10067
9959
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
10068
9960
|
intlMessage: messages$i.taxCategoriesStatus,
|
|
10069
9961
|
children: getPlatformLimitsStatus({
|
|
@@ -10125,18 +10017,17 @@ const useZonesPlatformLimitsFetcher = () => {
|
|
|
10125
10017
|
};
|
|
10126
10018
|
|
|
10127
10019
|
const useZonesPlatformLimits = () => {
|
|
10128
|
-
var _platformLimits$zones;
|
|
10129
10020
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10130
10021
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10131
|
-
if (!
|
|
10022
|
+
if (!platformLimits?.zones?.total) {
|
|
10132
10023
|
return {
|
|
10133
10024
|
hasReachedZonesWarningLimit: false,
|
|
10134
10025
|
hasReachedZonesErrorLimit: false
|
|
10135
10026
|
};
|
|
10136
10027
|
}
|
|
10137
|
-
const _platformLimits$
|
|
10138
|
-
limit = _platformLimits$
|
|
10139
|
-
current = _platformLimits$
|
|
10028
|
+
const _platformLimits$zones = platformLimits.zones.total,
|
|
10029
|
+
limit = _platformLimits$zones.limit,
|
|
10030
|
+
current = _platformLimits$zones.current;
|
|
10140
10031
|
const hasReachedZonesWarningLimit = getHasExceededWarningThreshold({
|
|
10141
10032
|
limit,
|
|
10142
10033
|
current
|
|
@@ -10152,13 +10043,12 @@ const useZonesPlatformLimits = () => {
|
|
|
10152
10043
|
};
|
|
10153
10044
|
|
|
10154
10045
|
const PlatformLimitsZonesNotifications = () => {
|
|
10155
|
-
var _platformLimits$zones;
|
|
10156
10046
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10157
10047
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10158
10048
|
const _useZonesPlatformLimi2 = useZonesPlatformLimits(),
|
|
10159
10049
|
hasReachedZonesWarningLimit = _useZonesPlatformLimi2.hasReachedZonesWarningLimit,
|
|
10160
10050
|
hasReachedZonesErrorLimit = _useZonesPlatformLimi2.hasReachedZonesErrorLimit;
|
|
10161
|
-
if (!
|
|
10051
|
+
if (!platformLimits?.zones?.total) {
|
|
10162
10052
|
return null;
|
|
10163
10053
|
}
|
|
10164
10054
|
if (hasReachedZonesErrorLimit) {
|
|
@@ -10204,13 +10094,12 @@ var messages$g = reactIntl.defineMessages({
|
|
|
10204
10094
|
});
|
|
10205
10095
|
|
|
10206
10096
|
const PlatformLimitsZonesStatus = _ref => {
|
|
10207
|
-
var _platformLimits$zones, _platformLimits$zones2;
|
|
10208
10097
|
let total = _ref.total;
|
|
10209
10098
|
const intl = reactIntl.useIntl();
|
|
10210
10099
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10211
10100
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10212
|
-
const current = platformLimits
|
|
10213
|
-
const limit = platformLimits
|
|
10101
|
+
const current = platformLimits?.zones?.total?.current;
|
|
10102
|
+
const limit = platformLimits?.zones?.total?.limit;
|
|
10214
10103
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
10215
10104
|
intlMessage: messages$g.zonesStatus,
|
|
10216
10105
|
children: getPlatformLimitsStatus({
|
|
@@ -10272,18 +10161,17 @@ const useCustomersPlatformLimitsFetcher = () => {
|
|
|
10272
10161
|
};
|
|
10273
10162
|
|
|
10274
10163
|
const useCustomersPlatformLimits$1 = () => {
|
|
10275
|
-
var _platformLimits$custo;
|
|
10276
10164
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10277
10165
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10278
|
-
if (!
|
|
10166
|
+
if (!platformLimits?.customers?.total) {
|
|
10279
10167
|
return {
|
|
10280
10168
|
hasReachedCustomersWarningLimit: false,
|
|
10281
10169
|
hasReachedCustomersErrorLimit: false
|
|
10282
10170
|
};
|
|
10283
10171
|
}
|
|
10284
|
-
const _platformLimits$
|
|
10285
|
-
limit = _platformLimits$
|
|
10286
|
-
current = _platformLimits$
|
|
10172
|
+
const _platformLimits$custo = platformLimits.customers.total,
|
|
10173
|
+
limit = _platformLimits$custo.limit,
|
|
10174
|
+
current = _platformLimits$custo.current;
|
|
10287
10175
|
const hasReachedCustomersWarningLimit = getHasExceededWarningThreshold({
|
|
10288
10176
|
limit,
|
|
10289
10177
|
current
|
|
@@ -10312,13 +10200,12 @@ const useCustomersPlatormLimitsModalState = () => {
|
|
|
10312
10200
|
};
|
|
10313
10201
|
|
|
10314
10202
|
const PlatformLimitsCustomersNotifications = () => {
|
|
10315
|
-
var _platformLimits$custo;
|
|
10316
10203
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10317
10204
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10318
10205
|
const _useCustomersPlatform2 = useCustomersPlatformLimits$1(),
|
|
10319
10206
|
hasReachedCustomersWarningLimit = _useCustomersPlatform2.hasReachedCustomersWarningLimit,
|
|
10320
10207
|
hasReachedCustomersErrorLimit = _useCustomersPlatform2.hasReachedCustomersErrorLimit;
|
|
10321
|
-
if (!
|
|
10208
|
+
if (!platformLimits?.customers?.total) {
|
|
10322
10209
|
return jsxRuntime.jsx("div", {});
|
|
10323
10210
|
}
|
|
10324
10211
|
if (hasReachedCustomersErrorLimit) {
|
|
@@ -10369,16 +10256,15 @@ var styles$b = {
|
|
|
10369
10256
|
"status": "platform-limits-customers-status-module__status___3rXYM"
|
|
10370
10257
|
};
|
|
10371
10258
|
const PlatformLimitsCustomersStatus = () => {
|
|
10372
|
-
var _platformLimits$custo;
|
|
10373
10259
|
const intl = reactIntl.useIntl();
|
|
10374
10260
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10375
10261
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10376
|
-
if (!
|
|
10262
|
+
if (!platformLimits?.customers?.total) {
|
|
10377
10263
|
return null;
|
|
10378
10264
|
}
|
|
10379
|
-
const _platformLimits$
|
|
10380
|
-
current = _platformLimits$
|
|
10381
|
-
limit = _platformLimits$
|
|
10265
|
+
const _platformLimits$custo = platformLimits.customers.total,
|
|
10266
|
+
current = _platformLimits$custo.current,
|
|
10267
|
+
limit = _platformLimits$custo.limit;
|
|
10382
10268
|
return jsxRuntime.jsx("div", {
|
|
10383
10269
|
className: styles$b.status,
|
|
10384
10270
|
children: jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
@@ -10612,18 +10498,17 @@ const useCustomerGroupsPlatformLimitsFetcher = () => {
|
|
|
10612
10498
|
};
|
|
10613
10499
|
|
|
10614
10500
|
const useCustomerGroupsPlatformLimitsStatus = () => {
|
|
10615
|
-
var _platformLimits$custo;
|
|
10616
10501
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10617
10502
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10618
|
-
if (!
|
|
10503
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
10619
10504
|
return {
|
|
10620
10505
|
hasReachedCustomerGroupsWarningLimit: false,
|
|
10621
10506
|
hasReachedCustomerGroupsErrorLimit: false
|
|
10622
10507
|
};
|
|
10623
10508
|
}
|
|
10624
|
-
const _platformLimits$
|
|
10625
|
-
limit = _platformLimits$
|
|
10626
|
-
current = _platformLimits$
|
|
10509
|
+
const _platformLimits$custo = platformLimits.customerGroups.total,
|
|
10510
|
+
limit = _platformLimits$custo.limit,
|
|
10511
|
+
current = _platformLimits$custo.current;
|
|
10627
10512
|
const hasReachedCustomerGroupsWarningLimit = getHasExceededWarningThreshold({
|
|
10628
10513
|
limit,
|
|
10629
10514
|
current
|
|
@@ -10652,13 +10537,12 @@ const useCustomerGroupsPlatormLimitsModalState = () => {
|
|
|
10652
10537
|
};
|
|
10653
10538
|
|
|
10654
10539
|
const PlatformLimitsCustomerGroupsNotifications = () => {
|
|
10655
|
-
var _platformLimits$custo;
|
|
10656
10540
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10657
10541
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10658
10542
|
const _useCustomerGroupsPla2 = useCustomerGroupsPlatformLimitsStatus(),
|
|
10659
10543
|
hasReachedCustomerGroupsWarningLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsWarningLimit,
|
|
10660
10544
|
hasReachedCustomerGroupsErrorLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsErrorLimit;
|
|
10661
|
-
if (!
|
|
10545
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
10662
10546
|
return jsxRuntime.jsx("div", {});
|
|
10663
10547
|
}
|
|
10664
10548
|
if (hasReachedCustomerGroupsErrorLimit) {
|
|
@@ -10709,16 +10593,15 @@ var styles$9 = {
|
|
|
10709
10593
|
"status": "platform-limits-customer-groups-status-module__status___6099G"
|
|
10710
10594
|
};
|
|
10711
10595
|
const PlatformLimitsCustomerGroupsStatus = () => {
|
|
10712
|
-
var _platformLimits$custo;
|
|
10713
10596
|
const intl = reactIntl.useIntl();
|
|
10714
10597
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10715
10598
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10716
|
-
if (!
|
|
10599
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
10717
10600
|
return null;
|
|
10718
10601
|
}
|
|
10719
|
-
const _platformLimits$
|
|
10720
|
-
current = _platformLimits$
|
|
10721
|
-
limit = _platformLimits$
|
|
10602
|
+
const _platformLimits$custo = platformLimits.customerGroups.total,
|
|
10603
|
+
current = _platformLimits$custo.current,
|
|
10604
|
+
limit = _platformLimits$custo.limit;
|
|
10722
10605
|
return jsxRuntime.jsx("div", {
|
|
10723
10606
|
className: styles$9.status,
|
|
10724
10607
|
children: jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
@@ -10950,7 +10833,7 @@ var fetchPimIndexStatus = ((apolloClient, projectKey) => async dispatch => {
|
|
|
10950
10833
|
try {
|
|
10951
10834
|
await dispatch(sdk.actions.head({
|
|
10952
10835
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.PIM_SEARCH,
|
|
10953
|
-
uri:
|
|
10836
|
+
uri: `/${projectKey}/search/products`
|
|
10954
10837
|
}));
|
|
10955
10838
|
return {
|
|
10956
10839
|
status: 'indexed'
|
|
@@ -11041,8 +10924,8 @@ const getIndexingJobIds = _ref => {
|
|
|
11041
10924
|
products = _ref$data.products,
|
|
11042
10925
|
productTypes = _ref$data.productTypes;
|
|
11043
10926
|
return {
|
|
11044
|
-
productsJobId:
|
|
11045
|
-
productTypesJobId:
|
|
10927
|
+
productsJobId: products?.indexingJobId || products?.existingIndexingJobId,
|
|
10928
|
+
productTypesJobId: productTypes?.indexingJobId || productTypes?.existingIndexingJobId
|
|
11046
10929
|
};
|
|
11047
10930
|
};
|
|
11048
10931
|
let PimIndexerProvider = /*#__PURE__*/function (_PureComponent) {
|
|
@@ -11306,7 +11189,6 @@ const valueMapping = {
|
|
|
11306
11189
|
all: [true, false]
|
|
11307
11190
|
};
|
|
11308
11191
|
const BooleanField = props => {
|
|
11309
|
-
var _context;
|
|
11310
11192
|
let selectedValue;
|
|
11311
11193
|
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]);
|
|
11312
11194
|
const yesLabel = props.intl.formatMessage(messages$8.yes);
|
|
@@ -11320,7 +11202,7 @@ const BooleanField = props => {
|
|
|
11320
11202
|
}];
|
|
11321
11203
|
if (props.isMulti) options.push({
|
|
11322
11204
|
value: 'all',
|
|
11323
|
-
label:
|
|
11205
|
+
label: `${yesLabel} / ${noLabel}`
|
|
11324
11206
|
});
|
|
11325
11207
|
return jsxRuntime.jsx(uiKit.SelectInput, {
|
|
11326
11208
|
name: props.name,
|
|
@@ -11484,19 +11366,19 @@ const ScrollToFieldError = () => {
|
|
|
11484
11366
|
if (isValid) return;
|
|
11485
11367
|
const firstErrorElement = document.querySelector('[aria-invalid="true"]');
|
|
11486
11368
|
if (firstErrorElement) {
|
|
11487
|
-
var _ref, _ref2, _document$querySelect, _elementToScrollTo$sc;
|
|
11488
11369
|
// Get a reference to the label.
|
|
11489
11370
|
const firstElementId = firstErrorElement.getAttribute('id');
|
|
11490
|
-
const localizedInputIndex = _indexOfInstanceProperty__default["default"](firstElementId).call(firstElementId,
|
|
11371
|
+
const localizedInputIndex = _indexOfInstanceProperty__default["default"](firstElementId).call(firstElementId, `.${dataLocale}`);
|
|
11491
11372
|
|
|
11492
11373
|
// check if locale is appended then remove it from id
|
|
11493
|
-
const id = localizedInputIndex > -1 ? firstElementId.replace(
|
|
11374
|
+
const id = localizedInputIndex > -1 ? firstElementId.replace(`.${dataLocale}`, '') : firstElementId;
|
|
11494
11375
|
|
|
11495
11376
|
// Scroll to the label (if found), otherwise to the input element itself.
|
|
11496
11377
|
|
|
11497
|
-
const elementToScrollTo =
|
|
11498
|
-
|
|
11499
|
-
(
|
|
11378
|
+
const elementToScrollTo =
|
|
11379
|
+
// div is used only for custom fields
|
|
11380
|
+
document.querySelector(`div[aria-errormessage="${firstElementId}"]`) ?? document.querySelector(`label[for="${id}"]`) ?? document.querySelector(`label#${id}`) ?? firstErrorElement;
|
|
11381
|
+
elementToScrollTo.scrollIntoView?.({
|
|
11500
11382
|
behavior: 'smooth'
|
|
11501
11383
|
});
|
|
11502
11384
|
}
|
|
@@ -11522,8 +11404,7 @@ var styles$4 = {
|
|
|
11522
11404
|
"search-mode-menu": "selectable-field-search-input-module__search-mode-menu___Od6Le"
|
|
11523
11405
|
};
|
|
11524
11406
|
const SelectableFieldSearchInput = props => {
|
|
11525
|
-
|
|
11526
|
-
const _useState = React.useState((_props$initialValue = props.initialValue) !== null && _props$initialValue !== void 0 ? _props$initialValue : ''),
|
|
11407
|
+
const _useState = React.useState(props.initialValue ?? ''),
|
|
11527
11408
|
_useState2 = _slicedToArray(_useState, 2),
|
|
11528
11409
|
searchText = _useState2[0],
|
|
11529
11410
|
setSearchText = _useState2[1];
|
|
@@ -11559,7 +11440,7 @@ const SelectableFieldSearchInput = props => {
|
|
|
11559
11440
|
});
|
|
11560
11441
|
},
|
|
11561
11442
|
onReset: props.onReset,
|
|
11562
|
-
placeholder:
|
|
11443
|
+
placeholder: props.placeholder ?? intl.formatMessage(messages$5.placeholder),
|
|
11563
11444
|
isDisabled: props.disabled
|
|
11564
11445
|
})
|
|
11565
11446
|
});
|
|
@@ -11620,7 +11501,6 @@ StoreSelectField.defaultProps = {
|
|
|
11620
11501
|
mappedValueField: 'id'
|
|
11621
11502
|
};
|
|
11622
11503
|
|
|
11623
|
-
var _templateObject;
|
|
11624
11504
|
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; }
|
|
11625
11505
|
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; }
|
|
11626
11506
|
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -11699,7 +11579,10 @@ const VALIDATOR_INTEGER = {
|
|
|
11699
11579
|
* has emitted a warning once in the logs, not for every instance
|
|
11700
11580
|
*/
|
|
11701
11581
|
let hasWarned = false;
|
|
11702
|
-
const warningMessage = commonTags.oneLineTrim
|
|
11582
|
+
const warningMessage = commonTags.oneLineTrim`
|
|
11583
|
+
\`validatedInput\` is no longer supported.
|
|
11584
|
+
Please use \`formik\` instead.
|
|
11585
|
+
`;
|
|
11703
11586
|
const ToolTipWrapperComponent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
11704
11587
|
let children = _ref.children;
|
|
11705
11588
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
@@ -11848,7 +11731,7 @@ function validatedInput(InnerComponent, validators) {
|
|
|
11848
11731
|
}]);
|
|
11849
11732
|
return ValidatedInput;
|
|
11850
11733
|
}(React.PureComponent);
|
|
11851
|
-
ValidatedInput.displayName =
|
|
11734
|
+
ValidatedInput.displayName = `ValidatedInput(${_InnerComponent.displayName})`;
|
|
11852
11735
|
ValidatedInput.defaultProps = {
|
|
11853
11736
|
isValid: true,
|
|
11854
11737
|
getInputRef: () => {}
|
|
@@ -11990,7 +11873,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
11990
11873
|
truncate: true,
|
|
11991
11874
|
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$2.filterWholeInput), {}, {
|
|
11992
11875
|
values: {
|
|
11993
|
-
values: "
|
|
11876
|
+
values: `"${props.value}"`
|
|
11994
11877
|
}
|
|
11995
11878
|
})
|
|
11996
11879
|
})
|
|
@@ -12003,7 +11886,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
12003
11886
|
truncate: true,
|
|
12004
11887
|
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$2.filterSeparateValues), {}, {
|
|
12005
11888
|
values: {
|
|
12006
|
-
values: "
|
|
11889
|
+
values: `"${props.multiValue.join('", "')}"` || props.value
|
|
12007
11890
|
}
|
|
12008
11891
|
})
|
|
12009
11892
|
})
|
|
@@ -12295,17 +12178,16 @@ function isEmpty(value) {
|
|
|
12295
12178
|
}
|
|
12296
12179
|
|
|
12297
12180
|
const buildSearchQuery = (searchQuery, searchMode, fragments) => {
|
|
12298
|
-
var _fragments$searchMode;
|
|
12299
12181
|
if (!searchQuery) return '';
|
|
12300
12182
|
const buildAllFieldsQueryString = query => {
|
|
12301
12183
|
const fragmentsArray = _Object$values__default["default"](fragments);
|
|
12302
|
-
return
|
|
12184
|
+
return `( ${_mapInstanceProperty__default["default"](fragmentsArray).call(fragmentsArray, fragment => fragment.getQuery(query)).join(' or ')} )`;
|
|
12303
12185
|
};
|
|
12304
12186
|
const trimmedSearchQuery = oneLine__default["default"](searchQuery);
|
|
12305
12187
|
if (searchMode === 'allFields') {
|
|
12306
12188
|
return buildAllFieldsQueryString(trimmedSearchQuery);
|
|
12307
12189
|
}
|
|
12308
|
-
if (!fragments[searchMode] || typeof
|
|
12190
|
+
if (!fragments[searchMode] || typeof fragments[searchMode]?.getQuery !== 'function') {
|
|
12309
12191
|
return '';
|
|
12310
12192
|
}
|
|
12311
12193
|
return fragments[searchMode].getQuery(trimmedSearchQuery);
|
|
@@ -12536,11 +12418,11 @@ function createResourceReducer(options) {
|
|
|
12536
12418
|
|
|
12537
12419
|
// TODO: validate constant keys
|
|
12538
12420
|
const actionsMap = {
|
|
12539
|
-
[
|
|
12421
|
+
[`${plural}_FETCHED`]: (_, action) => ({
|
|
12540
12422
|
currentQueryResult: action.payload
|
|
12541
12423
|
}),
|
|
12542
|
-
[
|
|
12543
|
-
[
|
|
12424
|
+
[`${single}_UPDATED_IN_LIST`]: updateStatusInList(mergeData),
|
|
12425
|
+
[`${single}_DELETED_IN_LIST`]: (state, _ref) => {
|
|
12544
12426
|
let payload = _ref.payload;
|
|
12545
12427
|
const results = state.currentQueryResult.results;
|
|
12546
12428
|
return {
|
|
@@ -12552,27 +12434,27 @@ function createResourceReducer(options) {
|
|
|
12552
12434
|
})
|
|
12553
12435
|
};
|
|
12554
12436
|
},
|
|
12555
|
-
[
|
|
12437
|
+
[`${single}_FETCHED`]: (_, _ref3) => {
|
|
12556
12438
|
let payload = _ref3.payload;
|
|
12557
12439
|
return {
|
|
12558
12440
|
currentVisible: payload
|
|
12559
12441
|
};
|
|
12560
12442
|
},
|
|
12561
|
-
[
|
|
12443
|
+
[`${single}_CREATED`]: (_ref4, _ref5) => {
|
|
12562
12444
|
let currentVisible = _ref4.currentVisible;
|
|
12563
12445
|
let payload = _ref5.payload;
|
|
12564
12446
|
return {
|
|
12565
12447
|
currentVisible: mergeData(payload, currentVisible)
|
|
12566
12448
|
};
|
|
12567
12449
|
},
|
|
12568
|
-
[
|
|
12450
|
+
[`${single}_UPDATED`]: (_ref6, _ref7) => {
|
|
12569
12451
|
let currentVisible = _ref6.currentVisible;
|
|
12570
12452
|
let payload = _ref7.payload;
|
|
12571
12453
|
return {
|
|
12572
12454
|
currentVisible: mergeData(payload, currentVisible)
|
|
12573
12455
|
};
|
|
12574
12456
|
},
|
|
12575
|
-
[
|
|
12457
|
+
[`${single}_DELETED`]: () => ({
|
|
12576
12458
|
currentVisible: null
|
|
12577
12459
|
})
|
|
12578
12460
|
};
|
|
@@ -12589,12 +12471,11 @@ function formatCustomerAddress(_ref) {
|
|
|
12589
12471
|
}
|
|
12590
12472
|
|
|
12591
12473
|
function formatCustomerName(_ref) {
|
|
12592
|
-
var _context;
|
|
12593
12474
|
let firstName = _ref.firstName,
|
|
12594
12475
|
lastName = _ref.lastName;
|
|
12595
12476
|
if (firstName && !lastName) return _trimInstanceProperty__default["default"](firstName).call(firstName);
|
|
12596
12477
|
if (!firstName && lastName) return _trimInstanceProperty__default["default"](lastName).call(lastName);
|
|
12597
|
-
if (firstName && lastName) return
|
|
12478
|
+
if (firstName && lastName) return `${_trimInstanceProperty__default["default"](firstName).call(firstName)} ${_trimInstanceProperty__default["default"](lastName).call(lastName)}`;
|
|
12598
12479
|
return constants.NO_VALUE_FALLBACK;
|
|
12599
12480
|
}
|
|
12600
12481
|
|
|
@@ -12644,10 +12525,7 @@ const validateText = (text, intl) => {
|
|
|
12644
12525
|
* @returns {boolean}
|
|
12645
12526
|
*/
|
|
12646
12527
|
const hasErrorCode = (unmappedApiErrors, errorCode) => {
|
|
12647
|
-
return _Array$isArray__default["default"](unmappedApiErrors) && _someInstanceProperty__default["default"](unmappedApiErrors).call(unmappedApiErrors, error =>
|
|
12648
|
-
var _error$extensions;
|
|
12649
|
-
return ((_error$extensions = error.extensions) === null || _error$extensions === void 0 ? void 0 : _error$extensions.code) === errorCode;
|
|
12650
|
-
});
|
|
12528
|
+
return _Array$isArray__default["default"](unmappedApiErrors) && _someInstanceProperty__default["default"](unmappedApiErrors).call(unmappedApiErrors, error => error.extensions?.code === errorCode);
|
|
12651
12529
|
};
|
|
12652
12530
|
|
|
12653
12531
|
const hasInvalidInputError = errors => hasErrorCode(errors, ERROR_CODES.invalidInput);
|
|
@@ -12659,7 +12537,7 @@ function minusify(value) {
|
|
|
12659
12537
|
return minus.concat(value);
|
|
12660
12538
|
}
|
|
12661
12539
|
|
|
12662
|
-
const flattenOperator = (operator, clauses) => compact__default["default"](_reduceInstanceProperty__default["default"](clauses).call(clauses, (result, clause) => _concatInstanceProperty__default["default"](result).call(result,
|
|
12540
|
+
const flattenOperator = (operator, clauses) => compact__default["default"](_reduceInstanceProperty__default["default"](clauses).call(clauses, (result, clause) => _concatInstanceProperty__default["default"](result).call(result, clause?.[operator] || clause), []));
|
|
12663
12541
|
const argsToArray = args => _reduceInstanceProperty__default["default"](args).call(args, (result, item) => _concatInstanceProperty__default["default"](result).call(result, item), []);
|
|
12664
12542
|
const exists = (field, attributeType) => ({
|
|
12665
12543
|
exists: {
|
|
@@ -12716,7 +12594,7 @@ const not = function () {
|
|
|
12716
12594
|
|
|
12717
12595
|
const safelyAddFallback = function (string) {
|
|
12718
12596
|
let fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : constants.NO_VALUE_FALLBACK;
|
|
12719
|
-
return string === '' ? fallback : string
|
|
12597
|
+
return string === '' ? fallback : string ?? fallback;
|
|
12720
12598
|
};
|
|
12721
12599
|
|
|
12722
12600
|
var messages$1 = reactIntl.defineMessages({
|
|
@@ -12851,19 +12729,19 @@ const computedProperties = {
|
|
|
12851
12729
|
// has been deleted. See MC-1925 for further information.
|
|
12852
12730
|
const filteredCategories = _filterInstanceProperty__default["default"](_context6 = product.categories).call(_context6, category => category.obj !== undefined);
|
|
12853
12731
|
return _mapInstanceProperty__default["default"](filteredCategories).call(filteredCategories, category => {
|
|
12854
|
-
var _context7;
|
|
12855
12732
|
const categoryPath = getPathName(category, language, languages);
|
|
12856
12733
|
const ancestors = getAncestors(category, language);
|
|
12857
|
-
const externalIdValue = category.obj.externalId ?
|
|
12734
|
+
const externalIdValue = category.obj.externalId ?
|
|
12735
|
+
// hardcoding "ext. ID" since this is not part of a message to be
|
|
12858
12736
|
// translated. This has been communicated with Jenn
|
|
12859
|
-
|
|
12737
|
+
`| ext. ID: ${category.obj.externalId}` : '';
|
|
12860
12738
|
return {
|
|
12861
12739
|
id: category.id,
|
|
12862
|
-
name:
|
|
12740
|
+
name: `${l10n.formatLocalizedString(category.obj, {
|
|
12863
12741
|
key: 'name',
|
|
12864
12742
|
locale: language,
|
|
12865
12743
|
fallbackOrder: languages
|
|
12866
|
-
})
|
|
12744
|
+
})} ${externalIdValue}`,
|
|
12867
12745
|
path: categoryPath,
|
|
12868
12746
|
level: ancestors.length
|
|
12869
12747
|
};
|
|
@@ -12900,13 +12778,13 @@ const getAttributeValueByType = _ref12 => {
|
|
|
12900
12778
|
value: value
|
|
12901
12779
|
});
|
|
12902
12780
|
case 'enum':
|
|
12903
|
-
return safelyAddFallback(value.label,
|
|
12781
|
+
return safelyAddFallback(value.label, `${value.key} (key)`);
|
|
12904
12782
|
case 'lenum':
|
|
12905
12783
|
return safelyAddFallback(l10n.formatLocalizedString(value, {
|
|
12906
12784
|
key: 'label',
|
|
12907
12785
|
locale: projectDataLocale,
|
|
12908
12786
|
fallbackOrder: projectLanguages
|
|
12909
|
-
}),
|
|
12787
|
+
}), `${value.key} (key)`);
|
|
12910
12788
|
case 'number':
|
|
12911
12789
|
return safelyAddFallback(value);
|
|
12912
12790
|
case 'boolean':
|
|
@@ -13029,7 +12907,6 @@ const reorderArrayItems = (array, from, to) => {
|
|
|
13029
12907
|
const mapTimeZonesToOptions = memoize__default["default"](timeZones => {
|
|
13030
12908
|
var _context;
|
|
13031
12909
|
return _mapInstanceProperty__default["default"](_context = _Object$entries__default["default"](timeZones)).call(_context, _ref => {
|
|
13032
|
-
var _context2;
|
|
13033
12910
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
13034
12911
|
code = _ref2[0],
|
|
13035
12912
|
value = _ref2[1];
|
|
@@ -13038,7 +12915,7 @@ const mapTimeZonesToOptions = memoize__default["default"](timeZones => {
|
|
|
13038
12915
|
//E.g. `(GMT +02:00) Central European Time - Berlin`
|
|
13039
12916
|
// unicode clock hex code: \u25F7
|
|
13040
12917
|
//
|
|
13041
|
-
label:
|
|
12918
|
+
label: `(GMT ${value.offset}) ${value.name}`
|
|
13042
12919
|
};
|
|
13043
12920
|
});
|
|
13044
12921
|
});
|
|
@@ -13046,12 +12923,9 @@ const getTimeZoneId = memoize__default["default"]((selectedTimeZone, timeZones)
|
|
|
13046
12923
|
if (timeZones[selectedTimeZone]) {
|
|
13047
12924
|
return selectedTimeZone;
|
|
13048
12925
|
} else {
|
|
13049
|
-
var
|
|
13050
|
-
const fallbackTimeZoneId = _findInstanceProperty__default["default"](
|
|
13051
|
-
|
|
13052
|
-
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);
|
|
13053
|
-
});
|
|
13054
|
-
if (fallbackTimeZoneId !== null && fallbackTimeZoneId !== void 0 && fallbackTimeZoneId.length) {
|
|
12926
|
+
var _context2;
|
|
12927
|
+
const fallbackTimeZoneId = _findInstanceProperty__default["default"](_context2 = _Object$keys__default["default"](timeZones)).call(_context2, timeZoneId => timeZones[timeZoneId]?.translationFor?.some(fallbackTimeZone => fallbackTimeZone === selectedTimeZone));
|
|
12928
|
+
if (fallbackTimeZoneId?.length) {
|
|
13055
12929
|
return fallbackTimeZoneId.toString();
|
|
13056
12930
|
} else {
|
|
13057
12931
|
return 'UTC';
|
|
@@ -13059,10 +12933,9 @@ const getTimeZoneId = memoize__default["default"]((selectedTimeZone, timeZones)
|
|
|
13059
12933
|
}
|
|
13060
12934
|
});
|
|
13061
12935
|
const getTimeZoneLabel = memoize__default["default"]((selectedTimeZone, timeZones) => {
|
|
13062
|
-
var _context4;
|
|
13063
12936
|
const timeZoneId = getTimeZoneId(selectedTimeZone, timeZones);
|
|
13064
12937
|
const timeZoneData = timeZones[timeZoneId];
|
|
13065
|
-
return
|
|
12938
|
+
return `(GMT ${timeZoneData.offset}) ${timeZoneData.name}`;
|
|
13066
12939
|
});
|
|
13067
12940
|
|
|
13068
12941
|
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; }
|
|
@@ -13123,8 +12996,7 @@ const typeDefinitionsExist = typeDefinitions => {
|
|
|
13123
12996
|
return typeDefinitions.length > 0;
|
|
13124
12997
|
};
|
|
13125
12998
|
const typeDefinitionSelected = formValues => {
|
|
13126
|
-
|
|
13127
|
-
return ((_formValues$FIELD_NAM = formValues[FIELD_NAME]) === null || _formValues$FIELD_NAM === void 0 ? void 0 : _formValues$FIELD_NAM.type) && ((_formValues$FIELD_NAM2 = formValues[FIELD_NAME]) === null || _formValues$FIELD_NAM2 === void 0 || (_formValues$FIELD_NAM2 = _formValues$FIELD_NAM2.type) === null || _formValues$FIELD_NAM2 === void 0 ? void 0 : _formValues$FIELD_NAM2.obj);
|
|
12999
|
+
return formValues[FIELD_NAME]?.type && formValues[FIELD_NAME]?.type?.obj;
|
|
13128
13000
|
};
|
|
13129
13001
|
const typeDefinitionContainsFieldDefinitions = formValues => {
|
|
13130
13002
|
return formValues[FIELD_NAME].type.obj.key && formValues[FIELD_NAME].type.obj.fieldDefinitions.length > 0;
|
|
@@ -13159,7 +13031,7 @@ const CustomFieldsInputWrapper = _ref2 => {
|
|
|
13159
13031
|
max: "scale",
|
|
13160
13032
|
children: jsxRuntime.jsx(CustomFields, {
|
|
13161
13033
|
isReadOnly: isReadOnly,
|
|
13162
|
-
name:
|
|
13034
|
+
name: `${FIELD_NAME}.fields`,
|
|
13163
13035
|
fieldDefinitions: isReadOnly && hideEmptyFields ? fieldDefinitionsWithValues(formValues) : formValues[FIELD_NAME].type.obj.fieldDefinitions
|
|
13164
13036
|
})
|
|
13165
13037
|
});
|
|
@@ -13194,7 +13066,6 @@ const createFormStateFromTypeDefinition = selectedTypeDefinition => {
|
|
|
13194
13066
|
};
|
|
13195
13067
|
};
|
|
13196
13068
|
const CustomTypeSubform = _ref => {
|
|
13197
|
-
var _formValues$FIELD_NAM3, _formValues$FIELD_NAM4;
|
|
13198
13069
|
let typeDefinitions = _ref.typeDefinitions,
|
|
13199
13070
|
isReadOnly = _ref.isReadOnly,
|
|
13200
13071
|
isCondensed = _ref.isCondensed,
|
|
@@ -13226,8 +13097,7 @@ const CustomTypeSubform = _ref => {
|
|
|
13226
13097
|
}
|
|
13227
13098
|
}, [typeDefinitions, setFieldValue, validateForm]);
|
|
13228
13099
|
const typeDefinitionSelected = formValues => {
|
|
13229
|
-
|
|
13230
|
-
return ((_formValues$FIELD_NAM = formValues[FIELD_NAME]) === null || _formValues$FIELD_NAM === void 0 ? void 0 : _formValues$FIELD_NAM.type) && ((_formValues$FIELD_NAM2 = formValues[FIELD_NAME]) === null || _formValues$FIELD_NAM2 === void 0 || (_formValues$FIELD_NAM2 = _formValues$FIELD_NAM2.type) === null || _formValues$FIELD_NAM2 === void 0 ? void 0 : _formValues$FIELD_NAM2.obj);
|
|
13100
|
+
return formValues[FIELD_NAME]?.type && formValues[FIELD_NAME]?.type?.obj;
|
|
13231
13101
|
};
|
|
13232
13102
|
|
|
13233
13103
|
// if the user has read-only permissions, empty fields are hidden, and no type definition is selected, hide the component
|
|
@@ -13242,9 +13112,9 @@ const CustomTypeSubform = _ref => {
|
|
|
13242
13112
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
13243
13113
|
isClearable: true,
|
|
13244
13114
|
"data-testid": "custom-type-select",
|
|
13245
|
-
name:
|
|
13246
|
-
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages,
|
|
13247
|
-
value:
|
|
13115
|
+
name: `${FIELD_NAME}.type.obj.key`,
|
|
13116
|
+
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages, formValues[FIELD_NAME]?.type?.id),
|
|
13117
|
+
value: formValues[FIELD_NAME]?.type?.obj?.key,
|
|
13248
13118
|
onChange: handleTypeDefinitionSelect,
|
|
13249
13119
|
placeholder: formatMessage(messages.typesPlaceholder),
|
|
13250
13120
|
isReadOnly: isReadOnly
|
|
@@ -13263,8 +13133,7 @@ CustomTypeSubform.displayName = 'CustomTypeSubform';
|
|
|
13263
13133
|
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; }
|
|
13264
13134
|
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; }
|
|
13265
13135
|
const transformFieldType = fieldDefinition => {
|
|
13266
|
-
|
|
13267
|
-
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') {
|
|
13136
|
+
if (fieldDefinition.type?.elementType?.name === 'LocalizedEnum') {
|
|
13268
13137
|
var _context;
|
|
13269
13138
|
return _objectSpread(_objectSpread({}, fieldDefinition.type), {}, {
|
|
13270
13139
|
elementType: _objectSpread(_objectSpread({}, fieldDefinition.type.elementType), {}, {
|
|
@@ -13274,7 +13143,7 @@ const transformFieldType = fieldDefinition => {
|
|
|
13274
13143
|
}))
|
|
13275
13144
|
})
|
|
13276
13145
|
});
|
|
13277
|
-
} else if (
|
|
13146
|
+
} else if (fieldDefinition.type?.name === 'LocalizedEnum') {
|
|
13278
13147
|
var _context2;
|
|
13279
13148
|
return _objectSpread(_objectSpread({}, fieldDefinition.type), {}, {
|
|
13280
13149
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context2, value => ({
|