@commercetools-frontend/experimental-components 5.4.3 → 5.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commercetools-frontend-experimental-components.cjs.dev.js +483 -614
- package/dist/commercetools-frontend-experimental-components.cjs.prod.js +481 -612
- package/dist/commercetools-frontend-experimental-components.esm.js +481 -612
- package/dist/styles.css +179 -170
- package/package.json +12 -12
|
@@ -30,14 +30,12 @@ var l10n = require('@commercetools-frontend/l10n');
|
|
|
30
30
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
31
31
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
32
32
|
var camelCase = require('lodash/camelCase');
|
|
33
|
-
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
34
33
|
var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
|
|
35
34
|
var _sortInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/sort');
|
|
36
35
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
37
36
|
var fastEquals = require('fast-equals');
|
|
38
37
|
var reactIntl = require('react-intl');
|
|
39
38
|
var omitEmpty = require('omit-empty-es');
|
|
40
|
-
var _taggedTemplateLiteral = require('@babel/runtime-corejs3/helpers/taggedTemplateLiteral');
|
|
41
39
|
var oneLine = require('common-tags/lib/oneLine');
|
|
42
40
|
var moment = require('moment-timezone');
|
|
43
41
|
var isNil$1 = require('lodash/isNil');
|
|
@@ -72,15 +70,14 @@ var has = require('lodash/has');
|
|
|
72
70
|
var _toArray = require('@babel/runtime-corejs3/helpers/toArray');
|
|
73
71
|
var _reverseInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reverse');
|
|
74
72
|
var sdk = require('@commercetools-frontend/sdk');
|
|
75
|
-
var client = require('@apollo/client');
|
|
76
73
|
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
74
|
+
var client = require('@apollo/client');
|
|
77
75
|
var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
78
76
|
var _parseFloat = require('@babel/runtime-corejs3/core-js-stable/parse-float');
|
|
79
77
|
var omit = require('lodash/omit');
|
|
80
78
|
var isEmpty$3 = require('lodash/isEmpty');
|
|
81
79
|
var _Object$freeze = require('@babel/runtime-corejs3/core-js-stable/object/freeze');
|
|
82
80
|
var originalOmitDeep = require('omit-deep');
|
|
83
|
-
var _findIndexInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find-index');
|
|
84
81
|
var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
|
|
85
82
|
var _parseInt = require('@babel/runtime-corejs3/core-js-stable/parse-int');
|
|
86
83
|
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
@@ -108,12 +105,14 @@ var flatMap = require('lodash/flatMap');
|
|
|
108
105
|
var reactRedux = require('react-redux');
|
|
109
106
|
var commonTags = require('common-tags');
|
|
110
107
|
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
|
-
|
|
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);
|
|
@@ -3729,25 +3692,23 @@ const useHandlers = onChange => {
|
|
|
3729
3692
|
return [handleInputChange, handleChange];
|
|
3730
3693
|
};
|
|
3731
3694
|
|
|
3695
|
+
const _excluded$1 = ["extraWhere"];
|
|
3732
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; }
|
|
3733
|
-
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; }
|
|
3734
3698
|
const constructPrefixSearchPredicate = function () {
|
|
3735
3699
|
let prefixSearchFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
3736
3700
|
let lowerBound = arguments.length > 1 ? arguments[1] : undefined;
|
|
3737
3701
|
let upperBound = arguments.length > 2 ? arguments[2] : undefined;
|
|
3738
3702
|
const constructPrefixSearchExpression = field => {
|
|
3739
|
-
var _context
|
|
3703
|
+
var _context;
|
|
3740
3704
|
const path = field.split('.');
|
|
3741
3705
|
const _path$slice$reverse = _reverseInstanceProperty__default["default"](_context = _sliceInstanceProperty__default["default"](path).call(path)).call(_context),
|
|
3742
3706
|
_path$slice$reverse2 = _toArray(_path$slice$reverse),
|
|
3743
3707
|
finalValueInPath = _path$slice$reverse2[0],
|
|
3744
3708
|
remainPathInReverse = _sliceInstanceProperty__default["default"](_path$slice$reverse2).call(_path$slice$reverse2, 1);
|
|
3745
|
-
const comparison =
|
|
3709
|
+
const comparison = `${finalValueInPath} >= "${lowerBound}" and ${finalValueInPath} < "${upperBound}"`;
|
|
3746
3710
|
if (remainPathInReverse.length) {
|
|
3747
|
-
return _reduceInstanceProperty__default["default"](remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) => {
|
|
3748
|
-
var _context5;
|
|
3749
|
-
return _concatInstanceProperty__default["default"](_context5 = "".concat(nextPath, "(")).call(_context5, nestedPath, ")");
|
|
3750
|
-
}, comparison);
|
|
3711
|
+
return _reduceInstanceProperty__default["default"](remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) => `${nextPath}(${nestedPath})`, comparison);
|
|
3751
3712
|
}
|
|
3752
3713
|
return comparison;
|
|
3753
3714
|
};
|
|
@@ -3760,22 +3721,29 @@ const useLoadOptions = _ref => {
|
|
|
3760
3721
|
const client$1 = client.useApolloClient();
|
|
3761
3722
|
const loadOptions = React.useCallback(function () {
|
|
3762
3723
|
let inputValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3724
|
+
let where;
|
|
3725
|
+
if (inputValue.length) {
|
|
3726
|
+
if (isUUID(inputValue)) {
|
|
3727
|
+
where = `id = "${inputValue}"`;
|
|
3728
|
+
} else {
|
|
3729
|
+
const _getPrefixSearchBound = getPrefixSearchBounds(inputValue),
|
|
3730
|
+
_getPrefixSearchBound2 = _slicedToArray(_getPrefixSearchBound, 2),
|
|
3731
|
+
lowerBound = _getPrefixSearchBound2[0],
|
|
3732
|
+
upperBound = _getPrefixSearchBound2[1];
|
|
3733
|
+
where = constructPrefixSearchPredicate(prefixSearchFields, lowerBound, upperBound);
|
|
3772
3734
|
}
|
|
3773
|
-
}
|
|
3735
|
+
}
|
|
3736
|
+
const _ref2 = variables ?? {},
|
|
3737
|
+
extraWhere = _ref2.extraWhere,
|
|
3738
|
+
restVariables = _objectWithoutProperties(_ref2, _excluded$1);
|
|
3739
|
+
if (typeof extraWhere === 'string') {
|
|
3740
|
+
where = where ? `(${where}) and ${variables.extraWhere}` : variables.extraWhere;
|
|
3741
|
+
}
|
|
3774
3742
|
return client$1.query({
|
|
3775
3743
|
query,
|
|
3776
3744
|
variables: _objectSpread$16({
|
|
3777
3745
|
where
|
|
3778
|
-
},
|
|
3746
|
+
}, restVariables),
|
|
3779
3747
|
context: {
|
|
3780
3748
|
target: constants.MC_API_PROXY_TARGETS.COMMERCETOOLS_PLATFORM
|
|
3781
3749
|
},
|
|
@@ -3786,7 +3754,6 @@ const useLoadOptions = _ref => {
|
|
|
3786
3754
|
};
|
|
3787
3755
|
|
|
3788
3756
|
function useCurrentOption(_ref) {
|
|
3789
|
-
var _context;
|
|
3790
3757
|
let id = _ref.id,
|
|
3791
3758
|
typename = _ref.typename,
|
|
3792
3759
|
query = _ref.query,
|
|
@@ -3798,7 +3765,7 @@ function useCurrentOption(_ref) {
|
|
|
3798
3765
|
// load from cache when possible to speed up initial render
|
|
3799
3766
|
const canReadFromCache = id && typename && fragment;
|
|
3800
3767
|
const cacheItem = canReadFromCache ? apolloClient.readFragment({
|
|
3801
|
-
id:
|
|
3768
|
+
id: `${typename}:${id}`,
|
|
3802
3769
|
fragment
|
|
3803
3770
|
}) : undefined;
|
|
3804
3771
|
|
|
@@ -3816,7 +3783,7 @@ function useCurrentOption(_ref) {
|
|
|
3816
3783
|
queryData = _useQuery.data,
|
|
3817
3784
|
queryError = _useQuery.error;
|
|
3818
3785
|
const queryItem = queryData && queryDataToItem(queryData);
|
|
3819
|
-
const item = queryItem
|
|
3786
|
+
const item = queryItem ?? cacheItem;
|
|
3820
3787
|
const loading = item ? false : queryLoading;
|
|
3821
3788
|
const error = item ? undefined : queryError;
|
|
3822
3789
|
const data = item && itemToOption(item);
|
|
@@ -3855,7 +3822,6 @@ const convertProductTypeToOption = productType => {
|
|
|
3855
3822
|
};
|
|
3856
3823
|
};
|
|
3857
3824
|
const ProductTypePickerInput = _ref => {
|
|
3858
|
-
var _currentOption$data$l, _currentOption$data;
|
|
3859
3825
|
let isClearable = _ref.isClearable,
|
|
3860
3826
|
isDisabled = _ref.isDisabled,
|
|
3861
3827
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -3886,9 +3852,8 @@ const ProductTypePickerInput = _ref => {
|
|
|
3886
3852
|
itemToOption: convertProductTypeToOption
|
|
3887
3853
|
});
|
|
3888
3854
|
const handleLoadOptions = React.useCallback(inputValue => loadProductTypes(inputValue).then(_ref3 => {
|
|
3889
|
-
var _data$productTypes;
|
|
3890
3855
|
let data = _ref3.data;
|
|
3891
|
-
return
|
|
3856
|
+
return data.productTypes?.results || [];
|
|
3892
3857
|
}).then(productTypes => _mapInstanceProperty__default["default"](productTypes).call(productTypes, convertProductTypeToOption)).catch(error => {
|
|
3893
3858
|
setLoadingError(error);
|
|
3894
3859
|
onError(error);
|
|
@@ -3902,12 +3867,12 @@ const ProductTypePickerInput = _ref => {
|
|
|
3902
3867
|
setLoadingError(null);
|
|
3903
3868
|
handleInternalInputChange(event);
|
|
3904
3869
|
}, [handleInternalInputChange]);
|
|
3905
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
3870
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
3906
3871
|
React.useEffect(() => {
|
|
3907
3872
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
3908
3873
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
3909
3874
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
3910
|
-
const tooltipTitle =
|
|
3875
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
3911
3876
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
3912
3877
|
max: "scale",
|
|
3913
3878
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -3958,7 +3923,6 @@ var messages$C = reactIntl.defineMessages({
|
|
|
3958
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 } } } };
|
|
3959
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 } } } };
|
|
3960
3925
|
const StatePickerInput = _ref => {
|
|
3961
|
-
var _currentOption$data$l, _currentOption$data;
|
|
3962
3926
|
let isClearable = _ref.isClearable,
|
|
3963
3927
|
isDisabled = _ref.isDisabled,
|
|
3964
3928
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -3973,7 +3937,7 @@ const StatePickerInput = _ref => {
|
|
|
3973
3937
|
formatMessage = _useIntl.formatMessage;
|
|
3974
3938
|
const dataLocale = applicationShellConnectors.useApplicationContext(applicationContext => applicationContext.dataLocale);
|
|
3975
3939
|
const variables = React.useMemo(() => ({
|
|
3976
|
-
sortByNamePath:
|
|
3940
|
+
sortByNamePath: `name.${dataLocale}`
|
|
3977
3941
|
}), [dataLocale]);
|
|
3978
3942
|
const convertStateToOption = React.useCallback(state => {
|
|
3979
3943
|
const localizedName = formatLocalizedFieldToString(state.nameAllLocales);
|
|
@@ -3988,7 +3952,7 @@ const StatePickerInput = _ref => {
|
|
|
3988
3952
|
_useState2 = _slicedToArray(_useState, 2),
|
|
3989
3953
|
loadingError = _useState2[0],
|
|
3990
3954
|
setLoadingError = _useState2[1];
|
|
3991
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
3955
|
+
const prefixSearchFields = React.useMemo(() => [`name.${dataLocale}`, 'key'], [dataLocale]);
|
|
3992
3956
|
const loadOptions = useLoadOptions({
|
|
3993
3957
|
query: GetStatesQuery,
|
|
3994
3958
|
variables,
|
|
@@ -4021,13 +3985,13 @@ const StatePickerInput = _ref => {
|
|
|
4021
3985
|
setLoadingError(null);
|
|
4022
3986
|
handleInternalInputChange(event);
|
|
4023
3987
|
}, [handleInternalInputChange]);
|
|
4024
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
3988
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
4025
3989
|
React.useEffect(() => {
|
|
4026
3990
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
4027
3991
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
4028
3992
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
4029
3993
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$C.noStatesFound), [loadingError, formatMessage]);
|
|
4030
|
-
const tooltipTitle =
|
|
3994
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
4031
3995
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
4032
3996
|
max: "scale",
|
|
4033
3997
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -4092,26 +4056,23 @@ const CustomFieldTooltip = _ref => {
|
|
|
4092
4056
|
|
|
4093
4057
|
const setToArray = function () {
|
|
4094
4058
|
let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4095
|
-
return
|
|
4059
|
+
return `id in (${_mapInstanceProperty__default["default"](values).call(values, value => `"${value}"`).join(', ')})`;
|
|
4096
4060
|
};
|
|
4097
4061
|
|
|
4098
4062
|
function capitalizeFirst(text) {
|
|
4099
4063
|
return text.charAt(0).toUpperCase() + _sliceInstanceProperty__default["default"](text).call(text, 1);
|
|
4100
4064
|
}
|
|
4101
4065
|
|
|
4102
|
-
const getCentAmountClause = (value, operator, locale) => {
|
|
4103
|
-
var _context;
|
|
4104
|
-
return _concatInstanceProperty__default["default"](_context = "centAmount ".concat(operator, " ")).call(_context, uiKit.MoneyInput.convertToMoneyValue(value, locale).centAmount);
|
|
4105
|
-
};
|
|
4066
|
+
const getCentAmountClause = (value, operator, locale) => `centAmount ${operator} ${uiKit.MoneyInput.convertToMoneyValue(value, locale).centAmount}`;
|
|
4106
4067
|
function moneyTransformer(value, option, locale) {
|
|
4107
4068
|
const clauses = [];
|
|
4108
4069
|
if (option === FILTER_TYPES.range) {
|
|
4109
|
-
clauses[0] =
|
|
4070
|
+
clauses[0] = `currencyCode = "${value.from.currencyCode}"`;
|
|
4110
4071
|
clauses[1] = getCentAmountClause(value.from, '>=', locale);
|
|
4111
4072
|
clauses[2] = getCentAmountClause(value.to, '<=', locale);
|
|
4112
4073
|
return clauses.join(' and ');
|
|
4113
4074
|
}
|
|
4114
|
-
clauses[0] =
|
|
4075
|
+
clauses[0] = `currencyCode = "${value.currencyCode}"`;
|
|
4115
4076
|
switch (option) {
|
|
4116
4077
|
case FILTER_TYPES.lessThan:
|
|
4117
4078
|
clauses[1] = getCentAmountClause(value, '<', locale);
|
|
@@ -4128,7 +4089,6 @@ function moneyTransformer(value, option, locale) {
|
|
|
4128
4089
|
return clauses.join(' and ');
|
|
4129
4090
|
}
|
|
4130
4091
|
|
|
4131
|
-
var _templateObject$2, _templateObject2$1;
|
|
4132
4092
|
const formatTime = 'HH:mm:ss.SSS';
|
|
4133
4093
|
|
|
4134
4094
|
/* TimeInput only allows HH:mm:ss and adds the seconds as 00 and
|
|
@@ -4150,7 +4110,6 @@ const defaultFilterValidator = _ref => {
|
|
|
4150
4110
|
const timeTransformer = function (filterKey, filters) {
|
|
4151
4111
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator;
|
|
4152
4112
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref2 => {
|
|
4153
|
-
var _context, _context2;
|
|
4154
4113
|
let type = _ref2.type,
|
|
4155
4114
|
value = _ref2.value;
|
|
4156
4115
|
if (!filterValidator({
|
|
@@ -4159,13 +4118,19 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4159
4118
|
})) return '';
|
|
4160
4119
|
switch (type) {
|
|
4161
4120
|
case FILTER_TYPES.lessThan:
|
|
4162
|
-
return
|
|
4121
|
+
return `${filterKey} < "${value}"`;
|
|
4163
4122
|
case FILTER_TYPES.moreThan:
|
|
4164
|
-
return
|
|
4123
|
+
return `${filterKey} > "${value}"`;
|
|
4165
4124
|
case FILTER_TYPES.equalTo:
|
|
4166
|
-
return oneLine__default["default"]
|
|
4125
|
+
return oneLine__default["default"]`
|
|
4126
|
+
(${filterKey} >= "${value}"
|
|
4127
|
+
and ${filterKey} <= "${getEndOfSecond(value)}")
|
|
4128
|
+
`;
|
|
4167
4129
|
case FILTER_TYPES.range:
|
|
4168
|
-
return oneLine__default["default"]
|
|
4130
|
+
return oneLine__default["default"]`
|
|
4131
|
+
(${filterKey} >= "${value.from}"
|
|
4132
|
+
and ${filterKey} <= "${getEndOfSecond(value.to)}")
|
|
4133
|
+
`;
|
|
4169
4134
|
default:
|
|
4170
4135
|
return '';
|
|
4171
4136
|
}
|
|
@@ -4181,7 +4146,7 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4181
4146
|
* (pickUpTime >= "14:00" and pickUpTime <= "15:00")
|
|
4182
4147
|
* ) or some_more_filters
|
|
4183
4148
|
*/
|
|
4184
|
-
return queryString === '' ? null :
|
|
4149
|
+
return queryString === '' ? null : `(${queryString})`;
|
|
4185
4150
|
};
|
|
4186
4151
|
|
|
4187
4152
|
// FIXME: delete once prefix search is supported in ctp api
|
|
@@ -4198,9 +4163,8 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4198
4163
|
// e.g
|
|
4199
4164
|
// where: `masterData(current(name(en >= "${lowerBound}" and en < "${upperBound}")))`
|
|
4200
4165
|
const getPrefixSearchBounds = input => {
|
|
4201
|
-
var _context;
|
|
4202
4166
|
const getNextCharacter = character => String.fromCharCode(character.charCodeAt() + 1);
|
|
4203
|
-
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))}`];
|
|
4204
4168
|
};
|
|
4205
4169
|
|
|
4206
4170
|
const _excluded = ["action"];
|
|
@@ -4393,7 +4357,7 @@ const convertChangeValueAction = actionPayload => {
|
|
|
4393
4357
|
* as its dynamic content can not be typed in SDL for the mutation.
|
|
4394
4358
|
*/
|
|
4395
4359
|
const convertAction = (actionName, actionPayload) => {
|
|
4396
|
-
var
|
|
4360
|
+
var _context3, _context4, _context5;
|
|
4397
4361
|
const getNameFromPayload = payload => {
|
|
4398
4362
|
// changeName for `Organizations`
|
|
4399
4363
|
if (typeof payload.name === 'string') return payload;
|
|
@@ -4451,7 +4415,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4451
4415
|
case 'setCustomType':
|
|
4452
4416
|
return {
|
|
4453
4417
|
[actionName]: {
|
|
4454
|
-
typeId:
|
|
4418
|
+
typeId: actionPayload.type?.id,
|
|
4455
4419
|
fields: actionPayload.fields ? _mapInstanceProperty__default["default"](_context3 = _Object$entries__default["default"](actionPayload.fields)).call(_context3, _ref => {
|
|
4456
4420
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
4457
4421
|
customField = _ref2[0],
|
|
@@ -4481,10 +4445,10 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4481
4445
|
};
|
|
4482
4446
|
case 'setGeoLocation':
|
|
4483
4447
|
return {
|
|
4484
|
-
[actionName]: actionPayload
|
|
4448
|
+
[actionName]: actionPayload?.geoLocation ? {
|
|
4485
4449
|
geoLocation: {
|
|
4486
4450
|
type: 'Point',
|
|
4487
|
-
coordinates: [_parseFloat__default["default"](
|
|
4451
|
+
coordinates: [_parseFloat__default["default"](actionPayload.geoLocation?.longitude), _parseFloat__default["default"](actionPayload.geoLocation?.latitude)]
|
|
4488
4452
|
}
|
|
4489
4453
|
} : {
|
|
4490
4454
|
undefined
|
|
@@ -4620,7 +4584,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4620
4584
|
case 'setShippingRateInputType':
|
|
4621
4585
|
return {
|
|
4622
4586
|
[actionName]: {
|
|
4623
|
-
shippingRateInputType:
|
|
4587
|
+
shippingRateInputType: actionPayload.shippingRateInputType?.type ? {
|
|
4624
4588
|
[actionPayload.shippingRateInputType.type]: {
|
|
4625
4589
|
values: actionPayload.shippingRateInputType.type === 'CartClassification' ? _mapInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](actionPayload.shippingRateInputType)).call(_context4, value => ({
|
|
4626
4590
|
key: value.key,
|
|
@@ -4674,8 +4638,8 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4674
4638
|
case 'addAddress':
|
|
4675
4639
|
case 'changeAddress':
|
|
4676
4640
|
{
|
|
4677
|
-
var
|
|
4678
|
-
const _ref3 =
|
|
4641
|
+
var _context6;
|
|
4642
|
+
const _ref3 = actionPayload.address?.custom || {},
|
|
4679
4643
|
_ref3$fields = _ref3.fields,
|
|
4680
4644
|
fields = _ref3$fields === void 0 ? {} : _ref3$fields;
|
|
4681
4645
|
const customFields = isEmpty__default["default"](fields) ? null : _mapInstanceProperty__default["default"](_context6 = _Object$entries__default["default"](fields)).call(_context6, _ref4 => {
|
|
@@ -4687,7 +4651,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4687
4651
|
value: _JSON$stringify__default["default"](value)
|
|
4688
4652
|
};
|
|
4689
4653
|
});
|
|
4690
|
-
const custom =
|
|
4654
|
+
const custom = actionPayload.address?.custom?.type?.id ? {
|
|
4691
4655
|
type: {
|
|
4692
4656
|
id: actionPayload.address.custom.type.id
|
|
4693
4657
|
},
|
|
@@ -4718,7 +4682,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4718
4682
|
value: _JSON$stringify__default["default"](value)
|
|
4719
4683
|
};
|
|
4720
4684
|
});
|
|
4721
|
-
const customType = type
|
|
4685
|
+
const customType = type?.id ? {
|
|
4722
4686
|
id: type.id
|
|
4723
4687
|
} : null;
|
|
4724
4688
|
return {
|
|
@@ -4741,11 +4705,10 @@ const createGraphQlUpdateActions = actions => _reduceInstanceProperty__default["
|
|
|
4741
4705
|
return [...previousActions, convertAction(actionName, actionPayload)];
|
|
4742
4706
|
}, []);
|
|
4743
4707
|
const extractErrorFromGraphQlResponse = graphQlResponse => {
|
|
4744
|
-
|
|
4745
|
-
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) {
|
|
4746
4709
|
return graphQlResponse.networkError.result.errors;
|
|
4747
4710
|
}
|
|
4748
|
-
if (
|
|
4711
|
+
if (graphQlResponse.graphQLErrors?.length > 0) {
|
|
4749
4712
|
return graphQlResponse.graphQLErrors;
|
|
4750
4713
|
}
|
|
4751
4714
|
return graphQlResponse;
|
|
@@ -4774,16 +4737,14 @@ function omitDeep(obj, fieldsToOmit) {
|
|
|
4774
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; }
|
|
4775
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; }
|
|
4776
4739
|
function getPriceChannelName(price) {
|
|
4777
|
-
|
|
4778
|
-
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;
|
|
4779
4741
|
}
|
|
4780
4742
|
function getDiscountValue(price) {
|
|
4781
|
-
var _price$value, _price$value2, _price$discounted;
|
|
4782
4743
|
let preciseAmount;
|
|
4783
4744
|
let fractionedAmount;
|
|
4784
|
-
if (
|
|
4745
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision && price.discounted.value.type === PRECISION_TYPES.highPrecision) {
|
|
4785
4746
|
preciseAmount = price.value.preciseAmount - price.discounted.value.preciseAmount;
|
|
4786
|
-
} else if (
|
|
4747
|
+
} else if (price.value?.type === PRECISION_TYPES.highPrecision && price.discounted?.value?.type === PRECISION_TYPES.centPrecision) {
|
|
4787
4748
|
fractionedAmount = getFractionedAmount(price.value) - getFractionedAmount(price.discounted.value);
|
|
4788
4749
|
}
|
|
4789
4750
|
return price.discounted ? _objectSpread$13(_objectSpread$13({}, price.value), {}, {
|
|
@@ -4797,28 +4758,23 @@ function getDiscountValue(price) {
|
|
|
4797
4758
|
function getSelectedPrice(price) {
|
|
4798
4759
|
return price.discounted ? price.discounted : price;
|
|
4799
4760
|
}
|
|
4800
|
-
function getNetUnitPrice(
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
shouldRoundAmount = _ref2.shouldRoundAmount;
|
|
4761
|
+
function getNetUnitPrice(_ref) {
|
|
4762
|
+
let lineItem = _ref.lineItem,
|
|
4763
|
+
shouldRoundAmount = _ref.shouldRoundAmount;
|
|
4804
4764
|
const price = getSelectedPrice(lineItem.price);
|
|
4805
|
-
const filteredPerMethodTaxRate = lineItem
|
|
4806
|
-
var _lineItem$shippingDet;
|
|
4807
|
-
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;
|
|
4808
|
-
});
|
|
4765
|
+
const filteredPerMethodTaxRate = lineItem?.perMethodTaxRate?.filter(perMethodTax => lineItem?.shippingDetails?.targets?.findIndex(target => target?.shippingMethodKey === perMethodTax?.shippingMethodKey) >= 0);
|
|
4809
4766
|
|
|
4810
4767
|
// when shipping mode is multi with the same tax rate
|
|
4811
|
-
if (
|
|
4812
|
-
var _price$value3, _price$value4;
|
|
4768
|
+
if (filteredPerMethodTaxRate?.length > 0 && filteredPerMethodTaxRate[0]?.taxRate?.includedInPrice) {
|
|
4813
4769
|
const taxRate = filteredPerMethodTaxRate[0].taxRate;
|
|
4814
4770
|
let centAmount;
|
|
4815
4771
|
// should accept 0 value
|
|
4816
|
-
if (typeof
|
|
4772
|
+
if (typeof price.value?.centAmount === 'number') {
|
|
4817
4773
|
const amount = price.value.centAmount / (1 + taxRate.amount);
|
|
4818
4774
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4819
4775
|
}
|
|
4820
4776
|
let preciseAmount;
|
|
4821
|
-
if (
|
|
4777
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + taxRate.amount);
|
|
4822
4778
|
return _objectSpread$13(_objectSpread$13({}, price.value), {}, {
|
|
4823
4779
|
centAmount,
|
|
4824
4780
|
preciseAmount
|
|
@@ -4827,15 +4783,14 @@ function getNetUnitPrice(_ref2) {
|
|
|
4827
4783
|
|
|
4828
4784
|
// when shipping mode is single
|
|
4829
4785
|
if (lineItem.taxRate && lineItem.taxRate.includedInPrice) {
|
|
4830
|
-
var _price$value5, _price$value6;
|
|
4831
4786
|
let centAmount;
|
|
4832
4787
|
// should accept 0 value
|
|
4833
|
-
if (typeof
|
|
4788
|
+
if (typeof price.value?.centAmount === 'number') {
|
|
4834
4789
|
const amount = price.value.centAmount / (1 + lineItem.taxRate.amount);
|
|
4835
4790
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4836
4791
|
}
|
|
4837
4792
|
let preciseAmount;
|
|
4838
|
-
if (
|
|
4793
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + lineItem.taxRate.amount);
|
|
4839
4794
|
return _objectSpread$13(_objectSpread$13({}, price.value), {}, {
|
|
4840
4795
|
centAmount,
|
|
4841
4796
|
preciseAmount
|
|
@@ -4869,18 +4824,18 @@ const transformCustomFieldFromGraphQLResponse = resource => {
|
|
|
4869
4824
|
key: resource.custom.type.key,
|
|
4870
4825
|
name: l10n.transformLocalizedFieldToLocalizedString(resource.custom.type.nameAllLocales),
|
|
4871
4826
|
fieldDefinitions: _mapInstanceProperty__default["default"](_context = resource.custom.type.fieldDefinitions).call(_context, fieldDefinition => {
|
|
4872
|
-
var
|
|
4827
|
+
var _context2, _context3;
|
|
4873
4828
|
return {
|
|
4874
4829
|
name: fieldDefinition.name,
|
|
4875
4830
|
required: fieldDefinition.required,
|
|
4876
|
-
type:
|
|
4831
|
+
type: fieldDefinition.type?.elementType?.name === 'LocalizedEnum' ? _objectSpread$12(_objectSpread$12({}, fieldDefinition.type), {}, {
|
|
4877
4832
|
elementType: _objectSpread$12(_objectSpread$12({}, fieldDefinition.type.elementType), {}, {
|
|
4878
4833
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
4879
4834
|
key: value.key,
|
|
4880
4835
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
4881
4836
|
}))
|
|
4882
4837
|
})
|
|
4883
|
-
}) :
|
|
4838
|
+
}) : fieldDefinition.type?.name === 'LocalizedEnum' ? _objectSpread$12(_objectSpread$12({}, fieldDefinition.type), {}, {
|
|
4884
4839
|
values: _mapInstanceProperty__default["default"](_context3 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context3, value => ({
|
|
4885
4840
|
key: value.key,
|
|
4886
4841
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -4907,7 +4862,7 @@ const convertProductSelectionFromGraphQl = productSelection => {
|
|
|
4907
4862
|
from: 'nameAllLocales',
|
|
4908
4863
|
to: 'name'
|
|
4909
4864
|
}])), {}, {
|
|
4910
|
-
custom: productSelection
|
|
4865
|
+
custom: productSelection?.custom ? transformCustomFieldFromGraphQLResponse(productSelection) : null
|
|
4911
4866
|
});
|
|
4912
4867
|
};
|
|
4913
4868
|
|
|
@@ -5055,9 +5010,9 @@ CustomFieldDefinitionsConnector.displayName = 'CustomFieldDefinitionsConnector';
|
|
|
5055
5010
|
CustomFieldDefinitionsConnector.defaultProps = {
|
|
5056
5011
|
resources: []
|
|
5057
5012
|
};
|
|
5058
|
-
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();
|
|
5059
5014
|
const mapPropsToOptions = ownProps => {
|
|
5060
|
-
const where = ownProps.resources.length > 0 ?
|
|
5015
|
+
const where = ownProps.resources.length > 0 ? `resourceTypeIds contains any (${stringifyResources$1(ownProps.resources)})` : undefined;
|
|
5061
5016
|
return {
|
|
5062
5017
|
variables: {
|
|
5063
5018
|
where,
|
|
@@ -5126,19 +5081,19 @@ const graphQlDocToForm = typeDefinition => {
|
|
|
5126
5081
|
key: typeDefinition.key,
|
|
5127
5082
|
name: l10n.transformLocalizedFieldToLocalizedString(typeDefinition.nameAllLocales),
|
|
5128
5083
|
fieldDefinitions: _mapInstanceProperty__default["default"](_context = typeDefinition.fieldDefinitions).call(_context, fieldDefinition => {
|
|
5129
|
-
var
|
|
5084
|
+
var _context2, _context3;
|
|
5130
5085
|
return {
|
|
5131
5086
|
name: fieldDefinition.name,
|
|
5132
5087
|
required: fieldDefinition.required,
|
|
5133
5088
|
inputHint: fieldDefinition.inputHint,
|
|
5134
|
-
type:
|
|
5089
|
+
type: fieldDefinition.type?.elementType?.name === 'LocalizedEnum' ? _objectSpread$$(_objectSpread$$({}, fieldDefinition.type), {}, {
|
|
5135
5090
|
elementType: _objectSpread$$(_objectSpread$$({}, fieldDefinition.type.elementType), {}, {
|
|
5136
5091
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
5137
5092
|
key: value.key,
|
|
5138
5093
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
5139
5094
|
}))
|
|
5140
5095
|
})
|
|
5141
|
-
}) :
|
|
5096
|
+
}) : fieldDefinition.type?.name === 'LocalizedEnum' ? _objectSpread$$(_objectSpread$$({}, fieldDefinition.type), {}, {
|
|
5142
5097
|
values: _mapInstanceProperty__default["default"](_context3 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context3, value => ({
|
|
5143
5098
|
key: value.key,
|
|
5144
5099
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -5170,7 +5125,7 @@ const formToGraphQlDoc = formCustomFields => ({
|
|
|
5170
5125
|
// TODO(pa3): find usages and make sure only 1 param is passed
|
|
5171
5126
|
const createEmptyCustomFields = typeDefinition => ({
|
|
5172
5127
|
fields: {},
|
|
5173
|
-
type:
|
|
5128
|
+
type: typeDefinition?.type || {
|
|
5174
5129
|
fieldDefinitions: []
|
|
5175
5130
|
}
|
|
5176
5131
|
});
|
|
@@ -5221,9 +5176,9 @@ CustomFieldTypeDefinitionsConnector.graphQlDocToForm = graphQlDocToForm;
|
|
|
5221
5176
|
CustomFieldTypeDefinitionsConnector.formToRestDoc = formToRestDoc;
|
|
5222
5177
|
CustomFieldTypeDefinitionsConnector.formToGraphQlDoc = formToGraphQlDoc;
|
|
5223
5178
|
CustomFieldTypeDefinitionsConnector.createEmptyCustomFields = createEmptyCustomFields;
|
|
5224
|
-
const stringifyResources = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => "
|
|
5179
|
+
const stringifyResources = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => `"${resource}"`).join();
|
|
5225
5180
|
const createGraphQlOptions = ownProps => {
|
|
5226
|
-
const where = ownProps.resources.length > 0 ?
|
|
5181
|
+
const where = ownProps.resources.length > 0 ? `resourceTypeIds contains any (${stringifyResources(ownProps.resources)})` : undefined;
|
|
5227
5182
|
return {
|
|
5228
5183
|
variables: {
|
|
5229
5184
|
where,
|
|
@@ -5299,7 +5254,7 @@ const extractDuplicatedValues = (values, type, language, languages) => {
|
|
|
5299
5254
|
let validatedValues = [];
|
|
5300
5255
|
if (type.name.toLowerCase() === 'money') {
|
|
5301
5256
|
validatedValues = unique(values, ['amount', 'currencyCode']);
|
|
5302
|
-
} 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') {
|
|
5303
5258
|
validatedValues = unique(values, languages);
|
|
5304
5259
|
} else validatedValues = unique(values);
|
|
5305
5260
|
return validatedValues;
|
|
@@ -5418,7 +5373,7 @@ const DraggableWrapper = _ref => {
|
|
|
5418
5373
|
children: jsxRuntime.jsxs(uiKit.Grid, {
|
|
5419
5374
|
gridTemplateColumns: '1fr 20fr',
|
|
5420
5375
|
gridTemplateRows: "auto 1fr auto",
|
|
5421
|
-
gridGap: uiKit.customProperties.
|
|
5376
|
+
gridGap: uiKit.customProperties.spacingM,
|
|
5422
5377
|
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
5423
5378
|
children: jsxRuntime.jsx(DragHandle, _objectSpread$X({}, provided.dragHandleProps))
|
|
5424
5379
|
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
@@ -5515,7 +5470,6 @@ const getSubfieldLanguage = subfieldName => {
|
|
|
5515
5470
|
return subfieldName.substring(lastDotIndex + 1);
|
|
5516
5471
|
};
|
|
5517
5472
|
function CustomLocalizedTextInput(props) {
|
|
5518
|
-
var _value$language;
|
|
5519
5473
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
5520
5474
|
language: applicationContext.dataLocale,
|
|
5521
5475
|
languages: applicationContext.project.languages
|
|
@@ -5540,7 +5494,7 @@ function CustomLocalizedTextInput(props) {
|
|
|
5540
5494
|
props.setFieldValue(props.name, nullifiedIfNeeded);
|
|
5541
5495
|
});
|
|
5542
5496
|
const InputComponent = isMultiLine ? uiKit.LocalizedMultilineTextInput : uiKit.LocalizedTextInput;
|
|
5543
|
-
const tooltipTitle = isMultiLine ? '' : value ?
|
|
5497
|
+
const tooltipTitle = isMultiLine ? '' : value ? value[language] ?? '' : '';
|
|
5544
5498
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
5545
5499
|
title: tooltipTitle,
|
|
5546
5500
|
children: jsxRuntime.jsx(InputComponent, {
|
|
@@ -5584,8 +5538,7 @@ function CustomBooleanInput(props) {
|
|
|
5584
5538
|
CustomBooleanInput.displayName = 'CustomBooleanInput';
|
|
5585
5539
|
|
|
5586
5540
|
function CustomNumberInput(props) {
|
|
5587
|
-
|
|
5588
|
-
const value = (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : '';
|
|
5541
|
+
const value = props.value ?? '';
|
|
5589
5542
|
const handleChange = makeChangeHandler(rawValue => props.setFieldValue(props.name, !rawValue ? undefined : Number(rawValue)));
|
|
5590
5543
|
return jsxRuntime.jsx(uiKit.NumberInput, {
|
|
5591
5544
|
id: props.name,
|
|
@@ -5630,7 +5583,7 @@ const fixAmount = value => {
|
|
|
5630
5583
|
// data user just entered effectively preventing full data from being entered.
|
|
5631
5584
|
const fixEnteredValue = (newValue, initialValue, currencies) => {
|
|
5632
5585
|
const withFixedCurrency = fixCurrencyCode(newValue, currencies);
|
|
5633
|
-
if (!
|
|
5586
|
+
if (!initialValue?.amount) {
|
|
5634
5587
|
return fixAmount(withFixedCurrency);
|
|
5635
5588
|
}
|
|
5636
5589
|
return withFixedCurrency;
|
|
@@ -5696,13 +5649,12 @@ const convertTypeValuesToOptions$1 = reselect.defaultMemoize((type, dataLocale,
|
|
|
5696
5649
|
key: 'label',
|
|
5697
5650
|
locale: dataLocale,
|
|
5698
5651
|
fallbackOrder: languages,
|
|
5699
|
-
fallback:
|
|
5652
|
+
fallback: `${value.key} (key)`
|
|
5700
5653
|
}),
|
|
5701
5654
|
value: value.key
|
|
5702
5655
|
}));
|
|
5703
5656
|
});
|
|
5704
5657
|
function CustomLocalizedEnumInput(props) {
|
|
5705
|
-
var _options$find$label, _options$find;
|
|
5706
5658
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
5707
5659
|
languages: applicationContext.project.languages,
|
|
5708
5660
|
dataLocale: applicationContext.dataLocale
|
|
@@ -5711,7 +5663,7 @@ function CustomLocalizedEnumInput(props) {
|
|
|
5711
5663
|
dataLocale = _useApplicationContex.dataLocale;
|
|
5712
5664
|
const options = convertTypeValuesToOptions$1(props.fieldDefinition.type, dataLocale, languages);
|
|
5713
5665
|
const handleChange = makeChangeHandler(rawValue => props.setFieldValue(props.name, rawValue));
|
|
5714
|
-
const tooltipTitle = props.value ?
|
|
5666
|
+
const tooltipTitle = props.value ? _findInstanceProperty__default["default"](options).call(options, option => option.value === props.value)?.label ?? '' : '';
|
|
5715
5667
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
5716
5668
|
title: tooltipTitle,
|
|
5717
5669
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
@@ -5731,8 +5683,7 @@ function CustomLocalizedEnumInput(props) {
|
|
|
5731
5683
|
CustomLocalizedEnumInput.displayName = 'CustomLocalizedEnumInput';
|
|
5732
5684
|
|
|
5733
5685
|
function CustomRawIdReferenceInput(props) {
|
|
5734
|
-
|
|
5735
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
5686
|
+
const value = props.value?.id || '';
|
|
5736
5687
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
5737
5688
|
title: value,
|
|
5738
5689
|
children: jsxRuntime.jsx(uiKit.TextInput, {
|
|
@@ -5777,7 +5728,7 @@ function getCategoriesByIds(apolloClient, options) {
|
|
|
5777
5728
|
return apolloClient.query({
|
|
5778
5729
|
query: FetchCategoriesByIds,
|
|
5779
5730
|
variables: {
|
|
5780
|
-
where:
|
|
5731
|
+
where: `id in (${_mapInstanceProperty__default["default"](_context2 = options.ids).call(_context2, id => `"${id}"`).join(', ')})`
|
|
5781
5732
|
},
|
|
5782
5733
|
context: {
|
|
5783
5734
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -5876,13 +5827,10 @@ const useReferenceSearchItems = _ref => {
|
|
|
5876
5827
|
};
|
|
5877
5828
|
};
|
|
5878
5829
|
function ReferenceSearch(props) {
|
|
5879
|
-
const ids = React.useMemo(() => {
|
|
5880
|
-
|
|
5881
|
-
return
|
|
5882
|
-
|
|
5883
|
-
return id;
|
|
5884
|
-
}) : [(_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.id] : [];
|
|
5885
|
-
}, [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]);
|
|
5886
5834
|
const _useReferenceSearchIt = useReferenceSearchItems({
|
|
5887
5835
|
loadItemsBySearchTerm: props.loadItemsBySearchTerm,
|
|
5888
5836
|
loadItemsByIds: props.loadItemsByIds,
|
|
@@ -5893,14 +5841,14 @@ function ReferenceSearch(props) {
|
|
|
5893
5841
|
areSomeItemsMissing = _useReferenceSearchIt.areSomeItemsMissing,
|
|
5894
5842
|
handleLoadItems = _useReferenceSearchIt.handleLoadItems;
|
|
5895
5843
|
if (areItemsLoading) return null;
|
|
5896
|
-
const value = props.isMulti ? items : items
|
|
5844
|
+
const value = props.isMulti ? items : items?.[0];
|
|
5897
5845
|
let filterValue = null;
|
|
5898
5846
|
if (value) filterValue = props.isMulti ? _mapInstanceProperty__default["default"](value).call(value, props.mapItemToOption) : props.mapItemToOption(value);
|
|
5899
5847
|
const tooltipTitle = value || props.value ? props.mapItemToOption(value || props.value).label : '';
|
|
5900
5848
|
const loadItems = value => _Promise__default["default"].resolve(handleLoadItems(value)).then(items => _mapInstanceProperty__default["default"](items).call(items, item => props.mapItemToOption(item)));
|
|
5901
5849
|
const handleChange = event => {
|
|
5902
|
-
var _context
|
|
5903
|
-
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;
|
|
5904
5852
|
props.onChange(option);
|
|
5905
5853
|
};
|
|
5906
5854
|
return jsxRuntime.jsxs("div", {
|
|
@@ -5971,9 +5919,8 @@ const messages$B = reactIntl.defineMessages({
|
|
|
5971
5919
|
});
|
|
5972
5920
|
|
|
5973
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; }
|
|
5974
|
-
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; }
|
|
5975
5923
|
function Option$1(props) {
|
|
5976
|
-
var _context, _context2;
|
|
5977
5924
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
5978
5925
|
language: applicationContext.dataLocale,
|
|
5979
5926
|
languages: applicationContext.project.languages
|
|
@@ -5994,19 +5941,19 @@ function Option$1(props) {
|
|
|
5994
5941
|
fallbackOrder: languages
|
|
5995
5942
|
})
|
|
5996
5943
|
}), category.parent && jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
5997
|
-
children:
|
|
5944
|
+
children: `${formatMessage(messages$B.parentCategory)}: ${l10n.formatLocalizedString(category.parent, {
|
|
5998
5945
|
key: 'name',
|
|
5999
5946
|
locale: language,
|
|
6000
5947
|
fallbackOrder: languages
|
|
6001
|
-
})
|
|
5948
|
+
})}`
|
|
6002
5949
|
}), jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
6003
|
-
children:
|
|
5950
|
+
children: `Slug: ${l10n.formatLocalizedString(category, {
|
|
6004
5951
|
key: 'slug',
|
|
6005
5952
|
locale: language,
|
|
6006
5953
|
fallbackOrder: languages
|
|
6007
|
-
})
|
|
5954
|
+
})}`
|
|
6008
5955
|
}), category.externalId && jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
6009
|
-
children:
|
|
5956
|
+
children: `${formatMessage(messages$B.externalId)}: ${category.externalId || constants.NO_VALUE_FALLBACK}`
|
|
6010
5957
|
})]
|
|
6011
5958
|
})
|
|
6012
5959
|
}));
|
|
@@ -6069,7 +6016,7 @@ var CategorySearchPickerOptionFragment$1 = { kind: "Document", definitions: [{ k
|
|
|
6069
6016
|
function useCachedCategoryOptions(ids) {
|
|
6070
6017
|
const apolloClient = client.useApolloClient();
|
|
6071
6018
|
const fragments = _mapInstanceProperty__default["default"](ids).call(ids, id => apolloClient.readFragment({
|
|
6072
|
-
id:
|
|
6019
|
+
id: `CategorySearch:${id}`,
|
|
6073
6020
|
fragment: CategorySearchPickerOptionFragment$1
|
|
6074
6021
|
}));
|
|
6075
6022
|
return _mapInstanceProperty__default["default"](fragments).call(fragments, category => transformLocalizedFieldsForCategory(category, [{
|
|
@@ -6084,8 +6031,8 @@ function useCachedCategoryOptions(ids) {
|
|
|
6084
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 } } } };
|
|
6085
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 } } } };
|
|
6086
6033
|
const transformCartDiscountResponse = response => {
|
|
6087
|
-
var _context
|
|
6088
|
-
return _mapInstanceProperty__default["default"](_context =
|
|
6034
|
+
var _context;
|
|
6035
|
+
return _mapInstanceProperty__default["default"](_context = response.data?.cartDiscounts.results || []).call(_context, cartDiscount => transformLocalizedFieldsForCartDiscount(cartDiscount));
|
|
6089
6036
|
};
|
|
6090
6037
|
function queryCartDiscounts(apolloClient) {
|
|
6091
6038
|
return apolloClient.query({
|
|
@@ -6097,14 +6044,14 @@ function queryCartDiscounts(apolloClient) {
|
|
|
6097
6044
|
}).then(transformCartDiscountResponse);
|
|
6098
6045
|
}
|
|
6099
6046
|
const getWhereClause = function () {
|
|
6100
|
-
var _context2, _context3
|
|
6047
|
+
var _context2, _context3;
|
|
6101
6048
|
let searchText = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
6102
6049
|
let language = arguments.length > 1 ? arguments[1] : undefined;
|
|
6103
6050
|
const query = _trimInstanceProperty__default["default"](_context2 = _JSON$stringify__default["default"](searchText)).call(_context2);
|
|
6104
|
-
const idQuery = isUUID(searchText) &&
|
|
6105
|
-
const nameQuery =
|
|
6106
|
-
const keyQuery =
|
|
6107
|
-
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 ');
|
|
6108
6055
|
};
|
|
6109
6056
|
function searchCartDiscountsByExactMatch(apolloClient, options) {
|
|
6110
6057
|
return apolloClient.query({
|
|
@@ -6127,10 +6074,7 @@ function getCartDiscountById(apolloClient, options) {
|
|
|
6127
6074
|
context: {
|
|
6128
6075
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
6129
6076
|
}
|
|
6130
|
-
}).then(response =>
|
|
6131
|
-
var _response$data2;
|
|
6132
|
-
return (_response$data2 = response.data) !== null && _response$data2 !== void 0 && _response$data2.cartDiscount ? transformLocalizedFieldsForCartDiscount(response.data.cartDiscount) : null;
|
|
6133
|
-
});
|
|
6077
|
+
}).then(response => response.data?.cartDiscount ? transformLocalizedFieldsForCartDiscount(response.data.cartDiscount) : null);
|
|
6134
6078
|
}
|
|
6135
6079
|
|
|
6136
6080
|
const messages$A = reactIntl.defineMessages({
|
|
@@ -6207,7 +6151,7 @@ function CartDiscountReferenceSearch(props) {
|
|
|
6207
6151
|
}),
|
|
6208
6152
|
loading = _useQuery.loading,
|
|
6209
6153
|
data = _useQuery.data;
|
|
6210
|
-
const isExactMatch =
|
|
6154
|
+
const isExactMatch = data?.cartDiscounts.total > QUERY_MAX_LIMIT;
|
|
6211
6155
|
const _useIntl = reactIntl.useIntl(),
|
|
6212
6156
|
formatMessage = _useIntl.formatMessage;
|
|
6213
6157
|
const apolloClient = client.useApolloClient();
|
|
@@ -6344,7 +6288,6 @@ const DropdownIndicator = () => jsxRuntime.jsx(uiKit.SearchIcon, {
|
|
|
6344
6288
|
});
|
|
6345
6289
|
DropdownIndicator.displayName = 'DropdownIndicator';
|
|
6346
6290
|
const ProductPickerInput = _ref => {
|
|
6347
|
-
var _currentOption$data$l, _currentOption$data;
|
|
6348
6291
|
let isClearable = _ref.isClearable,
|
|
6349
6292
|
isDisabled = _ref.isDisabled,
|
|
6350
6293
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -6364,20 +6307,19 @@ const ProductPickerInput = _ref => {
|
|
|
6364
6307
|
loadingError = _useState2[0],
|
|
6365
6308
|
setLoadingError = _useState2[1];
|
|
6366
6309
|
const convertProductToOption = React.useCallback(product => {
|
|
6367
|
-
var _masterData$current;
|
|
6368
6310
|
if (!product) return null;
|
|
6369
6311
|
const id = product.id,
|
|
6370
6312
|
key = product.key,
|
|
6371
6313
|
masterData = product.masterData;
|
|
6372
|
-
const localizedName = formatLocalizedFieldToString(
|
|
6314
|
+
const localizedName = formatLocalizedFieldToString(masterData.current?.nameAllLocales);
|
|
6373
6315
|
return {
|
|
6374
|
-
label: localizedName + (key ?
|
|
6316
|
+
label: localizedName + (key ? ` (key: ${key})` : ''),
|
|
6375
6317
|
value: id,
|
|
6376
6318
|
name: localizedName,
|
|
6377
6319
|
key
|
|
6378
6320
|
};
|
|
6379
6321
|
}, [formatLocalizedFieldToString]);
|
|
6380
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
6322
|
+
const prefixSearchFields = React.useMemo(() => [`masterData.current.name.${dataLocale}`, 'key'], [dataLocale]);
|
|
6381
6323
|
const loadOptions = useLoadOptions({
|
|
6382
6324
|
query: GetProductsQuery,
|
|
6383
6325
|
prefixSearchFields
|
|
@@ -6408,12 +6350,12 @@ const ProductPickerInput = _ref => {
|
|
|
6408
6350
|
setLoadingError(null);
|
|
6409
6351
|
handleInternalInputChange(event);
|
|
6410
6352
|
}, [handleInternalInputChange]);
|
|
6411
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
6353
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
6412
6354
|
React.useEffect(() => {
|
|
6413
6355
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
6414
6356
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
6415
6357
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
6416
|
-
const tooltipTitle =
|
|
6358
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
6417
6359
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
6418
6360
|
max: "scale",
|
|
6419
6361
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -6450,8 +6392,7 @@ const ProductPickerInput = _ref => {
|
|
|
6450
6392
|
ProductPickerInput.displayName = 'ProductPickerInput';
|
|
6451
6393
|
|
|
6452
6394
|
function CustomProductReferenceInput(props) {
|
|
6453
|
-
|
|
6454
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6395
|
+
const value = props.value?.id || '';
|
|
6455
6396
|
return jsxRuntime.jsx(ProductPickerInput, {
|
|
6456
6397
|
value: value,
|
|
6457
6398
|
name: props.name,
|
|
@@ -6468,8 +6409,7 @@ function CustomProductReferenceInput(props) {
|
|
|
6468
6409
|
CustomProductReferenceInput.displayName = 'CustomProductReferenceInput';
|
|
6469
6410
|
|
|
6470
6411
|
function CustomProductTypeReferenceInput(props) {
|
|
6471
|
-
|
|
6472
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6412
|
+
const value = props.value?.id || '';
|
|
6473
6413
|
return jsxRuntime.jsx(ProductTypePickerInput, {
|
|
6474
6414
|
value: value,
|
|
6475
6415
|
name: props.name,
|
|
@@ -6485,8 +6425,7 @@ function CustomProductTypeReferenceInput(props) {
|
|
|
6485
6425
|
CustomProductTypeReferenceInput.displayName = 'CustomProductTypeReferenceInput';
|
|
6486
6426
|
|
|
6487
6427
|
function CustomChannelReferenceInput(props) {
|
|
6488
|
-
|
|
6489
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6428
|
+
const value = props.value?.id || '';
|
|
6490
6429
|
return jsxRuntime.jsx(ChannelPickerInput, {
|
|
6491
6430
|
value: value,
|
|
6492
6431
|
name: props.name,
|
|
@@ -6502,8 +6441,7 @@ function CustomChannelReferenceInput(props) {
|
|
|
6502
6441
|
CustomChannelReferenceInput.displayName = 'CustomChannelReferenceInput';
|
|
6503
6442
|
|
|
6504
6443
|
function CustomStateReferenceInput(props) {
|
|
6505
|
-
|
|
6506
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6444
|
+
const value = props.value?.id || '';
|
|
6507
6445
|
return jsxRuntime.jsx(StatePickerInput, {
|
|
6508
6446
|
value: value,
|
|
6509
6447
|
name: props.name,
|
|
@@ -6612,14 +6550,13 @@ function CustomTimeInput(props) {
|
|
|
6612
6550
|
CustomTimeInput.displayName = 'CustomTimeInput';
|
|
6613
6551
|
|
|
6614
6552
|
const convertTypeValuesToOptions = reselect.defaultMemoize(typeValues => _mapInstanceProperty__default["default"](typeValues).call(typeValues, typeValue => ({
|
|
6615
|
-
label: typeValue.label ||
|
|
6553
|
+
label: typeValue.label || `${typeValue.key} (key)`,
|
|
6616
6554
|
value: typeValue.key
|
|
6617
6555
|
})));
|
|
6618
6556
|
function CustomEnumInput(props) {
|
|
6619
|
-
var _options$find$label, _options$find;
|
|
6620
6557
|
const options = convertTypeValuesToOptions(_valuesInstanceProperty__default["default"](props.fieldDefinition.type));
|
|
6621
6558
|
const handleChange = makeChangeHandler(rawValue => props.setFieldValue(props.name, rawValue));
|
|
6622
|
-
const tooltipTitle = props.value ?
|
|
6559
|
+
const tooltipTitle = props.value ? _findInstanceProperty__default["default"](options).call(options, option => option.value === props.value)?.label ?? '' : '';
|
|
6623
6560
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
6624
6561
|
title: tooltipTitle,
|
|
6625
6562
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
@@ -6691,9 +6628,9 @@ function ownKeys$P(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
6691
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; }
|
|
6692
6629
|
const getTypeName = type => type.name.toLowerCase();
|
|
6693
6630
|
const findLabel = (enumType, key) => {
|
|
6694
|
-
var
|
|
6631
|
+
var _context;
|
|
6695
6632
|
const emptyValue = getTypeName(enumType) === 'enum' ? '' : {};
|
|
6696
|
-
return
|
|
6633
|
+
return _findInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](enumType)).call(_context, value => value.key === key)?.label ?? emptyValue;
|
|
6697
6634
|
};
|
|
6698
6635
|
const convertEnumValues = (value, attributeDefinition) => {
|
|
6699
6636
|
var _context2, _context3;
|
|
@@ -6757,7 +6694,7 @@ const attributesMapToNameValuePairs = map => {
|
|
|
6757
6694
|
|
|
6758
6695
|
const getAttributeShortName = (fullName, attributesPrefix) => {
|
|
6759
6696
|
if (!attributesPrefix) return fullName;
|
|
6760
|
-
return fullName.replace(
|
|
6697
|
+
return fullName.replace(`${attributesPrefix}.`, '');
|
|
6761
6698
|
};
|
|
6762
6699
|
function ProductAttributes(props) {
|
|
6763
6700
|
const formik$1 = formik.useFormikContext();
|
|
@@ -6839,19 +6776,19 @@ function ownKeys$O(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
6839
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; }
|
|
6840
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 } } } };
|
|
6841
6778
|
const mapAttributeDefinition = definition => {
|
|
6842
|
-
var _context,
|
|
6779
|
+
var _context, _context2, _context3, _context4;
|
|
6843
6780
|
return _objectSpread$O(_objectSpread$O({}, definition), {}, {
|
|
6844
6781
|
required: definition.isRequired,
|
|
6845
6782
|
inputTip: l10n.transformLocalizedFieldToLocalizedString(definition.inputTipAllLocales),
|
|
6846
6783
|
label: l10n.transformLocalizedFieldToLocalizedString(definition.labelAllLocales),
|
|
6847
|
-
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), {}, {
|
|
6848
6785
|
elementType: _objectSpread$O(_objectSpread$O({}, definition.type.elementType), {}, {
|
|
6849
6786
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](definition.type.elementType).results).call(_context2, value => ({
|
|
6850
6787
|
key: value.key,
|
|
6851
6788
|
label: value.label || l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
6852
6789
|
}))
|
|
6853
6790
|
})
|
|
6854
|
-
}) : _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), {}, {
|
|
6855
6792
|
values: _mapInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](definition.type).results).call(_context4, value => ({
|
|
6856
6793
|
key: value.key,
|
|
6857
6794
|
label: value.label || l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -7174,15 +7111,21 @@ CustomNestedInput.displayName = 'CustomNestedInput';
|
|
|
7174
7111
|
|
|
7175
7112
|
var styles$d = {
|
|
7176
7113
|
"divider": "divider-module__divider___4-vdy",
|
|
7114
|
+
"divider-horizontal": "divider-module__divider-horizontal___RuUcj",
|
|
7115
|
+
"divider-vertical": "divider-module__divider-vertical___32kJG",
|
|
7177
7116
|
"divider-solid": "divider-module__divider-solid___3Fs4q divider-module__divider___4-vdy",
|
|
7178
7117
|
"divider-dashed": "divider-module__divider-dashed___2Em8A divider-module__divider___4-vdy"
|
|
7179
7118
|
};
|
|
7180
7119
|
function Divider(_ref) {
|
|
7181
|
-
let isDashed = _ref.isDashed
|
|
7120
|
+
let isDashed = _ref.isDashed,
|
|
7121
|
+
_ref$orientation = _ref.orientation,
|
|
7122
|
+
orientation = _ref$orientation === void 0 ? 'horizontal' : _ref$orientation;
|
|
7182
7123
|
return jsxRuntime.jsx("hr", {
|
|
7183
7124
|
className: classnames__default["default"]({
|
|
7184
7125
|
[styles$d['divider-solid']]: !isDashed,
|
|
7185
|
-
[styles$d['divider-dashed']]: isDashed
|
|
7126
|
+
[styles$d['divider-dashed']]: isDashed,
|
|
7127
|
+
[styles$d['divider-horizontal']]: orientation === 'horizontal',
|
|
7128
|
+
[styles$d['divider-vertical']]: orientation === 'vertical'
|
|
7186
7129
|
})
|
|
7187
7130
|
});
|
|
7188
7131
|
}
|
|
@@ -7196,7 +7139,7 @@ const ExpandButton = props => props.totalValues > 1 ? jsxRuntime.jsxs(uiKit.Spac
|
|
|
7196
7139
|
}), jsxRuntime.jsx(uiKit.FlatButton, {
|
|
7197
7140
|
tone: "primary",
|
|
7198
7141
|
icon: props.isExpanded ? jsxRuntime.jsx(uiKit.AngleUpIcon, {}) : jsxRuntime.jsx(uiKit.AngleDownIcon, {}),
|
|
7199
|
-
label: props.isExpanded ?
|
|
7142
|
+
label: props.isExpanded ? `Hide set items (${props.totalValues})` : `Show all set items (${props.totalValues})`,
|
|
7200
7143
|
onClick: props.onExpand
|
|
7201
7144
|
})]
|
|
7202
7145
|
}) : null;
|
|
@@ -7231,7 +7174,7 @@ const SetButtons = props => {
|
|
|
7231
7174
|
SetButtons.displayName = 'SetButtons';
|
|
7232
7175
|
|
|
7233
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; }
|
|
7234
|
-
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; }
|
|
7235
7178
|
const getDuplicateErrors = setValues => {
|
|
7236
7179
|
/* eslint-disable no-plusplus */
|
|
7237
7180
|
const result = [];
|
|
@@ -7272,13 +7215,10 @@ const getItemIndex = name => {
|
|
|
7272
7215
|
return _parseInt__default["default"](rawIndex, 10);
|
|
7273
7216
|
};
|
|
7274
7217
|
const makeKeys = amount => times__default["default"](amount, () => uuid.v4());
|
|
7275
|
-
const makeItemFieldName = (fieldName, index) => {
|
|
7276
|
-
var _context;
|
|
7277
|
-
return _concatInstanceProperty__default["default"](_context = "".concat(fieldName, ".[")).call(_context, index, "]");
|
|
7278
|
-
};
|
|
7218
|
+
const makeItemFieldName = (fieldName, index) => `${fieldName}.[${index}]`;
|
|
7279
7219
|
const makeMapForAllItems = (fieldName, items, value) => _reduceInstanceProperty__default["default"](items).call(items, (result, item, index) => set__default["default"](result, makeItemFieldName(fieldName, index), value), {});
|
|
7280
7220
|
function CustomInputSet(props) {
|
|
7281
|
-
var
|
|
7221
|
+
var _context;
|
|
7282
7222
|
const _useToggleState = uiKit.useToggleState(false),
|
|
7283
7223
|
_useToggleState2 = _slicedToArray(_useToggleState, 2),
|
|
7284
7224
|
isExpanded = _useToggleState2[0],
|
|
@@ -7300,7 +7240,7 @@ function CustomInputSet(props) {
|
|
|
7300
7240
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
7301
7241
|
keys = _useState4[0],
|
|
7302
7242
|
setKeys = _useState4[1];
|
|
7303
|
-
const totalAmount = internalValue
|
|
7243
|
+
const totalAmount = internalValue?.length;
|
|
7304
7244
|
const amountToRender = isExpanded ? totalAmount : 1;
|
|
7305
7245
|
const updateInternalValue = newValue => {
|
|
7306
7246
|
const valueToSet = isEmpty$1(newValue) ? [undefined] : newValue;
|
|
@@ -7347,8 +7287,8 @@ function CustomInputSet(props) {
|
|
|
7347
7287
|
// in <CustomFieldComponent /> where proper component for given field/attribute
|
|
7348
7288
|
// type is selected.
|
|
7349
7289
|
const type = getType(props.fieldDefinition);
|
|
7350
|
-
const typeName = type
|
|
7351
|
-
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);
|
|
7352
7292
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
7353
7293
|
children: [jsxRuntime.jsx(uiKit.AccessibleHidden, {
|
|
7354
7294
|
children: jsxRuntime.jsx("label", {
|
|
@@ -7426,14 +7366,12 @@ const nonSetComponents = {
|
|
|
7426
7366
|
};
|
|
7427
7367
|
const CustomFieldInput = /*#__PURE__*/React.memo(props => {
|
|
7428
7368
|
const InputComponent = React.useMemo(() => {
|
|
7429
|
-
|
|
7430
|
-
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();
|
|
7431
7370
|
if (typeName === 'set') {
|
|
7432
|
-
var _getSetElementType;
|
|
7433
7371
|
// Boolean is the only set element with peculiarities (i.e. way more
|
|
7434
7372
|
// convenient for user to work with it as with select input with three values:
|
|
7435
7373
|
// [true], [false] and [true, false]).
|
|
7436
|
-
if (
|
|
7374
|
+
if (getType(props.fieldDefinition)?.name.toLowerCase() === CUSTOM_FIELD_TYPES.boolean) {
|
|
7437
7375
|
return CustomBooleanInputSet;
|
|
7438
7376
|
}
|
|
7439
7377
|
// All the rest sets are just a fancy wrapper around single-item components
|
|
@@ -7524,9 +7462,9 @@ const CustomFieldErrors = props => {
|
|
|
7524
7462
|
const didFormValidationFail = useDidFormValidationFail();
|
|
7525
7463
|
const errors = _Array$isArray__default["default"](props.errors) ? mergeSetItemsErrors(props.errors) : props.errors;
|
|
7526
7464
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
7527
|
-
children: [props.isTouched || didFormValidationFail &&
|
|
7465
|
+
children: [props.isTouched || didFormValidationFail && errors?.missing && jsxRuntime.jsx(_.ErrorMessage, {
|
|
7528
7466
|
intlMessage: messages$K.required
|
|
7529
|
-
}), props.isTouched || didFormValidationFail &&
|
|
7467
|
+
}), props.isTouched || didFormValidationFail && errors?.duplicated && jsxRuntime.jsx(_.ErrorMessage, {
|
|
7530
7468
|
intlMessage: messages$K.unique
|
|
7531
7469
|
})]
|
|
7532
7470
|
});
|
|
@@ -7575,10 +7513,9 @@ function ownKeys$J(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
7575
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; }
|
|
7576
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 } } } };
|
|
7577
7515
|
const CustomFieldsLabelHint = _ref2 => {
|
|
7578
|
-
var _type$name;
|
|
7579
7516
|
let fieldDefinition = _ref2.fieldDefinition;
|
|
7580
7517
|
const type = getType(fieldDefinition);
|
|
7581
|
-
const isReference =
|
|
7518
|
+
const isReference = type.name?.toLowerCase() === 'reference';
|
|
7582
7519
|
const referenceTypeId = type.referenceTypeId;
|
|
7583
7520
|
const isCartDiscountsReference = isReference && referenceTypeId === SEARCHABLE_REFERENCES.cartDiscount;
|
|
7584
7521
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
@@ -7596,7 +7533,7 @@ const CustomFieldsLabelHint = _ref2 => {
|
|
|
7596
7533
|
data = _useQuery.data,
|
|
7597
7534
|
loading = _useQuery.loading;
|
|
7598
7535
|
if (loading) return null;
|
|
7599
|
-
if (
|
|
7536
|
+
if (data?.cartDiscounts.total > QUERY_MAX_LIMIT) {
|
|
7600
7537
|
return jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
7601
7538
|
alignItems: "center",
|
|
7602
7539
|
children: [jsxRuntime.jsx(uiKit.WarningIcon, {
|
|
@@ -7623,17 +7560,17 @@ function CustomFieldsProductTypeReferenceSubtitle() {
|
|
|
7623
7560
|
// TODO(pa3): this logic may be misplaced and probably
|
|
7624
7561
|
// should belong to <CustomReferenceInput /> component instead.
|
|
7625
7562
|
function CustomFieldsLabelSubtitle(_ref3) {
|
|
7626
|
-
var
|
|
7563
|
+
var _context;
|
|
7627
7564
|
let fieldDefinition = _ref3.fieldDefinition;
|
|
7628
7565
|
const _useIntl2 = reactIntl.useIntl(),
|
|
7629
7566
|
formatMessage = _useIntl2.formatMessage;
|
|
7630
7567
|
const type = getType(fieldDefinition);
|
|
7631
|
-
const isReference =
|
|
7568
|
+
const isReference = type.name?.toLowerCase() === 'reference';
|
|
7632
7569
|
if (!isReference) return null;
|
|
7633
7570
|
const referenceTypeId = type.referenceTypeId;
|
|
7634
7571
|
const referenceTypeName = capitalizeFirst(referenceTypeId);
|
|
7635
7572
|
if (_includesInstanceProperty__default["default"](_context = [SEARCHABLE_REFERENCES.category, SEARCHABLE_REFERENCES.cartDiscount]).call(_context, referenceTypeId)) return referenceTypeName;
|
|
7636
|
-
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`;
|
|
7637
7574
|
}
|
|
7638
7575
|
const Portal = props => /*#__PURE__*/ReactDOM__default["default"].createPortal(props.children, document.body);
|
|
7639
7576
|
var _ref = {
|
|
@@ -7645,7 +7582,7 @@ function CustomFieldsCountIndicator(_ref4) {
|
|
|
7645
7582
|
const formatLocalizedField = useFormatLocalizedFieldToString();
|
|
7646
7583
|
const _useIntl3 = reactIntl.useIntl(),
|
|
7647
7584
|
formatMessage = _useIntl3.formatMessage;
|
|
7648
|
-
return
|
|
7585
|
+
return assignedAttributeGroups?.length > 1 ? jsxRuntime.jsx(uiKit.Tooltip, {
|
|
7649
7586
|
title: formatMessage(messages$v.attributeGroupCountTooltip, {
|
|
7650
7587
|
attributeGroups: _mapInstanceProperty__default["default"](assignedAttributeGroups).call(assignedAttributeGroups, assignedAttributeGroup => formatLocalizedField(assignedAttributeGroup.nameAllLocales)).join(', '),
|
|
7651
7588
|
count: assignedAttributeGroups.length
|
|
@@ -7703,9 +7640,8 @@ const CustomFieldsLabel = /*#__PURE__*/React.memo(_ref5 => {
|
|
|
7703
7640
|
CustomFieldsLabel.displayName = 'CustomFieldsTitle';
|
|
7704
7641
|
|
|
7705
7642
|
const getFieldName = (parentName, fieldName) => {
|
|
7706
|
-
var _context;
|
|
7707
7643
|
if (!parentName) return fieldName;
|
|
7708
|
-
return
|
|
7644
|
+
return `${parentName}.${fieldName}`;
|
|
7709
7645
|
};
|
|
7710
7646
|
const isNested = fieldDefinition => {
|
|
7711
7647
|
const type = fieldDefinition.type;
|
|
@@ -7730,7 +7666,6 @@ const CustomFieldsInternal = props => {
|
|
|
7730
7666
|
isDragAndDropMode = _useDnDContext.isDragAndDropMode;
|
|
7731
7667
|
return jsxRuntime.jsx(DroppableWrapper, {
|
|
7732
7668
|
children: _mapInstanceProperty__default["default"](fieldDefinitions).call(fieldDefinitions, (fieldDefinition, index) => {
|
|
7733
|
-
var _context2;
|
|
7734
7669
|
const fieldName = getFieldName(props.name, fieldDefinition.name);
|
|
7735
7670
|
const isTouched = Boolean(formik.getIn(touched, fieldName));
|
|
7736
7671
|
const fieldErrors = formik.getIn(errors, fieldName);
|
|
@@ -7747,51 +7682,48 @@ const CustomFieldsInternal = props => {
|
|
|
7747
7682
|
return jsxRuntime.jsx(formik.FastField, {
|
|
7748
7683
|
name: fieldName,
|
|
7749
7684
|
validate: validate,
|
|
7750
|
-
children: () => {
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
children: jsxRuntime.
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
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, {
|
|
7702
|
+
name: fieldName,
|
|
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, {
|
|
7763
7710
|
name: fieldName,
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
onBlur: handleBlur,
|
|
7775
|
-
setFieldValue: props.setFieldValue
|
|
7776
|
-
}) : jsxRuntime.jsx(CustomFieldInput, {
|
|
7777
|
-
name: fieldName,
|
|
7778
|
-
value: value,
|
|
7779
|
-
fieldDefinition: fieldDefinition,
|
|
7780
|
-
isDisabled: props.isDisabled || isDragAndDropMode,
|
|
7781
|
-
isReadOnly: props.isReadOnly,
|
|
7782
|
-
onBlur: handleBlur,
|
|
7783
|
-
setFieldValue: props.setFieldValue,
|
|
7784
|
-
hasError: hasError
|
|
7785
|
-
}), jsxRuntime.jsx(CustomFieldErrors, {
|
|
7786
|
-
isTouched: isTouched,
|
|
7787
|
-
errors: fieldErrors
|
|
7788
|
-
})]
|
|
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
|
|
7789
7721
|
})]
|
|
7790
|
-
})
|
|
7722
|
+
})]
|
|
7791
7723
|
})
|
|
7792
|
-
})
|
|
7793
|
-
}
|
|
7794
|
-
},
|
|
7724
|
+
})
|
|
7725
|
+
})
|
|
7726
|
+
}, `${fieldName}-${index}`);
|
|
7795
7727
|
})
|
|
7796
7728
|
});
|
|
7797
7729
|
};
|
|
@@ -7847,7 +7779,7 @@ var pickerMessages = reactIntl.defineMessages({
|
|
|
7847
7779
|
});
|
|
7848
7780
|
|
|
7849
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; }
|
|
7850
|
-
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; }
|
|
7851
7783
|
const PRODUCT_SELECTION_MODES = {
|
|
7852
7784
|
INCLUSION: 'Individual',
|
|
7853
7785
|
EXCLUSION: 'IndividualExclusion'
|
|
@@ -7858,11 +7790,10 @@ const PRODUCT_SELECTION_MODES_LABELS = {
|
|
|
7858
7790
|
};
|
|
7859
7791
|
const getMode = mode => mode === PRODUCT_SELECTION_MODES.INCLUSION || mode === PRODUCT_SELECTION_MODES_LABELS.INCLUSION ? 'inclusion' : 'exclusion';
|
|
7860
7792
|
const addModeToLabel = function (ps) {
|
|
7861
|
-
var _context;
|
|
7862
7793
|
let enableExcludingProducts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
7863
7794
|
if (!ps) return undefined;
|
|
7864
7795
|
return _objectSpread$I(_objectSpread$I({}, ps), {}, {
|
|
7865
|
-
label:
|
|
7796
|
+
label: `${ps?.label}${enableExcludingProducts ? ` (type: ${getMode(ps?.mode)})` : ''}`
|
|
7866
7797
|
});
|
|
7867
7798
|
};
|
|
7868
7799
|
|
|
@@ -7874,7 +7805,6 @@ const mapProductSelectionsToOptions$1 = memoize__default["default"](function ()
|
|
|
7874
7805
|
let enableExcludingProducts = arguments.length > 4 ? arguments[4] : undefined;
|
|
7875
7806
|
const selectedPSList = _Array$isArray__default["default"](selectedPS) ? selectedPS : [selectedPS];
|
|
7876
7807
|
return _mapInstanceProperty__default["default"](productSelections).call(productSelections, productSelection => {
|
|
7877
|
-
var _context;
|
|
7878
7808
|
const label = l10n.formatLocalizedString(productSelection, {
|
|
7879
7809
|
key: 'name',
|
|
7880
7810
|
locale: dataLocale,
|
|
@@ -7883,14 +7813,13 @@ const mapProductSelectionsToOptions$1 = memoize__default["default"](function ()
|
|
|
7883
7813
|
return {
|
|
7884
7814
|
id: productSelection.id,
|
|
7885
7815
|
value: productSelection.id,
|
|
7886
|
-
label:
|
|
7816
|
+
label: `${label}${_includesInstanceProperty__default["default"](selectedPSList).call(selectedPSList, productSelection.id) && enableExcludingProducts ? ` (type: ${getMode(productSelection.mode)})` : ''}`,
|
|
7887
7817
|
key: productSelection.key,
|
|
7888
7818
|
mode: getMode(productSelection.mode)
|
|
7889
7819
|
};
|
|
7890
7820
|
});
|
|
7891
7821
|
});
|
|
7892
7822
|
function ProductSelectionBasicSelectDropdown(props) {
|
|
7893
|
-
var _productSelectionsFet, _productSelectionsFet2;
|
|
7894
7823
|
const intl = reactIntl.useIntl();
|
|
7895
7824
|
const enableExcludingProducts = applicationShell.useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
7896
7825
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -7903,10 +7832,10 @@ function ProductSelectionBasicSelectDropdown(props) {
|
|
|
7903
7832
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
7904
7833
|
dataLocale = _useApplicationContex.dataLocale;
|
|
7905
7834
|
if (productSelectionsFetcher.isLoading) return jsxRuntime.jsx(CenteredLoadingSpinner, {});
|
|
7906
|
-
const productSelections =
|
|
7835
|
+
const productSelections = productSelectionsFetcher.productSelections?.results ?? [];
|
|
7907
7836
|
const filteredProductSelections = _filterInstanceProperty__default["default"](productSelections).call(productSelections, ps => {
|
|
7908
|
-
var
|
|
7909
|
-
return !_includesInstanceProperty__default["default"](
|
|
7837
|
+
var _context;
|
|
7838
|
+
return !_includesInstanceProperty__default["default"](_context = props.excludedProductSelectionIds).call(_context, ps.id);
|
|
7910
7839
|
});
|
|
7911
7840
|
const onOptionClick = event => {
|
|
7912
7841
|
const productSelectionId = event.target.value;
|
|
@@ -7955,7 +7884,7 @@ const getValueFromOptions$3 = _ref => {
|
|
|
7955
7884
|
// handle async-select-field value transformation
|
|
7956
7885
|
if (isMulti) {
|
|
7957
7886
|
var _context;
|
|
7958
|
-
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));
|
|
7959
7888
|
}
|
|
7960
7889
|
|
|
7961
7890
|
// in case it is not multiselect, then a single valued async-select-input is being requested and the value should have proper format
|
|
@@ -7967,7 +7896,6 @@ const emptyStoreOption$1 = intl => [{
|
|
|
7967
7896
|
isDisabled: true
|
|
7968
7897
|
}];
|
|
7969
7898
|
function ProductSelectionsAsyncSelectDropdown(props) {
|
|
7970
|
-
var _productSelectionsFet3;
|
|
7971
7899
|
const intl = reactIntl.useIntl();
|
|
7972
7900
|
const enableExcludingProducts = applicationShell.useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
7973
7901
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -7980,17 +7908,13 @@ function ProductSelectionsAsyncSelectDropdown(props) {
|
|
|
7980
7908
|
})),
|
|
7981
7909
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
7982
7910
|
dataLocale = _useApplicationContex.dataLocale;
|
|
7983
|
-
const productSelections = React.useMemo(() =>
|
|
7984
|
-
var _productSelectionsFet, _productSelectionsFet2;
|
|
7985
|
-
return (_productSelectionsFet = (_productSelectionsFet2 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet2 === void 0 ? void 0 : _productSelectionsFet2.results) !== null && _productSelectionsFet !== void 0 ? _productSelectionsFet : [];
|
|
7986
|
-
}, [(_productSelectionsFet3 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet3 === void 0 ? void 0 : _productSelectionsFet3.results]);
|
|
7911
|
+
const productSelections = React.useMemo(() => productSelectionsFetcher.productSelections?.results ?? [], [productSelectionsFetcher.productSelections?.results]);
|
|
7987
7912
|
const filteredProductSelections = _filterInstanceProperty__default["default"](productSelections).call(productSelections, ps => {
|
|
7988
7913
|
var _context2;
|
|
7989
7914
|
return !_includesInstanceProperty__default["default"](_context2 = props.excludedProductSelectionIds).call(_context2, ps.id);
|
|
7990
7915
|
});
|
|
7991
7916
|
const onOptionClick = event => {
|
|
7992
|
-
|
|
7993
|
-
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;
|
|
7994
7918
|
const currentProductSelection = _findInstanceProperty__default["default"](productSelections).call(productSelections, productSelection => productSelection.id === productSelectionId);
|
|
7995
7919
|
props.onChange(currentProductSelection);
|
|
7996
7920
|
};
|
|
@@ -8062,15 +7986,11 @@ function ProductSelectionsAsyncSelectDropdown(props) {
|
|
|
8062
7986
|
}
|
|
8063
7987
|
|
|
8064
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 } } } };
|
|
8065
|
-
const createQueryVariables$4 = (productSelections, predicateField) => {
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
limit: 500
|
|
8070
|
-
};
|
|
8071
|
-
};
|
|
7989
|
+
const createQueryVariables$4 = (productSelections, predicateField) => ({
|
|
7990
|
+
where: `${predicateField} in (${_mapInstanceProperty__default["default"](productSelections).call(productSelections, ps => `"${ps}"`).join(', ')})`,
|
|
7991
|
+
limit: 500
|
|
7992
|
+
});
|
|
8072
7993
|
const useProductSelectionsByFieldFetcher = (productSelections, predicateField) => {
|
|
8073
|
-
var _productSelectionsQue, _productSelectionsQue2;
|
|
8074
7994
|
const productSelectionList = _Array$isArray__default["default"](productSelections) ? productSelections : [productSelections];
|
|
8075
7995
|
const productSelectionsQuery = react.useQuery(ProductSelectionsPickerFetcher$1, {
|
|
8076
7996
|
context: {
|
|
@@ -8080,7 +8000,7 @@ const useProductSelectionsByFieldFetcher = (productSelections, predicateField) =
|
|
|
8080
8000
|
skip: productSelectionList.length === 0
|
|
8081
8001
|
});
|
|
8082
8002
|
return {
|
|
8083
|
-
productSelections:
|
|
8003
|
+
productSelections: productSelectionsQuery.data?.productSelections.results ?? [],
|
|
8084
8004
|
isLoading: productSelectionsQuery.loading
|
|
8085
8005
|
};
|
|
8086
8006
|
};
|
|
@@ -8121,8 +8041,8 @@ const createQueryVariables$3 = _ref3 => {
|
|
|
8121
8041
|
var _context;
|
|
8122
8042
|
let searchText = _ref3.searchText;
|
|
8123
8043
|
const sanitizedSearchText = sanitize(_trimInstanceProperty__default["default"](searchText).call(searchText, searchText));
|
|
8124
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
8125
|
-
const keyQuery =
|
|
8044
|
+
const idQuery = isUUID(sanitizedSearchText) && `id = "${sanitizedSearchText}"`;
|
|
8045
|
+
const keyQuery = `key = "${sanitizedSearchText}"`;
|
|
8126
8046
|
const searchTextQuery = _filterInstanceProperty__default["default"](_context = [idQuery, keyQuery]).call(_context, Boolean).join(' or ');
|
|
8127
8047
|
return {
|
|
8128
8048
|
where: searchTextQuery || undefined
|
|
@@ -8145,7 +8065,6 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8145
8065
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8146
8066
|
const productSelectionsByFieldFetcher = useProductSelectionsByFieldFetcher(props.value, props.renderSelectInputOptionValuesByField);
|
|
8147
8067
|
const handleLoadOptions = async searchText => {
|
|
8148
|
-
var _data$productSelectio, _data$productSelectio2;
|
|
8149
8068
|
const _await$client$query = await client$1.query({
|
|
8150
8069
|
query: ProductSelectionsPickerFetcher,
|
|
8151
8070
|
variables: createQueryVariables$3({
|
|
@@ -8157,7 +8076,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8157
8076
|
fetchPolicy: 'network-only'
|
|
8158
8077
|
}),
|
|
8159
8078
|
data = _await$client$query.data;
|
|
8160
|
-
const matchedProductSelections =
|
|
8079
|
+
const matchedProductSelections = data?.productSelections?.results ?? [];
|
|
8161
8080
|
const updatedProductSelections = _mapInstanceProperty__default["default"](matchedProductSelections).call(matchedProductSelections, convertProductSelectionFromGraphQl);
|
|
8162
8081
|
const filteredProductSelections = _filterInstanceProperty__default["default"](updatedProductSelections).call(updatedProductSelections, ps => {
|
|
8163
8082
|
var _context2;
|
|
@@ -8173,8 +8092,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8173
8092
|
};
|
|
8174
8093
|
const loadOptionsDebounced = debounce__default["default"](handleLoadOptions, 500);
|
|
8175
8094
|
const onOptionClick = event => {
|
|
8176
|
-
|
|
8177
|
-
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;
|
|
8178
8096
|
const currentProductSelection = _findInstanceProperty__default["default"](productionSelectionResults).call(productionSelectionResults, productSelection => productSelection.id === productSelectionId);
|
|
8179
8097
|
props.onChange(currentProductSelection);
|
|
8180
8098
|
};
|
|
@@ -8222,11 +8140,11 @@ function ModeSelectInputOption(props) {
|
|
|
8222
8140
|
scale: "xs",
|
|
8223
8141
|
children: [jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
8224
8142
|
isBold: true,
|
|
8225
|
-
children:
|
|
8143
|
+
children: data?.label || noValueFallback
|
|
8226
8144
|
}), jsxRuntime.jsxs(uiKit.Text.Detail, {
|
|
8227
|
-
children: ["Key: ",
|
|
8145
|
+
children: ["Key: ", data?.key || noValueFallback]
|
|
8228
8146
|
}), jsxRuntime.jsxs(uiKit.Text.Detail, {
|
|
8229
|
-
children: ["Type: ",
|
|
8147
|
+
children: ["Type: ", data?.mode || noValueFallback]
|
|
8230
8148
|
})]
|
|
8231
8149
|
})
|
|
8232
8150
|
}));
|
|
@@ -8327,8 +8245,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8327
8245
|
var _context2;
|
|
8328
8246
|
const intl = reactIntl.useIntl();
|
|
8329
8247
|
const handleLoadOptions = async searchTerm => {
|
|
8330
|
-
|
|
8331
|
-
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 => {
|
|
8332
8249
|
var _context;
|
|
8333
8250
|
return _includesInstanceProperty__default["default"](_context = country.label.toLowerCase()).call(_context, searchTerm.toLowerCase());
|
|
8334
8251
|
});
|
|
@@ -8336,7 +8253,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8336
8253
|
return _sliceInstanceProperty__default["default"](filteredOptions).call(filteredOptions, 0, props.countriesAsyncLoadingLimit);
|
|
8337
8254
|
}
|
|
8338
8255
|
return [{
|
|
8339
|
-
options:
|
|
8256
|
+
options: props.options?.slice(0, props.countriesAsyncLoadingLimit)
|
|
8340
8257
|
}, {
|
|
8341
8258
|
options: emptyCountryOption(intl)
|
|
8342
8259
|
}];
|
|
@@ -8345,10 +8262,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8345
8262
|
const countries = event.target.value;
|
|
8346
8263
|
props.onChange({
|
|
8347
8264
|
target: _objectSpread$F(_objectSpread$F({}, event.target), {}, {
|
|
8348
|
-
value: _mapInstanceProperty__default["default"](countries).call(countries, country =>
|
|
8349
|
-
var _country$value;
|
|
8350
|
-
return (_country$value = country === null || country === void 0 ? void 0 : country.value) !== null && _country$value !== void 0 ? _country$value : country;
|
|
8351
|
-
})
|
|
8265
|
+
value: _mapInstanceProperty__default["default"](countries).call(countries, country => country?.value ?? country)
|
|
8352
8266
|
})
|
|
8353
8267
|
});
|
|
8354
8268
|
};
|
|
@@ -8378,8 +8292,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8378
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; }
|
|
8379
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; }
|
|
8380
8294
|
function CountriesPicker(props) {
|
|
8381
|
-
|
|
8382
|
-
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;
|
|
8383
8296
|
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
8384
8297
|
children: jsxRuntime.jsx(CustomCountriesPicker, _objectSpread$E({}, props))
|
|
8385
8298
|
});
|
|
@@ -8408,7 +8321,6 @@ var GetCustomerGroupsQuery = { kind: "Document", definitions: [{ kind: "Operatio
|
|
|
8408
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 } } } };
|
|
8409
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 } } } };
|
|
8410
8323
|
const CustomerGroupPickerInput = _ref => {
|
|
8411
|
-
var _currentOption$data$l, _currentOption$data;
|
|
8412
8324
|
let isClearable = _ref.isClearable,
|
|
8413
8325
|
isDisabled = _ref.isDisabled,
|
|
8414
8326
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -8477,13 +8389,13 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
8477
8389
|
setLoadingError(null);
|
|
8478
8390
|
handleInternalInputChange(event);
|
|
8479
8391
|
}, [handleInternalInputChange]);
|
|
8480
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
8392
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
8481
8393
|
React.useEffect(() => {
|
|
8482
8394
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
8483
8395
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
8484
8396
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
8485
8397
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$t.noCustomerGroupsFound), [loadingError, formatMessage]);
|
|
8486
|
-
const tooltipTitle =
|
|
8398
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
8487
8399
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
8488
8400
|
max: "scale",
|
|
8489
8401
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -8493,7 +8405,7 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
8493
8405
|
children: jsxRuntime.jsx(uiKit.AsyncSelectInput, {
|
|
8494
8406
|
id: name,
|
|
8495
8407
|
name: name,
|
|
8496
|
-
placeholder: placeholder
|
|
8408
|
+
placeholder: placeholder ?? formatMessage(messages$t.placeholder),
|
|
8497
8409
|
loadOptions: loadOptionsDebounced,
|
|
8498
8410
|
defaultOptions: true,
|
|
8499
8411
|
showOptionGroupDivider: true,
|
|
@@ -8522,12 +8434,11 @@ CustomerGroupPickerInput.displayName = 'CustomerGroupPickerInput';
|
|
|
8522
8434
|
const DEFAULT_LENGTH = 50;
|
|
8523
8435
|
const DEFAULT_END = '...';
|
|
8524
8436
|
function truncate (text) {
|
|
8525
|
-
var _context;
|
|
8526
8437
|
let length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_LENGTH;
|
|
8527
8438
|
let end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_END;
|
|
8528
8439
|
if (!text) return '';
|
|
8529
8440
|
if (text.length < length) return text;
|
|
8530
|
-
return
|
|
8441
|
+
return `${text.substring(0, length)}${end}`;
|
|
8531
8442
|
}
|
|
8532
8443
|
|
|
8533
8444
|
const LOWER_STORES_LIMIT = 60;
|
|
@@ -8535,7 +8446,6 @@ const UPPER_STORES_LIMIT = 500;
|
|
|
8535
8446
|
|
|
8536
8447
|
// map store to options
|
|
8537
8448
|
const mapStoresToOptions = _ref => {
|
|
8538
|
-
var _store$productSelecti;
|
|
8539
8449
|
let store = _ref.store,
|
|
8540
8450
|
renderSelectInputOptionValuesByField = _ref.renderSelectInputOptionValuesByField,
|
|
8541
8451
|
dataLocale = _ref.dataLocale;
|
|
@@ -8546,14 +8456,14 @@ const mapStoresToOptions = _ref => {
|
|
|
8546
8456
|
const localizedName = l10n.formatLocalizedString(convertedStore, {
|
|
8547
8457
|
key: 'name',
|
|
8548
8458
|
locale: dataLocale,
|
|
8549
|
-
fallback:
|
|
8459
|
+
fallback: `${store.key} (key)`
|
|
8550
8460
|
});
|
|
8551
8461
|
return {
|
|
8552
8462
|
label: localizedName,
|
|
8553
8463
|
value: renderSelectInputOptionValuesByField === 'key' ? store.key : store.id,
|
|
8554
8464
|
key: store.key,
|
|
8555
8465
|
id: store.id,
|
|
8556
|
-
productSelections:
|
|
8466
|
+
productSelections: store.productSelections?.map(productSelectionRef => productSelectionRef.productSelection.id)
|
|
8557
8467
|
};
|
|
8558
8468
|
};
|
|
8559
8469
|
|
|
@@ -8615,7 +8525,7 @@ const getValueFromOptions$1 = _ref => {
|
|
|
8615
8525
|
isMulti = _ref.isMulti;
|
|
8616
8526
|
// handle async-select-field value transformation
|
|
8617
8527
|
if (isMulti) {
|
|
8618
|
-
return _filterInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores
|
|
8528
|
+
return _filterInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores?.includes(store.value));
|
|
8619
8529
|
}
|
|
8620
8530
|
|
|
8621
8531
|
// return value as undefined if no options is yet selected. It is needed for cases where users sets initial values as empty string
|
|
@@ -8644,13 +8554,13 @@ const StoresAsyncSelectInput = props => {
|
|
|
8644
8554
|
sort: 'createdAt asc',
|
|
8645
8555
|
excludeExtendedStoresList: true,
|
|
8646
8556
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8647
|
-
stores:
|
|
8557
|
+
stores: keysOfStores?.length && keysOfStores,
|
|
8648
8558
|
projectKey: props.projectKey
|
|
8649
8559
|
});
|
|
8650
8560
|
const hasError = uiKit.AsyncSelectInput.isTouched(props.touched) && hasErrors$2(props.errors) || props.hasError;
|
|
8651
8561
|
const mappedStoresListOptions = React.useMemo(() => {
|
|
8652
|
-
var _context2
|
|
8653
|
-
return _mapInstanceProperty__default["default"](_context2 =
|
|
8562
|
+
var _context2;
|
|
8563
|
+
return _mapInstanceProperty__default["default"](_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8654
8564
|
store,
|
|
8655
8565
|
dataLocale,
|
|
8656
8566
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -8736,21 +8646,20 @@ const StoresBasicSelectInput = props => {
|
|
|
8736
8646
|
sort: 'createdAt asc',
|
|
8737
8647
|
excludeExtendedStoresList: true,
|
|
8738
8648
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8739
|
-
stores:
|
|
8649
|
+
stores: keysOfStores?.length && keysOfStores,
|
|
8740
8650
|
projectKey: props.projectKey
|
|
8741
8651
|
});
|
|
8742
8652
|
const hasError = uiKit.SelectInput.isTouched(props.touched) && hasErrors$1(props.errors) || props.hasError;
|
|
8743
8653
|
const mappedStoresListOptions = React.useMemo(() => {
|
|
8744
|
-
var _context2
|
|
8745
|
-
return _mapInstanceProperty__default["default"](_context2 =
|
|
8654
|
+
var _context2;
|
|
8655
|
+
return _mapInstanceProperty__default["default"](_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8746
8656
|
store,
|
|
8747
8657
|
dataLocale,
|
|
8748
8658
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
8749
8659
|
}));
|
|
8750
8660
|
}, [dataLocale, storesListFetcher.stores, props.renderSelectInputOptionValuesByField]);
|
|
8751
8661
|
const handleChange = event => {
|
|
8752
|
-
|
|
8753
|
-
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;
|
|
8754
8663
|
const currentStore = _findInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => store.value === value);
|
|
8755
8664
|
|
|
8756
8665
|
// We need complete store info including productSelections
|
|
@@ -8805,7 +8714,6 @@ StoresBasicSelectInput.defaultProps = {
|
|
|
8805
8714
|
|
|
8806
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 } } } };
|
|
8807
8716
|
const useTotalNumberOfStoresFetcher = projectKey => {
|
|
8808
|
-
var _totalNumberOfStoresQ;
|
|
8809
8717
|
const totalNumberOfStoresQuery = react.useQuery(TotalNumberOfStores, {
|
|
8810
8718
|
context: {
|
|
8811
8719
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM,
|
|
@@ -8814,7 +8722,7 @@ const useTotalNumberOfStoresFetcher = projectKey => {
|
|
|
8814
8722
|
fetchPolicy: 'network-only'
|
|
8815
8723
|
});
|
|
8816
8724
|
return {
|
|
8817
|
-
total:
|
|
8725
|
+
total: totalNumberOfStoresQuery.data?.totalNumberOfStores.total,
|
|
8818
8726
|
isLoading: totalNumberOfStoresQuery.loading
|
|
8819
8727
|
};
|
|
8820
8728
|
};
|
|
@@ -8832,19 +8740,15 @@ const handlers$1 = {
|
|
|
8832
8740
|
};
|
|
8833
8741
|
|
|
8834
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 } } } };
|
|
8835
|
-
const createQueryVariables$2 = (stores, predicateField, shouldFetchProductSelections) => {
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
excludeProductSelections: !shouldFetchProductSelections
|
|
8841
|
-
};
|
|
8842
|
-
};
|
|
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
|
+
});
|
|
8843
8748
|
const emptyStoresQueryResult = {
|
|
8844
8749
|
results: []
|
|
8845
8750
|
};
|
|
8846
8751
|
const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
8847
|
-
var _storesQuery$data;
|
|
8848
8752
|
let shouldFetchProductSelections = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
8849
8753
|
// incase of single select input stores are sent as single string literal
|
|
8850
8754
|
const storesList = _Array$isArray__default["default"](stores) ? stores : [stores];
|
|
@@ -8857,29 +8761,29 @@ const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
|
8857
8761
|
skip: storesList.length === 0
|
|
8858
8762
|
});
|
|
8859
8763
|
return {
|
|
8860
|
-
stores:
|
|
8764
|
+
stores: storesQuery.data?.storesByField || emptyStoresQueryResult,
|
|
8861
8765
|
isLoading: storesQuery.loading
|
|
8862
8766
|
};
|
|
8863
8767
|
};
|
|
8864
8768
|
|
|
8865
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; }
|
|
8866
|
-
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; }
|
|
8867
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 } } } };
|
|
8868
8772
|
const hasErrors = errors => {
|
|
8869
8773
|
var _context;
|
|
8870
8774
|
return errors && _someInstanceProperty__default["default"](_context = _Object$values__default["default"](errors)).call(_context, Boolean);
|
|
8871
8775
|
};
|
|
8872
8776
|
const createQueryVariables$1 = _ref => {
|
|
8873
|
-
var _context2
|
|
8777
|
+
var _context2;
|
|
8874
8778
|
let searchText = _ref.searchText,
|
|
8875
8779
|
dataLocale = _ref.dataLocale,
|
|
8876
8780
|
allAccessibleStoreKeysThroughDataFencePermissions = _ref.allAccessibleStoreKeysThroughDataFencePermissions,
|
|
8877
8781
|
shouldFetchProductSelections = _ref.shouldFetchProductSelections;
|
|
8878
8782
|
const sanitizedSearchText = sanitize(_trimInstanceProperty__default["default"](searchText).call(searchText, searchText));
|
|
8879
|
-
const keyQuery =
|
|
8783
|
+
const keyQuery = `key = "${sanitizedSearchText}"`;
|
|
8880
8784
|
|
|
8881
8785
|
// if the user has data fence permissions then we only allow stores to fetched that user has access to
|
|
8882
|
-
if (allAccessibleStoreKeysThroughDataFencePermissions
|
|
8786
|
+
if (allAccessibleStoreKeysThroughDataFencePermissions?.length) {
|
|
8883
8787
|
// if the current search term match the accessible stores keys, then proceed with fetching the store
|
|
8884
8788
|
if (_includesInstanceProperty__default["default"](allAccessibleStoreKeysThroughDataFencePermissions).call(allAccessibleStoreKeysThroughDataFencePermissions, sanitizedSearchText)) {
|
|
8885
8789
|
return {
|
|
@@ -8895,9 +8799,9 @@ const createQueryVariables$1 = _ref => {
|
|
|
8895
8799
|
excludeProductSelections: !shouldFetchProductSelections
|
|
8896
8800
|
};
|
|
8897
8801
|
}
|
|
8898
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
8899
|
-
const nameQuery =
|
|
8900
|
-
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 ');
|
|
8901
8805
|
return {
|
|
8902
8806
|
skipFetchingStores: false,
|
|
8903
8807
|
where: searchTextQuery,
|
|
@@ -8905,7 +8809,6 @@ const createQueryVariables$1 = _ref => {
|
|
|
8905
8809
|
};
|
|
8906
8810
|
};
|
|
8907
8811
|
const getValueFromOptions = _ref2 => {
|
|
8908
|
-
var _storesByFieldFetcher, _context4;
|
|
8909
8812
|
let isMulti = _ref2.isMulti,
|
|
8910
8813
|
value = _ref2.value,
|
|
8911
8814
|
dataLocale = _ref2.dataLocale,
|
|
@@ -8914,7 +8817,7 @@ const getValueFromOptions = _ref2 => {
|
|
|
8914
8817
|
if (!value) {
|
|
8915
8818
|
return undefined;
|
|
8916
8819
|
}
|
|
8917
|
-
const selectedOptions =
|
|
8820
|
+
const selectedOptions = storesByFieldFetcher.stores?.results.map(store => mapStoresToOptions({
|
|
8918
8821
|
store,
|
|
8919
8822
|
dataLocale,
|
|
8920
8823
|
renderSelectInputOptionValuesByField: renderSelectInputOptionValuesByField
|
|
@@ -8952,9 +8855,8 @@ const StoresSearchSelectInput = props => {
|
|
|
8952
8855
|
},
|
|
8953
8856
|
fetchPolicy: 'network-only'
|
|
8954
8857
|
}).then(_ref3 => {
|
|
8955
|
-
var _data$storesByWherePr, _context5;
|
|
8956
8858
|
let data = _ref3.data;
|
|
8957
|
-
return
|
|
8859
|
+
return data.storesByWherePredicate?.results.map(store => mapStoresToOptions({
|
|
8958
8860
|
store,
|
|
8959
8861
|
dataLocale,
|
|
8960
8862
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -9134,14 +9036,14 @@ var messages$r = reactIntl.defineMessages({
|
|
|
9134
9036
|
|
|
9135
9037
|
function formatDiscount(discount, currencyCode, intl) {
|
|
9136
9038
|
var _context;
|
|
9137
|
-
if (discount.type === 'relative') return
|
|
9039
|
+
if (discount.type === 'relative') return `${discount.permyriad / 100}%`;
|
|
9138
9040
|
if (!discount.money) return null;
|
|
9139
9041
|
const moneyForCurrencyCode = _findInstanceProperty__default["default"](_context = discount.money).call(_context, discountMoney => discountMoney.currencyCode === currencyCode);
|
|
9140
9042
|
return moneyForCurrencyCode ? formatMoney$2(moneyForCurrencyCode, intl) : null;
|
|
9141
9043
|
}
|
|
9142
9044
|
|
|
9143
9045
|
function formatPercentage(percentage) {
|
|
9144
|
-
return
|
|
9046
|
+
return `${percentage}%`;
|
|
9145
9047
|
}
|
|
9146
9048
|
function convertRatioToPercentage(ratio) {
|
|
9147
9049
|
return _parseFloat__default["default"]((ratio * 100).toFixed(2));
|
|
@@ -9195,8 +9097,8 @@ function validateFilter$2(_ref, intl) {
|
|
|
9195
9097
|
};
|
|
9196
9098
|
}
|
|
9197
9099
|
if (value.option === FILTER_TYPES.range) {
|
|
9198
|
-
const from = validateValue(filterValue
|
|
9199
|
-
const to = from ? null : validateValue(filterValue
|
|
9100
|
+
const from = validateValue(filterValue?.from, typeName, intl);
|
|
9101
|
+
const to = from ? null : validateValue(filterValue?.to, typeName, intl);
|
|
9200
9102
|
return from || to ? {
|
|
9201
9103
|
input: {
|
|
9202
9104
|
from,
|
|
@@ -9233,16 +9135,16 @@ function validateFilter$1(_ref, intl) {
|
|
|
9233
9135
|
type = _ref.type;
|
|
9234
9136
|
if (type === 'range') {
|
|
9235
9137
|
if (validateSingleFilter({
|
|
9236
|
-
value: value
|
|
9138
|
+
value: value?.from
|
|
9237
9139
|
})) return {
|
|
9238
9140
|
from: intl.formatMessage(messages$p.rangeMissingValue)
|
|
9239
9141
|
};
|
|
9240
9142
|
if (validateSingleFilter({
|
|
9241
|
-
value: value
|
|
9143
|
+
value: value?.to
|
|
9242
9144
|
})) return {
|
|
9243
9145
|
to: intl.formatMessage(messages$p.rangeMissingValue)
|
|
9244
9146
|
};
|
|
9245
|
-
if (moment__default$1["default"](value
|
|
9147
|
+
if (moment__default$1["default"](value?.to).isBefore(value?.from)) return {
|
|
9246
9148
|
from: intl.formatMessage(messages$p.rangeToSmallerThanFrom)
|
|
9247
9149
|
};
|
|
9248
9150
|
} else if (type === 'equalTo' || type === 'lessThan' || type === 'moreThan') {
|
|
@@ -9312,10 +9214,8 @@ function isEmptyFilter(_ref) {
|
|
|
9312
9214
|
}
|
|
9313
9215
|
|
|
9314
9216
|
function numberTransformer(filterKey, filters) {
|
|
9315
|
-
var _context3;
|
|
9316
9217
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$2;
|
|
9317
9218
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
9318
|
-
var _context, _context2;
|
|
9319
9219
|
let type = _ref.type,
|
|
9320
9220
|
value = _ref.value;
|
|
9321
9221
|
if (!filterValidator({
|
|
@@ -9324,19 +9224,19 @@ function numberTransformer(filterKey, filters) {
|
|
|
9324
9224
|
})) return '';
|
|
9325
9225
|
switch (type) {
|
|
9326
9226
|
case 'lessThan':
|
|
9327
|
-
return
|
|
9227
|
+
return `(* to ${value - 1})`;
|
|
9328
9228
|
case 'moreThan':
|
|
9329
|
-
return
|
|
9229
|
+
return `(${value + 1} to *)`;
|
|
9330
9230
|
case 'equalTo':
|
|
9331
|
-
return
|
|
9231
|
+
return `(${value} to ${value})`;
|
|
9332
9232
|
case 'range':
|
|
9333
|
-
return
|
|
9233
|
+
return `(${value.from} to ${value.to})`;
|
|
9334
9234
|
default:
|
|
9335
9235
|
return '';
|
|
9336
9236
|
}
|
|
9337
9237
|
});
|
|
9338
9238
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
9339
|
-
return queryString === '' ? null :
|
|
9239
|
+
return queryString === '' ? null : `${filterKey}: range${queryString}`;
|
|
9340
9240
|
}
|
|
9341
9241
|
function isFilterValid$2(_ref2) {
|
|
9342
9242
|
let type = _ref2.type,
|
|
@@ -9363,11 +9263,9 @@ function graphqlCategoryLevelTransformer(filterKey, filters, filterValidator) {
|
|
|
9363
9263
|
return _filterInstanceProperty__default["default"](_context = [levelFilterQuery, lastLevelFilterQuery]).call(_context, Boolean);
|
|
9364
9264
|
}
|
|
9365
9265
|
|
|
9366
|
-
var _templateObject$1, _templateObject2;
|
|
9367
9266
|
const dateFormatDayStart = 'YYYY-MM-DDT00:00:00.000Z';
|
|
9368
9267
|
const dateFormatDayEnd = 'YYYY-MM-DDT23:59:59.999Z';
|
|
9369
9268
|
function dateTransformer(filterKey, filters) {
|
|
9370
|
-
var _context;
|
|
9371
9269
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$1;
|
|
9372
9270
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
9373
9271
|
let type = _ref.type,
|
|
@@ -9378,19 +9276,25 @@ function dateTransformer(filterKey, filters) {
|
|
|
9378
9276
|
})) return '';
|
|
9379
9277
|
switch (type) {
|
|
9380
9278
|
case 'lessThan':
|
|
9381
|
-
return
|
|
9279
|
+
return `(* to "${moment__default$1["default"](value).format(dateFormatDayStart)}")`;
|
|
9382
9280
|
case 'moreThan':
|
|
9383
|
-
return
|
|
9281
|
+
return `("${moment__default$1["default"](value).format(dateFormatDayEnd)}" to *)`;
|
|
9384
9282
|
case 'equalTo':
|
|
9385
|
-
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
|
+
`;
|
|
9386
9287
|
case 'range':
|
|
9387
|
-
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
|
+
`;
|
|
9388
9292
|
default:
|
|
9389
9293
|
return '';
|
|
9390
9294
|
}
|
|
9391
9295
|
});
|
|
9392
9296
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
9393
|
-
return queryString === '' ? null :
|
|
9297
|
+
return queryString === '' ? null : `${filterKey}: range${queryString}`;
|
|
9394
9298
|
}
|
|
9395
9299
|
function isFilterValid$1(_ref2) {
|
|
9396
9300
|
let type = _ref2.type,
|
|
@@ -9405,19 +9309,18 @@ function isFilterValid$1(_ref2) {
|
|
|
9405
9309
|
}
|
|
9406
9310
|
|
|
9407
9311
|
function missingLocaleTransformer(filterKey, filters) {
|
|
9408
|
-
var _context;
|
|
9409
9312
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
9410
9313
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
9411
9314
|
if (filters.length === 0) return null;
|
|
9412
9315
|
const missingLocale = filters[0].value.value;
|
|
9413
|
-
return
|
|
9316
|
+
return `${filterKey}.${missingLocale}:missing`;
|
|
9414
9317
|
}
|
|
9415
9318
|
|
|
9416
9319
|
function missingTransformer(filterKey, filters) {
|
|
9417
9320
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
9418
9321
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
9419
9322
|
if (filters.length === 0) return null;
|
|
9420
|
-
return
|
|
9323
|
+
return `${filterKey}:missing`;
|
|
9421
9324
|
}
|
|
9422
9325
|
|
|
9423
9326
|
/**
|
|
@@ -9458,7 +9361,6 @@ function graphqlQueryBuilder(_ref) {
|
|
|
9458
9361
|
}
|
|
9459
9362
|
|
|
9460
9363
|
function referenceTransformer(filterKey, filters) {
|
|
9461
|
-
var _context;
|
|
9462
9364
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid;
|
|
9463
9365
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
9464
9366
|
let type = _ref.type,
|
|
@@ -9469,49 +9371,46 @@ function referenceTransformer(filterKey, filters) {
|
|
|
9469
9371
|
})) return '';
|
|
9470
9372
|
switch (type) {
|
|
9471
9373
|
case 'equalTo':
|
|
9472
|
-
return "
|
|
9374
|
+
return `"${value}"`;
|
|
9473
9375
|
default:
|
|
9474
9376
|
return '';
|
|
9475
9377
|
}
|
|
9476
9378
|
});
|
|
9477
9379
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
9478
|
-
return queryString === '' ? null :
|
|
9380
|
+
return queryString === '' ? null : `${filterKey}.id: ${queryString}`;
|
|
9479
9381
|
}
|
|
9480
9382
|
function isFilterValid(_ref2) {
|
|
9481
|
-
var
|
|
9383
|
+
var _context;
|
|
9482
9384
|
let type = _ref2.type,
|
|
9483
9385
|
value = _ref2.value;
|
|
9484
|
-
if (type === 'equalTo' && !_includesInstanceProperty__default["default"](
|
|
9386
|
+
if (type === 'equalTo' && !_includesInstanceProperty__default["default"](_context = [null, undefined, '']).call(_context, value)) return true;
|
|
9485
9387
|
return false;
|
|
9486
9388
|
}
|
|
9487
9389
|
|
|
9488
9390
|
function textTransformer(filterKey, queries) {
|
|
9489
|
-
var _context;
|
|
9490
9391
|
if (queries.length === 0) return null;
|
|
9491
9392
|
|
|
9492
9393
|
// Note: we assume for now that there can only be 1 text filter.
|
|
9493
9394
|
const queryValue = queries[0].value;
|
|
9494
|
-
return queryValue ?
|
|
9395
|
+
return queryValue ? `${filterKey}:"${queryValue}"` : null;
|
|
9495
9396
|
}
|
|
9496
9397
|
|
|
9497
9398
|
const composeNumberPredicateFromFilter = (target, value, option) => {
|
|
9498
|
-
var _context, _context2, _context3, _context4, _context5, _context6;
|
|
9499
9399
|
switch (option) {
|
|
9500
9400
|
case FILTER_TYPES.lessThan:
|
|
9501
|
-
return
|
|
9401
|
+
return `${target} < ${value}`;
|
|
9502
9402
|
case FILTER_TYPES.moreThan:
|
|
9503
|
-
return
|
|
9403
|
+
return `${target} > ${value}`;
|
|
9504
9404
|
case FILTER_TYPES.equalTo:
|
|
9505
|
-
return
|
|
9405
|
+
return `${target} = ${value}`;
|
|
9506
9406
|
case FILTER_TYPES.range:
|
|
9507
|
-
return
|
|
9407
|
+
return `${target} >= ${value.from} and ${target} <= ${value.to}`;
|
|
9508
9408
|
default:
|
|
9509
9409
|
return '';
|
|
9510
9410
|
}
|
|
9511
9411
|
};
|
|
9512
9412
|
function customFields (filter, locale) {
|
|
9513
9413
|
const customFieldsPredicates = _mapInstanceProperty__default["default"](filter).call(filter, customFieldFilter => {
|
|
9514
|
-
var _context7, _context8, _context9, _context10, _context11;
|
|
9515
9414
|
const _customFieldFilter$va = customFieldFilter.value,
|
|
9516
9415
|
target = _customFieldFilter$va.target,
|
|
9517
9416
|
type = _customFieldFilter$va.type,
|
|
@@ -9519,14 +9418,14 @@ function customFields (filter, locale) {
|
|
|
9519
9418
|
option = _customFieldFilter$va.option;
|
|
9520
9419
|
switch (type.name) {
|
|
9521
9420
|
case FIELD_TYPES.Boolean:
|
|
9522
|
-
return
|
|
9421
|
+
return `${target} = ${value.value}`;
|
|
9523
9422
|
case FIELD_TYPES.String:
|
|
9524
|
-
return
|
|
9423
|
+
return `${target} = "${value}"`;
|
|
9525
9424
|
case FIELD_TYPES.LocalizedString:
|
|
9526
|
-
return
|
|
9425
|
+
return `${target}(${localizedTextTransformer(value)})`;
|
|
9527
9426
|
case FIELD_TYPES.Enum:
|
|
9528
9427
|
case FIELD_TYPES.LocalizedEnum:
|
|
9529
|
-
return
|
|
9428
|
+
return `${target} = "${value.value}"`;
|
|
9530
9429
|
case FIELD_TYPES.Time:
|
|
9531
9430
|
return timeTransformer(target, [{
|
|
9532
9431
|
type: option,
|
|
@@ -9541,14 +9440,14 @@ function customFields (filter, locale) {
|
|
|
9541
9440
|
case FIELD_TYPES.Number:
|
|
9542
9441
|
return composeNumberPredicateFromFilter(target, value, option);
|
|
9543
9442
|
case FIELD_TYPES.Money:
|
|
9544
|
-
return
|
|
9443
|
+
return `${target}(${moneyTransformer(value, option, locale)})`;
|
|
9545
9444
|
case FIELD_TYPES.Reference:
|
|
9546
9445
|
case FIELD_TYPES.Set:
|
|
9547
9446
|
default:
|
|
9548
9447
|
throw new Error('Custom field type not recognized');
|
|
9549
9448
|
}
|
|
9550
9449
|
});
|
|
9551
|
-
return
|
|
9450
|
+
return `(custom(fields(${customFieldsPredicates.join(' and ')})))`;
|
|
9552
9451
|
}
|
|
9553
9452
|
|
|
9554
9453
|
// https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/btoa#Unicode_strings
|
|
@@ -9593,7 +9492,7 @@ function ownKeys$z(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
9593
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; }
|
|
9594
9493
|
const resourcesWithPlatformLimits = _Object$keys__default["default"](RESOURCES_WITH_PLATFORM_LIMITS);
|
|
9595
9494
|
const createQueryVariables = platformLimit => _reduceInstanceProperty__default["default"](resourcesWithPlatformLimits).call(resourcesWithPlatformLimits, (previousIncludedLimits, nextNameOfLimit) => _objectSpread$z({
|
|
9596
|
-
[camelCase__default["default"](
|
|
9495
|
+
[camelCase__default["default"](`should include ${nextNameOfLimit}`)]: platformLimit ? nextNameOfLimit === platformLimit : true
|
|
9597
9496
|
}, previousIncludedLimits), {});
|
|
9598
9497
|
|
|
9599
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 } } } };
|
|
@@ -9609,7 +9508,7 @@ const usePlatformLimitsFetcher = platformLimit => {
|
|
|
9609
9508
|
error = _useQuery.error,
|
|
9610
9509
|
data = _useQuery.data,
|
|
9611
9510
|
refetch = _useQuery.refetch;
|
|
9612
|
-
const platformLimits = !loading ? omit__default["default"](data
|
|
9511
|
+
const platformLimits = !loading ? omit__default["default"](data?.limits, '__typename') : {};
|
|
9613
9512
|
return {
|
|
9614
9513
|
isLoading: loading,
|
|
9615
9514
|
error,
|
|
@@ -9800,11 +9699,10 @@ const getPlatformLimitsStatus = _ref3 => {
|
|
|
9800
9699
|
total = _ref3.total,
|
|
9801
9700
|
intl = _ref3.intl;
|
|
9802
9701
|
if (limit) {
|
|
9803
|
-
|
|
9804
|
-
return _concatInstanceProperty__default["default"](_context = "(".concat(intl.formatNumber(current), "/")).call(_context, intl.formatNumber(limit), ")");
|
|
9702
|
+
return `(${intl.formatNumber(current)}/${intl.formatNumber(limit)})`;
|
|
9805
9703
|
}
|
|
9806
9704
|
if (total) {
|
|
9807
|
-
return
|
|
9705
|
+
return `(${intl.formatNumber(total)})`;
|
|
9808
9706
|
}
|
|
9809
9707
|
return '';
|
|
9810
9708
|
};
|
|
@@ -9824,18 +9722,17 @@ const useShippingMethodsPlatformLimitsFetcher = () => {
|
|
|
9824
9722
|
};
|
|
9825
9723
|
|
|
9826
9724
|
const useShippingMethodsPlatformLimits = () => {
|
|
9827
|
-
var _platformLimits$shipp;
|
|
9828
9725
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
9829
9726
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
9830
|
-
if (!
|
|
9727
|
+
if (!platformLimits?.shippingMethods?.total) {
|
|
9831
9728
|
return {
|
|
9832
9729
|
hasReachedShippingMethodsWarningLimit: false,
|
|
9833
9730
|
hasReachedShippingMethodsErrorLimit: false
|
|
9834
9731
|
};
|
|
9835
9732
|
}
|
|
9836
|
-
const _platformLimits$
|
|
9837
|
-
limit = _platformLimits$
|
|
9838
|
-
current = _platformLimits$
|
|
9733
|
+
const _platformLimits$shipp = platformLimits.shippingMethods.total,
|
|
9734
|
+
limit = _platformLimits$shipp.limit,
|
|
9735
|
+
current = _platformLimits$shipp.current;
|
|
9839
9736
|
const hasReachedShippingMethodsWarningLimit = getHasExceededWarningThreshold({
|
|
9840
9737
|
limit,
|
|
9841
9738
|
current
|
|
@@ -9851,13 +9748,12 @@ const useShippingMethodsPlatformLimits = () => {
|
|
|
9851
9748
|
};
|
|
9852
9749
|
|
|
9853
9750
|
const PlatformLimitsShippingMethodsNotifications = () => {
|
|
9854
|
-
var _platformLimits$shipp;
|
|
9855
9751
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
9856
9752
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
9857
9753
|
const _useShippingMethodsPl2 = useShippingMethodsPlatformLimits(),
|
|
9858
9754
|
hasReachedShippingMethodsWarningLimit = _useShippingMethodsPl2.hasReachedShippingMethodsWarningLimit,
|
|
9859
9755
|
hasReachedShippingMethodsErrorLimit = _useShippingMethodsPl2.hasReachedShippingMethodsErrorLimit;
|
|
9860
|
-
if (!
|
|
9756
|
+
if (!platformLimits?.shippingMethods?.total) {
|
|
9861
9757
|
return null;
|
|
9862
9758
|
}
|
|
9863
9759
|
if (hasReachedShippingMethodsErrorLimit) {
|
|
@@ -9903,13 +9799,12 @@ var messages$k = reactIntl.defineMessages({
|
|
|
9903
9799
|
});
|
|
9904
9800
|
|
|
9905
9801
|
const PlatformLimitsShippingMethodsStatus = _ref => {
|
|
9906
|
-
var _platformLimits$shipp, _platformLimits$shipp2;
|
|
9907
9802
|
let total = _ref.total;
|
|
9908
9803
|
const intl = reactIntl.useIntl();
|
|
9909
9804
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
9910
9805
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
9911
|
-
const current = platformLimits
|
|
9912
|
-
const limit = platformLimits
|
|
9806
|
+
const current = platformLimits?.shippingMethods?.total?.current;
|
|
9807
|
+
const limit = platformLimits?.shippingMethods?.total?.limit;
|
|
9913
9808
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
9914
9809
|
intlMessage: messages$k.shippingMethodsStatus,
|
|
9915
9810
|
children: getPlatformLimitsStatus({
|
|
@@ -9971,18 +9866,17 @@ const useTaxCategoriesPlatformLimitsFetcher = () => {
|
|
|
9971
9866
|
};
|
|
9972
9867
|
|
|
9973
9868
|
const useTaxCategoriesPlatformLimits = () => {
|
|
9974
|
-
var _platformLimits$taxCa;
|
|
9975
9869
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
9976
9870
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
9977
|
-
if (!
|
|
9871
|
+
if (!platformLimits?.taxCategories?.total) {
|
|
9978
9872
|
return {
|
|
9979
9873
|
hasReachedTaxCategoriesWarningLimit: false,
|
|
9980
9874
|
hasReachedTaxCategoriesErrorLimit: false
|
|
9981
9875
|
};
|
|
9982
9876
|
}
|
|
9983
|
-
const _platformLimits$
|
|
9984
|
-
limit = _platformLimits$
|
|
9985
|
-
current = _platformLimits$
|
|
9877
|
+
const _platformLimits$taxCa = platformLimits.taxCategories.total,
|
|
9878
|
+
limit = _platformLimits$taxCa.limit,
|
|
9879
|
+
current = _platformLimits$taxCa.current;
|
|
9986
9880
|
const hasReachedTaxCategoriesWarningLimit = getHasExceededWarningThreshold({
|
|
9987
9881
|
limit,
|
|
9988
9882
|
current
|
|
@@ -9998,13 +9892,12 @@ const useTaxCategoriesPlatformLimits = () => {
|
|
|
9998
9892
|
};
|
|
9999
9893
|
|
|
10000
9894
|
const PlatformLimitsTaxCategoriesNotifications = () => {
|
|
10001
|
-
var _platformLimits$taxCa;
|
|
10002
9895
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
10003
9896
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
10004
9897
|
const _useTaxCategoriesPlat2 = useTaxCategoriesPlatformLimits(),
|
|
10005
9898
|
hasReachedTaxCategoriesWarningLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesWarningLimit,
|
|
10006
9899
|
hasReachedTaxCategoriesErrorLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesErrorLimit;
|
|
10007
|
-
if (!
|
|
9900
|
+
if (!platformLimits?.taxCategories?.total) {
|
|
10008
9901
|
return null;
|
|
10009
9902
|
}
|
|
10010
9903
|
if (hasReachedTaxCategoriesErrorLimit) {
|
|
@@ -10050,13 +9943,12 @@ var messages$i = reactIntl.defineMessages({
|
|
|
10050
9943
|
});
|
|
10051
9944
|
|
|
10052
9945
|
const PlatformLimitsTaxCategoriesStatus = _ref => {
|
|
10053
|
-
var _platformLimits$taxCa, _platformLimits$taxCa2;
|
|
10054
9946
|
let total = _ref.total;
|
|
10055
9947
|
const intl = reactIntl.useIntl();
|
|
10056
9948
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
10057
9949
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
10058
|
-
const current = platformLimits
|
|
10059
|
-
const limit = platformLimits
|
|
9950
|
+
const current = platformLimits?.taxCategories?.total?.current;
|
|
9951
|
+
const limit = platformLimits?.taxCategories?.total?.limit;
|
|
10060
9952
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
10061
9953
|
intlMessage: messages$i.taxCategoriesStatus,
|
|
10062
9954
|
children: getPlatformLimitsStatus({
|
|
@@ -10118,18 +10010,17 @@ const useZonesPlatformLimitsFetcher = () => {
|
|
|
10118
10010
|
};
|
|
10119
10011
|
|
|
10120
10012
|
const useZonesPlatformLimits = () => {
|
|
10121
|
-
var _platformLimits$zones;
|
|
10122
10013
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10123
10014
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10124
|
-
if (!
|
|
10015
|
+
if (!platformLimits?.zones?.total) {
|
|
10125
10016
|
return {
|
|
10126
10017
|
hasReachedZonesWarningLimit: false,
|
|
10127
10018
|
hasReachedZonesErrorLimit: false
|
|
10128
10019
|
};
|
|
10129
10020
|
}
|
|
10130
|
-
const _platformLimits$
|
|
10131
|
-
limit = _platformLimits$
|
|
10132
|
-
current = _platformLimits$
|
|
10021
|
+
const _platformLimits$zones = platformLimits.zones.total,
|
|
10022
|
+
limit = _platformLimits$zones.limit,
|
|
10023
|
+
current = _platformLimits$zones.current;
|
|
10133
10024
|
const hasReachedZonesWarningLimit = getHasExceededWarningThreshold({
|
|
10134
10025
|
limit,
|
|
10135
10026
|
current
|
|
@@ -10145,13 +10036,12 @@ const useZonesPlatformLimits = () => {
|
|
|
10145
10036
|
};
|
|
10146
10037
|
|
|
10147
10038
|
const PlatformLimitsZonesNotifications = () => {
|
|
10148
|
-
var _platformLimits$zones;
|
|
10149
10039
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10150
10040
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10151
10041
|
const _useZonesPlatformLimi2 = useZonesPlatformLimits(),
|
|
10152
10042
|
hasReachedZonesWarningLimit = _useZonesPlatformLimi2.hasReachedZonesWarningLimit,
|
|
10153
10043
|
hasReachedZonesErrorLimit = _useZonesPlatformLimi2.hasReachedZonesErrorLimit;
|
|
10154
|
-
if (!
|
|
10044
|
+
if (!platformLimits?.zones?.total) {
|
|
10155
10045
|
return null;
|
|
10156
10046
|
}
|
|
10157
10047
|
if (hasReachedZonesErrorLimit) {
|
|
@@ -10197,13 +10087,12 @@ var messages$g = reactIntl.defineMessages({
|
|
|
10197
10087
|
});
|
|
10198
10088
|
|
|
10199
10089
|
const PlatformLimitsZonesStatus = _ref => {
|
|
10200
|
-
var _platformLimits$zones, _platformLimits$zones2;
|
|
10201
10090
|
let total = _ref.total;
|
|
10202
10091
|
const intl = reactIntl.useIntl();
|
|
10203
10092
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10204
10093
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10205
|
-
const current = platformLimits
|
|
10206
|
-
const limit = platformLimits
|
|
10094
|
+
const current = platformLimits?.zones?.total?.current;
|
|
10095
|
+
const limit = platformLimits?.zones?.total?.limit;
|
|
10207
10096
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
10208
10097
|
intlMessage: messages$g.zonesStatus,
|
|
10209
10098
|
children: getPlatformLimitsStatus({
|
|
@@ -10265,18 +10154,17 @@ const useCustomersPlatformLimitsFetcher = () => {
|
|
|
10265
10154
|
};
|
|
10266
10155
|
|
|
10267
10156
|
const useCustomersPlatformLimits$1 = () => {
|
|
10268
|
-
var _platformLimits$custo;
|
|
10269
10157
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10270
10158
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10271
|
-
if (!
|
|
10159
|
+
if (!platformLimits?.customers?.total) {
|
|
10272
10160
|
return {
|
|
10273
10161
|
hasReachedCustomersWarningLimit: false,
|
|
10274
10162
|
hasReachedCustomersErrorLimit: false
|
|
10275
10163
|
};
|
|
10276
10164
|
}
|
|
10277
|
-
const _platformLimits$
|
|
10278
|
-
limit = _platformLimits$
|
|
10279
|
-
current = _platformLimits$
|
|
10165
|
+
const _platformLimits$custo = platformLimits.customers.total,
|
|
10166
|
+
limit = _platformLimits$custo.limit,
|
|
10167
|
+
current = _platformLimits$custo.current;
|
|
10280
10168
|
const hasReachedCustomersWarningLimit = getHasExceededWarningThreshold({
|
|
10281
10169
|
limit,
|
|
10282
10170
|
current
|
|
@@ -10305,13 +10193,12 @@ const useCustomersPlatormLimitsModalState = () => {
|
|
|
10305
10193
|
};
|
|
10306
10194
|
|
|
10307
10195
|
const PlatformLimitsCustomersNotifications = () => {
|
|
10308
|
-
var _platformLimits$custo;
|
|
10309
10196
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10310
10197
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10311
10198
|
const _useCustomersPlatform2 = useCustomersPlatformLimits$1(),
|
|
10312
10199
|
hasReachedCustomersWarningLimit = _useCustomersPlatform2.hasReachedCustomersWarningLimit,
|
|
10313
10200
|
hasReachedCustomersErrorLimit = _useCustomersPlatform2.hasReachedCustomersErrorLimit;
|
|
10314
|
-
if (!
|
|
10201
|
+
if (!platformLimits?.customers?.total) {
|
|
10315
10202
|
return jsxRuntime.jsx("div", {});
|
|
10316
10203
|
}
|
|
10317
10204
|
if (hasReachedCustomersErrorLimit) {
|
|
@@ -10362,16 +10249,15 @@ var styles$b = {
|
|
|
10362
10249
|
"status": "platform-limits-customers-status-module__status___3rXYM"
|
|
10363
10250
|
};
|
|
10364
10251
|
const PlatformLimitsCustomersStatus = () => {
|
|
10365
|
-
var _platformLimits$custo;
|
|
10366
10252
|
const intl = reactIntl.useIntl();
|
|
10367
10253
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10368
10254
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10369
|
-
if (!
|
|
10255
|
+
if (!platformLimits?.customers?.total) {
|
|
10370
10256
|
return null;
|
|
10371
10257
|
}
|
|
10372
|
-
const _platformLimits$
|
|
10373
|
-
current = _platformLimits$
|
|
10374
|
-
limit = _platformLimits$
|
|
10258
|
+
const _platformLimits$custo = platformLimits.customers.total,
|
|
10259
|
+
current = _platformLimits$custo.current,
|
|
10260
|
+
limit = _platformLimits$custo.limit;
|
|
10375
10261
|
return jsxRuntime.jsx("div", {
|
|
10376
10262
|
className: styles$b.status,
|
|
10377
10263
|
children: jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
@@ -10605,18 +10491,17 @@ const useCustomerGroupsPlatformLimitsFetcher = () => {
|
|
|
10605
10491
|
};
|
|
10606
10492
|
|
|
10607
10493
|
const useCustomerGroupsPlatformLimitsStatus = () => {
|
|
10608
|
-
var _platformLimits$custo;
|
|
10609
10494
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10610
10495
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10611
|
-
if (!
|
|
10496
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
10612
10497
|
return {
|
|
10613
10498
|
hasReachedCustomerGroupsWarningLimit: false,
|
|
10614
10499
|
hasReachedCustomerGroupsErrorLimit: false
|
|
10615
10500
|
};
|
|
10616
10501
|
}
|
|
10617
|
-
const _platformLimits$
|
|
10618
|
-
limit = _platformLimits$
|
|
10619
|
-
current = _platformLimits$
|
|
10502
|
+
const _platformLimits$custo = platformLimits.customerGroups.total,
|
|
10503
|
+
limit = _platformLimits$custo.limit,
|
|
10504
|
+
current = _platformLimits$custo.current;
|
|
10620
10505
|
const hasReachedCustomerGroupsWarningLimit = getHasExceededWarningThreshold({
|
|
10621
10506
|
limit,
|
|
10622
10507
|
current
|
|
@@ -10645,13 +10530,12 @@ const useCustomerGroupsPlatormLimitsModalState = () => {
|
|
|
10645
10530
|
};
|
|
10646
10531
|
|
|
10647
10532
|
const PlatformLimitsCustomerGroupsNotifications = () => {
|
|
10648
|
-
var _platformLimits$custo;
|
|
10649
10533
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10650
10534
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10651
10535
|
const _useCustomerGroupsPla2 = useCustomerGroupsPlatformLimitsStatus(),
|
|
10652
10536
|
hasReachedCustomerGroupsWarningLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsWarningLimit,
|
|
10653
10537
|
hasReachedCustomerGroupsErrorLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsErrorLimit;
|
|
10654
|
-
if (!
|
|
10538
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
10655
10539
|
return jsxRuntime.jsx("div", {});
|
|
10656
10540
|
}
|
|
10657
10541
|
if (hasReachedCustomerGroupsErrorLimit) {
|
|
@@ -10702,16 +10586,15 @@ var styles$9 = {
|
|
|
10702
10586
|
"status": "platform-limits-customer-groups-status-module__status___6099G"
|
|
10703
10587
|
};
|
|
10704
10588
|
const PlatformLimitsCustomerGroupsStatus = () => {
|
|
10705
|
-
var _platformLimits$custo;
|
|
10706
10589
|
const intl = reactIntl.useIntl();
|
|
10707
10590
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10708
10591
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10709
|
-
if (!
|
|
10592
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
10710
10593
|
return null;
|
|
10711
10594
|
}
|
|
10712
|
-
const _platformLimits$
|
|
10713
|
-
current = _platformLimits$
|
|
10714
|
-
limit = _platformLimits$
|
|
10595
|
+
const _platformLimits$custo = platformLimits.customerGroups.total,
|
|
10596
|
+
current = _platformLimits$custo.current,
|
|
10597
|
+
limit = _platformLimits$custo.limit;
|
|
10715
10598
|
return jsxRuntime.jsx("div", {
|
|
10716
10599
|
className: styles$9.status,
|
|
10717
10600
|
children: jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
@@ -10943,7 +10826,7 @@ var fetchPimIndexStatus = ((apolloClient, projectKey) => async dispatch => {
|
|
|
10943
10826
|
try {
|
|
10944
10827
|
await dispatch(sdk.actions.head({
|
|
10945
10828
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.PIM_SEARCH,
|
|
10946
|
-
uri:
|
|
10829
|
+
uri: `/${projectKey}/search/products`
|
|
10947
10830
|
}));
|
|
10948
10831
|
return {
|
|
10949
10832
|
status: 'indexed'
|
|
@@ -11034,8 +10917,8 @@ const getIndexingJobIds = _ref => {
|
|
|
11034
10917
|
products = _ref$data.products,
|
|
11035
10918
|
productTypes = _ref$data.productTypes;
|
|
11036
10919
|
return {
|
|
11037
|
-
productsJobId:
|
|
11038
|
-
productTypesJobId:
|
|
10920
|
+
productsJobId: products?.indexingJobId || products?.existingIndexingJobId,
|
|
10921
|
+
productTypesJobId: productTypes?.indexingJobId || productTypes?.existingIndexingJobId
|
|
11039
10922
|
};
|
|
11040
10923
|
};
|
|
11041
10924
|
let PimIndexerProvider = /*#__PURE__*/function (_PureComponent) {
|
|
@@ -11299,7 +11182,6 @@ const valueMapping = {
|
|
|
11299
11182
|
all: [true, false]
|
|
11300
11183
|
};
|
|
11301
11184
|
const BooleanField = props => {
|
|
11302
|
-
var _context;
|
|
11303
11185
|
let selectedValue;
|
|
11304
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]);
|
|
11305
11187
|
const yesLabel = props.intl.formatMessage(messages$8.yes);
|
|
@@ -11313,7 +11195,7 @@ const BooleanField = props => {
|
|
|
11313
11195
|
}];
|
|
11314
11196
|
if (props.isMulti) options.push({
|
|
11315
11197
|
value: 'all',
|
|
11316
|
-
label:
|
|
11198
|
+
label: `${yesLabel} / ${noLabel}`
|
|
11317
11199
|
});
|
|
11318
11200
|
return jsxRuntime.jsx(uiKit.SelectInput, {
|
|
11319
11201
|
name: props.name,
|
|
@@ -11477,19 +11359,19 @@ const ScrollToFieldError = () => {
|
|
|
11477
11359
|
if (isValid) return;
|
|
11478
11360
|
const firstErrorElement = document.querySelector('[aria-invalid="true"]');
|
|
11479
11361
|
if (firstErrorElement) {
|
|
11480
|
-
var _ref, _ref2, _document$querySelect, _elementToScrollTo$sc;
|
|
11481
11362
|
// Get a reference to the label.
|
|
11482
11363
|
const firstElementId = firstErrorElement.getAttribute('id');
|
|
11483
|
-
const localizedInputIndex = _indexOfInstanceProperty__default["default"](firstElementId).call(firstElementId,
|
|
11364
|
+
const localizedInputIndex = _indexOfInstanceProperty__default["default"](firstElementId).call(firstElementId, `.${dataLocale}`);
|
|
11484
11365
|
|
|
11485
11366
|
// check if locale is appended then remove it from id
|
|
11486
|
-
const id = localizedInputIndex > -1 ? firstElementId.replace(
|
|
11367
|
+
const id = localizedInputIndex > -1 ? firstElementId.replace(`.${dataLocale}`, '') : firstElementId;
|
|
11487
11368
|
|
|
11488
11369
|
// Scroll to the label (if found), otherwise to the input element itself.
|
|
11489
11370
|
|
|
11490
|
-
const elementToScrollTo =
|
|
11491
|
-
|
|
11492
|
-
(
|
|
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?.({
|
|
11493
11375
|
behavior: 'smooth'
|
|
11494
11376
|
});
|
|
11495
11377
|
}
|
|
@@ -11515,8 +11397,7 @@ var styles$4 = {
|
|
|
11515
11397
|
"search-mode-menu": "selectable-field-search-input-module__search-mode-menu___Od6Le"
|
|
11516
11398
|
};
|
|
11517
11399
|
const SelectableFieldSearchInput = props => {
|
|
11518
|
-
|
|
11519
|
-
const _useState = React.useState((_props$initialValue = props.initialValue) !== null && _props$initialValue !== void 0 ? _props$initialValue : ''),
|
|
11400
|
+
const _useState = React.useState(props.initialValue ?? ''),
|
|
11520
11401
|
_useState2 = _slicedToArray(_useState, 2),
|
|
11521
11402
|
searchText = _useState2[0],
|
|
11522
11403
|
setSearchText = _useState2[1];
|
|
@@ -11552,7 +11433,7 @@ const SelectableFieldSearchInput = props => {
|
|
|
11552
11433
|
});
|
|
11553
11434
|
},
|
|
11554
11435
|
onReset: props.onReset,
|
|
11555
|
-
placeholder:
|
|
11436
|
+
placeholder: props.placeholder ?? intl.formatMessage(messages$5.placeholder),
|
|
11556
11437
|
isDisabled: props.disabled
|
|
11557
11438
|
})
|
|
11558
11439
|
});
|
|
@@ -11613,7 +11494,6 @@ StoreSelectField.defaultProps = {
|
|
|
11613
11494
|
mappedValueField: 'id'
|
|
11614
11495
|
};
|
|
11615
11496
|
|
|
11616
|
-
var _templateObject;
|
|
11617
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; }
|
|
11618
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; }
|
|
11619
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); }; }
|
|
@@ -11686,7 +11566,10 @@ const VALIDATOR_INTEGER = {
|
|
|
11686
11566
|
}
|
|
11687
11567
|
}
|
|
11688
11568
|
});
|
|
11689
|
-
commonTags.oneLineTrim
|
|
11569
|
+
commonTags.oneLineTrim`
|
|
11570
|
+
\`validatedInput\` is no longer supported.
|
|
11571
|
+
Please use \`formik\` instead.
|
|
11572
|
+
`;
|
|
11690
11573
|
const ToolTipWrapperComponent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
11691
11574
|
let children = _ref.children;
|
|
11692
11575
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
@@ -11833,7 +11716,7 @@ function validatedInput(InnerComponent, validators) {
|
|
|
11833
11716
|
}]);
|
|
11834
11717
|
return ValidatedInput;
|
|
11835
11718
|
}(React.PureComponent);
|
|
11836
|
-
ValidatedInput.displayName =
|
|
11719
|
+
ValidatedInput.displayName = `ValidatedInput(${_InnerComponent.displayName})`;
|
|
11837
11720
|
ValidatedInput.defaultProps = {
|
|
11838
11721
|
isValid: true,
|
|
11839
11722
|
getInputRef: () => {}
|
|
@@ -11975,7 +11858,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
11975
11858
|
truncate: true,
|
|
11976
11859
|
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$2.filterWholeInput), {}, {
|
|
11977
11860
|
values: {
|
|
11978
|
-
values: "
|
|
11861
|
+
values: `"${props.value}"`
|
|
11979
11862
|
}
|
|
11980
11863
|
})
|
|
11981
11864
|
})
|
|
@@ -11988,7 +11871,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
11988
11871
|
truncate: true,
|
|
11989
11872
|
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$2.filterSeparateValues), {}, {
|
|
11990
11873
|
values: {
|
|
11991
|
-
values: "
|
|
11874
|
+
values: `"${props.multiValue.join('", "')}"` || props.value
|
|
11992
11875
|
}
|
|
11993
11876
|
})
|
|
11994
11877
|
})
|
|
@@ -12280,17 +12163,16 @@ function isEmpty(value) {
|
|
|
12280
12163
|
}
|
|
12281
12164
|
|
|
12282
12165
|
const buildSearchQuery = (searchQuery, searchMode, fragments) => {
|
|
12283
|
-
var _fragments$searchMode;
|
|
12284
12166
|
if (!searchQuery) return '';
|
|
12285
12167
|
const buildAllFieldsQueryString = query => {
|
|
12286
12168
|
const fragmentsArray = _Object$values__default["default"](fragments);
|
|
12287
|
-
return
|
|
12169
|
+
return `( ${_mapInstanceProperty__default["default"](fragmentsArray).call(fragmentsArray, fragment => fragment.getQuery(query)).join(' or ')} )`;
|
|
12288
12170
|
};
|
|
12289
12171
|
const trimmedSearchQuery = oneLine__default["default"](searchQuery);
|
|
12290
12172
|
if (searchMode === 'allFields') {
|
|
12291
12173
|
return buildAllFieldsQueryString(trimmedSearchQuery);
|
|
12292
12174
|
}
|
|
12293
|
-
if (!fragments[searchMode] || typeof
|
|
12175
|
+
if (!fragments[searchMode] || typeof fragments[searchMode]?.getQuery !== 'function') {
|
|
12294
12176
|
return '';
|
|
12295
12177
|
}
|
|
12296
12178
|
return fragments[searchMode].getQuery(trimmedSearchQuery);
|
|
@@ -12521,11 +12403,11 @@ function createResourceReducer(options) {
|
|
|
12521
12403
|
|
|
12522
12404
|
// TODO: validate constant keys
|
|
12523
12405
|
const actionsMap = {
|
|
12524
|
-
[
|
|
12406
|
+
[`${plural}_FETCHED`]: (_, action) => ({
|
|
12525
12407
|
currentQueryResult: action.payload
|
|
12526
12408
|
}),
|
|
12527
|
-
[
|
|
12528
|
-
[
|
|
12409
|
+
[`${single}_UPDATED_IN_LIST`]: updateStatusInList(mergeData),
|
|
12410
|
+
[`${single}_DELETED_IN_LIST`]: (state, _ref) => {
|
|
12529
12411
|
let payload = _ref.payload;
|
|
12530
12412
|
const results = state.currentQueryResult.results;
|
|
12531
12413
|
return {
|
|
@@ -12537,27 +12419,27 @@ function createResourceReducer(options) {
|
|
|
12537
12419
|
})
|
|
12538
12420
|
};
|
|
12539
12421
|
},
|
|
12540
|
-
[
|
|
12422
|
+
[`${single}_FETCHED`]: (_, _ref3) => {
|
|
12541
12423
|
let payload = _ref3.payload;
|
|
12542
12424
|
return {
|
|
12543
12425
|
currentVisible: payload
|
|
12544
12426
|
};
|
|
12545
12427
|
},
|
|
12546
|
-
[
|
|
12428
|
+
[`${single}_CREATED`]: (_ref4, _ref5) => {
|
|
12547
12429
|
let currentVisible = _ref4.currentVisible;
|
|
12548
12430
|
let payload = _ref5.payload;
|
|
12549
12431
|
return {
|
|
12550
12432
|
currentVisible: mergeData(payload, currentVisible)
|
|
12551
12433
|
};
|
|
12552
12434
|
},
|
|
12553
|
-
[
|
|
12435
|
+
[`${single}_UPDATED`]: (_ref6, _ref7) => {
|
|
12554
12436
|
let currentVisible = _ref6.currentVisible;
|
|
12555
12437
|
let payload = _ref7.payload;
|
|
12556
12438
|
return {
|
|
12557
12439
|
currentVisible: mergeData(payload, currentVisible)
|
|
12558
12440
|
};
|
|
12559
12441
|
},
|
|
12560
|
-
[
|
|
12442
|
+
[`${single}_DELETED`]: () => ({
|
|
12561
12443
|
currentVisible: null
|
|
12562
12444
|
})
|
|
12563
12445
|
};
|
|
@@ -12574,12 +12456,11 @@ function formatCustomerAddress(_ref) {
|
|
|
12574
12456
|
}
|
|
12575
12457
|
|
|
12576
12458
|
function formatCustomerName(_ref) {
|
|
12577
|
-
var _context;
|
|
12578
12459
|
let firstName = _ref.firstName,
|
|
12579
12460
|
lastName = _ref.lastName;
|
|
12580
12461
|
if (firstName && !lastName) return _trimInstanceProperty__default["default"](firstName).call(firstName);
|
|
12581
12462
|
if (!firstName && lastName) return _trimInstanceProperty__default["default"](lastName).call(lastName);
|
|
12582
|
-
if (firstName && lastName) return
|
|
12463
|
+
if (firstName && lastName) return `${_trimInstanceProperty__default["default"](firstName).call(firstName)} ${_trimInstanceProperty__default["default"](lastName).call(lastName)}`;
|
|
12583
12464
|
return constants.NO_VALUE_FALLBACK;
|
|
12584
12465
|
}
|
|
12585
12466
|
|
|
@@ -12629,10 +12510,7 @@ const validateText = (text, intl) => {
|
|
|
12629
12510
|
* @returns {boolean}
|
|
12630
12511
|
*/
|
|
12631
12512
|
const hasErrorCode = (unmappedApiErrors, errorCode) => {
|
|
12632
|
-
return _Array$isArray__default["default"](unmappedApiErrors) && _someInstanceProperty__default["default"](unmappedApiErrors).call(unmappedApiErrors, error =>
|
|
12633
|
-
var _error$extensions;
|
|
12634
|
-
return ((_error$extensions = error.extensions) === null || _error$extensions === void 0 ? void 0 : _error$extensions.code) === errorCode;
|
|
12635
|
-
});
|
|
12513
|
+
return _Array$isArray__default["default"](unmappedApiErrors) && _someInstanceProperty__default["default"](unmappedApiErrors).call(unmappedApiErrors, error => error.extensions?.code === errorCode);
|
|
12636
12514
|
};
|
|
12637
12515
|
|
|
12638
12516
|
const hasInvalidInputError = errors => hasErrorCode(errors, ERROR_CODES.invalidInput);
|
|
@@ -12644,7 +12522,7 @@ function minusify(value) {
|
|
|
12644
12522
|
return minus.concat(value);
|
|
12645
12523
|
}
|
|
12646
12524
|
|
|
12647
|
-
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), []));
|
|
12648
12526
|
const argsToArray = args => _reduceInstanceProperty__default["default"](args).call(args, (result, item) => _concatInstanceProperty__default["default"](result).call(result, item), []);
|
|
12649
12527
|
const exists = (field, attributeType) => ({
|
|
12650
12528
|
exists: {
|
|
@@ -12701,7 +12579,7 @@ const not = function () {
|
|
|
12701
12579
|
|
|
12702
12580
|
const safelyAddFallback = function (string) {
|
|
12703
12581
|
let fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : constants.NO_VALUE_FALLBACK;
|
|
12704
|
-
return string === '' ? fallback : string
|
|
12582
|
+
return string === '' ? fallback : string ?? fallback;
|
|
12705
12583
|
};
|
|
12706
12584
|
|
|
12707
12585
|
var messages$1 = reactIntl.defineMessages({
|
|
@@ -12836,19 +12714,19 @@ const computedProperties = {
|
|
|
12836
12714
|
// has been deleted. See MC-1925 for further information.
|
|
12837
12715
|
const filteredCategories = _filterInstanceProperty__default["default"](_context6 = product.categories).call(_context6, category => category.obj !== undefined);
|
|
12838
12716
|
return _mapInstanceProperty__default["default"](filteredCategories).call(filteredCategories, category => {
|
|
12839
|
-
var _context7;
|
|
12840
12717
|
const categoryPath = getPathName(category, language, languages);
|
|
12841
12718
|
const ancestors = getAncestors(category, language);
|
|
12842
|
-
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
|
|
12843
12721
|
// translated. This has been communicated with Jenn
|
|
12844
|
-
|
|
12722
|
+
`| ext. ID: ${category.obj.externalId}` : '';
|
|
12845
12723
|
return {
|
|
12846
12724
|
id: category.id,
|
|
12847
|
-
name:
|
|
12725
|
+
name: `${l10n.formatLocalizedString(category.obj, {
|
|
12848
12726
|
key: 'name',
|
|
12849
12727
|
locale: language,
|
|
12850
12728
|
fallbackOrder: languages
|
|
12851
|
-
})
|
|
12729
|
+
})} ${externalIdValue}`,
|
|
12852
12730
|
path: categoryPath,
|
|
12853
12731
|
level: ancestors.length
|
|
12854
12732
|
};
|
|
@@ -12885,13 +12763,13 @@ const getAttributeValueByType = _ref12 => {
|
|
|
12885
12763
|
value: value
|
|
12886
12764
|
});
|
|
12887
12765
|
case 'enum':
|
|
12888
|
-
return safelyAddFallback(value.label,
|
|
12766
|
+
return safelyAddFallback(value.label, `${value.key} (key)`);
|
|
12889
12767
|
case 'lenum':
|
|
12890
12768
|
return safelyAddFallback(l10n.formatLocalizedString(value, {
|
|
12891
12769
|
key: 'label',
|
|
12892
12770
|
locale: projectDataLocale,
|
|
12893
12771
|
fallbackOrder: projectLanguages
|
|
12894
|
-
}),
|
|
12772
|
+
}), `${value.key} (key)`);
|
|
12895
12773
|
case 'number':
|
|
12896
12774
|
return safelyAddFallback(value);
|
|
12897
12775
|
case 'boolean':
|
|
@@ -13014,7 +12892,6 @@ const reorderArrayItems = (array, from, to) => {
|
|
|
13014
12892
|
const mapTimeZonesToOptions = memoize__default["default"](timeZones => {
|
|
13015
12893
|
var _context;
|
|
13016
12894
|
return _mapInstanceProperty__default["default"](_context = _Object$entries__default["default"](timeZones)).call(_context, _ref => {
|
|
13017
|
-
var _context2;
|
|
13018
12895
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
13019
12896
|
code = _ref2[0],
|
|
13020
12897
|
value = _ref2[1];
|
|
@@ -13023,7 +12900,7 @@ const mapTimeZonesToOptions = memoize__default["default"](timeZones => {
|
|
|
13023
12900
|
//E.g. `(GMT +02:00) Central European Time - Berlin`
|
|
13024
12901
|
// unicode clock hex code: \u25F7
|
|
13025
12902
|
//
|
|
13026
|
-
label:
|
|
12903
|
+
label: `(GMT ${value.offset}) ${value.name}`
|
|
13027
12904
|
};
|
|
13028
12905
|
});
|
|
13029
12906
|
});
|
|
@@ -13031,12 +12908,9 @@ const getTimeZoneId = memoize__default["default"]((selectedTimeZone, timeZones)
|
|
|
13031
12908
|
if (timeZones[selectedTimeZone]) {
|
|
13032
12909
|
return selectedTimeZone;
|
|
13033
12910
|
} else {
|
|
13034
|
-
var
|
|
13035
|
-
const fallbackTimeZoneId = _findInstanceProperty__default["default"](
|
|
13036
|
-
|
|
13037
|
-
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);
|
|
13038
|
-
});
|
|
13039
|
-
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) {
|
|
13040
12914
|
return fallbackTimeZoneId.toString();
|
|
13041
12915
|
} else {
|
|
13042
12916
|
return 'UTC';
|
|
@@ -13044,10 +12918,9 @@ const getTimeZoneId = memoize__default["default"]((selectedTimeZone, timeZones)
|
|
|
13044
12918
|
}
|
|
13045
12919
|
});
|
|
13046
12920
|
const getTimeZoneLabel = memoize__default["default"]((selectedTimeZone, timeZones) => {
|
|
13047
|
-
var _context4;
|
|
13048
12921
|
const timeZoneId = getTimeZoneId(selectedTimeZone, timeZones);
|
|
13049
12922
|
const timeZoneData = timeZones[timeZoneId];
|
|
13050
|
-
return
|
|
12923
|
+
return `(GMT ${timeZoneData.offset}) ${timeZoneData.name}`;
|
|
13051
12924
|
});
|
|
13052
12925
|
|
|
13053
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; }
|
|
@@ -13108,8 +12981,7 @@ const typeDefinitionsExist = typeDefinitions => {
|
|
|
13108
12981
|
return typeDefinitions.length > 0;
|
|
13109
12982
|
};
|
|
13110
12983
|
const typeDefinitionSelected = formValues => {
|
|
13111
|
-
|
|
13112
|
-
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;
|
|
13113
12985
|
};
|
|
13114
12986
|
const typeDefinitionContainsFieldDefinitions = formValues => {
|
|
13115
12987
|
return formValues[FIELD_NAME].type.obj.key && formValues[FIELD_NAME].type.obj.fieldDefinitions.length > 0;
|
|
@@ -13144,7 +13016,7 @@ const CustomFieldsInputWrapper = _ref2 => {
|
|
|
13144
13016
|
max: "scale",
|
|
13145
13017
|
children: jsxRuntime.jsx(CustomFields, {
|
|
13146
13018
|
isReadOnly: isReadOnly,
|
|
13147
|
-
name:
|
|
13019
|
+
name: `${FIELD_NAME}.fields`,
|
|
13148
13020
|
fieldDefinitions: isReadOnly && hideEmptyFields ? fieldDefinitionsWithValues(formValues) : formValues[FIELD_NAME].type.obj.fieldDefinitions
|
|
13149
13021
|
})
|
|
13150
13022
|
});
|
|
@@ -13179,7 +13051,6 @@ const createFormStateFromTypeDefinition = selectedTypeDefinition => {
|
|
|
13179
13051
|
};
|
|
13180
13052
|
};
|
|
13181
13053
|
const CustomTypeSubform = _ref => {
|
|
13182
|
-
var _formValues$FIELD_NAM3, _formValues$FIELD_NAM4;
|
|
13183
13054
|
let typeDefinitions = _ref.typeDefinitions,
|
|
13184
13055
|
isReadOnly = _ref.isReadOnly,
|
|
13185
13056
|
isCondensed = _ref.isCondensed,
|
|
@@ -13211,8 +13082,7 @@ const CustomTypeSubform = _ref => {
|
|
|
13211
13082
|
}
|
|
13212
13083
|
}, [typeDefinitions, setFieldValue, validateForm]);
|
|
13213
13084
|
const typeDefinitionSelected = formValues => {
|
|
13214
|
-
|
|
13215
|
-
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;
|
|
13216
13086
|
};
|
|
13217
13087
|
|
|
13218
13088
|
// if the user has read-only permissions, empty fields are hidden, and no type definition is selected, hide the component
|
|
@@ -13227,9 +13097,9 @@ const CustomTypeSubform = _ref => {
|
|
|
13227
13097
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
13228
13098
|
isClearable: true,
|
|
13229
13099
|
"data-testid": "custom-type-select",
|
|
13230
|
-
name:
|
|
13231
|
-
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages,
|
|
13232
|
-
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,
|
|
13233
13103
|
onChange: handleTypeDefinitionSelect,
|
|
13234
13104
|
placeholder: formatMessage(messages.typesPlaceholder),
|
|
13235
13105
|
isReadOnly: isReadOnly
|
|
@@ -13248,8 +13118,7 @@ CustomTypeSubform.displayName = 'CustomTypeSubform';
|
|
|
13248
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; }
|
|
13249
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; }
|
|
13250
13120
|
const transformFieldType = fieldDefinition => {
|
|
13251
|
-
|
|
13252
|
-
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') {
|
|
13253
13122
|
var _context;
|
|
13254
13123
|
return _objectSpread(_objectSpread({}, fieldDefinition.type), {}, {
|
|
13255
13124
|
elementType: _objectSpread(_objectSpread({}, fieldDefinition.type.elementType), {}, {
|
|
@@ -13259,7 +13128,7 @@ const transformFieldType = fieldDefinition => {
|
|
|
13259
13128
|
}))
|
|
13260
13129
|
})
|
|
13261
13130
|
});
|
|
13262
|
-
} else if (
|
|
13131
|
+
} else if (fieldDefinition.type?.name === 'LocalizedEnum') {
|
|
13263
13132
|
var _context2;
|
|
13264
13133
|
return _objectSpread(_objectSpread({}, fieldDefinition.type), {}, {
|
|
13265
13134
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context2, value => ({
|