@commercetools-frontend/experimental-components 5.4.4 → 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 +457 -603
- package/dist/commercetools-frontend-experimental-components.cjs.prod.js +455 -601
- package/dist/commercetools-frontend-experimental-components.esm.js +455 -601
- package/dist/styles.css +24 -24
- 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');
|
|
@@ -80,7 +78,6 @@ 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
|
-
extraWhere:
|
|
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);
|
|
@@ -3732,24 +3695,21 @@ const useHandlers = onChange => {
|
|
|
3732
3695
|
|
|
3733
3696
|
const _excluded$1 = ["extraWhere"];
|
|
3734
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; }
|
|
3735
|
-
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; }
|
|
3736
3699
|
const constructPrefixSearchPredicate = function () {
|
|
3737
3700
|
let prefixSearchFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
3738
3701
|
let lowerBound = arguments.length > 1 ? arguments[1] : undefined;
|
|
3739
3702
|
let upperBound = arguments.length > 2 ? arguments[2] : undefined;
|
|
3740
3703
|
const constructPrefixSearchExpression = field => {
|
|
3741
|
-
var _context
|
|
3704
|
+
var _context;
|
|
3742
3705
|
const path = field.split('.');
|
|
3743
3706
|
const _path$slice$reverse = _reverseInstanceProperty__default["default"](_context = _sliceInstanceProperty__default["default"](path).call(path)).call(_context),
|
|
3744
3707
|
_path$slice$reverse2 = _toArray(_path$slice$reverse),
|
|
3745
3708
|
finalValueInPath = _path$slice$reverse2[0],
|
|
3746
3709
|
remainPathInReverse = _sliceInstanceProperty__default["default"](_path$slice$reverse2).call(_path$slice$reverse2, 1);
|
|
3747
|
-
const comparison =
|
|
3710
|
+
const comparison = `${finalValueInPath} >= "${lowerBound}" and ${finalValueInPath} < "${upperBound}"`;
|
|
3748
3711
|
if (remainPathInReverse.length) {
|
|
3749
|
-
return _reduceInstanceProperty__default["default"](remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) => {
|
|
3750
|
-
var _context5;
|
|
3751
|
-
return _concatInstanceProperty__default["default"](_context5 = "".concat(nextPath, "(")).call(_context5, nestedPath, ")");
|
|
3752
|
-
}, comparison);
|
|
3712
|
+
return _reduceInstanceProperty__default["default"](remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) => `${nextPath}(${nestedPath})`, comparison);
|
|
3753
3713
|
}
|
|
3754
3714
|
return comparison;
|
|
3755
3715
|
};
|
|
@@ -3765,7 +3725,7 @@ const useLoadOptions = _ref => {
|
|
|
3765
3725
|
let where;
|
|
3766
3726
|
if (inputValue.length) {
|
|
3767
3727
|
if (isUUID(inputValue)) {
|
|
3768
|
-
where =
|
|
3728
|
+
where = `id = "${inputValue}"`;
|
|
3769
3729
|
} else {
|
|
3770
3730
|
const _getPrefixSearchBound = getPrefixSearchBounds(inputValue),
|
|
3771
3731
|
_getPrefixSearchBound2 = _slicedToArray(_getPrefixSearchBound, 2),
|
|
@@ -3774,12 +3734,11 @@ const useLoadOptions = _ref => {
|
|
|
3774
3734
|
where = constructPrefixSearchPredicate(prefixSearchFields, lowerBound, upperBound);
|
|
3775
3735
|
}
|
|
3776
3736
|
}
|
|
3777
|
-
const _ref2 = variables
|
|
3737
|
+
const _ref2 = variables ?? {},
|
|
3778
3738
|
extraWhere = _ref2.extraWhere,
|
|
3779
3739
|
restVariables = _objectWithoutProperties(_ref2, _excluded$1);
|
|
3780
3740
|
if (typeof extraWhere === 'string') {
|
|
3781
|
-
|
|
3782
|
-
where = where ? _concatInstanceProperty__default["default"](_context6 = "(".concat(where, ") and ")).call(_context6, variables.extraWhere) : variables.extraWhere;
|
|
3741
|
+
where = where ? `(${where}) and ${variables.extraWhere}` : variables.extraWhere;
|
|
3783
3742
|
}
|
|
3784
3743
|
return client$1.query({
|
|
3785
3744
|
query,
|
|
@@ -3796,7 +3755,6 @@ const useLoadOptions = _ref => {
|
|
|
3796
3755
|
};
|
|
3797
3756
|
|
|
3798
3757
|
function useCurrentOption(_ref) {
|
|
3799
|
-
var _context;
|
|
3800
3758
|
let id = _ref.id,
|
|
3801
3759
|
typename = _ref.typename,
|
|
3802
3760
|
query = _ref.query,
|
|
@@ -3808,7 +3766,7 @@ function useCurrentOption(_ref) {
|
|
|
3808
3766
|
// load from cache when possible to speed up initial render
|
|
3809
3767
|
const canReadFromCache = id && typename && fragment;
|
|
3810
3768
|
const cacheItem = canReadFromCache ? apolloClient.readFragment({
|
|
3811
|
-
id:
|
|
3769
|
+
id: `${typename}:${id}`,
|
|
3812
3770
|
fragment
|
|
3813
3771
|
}) : undefined;
|
|
3814
3772
|
|
|
@@ -3826,7 +3784,7 @@ function useCurrentOption(_ref) {
|
|
|
3826
3784
|
queryData = _useQuery.data,
|
|
3827
3785
|
queryError = _useQuery.error;
|
|
3828
3786
|
const queryItem = queryData && queryDataToItem(queryData);
|
|
3829
|
-
const item = queryItem
|
|
3787
|
+
const item = queryItem ?? cacheItem;
|
|
3830
3788
|
const loading = item ? false : queryLoading;
|
|
3831
3789
|
const error = item ? undefined : queryError;
|
|
3832
3790
|
const data = item && itemToOption(item);
|
|
@@ -3865,7 +3823,6 @@ const convertProductTypeToOption = productType => {
|
|
|
3865
3823
|
};
|
|
3866
3824
|
};
|
|
3867
3825
|
const ProductTypePickerInput = _ref => {
|
|
3868
|
-
var _currentOption$data$l, _currentOption$data;
|
|
3869
3826
|
let isClearable = _ref.isClearable,
|
|
3870
3827
|
isDisabled = _ref.isDisabled,
|
|
3871
3828
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -3896,9 +3853,8 @@ const ProductTypePickerInput = _ref => {
|
|
|
3896
3853
|
itemToOption: convertProductTypeToOption
|
|
3897
3854
|
});
|
|
3898
3855
|
const handleLoadOptions = React.useCallback(inputValue => loadProductTypes(inputValue).then(_ref3 => {
|
|
3899
|
-
var _data$productTypes;
|
|
3900
3856
|
let data = _ref3.data;
|
|
3901
|
-
return
|
|
3857
|
+
return data.productTypes?.results || [];
|
|
3902
3858
|
}).then(productTypes => _mapInstanceProperty__default["default"](productTypes).call(productTypes, convertProductTypeToOption)).catch(error => {
|
|
3903
3859
|
setLoadingError(error);
|
|
3904
3860
|
onError(error);
|
|
@@ -3912,12 +3868,12 @@ const ProductTypePickerInput = _ref => {
|
|
|
3912
3868
|
setLoadingError(null);
|
|
3913
3869
|
handleInternalInputChange(event);
|
|
3914
3870
|
}, [handleInternalInputChange]);
|
|
3915
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
3871
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
3916
3872
|
React.useEffect(() => {
|
|
3917
3873
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
3918
3874
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
3919
3875
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
3920
|
-
const tooltipTitle =
|
|
3876
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
3921
3877
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
3922
3878
|
max: "scale",
|
|
3923
3879
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -3968,7 +3924,6 @@ var messages$C = reactIntl.defineMessages({
|
|
|
3968
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 } } } };
|
|
3969
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 } } } };
|
|
3970
3926
|
const StatePickerInput = _ref => {
|
|
3971
|
-
var _currentOption$data$l, _currentOption$data;
|
|
3972
3927
|
let isClearable = _ref.isClearable,
|
|
3973
3928
|
isDisabled = _ref.isDisabled,
|
|
3974
3929
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -3983,7 +3938,7 @@ const StatePickerInput = _ref => {
|
|
|
3983
3938
|
formatMessage = _useIntl.formatMessage;
|
|
3984
3939
|
const dataLocale = applicationShellConnectors.useApplicationContext(applicationContext => applicationContext.dataLocale);
|
|
3985
3940
|
const variables = React.useMemo(() => ({
|
|
3986
|
-
sortByNamePath:
|
|
3941
|
+
sortByNamePath: `name.${dataLocale}`
|
|
3987
3942
|
}), [dataLocale]);
|
|
3988
3943
|
const convertStateToOption = React.useCallback(state => {
|
|
3989
3944
|
const localizedName = formatLocalizedFieldToString(state.nameAllLocales);
|
|
@@ -3998,7 +3953,7 @@ const StatePickerInput = _ref => {
|
|
|
3998
3953
|
_useState2 = _slicedToArray(_useState, 2),
|
|
3999
3954
|
loadingError = _useState2[0],
|
|
4000
3955
|
setLoadingError = _useState2[1];
|
|
4001
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
3956
|
+
const prefixSearchFields = React.useMemo(() => [`name.${dataLocale}`, 'key'], [dataLocale]);
|
|
4002
3957
|
const loadOptions = useLoadOptions({
|
|
4003
3958
|
query: GetStatesQuery,
|
|
4004
3959
|
variables,
|
|
@@ -4031,13 +3986,13 @@ const StatePickerInput = _ref => {
|
|
|
4031
3986
|
setLoadingError(null);
|
|
4032
3987
|
handleInternalInputChange(event);
|
|
4033
3988
|
}, [handleInternalInputChange]);
|
|
4034
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
3989
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
4035
3990
|
React.useEffect(() => {
|
|
4036
3991
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
4037
3992
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
4038
3993
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
4039
3994
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$C.noStatesFound), [loadingError, formatMessage]);
|
|
4040
|
-
const tooltipTitle =
|
|
3995
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
4041
3996
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
4042
3997
|
max: "scale",
|
|
4043
3998
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -4102,26 +4057,23 @@ const CustomFieldTooltip = _ref => {
|
|
|
4102
4057
|
|
|
4103
4058
|
const setToArray = function () {
|
|
4104
4059
|
let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4105
|
-
return
|
|
4060
|
+
return `id in (${_mapInstanceProperty__default["default"](values).call(values, value => `"${value}"`).join(', ')})`;
|
|
4106
4061
|
};
|
|
4107
4062
|
|
|
4108
4063
|
function capitalizeFirst(text) {
|
|
4109
4064
|
return text.charAt(0).toUpperCase() + _sliceInstanceProperty__default["default"](text).call(text, 1);
|
|
4110
4065
|
}
|
|
4111
4066
|
|
|
4112
|
-
const getCentAmountClause = (value, operator, locale) => {
|
|
4113
|
-
var _context;
|
|
4114
|
-
return _concatInstanceProperty__default["default"](_context = "centAmount ".concat(operator, " ")).call(_context, uiKit.MoneyInput.convertToMoneyValue(value, locale).centAmount);
|
|
4115
|
-
};
|
|
4067
|
+
const getCentAmountClause = (value, operator, locale) => `centAmount ${operator} ${uiKit.MoneyInput.convertToMoneyValue(value, locale).centAmount}`;
|
|
4116
4068
|
function moneyTransformer(value, option, locale) {
|
|
4117
4069
|
const clauses = [];
|
|
4118
4070
|
if (option === FILTER_TYPES.range) {
|
|
4119
|
-
clauses[0] =
|
|
4071
|
+
clauses[0] = `currencyCode = "${value.from.currencyCode}"`;
|
|
4120
4072
|
clauses[1] = getCentAmountClause(value.from, '>=', locale);
|
|
4121
4073
|
clauses[2] = getCentAmountClause(value.to, '<=', locale);
|
|
4122
4074
|
return clauses.join(' and ');
|
|
4123
4075
|
}
|
|
4124
|
-
clauses[0] =
|
|
4076
|
+
clauses[0] = `currencyCode = "${value.currencyCode}"`;
|
|
4125
4077
|
switch (option) {
|
|
4126
4078
|
case FILTER_TYPES.lessThan:
|
|
4127
4079
|
clauses[1] = getCentAmountClause(value, '<', locale);
|
|
@@ -4138,7 +4090,6 @@ function moneyTransformer(value, option, locale) {
|
|
|
4138
4090
|
return clauses.join(' and ');
|
|
4139
4091
|
}
|
|
4140
4092
|
|
|
4141
|
-
var _templateObject$2, _templateObject2$1;
|
|
4142
4093
|
const formatTime = 'HH:mm:ss.SSS';
|
|
4143
4094
|
|
|
4144
4095
|
/* TimeInput only allows HH:mm:ss and adds the seconds as 00 and
|
|
@@ -4160,7 +4111,6 @@ const defaultFilterValidator = _ref => {
|
|
|
4160
4111
|
const timeTransformer = function (filterKey, filters) {
|
|
4161
4112
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator;
|
|
4162
4113
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref2 => {
|
|
4163
|
-
var _context, _context2;
|
|
4164
4114
|
let type = _ref2.type,
|
|
4165
4115
|
value = _ref2.value;
|
|
4166
4116
|
if (!filterValidator({
|
|
@@ -4169,13 +4119,19 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4169
4119
|
})) return '';
|
|
4170
4120
|
switch (type) {
|
|
4171
4121
|
case FILTER_TYPES.lessThan:
|
|
4172
|
-
return
|
|
4122
|
+
return `${filterKey} < "${value}"`;
|
|
4173
4123
|
case FILTER_TYPES.moreThan:
|
|
4174
|
-
return
|
|
4124
|
+
return `${filterKey} > "${value}"`;
|
|
4175
4125
|
case FILTER_TYPES.equalTo:
|
|
4176
|
-
return oneLine__default["default"]
|
|
4126
|
+
return oneLine__default["default"]`
|
|
4127
|
+
(${filterKey} >= "${value}"
|
|
4128
|
+
and ${filterKey} <= "${getEndOfSecond(value)}")
|
|
4129
|
+
`;
|
|
4177
4130
|
case FILTER_TYPES.range:
|
|
4178
|
-
return oneLine__default["default"]
|
|
4131
|
+
return oneLine__default["default"]`
|
|
4132
|
+
(${filterKey} >= "${value.from}"
|
|
4133
|
+
and ${filterKey} <= "${getEndOfSecond(value.to)}")
|
|
4134
|
+
`;
|
|
4179
4135
|
default:
|
|
4180
4136
|
return '';
|
|
4181
4137
|
}
|
|
@@ -4191,7 +4147,7 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4191
4147
|
* (pickUpTime >= "14:00" and pickUpTime <= "15:00")
|
|
4192
4148
|
* ) or some_more_filters
|
|
4193
4149
|
*/
|
|
4194
|
-
return queryString === '' ? null :
|
|
4150
|
+
return queryString === '' ? null : `(${queryString})`;
|
|
4195
4151
|
};
|
|
4196
4152
|
|
|
4197
4153
|
// FIXME: delete once prefix search is supported in ctp api
|
|
@@ -4208,9 +4164,8 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4208
4164
|
// e.g
|
|
4209
4165
|
// where: `masterData(current(name(en >= "${lowerBound}" and en < "${upperBound}")))`
|
|
4210
4166
|
const getPrefixSearchBounds = input => {
|
|
4211
|
-
var _context;
|
|
4212
4167
|
const getNextCharacter = character => String.fromCharCode(character.charCodeAt() + 1);
|
|
4213
|
-
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))}`];
|
|
4214
4169
|
};
|
|
4215
4170
|
|
|
4216
4171
|
const _excluded = ["action"];
|
|
@@ -4403,7 +4358,7 @@ const convertChangeValueAction = actionPayload => {
|
|
|
4403
4358
|
* as its dynamic content can not be typed in SDL for the mutation.
|
|
4404
4359
|
*/
|
|
4405
4360
|
const convertAction = (actionName, actionPayload) => {
|
|
4406
|
-
var
|
|
4361
|
+
var _context3, _context4, _context5;
|
|
4407
4362
|
const getNameFromPayload = payload => {
|
|
4408
4363
|
// changeName for `Organizations`
|
|
4409
4364
|
if (typeof payload.name === 'string') return payload;
|
|
@@ -4461,7 +4416,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4461
4416
|
case 'setCustomType':
|
|
4462
4417
|
return {
|
|
4463
4418
|
[actionName]: {
|
|
4464
|
-
typeId:
|
|
4419
|
+
typeId: actionPayload.type?.id,
|
|
4465
4420
|
fields: actionPayload.fields ? _mapInstanceProperty__default["default"](_context3 = _Object$entries__default["default"](actionPayload.fields)).call(_context3, _ref => {
|
|
4466
4421
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
4467
4422
|
customField = _ref2[0],
|
|
@@ -4491,10 +4446,10 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4491
4446
|
};
|
|
4492
4447
|
case 'setGeoLocation':
|
|
4493
4448
|
return {
|
|
4494
|
-
[actionName]: actionPayload
|
|
4449
|
+
[actionName]: actionPayload?.geoLocation ? {
|
|
4495
4450
|
geoLocation: {
|
|
4496
4451
|
type: 'Point',
|
|
4497
|
-
coordinates: [_parseFloat__default["default"](
|
|
4452
|
+
coordinates: [_parseFloat__default["default"](actionPayload.geoLocation?.longitude), _parseFloat__default["default"](actionPayload.geoLocation?.latitude)]
|
|
4498
4453
|
}
|
|
4499
4454
|
} : {
|
|
4500
4455
|
undefined
|
|
@@ -4630,7 +4585,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4630
4585
|
case 'setShippingRateInputType':
|
|
4631
4586
|
return {
|
|
4632
4587
|
[actionName]: {
|
|
4633
|
-
shippingRateInputType:
|
|
4588
|
+
shippingRateInputType: actionPayload.shippingRateInputType?.type ? {
|
|
4634
4589
|
[actionPayload.shippingRateInputType.type]: {
|
|
4635
4590
|
values: actionPayload.shippingRateInputType.type === 'CartClassification' ? _mapInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](actionPayload.shippingRateInputType)).call(_context4, value => ({
|
|
4636
4591
|
key: value.key,
|
|
@@ -4684,8 +4639,8 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4684
4639
|
case 'addAddress':
|
|
4685
4640
|
case 'changeAddress':
|
|
4686
4641
|
{
|
|
4687
|
-
var
|
|
4688
|
-
const _ref3 =
|
|
4642
|
+
var _context6;
|
|
4643
|
+
const _ref3 = actionPayload.address?.custom || {},
|
|
4689
4644
|
_ref3$fields = _ref3.fields,
|
|
4690
4645
|
fields = _ref3$fields === void 0 ? {} : _ref3$fields;
|
|
4691
4646
|
const customFields = isEmpty__default["default"](fields) ? null : _mapInstanceProperty__default["default"](_context6 = _Object$entries__default["default"](fields)).call(_context6, _ref4 => {
|
|
@@ -4697,7 +4652,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4697
4652
|
value: _JSON$stringify__default["default"](value)
|
|
4698
4653
|
};
|
|
4699
4654
|
});
|
|
4700
|
-
const custom =
|
|
4655
|
+
const custom = actionPayload.address?.custom?.type?.id ? {
|
|
4701
4656
|
type: {
|
|
4702
4657
|
id: actionPayload.address.custom.type.id
|
|
4703
4658
|
},
|
|
@@ -4728,7 +4683,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4728
4683
|
value: _JSON$stringify__default["default"](value)
|
|
4729
4684
|
};
|
|
4730
4685
|
});
|
|
4731
|
-
const customType = type
|
|
4686
|
+
const customType = type?.id ? {
|
|
4732
4687
|
id: type.id
|
|
4733
4688
|
} : null;
|
|
4734
4689
|
return {
|
|
@@ -4751,11 +4706,10 @@ const createGraphQlUpdateActions = actions => _reduceInstanceProperty__default["
|
|
|
4751
4706
|
return [...previousActions, convertAction(actionName, actionPayload)];
|
|
4752
4707
|
}, []);
|
|
4753
4708
|
const extractErrorFromGraphQlResponse = graphQlResponse => {
|
|
4754
|
-
|
|
4755
|
-
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) {
|
|
4756
4710
|
return graphQlResponse.networkError.result.errors;
|
|
4757
4711
|
}
|
|
4758
|
-
if (
|
|
4712
|
+
if (graphQlResponse.graphQLErrors?.length > 0) {
|
|
4759
4713
|
return graphQlResponse.graphQLErrors;
|
|
4760
4714
|
}
|
|
4761
4715
|
return graphQlResponse;
|
|
@@ -4784,16 +4738,14 @@ function omitDeep(obj, fieldsToOmit) {
|
|
|
4784
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; }
|
|
4785
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; }
|
|
4786
4740
|
function getPriceChannelName(price) {
|
|
4787
|
-
|
|
4788
|
-
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;
|
|
4789
4742
|
}
|
|
4790
4743
|
function getDiscountValue(price) {
|
|
4791
|
-
var _price$value, _price$value2, _price$discounted;
|
|
4792
4744
|
let preciseAmount;
|
|
4793
4745
|
let fractionedAmount;
|
|
4794
|
-
if (
|
|
4746
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision && price.discounted.value.type === PRECISION_TYPES.highPrecision) {
|
|
4795
4747
|
preciseAmount = price.value.preciseAmount - price.discounted.value.preciseAmount;
|
|
4796
|
-
} else if (
|
|
4748
|
+
} else if (price.value?.type === PRECISION_TYPES.highPrecision && price.discounted?.value?.type === PRECISION_TYPES.centPrecision) {
|
|
4797
4749
|
fractionedAmount = getFractionedAmount(price.value) - getFractionedAmount(price.discounted.value);
|
|
4798
4750
|
}
|
|
4799
4751
|
return price.discounted ? _objectSpread$13(_objectSpread$13({}, price.value), {}, {
|
|
@@ -4807,28 +4759,23 @@ function getDiscountValue(price) {
|
|
|
4807
4759
|
function getSelectedPrice(price) {
|
|
4808
4760
|
return price.discounted ? price.discounted : price;
|
|
4809
4761
|
}
|
|
4810
|
-
function getNetUnitPrice(
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
shouldRoundAmount = _ref2.shouldRoundAmount;
|
|
4762
|
+
function getNetUnitPrice(_ref) {
|
|
4763
|
+
let lineItem = _ref.lineItem,
|
|
4764
|
+
shouldRoundAmount = _ref.shouldRoundAmount;
|
|
4814
4765
|
const price = getSelectedPrice(lineItem.price);
|
|
4815
|
-
const filteredPerMethodTaxRate = lineItem
|
|
4816
|
-
var _lineItem$shippingDet;
|
|
4817
|
-
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;
|
|
4818
|
-
});
|
|
4766
|
+
const filteredPerMethodTaxRate = lineItem?.perMethodTaxRate?.filter(perMethodTax => lineItem?.shippingDetails?.targets?.findIndex(target => target?.shippingMethodKey === perMethodTax?.shippingMethodKey) >= 0);
|
|
4819
4767
|
|
|
4820
4768
|
// when shipping mode is multi with the same tax rate
|
|
4821
|
-
if (
|
|
4822
|
-
var _price$value3, _price$value4;
|
|
4769
|
+
if (filteredPerMethodTaxRate?.length > 0 && filteredPerMethodTaxRate[0]?.taxRate?.includedInPrice) {
|
|
4823
4770
|
const taxRate = filteredPerMethodTaxRate[0].taxRate;
|
|
4824
4771
|
let centAmount;
|
|
4825
4772
|
// should accept 0 value
|
|
4826
|
-
if (typeof
|
|
4773
|
+
if (typeof price.value?.centAmount === 'number') {
|
|
4827
4774
|
const amount = price.value.centAmount / (1 + taxRate.amount);
|
|
4828
4775
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4829
4776
|
}
|
|
4830
4777
|
let preciseAmount;
|
|
4831
|
-
if (
|
|
4778
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + taxRate.amount);
|
|
4832
4779
|
return _objectSpread$13(_objectSpread$13({}, price.value), {}, {
|
|
4833
4780
|
centAmount,
|
|
4834
4781
|
preciseAmount
|
|
@@ -4837,15 +4784,14 @@ function getNetUnitPrice(_ref2) {
|
|
|
4837
4784
|
|
|
4838
4785
|
// when shipping mode is single
|
|
4839
4786
|
if (lineItem.taxRate && lineItem.taxRate.includedInPrice) {
|
|
4840
|
-
var _price$value5, _price$value6;
|
|
4841
4787
|
let centAmount;
|
|
4842
4788
|
// should accept 0 value
|
|
4843
|
-
if (typeof
|
|
4789
|
+
if (typeof price.value?.centAmount === 'number') {
|
|
4844
4790
|
const amount = price.value.centAmount / (1 + lineItem.taxRate.amount);
|
|
4845
4791
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4846
4792
|
}
|
|
4847
4793
|
let preciseAmount;
|
|
4848
|
-
if (
|
|
4794
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + lineItem.taxRate.amount);
|
|
4849
4795
|
return _objectSpread$13(_objectSpread$13({}, price.value), {}, {
|
|
4850
4796
|
centAmount,
|
|
4851
4797
|
preciseAmount
|
|
@@ -4879,18 +4825,18 @@ const transformCustomFieldFromGraphQLResponse = resource => {
|
|
|
4879
4825
|
key: resource.custom.type.key,
|
|
4880
4826
|
name: l10n.transformLocalizedFieldToLocalizedString(resource.custom.type.nameAllLocales),
|
|
4881
4827
|
fieldDefinitions: _mapInstanceProperty__default["default"](_context = resource.custom.type.fieldDefinitions).call(_context, fieldDefinition => {
|
|
4882
|
-
var
|
|
4828
|
+
var _context2, _context3;
|
|
4883
4829
|
return {
|
|
4884
4830
|
name: fieldDefinition.name,
|
|
4885
4831
|
required: fieldDefinition.required,
|
|
4886
|
-
type:
|
|
4832
|
+
type: fieldDefinition.type?.elementType?.name === 'LocalizedEnum' ? _objectSpread$12(_objectSpread$12({}, fieldDefinition.type), {}, {
|
|
4887
4833
|
elementType: _objectSpread$12(_objectSpread$12({}, fieldDefinition.type.elementType), {}, {
|
|
4888
4834
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
4889
4835
|
key: value.key,
|
|
4890
4836
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
4891
4837
|
}))
|
|
4892
4838
|
})
|
|
4893
|
-
}) :
|
|
4839
|
+
}) : fieldDefinition.type?.name === 'LocalizedEnum' ? _objectSpread$12(_objectSpread$12({}, fieldDefinition.type), {}, {
|
|
4894
4840
|
values: _mapInstanceProperty__default["default"](_context3 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context3, value => ({
|
|
4895
4841
|
key: value.key,
|
|
4896
4842
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -4917,7 +4863,7 @@ const convertProductSelectionFromGraphQl = productSelection => {
|
|
|
4917
4863
|
from: 'nameAllLocales',
|
|
4918
4864
|
to: 'name'
|
|
4919
4865
|
}])), {}, {
|
|
4920
|
-
custom: productSelection
|
|
4866
|
+
custom: productSelection?.custom ? transformCustomFieldFromGraphQLResponse(productSelection) : null
|
|
4921
4867
|
});
|
|
4922
4868
|
};
|
|
4923
4869
|
|
|
@@ -5046,7 +4992,7 @@ let CustomFieldDefinitionsConnector = /*#__PURE__*/function (_Component) {
|
|
|
5046
4992
|
value: function componentDidMount() {
|
|
5047
4993
|
var _context;
|
|
5048
4994
|
const hasUnsupportedResource = _someInstanceProperty__default["default"](_context = this.props.resources).call(_context, resource => !_includesInstanceProperty__default["default"](customizableResources$1).call(customizableResources$1, resource));
|
|
5049
|
-
!!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;
|
|
5050
4996
|
}
|
|
5051
4997
|
}, {
|
|
5052
4998
|
key: "render",
|
|
@@ -5065,9 +5011,9 @@ CustomFieldDefinitionsConnector.displayName = 'CustomFieldDefinitionsConnector';
|
|
|
5065
5011
|
CustomFieldDefinitionsConnector.defaultProps = {
|
|
5066
5012
|
resources: []
|
|
5067
5013
|
};
|
|
5068
|
-
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();
|
|
5069
5015
|
const mapPropsToOptions = ownProps => {
|
|
5070
|
-
const where = ownProps.resources.length > 0 ?
|
|
5016
|
+
const where = ownProps.resources.length > 0 ? `resourceTypeIds contains any (${stringifyResources$1(ownProps.resources)})` : undefined;
|
|
5071
5017
|
return {
|
|
5072
5018
|
variables: {
|
|
5073
5019
|
where,
|
|
@@ -5136,19 +5082,19 @@ const graphQlDocToForm = typeDefinition => {
|
|
|
5136
5082
|
key: typeDefinition.key,
|
|
5137
5083
|
name: l10n.transformLocalizedFieldToLocalizedString(typeDefinition.nameAllLocales),
|
|
5138
5084
|
fieldDefinitions: _mapInstanceProperty__default["default"](_context = typeDefinition.fieldDefinitions).call(_context, fieldDefinition => {
|
|
5139
|
-
var
|
|
5085
|
+
var _context2, _context3;
|
|
5140
5086
|
return {
|
|
5141
5087
|
name: fieldDefinition.name,
|
|
5142
5088
|
required: fieldDefinition.required,
|
|
5143
5089
|
inputHint: fieldDefinition.inputHint,
|
|
5144
|
-
type:
|
|
5090
|
+
type: fieldDefinition.type?.elementType?.name === 'LocalizedEnum' ? _objectSpread$$(_objectSpread$$({}, fieldDefinition.type), {}, {
|
|
5145
5091
|
elementType: _objectSpread$$(_objectSpread$$({}, fieldDefinition.type.elementType), {}, {
|
|
5146
5092
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
5147
5093
|
key: value.key,
|
|
5148
5094
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
5149
5095
|
}))
|
|
5150
5096
|
})
|
|
5151
|
-
}) :
|
|
5097
|
+
}) : fieldDefinition.type?.name === 'LocalizedEnum' ? _objectSpread$$(_objectSpread$$({}, fieldDefinition.type), {}, {
|
|
5152
5098
|
values: _mapInstanceProperty__default["default"](_context3 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context3, value => ({
|
|
5153
5099
|
key: value.key,
|
|
5154
5100
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -5180,7 +5126,7 @@ const formToGraphQlDoc = formCustomFields => ({
|
|
|
5180
5126
|
// TODO(pa3): find usages and make sure only 1 param is passed
|
|
5181
5127
|
const createEmptyCustomFields = typeDefinition => ({
|
|
5182
5128
|
fields: {},
|
|
5183
|
-
type:
|
|
5129
|
+
type: typeDefinition?.type || {
|
|
5184
5130
|
fieldDefinitions: []
|
|
5185
5131
|
}
|
|
5186
5132
|
});
|
|
@@ -5206,7 +5152,7 @@ let CustomFieldTypeDefinitionsConnector = /*#__PURE__*/function (_Component) {
|
|
|
5206
5152
|
value: function componentDidMount() {
|
|
5207
5153
|
var _context;
|
|
5208
5154
|
const hasUnsupportedResource = _someInstanceProperty__default["default"](_context = this.props.resources).call(_context, resource => !_includesInstanceProperty__default["default"](customizableResources).call(customizableResources, resource));
|
|
5209
|
-
!!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;
|
|
5210
5156
|
}
|
|
5211
5157
|
}, {
|
|
5212
5158
|
key: "render",
|
|
@@ -5231,9 +5177,9 @@ CustomFieldTypeDefinitionsConnector.graphQlDocToForm = graphQlDocToForm;
|
|
|
5231
5177
|
CustomFieldTypeDefinitionsConnector.formToRestDoc = formToRestDoc;
|
|
5232
5178
|
CustomFieldTypeDefinitionsConnector.formToGraphQlDoc = formToGraphQlDoc;
|
|
5233
5179
|
CustomFieldTypeDefinitionsConnector.createEmptyCustomFields = createEmptyCustomFields;
|
|
5234
|
-
const stringifyResources = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => "
|
|
5180
|
+
const stringifyResources = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => `"${resource}"`).join();
|
|
5235
5181
|
const createGraphQlOptions = ownProps => {
|
|
5236
|
-
const where = ownProps.resources.length > 0 ?
|
|
5182
|
+
const where = ownProps.resources.length > 0 ? `resourceTypeIds contains any (${stringifyResources(ownProps.resources)})` : undefined;
|
|
5237
5183
|
return {
|
|
5238
5184
|
variables: {
|
|
5239
5185
|
where,
|
|
@@ -5309,7 +5255,7 @@ const extractDuplicatedValues = (values, type, language, languages) => {
|
|
|
5309
5255
|
let validatedValues = [];
|
|
5310
5256
|
if (type.name.toLowerCase() === 'money') {
|
|
5311
5257
|
validatedValues = unique(values, ['amount', 'currencyCode']);
|
|
5312
|
-
} 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') {
|
|
5313
5259
|
validatedValues = unique(values, languages);
|
|
5314
5260
|
} else validatedValues = unique(values);
|
|
5315
5261
|
return validatedValues;
|
|
@@ -5525,7 +5471,6 @@ const getSubfieldLanguage = subfieldName => {
|
|
|
5525
5471
|
return subfieldName.substring(lastDotIndex + 1);
|
|
5526
5472
|
};
|
|
5527
5473
|
function CustomLocalizedTextInput(props) {
|
|
5528
|
-
var _value$language;
|
|
5529
5474
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
5530
5475
|
language: applicationContext.dataLocale,
|
|
5531
5476
|
languages: applicationContext.project.languages
|
|
@@ -5550,7 +5495,7 @@ function CustomLocalizedTextInput(props) {
|
|
|
5550
5495
|
props.setFieldValue(props.name, nullifiedIfNeeded);
|
|
5551
5496
|
});
|
|
5552
5497
|
const InputComponent = isMultiLine ? uiKit.LocalizedMultilineTextInput : uiKit.LocalizedTextInput;
|
|
5553
|
-
const tooltipTitle = isMultiLine ? '' : value ?
|
|
5498
|
+
const tooltipTitle = isMultiLine ? '' : value ? value[language] ?? '' : '';
|
|
5554
5499
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
5555
5500
|
title: tooltipTitle,
|
|
5556
5501
|
children: jsxRuntime.jsx(InputComponent, {
|
|
@@ -5594,8 +5539,7 @@ function CustomBooleanInput(props) {
|
|
|
5594
5539
|
CustomBooleanInput.displayName = 'CustomBooleanInput';
|
|
5595
5540
|
|
|
5596
5541
|
function CustomNumberInput(props) {
|
|
5597
|
-
|
|
5598
|
-
const value = (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : '';
|
|
5542
|
+
const value = props.value ?? '';
|
|
5599
5543
|
const handleChange = makeChangeHandler(rawValue => props.setFieldValue(props.name, !rawValue ? undefined : Number(rawValue)));
|
|
5600
5544
|
return jsxRuntime.jsx(uiKit.NumberInput, {
|
|
5601
5545
|
id: props.name,
|
|
@@ -5640,7 +5584,7 @@ const fixAmount = value => {
|
|
|
5640
5584
|
// data user just entered effectively preventing full data from being entered.
|
|
5641
5585
|
const fixEnteredValue = (newValue, initialValue, currencies) => {
|
|
5642
5586
|
const withFixedCurrency = fixCurrencyCode(newValue, currencies);
|
|
5643
|
-
if (!
|
|
5587
|
+
if (!initialValue?.amount) {
|
|
5644
5588
|
return fixAmount(withFixedCurrency);
|
|
5645
5589
|
}
|
|
5646
5590
|
return withFixedCurrency;
|
|
@@ -5706,13 +5650,12 @@ const convertTypeValuesToOptions$1 = reselect.defaultMemoize((type, dataLocale,
|
|
|
5706
5650
|
key: 'label',
|
|
5707
5651
|
locale: dataLocale,
|
|
5708
5652
|
fallbackOrder: languages,
|
|
5709
|
-
fallback:
|
|
5653
|
+
fallback: `${value.key} (key)`
|
|
5710
5654
|
}),
|
|
5711
5655
|
value: value.key
|
|
5712
5656
|
}));
|
|
5713
5657
|
});
|
|
5714
5658
|
function CustomLocalizedEnumInput(props) {
|
|
5715
|
-
var _options$find$label, _options$find;
|
|
5716
5659
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
5717
5660
|
languages: applicationContext.project.languages,
|
|
5718
5661
|
dataLocale: applicationContext.dataLocale
|
|
@@ -5721,7 +5664,7 @@ function CustomLocalizedEnumInput(props) {
|
|
|
5721
5664
|
dataLocale = _useApplicationContex.dataLocale;
|
|
5722
5665
|
const options = convertTypeValuesToOptions$1(props.fieldDefinition.type, dataLocale, languages);
|
|
5723
5666
|
const handleChange = makeChangeHandler(rawValue => props.setFieldValue(props.name, rawValue));
|
|
5724
|
-
const tooltipTitle = props.value ?
|
|
5667
|
+
const tooltipTitle = props.value ? _findInstanceProperty__default["default"](options).call(options, option => option.value === props.value)?.label ?? '' : '';
|
|
5725
5668
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
5726
5669
|
title: tooltipTitle,
|
|
5727
5670
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
@@ -5741,8 +5684,7 @@ function CustomLocalizedEnumInput(props) {
|
|
|
5741
5684
|
CustomLocalizedEnumInput.displayName = 'CustomLocalizedEnumInput';
|
|
5742
5685
|
|
|
5743
5686
|
function CustomRawIdReferenceInput(props) {
|
|
5744
|
-
|
|
5745
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
5687
|
+
const value = props.value?.id || '';
|
|
5746
5688
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
5747
5689
|
title: value,
|
|
5748
5690
|
children: jsxRuntime.jsx(uiKit.TextInput, {
|
|
@@ -5787,7 +5729,7 @@ function getCategoriesByIds(apolloClient, options) {
|
|
|
5787
5729
|
return apolloClient.query({
|
|
5788
5730
|
query: FetchCategoriesByIds,
|
|
5789
5731
|
variables: {
|
|
5790
|
-
where:
|
|
5732
|
+
where: `id in (${_mapInstanceProperty__default["default"](_context2 = options.ids).call(_context2, id => `"${id}"`).join(', ')})`
|
|
5791
5733
|
},
|
|
5792
5734
|
context: {
|
|
5793
5735
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -5886,13 +5828,10 @@ const useReferenceSearchItems = _ref => {
|
|
|
5886
5828
|
};
|
|
5887
5829
|
};
|
|
5888
5830
|
function ReferenceSearch(props) {
|
|
5889
|
-
const ids = React.useMemo(() => {
|
|
5890
|
-
|
|
5891
|
-
return
|
|
5892
|
-
|
|
5893
|
-
return id;
|
|
5894
|
-
}) : [(_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.id] : [];
|
|
5895
|
-
}, [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]);
|
|
5896
5835
|
const _useReferenceSearchIt = useReferenceSearchItems({
|
|
5897
5836
|
loadItemsBySearchTerm: props.loadItemsBySearchTerm,
|
|
5898
5837
|
loadItemsByIds: props.loadItemsByIds,
|
|
@@ -5903,14 +5842,14 @@ function ReferenceSearch(props) {
|
|
|
5903
5842
|
areSomeItemsMissing = _useReferenceSearchIt.areSomeItemsMissing,
|
|
5904
5843
|
handleLoadItems = _useReferenceSearchIt.handleLoadItems;
|
|
5905
5844
|
if (areItemsLoading) return null;
|
|
5906
|
-
const value = props.isMulti ? items : items
|
|
5845
|
+
const value = props.isMulti ? items : items?.[0];
|
|
5907
5846
|
let filterValue = null;
|
|
5908
5847
|
if (value) filterValue = props.isMulti ? _mapInstanceProperty__default["default"](value).call(value, props.mapItemToOption) : props.mapItemToOption(value);
|
|
5909
5848
|
const tooltipTitle = value || props.value ? props.mapItemToOption(value || props.value).label : '';
|
|
5910
5849
|
const loadItems = value => _Promise__default["default"].resolve(handleLoadItems(value)).then(items => _mapInstanceProperty__default["default"](items).call(items, item => props.mapItemToOption(item)));
|
|
5911
5850
|
const handleChange = event => {
|
|
5912
|
-
var _context
|
|
5913
|
-
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;
|
|
5914
5853
|
props.onChange(option);
|
|
5915
5854
|
};
|
|
5916
5855
|
return jsxRuntime.jsxs("div", {
|
|
@@ -5981,9 +5920,8 @@ const messages$B = reactIntl.defineMessages({
|
|
|
5981
5920
|
});
|
|
5982
5921
|
|
|
5983
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; }
|
|
5984
|
-
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; }
|
|
5985
5924
|
function Option$1(props) {
|
|
5986
|
-
var _context, _context2;
|
|
5987
5925
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
5988
5926
|
language: applicationContext.dataLocale,
|
|
5989
5927
|
languages: applicationContext.project.languages
|
|
@@ -6004,19 +5942,19 @@ function Option$1(props) {
|
|
|
6004
5942
|
fallbackOrder: languages
|
|
6005
5943
|
})
|
|
6006
5944
|
}), category.parent && jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
6007
|
-
children:
|
|
5945
|
+
children: `${formatMessage(messages$B.parentCategory)}: ${l10n.formatLocalizedString(category.parent, {
|
|
6008
5946
|
key: 'name',
|
|
6009
5947
|
locale: language,
|
|
6010
5948
|
fallbackOrder: languages
|
|
6011
|
-
})
|
|
5949
|
+
})}`
|
|
6012
5950
|
}), jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
6013
|
-
children:
|
|
5951
|
+
children: `Slug: ${l10n.formatLocalizedString(category, {
|
|
6014
5952
|
key: 'slug',
|
|
6015
5953
|
locale: language,
|
|
6016
5954
|
fallbackOrder: languages
|
|
6017
|
-
})
|
|
5955
|
+
})}`
|
|
6018
5956
|
}), category.externalId && jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
6019
|
-
children:
|
|
5957
|
+
children: `${formatMessage(messages$B.externalId)}: ${category.externalId || constants.NO_VALUE_FALLBACK}`
|
|
6020
5958
|
})]
|
|
6021
5959
|
})
|
|
6022
5960
|
}));
|
|
@@ -6079,7 +6017,7 @@ var CategorySearchPickerOptionFragment$1 = { kind: "Document", definitions: [{ k
|
|
|
6079
6017
|
function useCachedCategoryOptions(ids) {
|
|
6080
6018
|
const apolloClient = client.useApolloClient();
|
|
6081
6019
|
const fragments = _mapInstanceProperty__default["default"](ids).call(ids, id => apolloClient.readFragment({
|
|
6082
|
-
id:
|
|
6020
|
+
id: `CategorySearch:${id}`,
|
|
6083
6021
|
fragment: CategorySearchPickerOptionFragment$1
|
|
6084
6022
|
}));
|
|
6085
6023
|
return _mapInstanceProperty__default["default"](fragments).call(fragments, category => transformLocalizedFieldsForCategory(category, [{
|
|
@@ -6094,8 +6032,8 @@ function useCachedCategoryOptions(ids) {
|
|
|
6094
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 } } } };
|
|
6095
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 } } } };
|
|
6096
6034
|
const transformCartDiscountResponse = response => {
|
|
6097
|
-
var _context
|
|
6098
|
-
return _mapInstanceProperty__default["default"](_context =
|
|
6035
|
+
var _context;
|
|
6036
|
+
return _mapInstanceProperty__default["default"](_context = response.data?.cartDiscounts.results || []).call(_context, cartDiscount => transformLocalizedFieldsForCartDiscount(cartDiscount));
|
|
6099
6037
|
};
|
|
6100
6038
|
function queryCartDiscounts(apolloClient) {
|
|
6101
6039
|
return apolloClient.query({
|
|
@@ -6107,14 +6045,14 @@ function queryCartDiscounts(apolloClient) {
|
|
|
6107
6045
|
}).then(transformCartDiscountResponse);
|
|
6108
6046
|
}
|
|
6109
6047
|
const getWhereClause = function () {
|
|
6110
|
-
var _context2, _context3
|
|
6048
|
+
var _context2, _context3;
|
|
6111
6049
|
let searchText = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
6112
6050
|
let language = arguments.length > 1 ? arguments[1] : undefined;
|
|
6113
6051
|
const query = _trimInstanceProperty__default["default"](_context2 = _JSON$stringify__default["default"](searchText)).call(_context2);
|
|
6114
|
-
const idQuery = isUUID(searchText) &&
|
|
6115
|
-
const nameQuery =
|
|
6116
|
-
const keyQuery =
|
|
6117
|
-
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 ');
|
|
6118
6056
|
};
|
|
6119
6057
|
function searchCartDiscountsByExactMatch(apolloClient, options) {
|
|
6120
6058
|
return apolloClient.query({
|
|
@@ -6137,10 +6075,7 @@ function getCartDiscountById(apolloClient, options) {
|
|
|
6137
6075
|
context: {
|
|
6138
6076
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
6139
6077
|
}
|
|
6140
|
-
}).then(response =>
|
|
6141
|
-
var _response$data2;
|
|
6142
|
-
return (_response$data2 = response.data) !== null && _response$data2 !== void 0 && _response$data2.cartDiscount ? transformLocalizedFieldsForCartDiscount(response.data.cartDiscount) : null;
|
|
6143
|
-
});
|
|
6078
|
+
}).then(response => response.data?.cartDiscount ? transformLocalizedFieldsForCartDiscount(response.data.cartDiscount) : null);
|
|
6144
6079
|
}
|
|
6145
6080
|
|
|
6146
6081
|
const messages$A = reactIntl.defineMessages({
|
|
@@ -6217,7 +6152,7 @@ function CartDiscountReferenceSearch(props) {
|
|
|
6217
6152
|
}),
|
|
6218
6153
|
loading = _useQuery.loading,
|
|
6219
6154
|
data = _useQuery.data;
|
|
6220
|
-
const isExactMatch =
|
|
6155
|
+
const isExactMatch = data?.cartDiscounts.total > QUERY_MAX_LIMIT;
|
|
6221
6156
|
const _useIntl = reactIntl.useIntl(),
|
|
6222
6157
|
formatMessage = _useIntl.formatMessage;
|
|
6223
6158
|
const apolloClient = client.useApolloClient();
|
|
@@ -6354,7 +6289,6 @@ const DropdownIndicator = () => jsxRuntime.jsx(uiKit.SearchIcon, {
|
|
|
6354
6289
|
});
|
|
6355
6290
|
DropdownIndicator.displayName = 'DropdownIndicator';
|
|
6356
6291
|
const ProductPickerInput = _ref => {
|
|
6357
|
-
var _currentOption$data$l, _currentOption$data;
|
|
6358
6292
|
let isClearable = _ref.isClearable,
|
|
6359
6293
|
isDisabled = _ref.isDisabled,
|
|
6360
6294
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -6374,20 +6308,19 @@ const ProductPickerInput = _ref => {
|
|
|
6374
6308
|
loadingError = _useState2[0],
|
|
6375
6309
|
setLoadingError = _useState2[1];
|
|
6376
6310
|
const convertProductToOption = React.useCallback(product => {
|
|
6377
|
-
var _masterData$current;
|
|
6378
6311
|
if (!product) return null;
|
|
6379
6312
|
const id = product.id,
|
|
6380
6313
|
key = product.key,
|
|
6381
6314
|
masterData = product.masterData;
|
|
6382
|
-
const localizedName = formatLocalizedFieldToString(
|
|
6315
|
+
const localizedName = formatLocalizedFieldToString(masterData.current?.nameAllLocales);
|
|
6383
6316
|
return {
|
|
6384
|
-
label: localizedName + (key ?
|
|
6317
|
+
label: localizedName + (key ? ` (key: ${key})` : ''),
|
|
6385
6318
|
value: id,
|
|
6386
6319
|
name: localizedName,
|
|
6387
6320
|
key
|
|
6388
6321
|
};
|
|
6389
6322
|
}, [formatLocalizedFieldToString]);
|
|
6390
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
6323
|
+
const prefixSearchFields = React.useMemo(() => [`masterData.current.name.${dataLocale}`, 'key'], [dataLocale]);
|
|
6391
6324
|
const loadOptions = useLoadOptions({
|
|
6392
6325
|
query: GetProductsQuery,
|
|
6393
6326
|
prefixSearchFields
|
|
@@ -6418,12 +6351,12 @@ const ProductPickerInput = _ref => {
|
|
|
6418
6351
|
setLoadingError(null);
|
|
6419
6352
|
handleInternalInputChange(event);
|
|
6420
6353
|
}, [handleInternalInputChange]);
|
|
6421
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
6354
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
6422
6355
|
React.useEffect(() => {
|
|
6423
6356
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
6424
6357
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
6425
6358
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
6426
|
-
const tooltipTitle =
|
|
6359
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
6427
6360
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
6428
6361
|
max: "scale",
|
|
6429
6362
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -6460,8 +6393,7 @@ const ProductPickerInput = _ref => {
|
|
|
6460
6393
|
ProductPickerInput.displayName = 'ProductPickerInput';
|
|
6461
6394
|
|
|
6462
6395
|
function CustomProductReferenceInput(props) {
|
|
6463
|
-
|
|
6464
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6396
|
+
const value = props.value?.id || '';
|
|
6465
6397
|
return jsxRuntime.jsx(ProductPickerInput, {
|
|
6466
6398
|
value: value,
|
|
6467
6399
|
name: props.name,
|
|
@@ -6478,8 +6410,7 @@ function CustomProductReferenceInput(props) {
|
|
|
6478
6410
|
CustomProductReferenceInput.displayName = 'CustomProductReferenceInput';
|
|
6479
6411
|
|
|
6480
6412
|
function CustomProductTypeReferenceInput(props) {
|
|
6481
|
-
|
|
6482
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6413
|
+
const value = props.value?.id || '';
|
|
6483
6414
|
return jsxRuntime.jsx(ProductTypePickerInput, {
|
|
6484
6415
|
value: value,
|
|
6485
6416
|
name: props.name,
|
|
@@ -6495,8 +6426,7 @@ function CustomProductTypeReferenceInput(props) {
|
|
|
6495
6426
|
CustomProductTypeReferenceInput.displayName = 'CustomProductTypeReferenceInput';
|
|
6496
6427
|
|
|
6497
6428
|
function CustomChannelReferenceInput(props) {
|
|
6498
|
-
|
|
6499
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6429
|
+
const value = props.value?.id || '';
|
|
6500
6430
|
return jsxRuntime.jsx(ChannelPickerInput, {
|
|
6501
6431
|
value: value,
|
|
6502
6432
|
name: props.name,
|
|
@@ -6512,8 +6442,7 @@ function CustomChannelReferenceInput(props) {
|
|
|
6512
6442
|
CustomChannelReferenceInput.displayName = 'CustomChannelReferenceInput';
|
|
6513
6443
|
|
|
6514
6444
|
function CustomStateReferenceInput(props) {
|
|
6515
|
-
|
|
6516
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6445
|
+
const value = props.value?.id || '';
|
|
6517
6446
|
return jsxRuntime.jsx(StatePickerInput, {
|
|
6518
6447
|
value: value,
|
|
6519
6448
|
name: props.name,
|
|
@@ -6622,14 +6551,13 @@ function CustomTimeInput(props) {
|
|
|
6622
6551
|
CustomTimeInput.displayName = 'CustomTimeInput';
|
|
6623
6552
|
|
|
6624
6553
|
const convertTypeValuesToOptions = reselect.defaultMemoize(typeValues => _mapInstanceProperty__default["default"](typeValues).call(typeValues, typeValue => ({
|
|
6625
|
-
label: typeValue.label ||
|
|
6554
|
+
label: typeValue.label || `${typeValue.key} (key)`,
|
|
6626
6555
|
value: typeValue.key
|
|
6627
6556
|
})));
|
|
6628
6557
|
function CustomEnumInput(props) {
|
|
6629
|
-
var _options$find$label, _options$find;
|
|
6630
6558
|
const options = convertTypeValuesToOptions(_valuesInstanceProperty__default["default"](props.fieldDefinition.type));
|
|
6631
6559
|
const handleChange = makeChangeHandler(rawValue => props.setFieldValue(props.name, rawValue));
|
|
6632
|
-
const tooltipTitle = props.value ?
|
|
6560
|
+
const tooltipTitle = props.value ? _findInstanceProperty__default["default"](options).call(options, option => option.value === props.value)?.label ?? '' : '';
|
|
6633
6561
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
6634
6562
|
title: tooltipTitle,
|
|
6635
6563
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
@@ -6701,9 +6629,9 @@ function ownKeys$P(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
6701
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; }
|
|
6702
6630
|
const getTypeName = type => type.name.toLowerCase();
|
|
6703
6631
|
const findLabel = (enumType, key) => {
|
|
6704
|
-
var
|
|
6632
|
+
var _context;
|
|
6705
6633
|
const emptyValue = getTypeName(enumType) === 'enum' ? '' : {};
|
|
6706
|
-
return
|
|
6634
|
+
return _findInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](enumType)).call(_context, value => value.key === key)?.label ?? emptyValue;
|
|
6707
6635
|
};
|
|
6708
6636
|
const convertEnumValues = (value, attributeDefinition) => {
|
|
6709
6637
|
var _context2, _context3;
|
|
@@ -6767,7 +6695,7 @@ const attributesMapToNameValuePairs = map => {
|
|
|
6767
6695
|
|
|
6768
6696
|
const getAttributeShortName = (fullName, attributesPrefix) => {
|
|
6769
6697
|
if (!attributesPrefix) return fullName;
|
|
6770
|
-
return fullName.replace(
|
|
6698
|
+
return fullName.replace(`${attributesPrefix}.`, '');
|
|
6771
6699
|
};
|
|
6772
6700
|
function ProductAttributes(props) {
|
|
6773
6701
|
const formik$1 = formik.useFormikContext();
|
|
@@ -6849,19 +6777,19 @@ function ownKeys$O(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
6849
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; }
|
|
6850
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 } } } };
|
|
6851
6779
|
const mapAttributeDefinition = definition => {
|
|
6852
|
-
var _context,
|
|
6780
|
+
var _context, _context2, _context3, _context4;
|
|
6853
6781
|
return _objectSpread$O(_objectSpread$O({}, definition), {}, {
|
|
6854
6782
|
required: definition.isRequired,
|
|
6855
6783
|
inputTip: l10n.transformLocalizedFieldToLocalizedString(definition.inputTipAllLocales),
|
|
6856
6784
|
label: l10n.transformLocalizedFieldToLocalizedString(definition.labelAllLocales),
|
|
6857
|
-
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), {}, {
|
|
6858
6786
|
elementType: _objectSpread$O(_objectSpread$O({}, definition.type.elementType), {}, {
|
|
6859
6787
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](definition.type.elementType).results).call(_context2, value => ({
|
|
6860
6788
|
key: value.key,
|
|
6861
6789
|
label: value.label || l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
6862
6790
|
}))
|
|
6863
6791
|
})
|
|
6864
|
-
}) : _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), {}, {
|
|
6865
6793
|
values: _mapInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](definition.type).results).call(_context4, value => ({
|
|
6866
6794
|
key: value.key,
|
|
6867
6795
|
label: value.label || l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -7212,7 +7140,7 @@ const ExpandButton = props => props.totalValues > 1 ? jsxRuntime.jsxs(uiKit.Spac
|
|
|
7212
7140
|
}), jsxRuntime.jsx(uiKit.FlatButton, {
|
|
7213
7141
|
tone: "primary",
|
|
7214
7142
|
icon: props.isExpanded ? jsxRuntime.jsx(uiKit.AngleUpIcon, {}) : jsxRuntime.jsx(uiKit.AngleDownIcon, {}),
|
|
7215
|
-
label: props.isExpanded ?
|
|
7143
|
+
label: props.isExpanded ? `Hide set items (${props.totalValues})` : `Show all set items (${props.totalValues})`,
|
|
7216
7144
|
onClick: props.onExpand
|
|
7217
7145
|
})]
|
|
7218
7146
|
}) : null;
|
|
@@ -7247,7 +7175,7 @@ const SetButtons = props => {
|
|
|
7247
7175
|
SetButtons.displayName = 'SetButtons';
|
|
7248
7176
|
|
|
7249
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; }
|
|
7250
|
-
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; }
|
|
7251
7179
|
const getDuplicateErrors = setValues => {
|
|
7252
7180
|
/* eslint-disable no-plusplus */
|
|
7253
7181
|
const result = [];
|
|
@@ -7288,13 +7216,10 @@ const getItemIndex = name => {
|
|
|
7288
7216
|
return _parseInt__default["default"](rawIndex, 10);
|
|
7289
7217
|
};
|
|
7290
7218
|
const makeKeys = amount => times__default["default"](amount, () => uuid.v4());
|
|
7291
|
-
const makeItemFieldName = (fieldName, index) => {
|
|
7292
|
-
var _context;
|
|
7293
|
-
return _concatInstanceProperty__default["default"](_context = "".concat(fieldName, ".[")).call(_context, index, "]");
|
|
7294
|
-
};
|
|
7219
|
+
const makeItemFieldName = (fieldName, index) => `${fieldName}.[${index}]`;
|
|
7295
7220
|
const makeMapForAllItems = (fieldName, items, value) => _reduceInstanceProperty__default["default"](items).call(items, (result, item, index) => set__default["default"](result, makeItemFieldName(fieldName, index), value), {});
|
|
7296
7221
|
function CustomInputSet(props) {
|
|
7297
|
-
var
|
|
7222
|
+
var _context;
|
|
7298
7223
|
const _useToggleState = uiKit.useToggleState(false),
|
|
7299
7224
|
_useToggleState2 = _slicedToArray(_useToggleState, 2),
|
|
7300
7225
|
isExpanded = _useToggleState2[0],
|
|
@@ -7316,7 +7241,7 @@ function CustomInputSet(props) {
|
|
|
7316
7241
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
7317
7242
|
keys = _useState4[0],
|
|
7318
7243
|
setKeys = _useState4[1];
|
|
7319
|
-
const totalAmount = internalValue
|
|
7244
|
+
const totalAmount = internalValue?.length;
|
|
7320
7245
|
const amountToRender = isExpanded ? totalAmount : 1;
|
|
7321
7246
|
const updateInternalValue = newValue => {
|
|
7322
7247
|
const valueToSet = isEmpty$1(newValue) ? [undefined] : newValue;
|
|
@@ -7363,8 +7288,8 @@ function CustomInputSet(props) {
|
|
|
7363
7288
|
// in <CustomFieldComponent /> where proper component for given field/attribute
|
|
7364
7289
|
// type is selected.
|
|
7365
7290
|
const type = getType(props.fieldDefinition);
|
|
7366
|
-
const typeName = type
|
|
7367
|
-
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);
|
|
7368
7293
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
7369
7294
|
children: [jsxRuntime.jsx(uiKit.AccessibleHidden, {
|
|
7370
7295
|
children: jsxRuntime.jsx("label", {
|
|
@@ -7442,14 +7367,12 @@ const nonSetComponents = {
|
|
|
7442
7367
|
};
|
|
7443
7368
|
const CustomFieldInput = /*#__PURE__*/React.memo(props => {
|
|
7444
7369
|
const InputComponent = React.useMemo(() => {
|
|
7445
|
-
|
|
7446
|
-
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();
|
|
7447
7371
|
if (typeName === 'set') {
|
|
7448
|
-
var _getSetElementType;
|
|
7449
7372
|
// Boolean is the only set element with peculiarities (i.e. way more
|
|
7450
7373
|
// convenient for user to work with it as with select input with three values:
|
|
7451
7374
|
// [true], [false] and [true, false]).
|
|
7452
|
-
if (
|
|
7375
|
+
if (getType(props.fieldDefinition)?.name.toLowerCase() === CUSTOM_FIELD_TYPES.boolean) {
|
|
7453
7376
|
return CustomBooleanInputSet;
|
|
7454
7377
|
}
|
|
7455
7378
|
// All the rest sets are just a fancy wrapper around single-item components
|
|
@@ -7540,9 +7463,9 @@ const CustomFieldErrors = props => {
|
|
|
7540
7463
|
const didFormValidationFail = useDidFormValidationFail();
|
|
7541
7464
|
const errors = _Array$isArray__default["default"](props.errors) ? mergeSetItemsErrors(props.errors) : props.errors;
|
|
7542
7465
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
7543
|
-
children: [props.isTouched || didFormValidationFail &&
|
|
7466
|
+
children: [props.isTouched || didFormValidationFail && errors?.missing && jsxRuntime.jsx(_.ErrorMessage, {
|
|
7544
7467
|
intlMessage: messages$K.required
|
|
7545
|
-
}), props.isTouched || didFormValidationFail &&
|
|
7468
|
+
}), props.isTouched || didFormValidationFail && errors?.duplicated && jsxRuntime.jsx(_.ErrorMessage, {
|
|
7546
7469
|
intlMessage: messages$K.unique
|
|
7547
7470
|
})]
|
|
7548
7471
|
});
|
|
@@ -7592,10 +7515,9 @@ function _objectSpread$J(e) { for (var r = 1; r < arguments.length; r++) { var _
|
|
|
7592
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)."; }
|
|
7593
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 } } } };
|
|
7594
7517
|
const CustomFieldsLabelHint = _ref2 => {
|
|
7595
|
-
var _type$name;
|
|
7596
7518
|
let fieldDefinition = _ref2.fieldDefinition;
|
|
7597
7519
|
const type = getType(fieldDefinition);
|
|
7598
|
-
const isReference =
|
|
7520
|
+
const isReference = type.name?.toLowerCase() === 'reference';
|
|
7599
7521
|
const referenceTypeId = type.referenceTypeId;
|
|
7600
7522
|
const isCartDiscountsReference = isReference && referenceTypeId === SEARCHABLE_REFERENCES.cartDiscount;
|
|
7601
7523
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
@@ -7613,7 +7535,7 @@ const CustomFieldsLabelHint = _ref2 => {
|
|
|
7613
7535
|
data = _useQuery.data,
|
|
7614
7536
|
loading = _useQuery.loading;
|
|
7615
7537
|
if (loading) return null;
|
|
7616
|
-
if (
|
|
7538
|
+
if (data?.cartDiscounts.total > QUERY_MAX_LIMIT) {
|
|
7617
7539
|
return jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
7618
7540
|
alignItems: "center",
|
|
7619
7541
|
children: [jsxRuntime.jsx(uiKit.WarningIcon, {
|
|
@@ -7640,17 +7562,17 @@ function CustomFieldsProductTypeReferenceSubtitle() {
|
|
|
7640
7562
|
// TODO(pa3): this logic may be misplaced and probably
|
|
7641
7563
|
// should belong to <CustomReferenceInput /> component instead.
|
|
7642
7564
|
function CustomFieldsLabelSubtitle(_ref3) {
|
|
7643
|
-
var
|
|
7565
|
+
var _context;
|
|
7644
7566
|
let fieldDefinition = _ref3.fieldDefinition;
|
|
7645
7567
|
const _useIntl2 = reactIntl.useIntl(),
|
|
7646
7568
|
formatMessage = _useIntl2.formatMessage;
|
|
7647
7569
|
const type = getType(fieldDefinition);
|
|
7648
|
-
const isReference =
|
|
7570
|
+
const isReference = type.name?.toLowerCase() === 'reference';
|
|
7649
7571
|
if (!isReference) return null;
|
|
7650
7572
|
const referenceTypeId = type.referenceTypeId;
|
|
7651
7573
|
const referenceTypeName = capitalizeFirst(referenceTypeId);
|
|
7652
7574
|
if (_includesInstanceProperty__default["default"](_context = [SEARCHABLE_REFERENCES.category, SEARCHABLE_REFERENCES.cartDiscount]).call(_context, referenceTypeId)) return referenceTypeName;
|
|
7653
|
-
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`;
|
|
7654
7576
|
}
|
|
7655
7577
|
const Portal = props => /*#__PURE__*/ReactDOM__default["default"].createPortal(props.children, document.body);
|
|
7656
7578
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
@@ -7667,7 +7589,7 @@ function CustomFieldsCountIndicator(_ref4) {
|
|
|
7667
7589
|
const formatLocalizedField = useFormatLocalizedFieldToString();
|
|
7668
7590
|
const _useIntl3 = reactIntl.useIntl(),
|
|
7669
7591
|
formatMessage = _useIntl3.formatMessage;
|
|
7670
|
-
return
|
|
7592
|
+
return assignedAttributeGroups?.length > 1 ? jsxRuntime.jsx(uiKit.Tooltip, {
|
|
7671
7593
|
title: formatMessage(messages$v.attributeGroupCountTooltip, {
|
|
7672
7594
|
attributeGroups: _mapInstanceProperty__default["default"](assignedAttributeGroups).call(assignedAttributeGroups, assignedAttributeGroup => formatLocalizedField(assignedAttributeGroup.nameAllLocales)).join(', '),
|
|
7673
7595
|
count: assignedAttributeGroups.length
|
|
@@ -7725,9 +7647,8 @@ const CustomFieldsLabel = /*#__PURE__*/React.memo(_ref5 => {
|
|
|
7725
7647
|
CustomFieldsLabel.displayName = 'CustomFieldsTitle';
|
|
7726
7648
|
|
|
7727
7649
|
const getFieldName = (parentName, fieldName) => {
|
|
7728
|
-
var _context;
|
|
7729
7650
|
if (!parentName) return fieldName;
|
|
7730
|
-
return
|
|
7651
|
+
return `${parentName}.${fieldName}`;
|
|
7731
7652
|
};
|
|
7732
7653
|
const isNested = fieldDefinition => {
|
|
7733
7654
|
const type = fieldDefinition.type;
|
|
@@ -7752,7 +7673,6 @@ const CustomFieldsInternal = props => {
|
|
|
7752
7673
|
isDragAndDropMode = _useDnDContext.isDragAndDropMode;
|
|
7753
7674
|
return jsxRuntime.jsx(DroppableWrapper, {
|
|
7754
7675
|
children: _mapInstanceProperty__default["default"](fieldDefinitions).call(fieldDefinitions, (fieldDefinition, index) => {
|
|
7755
|
-
var _context2;
|
|
7756
7676
|
const fieldName = getFieldName(props.name, fieldDefinition.name);
|
|
7757
7677
|
const isTouched = Boolean(formik.getIn(touched, fieldName));
|
|
7758
7678
|
const fieldErrors = formik.getIn(errors, fieldName);
|
|
@@ -7769,51 +7689,48 @@ const CustomFieldsInternal = props => {
|
|
|
7769
7689
|
return jsxRuntime.jsx(formik.FastField, {
|
|
7770
7690
|
name: fieldName,
|
|
7771
7691
|
validate: validate,
|
|
7772
|
-
children: () => {
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
children: jsxRuntime.
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
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, {
|
|
7785
7709
|
name: fieldName,
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
onBlur: handleBlur,
|
|
7805
|
-
setFieldValue: props.setFieldValue,
|
|
7806
|
-
hasError: hasError
|
|
7807
|
-
}), jsxRuntime.jsx(CustomFieldErrors, {
|
|
7808
|
-
isTouched: isTouched,
|
|
7809
|
-
errors: fieldErrors
|
|
7810
|
-
})]
|
|
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, {
|
|
7717
|
+
name: fieldName,
|
|
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
|
|
7811
7728
|
})]
|
|
7812
|
-
})
|
|
7729
|
+
})]
|
|
7813
7730
|
})
|
|
7814
|
-
})
|
|
7815
|
-
}
|
|
7816
|
-
},
|
|
7731
|
+
})
|
|
7732
|
+
})
|
|
7733
|
+
}, `${fieldName}-${index}`);
|
|
7817
7734
|
})
|
|
7818
7735
|
});
|
|
7819
7736
|
};
|
|
@@ -7869,7 +7786,7 @@ var pickerMessages = reactIntl.defineMessages({
|
|
|
7869
7786
|
});
|
|
7870
7787
|
|
|
7871
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; }
|
|
7872
|
-
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; }
|
|
7873
7790
|
const PRODUCT_SELECTION_MODES = {
|
|
7874
7791
|
INCLUSION: 'Individual',
|
|
7875
7792
|
EXCLUSION: 'IndividualExclusion'
|
|
@@ -7880,11 +7797,10 @@ const PRODUCT_SELECTION_MODES_LABELS = {
|
|
|
7880
7797
|
};
|
|
7881
7798
|
const getMode = mode => mode === PRODUCT_SELECTION_MODES.INCLUSION || mode === PRODUCT_SELECTION_MODES_LABELS.INCLUSION ? 'inclusion' : 'exclusion';
|
|
7882
7799
|
const addModeToLabel = function (ps) {
|
|
7883
|
-
var _context;
|
|
7884
7800
|
let enableExcludingProducts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
7885
7801
|
if (!ps) return undefined;
|
|
7886
7802
|
return _objectSpread$I(_objectSpread$I({}, ps), {}, {
|
|
7887
|
-
label:
|
|
7803
|
+
label: `${ps?.label}${enableExcludingProducts ? ` (type: ${getMode(ps?.mode)})` : ''}`
|
|
7888
7804
|
});
|
|
7889
7805
|
};
|
|
7890
7806
|
|
|
@@ -7896,7 +7812,6 @@ const mapProductSelectionsToOptions$1 = memoize__default["default"](function ()
|
|
|
7896
7812
|
let enableExcludingProducts = arguments.length > 4 ? arguments[4] : undefined;
|
|
7897
7813
|
const selectedPSList = _Array$isArray__default["default"](selectedPS) ? selectedPS : [selectedPS];
|
|
7898
7814
|
return _mapInstanceProperty__default["default"](productSelections).call(productSelections, productSelection => {
|
|
7899
|
-
var _context;
|
|
7900
7815
|
const label = l10n.formatLocalizedString(productSelection, {
|
|
7901
7816
|
key: 'name',
|
|
7902
7817
|
locale: dataLocale,
|
|
@@ -7905,14 +7820,13 @@ const mapProductSelectionsToOptions$1 = memoize__default["default"](function ()
|
|
|
7905
7820
|
return {
|
|
7906
7821
|
id: productSelection.id,
|
|
7907
7822
|
value: productSelection.id,
|
|
7908
|
-
label:
|
|
7823
|
+
label: `${label}${_includesInstanceProperty__default["default"](selectedPSList).call(selectedPSList, productSelection.id) && enableExcludingProducts ? ` (type: ${getMode(productSelection.mode)})` : ''}`,
|
|
7909
7824
|
key: productSelection.key,
|
|
7910
7825
|
mode: getMode(productSelection.mode)
|
|
7911
7826
|
};
|
|
7912
7827
|
});
|
|
7913
7828
|
});
|
|
7914
7829
|
function ProductSelectionBasicSelectDropdown(props) {
|
|
7915
|
-
var _productSelectionsFet, _productSelectionsFet2;
|
|
7916
7830
|
const intl = reactIntl.useIntl();
|
|
7917
7831
|
const enableExcludingProducts = applicationShell.useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
7918
7832
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -7925,10 +7839,10 @@ function ProductSelectionBasicSelectDropdown(props) {
|
|
|
7925
7839
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
7926
7840
|
dataLocale = _useApplicationContex.dataLocale;
|
|
7927
7841
|
if (productSelectionsFetcher.isLoading) return jsxRuntime.jsx(CenteredLoadingSpinner, {});
|
|
7928
|
-
const productSelections =
|
|
7842
|
+
const productSelections = productSelectionsFetcher.productSelections?.results ?? [];
|
|
7929
7843
|
const filteredProductSelections = _filterInstanceProperty__default["default"](productSelections).call(productSelections, ps => {
|
|
7930
|
-
var
|
|
7931
|
-
return !_includesInstanceProperty__default["default"](
|
|
7844
|
+
var _context;
|
|
7845
|
+
return !_includesInstanceProperty__default["default"](_context = props.excludedProductSelectionIds).call(_context, ps.id);
|
|
7932
7846
|
});
|
|
7933
7847
|
const onOptionClick = event => {
|
|
7934
7848
|
const productSelectionId = event.target.value;
|
|
@@ -7977,7 +7891,7 @@ const getValueFromOptions$3 = _ref => {
|
|
|
7977
7891
|
// handle async-select-field value transformation
|
|
7978
7892
|
if (isMulti) {
|
|
7979
7893
|
var _context;
|
|
7980
|
-
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));
|
|
7981
7895
|
}
|
|
7982
7896
|
|
|
7983
7897
|
// in case it is not multiselect, then a single valued async-select-input is being requested and the value should have proper format
|
|
@@ -7989,7 +7903,6 @@ const emptyStoreOption$1 = intl => [{
|
|
|
7989
7903
|
isDisabled: true
|
|
7990
7904
|
}];
|
|
7991
7905
|
function ProductSelectionsAsyncSelectDropdown(props) {
|
|
7992
|
-
var _productSelectionsFet3;
|
|
7993
7906
|
const intl = reactIntl.useIntl();
|
|
7994
7907
|
const enableExcludingProducts = applicationShell.useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
7995
7908
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -8002,17 +7915,13 @@ function ProductSelectionsAsyncSelectDropdown(props) {
|
|
|
8002
7915
|
})),
|
|
8003
7916
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
8004
7917
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8005
|
-
const productSelections = React.useMemo(() =>
|
|
8006
|
-
var _productSelectionsFet, _productSelectionsFet2;
|
|
8007
|
-
return (_productSelectionsFet = (_productSelectionsFet2 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet2 === void 0 ? void 0 : _productSelectionsFet2.results) !== null && _productSelectionsFet !== void 0 ? _productSelectionsFet : [];
|
|
8008
|
-
}, [(_productSelectionsFet3 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet3 === void 0 ? void 0 : _productSelectionsFet3.results]);
|
|
7918
|
+
const productSelections = React.useMemo(() => productSelectionsFetcher.productSelections?.results ?? [], [productSelectionsFetcher.productSelections?.results]);
|
|
8009
7919
|
const filteredProductSelections = _filterInstanceProperty__default["default"](productSelections).call(productSelections, ps => {
|
|
8010
7920
|
var _context2;
|
|
8011
7921
|
return !_includesInstanceProperty__default["default"](_context2 = props.excludedProductSelectionIds).call(_context2, ps.id);
|
|
8012
7922
|
});
|
|
8013
7923
|
const onOptionClick = event => {
|
|
8014
|
-
|
|
8015
|
-
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;
|
|
8016
7925
|
const currentProductSelection = _findInstanceProperty__default["default"](productSelections).call(productSelections, productSelection => productSelection.id === productSelectionId);
|
|
8017
7926
|
props.onChange(currentProductSelection);
|
|
8018
7927
|
};
|
|
@@ -8084,15 +7993,11 @@ function ProductSelectionsAsyncSelectDropdown(props) {
|
|
|
8084
7993
|
}
|
|
8085
7994
|
|
|
8086
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 } } } };
|
|
8087
|
-
const createQueryVariables$4 = (productSelections, predicateField) => {
|
|
8088
|
-
|
|
8089
|
-
|
|
8090
|
-
|
|
8091
|
-
limit: 500
|
|
8092
|
-
};
|
|
8093
|
-
};
|
|
7996
|
+
const createQueryVariables$4 = (productSelections, predicateField) => ({
|
|
7997
|
+
where: `${predicateField} in (${_mapInstanceProperty__default["default"](productSelections).call(productSelections, ps => `"${ps}"`).join(', ')})`,
|
|
7998
|
+
limit: 500
|
|
7999
|
+
});
|
|
8094
8000
|
const useProductSelectionsByFieldFetcher = (productSelections, predicateField) => {
|
|
8095
|
-
var _productSelectionsQue, _productSelectionsQue2;
|
|
8096
8001
|
const productSelectionList = _Array$isArray__default["default"](productSelections) ? productSelections : [productSelections];
|
|
8097
8002
|
const productSelectionsQuery = react.useQuery(ProductSelectionsPickerFetcher$1, {
|
|
8098
8003
|
context: {
|
|
@@ -8102,7 +8007,7 @@ const useProductSelectionsByFieldFetcher = (productSelections, predicateField) =
|
|
|
8102
8007
|
skip: productSelectionList.length === 0
|
|
8103
8008
|
});
|
|
8104
8009
|
return {
|
|
8105
|
-
productSelections:
|
|
8010
|
+
productSelections: productSelectionsQuery.data?.productSelections.results ?? [],
|
|
8106
8011
|
isLoading: productSelectionsQuery.loading
|
|
8107
8012
|
};
|
|
8108
8013
|
};
|
|
@@ -8143,8 +8048,8 @@ const createQueryVariables$3 = _ref3 => {
|
|
|
8143
8048
|
var _context;
|
|
8144
8049
|
let searchText = _ref3.searchText;
|
|
8145
8050
|
const sanitizedSearchText = sanitize(_trimInstanceProperty__default["default"](searchText).call(searchText, searchText));
|
|
8146
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
8147
|
-
const keyQuery =
|
|
8051
|
+
const idQuery = isUUID(sanitizedSearchText) && `id = "${sanitizedSearchText}"`;
|
|
8052
|
+
const keyQuery = `key = "${sanitizedSearchText}"`;
|
|
8148
8053
|
const searchTextQuery = _filterInstanceProperty__default["default"](_context = [idQuery, keyQuery]).call(_context, Boolean).join(' or ');
|
|
8149
8054
|
return {
|
|
8150
8055
|
where: searchTextQuery || undefined
|
|
@@ -8167,7 +8072,6 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8167
8072
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8168
8073
|
const productSelectionsByFieldFetcher = useProductSelectionsByFieldFetcher(props.value, props.renderSelectInputOptionValuesByField);
|
|
8169
8074
|
const handleLoadOptions = async searchText => {
|
|
8170
|
-
var _data$productSelectio, _data$productSelectio2;
|
|
8171
8075
|
const _await$client$query = await client$1.query({
|
|
8172
8076
|
query: ProductSelectionsPickerFetcher,
|
|
8173
8077
|
variables: createQueryVariables$3({
|
|
@@ -8179,7 +8083,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8179
8083
|
fetchPolicy: 'network-only'
|
|
8180
8084
|
}),
|
|
8181
8085
|
data = _await$client$query.data;
|
|
8182
|
-
const matchedProductSelections =
|
|
8086
|
+
const matchedProductSelections = data?.productSelections?.results ?? [];
|
|
8183
8087
|
const updatedProductSelections = _mapInstanceProperty__default["default"](matchedProductSelections).call(matchedProductSelections, convertProductSelectionFromGraphQl);
|
|
8184
8088
|
const filteredProductSelections = _filterInstanceProperty__default["default"](updatedProductSelections).call(updatedProductSelections, ps => {
|
|
8185
8089
|
var _context2;
|
|
@@ -8195,8 +8099,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8195
8099
|
};
|
|
8196
8100
|
const loadOptionsDebounced = debounce__default["default"](handleLoadOptions, 500);
|
|
8197
8101
|
const onOptionClick = event => {
|
|
8198
|
-
|
|
8199
|
-
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;
|
|
8200
8103
|
const currentProductSelection = _findInstanceProperty__default["default"](productionSelectionResults).call(productionSelectionResults, productSelection => productSelection.id === productSelectionId);
|
|
8201
8104
|
props.onChange(currentProductSelection);
|
|
8202
8105
|
};
|
|
@@ -8244,11 +8147,11 @@ function ModeSelectInputOption(props) {
|
|
|
8244
8147
|
scale: "xs",
|
|
8245
8148
|
children: [jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
8246
8149
|
isBold: true,
|
|
8247
|
-
children:
|
|
8150
|
+
children: data?.label || noValueFallback
|
|
8248
8151
|
}), jsxRuntime.jsxs(uiKit.Text.Detail, {
|
|
8249
|
-
children: ["Key: ",
|
|
8152
|
+
children: ["Key: ", data?.key || noValueFallback]
|
|
8250
8153
|
}), jsxRuntime.jsxs(uiKit.Text.Detail, {
|
|
8251
|
-
children: ["Type: ",
|
|
8154
|
+
children: ["Type: ", data?.mode || noValueFallback]
|
|
8252
8155
|
})]
|
|
8253
8156
|
})
|
|
8254
8157
|
}));
|
|
@@ -8349,8 +8252,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8349
8252
|
var _context2;
|
|
8350
8253
|
const intl = reactIntl.useIntl();
|
|
8351
8254
|
const handleLoadOptions = async searchTerm => {
|
|
8352
|
-
|
|
8353
|
-
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 => {
|
|
8354
8256
|
var _context;
|
|
8355
8257
|
return _includesInstanceProperty__default["default"](_context = country.label.toLowerCase()).call(_context, searchTerm.toLowerCase());
|
|
8356
8258
|
});
|
|
@@ -8358,7 +8260,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8358
8260
|
return _sliceInstanceProperty__default["default"](filteredOptions).call(filteredOptions, 0, props.countriesAsyncLoadingLimit);
|
|
8359
8261
|
}
|
|
8360
8262
|
return [{
|
|
8361
|
-
options:
|
|
8263
|
+
options: props.options?.slice(0, props.countriesAsyncLoadingLimit)
|
|
8362
8264
|
}, {
|
|
8363
8265
|
options: emptyCountryOption(intl)
|
|
8364
8266
|
}];
|
|
@@ -8367,10 +8269,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8367
8269
|
const countries = event.target.value;
|
|
8368
8270
|
props.onChange({
|
|
8369
8271
|
target: _objectSpread$F(_objectSpread$F({}, event.target), {}, {
|
|
8370
|
-
value: _mapInstanceProperty__default["default"](countries).call(countries, country =>
|
|
8371
|
-
var _country$value;
|
|
8372
|
-
return (_country$value = country === null || country === void 0 ? void 0 : country.value) !== null && _country$value !== void 0 ? _country$value : country;
|
|
8373
|
-
})
|
|
8272
|
+
value: _mapInstanceProperty__default["default"](countries).call(countries, country => country?.value ?? country)
|
|
8374
8273
|
})
|
|
8375
8274
|
});
|
|
8376
8275
|
};
|
|
@@ -8400,8 +8299,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8400
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; }
|
|
8401
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; }
|
|
8402
8301
|
function CountriesPicker(props) {
|
|
8403
|
-
|
|
8404
|
-
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;
|
|
8405
8303
|
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
8406
8304
|
children: jsxRuntime.jsx(CustomCountriesPicker, _objectSpread$E({}, props))
|
|
8407
8305
|
});
|
|
@@ -8430,7 +8328,6 @@ var GetCustomerGroupsQuery = { kind: "Document", definitions: [{ kind: "Operatio
|
|
|
8430
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 } } } };
|
|
8431
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 } } } };
|
|
8432
8330
|
const CustomerGroupPickerInput = _ref => {
|
|
8433
|
-
var _currentOption$data$l, _currentOption$data;
|
|
8434
8331
|
let isClearable = _ref.isClearable,
|
|
8435
8332
|
isDisabled = _ref.isDisabled,
|
|
8436
8333
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -8499,13 +8396,13 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
8499
8396
|
setLoadingError(null);
|
|
8500
8397
|
handleInternalInputChange(event);
|
|
8501
8398
|
}, [handleInternalInputChange]);
|
|
8502
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
8399
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
8503
8400
|
React.useEffect(() => {
|
|
8504
8401
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
8505
8402
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
8506
8403
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
8507
8404
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$t.noCustomerGroupsFound), [loadingError, formatMessage]);
|
|
8508
|
-
const tooltipTitle =
|
|
8405
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
8509
8406
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
8510
8407
|
max: "scale",
|
|
8511
8408
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -8515,7 +8412,7 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
8515
8412
|
children: jsxRuntime.jsx(uiKit.AsyncSelectInput, {
|
|
8516
8413
|
id: name,
|
|
8517
8414
|
name: name,
|
|
8518
|
-
placeholder: placeholder
|
|
8415
|
+
placeholder: placeholder ?? formatMessage(messages$t.placeholder),
|
|
8519
8416
|
loadOptions: loadOptionsDebounced,
|
|
8520
8417
|
defaultOptions: true,
|
|
8521
8418
|
showOptionGroupDivider: true,
|
|
@@ -8544,12 +8441,11 @@ CustomerGroupPickerInput.displayName = 'CustomerGroupPickerInput';
|
|
|
8544
8441
|
const DEFAULT_LENGTH = 50;
|
|
8545
8442
|
const DEFAULT_END = '...';
|
|
8546
8443
|
function truncate (text) {
|
|
8547
|
-
var _context;
|
|
8548
8444
|
let length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_LENGTH;
|
|
8549
8445
|
let end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_END;
|
|
8550
8446
|
if (!text) return '';
|
|
8551
8447
|
if (text.length < length) return text;
|
|
8552
|
-
return
|
|
8448
|
+
return `${text.substring(0, length)}${end}`;
|
|
8553
8449
|
}
|
|
8554
8450
|
|
|
8555
8451
|
const LOWER_STORES_LIMIT = 60;
|
|
@@ -8557,7 +8453,6 @@ const UPPER_STORES_LIMIT = 500;
|
|
|
8557
8453
|
|
|
8558
8454
|
// map store to options
|
|
8559
8455
|
const mapStoresToOptions = _ref => {
|
|
8560
|
-
var _store$productSelecti;
|
|
8561
8456
|
let store = _ref.store,
|
|
8562
8457
|
renderSelectInputOptionValuesByField = _ref.renderSelectInputOptionValuesByField,
|
|
8563
8458
|
dataLocale = _ref.dataLocale;
|
|
@@ -8568,14 +8463,14 @@ const mapStoresToOptions = _ref => {
|
|
|
8568
8463
|
const localizedName = l10n.formatLocalizedString(convertedStore, {
|
|
8569
8464
|
key: 'name',
|
|
8570
8465
|
locale: dataLocale,
|
|
8571
|
-
fallback:
|
|
8466
|
+
fallback: `${store.key} (key)`
|
|
8572
8467
|
});
|
|
8573
8468
|
return {
|
|
8574
8469
|
label: localizedName,
|
|
8575
8470
|
value: renderSelectInputOptionValuesByField === 'key' ? store.key : store.id,
|
|
8576
8471
|
key: store.key,
|
|
8577
8472
|
id: store.id,
|
|
8578
|
-
productSelections:
|
|
8473
|
+
productSelections: store.productSelections?.map(productSelectionRef => productSelectionRef.productSelection.id)
|
|
8579
8474
|
};
|
|
8580
8475
|
};
|
|
8581
8476
|
|
|
@@ -8637,7 +8532,7 @@ const getValueFromOptions$1 = _ref => {
|
|
|
8637
8532
|
isMulti = _ref.isMulti;
|
|
8638
8533
|
// handle async-select-field value transformation
|
|
8639
8534
|
if (isMulti) {
|
|
8640
|
-
return _filterInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores
|
|
8535
|
+
return _filterInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores?.includes(store.value));
|
|
8641
8536
|
}
|
|
8642
8537
|
|
|
8643
8538
|
// return value as undefined if no options is yet selected. It is needed for cases where users sets initial values as empty string
|
|
@@ -8666,13 +8561,13 @@ const StoresAsyncSelectInput = props => {
|
|
|
8666
8561
|
sort: 'createdAt asc',
|
|
8667
8562
|
excludeExtendedStoresList: true,
|
|
8668
8563
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8669
|
-
stores:
|
|
8564
|
+
stores: keysOfStores?.length && keysOfStores,
|
|
8670
8565
|
projectKey: props.projectKey
|
|
8671
8566
|
});
|
|
8672
8567
|
const hasError = uiKit.AsyncSelectInput.isTouched(props.touched) && hasErrors$2(props.errors) || props.hasError;
|
|
8673
8568
|
const mappedStoresListOptions = React.useMemo(() => {
|
|
8674
|
-
var _context2
|
|
8675
|
-
return _mapInstanceProperty__default["default"](_context2 =
|
|
8569
|
+
var _context2;
|
|
8570
|
+
return _mapInstanceProperty__default["default"](_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8676
8571
|
store,
|
|
8677
8572
|
dataLocale,
|
|
8678
8573
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -8758,21 +8653,20 @@ const StoresBasicSelectInput = props => {
|
|
|
8758
8653
|
sort: 'createdAt asc',
|
|
8759
8654
|
excludeExtendedStoresList: true,
|
|
8760
8655
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8761
|
-
stores:
|
|
8656
|
+
stores: keysOfStores?.length && keysOfStores,
|
|
8762
8657
|
projectKey: props.projectKey
|
|
8763
8658
|
});
|
|
8764
8659
|
const hasError = uiKit.SelectInput.isTouched(props.touched) && hasErrors$1(props.errors) || props.hasError;
|
|
8765
8660
|
const mappedStoresListOptions = React.useMemo(() => {
|
|
8766
|
-
var _context2
|
|
8767
|
-
return _mapInstanceProperty__default["default"](_context2 =
|
|
8661
|
+
var _context2;
|
|
8662
|
+
return _mapInstanceProperty__default["default"](_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8768
8663
|
store,
|
|
8769
8664
|
dataLocale,
|
|
8770
8665
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
8771
8666
|
}));
|
|
8772
8667
|
}, [dataLocale, storesListFetcher.stores, props.renderSelectInputOptionValuesByField]);
|
|
8773
8668
|
const handleChange = event => {
|
|
8774
|
-
|
|
8775
|
-
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;
|
|
8776
8670
|
const currentStore = _findInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => store.value === value);
|
|
8777
8671
|
|
|
8778
8672
|
// We need complete store info including productSelections
|
|
@@ -8827,7 +8721,6 @@ StoresBasicSelectInput.defaultProps = {
|
|
|
8827
8721
|
|
|
8828
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 } } } };
|
|
8829
8723
|
const useTotalNumberOfStoresFetcher = projectKey => {
|
|
8830
|
-
var _totalNumberOfStoresQ;
|
|
8831
8724
|
const totalNumberOfStoresQuery = react.useQuery(TotalNumberOfStores, {
|
|
8832
8725
|
context: {
|
|
8833
8726
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM,
|
|
@@ -8836,7 +8729,7 @@ const useTotalNumberOfStoresFetcher = projectKey => {
|
|
|
8836
8729
|
fetchPolicy: 'network-only'
|
|
8837
8730
|
});
|
|
8838
8731
|
return {
|
|
8839
|
-
total:
|
|
8732
|
+
total: totalNumberOfStoresQuery.data?.totalNumberOfStores.total,
|
|
8840
8733
|
isLoading: totalNumberOfStoresQuery.loading
|
|
8841
8734
|
};
|
|
8842
8735
|
};
|
|
@@ -8854,19 +8747,15 @@ const handlers$1 = {
|
|
|
8854
8747
|
};
|
|
8855
8748
|
|
|
8856
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 } } } };
|
|
8857
|
-
const createQueryVariables$2 = (stores, predicateField, shouldFetchProductSelections) => {
|
|
8858
|
-
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
|
|
8862
|
-
excludeProductSelections: !shouldFetchProductSelections
|
|
8863
|
-
};
|
|
8864
|
-
};
|
|
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
|
+
});
|
|
8865
8755
|
const emptyStoresQueryResult = {
|
|
8866
8756
|
results: []
|
|
8867
8757
|
};
|
|
8868
8758
|
const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
8869
|
-
var _storesQuery$data;
|
|
8870
8759
|
let shouldFetchProductSelections = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
8871
8760
|
// incase of single select input stores are sent as single string literal
|
|
8872
8761
|
const storesList = _Array$isArray__default["default"](stores) ? stores : [stores];
|
|
@@ -8879,29 +8768,29 @@ const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
|
8879
8768
|
skip: storesList.length === 0
|
|
8880
8769
|
});
|
|
8881
8770
|
return {
|
|
8882
|
-
stores:
|
|
8771
|
+
stores: storesQuery.data?.storesByField || emptyStoresQueryResult,
|
|
8883
8772
|
isLoading: storesQuery.loading
|
|
8884
8773
|
};
|
|
8885
8774
|
};
|
|
8886
8775
|
|
|
8887
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; }
|
|
8888
|
-
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; }
|
|
8889
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 } } } };
|
|
8890
8779
|
const hasErrors = errors => {
|
|
8891
8780
|
var _context;
|
|
8892
8781
|
return errors && _someInstanceProperty__default["default"](_context = _Object$values__default["default"](errors)).call(_context, Boolean);
|
|
8893
8782
|
};
|
|
8894
8783
|
const createQueryVariables$1 = _ref => {
|
|
8895
|
-
var _context2
|
|
8784
|
+
var _context2;
|
|
8896
8785
|
let searchText = _ref.searchText,
|
|
8897
8786
|
dataLocale = _ref.dataLocale,
|
|
8898
8787
|
allAccessibleStoreKeysThroughDataFencePermissions = _ref.allAccessibleStoreKeysThroughDataFencePermissions,
|
|
8899
8788
|
shouldFetchProductSelections = _ref.shouldFetchProductSelections;
|
|
8900
8789
|
const sanitizedSearchText = sanitize(_trimInstanceProperty__default["default"](searchText).call(searchText, searchText));
|
|
8901
|
-
const keyQuery =
|
|
8790
|
+
const keyQuery = `key = "${sanitizedSearchText}"`;
|
|
8902
8791
|
|
|
8903
8792
|
// if the user has data fence permissions then we only allow stores to fetched that user has access to
|
|
8904
|
-
if (allAccessibleStoreKeysThroughDataFencePermissions
|
|
8793
|
+
if (allAccessibleStoreKeysThroughDataFencePermissions?.length) {
|
|
8905
8794
|
// if the current search term match the accessible stores keys, then proceed with fetching the store
|
|
8906
8795
|
if (_includesInstanceProperty__default["default"](allAccessibleStoreKeysThroughDataFencePermissions).call(allAccessibleStoreKeysThroughDataFencePermissions, sanitizedSearchText)) {
|
|
8907
8796
|
return {
|
|
@@ -8917,9 +8806,9 @@ const createQueryVariables$1 = _ref => {
|
|
|
8917
8806
|
excludeProductSelections: !shouldFetchProductSelections
|
|
8918
8807
|
};
|
|
8919
8808
|
}
|
|
8920
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
8921
|
-
const nameQuery =
|
|
8922
|
-
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 ');
|
|
8923
8812
|
return {
|
|
8924
8813
|
skipFetchingStores: false,
|
|
8925
8814
|
where: searchTextQuery,
|
|
@@ -8927,7 +8816,6 @@ const createQueryVariables$1 = _ref => {
|
|
|
8927
8816
|
};
|
|
8928
8817
|
};
|
|
8929
8818
|
const getValueFromOptions = _ref2 => {
|
|
8930
|
-
var _storesByFieldFetcher, _context4;
|
|
8931
8819
|
let isMulti = _ref2.isMulti,
|
|
8932
8820
|
value = _ref2.value,
|
|
8933
8821
|
dataLocale = _ref2.dataLocale,
|
|
@@ -8936,7 +8824,7 @@ const getValueFromOptions = _ref2 => {
|
|
|
8936
8824
|
if (!value) {
|
|
8937
8825
|
return undefined;
|
|
8938
8826
|
}
|
|
8939
|
-
const selectedOptions =
|
|
8827
|
+
const selectedOptions = storesByFieldFetcher.stores?.results.map(store => mapStoresToOptions({
|
|
8940
8828
|
store,
|
|
8941
8829
|
dataLocale,
|
|
8942
8830
|
renderSelectInputOptionValuesByField: renderSelectInputOptionValuesByField
|
|
@@ -8974,9 +8862,8 @@ const StoresSearchSelectInput = props => {
|
|
|
8974
8862
|
},
|
|
8975
8863
|
fetchPolicy: 'network-only'
|
|
8976
8864
|
}).then(_ref3 => {
|
|
8977
|
-
var _data$storesByWherePr, _context5;
|
|
8978
8865
|
let data = _ref3.data;
|
|
8979
|
-
return
|
|
8866
|
+
return data.storesByWherePredicate?.results.map(store => mapStoresToOptions({
|
|
8980
8867
|
store,
|
|
8981
8868
|
dataLocale,
|
|
8982
8869
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -9156,14 +9043,14 @@ var messages$r = reactIntl.defineMessages({
|
|
|
9156
9043
|
|
|
9157
9044
|
function formatDiscount(discount, currencyCode, intl) {
|
|
9158
9045
|
var _context;
|
|
9159
|
-
if (discount.type === 'relative') return
|
|
9046
|
+
if (discount.type === 'relative') return `${discount.permyriad / 100}%`;
|
|
9160
9047
|
if (!discount.money) return null;
|
|
9161
9048
|
const moneyForCurrencyCode = _findInstanceProperty__default["default"](_context = discount.money).call(_context, discountMoney => discountMoney.currencyCode === currencyCode);
|
|
9162
9049
|
return moneyForCurrencyCode ? formatMoney$2(moneyForCurrencyCode, intl) : null;
|
|
9163
9050
|
}
|
|
9164
9051
|
|
|
9165
9052
|
function formatPercentage(percentage) {
|
|
9166
|
-
return
|
|
9053
|
+
return `${percentage}%`;
|
|
9167
9054
|
}
|
|
9168
9055
|
function convertRatioToPercentage(ratio) {
|
|
9169
9056
|
return _parseFloat__default["default"]((ratio * 100).toFixed(2));
|
|
@@ -9217,8 +9104,8 @@ function validateFilter$2(_ref, intl) {
|
|
|
9217
9104
|
};
|
|
9218
9105
|
}
|
|
9219
9106
|
if (value.option === FILTER_TYPES.range) {
|
|
9220
|
-
const from = validateValue(filterValue
|
|
9221
|
-
const to = from ? null : validateValue(filterValue
|
|
9107
|
+
const from = validateValue(filterValue?.from, typeName, intl);
|
|
9108
|
+
const to = from ? null : validateValue(filterValue?.to, typeName, intl);
|
|
9222
9109
|
return from || to ? {
|
|
9223
9110
|
input: {
|
|
9224
9111
|
from,
|
|
@@ -9255,16 +9142,16 @@ function validateFilter$1(_ref, intl) {
|
|
|
9255
9142
|
type = _ref.type;
|
|
9256
9143
|
if (type === 'range') {
|
|
9257
9144
|
if (validateSingleFilter({
|
|
9258
|
-
value: value
|
|
9145
|
+
value: value?.from
|
|
9259
9146
|
})) return {
|
|
9260
9147
|
from: intl.formatMessage(messages$p.rangeMissingValue)
|
|
9261
9148
|
};
|
|
9262
9149
|
if (validateSingleFilter({
|
|
9263
|
-
value: value
|
|
9150
|
+
value: value?.to
|
|
9264
9151
|
})) return {
|
|
9265
9152
|
to: intl.formatMessage(messages$p.rangeMissingValue)
|
|
9266
9153
|
};
|
|
9267
|
-
if (moment__default$1["default"](value
|
|
9154
|
+
if (moment__default$1["default"](value?.to).isBefore(value?.from)) return {
|
|
9268
9155
|
from: intl.formatMessage(messages$p.rangeToSmallerThanFrom)
|
|
9269
9156
|
};
|
|
9270
9157
|
} else if (type === 'equalTo' || type === 'lessThan' || type === 'moreThan') {
|
|
@@ -9334,10 +9221,8 @@ function isEmptyFilter(_ref) {
|
|
|
9334
9221
|
}
|
|
9335
9222
|
|
|
9336
9223
|
function numberTransformer(filterKey, filters) {
|
|
9337
|
-
var _context3;
|
|
9338
9224
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$2;
|
|
9339
9225
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
9340
|
-
var _context, _context2;
|
|
9341
9226
|
let type = _ref.type,
|
|
9342
9227
|
value = _ref.value;
|
|
9343
9228
|
if (!filterValidator({
|
|
@@ -9346,19 +9231,19 @@ function numberTransformer(filterKey, filters) {
|
|
|
9346
9231
|
})) return '';
|
|
9347
9232
|
switch (type) {
|
|
9348
9233
|
case 'lessThan':
|
|
9349
|
-
return
|
|
9234
|
+
return `(* to ${value - 1})`;
|
|
9350
9235
|
case 'moreThan':
|
|
9351
|
-
return
|
|
9236
|
+
return `(${value + 1} to *)`;
|
|
9352
9237
|
case 'equalTo':
|
|
9353
|
-
return
|
|
9238
|
+
return `(${value} to ${value})`;
|
|
9354
9239
|
case 'range':
|
|
9355
|
-
return
|
|
9240
|
+
return `(${value.from} to ${value.to})`;
|
|
9356
9241
|
default:
|
|
9357
9242
|
return '';
|
|
9358
9243
|
}
|
|
9359
9244
|
});
|
|
9360
9245
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
9361
|
-
return queryString === '' ? null :
|
|
9246
|
+
return queryString === '' ? null : `${filterKey}: range${queryString}`;
|
|
9362
9247
|
}
|
|
9363
9248
|
function isFilterValid$2(_ref2) {
|
|
9364
9249
|
let type = _ref2.type,
|
|
@@ -9385,11 +9270,9 @@ function graphqlCategoryLevelTransformer(filterKey, filters, filterValidator) {
|
|
|
9385
9270
|
return _filterInstanceProperty__default["default"](_context = [levelFilterQuery, lastLevelFilterQuery]).call(_context, Boolean);
|
|
9386
9271
|
}
|
|
9387
9272
|
|
|
9388
|
-
var _templateObject$1, _templateObject2;
|
|
9389
9273
|
const dateFormatDayStart = 'YYYY-MM-DDT00:00:00.000Z';
|
|
9390
9274
|
const dateFormatDayEnd = 'YYYY-MM-DDT23:59:59.999Z';
|
|
9391
9275
|
function dateTransformer(filterKey, filters) {
|
|
9392
|
-
var _context;
|
|
9393
9276
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$1;
|
|
9394
9277
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
9395
9278
|
let type = _ref.type,
|
|
@@ -9400,19 +9283,25 @@ function dateTransformer(filterKey, filters) {
|
|
|
9400
9283
|
})) return '';
|
|
9401
9284
|
switch (type) {
|
|
9402
9285
|
case 'lessThan':
|
|
9403
|
-
return
|
|
9286
|
+
return `(* to "${moment__default$1["default"](value).format(dateFormatDayStart)}")`;
|
|
9404
9287
|
case 'moreThan':
|
|
9405
|
-
return
|
|
9288
|
+
return `("${moment__default$1["default"](value).format(dateFormatDayEnd)}" to *)`;
|
|
9406
9289
|
case 'equalTo':
|
|
9407
|
-
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
|
+
`;
|
|
9408
9294
|
case 'range':
|
|
9409
|
-
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
|
+
`;
|
|
9410
9299
|
default:
|
|
9411
9300
|
return '';
|
|
9412
9301
|
}
|
|
9413
9302
|
});
|
|
9414
9303
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
9415
|
-
return queryString === '' ? null :
|
|
9304
|
+
return queryString === '' ? null : `${filterKey}: range${queryString}`;
|
|
9416
9305
|
}
|
|
9417
9306
|
function isFilterValid$1(_ref2) {
|
|
9418
9307
|
let type = _ref2.type,
|
|
@@ -9427,19 +9316,18 @@ function isFilterValid$1(_ref2) {
|
|
|
9427
9316
|
}
|
|
9428
9317
|
|
|
9429
9318
|
function missingLocaleTransformer(filterKey, filters) {
|
|
9430
|
-
var _context;
|
|
9431
9319
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
9432
9320
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
9433
9321
|
if (filters.length === 0) return null;
|
|
9434
9322
|
const missingLocale = filters[0].value.value;
|
|
9435
|
-
return
|
|
9323
|
+
return `${filterKey}.${missingLocale}:missing`;
|
|
9436
9324
|
}
|
|
9437
9325
|
|
|
9438
9326
|
function missingTransformer(filterKey, filters) {
|
|
9439
9327
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
9440
9328
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
9441
9329
|
if (filters.length === 0) return null;
|
|
9442
|
-
return
|
|
9330
|
+
return `${filterKey}:missing`;
|
|
9443
9331
|
}
|
|
9444
9332
|
|
|
9445
9333
|
/**
|
|
@@ -9480,7 +9368,6 @@ function graphqlQueryBuilder(_ref) {
|
|
|
9480
9368
|
}
|
|
9481
9369
|
|
|
9482
9370
|
function referenceTransformer(filterKey, filters) {
|
|
9483
|
-
var _context;
|
|
9484
9371
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid;
|
|
9485
9372
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
9486
9373
|
let type = _ref.type,
|
|
@@ -9491,49 +9378,46 @@ function referenceTransformer(filterKey, filters) {
|
|
|
9491
9378
|
})) return '';
|
|
9492
9379
|
switch (type) {
|
|
9493
9380
|
case 'equalTo':
|
|
9494
|
-
return "
|
|
9381
|
+
return `"${value}"`;
|
|
9495
9382
|
default:
|
|
9496
9383
|
return '';
|
|
9497
9384
|
}
|
|
9498
9385
|
});
|
|
9499
9386
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
9500
|
-
return queryString === '' ? null :
|
|
9387
|
+
return queryString === '' ? null : `${filterKey}.id: ${queryString}`;
|
|
9501
9388
|
}
|
|
9502
9389
|
function isFilterValid(_ref2) {
|
|
9503
|
-
var
|
|
9390
|
+
var _context;
|
|
9504
9391
|
let type = _ref2.type,
|
|
9505
9392
|
value = _ref2.value;
|
|
9506
|
-
if (type === 'equalTo' && !_includesInstanceProperty__default["default"](
|
|
9393
|
+
if (type === 'equalTo' && !_includesInstanceProperty__default["default"](_context = [null, undefined, '']).call(_context, value)) return true;
|
|
9507
9394
|
return false;
|
|
9508
9395
|
}
|
|
9509
9396
|
|
|
9510
9397
|
function textTransformer(filterKey, queries) {
|
|
9511
|
-
var _context;
|
|
9512
9398
|
if (queries.length === 0) return null;
|
|
9513
9399
|
|
|
9514
9400
|
// Note: we assume for now that there can only be 1 text filter.
|
|
9515
9401
|
const queryValue = queries[0].value;
|
|
9516
|
-
return queryValue ?
|
|
9402
|
+
return queryValue ? `${filterKey}:"${queryValue}"` : null;
|
|
9517
9403
|
}
|
|
9518
9404
|
|
|
9519
9405
|
const composeNumberPredicateFromFilter = (target, value, option) => {
|
|
9520
|
-
var _context, _context2, _context3, _context4, _context5, _context6;
|
|
9521
9406
|
switch (option) {
|
|
9522
9407
|
case FILTER_TYPES.lessThan:
|
|
9523
|
-
return
|
|
9408
|
+
return `${target} < ${value}`;
|
|
9524
9409
|
case FILTER_TYPES.moreThan:
|
|
9525
|
-
return
|
|
9410
|
+
return `${target} > ${value}`;
|
|
9526
9411
|
case FILTER_TYPES.equalTo:
|
|
9527
|
-
return
|
|
9412
|
+
return `${target} = ${value}`;
|
|
9528
9413
|
case FILTER_TYPES.range:
|
|
9529
|
-
return
|
|
9414
|
+
return `${target} >= ${value.from} and ${target} <= ${value.to}`;
|
|
9530
9415
|
default:
|
|
9531
9416
|
return '';
|
|
9532
9417
|
}
|
|
9533
9418
|
};
|
|
9534
9419
|
function customFields (filter, locale) {
|
|
9535
9420
|
const customFieldsPredicates = _mapInstanceProperty__default["default"](filter).call(filter, customFieldFilter => {
|
|
9536
|
-
var _context7, _context8, _context9, _context10, _context11;
|
|
9537
9421
|
const _customFieldFilter$va = customFieldFilter.value,
|
|
9538
9422
|
target = _customFieldFilter$va.target,
|
|
9539
9423
|
type = _customFieldFilter$va.type,
|
|
@@ -9541,14 +9425,14 @@ function customFields (filter, locale) {
|
|
|
9541
9425
|
option = _customFieldFilter$va.option;
|
|
9542
9426
|
switch (type.name) {
|
|
9543
9427
|
case FIELD_TYPES.Boolean:
|
|
9544
|
-
return
|
|
9428
|
+
return `${target} = ${value.value}`;
|
|
9545
9429
|
case FIELD_TYPES.String:
|
|
9546
|
-
return
|
|
9430
|
+
return `${target} = "${value}"`;
|
|
9547
9431
|
case FIELD_TYPES.LocalizedString:
|
|
9548
|
-
return
|
|
9432
|
+
return `${target}(${localizedTextTransformer(value)})`;
|
|
9549
9433
|
case FIELD_TYPES.Enum:
|
|
9550
9434
|
case FIELD_TYPES.LocalizedEnum:
|
|
9551
|
-
return
|
|
9435
|
+
return `${target} = "${value.value}"`;
|
|
9552
9436
|
case FIELD_TYPES.Time:
|
|
9553
9437
|
return timeTransformer(target, [{
|
|
9554
9438
|
type: option,
|
|
@@ -9563,14 +9447,14 @@ function customFields (filter, locale) {
|
|
|
9563
9447
|
case FIELD_TYPES.Number:
|
|
9564
9448
|
return composeNumberPredicateFromFilter(target, value, option);
|
|
9565
9449
|
case FIELD_TYPES.Money:
|
|
9566
|
-
return
|
|
9450
|
+
return `${target}(${moneyTransformer(value, option, locale)})`;
|
|
9567
9451
|
case FIELD_TYPES.Reference:
|
|
9568
9452
|
case FIELD_TYPES.Set:
|
|
9569
9453
|
default:
|
|
9570
9454
|
throw new Error('Custom field type not recognized');
|
|
9571
9455
|
}
|
|
9572
9456
|
});
|
|
9573
|
-
return
|
|
9457
|
+
return `(custom(fields(${customFieldsPredicates.join(' and ')})))`;
|
|
9574
9458
|
}
|
|
9575
9459
|
|
|
9576
9460
|
// https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/btoa#Unicode_strings
|
|
@@ -9615,7 +9499,7 @@ function ownKeys$z(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
9615
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; }
|
|
9616
9500
|
const resourcesWithPlatformLimits = _Object$keys__default["default"](RESOURCES_WITH_PLATFORM_LIMITS);
|
|
9617
9501
|
const createQueryVariables = platformLimit => _reduceInstanceProperty__default["default"](resourcesWithPlatformLimits).call(resourcesWithPlatformLimits, (previousIncludedLimits, nextNameOfLimit) => _objectSpread$z({
|
|
9618
|
-
[camelCase__default["default"](
|
|
9502
|
+
[camelCase__default["default"](`should include ${nextNameOfLimit}`)]: platformLimit ? nextNameOfLimit === platformLimit : true
|
|
9619
9503
|
}, previousIncludedLimits), {});
|
|
9620
9504
|
|
|
9621
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 } } } };
|
|
@@ -9631,7 +9515,7 @@ const usePlatformLimitsFetcher = platformLimit => {
|
|
|
9631
9515
|
error = _useQuery.error,
|
|
9632
9516
|
data = _useQuery.data,
|
|
9633
9517
|
refetch = _useQuery.refetch;
|
|
9634
|
-
const platformLimits = !loading ? omit__default["default"](data
|
|
9518
|
+
const platformLimits = !loading ? omit__default["default"](data?.limits, '__typename') : {};
|
|
9635
9519
|
return {
|
|
9636
9520
|
isLoading: loading,
|
|
9637
9521
|
error,
|
|
@@ -9822,11 +9706,10 @@ const getPlatformLimitsStatus = _ref3 => {
|
|
|
9822
9706
|
total = _ref3.total,
|
|
9823
9707
|
intl = _ref3.intl;
|
|
9824
9708
|
if (limit) {
|
|
9825
|
-
|
|
9826
|
-
return _concatInstanceProperty__default["default"](_context = "(".concat(intl.formatNumber(current), "/")).call(_context, intl.formatNumber(limit), ")");
|
|
9709
|
+
return `(${intl.formatNumber(current)}/${intl.formatNumber(limit)})`;
|
|
9827
9710
|
}
|
|
9828
9711
|
if (total) {
|
|
9829
|
-
return
|
|
9712
|
+
return `(${intl.formatNumber(total)})`;
|
|
9830
9713
|
}
|
|
9831
9714
|
return '';
|
|
9832
9715
|
};
|
|
@@ -9846,18 +9729,17 @@ const useShippingMethodsPlatformLimitsFetcher = () => {
|
|
|
9846
9729
|
};
|
|
9847
9730
|
|
|
9848
9731
|
const useShippingMethodsPlatformLimits = () => {
|
|
9849
|
-
var _platformLimits$shipp;
|
|
9850
9732
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
9851
9733
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
9852
|
-
if (!
|
|
9734
|
+
if (!platformLimits?.shippingMethods?.total) {
|
|
9853
9735
|
return {
|
|
9854
9736
|
hasReachedShippingMethodsWarningLimit: false,
|
|
9855
9737
|
hasReachedShippingMethodsErrorLimit: false
|
|
9856
9738
|
};
|
|
9857
9739
|
}
|
|
9858
|
-
const _platformLimits$
|
|
9859
|
-
limit = _platformLimits$
|
|
9860
|
-
current = _platformLimits$
|
|
9740
|
+
const _platformLimits$shipp = platformLimits.shippingMethods.total,
|
|
9741
|
+
limit = _platformLimits$shipp.limit,
|
|
9742
|
+
current = _platformLimits$shipp.current;
|
|
9861
9743
|
const hasReachedShippingMethodsWarningLimit = getHasExceededWarningThreshold({
|
|
9862
9744
|
limit,
|
|
9863
9745
|
current
|
|
@@ -9873,13 +9755,12 @@ const useShippingMethodsPlatformLimits = () => {
|
|
|
9873
9755
|
};
|
|
9874
9756
|
|
|
9875
9757
|
const PlatformLimitsShippingMethodsNotifications = () => {
|
|
9876
|
-
var _platformLimits$shipp;
|
|
9877
9758
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
9878
9759
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
9879
9760
|
const _useShippingMethodsPl2 = useShippingMethodsPlatformLimits(),
|
|
9880
9761
|
hasReachedShippingMethodsWarningLimit = _useShippingMethodsPl2.hasReachedShippingMethodsWarningLimit,
|
|
9881
9762
|
hasReachedShippingMethodsErrorLimit = _useShippingMethodsPl2.hasReachedShippingMethodsErrorLimit;
|
|
9882
|
-
if (!
|
|
9763
|
+
if (!platformLimits?.shippingMethods?.total) {
|
|
9883
9764
|
return null;
|
|
9884
9765
|
}
|
|
9885
9766
|
if (hasReachedShippingMethodsErrorLimit) {
|
|
@@ -9925,13 +9806,12 @@ var messages$k = reactIntl.defineMessages({
|
|
|
9925
9806
|
});
|
|
9926
9807
|
|
|
9927
9808
|
const PlatformLimitsShippingMethodsStatus = _ref => {
|
|
9928
|
-
var _platformLimits$shipp, _platformLimits$shipp2;
|
|
9929
9809
|
let total = _ref.total;
|
|
9930
9810
|
const intl = reactIntl.useIntl();
|
|
9931
9811
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
9932
9812
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
9933
|
-
const current = platformLimits
|
|
9934
|
-
const limit = platformLimits
|
|
9813
|
+
const current = platformLimits?.shippingMethods?.total?.current;
|
|
9814
|
+
const limit = platformLimits?.shippingMethods?.total?.limit;
|
|
9935
9815
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
9936
9816
|
intlMessage: messages$k.shippingMethodsStatus,
|
|
9937
9817
|
children: getPlatformLimitsStatus({
|
|
@@ -9993,18 +9873,17 @@ const useTaxCategoriesPlatformLimitsFetcher = () => {
|
|
|
9993
9873
|
};
|
|
9994
9874
|
|
|
9995
9875
|
const useTaxCategoriesPlatformLimits = () => {
|
|
9996
|
-
var _platformLimits$taxCa;
|
|
9997
9876
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
9998
9877
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
9999
|
-
if (!
|
|
9878
|
+
if (!platformLimits?.taxCategories?.total) {
|
|
10000
9879
|
return {
|
|
10001
9880
|
hasReachedTaxCategoriesWarningLimit: false,
|
|
10002
9881
|
hasReachedTaxCategoriesErrorLimit: false
|
|
10003
9882
|
};
|
|
10004
9883
|
}
|
|
10005
|
-
const _platformLimits$
|
|
10006
|
-
limit = _platformLimits$
|
|
10007
|
-
current = _platformLimits$
|
|
9884
|
+
const _platformLimits$taxCa = platformLimits.taxCategories.total,
|
|
9885
|
+
limit = _platformLimits$taxCa.limit,
|
|
9886
|
+
current = _platformLimits$taxCa.current;
|
|
10008
9887
|
const hasReachedTaxCategoriesWarningLimit = getHasExceededWarningThreshold({
|
|
10009
9888
|
limit,
|
|
10010
9889
|
current
|
|
@@ -10020,13 +9899,12 @@ const useTaxCategoriesPlatformLimits = () => {
|
|
|
10020
9899
|
};
|
|
10021
9900
|
|
|
10022
9901
|
const PlatformLimitsTaxCategoriesNotifications = () => {
|
|
10023
|
-
var _platformLimits$taxCa;
|
|
10024
9902
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
10025
9903
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
10026
9904
|
const _useTaxCategoriesPlat2 = useTaxCategoriesPlatformLimits(),
|
|
10027
9905
|
hasReachedTaxCategoriesWarningLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesWarningLimit,
|
|
10028
9906
|
hasReachedTaxCategoriesErrorLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesErrorLimit;
|
|
10029
|
-
if (!
|
|
9907
|
+
if (!platformLimits?.taxCategories?.total) {
|
|
10030
9908
|
return null;
|
|
10031
9909
|
}
|
|
10032
9910
|
if (hasReachedTaxCategoriesErrorLimit) {
|
|
@@ -10072,13 +9950,12 @@ var messages$i = reactIntl.defineMessages({
|
|
|
10072
9950
|
});
|
|
10073
9951
|
|
|
10074
9952
|
const PlatformLimitsTaxCategoriesStatus = _ref => {
|
|
10075
|
-
var _platformLimits$taxCa, _platformLimits$taxCa2;
|
|
10076
9953
|
let total = _ref.total;
|
|
10077
9954
|
const intl = reactIntl.useIntl();
|
|
10078
9955
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
10079
9956
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
10080
|
-
const current = platformLimits
|
|
10081
|
-
const limit = platformLimits
|
|
9957
|
+
const current = platformLimits?.taxCategories?.total?.current;
|
|
9958
|
+
const limit = platformLimits?.taxCategories?.total?.limit;
|
|
10082
9959
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
10083
9960
|
intlMessage: messages$i.taxCategoriesStatus,
|
|
10084
9961
|
children: getPlatformLimitsStatus({
|
|
@@ -10140,18 +10017,17 @@ const useZonesPlatformLimitsFetcher = () => {
|
|
|
10140
10017
|
};
|
|
10141
10018
|
|
|
10142
10019
|
const useZonesPlatformLimits = () => {
|
|
10143
|
-
var _platformLimits$zones;
|
|
10144
10020
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10145
10021
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10146
|
-
if (!
|
|
10022
|
+
if (!platformLimits?.zones?.total) {
|
|
10147
10023
|
return {
|
|
10148
10024
|
hasReachedZonesWarningLimit: false,
|
|
10149
10025
|
hasReachedZonesErrorLimit: false
|
|
10150
10026
|
};
|
|
10151
10027
|
}
|
|
10152
|
-
const _platformLimits$
|
|
10153
|
-
limit = _platformLimits$
|
|
10154
|
-
current = _platformLimits$
|
|
10028
|
+
const _platformLimits$zones = platformLimits.zones.total,
|
|
10029
|
+
limit = _platformLimits$zones.limit,
|
|
10030
|
+
current = _platformLimits$zones.current;
|
|
10155
10031
|
const hasReachedZonesWarningLimit = getHasExceededWarningThreshold({
|
|
10156
10032
|
limit,
|
|
10157
10033
|
current
|
|
@@ -10167,13 +10043,12 @@ const useZonesPlatformLimits = () => {
|
|
|
10167
10043
|
};
|
|
10168
10044
|
|
|
10169
10045
|
const PlatformLimitsZonesNotifications = () => {
|
|
10170
|
-
var _platformLimits$zones;
|
|
10171
10046
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10172
10047
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10173
10048
|
const _useZonesPlatformLimi2 = useZonesPlatformLimits(),
|
|
10174
10049
|
hasReachedZonesWarningLimit = _useZonesPlatformLimi2.hasReachedZonesWarningLimit,
|
|
10175
10050
|
hasReachedZonesErrorLimit = _useZonesPlatformLimi2.hasReachedZonesErrorLimit;
|
|
10176
|
-
if (!
|
|
10051
|
+
if (!platformLimits?.zones?.total) {
|
|
10177
10052
|
return null;
|
|
10178
10053
|
}
|
|
10179
10054
|
if (hasReachedZonesErrorLimit) {
|
|
@@ -10219,13 +10094,12 @@ var messages$g = reactIntl.defineMessages({
|
|
|
10219
10094
|
});
|
|
10220
10095
|
|
|
10221
10096
|
const PlatformLimitsZonesStatus = _ref => {
|
|
10222
|
-
var _platformLimits$zones, _platformLimits$zones2;
|
|
10223
10097
|
let total = _ref.total;
|
|
10224
10098
|
const intl = reactIntl.useIntl();
|
|
10225
10099
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10226
10100
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10227
|
-
const current = platformLimits
|
|
10228
|
-
const limit = platformLimits
|
|
10101
|
+
const current = platformLimits?.zones?.total?.current;
|
|
10102
|
+
const limit = platformLimits?.zones?.total?.limit;
|
|
10229
10103
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
10230
10104
|
intlMessage: messages$g.zonesStatus,
|
|
10231
10105
|
children: getPlatformLimitsStatus({
|
|
@@ -10287,18 +10161,17 @@ const useCustomersPlatformLimitsFetcher = () => {
|
|
|
10287
10161
|
};
|
|
10288
10162
|
|
|
10289
10163
|
const useCustomersPlatformLimits$1 = () => {
|
|
10290
|
-
var _platformLimits$custo;
|
|
10291
10164
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10292
10165
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10293
|
-
if (!
|
|
10166
|
+
if (!platformLimits?.customers?.total) {
|
|
10294
10167
|
return {
|
|
10295
10168
|
hasReachedCustomersWarningLimit: false,
|
|
10296
10169
|
hasReachedCustomersErrorLimit: false
|
|
10297
10170
|
};
|
|
10298
10171
|
}
|
|
10299
|
-
const _platformLimits$
|
|
10300
|
-
limit = _platformLimits$
|
|
10301
|
-
current = _platformLimits$
|
|
10172
|
+
const _platformLimits$custo = platformLimits.customers.total,
|
|
10173
|
+
limit = _platformLimits$custo.limit,
|
|
10174
|
+
current = _platformLimits$custo.current;
|
|
10302
10175
|
const hasReachedCustomersWarningLimit = getHasExceededWarningThreshold({
|
|
10303
10176
|
limit,
|
|
10304
10177
|
current
|
|
@@ -10327,13 +10200,12 @@ const useCustomersPlatormLimitsModalState = () => {
|
|
|
10327
10200
|
};
|
|
10328
10201
|
|
|
10329
10202
|
const PlatformLimitsCustomersNotifications = () => {
|
|
10330
|
-
var _platformLimits$custo;
|
|
10331
10203
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10332
10204
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10333
10205
|
const _useCustomersPlatform2 = useCustomersPlatformLimits$1(),
|
|
10334
10206
|
hasReachedCustomersWarningLimit = _useCustomersPlatform2.hasReachedCustomersWarningLimit,
|
|
10335
10207
|
hasReachedCustomersErrorLimit = _useCustomersPlatform2.hasReachedCustomersErrorLimit;
|
|
10336
|
-
if (!
|
|
10208
|
+
if (!platformLimits?.customers?.total) {
|
|
10337
10209
|
return jsxRuntime.jsx("div", {});
|
|
10338
10210
|
}
|
|
10339
10211
|
if (hasReachedCustomersErrorLimit) {
|
|
@@ -10384,16 +10256,15 @@ var styles$b = {
|
|
|
10384
10256
|
"status": "platform-limits-customers-status-module__status___3rXYM"
|
|
10385
10257
|
};
|
|
10386
10258
|
const PlatformLimitsCustomersStatus = () => {
|
|
10387
|
-
var _platformLimits$custo;
|
|
10388
10259
|
const intl = reactIntl.useIntl();
|
|
10389
10260
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10390
10261
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10391
|
-
if (!
|
|
10262
|
+
if (!platformLimits?.customers?.total) {
|
|
10392
10263
|
return null;
|
|
10393
10264
|
}
|
|
10394
|
-
const _platformLimits$
|
|
10395
|
-
current = _platformLimits$
|
|
10396
|
-
limit = _platformLimits$
|
|
10265
|
+
const _platformLimits$custo = platformLimits.customers.total,
|
|
10266
|
+
current = _platformLimits$custo.current,
|
|
10267
|
+
limit = _platformLimits$custo.limit;
|
|
10397
10268
|
return jsxRuntime.jsx("div", {
|
|
10398
10269
|
className: styles$b.status,
|
|
10399
10270
|
children: jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
@@ -10627,18 +10498,17 @@ const useCustomerGroupsPlatformLimitsFetcher = () => {
|
|
|
10627
10498
|
};
|
|
10628
10499
|
|
|
10629
10500
|
const useCustomerGroupsPlatformLimitsStatus = () => {
|
|
10630
|
-
var _platformLimits$custo;
|
|
10631
10501
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10632
10502
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10633
|
-
if (!
|
|
10503
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
10634
10504
|
return {
|
|
10635
10505
|
hasReachedCustomerGroupsWarningLimit: false,
|
|
10636
10506
|
hasReachedCustomerGroupsErrorLimit: false
|
|
10637
10507
|
};
|
|
10638
10508
|
}
|
|
10639
|
-
const _platformLimits$
|
|
10640
|
-
limit = _platformLimits$
|
|
10641
|
-
current = _platformLimits$
|
|
10509
|
+
const _platformLimits$custo = platformLimits.customerGroups.total,
|
|
10510
|
+
limit = _platformLimits$custo.limit,
|
|
10511
|
+
current = _platformLimits$custo.current;
|
|
10642
10512
|
const hasReachedCustomerGroupsWarningLimit = getHasExceededWarningThreshold({
|
|
10643
10513
|
limit,
|
|
10644
10514
|
current
|
|
@@ -10667,13 +10537,12 @@ const useCustomerGroupsPlatormLimitsModalState = () => {
|
|
|
10667
10537
|
};
|
|
10668
10538
|
|
|
10669
10539
|
const PlatformLimitsCustomerGroupsNotifications = () => {
|
|
10670
|
-
var _platformLimits$custo;
|
|
10671
10540
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10672
10541
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10673
10542
|
const _useCustomerGroupsPla2 = useCustomerGroupsPlatformLimitsStatus(),
|
|
10674
10543
|
hasReachedCustomerGroupsWarningLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsWarningLimit,
|
|
10675
10544
|
hasReachedCustomerGroupsErrorLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsErrorLimit;
|
|
10676
|
-
if (!
|
|
10545
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
10677
10546
|
return jsxRuntime.jsx("div", {});
|
|
10678
10547
|
}
|
|
10679
10548
|
if (hasReachedCustomerGroupsErrorLimit) {
|
|
@@ -10724,16 +10593,15 @@ var styles$9 = {
|
|
|
10724
10593
|
"status": "platform-limits-customer-groups-status-module__status___6099G"
|
|
10725
10594
|
};
|
|
10726
10595
|
const PlatformLimitsCustomerGroupsStatus = () => {
|
|
10727
|
-
var _platformLimits$custo;
|
|
10728
10596
|
const intl = reactIntl.useIntl();
|
|
10729
10597
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10730
10598
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10731
|
-
if (!
|
|
10599
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
10732
10600
|
return null;
|
|
10733
10601
|
}
|
|
10734
|
-
const _platformLimits$
|
|
10735
|
-
current = _platformLimits$
|
|
10736
|
-
limit = _platformLimits$
|
|
10602
|
+
const _platformLimits$custo = platformLimits.customerGroups.total,
|
|
10603
|
+
current = _platformLimits$custo.current,
|
|
10604
|
+
limit = _platformLimits$custo.limit;
|
|
10737
10605
|
return jsxRuntime.jsx("div", {
|
|
10738
10606
|
className: styles$9.status,
|
|
10739
10607
|
children: jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
@@ -10965,7 +10833,7 @@ var fetchPimIndexStatus = ((apolloClient, projectKey) => async dispatch => {
|
|
|
10965
10833
|
try {
|
|
10966
10834
|
await dispatch(sdk.actions.head({
|
|
10967
10835
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.PIM_SEARCH,
|
|
10968
|
-
uri:
|
|
10836
|
+
uri: `/${projectKey}/search/products`
|
|
10969
10837
|
}));
|
|
10970
10838
|
return {
|
|
10971
10839
|
status: 'indexed'
|
|
@@ -11056,8 +10924,8 @@ const getIndexingJobIds = _ref => {
|
|
|
11056
10924
|
products = _ref$data.products,
|
|
11057
10925
|
productTypes = _ref$data.productTypes;
|
|
11058
10926
|
return {
|
|
11059
|
-
productsJobId:
|
|
11060
|
-
productTypesJobId:
|
|
10927
|
+
productsJobId: products?.indexingJobId || products?.existingIndexingJobId,
|
|
10928
|
+
productTypesJobId: productTypes?.indexingJobId || productTypes?.existingIndexingJobId
|
|
11061
10929
|
};
|
|
11062
10930
|
};
|
|
11063
10931
|
let PimIndexerProvider = /*#__PURE__*/function (_PureComponent) {
|
|
@@ -11321,7 +11189,6 @@ const valueMapping = {
|
|
|
11321
11189
|
all: [true, false]
|
|
11322
11190
|
};
|
|
11323
11191
|
const BooleanField = props => {
|
|
11324
|
-
var _context;
|
|
11325
11192
|
let selectedValue;
|
|
11326
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]);
|
|
11327
11194
|
const yesLabel = props.intl.formatMessage(messages$8.yes);
|
|
@@ -11335,7 +11202,7 @@ const BooleanField = props => {
|
|
|
11335
11202
|
}];
|
|
11336
11203
|
if (props.isMulti) options.push({
|
|
11337
11204
|
value: 'all',
|
|
11338
|
-
label:
|
|
11205
|
+
label: `${yesLabel} / ${noLabel}`
|
|
11339
11206
|
});
|
|
11340
11207
|
return jsxRuntime.jsx(uiKit.SelectInput, {
|
|
11341
11208
|
name: props.name,
|
|
@@ -11499,19 +11366,19 @@ const ScrollToFieldError = () => {
|
|
|
11499
11366
|
if (isValid) return;
|
|
11500
11367
|
const firstErrorElement = document.querySelector('[aria-invalid="true"]');
|
|
11501
11368
|
if (firstErrorElement) {
|
|
11502
|
-
var _ref, _ref2, _document$querySelect, _elementToScrollTo$sc;
|
|
11503
11369
|
// Get a reference to the label.
|
|
11504
11370
|
const firstElementId = firstErrorElement.getAttribute('id');
|
|
11505
|
-
const localizedInputIndex = _indexOfInstanceProperty__default["default"](firstElementId).call(firstElementId,
|
|
11371
|
+
const localizedInputIndex = _indexOfInstanceProperty__default["default"](firstElementId).call(firstElementId, `.${dataLocale}`);
|
|
11506
11372
|
|
|
11507
11373
|
// check if locale is appended then remove it from id
|
|
11508
|
-
const id = localizedInputIndex > -1 ? firstElementId.replace(
|
|
11374
|
+
const id = localizedInputIndex > -1 ? firstElementId.replace(`.${dataLocale}`, '') : firstElementId;
|
|
11509
11375
|
|
|
11510
11376
|
// Scroll to the label (if found), otherwise to the input element itself.
|
|
11511
11377
|
|
|
11512
|
-
const elementToScrollTo =
|
|
11513
|
-
|
|
11514
|
-
(
|
|
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?.({
|
|
11515
11382
|
behavior: 'smooth'
|
|
11516
11383
|
});
|
|
11517
11384
|
}
|
|
@@ -11537,8 +11404,7 @@ var styles$4 = {
|
|
|
11537
11404
|
"search-mode-menu": "selectable-field-search-input-module__search-mode-menu___Od6Le"
|
|
11538
11405
|
};
|
|
11539
11406
|
const SelectableFieldSearchInput = props => {
|
|
11540
|
-
|
|
11541
|
-
const _useState = React.useState((_props$initialValue = props.initialValue) !== null && _props$initialValue !== void 0 ? _props$initialValue : ''),
|
|
11407
|
+
const _useState = React.useState(props.initialValue ?? ''),
|
|
11542
11408
|
_useState2 = _slicedToArray(_useState, 2),
|
|
11543
11409
|
searchText = _useState2[0],
|
|
11544
11410
|
setSearchText = _useState2[1];
|
|
@@ -11574,7 +11440,7 @@ const SelectableFieldSearchInput = props => {
|
|
|
11574
11440
|
});
|
|
11575
11441
|
},
|
|
11576
11442
|
onReset: props.onReset,
|
|
11577
|
-
placeholder:
|
|
11443
|
+
placeholder: props.placeholder ?? intl.formatMessage(messages$5.placeholder),
|
|
11578
11444
|
isDisabled: props.disabled
|
|
11579
11445
|
})
|
|
11580
11446
|
});
|
|
@@ -11635,7 +11501,6 @@ StoreSelectField.defaultProps = {
|
|
|
11635
11501
|
mappedValueField: 'id'
|
|
11636
11502
|
};
|
|
11637
11503
|
|
|
11638
|
-
var _templateObject;
|
|
11639
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; }
|
|
11640
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; }
|
|
11641
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); }; }
|
|
@@ -11714,7 +11579,10 @@ const VALIDATOR_INTEGER = {
|
|
|
11714
11579
|
* has emitted a warning once in the logs, not for every instance
|
|
11715
11580
|
*/
|
|
11716
11581
|
let hasWarned = false;
|
|
11717
|
-
const warningMessage = commonTags.oneLineTrim
|
|
11582
|
+
const warningMessage = commonTags.oneLineTrim`
|
|
11583
|
+
\`validatedInput\` is no longer supported.
|
|
11584
|
+
Please use \`formik\` instead.
|
|
11585
|
+
`;
|
|
11718
11586
|
const ToolTipWrapperComponent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
11719
11587
|
let children = _ref.children;
|
|
11720
11588
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
@@ -11863,7 +11731,7 @@ function validatedInput(InnerComponent, validators) {
|
|
|
11863
11731
|
}]);
|
|
11864
11732
|
return ValidatedInput;
|
|
11865
11733
|
}(React.PureComponent);
|
|
11866
|
-
ValidatedInput.displayName =
|
|
11734
|
+
ValidatedInput.displayName = `ValidatedInput(${_InnerComponent.displayName})`;
|
|
11867
11735
|
ValidatedInput.defaultProps = {
|
|
11868
11736
|
isValid: true,
|
|
11869
11737
|
getInputRef: () => {}
|
|
@@ -12005,7 +11873,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
12005
11873
|
truncate: true,
|
|
12006
11874
|
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$2.filterWholeInput), {}, {
|
|
12007
11875
|
values: {
|
|
12008
|
-
values: "
|
|
11876
|
+
values: `"${props.value}"`
|
|
12009
11877
|
}
|
|
12010
11878
|
})
|
|
12011
11879
|
})
|
|
@@ -12018,7 +11886,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
12018
11886
|
truncate: true,
|
|
12019
11887
|
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$2.filterSeparateValues), {}, {
|
|
12020
11888
|
values: {
|
|
12021
|
-
values: "
|
|
11889
|
+
values: `"${props.multiValue.join('", "')}"` || props.value
|
|
12022
11890
|
}
|
|
12023
11891
|
})
|
|
12024
11892
|
})
|
|
@@ -12310,17 +12178,16 @@ function isEmpty(value) {
|
|
|
12310
12178
|
}
|
|
12311
12179
|
|
|
12312
12180
|
const buildSearchQuery = (searchQuery, searchMode, fragments) => {
|
|
12313
|
-
var _fragments$searchMode;
|
|
12314
12181
|
if (!searchQuery) return '';
|
|
12315
12182
|
const buildAllFieldsQueryString = query => {
|
|
12316
12183
|
const fragmentsArray = _Object$values__default["default"](fragments);
|
|
12317
|
-
return
|
|
12184
|
+
return `( ${_mapInstanceProperty__default["default"](fragmentsArray).call(fragmentsArray, fragment => fragment.getQuery(query)).join(' or ')} )`;
|
|
12318
12185
|
};
|
|
12319
12186
|
const trimmedSearchQuery = oneLine__default["default"](searchQuery);
|
|
12320
12187
|
if (searchMode === 'allFields') {
|
|
12321
12188
|
return buildAllFieldsQueryString(trimmedSearchQuery);
|
|
12322
12189
|
}
|
|
12323
|
-
if (!fragments[searchMode] || typeof
|
|
12190
|
+
if (!fragments[searchMode] || typeof fragments[searchMode]?.getQuery !== 'function') {
|
|
12324
12191
|
return '';
|
|
12325
12192
|
}
|
|
12326
12193
|
return fragments[searchMode].getQuery(trimmedSearchQuery);
|
|
@@ -12551,11 +12418,11 @@ function createResourceReducer(options) {
|
|
|
12551
12418
|
|
|
12552
12419
|
// TODO: validate constant keys
|
|
12553
12420
|
const actionsMap = {
|
|
12554
|
-
[
|
|
12421
|
+
[`${plural}_FETCHED`]: (_, action) => ({
|
|
12555
12422
|
currentQueryResult: action.payload
|
|
12556
12423
|
}),
|
|
12557
|
-
[
|
|
12558
|
-
[
|
|
12424
|
+
[`${single}_UPDATED_IN_LIST`]: updateStatusInList(mergeData),
|
|
12425
|
+
[`${single}_DELETED_IN_LIST`]: (state, _ref) => {
|
|
12559
12426
|
let payload = _ref.payload;
|
|
12560
12427
|
const results = state.currentQueryResult.results;
|
|
12561
12428
|
return {
|
|
@@ -12567,27 +12434,27 @@ function createResourceReducer(options) {
|
|
|
12567
12434
|
})
|
|
12568
12435
|
};
|
|
12569
12436
|
},
|
|
12570
|
-
[
|
|
12437
|
+
[`${single}_FETCHED`]: (_, _ref3) => {
|
|
12571
12438
|
let payload = _ref3.payload;
|
|
12572
12439
|
return {
|
|
12573
12440
|
currentVisible: payload
|
|
12574
12441
|
};
|
|
12575
12442
|
},
|
|
12576
|
-
[
|
|
12443
|
+
[`${single}_CREATED`]: (_ref4, _ref5) => {
|
|
12577
12444
|
let currentVisible = _ref4.currentVisible;
|
|
12578
12445
|
let payload = _ref5.payload;
|
|
12579
12446
|
return {
|
|
12580
12447
|
currentVisible: mergeData(payload, currentVisible)
|
|
12581
12448
|
};
|
|
12582
12449
|
},
|
|
12583
|
-
[
|
|
12450
|
+
[`${single}_UPDATED`]: (_ref6, _ref7) => {
|
|
12584
12451
|
let currentVisible = _ref6.currentVisible;
|
|
12585
12452
|
let payload = _ref7.payload;
|
|
12586
12453
|
return {
|
|
12587
12454
|
currentVisible: mergeData(payload, currentVisible)
|
|
12588
12455
|
};
|
|
12589
12456
|
},
|
|
12590
|
-
[
|
|
12457
|
+
[`${single}_DELETED`]: () => ({
|
|
12591
12458
|
currentVisible: null
|
|
12592
12459
|
})
|
|
12593
12460
|
};
|
|
@@ -12604,12 +12471,11 @@ function formatCustomerAddress(_ref) {
|
|
|
12604
12471
|
}
|
|
12605
12472
|
|
|
12606
12473
|
function formatCustomerName(_ref) {
|
|
12607
|
-
var _context;
|
|
12608
12474
|
let firstName = _ref.firstName,
|
|
12609
12475
|
lastName = _ref.lastName;
|
|
12610
12476
|
if (firstName && !lastName) return _trimInstanceProperty__default["default"](firstName).call(firstName);
|
|
12611
12477
|
if (!firstName && lastName) return _trimInstanceProperty__default["default"](lastName).call(lastName);
|
|
12612
|
-
if (firstName && lastName) return
|
|
12478
|
+
if (firstName && lastName) return `${_trimInstanceProperty__default["default"](firstName).call(firstName)} ${_trimInstanceProperty__default["default"](lastName).call(lastName)}`;
|
|
12613
12479
|
return constants.NO_VALUE_FALLBACK;
|
|
12614
12480
|
}
|
|
12615
12481
|
|
|
@@ -12659,10 +12525,7 @@ const validateText = (text, intl) => {
|
|
|
12659
12525
|
* @returns {boolean}
|
|
12660
12526
|
*/
|
|
12661
12527
|
const hasErrorCode = (unmappedApiErrors, errorCode) => {
|
|
12662
|
-
return _Array$isArray__default["default"](unmappedApiErrors) && _someInstanceProperty__default["default"](unmappedApiErrors).call(unmappedApiErrors, error =>
|
|
12663
|
-
var _error$extensions;
|
|
12664
|
-
return ((_error$extensions = error.extensions) === null || _error$extensions === void 0 ? void 0 : _error$extensions.code) === errorCode;
|
|
12665
|
-
});
|
|
12528
|
+
return _Array$isArray__default["default"](unmappedApiErrors) && _someInstanceProperty__default["default"](unmappedApiErrors).call(unmappedApiErrors, error => error.extensions?.code === errorCode);
|
|
12666
12529
|
};
|
|
12667
12530
|
|
|
12668
12531
|
const hasInvalidInputError = errors => hasErrorCode(errors, ERROR_CODES.invalidInput);
|
|
@@ -12674,7 +12537,7 @@ function minusify(value) {
|
|
|
12674
12537
|
return minus.concat(value);
|
|
12675
12538
|
}
|
|
12676
12539
|
|
|
12677
|
-
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), []));
|
|
12678
12541
|
const argsToArray = args => _reduceInstanceProperty__default["default"](args).call(args, (result, item) => _concatInstanceProperty__default["default"](result).call(result, item), []);
|
|
12679
12542
|
const exists = (field, attributeType) => ({
|
|
12680
12543
|
exists: {
|
|
@@ -12731,7 +12594,7 @@ const not = function () {
|
|
|
12731
12594
|
|
|
12732
12595
|
const safelyAddFallback = function (string) {
|
|
12733
12596
|
let fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : constants.NO_VALUE_FALLBACK;
|
|
12734
|
-
return string === '' ? fallback : string
|
|
12597
|
+
return string === '' ? fallback : string ?? fallback;
|
|
12735
12598
|
};
|
|
12736
12599
|
|
|
12737
12600
|
var messages$1 = reactIntl.defineMessages({
|
|
@@ -12866,19 +12729,19 @@ const computedProperties = {
|
|
|
12866
12729
|
// has been deleted. See MC-1925 for further information.
|
|
12867
12730
|
const filteredCategories = _filterInstanceProperty__default["default"](_context6 = product.categories).call(_context6, category => category.obj !== undefined);
|
|
12868
12731
|
return _mapInstanceProperty__default["default"](filteredCategories).call(filteredCategories, category => {
|
|
12869
|
-
var _context7;
|
|
12870
12732
|
const categoryPath = getPathName(category, language, languages);
|
|
12871
12733
|
const ancestors = getAncestors(category, language);
|
|
12872
|
-
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
|
|
12873
12736
|
// translated. This has been communicated with Jenn
|
|
12874
|
-
|
|
12737
|
+
`| ext. ID: ${category.obj.externalId}` : '';
|
|
12875
12738
|
return {
|
|
12876
12739
|
id: category.id,
|
|
12877
|
-
name:
|
|
12740
|
+
name: `${l10n.formatLocalizedString(category.obj, {
|
|
12878
12741
|
key: 'name',
|
|
12879
12742
|
locale: language,
|
|
12880
12743
|
fallbackOrder: languages
|
|
12881
|
-
})
|
|
12744
|
+
})} ${externalIdValue}`,
|
|
12882
12745
|
path: categoryPath,
|
|
12883
12746
|
level: ancestors.length
|
|
12884
12747
|
};
|
|
@@ -12915,13 +12778,13 @@ const getAttributeValueByType = _ref12 => {
|
|
|
12915
12778
|
value: value
|
|
12916
12779
|
});
|
|
12917
12780
|
case 'enum':
|
|
12918
|
-
return safelyAddFallback(value.label,
|
|
12781
|
+
return safelyAddFallback(value.label, `${value.key} (key)`);
|
|
12919
12782
|
case 'lenum':
|
|
12920
12783
|
return safelyAddFallback(l10n.formatLocalizedString(value, {
|
|
12921
12784
|
key: 'label',
|
|
12922
12785
|
locale: projectDataLocale,
|
|
12923
12786
|
fallbackOrder: projectLanguages
|
|
12924
|
-
}),
|
|
12787
|
+
}), `${value.key} (key)`);
|
|
12925
12788
|
case 'number':
|
|
12926
12789
|
return safelyAddFallback(value);
|
|
12927
12790
|
case 'boolean':
|
|
@@ -13044,7 +12907,6 @@ const reorderArrayItems = (array, from, to) => {
|
|
|
13044
12907
|
const mapTimeZonesToOptions = memoize__default["default"](timeZones => {
|
|
13045
12908
|
var _context;
|
|
13046
12909
|
return _mapInstanceProperty__default["default"](_context = _Object$entries__default["default"](timeZones)).call(_context, _ref => {
|
|
13047
|
-
var _context2;
|
|
13048
12910
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
13049
12911
|
code = _ref2[0],
|
|
13050
12912
|
value = _ref2[1];
|
|
@@ -13053,7 +12915,7 @@ const mapTimeZonesToOptions = memoize__default["default"](timeZones => {
|
|
|
13053
12915
|
//E.g. `(GMT +02:00) Central European Time - Berlin`
|
|
13054
12916
|
// unicode clock hex code: \u25F7
|
|
13055
12917
|
//
|
|
13056
|
-
label:
|
|
12918
|
+
label: `(GMT ${value.offset}) ${value.name}`
|
|
13057
12919
|
};
|
|
13058
12920
|
});
|
|
13059
12921
|
});
|
|
@@ -13061,12 +12923,9 @@ const getTimeZoneId = memoize__default["default"]((selectedTimeZone, timeZones)
|
|
|
13061
12923
|
if (timeZones[selectedTimeZone]) {
|
|
13062
12924
|
return selectedTimeZone;
|
|
13063
12925
|
} else {
|
|
13064
|
-
var
|
|
13065
|
-
const fallbackTimeZoneId = _findInstanceProperty__default["default"](
|
|
13066
|
-
|
|
13067
|
-
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);
|
|
13068
|
-
});
|
|
13069
|
-
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) {
|
|
13070
12929
|
return fallbackTimeZoneId.toString();
|
|
13071
12930
|
} else {
|
|
13072
12931
|
return 'UTC';
|
|
@@ -13074,10 +12933,9 @@ const getTimeZoneId = memoize__default["default"]((selectedTimeZone, timeZones)
|
|
|
13074
12933
|
}
|
|
13075
12934
|
});
|
|
13076
12935
|
const getTimeZoneLabel = memoize__default["default"]((selectedTimeZone, timeZones) => {
|
|
13077
|
-
var _context4;
|
|
13078
12936
|
const timeZoneId = getTimeZoneId(selectedTimeZone, timeZones);
|
|
13079
12937
|
const timeZoneData = timeZones[timeZoneId];
|
|
13080
|
-
return
|
|
12938
|
+
return `(GMT ${timeZoneData.offset}) ${timeZoneData.name}`;
|
|
13081
12939
|
});
|
|
13082
12940
|
|
|
13083
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; }
|
|
@@ -13138,8 +12996,7 @@ const typeDefinitionsExist = typeDefinitions => {
|
|
|
13138
12996
|
return typeDefinitions.length > 0;
|
|
13139
12997
|
};
|
|
13140
12998
|
const typeDefinitionSelected = formValues => {
|
|
13141
|
-
|
|
13142
|
-
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;
|
|
13143
13000
|
};
|
|
13144
13001
|
const typeDefinitionContainsFieldDefinitions = formValues => {
|
|
13145
13002
|
return formValues[FIELD_NAME].type.obj.key && formValues[FIELD_NAME].type.obj.fieldDefinitions.length > 0;
|
|
@@ -13174,7 +13031,7 @@ const CustomFieldsInputWrapper = _ref2 => {
|
|
|
13174
13031
|
max: "scale",
|
|
13175
13032
|
children: jsxRuntime.jsx(CustomFields, {
|
|
13176
13033
|
isReadOnly: isReadOnly,
|
|
13177
|
-
name:
|
|
13034
|
+
name: `${FIELD_NAME}.fields`,
|
|
13178
13035
|
fieldDefinitions: isReadOnly && hideEmptyFields ? fieldDefinitionsWithValues(formValues) : formValues[FIELD_NAME].type.obj.fieldDefinitions
|
|
13179
13036
|
})
|
|
13180
13037
|
});
|
|
@@ -13209,7 +13066,6 @@ const createFormStateFromTypeDefinition = selectedTypeDefinition => {
|
|
|
13209
13066
|
};
|
|
13210
13067
|
};
|
|
13211
13068
|
const CustomTypeSubform = _ref => {
|
|
13212
|
-
var _formValues$FIELD_NAM3, _formValues$FIELD_NAM4;
|
|
13213
13069
|
let typeDefinitions = _ref.typeDefinitions,
|
|
13214
13070
|
isReadOnly = _ref.isReadOnly,
|
|
13215
13071
|
isCondensed = _ref.isCondensed,
|
|
@@ -13241,8 +13097,7 @@ const CustomTypeSubform = _ref => {
|
|
|
13241
13097
|
}
|
|
13242
13098
|
}, [typeDefinitions, setFieldValue, validateForm]);
|
|
13243
13099
|
const typeDefinitionSelected = formValues => {
|
|
13244
|
-
|
|
13245
|
-
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;
|
|
13246
13101
|
};
|
|
13247
13102
|
|
|
13248
13103
|
// if the user has read-only permissions, empty fields are hidden, and no type definition is selected, hide the component
|
|
@@ -13257,9 +13112,9 @@ const CustomTypeSubform = _ref => {
|
|
|
13257
13112
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
13258
13113
|
isClearable: true,
|
|
13259
13114
|
"data-testid": "custom-type-select",
|
|
13260
|
-
name:
|
|
13261
|
-
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages,
|
|
13262
|
-
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,
|
|
13263
13118
|
onChange: handleTypeDefinitionSelect,
|
|
13264
13119
|
placeholder: formatMessage(messages.typesPlaceholder),
|
|
13265
13120
|
isReadOnly: isReadOnly
|
|
@@ -13278,8 +13133,7 @@ CustomTypeSubform.displayName = 'CustomTypeSubform';
|
|
|
13278
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; }
|
|
13279
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; }
|
|
13280
13135
|
const transformFieldType = fieldDefinition => {
|
|
13281
|
-
|
|
13282
|
-
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') {
|
|
13283
13137
|
var _context;
|
|
13284
13138
|
return _objectSpread(_objectSpread({}, fieldDefinition.type), {}, {
|
|
13285
13139
|
elementType: _objectSpread(_objectSpread({}, fieldDefinition.type.elementType), {}, {
|
|
@@ -13289,7 +13143,7 @@ const transformFieldType = fieldDefinition => {
|
|
|
13289
13143
|
}))
|
|
13290
13144
|
})
|
|
13291
13145
|
});
|
|
13292
|
-
} else if (
|
|
13146
|
+
} else if (fieldDefinition.type?.name === 'LocalizedEnum') {
|
|
13293
13147
|
var _context2;
|
|
13294
13148
|
return _objectSpread(_objectSpread({}, fieldDefinition.type), {}, {
|
|
13295
13149
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context2, value => ({
|