@commercetools-frontend/experimental-components 6.0.1 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commercetools-frontend-experimental-components.cjs.dev.js +911 -757
- package/dist/commercetools-frontend-experimental-components.cjs.prod.js +908 -754
- package/dist/commercetools-frontend-experimental-components.esm.js +905 -756
- package/dist/styles.css +44 -44
- package/package.json +43 -37
|
@@ -30,12 +30,14 @@ var l10n = require('@commercetools-frontend/l10n');
|
|
|
30
30
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
31
31
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
32
32
|
var camelCase = require('lodash/camelCase');
|
|
33
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
33
34
|
var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
|
|
34
35
|
var _sortInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/sort');
|
|
35
36
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
36
37
|
var fastEquals = require('fast-equals');
|
|
37
38
|
var reactIntl = require('react-intl');
|
|
38
39
|
var omitEmpty = require('omit-empty-es');
|
|
40
|
+
var _taggedTemplateLiteral = require('@babel/runtime-corejs3/helpers/taggedTemplateLiteral');
|
|
39
41
|
var oneLine = require('common-tags/lib/oneLine');
|
|
40
42
|
var moment = require('moment-timezone');
|
|
41
43
|
var isNil$1 = require('lodash/isNil');
|
|
@@ -64,7 +66,6 @@ var hooks = require('@apollo/client/react/hooks');
|
|
|
64
66
|
var moment$1 = require('moment');
|
|
65
67
|
var classnames = require('classnames');
|
|
66
68
|
require('react-required-if');
|
|
67
|
-
var _assertThisInitialized = require('@babel/runtime-corejs3/helpers/assertThisInitialized');
|
|
68
69
|
var Textarea = require('react-textarea-autosize');
|
|
69
70
|
var has = require('lodash/has');
|
|
70
71
|
var _toArray = require('@babel/runtime-corejs3/helpers/toArray');
|
|
@@ -78,6 +79,7 @@ var omit = require('lodash/omit');
|
|
|
78
79
|
var isEmpty$3 = require('lodash/isEmpty');
|
|
79
80
|
var _Object$freeze = require('@babel/runtime-corejs3/core-js-stable/object/freeze');
|
|
80
81
|
var originalOmitDeep = require('omit-deep');
|
|
82
|
+
var _findIndexInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find-index');
|
|
81
83
|
var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
|
|
82
84
|
var _parseInt = require('@babel/runtime-corejs3/core-js-stable/parse-int');
|
|
83
85
|
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
@@ -105,14 +107,12 @@ var flatMap = require('lodash/flatMap');
|
|
|
105
107
|
var reactRedux = require('react-redux');
|
|
106
108
|
var commonTags = require('common-tags');
|
|
107
109
|
var warning = require('tiny-warning');
|
|
108
|
-
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
109
110
|
var _Math$trunc = require('@babel/runtime-corejs3/core-js-stable/math/trunc');
|
|
110
111
|
var _Number$isNaN = require('@babel/runtime-corejs3/core-js-stable/number/is-nan');
|
|
111
112
|
var isUndefined = require('lodash/isUndefined');
|
|
112
113
|
var isFinite = require('lodash/isFinite');
|
|
113
114
|
var Cleave = require('cleave.js/react');
|
|
114
115
|
var _Object$assign = require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
115
|
-
var _findIndexInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find-index');
|
|
116
116
|
var compact = require('lodash/compact');
|
|
117
117
|
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
118
118
|
require('@babel/runtime-corejs3/helpers/get');
|
|
@@ -139,6 +139,7 @@ var uniqBy__default = /*#__PURE__*/_interopDefault(uniqBy);
|
|
|
139
139
|
var invariant__default = /*#__PURE__*/_interopDefault(invariant);
|
|
140
140
|
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
141
141
|
var camelCase__default = /*#__PURE__*/_interopDefault(camelCase);
|
|
142
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
142
143
|
var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
|
|
143
144
|
var _sortInstanceProperty__default = /*#__PURE__*/_interopDefault(_sortInstanceProperty);
|
|
144
145
|
var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
|
|
@@ -167,6 +168,7 @@ var omit__default = /*#__PURE__*/_interopDefault(omit);
|
|
|
167
168
|
var isEmpty__default = /*#__PURE__*/_interopDefault(isEmpty$3);
|
|
168
169
|
var _Object$freeze__default = /*#__PURE__*/_interopDefault(_Object$freeze);
|
|
169
170
|
var originalOmitDeep__default = /*#__PURE__*/_interopDefault(originalOmitDeep);
|
|
171
|
+
var _findIndexInstanceProperty__default = /*#__PURE__*/_interopDefault(_findIndexInstanceProperty);
|
|
170
172
|
var _Object$values__default = /*#__PURE__*/_interopDefault(_Object$values);
|
|
171
173
|
var _parseInt__default = /*#__PURE__*/_interopDefault(_parseInt);
|
|
172
174
|
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
@@ -185,14 +187,12 @@ var set__default = /*#__PURE__*/_interopDefault(set);
|
|
|
185
187
|
var memoize__default = /*#__PURE__*/_interopDefault(memoize);
|
|
186
188
|
var flatMap__default = /*#__PURE__*/_interopDefault(flatMap);
|
|
187
189
|
var warning__default = /*#__PURE__*/_interopDefault(warning);
|
|
188
|
-
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
189
190
|
var _Math$trunc__default = /*#__PURE__*/_interopDefault(_Math$trunc);
|
|
190
191
|
var _Number$isNaN__default = /*#__PURE__*/_interopDefault(_Number$isNaN);
|
|
191
192
|
var isUndefined__default = /*#__PURE__*/_interopDefault(isUndefined);
|
|
192
193
|
var isFinite__default = /*#__PURE__*/_interopDefault(isFinite);
|
|
193
194
|
var Cleave__default = /*#__PURE__*/_interopDefault(Cleave);
|
|
194
195
|
var _Object$assign__default = /*#__PURE__*/_interopDefault(_Object$assign);
|
|
195
|
-
var _findIndexInstanceProperty__default = /*#__PURE__*/_interopDefault(_findIndexInstanceProperty);
|
|
196
196
|
var compact__default = /*#__PURE__*/_interopDefault(compact);
|
|
197
197
|
var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
198
198
|
var _spliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_spliceInstanceProperty);
|
|
@@ -293,7 +293,7 @@ function filterDataAttributes(obj) {
|
|
|
293
293
|
* duplicated in original values
|
|
294
294
|
*/
|
|
295
295
|
function unique(values, properties) {
|
|
296
|
-
var
|
|
296
|
+
var _context2;
|
|
297
297
|
let ignoredValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['', null, undefined];
|
|
298
298
|
const duplicateValues = [];
|
|
299
299
|
let realValues;
|
|
@@ -302,19 +302,20 @@ function unique(values, properties) {
|
|
|
302
302
|
realValues = _filterInstanceProperty__default["default"](values).call(values, value => !_includesInstanceProperty__default["default"](ignoredValues).call(ignoredValues, value));
|
|
303
303
|
if (!realValues.length) return [];
|
|
304
304
|
if (properties) realValues = _mapInstanceProperty__default["default"](realValues).call(realValues, value => _reduceInstanceProperty__default["default"](properties).call(properties, (prev, curr) => {
|
|
305
|
+
var _context;
|
|
305
306
|
const currentValue = value[curr] || '';
|
|
306
|
-
return
|
|
307
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(prev, ":")).call(_context, currentValue);
|
|
307
308
|
}, ''));else realValues = _sliceInstanceProperty__default["default"](values).call(values, 0);
|
|
308
309
|
|
|
309
310
|
// TODO: checking for dupes like this is slow, find a better way
|
|
310
|
-
_reduceInstanceProperty__default["default"](
|
|
311
|
+
_reduceInstanceProperty__default["default"](_context2 = _sortInstanceProperty__default["default"](realValues).call(realValues)).call(_context2, (prev, curr) => {
|
|
311
312
|
if (curr === null) return curr;
|
|
312
313
|
if (curr !== '' && prev === curr && _indexOfInstanceProperty__default["default"](duplicateValues).call(duplicateValues, curr) === -1) duplicateValues.push(curr);
|
|
313
314
|
return curr;
|
|
314
315
|
});
|
|
315
316
|
if (properties) return _mapInstanceProperty__default["default"](duplicateValues).call(duplicateValues, value => {
|
|
316
|
-
var
|
|
317
|
-
const parts = _sliceInstanceProperty__default["default"](
|
|
317
|
+
var _context3;
|
|
318
|
+
const parts = _sliceInstanceProperty__default["default"](_context3 = value.split(':')).call(_context3, 1);
|
|
318
319
|
return _reduceInstanceProperty__default["default"](properties).call(properties, (prev, curr, index) => {
|
|
319
320
|
// eslint-disable-next-line no-param-reassign
|
|
320
321
|
prev[curr] = parts[index];
|
|
@@ -333,14 +334,14 @@ function unique(values, properties) {
|
|
|
333
334
|
* @return Array<Object> returns an array of objects with all duplicated values
|
|
334
335
|
*/
|
|
335
336
|
function uniqueObjects(items) {
|
|
336
|
-
var
|
|
337
|
+
var _context4;
|
|
337
338
|
const emptyValues = [undefined, null, ''];
|
|
338
|
-
const itemsWorkingSet = items && items.length ? _filterInstanceProperty__default["default"](
|
|
339
|
+
const itemsWorkingSet = items && items.length ? _filterInstanceProperty__default["default"](_context4 = _sliceInstanceProperty__default["default"](items).call(items)).call(_context4, x => !_includesInstanceProperty__default["default"](emptyValues).call(emptyValues, x)) : [];
|
|
339
340
|
const duplicateValues = _reduceInstanceProperty__default["default"](itemsWorkingSet).call(itemsWorkingSet, (acc, item, index) => {
|
|
340
|
-
var
|
|
341
|
+
var _context5;
|
|
341
342
|
if (item === null) return acc;
|
|
342
|
-
const isDuplicate = _reduceInstanceProperty__default["default"](
|
|
343
|
-
).call(
|
|
343
|
+
const isDuplicate = _reduceInstanceProperty__default["default"](_context5 = _sliceInstanceProperty__default["default"](itemsWorkingSet).call(itemsWorkingSet, index + 1) // get sub-array after this index
|
|
344
|
+
).call(_context5, (duplicateAcc, comparisonItem, comparisonIndex) => {
|
|
344
345
|
if (comparisonItem === null) return duplicateAcc;
|
|
345
346
|
|
|
346
347
|
// check if its a dupe
|
|
@@ -436,18 +437,16 @@ function getIndexesOfInvalidValues(values) {
|
|
|
436
437
|
|
|
437
438
|
const withoutEmptyErrorsByField = errorsByField => omitEmpty__default["default"](errorsByField);
|
|
438
439
|
|
|
440
|
+
var _templateObject$4;
|
|
439
441
|
function formatDateRangeValue(value, type) {
|
|
440
442
|
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
441
443
|
locale: 'en',
|
|
442
444
|
timeZone: moment__default["default"].tz.guess()
|
|
443
445
|
};
|
|
444
446
|
if (value.from === value.to) return formatDateTime$1(type, value.from, options);
|
|
445
|
-
if (value.from && value.to) return oneLine__default["default"]
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
`;
|
|
449
|
-
if (value.from) return `from ${formatDateTime$1(type, value.from, options)}`;
|
|
450
|
-
if (value.to) return `to ${formatDateTime$1(type, value.to, options)}`;
|
|
447
|
+
if (value.from && value.to) return oneLine__default["default"](_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteral(["\n ", " -\n ", "\n "])), formatDateTime$1(type, value.from, options), formatDateTime$1(type, value.to, options));
|
|
448
|
+
if (value.from) return "from ".concat(formatDateTime$1(type, value.from, options));
|
|
449
|
+
if (value.to) return "to ".concat(formatDateTime$1(type, value.to, options));
|
|
451
450
|
return '';
|
|
452
451
|
}
|
|
453
452
|
function formatDateTime$1(type, value) {
|
|
@@ -1683,13 +1682,13 @@ const getData = (code, field) => {
|
|
|
1683
1682
|
const getFractionDigit = code => getData(code, 'fractionDigit');
|
|
1684
1683
|
|
|
1685
1684
|
function ownKeys$1q(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1686
|
-
function _objectSpread$1q(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
1685
|
+
function _objectSpread$1q(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$1q(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$1q(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1687
1686
|
function formatMoneyRangeValue(value, intl) {
|
|
1687
|
+
var _context;
|
|
1688
1688
|
if (value.from === value.to) return formatMoneyValue(value.from, value.currency, intl);
|
|
1689
|
-
if (value.from && value.to) return
|
|
1690
|
-
|
|
1691
|
-
if (value.
|
|
1692
|
-
if (value.to) return `to ${formatMoneyValue(value.to, value.currency, intl)}`;
|
|
1689
|
+
if (value.from && value.to) return _concatInstanceProperty__default["default"](_context = "".concat(formatMoneyValue(value.from, value.currency, intl), " -\n ")).call(_context, formatMoneyValue(value.to, value.currency, intl));
|
|
1690
|
+
if (value.from) return "from ".concat(formatMoneyValue(value.from, value.currency, intl));
|
|
1691
|
+
if (value.to) return "to ".concat(formatMoneyValue(value.to, value.currency, intl));
|
|
1693
1692
|
return '';
|
|
1694
1693
|
}
|
|
1695
1694
|
function formatMoneyValue(amount, currency, intl) {
|
|
@@ -1709,7 +1708,8 @@ function getFractionedAmount(moneyValue) {
|
|
|
1709
1708
|
return amount / 10 ** fractionDigits;
|
|
1710
1709
|
}
|
|
1711
1710
|
function formatMoney$2(moneyValue, intl, options) {
|
|
1712
|
-
|
|
1711
|
+
var _moneyValue$fractione;
|
|
1712
|
+
return intl.formatNumber((_moneyValue$fractione = moneyValue.fractionedAmount) !== null && _moneyValue$fractione !== void 0 ? _moneyValue$fractione : getFractionedAmount(moneyValue), _objectSpread$1q({
|
|
1713
1713
|
style: 'currency',
|
|
1714
1714
|
currency: moneyValue.currencyCode,
|
|
1715
1715
|
minimumFractionDigits: moneyValue.fractionDigits
|
|
@@ -1730,11 +1730,13 @@ var messages$J = reactIntl.defineMessages({
|
|
|
1730
1730
|
});
|
|
1731
1731
|
|
|
1732
1732
|
const formatEnum = _ref => {
|
|
1733
|
+
var _context;
|
|
1733
1734
|
let value = _ref.value,
|
|
1734
1735
|
fallbackValue = _ref.fallbackValue;
|
|
1735
|
-
return value.label ||
|
|
1736
|
+
return value.label || _concatInstanceProperty__default["default"](_context = "".concat(fallbackValue, " (")).call(_context, value.key, ")");
|
|
1736
1737
|
};
|
|
1737
1738
|
const formatLenum = _ref2 => {
|
|
1739
|
+
var _context2;
|
|
1738
1740
|
let value = _ref2.value,
|
|
1739
1741
|
language = _ref2.language,
|
|
1740
1742
|
languages = _ref2.languages,
|
|
@@ -1742,7 +1744,7 @@ const formatLenum = _ref2 => {
|
|
|
1742
1744
|
return l10n.formatLocalizedString(value, {
|
|
1743
1745
|
key: 'label',
|
|
1744
1746
|
locale: language,
|
|
1745
|
-
fallback:
|
|
1747
|
+
fallback: _concatInstanceProperty__default["default"](_context2 = "".concat(fallbackValue, " (")).call(_context2, value.key, ")"),
|
|
1746
1748
|
fallbackOrder: languages
|
|
1747
1749
|
});
|
|
1748
1750
|
};
|
|
@@ -1778,6 +1780,7 @@ const formatDate = _ref6 => {
|
|
|
1778
1780
|
});
|
|
1779
1781
|
};
|
|
1780
1782
|
const formatDateTime = _ref7 => {
|
|
1783
|
+
var _context3;
|
|
1781
1784
|
let value = _ref7.value,
|
|
1782
1785
|
userTimeZone = _ref7.userTimeZone,
|
|
1783
1786
|
intl = _ref7.intl;
|
|
@@ -1793,7 +1796,7 @@ const formatDateTime = _ref7 => {
|
|
|
1793
1796
|
// defaults to utc if timeZone is not provided
|
|
1794
1797
|
timeZone: userTimeZone || 'utc'
|
|
1795
1798
|
});
|
|
1796
|
-
return
|
|
1799
|
+
return _concatInstanceProperty__default["default"](_context3 = "".concat(date, " (")).call(_context3, time, ")");
|
|
1797
1800
|
};
|
|
1798
1801
|
const formatBoolean = _ref8 => {
|
|
1799
1802
|
let value = _ref8.value,
|
|
@@ -1816,7 +1819,7 @@ const formatUnknown = _ref10 => {
|
|
|
1816
1819
|
fallbackValue = _ref10.fallbackValue;
|
|
1817
1820
|
// NOTE This is reporting within the render function, which is supposed to
|
|
1818
1821
|
// be pure. This is quite bad as this is a side-effect in the render fn.
|
|
1819
|
-
sentry.reportErrorToSentry(new Error(
|
|
1822
|
+
sentry.reportErrorToSentry(new Error("Unhandled custom attribute type '".concat(type.name, "' for value")), {
|
|
1820
1823
|
extra: {
|
|
1821
1824
|
value
|
|
1822
1825
|
}
|
|
@@ -1889,9 +1892,10 @@ const attributeTypeNames = {
|
|
|
1889
1892
|
Number: 'number'
|
|
1890
1893
|
};
|
|
1891
1894
|
const convertToAttributeType = customFieldType => {
|
|
1895
|
+
var _customFieldType$elem;
|
|
1892
1896
|
if (isNil__default["default"](customFieldType)) return customFieldType;
|
|
1893
1897
|
const attributeTypeName = attributeTypeNames[customFieldType.name];
|
|
1894
|
-
const elementTypeName = attributeTypeNames[customFieldType.elementType
|
|
1898
|
+
const elementTypeName = attributeTypeNames[(_customFieldType$elem = customFieldType.elementType) === null || _customFieldType$elem === void 0 ? void 0 : _customFieldType$elem.name];
|
|
1895
1899
|
return {
|
|
1896
1900
|
name: attributeTypeName,
|
|
1897
1901
|
elementType: {
|
|
@@ -1954,21 +1958,25 @@ const setDisplayName = nextDisplayName => Component => {
|
|
|
1954
1958
|
return Component;
|
|
1955
1959
|
};
|
|
1956
1960
|
|
|
1957
|
-
const wrapDisplayName = (BaseComponent, hocName) =>
|
|
1961
|
+
const wrapDisplayName = (BaseComponent, hocName) => {
|
|
1962
|
+
var _context;
|
|
1963
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(hocName, "(")).call(_context, getDisplayName(BaseComponent), ")");
|
|
1964
|
+
};
|
|
1958
1965
|
|
|
1959
1966
|
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; }
|
|
1960
1967
|
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; }
|
|
1961
1968
|
const injectDataTablePaginationState = initialValues => Component => {
|
|
1962
1969
|
const WithDataTablePaginationState = props => {
|
|
1970
|
+
var _initialValues$tableS, _initialValues$tableS2;
|
|
1963
1971
|
const _usePaginationState = uiKit.usePaginationState({
|
|
1964
|
-
page: initialValues
|
|
1965
|
-
perPage: initialValues
|
|
1972
|
+
page: initialValues === null || initialValues === void 0 ? void 0 : initialValues.page,
|
|
1973
|
+
perPage: initialValues === null || initialValues === void 0 ? void 0 : initialValues.perPage
|
|
1966
1974
|
}),
|
|
1967
1975
|
page = _usePaginationState.page,
|
|
1968
1976
|
perPage = _usePaginationState.perPage;
|
|
1969
1977
|
const tableSorting = uiKit.useDataTableSortingState({
|
|
1970
|
-
key: initialValues
|
|
1971
|
-
order: initialValues
|
|
1978
|
+
key: initialValues === null || initialValues === void 0 || (_initialValues$tableS = initialValues.tableSorting) === null || _initialValues$tableS === void 0 ? void 0 : _initialValues$tableS.key,
|
|
1979
|
+
order: initialValues === null || initialValues === void 0 || (_initialValues$tableS2 = initialValues.tableSorting) === null || _initialValues$tableS2 === void 0 ? void 0 : _initialValues$tableS2.order
|
|
1972
1980
|
});
|
|
1973
1981
|
return jsxRuntime.jsx(Component, _objectSpread$1p(_objectSpread$1p({}, props), {}, {
|
|
1974
1982
|
dataTablePaginationState: {
|
|
@@ -2002,7 +2010,7 @@ const injectNotifications = function () {
|
|
|
2002
2010
|
[propName]: notifications
|
|
2003
2011
|
}));
|
|
2004
2012
|
};
|
|
2005
|
-
WrappedComponent.displayName =
|
|
2013
|
+
WrappedComponent.displayName = "withNotifications(".concat(getDisplayName(Component));
|
|
2006
2014
|
return WrappedComponent;
|
|
2007
2015
|
};
|
|
2008
2016
|
};
|
|
@@ -2111,7 +2119,10 @@ const isNil = value => typeof value === 'undefined' || value === null;
|
|
|
2111
2119
|
const useStorage = (storageKey, initialStorageValue, options) => {
|
|
2112
2120
|
var _context;
|
|
2113
2121
|
const mergedOptions = _objectSpread$1j(_objectSpread$1j({}, defaultOptions$2), options);
|
|
2114
|
-
const userId = applicationShellConnectors.useApplicationContext(context =>
|
|
2122
|
+
const userId = applicationShellConnectors.useApplicationContext(context => {
|
|
2123
|
+
var _context$user;
|
|
2124
|
+
return (_context$user = context.user) === null || _context$user === void 0 ? void 0 : _context$user.id;
|
|
2125
|
+
});
|
|
2115
2126
|
const scopedStorageKey = _filterInstanceProperty__default["default"](_context = [mergedOptions.segregateByUser && userId, storageKey]).call(_context, Boolean).join('/');
|
|
2116
2127
|
const readFromStorage = React.useCallback(() => {
|
|
2117
2128
|
const rawStorageValue = getStorage(mergedOptions.storageType).getItem(scopedStorageKey);
|
|
@@ -2130,8 +2141,9 @@ const useStorage = (storageKey, initialStorageValue, options) => {
|
|
|
2130
2141
|
return parsedStorageValue;
|
|
2131
2142
|
}, [mergedOptions.storageType, scopedStorageKey]);
|
|
2132
2143
|
const initializeStorageValue = () => {
|
|
2144
|
+
var _ref, _readFromStorage;
|
|
2133
2145
|
// default the storage value to the initial provided value when provided
|
|
2134
|
-
return readFromStorage()
|
|
2146
|
+
return (_ref = (_readFromStorage = readFromStorage()) !== null && _readFromStorage !== void 0 ? _readFromStorage : initialStorageValue) !== null && _ref !== void 0 ? _ref : null;
|
|
2135
2147
|
};
|
|
2136
2148
|
const _useState = React.useState(initializeStorageValue),
|
|
2137
2149
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -2230,14 +2242,16 @@ function ownKeys$1h(e, r) { var t = _Object$keys__default["default"](e); if (_Ob
|
|
|
2230
2242
|
function _objectSpread$1h(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$1h(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$1h(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
2231
2243
|
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 } } } };
|
|
2232
2244
|
const filterStoresOutdatedDanglingProductSelections = storesQueryResult => {
|
|
2245
|
+
var _storesQueryResult$re;
|
|
2233
2246
|
if (!storesQueryResult) return null;
|
|
2234
2247
|
return {
|
|
2235
2248
|
total: storesQueryResult.total,
|
|
2236
2249
|
count: storesQueryResult.count,
|
|
2237
2250
|
offset: storesQueryResult.offset,
|
|
2238
|
-
results: storesQueryResult.results
|
|
2251
|
+
results: (_storesQueryResult$re = storesQueryResult.results) === null || _storesQueryResult$re === void 0 ? void 0 : _mapInstanceProperty__default["default"](_storesQueryResult$re).call(_storesQueryResult$re, store => {
|
|
2252
|
+
var _store$productSelecti;
|
|
2239
2253
|
return _objectSpread$1h(_objectSpread$1h({}, store), {}, {
|
|
2240
|
-
productSelections: store.productSelections
|
|
2254
|
+
productSelections: (_store$productSelecti = store.productSelections) === null || _store$productSelecti === void 0 ? void 0 : _filterInstanceProperty__default["default"](_store$productSelecti).call(_store$productSelecti, productSelectionRef => Boolean(productSelectionRef.productSelection))
|
|
2241
2255
|
});
|
|
2242
2256
|
})
|
|
2243
2257
|
};
|
|
@@ -2249,7 +2263,7 @@ const createQueryVariables$6 = ownProps => {
|
|
|
2249
2263
|
offset: ownProps.offset,
|
|
2250
2264
|
sort: _sortInstanceProperty__default["default"](ownProps)
|
|
2251
2265
|
}, Boolean(ownProps.stores) && {
|
|
2252
|
-
where:
|
|
2266
|
+
where: "key in (".concat(_mapInstanceProperty__default["default"](_context = ownProps.stores).call(_context, store => "\"".concat(store, "\"")).join(', '), ")")
|
|
2253
2267
|
}), {}, {
|
|
2254
2268
|
excludeExtendedStoresList: ownProps.excludeExtendedStoresList,
|
|
2255
2269
|
excludeProductSelections: ownProps.excludeProductSelections
|
|
@@ -2274,7 +2288,10 @@ const useStoresListFetcher = props => {
|
|
|
2274
2288
|
projectKey: props.projectKey
|
|
2275
2289
|
},
|
|
2276
2290
|
fetchPolicy: 'network-only',
|
|
2277
|
-
onError: graphqlErrorResponse =>
|
|
2291
|
+
onError: graphqlErrorResponse => {
|
|
2292
|
+
var _props$onError;
|
|
2293
|
+
return (_props$onError = props.onError) === null || _props$onError === void 0 ? void 0 : _props$onError.call(props, graphqlErrorResponse);
|
|
2294
|
+
}
|
|
2278
2295
|
}),
|
|
2279
2296
|
data = _useQuery.data,
|
|
2280
2297
|
refetch = _useQuery.refetch,
|
|
@@ -2282,7 +2299,7 @@ const useStoresListFetcher = props => {
|
|
|
2282
2299
|
return {
|
|
2283
2300
|
isLoading: loading,
|
|
2284
2301
|
refetch,
|
|
2285
|
-
stores: filterStoresOutdatedDanglingProductSelections(data
|
|
2302
|
+
stores: filterStoresOutdatedDanglingProductSelections(data === null || data === void 0 ? void 0 : data.stores),
|
|
2286
2303
|
refetchQuery: {
|
|
2287
2304
|
query: FetchStoresQuery,
|
|
2288
2305
|
variables: queryVariables,
|
|
@@ -2346,10 +2363,16 @@ const handlers$5 = {
|
|
|
2346
2363
|
}
|
|
2347
2364
|
};
|
|
2348
2365
|
|
|
2349
|
-
const toPermission = (permission, resourceName) =>
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2366
|
+
const toPermission = (permission, resourceName) => {
|
|
2367
|
+
var _context;
|
|
2368
|
+
return camelCase__default["default"](_concatInstanceProperty__default["default"](_context = "can ".concat(permission, " ")).call(_context, resourceName));
|
|
2369
|
+
};
|
|
2370
|
+
const createComposePath = resourceName => permission => {
|
|
2371
|
+
var _context2;
|
|
2372
|
+
return (// e.g applicationContext.dataFences?.store?.orders?.canViewOrders?.values
|
|
2373
|
+
_concatInstanceProperty__default["default"](_context2 = "dataFences.store.".concat(resourceName, ".")).call(_context2, permission, ".values")
|
|
2374
|
+
);
|
|
2375
|
+
};
|
|
2353
2376
|
const useStoreKeysInDataFences = _ref => {
|
|
2354
2377
|
let resourceName = _ref.resourceName,
|
|
2355
2378
|
_ref$permission = _ref.permission,
|
|
@@ -2747,7 +2770,7 @@ const usePersistedTableConfiguration = props => {
|
|
|
2747
2770
|
* Therefore, if it will be missing from the local storage and hence we use the [] as default.
|
|
2748
2771
|
*/
|
|
2749
2772
|
const getVisibleColumns = React.useCallback(() => {
|
|
2750
|
-
if (cachedVisibleTableConfiguration
|
|
2773
|
+
if (cachedVisibleTableConfiguration !== null && cachedVisibleTableConfiguration !== void 0 && cachedVisibleTableConfiguration.columnsConfig) {
|
|
2751
2774
|
return retrieveColumnsWithCachedConfiguration({
|
|
2752
2775
|
allAvailableColumnsConfiguration,
|
|
2753
2776
|
cachedVisibleTableConfiguration: cachedVisibleTableConfiguration.columnsConfig,
|
|
@@ -2761,8 +2784,8 @@ const usePersistedTableConfiguration = props => {
|
|
|
2761
2784
|
return {
|
|
2762
2785
|
visibleColumns,
|
|
2763
2786
|
visibleColumnKeys,
|
|
2764
|
-
cachedVisibleColumnsConfiguration: cachedVisibleTableConfiguration
|
|
2765
|
-
cachedDisplaySettings: cachedVisibleTableConfiguration
|
|
2787
|
+
cachedVisibleColumnsConfiguration: cachedVisibleTableConfiguration === null || cachedVisibleTableConfiguration === void 0 ? void 0 : cachedVisibleTableConfiguration.columnsConfig,
|
|
2788
|
+
cachedDisplaySettings: cachedVisibleTableConfiguration === null || cachedVisibleTableConfiguration === void 0 ? void 0 : cachedVisibleTableConfiguration.displaySettings,
|
|
2766
2789
|
handleCachedTableConfigurationUpdate: update => handleCacheUpdate({
|
|
2767
2790
|
update,
|
|
2768
2791
|
cachedVisibleTableConfiguration,
|
|
@@ -2773,6 +2796,7 @@ const usePersistedTableConfiguration = props => {
|
|
|
2773
2796
|
|
|
2774
2797
|
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 } } } };
|
|
2775
2798
|
const useProductSelectionsTotalFetcher = props => {
|
|
2799
|
+
var _data$productSelectio;
|
|
2776
2800
|
const _useQuery = hooks.useQuery(FetchProductSelectionsTotal, {
|
|
2777
2801
|
context: {
|
|
2778
2802
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -2782,7 +2806,7 @@ const useProductSelectionsTotalFetcher = props => {
|
|
|
2782
2806
|
data = _useQuery.data;
|
|
2783
2807
|
return {
|
|
2784
2808
|
isLoading: loading,
|
|
2785
|
-
total: data
|
|
2809
|
+
total: data === null || data === void 0 || (_data$productSelectio = data.productSelections) === null || _data$productSelectio === void 0 ? void 0 : _data$productSelectio.total
|
|
2786
2810
|
};
|
|
2787
2811
|
};
|
|
2788
2812
|
|
|
@@ -2803,7 +2827,7 @@ function _objectSpread$1d(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
|
2803
2827
|
// eslint-disable-next-line import/prefer-default-export
|
|
2804
2828
|
const convertProductSelectionsFromGraphQl = productSelections => {
|
|
2805
2829
|
var _context;
|
|
2806
|
-
return productSelections
|
|
2830
|
+
return (productSelections === null || productSelections === void 0 ? void 0 : productSelections.results) && _objectSpread$1d(_objectSpread$1d({}, productSelections), {}, {
|
|
2807
2831
|
results: _mapInstanceProperty__default["default"](_context = productSelections.results).call(_context, productSelection => _objectSpread$1d({}, l10n.applyTransformedLocalizedFields(productSelection, [{
|
|
2808
2832
|
from: 'nameAllLocales',
|
|
2809
2833
|
to: 'name'
|
|
@@ -2837,7 +2861,7 @@ const useProductSelectionsFetcher = props => {
|
|
|
2837
2861
|
refetch = _useQuery.refetch;
|
|
2838
2862
|
return {
|
|
2839
2863
|
isLoading: loading,
|
|
2840
|
-
productSelections: convertProductSelectionsFromGraphQl(data
|
|
2864
|
+
productSelections: convertProductSelectionsFromGraphQl(data === null || data === void 0 ? void 0 : data.productSelections) || emptyProductSelections,
|
|
2841
2865
|
refetch
|
|
2842
2866
|
};
|
|
2843
2867
|
};
|
|
@@ -2862,6 +2886,7 @@ function validateSingleFilter(_ref) {
|
|
|
2862
2886
|
return _includesInstanceProperty__default["default"](invalidValues).call(invalidValues, value);
|
|
2863
2887
|
}
|
|
2864
2888
|
|
|
2889
|
+
var _templateObject$3, _templateObject2$2;
|
|
2865
2890
|
const dateFormatDayStart$1 = 'YYYY-MM-DDT00:00:00.000';
|
|
2866
2891
|
const dateFormatDayEnd$1 = 'YYYY-MM-DDT23:59:59.999';
|
|
2867
2892
|
const getDateTimeInUTC = (date, timezone, format) => {
|
|
@@ -2871,7 +2896,8 @@ const getDateTimeInUTC = (date, timezone, format) => {
|
|
|
2871
2896
|
const noTimeSpecified = momentDate.hours() === 0 && momentDate.minutes() === 0 && momentDate.seconds() === 0;
|
|
2872
2897
|
// if it's a date then convert it to UTC datetime based on timezone
|
|
2873
2898
|
if (noTimeSpecified) {
|
|
2874
|
-
|
|
2899
|
+
var _moment$tz;
|
|
2900
|
+
const offset = ((_moment$tz = moment__default$1["default"](date).tz(timezone)) === null || _moment$tz === void 0 ? void 0 : _moment$tz.utcOffset()) || 0;
|
|
2875
2901
|
const formattedDate = momentDate.format(format);
|
|
2876
2902
|
const formattedDateWithOffset = moment__default$1["default"](formattedDate).add(offset, 'minutes').format(dateFormat);
|
|
2877
2903
|
// console.log(formattedDateWithOffset);
|
|
@@ -2884,6 +2910,7 @@ const getDateTimeInUTC = (date, timezone, format) => {
|
|
|
2884
2910
|
function dateTransformer$1(filterKey, filters) {
|
|
2885
2911
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator$1;
|
|
2886
2912
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
2913
|
+
var _context, _context2;
|
|
2887
2914
|
let type = _ref.type,
|
|
2888
2915
|
value = _ref.value,
|
|
2889
2916
|
timezone = _ref.timezone;
|
|
@@ -2893,19 +2920,13 @@ function dateTransformer$1(filterKey, filters) {
|
|
|
2893
2920
|
})) return '';
|
|
2894
2921
|
switch (type) {
|
|
2895
2922
|
case FILTER_TYPES.lessThan:
|
|
2896
|
-
return
|
|
2923
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(filterKey, " < \"")).call(_context, getDateTimeInUTC(value, timezone, dateFormatDayStart$1), "\"");
|
|
2897
2924
|
case FILTER_TYPES.moreThan:
|
|
2898
|
-
return
|
|
2925
|
+
return _concatInstanceProperty__default["default"](_context2 = "".concat(filterKey, " > \"")).call(_context2, getDateTimeInUTC(value, timezone, dateFormatDayEnd$1), "\"");
|
|
2899
2926
|
case FILTER_TYPES.equalTo:
|
|
2900
|
-
return oneLine__default["default"]
|
|
2901
|
-
(${filterKey} >= "${getDateTimeInUTC(value, timezone, dateFormatDayStart$1)}"
|
|
2902
|
-
and ${filterKey} <= "${getDateTimeInUTC(value, timezone, dateFormatDayEnd$1)}")
|
|
2903
|
-
`;
|
|
2927
|
+
return oneLine__default["default"](_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n (", " >= \"", "\"\n and ", " <= \"", "\")\n "])), filterKey, getDateTimeInUTC(value, timezone, dateFormatDayStart$1), filterKey, getDateTimeInUTC(value, timezone, dateFormatDayEnd$1));
|
|
2904
2928
|
case FILTER_TYPES.range:
|
|
2905
|
-
return oneLine__default["default"]
|
|
2906
|
-
(${filterKey} >= "${getDateTimeInUTC(value.from, timezone, dateFormatDayStart$1)}"
|
|
2907
|
-
and ${filterKey} <= "${getDateTimeInUTC(value.to, timezone, dateFormatDayEnd$1)}")
|
|
2908
|
-
`;
|
|
2929
|
+
return oneLine__default["default"](_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteral(["\n (", " >= \"", "\"\n and ", " <= \"", "\")\n "])), filterKey, getDateTimeInUTC(value.from, timezone, dateFormatDayStart$1), filterKey, getDateTimeInUTC(value.to, timezone, dateFormatDayEnd$1));
|
|
2909
2930
|
default:
|
|
2910
2931
|
return '';
|
|
2911
2932
|
}
|
|
@@ -2921,7 +2942,7 @@ function dateTransformer$1(filterKey, filters) {
|
|
|
2921
2942
|
* (createdAt >= "2018-02-15T00:00:00.000+01:00" and createdAt <= "2018-02-15T23:59:59.999+01:00")
|
|
2922
2943
|
* ) or some_more_filters
|
|
2923
2944
|
*/
|
|
2924
|
-
return queryString === '' ? null :
|
|
2945
|
+
return queryString === '' ? null : "(".concat(queryString, ")");
|
|
2925
2946
|
}
|
|
2926
2947
|
function defaultFilterValidator$1(_ref2) {
|
|
2927
2948
|
let type = _ref2.type,
|
|
@@ -2937,7 +2958,10 @@ function defaultFilterValidator$1(_ref2) {
|
|
|
2937
2958
|
|
|
2938
2959
|
var localizedTextTransformer = (localizedString => {
|
|
2939
2960
|
var _context;
|
|
2940
|
-
return _mapInstanceProperty__default["default"](_context = _Object$keys__default["default"](localizedString)).call(_context, locale =>
|
|
2961
|
+
return _mapInstanceProperty__default["default"](_context = _Object$keys__default["default"](localizedString)).call(_context, locale => {
|
|
2962
|
+
var _context2;
|
|
2963
|
+
return _concatInstanceProperty__default["default"](_context2 = "".concat(locale, " = \"")).call(_context2, localizedString[locale], "\"");
|
|
2964
|
+
}).join(' and ');
|
|
2941
2965
|
});
|
|
2942
2966
|
|
|
2943
2967
|
var styles$j = {
|
|
@@ -2985,8 +3009,9 @@ function _objectSpread$1c(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
|
2985
3009
|
var GetChannelsQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetChannelsQuery" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "where" } }, type: { kind: "NamedType", name: { kind: "Name", value: "String" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "sortByNamePath" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "channels" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "where" }, value: { kind: "Variable", name: { kind: "Name", value: "where" } } }, { kind: "Argument", name: { kind: "Name", value: "sort" }, value: { kind: "ListValue", values: [{ kind: "Variable", name: { kind: "Name", value: "sortByNamePath" } }, { kind: "StringValue", value: "key", block: false }] } }, { kind: "Argument", name: { kind: "Name", value: "limit" }, value: { kind: "IntValue", value: "60" } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "FragmentSpread", name: { kind: "Name", value: "PickerInputChannel" }, directives: [] }] } }] } }] } }, { kind: "FragmentDefinition", name: { kind: "Name", value: "PickerInputChannel" }, typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Channel" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 392, source: { body: "fragment PickerInputChannel on Channel {\n id\n key\n nameAllLocales {\n locale\n value\n }\n}\n\nquery GetChannelsQuery($where: String, $sortByNamePath: String!) {\n channels(where: $where, sort: [$sortByNamePath, \"key\"], limit: 60) {\n total\n results {\n ...PickerInputChannel\n }\n }\n}\n\nquery GetChannelQuery($id: String) {\n channel(id: $id) {\n ...PickerInputChannel\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
2986
3010
|
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 } } } };
|
|
2987
3011
|
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 } } } };
|
|
2988
|
-
const getRolesClause = roles => roles && roles.length > 0 ?
|
|
3012
|
+
const getRolesClause = roles => roles && roles.length > 0 ? "roles contains any (".concat(_mapInstanceProperty__default["default"](roles).call(roles, role => "\"".concat(role, "\"")).join(','), ")") : undefined;
|
|
2989
3013
|
const ChannelPickerInput = _ref => {
|
|
3014
|
+
var _currentOption$data$l, _currentOption$data;
|
|
2990
3015
|
let isClearable = _ref.isClearable,
|
|
2991
3016
|
isDisabled = _ref.isDisabled,
|
|
2992
3017
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -3006,7 +3031,7 @@ const ChannelPickerInput = _ref => {
|
|
|
3006
3031
|
const variables = React.useMemo(() => {
|
|
3007
3032
|
const rolesClause = getRolesClause(roles);
|
|
3008
3033
|
return _objectSpread$1c({
|
|
3009
|
-
sortByNamePath:
|
|
3034
|
+
sortByNamePath: "name.".concat(dataLocale)
|
|
3010
3035
|
}, rolesClause && {
|
|
3011
3036
|
extraWhere: rolesClause
|
|
3012
3037
|
});
|
|
@@ -3027,7 +3052,7 @@ const ChannelPickerInput = _ref => {
|
|
|
3027
3052
|
}
|
|
3028
3053
|
return channel;
|
|
3029
3054
|
}, [formatLocalizedFieldToString]);
|
|
3030
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
3055
|
+
const prefixSearchFields = React.useMemo(() => ["name.".concat(dataLocale), 'key'], [dataLocale]);
|
|
3031
3056
|
const loadOptions = useLoadOptions({
|
|
3032
3057
|
query: GetChannelsQuery,
|
|
3033
3058
|
variables,
|
|
@@ -3062,13 +3087,13 @@ const ChannelPickerInput = _ref => {
|
|
|
3062
3087
|
setLoadingError(null);
|
|
3063
3088
|
handleInternalInputChange(event);
|
|
3064
3089
|
}, [handleInternalInputChange]);
|
|
3065
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
3090
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption === null || currentOption === void 0 ? void 0 : currentOption.error);
|
|
3066
3091
|
React.useEffect(() => {
|
|
3067
3092
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
3068
3093
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
3069
3094
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
3070
3095
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$G.noChannelsFound), [loadingError, formatMessage]);
|
|
3071
|
-
const tooltipTitle = currentOption
|
|
3096
|
+
const tooltipTitle = (_currentOption$data$l = currentOption === null || currentOption === void 0 || (_currentOption$data = currentOption.data) === null || _currentOption$data === void 0 ? void 0 : _currentOption$data.label) !== null && _currentOption$data$l !== void 0 ? _currentOption$data$l : '';
|
|
3072
3097
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
3073
3098
|
max: "scale",
|
|
3074
3099
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -3078,7 +3103,7 @@ const ChannelPickerInput = _ref => {
|
|
|
3078
3103
|
children: jsxRuntime.jsx(uiKit.AsyncSelectInput, {
|
|
3079
3104
|
id: name,
|
|
3080
3105
|
name: name,
|
|
3081
|
-
placeholder: placeholder
|
|
3106
|
+
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : formatMessage(messages$G.placeholder),
|
|
3082
3107
|
loadOptions: loadOptionsDebounced,
|
|
3083
3108
|
defaultOptions: true,
|
|
3084
3109
|
showOptionGroupDivider: true,
|
|
@@ -3122,26 +3147,26 @@ function _callSuper$9(_this, derived, args) {
|
|
|
3122
3147
|
return _possibleConstructorReturn(_this, isNativeReflectConstruct() ? _Reflect$construct__default["default"](derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args));
|
|
3123
3148
|
}
|
|
3124
3149
|
let FormattedDateTime = /*#__PURE__*/function (_PureComponent) {
|
|
3125
|
-
_inherits(FormattedDateTime, _PureComponent);
|
|
3126
3150
|
function FormattedDateTime() {
|
|
3127
3151
|
_classCallCheck(this, FormattedDateTime);
|
|
3128
3152
|
return _callSuper$9(this, FormattedDateTime, arguments);
|
|
3129
3153
|
}
|
|
3130
|
-
|
|
3154
|
+
_inherits(FormattedDateTime, _PureComponent);
|
|
3155
|
+
return _createClass(FormattedDateTime, [{
|
|
3131
3156
|
key: "render",
|
|
3132
3157
|
value: function render() {
|
|
3133
3158
|
return jsxRuntime.jsx(applicationShellConnectors.ApplicationContext, {
|
|
3134
3159
|
render: _ref => {
|
|
3160
|
+
var _this$props;
|
|
3135
3161
|
let user = _ref.user;
|
|
3136
3162
|
return formatDateTime$1(this.props.type, this.props.value, {
|
|
3137
|
-
timeZone: this
|
|
3163
|
+
timeZone: (this === null || this === void 0 || (_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.timeZone) || (user === null || user === void 0 ? void 0 : user.timeZone),
|
|
3138
3164
|
locale: this.props.intl.locale
|
|
3139
3165
|
});
|
|
3140
3166
|
}
|
|
3141
3167
|
});
|
|
3142
3168
|
}
|
|
3143
3169
|
}]);
|
|
3144
|
-
return FormattedDateTime;
|
|
3145
3170
|
}(React.PureComponent);
|
|
3146
3171
|
FormattedDateTime.displayName = 'FormattedDateTime';
|
|
3147
3172
|
var FormattedDateTime$1 = reactIntl.injectIntl(FormattedDateTime);
|
|
@@ -3166,25 +3191,25 @@ function _callSuper$8(_this, derived, args) {
|
|
|
3166
3191
|
}
|
|
3167
3192
|
const withMouseOverState = BaseComponent => {
|
|
3168
3193
|
let WithMouseOverState = /*#__PURE__*/function (_Component) {
|
|
3169
|
-
_inherits(WithMouseOverState, _Component);
|
|
3170
3194
|
function WithMouseOverState() {
|
|
3171
|
-
var
|
|
3195
|
+
var _this2;
|
|
3172
3196
|
_classCallCheck(this, WithMouseOverState);
|
|
3173
3197
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3174
3198
|
args[_key] = arguments[_key];
|
|
3175
3199
|
}
|
|
3176
|
-
|
|
3177
|
-
|
|
3200
|
+
_this2 = _callSuper$8(this, WithMouseOverState, [...args]);
|
|
3201
|
+
_this2.state = {
|
|
3178
3202
|
isMouseOver: false
|
|
3179
3203
|
};
|
|
3180
|
-
|
|
3204
|
+
_this2.setMouseOver = nextMouseOver => _this2.setState({
|
|
3181
3205
|
isMouseOver: nextMouseOver
|
|
3182
3206
|
});
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
return
|
|
3207
|
+
_this2.handleMouseOver = () => _this2.setMouseOver(true);
|
|
3208
|
+
_this2.handleMouseOut = () => _this2.setMouseOver(false);
|
|
3209
|
+
return _this2;
|
|
3186
3210
|
}
|
|
3187
|
-
|
|
3211
|
+
_inherits(WithMouseOverState, _Component);
|
|
3212
|
+
return _createClass(WithMouseOverState, [{
|
|
3188
3213
|
key: "render",
|
|
3189
3214
|
value: function render() {
|
|
3190
3215
|
const injectedProps = {
|
|
@@ -3195,7 +3220,6 @@ const withMouseOverState = BaseComponent => {
|
|
|
3195
3220
|
return jsxRuntime.jsx(BaseComponent, _objectSpread$1b({}, _objectSpread$1b(_objectSpread$1b({}, this.props), injectedProps)));
|
|
3196
3221
|
}
|
|
3197
3222
|
}]);
|
|
3198
|
-
return WithMouseOverState;
|
|
3199
3223
|
}(React.Component);
|
|
3200
3224
|
WithMouseOverState.displayName = wrapDisplayName(BaseComponent, 'withMouseOverState');
|
|
3201
3225
|
return WithMouseOverState;
|
|
@@ -3230,74 +3254,74 @@ var styles$i = {
|
|
|
3230
3254
|
"granular": "throttled-field-module__granular___2LXJf"
|
|
3231
3255
|
};
|
|
3232
3256
|
let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
3233
|
-
_inherits(ThrottledField, _PureComponent);
|
|
3234
3257
|
function ThrottledField() {
|
|
3235
|
-
var
|
|
3258
|
+
var _this2;
|
|
3236
3259
|
_classCallCheck(this, ThrottledField);
|
|
3237
3260
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3238
3261
|
args[_key] = arguments[_key];
|
|
3239
3262
|
}
|
|
3240
|
-
|
|
3241
|
-
|
|
3263
|
+
_this2 = _callSuper$7(this, ThrottledField, [...args]);
|
|
3264
|
+
_this2.state = {
|
|
3242
3265
|
draftValue: '',
|
|
3243
3266
|
prevValue: ''
|
|
3244
3267
|
};
|
|
3245
|
-
|
|
3246
|
-
clearTimeout(
|
|
3247
|
-
clearTimeout(
|
|
3248
|
-
|
|
3249
|
-
|
|
3268
|
+
_this2.clearPendingUpdates = () => {
|
|
3269
|
+
clearTimeout(_this2.changeTimeout);
|
|
3270
|
+
clearTimeout(_this2.blurTimeout);
|
|
3271
|
+
_this2.changeTimeout = null;
|
|
3272
|
+
_this2.blurTimeout = null;
|
|
3250
3273
|
};
|
|
3251
|
-
|
|
3274
|
+
_this2.handleChange = event => {
|
|
3252
3275
|
// The `SyntheticEvent` is pooled by default for perf reasons.
|
|
3253
3276
|
// See https://facebook.github.io/react/docs/events.html#event-pooling
|
|
3254
3277
|
// To access the event in an async way we need to persist it.
|
|
3255
3278
|
event.persist();
|
|
3256
|
-
|
|
3279
|
+
_this2.setState({
|
|
3257
3280
|
draftValue: event.target.value
|
|
3258
3281
|
});
|
|
3259
|
-
|
|
3282
|
+
_this2.doDelayedUpdate(_this2.props.onChange, event, 'change');
|
|
3260
3283
|
};
|
|
3261
|
-
|
|
3284
|
+
_this2.handleEnter = event => {
|
|
3262
3285
|
if (event.keyCode !== 13) return;
|
|
3263
|
-
if (
|
|
3286
|
+
if (_this2.changeTimeout) {
|
|
3264
3287
|
// Since there are still are some pending updates that are not sent to the
|
|
3265
3288
|
// parent yet we need to call the update here explicitly and clear the
|
|
3266
3289
|
// pending updates
|
|
3267
|
-
|
|
3290
|
+
_this2.props.onChange({
|
|
3268
3291
|
target: {
|
|
3269
|
-
value:
|
|
3292
|
+
value: _this2.state.draftValue
|
|
3270
3293
|
}
|
|
3271
3294
|
});
|
|
3272
3295
|
// we can savely clear the timeout and thus abort all pending changes
|
|
3273
3296
|
// because we just update the parent with the current state
|
|
3274
|
-
clearTimeout(
|
|
3275
|
-
|
|
3297
|
+
clearTimeout(_this2.changeTimeout);
|
|
3298
|
+
_this2.changeTimeout = null;
|
|
3276
3299
|
}
|
|
3277
|
-
|
|
3300
|
+
_this2.props.onEnter(_this2.state.draftValue);
|
|
3278
3301
|
};
|
|
3279
|
-
|
|
3302
|
+
_this2.handleBlur = event => {
|
|
3280
3303
|
// The `SyntheticEvent` is pooled by default for perf reasons.
|
|
3281
3304
|
// See https://facebook.github.io/react/docs/events.html#event-pooling
|
|
3282
3305
|
// To access the event in an async way we need to persist it.
|
|
3283
|
-
if (
|
|
3306
|
+
if (_this2.props.onBlurValue) {
|
|
3284
3307
|
event.persist();
|
|
3285
|
-
|
|
3308
|
+
_this2.doDelayedUpdate(e => _this2.props.onBlurValue(e.target.value), event, 'blur');
|
|
3286
3309
|
}
|
|
3287
3310
|
};
|
|
3288
|
-
|
|
3289
|
-
const self =
|
|
3290
|
-
const timeoutKey =
|
|
3311
|
+
_this2.doDelayedUpdate = (updateFunction, event, eventType) => {
|
|
3312
|
+
const self = _this2;
|
|
3313
|
+
const timeoutKey = "".concat(eventType, "Timeout");
|
|
3291
3314
|
// TODO: can't we just use one variable?
|
|
3292
|
-
clearTimeout(
|
|
3293
|
-
|
|
3315
|
+
clearTimeout(_this2[timeoutKey]);
|
|
3316
|
+
_this2[timeoutKey] = _setTimeout__default["default"](() => {
|
|
3294
3317
|
updateFunction.call(self, event);
|
|
3295
|
-
|
|
3296
|
-
},
|
|
3318
|
+
_this2[timeoutKey] = null;
|
|
3319
|
+
}, _this2.props.throttleMS);
|
|
3297
3320
|
};
|
|
3298
|
-
return
|
|
3321
|
+
return _this2;
|
|
3299
3322
|
}
|
|
3300
|
-
|
|
3323
|
+
_inherits(ThrottledField, _PureComponent);
|
|
3324
|
+
return _createClass(ThrottledField, [{
|
|
3301
3325
|
key: "componentWillUnmount",
|
|
3302
3326
|
value: function componentWillUnmount() {
|
|
3303
3327
|
this.clearPendingUpdates();
|
|
@@ -3317,7 +3341,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
3317
3341
|
}, this.props.onEnter ? {
|
|
3318
3342
|
onKeyDown: this.handleEnter
|
|
3319
3343
|
} : {}), filterDataAttributes(this.props));
|
|
3320
|
-
const inputId =
|
|
3344
|
+
const inputId = "throttled-field-".concat(this.props.name);
|
|
3321
3345
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3322
3346
|
children: [jsxRuntime.jsx(uiKit.AccessibleHidden, {
|
|
3323
3347
|
children: jsxRuntime.jsx("label", {
|
|
@@ -3326,7 +3350,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
3326
3350
|
})
|
|
3327
3351
|
}), this.props.as === 'textarea' ? jsxRuntime.jsx(Textarea__default["default"], _objectSpread$1a(_objectSpread$1a({}, commonProps), {}, {
|
|
3328
3352
|
id: inputId,
|
|
3329
|
-
className: classnames__default["default"](styles$i.textarea, styles$i[
|
|
3353
|
+
className: classnames__default["default"](styles$i.textarea, styles$i["textarea-".concat(this.props.style)], {
|
|
3330
3354
|
[styles$i.invalid]: !this.props.isValid,
|
|
3331
3355
|
[styles$i.disabled]: this.props.disabled
|
|
3332
3356
|
}),
|
|
@@ -3337,7 +3361,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
3337
3361
|
id: inputId,
|
|
3338
3362
|
ref: this.props.inputRef,
|
|
3339
3363
|
type: this.props.as,
|
|
3340
|
-
className: classnames__default["default"](styles$i[
|
|
3364
|
+
className: classnames__default["default"](styles$i["input-".concat(this.props.style)], {
|
|
3341
3365
|
[styles$i.invalid]: !this.props.isValid,
|
|
3342
3366
|
[styles$i.disabled]: this.props.disabled,
|
|
3343
3367
|
[styles$i.granular]: this.props.isGranular
|
|
@@ -3357,7 +3381,6 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
3357
3381
|
return null;
|
|
3358
3382
|
}
|
|
3359
3383
|
}]);
|
|
3360
|
-
return ThrottledField;
|
|
3361
3384
|
}(React.PureComponent);
|
|
3362
3385
|
ThrottledField.displayName = 'ThrottledField';
|
|
3363
3386
|
ThrottledField.defaultProps = {
|
|
@@ -3414,53 +3437,54 @@ var styles$h = {
|
|
|
3414
3437
|
"action": "search-input-module__action___1GqGT"
|
|
3415
3438
|
};
|
|
3416
3439
|
let SearchInput = /*#__PURE__*/function (_Component) {
|
|
3417
|
-
_inherits(SearchInput, _Component);
|
|
3418
3440
|
function SearchInput() {
|
|
3419
|
-
var
|
|
3441
|
+
var _this2;
|
|
3420
3442
|
_classCallCheck(this, SearchInput);
|
|
3421
3443
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3422
3444
|
args[_key] = arguments[_key];
|
|
3423
3445
|
}
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
initialValue:
|
|
3427
|
-
text:
|
|
3446
|
+
_this2 = _callSuper$6(this, SearchInput, [...args]);
|
|
3447
|
+
_this2.state = {
|
|
3448
|
+
initialValue: _this2.props.initialValue,
|
|
3449
|
+
text: _this2.props.initialValue || ''
|
|
3428
3450
|
};
|
|
3429
|
-
|
|
3451
|
+
_this2.handleInputChange = event => {
|
|
3430
3452
|
const value = event.target.value;
|
|
3431
|
-
|
|
3453
|
+
_this2.setState({
|
|
3432
3454
|
text: value
|
|
3433
3455
|
}, () => {
|
|
3434
|
-
if (
|
|
3435
|
-
if (
|
|
3456
|
+
if (_this2.props.shouldSubmitOnInputChange) _this2.props.onSubmit(value, _this2.props.searchMode);
|
|
3457
|
+
if (_this2.props.onChange) _this2.props.onChange(value);
|
|
3436
3458
|
});
|
|
3437
3459
|
};
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
text:
|
|
3460
|
+
_this2.handleEnter = value => {
|
|
3461
|
+
_this2.setState({
|
|
3462
|
+
text: _this2.props.shouldClearOnSubmit ? '' : value
|
|
3441
3463
|
});
|
|
3442
|
-
|
|
3464
|
+
_this2.props.onSubmit(value, _this2.props.searchMode);
|
|
3443
3465
|
};
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3466
|
+
_this2.handleSubmit = () => {
|
|
3467
|
+
_this2.props.onSubmit(_this2.state.text, _this2.props.searchMode);
|
|
3468
|
+
_this2.props.shouldClearOnSubmit && _this2.setState({
|
|
3447
3469
|
text: ''
|
|
3448
3470
|
});
|
|
3449
3471
|
};
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3472
|
+
_this2.handleClear = () => {
|
|
3473
|
+
var _this2$inputRef;
|
|
3474
|
+
(_this2$inputRef = _this2.inputRef) === null || _this2$inputRef === void 0 || _this2$inputRef.focus();
|
|
3475
|
+
_this2.props.onChange(null);
|
|
3476
|
+
_this2.props.onReset();
|
|
3477
|
+
_this2.setState({
|
|
3455
3478
|
text: ''
|
|
3456
3479
|
});
|
|
3457
3480
|
};
|
|
3458
|
-
|
|
3459
|
-
|
|
3481
|
+
_this2.setInputRef = inputRef => {
|
|
3482
|
+
_this2.inputRef = inputRef;
|
|
3460
3483
|
};
|
|
3461
|
-
return
|
|
3484
|
+
return _this2;
|
|
3462
3485
|
}
|
|
3463
|
-
|
|
3486
|
+
_inherits(SearchInput, _Component);
|
|
3487
|
+
return _createClass(SearchInput, [{
|
|
3464
3488
|
key: "shouldComponentUpdate",
|
|
3465
3489
|
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
3466
3490
|
// ignore state, since it is only use to keep track of the text in the child
|
|
@@ -3535,7 +3559,6 @@ let SearchInput = /*#__PURE__*/function (_Component) {
|
|
|
3535
3559
|
return null;
|
|
3536
3560
|
}
|
|
3537
3561
|
}]);
|
|
3538
|
-
return SearchInput;
|
|
3539
3562
|
}(React.Component);
|
|
3540
3563
|
SearchInput.displayName = 'SearchInput';
|
|
3541
3564
|
SearchInput.defaultProps = {
|
|
@@ -3560,12 +3583,12 @@ const useExecuteGraphQLRequest = () => {
|
|
|
3560
3583
|
};
|
|
3561
3584
|
const createSearchProductsFromPIMAction = (searchTerm, projectKey) => sdk.actions.post({
|
|
3562
3585
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.PIM_SEARCH,
|
|
3563
|
-
uri:
|
|
3586
|
+
uri: "/".concat(projectKey, "/search/product-types"),
|
|
3564
3587
|
payload: {
|
|
3565
3588
|
query: {
|
|
3566
3589
|
wildcard: {
|
|
3567
3590
|
field: 'name',
|
|
3568
|
-
value:
|
|
3591
|
+
value: "*".concat(searchTerm, "*"),
|
|
3569
3592
|
caseInsensitive: true
|
|
3570
3593
|
}
|
|
3571
3594
|
},
|
|
@@ -3579,8 +3602,9 @@ const useFetchProductTypesFromPIM = _ref => {
|
|
|
3579
3602
|
const dispatch = sdk.useAsyncDispatch();
|
|
3580
3603
|
const executeGraphQLRequest = useExecuteGraphQLRequest();
|
|
3581
3604
|
const fetchProductTypesFromPim = React.useCallback(async searchTerm => {
|
|
3605
|
+
var _result$hits$map, _result$hits;
|
|
3582
3606
|
const result = await dispatch(createSearchProductsFromPIMAction(searchTerm, projectKey));
|
|
3583
|
-
const ids =
|
|
3607
|
+
const ids = (_result$hits$map = result === null || result === void 0 || (_result$hits = result.hits) === null || _result$hits === void 0 ? void 0 : _mapInstanceProperty__default["default"](_result$hits).call(_result$hits, hit => hit.id)) !== null && _result$hits$map !== void 0 ? _result$hits$map : [];
|
|
3584
3608
|
// Avoid sending any requests if it's clear that nothing is found
|
|
3585
3609
|
if (ids.length === 0) {
|
|
3586
3610
|
return {
|
|
@@ -3615,19 +3639,22 @@ const useFetchProductTypesFromPIM = _ref => {
|
|
|
3615
3639
|
*/
|
|
3616
3640
|
const constructNestedExpression = (reversedPath, predicate) => {
|
|
3617
3641
|
if (reversedPath.length > 0) {
|
|
3618
|
-
return _reduceInstanceProperty__default["default"](reversedPath).call(reversedPath, (nextNestedValue, nestedSelection) =>
|
|
3642
|
+
return _reduceInstanceProperty__default["default"](reversedPath).call(reversedPath, (nextNestedValue, nestedSelection) => {
|
|
3643
|
+
var _context;
|
|
3644
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(nestedSelection, "(")).call(_context, nextNestedValue, ")");
|
|
3645
|
+
}, predicate);
|
|
3619
3646
|
}
|
|
3620
3647
|
return predicate;
|
|
3621
3648
|
};
|
|
3622
3649
|
const constructPrefixSearchPredicate$1 = (prefixSearchFields, lowerBound, upperBound) => {
|
|
3623
3650
|
const constructPrefixSearchExpression = field => {
|
|
3624
|
-
var
|
|
3651
|
+
var _context2, _context3, _context4, _context5;
|
|
3625
3652
|
const parts = field.split('.');
|
|
3626
|
-
const _parts$slice$reverse = _reverseInstanceProperty__default["default"](
|
|
3653
|
+
const _parts$slice$reverse = _reverseInstanceProperty__default["default"](_context2 = _sliceInstanceProperty__default["default"](parts).call(parts)).call(_context2),
|
|
3627
3654
|
_parts$slice$reverse2 = _toArray(_parts$slice$reverse),
|
|
3628
3655
|
valueToNest = _parts$slice$reverse2[0],
|
|
3629
3656
|
reversedPathToNestedValue = _sliceInstanceProperty__default["default"](_parts$slice$reverse2).call(_parts$slice$reverse2, 1);
|
|
3630
|
-
const predicateExpression =
|
|
3657
|
+
const predicateExpression = _concatInstanceProperty__default["default"](_context3 = _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = "".concat(valueToNest, " >= \"")).call(_context5, lowerBound, "\" and ")).call(_context4, valueToNest, " < \"")).call(_context3, upperBound, "\"");
|
|
3631
3658
|
return constructNestedExpression(reversedPathToNestedValue, predicateExpression);
|
|
3632
3659
|
};
|
|
3633
3660
|
return _mapInstanceProperty__default["default"](prefixSearchFields).call(prefixSearchFields, constructPrefixSearchExpression).join(' or ');
|
|
@@ -3635,7 +3662,7 @@ const constructPrefixSearchPredicate$1 = (prefixSearchFields, lowerBound, upperB
|
|
|
3635
3662
|
const constructWherePredicate = (inputValue, prefixSearchFields) => {
|
|
3636
3663
|
const wherePredicate = function () {
|
|
3637
3664
|
if (inputValue.length) {
|
|
3638
|
-
if (isUUID(inputValue)) return
|
|
3665
|
+
if (isUUID(inputValue)) return "id = \"".concat(inputValue, "\"");else {
|
|
3639
3666
|
const _getPrefixSearchBound = getPrefixSearchBounds(inputValue),
|
|
3640
3667
|
_getPrefixSearchBound2 = _slicedToArray(_getPrefixSearchBound, 2),
|
|
3641
3668
|
lowerBound = _getPrefixSearchBound2[0],
|
|
@@ -3660,6 +3687,7 @@ const useFetchProductTypessFromCTP = _ref2 => {
|
|
|
3660
3687
|
}, [prefixSearchFields, executeGraphQLRequest]);
|
|
3661
3688
|
};
|
|
3662
3689
|
const usePimStatus = () => {
|
|
3690
|
+
var _data$indicesExist;
|
|
3663
3691
|
const _useQuery = react.useQuery(FetchIndicesExist$1, {
|
|
3664
3692
|
context: {
|
|
3665
3693
|
target: constants.GRAPHQL_TARGETS.PIM_INDEXER
|
|
@@ -3669,17 +3697,20 @@ const usePimStatus = () => {
|
|
|
3669
3697
|
data = _useQuery.data;
|
|
3670
3698
|
return {
|
|
3671
3699
|
data,
|
|
3672
|
-
isProjectIndexed: Boolean(data
|
|
3700
|
+
isProjectIndexed: Boolean(data === null || data === void 0 || (_data$indicesExist = data.indicesExist) === null || _data$indicesExist === void 0 || (_data$indicesExist = _data$indicesExist.productTypes) === null || _data$indicesExist === void 0 ? void 0 : _data$indicesExist.searchableIndexExists)
|
|
3673
3701
|
};
|
|
3674
3702
|
};
|
|
3675
3703
|
const useProductTypeOptions = _ref3 => {
|
|
3676
3704
|
let prefixSearchFields = _ref3.prefixSearchFields;
|
|
3677
3705
|
const _usePimStatus = usePimStatus(),
|
|
3678
3706
|
isProjectIndexed = _usePimStatus.isProjectIndexed;
|
|
3679
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context =>
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3707
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => {
|
|
3708
|
+
var _context$project;
|
|
3709
|
+
return {
|
|
3710
|
+
dataLocale: context.dataLocale,
|
|
3711
|
+
projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key
|
|
3712
|
+
};
|
|
3713
|
+
}),
|
|
3683
3714
|
dataLocale = _useApplicationContex.dataLocale,
|
|
3684
3715
|
projectKey = _useApplicationContex.projectKey;
|
|
3685
3716
|
const fetchProductTypesFromPim = useFetchProductTypesFromPIM({
|
|
@@ -3743,9 +3774,10 @@ const useHandlers = onChange => {
|
|
|
3743
3774
|
setInputValue(changedValue);
|
|
3744
3775
|
}, []);
|
|
3745
3776
|
const handleChange = useEventCallback(event => {
|
|
3777
|
+
var _event$target$value;
|
|
3746
3778
|
const eventWithExtractedValue = _objectSpread$18(_objectSpread$18({}, event), {}, {
|
|
3747
3779
|
target: _objectSpread$18(_objectSpread$18({}, event.target), {}, {
|
|
3748
|
-
value: event.target.value
|
|
3780
|
+
value: (_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.value
|
|
3749
3781
|
})
|
|
3750
3782
|
});
|
|
3751
3783
|
onChange(eventWithExtractedValue);
|
|
@@ -3755,21 +3787,24 @@ const useHandlers = onChange => {
|
|
|
3755
3787
|
|
|
3756
3788
|
const _excluded$3 = ["extraWhere"];
|
|
3757
3789
|
function ownKeys$17(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3758
|
-
function _objectSpread$17(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
3790
|
+
function _objectSpread$17(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context7 = ownKeys$17(Object(t), !0)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context8 = ownKeys$17(Object(t))).call(_context8, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
3759
3791
|
const constructPrefixSearchPredicate = function () {
|
|
3760
3792
|
let prefixSearchFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
3761
3793
|
let lowerBound = arguments.length > 1 ? arguments[1] : undefined;
|
|
3762
3794
|
let upperBound = arguments.length > 2 ? arguments[2] : undefined;
|
|
3763
3795
|
const constructPrefixSearchExpression = field => {
|
|
3764
|
-
var _context;
|
|
3796
|
+
var _context, _context2, _context3, _context4;
|
|
3765
3797
|
const path = field.split('.');
|
|
3766
3798
|
const _path$slice$reverse = _reverseInstanceProperty__default["default"](_context = _sliceInstanceProperty__default["default"](path).call(path)).call(_context),
|
|
3767
3799
|
_path$slice$reverse2 = _toArray(_path$slice$reverse),
|
|
3768
3800
|
finalValueInPath = _path$slice$reverse2[0],
|
|
3769
3801
|
remainPathInReverse = _sliceInstanceProperty__default["default"](_path$slice$reverse2).call(_path$slice$reverse2, 1);
|
|
3770
|
-
const comparison =
|
|
3802
|
+
const comparison = _concatInstanceProperty__default["default"](_context2 = _concatInstanceProperty__default["default"](_context3 = _concatInstanceProperty__default["default"](_context4 = "".concat(finalValueInPath, " >= \"")).call(_context4, lowerBound, "\" and ")).call(_context3, finalValueInPath, " < \"")).call(_context2, upperBound, "\"");
|
|
3771
3803
|
if (remainPathInReverse.length) {
|
|
3772
|
-
return _reduceInstanceProperty__default["default"](remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) =>
|
|
3804
|
+
return _reduceInstanceProperty__default["default"](remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) => {
|
|
3805
|
+
var _context5;
|
|
3806
|
+
return _concatInstanceProperty__default["default"](_context5 = "".concat(nextPath, "(")).call(_context5, nestedPath, ")");
|
|
3807
|
+
}, comparison);
|
|
3773
3808
|
}
|
|
3774
3809
|
return comparison;
|
|
3775
3810
|
};
|
|
@@ -3785,7 +3820,7 @@ const useLoadOptions = _ref => {
|
|
|
3785
3820
|
let where;
|
|
3786
3821
|
if (inputValue.length) {
|
|
3787
3822
|
if (isUUID(inputValue)) {
|
|
3788
|
-
where =
|
|
3823
|
+
where = "id = \"".concat(inputValue, "\"");
|
|
3789
3824
|
} else {
|
|
3790
3825
|
const _getPrefixSearchBound = getPrefixSearchBounds(inputValue),
|
|
3791
3826
|
_getPrefixSearchBound2 = _slicedToArray(_getPrefixSearchBound, 2),
|
|
@@ -3794,11 +3829,12 @@ const useLoadOptions = _ref => {
|
|
|
3794
3829
|
where = constructPrefixSearchPredicate(prefixSearchFields, lowerBound, upperBound);
|
|
3795
3830
|
}
|
|
3796
3831
|
}
|
|
3797
|
-
const _ref2 = variables
|
|
3832
|
+
const _ref2 = variables !== null && variables !== void 0 ? variables : {},
|
|
3798
3833
|
extraWhere = _ref2.extraWhere,
|
|
3799
3834
|
restVariables = _objectWithoutProperties(_ref2, _excluded$3);
|
|
3800
3835
|
if (typeof extraWhere === 'string') {
|
|
3801
|
-
|
|
3836
|
+
var _context6;
|
|
3837
|
+
where = where ? _concatInstanceProperty__default["default"](_context6 = "(".concat(where, ") and ")).call(_context6, variables.extraWhere) : variables.extraWhere;
|
|
3802
3838
|
}
|
|
3803
3839
|
return client$1.query({
|
|
3804
3840
|
query,
|
|
@@ -3815,6 +3851,7 @@ const useLoadOptions = _ref => {
|
|
|
3815
3851
|
};
|
|
3816
3852
|
|
|
3817
3853
|
function useCurrentOption(_ref) {
|
|
3854
|
+
var _context;
|
|
3818
3855
|
let id = _ref.id,
|
|
3819
3856
|
typename = _ref.typename,
|
|
3820
3857
|
query = _ref.query,
|
|
@@ -3826,7 +3863,7 @@ function useCurrentOption(_ref) {
|
|
|
3826
3863
|
// load from cache when possible to speed up initial render
|
|
3827
3864
|
const canReadFromCache = id && typename && fragment;
|
|
3828
3865
|
const cacheItem = canReadFromCache ? apolloClient.readFragment({
|
|
3829
|
-
id:
|
|
3866
|
+
id: _concatInstanceProperty__default["default"](_context = "".concat(typename, ":")).call(_context, id),
|
|
3830
3867
|
fragment
|
|
3831
3868
|
}) : undefined;
|
|
3832
3869
|
|
|
@@ -3844,7 +3881,7 @@ function useCurrentOption(_ref) {
|
|
|
3844
3881
|
queryData = _useQuery.data,
|
|
3845
3882
|
queryError = _useQuery.error;
|
|
3846
3883
|
const queryItem = queryData && queryDataToItem(queryData);
|
|
3847
|
-
const item = queryItem
|
|
3884
|
+
const item = queryItem !== null && queryItem !== void 0 ? queryItem : cacheItem;
|
|
3848
3885
|
const loading = item ? false : queryLoading;
|
|
3849
3886
|
const error = item ? undefined : queryError;
|
|
3850
3887
|
const data = item && itemToOption(item);
|
|
@@ -3883,6 +3920,7 @@ const convertProductTypeToOption = productType => {
|
|
|
3883
3920
|
};
|
|
3884
3921
|
};
|
|
3885
3922
|
const ProductTypePickerInput = _ref => {
|
|
3923
|
+
var _currentOption$data$l, _currentOption$data;
|
|
3886
3924
|
let isClearable = _ref.isClearable,
|
|
3887
3925
|
isDisabled = _ref.isDisabled,
|
|
3888
3926
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -3914,8 +3952,9 @@ const ProductTypePickerInput = _ref => {
|
|
|
3914
3952
|
itemToOption: convertProductTypeToOption
|
|
3915
3953
|
});
|
|
3916
3954
|
const handleLoadOptions = React.useCallback(inputValue => loadProductTypes(inputValue).then(_ref3 => {
|
|
3955
|
+
var _data$productTypes;
|
|
3917
3956
|
let data = _ref3.data;
|
|
3918
|
-
return data.productTypes
|
|
3957
|
+
return ((_data$productTypes = data.productTypes) === null || _data$productTypes === void 0 ? void 0 : _data$productTypes.results) || [];
|
|
3919
3958
|
}).then(productTypes => _mapInstanceProperty__default["default"](productTypes).call(productTypes, convertProductTypeToOption)).catch(error => {
|
|
3920
3959
|
setLoadingError(error);
|
|
3921
3960
|
onError(error);
|
|
@@ -3929,12 +3968,12 @@ const ProductTypePickerInput = _ref => {
|
|
|
3929
3968
|
setLoadingError(null);
|
|
3930
3969
|
handleInternalInputChange(event);
|
|
3931
3970
|
}, [handleInternalInputChange]);
|
|
3932
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
3971
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption === null || currentOption === void 0 ? void 0 : currentOption.error);
|
|
3933
3972
|
React.useEffect(() => {
|
|
3934
3973
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
3935
3974
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
3936
3975
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
3937
|
-
const tooltipTitle = currentOption
|
|
3976
|
+
const tooltipTitle = (_currentOption$data$l = currentOption === null || currentOption === void 0 || (_currentOption$data = currentOption.data) === null || _currentOption$data === void 0 ? void 0 : _currentOption$data.label) !== null && _currentOption$data$l !== void 0 ? _currentOption$data$l : '';
|
|
3938
3977
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
3939
3978
|
max: "scale",
|
|
3940
3979
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -3988,6 +4027,7 @@ var messages$C = reactIntl.defineMessages({
|
|
|
3988
4027
|
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 } } } };
|
|
3989
4028
|
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 } } } };
|
|
3990
4029
|
const StatePickerInput = _ref => {
|
|
4030
|
+
var _currentOption$data$l, _currentOption$data;
|
|
3991
4031
|
let isClearable = _ref.isClearable,
|
|
3992
4032
|
isDisabled = _ref.isDisabled,
|
|
3993
4033
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -4003,7 +4043,7 @@ const StatePickerInput = _ref => {
|
|
|
4003
4043
|
formatMessage = _useIntl.formatMessage;
|
|
4004
4044
|
const dataLocale = applicationShellConnectors.useApplicationContext(applicationContext => applicationContext.dataLocale);
|
|
4005
4045
|
const variables = React.useMemo(() => ({
|
|
4006
|
-
sortByNamePath:
|
|
4046
|
+
sortByNamePath: "name.".concat(dataLocale)
|
|
4007
4047
|
}), [dataLocale]);
|
|
4008
4048
|
const convertStateToOption = React.useCallback(state => {
|
|
4009
4049
|
const localizedName = formatLocalizedFieldToString(state.nameAllLocales);
|
|
@@ -4018,7 +4058,7 @@ const StatePickerInput = _ref => {
|
|
|
4018
4058
|
_useState2 = _slicedToArray(_useState, 2),
|
|
4019
4059
|
loadingError = _useState2[0],
|
|
4020
4060
|
setLoadingError = _useState2[1];
|
|
4021
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
4061
|
+
const prefixSearchFields = React.useMemo(() => ["name.".concat(dataLocale), 'key'], [dataLocale]);
|
|
4022
4062
|
const loadOptions = useLoadOptions({
|
|
4023
4063
|
query: GetStatesQuery,
|
|
4024
4064
|
variables,
|
|
@@ -4051,13 +4091,13 @@ const StatePickerInput = _ref => {
|
|
|
4051
4091
|
setLoadingError(null);
|
|
4052
4092
|
handleInternalInputChange(event);
|
|
4053
4093
|
}, [handleInternalInputChange]);
|
|
4054
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
4094
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption === null || currentOption === void 0 ? void 0 : currentOption.error);
|
|
4055
4095
|
React.useEffect(() => {
|
|
4056
4096
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
4057
4097
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
4058
4098
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
4059
4099
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$C.noStatesFound), [loadingError, formatMessage]);
|
|
4060
|
-
const tooltipTitle = currentOption
|
|
4100
|
+
const tooltipTitle = (_currentOption$data$l = currentOption === null || currentOption === void 0 || (_currentOption$data = currentOption.data) === null || _currentOption$data === void 0 ? void 0 : _currentOption$data.label) !== null && _currentOption$data$l !== void 0 ? _currentOption$data$l : '';
|
|
4061
4101
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
4062
4102
|
max: "scale",
|
|
4063
4103
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -4125,23 +4165,26 @@ const CustomFieldTooltip = _ref => {
|
|
|
4125
4165
|
|
|
4126
4166
|
const setToArray = function () {
|
|
4127
4167
|
let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4128
|
-
return
|
|
4168
|
+
return "id in (".concat(_mapInstanceProperty__default["default"](values).call(values, value => "\"".concat(value, "\"")).join(', '), ")");
|
|
4129
4169
|
};
|
|
4130
4170
|
|
|
4131
4171
|
function capitalizeFirst(text) {
|
|
4132
4172
|
return text.charAt(0).toUpperCase() + _sliceInstanceProperty__default["default"](text).call(text, 1);
|
|
4133
4173
|
}
|
|
4134
4174
|
|
|
4135
|
-
const getCentAmountClause = (value, operator, locale) =>
|
|
4175
|
+
const getCentAmountClause = (value, operator, locale) => {
|
|
4176
|
+
var _context;
|
|
4177
|
+
return _concatInstanceProperty__default["default"](_context = "centAmount ".concat(operator, " ")).call(_context, uiKit.MoneyInput.convertToMoneyValue(value, locale).centAmount);
|
|
4178
|
+
};
|
|
4136
4179
|
function moneyTransformer(value, option, locale) {
|
|
4137
4180
|
const clauses = [];
|
|
4138
4181
|
if (option === FILTER_TYPES.range) {
|
|
4139
|
-
clauses[0] =
|
|
4182
|
+
clauses[0] = "currencyCode = \"".concat(value.from.currencyCode, "\"");
|
|
4140
4183
|
clauses[1] = getCentAmountClause(value.from, '>=', locale);
|
|
4141
4184
|
clauses[2] = getCentAmountClause(value.to, '<=', locale);
|
|
4142
4185
|
return clauses.join(' and ');
|
|
4143
4186
|
}
|
|
4144
|
-
clauses[0] =
|
|
4187
|
+
clauses[0] = "currencyCode = \"".concat(value.currencyCode, "\"");
|
|
4145
4188
|
switch (option) {
|
|
4146
4189
|
case FILTER_TYPES.lessThan:
|
|
4147
4190
|
clauses[1] = getCentAmountClause(value, '<', locale);
|
|
@@ -4158,6 +4201,7 @@ function moneyTransformer(value, option, locale) {
|
|
|
4158
4201
|
return clauses.join(' and ');
|
|
4159
4202
|
}
|
|
4160
4203
|
|
|
4204
|
+
var _templateObject$2, _templateObject2$1;
|
|
4161
4205
|
const formatTime = 'HH:mm:ss.SSS';
|
|
4162
4206
|
|
|
4163
4207
|
/* TimeInput only allows HH:mm:ss and adds the seconds as 00 and
|
|
@@ -4179,6 +4223,7 @@ const defaultFilterValidator = _ref => {
|
|
|
4179
4223
|
const timeTransformer = function (filterKey, filters) {
|
|
4180
4224
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator;
|
|
4181
4225
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref2 => {
|
|
4226
|
+
var _context, _context2;
|
|
4182
4227
|
let type = _ref2.type,
|
|
4183
4228
|
value = _ref2.value;
|
|
4184
4229
|
if (!filterValidator({
|
|
@@ -4187,19 +4232,13 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4187
4232
|
})) return '';
|
|
4188
4233
|
switch (type) {
|
|
4189
4234
|
case FILTER_TYPES.lessThan:
|
|
4190
|
-
return
|
|
4235
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(filterKey, " < \"")).call(_context, value, "\"");
|
|
4191
4236
|
case FILTER_TYPES.moreThan:
|
|
4192
|
-
return
|
|
4237
|
+
return _concatInstanceProperty__default["default"](_context2 = "".concat(filterKey, " > \"")).call(_context2, value, "\"");
|
|
4193
4238
|
case FILTER_TYPES.equalTo:
|
|
4194
|
-
return oneLine__default["default"]
|
|
4195
|
-
(${filterKey} >= "${value}"
|
|
4196
|
-
and ${filterKey} <= "${getEndOfSecond(value)}")
|
|
4197
|
-
`;
|
|
4239
|
+
return oneLine__default["default"](_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n (", " >= \"", "\"\n and ", " <= \"", "\")\n "])), filterKey, value, filterKey, getEndOfSecond(value));
|
|
4198
4240
|
case FILTER_TYPES.range:
|
|
4199
|
-
return oneLine__default["default"]
|
|
4200
|
-
(${filterKey} >= "${value.from}"
|
|
4201
|
-
and ${filterKey} <= "${getEndOfSecond(value.to)}")
|
|
4202
|
-
`;
|
|
4241
|
+
return oneLine__default["default"](_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n (", " >= \"", "\"\n and ", " <= \"", "\")\n "])), filterKey, value.from, filterKey, getEndOfSecond(value.to));
|
|
4203
4242
|
default:
|
|
4204
4243
|
return '';
|
|
4205
4244
|
}
|
|
@@ -4215,7 +4254,7 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4215
4254
|
* (pickUpTime >= "14:00" and pickUpTime <= "15:00")
|
|
4216
4255
|
* ) or some_more_filters
|
|
4217
4256
|
*/
|
|
4218
|
-
return queryString === '' ? null :
|
|
4257
|
+
return queryString === '' ? null : "(".concat(queryString, ")");
|
|
4219
4258
|
};
|
|
4220
4259
|
|
|
4221
4260
|
// FIXME: delete once prefix search is supported in ctp api
|
|
@@ -4232,8 +4271,9 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4232
4271
|
// e.g
|
|
4233
4272
|
// where: `masterData(current(name(en >= "${lowerBound}" and en < "${upperBound}")))`
|
|
4234
4273
|
const getPrefixSearchBounds = input => {
|
|
4274
|
+
var _context;
|
|
4235
4275
|
const getNextCharacter = character => String.fromCharCode(character.charCodeAt() + 1);
|
|
4236
|
-
return [input,
|
|
4276
|
+
return [input, _concatInstanceProperty__default["default"](_context = "".concat(_sliceInstanceProperty__default["default"](input).call(input, 0, input.length - 1))).call(_context, getNextCharacter(_sliceInstanceProperty__default["default"](input).call(input, input.length - 1)))];
|
|
4237
4277
|
};
|
|
4238
4278
|
|
|
4239
4279
|
const _excluded$2 = ["action"];
|
|
@@ -4426,7 +4466,7 @@ const convertChangeValueAction = actionPayload => {
|
|
|
4426
4466
|
* as its dynamic content can not be typed in SDL for the mutation.
|
|
4427
4467
|
*/
|
|
4428
4468
|
const convertAction = (actionName, actionPayload) => {
|
|
4429
|
-
var _context3, _context4, _context5;
|
|
4469
|
+
var _actionPayload$type, _context3, _actionPayload$geoLoc, _actionPayload$geoLoc2, _actionPayload$shippi, _context4, _context5;
|
|
4430
4470
|
const getNameFromPayload = payload => {
|
|
4431
4471
|
// changeName for `Organizations`
|
|
4432
4472
|
if (typeof payload.name === 'string') return payload;
|
|
@@ -4491,7 +4531,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4491
4531
|
case 'setCustomType':
|
|
4492
4532
|
return {
|
|
4493
4533
|
[actionName]: {
|
|
4494
|
-
typeId: actionPayload.type
|
|
4534
|
+
typeId: (_actionPayload$type = actionPayload.type) === null || _actionPayload$type === void 0 ? void 0 : _actionPayload$type.id,
|
|
4495
4535
|
fields: actionPayload.fields ? _mapInstanceProperty__default["default"](_context3 = _Object$entries__default["default"](actionPayload.fields)).call(_context3, _ref => {
|
|
4496
4536
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
4497
4537
|
customField = _ref2[0],
|
|
@@ -4521,10 +4561,10 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4521
4561
|
};
|
|
4522
4562
|
case 'setGeoLocation':
|
|
4523
4563
|
return {
|
|
4524
|
-
[actionName]: actionPayload
|
|
4564
|
+
[actionName]: actionPayload !== null && actionPayload !== void 0 && actionPayload.geoLocation ? {
|
|
4525
4565
|
geoLocation: {
|
|
4526
4566
|
type: 'Point',
|
|
4527
|
-
coordinates: [_parseFloat__default["default"](actionPayload.geoLocation
|
|
4567
|
+
coordinates: [_parseFloat__default["default"]((_actionPayload$geoLoc = actionPayload.geoLocation) === null || _actionPayload$geoLoc === void 0 ? void 0 : _actionPayload$geoLoc.longitude), _parseFloat__default["default"]((_actionPayload$geoLoc2 = actionPayload.geoLocation) === null || _actionPayload$geoLoc2 === void 0 ? void 0 : _actionPayload$geoLoc2.latitude)]
|
|
4528
4568
|
}
|
|
4529
4569
|
} : {
|
|
4530
4570
|
undefined
|
|
@@ -4660,7 +4700,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4660
4700
|
case 'setShippingRateInputType':
|
|
4661
4701
|
return {
|
|
4662
4702
|
[actionName]: {
|
|
4663
|
-
shippingRateInputType: actionPayload.shippingRateInputType
|
|
4703
|
+
shippingRateInputType: (_actionPayload$shippi = actionPayload.shippingRateInputType) !== null && _actionPayload$shippi !== void 0 && _actionPayload$shippi.type ? {
|
|
4664
4704
|
[actionPayload.shippingRateInputType.type]: {
|
|
4665
4705
|
values: actionPayload.shippingRateInputType.type === 'CartClassification' ? _mapInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](actionPayload.shippingRateInputType)).call(_context4, value => ({
|
|
4666
4706
|
key: value.key,
|
|
@@ -4714,8 +4754,8 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4714
4754
|
case 'addAddress':
|
|
4715
4755
|
case 'changeAddress':
|
|
4716
4756
|
{
|
|
4717
|
-
var _context6;
|
|
4718
|
-
const _ref3 = actionPayload.address
|
|
4757
|
+
var _actionPayload$addres, _context6, _actionPayload$addres2;
|
|
4758
|
+
const _ref3 = ((_actionPayload$addres = actionPayload.address) === null || _actionPayload$addres === void 0 ? void 0 : _actionPayload$addres.custom) || {},
|
|
4719
4759
|
_ref3$fields = _ref3.fields,
|
|
4720
4760
|
fields = _ref3$fields === void 0 ? {} : _ref3$fields;
|
|
4721
4761
|
const customFields = isEmpty__default["default"](fields) ? null : _mapInstanceProperty__default["default"](_context6 = _Object$entries__default["default"](fields)).call(_context6, _ref4 => {
|
|
@@ -4727,7 +4767,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4727
4767
|
value: _JSON$stringify__default["default"](value)
|
|
4728
4768
|
};
|
|
4729
4769
|
});
|
|
4730
|
-
const custom = actionPayload.address
|
|
4770
|
+
const custom = (_actionPayload$addres2 = actionPayload.address) !== null && _actionPayload$addres2 !== void 0 && (_actionPayload$addres2 = _actionPayload$addres2.custom) !== null && _actionPayload$addres2 !== void 0 && (_actionPayload$addres2 = _actionPayload$addres2.type) !== null && _actionPayload$addres2 !== void 0 && _actionPayload$addres2.id ? {
|
|
4731
4771
|
type: {
|
|
4732
4772
|
id: actionPayload.address.custom.type.id
|
|
4733
4773
|
},
|
|
@@ -4758,7 +4798,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4758
4798
|
value: _JSON$stringify__default["default"](value)
|
|
4759
4799
|
};
|
|
4760
4800
|
});
|
|
4761
|
-
const customType = type
|
|
4801
|
+
const customType = type !== null && type !== void 0 && type.id ? {
|
|
4762
4802
|
id: type.id
|
|
4763
4803
|
} : null;
|
|
4764
4804
|
return {
|
|
@@ -4781,10 +4821,11 @@ const createGraphQlUpdateActions = actions => _reduceInstanceProperty__default["
|
|
|
4781
4821
|
return [...previousActions, convertAction(actionName, actionPayload)];
|
|
4782
4822
|
}, []);
|
|
4783
4823
|
const extractErrorFromGraphQlResponse = graphQlResponse => {
|
|
4784
|
-
|
|
4824
|
+
var _graphQlResponse$netw, _graphQlResponse$grap;
|
|
4825
|
+
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) {
|
|
4785
4826
|
return graphQlResponse.networkError.result.errors;
|
|
4786
4827
|
}
|
|
4787
|
-
if (graphQlResponse.graphQLErrors
|
|
4828
|
+
if (((_graphQlResponse$grap = graphQlResponse.graphQLErrors) === null || _graphQlResponse$grap === void 0 ? void 0 : _graphQlResponse$grap.length) > 0) {
|
|
4788
4829
|
return graphQlResponse.graphQLErrors;
|
|
4789
4830
|
}
|
|
4790
4831
|
return graphQlResponse;
|
|
@@ -4813,14 +4854,16 @@ function omitDeep(obj, fieldsToOmit) {
|
|
|
4813
4854
|
function ownKeys$14(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4814
4855
|
function _objectSpread$14(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$14(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$14(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
4815
4856
|
function getPriceChannelName(price) {
|
|
4816
|
-
|
|
4857
|
+
var _ref, _price$channel$name, _price$channel, _price$channel2;
|
|
4858
|
+
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;
|
|
4817
4859
|
}
|
|
4818
4860
|
function getDiscountValue(price) {
|
|
4861
|
+
var _price$value, _price$value2, _price$discounted;
|
|
4819
4862
|
let preciseAmount;
|
|
4820
4863
|
let fractionedAmount;
|
|
4821
|
-
if (price.value
|
|
4864
|
+
if (((_price$value = price.value) === null || _price$value === void 0 ? void 0 : _price$value.type) === PRECISION_TYPES.highPrecision && price.discounted.value.type === PRECISION_TYPES.highPrecision) {
|
|
4822
4865
|
preciseAmount = price.value.preciseAmount - price.discounted.value.preciseAmount;
|
|
4823
|
-
} else if (price.value
|
|
4866
|
+
} else if (((_price$value2 = price.value) === null || _price$value2 === void 0 ? void 0 : _price$value2.type) === PRECISION_TYPES.highPrecision && ((_price$discounted = price.discounted) === null || _price$discounted === void 0 || (_price$discounted = _price$discounted.value) === null || _price$discounted === void 0 ? void 0 : _price$discounted.type) === PRECISION_TYPES.centPrecision) {
|
|
4824
4867
|
fractionedAmount = getFractionedAmount(price.value) - getFractionedAmount(price.discounted.value);
|
|
4825
4868
|
}
|
|
4826
4869
|
return price.discounted ? _objectSpread$14(_objectSpread$14({}, price.value), {}, {
|
|
@@ -4834,23 +4877,28 @@ function getDiscountValue(price) {
|
|
|
4834
4877
|
function getSelectedPrice(price) {
|
|
4835
4878
|
return price.discounted ? price.discounted : price;
|
|
4836
4879
|
}
|
|
4837
|
-
function getNetUnitPrice(
|
|
4838
|
-
|
|
4839
|
-
|
|
4880
|
+
function getNetUnitPrice(_ref2) {
|
|
4881
|
+
var _lineItem$perMethodTa, _filteredPerMethodTax;
|
|
4882
|
+
let lineItem = _ref2.lineItem,
|
|
4883
|
+
shouldRoundAmount = _ref2.shouldRoundAmount;
|
|
4840
4884
|
const price = getSelectedPrice(lineItem.price);
|
|
4841
|
-
const filteredPerMethodTaxRate = lineItem
|
|
4885
|
+
const filteredPerMethodTaxRate = lineItem === null || lineItem === void 0 || (_lineItem$perMethodTa = lineItem.perMethodTaxRate) === null || _lineItem$perMethodTa === void 0 ? void 0 : _filterInstanceProperty__default["default"](_lineItem$perMethodTa).call(_lineItem$perMethodTa, perMethodTax => {
|
|
4886
|
+
var _lineItem$shippingDet;
|
|
4887
|
+
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;
|
|
4888
|
+
});
|
|
4842
4889
|
|
|
4843
4890
|
// when shipping mode is multi with the same tax rate
|
|
4844
|
-
if (filteredPerMethodTaxRate
|
|
4891
|
+
if ((filteredPerMethodTaxRate === null || filteredPerMethodTaxRate === void 0 ? void 0 : filteredPerMethodTaxRate.length) > 0 && (_filteredPerMethodTax = filteredPerMethodTaxRate[0]) !== null && _filteredPerMethodTax !== void 0 && (_filteredPerMethodTax = _filteredPerMethodTax.taxRate) !== null && _filteredPerMethodTax !== void 0 && _filteredPerMethodTax.includedInPrice) {
|
|
4892
|
+
var _price$value3, _price$value4;
|
|
4845
4893
|
const taxRate = filteredPerMethodTaxRate[0].taxRate;
|
|
4846
4894
|
let centAmount;
|
|
4847
4895
|
// should accept 0 value
|
|
4848
|
-
if (typeof price.value
|
|
4896
|
+
if (typeof ((_price$value3 = price.value) === null || _price$value3 === void 0 ? void 0 : _price$value3.centAmount) === 'number') {
|
|
4849
4897
|
const amount = price.value.centAmount / (1 + taxRate.amount);
|
|
4850
4898
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4851
4899
|
}
|
|
4852
4900
|
let preciseAmount;
|
|
4853
|
-
if (price.value
|
|
4901
|
+
if (((_price$value4 = price.value) === null || _price$value4 === void 0 ? void 0 : _price$value4.type) === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + taxRate.amount);
|
|
4854
4902
|
return _objectSpread$14(_objectSpread$14({}, price.value), {}, {
|
|
4855
4903
|
centAmount,
|
|
4856
4904
|
preciseAmount
|
|
@@ -4859,14 +4907,15 @@ function getNetUnitPrice(_ref) {
|
|
|
4859
4907
|
|
|
4860
4908
|
// when shipping mode is single
|
|
4861
4909
|
if (lineItem.taxRate && lineItem.taxRate.includedInPrice) {
|
|
4910
|
+
var _price$value5, _price$value6;
|
|
4862
4911
|
let centAmount;
|
|
4863
4912
|
// should accept 0 value
|
|
4864
|
-
if (typeof price.value
|
|
4913
|
+
if (typeof ((_price$value5 = price.value) === null || _price$value5 === void 0 ? void 0 : _price$value5.centAmount) === 'number') {
|
|
4865
4914
|
const amount = price.value.centAmount / (1 + lineItem.taxRate.amount);
|
|
4866
4915
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4867
4916
|
}
|
|
4868
4917
|
let preciseAmount;
|
|
4869
|
-
if (price.value
|
|
4918
|
+
if (((_price$value6 = price.value) === null || _price$value6 === void 0 ? void 0 : _price$value6.type) === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + lineItem.taxRate.amount);
|
|
4870
4919
|
return _objectSpread$14(_objectSpread$14({}, price.value), {}, {
|
|
4871
4920
|
centAmount,
|
|
4872
4921
|
preciseAmount
|
|
@@ -4900,18 +4949,18 @@ const transformCustomFieldFromGraphQLResponse = resource => {
|
|
|
4900
4949
|
key: resource.custom.type.key,
|
|
4901
4950
|
name: l10n.transformLocalizedFieldToLocalizedString(resource.custom.type.nameAllLocales),
|
|
4902
4951
|
fieldDefinitions: _mapInstanceProperty__default["default"](_context = resource.custom.type.fieldDefinitions).call(_context, fieldDefinition => {
|
|
4903
|
-
var _context2, _context3;
|
|
4952
|
+
var _fieldDefinition$type, _context2, _fieldDefinition$type2, _context3;
|
|
4904
4953
|
return {
|
|
4905
4954
|
name: fieldDefinition.name,
|
|
4906
4955
|
required: fieldDefinition.required,
|
|
4907
|
-
type: fieldDefinition.type
|
|
4956
|
+
type: ((_fieldDefinition$type = fieldDefinition.type) === null || _fieldDefinition$type === void 0 || (_fieldDefinition$type = _fieldDefinition$type.elementType) === null || _fieldDefinition$type === void 0 ? void 0 : _fieldDefinition$type.name) === 'LocalizedEnum' ? _objectSpread$13(_objectSpread$13({}, fieldDefinition.type), {}, {
|
|
4908
4957
|
elementType: _objectSpread$13(_objectSpread$13({}, fieldDefinition.type.elementType), {}, {
|
|
4909
4958
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
4910
4959
|
key: value.key,
|
|
4911
4960
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
4912
4961
|
}))
|
|
4913
4962
|
})
|
|
4914
|
-
}) : fieldDefinition.type
|
|
4963
|
+
}) : ((_fieldDefinition$type2 = fieldDefinition.type) === null || _fieldDefinition$type2 === void 0 ? void 0 : _fieldDefinition$type2.name) === 'LocalizedEnum' ? _objectSpread$13(_objectSpread$13({}, fieldDefinition.type), {}, {
|
|
4915
4964
|
values: _mapInstanceProperty__default["default"](_context3 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context3, value => ({
|
|
4916
4965
|
key: value.key,
|
|
4917
4966
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -4938,7 +4987,7 @@ const convertProductSelectionFromGraphQl = productSelection => {
|
|
|
4938
4987
|
from: 'nameAllLocales',
|
|
4939
4988
|
to: 'name'
|
|
4940
4989
|
}])), {}, {
|
|
4941
|
-
custom: productSelection
|
|
4990
|
+
custom: productSelection !== null && productSelection !== void 0 && productSelection.custom ? transformCustomFieldFromGraphQLResponse(productSelection) : null
|
|
4942
4991
|
});
|
|
4943
4992
|
};
|
|
4944
4993
|
|
|
@@ -5068,17 +5117,17 @@ function _callSuper$5(_this, derived, args) {
|
|
|
5068
5117
|
var FetchTypeDefinitionsQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchTypeDefinitionsQuery" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "where" } }, type: { kind: "NamedType", name: { kind: "Name", value: "String" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "limit" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "offset" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "typeDefinitions" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "where" }, value: { kind: "Variable", name: { kind: "Name", value: "where" } } }, { kind: "Argument", name: { kind: "Name", value: "limit" }, value: { kind: "Variable", name: { kind: "Name", value: "limit" } } }, { kind: "Argument", name: { kind: "Name", value: "offset" }, value: { kind: "Variable", name: { kind: "Name", value: "offset" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "fieldDefinitions" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "SetType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "elementType" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "EnumType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "values" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "label" }, arguments: [], directives: [] }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "LocalizedEnumType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "values" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }] } }] } }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "EnumType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "values" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "label" }, arguments: [], directives: [] }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "LocalizedEnumType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "values" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ReferenceType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "referenceTypeId" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }] } }] } }] } }] } }] } }], loc: { start: 0, end: 1172, source: { body: "query FetchTypeDefinitionsQuery($where: String, $limit: Int, $offset: Int) {\n typeDefinitions(where: $where, limit: $limit, offset: $offset) {\n results {\n fieldDefinitions {\n type {\n name\n ... on SetType {\n elementType {\n name\n ... on EnumType {\n values {\n key\n label\n }\n }\n ... on LocalizedEnumType {\n values {\n key\n labelAllLocales {\n value\n locale\n }\n }\n }\n }\n }\n ... on EnumType {\n values {\n key\n label\n }\n }\n ... on LocalizedEnumType {\n values {\n key\n labelAllLocales {\n value\n locale\n }\n }\n }\n ... on ReferenceType {\n referenceTypeId\n }\n }\n name\n labelAllLocales {\n value\n locale\n }\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
5069
5118
|
const customizableResources$1 = ['asset', 'category', 'channel', 'customer', 'order', 'discount-code', 'cart-discount', 'inventory-entry', 'line-item', 'custom-line-item', 'product-price', 'payment', 'payment-interface-interaction', 'shopping-list', 'shopping-list-text-line-item', 'standalone-price', 'review'];
|
|
5070
5119
|
let CustomFieldDefinitionsConnector = /*#__PURE__*/function (_Component) {
|
|
5071
|
-
_inherits(CustomFieldDefinitionsConnector, _Component);
|
|
5072
5120
|
function CustomFieldDefinitionsConnector() {
|
|
5073
5121
|
_classCallCheck(this, CustomFieldDefinitionsConnector);
|
|
5074
5122
|
return _callSuper$5(this, CustomFieldDefinitionsConnector, arguments);
|
|
5075
5123
|
}
|
|
5076
|
-
|
|
5124
|
+
_inherits(CustomFieldDefinitionsConnector, _Component);
|
|
5125
|
+
return _createClass(CustomFieldDefinitionsConnector, [{
|
|
5077
5126
|
key: "componentDidMount",
|
|
5078
5127
|
value: function componentDidMount() {
|
|
5079
5128
|
var _context;
|
|
5080
5129
|
const hasUnsupportedResource = _someInstanceProperty__default["default"](_context = this.props.resources).call(_context, resource => !_includesInstanceProperty__default["default"](customizableResources$1).call(customizableResources$1, resource));
|
|
5081
|
-
!!hasUnsupportedResource ? process.env.NODE_ENV !== "production" ? invariant__default["default"](false,
|
|
5130
|
+
!!hasUnsupportedResource ? process.env.NODE_ENV !== "production" ? invariant__default["default"](false, "core/components/custom-field-definitions-connector: some of the specified resources are not supported.") : invariant__default["default"](false) : void 0;
|
|
5082
5131
|
}
|
|
5083
5132
|
}, {
|
|
5084
5133
|
key: "render",
|
|
@@ -5091,15 +5140,14 @@ let CustomFieldDefinitionsConnector = /*#__PURE__*/function (_Component) {
|
|
|
5091
5140
|
});
|
|
5092
5141
|
}
|
|
5093
5142
|
}]);
|
|
5094
|
-
return CustomFieldDefinitionsConnector;
|
|
5095
5143
|
}(React.Component);
|
|
5096
5144
|
CustomFieldDefinitionsConnector.displayName = 'CustomFieldDefinitionsConnector';
|
|
5097
5145
|
CustomFieldDefinitionsConnector.defaultProps = {
|
|
5098
5146
|
resources: []
|
|
5099
5147
|
};
|
|
5100
|
-
const stringifyResources$1 = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource =>
|
|
5148
|
+
const stringifyResources$1 = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => "\"".concat(resource, "\"")).join();
|
|
5101
5149
|
const mapPropsToOptions = ownProps => {
|
|
5102
|
-
const where = ownProps.resources.length > 0 ?
|
|
5150
|
+
const where = ownProps.resources.length > 0 ? "resourceTypeIds contains any (".concat(stringifyResources$1(ownProps.resources), ")") : undefined;
|
|
5103
5151
|
return {
|
|
5104
5152
|
variables: {
|
|
5105
5153
|
where,
|
|
@@ -5168,19 +5216,19 @@ const graphQlDocToForm = typeDefinition => {
|
|
|
5168
5216
|
key: typeDefinition.key,
|
|
5169
5217
|
name: l10n.transformLocalizedFieldToLocalizedString(typeDefinition.nameAllLocales),
|
|
5170
5218
|
fieldDefinitions: _mapInstanceProperty__default["default"](_context = typeDefinition.fieldDefinitions).call(_context, fieldDefinition => {
|
|
5171
|
-
var _context2, _context3;
|
|
5219
|
+
var _fieldDefinition$type, _context2, _fieldDefinition$type2, _context3;
|
|
5172
5220
|
return {
|
|
5173
5221
|
name: fieldDefinition.name,
|
|
5174
5222
|
required: fieldDefinition.required,
|
|
5175
5223
|
inputHint: fieldDefinition.inputHint,
|
|
5176
|
-
type: fieldDefinition.type
|
|
5224
|
+
type: ((_fieldDefinition$type = fieldDefinition.type) === null || _fieldDefinition$type === void 0 || (_fieldDefinition$type = _fieldDefinition$type.elementType) === null || _fieldDefinition$type === void 0 ? void 0 : _fieldDefinition$type.name) === 'LocalizedEnum' ? _objectSpread$10(_objectSpread$10({}, fieldDefinition.type), {}, {
|
|
5177
5225
|
elementType: _objectSpread$10(_objectSpread$10({}, fieldDefinition.type.elementType), {}, {
|
|
5178
5226
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
5179
5227
|
key: value.key,
|
|
5180
5228
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
5181
5229
|
}))
|
|
5182
5230
|
})
|
|
5183
|
-
}) : fieldDefinition.type
|
|
5231
|
+
}) : ((_fieldDefinition$type2 = fieldDefinition.type) === null || _fieldDefinition$type2 === void 0 ? void 0 : _fieldDefinition$type2.name) === 'LocalizedEnum' ? _objectSpread$10(_objectSpread$10({}, fieldDefinition.type), {}, {
|
|
5184
5232
|
values: _mapInstanceProperty__default["default"](_context3 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context3, value => ({
|
|
5185
5233
|
key: value.key,
|
|
5186
5234
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -5212,7 +5260,7 @@ const formToGraphQlDoc = formCustomFields => ({
|
|
|
5212
5260
|
// TODO(pa3): find usages and make sure only 1 param is passed
|
|
5213
5261
|
const createEmptyCustomFields = typeDefinition => ({
|
|
5214
5262
|
fields: {},
|
|
5215
|
-
type: typeDefinition
|
|
5263
|
+
type: (typeDefinition === null || typeDefinition === void 0 ? void 0 : typeDefinition.type) || {
|
|
5216
5264
|
fieldDefinitions: []
|
|
5217
5265
|
}
|
|
5218
5266
|
});
|
|
@@ -5239,17 +5287,17 @@ const emptyTypeDefinitions = {
|
|
|
5239
5287
|
results: []
|
|
5240
5288
|
};
|
|
5241
5289
|
let CustomFieldTypeDefinitionsConnector = /*#__PURE__*/function (_Component) {
|
|
5242
|
-
_inherits(CustomFieldTypeDefinitionsConnector, _Component);
|
|
5243
5290
|
function CustomFieldTypeDefinitionsConnector() {
|
|
5244
5291
|
_classCallCheck(this, CustomFieldTypeDefinitionsConnector);
|
|
5245
5292
|
return _callSuper$4(this, CustomFieldTypeDefinitionsConnector, arguments);
|
|
5246
5293
|
}
|
|
5247
|
-
|
|
5294
|
+
_inherits(CustomFieldTypeDefinitionsConnector, _Component);
|
|
5295
|
+
return _createClass(CustomFieldTypeDefinitionsConnector, [{
|
|
5248
5296
|
key: "componentDidMount",
|
|
5249
5297
|
value: function componentDidMount() {
|
|
5250
5298
|
var _context;
|
|
5251
5299
|
const hasUnsupportedResource = _someInstanceProperty__default["default"](_context = this.props.resources).call(_context, resource => !_includesInstanceProperty__default["default"](customizableResources).call(customizableResources, resource));
|
|
5252
|
-
!!hasUnsupportedResource ? process.env.NODE_ENV !== "production" ? invariant__default["default"](false,
|
|
5300
|
+
!!hasUnsupportedResource ? process.env.NODE_ENV !== "production" ? invariant__default["default"](false, "core/components/custom-field-definitions-connector: some of the specified resources are not supported.") : invariant__default["default"](false) : void 0;
|
|
5253
5301
|
}
|
|
5254
5302
|
}, {
|
|
5255
5303
|
key: "render",
|
|
@@ -5262,7 +5310,6 @@ let CustomFieldTypeDefinitionsConnector = /*#__PURE__*/function (_Component) {
|
|
|
5262
5310
|
});
|
|
5263
5311
|
}
|
|
5264
5312
|
}]);
|
|
5265
|
-
return CustomFieldTypeDefinitionsConnector;
|
|
5266
5313
|
}(React.Component);
|
|
5267
5314
|
CustomFieldTypeDefinitionsConnector.displayName = 'CustomFieldTypeDefinitionsConnector';
|
|
5268
5315
|
CustomFieldTypeDefinitionsConnector.defaultProps = {
|
|
@@ -5274,9 +5321,9 @@ CustomFieldTypeDefinitionsConnector.graphQlDocToForm = graphQlDocToForm;
|
|
|
5274
5321
|
CustomFieldTypeDefinitionsConnector.formToRestDoc = formToRestDoc;
|
|
5275
5322
|
CustomFieldTypeDefinitionsConnector.formToGraphQlDoc = formToGraphQlDoc;
|
|
5276
5323
|
CustomFieldTypeDefinitionsConnector.createEmptyCustomFields = createEmptyCustomFields;
|
|
5277
|
-
const stringifyResources = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource =>
|
|
5324
|
+
const stringifyResources = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => "\"".concat(resource, "\"")).join();
|
|
5278
5325
|
const createGraphQlOptions = ownProps => {
|
|
5279
|
-
const where = ownProps.resources.length > 0 ?
|
|
5326
|
+
const where = ownProps.resources.length > 0 ? "resourceTypeIds contains any (".concat(stringifyResources(ownProps.resources), ")") : undefined;
|
|
5280
5327
|
return {
|
|
5281
5328
|
variables: {
|
|
5282
5329
|
where,
|
|
@@ -5352,7 +5399,7 @@ const extractDuplicatedValues = (values, type, language, languages) => {
|
|
|
5352
5399
|
let validatedValues = [];
|
|
5353
5400
|
if (type.name.toLowerCase() === 'money') {
|
|
5354
5401
|
validatedValues = unique(values, ['amount', 'currencyCode']);
|
|
5355
|
-
} else if (type.name.toLowerCase() === 'reference') validatedValues = unique(_filterInstanceProperty__default["default"](values).call(values, value => value
|
|
5402
|
+
} else if (type.name.toLowerCase() === 'reference') validatedValues = unique(_filterInstanceProperty__default["default"](values).call(values, value => value === null || value === void 0 ? void 0 : value.id), ['id']);else if (type.name.toLowerCase() === 'localizedstring') {
|
|
5356
5403
|
validatedValues = unique(values, languages);
|
|
5357
5404
|
} else validatedValues = unique(values);
|
|
5358
5405
|
return validatedValues;
|
|
@@ -5599,6 +5646,7 @@ const getSubfieldLanguage = subfieldName => {
|
|
|
5599
5646
|
return subfieldName.substring(lastDotIndex + 1);
|
|
5600
5647
|
};
|
|
5601
5648
|
function CustomLocalizedTextInput(props) {
|
|
5649
|
+
var _value$language;
|
|
5602
5650
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
5603
5651
|
language: applicationContext.dataLocale,
|
|
5604
5652
|
languages: applicationContext.project.languages
|
|
@@ -5624,7 +5672,7 @@ function CustomLocalizedTextInput(props) {
|
|
|
5624
5672
|
props.renderWarnings && props.handleWarningChange(props.name, props.fieldDefinition, rawValue);
|
|
5625
5673
|
});
|
|
5626
5674
|
const InputComponent = isMultiLine ? uiKit.LocalizedMultilineTextInput : uiKit.LocalizedTextInput;
|
|
5627
|
-
const tooltipTitle = isMultiLine ? '' : value ? value[language]
|
|
5675
|
+
const tooltipTitle = isMultiLine ? '' : value ? (_value$language = value[language]) !== null && _value$language !== void 0 ? _value$language : '' : '';
|
|
5628
5676
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
5629
5677
|
title: tooltipTitle,
|
|
5630
5678
|
children: jsxRuntime.jsx(InputComponent, {
|
|
@@ -5675,7 +5723,8 @@ function CustomBooleanInput(props) {
|
|
|
5675
5723
|
CustomBooleanInput.displayName = 'CustomBooleanInput';
|
|
5676
5724
|
|
|
5677
5725
|
function CustomNumberInput(props) {
|
|
5678
|
-
|
|
5726
|
+
var _props$value;
|
|
5727
|
+
const value = (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : '';
|
|
5679
5728
|
const handleChange = makeChangeHandler(rawValue => {
|
|
5680
5729
|
props.setFieldValue(props.name, !rawValue ? undefined : Number(rawValue));
|
|
5681
5730
|
props.renderWarnings && props.handleWarningChange(props.name, props.fieldDefinition, rawValue);
|
|
@@ -5724,7 +5773,7 @@ const fixAmount = value => {
|
|
|
5724
5773
|
// data user just entered effectively preventing full data from being entered.
|
|
5725
5774
|
const fixEnteredValue = (newValue, initialValue, currencies) => {
|
|
5726
5775
|
const withFixedCurrency = fixCurrencyCode(newValue, currencies);
|
|
5727
|
-
if (!initialValue
|
|
5776
|
+
if (!(initialValue !== null && initialValue !== void 0 && initialValue.amount)) {
|
|
5728
5777
|
return fixAmount(withFixedCurrency);
|
|
5729
5778
|
}
|
|
5730
5779
|
return withFixedCurrency;
|
|
@@ -5794,12 +5843,13 @@ const convertTypeValuesToOptions$1 = reselect.defaultMemoize((type, dataLocale,
|
|
|
5794
5843
|
key: 'label',
|
|
5795
5844
|
locale: dataLocale,
|
|
5796
5845
|
fallbackOrder: languages,
|
|
5797
|
-
fallback:
|
|
5846
|
+
fallback: "".concat(value.key, " (key)")
|
|
5798
5847
|
}),
|
|
5799
5848
|
value: value.key
|
|
5800
5849
|
}));
|
|
5801
5850
|
});
|
|
5802
5851
|
function CustomLocalizedEnumInput(props) {
|
|
5852
|
+
var _options$find$label, _options$find;
|
|
5803
5853
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
5804
5854
|
languages: applicationContext.project.languages,
|
|
5805
5855
|
dataLocale: applicationContext.dataLocale
|
|
@@ -5811,7 +5861,7 @@ function CustomLocalizedEnumInput(props) {
|
|
|
5811
5861
|
props.setFieldValue(props.name, rawValue);
|
|
5812
5862
|
props.renderWarnings && props.handleWarningChange(props.name, props.fieldDefinition, rawValue);
|
|
5813
5863
|
});
|
|
5814
|
-
const tooltipTitle = props.value ? _findInstanceProperty__default["default"](options).call(options, option => option.value === props.value)
|
|
5864
|
+
const tooltipTitle = props.value ? (_options$find$label = (_options$find = _findInstanceProperty__default["default"](options).call(options, option => option.value === props.value)) === null || _options$find === void 0 ? void 0 : _options$find.label) !== null && _options$find$label !== void 0 ? _options$find$label : '' : '';
|
|
5815
5865
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
5816
5866
|
title: tooltipTitle,
|
|
5817
5867
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
@@ -5834,7 +5884,8 @@ function CustomLocalizedEnumInput(props) {
|
|
|
5834
5884
|
CustomLocalizedEnumInput.displayName = 'CustomLocalizedEnumInput';
|
|
5835
5885
|
|
|
5836
5886
|
function CustomRawIdReferenceInput(props) {
|
|
5837
|
-
|
|
5887
|
+
var _props$value;
|
|
5888
|
+
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
5838
5889
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
5839
5890
|
title: value,
|
|
5840
5891
|
children: jsxRuntime.jsx(uiKit.TextInput, {
|
|
@@ -5880,7 +5931,7 @@ function getCategoriesByIds(apolloClient, options) {
|
|
|
5880
5931
|
return apolloClient.query({
|
|
5881
5932
|
query: FetchCategoriesByIds,
|
|
5882
5933
|
variables: {
|
|
5883
|
-
where:
|
|
5934
|
+
where: "id in (".concat(_mapInstanceProperty__default["default"](_context2 = options.ids).call(_context2, id => "\"".concat(id, "\"")).join(', '), ")")
|
|
5884
5935
|
},
|
|
5885
5936
|
context: {
|
|
5886
5937
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -5979,10 +6030,13 @@ const useReferenceSearchItems = _ref => {
|
|
|
5979
6030
|
};
|
|
5980
6031
|
};
|
|
5981
6032
|
function ReferenceSearch(props) {
|
|
5982
|
-
const ids = React.useMemo(() =>
|
|
5983
|
-
|
|
5984
|
-
return
|
|
5985
|
-
|
|
6033
|
+
const ids = React.useMemo(() => {
|
|
6034
|
+
var _props$value, _props$value2;
|
|
6035
|
+
return props.value ? props.isMulti ? (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _mapInstanceProperty__default["default"](_props$value).call(_props$value, _ref2 => {
|
|
6036
|
+
let id = _ref2.id;
|
|
6037
|
+
return id;
|
|
6038
|
+
}) : [(_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.id] : [];
|
|
6039
|
+
}, [props.value, props.isMulti]);
|
|
5986
6040
|
const _useReferenceSearchIt = useReferenceSearchItems({
|
|
5987
6041
|
loadItemsBySearchTerm: props.loadItemsBySearchTerm,
|
|
5988
6042
|
loadItemsByIds: props.loadItemsByIds,
|
|
@@ -5993,14 +6047,14 @@ function ReferenceSearch(props) {
|
|
|
5993
6047
|
areSomeItemsMissing = _useReferenceSearchIt.areSomeItemsMissing,
|
|
5994
6048
|
handleLoadItems = _useReferenceSearchIt.handleLoadItems;
|
|
5995
6049
|
if (areItemsLoading) return null;
|
|
5996
|
-
const value = props.isMulti ? items : items
|
|
6050
|
+
const value = props.isMulti ? items : items === null || items === void 0 ? void 0 : items[0];
|
|
5997
6051
|
let filterValue = null;
|
|
5998
6052
|
if (value) filterValue = props.isMulti ? _mapInstanceProperty__default["default"](value).call(value, props.mapItemToOption) : props.mapItemToOption(value);
|
|
5999
6053
|
const tooltipTitle = value || props.value ? props.mapItemToOption(value || props.value).label : '';
|
|
6000
6054
|
const loadItems = value => _Promise__default["default"].resolve(handleLoadItems(value)).then(items => _mapInstanceProperty__default["default"](items).call(items, item => props.mapItemToOption(item)));
|
|
6001
6055
|
const handleChange = event => {
|
|
6002
|
-
var _context;
|
|
6003
|
-
const option = props.isMulti ? _mapInstanceProperty__default["default"](_context = event.target.value).call(_context, item => item.value) : event.target.value
|
|
6056
|
+
var _context, _event$target$value;
|
|
6057
|
+
const option = props.isMulti ? _mapInstanceProperty__default["default"](_context = event.target.value).call(_context, item => item.value) : ((_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.value) || null;
|
|
6004
6058
|
props.onChange(option);
|
|
6005
6059
|
};
|
|
6006
6060
|
return jsxRuntime.jsxs("div", {
|
|
@@ -6074,8 +6128,9 @@ const messages$B = reactIntl.defineMessages({
|
|
|
6074
6128
|
});
|
|
6075
6129
|
|
|
6076
6130
|
function ownKeys$U(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6077
|
-
function _objectSpread$U(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
6131
|
+
function _objectSpread$U(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys$U(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys$U(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
6078
6132
|
function Option$1(props) {
|
|
6133
|
+
var _context, _context2;
|
|
6079
6134
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
6080
6135
|
language: applicationContext.dataLocale,
|
|
6081
6136
|
languages: applicationContext.project.languages
|
|
@@ -6096,19 +6151,19 @@ function Option$1(props) {
|
|
|
6096
6151
|
fallbackOrder: languages
|
|
6097
6152
|
})
|
|
6098
6153
|
}), category.parent && jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
6099
|
-
children:
|
|
6154
|
+
children: _concatInstanceProperty__default["default"](_context = "".concat(formatMessage(messages$B.parentCategory), ": ")).call(_context, l10n.formatLocalizedString(category.parent, {
|
|
6100
6155
|
key: 'name',
|
|
6101
6156
|
locale: language,
|
|
6102
6157
|
fallbackOrder: languages
|
|
6103
|
-
})
|
|
6158
|
+
}))
|
|
6104
6159
|
}), jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
6105
|
-
children:
|
|
6160
|
+
children: "Slug: ".concat(l10n.formatLocalizedString(category, {
|
|
6106
6161
|
key: 'slug',
|
|
6107
6162
|
locale: language,
|
|
6108
6163
|
fallbackOrder: languages
|
|
6109
|
-
})
|
|
6164
|
+
}))
|
|
6110
6165
|
}), category.externalId && jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
6111
|
-
children:
|
|
6166
|
+
children: _concatInstanceProperty__default["default"](_context2 = "".concat(formatMessage(messages$B.externalId), ": ")).call(_context2, category.externalId || constants.NO_VALUE_FALLBACK)
|
|
6112
6167
|
})]
|
|
6113
6168
|
})
|
|
6114
6169
|
}));
|
|
@@ -6172,7 +6227,7 @@ var CategorySearchPickerOptionFragment$1 = { kind: "Document", definitions: [{ k
|
|
|
6172
6227
|
function useCachedCategoryOptions(ids) {
|
|
6173
6228
|
const apolloClient = client.useApolloClient();
|
|
6174
6229
|
const fragments = _mapInstanceProperty__default["default"](ids).call(ids, id => apolloClient.readFragment({
|
|
6175
|
-
id:
|
|
6230
|
+
id: "CategorySearch:".concat(id),
|
|
6176
6231
|
fragment: CategorySearchPickerOptionFragment$1
|
|
6177
6232
|
}));
|
|
6178
6233
|
return _mapInstanceProperty__default["default"](fragments).call(fragments, category => transformLocalizedFieldsForCategory(category, [{
|
|
@@ -6187,8 +6242,8 @@ function useCachedCategoryOptions(ids) {
|
|
|
6187
6242
|
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 } } } };
|
|
6188
6243
|
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 } } } };
|
|
6189
6244
|
const transformCartDiscountResponse = response => {
|
|
6190
|
-
var _context;
|
|
6191
|
-
return _mapInstanceProperty__default["default"](_context = response.data
|
|
6245
|
+
var _context, _response$data;
|
|
6246
|
+
return _mapInstanceProperty__default["default"](_context = ((_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.cartDiscounts.results) || []).call(_context, cartDiscount => transformLocalizedFieldsForCartDiscount(cartDiscount));
|
|
6192
6247
|
};
|
|
6193
6248
|
function queryCartDiscounts(apolloClient) {
|
|
6194
6249
|
return apolloClient.query({
|
|
@@ -6200,14 +6255,14 @@ function queryCartDiscounts(apolloClient) {
|
|
|
6200
6255
|
}).then(transformCartDiscountResponse);
|
|
6201
6256
|
}
|
|
6202
6257
|
const getWhereClause = function () {
|
|
6203
|
-
var _context2, _context3;
|
|
6258
|
+
var _context2, _context3, _context4;
|
|
6204
6259
|
let searchText = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
6205
6260
|
let language = arguments.length > 1 ? arguments[1] : undefined;
|
|
6206
6261
|
const query = _trimInstanceProperty__default["default"](_context2 = _JSON$stringify__default["default"](searchText)).call(_context2);
|
|
6207
|
-
const idQuery = isUUID(searchText) &&
|
|
6208
|
-
const nameQuery =
|
|
6209
|
-
const keyQuery =
|
|
6210
|
-
return _filterInstanceProperty__default["default"](
|
|
6262
|
+
const idQuery = isUUID(searchText) && "id = ".concat(query);
|
|
6263
|
+
const nameQuery = _concatInstanceProperty__default["default"](_context3 = "name(".concat(language, " = ")).call(_context3, query, ")");
|
|
6264
|
+
const keyQuery = "key = ".concat(query);
|
|
6265
|
+
return _filterInstanceProperty__default["default"](_context4 = [idQuery, nameQuery, keyQuery]).call(_context4, Boolean).join(' or ');
|
|
6211
6266
|
};
|
|
6212
6267
|
function searchCartDiscountsByExactMatch(apolloClient, options) {
|
|
6213
6268
|
return apolloClient.query({
|
|
@@ -6230,7 +6285,10 @@ function getCartDiscountById(apolloClient, options) {
|
|
|
6230
6285
|
context: {
|
|
6231
6286
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
6232
6287
|
}
|
|
6233
|
-
}).then(response =>
|
|
6288
|
+
}).then(response => {
|
|
6289
|
+
var _response$data2;
|
|
6290
|
+
return (_response$data2 = response.data) !== null && _response$data2 !== void 0 && _response$data2.cartDiscount ? transformLocalizedFieldsForCartDiscount(response.data.cartDiscount) : null;
|
|
6291
|
+
});
|
|
6234
6292
|
}
|
|
6235
6293
|
|
|
6236
6294
|
const messages$A = reactIntl.defineMessages({
|
|
@@ -6307,7 +6365,7 @@ function CartDiscountReferenceSearch(props) {
|
|
|
6307
6365
|
}),
|
|
6308
6366
|
loading = _useQuery.loading,
|
|
6309
6367
|
data = _useQuery.data;
|
|
6310
|
-
const isExactMatch = data
|
|
6368
|
+
const isExactMatch = (data === null || data === void 0 ? void 0 : data.cartDiscounts.total) > QUERY_MAX_LIMIT;
|
|
6311
6369
|
const _useIntl = reactIntl.useIntl(),
|
|
6312
6370
|
formatMessage = _useIntl.formatMessage;
|
|
6313
6371
|
const apolloClient = client.useApolloClient();
|
|
@@ -6447,6 +6505,7 @@ const DropdownIndicator = () => jsxRuntime.jsx(uiKit.SearchIcon, {
|
|
|
6447
6505
|
});
|
|
6448
6506
|
DropdownIndicator.displayName = 'DropdownIndicator';
|
|
6449
6507
|
const ProductPickerInput = _ref => {
|
|
6508
|
+
var _currentOption$data$l, _currentOption$data;
|
|
6450
6509
|
let isClearable = _ref.isClearable,
|
|
6451
6510
|
isDisabled = _ref.isDisabled,
|
|
6452
6511
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -6467,19 +6526,20 @@ const ProductPickerInput = _ref => {
|
|
|
6467
6526
|
loadingError = _useState2[0],
|
|
6468
6527
|
setLoadingError = _useState2[1];
|
|
6469
6528
|
const convertProductToOption = React.useCallback(product => {
|
|
6529
|
+
var _masterData$current;
|
|
6470
6530
|
if (!product) return null;
|
|
6471
6531
|
const id = product.id,
|
|
6472
6532
|
key = product.key,
|
|
6473
6533
|
masterData = product.masterData;
|
|
6474
|
-
const localizedName = formatLocalizedFieldToString(masterData.current
|
|
6534
|
+
const localizedName = formatLocalizedFieldToString((_masterData$current = masterData.current) === null || _masterData$current === void 0 ? void 0 : _masterData$current.nameAllLocales);
|
|
6475
6535
|
return {
|
|
6476
|
-
label: localizedName + (key ?
|
|
6536
|
+
label: localizedName + (key ? " (key: ".concat(key, ")") : ''),
|
|
6477
6537
|
value: id,
|
|
6478
6538
|
name: localizedName,
|
|
6479
6539
|
key
|
|
6480
6540
|
};
|
|
6481
6541
|
}, [formatLocalizedFieldToString]);
|
|
6482
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
6542
|
+
const prefixSearchFields = React.useMemo(() => ["masterData.current.name.".concat(dataLocale), 'key'], [dataLocale]);
|
|
6483
6543
|
const loadOptions = useLoadOptions({
|
|
6484
6544
|
query: GetProductsQuery,
|
|
6485
6545
|
prefixSearchFields
|
|
@@ -6510,12 +6570,12 @@ const ProductPickerInput = _ref => {
|
|
|
6510
6570
|
setLoadingError(null);
|
|
6511
6571
|
handleInternalInputChange(event);
|
|
6512
6572
|
}, [handleInternalInputChange]);
|
|
6513
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
6573
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption === null || currentOption === void 0 ? void 0 : currentOption.error);
|
|
6514
6574
|
React.useEffect(() => {
|
|
6515
6575
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
6516
6576
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
6517
6577
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
6518
|
-
const tooltipTitle = currentOption
|
|
6578
|
+
const tooltipTitle = (_currentOption$data$l = currentOption === null || currentOption === void 0 || (_currentOption$data = currentOption.data) === null || _currentOption$data === void 0 ? void 0 : _currentOption$data.label) !== null && _currentOption$data$l !== void 0 ? _currentOption$data$l : '';
|
|
6519
6579
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
6520
6580
|
max: "scale",
|
|
6521
6581
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -6555,7 +6615,8 @@ const ProductPickerInput = _ref => {
|
|
|
6555
6615
|
ProductPickerInput.displayName = 'ProductPickerInput';
|
|
6556
6616
|
|
|
6557
6617
|
function CustomProductReferenceInput(props) {
|
|
6558
|
-
|
|
6618
|
+
var _props$value;
|
|
6619
|
+
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6559
6620
|
return jsxRuntime.jsx(ProductPickerInput, {
|
|
6560
6621
|
value: value,
|
|
6561
6622
|
name: props.name,
|
|
@@ -6573,7 +6634,8 @@ function CustomProductReferenceInput(props) {
|
|
|
6573
6634
|
CustomProductReferenceInput.displayName = 'CustomProductReferenceInput';
|
|
6574
6635
|
|
|
6575
6636
|
function CustomProductTypeReferenceInput(props) {
|
|
6576
|
-
|
|
6637
|
+
var _props$value;
|
|
6638
|
+
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6577
6639
|
return jsxRuntime.jsx(ProductTypePickerInput, {
|
|
6578
6640
|
value: value,
|
|
6579
6641
|
name: props.name,
|
|
@@ -6590,7 +6652,8 @@ function CustomProductTypeReferenceInput(props) {
|
|
|
6590
6652
|
CustomProductTypeReferenceInput.displayName = 'CustomProductTypeReferenceInput';
|
|
6591
6653
|
|
|
6592
6654
|
function CustomChannelReferenceInput(props) {
|
|
6593
|
-
|
|
6655
|
+
var _props$value;
|
|
6656
|
+
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6594
6657
|
return jsxRuntime.jsx(ChannelPickerInput, {
|
|
6595
6658
|
value: value,
|
|
6596
6659
|
name: props.name,
|
|
@@ -6607,7 +6670,8 @@ function CustomChannelReferenceInput(props) {
|
|
|
6607
6670
|
CustomChannelReferenceInput.displayName = 'CustomChannelReferenceInput';
|
|
6608
6671
|
|
|
6609
6672
|
function CustomStateReferenceInput(props) {
|
|
6610
|
-
|
|
6673
|
+
var _props$value;
|
|
6674
|
+
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6611
6675
|
return jsxRuntime.jsx(StatePickerInput, {
|
|
6612
6676
|
value: value,
|
|
6613
6677
|
name: props.name,
|
|
@@ -6723,16 +6787,17 @@ function CustomTimeInput(props) {
|
|
|
6723
6787
|
CustomTimeInput.displayName = 'CustomTimeInput';
|
|
6724
6788
|
|
|
6725
6789
|
const convertTypeValuesToOptions = reselect.defaultMemoize(typeValues => _mapInstanceProperty__default["default"](typeValues).call(typeValues, typeValue => ({
|
|
6726
|
-
label: typeValue.label ||
|
|
6790
|
+
label: typeValue.label || "".concat(typeValue.key, " (key)"),
|
|
6727
6791
|
value: typeValue.key
|
|
6728
6792
|
})));
|
|
6729
6793
|
function CustomEnumInput(props) {
|
|
6794
|
+
var _options$find$label, _options$find;
|
|
6730
6795
|
const options = convertTypeValuesToOptions(_valuesInstanceProperty__default["default"](props.fieldDefinition.type));
|
|
6731
6796
|
const handleChange = makeChangeHandler(rawValue => {
|
|
6732
6797
|
props.setFieldValue(props.name, rawValue);
|
|
6733
6798
|
props.renderWarnings && props.handleWarningChange(props.name, props.fieldDefinition, rawValue);
|
|
6734
6799
|
});
|
|
6735
|
-
const tooltipTitle = props.value ? _findInstanceProperty__default["default"](options).call(options, option => option.value === props.value)
|
|
6800
|
+
const tooltipTitle = props.value ? (_options$find$label = (_options$find = _findInstanceProperty__default["default"](options).call(options, option => option.value === props.value)) === null || _options$find === void 0 ? void 0 : _options$find.label) !== null && _options$find$label !== void 0 ? _options$find$label : '' : '';
|
|
6736
6801
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
6737
6802
|
title: tooltipTitle,
|
|
6738
6803
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
@@ -6810,9 +6875,9 @@ function ownKeys$Q(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
6810
6875
|
function _objectSpread$Q(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context7 = ownKeys$Q(Object(t), !0)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context8 = ownKeys$Q(Object(t))).call(_context8, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
6811
6876
|
const getTypeName = type => type.name.toLowerCase();
|
|
6812
6877
|
const findLabel = (enumType, key) => {
|
|
6813
|
-
var _context;
|
|
6878
|
+
var _enumType$values$find, _enumType$values$find2, _context;
|
|
6814
6879
|
const emptyValue = getTypeName(enumType) === 'enum' ? '' : {};
|
|
6815
|
-
return _findInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](enumType)).call(_context, value => value.key === key)
|
|
6880
|
+
return (_enumType$values$find = (_enumType$values$find2 = _findInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](enumType)).call(_context, value => value.key === key)) === null || _enumType$values$find2 === void 0 ? void 0 : _enumType$values$find2.label) !== null && _enumType$values$find !== void 0 ? _enumType$values$find : emptyValue;
|
|
6816
6881
|
};
|
|
6817
6882
|
const convertEnumValues = (value, attributeDefinition) => {
|
|
6818
6883
|
var _context2, _context3;
|
|
@@ -6878,7 +6943,7 @@ const attributesMapToNameValuePairs = map => {
|
|
|
6878
6943
|
const _excluded$1 = ["WrapperComponent"];
|
|
6879
6944
|
const getAttributeShortName = (fullName, attributesPrefix) => {
|
|
6880
6945
|
if (!attributesPrefix) return fullName;
|
|
6881
|
-
return fullName.replace(
|
|
6946
|
+
return fullName.replace("".concat(attributesPrefix, "."), '');
|
|
6882
6947
|
};
|
|
6883
6948
|
function ProductAttributes(_ref) {
|
|
6884
6949
|
let WrapperComponent = _ref.WrapperComponent,
|
|
@@ -6966,19 +7031,19 @@ function ownKeys$P(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
6966
7031
|
function _objectSpread$P(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context6 = ownKeys$P(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context7 = ownKeys$P(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
6967
7032
|
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 } } } };
|
|
6968
7033
|
const mapAttributeDefinition = definition => {
|
|
6969
|
-
var _context, _context2, _context3, _context4;
|
|
7034
|
+
var _context, _definition$type, _context2, _context3, _definition$type2, _context4;
|
|
6970
7035
|
return _objectSpread$P(_objectSpread$P({}, definition), {}, {
|
|
6971
7036
|
required: definition.isRequired,
|
|
6972
7037
|
inputTip: l10n.transformLocalizedFieldToLocalizedString(definition.inputTipAllLocales),
|
|
6973
7038
|
label: l10n.transformLocalizedFieldToLocalizedString(definition.labelAllLocales),
|
|
6974
|
-
type: _includesInstanceProperty__default["default"](_context = ['enum', 'lenum']).call(_context, definition.type
|
|
7039
|
+
type: _includesInstanceProperty__default["default"](_context = ['enum', 'lenum']).call(_context, (_definition$type = definition.type) === null || _definition$type === void 0 || (_definition$type = _definition$type.elementType) === null || _definition$type === void 0 ? void 0 : _definition$type.name) ? _objectSpread$P(_objectSpread$P({}, definition.type), {}, {
|
|
6975
7040
|
elementType: _objectSpread$P(_objectSpread$P({}, definition.type.elementType), {}, {
|
|
6976
7041
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](definition.type.elementType).results).call(_context2, value => ({
|
|
6977
7042
|
key: value.key,
|
|
6978
7043
|
label: value.label || l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
6979
7044
|
}))
|
|
6980
7045
|
})
|
|
6981
|
-
}) : _includesInstanceProperty__default["default"](_context3 = ['enum', 'lenum']).call(_context3, definition.type
|
|
7046
|
+
}) : _includesInstanceProperty__default["default"](_context3 = ['enum', 'lenum']).call(_context3, (_definition$type2 = definition.type) === null || _definition$type2 === void 0 ? void 0 : _definition$type2.name) ? _objectSpread$P(_objectSpread$P({}, definition.type), {}, {
|
|
6982
7047
|
values: _mapInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](definition.type).results).call(_context4, value => ({
|
|
6983
7048
|
key: value.key,
|
|
6984
7049
|
label: value.label || l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -7331,7 +7396,7 @@ const ExpandButton = props => props.totalValues > 1 ? jsxRuntime.jsxs(uiKit.Spac
|
|
|
7331
7396
|
}), jsxRuntime.jsx(uiKit.FlatButton, {
|
|
7332
7397
|
tone: "primary",
|
|
7333
7398
|
icon: props.isExpanded ? jsxRuntime.jsx(uiKit.AngleUpIcon, {}) : jsxRuntime.jsx(uiKit.AngleDownIcon, {}),
|
|
7334
|
-
label: props.isExpanded ?
|
|
7399
|
+
label: props.isExpanded ? "Hide set items (".concat(props.totalValues, ")") : "Show all set items (".concat(props.totalValues, ")"),
|
|
7335
7400
|
onClick: props.onExpand
|
|
7336
7401
|
})]
|
|
7337
7402
|
}) : null;
|
|
@@ -7366,7 +7431,7 @@ const SetButtons = props => {
|
|
|
7366
7431
|
SetButtons.displayName = 'SetButtons';
|
|
7367
7432
|
|
|
7368
7433
|
function ownKeys$N(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7369
|
-
function _objectSpread$N(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
7434
|
+
function _objectSpread$N(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys$N(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys$N(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
7370
7435
|
const getDuplicateErrors = setValues => {
|
|
7371
7436
|
/* eslint-disable no-plusplus */
|
|
7372
7437
|
const result = [];
|
|
@@ -7407,10 +7472,13 @@ const getItemIndex = name => {
|
|
|
7407
7472
|
return _parseInt__default["default"](rawIndex, 10);
|
|
7408
7473
|
};
|
|
7409
7474
|
const makeKeys = amount => times__default["default"](amount, () => uuid.v4());
|
|
7410
|
-
const makeItemFieldName = (fieldName, index) =>
|
|
7475
|
+
const makeItemFieldName = (fieldName, index) => {
|
|
7476
|
+
var _context;
|
|
7477
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(fieldName, ".[")).call(_context, index, "]");
|
|
7478
|
+
};
|
|
7411
7479
|
const makeMapForAllItems = (fieldName, items, value) => _reduceInstanceProperty__default["default"](items).call(items, (result, item, index) => set__default["default"](result, makeItemFieldName(fieldName, index), value), {});
|
|
7412
7480
|
function CustomInputSet(props) {
|
|
7413
|
-
var
|
|
7481
|
+
var _context2;
|
|
7414
7482
|
const _useToggleState = uiKit.useToggleState(false),
|
|
7415
7483
|
_useToggleState2 = _slicedToArray(_useToggleState, 2),
|
|
7416
7484
|
isExpanded = _useToggleState2[0],
|
|
@@ -7432,7 +7500,7 @@ function CustomInputSet(props) {
|
|
|
7432
7500
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
7433
7501
|
keys = _useState4[0],
|
|
7434
7502
|
setKeys = _useState4[1];
|
|
7435
|
-
const totalAmount = internalValue
|
|
7503
|
+
const totalAmount = internalValue === null || internalValue === void 0 ? void 0 : internalValue.length;
|
|
7436
7504
|
const amountToRender = isExpanded ? totalAmount : 1;
|
|
7437
7505
|
const updateInternalValue = newValue => {
|
|
7438
7506
|
const valueToSet = isEmpty$1(newValue) ? [undefined] : newValue;
|
|
@@ -7479,8 +7547,8 @@ function CustomInputSet(props) {
|
|
|
7479
7547
|
// in <CustomFieldComponent /> where proper component for given field/attribute
|
|
7480
7548
|
// type is selected.
|
|
7481
7549
|
const type = getType(props.fieldDefinition);
|
|
7482
|
-
const typeName = type
|
|
7483
|
-
const areButtonsTopAligned = _includesInstanceProperty__default["default"](
|
|
7550
|
+
const typeName = type === null || type === void 0 ? void 0 : type.name.toLowerCase();
|
|
7551
|
+
const areButtonsTopAligned = _includesInstanceProperty__default["default"](_context2 = [CUSTOM_FIELD_TYPES.lenum, CUSTOM_FIELD_TYPES.localizedenum, CUSTOM_FIELD_TYPES.localizedstring, CUSTOM_FIELD_TYPES.string, CUSTOM_FIELD_TYPES.text, CUSTOM_FIELD_TYPES.ltext, CUSTOM_FIELD_TYPES.reference]).call(_context2, typeName);
|
|
7484
7552
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
7485
7553
|
children: [jsxRuntime.jsx(uiKit.AccessibleHidden, {
|
|
7486
7554
|
children: jsxRuntime.jsx("label", {
|
|
@@ -7562,12 +7630,14 @@ const nonSetComponents = {
|
|
|
7562
7630
|
};
|
|
7563
7631
|
const CustomFieldInput = /*#__PURE__*/React.memo(props => {
|
|
7564
7632
|
const InputComponent = React.useMemo(() => {
|
|
7565
|
-
|
|
7633
|
+
var _props$fieldDefinitio;
|
|
7634
|
+
const typeName = (_props$fieldDefinitio = props.fieldDefinition.type) === null || _props$fieldDefinitio === void 0 ? void 0 : _props$fieldDefinitio.name.toLowerCase();
|
|
7566
7635
|
if (typeName === 'set') {
|
|
7636
|
+
var _getSetElementType;
|
|
7567
7637
|
// Boolean is the only set element with peculiarities (i.e. way more
|
|
7568
7638
|
// convenient for user to work with it as with select input with three values:
|
|
7569
7639
|
// [true], [false] and [true, false]).
|
|
7570
|
-
if (getType(props.fieldDefinition)
|
|
7640
|
+
if (((_getSetElementType = getType(props.fieldDefinition)) === null || _getSetElementType === void 0 ? void 0 : _getSetElementType.name.toLowerCase()) === CUSTOM_FIELD_TYPES.boolean) {
|
|
7571
7641
|
return CustomBooleanInputSet;
|
|
7572
7642
|
}
|
|
7573
7643
|
// All the rest sets are just a fancy wrapper around single-item components
|
|
@@ -7664,9 +7734,9 @@ const CustomFieldErrors = props => {
|
|
|
7664
7734
|
const didFormValidationFail = useDidFormValidationFail();
|
|
7665
7735
|
const errors = _Array$isArray__default["default"](props.errors) ? mergeSetItemsErrors(props.errors) : props.errors;
|
|
7666
7736
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
7667
|
-
children: [props.isTouched || didFormValidationFail && errors
|
|
7737
|
+
children: [props.isTouched || didFormValidationFail && (errors === null || errors === void 0 ? void 0 : errors.missing) && jsxRuntime.jsx(_.ErrorMessage, {
|
|
7668
7738
|
intlMessage: messages$K.required
|
|
7669
|
-
}), props.isTouched || didFormValidationFail && errors
|
|
7739
|
+
}), props.isTouched || didFormValidationFail && (errors === null || errors === void 0 ? void 0 : errors.duplicated) && jsxRuntime.jsx(_.ErrorMessage, {
|
|
7670
7740
|
intlMessage: messages$K.unique
|
|
7671
7741
|
})]
|
|
7672
7742
|
});
|
|
@@ -7716,9 +7786,10 @@ function _objectSpread$K(e) { for (var r = 1; r < arguments.length; r++) { var _
|
|
|
7716
7786
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
7717
7787
|
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 } } } };
|
|
7718
7788
|
const CustomFieldsLabelHint = _ref2 => {
|
|
7789
|
+
var _type$name;
|
|
7719
7790
|
let fieldDefinition = _ref2.fieldDefinition;
|
|
7720
7791
|
const type = getType(fieldDefinition);
|
|
7721
|
-
const isReference = type.name
|
|
7792
|
+
const isReference = ((_type$name = type.name) === null || _type$name === void 0 ? void 0 : _type$name.toLowerCase()) === 'reference';
|
|
7722
7793
|
const referenceTypeId = type.referenceTypeId;
|
|
7723
7794
|
const isCartDiscountsReference = isReference && referenceTypeId === SEARCHABLE_REFERENCES.cartDiscount;
|
|
7724
7795
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
@@ -7736,7 +7807,7 @@ const CustomFieldsLabelHint = _ref2 => {
|
|
|
7736
7807
|
data = _useQuery.data,
|
|
7737
7808
|
loading = _useQuery.loading;
|
|
7738
7809
|
if (loading) return null;
|
|
7739
|
-
if (data
|
|
7810
|
+
if ((data === null || data === void 0 ? void 0 : data.cartDiscounts.total) > QUERY_MAX_LIMIT) {
|
|
7740
7811
|
return jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
7741
7812
|
alignItems: "center",
|
|
7742
7813
|
children: [jsxRuntime.jsx(uiKit.WarningIcon, {
|
|
@@ -7763,17 +7834,17 @@ function CustomFieldsProductTypeReferenceSubtitle() {
|
|
|
7763
7834
|
// TODO(pa3): this logic may be misplaced and probably
|
|
7764
7835
|
// should belong to <CustomReferenceInput /> component instead.
|
|
7765
7836
|
function CustomFieldsLabelSubtitle(_ref3) {
|
|
7766
|
-
var _context;
|
|
7837
|
+
var _type$name2, _context;
|
|
7767
7838
|
let fieldDefinition = _ref3.fieldDefinition;
|
|
7768
7839
|
const _useIntl2 = reactIntl.useIntl(),
|
|
7769
7840
|
formatMessage = _useIntl2.formatMessage;
|
|
7770
7841
|
const type = getType(fieldDefinition);
|
|
7771
|
-
const isReference = type.name
|
|
7842
|
+
const isReference = ((_type$name2 = type.name) === null || _type$name2 === void 0 ? void 0 : _type$name2.toLowerCase()) === 'reference';
|
|
7772
7843
|
if (!isReference) return null;
|
|
7773
7844
|
const referenceTypeId = type.referenceTypeId;
|
|
7774
7845
|
const referenceTypeName = capitalizeFirst(referenceTypeId);
|
|
7775
7846
|
if (_includesInstanceProperty__default["default"](_context = [SEARCHABLE_REFERENCES.category, SEARCHABLE_REFERENCES.cartDiscount]).call(_context, referenceTypeId)) return referenceTypeName;
|
|
7776
|
-
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) :
|
|
7847
|
+
return referenceTypeId === SEARCHABLE_REFERENCES.product ? formatMessage(messages$v.productReferenceLabel) : referenceTypeId === SEARCHABLE_REFERENCES.productType ? jsxRuntime.jsx(CustomFieldsProductTypeReferenceSubtitle, {}) : referenceTypeId === SEARCHABLE_REFERENCES.channel ? formatMessage(messages$v.channelReferenceLabel) : referenceTypeId === SEARCHABLE_REFERENCES.state ? formatMessage(messages$v.stateReferenceLabel) : "".concat(referenceTypeName, " ID");
|
|
7777
7848
|
}
|
|
7778
7849
|
const Portal = props => /*#__PURE__*/ReactDOM__default["default"].createPortal(props.children, document.body);
|
|
7779
7850
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
@@ -7790,7 +7861,7 @@ function CustomFieldsCountIndicator(_ref4) {
|
|
|
7790
7861
|
const formatLocalizedField = useFormatLocalizedFieldToString();
|
|
7791
7862
|
const _useIntl3 = reactIntl.useIntl(),
|
|
7792
7863
|
formatMessage = _useIntl3.formatMessage;
|
|
7793
|
-
return assignedAttributeGroups
|
|
7864
|
+
return (assignedAttributeGroups === null || assignedAttributeGroups === void 0 ? void 0 : assignedAttributeGroups.length) > 1 ? jsxRuntime.jsx(uiKit.Tooltip, {
|
|
7794
7865
|
title: formatMessage(messages$v.attributeGroupCountTooltip, {
|
|
7795
7866
|
attributeGroups: _mapInstanceProperty__default["default"](assignedAttributeGroups).call(assignedAttributeGroups, assignedAttributeGroup => formatLocalizedField(assignedAttributeGroup.nameAllLocales)).join(', '),
|
|
7796
7867
|
count: assignedAttributeGroups.length
|
|
@@ -7849,10 +7920,11 @@ CustomFieldsLabel.displayName = 'CustomFieldsTitle';
|
|
|
7849
7920
|
|
|
7850
7921
|
const _excluded = ["WrapperComponent"];
|
|
7851
7922
|
function ownKeys$J(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7852
|
-
function _objectSpread$J(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
7923
|
+
function _objectSpread$J(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context6 = ownKeys$J(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context7 = ownKeys$J(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
7853
7924
|
const getFieldName = (parentName, fieldName) => {
|
|
7925
|
+
var _context;
|
|
7854
7926
|
if (!parentName) return fieldName;
|
|
7855
|
-
return
|
|
7927
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(parentName, ".")).call(_context, fieldName);
|
|
7856
7928
|
};
|
|
7857
7929
|
const isNested = fieldDefinition => {
|
|
7858
7930
|
const type = fieldDefinition.type;
|
|
@@ -7883,6 +7955,7 @@ const CustomFieldsInternal = _ref => {
|
|
|
7883
7955
|
return jsxRuntime.jsx(DroppableWrapper, {
|
|
7884
7956
|
onDragEnd: onDragEnd,
|
|
7885
7957
|
children: _mapInstanceProperty__default["default"](fieldDefinitions).call(fieldDefinitions, (fieldDefinition, index) => {
|
|
7958
|
+
var _context2, _context3;
|
|
7886
7959
|
const fieldName = getFieldName(props.name, fieldDefinition.name);
|
|
7887
7960
|
const isTouched = Boolean(formik.getIn(touched, fieldName));
|
|
7888
7961
|
const fieldErrors = formik.getIn(errors, fieldName);
|
|
@@ -7907,7 +7980,7 @@ const CustomFieldsInternal = _ref => {
|
|
|
7907
7980
|
onBlur: handleBlur,
|
|
7908
7981
|
setFieldValue: props.setFieldValue,
|
|
7909
7982
|
hasError: hasError,
|
|
7910
|
-
hasWarning: props.renderWarnings && status
|
|
7983
|
+
hasWarning: props.renderWarnings && (status === null || status === void 0 ? void 0 : status.warnings[fieldName]),
|
|
7911
7984
|
handleWarningChange: props.handleWarningChange,
|
|
7912
7985
|
renderWarnings: props.renderWarnings
|
|
7913
7986
|
};
|
|
@@ -7915,33 +7988,36 @@ const CustomFieldsInternal = _ref => {
|
|
|
7915
7988
|
return jsxRuntime.jsx(formik.FastField, {
|
|
7916
7989
|
name: fieldName,
|
|
7917
7990
|
validate: validate,
|
|
7918
|
-
children: () =>
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
children: jsxRuntime.
|
|
7925
|
-
|
|
7926
|
-
"
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7991
|
+
children: () => {
|
|
7992
|
+
var _context4, _context5;
|
|
7993
|
+
return jsxRuntime.jsx(DraggableWrapper, {
|
|
7994
|
+
draggableKey: _concatInstanceProperty__default["default"](_context4 = "".concat(fieldName, "-")).call(_context4, index),
|
|
7995
|
+
draggableId: _concatInstanceProperty__default["default"](_context5 = "".concat(fieldName, "-")).call(_context5, index),
|
|
7996
|
+
index: index,
|
|
7997
|
+
children: jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
7998
|
+
scale: "xs",
|
|
7999
|
+
children: jsxRuntime.jsxs("div", {
|
|
8000
|
+
"aria-invalid": _Object$keys__default["default"](fieldErrors !== null && fieldErrors !== void 0 ? fieldErrors : {}).length > 0,
|
|
8001
|
+
"aria-errormessage": "".concat(fieldName, "-error"),
|
|
8002
|
+
id: "".concat(fieldName, "-error"),
|
|
8003
|
+
children: [jsxRuntime.jsx(CustomFieldsLabel, {
|
|
8004
|
+
name: fieldName,
|
|
8005
|
+
fieldDefinition: fieldDefinition
|
|
8006
|
+
}), jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
8007
|
+
scale: "xs",
|
|
8008
|
+
alignItems: "stretch",
|
|
8009
|
+
children: [WrapperComponent ? jsxRuntime.jsx(WrapperComponent, {
|
|
8010
|
+
children: Field
|
|
8011
|
+
}) : Field, props.renderWarnings && (status === null || status === void 0 ? void 0 : status.warnings[fieldName]) && props.renderCustomWarnings(fieldDefinition), jsxRuntime.jsx(CustomFieldErrors, {
|
|
8012
|
+
isTouched: isTouched,
|
|
8013
|
+
errors: fieldErrors
|
|
8014
|
+
})]
|
|
7939
8015
|
})]
|
|
7940
|
-
})
|
|
8016
|
+
})
|
|
7941
8017
|
})
|
|
7942
|
-
})
|
|
7943
|
-
}
|
|
7944
|
-
},
|
|
8018
|
+
});
|
|
8019
|
+
}
|
|
8020
|
+
}, _concatInstanceProperty__default["default"](_context2 = _concatInstanceProperty__default["default"](_context3 = "".concat(fieldName, "-")).call(_context3, index, "-")).call(_context2, fieldKey));
|
|
7945
8021
|
})
|
|
7946
8022
|
});
|
|
7947
8023
|
};
|
|
@@ -8001,7 +8077,7 @@ var pickerMessages = reactIntl.defineMessages({
|
|
|
8001
8077
|
});
|
|
8002
8078
|
|
|
8003
8079
|
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; }
|
|
8004
|
-
function _objectSpread$I(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
8080
|
+
function _objectSpread$I(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$I(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$I(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
8005
8081
|
const PRODUCT_SELECTION_MODES = {
|
|
8006
8082
|
INCLUSION: 'Individual',
|
|
8007
8083
|
EXCLUSION: 'IndividualExclusion'
|
|
@@ -8012,10 +8088,11 @@ const PRODUCT_SELECTION_MODES_LABELS = {
|
|
|
8012
8088
|
};
|
|
8013
8089
|
const getMode = mode => mode === PRODUCT_SELECTION_MODES.INCLUSION || mode === PRODUCT_SELECTION_MODES_LABELS.INCLUSION ? 'inclusion' : 'exclusion';
|
|
8014
8090
|
const addModeToLabel = function (ps) {
|
|
8091
|
+
var _context;
|
|
8015
8092
|
let enableExcludingProducts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
8016
8093
|
if (!ps) return undefined;
|
|
8017
8094
|
return _objectSpread$I(_objectSpread$I({}, ps), {}, {
|
|
8018
|
-
label:
|
|
8095
|
+
label: _concatInstanceProperty__default["default"](_context = "".concat(ps === null || ps === void 0 ? void 0 : ps.label)).call(_context, enableExcludingProducts ? " (type: ".concat(getMode(ps === null || ps === void 0 ? void 0 : ps.mode), ")") : '')
|
|
8019
8096
|
});
|
|
8020
8097
|
};
|
|
8021
8098
|
|
|
@@ -8027,6 +8104,7 @@ const mapProductSelectionsToOptions$1 = memoize__default["default"](function ()
|
|
|
8027
8104
|
let enableExcludingProducts = arguments.length > 4 ? arguments[4] : undefined;
|
|
8028
8105
|
const selectedPSList = _Array$isArray__default["default"](selectedPS) ? selectedPS : [selectedPS];
|
|
8029
8106
|
return _mapInstanceProperty__default["default"](productSelections).call(productSelections, productSelection => {
|
|
8107
|
+
var _context;
|
|
8030
8108
|
const label = l10n.formatLocalizedString(productSelection, {
|
|
8031
8109
|
key: 'name',
|
|
8032
8110
|
locale: dataLocale,
|
|
@@ -8035,13 +8113,14 @@ const mapProductSelectionsToOptions$1 = memoize__default["default"](function ()
|
|
|
8035
8113
|
return {
|
|
8036
8114
|
id: productSelection.id,
|
|
8037
8115
|
value: productSelection.id,
|
|
8038
|
-
label:
|
|
8116
|
+
label: _concatInstanceProperty__default["default"](_context = "".concat(label)).call(_context, _includesInstanceProperty__default["default"](selectedPSList).call(selectedPSList, productSelection.id) && enableExcludingProducts ? " (type: ".concat(getMode(productSelection.mode), ")") : ''),
|
|
8039
8117
|
key: productSelection.key,
|
|
8040
8118
|
mode: getMode(productSelection.mode)
|
|
8041
8119
|
};
|
|
8042
8120
|
});
|
|
8043
8121
|
});
|
|
8044
8122
|
function ProductSelectionBasicSelectDropdown(props) {
|
|
8123
|
+
var _productSelectionsFet, _productSelectionsFet2;
|
|
8045
8124
|
const intl = reactIntl.useIntl();
|
|
8046
8125
|
const enableExcludingProducts = applicationShell.useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
8047
8126
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -8054,10 +8133,10 @@ function ProductSelectionBasicSelectDropdown(props) {
|
|
|
8054
8133
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
8055
8134
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8056
8135
|
if (productSelectionsFetcher.isLoading) return jsxRuntime.jsx(CenteredLoadingSpinner, {});
|
|
8057
|
-
const productSelections = productSelectionsFetcher.productSelections
|
|
8136
|
+
const productSelections = (_productSelectionsFet = (_productSelectionsFet2 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet2 === void 0 ? void 0 : _productSelectionsFet2.results) !== null && _productSelectionsFet !== void 0 ? _productSelectionsFet : [];
|
|
8058
8137
|
const filteredProductSelections = _filterInstanceProperty__default["default"](productSelections).call(productSelections, ps => {
|
|
8059
|
-
var
|
|
8060
|
-
return !_includesInstanceProperty__default["default"](
|
|
8138
|
+
var _context2;
|
|
8139
|
+
return !_includesInstanceProperty__default["default"](_context2 = props.excludedProductSelectionIds).call(_context2, ps.id);
|
|
8061
8140
|
});
|
|
8062
8141
|
const onOptionClick = event => {
|
|
8063
8142
|
const productSelectionId = event.target.value;
|
|
@@ -8110,7 +8189,7 @@ const getValueFromOptions$3 = _ref => {
|
|
|
8110
8189
|
// handle async-select-field value transformation
|
|
8111
8190
|
if (isMulti) {
|
|
8112
8191
|
var _context;
|
|
8113
|
-
return _mapInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](allProductSelectionOptions).call(allProductSelectionOptions, ps => currentlySelectedProductSelections
|
|
8192
|
+
return _mapInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](allProductSelectionOptions).call(allProductSelectionOptions, ps => currentlySelectedProductSelections === null || currentlySelectedProductSelections === void 0 ? void 0 : _includesInstanceProperty__default["default"](currentlySelectedProductSelections).call(currentlySelectedProductSelections, ps.value))).call(_context, ps => addModeToLabel(ps, enableExcludingProducts));
|
|
8114
8193
|
}
|
|
8115
8194
|
|
|
8116
8195
|
// in case it is not multiselect, then a single valued async-select-input is being requested and the value should have proper format
|
|
@@ -8122,6 +8201,7 @@ const emptyStoreOption$1 = intl => [{
|
|
|
8122
8201
|
isDisabled: true
|
|
8123
8202
|
}];
|
|
8124
8203
|
function ProductSelectionsAsyncSelectDropdown(props) {
|
|
8204
|
+
var _productSelectionsFet3;
|
|
8125
8205
|
const intl = reactIntl.useIntl();
|
|
8126
8206
|
const enableExcludingProducts = applicationShell.useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
8127
8207
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -8134,13 +8214,17 @@ function ProductSelectionsAsyncSelectDropdown(props) {
|
|
|
8134
8214
|
})),
|
|
8135
8215
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
8136
8216
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8137
|
-
const productSelections = React.useMemo(() =>
|
|
8217
|
+
const productSelections = React.useMemo(() => {
|
|
8218
|
+
var _productSelectionsFet, _productSelectionsFet2;
|
|
8219
|
+
return (_productSelectionsFet = (_productSelectionsFet2 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet2 === void 0 ? void 0 : _productSelectionsFet2.results) !== null && _productSelectionsFet !== void 0 ? _productSelectionsFet : [];
|
|
8220
|
+
}, [(_productSelectionsFet3 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet3 === void 0 ? void 0 : _productSelectionsFet3.results]);
|
|
8138
8221
|
const filteredProductSelections = _filterInstanceProperty__default["default"](productSelections).call(productSelections, ps => {
|
|
8139
8222
|
var _context2;
|
|
8140
8223
|
return !_includesInstanceProperty__default["default"](_context2 = props.excludedProductSelectionIds).call(_context2, ps.id);
|
|
8141
8224
|
});
|
|
8142
8225
|
const onOptionClick = event => {
|
|
8143
|
-
|
|
8226
|
+
var _event$target$value;
|
|
8227
|
+
const productSelectionId = (_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.value;
|
|
8144
8228
|
const currentProductSelection = _findInstanceProperty__default["default"](productSelections).call(productSelections, productSelection => productSelection.id === productSelectionId);
|
|
8145
8229
|
props.onChange(currentProductSelection);
|
|
8146
8230
|
};
|
|
@@ -8216,11 +8300,15 @@ function ProductSelectionsAsyncSelectDropdown(props) {
|
|
|
8216
8300
|
}
|
|
8217
8301
|
|
|
8218
8302
|
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 } } } };
|
|
8219
|
-
const createQueryVariables$4 = (productSelections, predicateField) =>
|
|
8220
|
-
|
|
8221
|
-
|
|
8222
|
-
|
|
8303
|
+
const createQueryVariables$4 = (productSelections, predicateField) => {
|
|
8304
|
+
var _context;
|
|
8305
|
+
return {
|
|
8306
|
+
where: _concatInstanceProperty__default["default"](_context = "".concat(predicateField, " in (")).call(_context, _mapInstanceProperty__default["default"](productSelections).call(productSelections, ps => "\"".concat(ps, "\"")).join(', '), ")"),
|
|
8307
|
+
limit: 500
|
|
8308
|
+
};
|
|
8309
|
+
};
|
|
8223
8310
|
const useProductSelectionsByFieldFetcher = (productSelections, predicateField) => {
|
|
8311
|
+
var _productSelectionsQue, _productSelectionsQue2;
|
|
8224
8312
|
const productSelectionList = _Array$isArray__default["default"](productSelections) ? productSelections : [productSelections];
|
|
8225
8313
|
const productSelectionsQuery = react.useQuery(ProductSelectionsPickerFetcher$1, {
|
|
8226
8314
|
context: {
|
|
@@ -8230,7 +8318,7 @@ const useProductSelectionsByFieldFetcher = (productSelections, predicateField) =
|
|
|
8230
8318
|
skip: productSelectionList.length === 0
|
|
8231
8319
|
});
|
|
8232
8320
|
return {
|
|
8233
|
-
productSelections: productSelectionsQuery.data
|
|
8321
|
+
productSelections: (_productSelectionsQue = (_productSelectionsQue2 = productSelectionsQuery.data) === null || _productSelectionsQue2 === void 0 ? void 0 : _productSelectionsQue2.productSelections.results) !== null && _productSelectionsQue !== void 0 ? _productSelectionsQue : [],
|
|
8234
8322
|
isLoading: productSelectionsQuery.loading
|
|
8235
8323
|
};
|
|
8236
8324
|
};
|
|
@@ -8271,8 +8359,8 @@ const createQueryVariables$3 = _ref3 => {
|
|
|
8271
8359
|
var _context;
|
|
8272
8360
|
let searchText = _ref3.searchText;
|
|
8273
8361
|
const sanitizedSearchText = sanitize(_trimInstanceProperty__default["default"](searchText).call(searchText, searchText));
|
|
8274
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
8275
|
-
const keyQuery =
|
|
8362
|
+
const idQuery = isUUID(sanitizedSearchText) && "id = \"".concat(sanitizedSearchText, "\"");
|
|
8363
|
+
const keyQuery = "key = \"".concat(sanitizedSearchText, "\"");
|
|
8276
8364
|
const searchTextQuery = _filterInstanceProperty__default["default"](_context = [idQuery, keyQuery]).call(_context, Boolean).join(' or ');
|
|
8277
8365
|
return {
|
|
8278
8366
|
where: searchTextQuery || undefined
|
|
@@ -8295,6 +8383,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8295
8383
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8296
8384
|
const productSelectionsByFieldFetcher = useProductSelectionsByFieldFetcher(props.value, props.renderSelectInputOptionValuesByField);
|
|
8297
8385
|
const handleLoadOptions = async searchText => {
|
|
8386
|
+
var _data$productSelectio, _data$productSelectio2;
|
|
8298
8387
|
const _await$client$query = await client$1.query({
|
|
8299
8388
|
query: ProductSelectionsPickerFetcher,
|
|
8300
8389
|
variables: createQueryVariables$3({
|
|
@@ -8306,7 +8395,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8306
8395
|
fetchPolicy: 'network-only'
|
|
8307
8396
|
}),
|
|
8308
8397
|
data = _await$client$query.data;
|
|
8309
|
-
const matchedProductSelections = data
|
|
8398
|
+
const matchedProductSelections = (_data$productSelectio = data === null || data === void 0 || (_data$productSelectio2 = data.productSelections) === null || _data$productSelectio2 === void 0 ? void 0 : _data$productSelectio2.results) !== null && _data$productSelectio !== void 0 ? _data$productSelectio : [];
|
|
8310
8399
|
const updatedProductSelections = _mapInstanceProperty__default["default"](matchedProductSelections).call(matchedProductSelections, convertProductSelectionFromGraphQl);
|
|
8311
8400
|
const filteredProductSelections = _filterInstanceProperty__default["default"](updatedProductSelections).call(updatedProductSelections, ps => {
|
|
8312
8401
|
var _context2;
|
|
@@ -8322,7 +8411,8 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8322
8411
|
};
|
|
8323
8412
|
const loadOptionsDebounced = debounce__default["default"](handleLoadOptions, 500);
|
|
8324
8413
|
const onOptionClick = event => {
|
|
8325
|
-
|
|
8414
|
+
var _event$target$value;
|
|
8415
|
+
const productSelectionId = (_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.value;
|
|
8326
8416
|
const currentProductSelection = _findInstanceProperty__default["default"](productionSelectionResults).call(productionSelectionResults, productSelection => productSelection.id === productSelectionId);
|
|
8327
8417
|
props.onChange(currentProductSelection);
|
|
8328
8418
|
};
|
|
@@ -8374,11 +8464,11 @@ function ModeSelectInputOption(props) {
|
|
|
8374
8464
|
scale: "xs",
|
|
8375
8465
|
children: [jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
8376
8466
|
isBold: true,
|
|
8377
|
-
children: data
|
|
8467
|
+
children: (data === null || data === void 0 ? void 0 : data.label) || noValueFallback
|
|
8378
8468
|
}), jsxRuntime.jsxs(uiKit.Text.Detail, {
|
|
8379
|
-
children: ["Key: ", data
|
|
8469
|
+
children: ["Key: ", (data === null || data === void 0 ? void 0 : data.key) || noValueFallback]
|
|
8380
8470
|
}), jsxRuntime.jsxs(uiKit.Text.Detail, {
|
|
8381
|
-
children: ["Type: ", data
|
|
8471
|
+
children: ["Type: ", (data === null || data === void 0 ? void 0 : data.mode) || noValueFallback]
|
|
8382
8472
|
})]
|
|
8383
8473
|
})
|
|
8384
8474
|
}));
|
|
@@ -8479,7 +8569,8 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8479
8569
|
var _context2;
|
|
8480
8570
|
const intl = reactIntl.useIntl();
|
|
8481
8571
|
const handleLoadOptions = async searchTerm => {
|
|
8482
|
-
|
|
8572
|
+
var _props$options, _props$options2;
|
|
8573
|
+
const filteredOptions = (_props$options = props.options) === null || _props$options === void 0 ? void 0 : _filterInstanceProperty__default["default"](_props$options).call(_props$options, country => {
|
|
8483
8574
|
var _context;
|
|
8484
8575
|
return _includesInstanceProperty__default["default"](_context = country.label.toLowerCase()).call(_context, searchTerm.toLowerCase());
|
|
8485
8576
|
});
|
|
@@ -8487,7 +8578,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8487
8578
|
return _sliceInstanceProperty__default["default"](filteredOptions).call(filteredOptions, 0, props.countriesAsyncLoadingLimit);
|
|
8488
8579
|
}
|
|
8489
8580
|
return [{
|
|
8490
|
-
options: props.options
|
|
8581
|
+
options: (_props$options2 = props.options) === null || _props$options2 === void 0 ? void 0 : _sliceInstanceProperty__default["default"](_props$options2).call(_props$options2, 0, props.countriesAsyncLoadingLimit)
|
|
8491
8582
|
}, {
|
|
8492
8583
|
options: emptyCountryOption(intl)
|
|
8493
8584
|
}];
|
|
@@ -8496,7 +8587,10 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8496
8587
|
const countries = event.target.value;
|
|
8497
8588
|
props.onChange({
|
|
8498
8589
|
target: _objectSpread$F(_objectSpread$F({}, event.target), {}, {
|
|
8499
|
-
value: _mapInstanceProperty__default["default"](countries).call(countries, country =>
|
|
8590
|
+
value: _mapInstanceProperty__default["default"](countries).call(countries, country => {
|
|
8591
|
+
var _country$value;
|
|
8592
|
+
return (_country$value = country === null || country === void 0 ? void 0 : country.value) !== null && _country$value !== void 0 ? _country$value : country;
|
|
8593
|
+
})
|
|
8500
8594
|
})
|
|
8501
8595
|
});
|
|
8502
8596
|
};
|
|
@@ -8526,7 +8620,8 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8526
8620
|
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; }
|
|
8527
8621
|
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; }
|
|
8528
8622
|
function CountriesPicker(props) {
|
|
8529
|
-
|
|
8623
|
+
var _props$options;
|
|
8624
|
+
const CustomCountriesPicker = ((_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.length) <= props.countriesAsyncLoadingLimit ? CountriesBasicSelectDropdown : CountriesAsyncSelectDropdown;
|
|
8530
8625
|
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
8531
8626
|
children: jsxRuntime.jsx(CustomCountriesPicker, _objectSpread$E({}, props))
|
|
8532
8627
|
});
|
|
@@ -8555,6 +8650,7 @@ var GetCustomerGroupsQuery = { kind: "Document", definitions: [{ kind: "Operatio
|
|
|
8555
8650
|
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 } } } };
|
|
8556
8651
|
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 } } } };
|
|
8557
8652
|
const CustomerGroupPickerInput = _ref => {
|
|
8653
|
+
var _currentOption$data$l, _currentOption$data;
|
|
8558
8654
|
let isClearable = _ref.isClearable,
|
|
8559
8655
|
isDisabled = _ref.isDisabled,
|
|
8560
8656
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -8623,13 +8719,13 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
8623
8719
|
setLoadingError(null);
|
|
8624
8720
|
handleInternalInputChange(event);
|
|
8625
8721
|
}, [handleInternalInputChange]);
|
|
8626
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
8722
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption === null || currentOption === void 0 ? void 0 : currentOption.error);
|
|
8627
8723
|
React.useEffect(() => {
|
|
8628
8724
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
8629
8725
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
8630
8726
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
8631
8727
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$t.noCustomerGroupsFound), [loadingError, formatMessage]);
|
|
8632
|
-
const tooltipTitle = currentOption
|
|
8728
|
+
const tooltipTitle = (_currentOption$data$l = currentOption === null || currentOption === void 0 || (_currentOption$data = currentOption.data) === null || _currentOption$data === void 0 ? void 0 : _currentOption$data.label) !== null && _currentOption$data$l !== void 0 ? _currentOption$data$l : '';
|
|
8633
8729
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
8634
8730
|
max: "scale",
|
|
8635
8731
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -8639,7 +8735,7 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
8639
8735
|
children: jsxRuntime.jsx(uiKit.AsyncSelectInput, {
|
|
8640
8736
|
id: name,
|
|
8641
8737
|
name: name,
|
|
8642
|
-
placeholder: placeholder
|
|
8738
|
+
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : formatMessage(messages$t.placeholder),
|
|
8643
8739
|
loadOptions: loadOptionsDebounced,
|
|
8644
8740
|
defaultOptions: true,
|
|
8645
8741
|
showOptionGroupDivider: true,
|
|
@@ -8668,11 +8764,12 @@ CustomerGroupPickerInput.displayName = 'CustomerGroupPickerInput';
|
|
|
8668
8764
|
const DEFAULT_LENGTH = 50;
|
|
8669
8765
|
const DEFAULT_END = '...';
|
|
8670
8766
|
function truncate (text) {
|
|
8767
|
+
var _context;
|
|
8671
8768
|
let length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_LENGTH;
|
|
8672
8769
|
let end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_END;
|
|
8673
8770
|
if (!text) return '';
|
|
8674
8771
|
if (text.length < length) return text;
|
|
8675
|
-
return
|
|
8772
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(text.substring(0, length))).call(_context, end);
|
|
8676
8773
|
}
|
|
8677
8774
|
|
|
8678
8775
|
const LOWER_STORES_LIMIT = 60;
|
|
@@ -8680,6 +8777,7 @@ const UPPER_STORES_LIMIT = 500;
|
|
|
8680
8777
|
|
|
8681
8778
|
// map store to options
|
|
8682
8779
|
const mapStoresToOptions = _ref => {
|
|
8780
|
+
var _store$productSelecti;
|
|
8683
8781
|
let store = _ref.store,
|
|
8684
8782
|
renderSelectInputOptionValuesByField = _ref.renderSelectInputOptionValuesByField,
|
|
8685
8783
|
dataLocale = _ref.dataLocale;
|
|
@@ -8690,14 +8788,14 @@ const mapStoresToOptions = _ref => {
|
|
|
8690
8788
|
const localizedName = l10n.formatLocalizedString(convertedStore, {
|
|
8691
8789
|
key: 'name',
|
|
8692
8790
|
locale: dataLocale,
|
|
8693
|
-
fallback:
|
|
8791
|
+
fallback: "".concat(store.key, " (key)")
|
|
8694
8792
|
});
|
|
8695
8793
|
return {
|
|
8696
8794
|
label: localizedName,
|
|
8697
8795
|
value: renderSelectInputOptionValuesByField === 'key' ? store.key : store.id,
|
|
8698
8796
|
key: store.key,
|
|
8699
8797
|
id: store.id,
|
|
8700
|
-
productSelections: store.productSelections
|
|
8798
|
+
productSelections: (_store$productSelecti = store.productSelections) === null || _store$productSelecti === void 0 ? void 0 : _mapInstanceProperty__default["default"](_store$productSelecti).call(_store$productSelecti, productSelectionRef => productSelectionRef.productSelection.id)
|
|
8701
8799
|
};
|
|
8702
8800
|
};
|
|
8703
8801
|
|
|
@@ -8764,7 +8862,7 @@ const getValueFromOptions$1 = _ref => {
|
|
|
8764
8862
|
isMulti = _ref.isMulti;
|
|
8765
8863
|
// handle async-select-field value transformation
|
|
8766
8864
|
if (isMulti) {
|
|
8767
|
-
return _filterInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores
|
|
8865
|
+
return _filterInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores === null || currentlySelectedStores === void 0 ? void 0 : _includesInstanceProperty__default["default"](currentlySelectedStores).call(currentlySelectedStores, store.value));
|
|
8768
8866
|
}
|
|
8769
8867
|
|
|
8770
8868
|
// return value as undefined if no options is yet selected. It is needed for cases where users sets initial values as empty string
|
|
@@ -8793,13 +8891,13 @@ const StoresAsyncSelectInput = props => {
|
|
|
8793
8891
|
sort: 'createdAt asc',
|
|
8794
8892
|
excludeExtendedStoresList: true,
|
|
8795
8893
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8796
|
-
stores: keysOfStores
|
|
8894
|
+
stores: (keysOfStores === null || keysOfStores === void 0 ? void 0 : keysOfStores.length) && keysOfStores,
|
|
8797
8895
|
projectKey: props.projectKey
|
|
8798
8896
|
});
|
|
8799
8897
|
const hasError = uiKit.AsyncSelectInput.isTouched(props.touched) && hasErrors$2(props.errors) || props.hasError;
|
|
8800
8898
|
const mappedStoresListOptions = React.useMemo(() => {
|
|
8801
|
-
var _context2;
|
|
8802
|
-
return _mapInstanceProperty__default["default"](_context2 = storesListFetcher.stores
|
|
8899
|
+
var _context2, _storesListFetcher$st;
|
|
8900
|
+
return _mapInstanceProperty__default["default"](_context2 = ((_storesListFetcher$st = storesListFetcher.stores) === null || _storesListFetcher$st === void 0 ? void 0 : _storesListFetcher$st.results) || []).call(_context2, store => mapStoresToOptions({
|
|
8803
8901
|
store,
|
|
8804
8902
|
dataLocale,
|
|
8805
8903
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -8895,25 +8993,26 @@ const StoresBasicSelectInput = props => {
|
|
|
8895
8993
|
sort: 'createdAt asc',
|
|
8896
8994
|
excludeExtendedStoresList: true,
|
|
8897
8995
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8898
|
-
stores: keysOfStores
|
|
8996
|
+
stores: (keysOfStores === null || keysOfStores === void 0 ? void 0 : keysOfStores.length) && keysOfStores,
|
|
8899
8997
|
projectKey: props.projectKey
|
|
8900
8998
|
});
|
|
8901
8999
|
const hasError = uiKit.SelectInput.isTouched(props.touched) && hasErrors$1(props.errors) || props.hasError;
|
|
8902
9000
|
const mappedStoresListOptions = React.useMemo(() => {
|
|
8903
|
-
var _context2;
|
|
8904
|
-
const results = _mapInstanceProperty__default["default"](_context2 = storesListFetcher.stores
|
|
9001
|
+
var _context2, _storesListFetcher$st;
|
|
9002
|
+
const results = _mapInstanceProperty__default["default"](_context2 = ((_storesListFetcher$st = storesListFetcher.stores) === null || _storesListFetcher$st === void 0 ? void 0 : _storesListFetcher$st.results) || []).call(_context2, store => mapStoresToOptions({
|
|
8905
9003
|
store,
|
|
8906
9004
|
dataLocale,
|
|
8907
9005
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
8908
9006
|
}));
|
|
8909
|
-
return props
|
|
9007
|
+
return props !== null && props !== void 0 && props.renderLabel ? [{
|
|
8910
9008
|
options: getCustomGroupLabelOption(props.renderLabel)
|
|
8911
9009
|
}, {
|
|
8912
9010
|
options: results
|
|
8913
9011
|
}] : results;
|
|
8914
|
-
}, [dataLocale, storesListFetcher.stores, props.renderSelectInputOptionValuesByField, props
|
|
9012
|
+
}, [dataLocale, storesListFetcher.stores, props.renderSelectInputOptionValuesByField, props === null || props === void 0 ? void 0 : props.renderLabel]);
|
|
8915
9013
|
const handleChange = event => {
|
|
8916
|
-
|
|
9014
|
+
var _event$target$value$v, _event$target$value;
|
|
9015
|
+
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;
|
|
8917
9016
|
const currentStore = _findInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => store.value === value);
|
|
8918
9017
|
|
|
8919
9018
|
// We need complete store info including productSelections
|
|
@@ -8971,6 +9070,7 @@ StoresBasicSelectInput.defaultProps = {
|
|
|
8971
9070
|
|
|
8972
9071
|
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 } } } };
|
|
8973
9072
|
const useTotalNumberOfStoresFetcher = projectKey => {
|
|
9073
|
+
var _totalNumberOfStoresQ;
|
|
8974
9074
|
const totalNumberOfStoresQuery = react.useQuery(TotalNumberOfStores, {
|
|
8975
9075
|
context: {
|
|
8976
9076
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM,
|
|
@@ -8979,7 +9079,7 @@ const useTotalNumberOfStoresFetcher = projectKey => {
|
|
|
8979
9079
|
fetchPolicy: 'network-only'
|
|
8980
9080
|
});
|
|
8981
9081
|
return {
|
|
8982
|
-
total: totalNumberOfStoresQuery.data
|
|
9082
|
+
total: (_totalNumberOfStoresQ = totalNumberOfStoresQuery.data) === null || _totalNumberOfStoresQ === void 0 ? void 0 : _totalNumberOfStoresQ.totalNumberOfStores.total,
|
|
8983
9083
|
isLoading: totalNumberOfStoresQuery.loading
|
|
8984
9084
|
};
|
|
8985
9085
|
};
|
|
@@ -8997,15 +9097,19 @@ const handlers$1 = {
|
|
|
8997
9097
|
};
|
|
8998
9098
|
|
|
8999
9099
|
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 } } } };
|
|
9000
|
-
const createQueryVariables$2 = (stores, predicateField, shouldFetchProductSelections) =>
|
|
9001
|
-
|
|
9002
|
-
|
|
9003
|
-
|
|
9004
|
-
|
|
9100
|
+
const createQueryVariables$2 = (stores, predicateField, shouldFetchProductSelections) => {
|
|
9101
|
+
var _context;
|
|
9102
|
+
return {
|
|
9103
|
+
where: _concatInstanceProperty__default["default"](_context = "".concat(predicateField, " in (")).call(_context, _mapInstanceProperty__default["default"](stores).call(stores, store => "\"".concat(store, "\"")).join(', '), ")"),
|
|
9104
|
+
limit: 500,
|
|
9105
|
+
excludeProductSelections: !shouldFetchProductSelections
|
|
9106
|
+
};
|
|
9107
|
+
};
|
|
9005
9108
|
const emptyStoresQueryResult = {
|
|
9006
9109
|
results: []
|
|
9007
9110
|
};
|
|
9008
9111
|
const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
9112
|
+
var _storesQuery$data;
|
|
9009
9113
|
let shouldFetchProductSelections = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
9010
9114
|
// incase of single select input stores are sent as single string literal
|
|
9011
9115
|
const storesList = _Array$isArray__default["default"](stores) ? stores : [stores];
|
|
@@ -9018,13 +9122,13 @@ const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
|
9018
9122
|
skip: storesList.length === 0
|
|
9019
9123
|
});
|
|
9020
9124
|
return {
|
|
9021
|
-
stores: storesQuery.data
|
|
9125
|
+
stores: ((_storesQuery$data = storesQuery.data) === null || _storesQuery$data === void 0 ? void 0 : _storesQuery$data.storesByField) || emptyStoresQueryResult,
|
|
9022
9126
|
isLoading: storesQuery.loading
|
|
9023
9127
|
};
|
|
9024
9128
|
};
|
|
9025
9129
|
|
|
9026
9130
|
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; }
|
|
9027
|
-
function _objectSpread$B(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
9131
|
+
function _objectSpread$B(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context6 = ownKeys$B(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context7 = ownKeys$B(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
9028
9132
|
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 } } } };
|
|
9029
9133
|
var styles$c = {
|
|
9030
9134
|
"renderLabelContainer": "stores-search-selector-module__renderLabelContainer___3_PBc",
|
|
@@ -9035,16 +9139,16 @@ const hasErrors = errors => {
|
|
|
9035
9139
|
return errors && _someInstanceProperty__default["default"](_context = _Object$values__default["default"](errors)).call(_context, Boolean);
|
|
9036
9140
|
};
|
|
9037
9141
|
const createQueryVariables$1 = _ref => {
|
|
9038
|
-
var _context2;
|
|
9142
|
+
var _context2, _context3;
|
|
9039
9143
|
let searchText = _ref.searchText,
|
|
9040
9144
|
dataLocale = _ref.dataLocale,
|
|
9041
9145
|
allAccessibleStoreKeysThroughDataFencePermissions = _ref.allAccessibleStoreKeysThroughDataFencePermissions,
|
|
9042
9146
|
shouldFetchProductSelections = _ref.shouldFetchProductSelections;
|
|
9043
9147
|
const sanitizedSearchText = sanitize(_trimInstanceProperty__default["default"](searchText).call(searchText, searchText));
|
|
9044
|
-
const keyQuery =
|
|
9148
|
+
const keyQuery = "key = \"".concat(sanitizedSearchText, "\"");
|
|
9045
9149
|
|
|
9046
9150
|
// if the user has data fence permissions then we only allow stores to fetched that user has access to
|
|
9047
|
-
if (allAccessibleStoreKeysThroughDataFencePermissions
|
|
9151
|
+
if (allAccessibleStoreKeysThroughDataFencePermissions !== null && allAccessibleStoreKeysThroughDataFencePermissions !== void 0 && allAccessibleStoreKeysThroughDataFencePermissions.length) {
|
|
9048
9152
|
// if the current search term match the accessible stores keys, then proceed with fetching the store
|
|
9049
9153
|
if (_includesInstanceProperty__default["default"](allAccessibleStoreKeysThroughDataFencePermissions).call(allAccessibleStoreKeysThroughDataFencePermissions, sanitizedSearchText)) {
|
|
9050
9154
|
return {
|
|
@@ -9060,9 +9164,9 @@ const createQueryVariables$1 = _ref => {
|
|
|
9060
9164
|
excludeProductSelections: !shouldFetchProductSelections
|
|
9061
9165
|
};
|
|
9062
9166
|
}
|
|
9063
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
9064
|
-
const nameQuery =
|
|
9065
|
-
const searchTextQuery = _filterInstanceProperty__default["default"](
|
|
9167
|
+
const idQuery = isUUID(sanitizedSearchText) && "id = \"".concat(sanitizedSearchText, "\"");
|
|
9168
|
+
const nameQuery = _concatInstanceProperty__default["default"](_context2 = "name(".concat(dataLocale, " = \"")).call(_context2, sanitizedSearchText, "\")");
|
|
9169
|
+
const searchTextQuery = _filterInstanceProperty__default["default"](_context3 = [idQuery, nameQuery, keyQuery]).call(_context3, Boolean).join(' or ');
|
|
9066
9170
|
return {
|
|
9067
9171
|
skipFetchingStores: false,
|
|
9068
9172
|
where: searchTextQuery,
|
|
@@ -9070,6 +9174,7 @@ const createQueryVariables$1 = _ref => {
|
|
|
9070
9174
|
};
|
|
9071
9175
|
};
|
|
9072
9176
|
const getValueFromOptions = _ref2 => {
|
|
9177
|
+
var _storesByFieldFetcher, _context4;
|
|
9073
9178
|
let isMulti = _ref2.isMulti,
|
|
9074
9179
|
value = _ref2.value,
|
|
9075
9180
|
dataLocale = _ref2.dataLocale,
|
|
@@ -9078,7 +9183,7 @@ const getValueFromOptions = _ref2 => {
|
|
|
9078
9183
|
if (!value) {
|
|
9079
9184
|
return undefined;
|
|
9080
9185
|
}
|
|
9081
|
-
const selectedOptions = storesByFieldFetcher.stores
|
|
9186
|
+
const selectedOptions = (_storesByFieldFetcher = storesByFieldFetcher.stores) === null || _storesByFieldFetcher === void 0 ? void 0 : _mapInstanceProperty__default["default"](_context4 = _storesByFieldFetcher.results).call(_context4, store => mapStoresToOptions({
|
|
9082
9187
|
store,
|
|
9083
9188
|
dataLocale,
|
|
9084
9189
|
renderSelectInputOptionValuesByField: renderSelectInputOptionValuesByField
|
|
@@ -9116,8 +9221,9 @@ const StoresSearchSelectInput = props => {
|
|
|
9116
9221
|
},
|
|
9117
9222
|
fetchPolicy: 'network-only'
|
|
9118
9223
|
}).then(_ref3 => {
|
|
9224
|
+
var _data$storesByWherePr, _context5;
|
|
9119
9225
|
let data = _ref3.data;
|
|
9120
|
-
const result = data.storesByWherePredicate
|
|
9226
|
+
const result = (_data$storesByWherePr = data.storesByWherePredicate) === null || _data$storesByWherePr === void 0 ? void 0 : _mapInstanceProperty__default["default"](_context5 = _data$storesByWherePr.results).call(_context5, store => mapStoresToOptions({
|
|
9121
9227
|
store,
|
|
9122
9228
|
dataLocale,
|
|
9123
9229
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -9138,7 +9244,7 @@ const StoresSearchSelectInput = props => {
|
|
|
9138
9244
|
className: styles$c.renderLabelContainer,
|
|
9139
9245
|
children: [jsxRuntime.jsx("div", {
|
|
9140
9246
|
className: styles$c.customLabel,
|
|
9141
|
-
children: props
|
|
9247
|
+
children: (props === null || props === void 0 ? void 0 : props.renderLabel) && (props === null || props === void 0 ? void 0 : props.renderLabel)
|
|
9142
9248
|
}), jsxRuntime.jsx("div", {
|
|
9143
9249
|
children: intl.formatMessage(inputValue ? messages$s.searchSelectInputNoOptionsFoundMessage : messages$s.searchSelectInputNoValueMessage)
|
|
9144
9250
|
})]
|
|
@@ -9317,14 +9423,14 @@ var messages$r = reactIntl.defineMessages({
|
|
|
9317
9423
|
|
|
9318
9424
|
function formatDiscount(discount, currencyCode, intl) {
|
|
9319
9425
|
var _context;
|
|
9320
|
-
if (discount.type === 'relative') return
|
|
9426
|
+
if (discount.type === 'relative') return "".concat(discount.permyriad / 100, "%");
|
|
9321
9427
|
if (!discount.money) return null;
|
|
9322
9428
|
const moneyForCurrencyCode = _findInstanceProperty__default["default"](_context = discount.money).call(_context, discountMoney => discountMoney.currencyCode === currencyCode);
|
|
9323
9429
|
return moneyForCurrencyCode ? formatMoney$2(moneyForCurrencyCode, intl) : null;
|
|
9324
9430
|
}
|
|
9325
9431
|
|
|
9326
9432
|
function formatPercentage(percentage) {
|
|
9327
|
-
return
|
|
9433
|
+
return "".concat(percentage, "%");
|
|
9328
9434
|
}
|
|
9329
9435
|
function convertRatioToPercentage(ratio) {
|
|
9330
9436
|
return _parseFloat__default["default"]((ratio * 100).toFixed(2));
|
|
@@ -9378,8 +9484,8 @@ function validateFilter$2(_ref, intl) {
|
|
|
9378
9484
|
};
|
|
9379
9485
|
}
|
|
9380
9486
|
if (value.option === FILTER_TYPES.range) {
|
|
9381
|
-
const from = validateValue(filterValue
|
|
9382
|
-
const to = from ? null : validateValue(filterValue
|
|
9487
|
+
const from = validateValue(filterValue === null || filterValue === void 0 ? void 0 : filterValue.from, typeName, intl);
|
|
9488
|
+
const to = from ? null : validateValue(filterValue === null || filterValue === void 0 ? void 0 : filterValue.to, typeName, intl);
|
|
9383
9489
|
return from || to ? {
|
|
9384
9490
|
input: {
|
|
9385
9491
|
from,
|
|
@@ -9416,16 +9522,16 @@ function validateFilter$1(_ref, intl) {
|
|
|
9416
9522
|
type = _ref.type;
|
|
9417
9523
|
if (type === 'range') {
|
|
9418
9524
|
if (validateSingleFilter({
|
|
9419
|
-
value: value
|
|
9525
|
+
value: value === null || value === void 0 ? void 0 : value.from
|
|
9420
9526
|
})) return {
|
|
9421
9527
|
from: intl.formatMessage(messages$p.rangeMissingValue)
|
|
9422
9528
|
};
|
|
9423
9529
|
if (validateSingleFilter({
|
|
9424
|
-
value: value
|
|
9530
|
+
value: value === null || value === void 0 ? void 0 : value.to
|
|
9425
9531
|
})) return {
|
|
9426
9532
|
to: intl.formatMessage(messages$p.rangeMissingValue)
|
|
9427
9533
|
};
|
|
9428
|
-
if (moment__default$1["default"](value
|
|
9534
|
+
if (moment__default$1["default"](value === null || value === void 0 ? void 0 : value.to).isBefore(value === null || value === void 0 ? void 0 : value.from)) return {
|
|
9429
9535
|
from: intl.formatMessage(messages$p.rangeToSmallerThanFrom)
|
|
9430
9536
|
};
|
|
9431
9537
|
} else if (type === 'equalTo' || type === 'lessThan' || type === 'moreThan') {
|
|
@@ -9495,8 +9601,10 @@ function isEmptyFilter(_ref) {
|
|
|
9495
9601
|
}
|
|
9496
9602
|
|
|
9497
9603
|
function numberTransformer(filterKey, filters) {
|
|
9604
|
+
var _context3;
|
|
9498
9605
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$2;
|
|
9499
9606
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
9607
|
+
var _context, _context2;
|
|
9500
9608
|
let type = _ref.type,
|
|
9501
9609
|
value = _ref.value;
|
|
9502
9610
|
if (!filterValidator({
|
|
@@ -9505,19 +9613,19 @@ function numberTransformer(filterKey, filters) {
|
|
|
9505
9613
|
})) return '';
|
|
9506
9614
|
switch (type) {
|
|
9507
9615
|
case 'lessThan':
|
|
9508
|
-
return
|
|
9616
|
+
return "(* to ".concat(_parseInt__default["default"](value) - 1, ")");
|
|
9509
9617
|
case 'moreThan':
|
|
9510
|
-
return
|
|
9618
|
+
return "(".concat(_parseInt__default["default"](value) + 1, " to *)");
|
|
9511
9619
|
case 'equalTo':
|
|
9512
|
-
return
|
|
9620
|
+
return _concatInstanceProperty__default["default"](_context = "(".concat(value, " to ")).call(_context, value, ")");
|
|
9513
9621
|
case 'range':
|
|
9514
|
-
return
|
|
9622
|
+
return _concatInstanceProperty__default["default"](_context2 = "(".concat(value.from, " to ")).call(_context2, value.to, ")");
|
|
9515
9623
|
default:
|
|
9516
9624
|
return '';
|
|
9517
9625
|
}
|
|
9518
9626
|
});
|
|
9519
9627
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
9520
|
-
return queryString === '' ? null :
|
|
9628
|
+
return queryString === '' ? null : _concatInstanceProperty__default["default"](_context3 = "".concat(filterKey, ": range")).call(_context3, queryString);
|
|
9521
9629
|
}
|
|
9522
9630
|
function isFilterValid$2(_ref2) {
|
|
9523
9631
|
let type = _ref2.type,
|
|
@@ -9544,9 +9652,11 @@ function graphqlCategoryLevelTransformer(filterKey, filters, filterValidator) {
|
|
|
9544
9652
|
return _filterInstanceProperty__default["default"](_context = [levelFilterQuery, lastLevelFilterQuery]).call(_context, Boolean);
|
|
9545
9653
|
}
|
|
9546
9654
|
|
|
9655
|
+
var _templateObject$1, _templateObject2;
|
|
9547
9656
|
const dateFormatDayStart = 'YYYY-MM-DDT00:00:00.000Z';
|
|
9548
9657
|
const dateFormatDayEnd = 'YYYY-MM-DDT23:59:59.999Z';
|
|
9549
9658
|
function dateTransformer(filterKey, filters) {
|
|
9659
|
+
var _context;
|
|
9550
9660
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$1;
|
|
9551
9661
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
9552
9662
|
let type = _ref.type,
|
|
@@ -9557,25 +9667,19 @@ function dateTransformer(filterKey, filters) {
|
|
|
9557
9667
|
})) return '';
|
|
9558
9668
|
switch (type) {
|
|
9559
9669
|
case 'lessThan':
|
|
9560
|
-
return
|
|
9670
|
+
return "(* to \"".concat(moment__default$1["default"](value).format(dateFormatDayStart), "\")");
|
|
9561
9671
|
case 'moreThan':
|
|
9562
|
-
return
|
|
9672
|
+
return "(\"".concat(moment__default$1["default"](value).format(dateFormatDayEnd), "\" to *)");
|
|
9563
9673
|
case 'equalTo':
|
|
9564
|
-
return oneLine__default["default"]
|
|
9565
|
-
("${moment__default$1["default"](value).format(dateFormatDayStart)}"
|
|
9566
|
-
to "${moment__default$1["default"](value).format(dateFormatDayEnd)}")
|
|
9567
|
-
`;
|
|
9674
|
+
return oneLine__default["default"](_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n (\"", "\"\n to \"", "\")\n "])), moment__default$1["default"](value).format(dateFormatDayStart), moment__default$1["default"](value).format(dateFormatDayEnd));
|
|
9568
9675
|
case 'range':
|
|
9569
|
-
return oneLine__default["default"]
|
|
9570
|
-
("${moment__default$1["default"](value.from).format(dateFormatDayStart)}"
|
|
9571
|
-
to "${moment__default$1["default"](value.to).format(dateFormatDayEnd)}")
|
|
9572
|
-
`;
|
|
9676
|
+
return oneLine__default["default"](_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n (\"", "\"\n to \"", "\")\n "])), moment__default$1["default"](value.from).format(dateFormatDayStart), moment__default$1["default"](value.to).format(dateFormatDayEnd));
|
|
9573
9677
|
default:
|
|
9574
9678
|
return '';
|
|
9575
9679
|
}
|
|
9576
9680
|
});
|
|
9577
9681
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
9578
|
-
return queryString === '' ? null :
|
|
9682
|
+
return queryString === '' ? null : _concatInstanceProperty__default["default"](_context = "".concat(filterKey, ": range")).call(_context, queryString);
|
|
9579
9683
|
}
|
|
9580
9684
|
function isFilterValid$1(_ref2) {
|
|
9581
9685
|
let type = _ref2.type,
|
|
@@ -9590,18 +9694,19 @@ function isFilterValid$1(_ref2) {
|
|
|
9590
9694
|
}
|
|
9591
9695
|
|
|
9592
9696
|
function missingLocaleTransformer(filterKey, filters) {
|
|
9697
|
+
var _context;
|
|
9593
9698
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
9594
9699
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
9595
9700
|
if (filters.length === 0) return null;
|
|
9596
9701
|
const missingLocale = filters[0].value.value;
|
|
9597
|
-
return
|
|
9702
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(filterKey, ".")).call(_context, missingLocale, ":missing");
|
|
9598
9703
|
}
|
|
9599
9704
|
|
|
9600
9705
|
function missingTransformer(filterKey, filters) {
|
|
9601
9706
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
9602
9707
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
9603
9708
|
if (filters.length === 0) return null;
|
|
9604
|
-
return
|
|
9709
|
+
return "".concat(filterKey, ":missing");
|
|
9605
9710
|
}
|
|
9606
9711
|
|
|
9607
9712
|
/**
|
|
@@ -9642,6 +9747,7 @@ function graphqlQueryBuilder(_ref) {
|
|
|
9642
9747
|
}
|
|
9643
9748
|
|
|
9644
9749
|
function referenceTransformer(filterKey, filters) {
|
|
9750
|
+
var _context;
|
|
9645
9751
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid;
|
|
9646
9752
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
9647
9753
|
let type = _ref.type,
|
|
@@ -9652,46 +9758,49 @@ function referenceTransformer(filterKey, filters) {
|
|
|
9652
9758
|
})) return '';
|
|
9653
9759
|
switch (type) {
|
|
9654
9760
|
case 'equalTo':
|
|
9655
|
-
return
|
|
9761
|
+
return "\"".concat(value, "\"");
|
|
9656
9762
|
default:
|
|
9657
9763
|
return '';
|
|
9658
9764
|
}
|
|
9659
9765
|
});
|
|
9660
9766
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
9661
|
-
return queryString === '' ? null :
|
|
9767
|
+
return queryString === '' ? null : _concatInstanceProperty__default["default"](_context = "".concat(filterKey, ".id: ")).call(_context, queryString);
|
|
9662
9768
|
}
|
|
9663
9769
|
function isFilterValid(_ref2) {
|
|
9664
|
-
var
|
|
9770
|
+
var _context2;
|
|
9665
9771
|
let type = _ref2.type,
|
|
9666
9772
|
value = _ref2.value;
|
|
9667
|
-
if (type === 'equalTo' && !_includesInstanceProperty__default["default"](
|
|
9773
|
+
if (type === 'equalTo' && !_includesInstanceProperty__default["default"](_context2 = [null, undefined, '']).call(_context2, value)) return true;
|
|
9668
9774
|
return false;
|
|
9669
9775
|
}
|
|
9670
9776
|
|
|
9671
9777
|
function textTransformer(filterKey, queries) {
|
|
9778
|
+
var _context;
|
|
9672
9779
|
if (queries.length === 0) return null;
|
|
9673
9780
|
|
|
9674
9781
|
// Note: we assume for now that there can only be 1 text filter.
|
|
9675
9782
|
const queryValue = queries[0].value;
|
|
9676
|
-
return queryValue ?
|
|
9783
|
+
return queryValue ? _concatInstanceProperty__default["default"](_context = "".concat(filterKey, ":\"")).call(_context, queryValue, "\"") : null;
|
|
9677
9784
|
}
|
|
9678
9785
|
|
|
9679
9786
|
const composeNumberPredicateFromFilter = (target, value, option) => {
|
|
9787
|
+
var _context, _context2, _context3, _context4, _context5, _context6;
|
|
9680
9788
|
switch (option) {
|
|
9681
9789
|
case FILTER_TYPES.lessThan:
|
|
9682
|
-
return
|
|
9790
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(target, " < ")).call(_context, value);
|
|
9683
9791
|
case FILTER_TYPES.moreThan:
|
|
9684
|
-
return
|
|
9792
|
+
return _concatInstanceProperty__default["default"](_context2 = "".concat(target, " > ")).call(_context2, value);
|
|
9685
9793
|
case FILTER_TYPES.equalTo:
|
|
9686
|
-
return
|
|
9794
|
+
return _concatInstanceProperty__default["default"](_context3 = "".concat(target, " = ")).call(_context3, value);
|
|
9687
9795
|
case FILTER_TYPES.range:
|
|
9688
|
-
return
|
|
9796
|
+
return _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = _concatInstanceProperty__default["default"](_context6 = "".concat(target, " >= ")).call(_context6, value.from, " and ")).call(_context5, target, " <= ")).call(_context4, value.to);
|
|
9689
9797
|
default:
|
|
9690
9798
|
return '';
|
|
9691
9799
|
}
|
|
9692
9800
|
};
|
|
9693
9801
|
function customFields (filter, locale) {
|
|
9694
9802
|
const customFieldsPredicates = _mapInstanceProperty__default["default"](filter).call(filter, customFieldFilter => {
|
|
9803
|
+
var _context7, _context8, _context9, _context10, _context11;
|
|
9695
9804
|
const _customFieldFilter$va = customFieldFilter.value,
|
|
9696
9805
|
target = _customFieldFilter$va.target,
|
|
9697
9806
|
type = _customFieldFilter$va.type,
|
|
@@ -9699,14 +9808,14 @@ function customFields (filter, locale) {
|
|
|
9699
9808
|
option = _customFieldFilter$va.option;
|
|
9700
9809
|
switch (type.name) {
|
|
9701
9810
|
case FIELD_TYPES.Boolean:
|
|
9702
|
-
return
|
|
9811
|
+
return _concatInstanceProperty__default["default"](_context7 = "".concat(target, " = ")).call(_context7, value.value);
|
|
9703
9812
|
case FIELD_TYPES.String:
|
|
9704
|
-
return
|
|
9813
|
+
return _concatInstanceProperty__default["default"](_context8 = "".concat(target, " = \"")).call(_context8, value, "\"");
|
|
9705
9814
|
case FIELD_TYPES.LocalizedString:
|
|
9706
|
-
return
|
|
9815
|
+
return _concatInstanceProperty__default["default"](_context9 = "".concat(target, "(")).call(_context9, localizedTextTransformer(value), ")");
|
|
9707
9816
|
case FIELD_TYPES.Enum:
|
|
9708
9817
|
case FIELD_TYPES.LocalizedEnum:
|
|
9709
|
-
return
|
|
9818
|
+
return _concatInstanceProperty__default["default"](_context10 = "".concat(target, " = \"")).call(_context10, value.value, "\"");
|
|
9710
9819
|
case FIELD_TYPES.Time:
|
|
9711
9820
|
return timeTransformer(target, [{
|
|
9712
9821
|
type: option,
|
|
@@ -9721,14 +9830,14 @@ function customFields (filter, locale) {
|
|
|
9721
9830
|
case FIELD_TYPES.Number:
|
|
9722
9831
|
return composeNumberPredicateFromFilter(target, value, option);
|
|
9723
9832
|
case FIELD_TYPES.Money:
|
|
9724
|
-
return
|
|
9833
|
+
return _concatInstanceProperty__default["default"](_context11 = "".concat(target, "(")).call(_context11, moneyTransformer(value, option, locale), ")");
|
|
9725
9834
|
case FIELD_TYPES.Reference:
|
|
9726
9835
|
case FIELD_TYPES.Set:
|
|
9727
9836
|
default:
|
|
9728
9837
|
throw new Error('Custom field type not recognized');
|
|
9729
9838
|
}
|
|
9730
9839
|
});
|
|
9731
|
-
return
|
|
9840
|
+
return "(custom(fields(".concat(customFieldsPredicates.join(' and '), ")))");
|
|
9732
9841
|
}
|
|
9733
9842
|
|
|
9734
9843
|
// https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/btoa#Unicode_strings
|
|
@@ -9773,7 +9882,7 @@ function ownKeys$z(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
9773
9882
|
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; }
|
|
9774
9883
|
const resourcesWithPlatformLimits = _Object$keys__default["default"](RESOURCES_WITH_PLATFORM_LIMITS);
|
|
9775
9884
|
const createQueryVariables = platformLimit => _reduceInstanceProperty__default["default"](resourcesWithPlatformLimits).call(resourcesWithPlatformLimits, (previousIncludedLimits, nextNameOfLimit) => _objectSpread$z({
|
|
9776
|
-
[camelCase__default["default"](
|
|
9885
|
+
[camelCase__default["default"]("should include ".concat(nextNameOfLimit))]: platformLimit ? nextNameOfLimit === platformLimit : true
|
|
9777
9886
|
}, previousIncludedLimits), {});
|
|
9778
9887
|
|
|
9779
9888
|
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 } } } };
|
|
@@ -9789,7 +9898,7 @@ const usePlatformLimitsFetcher = platformLimit => {
|
|
|
9789
9898
|
error = _useQuery.error,
|
|
9790
9899
|
data = _useQuery.data,
|
|
9791
9900
|
refetch = _useQuery.refetch;
|
|
9792
|
-
const platformLimits = !loading ? omit__default["default"](data
|
|
9901
|
+
const platformLimits = !loading ? omit__default["default"](data === null || data === void 0 ? void 0 : data.limits, '__typename') : {};
|
|
9793
9902
|
return {
|
|
9794
9903
|
isLoading: loading,
|
|
9795
9904
|
error,
|
|
@@ -9980,10 +10089,11 @@ const getPlatformLimitsStatus = _ref3 => {
|
|
|
9980
10089
|
total = _ref3.total,
|
|
9981
10090
|
intl = _ref3.intl;
|
|
9982
10091
|
if (limit) {
|
|
9983
|
-
|
|
10092
|
+
var _context;
|
|
10093
|
+
return _concatInstanceProperty__default["default"](_context = "(".concat(intl.formatNumber(current), "/")).call(_context, intl.formatNumber(limit), ")");
|
|
9984
10094
|
}
|
|
9985
10095
|
if (total) {
|
|
9986
|
-
return
|
|
10096
|
+
return "(".concat(intl.formatNumber(total), ")");
|
|
9987
10097
|
}
|
|
9988
10098
|
return '';
|
|
9989
10099
|
};
|
|
@@ -10003,17 +10113,18 @@ const useShippingMethodsPlatformLimitsFetcher = () => {
|
|
|
10003
10113
|
};
|
|
10004
10114
|
|
|
10005
10115
|
const useShippingMethodsPlatformLimits = () => {
|
|
10116
|
+
var _platformLimits$shipp;
|
|
10006
10117
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
10007
10118
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
10008
|
-
if (!platformLimits
|
|
10119
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$shipp = platformLimits.shippingMethods) !== null && _platformLimits$shipp !== void 0 && _platformLimits$shipp.total)) {
|
|
10009
10120
|
return {
|
|
10010
10121
|
hasReachedShippingMethodsWarningLimit: false,
|
|
10011
10122
|
hasReachedShippingMethodsErrorLimit: false
|
|
10012
10123
|
};
|
|
10013
10124
|
}
|
|
10014
|
-
const _platformLimits$
|
|
10015
|
-
limit = _platformLimits$
|
|
10016
|
-
current = _platformLimits$
|
|
10125
|
+
const _platformLimits$shipp2 = platformLimits.shippingMethods.total,
|
|
10126
|
+
limit = _platformLimits$shipp2.limit,
|
|
10127
|
+
current = _platformLimits$shipp2.current;
|
|
10017
10128
|
const hasReachedShippingMethodsWarningLimit = getHasExceededWarningThreshold({
|
|
10018
10129
|
limit,
|
|
10019
10130
|
current
|
|
@@ -10029,12 +10140,13 @@ const useShippingMethodsPlatformLimits = () => {
|
|
|
10029
10140
|
};
|
|
10030
10141
|
|
|
10031
10142
|
const PlatformLimitsShippingMethodsNotifications = () => {
|
|
10143
|
+
var _platformLimits$shipp;
|
|
10032
10144
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
10033
10145
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
10034
10146
|
const _useShippingMethodsPl2 = useShippingMethodsPlatformLimits(),
|
|
10035
10147
|
hasReachedShippingMethodsWarningLimit = _useShippingMethodsPl2.hasReachedShippingMethodsWarningLimit,
|
|
10036
10148
|
hasReachedShippingMethodsErrorLimit = _useShippingMethodsPl2.hasReachedShippingMethodsErrorLimit;
|
|
10037
|
-
if (!platformLimits
|
|
10149
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$shipp = platformLimits.shippingMethods) !== null && _platformLimits$shipp !== void 0 && _platformLimits$shipp.total)) {
|
|
10038
10150
|
return null;
|
|
10039
10151
|
}
|
|
10040
10152
|
if (hasReachedShippingMethodsErrorLimit) {
|
|
@@ -10080,12 +10192,13 @@ var messages$k = reactIntl.defineMessages({
|
|
|
10080
10192
|
});
|
|
10081
10193
|
|
|
10082
10194
|
const PlatformLimitsShippingMethodsStatus = _ref => {
|
|
10195
|
+
var _platformLimits$shipp, _platformLimits$shipp2;
|
|
10083
10196
|
let total = _ref.total;
|
|
10084
10197
|
const intl = reactIntl.useIntl();
|
|
10085
10198
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
10086
10199
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
10087
|
-
const current = platformLimits
|
|
10088
|
-
const limit = platformLimits
|
|
10200
|
+
const current = platformLimits === null || platformLimits === void 0 || (_platformLimits$shipp = platformLimits.shippingMethods) === null || _platformLimits$shipp === void 0 || (_platformLimits$shipp = _platformLimits$shipp.total) === null || _platformLimits$shipp === void 0 ? void 0 : _platformLimits$shipp.current;
|
|
10201
|
+
const limit = platformLimits === null || platformLimits === void 0 || (_platformLimits$shipp2 = platformLimits.shippingMethods) === null || _platformLimits$shipp2 === void 0 || (_platformLimits$shipp2 = _platformLimits$shipp2.total) === null || _platformLimits$shipp2 === void 0 ? void 0 : _platformLimits$shipp2.limit;
|
|
10089
10202
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
10090
10203
|
intlMessage: messages$k.shippingMethodsStatus,
|
|
10091
10204
|
children: getPlatformLimitsStatus({
|
|
@@ -10147,17 +10260,18 @@ const useTaxCategoriesPlatformLimitsFetcher = () => {
|
|
|
10147
10260
|
};
|
|
10148
10261
|
|
|
10149
10262
|
const useTaxCategoriesPlatformLimits = () => {
|
|
10263
|
+
var _platformLimits$taxCa;
|
|
10150
10264
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
10151
10265
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
10152
|
-
if (!platformLimits
|
|
10266
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$taxCa = platformLimits.taxCategories) !== null && _platformLimits$taxCa !== void 0 && _platformLimits$taxCa.total)) {
|
|
10153
10267
|
return {
|
|
10154
10268
|
hasReachedTaxCategoriesWarningLimit: false,
|
|
10155
10269
|
hasReachedTaxCategoriesErrorLimit: false
|
|
10156
10270
|
};
|
|
10157
10271
|
}
|
|
10158
|
-
const _platformLimits$
|
|
10159
|
-
limit = _platformLimits$
|
|
10160
|
-
current = _platformLimits$
|
|
10272
|
+
const _platformLimits$taxCa2 = platformLimits.taxCategories.total,
|
|
10273
|
+
limit = _platformLimits$taxCa2.limit,
|
|
10274
|
+
current = _platformLimits$taxCa2.current;
|
|
10161
10275
|
const hasReachedTaxCategoriesWarningLimit = getHasExceededWarningThreshold({
|
|
10162
10276
|
limit,
|
|
10163
10277
|
current
|
|
@@ -10173,12 +10287,13 @@ const useTaxCategoriesPlatformLimits = () => {
|
|
|
10173
10287
|
};
|
|
10174
10288
|
|
|
10175
10289
|
const PlatformLimitsTaxCategoriesNotifications = () => {
|
|
10290
|
+
var _platformLimits$taxCa;
|
|
10176
10291
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
10177
10292
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
10178
10293
|
const _useTaxCategoriesPlat2 = useTaxCategoriesPlatformLimits(),
|
|
10179
10294
|
hasReachedTaxCategoriesWarningLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesWarningLimit,
|
|
10180
10295
|
hasReachedTaxCategoriesErrorLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesErrorLimit;
|
|
10181
|
-
if (!platformLimits
|
|
10296
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$taxCa = platformLimits.taxCategories) !== null && _platformLimits$taxCa !== void 0 && _platformLimits$taxCa.total)) {
|
|
10182
10297
|
return null;
|
|
10183
10298
|
}
|
|
10184
10299
|
if (hasReachedTaxCategoriesErrorLimit) {
|
|
@@ -10224,12 +10339,13 @@ var messages$i = reactIntl.defineMessages({
|
|
|
10224
10339
|
});
|
|
10225
10340
|
|
|
10226
10341
|
const PlatformLimitsTaxCategoriesStatus = _ref => {
|
|
10342
|
+
var _platformLimits$taxCa, _platformLimits$taxCa2;
|
|
10227
10343
|
let total = _ref.total;
|
|
10228
10344
|
const intl = reactIntl.useIntl();
|
|
10229
10345
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
10230
10346
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
10231
|
-
const current = platformLimits
|
|
10232
|
-
const limit = platformLimits
|
|
10347
|
+
const current = platformLimits === null || platformLimits === void 0 || (_platformLimits$taxCa = platformLimits.taxCategories) === null || _platformLimits$taxCa === void 0 || (_platformLimits$taxCa = _platformLimits$taxCa.total) === null || _platformLimits$taxCa === void 0 ? void 0 : _platformLimits$taxCa.current;
|
|
10348
|
+
const limit = platformLimits === null || platformLimits === void 0 || (_platformLimits$taxCa2 = platformLimits.taxCategories) === null || _platformLimits$taxCa2 === void 0 || (_platformLimits$taxCa2 = _platformLimits$taxCa2.total) === null || _platformLimits$taxCa2 === void 0 ? void 0 : _platformLimits$taxCa2.limit;
|
|
10233
10349
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
10234
10350
|
intlMessage: messages$i.taxCategoriesStatus,
|
|
10235
10351
|
children: getPlatformLimitsStatus({
|
|
@@ -10291,17 +10407,18 @@ const useZonesPlatformLimitsFetcher = () => {
|
|
|
10291
10407
|
};
|
|
10292
10408
|
|
|
10293
10409
|
const useZonesPlatformLimits = () => {
|
|
10410
|
+
var _platformLimits$zones;
|
|
10294
10411
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10295
10412
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10296
|
-
if (!platformLimits
|
|
10413
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$zones = platformLimits.zones) !== null && _platformLimits$zones !== void 0 && _platformLimits$zones.total)) {
|
|
10297
10414
|
return {
|
|
10298
10415
|
hasReachedZonesWarningLimit: false,
|
|
10299
10416
|
hasReachedZonesErrorLimit: false
|
|
10300
10417
|
};
|
|
10301
10418
|
}
|
|
10302
|
-
const _platformLimits$
|
|
10303
|
-
limit = _platformLimits$
|
|
10304
|
-
current = _platformLimits$
|
|
10419
|
+
const _platformLimits$zones2 = platformLimits.zones.total,
|
|
10420
|
+
limit = _platformLimits$zones2.limit,
|
|
10421
|
+
current = _platformLimits$zones2.current;
|
|
10305
10422
|
const hasReachedZonesWarningLimit = getHasExceededWarningThreshold({
|
|
10306
10423
|
limit,
|
|
10307
10424
|
current
|
|
@@ -10317,12 +10434,13 @@ const useZonesPlatformLimits = () => {
|
|
|
10317
10434
|
};
|
|
10318
10435
|
|
|
10319
10436
|
const PlatformLimitsZonesNotifications = () => {
|
|
10437
|
+
var _platformLimits$zones;
|
|
10320
10438
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10321
10439
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10322
10440
|
const _useZonesPlatformLimi2 = useZonesPlatformLimits(),
|
|
10323
10441
|
hasReachedZonesWarningLimit = _useZonesPlatformLimi2.hasReachedZonesWarningLimit,
|
|
10324
10442
|
hasReachedZonesErrorLimit = _useZonesPlatformLimi2.hasReachedZonesErrorLimit;
|
|
10325
|
-
if (!platformLimits
|
|
10443
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$zones = platformLimits.zones) !== null && _platformLimits$zones !== void 0 && _platformLimits$zones.total)) {
|
|
10326
10444
|
return null;
|
|
10327
10445
|
}
|
|
10328
10446
|
if (hasReachedZonesErrorLimit) {
|
|
@@ -10368,12 +10486,13 @@ var messages$g = reactIntl.defineMessages({
|
|
|
10368
10486
|
});
|
|
10369
10487
|
|
|
10370
10488
|
const PlatformLimitsZonesStatus = _ref => {
|
|
10489
|
+
var _platformLimits$zones, _platformLimits$zones2;
|
|
10371
10490
|
let total = _ref.total;
|
|
10372
10491
|
const intl = reactIntl.useIntl();
|
|
10373
10492
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10374
10493
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10375
|
-
const current = platformLimits
|
|
10376
|
-
const limit = platformLimits
|
|
10494
|
+
const current = platformLimits === null || platformLimits === void 0 || (_platformLimits$zones = platformLimits.zones) === null || _platformLimits$zones === void 0 || (_platformLimits$zones = _platformLimits$zones.total) === null || _platformLimits$zones === void 0 ? void 0 : _platformLimits$zones.current;
|
|
10495
|
+
const limit = platformLimits === null || platformLimits === void 0 || (_platformLimits$zones2 = platformLimits.zones) === null || _platformLimits$zones2 === void 0 || (_platformLimits$zones2 = _platformLimits$zones2.total) === null || _platformLimits$zones2 === void 0 ? void 0 : _platformLimits$zones2.limit;
|
|
10377
10496
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
10378
10497
|
intlMessage: messages$g.zonesStatus,
|
|
10379
10498
|
children: getPlatformLimitsStatus({
|
|
@@ -10435,17 +10554,18 @@ const useCustomersPlatformLimitsFetcher = () => {
|
|
|
10435
10554
|
};
|
|
10436
10555
|
|
|
10437
10556
|
const useCustomersPlatformLimits$1 = () => {
|
|
10557
|
+
var _platformLimits$custo;
|
|
10438
10558
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10439
10559
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10440
|
-
if (!platformLimits
|
|
10560
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$custo = platformLimits.customers) !== null && _platformLimits$custo !== void 0 && _platformLimits$custo.total)) {
|
|
10441
10561
|
return {
|
|
10442
10562
|
hasReachedCustomersWarningLimit: false,
|
|
10443
10563
|
hasReachedCustomersErrorLimit: false
|
|
10444
10564
|
};
|
|
10445
10565
|
}
|
|
10446
|
-
const _platformLimits$
|
|
10447
|
-
limit = _platformLimits$
|
|
10448
|
-
current = _platformLimits$
|
|
10566
|
+
const _platformLimits$custo2 = platformLimits.customers.total,
|
|
10567
|
+
limit = _platformLimits$custo2.limit,
|
|
10568
|
+
current = _platformLimits$custo2.current;
|
|
10449
10569
|
const hasReachedCustomersWarningLimit = getHasExceededWarningThreshold({
|
|
10450
10570
|
limit,
|
|
10451
10571
|
current
|
|
@@ -10474,12 +10594,13 @@ const useCustomersPlatormLimitsModalState = () => {
|
|
|
10474
10594
|
};
|
|
10475
10595
|
|
|
10476
10596
|
const PlatformLimitsCustomersNotifications = () => {
|
|
10597
|
+
var _platformLimits$custo;
|
|
10477
10598
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10478
10599
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10479
10600
|
const _useCustomersPlatform2 = useCustomersPlatformLimits$1(),
|
|
10480
10601
|
hasReachedCustomersWarningLimit = _useCustomersPlatform2.hasReachedCustomersWarningLimit,
|
|
10481
10602
|
hasReachedCustomersErrorLimit = _useCustomersPlatform2.hasReachedCustomersErrorLimit;
|
|
10482
|
-
if (!platformLimits
|
|
10603
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$custo = platformLimits.customers) !== null && _platformLimits$custo !== void 0 && _platformLimits$custo.total)) {
|
|
10483
10604
|
return jsxRuntime.jsx("div", {});
|
|
10484
10605
|
}
|
|
10485
10606
|
if (hasReachedCustomersErrorLimit) {
|
|
@@ -10530,15 +10651,16 @@ var styles$b = {
|
|
|
10530
10651
|
"status": "platform-limits-customers-status-module__status___3rXYM"
|
|
10531
10652
|
};
|
|
10532
10653
|
const PlatformLimitsCustomersStatus = () => {
|
|
10654
|
+
var _platformLimits$custo;
|
|
10533
10655
|
const intl = reactIntl.useIntl();
|
|
10534
10656
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10535
10657
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10536
|
-
if (!platformLimits
|
|
10658
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$custo = platformLimits.customers) !== null && _platformLimits$custo !== void 0 && _platformLimits$custo.total)) {
|
|
10537
10659
|
return null;
|
|
10538
10660
|
}
|
|
10539
|
-
const _platformLimits$
|
|
10540
|
-
current = _platformLimits$
|
|
10541
|
-
limit = _platformLimits$
|
|
10661
|
+
const _platformLimits$custo2 = platformLimits.customers.total,
|
|
10662
|
+
current = _platformLimits$custo2.current,
|
|
10663
|
+
limit = _platformLimits$custo2.limit;
|
|
10542
10664
|
return jsxRuntime.jsx("div", {
|
|
10543
10665
|
className: styles$b.status,
|
|
10544
10666
|
children: jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
@@ -10772,17 +10894,18 @@ const useCustomerGroupsPlatformLimitsFetcher = () => {
|
|
|
10772
10894
|
};
|
|
10773
10895
|
|
|
10774
10896
|
const useCustomerGroupsPlatformLimitsStatus = () => {
|
|
10897
|
+
var _platformLimits$custo;
|
|
10775
10898
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10776
10899
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10777
|
-
if (!platformLimits
|
|
10900
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$custo = platformLimits.customerGroups) !== null && _platformLimits$custo !== void 0 && _platformLimits$custo.total)) {
|
|
10778
10901
|
return {
|
|
10779
10902
|
hasReachedCustomerGroupsWarningLimit: false,
|
|
10780
10903
|
hasReachedCustomerGroupsErrorLimit: false
|
|
10781
10904
|
};
|
|
10782
10905
|
}
|
|
10783
|
-
const _platformLimits$
|
|
10784
|
-
limit = _platformLimits$
|
|
10785
|
-
current = _platformLimits$
|
|
10906
|
+
const _platformLimits$custo2 = platformLimits.customerGroups.total,
|
|
10907
|
+
limit = _platformLimits$custo2.limit,
|
|
10908
|
+
current = _platformLimits$custo2.current;
|
|
10786
10909
|
const hasReachedCustomerGroupsWarningLimit = getHasExceededWarningThreshold({
|
|
10787
10910
|
limit,
|
|
10788
10911
|
current
|
|
@@ -10811,12 +10934,13 @@ const useCustomerGroupsPlatormLimitsModalState = () => {
|
|
|
10811
10934
|
};
|
|
10812
10935
|
|
|
10813
10936
|
const PlatformLimitsCustomerGroupsNotifications = () => {
|
|
10937
|
+
var _platformLimits$custo;
|
|
10814
10938
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10815
10939
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10816
10940
|
const _useCustomerGroupsPla2 = useCustomerGroupsPlatformLimitsStatus(),
|
|
10817
10941
|
hasReachedCustomerGroupsWarningLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsWarningLimit,
|
|
10818
10942
|
hasReachedCustomerGroupsErrorLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsErrorLimit;
|
|
10819
|
-
if (!platformLimits
|
|
10943
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$custo = platformLimits.customerGroups) !== null && _platformLimits$custo !== void 0 && _platformLimits$custo.total)) {
|
|
10820
10944
|
return jsxRuntime.jsx("div", {});
|
|
10821
10945
|
}
|
|
10822
10946
|
if (hasReachedCustomerGroupsErrorLimit) {
|
|
@@ -10867,15 +10991,16 @@ var styles$9 = {
|
|
|
10867
10991
|
"status": "platform-limits-customer-groups-status-module__status___6099G"
|
|
10868
10992
|
};
|
|
10869
10993
|
const PlatformLimitsCustomerGroupsStatus = () => {
|
|
10994
|
+
var _platformLimits$custo;
|
|
10870
10995
|
const intl = reactIntl.useIntl();
|
|
10871
10996
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10872
10997
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10873
|
-
if (!platformLimits
|
|
10998
|
+
if (!(platformLimits !== null && platformLimits !== void 0 && (_platformLimits$custo = platformLimits.customerGroups) !== null && _platformLimits$custo !== void 0 && _platformLimits$custo.total)) {
|
|
10874
10999
|
return null;
|
|
10875
11000
|
}
|
|
10876
|
-
const _platformLimits$
|
|
10877
|
-
current = _platformLimits$
|
|
10878
|
-
limit = _platformLimits$
|
|
11001
|
+
const _platformLimits$custo2 = platformLimits.customerGroups.total,
|
|
11002
|
+
current = _platformLimits$custo2.current,
|
|
11003
|
+
limit = _platformLimits$custo2.limit;
|
|
10879
11004
|
return jsxRuntime.jsx("div", {
|
|
10880
11005
|
className: styles$9.status,
|
|
10881
11006
|
children: jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
@@ -11107,7 +11232,7 @@ var fetchPimIndexStatus = ((apolloClient, projectKey) => async dispatch => {
|
|
|
11107
11232
|
try {
|
|
11108
11233
|
await dispatch(sdk.actions.head({
|
|
11109
11234
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.PIM_SEARCH,
|
|
11110
|
-
uri:
|
|
11235
|
+
uri: "/".concat(projectKey, "/search/products")
|
|
11111
11236
|
}));
|
|
11112
11237
|
return {
|
|
11113
11238
|
status: 'indexed'
|
|
@@ -11210,51 +11335,50 @@ const getIndexingJobIds = _ref => {
|
|
|
11210
11335
|
products = _ref$data.products,
|
|
11211
11336
|
productTypes = _ref$data.productTypes;
|
|
11212
11337
|
return {
|
|
11213
|
-
productsJobId: products
|
|
11214
|
-
productTypesJobId: productTypes
|
|
11338
|
+
productsJobId: (products === null || products === void 0 ? void 0 : products.indexingJobId) || (products === null || products === void 0 ? void 0 : products.existingIndexingJobId),
|
|
11339
|
+
productTypesJobId: (productTypes === null || productTypes === void 0 ? void 0 : productTypes.indexingJobId) || (productTypes === null || productTypes === void 0 ? void 0 : productTypes.existingIndexingJobId)
|
|
11215
11340
|
};
|
|
11216
11341
|
};
|
|
11217
11342
|
let PimIndexerProvider = /*#__PURE__*/function (_PureComponent) {
|
|
11218
|
-
_inherits(PimIndexerProvider, _PureComponent);
|
|
11219
11343
|
function PimIndexerProvider() {
|
|
11220
|
-
var
|
|
11344
|
+
var _this2;
|
|
11221
11345
|
_classCallCheck(this, PimIndexerProvider);
|
|
11222
11346
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
11223
11347
|
args[_key] = arguments[_key];
|
|
11224
11348
|
}
|
|
11225
|
-
|
|
11226
|
-
|
|
11349
|
+
_this2 = _callSuper$3(this, PimIndexerProvider, [...args]);
|
|
11350
|
+
_this2.state = {
|
|
11227
11351
|
isLoading: true,
|
|
11228
11352
|
isPimIndexerUnreachable: false,
|
|
11229
11353
|
isProjectIndexedByPim: false,
|
|
11230
11354
|
isProjectBeingIndexedByPim: false
|
|
11231
11355
|
};
|
|
11232
|
-
|
|
11356
|
+
_this2.checkIfProjectIsIndexed = async () => {
|
|
11233
11357
|
var _context;
|
|
11234
|
-
const _await$
|
|
11235
|
-
status = _await$
|
|
11236
|
-
isIndexingProducts = _await$
|
|
11237
|
-
isIndexingProductTypes = _await$
|
|
11358
|
+
const _await$_this2$props$f = await _this2.props.fetchPimIndexStatus(_this2.props.client, _this2.props.projectKey),
|
|
11359
|
+
status = _await$_this2$props$f.status,
|
|
11360
|
+
isIndexingProducts = _await$_this2$props$f.isIndexingProducts,
|
|
11361
|
+
isIndexingProductTypes = _await$_this2$props$f.isIndexingProductTypes;
|
|
11238
11362
|
const isPimIndexerUnreachable = _includesInstanceProperty__default["default"](_context = ['not-configured', 'unreachable']).call(_context, status);
|
|
11239
11363
|
if (status === 'indexing') {
|
|
11240
|
-
|
|
11364
|
+
_this2.monitorIndexingProgress({
|
|
11241
11365
|
isIndexingProducts,
|
|
11242
11366
|
isIndexingProductTypes
|
|
11243
11367
|
});
|
|
11244
11368
|
} else {
|
|
11245
|
-
|
|
11369
|
+
_this2.setState({
|
|
11246
11370
|
isLoading: false,
|
|
11247
11371
|
isPimIndexerUnreachable,
|
|
11248
11372
|
isProjectIndexedByPim: status === 'indexed'
|
|
11249
11373
|
});
|
|
11250
11374
|
}
|
|
11251
11375
|
};
|
|
11252
|
-
|
|
11253
|
-
|
|
11376
|
+
_this2.componentDidMount = () => {
|
|
11377
|
+
_this2.checkIfProjectIsIndexed();
|
|
11254
11378
|
};
|
|
11255
|
-
|
|
11256
|
-
if (
|
|
11257
|
-
return
|
|
11379
|
+
_this2.attemptToRefreshProducts = products => {
|
|
11380
|
+
if (_this2.state.isProjectIndexedByPim) {
|
|
11381
|
+
return _this2.props.refreshProductIndicesByIds({
|
|
11258
11382
|
context: pimIndexerRequestContext,
|
|
11259
11383
|
variables: {
|
|
11260
11384
|
ids: _mapInstanceProperty__default["default"](products).call(products, product => product.id)
|
|
@@ -11271,26 +11395,26 @@ let PimIndexerProvider = /*#__PURE__*/function (_PureComponent) {
|
|
|
11271
11395
|
}
|
|
11272
11396
|
return _Promise__default["default"].resolve();
|
|
11273
11397
|
};
|
|
11274
|
-
|
|
11275
|
-
|
|
11398
|
+
_this2.handleFailedIndexing = () => {
|
|
11399
|
+
_this2.setState({
|
|
11276
11400
|
isProjectBeingIndexedByPim: false,
|
|
11277
11401
|
isProjectIndexedByPim: false
|
|
11278
11402
|
});
|
|
11279
|
-
|
|
11403
|
+
_this2.props.notifications.showNotification({
|
|
11280
11404
|
kind: 'error',
|
|
11281
11405
|
domain: constants.DOMAINS.SIDE,
|
|
11282
|
-
text:
|
|
11406
|
+
text: _this2.props.intl.formatMessage(messages$9.indexingFailed)
|
|
11283
11407
|
});
|
|
11284
11408
|
};
|
|
11285
|
-
|
|
11286
|
-
const result = await
|
|
11409
|
+
_this2.getIndexingProgress = async () => {
|
|
11410
|
+
const result = await _this2.props.client.query({
|
|
11287
11411
|
query: GetIndexingProgress,
|
|
11288
11412
|
context: pimIndexerRequestContext,
|
|
11289
11413
|
variables: {
|
|
11290
|
-
productsJobId:
|
|
11291
|
-
productTypesJobId:
|
|
11292
|
-
shouldIncludeProducts: !!
|
|
11293
|
-
shouldIncludeProductTypes: !!
|
|
11414
|
+
productsJobId: _this2.state.productsJobId || '',
|
|
11415
|
+
productTypesJobId: _this2.state.productTypesJobId || '',
|
|
11416
|
+
shouldIncludeProducts: !!_this2.state.productsJobId,
|
|
11417
|
+
shouldIncludeProductTypes: !!_this2.state.productTypesJobId
|
|
11294
11418
|
},
|
|
11295
11419
|
fetchPolicy: 'network-only'
|
|
11296
11420
|
});
|
|
@@ -11303,24 +11427,24 @@ let PimIndexerProvider = /*#__PURE__*/function (_PureComponent) {
|
|
|
11303
11427
|
productTypes: result.data.productTypes || completedStatus
|
|
11304
11428
|
};
|
|
11305
11429
|
};
|
|
11306
|
-
|
|
11430
|
+
_this2.handleFinishedIndexing = async () => {
|
|
11307
11431
|
try {
|
|
11308
|
-
|
|
11309
|
-
const _await$
|
|
11310
|
-
status = _await$
|
|
11432
|
+
_this2.updateIndexingStatusTimerHandler = null;
|
|
11433
|
+
const _await$_this2$props$f2 = await _this2.props.fetchPimIndexStatus(_this2.props.client, _this2.props.projectKey),
|
|
11434
|
+
status = _await$_this2$props$f2.status;
|
|
11311
11435
|
|
|
11312
11436
|
// There is a delay between indexing jobs reporting
|
|
11313
11437
|
// they are completed, and PIM realizing all the project is indexed.
|
|
11314
11438
|
// So, we have to wait to let PIM update project indexing status.
|
|
11315
11439
|
if (status === 'indexed') {
|
|
11316
|
-
|
|
11440
|
+
_this2.setState({
|
|
11317
11441
|
isProjectBeingIndexedByPim: false,
|
|
11318
11442
|
isProjectIndexedByPim: true
|
|
11319
11443
|
});
|
|
11320
|
-
|
|
11444
|
+
_this2.props.notifications.showNotification({
|
|
11321
11445
|
kind: 'success',
|
|
11322
11446
|
domain: constants.DOMAINS.SIDE,
|
|
11323
|
-
text:
|
|
11447
|
+
text: _this2.props.intl.formatMessage(messages$9.indexingSucceed)
|
|
11324
11448
|
},
|
|
11325
11449
|
// because the indexing may take so long, the success notification
|
|
11326
11450
|
// may be dismissed without being seen by the user. Set `dismissAfter`
|
|
@@ -11329,63 +11453,64 @@ let PimIndexerProvider = /*#__PURE__*/function (_PureComponent) {
|
|
|
11329
11453
|
dismissAfter: 0
|
|
11330
11454
|
});
|
|
11331
11455
|
} else {
|
|
11332
|
-
|
|
11456
|
+
_this2.updateIndexingStatusTimerHandler = _setTimeout__default["default"](_this2.handleFinishedIndexing, 5000);
|
|
11333
11457
|
}
|
|
11334
11458
|
} catch (e) {
|
|
11335
|
-
|
|
11459
|
+
_this2.handleFailedIndexing();
|
|
11336
11460
|
}
|
|
11337
11461
|
};
|
|
11338
|
-
|
|
11462
|
+
_this2.updateIndexingStatus = async () => {
|
|
11339
11463
|
try {
|
|
11340
|
-
const _await$
|
|
11341
|
-
products = _await$
|
|
11342
|
-
productTypes = _await$
|
|
11464
|
+
const _await$_this2$getInde = await _this2.getIndexingProgress(),
|
|
11465
|
+
products = _await$_this2$getInde.products,
|
|
11466
|
+
productTypes = _await$_this2$getInde.productTypes;
|
|
11343
11467
|
const isCompleted = isIndexingCompleted(products, productTypes);
|
|
11344
11468
|
const indexingProgress = calculateProgress(products, productTypes);
|
|
11345
|
-
|
|
11469
|
+
_this2.setState({
|
|
11346
11470
|
indexingProgress
|
|
11347
11471
|
});
|
|
11348
11472
|
if (!isCompleted) {
|
|
11349
|
-
|
|
11473
|
+
_this2.updateIndexingStatusTimerHandler = _setTimeout__default["default"](_this2.updateIndexingStatus, 5000);
|
|
11350
11474
|
} else {
|
|
11351
|
-
|
|
11475
|
+
_this2.setState({
|
|
11352
11476
|
indexingProgress: 100
|
|
11353
11477
|
});
|
|
11354
|
-
|
|
11478
|
+
_this2.handleFinishedIndexing();
|
|
11355
11479
|
}
|
|
11356
11480
|
} catch (e) {
|
|
11357
|
-
|
|
11481
|
+
_this2.handleFailedIndexing();
|
|
11358
11482
|
}
|
|
11359
11483
|
};
|
|
11360
|
-
|
|
11484
|
+
_this2.monitorIndexingProgress = async _ref2 => {
|
|
11361
11485
|
let isIndexingProducts = _ref2.isIndexingProducts,
|
|
11362
11486
|
isIndexingProductTypes = _ref2.isIndexingProductTypes;
|
|
11363
|
-
if (
|
|
11487
|
+
if (_this2.state.isProjectBeingIndexedByPim) return;
|
|
11364
11488
|
try {
|
|
11365
|
-
const indexMutationResult = await
|
|
11489
|
+
const indexMutationResult = await _this2.props.indexProject({
|
|
11366
11490
|
context: pimIndexerRequestContext,
|
|
11367
11491
|
variables: {
|
|
11368
11492
|
shouldIndexProducts: isIndexingProducts,
|
|
11369
11493
|
shouldIndexProductTypes: isIndexingProductTypes
|
|
11370
11494
|
}
|
|
11371
11495
|
});
|
|
11372
|
-
|
|
11496
|
+
_this2.setState(_objectSpread$h(_objectSpread$h({
|
|
11373
11497
|
isLoading: false,
|
|
11374
11498
|
isProjectBeingIndexedByPim: true
|
|
11375
11499
|
}, getIndexingJobIds(indexMutationResult)), {}, {
|
|
11376
11500
|
indexingProgress: 0
|
|
11377
|
-
}), () =>
|
|
11501
|
+
}), () => _this2.updateIndexingStatus());
|
|
11378
11502
|
} catch (e) {
|
|
11379
|
-
|
|
11503
|
+
_this2.handleFailedIndexing();
|
|
11380
11504
|
}
|
|
11381
11505
|
};
|
|
11382
|
-
|
|
11506
|
+
_this2.indexProject = () => _this2.monitorIndexingProgress({
|
|
11383
11507
|
isIndexingProductTypes: true,
|
|
11384
11508
|
isIndexingProducts: true
|
|
11385
11509
|
});
|
|
11386
|
-
return
|
|
11510
|
+
return _this2;
|
|
11387
11511
|
}
|
|
11388
|
-
|
|
11512
|
+
_inherits(PimIndexerProvider, _PureComponent);
|
|
11513
|
+
return _createClass(PimIndexerProvider, [{
|
|
11389
11514
|
key: "componentWillUnmount",
|
|
11390
11515
|
value: function componentWillUnmount() {
|
|
11391
11516
|
if (this.updateIndexingStatusTimerHandler) clearTimeout(this.updateIndexingStatusTimerHandler);
|
|
@@ -11402,7 +11527,6 @@ let PimIndexerProvider = /*#__PURE__*/function (_PureComponent) {
|
|
|
11402
11527
|
});
|
|
11403
11528
|
}
|
|
11404
11529
|
}]);
|
|
11405
|
-
return PimIndexerProvider;
|
|
11406
11530
|
}(React.PureComponent);
|
|
11407
11531
|
PimIndexerProvider.displayName = 'PimIndexerProvider';
|
|
11408
11532
|
var pimIndexerProvider = flowRight__default["default"](applicationShellConnectors.withApplicationContext(applicationContext => ({
|
|
@@ -11430,12 +11554,12 @@ function _callSuper$2(_this, derived, args) {
|
|
|
11430
11554
|
return _possibleConstructorReturn(_this, isNativeReflectConstruct() ? _Reflect$construct__default["default"](derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args));
|
|
11431
11555
|
}
|
|
11432
11556
|
let WithPimIndexer = /*#__PURE__*/function (_PureComponent) {
|
|
11433
|
-
_inherits(WithPimIndexer, _PureComponent);
|
|
11434
11557
|
function WithPimIndexer() {
|
|
11435
11558
|
_classCallCheck(this, WithPimIndexer);
|
|
11436
11559
|
return _callSuper$2(this, WithPimIndexer, arguments);
|
|
11437
11560
|
}
|
|
11438
|
-
|
|
11561
|
+
_inherits(WithPimIndexer, _PureComponent);
|
|
11562
|
+
return _createClass(WithPimIndexer, [{
|
|
11439
11563
|
key: "render",
|
|
11440
11564
|
value: function render() {
|
|
11441
11565
|
return jsxRuntime.jsx(PimIndexerContext.Consumer, {
|
|
@@ -11443,7 +11567,6 @@ let WithPimIndexer = /*#__PURE__*/function (_PureComponent) {
|
|
|
11443
11567
|
});
|
|
11444
11568
|
}
|
|
11445
11569
|
}]);
|
|
11446
|
-
return WithPimIndexer;
|
|
11447
11570
|
}(React.PureComponent);
|
|
11448
11571
|
WithPimIndexer.displayName = 'WithPimIndexer';
|
|
11449
11572
|
|
|
@@ -11485,6 +11608,7 @@ const valueMapping = {
|
|
|
11485
11608
|
all: [true, false]
|
|
11486
11609
|
};
|
|
11487
11610
|
const BooleanField = props => {
|
|
11611
|
+
var _context;
|
|
11488
11612
|
let selectedValue;
|
|
11489
11613
|
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]);
|
|
11490
11614
|
const yesLabel = props.intl.formatMessage(messages$8.yes);
|
|
@@ -11498,7 +11622,7 @@ const BooleanField = props => {
|
|
|
11498
11622
|
}];
|
|
11499
11623
|
if (props.isMulti) options.push({
|
|
11500
11624
|
value: 'all',
|
|
11501
|
-
label:
|
|
11625
|
+
label: _concatInstanceProperty__default["default"](_context = "".concat(yesLabel, " / ")).call(_context, noLabel)
|
|
11502
11626
|
});
|
|
11503
11627
|
return jsxRuntime.jsx(uiKit.SelectInput, {
|
|
11504
11628
|
name: props.name,
|
|
@@ -11662,19 +11786,19 @@ const ScrollToFieldError = () => {
|
|
|
11662
11786
|
if (isValid) return;
|
|
11663
11787
|
const firstErrorElement = document.querySelector('[aria-invalid="true"]');
|
|
11664
11788
|
if (firstErrorElement) {
|
|
11789
|
+
var _ref, _ref2, _document$querySelect, _elementToScrollTo$sc;
|
|
11665
11790
|
// Get a reference to the label.
|
|
11666
11791
|
const firstElementId = firstErrorElement.getAttribute('id');
|
|
11667
|
-
const localizedInputIndex = _indexOfInstanceProperty__default["default"](firstElementId).call(firstElementId,
|
|
11792
|
+
const localizedInputIndex = _indexOfInstanceProperty__default["default"](firstElementId).call(firstElementId, ".".concat(dataLocale));
|
|
11668
11793
|
|
|
11669
11794
|
// check if locale is appended then remove it from id
|
|
11670
|
-
const id = localizedInputIndex > -1 ? firstElementId.replace(
|
|
11795
|
+
const id = localizedInputIndex > -1 ? firstElementId.replace(".".concat(dataLocale), '') : firstElementId;
|
|
11671
11796
|
|
|
11672
11797
|
// Scroll to the label (if found), otherwise to the input element itself.
|
|
11673
11798
|
|
|
11674
|
-
const elementToScrollTo =
|
|
11675
|
-
|
|
11676
|
-
|
|
11677
|
-
elementToScrollTo.scrollIntoView?.({
|
|
11799
|
+
const elementToScrollTo = // div is used only for custom fields
|
|
11800
|
+
(_ref = (_ref2 = (_document$querySelect = document.querySelector("div[aria-errormessage=\"".concat(firstElementId, "\"]"))) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector("label[for=\"".concat(id, "\"]"))) !== null && _ref2 !== void 0 ? _ref2 : document.querySelector("label#".concat(id))) !== null && _ref !== void 0 ? _ref : firstErrorElement;
|
|
11801
|
+
(_elementToScrollTo$sc = elementToScrollTo.scrollIntoView) === null || _elementToScrollTo$sc === void 0 || _elementToScrollTo$sc.call(elementToScrollTo, {
|
|
11678
11802
|
behavior: 'smooth'
|
|
11679
11803
|
});
|
|
11680
11804
|
}
|
|
@@ -11700,7 +11824,8 @@ var styles$4 = {
|
|
|
11700
11824
|
"search-mode-menu": "selectable-field-search-input-module__search-mode-menu___Od6Le"
|
|
11701
11825
|
};
|
|
11702
11826
|
const SelectableFieldSearchInput = props => {
|
|
11703
|
-
|
|
11827
|
+
var _props$initialValue, _props$placeholder;
|
|
11828
|
+
const _useState = React.useState((_props$initialValue = props.initialValue) !== null && _props$initialValue !== void 0 ? _props$initialValue : ''),
|
|
11704
11829
|
_useState2 = _slicedToArray(_useState, 2),
|
|
11705
11830
|
searchText = _useState2[0],
|
|
11706
11831
|
setSearchText = _useState2[1];
|
|
@@ -11736,7 +11861,7 @@ const SelectableFieldSearchInput = props => {
|
|
|
11736
11861
|
});
|
|
11737
11862
|
},
|
|
11738
11863
|
onReset: props.onReset,
|
|
11739
|
-
placeholder: props.placeholder
|
|
11864
|
+
placeholder: (_props$placeholder = props.placeholder) !== null && _props$placeholder !== void 0 ? _props$placeholder : intl.formatMessage(messages$5.placeholder),
|
|
11740
11865
|
isDisabled: props.disabled
|
|
11741
11866
|
})
|
|
11742
11867
|
});
|
|
@@ -11797,6 +11922,7 @@ StoreSelectField.defaultProps = {
|
|
|
11797
11922
|
mappedValueField: 'id'
|
|
11798
11923
|
};
|
|
11799
11924
|
|
|
11925
|
+
var _templateObject;
|
|
11800
11926
|
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; }
|
|
11801
11927
|
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; }
|
|
11802
11928
|
function _callSuper$1(_this, derived, args) {
|
|
@@ -11887,10 +12013,7 @@ const VALIDATOR_INTEGER = {
|
|
|
11887
12013
|
* has emitted a warning once in the logs, not for every instance
|
|
11888
12014
|
*/
|
|
11889
12015
|
let hasWarned = false;
|
|
11890
|
-
const warningMessage = commonTags.oneLineTrim`
|
|
11891
|
-
\`validatedInput\` is no longer supported.
|
|
11892
|
-
Please use \`formik\` instead.
|
|
11893
|
-
`;
|
|
12016
|
+
const warningMessage = commonTags.oneLineTrim(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n `validatedInput` is no longer supported.\n Please use `formik` instead.\n"], ["\n \\`validatedInput\\` is no longer supported.\n Please use \\`formik\\` instead.\n"])));
|
|
11894
12017
|
const ToolTipWrapperComponent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
11895
12018
|
let children = _ref.children;
|
|
11896
12019
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
@@ -11923,74 +12046,74 @@ function validatedInput(InnerComponent, validators) {
|
|
|
11923
12046
|
_initialValidState[v.name] = true;
|
|
11924
12047
|
});
|
|
11925
12048
|
let ValidatedInput = /*#__PURE__*/function (_PureComponent) {
|
|
11926
|
-
_inherits(ValidatedInput, _PureComponent);
|
|
11927
12049
|
function ValidatedInput() {
|
|
11928
|
-
var
|
|
12050
|
+
var _this2;
|
|
11929
12051
|
_classCallCheck(this, ValidatedInput);
|
|
11930
12052
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
11931
12053
|
args[_key] = arguments[_key];
|
|
11932
12054
|
}
|
|
11933
|
-
|
|
11934
|
-
|
|
12055
|
+
_this2 = _callSuper$1(this, ValidatedInput, [...args]);
|
|
12056
|
+
_this2.state = {
|
|
11935
12057
|
validStatus: _initialValidState
|
|
11936
12058
|
};
|
|
11937
|
-
|
|
11938
|
-
if (!fastEquals.deepEqual(
|
|
11939
|
-
|
|
12059
|
+
_this2.conditionalSetValidStatus = nextValidStatus => {
|
|
12060
|
+
if (!fastEquals.deepEqual(_this2.state.validStatus, nextValidStatus)) {
|
|
12061
|
+
_this2.setState({
|
|
11940
12062
|
validStatus: nextValidStatus
|
|
11941
12063
|
});
|
|
11942
12064
|
}
|
|
11943
12065
|
};
|
|
11944
|
-
|
|
12066
|
+
_this2.handleChange = function (event) {
|
|
11945
12067
|
let _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
11946
12068
|
_ref4$triggerUpdate = _ref4.triggerUpdate,
|
|
11947
12069
|
triggerUpdate = _ref4$triggerUpdate === void 0 ? true : _ref4$triggerUpdate;
|
|
11948
12070
|
let value = '';
|
|
11949
12071
|
const nextValidStatus = {};
|
|
11950
|
-
const onChange = changeHandler &&
|
|
12072
|
+
const onChange = changeHandler && _this2.props[changeHandler] || _this2.props.onChange;
|
|
11951
12073
|
|
|
11952
12074
|
// If the actual event is passed, validate the value
|
|
11953
12075
|
if (getIsEvent(event)) value = event.target.value;else value = event;
|
|
11954
12076
|
_forEachInstanceProperty__default["default"](_validators).call(_validators, v => {
|
|
11955
|
-
if (v.validators.change) nextValidStatus[v.name] = v.validators.change.call(
|
|
12077
|
+
if (v.validators.change) nextValidStatus[v.name] = v.validators.change.call(_this2, value);else nextValidStatus[v.name] = true;
|
|
11956
12078
|
});
|
|
11957
12079
|
if (onChange && triggerUpdate) onChange(event);
|
|
11958
|
-
|
|
12080
|
+
_this2.conditionalSetValidStatus(nextValidStatus);
|
|
11959
12081
|
};
|
|
11960
12082
|
/**
|
|
11961
12083
|
* Only triggers when there is a value, but its not valid
|
|
11962
12084
|
* so it must be an invalid numeric value
|
|
11963
12085
|
*/
|
|
11964
|
-
|
|
11965
|
-
const nextValidStatus = _objectSpread$b({},
|
|
12086
|
+
_this2.handleInvalid = () => {
|
|
12087
|
+
const nextValidStatus = _objectSpread$b({}, _this2.state.validStatus);
|
|
11966
12088
|
if (has__default["default"](nextValidStatus, 'numeric')) {
|
|
11967
12089
|
nextValidStatus.numeric = false;
|
|
11968
|
-
|
|
12090
|
+
_this2.conditionalSetValidStatus(nextValidStatus);
|
|
11969
12091
|
}
|
|
11970
12092
|
};
|
|
11971
|
-
|
|
12093
|
+
_this2.handleBlur = event => {
|
|
11972
12094
|
let value = '';
|
|
11973
12095
|
const nextValidStatus = {};
|
|
11974
|
-
const onBlur = blurHandler &&
|
|
12096
|
+
const onBlur = blurHandler && _this2.props[blurHandler] || _this2.props.onBlurValue;
|
|
11975
12097
|
|
|
11976
12098
|
// If the actual event is passed, validate the value
|
|
11977
12099
|
if (getIsEvent(event)) value = event.target.value;else value = event;
|
|
11978
12100
|
_forEachInstanceProperty__default["default"](_validators).call(_validators, v => {
|
|
11979
|
-
if (v.validators.blur) nextValidStatus[v.name] = v.validators.blur.call(
|
|
12101
|
+
if (v.validators.blur) nextValidStatus[v.name] = v.validators.blur.call(_this2, value);else nextValidStatus[v.name] = true;
|
|
11980
12102
|
});
|
|
11981
12103
|
if (onBlur) onBlur(event);
|
|
11982
|
-
|
|
12104
|
+
_this2.conditionalSetValidStatus(nextValidStatus);
|
|
11983
12105
|
};
|
|
11984
|
-
|
|
12106
|
+
_this2.resetValidity = () => {
|
|
11985
12107
|
const nextValidStatus = {};
|
|
11986
12108
|
_forEachInstanceProperty__default["default"](_validators).call(_validators, v => {
|
|
11987
12109
|
nextValidStatus[v.name] = true;
|
|
11988
12110
|
});
|
|
11989
|
-
|
|
12111
|
+
_this2.conditionalSetValidStatus(nextValidStatus);
|
|
11990
12112
|
};
|
|
11991
|
-
return
|
|
12113
|
+
return _this2;
|
|
11992
12114
|
}
|
|
11993
|
-
|
|
12115
|
+
_inherits(ValidatedInput, _PureComponent);
|
|
12116
|
+
return _createClass(ValidatedInput, [{
|
|
11994
12117
|
key: "componentDidMount",
|
|
11995
12118
|
value: function componentDidMount() {
|
|
11996
12119
|
process.env.NODE_ENV !== "production" ? warning__default["default"](hasWarned, warningMessage) : void 0;
|
|
@@ -12036,9 +12159,8 @@ function validatedInput(InnerComponent, validators) {
|
|
|
12036
12159
|
});
|
|
12037
12160
|
}
|
|
12038
12161
|
}]);
|
|
12039
|
-
return ValidatedInput;
|
|
12040
12162
|
}(React.PureComponent);
|
|
12041
|
-
ValidatedInput.displayName =
|
|
12163
|
+
ValidatedInput.displayName = "ValidatedInput(".concat(_InnerComponent.displayName, ")");
|
|
12042
12164
|
ValidatedInput.defaultProps = {
|
|
12043
12165
|
isValid: true,
|
|
12044
12166
|
getInputRef: () => {}
|
|
@@ -12046,22 +12168,22 @@ function validatedInput(InnerComponent, validators) {
|
|
|
12046
12168
|
return reactIntl.injectIntl(ValidatedInput);
|
|
12047
12169
|
}
|
|
12048
12170
|
function simpleInput(type) {
|
|
12049
|
-
var
|
|
12050
|
-
return
|
|
12051
|
-
|
|
12052
|
-
|
|
12053
|
-
|
|
12054
|
-
_classCallCheck(this, _class2);
|
|
12171
|
+
var _Class;
|
|
12172
|
+
return _Class = /*#__PURE__*/function (_PureComponent2) {
|
|
12173
|
+
function _Class() {
|
|
12174
|
+
var _this3;
|
|
12175
|
+
_classCallCheck(this, _Class);
|
|
12055
12176
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
12056
12177
|
args[_key2] = arguments[_key2];
|
|
12057
12178
|
}
|
|
12058
|
-
|
|
12059
|
-
|
|
12060
|
-
if (
|
|
12179
|
+
_this3 = _callSuper$1(this, _Class, [...args]);
|
|
12180
|
+
_this3.handleBlur = event => {
|
|
12181
|
+
if (_this3.props.onBlurValue) _this3.props.onBlurValue(event.target.value);
|
|
12061
12182
|
};
|
|
12062
|
-
return
|
|
12183
|
+
return _this3;
|
|
12063
12184
|
}
|
|
12064
|
-
|
|
12185
|
+
_inherits(_Class, _PureComponent2);
|
|
12186
|
+
return _createClass(_Class, [{
|
|
12065
12187
|
key: "render",
|
|
12066
12188
|
value: function render() {
|
|
12067
12189
|
return jsxRuntime.jsx("input", {
|
|
@@ -12078,11 +12200,10 @@ function simpleInput(type) {
|
|
|
12078
12200
|
});
|
|
12079
12201
|
}
|
|
12080
12202
|
}]);
|
|
12081
|
-
|
|
12082
|
-
}(React.PureComponent), _class2.displayName = 'SimpleInput', _class2.defaultProps = {
|
|
12203
|
+
}(React.PureComponent), _Class.displayName = 'SimpleInput', _Class.defaultProps = {
|
|
12083
12204
|
getInputRef: () => {},
|
|
12084
12205
|
name: 'simple-validated-input'
|
|
12085
|
-
},
|
|
12206
|
+
}, _Class;
|
|
12086
12207
|
}
|
|
12087
12208
|
|
|
12088
12209
|
var messages$4 = reactIntl.defineMessages({
|
|
@@ -12179,7 +12300,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
12179
12300
|
truncate: true,
|
|
12180
12301
|
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$2.filterWholeInput), {}, {
|
|
12181
12302
|
values: {
|
|
12182
|
-
values:
|
|
12303
|
+
values: "\"".concat(props.value, "\"")
|
|
12183
12304
|
}
|
|
12184
12305
|
})
|
|
12185
12306
|
})
|
|
@@ -12192,7 +12313,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
12192
12313
|
truncate: true,
|
|
12193
12314
|
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$2.filterSeparateValues), {}, {
|
|
12194
12315
|
values: {
|
|
12195
|
-
values:
|
|
12316
|
+
values: "\"".concat(props.multiValue.join('", "'), "\"") || props.value
|
|
12196
12317
|
}
|
|
12197
12318
|
})
|
|
12198
12319
|
})
|
|
@@ -12327,46 +12448,46 @@ Cleave__default["default"].displayName = 'Cleave';
|
|
|
12327
12448
|
// use isFinite to exclude Infitinty, -Inifinity and NaN
|
|
12328
12449
|
const isValidValue = value => isFinite__default["default"](value) || isNil__default["default"](value);
|
|
12329
12450
|
let NumericFormatInput = /*#__PURE__*/function (_PureComponent) {
|
|
12330
|
-
_inherits(NumericFormatInput, _PureComponent);
|
|
12331
12451
|
function NumericFormatInput() {
|
|
12332
|
-
var
|
|
12452
|
+
var _this2;
|
|
12333
12453
|
_classCallCheck(this, NumericFormatInput);
|
|
12334
12454
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
12335
12455
|
args[_key] = arguments[_key];
|
|
12336
12456
|
}
|
|
12337
|
-
|
|
12338
|
-
|
|
12339
|
-
parsedValue:
|
|
12457
|
+
_this2 = _callSuper(this, NumericFormatInput, [...args]);
|
|
12458
|
+
_this2.state = {
|
|
12459
|
+
parsedValue: _this2.props.value
|
|
12340
12460
|
};
|
|
12341
|
-
|
|
12461
|
+
_this2.setValue = value => {
|
|
12342
12462
|
if (!isValidValue(value)) return;
|
|
12343
|
-
const newValue = !isUndefined__default["default"](value) ?
|
|
12344
|
-
|
|
12463
|
+
const newValue = !isUndefined__default["default"](value) ? _this2.props.formatNumber(value) : undefined;
|
|
12464
|
+
_this2.owner.setRawValue(newValue);
|
|
12345
12465
|
};
|
|
12346
|
-
|
|
12347
|
-
|
|
12348
|
-
|
|
12466
|
+
_this2.handleInit = owner => {
|
|
12467
|
+
_this2.owner = owner;
|
|
12468
|
+
_this2.setValue(_this2.props.value);
|
|
12349
12469
|
};
|
|
12350
|
-
|
|
12470
|
+
_this2.handleChange = event => {
|
|
12351
12471
|
const value = event.target.rawValue;
|
|
12352
|
-
const parsedNumber =
|
|
12353
|
-
if (
|
|
12354
|
-
|
|
12472
|
+
const parsedNumber = _this2.props.parseNumber(value);
|
|
12473
|
+
if (_this2.state.parsedValue === parsedNumber) return;
|
|
12474
|
+
_this2.setState({
|
|
12355
12475
|
parsedValue: parsedNumber
|
|
12356
12476
|
});
|
|
12357
|
-
|
|
12358
|
-
if (!isNumberish(value) &&
|
|
12477
|
+
_this2.props.onChangeValue(parsedNumber);
|
|
12478
|
+
if (!isNumberish(value) && _this2.props.onInvalidValue) _this2.props.onInvalidValue(value);
|
|
12359
12479
|
};
|
|
12360
|
-
|
|
12361
|
-
|
|
12362
|
-
if (
|
|
12480
|
+
_this2.handleBlur = () => {
|
|
12481
|
+
_this2.setValue(_this2.props.value);
|
|
12482
|
+
if (_this2.props.onBlurValue) _this2.props.onBlurValue(_this2.props.value);
|
|
12363
12483
|
};
|
|
12364
|
-
|
|
12365
|
-
|
|
12484
|
+
_this2.registerInputRef = ref => {
|
|
12485
|
+
_this2.textInput = ref;
|
|
12366
12486
|
};
|
|
12367
|
-
return
|
|
12487
|
+
return _this2;
|
|
12368
12488
|
}
|
|
12369
|
-
|
|
12489
|
+
_inherits(NumericFormatInput, _PureComponent);
|
|
12490
|
+
return _createClass(NumericFormatInput, [{
|
|
12370
12491
|
key: "componentDidUpdate",
|
|
12371
12492
|
value: function componentDidUpdate(prevProps) {
|
|
12372
12493
|
if (this.props.value !== prevProps.value && this.props.value !== this.state.parsedValue) {
|
|
@@ -12407,7 +12528,6 @@ let NumericFormatInput = /*#__PURE__*/function (_PureComponent) {
|
|
|
12407
12528
|
}, dataAttributes));
|
|
12408
12529
|
}
|
|
12409
12530
|
}]);
|
|
12410
|
-
return NumericFormatInput;
|
|
12411
12531
|
}(React.PureComponent);
|
|
12412
12532
|
NumericFormatInput.displayName = 'NumericFormatInput';
|
|
12413
12533
|
NumericFormatInput.defaultProps = {
|
|
@@ -12495,16 +12615,17 @@ function isEmpty(value) {
|
|
|
12495
12615
|
}
|
|
12496
12616
|
|
|
12497
12617
|
const buildSearchQuery = (searchQuery, searchMode, fragments) => {
|
|
12618
|
+
var _fragments$searchMode;
|
|
12498
12619
|
if (!searchQuery) return '';
|
|
12499
12620
|
const buildAllFieldsQueryString = query => {
|
|
12500
12621
|
const fragmentsArray = _Object$values__default["default"](fragments);
|
|
12501
|
-
return
|
|
12622
|
+
return "( ".concat(_mapInstanceProperty__default["default"](fragmentsArray).call(fragmentsArray, fragment => fragment.getQuery(query)).join(' or '), " )");
|
|
12502
12623
|
};
|
|
12503
12624
|
const trimmedSearchQuery = oneLine__default["default"](searchQuery);
|
|
12504
12625
|
if (searchMode === 'allFields') {
|
|
12505
12626
|
return buildAllFieldsQueryString(trimmedSearchQuery);
|
|
12506
12627
|
}
|
|
12507
|
-
if (!fragments[searchMode] || typeof fragments[searchMode]
|
|
12628
|
+
if (!fragments[searchMode] || typeof ((_fragments$searchMode = fragments[searchMode]) === null || _fragments$searchMode === void 0 ? void 0 : _fragments$searchMode.getQuery) !== 'function') {
|
|
12508
12629
|
return '';
|
|
12509
12630
|
}
|
|
12510
12631
|
return fragments[searchMode].getQuery(trimmedSearchQuery);
|
|
@@ -12735,11 +12856,11 @@ function createResourceReducer(options) {
|
|
|
12735
12856
|
|
|
12736
12857
|
// TODO: validate constant keys
|
|
12737
12858
|
const actionsMap = {
|
|
12738
|
-
[
|
|
12859
|
+
["".concat(plural, "_FETCHED")]: (_, action) => ({
|
|
12739
12860
|
currentQueryResult: action.payload
|
|
12740
12861
|
}),
|
|
12741
|
-
[
|
|
12742
|
-
[
|
|
12862
|
+
["".concat(single, "_UPDATED_IN_LIST")]: updateStatusInList(mergeData),
|
|
12863
|
+
["".concat(single, "_DELETED_IN_LIST")]: (state, _ref) => {
|
|
12743
12864
|
let payload = _ref.payload;
|
|
12744
12865
|
const results = state.currentQueryResult.results;
|
|
12745
12866
|
return {
|
|
@@ -12751,27 +12872,27 @@ function createResourceReducer(options) {
|
|
|
12751
12872
|
})
|
|
12752
12873
|
};
|
|
12753
12874
|
},
|
|
12754
|
-
[
|
|
12875
|
+
["".concat(single, "_FETCHED")]: (_, _ref3) => {
|
|
12755
12876
|
let payload = _ref3.payload;
|
|
12756
12877
|
return {
|
|
12757
12878
|
currentVisible: payload
|
|
12758
12879
|
};
|
|
12759
12880
|
},
|
|
12760
|
-
[
|
|
12881
|
+
["".concat(single, "_CREATED")]: (_ref4, _ref5) => {
|
|
12761
12882
|
let currentVisible = _ref4.currentVisible;
|
|
12762
12883
|
let payload = _ref5.payload;
|
|
12763
12884
|
return {
|
|
12764
12885
|
currentVisible: mergeData(payload, currentVisible)
|
|
12765
12886
|
};
|
|
12766
12887
|
},
|
|
12767
|
-
[
|
|
12888
|
+
["".concat(single, "_UPDATED")]: (_ref6, _ref7) => {
|
|
12768
12889
|
let currentVisible = _ref6.currentVisible;
|
|
12769
12890
|
let payload = _ref7.payload;
|
|
12770
12891
|
return {
|
|
12771
12892
|
currentVisible: mergeData(payload, currentVisible)
|
|
12772
12893
|
};
|
|
12773
12894
|
},
|
|
12774
|
-
[
|
|
12895
|
+
["".concat(single, "_DELETED")]: () => ({
|
|
12775
12896
|
currentVisible: null
|
|
12776
12897
|
})
|
|
12777
12898
|
};
|
|
@@ -12788,11 +12909,12 @@ function formatCustomerAddress(_ref) {
|
|
|
12788
12909
|
}
|
|
12789
12910
|
|
|
12790
12911
|
function formatCustomerName(_ref) {
|
|
12912
|
+
var _context;
|
|
12791
12913
|
let firstName = _ref.firstName,
|
|
12792
12914
|
lastName = _ref.lastName;
|
|
12793
12915
|
if (firstName && !lastName) return _trimInstanceProperty__default["default"](firstName).call(firstName);
|
|
12794
12916
|
if (!firstName && lastName) return _trimInstanceProperty__default["default"](lastName).call(lastName);
|
|
12795
|
-
if (firstName && lastName) return
|
|
12917
|
+
if (firstName && lastName) return _concatInstanceProperty__default["default"](_context = "".concat(_trimInstanceProperty__default["default"](firstName).call(firstName), " ")).call(_context, _trimInstanceProperty__default["default"](lastName).call(lastName));
|
|
12796
12918
|
return constants.NO_VALUE_FALLBACK;
|
|
12797
12919
|
}
|
|
12798
12920
|
|
|
@@ -12844,7 +12966,10 @@ const validateText = function (text, intl) {
|
|
|
12844
12966
|
* @returns {boolean}
|
|
12845
12967
|
*/
|
|
12846
12968
|
const hasErrorCode = (unmappedApiErrors, errorCode) => {
|
|
12847
|
-
return _Array$isArray__default["default"](unmappedApiErrors) && _someInstanceProperty__default["default"](unmappedApiErrors).call(unmappedApiErrors, error =>
|
|
12969
|
+
return _Array$isArray__default["default"](unmappedApiErrors) && _someInstanceProperty__default["default"](unmappedApiErrors).call(unmappedApiErrors, error => {
|
|
12970
|
+
var _error$extensions;
|
|
12971
|
+
return ((_error$extensions = error.extensions) === null || _error$extensions === void 0 ? void 0 : _error$extensions.code) === errorCode;
|
|
12972
|
+
});
|
|
12848
12973
|
};
|
|
12849
12974
|
|
|
12850
12975
|
const hasInvalidInputError = errors => hasErrorCode(errors, ERROR_CODES.invalidInput);
|
|
@@ -12856,7 +12981,7 @@ function minusify(value) {
|
|
|
12856
12981
|
return minus.concat(value);
|
|
12857
12982
|
}
|
|
12858
12983
|
|
|
12859
|
-
const flattenOperator = (operator, clauses) => compact__default["default"](_reduceInstanceProperty__default["default"](clauses).call(clauses, (result, clause) => _concatInstanceProperty__default["default"](result).call(result, clause
|
|
12984
|
+
const flattenOperator = (operator, clauses) => compact__default["default"](_reduceInstanceProperty__default["default"](clauses).call(clauses, (result, clause) => _concatInstanceProperty__default["default"](result).call(result, (clause === null || clause === void 0 ? void 0 : clause[operator]) || clause), []));
|
|
12860
12985
|
const argsToArray = args => _reduceInstanceProperty__default["default"](args).call(args, (result, item) => _concatInstanceProperty__default["default"](result).call(result, item), []);
|
|
12861
12986
|
const exists = (field, attributeType) => ({
|
|
12862
12987
|
exists: {
|
|
@@ -12913,7 +13038,7 @@ const not = function () {
|
|
|
12913
13038
|
|
|
12914
13039
|
const safelyAddFallback = function (string) {
|
|
12915
13040
|
let fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : constants.NO_VALUE_FALLBACK;
|
|
12916
|
-
return string === '' ? fallback : string
|
|
13041
|
+
return string === '' ? fallback : string !== null && string !== void 0 ? string : fallback;
|
|
12917
13042
|
};
|
|
12918
13043
|
|
|
12919
13044
|
var messages$1 = reactIntl.defineMessages({
|
|
@@ -13048,19 +13173,19 @@ const computedProperties = {
|
|
|
13048
13173
|
// has been deleted. See MC-1925 for further information.
|
|
13049
13174
|
const filteredCategories = _filterInstanceProperty__default["default"](_context6 = product.categories).call(_context6, category => category.obj !== undefined);
|
|
13050
13175
|
return _mapInstanceProperty__default["default"](filteredCategories).call(filteredCategories, category => {
|
|
13176
|
+
var _context7;
|
|
13051
13177
|
const categoryPath = getPathName(category, language, languages);
|
|
13052
13178
|
const ancestors = getAncestors(category, language);
|
|
13053
|
-
const externalIdValue = category.obj.externalId ?
|
|
13054
|
-
// hardcoding "ext. ID" since this is not part of a message to be
|
|
13179
|
+
const externalIdValue = category.obj.externalId ? // hardcoding "ext. ID" since this is not part of a message to be
|
|
13055
13180
|
// translated. This has been communicated with Jenn
|
|
13056
|
-
|
|
13181
|
+
"| ext. ID: ".concat(category.obj.externalId) : '';
|
|
13057
13182
|
return {
|
|
13058
13183
|
id: category.id,
|
|
13059
|
-
name:
|
|
13184
|
+
name: _concatInstanceProperty__default["default"](_context7 = "".concat(l10n.formatLocalizedString(category.obj, {
|
|
13060
13185
|
key: 'name',
|
|
13061
13186
|
locale: language,
|
|
13062
13187
|
fallbackOrder: languages
|
|
13063
|
-
})
|
|
13188
|
+
}), " ")).call(_context7, externalIdValue),
|
|
13064
13189
|
path: categoryPath,
|
|
13065
13190
|
level: ancestors.length
|
|
13066
13191
|
};
|
|
@@ -13097,13 +13222,13 @@ const getAttributeValueByType = _ref12 => {
|
|
|
13097
13222
|
value: value
|
|
13098
13223
|
});
|
|
13099
13224
|
case 'enum':
|
|
13100
|
-
return safelyAddFallback(value.label,
|
|
13225
|
+
return safelyAddFallback(value.label, "".concat(value.key, " (key)"));
|
|
13101
13226
|
case 'lenum':
|
|
13102
13227
|
return safelyAddFallback(l10n.formatLocalizedString(value, {
|
|
13103
13228
|
key: 'label',
|
|
13104
13229
|
locale: projectDataLocale,
|
|
13105
13230
|
fallbackOrder: projectLanguages
|
|
13106
|
-
}),
|
|
13231
|
+
}), "".concat(value.key, " (key)"));
|
|
13107
13232
|
case 'number':
|
|
13108
13233
|
return safelyAddFallback(value);
|
|
13109
13234
|
case 'boolean':
|
|
@@ -13126,7 +13251,7 @@ let RequestCache = /*#__PURE__*/function () {
|
|
|
13126
13251
|
this.result = null;
|
|
13127
13252
|
this.expiryDurationInSeconds = 5 * 60;
|
|
13128
13253
|
}
|
|
13129
|
-
_createClass(RequestCache, [{
|
|
13254
|
+
return _createClass(RequestCache, [{
|
|
13130
13255
|
key: "get",
|
|
13131
13256
|
value: function get(key) {
|
|
13132
13257
|
if (this.isValid(key)) {
|
|
@@ -13165,7 +13290,6 @@ let RequestCache = /*#__PURE__*/function () {
|
|
|
13165
13290
|
this.result = null;
|
|
13166
13291
|
}
|
|
13167
13292
|
}]);
|
|
13168
|
-
return RequestCache;
|
|
13169
13293
|
}();
|
|
13170
13294
|
|
|
13171
13295
|
// copied from
|
|
@@ -13226,6 +13350,7 @@ const reorderArrayItems = (array, from, to) => {
|
|
|
13226
13350
|
const mapTimeZonesToOptions = memoize__default["default"](timeZones => {
|
|
13227
13351
|
var _context;
|
|
13228
13352
|
return _mapInstanceProperty__default["default"](_context = _Object$entries__default["default"](timeZones)).call(_context, _ref => {
|
|
13353
|
+
var _context2;
|
|
13229
13354
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
13230
13355
|
code = _ref2[0],
|
|
13231
13356
|
value = _ref2[1];
|
|
@@ -13234,7 +13359,7 @@ const mapTimeZonesToOptions = memoize__default["default"](timeZones => {
|
|
|
13234
13359
|
//E.g. `(GMT +02:00) Central European Time - Berlin`
|
|
13235
13360
|
// unicode clock hex code: \u25F7
|
|
13236
13361
|
//
|
|
13237
|
-
label:
|
|
13362
|
+
label: _concatInstanceProperty__default["default"](_context2 = "(GMT ".concat(value.offset, ") ")).call(_context2, value.name)
|
|
13238
13363
|
};
|
|
13239
13364
|
});
|
|
13240
13365
|
});
|
|
@@ -13242,9 +13367,12 @@ const getTimeZoneId = memoize__default["default"]((selectedTimeZone, timeZones)
|
|
|
13242
13367
|
if (timeZones[selectedTimeZone]) {
|
|
13243
13368
|
return selectedTimeZone;
|
|
13244
13369
|
} else {
|
|
13245
|
-
var
|
|
13246
|
-
const fallbackTimeZoneId = _findInstanceProperty__default["default"](
|
|
13247
|
-
|
|
13370
|
+
var _context3;
|
|
13371
|
+
const fallbackTimeZoneId = _findInstanceProperty__default["default"](_context3 = _Object$keys__default["default"](timeZones)).call(_context3, timeZoneId => {
|
|
13372
|
+
var _timeZones$timeZoneId;
|
|
13373
|
+
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);
|
|
13374
|
+
});
|
|
13375
|
+
if (fallbackTimeZoneId !== null && fallbackTimeZoneId !== void 0 && fallbackTimeZoneId.length) {
|
|
13248
13376
|
return fallbackTimeZoneId.toString();
|
|
13249
13377
|
} else {
|
|
13250
13378
|
return 'UTC';
|
|
@@ -13252,9 +13380,10 @@ const getTimeZoneId = memoize__default["default"]((selectedTimeZone, timeZones)
|
|
|
13252
13380
|
}
|
|
13253
13381
|
});
|
|
13254
13382
|
const getTimeZoneLabel = memoize__default["default"]((selectedTimeZone, timeZones) => {
|
|
13383
|
+
var _context4;
|
|
13255
13384
|
const timeZoneId = getTimeZoneId(selectedTimeZone, timeZones);
|
|
13256
13385
|
const timeZoneData = timeZones[timeZoneId];
|
|
13257
|
-
return
|
|
13386
|
+
return _concatInstanceProperty__default["default"](_context4 = "(GMT ".concat(timeZoneData.offset, ") ")).call(_context4, timeZoneData.name);
|
|
13258
13387
|
});
|
|
13259
13388
|
|
|
13260
13389
|
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; }
|
|
@@ -13310,20 +13439,114 @@ var messages = reactIntl.defineMessages({
|
|
|
13310
13439
|
const FIELD_NAME = 'custom';
|
|
13311
13440
|
|
|
13312
13441
|
function ownKeys$2(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13313
|
-
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
13442
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context7 = ownKeys$2(Object(t), !0)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context8 = ownKeys$2(Object(t))).call(_context8, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
13443
|
+
const transformFieldType = fieldDefinition => {
|
|
13444
|
+
var _fieldDefinition$type, _fieldDefinition$type2;
|
|
13445
|
+
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') {
|
|
13446
|
+
var _context;
|
|
13447
|
+
return _objectSpread$2(_objectSpread$2({}, fieldDefinition.type), {}, {
|
|
13448
|
+
elementType: _objectSpread$2(_objectSpread$2({}, fieldDefinition.type.elementType), {}, {
|
|
13449
|
+
values: _mapInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](fieldDefinition.type.elementType)).call(_context, value => ({
|
|
13450
|
+
key: value.key,
|
|
13451
|
+
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
13452
|
+
}))
|
|
13453
|
+
})
|
|
13454
|
+
});
|
|
13455
|
+
} else if (((_fieldDefinition$type2 = fieldDefinition.type) === null || _fieldDefinition$type2 === void 0 ? void 0 : _fieldDefinition$type2.name) === 'LocalizedEnum') {
|
|
13456
|
+
var _context2;
|
|
13457
|
+
return _objectSpread$2(_objectSpread$2({}, fieldDefinition.type), {}, {
|
|
13458
|
+
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context2, value => ({
|
|
13459
|
+
key: value.key,
|
|
13460
|
+
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
13461
|
+
}))
|
|
13462
|
+
});
|
|
13463
|
+
} else {
|
|
13464
|
+
return fieldDefinition.type;
|
|
13465
|
+
}
|
|
13466
|
+
};
|
|
13467
|
+
const convertCustomField = resource => {
|
|
13468
|
+
var _context3, _context4;
|
|
13469
|
+
return {
|
|
13470
|
+
type: {
|
|
13471
|
+
typeId: 'type',
|
|
13472
|
+
id: resource.custom.type.id,
|
|
13473
|
+
obj: {
|
|
13474
|
+
key: resource.custom.type.key,
|
|
13475
|
+
name: l10n.transformLocalizedFieldToLocalizedString(resource.custom.type.nameAllLocales),
|
|
13476
|
+
fieldDefinitions: _mapInstanceProperty__default["default"](_context3 = resource.custom.type.fieldDefinitions).call(_context3, fieldDefinition => ({
|
|
13477
|
+
name: fieldDefinition.name,
|
|
13478
|
+
required: fieldDefinition.required,
|
|
13479
|
+
inputHint: fieldDefinition.inputHint,
|
|
13480
|
+
type: transformFieldType(fieldDefinition),
|
|
13481
|
+
label: l10n.transformLocalizedFieldToLocalizedString(fieldDefinition.labelAllLocales)
|
|
13482
|
+
}))
|
|
13483
|
+
}
|
|
13484
|
+
},
|
|
13485
|
+
fields: _reduceInstanceProperty__default["default"](_context4 = resource.custom.customFieldsRaw).call(_context4, (fields, customField) => _objectSpread$2(_objectSpread$2({}, fields), {}, {
|
|
13486
|
+
[customField.name]: customField.value
|
|
13487
|
+
}), {})
|
|
13488
|
+
};
|
|
13489
|
+
};
|
|
13490
|
+
const createFormStateFromResource = resource => {
|
|
13491
|
+
// If there are no custom fields on the resource, don't create a form state
|
|
13492
|
+
if (!resource[FIELD_NAME]) {
|
|
13493
|
+
return {
|
|
13494
|
+
[FIELD_NAME]: undefined
|
|
13495
|
+
};
|
|
13496
|
+
}
|
|
13497
|
+
return {
|
|
13498
|
+
[FIELD_NAME]: convertCustomField(resource)
|
|
13499
|
+
};
|
|
13500
|
+
};
|
|
13501
|
+
const createGraphQlDocFromFormState = formState => {
|
|
13502
|
+
var _formState$FIELD_NAME, _context5;
|
|
13503
|
+
// Unset the custom type if it's not in the form state
|
|
13504
|
+
if (!((_formState$FIELD_NAME = formState[FIELD_NAME]) !== null && _formState$FIELD_NAME !== void 0 && (_formState$FIELD_NAME = _formState$FIELD_NAME.type) !== null && _formState$FIELD_NAME !== void 0 && _formState$FIELD_NAME.id)) {
|
|
13505
|
+
return {
|
|
13506
|
+
[FIELD_NAME]: {}
|
|
13507
|
+
};
|
|
13508
|
+
}
|
|
13509
|
+
return {
|
|
13510
|
+
[FIELD_NAME]: {
|
|
13511
|
+
type: {
|
|
13512
|
+
id: formState[FIELD_NAME].type.id,
|
|
13513
|
+
typeId: 'type'
|
|
13514
|
+
},
|
|
13515
|
+
fields: _mapInstanceProperty__default["default"](_context5 = _Object$entries__default["default"](formState[FIELD_NAME].fields)).call(_context5, _ref => {
|
|
13516
|
+
let _ref2 = _slicedToArray(_ref, 2),
|
|
13517
|
+
name = _ref2[0],
|
|
13518
|
+
value = _ref2[1];
|
|
13519
|
+
return {
|
|
13520
|
+
name,
|
|
13521
|
+
value: _JSON$stringify__default["default"](value)
|
|
13522
|
+
};
|
|
13523
|
+
})
|
|
13524
|
+
}
|
|
13525
|
+
};
|
|
13526
|
+
};
|
|
13527
|
+
|
|
13528
|
+
// Creates a root field name accessor for `custom` form state
|
|
13529
|
+
const createRootFieldName = rootFieldName => {
|
|
13530
|
+
var _context6;
|
|
13531
|
+
return rootFieldName ? _concatInstanceProperty__default["default"](_context6 = "".concat(rootFieldName, ".")).call(_context6, FIELD_NAME) : FIELD_NAME;
|
|
13532
|
+
};
|
|
13533
|
+
|
|
13534
|
+
function ownKeys$1(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13535
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$1(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
13314
13536
|
const typeDefinitionsExist = typeDefinitions => {
|
|
13315
13537
|
return typeDefinitions.length > 0;
|
|
13316
13538
|
};
|
|
13317
|
-
const typeDefinitionSelected = formValues => {
|
|
13318
|
-
|
|
13539
|
+
const typeDefinitionSelected = (formValues, rootFieldName) => {
|
|
13540
|
+
var _getIn, _getIn2;
|
|
13541
|
+
return ((_getIn = formik.getIn(formValues, rootFieldName)) === null || _getIn === void 0 ? void 0 : _getIn.type) && ((_getIn2 = formik.getIn(formValues, rootFieldName)) === null || _getIn2 === void 0 || (_getIn2 = _getIn2.type) === null || _getIn2 === void 0 ? void 0 : _getIn2.obj);
|
|
13319
13542
|
};
|
|
13320
|
-
const typeDefinitionContainsFieldDefinitions = formValues => {
|
|
13321
|
-
return formValues
|
|
13543
|
+
const typeDefinitionContainsFieldDefinitions = (formValues, rootFieldName) => {
|
|
13544
|
+
return formik.getIn(formValues, rootFieldName).type.obj.key && formik.getIn(formValues, rootFieldName).type.obj.fieldDefinitions.length > 0;
|
|
13322
13545
|
};
|
|
13323
|
-
const fieldDefinitionsWithValues = formValues => {
|
|
13546
|
+
const fieldDefinitionsWithValues = (formValues, rootFieldName) => {
|
|
13324
13547
|
var _context;
|
|
13325
|
-
const fieldValues = formValues
|
|
13326
|
-
return _filterInstanceProperty__default["default"](_context = formValues
|
|
13548
|
+
const fieldValues = formik.getIn(formValues, rootFieldName).fields;
|
|
13549
|
+
return _filterInstanceProperty__default["default"](_context = formik.getIn(formValues, rootFieldName).type.obj.fieldDefinitions).call(_context, _ref => {
|
|
13327
13550
|
let name = _ref.name;
|
|
13328
13551
|
return fieldValues[name] !== undefined;
|
|
13329
13552
|
});
|
|
@@ -13331,34 +13554,36 @@ const fieldDefinitionsWithValues = formValues => {
|
|
|
13331
13554
|
const CustomFieldsInputWrapper = _ref2 => {
|
|
13332
13555
|
let typeDefinitions = _ref2.typeDefinitions,
|
|
13333
13556
|
isReadOnly = _ref2.isReadOnly,
|
|
13334
|
-
hideEmptyFields = _ref2.hideEmptyFields
|
|
13557
|
+
hideEmptyFields = _ref2.hideEmptyFields,
|
|
13558
|
+
rootFormStateFieldName = _ref2.rootFormStateFieldName;
|
|
13335
13559
|
const _useFormikContext = formik.useFormikContext(),
|
|
13336
13560
|
formValues = _valuesInstanceProperty__default["default"](_useFormikContext);
|
|
13561
|
+
const rootFieldName = createRootFieldName(rootFormStateFieldName);
|
|
13337
13562
|
if (!typeDefinitionsExist(typeDefinitions)) {
|
|
13338
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
13563
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$1({}, messages.noTypes));
|
|
13339
13564
|
}
|
|
13340
|
-
if (!typeDefinitionSelected(formValues)) {
|
|
13341
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
13565
|
+
if (!typeDefinitionSelected(formValues, rootFieldName)) {
|
|
13566
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$1({}, messages.noCustomType));
|
|
13342
13567
|
}
|
|
13343
|
-
if (!typeDefinitionContainsFieldDefinitions(formValues)) {
|
|
13344
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
13568
|
+
if (!typeDefinitionContainsFieldDefinitions(formValues, rootFieldName)) {
|
|
13569
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$1({}, messages.noCustomFields));
|
|
13345
13570
|
}
|
|
13346
|
-
if (fieldDefinitionsWithValues(formValues).length === 0 && isReadOnly && hideEmptyFields) {
|
|
13347
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
13571
|
+
if (fieldDefinitionsWithValues(formValues, rootFieldName).length === 0 && isReadOnly && hideEmptyFields) {
|
|
13572
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$1({}, messages.noInputValues));
|
|
13348
13573
|
}
|
|
13349
13574
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
13350
13575
|
max: "scale",
|
|
13351
13576
|
children: jsxRuntime.jsx(CustomFields, {
|
|
13352
13577
|
isReadOnly: isReadOnly,
|
|
13353
|
-
name:
|
|
13354
|
-
fieldDefinitions: isReadOnly && hideEmptyFields ? fieldDefinitionsWithValues(formValues) : formValues
|
|
13578
|
+
name: "".concat(rootFieldName, ".fields"),
|
|
13579
|
+
fieldDefinitions: isReadOnly && hideEmptyFields ? fieldDefinitionsWithValues(formValues, rootFieldName) : formik.getIn(formValues, rootFieldName).type.obj.fieldDefinitions
|
|
13355
13580
|
})
|
|
13356
13581
|
});
|
|
13357
13582
|
};
|
|
13358
13583
|
CustomFieldsInputWrapper.displayName = 'CustomFieldsInputWrapper';
|
|
13359
13584
|
|
|
13360
|
-
function ownKeys
|
|
13361
|
-
function _objectSpread
|
|
13585
|
+
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; }
|
|
13586
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
13362
13587
|
const mapTypeDefinitionsToOptions = (typeDefinitions, language, languages, selectedTypeDefinitionId) => {
|
|
13363
13588
|
return _mapInstanceProperty__default["default"](typeDefinitions).call(typeDefinitions, typeDefinition => ({
|
|
13364
13589
|
isDisabled: selectedTypeDefinitionId && selectedTypeDefinitionId === typeDefinition.type.id,
|
|
@@ -13385,10 +13610,13 @@ const createFormStateFromTypeDefinition = selectedTypeDefinition => {
|
|
|
13385
13610
|
};
|
|
13386
13611
|
};
|
|
13387
13612
|
const CustomTypeSubform = _ref => {
|
|
13613
|
+
var _getIn3, _getIn4;
|
|
13388
13614
|
let typeDefinitions = _ref.typeDefinitions,
|
|
13389
13615
|
isReadOnly = _ref.isReadOnly,
|
|
13390
13616
|
isCondensed = _ref.isCondensed,
|
|
13391
|
-
hideEmptyFields = _ref.hideEmptyFields
|
|
13617
|
+
hideEmptyFields = _ref.hideEmptyFields,
|
|
13618
|
+
rootFormStateFieldName = _ref.rootFormStateFieldName,
|
|
13619
|
+
panelTitle = _ref.panelTitle;
|
|
13392
13620
|
const _useFormikContext = formik.useFormikContext(),
|
|
13393
13621
|
formValues = _valuesInstanceProperty__default["default"](_useFormikContext),
|
|
13394
13622
|
setFieldValue = _useFormikContext.setFieldValue,
|
|
@@ -13401,22 +13629,24 @@ const CustomTypeSubform = _ref => {
|
|
|
13401
13629
|
})),
|
|
13402
13630
|
language = _useApplicationContex.language,
|
|
13403
13631
|
languages = _useApplicationContex.languages;
|
|
13632
|
+
const rootFieldName = createRootFieldName(rootFormStateFieldName);
|
|
13404
13633
|
const handleTypeDefinitionSelect = React.useCallback(event => {
|
|
13405
13634
|
const selectedTypeDefinition = _findInstanceProperty__default["default"](typeDefinitions).call(typeDefinitions, typeDefinition => typeDefinition.type.key === event.target.value);
|
|
13406
13635
|
if (selectedTypeDefinition) {
|
|
13407
13636
|
const nextCustom = createFormStateFromTypeDefinition(selectedTypeDefinition);
|
|
13408
|
-
setFieldValue(
|
|
13637
|
+
setFieldValue(rootFieldName, nextCustom).then(() => {
|
|
13409
13638
|
validateForm();
|
|
13410
13639
|
});
|
|
13411
13640
|
} else {
|
|
13412
13641
|
// if the dropdown selector is cleared, remove the `custom` field from the form state entirely
|
|
13413
|
-
setFieldValue(
|
|
13642
|
+
setFieldValue(rootFieldName, undefined).then(() => {
|
|
13414
13643
|
validateForm();
|
|
13415
13644
|
});
|
|
13416
13645
|
}
|
|
13417
|
-
}, [typeDefinitions, setFieldValue, validateForm]);
|
|
13646
|
+
}, [typeDefinitions, setFieldValue, validateForm, rootFieldName]);
|
|
13418
13647
|
const typeDefinitionSelected = formValues => {
|
|
13419
|
-
|
|
13648
|
+
var _getIn, _getIn2;
|
|
13649
|
+
return ((_getIn = formik.getIn(formValues, rootFieldName)) === null || _getIn === void 0 ? void 0 : _getIn.type) && ((_getIn2 = formik.getIn(formValues, rootFieldName)) === null || _getIn2 === void 0 || (_getIn2 = _getIn2.type) === null || _getIn2 === void 0 ? void 0 : _getIn2.obj);
|
|
13420
13650
|
};
|
|
13421
13651
|
|
|
13422
13652
|
// if the user has read-only permissions, empty fields are hidden, and no type definition is selected, hide the component
|
|
@@ -13424,16 +13654,16 @@ const CustomTypeSubform = _ref => {
|
|
|
13424
13654
|
return jsxRuntime.jsx(uiKit.CollapsiblePanel, {
|
|
13425
13655
|
header: jsxRuntime.jsx(uiKit.CollapsiblePanel.Header, {
|
|
13426
13656
|
isCondensed: isCondensed,
|
|
13427
|
-
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread
|
|
13657
|
+
children: panelTitle || jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread({}, messages.title))
|
|
13428
13658
|
}),
|
|
13429
13659
|
headerControls: typeDefinitions.length > 0 && jsxRuntime.jsx("div", {
|
|
13430
|
-
css: /*#__PURE__*/react$1.css("min-width:", uiKit.designTokens.constraint11, ";" + (process.env.NODE_ENV === "production" ? "" : ";label:CustomTypeSubform;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
13660
|
+
css: /*#__PURE__*/react$1.css("min-width:", uiKit.designTokens.constraint11, ";" + (process.env.NODE_ENV === "production" ? "" : ";label:CustomTypeSubform;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImN1c3RvbS10eXBlLXN1YmZvcm0uanN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXFIb0IiLCJmaWxlIjoiY3VzdG9tLXR5cGUtc3ViZm9ybS5qc3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyB1c2VDYWxsYmFjayB9IGZyb20gJ3JlYWN0JztcbmltcG9ydCBQcm9wVHlwZXMgZnJvbSAncHJvcC10eXBlcyc7XG5pbXBvcnQgeyB1c2VGb3JtaWtDb250ZXh0LCBnZXRJbiB9IGZyb20gJ2Zvcm1payc7XG5pbXBvcnQgeyBGb3JtYXR0ZWRNZXNzYWdlLCB1c2VJbnRsIH0gZnJvbSAncmVhY3QtaW50bCc7XG5pbXBvcnQgeyB1c2VBcHBsaWNhdGlvbkNvbnRleHQgfSBmcm9tICdAY29tbWVyY2V0b29scy1mcm9udGVuZC9hcHBsaWNhdGlvbi1zaGVsbC1jb25uZWN0b3JzJztcbmltcG9ydCB7IGZvcm1hdExvY2FsaXplZFN0cmluZyB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLWZyb250ZW5kL2wxMG4nO1xuaW1wb3J0IHtcbiAgQ29sbGFwc2libGVQYW5lbCxcbiAgU2VsZWN0SW5wdXQsXG4gIGRlc2lnblRva2Vucyxcbn0gZnJvbSAnQGNvbW1lcmNldG9vbHMtZnJvbnRlbmQvdWkta2l0JztcbmltcG9ydCBtZXNzYWdlcyBmcm9tICcuL21lc3NhZ2VzJztcbmltcG9ydCBDdXN0b21GaWVsZHNJbnB1dFdyYXBwZXIgZnJvbSAnLi9jdXN0b20tZmllbGRzLWlucHV0LXdyYXBwZXInO1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHsgY3JlYXRlUm9vdEZpZWxkTmFtZSB9IGZyb20gJy4vdXRpbHMnO1xuXG4vLyBDcmVhdGVzIGRyb3Bkb3duIG9wdGlvbnNcbmV4cG9ydCBjb25zdCBtYXBUeXBlRGVmaW5pdGlvbnNUb09wdGlvbnMgPSAoXG4gIHR5cGVEZWZpbml0aW9ucyxcbiAgbGFuZ3VhZ2UsXG4gIGxhbmd1YWdlcyxcbiAgc2VsZWN0ZWRUeXBlRGVmaW5pdGlvbklkXG4pID0+IHtcbiAgcmV0dXJuIHR5cGVEZWZpbml0aW9ucy5tYXAoKHR5cGVEZWZpbml0aW9uKSA9PiAoe1xuICAgIGlzRGlzYWJsZWQ6XG4gICAgICBzZWxlY3RlZFR5cGVEZWZpbml0aW9uSWQgJiZcbiAgICAgIHNlbGVjdGVkVHlwZURlZmluaXRpb25JZCA9PT0gdHlwZURlZmluaXRpb24udHlwZS5pZCxcbiAgICB2YWx1ZTogdHlwZURlZmluaXRpb24udHlwZS5rZXksXG4gICAgbGFiZWw6IGZvcm1hdExvY2FsaXplZFN0cmluZyh0eXBlRGVmaW5pdGlvbi50eXBlLCB7XG4gICAgICBrZXk6ICduYW1lJyxcbiAgICAgIGxvY2FsZTogbGFuZ3VhZ2UsXG4gICAgICBmYWxsYmFja09yZGVyOiBsYW5ndWFnZXMsXG4gICAgfSksXG4gIH0pKTtcbn07XG5cbi8vIFVzZWQgdG8gZ2VuZXJhdGUgZm9ybSBzdGF0ZSB3aGVuIHRoZSB1c2VyIHNlbGVjdHMgYSB0eXBlIGRlZmluaXRpb24gZnJvbSB0aGUgZHJvcGRvd25cbmNvbnN0IGNyZWF0ZUZvcm1TdGF0ZUZyb21UeXBlRGVmaW5pdGlvbiA9IChzZWxlY3RlZFR5cGVEZWZpbml0aW9uKSA9PiB7XG4gIHJldHVybiB7XG4gICAgdHlwZToge1xuICAgICAgaWQ6IHNlbGVjdGVkVHlwZURlZmluaXRpb24udHlwZS5pZCxcbiAgICAgIG9iajoge1xuICAgICAgICBmaWVsZERlZmluaXRpb25zOiBzZWxlY3RlZFR5cGVEZWZpbml0aW9uLnR5cGUuZmllbGREZWZpbml0aW9ucyxcbiAgICAgICAga2V5OiBzZWxlY3RlZFR5cGVEZWZpbml0aW9uLnR5cGUua2V5LFxuICAgICAgfSxcbiAgICB9LFxuICAgIGZpZWxkczoge30sXG4gIH07XG59O1xuXG5jb25zdCBDdXN0b21UeXBlU3ViZm9ybSA9ICh7XG4gIHR5cGVEZWZpbml0aW9ucyxcbiAgaXNSZWFkT25seSxcbiAgaXNDb25kZW5zZWQsXG4gIGhpZGVFbXB0eUZpZWxkcyxcbiAgcm9vdEZvcm1TdGF0ZUZpZWxkTmFtZSxcbiAgcGFuZWxUaXRsZSxcbn0pID0+IHtcbiAgY29uc3Qge1xuICAgIHZhbHVlczogZm9ybVZhbHVlcyxcbiAgICBzZXRGaWVsZFZhbHVlLFxuICAgIHZhbGlkYXRlRm9ybSxcbiAgfSA9IHVzZUZvcm1pa0NvbnRleHQoKTtcbiAgY29uc3QgeyBmb3JtYXRNZXNzYWdlIH0gPSB1c2VJbnRsKCk7XG4gIGNvbnN0IHsgbGFuZ3VhZ2UsIGxhbmd1YWdlcyB9ID0gdXNlQXBwbGljYXRpb25Db250ZXh0KFxuICAgIChhcHBsaWNhdGlvbkNvbnRleHQpID0+ICh7XG4gICAgICBsYW5ndWFnZTogYXBwbGljYXRpb25Db250ZXh0LmRhdGFMb2NhbGUsXG4gICAgICBsYW5ndWFnZXM6IGFwcGxpY2F0aW9uQ29udGV4dC5wcm9qZWN0Lmxhbmd1YWdlcyxcbiAgICB9KVxuICApO1xuICBjb25zdCByb290RmllbGROYW1lID0gY3JlYXRlUm9vdEZpZWxkTmFtZShyb290Rm9ybVN0YXRlRmllbGROYW1lKTtcblxuICBjb25zdCBoYW5kbGVUeXBlRGVmaW5pdGlvblNlbGVjdCA9IHVzZUNhbGxiYWNrKFxuICAgIChldmVudCkgPT4ge1xuICAgICAgY29uc3Qgc2VsZWN0ZWRUeXBlRGVmaW5pdGlvbiA9IHR5cGVEZWZpbml0aW9ucy5maW5kKFxuICAgICAgICAodHlwZURlZmluaXRpb24pID0+IHR5cGVEZWZpbml0aW9uLnR5cGUua2V5ID09PSBldmVudC50YXJnZXQudmFsdWVcbiAgICAgICk7XG5cbiAgICAgIGlmIChzZWxlY3RlZFR5cGVEZWZpbml0aW9uKSB7XG4gICAgICAgIGNvbnN0IG5leHRDdXN0b20gPSBjcmVhdGVGb3JtU3RhdGVGcm9tVHlwZURlZmluaXRpb24oXG4gICAgICAgICAgc2VsZWN0ZWRUeXBlRGVmaW5pdGlvblxuICAgICAgICApO1xuXG4gICAgICAgIHNldEZpZWxkVmFsdWUocm9vdEZpZWxkTmFtZSwgbmV4dEN1c3RvbSkudGhlbigoKSA9PiB7XG4gICAgICAgICAgdmFsaWRhdGVGb3JtKCk7XG4gICAgICAgIH0pO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgLy8gaWYgdGhlIGRyb3Bkb3duIHNlbGVjdG9yIGlzIGNsZWFyZWQsIHJlbW92ZSB0aGUgYGN1c3RvbWAgZmllbGQgZnJvbSB0aGUgZm9ybSBzdGF0ZSBlbnRpcmVseVxuICAgICAgICBzZXRGaWVsZFZhbHVlKHJvb3RGaWVsZE5hbWUsIHVuZGVmaW5lZCkudGhlbigoKSA9PiB7XG4gICAgICAgICAgdmFsaWRhdGVGb3JtKCk7XG4gICAgICAgIH0pO1xuICAgICAgfVxuICAgIH0sXG4gICAgW3R5cGVEZWZpbml0aW9ucywgc2V0RmllbGRWYWx1ZSwgdmFsaWRhdGVGb3JtLCByb290RmllbGROYW1lXVxuICApO1xuXG4gIGNvbnN0IHR5cGVEZWZpbml0aW9uU2VsZWN0ZWQgPSAoZm9ybVZhbHVlcykgPT4ge1xuICAgIHJldHVybiAoXG4gICAgICBnZXRJbihmb3JtVmFsdWVzLCByb290RmllbGROYW1lKT8udHlwZSAmJlxuICAgICAgZ2V0SW4oZm9ybVZhbHVlcywgcm9vdEZpZWxkTmFtZSk/LnR5cGU/Lm9ialxuICAgICk7XG4gIH07XG5cbiAgLy8gaWYgdGhlIHVzZXIgaGFzIHJlYWQtb25seSBwZXJtaXNzaW9ucywgZW1wdHkgZmllbGRzIGFyZSBoaWRkZW4sIGFuZCBubyB0eXBlIGRlZmluaXRpb24gaXMgc2VsZWN0ZWQsIGhpZGUgdGhlIGNvbXBvbmVudFxuICBpZiAoaXNSZWFkT25seSAmJiBoaWRlRW1wdHlGaWVsZHMgJiYgIXR5cGVEZWZpbml0aW9uU2VsZWN0ZWQoZm9ybVZhbHVlcykpXG4gICAgcmV0dXJuIG51bGw7XG5cbiAgcmV0dXJuIChcbiAgICA8Q29sbGFwc2libGVQYW5lbFxuICAgICAgaGVhZGVyPXtcbiAgICAgICAgPENvbGxhcHNpYmxlUGFuZWwuSGVhZGVyIGlzQ29uZGVuc2VkPXtpc0NvbmRlbnNlZH0+XG4gICAgICAgICAge3BhbmVsVGl0bGUgfHwgPEZvcm1hdHRlZE1lc3NhZ2Ugey4uLm1lc3NhZ2VzLnRpdGxlfSAvPn1cbiAgICAgICAgPC9Db2xsYXBzaWJsZVBhbmVsLkhlYWRlcj5cbiAgICAgIH1cbiAgICAgIGhlYWRlckNvbnRyb2xzPXtcbiAgICAgICAgdHlwZURlZmluaXRpb25zLmxlbmd0aCA+IDAgJiYgKFxuICAgICAgICAgIDxkaXZcbiAgICAgICAgICAgIGNzcz17Y3NzYFxuICAgICAgICAgICAgICBtaW4td2lkdGg6ICR7ZGVzaWduVG9rZW5zLmNvbnN0cmFpbnQxMX07XG4gICAgICAgICAgICBgfVxuICAgICAgICAgID5cbiAgICAgICAgICAgIDxTZWxlY3RJbnB1dFxuICAgICAgICAgICAgICBpc0NsZWFyYWJsZVxuICAgICAgICAgICAgICBkYXRhLXRlc3RpZD1cImN1c3RvbS10eXBlLXNlbGVjdFwiXG4gICAgICAgICAgICAgIG5hbWU9e2Ake3Jvb3RGaWVsZE5hbWV9LnR5cGUub2JqLmtleWB9XG4gICAgICAgICAgICAgIG9wdGlvbnM9e21hcFR5cGVEZWZpbml0aW9uc1RvT3B0aW9ucyhcbiAgICAgICAgICAgICAgICB0eXBlRGVmaW5pdGlvbnMsXG4gICAgICAgICAgICAgICAgbGFuZ3VhZ2UsXG4gICAgICAgICAgICAgICAgbGFuZ3VhZ2VzLFxuXG4gICAgICAgICAgICAgICAgZ2V0SW4oZm9ybVZhbHVlcywgcm9vdEZpZWxkTmFtZSk/LnR5cGU/LmlkXG4gICAgICAgICAgICAgICl9XG4gICAgICAgICAgICAgIHZhbHVlPXtnZXRJbihmb3JtVmFsdWVzLCByb290RmllbGROYW1lKT8udHlwZT8ub2JqPy5rZXl9XG4gICAgICAgICAgICAgIG9uQ2hhbmdlPXtoYW5kbGVUeXBlRGVmaW5pdGlvblNlbGVjdH1cbiAgICAgICAgICAgICAgcGxhY2Vob2xkZXI9e2Zvcm1hdE1lc3NhZ2UobWVzc2FnZXMudHlwZXNQbGFjZWhvbGRlcil9XG4gICAgICAgICAgICAgIGlzUmVhZE9ubHk9e2lzUmVhZE9ubHl9XG4gICAgICAgICAgICAvPlxuICAgICAgICAgIDwvZGl2PlxuICAgICAgICApXG4gICAgICB9XG4gICAgICBoZWFkZXJDb250cm9sc0FsaWdubWVudD1cInJpZ2h0XCJcbiAgICA+XG4gICAgICA8Q3VzdG9tRmllbGRzSW5wdXRXcmFwcGVyXG4gICAgICAgIHR5cGVEZWZpbml0aW9ucz17dHlwZURlZmluaXRpb25zfVxuICAgICAgICBpc1JlYWRPbmx5PXtpc1JlYWRPbmx5fVxuICAgICAgICBoaWRlRW1wdHlGaWVsZHM9e2hpZGVFbXB0eUZpZWxkc31cbiAgICAgICAgcm9vdEZvcm1TdGF0ZUZpZWxkTmFtZT17cm9vdEZvcm1TdGF0ZUZpZWxkTmFtZX1cbiAgICAgIC8+XG4gICAgPC9Db2xsYXBzaWJsZVBhbmVsPlxuICApO1xufTtcblxuQ3VzdG9tVHlwZVN1YmZvcm0uZGlzcGxheU5hbWUgPSAnQ3VzdG9tVHlwZVN1YmZvcm0nO1xuQ3VzdG9tVHlwZVN1YmZvcm0ucHJvcFR5cGVzID0ge1xuICB0eXBlRGVmaW5pdGlvbnM6IFByb3BUeXBlcy5hcnJheS5pc1JlcXVpcmVkLFxuICBpc1JlYWRPbmx5OiBQcm9wVHlwZXMuYm9vbCxcbiAgaXNDb25kZW5zZWQ6IFByb3BUeXBlcy5ib29sLFxuICBoaWRlRW1wdHlGaWVsZHM6IFByb3BUeXBlcy5ib29sLFxuICByb290Rm9ybVN0YXRlRmllbGROYW1lOiBQcm9wVHlwZXMuc3RyaW5nLFxuICBwYW5lbFRpdGxlOiBQcm9wVHlwZXMubm9kZSxcbn07XG5cbmV4cG9ydCBkZWZhdWx0IEN1c3RvbVR5cGVTdWJmb3JtO1xuIl19 */"),
|
|
13431
13661
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
13432
13662
|
isClearable: true,
|
|
13433
13663
|
"data-testid": "custom-type-select",
|
|
13434
|
-
name:
|
|
13435
|
-
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages, formValues
|
|
13436
|
-
value: formValues
|
|
13664
|
+
name: "".concat(rootFieldName, ".type.obj.key"),
|
|
13665
|
+
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages, (_getIn3 = formik.getIn(formValues, rootFieldName)) === null || _getIn3 === void 0 || (_getIn3 = _getIn3.type) === null || _getIn3 === void 0 ? void 0 : _getIn3.id),
|
|
13666
|
+
value: (_getIn4 = formik.getIn(formValues, rootFieldName)) === null || _getIn4 === void 0 || (_getIn4 = _getIn4.type) === null || _getIn4 === void 0 || (_getIn4 = _getIn4.obj) === null || _getIn4 === void 0 ? void 0 : _getIn4.key,
|
|
13437
13667
|
onChange: handleTypeDefinitionSelect,
|
|
13438
13668
|
placeholder: formatMessage(messages.typesPlaceholder),
|
|
13439
13669
|
isReadOnly: isReadOnly
|
|
@@ -13443,103 +13673,20 @@ const CustomTypeSubform = _ref => {
|
|
|
13443
13673
|
children: jsxRuntime.jsx(CustomFieldsInputWrapper, {
|
|
13444
13674
|
typeDefinitions: typeDefinitions,
|
|
13445
13675
|
isReadOnly: isReadOnly,
|
|
13446
|
-
hideEmptyFields: hideEmptyFields
|
|
13676
|
+
hideEmptyFields: hideEmptyFields,
|
|
13677
|
+
rootFormStateFieldName: rootFormStateFieldName
|
|
13447
13678
|
})
|
|
13448
13679
|
});
|
|
13449
13680
|
};
|
|
13450
13681
|
CustomTypeSubform.displayName = 'CustomTypeSubform';
|
|
13451
13682
|
|
|
13452
|
-
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; }
|
|
13453
|
-
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; }
|
|
13454
|
-
const transformFieldType = fieldDefinition => {
|
|
13455
|
-
if (fieldDefinition.type?.elementType?.name === 'LocalizedEnum') {
|
|
13456
|
-
var _context;
|
|
13457
|
-
return _objectSpread(_objectSpread({}, fieldDefinition.type), {}, {
|
|
13458
|
-
elementType: _objectSpread(_objectSpread({}, fieldDefinition.type.elementType), {}, {
|
|
13459
|
-
values: _mapInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](fieldDefinition.type.elementType)).call(_context, value => ({
|
|
13460
|
-
key: value.key,
|
|
13461
|
-
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
13462
|
-
}))
|
|
13463
|
-
})
|
|
13464
|
-
});
|
|
13465
|
-
} else if (fieldDefinition.type?.name === 'LocalizedEnum') {
|
|
13466
|
-
var _context2;
|
|
13467
|
-
return _objectSpread(_objectSpread({}, fieldDefinition.type), {}, {
|
|
13468
|
-
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context2, value => ({
|
|
13469
|
-
key: value.key,
|
|
13470
|
-
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
13471
|
-
}))
|
|
13472
|
-
});
|
|
13473
|
-
} else {
|
|
13474
|
-
return fieldDefinition.type;
|
|
13475
|
-
}
|
|
13476
|
-
};
|
|
13477
|
-
const convertCustomField = resource => {
|
|
13478
|
-
var _context3, _context4;
|
|
13479
|
-
return {
|
|
13480
|
-
type: {
|
|
13481
|
-
typeId: 'type',
|
|
13482
|
-
id: resource.custom.type.id,
|
|
13483
|
-
obj: {
|
|
13484
|
-
key: resource.custom.type.key,
|
|
13485
|
-
name: l10n.transformLocalizedFieldToLocalizedString(resource.custom.type.nameAllLocales),
|
|
13486
|
-
fieldDefinitions: _mapInstanceProperty__default["default"](_context3 = resource.custom.type.fieldDefinitions).call(_context3, fieldDefinition => ({
|
|
13487
|
-
name: fieldDefinition.name,
|
|
13488
|
-
required: fieldDefinition.required,
|
|
13489
|
-
inputHint: fieldDefinition.inputHint,
|
|
13490
|
-
type: transformFieldType(fieldDefinition),
|
|
13491
|
-
label: l10n.transformLocalizedFieldToLocalizedString(fieldDefinition.labelAllLocales)
|
|
13492
|
-
}))
|
|
13493
|
-
}
|
|
13494
|
-
},
|
|
13495
|
-
fields: _reduceInstanceProperty__default["default"](_context4 = resource.custom.customFieldsRaw).call(_context4, (fields, customField) => _objectSpread(_objectSpread({}, fields), {}, {
|
|
13496
|
-
[customField.name]: customField.value
|
|
13497
|
-
}), {})
|
|
13498
|
-
};
|
|
13499
|
-
};
|
|
13500
|
-
const createFormStateFromResource = resource => {
|
|
13501
|
-
// If there are no custom fields on the resource, don't create a form state
|
|
13502
|
-
if (!resource[FIELD_NAME]) {
|
|
13503
|
-
return {
|
|
13504
|
-
[FIELD_NAME]: undefined
|
|
13505
|
-
};
|
|
13506
|
-
}
|
|
13507
|
-
return {
|
|
13508
|
-
[FIELD_NAME]: convertCustomField(resource)
|
|
13509
|
-
};
|
|
13510
|
-
};
|
|
13511
|
-
const createGraphQlDocFromFormState = formState => {
|
|
13512
|
-
var _context5;
|
|
13513
|
-
// Unset the custom type if it's not in the form state
|
|
13514
|
-
if (!formState[FIELD_NAME]) {
|
|
13515
|
-
return {
|
|
13516
|
-
[FIELD_NAME]: {}
|
|
13517
|
-
};
|
|
13518
|
-
}
|
|
13519
|
-
return {
|
|
13520
|
-
[FIELD_NAME]: {
|
|
13521
|
-
type: {
|
|
13522
|
-
id: formState[FIELD_NAME].type.id,
|
|
13523
|
-
typeId: 'type'
|
|
13524
|
-
},
|
|
13525
|
-
fields: _mapInstanceProperty__default["default"](_context5 = _Object$entries__default["default"](formState[FIELD_NAME].fields)).call(_context5, _ref => {
|
|
13526
|
-
let _ref2 = _slicedToArray(_ref, 2),
|
|
13527
|
-
name = _ref2[0],
|
|
13528
|
-
value = _ref2[1];
|
|
13529
|
-
return {
|
|
13530
|
-
name,
|
|
13531
|
-
value: _JSON$stringify__default["default"](value)
|
|
13532
|
-
};
|
|
13533
|
-
})
|
|
13534
|
-
}
|
|
13535
|
-
};
|
|
13536
|
-
};
|
|
13537
|
-
|
|
13538
13683
|
const CustomFieldsFormField = _ref => {
|
|
13539
13684
|
let resources = _ref.resources,
|
|
13540
13685
|
isReadOnly = _ref.isReadOnly,
|
|
13541
13686
|
isCondensed = _ref.isCondensed,
|
|
13542
|
-
hideEmptyFields = _ref.hideEmptyFields
|
|
13687
|
+
hideEmptyFields = _ref.hideEmptyFields,
|
|
13688
|
+
rootFormStateFieldName = _ref.rootFormStateFieldName,
|
|
13689
|
+
panelTitle = _ref.panelTitle;
|
|
13543
13690
|
const projectKey = applicationShellConnectors.useApplicationContext(applicationContext => applicationContext.project.key);
|
|
13544
13691
|
return jsxRuntime.jsx(CustomFieldTypeDefinitionsConnector$1, {
|
|
13545
13692
|
resources: resources,
|
|
@@ -13557,7 +13704,9 @@ const CustomFieldsFormField = _ref => {
|
|
|
13557
13704
|
typeDefinitions: typeDefinitions,
|
|
13558
13705
|
isReadOnly: isReadOnly,
|
|
13559
13706
|
isCondensed: isCondensed,
|
|
13560
|
-
hideEmptyFields: hideEmptyFields
|
|
13707
|
+
hideEmptyFields: hideEmptyFields,
|
|
13708
|
+
rootFormStateFieldName: rootFormStateFieldName,
|
|
13709
|
+
panelTitle: panelTitle
|
|
13561
13710
|
});
|
|
13562
13711
|
}
|
|
13563
13712
|
});
|
|
@@ -13576,6 +13725,7 @@ exports.CenteredLoadingSpinner = CenteredLoadingSpinner;
|
|
|
13576
13725
|
exports.ChannelPickerInput = ChannelPickerInput;
|
|
13577
13726
|
exports.CountriesPicker = CountriesPicker;
|
|
13578
13727
|
exports.CustomFieldDefinitionsConnector = customFieldDefinitionsConnector;
|
|
13728
|
+
exports.CustomFieldTooltip = CustomFieldTooltip;
|
|
13579
13729
|
exports.CustomFieldTypeDefinitionsConnector = CustomFieldTypeDefinitionsConnector$1;
|
|
13580
13730
|
exports.CustomFields = CustomFields;
|
|
13581
13731
|
exports.CustomFieldsErrorTextNotification = CustomFieldsErrorTextNotification;
|
|
@@ -13590,6 +13740,7 @@ exports.LabelRange = LabelRange;
|
|
|
13590
13740
|
exports.MissingValueField = MissingValueField;
|
|
13591
13741
|
exports.MultiValueSearchInput = MultiValueSearchInput;
|
|
13592
13742
|
exports.NumericFormatInput = numericFormatInput;
|
|
13743
|
+
exports.Option = Option$2;
|
|
13593
13744
|
exports.PRECISION_TYPES = PRECISION_TYPES;
|
|
13594
13745
|
exports.PimIndexerProvider = pimIndexerProvider;
|
|
13595
13746
|
exports.ProductAttributeInput = ProductAttributeInput;
|
|
@@ -13652,6 +13803,7 @@ exports.formatProductAttribute = formatAttribute;
|
|
|
13652
13803
|
exports.getAncestors = getAncestors;
|
|
13653
13804
|
exports.getAttributeValueByType = getAttributeValueByType;
|
|
13654
13805
|
exports.getAttributeValueType = getAttributeValueType;
|
|
13806
|
+
exports.getBottomOption = getBottomOption;
|
|
13655
13807
|
exports.getBulkNotification = getBulkNotification;
|
|
13656
13808
|
exports.getCategoryLevel = getCategoryLevel;
|
|
13657
13809
|
exports.getCountsFromBulkSummary = getCountsFromBulkSummary;
|
|
@@ -13736,11 +13888,13 @@ exports.truncate = truncate;
|
|
|
13736
13888
|
exports.unique = unique;
|
|
13737
13889
|
exports.uniqueObjects = uniqueObjects;
|
|
13738
13890
|
exports.useCachedCategoryOptions = useCachedCategoryOptions;
|
|
13891
|
+
exports.useCurrentOption = useCurrentOption;
|
|
13739
13892
|
exports.useCustomFieldsDnDContext = useDnDContext;
|
|
13740
13893
|
exports.useCustomerGroupsPlatformLimits = useCustomerGroupsPlatformLimits;
|
|
13741
13894
|
exports.useCustomersPlatformLimits = useCustomersPlatformLimits;
|
|
13742
13895
|
exports.useDebouncedPromiseCallback = useDebouncedPromiseCallback;
|
|
13743
13896
|
exports.useFormatLocalizedFieldToString = useFormatLocalizedFieldToString;
|
|
13897
|
+
exports.useLoadOptions = useLoadOptions;
|
|
13744
13898
|
exports.useLocalizedKeyFallback = useLocalizedKeyFallback;
|
|
13745
13899
|
exports.usePendingRequests = usePendingRequests;
|
|
13746
13900
|
exports.usePersistedTableConfiguration = usePersistedTableConfiguration;
|