@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
|
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);
|
|
@@ -187,12 +184,14 @@ var merge__default = /*#__PURE__*/_interopDefault(merge);
|
|
|
187
184
|
var set__default = /*#__PURE__*/_interopDefault(set);
|
|
188
185
|
var memoize__default = /*#__PURE__*/_interopDefault(memoize);
|
|
189
186
|
var flatMap__default = /*#__PURE__*/_interopDefault(flatMap);
|
|
187
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
190
188
|
var _Math$trunc__default = /*#__PURE__*/_interopDefault(_Math$trunc);
|
|
191
189
|
var _Number$isNaN__default = /*#__PURE__*/_interopDefault(_Number$isNaN);
|
|
192
190
|
var isUndefined__default = /*#__PURE__*/_interopDefault(isUndefined);
|
|
193
191
|
var isFinite__default = /*#__PURE__*/_interopDefault(isFinite);
|
|
194
192
|
var Cleave__default = /*#__PURE__*/_interopDefault(Cleave);
|
|
195
193
|
var _Object$assign__default = /*#__PURE__*/_interopDefault(_Object$assign);
|
|
194
|
+
var _findIndexInstanceProperty__default = /*#__PURE__*/_interopDefault(_findIndexInstanceProperty);
|
|
196
195
|
var compact__default = /*#__PURE__*/_interopDefault(compact);
|
|
197
196
|
var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
198
197
|
var _spliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_spliceInstanceProperty);
|
|
@@ -290,7 +289,7 @@ function filterDataAttributes(obj) {
|
|
|
290
289
|
* duplicated in original values
|
|
291
290
|
*/
|
|
292
291
|
function unique(values, properties) {
|
|
293
|
-
var
|
|
292
|
+
var _context;
|
|
294
293
|
let ignoredValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['', null, undefined];
|
|
295
294
|
const duplicateValues = [];
|
|
296
295
|
let realValues;
|
|
@@ -299,20 +298,19 @@ function unique(values, properties) {
|
|
|
299
298
|
realValues = _filterInstanceProperty__default["default"](values).call(values, value => !_includesInstanceProperty__default["default"](ignoredValues).call(ignoredValues, value));
|
|
300
299
|
if (!realValues.length) return [];
|
|
301
300
|
if (properties) realValues = _mapInstanceProperty__default["default"](realValues).call(realValues, value => _reduceInstanceProperty__default["default"](properties).call(properties, (prev, curr) => {
|
|
302
|
-
var _context;
|
|
303
301
|
const currentValue = value[curr] || '';
|
|
304
|
-
return
|
|
302
|
+
return `${prev}:${currentValue}`;
|
|
305
303
|
}, ''));else realValues = _sliceInstanceProperty__default["default"](values).call(values, 0);
|
|
306
304
|
|
|
307
305
|
// TODO: checking for dupes like this is slow, find a better way
|
|
308
|
-
_reduceInstanceProperty__default["default"](
|
|
306
|
+
_reduceInstanceProperty__default["default"](_context = _sortInstanceProperty__default["default"](realValues).call(realValues)).call(_context, (prev, curr) => {
|
|
309
307
|
if (curr === null) return curr;
|
|
310
308
|
if (curr !== '' && prev === curr && _indexOfInstanceProperty__default["default"](duplicateValues).call(duplicateValues, curr) === -1) duplicateValues.push(curr);
|
|
311
309
|
return curr;
|
|
312
310
|
});
|
|
313
311
|
if (properties) return _mapInstanceProperty__default["default"](duplicateValues).call(duplicateValues, value => {
|
|
314
|
-
var
|
|
315
|
-
const parts = _sliceInstanceProperty__default["default"](
|
|
312
|
+
var _context2;
|
|
313
|
+
const parts = _sliceInstanceProperty__default["default"](_context2 = value.split(':')).call(_context2, 1);
|
|
316
314
|
return _reduceInstanceProperty__default["default"](properties).call(properties, (prev, curr, index) => {
|
|
317
315
|
// eslint-disable-next-line no-param-reassign
|
|
318
316
|
prev[curr] = parts[index];
|
|
@@ -331,14 +329,14 @@ function unique(values, properties) {
|
|
|
331
329
|
* @return Array<Object> returns an array of objects with all duplicated values
|
|
332
330
|
*/
|
|
333
331
|
function uniqueObjects(items) {
|
|
334
|
-
var
|
|
332
|
+
var _context3;
|
|
335
333
|
const emptyValues = [undefined, null, ''];
|
|
336
|
-
const itemsWorkingSet = items && items.length ? _filterInstanceProperty__default["default"](
|
|
334
|
+
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)) : [];
|
|
337
335
|
const duplicateValues = _reduceInstanceProperty__default["default"](itemsWorkingSet).call(itemsWorkingSet, (acc, item, index) => {
|
|
338
|
-
var
|
|
336
|
+
var _context4;
|
|
339
337
|
if (item === null) return acc;
|
|
340
|
-
const isDuplicate = _reduceInstanceProperty__default["default"](
|
|
341
|
-
).call(
|
|
338
|
+
const isDuplicate = _reduceInstanceProperty__default["default"](_context4 = _sliceInstanceProperty__default["default"](itemsWorkingSet).call(itemsWorkingSet, index + 1) // get sub-array after this index
|
|
339
|
+
).call(_context4, (duplicateAcc, comparisonItem, comparisonIndex) => {
|
|
342
340
|
if (comparisonItem === null) return duplicateAcc;
|
|
343
341
|
|
|
344
342
|
// check if its a dupe
|
|
@@ -429,16 +427,18 @@ function getIndexesOfInvalidValues(values) {
|
|
|
429
427
|
|
|
430
428
|
const withoutEmptyErrorsByField = errorsByField => omitEmpty__default["default"](errorsByField);
|
|
431
429
|
|
|
432
|
-
var _templateObject$4;
|
|
433
430
|
function formatDateRangeValue(value, type) {
|
|
434
431
|
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
435
432
|
locale: 'en',
|
|
436
433
|
timeZone: moment__default["default"].tz.guess()
|
|
437
434
|
};
|
|
438
435
|
if (value.from === value.to) return formatDateTime$1(type, value.from, options);
|
|
439
|
-
if (value.from && value.to) return oneLine__default["default"]
|
|
440
|
-
|
|
441
|
-
|
|
436
|
+
if (value.from && value.to) return oneLine__default["default"]`
|
|
437
|
+
${formatDateTime$1(type, value.from, options)} -
|
|
438
|
+
${formatDateTime$1(type, value.to, options)}
|
|
439
|
+
`;
|
|
440
|
+
if (value.from) return `from ${formatDateTime$1(type, value.from, options)}`;
|
|
441
|
+
if (value.to) return `to ${formatDateTime$1(type, value.to, options)}`;
|
|
442
442
|
return '';
|
|
443
443
|
}
|
|
444
444
|
function formatDateTime$1(type, value) {
|
|
@@ -1674,13 +1674,13 @@ const getData = (code, field) => {
|
|
|
1674
1674
|
const getFractionDigit = code => getData(code, 'fractionDigit');
|
|
1675
1675
|
|
|
1676
1676
|
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; }
|
|
1677
|
-
function _objectSpread$1p(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
1677
|
+
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; }
|
|
1678
1678
|
function formatMoneyRangeValue(value, intl) {
|
|
1679
|
-
var _context;
|
|
1680
1679
|
if (value.from === value.to) return formatMoneyValue(value.from, value.currency, intl);
|
|
1681
|
-
if (value.from && value.to) return
|
|
1682
|
-
|
|
1683
|
-
if (value.
|
|
1680
|
+
if (value.from && value.to) return `${formatMoneyValue(value.from, value.currency, intl)} -
|
|
1681
|
+
${formatMoneyValue(value.to, value.currency, intl)}`;
|
|
1682
|
+
if (value.from) return `from ${formatMoneyValue(value.from, value.currency, intl)}`;
|
|
1683
|
+
if (value.to) return `to ${formatMoneyValue(value.to, value.currency, intl)}`;
|
|
1684
1684
|
return '';
|
|
1685
1685
|
}
|
|
1686
1686
|
function formatMoneyValue(amount, currency, intl) {
|
|
@@ -1700,8 +1700,7 @@ function getFractionedAmount(moneyValue) {
|
|
|
1700
1700
|
return amount / 10 ** fractionDigits;
|
|
1701
1701
|
}
|
|
1702
1702
|
function formatMoney$2(moneyValue, intl, options) {
|
|
1703
|
-
|
|
1704
|
-
return intl.formatNumber((_moneyValue$fractione = moneyValue.fractionedAmount) !== null && _moneyValue$fractione !== void 0 ? _moneyValue$fractione : getFractionedAmount(moneyValue), _objectSpread$1p({
|
|
1703
|
+
return intl.formatNumber(moneyValue.fractionedAmount ?? getFractionedAmount(moneyValue), _objectSpread$1p({
|
|
1705
1704
|
style: 'currency',
|
|
1706
1705
|
currency: moneyValue.currencyCode,
|
|
1707
1706
|
minimumFractionDigits: moneyValue.fractionDigits
|
|
@@ -1722,13 +1721,11 @@ var messages$J = reactIntl.defineMessages({
|
|
|
1722
1721
|
});
|
|
1723
1722
|
|
|
1724
1723
|
const formatEnum = _ref => {
|
|
1725
|
-
var _context;
|
|
1726
1724
|
let value = _ref.value,
|
|
1727
1725
|
fallbackValue = _ref.fallbackValue;
|
|
1728
|
-
return value.label ||
|
|
1726
|
+
return value.label || `${fallbackValue} (${value.key})`;
|
|
1729
1727
|
};
|
|
1730
1728
|
const formatLenum = _ref2 => {
|
|
1731
|
-
var _context2;
|
|
1732
1729
|
let value = _ref2.value,
|
|
1733
1730
|
language = _ref2.language,
|
|
1734
1731
|
languages = _ref2.languages,
|
|
@@ -1736,7 +1733,7 @@ const formatLenum = _ref2 => {
|
|
|
1736
1733
|
return l10n.formatLocalizedString(value, {
|
|
1737
1734
|
key: 'label',
|
|
1738
1735
|
locale: language,
|
|
1739
|
-
fallback:
|
|
1736
|
+
fallback: `${fallbackValue} (${value.key})`,
|
|
1740
1737
|
fallbackOrder: languages
|
|
1741
1738
|
});
|
|
1742
1739
|
};
|
|
@@ -1772,7 +1769,6 @@ const formatDate = _ref6 => {
|
|
|
1772
1769
|
});
|
|
1773
1770
|
};
|
|
1774
1771
|
const formatDateTime = _ref7 => {
|
|
1775
|
-
var _context3;
|
|
1776
1772
|
let value = _ref7.value,
|
|
1777
1773
|
userTimeZone = _ref7.userTimeZone,
|
|
1778
1774
|
intl = _ref7.intl;
|
|
@@ -1788,7 +1784,7 @@ const formatDateTime = _ref7 => {
|
|
|
1788
1784
|
// defaults to utc if timeZone is not provided
|
|
1789
1785
|
timeZone: userTimeZone || 'utc'
|
|
1790
1786
|
});
|
|
1791
|
-
return
|
|
1787
|
+
return `${date} (${time})`;
|
|
1792
1788
|
};
|
|
1793
1789
|
const formatBoolean = _ref8 => {
|
|
1794
1790
|
let value = _ref8.value,
|
|
@@ -1811,7 +1807,7 @@ const formatUnknown = _ref10 => {
|
|
|
1811
1807
|
fallbackValue = _ref10.fallbackValue;
|
|
1812
1808
|
// NOTE This is reporting within the render function, which is supposed to
|
|
1813
1809
|
// be pure. This is quite bad as this is a side-effect in the render fn.
|
|
1814
|
-
sentry.reportErrorToSentry(new Error(
|
|
1810
|
+
sentry.reportErrorToSentry(new Error(`Unhandled custom attribute type '${type.name}' for value`), {
|
|
1815
1811
|
extra: {
|
|
1816
1812
|
value
|
|
1817
1813
|
}
|
|
@@ -1884,10 +1880,9 @@ const attributeTypeNames = {
|
|
|
1884
1880
|
Number: 'number'
|
|
1885
1881
|
};
|
|
1886
1882
|
const convertToAttributeType = customFieldType => {
|
|
1887
|
-
var _customFieldType$elem;
|
|
1888
1883
|
if (isNil__default["default"](customFieldType)) return customFieldType;
|
|
1889
1884
|
const attributeTypeName = attributeTypeNames[customFieldType.name];
|
|
1890
|
-
const elementTypeName = attributeTypeNames[
|
|
1885
|
+
const elementTypeName = attributeTypeNames[customFieldType.elementType?.name];
|
|
1891
1886
|
return {
|
|
1892
1887
|
name: attributeTypeName,
|
|
1893
1888
|
elementType: {
|
|
@@ -1950,25 +1945,21 @@ const setDisplayName = nextDisplayName => Component => {
|
|
|
1950
1945
|
return Component;
|
|
1951
1946
|
};
|
|
1952
1947
|
|
|
1953
|
-
const wrapDisplayName = (BaseComponent, hocName) => {
|
|
1954
|
-
var _context;
|
|
1955
|
-
return _concatInstanceProperty__default["default"](_context = "".concat(hocName, "(")).call(_context, getDisplayName(BaseComponent), ")");
|
|
1956
|
-
};
|
|
1948
|
+
const wrapDisplayName = (BaseComponent, hocName) => `${hocName}(${getDisplayName(BaseComponent)})`;
|
|
1957
1949
|
|
|
1958
1950
|
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; }
|
|
1959
1951
|
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; }
|
|
1960
1952
|
const injectDataTablePaginationState = initialValues => Component => {
|
|
1961
1953
|
const WithDataTablePaginationState = props => {
|
|
1962
|
-
var _initialValues$tableS, _initialValues$tableS2;
|
|
1963
1954
|
const _usePaginationState = uiKit.usePaginationState({
|
|
1964
|
-
page: initialValues
|
|
1965
|
-
perPage: initialValues
|
|
1955
|
+
page: initialValues?.page,
|
|
1956
|
+
perPage: initialValues?.perPage
|
|
1966
1957
|
}),
|
|
1967
1958
|
page = _usePaginationState.page,
|
|
1968
1959
|
perPage = _usePaginationState.perPage;
|
|
1969
1960
|
const tableSorting = uiKit.useDataTableSortingState({
|
|
1970
|
-
key: initialValues
|
|
1971
|
-
order: initialValues
|
|
1961
|
+
key: initialValues?.tableSorting?.key,
|
|
1962
|
+
order: initialValues?.tableSorting?.order
|
|
1972
1963
|
});
|
|
1973
1964
|
return jsxRuntime.jsx(Component, _objectSpread$1o(_objectSpread$1o({}, props), {}, {
|
|
1974
1965
|
dataTablePaginationState: {
|
|
@@ -2002,7 +1993,7 @@ const injectNotifications = function () {
|
|
|
2002
1993
|
[propName]: notifications
|
|
2003
1994
|
}));
|
|
2004
1995
|
};
|
|
2005
|
-
WrappedComponent.displayName =
|
|
1996
|
+
WrappedComponent.displayName = `withNotifications(${getDisplayName(Component)}`;
|
|
2006
1997
|
return WrappedComponent;
|
|
2007
1998
|
};
|
|
2008
1999
|
};
|
|
@@ -2111,10 +2102,7 @@ const isNil = value => typeof value === 'undefined' || value === null;
|
|
|
2111
2102
|
const useStorage = (storageKey, initialStorageValue, options) => {
|
|
2112
2103
|
var _context;
|
|
2113
2104
|
const mergedOptions = _objectSpread$1i(_objectSpread$1i({}, defaultOptions$2), options);
|
|
2114
|
-
const userId = applicationShellConnectors.useApplicationContext(context =>
|
|
2115
|
-
var _context$user;
|
|
2116
|
-
return (_context$user = context.user) === null || _context$user === void 0 ? void 0 : _context$user.id;
|
|
2117
|
-
});
|
|
2105
|
+
const userId = applicationShellConnectors.useApplicationContext(context => context.user?.id);
|
|
2118
2106
|
const scopedStorageKey = _filterInstanceProperty__default["default"](_context = [mergedOptions.segregateByUser && userId, storageKey]).call(_context, Boolean).join('/');
|
|
2119
2107
|
const readFromStorage = React.useCallback(() => {
|
|
2120
2108
|
const rawStorageValue = getStorage(mergedOptions.storageType).getItem(scopedStorageKey);
|
|
@@ -2133,9 +2121,8 @@ const useStorage = (storageKey, initialStorageValue, options) => {
|
|
|
2133
2121
|
return parsedStorageValue;
|
|
2134
2122
|
}, [mergedOptions.storageType, scopedStorageKey]);
|
|
2135
2123
|
const initializeStorageValue = () => {
|
|
2136
|
-
var _ref, _readFromStorage;
|
|
2137
2124
|
// default the storage value to the initial provided value when provided
|
|
2138
|
-
return
|
|
2125
|
+
return readFromStorage() ?? initialStorageValue ?? null;
|
|
2139
2126
|
};
|
|
2140
2127
|
const _useState = React.useState(initializeStorageValue),
|
|
2141
2128
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -2234,16 +2221,14 @@ function ownKeys$1g(e, r) { var t = _Object$keys__default["default"](e); if (_Ob
|
|
|
2234
2221
|
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; }
|
|
2235
2222
|
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 } } } };
|
|
2236
2223
|
const filterStoresOutdatedDanglingProductSelections = storesQueryResult => {
|
|
2237
|
-
var _storesQueryResult$re;
|
|
2238
2224
|
if (!storesQueryResult) return null;
|
|
2239
2225
|
return {
|
|
2240
2226
|
total: storesQueryResult.total,
|
|
2241
2227
|
count: storesQueryResult.count,
|
|
2242
2228
|
offset: storesQueryResult.offset,
|
|
2243
|
-
results:
|
|
2244
|
-
var _store$productSelecti;
|
|
2229
|
+
results: storesQueryResult.results?.map(store => {
|
|
2245
2230
|
return _objectSpread$1g(_objectSpread$1g({}, store), {}, {
|
|
2246
|
-
productSelections:
|
|
2231
|
+
productSelections: store.productSelections?.filter(productSelectionRef => Boolean(productSelectionRef.productSelection))
|
|
2247
2232
|
});
|
|
2248
2233
|
})
|
|
2249
2234
|
};
|
|
@@ -2255,7 +2240,7 @@ const createQueryVariables$6 = ownProps => {
|
|
|
2255
2240
|
offset: ownProps.offset,
|
|
2256
2241
|
sort: _sortInstanceProperty__default["default"](ownProps)
|
|
2257
2242
|
}, Boolean(ownProps.stores) && {
|
|
2258
|
-
where:
|
|
2243
|
+
where: `key in (${_mapInstanceProperty__default["default"](_context = ownProps.stores).call(_context, store => `"${store}"`).join(', ')})`
|
|
2259
2244
|
}), {}, {
|
|
2260
2245
|
excludeExtendedStoresList: ownProps.excludeExtendedStoresList,
|
|
2261
2246
|
excludeProductSelections: ownProps.excludeProductSelections
|
|
@@ -2280,10 +2265,7 @@ const useStoresListFetcher = props => {
|
|
|
2280
2265
|
projectKey: props.projectKey
|
|
2281
2266
|
},
|
|
2282
2267
|
fetchPolicy: 'network-only',
|
|
2283
|
-
onError: graphqlErrorResponse =>
|
|
2284
|
-
var _props$onError;
|
|
2285
|
-
return (_props$onError = props.onError) === null || _props$onError === void 0 ? void 0 : _props$onError.call(props, graphqlErrorResponse);
|
|
2286
|
-
}
|
|
2268
|
+
onError: graphqlErrorResponse => props.onError?.(graphqlErrorResponse)
|
|
2287
2269
|
}),
|
|
2288
2270
|
data = _useQuery.data,
|
|
2289
2271
|
refetch = _useQuery.refetch,
|
|
@@ -2291,7 +2273,7 @@ const useStoresListFetcher = props => {
|
|
|
2291
2273
|
return {
|
|
2292
2274
|
isLoading: loading,
|
|
2293
2275
|
refetch,
|
|
2294
|
-
stores: filterStoresOutdatedDanglingProductSelections(data
|
|
2276
|
+
stores: filterStoresOutdatedDanglingProductSelections(data?.stores),
|
|
2295
2277
|
refetchQuery: {
|
|
2296
2278
|
query: FetchStoresQuery,
|
|
2297
2279
|
variables: queryVariables,
|
|
@@ -2355,16 +2337,10 @@ const handlers$5 = {
|
|
|
2355
2337
|
}
|
|
2356
2338
|
};
|
|
2357
2339
|
|
|
2358
|
-
const toPermission = (permission, resourceName) => {
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
}
|
|
2362
|
-
const createComposePath = resourceName => permission => {
|
|
2363
|
-
var _context2;
|
|
2364
|
-
return (// e.g applicationContext.dataFences?.store?.orders?.canViewOrders?.values
|
|
2365
|
-
_concatInstanceProperty__default["default"](_context2 = "dataFences.store.".concat(resourceName, ".")).call(_context2, permission, ".values")
|
|
2366
|
-
);
|
|
2367
|
-
};
|
|
2340
|
+
const toPermission = (permission, resourceName) => camelCase__default["default"](`can ${permission} ${resourceName}`);
|
|
2341
|
+
const createComposePath = resourceName => permission =>
|
|
2342
|
+
// e.g applicationContext.dataFences?.store?.orders?.canViewOrders?.values
|
|
2343
|
+
`dataFences.store.${resourceName}.${permission}.values`;
|
|
2368
2344
|
const useStoreKeysInDataFences = _ref => {
|
|
2369
2345
|
let resourceName = _ref.resourceName,
|
|
2370
2346
|
_ref$permission = _ref.permission,
|
|
@@ -2762,7 +2738,7 @@ const usePersistedTableConfiguration = props => {
|
|
|
2762
2738
|
* Therefore, if it will be missing from the local storage and hence we use the [] as default.
|
|
2763
2739
|
*/
|
|
2764
2740
|
const getVisibleColumns = React.useCallback(() => {
|
|
2765
|
-
if (cachedVisibleTableConfiguration
|
|
2741
|
+
if (cachedVisibleTableConfiguration?.columnsConfig) {
|
|
2766
2742
|
return retrieveColumnsWithCachedConfiguration({
|
|
2767
2743
|
allAvailableColumnsConfiguration,
|
|
2768
2744
|
cachedVisibleTableConfiguration: cachedVisibleTableConfiguration.columnsConfig,
|
|
@@ -2776,8 +2752,8 @@ const usePersistedTableConfiguration = props => {
|
|
|
2776
2752
|
return {
|
|
2777
2753
|
visibleColumns,
|
|
2778
2754
|
visibleColumnKeys,
|
|
2779
|
-
cachedVisibleColumnsConfiguration: cachedVisibleTableConfiguration
|
|
2780
|
-
cachedDisplaySettings: cachedVisibleTableConfiguration
|
|
2755
|
+
cachedVisibleColumnsConfiguration: cachedVisibleTableConfiguration?.columnsConfig,
|
|
2756
|
+
cachedDisplaySettings: cachedVisibleTableConfiguration?.displaySettings,
|
|
2781
2757
|
handleCachedTableConfigurationUpdate: update => handleCacheUpdate({
|
|
2782
2758
|
update,
|
|
2783
2759
|
cachedVisibleTableConfiguration,
|
|
@@ -2788,7 +2764,6 @@ const usePersistedTableConfiguration = props => {
|
|
|
2788
2764
|
|
|
2789
2765
|
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 } } } };
|
|
2790
2766
|
const useProductSelectionsTotalFetcher = props => {
|
|
2791
|
-
var _data$productSelectio;
|
|
2792
2767
|
const _useQuery = hooks.useQuery(FetchProductSelectionsTotal, {
|
|
2793
2768
|
context: {
|
|
2794
2769
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -2798,7 +2773,7 @@ const useProductSelectionsTotalFetcher = props => {
|
|
|
2798
2773
|
data = _useQuery.data;
|
|
2799
2774
|
return {
|
|
2800
2775
|
isLoading: loading,
|
|
2801
|
-
total: data
|
|
2776
|
+
total: data?.productSelections?.total
|
|
2802
2777
|
};
|
|
2803
2778
|
};
|
|
2804
2779
|
|
|
@@ -2819,7 +2794,7 @@ function _objectSpread$1c(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
|
2819
2794
|
// eslint-disable-next-line import/prefer-default-export
|
|
2820
2795
|
const convertProductSelectionsFromGraphQl = productSelections => {
|
|
2821
2796
|
var _context;
|
|
2822
|
-
return
|
|
2797
|
+
return productSelections?.results && _objectSpread$1c(_objectSpread$1c({}, productSelections), {}, {
|
|
2823
2798
|
results: _mapInstanceProperty__default["default"](_context = productSelections.results).call(_context, productSelection => _objectSpread$1c({}, l10n.applyTransformedLocalizedFields(productSelection, [{
|
|
2824
2799
|
from: 'nameAllLocales',
|
|
2825
2800
|
to: 'name'
|
|
@@ -2853,7 +2828,7 @@ const useProductSelectionsFetcher = props => {
|
|
|
2853
2828
|
refetch = _useQuery.refetch;
|
|
2854
2829
|
return {
|
|
2855
2830
|
isLoading: loading,
|
|
2856
|
-
productSelections: convertProductSelectionsFromGraphQl(data
|
|
2831
|
+
productSelections: convertProductSelectionsFromGraphQl(data?.productSelections) || emptyProductSelections,
|
|
2857
2832
|
refetch
|
|
2858
2833
|
};
|
|
2859
2834
|
};
|
|
@@ -2878,7 +2853,6 @@ function validateSingleFilter(_ref) {
|
|
|
2878
2853
|
return _includesInstanceProperty__default["default"](invalidValues).call(invalidValues, value);
|
|
2879
2854
|
}
|
|
2880
2855
|
|
|
2881
|
-
var _templateObject$3, _templateObject2$2;
|
|
2882
2856
|
const dateFormatDayStart$1 = 'YYYY-MM-DDT00:00:00.000';
|
|
2883
2857
|
const dateFormatDayEnd$1 = 'YYYY-MM-DDT23:59:59.999';
|
|
2884
2858
|
const getDateTimeInUTC = (date, timezone, format) => {
|
|
@@ -2888,8 +2862,7 @@ const getDateTimeInUTC = (date, timezone, format) => {
|
|
|
2888
2862
|
const noTimeSpecified = momentDate.hours() === 0 && momentDate.minutes() === 0 && momentDate.seconds() === 0;
|
|
2889
2863
|
// if it's a date then convert it to UTC datetime based on timezone
|
|
2890
2864
|
if (noTimeSpecified) {
|
|
2891
|
-
|
|
2892
|
-
const offset = ((_moment$tz = moment__default$1["default"](date).tz(timezone)) === null || _moment$tz === void 0 ? void 0 : _moment$tz.utcOffset()) || 0;
|
|
2865
|
+
const offset = moment__default$1["default"](date).tz(timezone)?.utcOffset() || 0;
|
|
2893
2866
|
const formattedDate = momentDate.format(format);
|
|
2894
2867
|
const formattedDateWithOffset = moment__default$1["default"](formattedDate).add(offset, 'minutes').format(dateFormat);
|
|
2895
2868
|
// console.log(formattedDateWithOffset);
|
|
@@ -2902,7 +2875,6 @@ const getDateTimeInUTC = (date, timezone, format) => {
|
|
|
2902
2875
|
function dateTransformer$1(filterKey, filters) {
|
|
2903
2876
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator$1;
|
|
2904
2877
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
2905
|
-
var _context, _context2;
|
|
2906
2878
|
let type = _ref.type,
|
|
2907
2879
|
value = _ref.value,
|
|
2908
2880
|
timezone = _ref.timezone;
|
|
@@ -2912,13 +2884,19 @@ function dateTransformer$1(filterKey, filters) {
|
|
|
2912
2884
|
})) return '';
|
|
2913
2885
|
switch (type) {
|
|
2914
2886
|
case FILTER_TYPES.lessThan:
|
|
2915
|
-
return
|
|
2887
|
+
return `${filterKey} < "${getDateTimeInUTC(value, timezone, dateFormatDayStart$1)}"`;
|
|
2916
2888
|
case FILTER_TYPES.moreThan:
|
|
2917
|
-
return
|
|
2889
|
+
return `${filterKey} > "${getDateTimeInUTC(value, timezone, dateFormatDayEnd$1)}"`;
|
|
2918
2890
|
case FILTER_TYPES.equalTo:
|
|
2919
|
-
return oneLine__default["default"]
|
|
2891
|
+
return oneLine__default["default"]`
|
|
2892
|
+
(${filterKey} >= "${getDateTimeInUTC(value, timezone, dateFormatDayStart$1)}"
|
|
2893
|
+
and ${filterKey} <= "${getDateTimeInUTC(value, timezone, dateFormatDayEnd$1)}")
|
|
2894
|
+
`;
|
|
2920
2895
|
case FILTER_TYPES.range:
|
|
2921
|
-
return oneLine__default["default"]
|
|
2896
|
+
return oneLine__default["default"]`
|
|
2897
|
+
(${filterKey} >= "${getDateTimeInUTC(value.from, timezone, dateFormatDayStart$1)}"
|
|
2898
|
+
and ${filterKey} <= "${getDateTimeInUTC(value.to, timezone, dateFormatDayEnd$1)}")
|
|
2899
|
+
`;
|
|
2922
2900
|
default:
|
|
2923
2901
|
return '';
|
|
2924
2902
|
}
|
|
@@ -2934,7 +2912,7 @@ function dateTransformer$1(filterKey, filters) {
|
|
|
2934
2912
|
* (createdAt >= "2018-02-15T00:00:00.000+01:00" and createdAt <= "2018-02-15T23:59:59.999+01:00")
|
|
2935
2913
|
* ) or some_more_filters
|
|
2936
2914
|
*/
|
|
2937
|
-
return queryString === '' ? null :
|
|
2915
|
+
return queryString === '' ? null : `(${queryString})`;
|
|
2938
2916
|
}
|
|
2939
2917
|
function defaultFilterValidator$1(_ref2) {
|
|
2940
2918
|
let type = _ref2.type,
|
|
@@ -2950,10 +2928,7 @@ function defaultFilterValidator$1(_ref2) {
|
|
|
2950
2928
|
|
|
2951
2929
|
var localizedTextTransformer = (localizedString => {
|
|
2952
2930
|
var _context;
|
|
2953
|
-
return _mapInstanceProperty__default["default"](_context = _Object$keys__default["default"](localizedString)).call(_context, locale => {
|
|
2954
|
-
var _context2;
|
|
2955
|
-
return _concatInstanceProperty__default["default"](_context2 = "".concat(locale, " = \"")).call(_context2, localizedString[locale], "\"");
|
|
2956
|
-
}).join(' and ');
|
|
2931
|
+
return _mapInstanceProperty__default["default"](_context = _Object$keys__default["default"](localizedString)).call(_context, locale => `${locale} = "${localizedString[locale]}"`).join(' and ');
|
|
2957
2932
|
});
|
|
2958
2933
|
|
|
2959
2934
|
var styles$i = {
|
|
@@ -3002,7 +2977,6 @@ var GetChannelsQuery = { kind: "Document", definitions: [{ kind: "OperationDefin
|
|
|
3002
2977
|
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 } } } };
|
|
3003
2978
|
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 } } } };
|
|
3004
2979
|
const ChannelPickerInput = _ref => {
|
|
3005
|
-
var _currentOption$data$l, _currentOption$data;
|
|
3006
2980
|
let isClearable = _ref.isClearable,
|
|
3007
2981
|
isDisabled = _ref.isDisabled,
|
|
3008
2982
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -3019,9 +2993,9 @@ const ChannelPickerInput = _ref => {
|
|
|
3019
2993
|
formatMessage = _useIntl.formatMessage;
|
|
3020
2994
|
const dataLocale = applicationShellConnectors.useApplicationContext(applicationContext => applicationContext.dataLocale);
|
|
3021
2995
|
const variables = React.useMemo(() => _objectSpread$1b({
|
|
3022
|
-
sortByNamePath:
|
|
2996
|
+
sortByNamePath: `name.${dataLocale}`
|
|
3023
2997
|
}, role && {
|
|
3024
|
-
extraWhere:
|
|
2998
|
+
extraWhere: `roles contains any ("${role}")`
|
|
3025
2999
|
}), [dataLocale, role]);
|
|
3026
3000
|
const _useState = React.useState(),
|
|
3027
3001
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -3039,7 +3013,7 @@ const ChannelPickerInput = _ref => {
|
|
|
3039
3013
|
}
|
|
3040
3014
|
return channel;
|
|
3041
3015
|
}, [formatLocalizedFieldToString]);
|
|
3042
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
3016
|
+
const prefixSearchFields = React.useMemo(() => [`name.${dataLocale}`, 'key'], [dataLocale]);
|
|
3043
3017
|
const loadOptions = useLoadOptions({
|
|
3044
3018
|
query: GetChannelsQuery,
|
|
3045
3019
|
variables,
|
|
@@ -3074,13 +3048,13 @@ const ChannelPickerInput = _ref => {
|
|
|
3074
3048
|
setLoadingError(null);
|
|
3075
3049
|
handleInternalInputChange(event);
|
|
3076
3050
|
}, [handleInternalInputChange]);
|
|
3077
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
3051
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
3078
3052
|
React.useEffect(() => {
|
|
3079
3053
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
3080
3054
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
3081
3055
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
3082
3056
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$G.noChannelsFound), [loadingError, formatMessage]);
|
|
3083
|
-
const tooltipTitle =
|
|
3057
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
3084
3058
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
3085
3059
|
max: "scale",
|
|
3086
3060
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -3090,7 +3064,7 @@ const ChannelPickerInput = _ref => {
|
|
|
3090
3064
|
children: jsxRuntime.jsx(uiKit.AsyncSelectInput, {
|
|
3091
3065
|
id: name,
|
|
3092
3066
|
name: name,
|
|
3093
|
-
placeholder: placeholder
|
|
3067
|
+
placeholder: placeholder ?? formatMessage(messages$G.placeholder),
|
|
3094
3068
|
loadOptions: loadOptionsDebounced,
|
|
3095
3069
|
defaultOptions: true,
|
|
3096
3070
|
showOptionGroupDivider: true,
|
|
@@ -3130,10 +3104,9 @@ let FormattedDateTime = /*#__PURE__*/function (_PureComponent) {
|
|
|
3130
3104
|
value: function render() {
|
|
3131
3105
|
return jsxRuntime.jsx(applicationShellConnectors.ApplicationContext, {
|
|
3132
3106
|
render: _ref => {
|
|
3133
|
-
var _this$props;
|
|
3134
3107
|
let user = _ref.user;
|
|
3135
3108
|
return formatDateTime$1(this.props.type, this.props.value, {
|
|
3136
|
-
timeZone:
|
|
3109
|
+
timeZone: this?.props?.timeZone || user?.timeZone,
|
|
3137
3110
|
locale: this.props.intl.locale
|
|
3138
3111
|
});
|
|
3139
3112
|
}
|
|
@@ -3264,7 +3237,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
3264
3237
|
};
|
|
3265
3238
|
_this.doDelayedUpdate = (updateFunction, event, eventType) => {
|
|
3266
3239
|
const self = _assertThisInitialized(_this);
|
|
3267
|
-
const timeoutKey =
|
|
3240
|
+
const timeoutKey = `${eventType}Timeout`;
|
|
3268
3241
|
// TODO: can't we just use one variable?
|
|
3269
3242
|
clearTimeout(_this[timeoutKey]);
|
|
3270
3243
|
_this[timeoutKey] = _setTimeout__default["default"](() => {
|
|
@@ -3294,7 +3267,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
3294
3267
|
}, this.props.onEnter ? {
|
|
3295
3268
|
onKeyDown: this.handleEnter
|
|
3296
3269
|
} : {}), filterDataAttributes(this.props));
|
|
3297
|
-
const inputId =
|
|
3270
|
+
const inputId = `throttled-field-${this.props.name}`;
|
|
3298
3271
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3299
3272
|
children: [jsxRuntime.jsx(uiKit.AccessibleHidden, {
|
|
3300
3273
|
children: jsxRuntime.jsx("label", {
|
|
@@ -3303,7 +3276,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
3303
3276
|
})
|
|
3304
3277
|
}), this.props.as === 'textarea' ? jsxRuntime.jsx(Textarea__default["default"], _objectSpread$19(_objectSpread$19({}, commonProps), {}, {
|
|
3305
3278
|
id: inputId,
|
|
3306
|
-
className: classnames__default["default"](styles$h.textarea, styles$h[
|
|
3279
|
+
className: classnames__default["default"](styles$h.textarea, styles$h[`textarea-${this.props.style}`], {
|
|
3307
3280
|
[styles$h.invalid]: !this.props.isValid,
|
|
3308
3281
|
[styles$h.disabled]: this.props.disabled
|
|
3309
3282
|
}),
|
|
@@ -3314,7 +3287,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
3314
3287
|
id: inputId,
|
|
3315
3288
|
ref: this.props.inputRef,
|
|
3316
3289
|
type: this.props.as,
|
|
3317
|
-
className: classnames__default["default"](styles$h[
|
|
3290
|
+
className: classnames__default["default"](styles$h[`input-${this.props.style}`], {
|
|
3318
3291
|
[styles$h.invalid]: !this.props.isValid,
|
|
3319
3292
|
[styles$h.disabled]: this.props.disabled,
|
|
3320
3293
|
[styles$h.granular]: this.props.isGranular
|
|
@@ -3414,8 +3387,7 @@ let SearchInput = /*#__PURE__*/function (_Component) {
|
|
|
3414
3387
|
});
|
|
3415
3388
|
};
|
|
3416
3389
|
_this.handleClear = () => {
|
|
3417
|
-
|
|
3418
|
-
(_this$inputRef = _this.inputRef) === null || _this$inputRef === void 0 || _this$inputRef.focus();
|
|
3390
|
+
_this.inputRef?.focus();
|
|
3419
3391
|
_this.props.onChange(null);
|
|
3420
3392
|
_this.props.onReset();
|
|
3421
3393
|
_this.setState({
|
|
@@ -3527,12 +3499,12 @@ const useExecuteGraphQLRequest = () => {
|
|
|
3527
3499
|
};
|
|
3528
3500
|
const createSearchProductsFromPIMAction = (searchTerm, projectKey) => sdk.actions.post({
|
|
3529
3501
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.PIM_SEARCH,
|
|
3530
|
-
uri:
|
|
3502
|
+
uri: `/${projectKey}/search/product-types`,
|
|
3531
3503
|
payload: {
|
|
3532
3504
|
query: {
|
|
3533
3505
|
wildcard: {
|
|
3534
3506
|
field: 'name',
|
|
3535
|
-
value:
|
|
3507
|
+
value: `*${searchTerm}*`,
|
|
3536
3508
|
caseInsensitive: true
|
|
3537
3509
|
}
|
|
3538
3510
|
},
|
|
@@ -3546,9 +3518,8 @@ const useFetchProductTypesFromPIM = _ref => {
|
|
|
3546
3518
|
const dispatch = sdk.useAsyncDispatch();
|
|
3547
3519
|
const executeGraphQLRequest = useExecuteGraphQLRequest();
|
|
3548
3520
|
const fetchProductTypesFromPim = React.useCallback(async searchTerm => {
|
|
3549
|
-
var _result$hits$map, _result$hits;
|
|
3550
3521
|
const result = await dispatch(createSearchProductsFromPIMAction(searchTerm, projectKey));
|
|
3551
|
-
const ids =
|
|
3522
|
+
const ids = result?.hits?.map(hit => hit.id) ?? [];
|
|
3552
3523
|
// Avoid sending any requests if it's clear that nothing is found
|
|
3553
3524
|
if (ids.length === 0) {
|
|
3554
3525
|
return {
|
|
@@ -3583,22 +3554,19 @@ const useFetchProductTypesFromPIM = _ref => {
|
|
|
3583
3554
|
*/
|
|
3584
3555
|
const constructNestedExpression = (reversedPath, predicate) => {
|
|
3585
3556
|
if (reversedPath.length > 0) {
|
|
3586
|
-
return _reduceInstanceProperty__default["default"](reversedPath).call(reversedPath, (nextNestedValue, nestedSelection) => {
|
|
3587
|
-
var _context;
|
|
3588
|
-
return _concatInstanceProperty__default["default"](_context = "".concat(nestedSelection, "(")).call(_context, nextNestedValue, ")");
|
|
3589
|
-
}, predicate);
|
|
3557
|
+
return _reduceInstanceProperty__default["default"](reversedPath).call(reversedPath, (nextNestedValue, nestedSelection) => `${nestedSelection}(${nextNestedValue})`, predicate);
|
|
3590
3558
|
}
|
|
3591
3559
|
return predicate;
|
|
3592
3560
|
};
|
|
3593
3561
|
const constructPrefixSearchPredicate$1 = (prefixSearchFields, lowerBound, upperBound) => {
|
|
3594
3562
|
const constructPrefixSearchExpression = field => {
|
|
3595
|
-
var
|
|
3563
|
+
var _context;
|
|
3596
3564
|
const parts = field.split('.');
|
|
3597
|
-
const _parts$slice$reverse = _reverseInstanceProperty__default["default"](
|
|
3565
|
+
const _parts$slice$reverse = _reverseInstanceProperty__default["default"](_context = _sliceInstanceProperty__default["default"](parts).call(parts)).call(_context),
|
|
3598
3566
|
_parts$slice$reverse2 = _toArray(_parts$slice$reverse),
|
|
3599
3567
|
valueToNest = _parts$slice$reverse2[0],
|
|
3600
3568
|
reversedPathToNestedValue = _sliceInstanceProperty__default["default"](_parts$slice$reverse2).call(_parts$slice$reverse2, 1);
|
|
3601
|
-
const predicateExpression =
|
|
3569
|
+
const predicateExpression = `${valueToNest} >= "${lowerBound}" and ${valueToNest} < "${upperBound}"`;
|
|
3602
3570
|
return constructNestedExpression(reversedPathToNestedValue, predicateExpression);
|
|
3603
3571
|
};
|
|
3604
3572
|
return _mapInstanceProperty__default["default"](prefixSearchFields).call(prefixSearchFields, constructPrefixSearchExpression).join(' or ');
|
|
@@ -3606,7 +3574,7 @@ const constructPrefixSearchPredicate$1 = (prefixSearchFields, lowerBound, upperB
|
|
|
3606
3574
|
const constructWherePredicate = (inputValue, prefixSearchFields) => {
|
|
3607
3575
|
const wherePredicate = function () {
|
|
3608
3576
|
if (inputValue.length) {
|
|
3609
|
-
if (isUUID(inputValue)) return
|
|
3577
|
+
if (isUUID(inputValue)) return `id = "${inputValue}"`;else {
|
|
3610
3578
|
const _getPrefixSearchBound = getPrefixSearchBounds(inputValue),
|
|
3611
3579
|
_getPrefixSearchBound2 = _slicedToArray(_getPrefixSearchBound, 2),
|
|
3612
3580
|
lowerBound = _getPrefixSearchBound2[0],
|
|
@@ -3631,7 +3599,6 @@ const useFetchProductTypessFromCTP = _ref2 => {
|
|
|
3631
3599
|
}, [prefixSearchFields, executeGraphQLRequest]);
|
|
3632
3600
|
};
|
|
3633
3601
|
const usePimStatus = () => {
|
|
3634
|
-
var _data$indicesExist;
|
|
3635
3602
|
const _useQuery = react.useQuery(FetchIndicesExist$1, {
|
|
3636
3603
|
context: {
|
|
3637
3604
|
target: constants.GRAPHQL_TARGETS.PIM_INDEXER
|
|
@@ -3641,20 +3608,17 @@ const usePimStatus = () => {
|
|
|
3641
3608
|
data = _useQuery.data;
|
|
3642
3609
|
return {
|
|
3643
3610
|
data,
|
|
3644
|
-
isProjectIndexed: Boolean(data
|
|
3611
|
+
isProjectIndexed: Boolean(data?.indicesExist?.productTypes?.searchableIndexExists)
|
|
3645
3612
|
};
|
|
3646
3613
|
};
|
|
3647
3614
|
const useProductTypeOptions = _ref3 => {
|
|
3648
3615
|
let prefixSearchFields = _ref3.prefixSearchFields;
|
|
3649
3616
|
const _usePimStatus = usePimStatus(),
|
|
3650
3617
|
isProjectIndexed = _usePimStatus.isProjectIndexed;
|
|
3651
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => {
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key
|
|
3656
|
-
};
|
|
3657
|
-
}),
|
|
3618
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
3619
|
+
dataLocale: context.dataLocale,
|
|
3620
|
+
projectKey: context.project?.key
|
|
3621
|
+
})),
|
|
3658
3622
|
dataLocale = _useApplicationContex.dataLocale,
|
|
3659
3623
|
projectKey = _useApplicationContex.projectKey;
|
|
3660
3624
|
const fetchProductTypesFromPim = useFetchProductTypesFromPIM({
|
|
@@ -3718,10 +3682,9 @@ const useHandlers = onChange => {
|
|
|
3718
3682
|
setInputValue(changedValue);
|
|
3719
3683
|
}, []);
|
|
3720
3684
|
const handleChange = useEventCallback(event => {
|
|
3721
|
-
var _event$target$value;
|
|
3722
3685
|
const eventWithExtractedValue = _objectSpread$17(_objectSpread$17({}, event), {}, {
|
|
3723
3686
|
target: _objectSpread$17(_objectSpread$17({}, event.target), {}, {
|
|
3724
|
-
value:
|
|
3687
|
+
value: event.target.value?.value
|
|
3725
3688
|
})
|
|
3726
3689
|
});
|
|
3727
3690
|
onChange(eventWithExtractedValue);
|
|
@@ -3731,24 +3694,21 @@ const useHandlers = onChange => {
|
|
|
3731
3694
|
|
|
3732
3695
|
const _excluded$1 = ["extraWhere"];
|
|
3733
3696
|
function ownKeys$16(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3734
|
-
function _objectSpread$16(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
3697
|
+
function _objectSpread$16(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$16(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$16(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
3735
3698
|
const constructPrefixSearchPredicate = function () {
|
|
3736
3699
|
let prefixSearchFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
3737
3700
|
let lowerBound = arguments.length > 1 ? arguments[1] : undefined;
|
|
3738
3701
|
let upperBound = arguments.length > 2 ? arguments[2] : undefined;
|
|
3739
3702
|
const constructPrefixSearchExpression = field => {
|
|
3740
|
-
var _context
|
|
3703
|
+
var _context;
|
|
3741
3704
|
const path = field.split('.');
|
|
3742
3705
|
const _path$slice$reverse = _reverseInstanceProperty__default["default"](_context = _sliceInstanceProperty__default["default"](path).call(path)).call(_context),
|
|
3743
3706
|
_path$slice$reverse2 = _toArray(_path$slice$reverse),
|
|
3744
3707
|
finalValueInPath = _path$slice$reverse2[0],
|
|
3745
3708
|
remainPathInReverse = _sliceInstanceProperty__default["default"](_path$slice$reverse2).call(_path$slice$reverse2, 1);
|
|
3746
|
-
const comparison =
|
|
3709
|
+
const comparison = `${finalValueInPath} >= "${lowerBound}" and ${finalValueInPath} < "${upperBound}"`;
|
|
3747
3710
|
if (remainPathInReverse.length) {
|
|
3748
|
-
return _reduceInstanceProperty__default["default"](remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) => {
|
|
3749
|
-
var _context5;
|
|
3750
|
-
return _concatInstanceProperty__default["default"](_context5 = "".concat(nextPath, "(")).call(_context5, nestedPath, ")");
|
|
3751
|
-
}, comparison);
|
|
3711
|
+
return _reduceInstanceProperty__default["default"](remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) => `${nextPath}(${nestedPath})`, comparison);
|
|
3752
3712
|
}
|
|
3753
3713
|
return comparison;
|
|
3754
3714
|
};
|
|
@@ -3764,7 +3724,7 @@ const useLoadOptions = _ref => {
|
|
|
3764
3724
|
let where;
|
|
3765
3725
|
if (inputValue.length) {
|
|
3766
3726
|
if (isUUID(inputValue)) {
|
|
3767
|
-
where =
|
|
3727
|
+
where = `id = "${inputValue}"`;
|
|
3768
3728
|
} else {
|
|
3769
3729
|
const _getPrefixSearchBound = getPrefixSearchBounds(inputValue),
|
|
3770
3730
|
_getPrefixSearchBound2 = _slicedToArray(_getPrefixSearchBound, 2),
|
|
@@ -3773,12 +3733,11 @@ const useLoadOptions = _ref => {
|
|
|
3773
3733
|
where = constructPrefixSearchPredicate(prefixSearchFields, lowerBound, upperBound);
|
|
3774
3734
|
}
|
|
3775
3735
|
}
|
|
3776
|
-
const _ref2 = variables
|
|
3736
|
+
const _ref2 = variables ?? {},
|
|
3777
3737
|
extraWhere = _ref2.extraWhere,
|
|
3778
3738
|
restVariables = _objectWithoutProperties(_ref2, _excluded$1);
|
|
3779
3739
|
if (typeof extraWhere === 'string') {
|
|
3780
|
-
|
|
3781
|
-
where = where ? _concatInstanceProperty__default["default"](_context6 = "(".concat(where, ") and ")).call(_context6, variables.extraWhere) : variables.extraWhere;
|
|
3740
|
+
where = where ? `(${where}) and ${variables.extraWhere}` : variables.extraWhere;
|
|
3782
3741
|
}
|
|
3783
3742
|
return client$1.query({
|
|
3784
3743
|
query,
|
|
@@ -3795,7 +3754,6 @@ const useLoadOptions = _ref => {
|
|
|
3795
3754
|
};
|
|
3796
3755
|
|
|
3797
3756
|
function useCurrentOption(_ref) {
|
|
3798
|
-
var _context;
|
|
3799
3757
|
let id = _ref.id,
|
|
3800
3758
|
typename = _ref.typename,
|
|
3801
3759
|
query = _ref.query,
|
|
@@ -3807,7 +3765,7 @@ function useCurrentOption(_ref) {
|
|
|
3807
3765
|
// load from cache when possible to speed up initial render
|
|
3808
3766
|
const canReadFromCache = id && typename && fragment;
|
|
3809
3767
|
const cacheItem = canReadFromCache ? apolloClient.readFragment({
|
|
3810
|
-
id:
|
|
3768
|
+
id: `${typename}:${id}`,
|
|
3811
3769
|
fragment
|
|
3812
3770
|
}) : undefined;
|
|
3813
3771
|
|
|
@@ -3825,7 +3783,7 @@ function useCurrentOption(_ref) {
|
|
|
3825
3783
|
queryData = _useQuery.data,
|
|
3826
3784
|
queryError = _useQuery.error;
|
|
3827
3785
|
const queryItem = queryData && queryDataToItem(queryData);
|
|
3828
|
-
const item = queryItem
|
|
3786
|
+
const item = queryItem ?? cacheItem;
|
|
3829
3787
|
const loading = item ? false : queryLoading;
|
|
3830
3788
|
const error = item ? undefined : queryError;
|
|
3831
3789
|
const data = item && itemToOption(item);
|
|
@@ -3864,7 +3822,6 @@ const convertProductTypeToOption = productType => {
|
|
|
3864
3822
|
};
|
|
3865
3823
|
};
|
|
3866
3824
|
const ProductTypePickerInput = _ref => {
|
|
3867
|
-
var _currentOption$data$l, _currentOption$data;
|
|
3868
3825
|
let isClearable = _ref.isClearable,
|
|
3869
3826
|
isDisabled = _ref.isDisabled,
|
|
3870
3827
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -3895,9 +3852,8 @@ const ProductTypePickerInput = _ref => {
|
|
|
3895
3852
|
itemToOption: convertProductTypeToOption
|
|
3896
3853
|
});
|
|
3897
3854
|
const handleLoadOptions = React.useCallback(inputValue => loadProductTypes(inputValue).then(_ref3 => {
|
|
3898
|
-
var _data$productTypes;
|
|
3899
3855
|
let data = _ref3.data;
|
|
3900
|
-
return
|
|
3856
|
+
return data.productTypes?.results || [];
|
|
3901
3857
|
}).then(productTypes => _mapInstanceProperty__default["default"](productTypes).call(productTypes, convertProductTypeToOption)).catch(error => {
|
|
3902
3858
|
setLoadingError(error);
|
|
3903
3859
|
onError(error);
|
|
@@ -3911,12 +3867,12 @@ const ProductTypePickerInput = _ref => {
|
|
|
3911
3867
|
setLoadingError(null);
|
|
3912
3868
|
handleInternalInputChange(event);
|
|
3913
3869
|
}, [handleInternalInputChange]);
|
|
3914
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
3870
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
3915
3871
|
React.useEffect(() => {
|
|
3916
3872
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
3917
3873
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
3918
3874
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
3919
|
-
const tooltipTitle =
|
|
3875
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
3920
3876
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
3921
3877
|
max: "scale",
|
|
3922
3878
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -3967,7 +3923,6 @@ var messages$C = reactIntl.defineMessages({
|
|
|
3967
3923
|
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 } } } };
|
|
3968
3924
|
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 } } } };
|
|
3969
3925
|
const StatePickerInput = _ref => {
|
|
3970
|
-
var _currentOption$data$l, _currentOption$data;
|
|
3971
3926
|
let isClearable = _ref.isClearable,
|
|
3972
3927
|
isDisabled = _ref.isDisabled,
|
|
3973
3928
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -3982,7 +3937,7 @@ const StatePickerInput = _ref => {
|
|
|
3982
3937
|
formatMessage = _useIntl.formatMessage;
|
|
3983
3938
|
const dataLocale = applicationShellConnectors.useApplicationContext(applicationContext => applicationContext.dataLocale);
|
|
3984
3939
|
const variables = React.useMemo(() => ({
|
|
3985
|
-
sortByNamePath:
|
|
3940
|
+
sortByNamePath: `name.${dataLocale}`
|
|
3986
3941
|
}), [dataLocale]);
|
|
3987
3942
|
const convertStateToOption = React.useCallback(state => {
|
|
3988
3943
|
const localizedName = formatLocalizedFieldToString(state.nameAllLocales);
|
|
@@ -3997,7 +3952,7 @@ const StatePickerInput = _ref => {
|
|
|
3997
3952
|
_useState2 = _slicedToArray(_useState, 2),
|
|
3998
3953
|
loadingError = _useState2[0],
|
|
3999
3954
|
setLoadingError = _useState2[1];
|
|
4000
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
3955
|
+
const prefixSearchFields = React.useMemo(() => [`name.${dataLocale}`, 'key'], [dataLocale]);
|
|
4001
3956
|
const loadOptions = useLoadOptions({
|
|
4002
3957
|
query: GetStatesQuery,
|
|
4003
3958
|
variables,
|
|
@@ -4030,13 +3985,13 @@ const StatePickerInput = _ref => {
|
|
|
4030
3985
|
setLoadingError(null);
|
|
4031
3986
|
handleInternalInputChange(event);
|
|
4032
3987
|
}, [handleInternalInputChange]);
|
|
4033
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
3988
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
4034
3989
|
React.useEffect(() => {
|
|
4035
3990
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
4036
3991
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
4037
3992
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
4038
3993
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$C.noStatesFound), [loadingError, formatMessage]);
|
|
4039
|
-
const tooltipTitle =
|
|
3994
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
4040
3995
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
4041
3996
|
max: "scale",
|
|
4042
3997
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -4101,26 +4056,23 @@ const CustomFieldTooltip = _ref => {
|
|
|
4101
4056
|
|
|
4102
4057
|
const setToArray = function () {
|
|
4103
4058
|
let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4104
|
-
return
|
|
4059
|
+
return `id in (${_mapInstanceProperty__default["default"](values).call(values, value => `"${value}"`).join(', ')})`;
|
|
4105
4060
|
};
|
|
4106
4061
|
|
|
4107
4062
|
function capitalizeFirst(text) {
|
|
4108
4063
|
return text.charAt(0).toUpperCase() + _sliceInstanceProperty__default["default"](text).call(text, 1);
|
|
4109
4064
|
}
|
|
4110
4065
|
|
|
4111
|
-
const getCentAmountClause = (value, operator, locale) => {
|
|
4112
|
-
var _context;
|
|
4113
|
-
return _concatInstanceProperty__default["default"](_context = "centAmount ".concat(operator, " ")).call(_context, uiKit.MoneyInput.convertToMoneyValue(value, locale).centAmount);
|
|
4114
|
-
};
|
|
4066
|
+
const getCentAmountClause = (value, operator, locale) => `centAmount ${operator} ${uiKit.MoneyInput.convertToMoneyValue(value, locale).centAmount}`;
|
|
4115
4067
|
function moneyTransformer(value, option, locale) {
|
|
4116
4068
|
const clauses = [];
|
|
4117
4069
|
if (option === FILTER_TYPES.range) {
|
|
4118
|
-
clauses[0] =
|
|
4070
|
+
clauses[0] = `currencyCode = "${value.from.currencyCode}"`;
|
|
4119
4071
|
clauses[1] = getCentAmountClause(value.from, '>=', locale);
|
|
4120
4072
|
clauses[2] = getCentAmountClause(value.to, '<=', locale);
|
|
4121
4073
|
return clauses.join(' and ');
|
|
4122
4074
|
}
|
|
4123
|
-
clauses[0] =
|
|
4075
|
+
clauses[0] = `currencyCode = "${value.currencyCode}"`;
|
|
4124
4076
|
switch (option) {
|
|
4125
4077
|
case FILTER_TYPES.lessThan:
|
|
4126
4078
|
clauses[1] = getCentAmountClause(value, '<', locale);
|
|
@@ -4137,7 +4089,6 @@ function moneyTransformer(value, option, locale) {
|
|
|
4137
4089
|
return clauses.join(' and ');
|
|
4138
4090
|
}
|
|
4139
4091
|
|
|
4140
|
-
var _templateObject$2, _templateObject2$1;
|
|
4141
4092
|
const formatTime = 'HH:mm:ss.SSS';
|
|
4142
4093
|
|
|
4143
4094
|
/* TimeInput only allows HH:mm:ss and adds the seconds as 00 and
|
|
@@ -4159,7 +4110,6 @@ const defaultFilterValidator = _ref => {
|
|
|
4159
4110
|
const timeTransformer = function (filterKey, filters) {
|
|
4160
4111
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator;
|
|
4161
4112
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref2 => {
|
|
4162
|
-
var _context, _context2;
|
|
4163
4113
|
let type = _ref2.type,
|
|
4164
4114
|
value = _ref2.value;
|
|
4165
4115
|
if (!filterValidator({
|
|
@@ -4168,13 +4118,19 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4168
4118
|
})) return '';
|
|
4169
4119
|
switch (type) {
|
|
4170
4120
|
case FILTER_TYPES.lessThan:
|
|
4171
|
-
return
|
|
4121
|
+
return `${filterKey} < "${value}"`;
|
|
4172
4122
|
case FILTER_TYPES.moreThan:
|
|
4173
|
-
return
|
|
4123
|
+
return `${filterKey} > "${value}"`;
|
|
4174
4124
|
case FILTER_TYPES.equalTo:
|
|
4175
|
-
return oneLine__default["default"]
|
|
4125
|
+
return oneLine__default["default"]`
|
|
4126
|
+
(${filterKey} >= "${value}"
|
|
4127
|
+
and ${filterKey} <= "${getEndOfSecond(value)}")
|
|
4128
|
+
`;
|
|
4176
4129
|
case FILTER_TYPES.range:
|
|
4177
|
-
return oneLine__default["default"]
|
|
4130
|
+
return oneLine__default["default"]`
|
|
4131
|
+
(${filterKey} >= "${value.from}"
|
|
4132
|
+
and ${filterKey} <= "${getEndOfSecond(value.to)}")
|
|
4133
|
+
`;
|
|
4178
4134
|
default:
|
|
4179
4135
|
return '';
|
|
4180
4136
|
}
|
|
@@ -4190,7 +4146,7 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4190
4146
|
* (pickUpTime >= "14:00" and pickUpTime <= "15:00")
|
|
4191
4147
|
* ) or some_more_filters
|
|
4192
4148
|
*/
|
|
4193
|
-
return queryString === '' ? null :
|
|
4149
|
+
return queryString === '' ? null : `(${queryString})`;
|
|
4194
4150
|
};
|
|
4195
4151
|
|
|
4196
4152
|
// FIXME: delete once prefix search is supported in ctp api
|
|
@@ -4207,9 +4163,8 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4207
4163
|
// e.g
|
|
4208
4164
|
// where: `masterData(current(name(en >= "${lowerBound}" and en < "${upperBound}")))`
|
|
4209
4165
|
const getPrefixSearchBounds = input => {
|
|
4210
|
-
var _context;
|
|
4211
4166
|
const getNextCharacter = character => String.fromCharCode(character.charCodeAt() + 1);
|
|
4212
|
-
return [input,
|
|
4167
|
+
return [input, `${_sliceInstanceProperty__default["default"](input).call(input, 0, input.length - 1)}${getNextCharacter(_sliceInstanceProperty__default["default"](input).call(input, input.length - 1))}`];
|
|
4213
4168
|
};
|
|
4214
4169
|
|
|
4215
4170
|
const _excluded = ["action"];
|
|
@@ -4402,7 +4357,7 @@ const convertChangeValueAction = actionPayload => {
|
|
|
4402
4357
|
* as its dynamic content can not be typed in SDL for the mutation.
|
|
4403
4358
|
*/
|
|
4404
4359
|
const convertAction = (actionName, actionPayload) => {
|
|
4405
|
-
var
|
|
4360
|
+
var _context3, _context4, _context5;
|
|
4406
4361
|
const getNameFromPayload = payload => {
|
|
4407
4362
|
// changeName for `Organizations`
|
|
4408
4363
|
if (typeof payload.name === 'string') return payload;
|
|
@@ -4460,7 +4415,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4460
4415
|
case 'setCustomType':
|
|
4461
4416
|
return {
|
|
4462
4417
|
[actionName]: {
|
|
4463
|
-
typeId:
|
|
4418
|
+
typeId: actionPayload.type?.id,
|
|
4464
4419
|
fields: actionPayload.fields ? _mapInstanceProperty__default["default"](_context3 = _Object$entries__default["default"](actionPayload.fields)).call(_context3, _ref => {
|
|
4465
4420
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
4466
4421
|
customField = _ref2[0],
|
|
@@ -4490,10 +4445,10 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4490
4445
|
};
|
|
4491
4446
|
case 'setGeoLocation':
|
|
4492
4447
|
return {
|
|
4493
|
-
[actionName]: actionPayload
|
|
4448
|
+
[actionName]: actionPayload?.geoLocation ? {
|
|
4494
4449
|
geoLocation: {
|
|
4495
4450
|
type: 'Point',
|
|
4496
|
-
coordinates: [_parseFloat__default["default"](
|
|
4451
|
+
coordinates: [_parseFloat__default["default"](actionPayload.geoLocation?.longitude), _parseFloat__default["default"](actionPayload.geoLocation?.latitude)]
|
|
4497
4452
|
}
|
|
4498
4453
|
} : {
|
|
4499
4454
|
undefined
|
|
@@ -4629,7 +4584,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4629
4584
|
case 'setShippingRateInputType':
|
|
4630
4585
|
return {
|
|
4631
4586
|
[actionName]: {
|
|
4632
|
-
shippingRateInputType:
|
|
4587
|
+
shippingRateInputType: actionPayload.shippingRateInputType?.type ? {
|
|
4633
4588
|
[actionPayload.shippingRateInputType.type]: {
|
|
4634
4589
|
values: actionPayload.shippingRateInputType.type === 'CartClassification' ? _mapInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](actionPayload.shippingRateInputType)).call(_context4, value => ({
|
|
4635
4590
|
key: value.key,
|
|
@@ -4683,8 +4638,8 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4683
4638
|
case 'addAddress':
|
|
4684
4639
|
case 'changeAddress':
|
|
4685
4640
|
{
|
|
4686
|
-
var
|
|
4687
|
-
const _ref3 =
|
|
4641
|
+
var _context6;
|
|
4642
|
+
const _ref3 = actionPayload.address?.custom || {},
|
|
4688
4643
|
_ref3$fields = _ref3.fields,
|
|
4689
4644
|
fields = _ref3$fields === void 0 ? {} : _ref3$fields;
|
|
4690
4645
|
const customFields = isEmpty__default["default"](fields) ? null : _mapInstanceProperty__default["default"](_context6 = _Object$entries__default["default"](fields)).call(_context6, _ref4 => {
|
|
@@ -4696,7 +4651,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4696
4651
|
value: _JSON$stringify__default["default"](value)
|
|
4697
4652
|
};
|
|
4698
4653
|
});
|
|
4699
|
-
const custom =
|
|
4654
|
+
const custom = actionPayload.address?.custom?.type?.id ? {
|
|
4700
4655
|
type: {
|
|
4701
4656
|
id: actionPayload.address.custom.type.id
|
|
4702
4657
|
},
|
|
@@ -4727,7 +4682,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4727
4682
|
value: _JSON$stringify__default["default"](value)
|
|
4728
4683
|
};
|
|
4729
4684
|
});
|
|
4730
|
-
const customType = type
|
|
4685
|
+
const customType = type?.id ? {
|
|
4731
4686
|
id: type.id
|
|
4732
4687
|
} : null;
|
|
4733
4688
|
return {
|
|
@@ -4750,11 +4705,10 @@ const createGraphQlUpdateActions = actions => _reduceInstanceProperty__default["
|
|
|
4750
4705
|
return [...previousActions, convertAction(actionName, actionPayload)];
|
|
4751
4706
|
}, []);
|
|
4752
4707
|
const extractErrorFromGraphQlResponse = graphQlResponse => {
|
|
4753
|
-
|
|
4754
|
-
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) {
|
|
4708
|
+
if (graphQlResponse.networkError?.result?.errors?.length > 0) {
|
|
4755
4709
|
return graphQlResponse.networkError.result.errors;
|
|
4756
4710
|
}
|
|
4757
|
-
if (
|
|
4711
|
+
if (graphQlResponse.graphQLErrors?.length > 0) {
|
|
4758
4712
|
return graphQlResponse.graphQLErrors;
|
|
4759
4713
|
}
|
|
4760
4714
|
return graphQlResponse;
|
|
@@ -4783,16 +4737,14 @@ function omitDeep(obj, fieldsToOmit) {
|
|
|
4783
4737
|
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; }
|
|
4784
4738
|
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; }
|
|
4785
4739
|
function getPriceChannelName(price) {
|
|
4786
|
-
|
|
4787
|
-
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;
|
|
4740
|
+
return price.channel?.name ?? price.channel?.key ?? null;
|
|
4788
4741
|
}
|
|
4789
4742
|
function getDiscountValue(price) {
|
|
4790
|
-
var _price$value, _price$value2, _price$discounted;
|
|
4791
4743
|
let preciseAmount;
|
|
4792
4744
|
let fractionedAmount;
|
|
4793
|
-
if (
|
|
4745
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision && price.discounted.value.type === PRECISION_TYPES.highPrecision) {
|
|
4794
4746
|
preciseAmount = price.value.preciseAmount - price.discounted.value.preciseAmount;
|
|
4795
|
-
} else if (
|
|
4747
|
+
} else if (price.value?.type === PRECISION_TYPES.highPrecision && price.discounted?.value?.type === PRECISION_TYPES.centPrecision) {
|
|
4796
4748
|
fractionedAmount = getFractionedAmount(price.value) - getFractionedAmount(price.discounted.value);
|
|
4797
4749
|
}
|
|
4798
4750
|
return price.discounted ? _objectSpread$13(_objectSpread$13({}, price.value), {}, {
|
|
@@ -4806,28 +4758,23 @@ function getDiscountValue(price) {
|
|
|
4806
4758
|
function getSelectedPrice(price) {
|
|
4807
4759
|
return price.discounted ? price.discounted : price;
|
|
4808
4760
|
}
|
|
4809
|
-
function getNetUnitPrice(
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
shouldRoundAmount = _ref2.shouldRoundAmount;
|
|
4761
|
+
function getNetUnitPrice(_ref) {
|
|
4762
|
+
let lineItem = _ref.lineItem,
|
|
4763
|
+
shouldRoundAmount = _ref.shouldRoundAmount;
|
|
4813
4764
|
const price = getSelectedPrice(lineItem.price);
|
|
4814
|
-
const filteredPerMethodTaxRate = lineItem
|
|
4815
|
-
var _lineItem$shippingDet;
|
|
4816
|
-
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;
|
|
4817
|
-
});
|
|
4765
|
+
const filteredPerMethodTaxRate = lineItem?.perMethodTaxRate?.filter(perMethodTax => lineItem?.shippingDetails?.targets?.findIndex(target => target?.shippingMethodKey === perMethodTax?.shippingMethodKey) >= 0);
|
|
4818
4766
|
|
|
4819
4767
|
// when shipping mode is multi with the same tax rate
|
|
4820
|
-
if (
|
|
4821
|
-
var _price$value3, _price$value4;
|
|
4768
|
+
if (filteredPerMethodTaxRate?.length > 0 && filteredPerMethodTaxRate[0]?.taxRate?.includedInPrice) {
|
|
4822
4769
|
const taxRate = filteredPerMethodTaxRate[0].taxRate;
|
|
4823
4770
|
let centAmount;
|
|
4824
4771
|
// should accept 0 value
|
|
4825
|
-
if (typeof
|
|
4772
|
+
if (typeof price.value?.centAmount === 'number') {
|
|
4826
4773
|
const amount = price.value.centAmount / (1 + taxRate.amount);
|
|
4827
4774
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4828
4775
|
}
|
|
4829
4776
|
let preciseAmount;
|
|
4830
|
-
if (
|
|
4777
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + taxRate.amount);
|
|
4831
4778
|
return _objectSpread$13(_objectSpread$13({}, price.value), {}, {
|
|
4832
4779
|
centAmount,
|
|
4833
4780
|
preciseAmount
|
|
@@ -4836,15 +4783,14 @@ function getNetUnitPrice(_ref2) {
|
|
|
4836
4783
|
|
|
4837
4784
|
// when shipping mode is single
|
|
4838
4785
|
if (lineItem.taxRate && lineItem.taxRate.includedInPrice) {
|
|
4839
|
-
var _price$value5, _price$value6;
|
|
4840
4786
|
let centAmount;
|
|
4841
4787
|
// should accept 0 value
|
|
4842
|
-
if (typeof
|
|
4788
|
+
if (typeof price.value?.centAmount === 'number') {
|
|
4843
4789
|
const amount = price.value.centAmount / (1 + lineItem.taxRate.amount);
|
|
4844
4790
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4845
4791
|
}
|
|
4846
4792
|
let preciseAmount;
|
|
4847
|
-
if (
|
|
4793
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + lineItem.taxRate.amount);
|
|
4848
4794
|
return _objectSpread$13(_objectSpread$13({}, price.value), {}, {
|
|
4849
4795
|
centAmount,
|
|
4850
4796
|
preciseAmount
|
|
@@ -4878,18 +4824,18 @@ const transformCustomFieldFromGraphQLResponse = resource => {
|
|
|
4878
4824
|
key: resource.custom.type.key,
|
|
4879
4825
|
name: l10n.transformLocalizedFieldToLocalizedString(resource.custom.type.nameAllLocales),
|
|
4880
4826
|
fieldDefinitions: _mapInstanceProperty__default["default"](_context = resource.custom.type.fieldDefinitions).call(_context, fieldDefinition => {
|
|
4881
|
-
var
|
|
4827
|
+
var _context2, _context3;
|
|
4882
4828
|
return {
|
|
4883
4829
|
name: fieldDefinition.name,
|
|
4884
4830
|
required: fieldDefinition.required,
|
|
4885
|
-
type:
|
|
4831
|
+
type: fieldDefinition.type?.elementType?.name === 'LocalizedEnum' ? _objectSpread$12(_objectSpread$12({}, fieldDefinition.type), {}, {
|
|
4886
4832
|
elementType: _objectSpread$12(_objectSpread$12({}, fieldDefinition.type.elementType), {}, {
|
|
4887
4833
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
4888
4834
|
key: value.key,
|
|
4889
4835
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
4890
4836
|
}))
|
|
4891
4837
|
})
|
|
4892
|
-
}) :
|
|
4838
|
+
}) : fieldDefinition.type?.name === 'LocalizedEnum' ? _objectSpread$12(_objectSpread$12({}, fieldDefinition.type), {}, {
|
|
4893
4839
|
values: _mapInstanceProperty__default["default"](_context3 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context3, value => ({
|
|
4894
4840
|
key: value.key,
|
|
4895
4841
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -4916,7 +4862,7 @@ const convertProductSelectionFromGraphQl = productSelection => {
|
|
|
4916
4862
|
from: 'nameAllLocales',
|
|
4917
4863
|
to: 'name'
|
|
4918
4864
|
}])), {}, {
|
|
4919
|
-
custom: productSelection
|
|
4865
|
+
custom: productSelection?.custom ? transformCustomFieldFromGraphQLResponse(productSelection) : null
|
|
4920
4866
|
});
|
|
4921
4867
|
};
|
|
4922
4868
|
|
|
@@ -5064,9 +5010,9 @@ CustomFieldDefinitionsConnector.displayName = 'CustomFieldDefinitionsConnector';
|
|
|
5064
5010
|
CustomFieldDefinitionsConnector.defaultProps = {
|
|
5065
5011
|
resources: []
|
|
5066
5012
|
};
|
|
5067
|
-
const stringifyResources$1 = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => "
|
|
5013
|
+
const stringifyResources$1 = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => `"${resource}"`).join();
|
|
5068
5014
|
const mapPropsToOptions = ownProps => {
|
|
5069
|
-
const where = ownProps.resources.length > 0 ?
|
|
5015
|
+
const where = ownProps.resources.length > 0 ? `resourceTypeIds contains any (${stringifyResources$1(ownProps.resources)})` : undefined;
|
|
5070
5016
|
return {
|
|
5071
5017
|
variables: {
|
|
5072
5018
|
where,
|
|
@@ -5135,19 +5081,19 @@ const graphQlDocToForm = typeDefinition => {
|
|
|
5135
5081
|
key: typeDefinition.key,
|
|
5136
5082
|
name: l10n.transformLocalizedFieldToLocalizedString(typeDefinition.nameAllLocales),
|
|
5137
5083
|
fieldDefinitions: _mapInstanceProperty__default["default"](_context = typeDefinition.fieldDefinitions).call(_context, fieldDefinition => {
|
|
5138
|
-
var
|
|
5084
|
+
var _context2, _context3;
|
|
5139
5085
|
return {
|
|
5140
5086
|
name: fieldDefinition.name,
|
|
5141
5087
|
required: fieldDefinition.required,
|
|
5142
5088
|
inputHint: fieldDefinition.inputHint,
|
|
5143
|
-
type:
|
|
5089
|
+
type: fieldDefinition.type?.elementType?.name === 'LocalizedEnum' ? _objectSpread$$(_objectSpread$$({}, fieldDefinition.type), {}, {
|
|
5144
5090
|
elementType: _objectSpread$$(_objectSpread$$({}, fieldDefinition.type.elementType), {}, {
|
|
5145
5091
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
5146
5092
|
key: value.key,
|
|
5147
5093
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
5148
5094
|
}))
|
|
5149
5095
|
})
|
|
5150
|
-
}) :
|
|
5096
|
+
}) : fieldDefinition.type?.name === 'LocalizedEnum' ? _objectSpread$$(_objectSpread$$({}, fieldDefinition.type), {}, {
|
|
5151
5097
|
values: _mapInstanceProperty__default["default"](_context3 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context3, value => ({
|
|
5152
5098
|
key: value.key,
|
|
5153
5099
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -5179,7 +5125,7 @@ const formToGraphQlDoc = formCustomFields => ({
|
|
|
5179
5125
|
// TODO(pa3): find usages and make sure only 1 param is passed
|
|
5180
5126
|
const createEmptyCustomFields = typeDefinition => ({
|
|
5181
5127
|
fields: {},
|
|
5182
|
-
type:
|
|
5128
|
+
type: typeDefinition?.type || {
|
|
5183
5129
|
fieldDefinitions: []
|
|
5184
5130
|
}
|
|
5185
5131
|
});
|
|
@@ -5230,9 +5176,9 @@ CustomFieldTypeDefinitionsConnector.graphQlDocToForm = graphQlDocToForm;
|
|
|
5230
5176
|
CustomFieldTypeDefinitionsConnector.formToRestDoc = formToRestDoc;
|
|
5231
5177
|
CustomFieldTypeDefinitionsConnector.formToGraphQlDoc = formToGraphQlDoc;
|
|
5232
5178
|
CustomFieldTypeDefinitionsConnector.createEmptyCustomFields = createEmptyCustomFields;
|
|
5233
|
-
const stringifyResources = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => "
|
|
5179
|
+
const stringifyResources = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => `"${resource}"`).join();
|
|
5234
5180
|
const createGraphQlOptions = ownProps => {
|
|
5235
|
-
const where = ownProps.resources.length > 0 ?
|
|
5181
|
+
const where = ownProps.resources.length > 0 ? `resourceTypeIds contains any (${stringifyResources(ownProps.resources)})` : undefined;
|
|
5236
5182
|
return {
|
|
5237
5183
|
variables: {
|
|
5238
5184
|
where,
|
|
@@ -5308,7 +5254,7 @@ const extractDuplicatedValues = (values, type, language, languages) => {
|
|
|
5308
5254
|
let validatedValues = [];
|
|
5309
5255
|
if (type.name.toLowerCase() === 'money') {
|
|
5310
5256
|
validatedValues = unique(values, ['amount', 'currencyCode']);
|
|
5311
|
-
} else if (type.name.toLowerCase() === 'reference') validatedValues = unique(_filterInstanceProperty__default["default"](values).call(values, value => value
|
|
5257
|
+
} else if (type.name.toLowerCase() === 'reference') validatedValues = unique(_filterInstanceProperty__default["default"](values).call(values, value => value?.id), ['id']);else if (type.name.toLowerCase() === 'localizedstring') {
|
|
5312
5258
|
validatedValues = unique(values, languages);
|
|
5313
5259
|
} else validatedValues = unique(values);
|
|
5314
5260
|
return validatedValues;
|
|
@@ -5524,7 +5470,6 @@ const getSubfieldLanguage = subfieldName => {
|
|
|
5524
5470
|
return subfieldName.substring(lastDotIndex + 1);
|
|
5525
5471
|
};
|
|
5526
5472
|
function CustomLocalizedTextInput(props) {
|
|
5527
|
-
var _value$language;
|
|
5528
5473
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
5529
5474
|
language: applicationContext.dataLocale,
|
|
5530
5475
|
languages: applicationContext.project.languages
|
|
@@ -5549,7 +5494,7 @@ function CustomLocalizedTextInput(props) {
|
|
|
5549
5494
|
props.setFieldValue(props.name, nullifiedIfNeeded);
|
|
5550
5495
|
});
|
|
5551
5496
|
const InputComponent = isMultiLine ? uiKit.LocalizedMultilineTextInput : uiKit.LocalizedTextInput;
|
|
5552
|
-
const tooltipTitle = isMultiLine ? '' : value ?
|
|
5497
|
+
const tooltipTitle = isMultiLine ? '' : value ? value[language] ?? '' : '';
|
|
5553
5498
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
5554
5499
|
title: tooltipTitle,
|
|
5555
5500
|
children: jsxRuntime.jsx(InputComponent, {
|
|
@@ -5593,8 +5538,7 @@ function CustomBooleanInput(props) {
|
|
|
5593
5538
|
CustomBooleanInput.displayName = 'CustomBooleanInput';
|
|
5594
5539
|
|
|
5595
5540
|
function CustomNumberInput(props) {
|
|
5596
|
-
|
|
5597
|
-
const value = (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : '';
|
|
5541
|
+
const value = props.value ?? '';
|
|
5598
5542
|
const handleChange = makeChangeHandler(rawValue => props.setFieldValue(props.name, !rawValue ? undefined : Number(rawValue)));
|
|
5599
5543
|
return jsxRuntime.jsx(uiKit.NumberInput, {
|
|
5600
5544
|
id: props.name,
|
|
@@ -5639,7 +5583,7 @@ const fixAmount = value => {
|
|
|
5639
5583
|
// data user just entered effectively preventing full data from being entered.
|
|
5640
5584
|
const fixEnteredValue = (newValue, initialValue, currencies) => {
|
|
5641
5585
|
const withFixedCurrency = fixCurrencyCode(newValue, currencies);
|
|
5642
|
-
if (!
|
|
5586
|
+
if (!initialValue?.amount) {
|
|
5643
5587
|
return fixAmount(withFixedCurrency);
|
|
5644
5588
|
}
|
|
5645
5589
|
return withFixedCurrency;
|
|
@@ -5705,13 +5649,12 @@ const convertTypeValuesToOptions$1 = reselect.defaultMemoize((type, dataLocale,
|
|
|
5705
5649
|
key: 'label',
|
|
5706
5650
|
locale: dataLocale,
|
|
5707
5651
|
fallbackOrder: languages,
|
|
5708
|
-
fallback:
|
|
5652
|
+
fallback: `${value.key} (key)`
|
|
5709
5653
|
}),
|
|
5710
5654
|
value: value.key
|
|
5711
5655
|
}));
|
|
5712
5656
|
});
|
|
5713
5657
|
function CustomLocalizedEnumInput(props) {
|
|
5714
|
-
var _options$find$label, _options$find;
|
|
5715
5658
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
5716
5659
|
languages: applicationContext.project.languages,
|
|
5717
5660
|
dataLocale: applicationContext.dataLocale
|
|
@@ -5720,7 +5663,7 @@ function CustomLocalizedEnumInput(props) {
|
|
|
5720
5663
|
dataLocale = _useApplicationContex.dataLocale;
|
|
5721
5664
|
const options = convertTypeValuesToOptions$1(props.fieldDefinition.type, dataLocale, languages);
|
|
5722
5665
|
const handleChange = makeChangeHandler(rawValue => props.setFieldValue(props.name, rawValue));
|
|
5723
|
-
const tooltipTitle = props.value ?
|
|
5666
|
+
const tooltipTitle = props.value ? _findInstanceProperty__default["default"](options).call(options, option => option.value === props.value)?.label ?? '' : '';
|
|
5724
5667
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
5725
5668
|
title: tooltipTitle,
|
|
5726
5669
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
@@ -5740,8 +5683,7 @@ function CustomLocalizedEnumInput(props) {
|
|
|
5740
5683
|
CustomLocalizedEnumInput.displayName = 'CustomLocalizedEnumInput';
|
|
5741
5684
|
|
|
5742
5685
|
function CustomRawIdReferenceInput(props) {
|
|
5743
|
-
|
|
5744
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
5686
|
+
const value = props.value?.id || '';
|
|
5745
5687
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
5746
5688
|
title: value,
|
|
5747
5689
|
children: jsxRuntime.jsx(uiKit.TextInput, {
|
|
@@ -5786,7 +5728,7 @@ function getCategoriesByIds(apolloClient, options) {
|
|
|
5786
5728
|
return apolloClient.query({
|
|
5787
5729
|
query: FetchCategoriesByIds,
|
|
5788
5730
|
variables: {
|
|
5789
|
-
where:
|
|
5731
|
+
where: `id in (${_mapInstanceProperty__default["default"](_context2 = options.ids).call(_context2, id => `"${id}"`).join(', ')})`
|
|
5790
5732
|
},
|
|
5791
5733
|
context: {
|
|
5792
5734
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -5885,13 +5827,10 @@ const useReferenceSearchItems = _ref => {
|
|
|
5885
5827
|
};
|
|
5886
5828
|
};
|
|
5887
5829
|
function ReferenceSearch(props) {
|
|
5888
|
-
const ids = React.useMemo(() => {
|
|
5889
|
-
|
|
5890
|
-
return
|
|
5891
|
-
|
|
5892
|
-
return id;
|
|
5893
|
-
}) : [(_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.id] : [];
|
|
5894
|
-
}, [props.value, props.isMulti]);
|
|
5830
|
+
const ids = React.useMemo(() => props.value ? props.isMulti ? props.value?.map(_ref2 => {
|
|
5831
|
+
let id = _ref2.id;
|
|
5832
|
+
return id;
|
|
5833
|
+
}) : [props.value?.id] : [], [props.value, props.isMulti]);
|
|
5895
5834
|
const _useReferenceSearchIt = useReferenceSearchItems({
|
|
5896
5835
|
loadItemsBySearchTerm: props.loadItemsBySearchTerm,
|
|
5897
5836
|
loadItemsByIds: props.loadItemsByIds,
|
|
@@ -5902,14 +5841,14 @@ function ReferenceSearch(props) {
|
|
|
5902
5841
|
areSomeItemsMissing = _useReferenceSearchIt.areSomeItemsMissing,
|
|
5903
5842
|
handleLoadItems = _useReferenceSearchIt.handleLoadItems;
|
|
5904
5843
|
if (areItemsLoading) return null;
|
|
5905
|
-
const value = props.isMulti ? items : items
|
|
5844
|
+
const value = props.isMulti ? items : items?.[0];
|
|
5906
5845
|
let filterValue = null;
|
|
5907
5846
|
if (value) filterValue = props.isMulti ? _mapInstanceProperty__default["default"](value).call(value, props.mapItemToOption) : props.mapItemToOption(value);
|
|
5908
5847
|
const tooltipTitle = value || props.value ? props.mapItemToOption(value || props.value).label : '';
|
|
5909
5848
|
const loadItems = value => _Promise__default["default"].resolve(handleLoadItems(value)).then(items => _mapInstanceProperty__default["default"](items).call(items, item => props.mapItemToOption(item)));
|
|
5910
5849
|
const handleChange = event => {
|
|
5911
|
-
var _context
|
|
5912
|
-
const option = props.isMulti ? _mapInstanceProperty__default["default"](_context = event.target.value).call(_context, item => item.value) :
|
|
5850
|
+
var _context;
|
|
5851
|
+
const option = props.isMulti ? _mapInstanceProperty__default["default"](_context = event.target.value).call(_context, item => item.value) : event.target.value?.value || null;
|
|
5913
5852
|
props.onChange(option);
|
|
5914
5853
|
};
|
|
5915
5854
|
return jsxRuntime.jsxs("div", {
|
|
@@ -5980,9 +5919,8 @@ const messages$B = reactIntl.defineMessages({
|
|
|
5980
5919
|
});
|
|
5981
5920
|
|
|
5982
5921
|
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; }
|
|
5983
|
-
function _objectSpread$T(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
5922
|
+
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; }
|
|
5984
5923
|
function Option$1(props) {
|
|
5985
|
-
var _context, _context2;
|
|
5986
5924
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
5987
5925
|
language: applicationContext.dataLocale,
|
|
5988
5926
|
languages: applicationContext.project.languages
|
|
@@ -6003,19 +5941,19 @@ function Option$1(props) {
|
|
|
6003
5941
|
fallbackOrder: languages
|
|
6004
5942
|
})
|
|
6005
5943
|
}), category.parent && jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
6006
|
-
children:
|
|
5944
|
+
children: `${formatMessage(messages$B.parentCategory)}: ${l10n.formatLocalizedString(category.parent, {
|
|
6007
5945
|
key: 'name',
|
|
6008
5946
|
locale: language,
|
|
6009
5947
|
fallbackOrder: languages
|
|
6010
|
-
})
|
|
5948
|
+
})}`
|
|
6011
5949
|
}), jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
6012
|
-
children:
|
|
5950
|
+
children: `Slug: ${l10n.formatLocalizedString(category, {
|
|
6013
5951
|
key: 'slug',
|
|
6014
5952
|
locale: language,
|
|
6015
5953
|
fallbackOrder: languages
|
|
6016
|
-
})
|
|
5954
|
+
})}`
|
|
6017
5955
|
}), category.externalId && jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
6018
|
-
children:
|
|
5956
|
+
children: `${formatMessage(messages$B.externalId)}: ${category.externalId || constants.NO_VALUE_FALLBACK}`
|
|
6019
5957
|
})]
|
|
6020
5958
|
})
|
|
6021
5959
|
}));
|
|
@@ -6078,7 +6016,7 @@ var CategorySearchPickerOptionFragment$1 = { kind: "Document", definitions: [{ k
|
|
|
6078
6016
|
function useCachedCategoryOptions(ids) {
|
|
6079
6017
|
const apolloClient = client.useApolloClient();
|
|
6080
6018
|
const fragments = _mapInstanceProperty__default["default"](ids).call(ids, id => apolloClient.readFragment({
|
|
6081
|
-
id:
|
|
6019
|
+
id: `CategorySearch:${id}`,
|
|
6082
6020
|
fragment: CategorySearchPickerOptionFragment$1
|
|
6083
6021
|
}));
|
|
6084
6022
|
return _mapInstanceProperty__default["default"](fragments).call(fragments, category => transformLocalizedFieldsForCategory(category, [{
|
|
@@ -6093,8 +6031,8 @@ function useCachedCategoryOptions(ids) {
|
|
|
6093
6031
|
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 } } } };
|
|
6094
6032
|
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 } } } };
|
|
6095
6033
|
const transformCartDiscountResponse = response => {
|
|
6096
|
-
var _context
|
|
6097
|
-
return _mapInstanceProperty__default["default"](_context =
|
|
6034
|
+
var _context;
|
|
6035
|
+
return _mapInstanceProperty__default["default"](_context = response.data?.cartDiscounts.results || []).call(_context, cartDiscount => transformLocalizedFieldsForCartDiscount(cartDiscount));
|
|
6098
6036
|
};
|
|
6099
6037
|
function queryCartDiscounts(apolloClient) {
|
|
6100
6038
|
return apolloClient.query({
|
|
@@ -6106,14 +6044,14 @@ function queryCartDiscounts(apolloClient) {
|
|
|
6106
6044
|
}).then(transformCartDiscountResponse);
|
|
6107
6045
|
}
|
|
6108
6046
|
const getWhereClause = function () {
|
|
6109
|
-
var _context2, _context3
|
|
6047
|
+
var _context2, _context3;
|
|
6110
6048
|
let searchText = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
6111
6049
|
let language = arguments.length > 1 ? arguments[1] : undefined;
|
|
6112
6050
|
const query = _trimInstanceProperty__default["default"](_context2 = _JSON$stringify__default["default"](searchText)).call(_context2);
|
|
6113
|
-
const idQuery = isUUID(searchText) &&
|
|
6114
|
-
const nameQuery =
|
|
6115
|
-
const keyQuery =
|
|
6116
|
-
return _filterInstanceProperty__default["default"](
|
|
6051
|
+
const idQuery = isUUID(searchText) && `id = ${query}`;
|
|
6052
|
+
const nameQuery = `name(${language} = ${query})`;
|
|
6053
|
+
const keyQuery = `key = ${query}`;
|
|
6054
|
+
return _filterInstanceProperty__default["default"](_context3 = [idQuery, nameQuery, keyQuery]).call(_context3, Boolean).join(' or ');
|
|
6117
6055
|
};
|
|
6118
6056
|
function searchCartDiscountsByExactMatch(apolloClient, options) {
|
|
6119
6057
|
return apolloClient.query({
|
|
@@ -6136,10 +6074,7 @@ function getCartDiscountById(apolloClient, options) {
|
|
|
6136
6074
|
context: {
|
|
6137
6075
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
6138
6076
|
}
|
|
6139
|
-
}).then(response =>
|
|
6140
|
-
var _response$data2;
|
|
6141
|
-
return (_response$data2 = response.data) !== null && _response$data2 !== void 0 && _response$data2.cartDiscount ? transformLocalizedFieldsForCartDiscount(response.data.cartDiscount) : null;
|
|
6142
|
-
});
|
|
6077
|
+
}).then(response => response.data?.cartDiscount ? transformLocalizedFieldsForCartDiscount(response.data.cartDiscount) : null);
|
|
6143
6078
|
}
|
|
6144
6079
|
|
|
6145
6080
|
const messages$A = reactIntl.defineMessages({
|
|
@@ -6216,7 +6151,7 @@ function CartDiscountReferenceSearch(props) {
|
|
|
6216
6151
|
}),
|
|
6217
6152
|
loading = _useQuery.loading,
|
|
6218
6153
|
data = _useQuery.data;
|
|
6219
|
-
const isExactMatch =
|
|
6154
|
+
const isExactMatch = data?.cartDiscounts.total > QUERY_MAX_LIMIT;
|
|
6220
6155
|
const _useIntl = reactIntl.useIntl(),
|
|
6221
6156
|
formatMessage = _useIntl.formatMessage;
|
|
6222
6157
|
const apolloClient = client.useApolloClient();
|
|
@@ -6353,7 +6288,6 @@ const DropdownIndicator = () => jsxRuntime.jsx(uiKit.SearchIcon, {
|
|
|
6353
6288
|
});
|
|
6354
6289
|
DropdownIndicator.displayName = 'DropdownIndicator';
|
|
6355
6290
|
const ProductPickerInput = _ref => {
|
|
6356
|
-
var _currentOption$data$l, _currentOption$data;
|
|
6357
6291
|
let isClearable = _ref.isClearable,
|
|
6358
6292
|
isDisabled = _ref.isDisabled,
|
|
6359
6293
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -6373,20 +6307,19 @@ const ProductPickerInput = _ref => {
|
|
|
6373
6307
|
loadingError = _useState2[0],
|
|
6374
6308
|
setLoadingError = _useState2[1];
|
|
6375
6309
|
const convertProductToOption = React.useCallback(product => {
|
|
6376
|
-
var _masterData$current;
|
|
6377
6310
|
if (!product) return null;
|
|
6378
6311
|
const id = product.id,
|
|
6379
6312
|
key = product.key,
|
|
6380
6313
|
masterData = product.masterData;
|
|
6381
|
-
const localizedName = formatLocalizedFieldToString(
|
|
6314
|
+
const localizedName = formatLocalizedFieldToString(masterData.current?.nameAllLocales);
|
|
6382
6315
|
return {
|
|
6383
|
-
label: localizedName + (key ?
|
|
6316
|
+
label: localizedName + (key ? ` (key: ${key})` : ''),
|
|
6384
6317
|
value: id,
|
|
6385
6318
|
name: localizedName,
|
|
6386
6319
|
key
|
|
6387
6320
|
};
|
|
6388
6321
|
}, [formatLocalizedFieldToString]);
|
|
6389
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
6322
|
+
const prefixSearchFields = React.useMemo(() => [`masterData.current.name.${dataLocale}`, 'key'], [dataLocale]);
|
|
6390
6323
|
const loadOptions = useLoadOptions({
|
|
6391
6324
|
query: GetProductsQuery,
|
|
6392
6325
|
prefixSearchFields
|
|
@@ -6417,12 +6350,12 @@ const ProductPickerInput = _ref => {
|
|
|
6417
6350
|
setLoadingError(null);
|
|
6418
6351
|
handleInternalInputChange(event);
|
|
6419
6352
|
}, [handleInternalInputChange]);
|
|
6420
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
6353
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
6421
6354
|
React.useEffect(() => {
|
|
6422
6355
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
6423
6356
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
6424
6357
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
6425
|
-
const tooltipTitle =
|
|
6358
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
6426
6359
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
6427
6360
|
max: "scale",
|
|
6428
6361
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -6459,8 +6392,7 @@ const ProductPickerInput = _ref => {
|
|
|
6459
6392
|
ProductPickerInput.displayName = 'ProductPickerInput';
|
|
6460
6393
|
|
|
6461
6394
|
function CustomProductReferenceInput(props) {
|
|
6462
|
-
|
|
6463
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6395
|
+
const value = props.value?.id || '';
|
|
6464
6396
|
return jsxRuntime.jsx(ProductPickerInput, {
|
|
6465
6397
|
value: value,
|
|
6466
6398
|
name: props.name,
|
|
@@ -6477,8 +6409,7 @@ function CustomProductReferenceInput(props) {
|
|
|
6477
6409
|
CustomProductReferenceInput.displayName = 'CustomProductReferenceInput';
|
|
6478
6410
|
|
|
6479
6411
|
function CustomProductTypeReferenceInput(props) {
|
|
6480
|
-
|
|
6481
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6412
|
+
const value = props.value?.id || '';
|
|
6482
6413
|
return jsxRuntime.jsx(ProductTypePickerInput, {
|
|
6483
6414
|
value: value,
|
|
6484
6415
|
name: props.name,
|
|
@@ -6494,8 +6425,7 @@ function CustomProductTypeReferenceInput(props) {
|
|
|
6494
6425
|
CustomProductTypeReferenceInput.displayName = 'CustomProductTypeReferenceInput';
|
|
6495
6426
|
|
|
6496
6427
|
function CustomChannelReferenceInput(props) {
|
|
6497
|
-
|
|
6498
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6428
|
+
const value = props.value?.id || '';
|
|
6499
6429
|
return jsxRuntime.jsx(ChannelPickerInput, {
|
|
6500
6430
|
value: value,
|
|
6501
6431
|
name: props.name,
|
|
@@ -6511,8 +6441,7 @@ function CustomChannelReferenceInput(props) {
|
|
|
6511
6441
|
CustomChannelReferenceInput.displayName = 'CustomChannelReferenceInput';
|
|
6512
6442
|
|
|
6513
6443
|
function CustomStateReferenceInput(props) {
|
|
6514
|
-
|
|
6515
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6444
|
+
const value = props.value?.id || '';
|
|
6516
6445
|
return jsxRuntime.jsx(StatePickerInput, {
|
|
6517
6446
|
value: value,
|
|
6518
6447
|
name: props.name,
|
|
@@ -6621,14 +6550,13 @@ function CustomTimeInput(props) {
|
|
|
6621
6550
|
CustomTimeInput.displayName = 'CustomTimeInput';
|
|
6622
6551
|
|
|
6623
6552
|
const convertTypeValuesToOptions = reselect.defaultMemoize(typeValues => _mapInstanceProperty__default["default"](typeValues).call(typeValues, typeValue => ({
|
|
6624
|
-
label: typeValue.label ||
|
|
6553
|
+
label: typeValue.label || `${typeValue.key} (key)`,
|
|
6625
6554
|
value: typeValue.key
|
|
6626
6555
|
})));
|
|
6627
6556
|
function CustomEnumInput(props) {
|
|
6628
|
-
var _options$find$label, _options$find;
|
|
6629
6557
|
const options = convertTypeValuesToOptions(_valuesInstanceProperty__default["default"](props.fieldDefinition.type));
|
|
6630
6558
|
const handleChange = makeChangeHandler(rawValue => props.setFieldValue(props.name, rawValue));
|
|
6631
|
-
const tooltipTitle = props.value ?
|
|
6559
|
+
const tooltipTitle = props.value ? _findInstanceProperty__default["default"](options).call(options, option => option.value === props.value)?.label ?? '' : '';
|
|
6632
6560
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
6633
6561
|
title: tooltipTitle,
|
|
6634
6562
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
@@ -6700,9 +6628,9 @@ function ownKeys$P(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
6700
6628
|
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; }
|
|
6701
6629
|
const getTypeName = type => type.name.toLowerCase();
|
|
6702
6630
|
const findLabel = (enumType, key) => {
|
|
6703
|
-
var
|
|
6631
|
+
var _context;
|
|
6704
6632
|
const emptyValue = getTypeName(enumType) === 'enum' ? '' : {};
|
|
6705
|
-
return
|
|
6633
|
+
return _findInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](enumType)).call(_context, value => value.key === key)?.label ?? emptyValue;
|
|
6706
6634
|
};
|
|
6707
6635
|
const convertEnumValues = (value, attributeDefinition) => {
|
|
6708
6636
|
var _context2, _context3;
|
|
@@ -6766,7 +6694,7 @@ const attributesMapToNameValuePairs = map => {
|
|
|
6766
6694
|
|
|
6767
6695
|
const getAttributeShortName = (fullName, attributesPrefix) => {
|
|
6768
6696
|
if (!attributesPrefix) return fullName;
|
|
6769
|
-
return fullName.replace(
|
|
6697
|
+
return fullName.replace(`${attributesPrefix}.`, '');
|
|
6770
6698
|
};
|
|
6771
6699
|
function ProductAttributes(props) {
|
|
6772
6700
|
const formik$1 = formik.useFormikContext();
|
|
@@ -6848,19 +6776,19 @@ function ownKeys$O(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
6848
6776
|
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; }
|
|
6849
6777
|
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 } } } };
|
|
6850
6778
|
const mapAttributeDefinition = definition => {
|
|
6851
|
-
var _context,
|
|
6779
|
+
var _context, _context2, _context3, _context4;
|
|
6852
6780
|
return _objectSpread$O(_objectSpread$O({}, definition), {}, {
|
|
6853
6781
|
required: definition.isRequired,
|
|
6854
6782
|
inputTip: l10n.transformLocalizedFieldToLocalizedString(definition.inputTipAllLocales),
|
|
6855
6783
|
label: l10n.transformLocalizedFieldToLocalizedString(definition.labelAllLocales),
|
|
6856
|
-
type: _includesInstanceProperty__default["default"](_context = ['enum', 'lenum']).call(_context,
|
|
6784
|
+
type: _includesInstanceProperty__default["default"](_context = ['enum', 'lenum']).call(_context, definition.type?.elementType?.name) ? _objectSpread$O(_objectSpread$O({}, definition.type), {}, {
|
|
6857
6785
|
elementType: _objectSpread$O(_objectSpread$O({}, definition.type.elementType), {}, {
|
|
6858
6786
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](definition.type.elementType).results).call(_context2, value => ({
|
|
6859
6787
|
key: value.key,
|
|
6860
6788
|
label: value.label || l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
6861
6789
|
}))
|
|
6862
6790
|
})
|
|
6863
|
-
}) : _includesInstanceProperty__default["default"](_context3 = ['enum', 'lenum']).call(_context3,
|
|
6791
|
+
}) : _includesInstanceProperty__default["default"](_context3 = ['enum', 'lenum']).call(_context3, definition.type?.name) ? _objectSpread$O(_objectSpread$O({}, definition.type), {}, {
|
|
6864
6792
|
values: _mapInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](definition.type).results).call(_context4, value => ({
|
|
6865
6793
|
key: value.key,
|
|
6866
6794
|
label: value.label || l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -7211,7 +7139,7 @@ const ExpandButton = props => props.totalValues > 1 ? jsxRuntime.jsxs(uiKit.Spac
|
|
|
7211
7139
|
}), jsxRuntime.jsx(uiKit.FlatButton, {
|
|
7212
7140
|
tone: "primary",
|
|
7213
7141
|
icon: props.isExpanded ? jsxRuntime.jsx(uiKit.AngleUpIcon, {}) : jsxRuntime.jsx(uiKit.AngleDownIcon, {}),
|
|
7214
|
-
label: props.isExpanded ?
|
|
7142
|
+
label: props.isExpanded ? `Hide set items (${props.totalValues})` : `Show all set items (${props.totalValues})`,
|
|
7215
7143
|
onClick: props.onExpand
|
|
7216
7144
|
})]
|
|
7217
7145
|
}) : null;
|
|
@@ -7246,7 +7174,7 @@ const SetButtons = props => {
|
|
|
7246
7174
|
SetButtons.displayName = 'SetButtons';
|
|
7247
7175
|
|
|
7248
7176
|
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; }
|
|
7249
|
-
function _objectSpread$M(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
7177
|
+
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; }
|
|
7250
7178
|
const getDuplicateErrors = setValues => {
|
|
7251
7179
|
/* eslint-disable no-plusplus */
|
|
7252
7180
|
const result = [];
|
|
@@ -7287,13 +7215,10 @@ const getItemIndex = name => {
|
|
|
7287
7215
|
return _parseInt__default["default"](rawIndex, 10);
|
|
7288
7216
|
};
|
|
7289
7217
|
const makeKeys = amount => times__default["default"](amount, () => uuid.v4());
|
|
7290
|
-
const makeItemFieldName = (fieldName, index) => {
|
|
7291
|
-
var _context;
|
|
7292
|
-
return _concatInstanceProperty__default["default"](_context = "".concat(fieldName, ".[")).call(_context, index, "]");
|
|
7293
|
-
};
|
|
7218
|
+
const makeItemFieldName = (fieldName, index) => `${fieldName}.[${index}]`;
|
|
7294
7219
|
const makeMapForAllItems = (fieldName, items, value) => _reduceInstanceProperty__default["default"](items).call(items, (result, item, index) => set__default["default"](result, makeItemFieldName(fieldName, index), value), {});
|
|
7295
7220
|
function CustomInputSet(props) {
|
|
7296
|
-
var
|
|
7221
|
+
var _context;
|
|
7297
7222
|
const _useToggleState = uiKit.useToggleState(false),
|
|
7298
7223
|
_useToggleState2 = _slicedToArray(_useToggleState, 2),
|
|
7299
7224
|
isExpanded = _useToggleState2[0],
|
|
@@ -7315,7 +7240,7 @@ function CustomInputSet(props) {
|
|
|
7315
7240
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
7316
7241
|
keys = _useState4[0],
|
|
7317
7242
|
setKeys = _useState4[1];
|
|
7318
|
-
const totalAmount = internalValue
|
|
7243
|
+
const totalAmount = internalValue?.length;
|
|
7319
7244
|
const amountToRender = isExpanded ? totalAmount : 1;
|
|
7320
7245
|
const updateInternalValue = newValue => {
|
|
7321
7246
|
const valueToSet = isEmpty$1(newValue) ? [undefined] : newValue;
|
|
@@ -7362,8 +7287,8 @@ function CustomInputSet(props) {
|
|
|
7362
7287
|
// in <CustomFieldComponent /> where proper component for given field/attribute
|
|
7363
7288
|
// type is selected.
|
|
7364
7289
|
const type = getType(props.fieldDefinition);
|
|
7365
|
-
const typeName = type
|
|
7366
|
-
const areButtonsTopAligned = _includesInstanceProperty__default["default"](
|
|
7290
|
+
const typeName = type?.name.toLowerCase();
|
|
7291
|
+
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);
|
|
7367
7292
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
7368
7293
|
children: [jsxRuntime.jsx(uiKit.AccessibleHidden, {
|
|
7369
7294
|
children: jsxRuntime.jsx("label", {
|
|
@@ -7441,14 +7366,12 @@ const nonSetComponents = {
|
|
|
7441
7366
|
};
|
|
7442
7367
|
const CustomFieldInput = /*#__PURE__*/React.memo(props => {
|
|
7443
7368
|
const InputComponent = React.useMemo(() => {
|
|
7444
|
-
|
|
7445
|
-
const typeName = (_props$fieldDefinitio = props.fieldDefinition.type) === null || _props$fieldDefinitio === void 0 ? void 0 : _props$fieldDefinitio.name.toLowerCase();
|
|
7369
|
+
const typeName = props.fieldDefinition.type?.name.toLowerCase();
|
|
7446
7370
|
if (typeName === 'set') {
|
|
7447
|
-
var _getSetElementType;
|
|
7448
7371
|
// Boolean is the only set element with peculiarities (i.e. way more
|
|
7449
7372
|
// convenient for user to work with it as with select input with three values:
|
|
7450
7373
|
// [true], [false] and [true, false]).
|
|
7451
|
-
if (
|
|
7374
|
+
if (getType(props.fieldDefinition)?.name.toLowerCase() === CUSTOM_FIELD_TYPES.boolean) {
|
|
7452
7375
|
return CustomBooleanInputSet;
|
|
7453
7376
|
}
|
|
7454
7377
|
// All the rest sets are just a fancy wrapper around single-item components
|
|
@@ -7539,9 +7462,9 @@ const CustomFieldErrors = props => {
|
|
|
7539
7462
|
const didFormValidationFail = useDidFormValidationFail();
|
|
7540
7463
|
const errors = _Array$isArray__default["default"](props.errors) ? mergeSetItemsErrors(props.errors) : props.errors;
|
|
7541
7464
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
7542
|
-
children: [props.isTouched || didFormValidationFail &&
|
|
7465
|
+
children: [props.isTouched || didFormValidationFail && errors?.missing && jsxRuntime.jsx(_.ErrorMessage, {
|
|
7543
7466
|
intlMessage: messages$K.required
|
|
7544
|
-
}), props.isTouched || didFormValidationFail &&
|
|
7467
|
+
}), props.isTouched || didFormValidationFail && errors?.duplicated && jsxRuntime.jsx(_.ErrorMessage, {
|
|
7545
7468
|
intlMessage: messages$K.unique
|
|
7546
7469
|
})]
|
|
7547
7470
|
});
|
|
@@ -7590,10 +7513,9 @@ function ownKeys$J(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
7590
7513
|
function _objectSpread$J(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$J(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$J(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
7591
7514
|
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 } } } };
|
|
7592
7515
|
const CustomFieldsLabelHint = _ref2 => {
|
|
7593
|
-
var _type$name;
|
|
7594
7516
|
let fieldDefinition = _ref2.fieldDefinition;
|
|
7595
7517
|
const type = getType(fieldDefinition);
|
|
7596
|
-
const isReference =
|
|
7518
|
+
const isReference = type.name?.toLowerCase() === 'reference';
|
|
7597
7519
|
const referenceTypeId = type.referenceTypeId;
|
|
7598
7520
|
const isCartDiscountsReference = isReference && referenceTypeId === SEARCHABLE_REFERENCES.cartDiscount;
|
|
7599
7521
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
@@ -7611,7 +7533,7 @@ const CustomFieldsLabelHint = _ref2 => {
|
|
|
7611
7533
|
data = _useQuery.data,
|
|
7612
7534
|
loading = _useQuery.loading;
|
|
7613
7535
|
if (loading) return null;
|
|
7614
|
-
if (
|
|
7536
|
+
if (data?.cartDiscounts.total > QUERY_MAX_LIMIT) {
|
|
7615
7537
|
return jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
7616
7538
|
alignItems: "center",
|
|
7617
7539
|
children: [jsxRuntime.jsx(uiKit.WarningIcon, {
|
|
@@ -7638,17 +7560,17 @@ function CustomFieldsProductTypeReferenceSubtitle() {
|
|
|
7638
7560
|
// TODO(pa3): this logic may be misplaced and probably
|
|
7639
7561
|
// should belong to <CustomReferenceInput /> component instead.
|
|
7640
7562
|
function CustomFieldsLabelSubtitle(_ref3) {
|
|
7641
|
-
var
|
|
7563
|
+
var _context;
|
|
7642
7564
|
let fieldDefinition = _ref3.fieldDefinition;
|
|
7643
7565
|
const _useIntl2 = reactIntl.useIntl(),
|
|
7644
7566
|
formatMessage = _useIntl2.formatMessage;
|
|
7645
7567
|
const type = getType(fieldDefinition);
|
|
7646
|
-
const isReference =
|
|
7568
|
+
const isReference = type.name?.toLowerCase() === 'reference';
|
|
7647
7569
|
if (!isReference) return null;
|
|
7648
7570
|
const referenceTypeId = type.referenceTypeId;
|
|
7649
7571
|
const referenceTypeName = capitalizeFirst(referenceTypeId);
|
|
7650
7572
|
if (_includesInstanceProperty__default["default"](_context = [SEARCHABLE_REFERENCES.category, SEARCHABLE_REFERENCES.cartDiscount]).call(_context, referenceTypeId)) return referenceTypeName;
|
|
7651
|
-
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) :
|
|
7573
|
+
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`;
|
|
7652
7574
|
}
|
|
7653
7575
|
const Portal = props => /*#__PURE__*/ReactDOM__default["default"].createPortal(props.children, document.body);
|
|
7654
7576
|
var _ref = {
|
|
@@ -7660,7 +7582,7 @@ function CustomFieldsCountIndicator(_ref4) {
|
|
|
7660
7582
|
const formatLocalizedField = useFormatLocalizedFieldToString();
|
|
7661
7583
|
const _useIntl3 = reactIntl.useIntl(),
|
|
7662
7584
|
formatMessage = _useIntl3.formatMessage;
|
|
7663
|
-
return
|
|
7585
|
+
return assignedAttributeGroups?.length > 1 ? jsxRuntime.jsx(uiKit.Tooltip, {
|
|
7664
7586
|
title: formatMessage(messages$v.attributeGroupCountTooltip, {
|
|
7665
7587
|
attributeGroups: _mapInstanceProperty__default["default"](assignedAttributeGroups).call(assignedAttributeGroups, assignedAttributeGroup => formatLocalizedField(assignedAttributeGroup.nameAllLocales)).join(', '),
|
|
7666
7588
|
count: assignedAttributeGroups.length
|
|
@@ -7718,9 +7640,8 @@ const CustomFieldsLabel = /*#__PURE__*/React.memo(_ref5 => {
|
|
|
7718
7640
|
CustomFieldsLabel.displayName = 'CustomFieldsTitle';
|
|
7719
7641
|
|
|
7720
7642
|
const getFieldName = (parentName, fieldName) => {
|
|
7721
|
-
var _context;
|
|
7722
7643
|
if (!parentName) return fieldName;
|
|
7723
|
-
return
|
|
7644
|
+
return `${parentName}.${fieldName}`;
|
|
7724
7645
|
};
|
|
7725
7646
|
const isNested = fieldDefinition => {
|
|
7726
7647
|
const type = fieldDefinition.type;
|
|
@@ -7745,7 +7666,6 @@ const CustomFieldsInternal = props => {
|
|
|
7745
7666
|
isDragAndDropMode = _useDnDContext.isDragAndDropMode;
|
|
7746
7667
|
return jsxRuntime.jsx(DroppableWrapper, {
|
|
7747
7668
|
children: _mapInstanceProperty__default["default"](fieldDefinitions).call(fieldDefinitions, (fieldDefinition, index) => {
|
|
7748
|
-
var _context2;
|
|
7749
7669
|
const fieldName = getFieldName(props.name, fieldDefinition.name);
|
|
7750
7670
|
const isTouched = Boolean(formik.getIn(touched, fieldName));
|
|
7751
7671
|
const fieldErrors = formik.getIn(errors, fieldName);
|
|
@@ -7762,51 +7682,48 @@ const CustomFieldsInternal = props => {
|
|
|
7762
7682
|
return jsxRuntime.jsx(formik.FastField, {
|
|
7763
7683
|
name: fieldName,
|
|
7764
7684
|
validate: validate,
|
|
7765
|
-
children: () => {
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
children: jsxRuntime.
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7685
|
+
children: () => jsxRuntime.jsx(DraggableWrapper, {
|
|
7686
|
+
draggableKey: `${fieldName}-${index}`,
|
|
7687
|
+
draggableId: `${fieldName}-${index}`,
|
|
7688
|
+
index: index,
|
|
7689
|
+
children: jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
7690
|
+
scale: "xs",
|
|
7691
|
+
children: jsxRuntime.jsxs("div", {
|
|
7692
|
+
"aria-invalid": _Object$keys__default["default"](fieldErrors ?? {}).length > 0,
|
|
7693
|
+
"aria-errormessage": `${fieldName}-error`,
|
|
7694
|
+
id: `${fieldName}-error`,
|
|
7695
|
+
children: [jsxRuntime.jsx(CustomFieldsLabel, {
|
|
7696
|
+
name: fieldName,
|
|
7697
|
+
fieldDefinition: fieldDefinition
|
|
7698
|
+
}), jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
7699
|
+
scale: "xs",
|
|
7700
|
+
alignItems: "stretch",
|
|
7701
|
+
children: [isNested(fieldDefinition) ? jsxRuntime.jsx(CustomNestedFieldInput, {
|
|
7778
7702
|
name: fieldName,
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
onBlur: handleBlur,
|
|
7798
|
-
setFieldValue: props.setFieldValue,
|
|
7799
|
-
hasError: hasError
|
|
7800
|
-
}), jsxRuntime.jsx(CustomFieldErrors, {
|
|
7801
|
-
isTouched: isTouched,
|
|
7802
|
-
errors: fieldErrors
|
|
7803
|
-
})]
|
|
7703
|
+
value: value,
|
|
7704
|
+
fieldDefinition: fieldDefinition,
|
|
7705
|
+
isDisabled: props.isDisabled || isDragAndDropMode,
|
|
7706
|
+
isReadOnly: props.isReadOnly,
|
|
7707
|
+
onBlur: handleBlur,
|
|
7708
|
+
setFieldValue: props.setFieldValue
|
|
7709
|
+
}) : jsxRuntime.jsx(CustomFieldInput, {
|
|
7710
|
+
name: fieldName,
|
|
7711
|
+
value: value,
|
|
7712
|
+
fieldDefinition: fieldDefinition,
|
|
7713
|
+
isDisabled: props.isDisabled || isDragAndDropMode,
|
|
7714
|
+
isReadOnly: props.isReadOnly,
|
|
7715
|
+
onBlur: handleBlur,
|
|
7716
|
+
setFieldValue: props.setFieldValue,
|
|
7717
|
+
hasError: hasError
|
|
7718
|
+
}), jsxRuntime.jsx(CustomFieldErrors, {
|
|
7719
|
+
isTouched: isTouched,
|
|
7720
|
+
errors: fieldErrors
|
|
7804
7721
|
})]
|
|
7805
|
-
})
|
|
7722
|
+
})]
|
|
7806
7723
|
})
|
|
7807
|
-
})
|
|
7808
|
-
}
|
|
7809
|
-
},
|
|
7724
|
+
})
|
|
7725
|
+
})
|
|
7726
|
+
}, `${fieldName}-${index}`);
|
|
7810
7727
|
})
|
|
7811
7728
|
});
|
|
7812
7729
|
};
|
|
@@ -7862,7 +7779,7 @@ var pickerMessages = reactIntl.defineMessages({
|
|
|
7862
7779
|
});
|
|
7863
7780
|
|
|
7864
7781
|
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; }
|
|
7865
|
-
function _objectSpread$I(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
7782
|
+
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; }
|
|
7866
7783
|
const PRODUCT_SELECTION_MODES = {
|
|
7867
7784
|
INCLUSION: 'Individual',
|
|
7868
7785
|
EXCLUSION: 'IndividualExclusion'
|
|
@@ -7873,11 +7790,10 @@ const PRODUCT_SELECTION_MODES_LABELS = {
|
|
|
7873
7790
|
};
|
|
7874
7791
|
const getMode = mode => mode === PRODUCT_SELECTION_MODES.INCLUSION || mode === PRODUCT_SELECTION_MODES_LABELS.INCLUSION ? 'inclusion' : 'exclusion';
|
|
7875
7792
|
const addModeToLabel = function (ps) {
|
|
7876
|
-
var _context;
|
|
7877
7793
|
let enableExcludingProducts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
7878
7794
|
if (!ps) return undefined;
|
|
7879
7795
|
return _objectSpread$I(_objectSpread$I({}, ps), {}, {
|
|
7880
|
-
label:
|
|
7796
|
+
label: `${ps?.label}${enableExcludingProducts ? ` (type: ${getMode(ps?.mode)})` : ''}`
|
|
7881
7797
|
});
|
|
7882
7798
|
};
|
|
7883
7799
|
|
|
@@ -7889,7 +7805,6 @@ const mapProductSelectionsToOptions$1 = memoize__default["default"](function ()
|
|
|
7889
7805
|
let enableExcludingProducts = arguments.length > 4 ? arguments[4] : undefined;
|
|
7890
7806
|
const selectedPSList = _Array$isArray__default["default"](selectedPS) ? selectedPS : [selectedPS];
|
|
7891
7807
|
return _mapInstanceProperty__default["default"](productSelections).call(productSelections, productSelection => {
|
|
7892
|
-
var _context;
|
|
7893
7808
|
const label = l10n.formatLocalizedString(productSelection, {
|
|
7894
7809
|
key: 'name',
|
|
7895
7810
|
locale: dataLocale,
|
|
@@ -7898,14 +7813,13 @@ const mapProductSelectionsToOptions$1 = memoize__default["default"](function ()
|
|
|
7898
7813
|
return {
|
|
7899
7814
|
id: productSelection.id,
|
|
7900
7815
|
value: productSelection.id,
|
|
7901
|
-
label:
|
|
7816
|
+
label: `${label}${_includesInstanceProperty__default["default"](selectedPSList).call(selectedPSList, productSelection.id) && enableExcludingProducts ? ` (type: ${getMode(productSelection.mode)})` : ''}`,
|
|
7902
7817
|
key: productSelection.key,
|
|
7903
7818
|
mode: getMode(productSelection.mode)
|
|
7904
7819
|
};
|
|
7905
7820
|
});
|
|
7906
7821
|
});
|
|
7907
7822
|
function ProductSelectionBasicSelectDropdown(props) {
|
|
7908
|
-
var _productSelectionsFet, _productSelectionsFet2;
|
|
7909
7823
|
const intl = reactIntl.useIntl();
|
|
7910
7824
|
const enableExcludingProducts = applicationShell.useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
7911
7825
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -7918,10 +7832,10 @@ function ProductSelectionBasicSelectDropdown(props) {
|
|
|
7918
7832
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
7919
7833
|
dataLocale = _useApplicationContex.dataLocale;
|
|
7920
7834
|
if (productSelectionsFetcher.isLoading) return jsxRuntime.jsx(CenteredLoadingSpinner, {});
|
|
7921
|
-
const productSelections =
|
|
7835
|
+
const productSelections = productSelectionsFetcher.productSelections?.results ?? [];
|
|
7922
7836
|
const filteredProductSelections = _filterInstanceProperty__default["default"](productSelections).call(productSelections, ps => {
|
|
7923
|
-
var
|
|
7924
|
-
return !_includesInstanceProperty__default["default"](
|
|
7837
|
+
var _context;
|
|
7838
|
+
return !_includesInstanceProperty__default["default"](_context = props.excludedProductSelectionIds).call(_context, ps.id);
|
|
7925
7839
|
});
|
|
7926
7840
|
const onOptionClick = event => {
|
|
7927
7841
|
const productSelectionId = event.target.value;
|
|
@@ -7970,7 +7884,7 @@ const getValueFromOptions$3 = _ref => {
|
|
|
7970
7884
|
// handle async-select-field value transformation
|
|
7971
7885
|
if (isMulti) {
|
|
7972
7886
|
var _context;
|
|
7973
|
-
return _mapInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](allProductSelectionOptions).call(allProductSelectionOptions, ps => currentlySelectedProductSelections
|
|
7887
|
+
return _mapInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](allProductSelectionOptions).call(allProductSelectionOptions, ps => currentlySelectedProductSelections?.includes(ps.value))).call(_context, ps => addModeToLabel(ps, enableExcludingProducts));
|
|
7974
7888
|
}
|
|
7975
7889
|
|
|
7976
7890
|
// in case it is not multiselect, then a single valued async-select-input is being requested and the value should have proper format
|
|
@@ -7982,7 +7896,6 @@ const emptyStoreOption$1 = intl => [{
|
|
|
7982
7896
|
isDisabled: true
|
|
7983
7897
|
}];
|
|
7984
7898
|
function ProductSelectionsAsyncSelectDropdown(props) {
|
|
7985
|
-
var _productSelectionsFet3;
|
|
7986
7899
|
const intl = reactIntl.useIntl();
|
|
7987
7900
|
const enableExcludingProducts = applicationShell.useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
7988
7901
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -7995,17 +7908,13 @@ function ProductSelectionsAsyncSelectDropdown(props) {
|
|
|
7995
7908
|
})),
|
|
7996
7909
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
7997
7910
|
dataLocale = _useApplicationContex.dataLocale;
|
|
7998
|
-
const productSelections = React.useMemo(() =>
|
|
7999
|
-
var _productSelectionsFet, _productSelectionsFet2;
|
|
8000
|
-
return (_productSelectionsFet = (_productSelectionsFet2 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet2 === void 0 ? void 0 : _productSelectionsFet2.results) !== null && _productSelectionsFet !== void 0 ? _productSelectionsFet : [];
|
|
8001
|
-
}, [(_productSelectionsFet3 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet3 === void 0 ? void 0 : _productSelectionsFet3.results]);
|
|
7911
|
+
const productSelections = React.useMemo(() => productSelectionsFetcher.productSelections?.results ?? [], [productSelectionsFetcher.productSelections?.results]);
|
|
8002
7912
|
const filteredProductSelections = _filterInstanceProperty__default["default"](productSelections).call(productSelections, ps => {
|
|
8003
7913
|
var _context2;
|
|
8004
7914
|
return !_includesInstanceProperty__default["default"](_context2 = props.excludedProductSelectionIds).call(_context2, ps.id);
|
|
8005
7915
|
});
|
|
8006
7916
|
const onOptionClick = event => {
|
|
8007
|
-
|
|
8008
|
-
const productSelectionId = (_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.value;
|
|
7917
|
+
const productSelectionId = event.target.value?.value;
|
|
8009
7918
|
const currentProductSelection = _findInstanceProperty__default["default"](productSelections).call(productSelections, productSelection => productSelection.id === productSelectionId);
|
|
8010
7919
|
props.onChange(currentProductSelection);
|
|
8011
7920
|
};
|
|
@@ -8077,15 +7986,11 @@ function ProductSelectionsAsyncSelectDropdown(props) {
|
|
|
8077
7986
|
}
|
|
8078
7987
|
|
|
8079
7988
|
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 } } } };
|
|
8080
|
-
const createQueryVariables$4 = (productSelections, predicateField) => {
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
limit: 500
|
|
8085
|
-
};
|
|
8086
|
-
};
|
|
7989
|
+
const createQueryVariables$4 = (productSelections, predicateField) => ({
|
|
7990
|
+
where: `${predicateField} in (${_mapInstanceProperty__default["default"](productSelections).call(productSelections, ps => `"${ps}"`).join(', ')})`,
|
|
7991
|
+
limit: 500
|
|
7992
|
+
});
|
|
8087
7993
|
const useProductSelectionsByFieldFetcher = (productSelections, predicateField) => {
|
|
8088
|
-
var _productSelectionsQue, _productSelectionsQue2;
|
|
8089
7994
|
const productSelectionList = _Array$isArray__default["default"](productSelections) ? productSelections : [productSelections];
|
|
8090
7995
|
const productSelectionsQuery = react.useQuery(ProductSelectionsPickerFetcher$1, {
|
|
8091
7996
|
context: {
|
|
@@ -8095,7 +8000,7 @@ const useProductSelectionsByFieldFetcher = (productSelections, predicateField) =
|
|
|
8095
8000
|
skip: productSelectionList.length === 0
|
|
8096
8001
|
});
|
|
8097
8002
|
return {
|
|
8098
|
-
productSelections:
|
|
8003
|
+
productSelections: productSelectionsQuery.data?.productSelections.results ?? [],
|
|
8099
8004
|
isLoading: productSelectionsQuery.loading
|
|
8100
8005
|
};
|
|
8101
8006
|
};
|
|
@@ -8136,8 +8041,8 @@ const createQueryVariables$3 = _ref3 => {
|
|
|
8136
8041
|
var _context;
|
|
8137
8042
|
let searchText = _ref3.searchText;
|
|
8138
8043
|
const sanitizedSearchText = sanitize(_trimInstanceProperty__default["default"](searchText).call(searchText, searchText));
|
|
8139
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
8140
|
-
const keyQuery =
|
|
8044
|
+
const idQuery = isUUID(sanitizedSearchText) && `id = "${sanitizedSearchText}"`;
|
|
8045
|
+
const keyQuery = `key = "${sanitizedSearchText}"`;
|
|
8141
8046
|
const searchTextQuery = _filterInstanceProperty__default["default"](_context = [idQuery, keyQuery]).call(_context, Boolean).join(' or ');
|
|
8142
8047
|
return {
|
|
8143
8048
|
where: searchTextQuery || undefined
|
|
@@ -8160,7 +8065,6 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8160
8065
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8161
8066
|
const productSelectionsByFieldFetcher = useProductSelectionsByFieldFetcher(props.value, props.renderSelectInputOptionValuesByField);
|
|
8162
8067
|
const handleLoadOptions = async searchText => {
|
|
8163
|
-
var _data$productSelectio, _data$productSelectio2;
|
|
8164
8068
|
const _await$client$query = await client$1.query({
|
|
8165
8069
|
query: ProductSelectionsPickerFetcher,
|
|
8166
8070
|
variables: createQueryVariables$3({
|
|
@@ -8172,7 +8076,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8172
8076
|
fetchPolicy: 'network-only'
|
|
8173
8077
|
}),
|
|
8174
8078
|
data = _await$client$query.data;
|
|
8175
|
-
const matchedProductSelections =
|
|
8079
|
+
const matchedProductSelections = data?.productSelections?.results ?? [];
|
|
8176
8080
|
const updatedProductSelections = _mapInstanceProperty__default["default"](matchedProductSelections).call(matchedProductSelections, convertProductSelectionFromGraphQl);
|
|
8177
8081
|
const filteredProductSelections = _filterInstanceProperty__default["default"](updatedProductSelections).call(updatedProductSelections, ps => {
|
|
8178
8082
|
var _context2;
|
|
@@ -8188,8 +8092,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8188
8092
|
};
|
|
8189
8093
|
const loadOptionsDebounced = debounce__default["default"](handleLoadOptions, 500);
|
|
8190
8094
|
const onOptionClick = event => {
|
|
8191
|
-
|
|
8192
|
-
const productSelectionId = (_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.value;
|
|
8095
|
+
const productSelectionId = event.target.value?.value;
|
|
8193
8096
|
const currentProductSelection = _findInstanceProperty__default["default"](productionSelectionResults).call(productionSelectionResults, productSelection => productSelection.id === productSelectionId);
|
|
8194
8097
|
props.onChange(currentProductSelection);
|
|
8195
8098
|
};
|
|
@@ -8237,11 +8140,11 @@ function ModeSelectInputOption(props) {
|
|
|
8237
8140
|
scale: "xs",
|
|
8238
8141
|
children: [jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
8239
8142
|
isBold: true,
|
|
8240
|
-
children:
|
|
8143
|
+
children: data?.label || noValueFallback
|
|
8241
8144
|
}), jsxRuntime.jsxs(uiKit.Text.Detail, {
|
|
8242
|
-
children: ["Key: ",
|
|
8145
|
+
children: ["Key: ", data?.key || noValueFallback]
|
|
8243
8146
|
}), jsxRuntime.jsxs(uiKit.Text.Detail, {
|
|
8244
|
-
children: ["Type: ",
|
|
8147
|
+
children: ["Type: ", data?.mode || noValueFallback]
|
|
8245
8148
|
})]
|
|
8246
8149
|
})
|
|
8247
8150
|
}));
|
|
@@ -8342,8 +8245,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8342
8245
|
var _context2;
|
|
8343
8246
|
const intl = reactIntl.useIntl();
|
|
8344
8247
|
const handleLoadOptions = async searchTerm => {
|
|
8345
|
-
|
|
8346
|
-
const filteredOptions = (_props$options = props.options) === null || _props$options === void 0 ? void 0 : _filterInstanceProperty__default["default"](_props$options).call(_props$options, country => {
|
|
8248
|
+
const filteredOptions = props.options?.filter(country => {
|
|
8347
8249
|
var _context;
|
|
8348
8250
|
return _includesInstanceProperty__default["default"](_context = country.label.toLowerCase()).call(_context, searchTerm.toLowerCase());
|
|
8349
8251
|
});
|
|
@@ -8351,7 +8253,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8351
8253
|
return _sliceInstanceProperty__default["default"](filteredOptions).call(filteredOptions, 0, props.countriesAsyncLoadingLimit);
|
|
8352
8254
|
}
|
|
8353
8255
|
return [{
|
|
8354
|
-
options:
|
|
8256
|
+
options: props.options?.slice(0, props.countriesAsyncLoadingLimit)
|
|
8355
8257
|
}, {
|
|
8356
8258
|
options: emptyCountryOption(intl)
|
|
8357
8259
|
}];
|
|
@@ -8360,10 +8262,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8360
8262
|
const countries = event.target.value;
|
|
8361
8263
|
props.onChange({
|
|
8362
8264
|
target: _objectSpread$F(_objectSpread$F({}, event.target), {}, {
|
|
8363
|
-
value: _mapInstanceProperty__default["default"](countries).call(countries, country =>
|
|
8364
|
-
var _country$value;
|
|
8365
|
-
return (_country$value = country === null || country === void 0 ? void 0 : country.value) !== null && _country$value !== void 0 ? _country$value : country;
|
|
8366
|
-
})
|
|
8265
|
+
value: _mapInstanceProperty__default["default"](countries).call(countries, country => country?.value ?? country)
|
|
8367
8266
|
})
|
|
8368
8267
|
});
|
|
8369
8268
|
};
|
|
@@ -8393,8 +8292,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8393
8292
|
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; }
|
|
8394
8293
|
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; }
|
|
8395
8294
|
function CountriesPicker(props) {
|
|
8396
|
-
|
|
8397
|
-
const CustomCountriesPicker = ((_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.length) <= props.countriesAsyncLoadingLimit ? CountriesBasicSelectDropdown : CountriesAsyncSelectDropdown;
|
|
8295
|
+
const CustomCountriesPicker = props.options?.length <= props.countriesAsyncLoadingLimit ? CountriesBasicSelectDropdown : CountriesAsyncSelectDropdown;
|
|
8398
8296
|
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
8399
8297
|
children: jsxRuntime.jsx(CustomCountriesPicker, _objectSpread$E({}, props))
|
|
8400
8298
|
});
|
|
@@ -8423,7 +8321,6 @@ var GetCustomerGroupsQuery = { kind: "Document", definitions: [{ kind: "Operatio
|
|
|
8423
8321
|
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 } } } };
|
|
8424
8322
|
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 } } } };
|
|
8425
8323
|
const CustomerGroupPickerInput = _ref => {
|
|
8426
|
-
var _currentOption$data$l, _currentOption$data;
|
|
8427
8324
|
let isClearable = _ref.isClearable,
|
|
8428
8325
|
isDisabled = _ref.isDisabled,
|
|
8429
8326
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -8492,13 +8389,13 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
8492
8389
|
setLoadingError(null);
|
|
8493
8390
|
handleInternalInputChange(event);
|
|
8494
8391
|
}, [handleInternalInputChange]);
|
|
8495
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
8392
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
8496
8393
|
React.useEffect(() => {
|
|
8497
8394
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
8498
8395
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
8499
8396
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
8500
8397
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$t.noCustomerGroupsFound), [loadingError, formatMessage]);
|
|
8501
|
-
const tooltipTitle =
|
|
8398
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
8502
8399
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
8503
8400
|
max: "scale",
|
|
8504
8401
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -8508,7 +8405,7 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
8508
8405
|
children: jsxRuntime.jsx(uiKit.AsyncSelectInput, {
|
|
8509
8406
|
id: name,
|
|
8510
8407
|
name: name,
|
|
8511
|
-
placeholder: placeholder
|
|
8408
|
+
placeholder: placeholder ?? formatMessage(messages$t.placeholder),
|
|
8512
8409
|
loadOptions: loadOptionsDebounced,
|
|
8513
8410
|
defaultOptions: true,
|
|
8514
8411
|
showOptionGroupDivider: true,
|
|
@@ -8537,12 +8434,11 @@ CustomerGroupPickerInput.displayName = 'CustomerGroupPickerInput';
|
|
|
8537
8434
|
const DEFAULT_LENGTH = 50;
|
|
8538
8435
|
const DEFAULT_END = '...';
|
|
8539
8436
|
function truncate (text) {
|
|
8540
|
-
var _context;
|
|
8541
8437
|
let length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_LENGTH;
|
|
8542
8438
|
let end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_END;
|
|
8543
8439
|
if (!text) return '';
|
|
8544
8440
|
if (text.length < length) return text;
|
|
8545
|
-
return
|
|
8441
|
+
return `${text.substring(0, length)}${end}`;
|
|
8546
8442
|
}
|
|
8547
8443
|
|
|
8548
8444
|
const LOWER_STORES_LIMIT = 60;
|
|
@@ -8550,7 +8446,6 @@ const UPPER_STORES_LIMIT = 500;
|
|
|
8550
8446
|
|
|
8551
8447
|
// map store to options
|
|
8552
8448
|
const mapStoresToOptions = _ref => {
|
|
8553
|
-
var _store$productSelecti;
|
|
8554
8449
|
let store = _ref.store,
|
|
8555
8450
|
renderSelectInputOptionValuesByField = _ref.renderSelectInputOptionValuesByField,
|
|
8556
8451
|
dataLocale = _ref.dataLocale;
|
|
@@ -8561,14 +8456,14 @@ const mapStoresToOptions = _ref => {
|
|
|
8561
8456
|
const localizedName = l10n.formatLocalizedString(convertedStore, {
|
|
8562
8457
|
key: 'name',
|
|
8563
8458
|
locale: dataLocale,
|
|
8564
|
-
fallback:
|
|
8459
|
+
fallback: `${store.key} (key)`
|
|
8565
8460
|
});
|
|
8566
8461
|
return {
|
|
8567
8462
|
label: localizedName,
|
|
8568
8463
|
value: renderSelectInputOptionValuesByField === 'key' ? store.key : store.id,
|
|
8569
8464
|
key: store.key,
|
|
8570
8465
|
id: store.id,
|
|
8571
|
-
productSelections:
|
|
8466
|
+
productSelections: store.productSelections?.map(productSelectionRef => productSelectionRef.productSelection.id)
|
|
8572
8467
|
};
|
|
8573
8468
|
};
|
|
8574
8469
|
|
|
@@ -8630,7 +8525,7 @@ const getValueFromOptions$1 = _ref => {
|
|
|
8630
8525
|
isMulti = _ref.isMulti;
|
|
8631
8526
|
// handle async-select-field value transformation
|
|
8632
8527
|
if (isMulti) {
|
|
8633
|
-
return _filterInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores
|
|
8528
|
+
return _filterInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores?.includes(store.value));
|
|
8634
8529
|
}
|
|
8635
8530
|
|
|
8636
8531
|
// return value as undefined if no options is yet selected. It is needed for cases where users sets initial values as empty string
|
|
@@ -8659,13 +8554,13 @@ const StoresAsyncSelectInput = props => {
|
|
|
8659
8554
|
sort: 'createdAt asc',
|
|
8660
8555
|
excludeExtendedStoresList: true,
|
|
8661
8556
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8662
|
-
stores:
|
|
8557
|
+
stores: keysOfStores?.length && keysOfStores,
|
|
8663
8558
|
projectKey: props.projectKey
|
|
8664
8559
|
});
|
|
8665
8560
|
const hasError = uiKit.AsyncSelectInput.isTouched(props.touched) && hasErrors$2(props.errors) || props.hasError;
|
|
8666
8561
|
const mappedStoresListOptions = React.useMemo(() => {
|
|
8667
|
-
var _context2
|
|
8668
|
-
return _mapInstanceProperty__default["default"](_context2 =
|
|
8562
|
+
var _context2;
|
|
8563
|
+
return _mapInstanceProperty__default["default"](_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8669
8564
|
store,
|
|
8670
8565
|
dataLocale,
|
|
8671
8566
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -8751,21 +8646,20 @@ const StoresBasicSelectInput = props => {
|
|
|
8751
8646
|
sort: 'createdAt asc',
|
|
8752
8647
|
excludeExtendedStoresList: true,
|
|
8753
8648
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8754
|
-
stores:
|
|
8649
|
+
stores: keysOfStores?.length && keysOfStores,
|
|
8755
8650
|
projectKey: props.projectKey
|
|
8756
8651
|
});
|
|
8757
8652
|
const hasError = uiKit.SelectInput.isTouched(props.touched) && hasErrors$1(props.errors) || props.hasError;
|
|
8758
8653
|
const mappedStoresListOptions = React.useMemo(() => {
|
|
8759
|
-
var _context2
|
|
8760
|
-
return _mapInstanceProperty__default["default"](_context2 =
|
|
8654
|
+
var _context2;
|
|
8655
|
+
return _mapInstanceProperty__default["default"](_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8761
8656
|
store,
|
|
8762
8657
|
dataLocale,
|
|
8763
8658
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
8764
8659
|
}));
|
|
8765
8660
|
}, [dataLocale, storesListFetcher.stores, props.renderSelectInputOptionValuesByField]);
|
|
8766
8661
|
const handleChange = event => {
|
|
8767
|
-
|
|
8768
|
-
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;
|
|
8662
|
+
const value = event.target.value?.value ?? event.target.value;
|
|
8769
8663
|
const currentStore = _findInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => store.value === value);
|
|
8770
8664
|
|
|
8771
8665
|
// We need complete store info including productSelections
|
|
@@ -8820,7 +8714,6 @@ StoresBasicSelectInput.defaultProps = {
|
|
|
8820
8714
|
|
|
8821
8715
|
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 } } } };
|
|
8822
8716
|
const useTotalNumberOfStoresFetcher = projectKey => {
|
|
8823
|
-
var _totalNumberOfStoresQ;
|
|
8824
8717
|
const totalNumberOfStoresQuery = react.useQuery(TotalNumberOfStores, {
|
|
8825
8718
|
context: {
|
|
8826
8719
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM,
|
|
@@ -8829,7 +8722,7 @@ const useTotalNumberOfStoresFetcher = projectKey => {
|
|
|
8829
8722
|
fetchPolicy: 'network-only'
|
|
8830
8723
|
});
|
|
8831
8724
|
return {
|
|
8832
|
-
total:
|
|
8725
|
+
total: totalNumberOfStoresQuery.data?.totalNumberOfStores.total,
|
|
8833
8726
|
isLoading: totalNumberOfStoresQuery.loading
|
|
8834
8727
|
};
|
|
8835
8728
|
};
|
|
@@ -8847,19 +8740,15 @@ const handlers$1 = {
|
|
|
8847
8740
|
};
|
|
8848
8741
|
|
|
8849
8742
|
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 } } } };
|
|
8850
|
-
const createQueryVariables$2 = (stores, predicateField, shouldFetchProductSelections) => {
|
|
8851
|
-
|
|
8852
|
-
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
excludeProductSelections: !shouldFetchProductSelections
|
|
8856
|
-
};
|
|
8857
|
-
};
|
|
8743
|
+
const createQueryVariables$2 = (stores, predicateField, shouldFetchProductSelections) => ({
|
|
8744
|
+
where: `${predicateField} in (${_mapInstanceProperty__default["default"](stores).call(stores, store => `"${store}"`).join(', ')})`,
|
|
8745
|
+
limit: 500,
|
|
8746
|
+
excludeProductSelections: !shouldFetchProductSelections
|
|
8747
|
+
});
|
|
8858
8748
|
const emptyStoresQueryResult = {
|
|
8859
8749
|
results: []
|
|
8860
8750
|
};
|
|
8861
8751
|
const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
8862
|
-
var _storesQuery$data;
|
|
8863
8752
|
let shouldFetchProductSelections = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
8864
8753
|
// incase of single select input stores are sent as single string literal
|
|
8865
8754
|
const storesList = _Array$isArray__default["default"](stores) ? stores : [stores];
|
|
@@ -8872,29 +8761,29 @@ const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
|
8872
8761
|
skip: storesList.length === 0
|
|
8873
8762
|
});
|
|
8874
8763
|
return {
|
|
8875
|
-
stores:
|
|
8764
|
+
stores: storesQuery.data?.storesByField || emptyStoresQueryResult,
|
|
8876
8765
|
isLoading: storesQuery.loading
|
|
8877
8766
|
};
|
|
8878
8767
|
};
|
|
8879
8768
|
|
|
8880
8769
|
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; }
|
|
8881
|
-
function _objectSpread$B(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
8770
|
+
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; }
|
|
8882
8771
|
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 } } } };
|
|
8883
8772
|
const hasErrors = errors => {
|
|
8884
8773
|
var _context;
|
|
8885
8774
|
return errors && _someInstanceProperty__default["default"](_context = _Object$values__default["default"](errors)).call(_context, Boolean);
|
|
8886
8775
|
};
|
|
8887
8776
|
const createQueryVariables$1 = _ref => {
|
|
8888
|
-
var _context2
|
|
8777
|
+
var _context2;
|
|
8889
8778
|
let searchText = _ref.searchText,
|
|
8890
8779
|
dataLocale = _ref.dataLocale,
|
|
8891
8780
|
allAccessibleStoreKeysThroughDataFencePermissions = _ref.allAccessibleStoreKeysThroughDataFencePermissions,
|
|
8892
8781
|
shouldFetchProductSelections = _ref.shouldFetchProductSelections;
|
|
8893
8782
|
const sanitizedSearchText = sanitize(_trimInstanceProperty__default["default"](searchText).call(searchText, searchText));
|
|
8894
|
-
const keyQuery =
|
|
8783
|
+
const keyQuery = `key = "${sanitizedSearchText}"`;
|
|
8895
8784
|
|
|
8896
8785
|
// if the user has data fence permissions then we only allow stores to fetched that user has access to
|
|
8897
|
-
if (allAccessibleStoreKeysThroughDataFencePermissions
|
|
8786
|
+
if (allAccessibleStoreKeysThroughDataFencePermissions?.length) {
|
|
8898
8787
|
// if the current search term match the accessible stores keys, then proceed with fetching the store
|
|
8899
8788
|
if (_includesInstanceProperty__default["default"](allAccessibleStoreKeysThroughDataFencePermissions).call(allAccessibleStoreKeysThroughDataFencePermissions, sanitizedSearchText)) {
|
|
8900
8789
|
return {
|
|
@@ -8910,9 +8799,9 @@ const createQueryVariables$1 = _ref => {
|
|
|
8910
8799
|
excludeProductSelections: !shouldFetchProductSelections
|
|
8911
8800
|
};
|
|
8912
8801
|
}
|
|
8913
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
8914
|
-
const nameQuery =
|
|
8915
|
-
const searchTextQuery = _filterInstanceProperty__default["default"](
|
|
8802
|
+
const idQuery = isUUID(sanitizedSearchText) && `id = "${sanitizedSearchText}"`;
|
|
8803
|
+
const nameQuery = `name(${dataLocale} = "${sanitizedSearchText}")`;
|
|
8804
|
+
const searchTextQuery = _filterInstanceProperty__default["default"](_context2 = [idQuery, nameQuery, keyQuery]).call(_context2, Boolean).join(' or ');
|
|
8916
8805
|
return {
|
|
8917
8806
|
skipFetchingStores: false,
|
|
8918
8807
|
where: searchTextQuery,
|
|
@@ -8920,7 +8809,6 @@ const createQueryVariables$1 = _ref => {
|
|
|
8920
8809
|
};
|
|
8921
8810
|
};
|
|
8922
8811
|
const getValueFromOptions = _ref2 => {
|
|
8923
|
-
var _storesByFieldFetcher, _context4;
|
|
8924
8812
|
let isMulti = _ref2.isMulti,
|
|
8925
8813
|
value = _ref2.value,
|
|
8926
8814
|
dataLocale = _ref2.dataLocale,
|
|
@@ -8929,7 +8817,7 @@ const getValueFromOptions = _ref2 => {
|
|
|
8929
8817
|
if (!value) {
|
|
8930
8818
|
return undefined;
|
|
8931
8819
|
}
|
|
8932
|
-
const selectedOptions =
|
|
8820
|
+
const selectedOptions = storesByFieldFetcher.stores?.results.map(store => mapStoresToOptions({
|
|
8933
8821
|
store,
|
|
8934
8822
|
dataLocale,
|
|
8935
8823
|
renderSelectInputOptionValuesByField: renderSelectInputOptionValuesByField
|
|
@@ -8967,9 +8855,8 @@ const StoresSearchSelectInput = props => {
|
|
|
8967
8855
|
},
|
|
8968
8856
|
fetchPolicy: 'network-only'
|
|
8969
8857
|
}).then(_ref3 => {
|
|
8970
|
-
var _data$storesByWherePr, _context5;
|
|
8971
8858
|
let data = _ref3.data;
|
|
8972
|
-
return
|
|
8859
|
+
return data.storesByWherePredicate?.results.map(store => mapStoresToOptions({
|
|
8973
8860
|
store,
|
|
8974
8861
|
dataLocale,
|
|
8975
8862
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -9149,14 +9036,14 @@ var messages$r = reactIntl.defineMessages({
|
|
|
9149
9036
|
|
|
9150
9037
|
function formatDiscount(discount, currencyCode, intl) {
|
|
9151
9038
|
var _context;
|
|
9152
|
-
if (discount.type === 'relative') return
|
|
9039
|
+
if (discount.type === 'relative') return `${discount.permyriad / 100}%`;
|
|
9153
9040
|
if (!discount.money) return null;
|
|
9154
9041
|
const moneyForCurrencyCode = _findInstanceProperty__default["default"](_context = discount.money).call(_context, discountMoney => discountMoney.currencyCode === currencyCode);
|
|
9155
9042
|
return moneyForCurrencyCode ? formatMoney$2(moneyForCurrencyCode, intl) : null;
|
|
9156
9043
|
}
|
|
9157
9044
|
|
|
9158
9045
|
function formatPercentage(percentage) {
|
|
9159
|
-
return
|
|
9046
|
+
return `${percentage}%`;
|
|
9160
9047
|
}
|
|
9161
9048
|
function convertRatioToPercentage(ratio) {
|
|
9162
9049
|
return _parseFloat__default["default"]((ratio * 100).toFixed(2));
|
|
@@ -9210,8 +9097,8 @@ function validateFilter$2(_ref, intl) {
|
|
|
9210
9097
|
};
|
|
9211
9098
|
}
|
|
9212
9099
|
if (value.option === FILTER_TYPES.range) {
|
|
9213
|
-
const from = validateValue(filterValue
|
|
9214
|
-
const to = from ? null : validateValue(filterValue
|
|
9100
|
+
const from = validateValue(filterValue?.from, typeName, intl);
|
|
9101
|
+
const to = from ? null : validateValue(filterValue?.to, typeName, intl);
|
|
9215
9102
|
return from || to ? {
|
|
9216
9103
|
input: {
|
|
9217
9104
|
from,
|
|
@@ -9248,16 +9135,16 @@ function validateFilter$1(_ref, intl) {
|
|
|
9248
9135
|
type = _ref.type;
|
|
9249
9136
|
if (type === 'range') {
|
|
9250
9137
|
if (validateSingleFilter({
|
|
9251
|
-
value: value
|
|
9138
|
+
value: value?.from
|
|
9252
9139
|
})) return {
|
|
9253
9140
|
from: intl.formatMessage(messages$p.rangeMissingValue)
|
|
9254
9141
|
};
|
|
9255
9142
|
if (validateSingleFilter({
|
|
9256
|
-
value: value
|
|
9143
|
+
value: value?.to
|
|
9257
9144
|
})) return {
|
|
9258
9145
|
to: intl.formatMessage(messages$p.rangeMissingValue)
|
|
9259
9146
|
};
|
|
9260
|
-
if (moment__default$1["default"](value
|
|
9147
|
+
if (moment__default$1["default"](value?.to).isBefore(value?.from)) return {
|
|
9261
9148
|
from: intl.formatMessage(messages$p.rangeToSmallerThanFrom)
|
|
9262
9149
|
};
|
|
9263
9150
|
} else if (type === 'equalTo' || type === 'lessThan' || type === 'moreThan') {
|
|
@@ -9327,10 +9214,8 @@ function isEmptyFilter(_ref) {
|
|
|
9327
9214
|
}
|
|
9328
9215
|
|
|
9329
9216
|
function numberTransformer(filterKey, filters) {
|
|
9330
|
-
var _context3;
|
|
9331
9217
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$2;
|
|
9332
9218
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
9333
|
-
var _context, _context2;
|
|
9334
9219
|
let type = _ref.type,
|
|
9335
9220
|
value = _ref.value;
|
|
9336
9221
|
if (!filterValidator({
|
|
@@ -9339,19 +9224,19 @@ function numberTransformer(filterKey, filters) {
|
|
|
9339
9224
|
})) return '';
|
|
9340
9225
|
switch (type) {
|
|
9341
9226
|
case 'lessThan':
|
|
9342
|
-
return
|
|
9227
|
+
return `(* to ${value - 1})`;
|
|
9343
9228
|
case 'moreThan':
|
|
9344
|
-
return
|
|
9229
|
+
return `(${value + 1} to *)`;
|
|
9345
9230
|
case 'equalTo':
|
|
9346
|
-
return
|
|
9231
|
+
return `(${value} to ${value})`;
|
|
9347
9232
|
case 'range':
|
|
9348
|
-
return
|
|
9233
|
+
return `(${value.from} to ${value.to})`;
|
|
9349
9234
|
default:
|
|
9350
9235
|
return '';
|
|
9351
9236
|
}
|
|
9352
9237
|
});
|
|
9353
9238
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
9354
|
-
return queryString === '' ? null :
|
|
9239
|
+
return queryString === '' ? null : `${filterKey}: range${queryString}`;
|
|
9355
9240
|
}
|
|
9356
9241
|
function isFilterValid$2(_ref2) {
|
|
9357
9242
|
let type = _ref2.type,
|
|
@@ -9378,11 +9263,9 @@ function graphqlCategoryLevelTransformer(filterKey, filters, filterValidator) {
|
|
|
9378
9263
|
return _filterInstanceProperty__default["default"](_context = [levelFilterQuery, lastLevelFilterQuery]).call(_context, Boolean);
|
|
9379
9264
|
}
|
|
9380
9265
|
|
|
9381
|
-
var _templateObject$1, _templateObject2;
|
|
9382
9266
|
const dateFormatDayStart = 'YYYY-MM-DDT00:00:00.000Z';
|
|
9383
9267
|
const dateFormatDayEnd = 'YYYY-MM-DDT23:59:59.999Z';
|
|
9384
9268
|
function dateTransformer(filterKey, filters) {
|
|
9385
|
-
var _context;
|
|
9386
9269
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$1;
|
|
9387
9270
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
9388
9271
|
let type = _ref.type,
|
|
@@ -9393,19 +9276,25 @@ function dateTransformer(filterKey, filters) {
|
|
|
9393
9276
|
})) return '';
|
|
9394
9277
|
switch (type) {
|
|
9395
9278
|
case 'lessThan':
|
|
9396
|
-
return
|
|
9279
|
+
return `(* to "${moment__default$1["default"](value).format(dateFormatDayStart)}")`;
|
|
9397
9280
|
case 'moreThan':
|
|
9398
|
-
return
|
|
9281
|
+
return `("${moment__default$1["default"](value).format(dateFormatDayEnd)}" to *)`;
|
|
9399
9282
|
case 'equalTo':
|
|
9400
|
-
return oneLine__default["default"]
|
|
9283
|
+
return oneLine__default["default"]`
|
|
9284
|
+
("${moment__default$1["default"](value).format(dateFormatDayStart)}"
|
|
9285
|
+
to "${moment__default$1["default"](value).format(dateFormatDayEnd)}")
|
|
9286
|
+
`;
|
|
9401
9287
|
case 'range':
|
|
9402
|
-
return oneLine__default["default"]
|
|
9288
|
+
return oneLine__default["default"]`
|
|
9289
|
+
("${moment__default$1["default"](value.from).format(dateFormatDayStart)}"
|
|
9290
|
+
to "${moment__default$1["default"](value.to).format(dateFormatDayEnd)}")
|
|
9291
|
+
`;
|
|
9403
9292
|
default:
|
|
9404
9293
|
return '';
|
|
9405
9294
|
}
|
|
9406
9295
|
});
|
|
9407
9296
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
9408
|
-
return queryString === '' ? null :
|
|
9297
|
+
return queryString === '' ? null : `${filterKey}: range${queryString}`;
|
|
9409
9298
|
}
|
|
9410
9299
|
function isFilterValid$1(_ref2) {
|
|
9411
9300
|
let type = _ref2.type,
|
|
@@ -9420,19 +9309,18 @@ function isFilterValid$1(_ref2) {
|
|
|
9420
9309
|
}
|
|
9421
9310
|
|
|
9422
9311
|
function missingLocaleTransformer(filterKey, filters) {
|
|
9423
|
-
var _context;
|
|
9424
9312
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
9425
9313
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
9426
9314
|
if (filters.length === 0) return null;
|
|
9427
9315
|
const missingLocale = filters[0].value.value;
|
|
9428
|
-
return
|
|
9316
|
+
return `${filterKey}.${missingLocale}:missing`;
|
|
9429
9317
|
}
|
|
9430
9318
|
|
|
9431
9319
|
function missingTransformer(filterKey, filters) {
|
|
9432
9320
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
9433
9321
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
9434
9322
|
if (filters.length === 0) return null;
|
|
9435
|
-
return
|
|
9323
|
+
return `${filterKey}:missing`;
|
|
9436
9324
|
}
|
|
9437
9325
|
|
|
9438
9326
|
/**
|
|
@@ -9473,7 +9361,6 @@ function graphqlQueryBuilder(_ref) {
|
|
|
9473
9361
|
}
|
|
9474
9362
|
|
|
9475
9363
|
function referenceTransformer(filterKey, filters) {
|
|
9476
|
-
var _context;
|
|
9477
9364
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid;
|
|
9478
9365
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
9479
9366
|
let type = _ref.type,
|
|
@@ -9484,49 +9371,46 @@ function referenceTransformer(filterKey, filters) {
|
|
|
9484
9371
|
})) return '';
|
|
9485
9372
|
switch (type) {
|
|
9486
9373
|
case 'equalTo':
|
|
9487
|
-
return "
|
|
9374
|
+
return `"${value}"`;
|
|
9488
9375
|
default:
|
|
9489
9376
|
return '';
|
|
9490
9377
|
}
|
|
9491
9378
|
});
|
|
9492
9379
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
9493
|
-
return queryString === '' ? null :
|
|
9380
|
+
return queryString === '' ? null : `${filterKey}.id: ${queryString}`;
|
|
9494
9381
|
}
|
|
9495
9382
|
function isFilterValid(_ref2) {
|
|
9496
|
-
var
|
|
9383
|
+
var _context;
|
|
9497
9384
|
let type = _ref2.type,
|
|
9498
9385
|
value = _ref2.value;
|
|
9499
|
-
if (type === 'equalTo' && !_includesInstanceProperty__default["default"](
|
|
9386
|
+
if (type === 'equalTo' && !_includesInstanceProperty__default["default"](_context = [null, undefined, '']).call(_context, value)) return true;
|
|
9500
9387
|
return false;
|
|
9501
9388
|
}
|
|
9502
9389
|
|
|
9503
9390
|
function textTransformer(filterKey, queries) {
|
|
9504
|
-
var _context;
|
|
9505
9391
|
if (queries.length === 0) return null;
|
|
9506
9392
|
|
|
9507
9393
|
// Note: we assume for now that there can only be 1 text filter.
|
|
9508
9394
|
const queryValue = queries[0].value;
|
|
9509
|
-
return queryValue ?
|
|
9395
|
+
return queryValue ? `${filterKey}:"${queryValue}"` : null;
|
|
9510
9396
|
}
|
|
9511
9397
|
|
|
9512
9398
|
const composeNumberPredicateFromFilter = (target, value, option) => {
|
|
9513
|
-
var _context, _context2, _context3, _context4, _context5, _context6;
|
|
9514
9399
|
switch (option) {
|
|
9515
9400
|
case FILTER_TYPES.lessThan:
|
|
9516
|
-
return
|
|
9401
|
+
return `${target} < ${value}`;
|
|
9517
9402
|
case FILTER_TYPES.moreThan:
|
|
9518
|
-
return
|
|
9403
|
+
return `${target} > ${value}`;
|
|
9519
9404
|
case FILTER_TYPES.equalTo:
|
|
9520
|
-
return
|
|
9405
|
+
return `${target} = ${value}`;
|
|
9521
9406
|
case FILTER_TYPES.range:
|
|
9522
|
-
return
|
|
9407
|
+
return `${target} >= ${value.from} and ${target} <= ${value.to}`;
|
|
9523
9408
|
default:
|
|
9524
9409
|
return '';
|
|
9525
9410
|
}
|
|
9526
9411
|
};
|
|
9527
9412
|
function customFields (filter, locale) {
|
|
9528
9413
|
const customFieldsPredicates = _mapInstanceProperty__default["default"](filter).call(filter, customFieldFilter => {
|
|
9529
|
-
var _context7, _context8, _context9, _context10, _context11;
|
|
9530
9414
|
const _customFieldFilter$va = customFieldFilter.value,
|
|
9531
9415
|
target = _customFieldFilter$va.target,
|
|
9532
9416
|
type = _customFieldFilter$va.type,
|
|
@@ -9534,14 +9418,14 @@ function customFields (filter, locale) {
|
|
|
9534
9418
|
option = _customFieldFilter$va.option;
|
|
9535
9419
|
switch (type.name) {
|
|
9536
9420
|
case FIELD_TYPES.Boolean:
|
|
9537
|
-
return
|
|
9421
|
+
return `${target} = ${value.value}`;
|
|
9538
9422
|
case FIELD_TYPES.String:
|
|
9539
|
-
return
|
|
9423
|
+
return `${target} = "${value}"`;
|
|
9540
9424
|
case FIELD_TYPES.LocalizedString:
|
|
9541
|
-
return
|
|
9425
|
+
return `${target}(${localizedTextTransformer(value)})`;
|
|
9542
9426
|
case FIELD_TYPES.Enum:
|
|
9543
9427
|
case FIELD_TYPES.LocalizedEnum:
|
|
9544
|
-
return
|
|
9428
|
+
return `${target} = "${value.value}"`;
|
|
9545
9429
|
case FIELD_TYPES.Time:
|
|
9546
9430
|
return timeTransformer(target, [{
|
|
9547
9431
|
type: option,
|
|
@@ -9556,14 +9440,14 @@ function customFields (filter, locale) {
|
|
|
9556
9440
|
case FIELD_TYPES.Number:
|
|
9557
9441
|
return composeNumberPredicateFromFilter(target, value, option);
|
|
9558
9442
|
case FIELD_TYPES.Money:
|
|
9559
|
-
return
|
|
9443
|
+
return `${target}(${moneyTransformer(value, option, locale)})`;
|
|
9560
9444
|
case FIELD_TYPES.Reference:
|
|
9561
9445
|
case FIELD_TYPES.Set:
|
|
9562
9446
|
default:
|
|
9563
9447
|
throw new Error('Custom field type not recognized');
|
|
9564
9448
|
}
|
|
9565
9449
|
});
|
|
9566
|
-
return
|
|
9450
|
+
return `(custom(fields(${customFieldsPredicates.join(' and ')})))`;
|
|
9567
9451
|
}
|
|
9568
9452
|
|
|
9569
9453
|
// https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/btoa#Unicode_strings
|
|
@@ -9608,7 +9492,7 @@ function ownKeys$z(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
9608
9492
|
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; }
|
|
9609
9493
|
const resourcesWithPlatformLimits = _Object$keys__default["default"](RESOURCES_WITH_PLATFORM_LIMITS);
|
|
9610
9494
|
const createQueryVariables = platformLimit => _reduceInstanceProperty__default["default"](resourcesWithPlatformLimits).call(resourcesWithPlatformLimits, (previousIncludedLimits, nextNameOfLimit) => _objectSpread$z({
|
|
9611
|
-
[camelCase__default["default"](
|
|
9495
|
+
[camelCase__default["default"](`should include ${nextNameOfLimit}`)]: platformLimit ? nextNameOfLimit === platformLimit : true
|
|
9612
9496
|
}, previousIncludedLimits), {});
|
|
9613
9497
|
|
|
9614
9498
|
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 } } } };
|
|
@@ -9624,7 +9508,7 @@ const usePlatformLimitsFetcher = platformLimit => {
|
|
|
9624
9508
|
error = _useQuery.error,
|
|
9625
9509
|
data = _useQuery.data,
|
|
9626
9510
|
refetch = _useQuery.refetch;
|
|
9627
|
-
const platformLimits = !loading ? omit__default["default"](data
|
|
9511
|
+
const platformLimits = !loading ? omit__default["default"](data?.limits, '__typename') : {};
|
|
9628
9512
|
return {
|
|
9629
9513
|
isLoading: loading,
|
|
9630
9514
|
error,
|
|
@@ -9815,11 +9699,10 @@ const getPlatformLimitsStatus = _ref3 => {
|
|
|
9815
9699
|
total = _ref3.total,
|
|
9816
9700
|
intl = _ref3.intl;
|
|
9817
9701
|
if (limit) {
|
|
9818
|
-
|
|
9819
|
-
return _concatInstanceProperty__default["default"](_context = "(".concat(intl.formatNumber(current), "/")).call(_context, intl.formatNumber(limit), ")");
|
|
9702
|
+
return `(${intl.formatNumber(current)}/${intl.formatNumber(limit)})`;
|
|
9820
9703
|
}
|
|
9821
9704
|
if (total) {
|
|
9822
|
-
return
|
|
9705
|
+
return `(${intl.formatNumber(total)})`;
|
|
9823
9706
|
}
|
|
9824
9707
|
return '';
|
|
9825
9708
|
};
|
|
@@ -9839,18 +9722,17 @@ const useShippingMethodsPlatformLimitsFetcher = () => {
|
|
|
9839
9722
|
};
|
|
9840
9723
|
|
|
9841
9724
|
const useShippingMethodsPlatformLimits = () => {
|
|
9842
|
-
var _platformLimits$shipp;
|
|
9843
9725
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
9844
9726
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
9845
|
-
if (!
|
|
9727
|
+
if (!platformLimits?.shippingMethods?.total) {
|
|
9846
9728
|
return {
|
|
9847
9729
|
hasReachedShippingMethodsWarningLimit: false,
|
|
9848
9730
|
hasReachedShippingMethodsErrorLimit: false
|
|
9849
9731
|
};
|
|
9850
9732
|
}
|
|
9851
|
-
const _platformLimits$
|
|
9852
|
-
limit = _platformLimits$
|
|
9853
|
-
current = _platformLimits$
|
|
9733
|
+
const _platformLimits$shipp = platformLimits.shippingMethods.total,
|
|
9734
|
+
limit = _platformLimits$shipp.limit,
|
|
9735
|
+
current = _platformLimits$shipp.current;
|
|
9854
9736
|
const hasReachedShippingMethodsWarningLimit = getHasExceededWarningThreshold({
|
|
9855
9737
|
limit,
|
|
9856
9738
|
current
|
|
@@ -9866,13 +9748,12 @@ const useShippingMethodsPlatformLimits = () => {
|
|
|
9866
9748
|
};
|
|
9867
9749
|
|
|
9868
9750
|
const PlatformLimitsShippingMethodsNotifications = () => {
|
|
9869
|
-
var _platformLimits$shipp;
|
|
9870
9751
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
9871
9752
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
9872
9753
|
const _useShippingMethodsPl2 = useShippingMethodsPlatformLimits(),
|
|
9873
9754
|
hasReachedShippingMethodsWarningLimit = _useShippingMethodsPl2.hasReachedShippingMethodsWarningLimit,
|
|
9874
9755
|
hasReachedShippingMethodsErrorLimit = _useShippingMethodsPl2.hasReachedShippingMethodsErrorLimit;
|
|
9875
|
-
if (!
|
|
9756
|
+
if (!platformLimits?.shippingMethods?.total) {
|
|
9876
9757
|
return null;
|
|
9877
9758
|
}
|
|
9878
9759
|
if (hasReachedShippingMethodsErrorLimit) {
|
|
@@ -9918,13 +9799,12 @@ var messages$k = reactIntl.defineMessages({
|
|
|
9918
9799
|
});
|
|
9919
9800
|
|
|
9920
9801
|
const PlatformLimitsShippingMethodsStatus = _ref => {
|
|
9921
|
-
var _platformLimits$shipp, _platformLimits$shipp2;
|
|
9922
9802
|
let total = _ref.total;
|
|
9923
9803
|
const intl = reactIntl.useIntl();
|
|
9924
9804
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
9925
9805
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
9926
|
-
const current = platformLimits
|
|
9927
|
-
const limit = platformLimits
|
|
9806
|
+
const current = platformLimits?.shippingMethods?.total?.current;
|
|
9807
|
+
const limit = platformLimits?.shippingMethods?.total?.limit;
|
|
9928
9808
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
9929
9809
|
intlMessage: messages$k.shippingMethodsStatus,
|
|
9930
9810
|
children: getPlatformLimitsStatus({
|
|
@@ -9986,18 +9866,17 @@ const useTaxCategoriesPlatformLimitsFetcher = () => {
|
|
|
9986
9866
|
};
|
|
9987
9867
|
|
|
9988
9868
|
const useTaxCategoriesPlatformLimits = () => {
|
|
9989
|
-
var _platformLimits$taxCa;
|
|
9990
9869
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
9991
9870
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
9992
|
-
if (!
|
|
9871
|
+
if (!platformLimits?.taxCategories?.total) {
|
|
9993
9872
|
return {
|
|
9994
9873
|
hasReachedTaxCategoriesWarningLimit: false,
|
|
9995
9874
|
hasReachedTaxCategoriesErrorLimit: false
|
|
9996
9875
|
};
|
|
9997
9876
|
}
|
|
9998
|
-
const _platformLimits$
|
|
9999
|
-
limit = _platformLimits$
|
|
10000
|
-
current = _platformLimits$
|
|
9877
|
+
const _platformLimits$taxCa = platformLimits.taxCategories.total,
|
|
9878
|
+
limit = _platformLimits$taxCa.limit,
|
|
9879
|
+
current = _platformLimits$taxCa.current;
|
|
10001
9880
|
const hasReachedTaxCategoriesWarningLimit = getHasExceededWarningThreshold({
|
|
10002
9881
|
limit,
|
|
10003
9882
|
current
|
|
@@ -10013,13 +9892,12 @@ const useTaxCategoriesPlatformLimits = () => {
|
|
|
10013
9892
|
};
|
|
10014
9893
|
|
|
10015
9894
|
const PlatformLimitsTaxCategoriesNotifications = () => {
|
|
10016
|
-
var _platformLimits$taxCa;
|
|
10017
9895
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
10018
9896
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
10019
9897
|
const _useTaxCategoriesPlat2 = useTaxCategoriesPlatformLimits(),
|
|
10020
9898
|
hasReachedTaxCategoriesWarningLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesWarningLimit,
|
|
10021
9899
|
hasReachedTaxCategoriesErrorLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesErrorLimit;
|
|
10022
|
-
if (!
|
|
9900
|
+
if (!platformLimits?.taxCategories?.total) {
|
|
10023
9901
|
return null;
|
|
10024
9902
|
}
|
|
10025
9903
|
if (hasReachedTaxCategoriesErrorLimit) {
|
|
@@ -10065,13 +9943,12 @@ var messages$i = reactIntl.defineMessages({
|
|
|
10065
9943
|
});
|
|
10066
9944
|
|
|
10067
9945
|
const PlatformLimitsTaxCategoriesStatus = _ref => {
|
|
10068
|
-
var _platformLimits$taxCa, _platformLimits$taxCa2;
|
|
10069
9946
|
let total = _ref.total;
|
|
10070
9947
|
const intl = reactIntl.useIntl();
|
|
10071
9948
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
10072
9949
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
10073
|
-
const current = platformLimits
|
|
10074
|
-
const limit = platformLimits
|
|
9950
|
+
const current = platformLimits?.taxCategories?.total?.current;
|
|
9951
|
+
const limit = platformLimits?.taxCategories?.total?.limit;
|
|
10075
9952
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
10076
9953
|
intlMessage: messages$i.taxCategoriesStatus,
|
|
10077
9954
|
children: getPlatformLimitsStatus({
|
|
@@ -10133,18 +10010,17 @@ const useZonesPlatformLimitsFetcher = () => {
|
|
|
10133
10010
|
};
|
|
10134
10011
|
|
|
10135
10012
|
const useZonesPlatformLimits = () => {
|
|
10136
|
-
var _platformLimits$zones;
|
|
10137
10013
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10138
10014
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10139
|
-
if (!
|
|
10015
|
+
if (!platformLimits?.zones?.total) {
|
|
10140
10016
|
return {
|
|
10141
10017
|
hasReachedZonesWarningLimit: false,
|
|
10142
10018
|
hasReachedZonesErrorLimit: false
|
|
10143
10019
|
};
|
|
10144
10020
|
}
|
|
10145
|
-
const _platformLimits$
|
|
10146
|
-
limit = _platformLimits$
|
|
10147
|
-
current = _platformLimits$
|
|
10021
|
+
const _platformLimits$zones = platformLimits.zones.total,
|
|
10022
|
+
limit = _platformLimits$zones.limit,
|
|
10023
|
+
current = _platformLimits$zones.current;
|
|
10148
10024
|
const hasReachedZonesWarningLimit = getHasExceededWarningThreshold({
|
|
10149
10025
|
limit,
|
|
10150
10026
|
current
|
|
@@ -10160,13 +10036,12 @@ const useZonesPlatformLimits = () => {
|
|
|
10160
10036
|
};
|
|
10161
10037
|
|
|
10162
10038
|
const PlatformLimitsZonesNotifications = () => {
|
|
10163
|
-
var _platformLimits$zones;
|
|
10164
10039
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10165
10040
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10166
10041
|
const _useZonesPlatformLimi2 = useZonesPlatformLimits(),
|
|
10167
10042
|
hasReachedZonesWarningLimit = _useZonesPlatformLimi2.hasReachedZonesWarningLimit,
|
|
10168
10043
|
hasReachedZonesErrorLimit = _useZonesPlatformLimi2.hasReachedZonesErrorLimit;
|
|
10169
|
-
if (!
|
|
10044
|
+
if (!platformLimits?.zones?.total) {
|
|
10170
10045
|
return null;
|
|
10171
10046
|
}
|
|
10172
10047
|
if (hasReachedZonesErrorLimit) {
|
|
@@ -10212,13 +10087,12 @@ var messages$g = reactIntl.defineMessages({
|
|
|
10212
10087
|
});
|
|
10213
10088
|
|
|
10214
10089
|
const PlatformLimitsZonesStatus = _ref => {
|
|
10215
|
-
var _platformLimits$zones, _platformLimits$zones2;
|
|
10216
10090
|
let total = _ref.total;
|
|
10217
10091
|
const intl = reactIntl.useIntl();
|
|
10218
10092
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10219
10093
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10220
|
-
const current = platformLimits
|
|
10221
|
-
const limit = platformLimits
|
|
10094
|
+
const current = platformLimits?.zones?.total?.current;
|
|
10095
|
+
const limit = platformLimits?.zones?.total?.limit;
|
|
10222
10096
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
10223
10097
|
intlMessage: messages$g.zonesStatus,
|
|
10224
10098
|
children: getPlatformLimitsStatus({
|
|
@@ -10280,18 +10154,17 @@ const useCustomersPlatformLimitsFetcher = () => {
|
|
|
10280
10154
|
};
|
|
10281
10155
|
|
|
10282
10156
|
const useCustomersPlatformLimits$1 = () => {
|
|
10283
|
-
var _platformLimits$custo;
|
|
10284
10157
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10285
10158
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10286
|
-
if (!
|
|
10159
|
+
if (!platformLimits?.customers?.total) {
|
|
10287
10160
|
return {
|
|
10288
10161
|
hasReachedCustomersWarningLimit: false,
|
|
10289
10162
|
hasReachedCustomersErrorLimit: false
|
|
10290
10163
|
};
|
|
10291
10164
|
}
|
|
10292
|
-
const _platformLimits$
|
|
10293
|
-
limit = _platformLimits$
|
|
10294
|
-
current = _platformLimits$
|
|
10165
|
+
const _platformLimits$custo = platformLimits.customers.total,
|
|
10166
|
+
limit = _platformLimits$custo.limit,
|
|
10167
|
+
current = _platformLimits$custo.current;
|
|
10295
10168
|
const hasReachedCustomersWarningLimit = getHasExceededWarningThreshold({
|
|
10296
10169
|
limit,
|
|
10297
10170
|
current
|
|
@@ -10320,13 +10193,12 @@ const useCustomersPlatormLimitsModalState = () => {
|
|
|
10320
10193
|
};
|
|
10321
10194
|
|
|
10322
10195
|
const PlatformLimitsCustomersNotifications = () => {
|
|
10323
|
-
var _platformLimits$custo;
|
|
10324
10196
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10325
10197
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10326
10198
|
const _useCustomersPlatform2 = useCustomersPlatformLimits$1(),
|
|
10327
10199
|
hasReachedCustomersWarningLimit = _useCustomersPlatform2.hasReachedCustomersWarningLimit,
|
|
10328
10200
|
hasReachedCustomersErrorLimit = _useCustomersPlatform2.hasReachedCustomersErrorLimit;
|
|
10329
|
-
if (!
|
|
10201
|
+
if (!platformLimits?.customers?.total) {
|
|
10330
10202
|
return jsxRuntime.jsx("div", {});
|
|
10331
10203
|
}
|
|
10332
10204
|
if (hasReachedCustomersErrorLimit) {
|
|
@@ -10377,16 +10249,15 @@ var styles$b = {
|
|
|
10377
10249
|
"status": "platform-limits-customers-status-module__status___3rXYM"
|
|
10378
10250
|
};
|
|
10379
10251
|
const PlatformLimitsCustomersStatus = () => {
|
|
10380
|
-
var _platformLimits$custo;
|
|
10381
10252
|
const intl = reactIntl.useIntl();
|
|
10382
10253
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10383
10254
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10384
|
-
if (!
|
|
10255
|
+
if (!platformLimits?.customers?.total) {
|
|
10385
10256
|
return null;
|
|
10386
10257
|
}
|
|
10387
|
-
const _platformLimits$
|
|
10388
|
-
current = _platformLimits$
|
|
10389
|
-
limit = _platformLimits$
|
|
10258
|
+
const _platformLimits$custo = platformLimits.customers.total,
|
|
10259
|
+
current = _platformLimits$custo.current,
|
|
10260
|
+
limit = _platformLimits$custo.limit;
|
|
10390
10261
|
return jsxRuntime.jsx("div", {
|
|
10391
10262
|
className: styles$b.status,
|
|
10392
10263
|
children: jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
@@ -10620,18 +10491,17 @@ const useCustomerGroupsPlatformLimitsFetcher = () => {
|
|
|
10620
10491
|
};
|
|
10621
10492
|
|
|
10622
10493
|
const useCustomerGroupsPlatformLimitsStatus = () => {
|
|
10623
|
-
var _platformLimits$custo;
|
|
10624
10494
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10625
10495
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10626
|
-
if (!
|
|
10496
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
10627
10497
|
return {
|
|
10628
10498
|
hasReachedCustomerGroupsWarningLimit: false,
|
|
10629
10499
|
hasReachedCustomerGroupsErrorLimit: false
|
|
10630
10500
|
};
|
|
10631
10501
|
}
|
|
10632
|
-
const _platformLimits$
|
|
10633
|
-
limit = _platformLimits$
|
|
10634
|
-
current = _platformLimits$
|
|
10502
|
+
const _platformLimits$custo = platformLimits.customerGroups.total,
|
|
10503
|
+
limit = _platformLimits$custo.limit,
|
|
10504
|
+
current = _platformLimits$custo.current;
|
|
10635
10505
|
const hasReachedCustomerGroupsWarningLimit = getHasExceededWarningThreshold({
|
|
10636
10506
|
limit,
|
|
10637
10507
|
current
|
|
@@ -10660,13 +10530,12 @@ const useCustomerGroupsPlatormLimitsModalState = () => {
|
|
|
10660
10530
|
};
|
|
10661
10531
|
|
|
10662
10532
|
const PlatformLimitsCustomerGroupsNotifications = () => {
|
|
10663
|
-
var _platformLimits$custo;
|
|
10664
10533
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10665
10534
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10666
10535
|
const _useCustomerGroupsPla2 = useCustomerGroupsPlatformLimitsStatus(),
|
|
10667
10536
|
hasReachedCustomerGroupsWarningLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsWarningLimit,
|
|
10668
10537
|
hasReachedCustomerGroupsErrorLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsErrorLimit;
|
|
10669
|
-
if (!
|
|
10538
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
10670
10539
|
return jsxRuntime.jsx("div", {});
|
|
10671
10540
|
}
|
|
10672
10541
|
if (hasReachedCustomerGroupsErrorLimit) {
|
|
@@ -10717,16 +10586,15 @@ var styles$9 = {
|
|
|
10717
10586
|
"status": "platform-limits-customer-groups-status-module__status___6099G"
|
|
10718
10587
|
};
|
|
10719
10588
|
const PlatformLimitsCustomerGroupsStatus = () => {
|
|
10720
|
-
var _platformLimits$custo;
|
|
10721
10589
|
const intl = reactIntl.useIntl();
|
|
10722
10590
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10723
10591
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10724
|
-
if (!
|
|
10592
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
10725
10593
|
return null;
|
|
10726
10594
|
}
|
|
10727
|
-
const _platformLimits$
|
|
10728
|
-
current = _platformLimits$
|
|
10729
|
-
limit = _platformLimits$
|
|
10595
|
+
const _platformLimits$custo = platformLimits.customerGroups.total,
|
|
10596
|
+
current = _platformLimits$custo.current,
|
|
10597
|
+
limit = _platformLimits$custo.limit;
|
|
10730
10598
|
return jsxRuntime.jsx("div", {
|
|
10731
10599
|
className: styles$9.status,
|
|
10732
10600
|
children: jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
@@ -10958,7 +10826,7 @@ var fetchPimIndexStatus = ((apolloClient, projectKey) => async dispatch => {
|
|
|
10958
10826
|
try {
|
|
10959
10827
|
await dispatch(sdk.actions.head({
|
|
10960
10828
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.PIM_SEARCH,
|
|
10961
|
-
uri:
|
|
10829
|
+
uri: `/${projectKey}/search/products`
|
|
10962
10830
|
}));
|
|
10963
10831
|
return {
|
|
10964
10832
|
status: 'indexed'
|
|
@@ -11049,8 +10917,8 @@ const getIndexingJobIds = _ref => {
|
|
|
11049
10917
|
products = _ref$data.products,
|
|
11050
10918
|
productTypes = _ref$data.productTypes;
|
|
11051
10919
|
return {
|
|
11052
|
-
productsJobId:
|
|
11053
|
-
productTypesJobId:
|
|
10920
|
+
productsJobId: products?.indexingJobId || products?.existingIndexingJobId,
|
|
10921
|
+
productTypesJobId: productTypes?.indexingJobId || productTypes?.existingIndexingJobId
|
|
11054
10922
|
};
|
|
11055
10923
|
};
|
|
11056
10924
|
let PimIndexerProvider = /*#__PURE__*/function (_PureComponent) {
|
|
@@ -11314,7 +11182,6 @@ const valueMapping = {
|
|
|
11314
11182
|
all: [true, false]
|
|
11315
11183
|
};
|
|
11316
11184
|
const BooleanField = props => {
|
|
11317
|
-
var _context;
|
|
11318
11185
|
let selectedValue;
|
|
11319
11186
|
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]);
|
|
11320
11187
|
const yesLabel = props.intl.formatMessage(messages$8.yes);
|
|
@@ -11328,7 +11195,7 @@ const BooleanField = props => {
|
|
|
11328
11195
|
}];
|
|
11329
11196
|
if (props.isMulti) options.push({
|
|
11330
11197
|
value: 'all',
|
|
11331
|
-
label:
|
|
11198
|
+
label: `${yesLabel} / ${noLabel}`
|
|
11332
11199
|
});
|
|
11333
11200
|
return jsxRuntime.jsx(uiKit.SelectInput, {
|
|
11334
11201
|
name: props.name,
|
|
@@ -11492,19 +11359,19 @@ const ScrollToFieldError = () => {
|
|
|
11492
11359
|
if (isValid) return;
|
|
11493
11360
|
const firstErrorElement = document.querySelector('[aria-invalid="true"]');
|
|
11494
11361
|
if (firstErrorElement) {
|
|
11495
|
-
var _ref, _ref2, _document$querySelect, _elementToScrollTo$sc;
|
|
11496
11362
|
// Get a reference to the label.
|
|
11497
11363
|
const firstElementId = firstErrorElement.getAttribute('id');
|
|
11498
|
-
const localizedInputIndex = _indexOfInstanceProperty__default["default"](firstElementId).call(firstElementId,
|
|
11364
|
+
const localizedInputIndex = _indexOfInstanceProperty__default["default"](firstElementId).call(firstElementId, `.${dataLocale}`);
|
|
11499
11365
|
|
|
11500
11366
|
// check if locale is appended then remove it from id
|
|
11501
|
-
const id = localizedInputIndex > -1 ? firstElementId.replace(
|
|
11367
|
+
const id = localizedInputIndex > -1 ? firstElementId.replace(`.${dataLocale}`, '') : firstElementId;
|
|
11502
11368
|
|
|
11503
11369
|
// Scroll to the label (if found), otherwise to the input element itself.
|
|
11504
11370
|
|
|
11505
|
-
const elementToScrollTo =
|
|
11506
|
-
|
|
11507
|
-
(
|
|
11371
|
+
const elementToScrollTo =
|
|
11372
|
+
// div is used only for custom fields
|
|
11373
|
+
document.querySelector(`div[aria-errormessage="${firstElementId}"]`) ?? document.querySelector(`label[for="${id}"]`) ?? document.querySelector(`label#${id}`) ?? firstErrorElement;
|
|
11374
|
+
elementToScrollTo.scrollIntoView?.({
|
|
11508
11375
|
behavior: 'smooth'
|
|
11509
11376
|
});
|
|
11510
11377
|
}
|
|
@@ -11530,8 +11397,7 @@ var styles$4 = {
|
|
|
11530
11397
|
"search-mode-menu": "selectable-field-search-input-module__search-mode-menu___Od6Le"
|
|
11531
11398
|
};
|
|
11532
11399
|
const SelectableFieldSearchInput = props => {
|
|
11533
|
-
|
|
11534
|
-
const _useState = React.useState((_props$initialValue = props.initialValue) !== null && _props$initialValue !== void 0 ? _props$initialValue : ''),
|
|
11400
|
+
const _useState = React.useState(props.initialValue ?? ''),
|
|
11535
11401
|
_useState2 = _slicedToArray(_useState, 2),
|
|
11536
11402
|
searchText = _useState2[0],
|
|
11537
11403
|
setSearchText = _useState2[1];
|
|
@@ -11567,7 +11433,7 @@ const SelectableFieldSearchInput = props => {
|
|
|
11567
11433
|
});
|
|
11568
11434
|
},
|
|
11569
11435
|
onReset: props.onReset,
|
|
11570
|
-
placeholder:
|
|
11436
|
+
placeholder: props.placeholder ?? intl.formatMessage(messages$5.placeholder),
|
|
11571
11437
|
isDisabled: props.disabled
|
|
11572
11438
|
})
|
|
11573
11439
|
});
|
|
@@ -11628,7 +11494,6 @@ StoreSelectField.defaultProps = {
|
|
|
11628
11494
|
mappedValueField: 'id'
|
|
11629
11495
|
};
|
|
11630
11496
|
|
|
11631
|
-
var _templateObject;
|
|
11632
11497
|
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; }
|
|
11633
11498
|
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; }
|
|
11634
11499
|
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); }; }
|
|
@@ -11701,7 +11566,10 @@ const VALIDATOR_INTEGER = {
|
|
|
11701
11566
|
}
|
|
11702
11567
|
}
|
|
11703
11568
|
});
|
|
11704
|
-
commonTags.oneLineTrim
|
|
11569
|
+
commonTags.oneLineTrim`
|
|
11570
|
+
\`validatedInput\` is no longer supported.
|
|
11571
|
+
Please use \`formik\` instead.
|
|
11572
|
+
`;
|
|
11705
11573
|
const ToolTipWrapperComponent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
11706
11574
|
let children = _ref.children;
|
|
11707
11575
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
@@ -11848,7 +11716,7 @@ function validatedInput(InnerComponent, validators) {
|
|
|
11848
11716
|
}]);
|
|
11849
11717
|
return ValidatedInput;
|
|
11850
11718
|
}(React.PureComponent);
|
|
11851
|
-
ValidatedInput.displayName =
|
|
11719
|
+
ValidatedInput.displayName = `ValidatedInput(${_InnerComponent.displayName})`;
|
|
11852
11720
|
ValidatedInput.defaultProps = {
|
|
11853
11721
|
isValid: true,
|
|
11854
11722
|
getInputRef: () => {}
|
|
@@ -11990,7 +11858,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
11990
11858
|
truncate: true,
|
|
11991
11859
|
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$2.filterWholeInput), {}, {
|
|
11992
11860
|
values: {
|
|
11993
|
-
values: "
|
|
11861
|
+
values: `"${props.value}"`
|
|
11994
11862
|
}
|
|
11995
11863
|
})
|
|
11996
11864
|
})
|
|
@@ -12003,7 +11871,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
12003
11871
|
truncate: true,
|
|
12004
11872
|
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$2.filterSeparateValues), {}, {
|
|
12005
11873
|
values: {
|
|
12006
|
-
values: "
|
|
11874
|
+
values: `"${props.multiValue.join('", "')}"` || props.value
|
|
12007
11875
|
}
|
|
12008
11876
|
})
|
|
12009
11877
|
})
|
|
@@ -12295,17 +12163,16 @@ function isEmpty(value) {
|
|
|
12295
12163
|
}
|
|
12296
12164
|
|
|
12297
12165
|
const buildSearchQuery = (searchQuery, searchMode, fragments) => {
|
|
12298
|
-
var _fragments$searchMode;
|
|
12299
12166
|
if (!searchQuery) return '';
|
|
12300
12167
|
const buildAllFieldsQueryString = query => {
|
|
12301
12168
|
const fragmentsArray = _Object$values__default["default"](fragments);
|
|
12302
|
-
return
|
|
12169
|
+
return `( ${_mapInstanceProperty__default["default"](fragmentsArray).call(fragmentsArray, fragment => fragment.getQuery(query)).join(' or ')} )`;
|
|
12303
12170
|
};
|
|
12304
12171
|
const trimmedSearchQuery = oneLine__default["default"](searchQuery);
|
|
12305
12172
|
if (searchMode === 'allFields') {
|
|
12306
12173
|
return buildAllFieldsQueryString(trimmedSearchQuery);
|
|
12307
12174
|
}
|
|
12308
|
-
if (!fragments[searchMode] || typeof
|
|
12175
|
+
if (!fragments[searchMode] || typeof fragments[searchMode]?.getQuery !== 'function') {
|
|
12309
12176
|
return '';
|
|
12310
12177
|
}
|
|
12311
12178
|
return fragments[searchMode].getQuery(trimmedSearchQuery);
|
|
@@ -12536,11 +12403,11 @@ function createResourceReducer(options) {
|
|
|
12536
12403
|
|
|
12537
12404
|
// TODO: validate constant keys
|
|
12538
12405
|
const actionsMap = {
|
|
12539
|
-
[
|
|
12406
|
+
[`${plural}_FETCHED`]: (_, action) => ({
|
|
12540
12407
|
currentQueryResult: action.payload
|
|
12541
12408
|
}),
|
|
12542
|
-
[
|
|
12543
|
-
[
|
|
12409
|
+
[`${single}_UPDATED_IN_LIST`]: updateStatusInList(mergeData),
|
|
12410
|
+
[`${single}_DELETED_IN_LIST`]: (state, _ref) => {
|
|
12544
12411
|
let payload = _ref.payload;
|
|
12545
12412
|
const results = state.currentQueryResult.results;
|
|
12546
12413
|
return {
|
|
@@ -12552,27 +12419,27 @@ function createResourceReducer(options) {
|
|
|
12552
12419
|
})
|
|
12553
12420
|
};
|
|
12554
12421
|
},
|
|
12555
|
-
[
|
|
12422
|
+
[`${single}_FETCHED`]: (_, _ref3) => {
|
|
12556
12423
|
let payload = _ref3.payload;
|
|
12557
12424
|
return {
|
|
12558
12425
|
currentVisible: payload
|
|
12559
12426
|
};
|
|
12560
12427
|
},
|
|
12561
|
-
[
|
|
12428
|
+
[`${single}_CREATED`]: (_ref4, _ref5) => {
|
|
12562
12429
|
let currentVisible = _ref4.currentVisible;
|
|
12563
12430
|
let payload = _ref5.payload;
|
|
12564
12431
|
return {
|
|
12565
12432
|
currentVisible: mergeData(payload, currentVisible)
|
|
12566
12433
|
};
|
|
12567
12434
|
},
|
|
12568
|
-
[
|
|
12435
|
+
[`${single}_UPDATED`]: (_ref6, _ref7) => {
|
|
12569
12436
|
let currentVisible = _ref6.currentVisible;
|
|
12570
12437
|
let payload = _ref7.payload;
|
|
12571
12438
|
return {
|
|
12572
12439
|
currentVisible: mergeData(payload, currentVisible)
|
|
12573
12440
|
};
|
|
12574
12441
|
},
|
|
12575
|
-
[
|
|
12442
|
+
[`${single}_DELETED`]: () => ({
|
|
12576
12443
|
currentVisible: null
|
|
12577
12444
|
})
|
|
12578
12445
|
};
|
|
@@ -12589,12 +12456,11 @@ function formatCustomerAddress(_ref) {
|
|
|
12589
12456
|
}
|
|
12590
12457
|
|
|
12591
12458
|
function formatCustomerName(_ref) {
|
|
12592
|
-
var _context;
|
|
12593
12459
|
let firstName = _ref.firstName,
|
|
12594
12460
|
lastName = _ref.lastName;
|
|
12595
12461
|
if (firstName && !lastName) return _trimInstanceProperty__default["default"](firstName).call(firstName);
|
|
12596
12462
|
if (!firstName && lastName) return _trimInstanceProperty__default["default"](lastName).call(lastName);
|
|
12597
|
-
if (firstName && lastName) return
|
|
12463
|
+
if (firstName && lastName) return `${_trimInstanceProperty__default["default"](firstName).call(firstName)} ${_trimInstanceProperty__default["default"](lastName).call(lastName)}`;
|
|
12598
12464
|
return constants.NO_VALUE_FALLBACK;
|
|
12599
12465
|
}
|
|
12600
12466
|
|
|
@@ -12644,10 +12510,7 @@ const validateText = (text, intl) => {
|
|
|
12644
12510
|
* @returns {boolean}
|
|
12645
12511
|
*/
|
|
12646
12512
|
const hasErrorCode = (unmappedApiErrors, errorCode) => {
|
|
12647
|
-
return _Array$isArray__default["default"](unmappedApiErrors) && _someInstanceProperty__default["default"](unmappedApiErrors).call(unmappedApiErrors, error =>
|
|
12648
|
-
var _error$extensions;
|
|
12649
|
-
return ((_error$extensions = error.extensions) === null || _error$extensions === void 0 ? void 0 : _error$extensions.code) === errorCode;
|
|
12650
|
-
});
|
|
12513
|
+
return _Array$isArray__default["default"](unmappedApiErrors) && _someInstanceProperty__default["default"](unmappedApiErrors).call(unmappedApiErrors, error => error.extensions?.code === errorCode);
|
|
12651
12514
|
};
|
|
12652
12515
|
|
|
12653
12516
|
const hasInvalidInputError = errors => hasErrorCode(errors, ERROR_CODES.invalidInput);
|
|
@@ -12659,7 +12522,7 @@ function minusify(value) {
|
|
|
12659
12522
|
return minus.concat(value);
|
|
12660
12523
|
}
|
|
12661
12524
|
|
|
12662
|
-
const flattenOperator = (operator, clauses) => compact__default["default"](_reduceInstanceProperty__default["default"](clauses).call(clauses, (result, clause) => _concatInstanceProperty__default["default"](result).call(result,
|
|
12525
|
+
const flattenOperator = (operator, clauses) => compact__default["default"](_reduceInstanceProperty__default["default"](clauses).call(clauses, (result, clause) => _concatInstanceProperty__default["default"](result).call(result, clause?.[operator] || clause), []));
|
|
12663
12526
|
const argsToArray = args => _reduceInstanceProperty__default["default"](args).call(args, (result, item) => _concatInstanceProperty__default["default"](result).call(result, item), []);
|
|
12664
12527
|
const exists = (field, attributeType) => ({
|
|
12665
12528
|
exists: {
|
|
@@ -12716,7 +12579,7 @@ const not = function () {
|
|
|
12716
12579
|
|
|
12717
12580
|
const safelyAddFallback = function (string) {
|
|
12718
12581
|
let fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : constants.NO_VALUE_FALLBACK;
|
|
12719
|
-
return string === '' ? fallback : string
|
|
12582
|
+
return string === '' ? fallback : string ?? fallback;
|
|
12720
12583
|
};
|
|
12721
12584
|
|
|
12722
12585
|
var messages$1 = reactIntl.defineMessages({
|
|
@@ -12851,19 +12714,19 @@ const computedProperties = {
|
|
|
12851
12714
|
// has been deleted. See MC-1925 for further information.
|
|
12852
12715
|
const filteredCategories = _filterInstanceProperty__default["default"](_context6 = product.categories).call(_context6, category => category.obj !== undefined);
|
|
12853
12716
|
return _mapInstanceProperty__default["default"](filteredCategories).call(filteredCategories, category => {
|
|
12854
|
-
var _context7;
|
|
12855
12717
|
const categoryPath = getPathName(category, language, languages);
|
|
12856
12718
|
const ancestors = getAncestors(category, language);
|
|
12857
|
-
const externalIdValue = category.obj.externalId ?
|
|
12719
|
+
const externalIdValue = category.obj.externalId ?
|
|
12720
|
+
// hardcoding "ext. ID" since this is not part of a message to be
|
|
12858
12721
|
// translated. This has been communicated with Jenn
|
|
12859
|
-
|
|
12722
|
+
`| ext. ID: ${category.obj.externalId}` : '';
|
|
12860
12723
|
return {
|
|
12861
12724
|
id: category.id,
|
|
12862
|
-
name:
|
|
12725
|
+
name: `${l10n.formatLocalizedString(category.obj, {
|
|
12863
12726
|
key: 'name',
|
|
12864
12727
|
locale: language,
|
|
12865
12728
|
fallbackOrder: languages
|
|
12866
|
-
})
|
|
12729
|
+
})} ${externalIdValue}`,
|
|
12867
12730
|
path: categoryPath,
|
|
12868
12731
|
level: ancestors.length
|
|
12869
12732
|
};
|
|
@@ -12900,13 +12763,13 @@ const getAttributeValueByType = _ref12 => {
|
|
|
12900
12763
|
value: value
|
|
12901
12764
|
});
|
|
12902
12765
|
case 'enum':
|
|
12903
|
-
return safelyAddFallback(value.label,
|
|
12766
|
+
return safelyAddFallback(value.label, `${value.key} (key)`);
|
|
12904
12767
|
case 'lenum':
|
|
12905
12768
|
return safelyAddFallback(l10n.formatLocalizedString(value, {
|
|
12906
12769
|
key: 'label',
|
|
12907
12770
|
locale: projectDataLocale,
|
|
12908
12771
|
fallbackOrder: projectLanguages
|
|
12909
|
-
}),
|
|
12772
|
+
}), `${value.key} (key)`);
|
|
12910
12773
|
case 'number':
|
|
12911
12774
|
return safelyAddFallback(value);
|
|
12912
12775
|
case 'boolean':
|
|
@@ -13029,7 +12892,6 @@ const reorderArrayItems = (array, from, to) => {
|
|
|
13029
12892
|
const mapTimeZonesToOptions = memoize__default["default"](timeZones => {
|
|
13030
12893
|
var _context;
|
|
13031
12894
|
return _mapInstanceProperty__default["default"](_context = _Object$entries__default["default"](timeZones)).call(_context, _ref => {
|
|
13032
|
-
var _context2;
|
|
13033
12895
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
13034
12896
|
code = _ref2[0],
|
|
13035
12897
|
value = _ref2[1];
|
|
@@ -13038,7 +12900,7 @@ const mapTimeZonesToOptions = memoize__default["default"](timeZones => {
|
|
|
13038
12900
|
//E.g. `(GMT +02:00) Central European Time - Berlin`
|
|
13039
12901
|
// unicode clock hex code: \u25F7
|
|
13040
12902
|
//
|
|
13041
|
-
label:
|
|
12903
|
+
label: `(GMT ${value.offset}) ${value.name}`
|
|
13042
12904
|
};
|
|
13043
12905
|
});
|
|
13044
12906
|
});
|
|
@@ -13046,12 +12908,9 @@ const getTimeZoneId = memoize__default["default"]((selectedTimeZone, timeZones)
|
|
|
13046
12908
|
if (timeZones[selectedTimeZone]) {
|
|
13047
12909
|
return selectedTimeZone;
|
|
13048
12910
|
} else {
|
|
13049
|
-
var
|
|
13050
|
-
const fallbackTimeZoneId = _findInstanceProperty__default["default"](
|
|
13051
|
-
|
|
13052
|
-
return (_timeZones$timeZoneId = timeZones[timeZoneId]) === null || _timeZones$timeZoneId === void 0 || (_timeZones$timeZoneId = _timeZones$timeZoneId.translationFor) === null || _timeZones$timeZoneId === void 0 ? void 0 : _someInstanceProperty__default["default"](_timeZones$timeZoneId).call(_timeZones$timeZoneId, fallbackTimeZone => fallbackTimeZone === selectedTimeZone);
|
|
13053
|
-
});
|
|
13054
|
-
if (fallbackTimeZoneId !== null && fallbackTimeZoneId !== void 0 && fallbackTimeZoneId.length) {
|
|
12911
|
+
var _context2;
|
|
12912
|
+
const fallbackTimeZoneId = _findInstanceProperty__default["default"](_context2 = _Object$keys__default["default"](timeZones)).call(_context2, timeZoneId => timeZones[timeZoneId]?.translationFor?.some(fallbackTimeZone => fallbackTimeZone === selectedTimeZone));
|
|
12913
|
+
if (fallbackTimeZoneId?.length) {
|
|
13055
12914
|
return fallbackTimeZoneId.toString();
|
|
13056
12915
|
} else {
|
|
13057
12916
|
return 'UTC';
|
|
@@ -13059,10 +12918,9 @@ const getTimeZoneId = memoize__default["default"]((selectedTimeZone, timeZones)
|
|
|
13059
12918
|
}
|
|
13060
12919
|
});
|
|
13061
12920
|
const getTimeZoneLabel = memoize__default["default"]((selectedTimeZone, timeZones) => {
|
|
13062
|
-
var _context4;
|
|
13063
12921
|
const timeZoneId = getTimeZoneId(selectedTimeZone, timeZones);
|
|
13064
12922
|
const timeZoneData = timeZones[timeZoneId];
|
|
13065
|
-
return
|
|
12923
|
+
return `(GMT ${timeZoneData.offset}) ${timeZoneData.name}`;
|
|
13066
12924
|
});
|
|
13067
12925
|
|
|
13068
12926
|
function ownKeys$3(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -13123,8 +12981,7 @@ const typeDefinitionsExist = typeDefinitions => {
|
|
|
13123
12981
|
return typeDefinitions.length > 0;
|
|
13124
12982
|
};
|
|
13125
12983
|
const typeDefinitionSelected = formValues => {
|
|
13126
|
-
|
|
13127
|
-
return ((_formValues$FIELD_NAM = formValues[FIELD_NAME]) === null || _formValues$FIELD_NAM === void 0 ? void 0 : _formValues$FIELD_NAM.type) && ((_formValues$FIELD_NAM2 = formValues[FIELD_NAME]) === null || _formValues$FIELD_NAM2 === void 0 || (_formValues$FIELD_NAM2 = _formValues$FIELD_NAM2.type) === null || _formValues$FIELD_NAM2 === void 0 ? void 0 : _formValues$FIELD_NAM2.obj);
|
|
12984
|
+
return formValues[FIELD_NAME]?.type && formValues[FIELD_NAME]?.type?.obj;
|
|
13128
12985
|
};
|
|
13129
12986
|
const typeDefinitionContainsFieldDefinitions = formValues => {
|
|
13130
12987
|
return formValues[FIELD_NAME].type.obj.key && formValues[FIELD_NAME].type.obj.fieldDefinitions.length > 0;
|
|
@@ -13159,7 +13016,7 @@ const CustomFieldsInputWrapper = _ref2 => {
|
|
|
13159
13016
|
max: "scale",
|
|
13160
13017
|
children: jsxRuntime.jsx(CustomFields, {
|
|
13161
13018
|
isReadOnly: isReadOnly,
|
|
13162
|
-
name:
|
|
13019
|
+
name: `${FIELD_NAME}.fields`,
|
|
13163
13020
|
fieldDefinitions: isReadOnly && hideEmptyFields ? fieldDefinitionsWithValues(formValues) : formValues[FIELD_NAME].type.obj.fieldDefinitions
|
|
13164
13021
|
})
|
|
13165
13022
|
});
|
|
@@ -13194,7 +13051,6 @@ const createFormStateFromTypeDefinition = selectedTypeDefinition => {
|
|
|
13194
13051
|
};
|
|
13195
13052
|
};
|
|
13196
13053
|
const CustomTypeSubform = _ref => {
|
|
13197
|
-
var _formValues$FIELD_NAM3, _formValues$FIELD_NAM4;
|
|
13198
13054
|
let typeDefinitions = _ref.typeDefinitions,
|
|
13199
13055
|
isReadOnly = _ref.isReadOnly,
|
|
13200
13056
|
isCondensed = _ref.isCondensed,
|
|
@@ -13226,8 +13082,7 @@ const CustomTypeSubform = _ref => {
|
|
|
13226
13082
|
}
|
|
13227
13083
|
}, [typeDefinitions, setFieldValue, validateForm]);
|
|
13228
13084
|
const typeDefinitionSelected = formValues => {
|
|
13229
|
-
|
|
13230
|
-
return ((_formValues$FIELD_NAM = formValues[FIELD_NAME]) === null || _formValues$FIELD_NAM === void 0 ? void 0 : _formValues$FIELD_NAM.type) && ((_formValues$FIELD_NAM2 = formValues[FIELD_NAME]) === null || _formValues$FIELD_NAM2 === void 0 || (_formValues$FIELD_NAM2 = _formValues$FIELD_NAM2.type) === null || _formValues$FIELD_NAM2 === void 0 ? void 0 : _formValues$FIELD_NAM2.obj);
|
|
13085
|
+
return formValues[FIELD_NAME]?.type && formValues[FIELD_NAME]?.type?.obj;
|
|
13231
13086
|
};
|
|
13232
13087
|
|
|
13233
13088
|
// if the user has read-only permissions, empty fields are hidden, and no type definition is selected, hide the component
|
|
@@ -13242,9 +13097,9 @@ const CustomTypeSubform = _ref => {
|
|
|
13242
13097
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
13243
13098
|
isClearable: true,
|
|
13244
13099
|
"data-testid": "custom-type-select",
|
|
13245
|
-
name:
|
|
13246
|
-
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages,
|
|
13247
|
-
value:
|
|
13100
|
+
name: `${FIELD_NAME}.type.obj.key`,
|
|
13101
|
+
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages, formValues[FIELD_NAME]?.type?.id),
|
|
13102
|
+
value: formValues[FIELD_NAME]?.type?.obj?.key,
|
|
13248
13103
|
onChange: handleTypeDefinitionSelect,
|
|
13249
13104
|
placeholder: formatMessage(messages.typesPlaceholder),
|
|
13250
13105
|
isReadOnly: isReadOnly
|
|
@@ -13263,8 +13118,7 @@ CustomTypeSubform.displayName = 'CustomTypeSubform';
|
|
|
13263
13118
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13264
13119
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context6 = ownKeys(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context7 = ownKeys(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
13265
13120
|
const transformFieldType = fieldDefinition => {
|
|
13266
|
-
|
|
13267
|
-
if (((_fieldDefinition$type = fieldDefinition.type) === null || _fieldDefinition$type === void 0 || (_fieldDefinition$type = _fieldDefinition$type.elementType) === null || _fieldDefinition$type === void 0 ? void 0 : _fieldDefinition$type.name) === 'LocalizedEnum') {
|
|
13121
|
+
if (fieldDefinition.type?.elementType?.name === 'LocalizedEnum') {
|
|
13268
13122
|
var _context;
|
|
13269
13123
|
return _objectSpread(_objectSpread({}, fieldDefinition.type), {}, {
|
|
13270
13124
|
elementType: _objectSpread(_objectSpread({}, fieldDefinition.type.elementType), {}, {
|
|
@@ -13274,7 +13128,7 @@ const transformFieldType = fieldDefinition => {
|
|
|
13274
13128
|
}))
|
|
13275
13129
|
})
|
|
13276
13130
|
});
|
|
13277
|
-
} else if (
|
|
13131
|
+
} else if (fieldDefinition.type?.name === 'LocalizedEnum') {
|
|
13278
13132
|
var _context2;
|
|
13279
13133
|
return _objectSpread(_objectSpread({}, fieldDefinition.type), {}, {
|
|
13280
13134
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context2, value => ({
|