@commercetools-frontend/experimental-components 5.4.3 → 5.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commercetools-frontend-experimental-components.cjs.dev.js +483 -614
- package/dist/commercetools-frontend-experimental-components.cjs.prod.js +481 -612
- package/dist/commercetools-frontend-experimental-components.esm.js +481 -612
- package/dist/styles.css +179 -170
- package/package.json +12 -12
|
@@ -26,14 +26,12 @@ import { formatLocalizedString, transformLocalizedFieldToLocalizedString, applyT
|
|
|
26
26
|
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
27
27
|
import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
|
|
28
28
|
import camelCase from 'lodash/camelCase';
|
|
29
|
-
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
30
29
|
import _sliceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/slice';
|
|
31
30
|
import _sortInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/sort';
|
|
32
31
|
import _indexOfInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/index-of';
|
|
33
32
|
import { deepEqual } from 'fast-equals';
|
|
34
33
|
import { defineMessages, useIntl, injectIntl, FormattedMessage } from 'react-intl';
|
|
35
34
|
import omitEmpty from 'omit-empty-es';
|
|
36
|
-
import _taggedTemplateLiteral from '@babel/runtime-corejs3/helpers/esm/taggedTemplateLiteral';
|
|
37
35
|
import oneLine from 'common-tags/lib/oneLine';
|
|
38
36
|
import moment from 'moment-timezone';
|
|
39
37
|
import isNil$1 from 'lodash/isNil';
|
|
@@ -68,15 +66,14 @@ import has from 'lodash/has';
|
|
|
68
66
|
import _toArray from '@babel/runtime-corejs3/helpers/esm/toArray';
|
|
69
67
|
import _reverseInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reverse';
|
|
70
68
|
import { useAsyncDispatch, actions } from '@commercetools-frontend/sdk';
|
|
71
|
-
import { useApolloClient as useApolloClient$1, useQuery as useQuery$2 } from '@apollo/client';
|
|
72
69
|
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/esm/objectWithoutProperties';
|
|
70
|
+
import { useApolloClient as useApolloClient$1, useQuery as useQuery$2 } from '@apollo/client';
|
|
73
71
|
import _Object$entries from '@babel/runtime-corejs3/core-js-stable/object/entries';
|
|
74
72
|
import _parseFloat from '@babel/runtime-corejs3/core-js-stable/parse-float';
|
|
75
73
|
import omit from 'lodash/omit';
|
|
76
74
|
import isEmpty$3 from 'lodash/isEmpty';
|
|
77
75
|
import _Object$freeze from '@babel/runtime-corejs3/core-js-stable/object/freeze';
|
|
78
76
|
import originalOmitDeep from 'omit-deep';
|
|
79
|
-
import _findIndexInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/find-index';
|
|
80
77
|
import _Object$values from '@babel/runtime-corejs3/core-js-stable/object/values';
|
|
81
78
|
import _parseInt from '@babel/runtime-corejs3/core-js-stable/parse-int';
|
|
82
79
|
import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
|
|
@@ -104,12 +101,14 @@ import flatMap from 'lodash/flatMap';
|
|
|
104
101
|
import { connect } from 'react-redux';
|
|
105
102
|
import { oneLineTrim } from 'common-tags';
|
|
106
103
|
import warning from 'tiny-warning';
|
|
104
|
+
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
107
105
|
import _Math$trunc from '@babel/runtime-corejs3/core-js-stable/math/trunc';
|
|
108
106
|
import _Number$isNaN from '@babel/runtime-corejs3/core-js-stable/number/is-nan';
|
|
109
107
|
import isUndefined from 'lodash/isUndefined';
|
|
110
108
|
import isFinite from 'lodash/isFinite';
|
|
111
109
|
import Cleave from 'cleave.js/react';
|
|
112
110
|
import _Object$assign from '@babel/runtime-corejs3/core-js-stable/object/assign';
|
|
111
|
+
import _findIndexInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/find-index';
|
|
113
112
|
import compact from 'lodash/compact';
|
|
114
113
|
import _Set from '@babel/runtime-corejs3/core-js-stable/set';
|
|
115
114
|
import '@babel/runtime-corejs3/helpers/get';
|
|
@@ -208,7 +207,7 @@ function filterDataAttributes(obj) {
|
|
|
208
207
|
* duplicated in original values
|
|
209
208
|
*/
|
|
210
209
|
function unique(values, properties) {
|
|
211
|
-
var
|
|
210
|
+
var _context;
|
|
212
211
|
let ignoredValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['', null, undefined];
|
|
213
212
|
const duplicateValues = [];
|
|
214
213
|
let realValues;
|
|
@@ -217,20 +216,19 @@ function unique(values, properties) {
|
|
|
217
216
|
realValues = _filterInstanceProperty(values).call(values, value => !_includesInstanceProperty(ignoredValues).call(ignoredValues, value));
|
|
218
217
|
if (!realValues.length) return [];
|
|
219
218
|
if (properties) realValues = _mapInstanceProperty(realValues).call(realValues, value => _reduceInstanceProperty(properties).call(properties, (prev, curr) => {
|
|
220
|
-
var _context;
|
|
221
219
|
const currentValue = value[curr] || '';
|
|
222
|
-
return
|
|
220
|
+
return `${prev}:${currentValue}`;
|
|
223
221
|
}, ''));else realValues = _sliceInstanceProperty(values).call(values, 0);
|
|
224
222
|
|
|
225
223
|
// TODO: checking for dupes like this is slow, find a better way
|
|
226
|
-
_reduceInstanceProperty(
|
|
224
|
+
_reduceInstanceProperty(_context = _sortInstanceProperty(realValues).call(realValues)).call(_context, (prev, curr) => {
|
|
227
225
|
if (curr === null) return curr;
|
|
228
226
|
if (curr !== '' && prev === curr && _indexOfInstanceProperty(duplicateValues).call(duplicateValues, curr) === -1) duplicateValues.push(curr);
|
|
229
227
|
return curr;
|
|
230
228
|
});
|
|
231
229
|
if (properties) return _mapInstanceProperty(duplicateValues).call(duplicateValues, value => {
|
|
232
|
-
var
|
|
233
|
-
const parts = _sliceInstanceProperty(
|
|
230
|
+
var _context2;
|
|
231
|
+
const parts = _sliceInstanceProperty(_context2 = value.split(':')).call(_context2, 1);
|
|
234
232
|
return _reduceInstanceProperty(properties).call(properties, (prev, curr, index) => {
|
|
235
233
|
// eslint-disable-next-line no-param-reassign
|
|
236
234
|
prev[curr] = parts[index];
|
|
@@ -249,14 +247,14 @@ function unique(values, properties) {
|
|
|
249
247
|
* @return Array<Object> returns an array of objects with all duplicated values
|
|
250
248
|
*/
|
|
251
249
|
function uniqueObjects(items) {
|
|
252
|
-
var
|
|
250
|
+
var _context3;
|
|
253
251
|
const emptyValues = [undefined, null, ''];
|
|
254
|
-
const itemsWorkingSet = items && items.length ? _filterInstanceProperty(
|
|
252
|
+
const itemsWorkingSet = items && items.length ? _filterInstanceProperty(_context3 = _sliceInstanceProperty(items).call(items)).call(_context3, x => !_includesInstanceProperty(emptyValues).call(emptyValues, x)) : [];
|
|
255
253
|
const duplicateValues = _reduceInstanceProperty(itemsWorkingSet).call(itemsWorkingSet, (acc, item, index) => {
|
|
256
|
-
var
|
|
254
|
+
var _context4;
|
|
257
255
|
if (item === null) return acc;
|
|
258
|
-
const isDuplicate = _reduceInstanceProperty(
|
|
259
|
-
).call(
|
|
256
|
+
const isDuplicate = _reduceInstanceProperty(_context4 = _sliceInstanceProperty(itemsWorkingSet).call(itemsWorkingSet, index + 1) // get sub-array after this index
|
|
257
|
+
).call(_context4, (duplicateAcc, comparisonItem, comparisonIndex) => {
|
|
260
258
|
if (comparisonItem === null) return duplicateAcc;
|
|
261
259
|
|
|
262
260
|
// check if its a dupe
|
|
@@ -347,16 +345,18 @@ function getIndexesOfInvalidValues(values) {
|
|
|
347
345
|
|
|
348
346
|
const withoutEmptyErrorsByField = errorsByField => omitEmpty(errorsByField);
|
|
349
347
|
|
|
350
|
-
var _templateObject$4;
|
|
351
348
|
function formatDateRangeValue(value, type) {
|
|
352
349
|
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
353
350
|
locale: 'en',
|
|
354
351
|
timeZone: moment.tz.guess()
|
|
355
352
|
};
|
|
356
353
|
if (value.from === value.to) return formatDateTime$1(type, value.from, options);
|
|
357
|
-
if (value.from && value.to) return oneLine
|
|
358
|
-
|
|
359
|
-
|
|
354
|
+
if (value.from && value.to) return oneLine`
|
|
355
|
+
${formatDateTime$1(type, value.from, options)} -
|
|
356
|
+
${formatDateTime$1(type, value.to, options)}
|
|
357
|
+
`;
|
|
358
|
+
if (value.from) return `from ${formatDateTime$1(type, value.from, options)}`;
|
|
359
|
+
if (value.to) return `to ${formatDateTime$1(type, value.to, options)}`;
|
|
360
360
|
return '';
|
|
361
361
|
}
|
|
362
362
|
function formatDateTime$1(type, value) {
|
|
@@ -1592,13 +1592,13 @@ const getData = (code, field) => {
|
|
|
1592
1592
|
const getFractionDigit = code => getData(code, 'fractionDigit');
|
|
1593
1593
|
|
|
1594
1594
|
function ownKeys$1p(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1595
|
-
function _objectSpread$1p(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
1595
|
+
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(_context = ownKeys$1p(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$1p(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1596
1596
|
function formatMoneyRangeValue(value, intl) {
|
|
1597
|
-
var _context;
|
|
1598
1597
|
if (value.from === value.to) return formatMoneyValue(value.from, value.currency, intl);
|
|
1599
|
-
if (value.from && value.to) return
|
|
1600
|
-
|
|
1601
|
-
if (value.
|
|
1598
|
+
if (value.from && value.to) return `${formatMoneyValue(value.from, value.currency, intl)} -
|
|
1599
|
+
${formatMoneyValue(value.to, value.currency, intl)}`;
|
|
1600
|
+
if (value.from) return `from ${formatMoneyValue(value.from, value.currency, intl)}`;
|
|
1601
|
+
if (value.to) return `to ${formatMoneyValue(value.to, value.currency, intl)}`;
|
|
1602
1602
|
return '';
|
|
1603
1603
|
}
|
|
1604
1604
|
function formatMoneyValue(amount, currency, intl) {
|
|
@@ -1618,8 +1618,7 @@ function getFractionedAmount(moneyValue) {
|
|
|
1618
1618
|
return amount / 10 ** fractionDigits;
|
|
1619
1619
|
}
|
|
1620
1620
|
function formatMoney$2(moneyValue, intl, options) {
|
|
1621
|
-
|
|
1622
|
-
return intl.formatNumber((_moneyValue$fractione = moneyValue.fractionedAmount) !== null && _moneyValue$fractione !== void 0 ? _moneyValue$fractione : getFractionedAmount(moneyValue), _objectSpread$1p({
|
|
1621
|
+
return intl.formatNumber(moneyValue.fractionedAmount ?? getFractionedAmount(moneyValue), _objectSpread$1p({
|
|
1623
1622
|
style: 'currency',
|
|
1624
1623
|
currency: moneyValue.currencyCode,
|
|
1625
1624
|
minimumFractionDigits: moneyValue.fractionDigits
|
|
@@ -1640,13 +1639,11 @@ var messages$J = defineMessages({
|
|
|
1640
1639
|
});
|
|
1641
1640
|
|
|
1642
1641
|
const formatEnum = _ref => {
|
|
1643
|
-
var _context;
|
|
1644
1642
|
let value = _ref.value,
|
|
1645
1643
|
fallbackValue = _ref.fallbackValue;
|
|
1646
|
-
return value.label ||
|
|
1644
|
+
return value.label || `${fallbackValue} (${value.key})`;
|
|
1647
1645
|
};
|
|
1648
1646
|
const formatLenum = _ref2 => {
|
|
1649
|
-
var _context2;
|
|
1650
1647
|
let value = _ref2.value,
|
|
1651
1648
|
language = _ref2.language,
|
|
1652
1649
|
languages = _ref2.languages,
|
|
@@ -1654,7 +1651,7 @@ const formatLenum = _ref2 => {
|
|
|
1654
1651
|
return formatLocalizedString(value, {
|
|
1655
1652
|
key: 'label',
|
|
1656
1653
|
locale: language,
|
|
1657
|
-
fallback:
|
|
1654
|
+
fallback: `${fallbackValue} (${value.key})`,
|
|
1658
1655
|
fallbackOrder: languages
|
|
1659
1656
|
});
|
|
1660
1657
|
};
|
|
@@ -1690,7 +1687,6 @@ const formatDate = _ref6 => {
|
|
|
1690
1687
|
});
|
|
1691
1688
|
};
|
|
1692
1689
|
const formatDateTime = _ref7 => {
|
|
1693
|
-
var _context3;
|
|
1694
1690
|
let value = _ref7.value,
|
|
1695
1691
|
userTimeZone = _ref7.userTimeZone,
|
|
1696
1692
|
intl = _ref7.intl;
|
|
@@ -1706,7 +1702,7 @@ const formatDateTime = _ref7 => {
|
|
|
1706
1702
|
// defaults to utc if timeZone is not provided
|
|
1707
1703
|
timeZone: userTimeZone || 'utc'
|
|
1708
1704
|
});
|
|
1709
|
-
return
|
|
1705
|
+
return `${date} (${time})`;
|
|
1710
1706
|
};
|
|
1711
1707
|
const formatBoolean = _ref8 => {
|
|
1712
1708
|
let value = _ref8.value,
|
|
@@ -1729,7 +1725,7 @@ const formatUnknown = _ref10 => {
|
|
|
1729
1725
|
fallbackValue = _ref10.fallbackValue;
|
|
1730
1726
|
// NOTE This is reporting within the render function, which is supposed to
|
|
1731
1727
|
// be pure. This is quite bad as this is a side-effect in the render fn.
|
|
1732
|
-
reportErrorToSentry(new Error(
|
|
1728
|
+
reportErrorToSentry(new Error(`Unhandled custom attribute type '${type.name}' for value`), {
|
|
1733
1729
|
extra: {
|
|
1734
1730
|
value
|
|
1735
1731
|
}
|
|
@@ -1802,10 +1798,9 @@ const attributeTypeNames = {
|
|
|
1802
1798
|
Number: 'number'
|
|
1803
1799
|
};
|
|
1804
1800
|
const convertToAttributeType = customFieldType => {
|
|
1805
|
-
var _customFieldType$elem;
|
|
1806
1801
|
if (isNil$1(customFieldType)) return customFieldType;
|
|
1807
1802
|
const attributeTypeName = attributeTypeNames[customFieldType.name];
|
|
1808
|
-
const elementTypeName = attributeTypeNames[
|
|
1803
|
+
const elementTypeName = attributeTypeNames[customFieldType.elementType?.name];
|
|
1809
1804
|
return {
|
|
1810
1805
|
name: attributeTypeName,
|
|
1811
1806
|
elementType: {
|
|
@@ -1868,25 +1863,21 @@ const setDisplayName = nextDisplayName => Component => {
|
|
|
1868
1863
|
return Component;
|
|
1869
1864
|
};
|
|
1870
1865
|
|
|
1871
|
-
const wrapDisplayName = (BaseComponent, hocName) => {
|
|
1872
|
-
var _context;
|
|
1873
|
-
return _concatInstanceProperty(_context = "".concat(hocName, "(")).call(_context, getDisplayName(BaseComponent), ")");
|
|
1874
|
-
};
|
|
1866
|
+
const wrapDisplayName = (BaseComponent, hocName) => `${hocName}(${getDisplayName(BaseComponent)})`;
|
|
1875
1867
|
|
|
1876
1868
|
function ownKeys$1o(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1877
1869
|
function _objectSpread$1o(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$1o(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$1o(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1878
1870
|
const injectDataTablePaginationState = initialValues => Component => {
|
|
1879
1871
|
const WithDataTablePaginationState = props => {
|
|
1880
|
-
var _initialValues$tableS, _initialValues$tableS2;
|
|
1881
1872
|
const _usePaginationState = usePaginationState({
|
|
1882
|
-
page: initialValues
|
|
1883
|
-
perPage: initialValues
|
|
1873
|
+
page: initialValues?.page,
|
|
1874
|
+
perPage: initialValues?.perPage
|
|
1884
1875
|
}),
|
|
1885
1876
|
page = _usePaginationState.page,
|
|
1886
1877
|
perPage = _usePaginationState.perPage;
|
|
1887
1878
|
const tableSorting = useDataTableSortingState({
|
|
1888
|
-
key: initialValues
|
|
1889
|
-
order: initialValues
|
|
1879
|
+
key: initialValues?.tableSorting?.key,
|
|
1880
|
+
order: initialValues?.tableSorting?.order
|
|
1890
1881
|
});
|
|
1891
1882
|
return jsx(Component, _objectSpread$1o(_objectSpread$1o({}, props), {}, {
|
|
1892
1883
|
dataTablePaginationState: {
|
|
@@ -1920,7 +1911,7 @@ const injectNotifications = function () {
|
|
|
1920
1911
|
[propName]: notifications
|
|
1921
1912
|
}));
|
|
1922
1913
|
};
|
|
1923
|
-
WrappedComponent.displayName =
|
|
1914
|
+
WrappedComponent.displayName = `withNotifications(${getDisplayName(Component)}`;
|
|
1924
1915
|
return WrappedComponent;
|
|
1925
1916
|
};
|
|
1926
1917
|
};
|
|
@@ -2029,10 +2020,7 @@ const isNil = value => typeof value === 'undefined' || value === null;
|
|
|
2029
2020
|
const useStorage = (storageKey, initialStorageValue, options) => {
|
|
2030
2021
|
var _context;
|
|
2031
2022
|
const mergedOptions = _objectSpread$1i(_objectSpread$1i({}, defaultOptions$2), options);
|
|
2032
|
-
const userId = useApplicationContext(context =>
|
|
2033
|
-
var _context$user;
|
|
2034
|
-
return (_context$user = context.user) === null || _context$user === void 0 ? void 0 : _context$user.id;
|
|
2035
|
-
});
|
|
2023
|
+
const userId = useApplicationContext(context => context.user?.id);
|
|
2036
2024
|
const scopedStorageKey = _filterInstanceProperty(_context = [mergedOptions.segregateByUser && userId, storageKey]).call(_context, Boolean).join('/');
|
|
2037
2025
|
const readFromStorage = useCallback(() => {
|
|
2038
2026
|
const rawStorageValue = getStorage(mergedOptions.storageType).getItem(scopedStorageKey);
|
|
@@ -2051,9 +2039,8 @@ const useStorage = (storageKey, initialStorageValue, options) => {
|
|
|
2051
2039
|
return parsedStorageValue;
|
|
2052
2040
|
}, [mergedOptions.storageType, scopedStorageKey]);
|
|
2053
2041
|
const initializeStorageValue = () => {
|
|
2054
|
-
var _ref, _readFromStorage;
|
|
2055
2042
|
// default the storage value to the initial provided value when provided
|
|
2056
|
-
return
|
|
2043
|
+
return readFromStorage() ?? initialStorageValue ?? null;
|
|
2057
2044
|
};
|
|
2058
2045
|
const _useState = useState(initializeStorageValue),
|
|
2059
2046
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -2152,16 +2139,14 @@ function ownKeys$1g(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertyS
|
|
|
2152
2139
|
function _objectSpread$1g(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys$1g(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys$1g(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2153
2140
|
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 } } } };
|
|
2154
2141
|
const filterStoresOutdatedDanglingProductSelections = storesQueryResult => {
|
|
2155
|
-
var _storesQueryResult$re;
|
|
2156
2142
|
if (!storesQueryResult) return null;
|
|
2157
2143
|
return {
|
|
2158
2144
|
total: storesQueryResult.total,
|
|
2159
2145
|
count: storesQueryResult.count,
|
|
2160
2146
|
offset: storesQueryResult.offset,
|
|
2161
|
-
results:
|
|
2162
|
-
var _store$productSelecti;
|
|
2147
|
+
results: storesQueryResult.results?.map(store => {
|
|
2163
2148
|
return _objectSpread$1g(_objectSpread$1g({}, store), {}, {
|
|
2164
|
-
productSelections:
|
|
2149
|
+
productSelections: store.productSelections?.filter(productSelectionRef => Boolean(productSelectionRef.productSelection))
|
|
2165
2150
|
});
|
|
2166
2151
|
})
|
|
2167
2152
|
};
|
|
@@ -2173,7 +2158,7 @@ const createQueryVariables$6 = ownProps => {
|
|
|
2173
2158
|
offset: ownProps.offset,
|
|
2174
2159
|
sort: _sortInstanceProperty(ownProps)
|
|
2175
2160
|
}, Boolean(ownProps.stores) && {
|
|
2176
|
-
where:
|
|
2161
|
+
where: `key in (${_mapInstanceProperty(_context = ownProps.stores).call(_context, store => `"${store}"`).join(', ')})`
|
|
2177
2162
|
}), {}, {
|
|
2178
2163
|
excludeExtendedStoresList: ownProps.excludeExtendedStoresList,
|
|
2179
2164
|
excludeProductSelections: ownProps.excludeProductSelections
|
|
@@ -2198,10 +2183,7 @@ const useStoresListFetcher = props => {
|
|
|
2198
2183
|
projectKey: props.projectKey
|
|
2199
2184
|
},
|
|
2200
2185
|
fetchPolicy: 'network-only',
|
|
2201
|
-
onError: graphqlErrorResponse =>
|
|
2202
|
-
var _props$onError;
|
|
2203
|
-
return (_props$onError = props.onError) === null || _props$onError === void 0 ? void 0 : _props$onError.call(props, graphqlErrorResponse);
|
|
2204
|
-
}
|
|
2186
|
+
onError: graphqlErrorResponse => props.onError?.(graphqlErrorResponse)
|
|
2205
2187
|
}),
|
|
2206
2188
|
data = _useQuery.data,
|
|
2207
2189
|
refetch = _useQuery.refetch,
|
|
@@ -2209,7 +2191,7 @@ const useStoresListFetcher = props => {
|
|
|
2209
2191
|
return {
|
|
2210
2192
|
isLoading: loading,
|
|
2211
2193
|
refetch,
|
|
2212
|
-
stores: filterStoresOutdatedDanglingProductSelections(data
|
|
2194
|
+
stores: filterStoresOutdatedDanglingProductSelections(data?.stores),
|
|
2213
2195
|
refetchQuery: {
|
|
2214
2196
|
query: FetchStoresQuery,
|
|
2215
2197
|
variables: queryVariables,
|
|
@@ -2273,16 +2255,10 @@ const handlers$5 = {
|
|
|
2273
2255
|
}
|
|
2274
2256
|
};
|
|
2275
2257
|
|
|
2276
|
-
const toPermission = (permission, resourceName) => {
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
}
|
|
2280
|
-
const createComposePath = resourceName => permission => {
|
|
2281
|
-
var _context2;
|
|
2282
|
-
return (// e.g applicationContext.dataFences?.store?.orders?.canViewOrders?.values
|
|
2283
|
-
_concatInstanceProperty(_context2 = "dataFences.store.".concat(resourceName, ".")).call(_context2, permission, ".values")
|
|
2284
|
-
);
|
|
2285
|
-
};
|
|
2258
|
+
const toPermission = (permission, resourceName) => camelCase(`can ${permission} ${resourceName}`);
|
|
2259
|
+
const createComposePath = resourceName => permission =>
|
|
2260
|
+
// e.g applicationContext.dataFences?.store?.orders?.canViewOrders?.values
|
|
2261
|
+
`dataFences.store.${resourceName}.${permission}.values`;
|
|
2286
2262
|
const useStoreKeysInDataFences = _ref => {
|
|
2287
2263
|
let resourceName = _ref.resourceName,
|
|
2288
2264
|
_ref$permission = _ref.permission,
|
|
@@ -2680,7 +2656,7 @@ const usePersistedTableConfiguration = props => {
|
|
|
2680
2656
|
* Therefore, if it will be missing from the local storage and hence we use the [] as default.
|
|
2681
2657
|
*/
|
|
2682
2658
|
const getVisibleColumns = useCallback(() => {
|
|
2683
|
-
if (cachedVisibleTableConfiguration
|
|
2659
|
+
if (cachedVisibleTableConfiguration?.columnsConfig) {
|
|
2684
2660
|
return retrieveColumnsWithCachedConfiguration({
|
|
2685
2661
|
allAvailableColumnsConfiguration,
|
|
2686
2662
|
cachedVisibleTableConfiguration: cachedVisibleTableConfiguration.columnsConfig,
|
|
@@ -2694,8 +2670,8 @@ const usePersistedTableConfiguration = props => {
|
|
|
2694
2670
|
return {
|
|
2695
2671
|
visibleColumns,
|
|
2696
2672
|
visibleColumnKeys,
|
|
2697
|
-
cachedVisibleColumnsConfiguration: cachedVisibleTableConfiguration
|
|
2698
|
-
cachedDisplaySettings: cachedVisibleTableConfiguration
|
|
2673
|
+
cachedVisibleColumnsConfiguration: cachedVisibleTableConfiguration?.columnsConfig,
|
|
2674
|
+
cachedDisplaySettings: cachedVisibleTableConfiguration?.displaySettings,
|
|
2699
2675
|
handleCachedTableConfigurationUpdate: update => handleCacheUpdate({
|
|
2700
2676
|
update,
|
|
2701
2677
|
cachedVisibleTableConfiguration,
|
|
@@ -2706,7 +2682,6 @@ const usePersistedTableConfiguration = props => {
|
|
|
2706
2682
|
|
|
2707
2683
|
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 } } } };
|
|
2708
2684
|
const useProductSelectionsTotalFetcher = props => {
|
|
2709
|
-
var _data$productSelectio;
|
|
2710
2685
|
const _useQuery = useQuery$1(FetchProductSelectionsTotal, {
|
|
2711
2686
|
context: {
|
|
2712
2687
|
target: GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -2716,7 +2691,7 @@ const useProductSelectionsTotalFetcher = props => {
|
|
|
2716
2691
|
data = _useQuery.data;
|
|
2717
2692
|
return {
|
|
2718
2693
|
isLoading: loading,
|
|
2719
|
-
total: data
|
|
2694
|
+
total: data?.productSelections?.total
|
|
2720
2695
|
};
|
|
2721
2696
|
};
|
|
2722
2697
|
|
|
@@ -2737,7 +2712,7 @@ function _objectSpread$1c(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
|
2737
2712
|
// eslint-disable-next-line import/prefer-default-export
|
|
2738
2713
|
const convertProductSelectionsFromGraphQl = productSelections => {
|
|
2739
2714
|
var _context;
|
|
2740
|
-
return
|
|
2715
|
+
return productSelections?.results && _objectSpread$1c(_objectSpread$1c({}, productSelections), {}, {
|
|
2741
2716
|
results: _mapInstanceProperty(_context = productSelections.results).call(_context, productSelection => _objectSpread$1c({}, applyTransformedLocalizedFields(productSelection, [{
|
|
2742
2717
|
from: 'nameAllLocales',
|
|
2743
2718
|
to: 'name'
|
|
@@ -2771,7 +2746,7 @@ const useProductSelectionsFetcher = props => {
|
|
|
2771
2746
|
refetch = _useQuery.refetch;
|
|
2772
2747
|
return {
|
|
2773
2748
|
isLoading: loading,
|
|
2774
|
-
productSelections: convertProductSelectionsFromGraphQl(data
|
|
2749
|
+
productSelections: convertProductSelectionsFromGraphQl(data?.productSelections) || emptyProductSelections,
|
|
2775
2750
|
refetch
|
|
2776
2751
|
};
|
|
2777
2752
|
};
|
|
@@ -2796,7 +2771,6 @@ function validateSingleFilter(_ref) {
|
|
|
2796
2771
|
return _includesInstanceProperty(invalidValues).call(invalidValues, value);
|
|
2797
2772
|
}
|
|
2798
2773
|
|
|
2799
|
-
var _templateObject$3, _templateObject2$2;
|
|
2800
2774
|
const dateFormatDayStart$1 = 'YYYY-MM-DDT00:00:00.000';
|
|
2801
2775
|
const dateFormatDayEnd$1 = 'YYYY-MM-DDT23:59:59.999';
|
|
2802
2776
|
const getDateTimeInUTC = (date, timezone, format) => {
|
|
@@ -2806,8 +2780,7 @@ const getDateTimeInUTC = (date, timezone, format) => {
|
|
|
2806
2780
|
const noTimeSpecified = momentDate.hours() === 0 && momentDate.minutes() === 0 && momentDate.seconds() === 0;
|
|
2807
2781
|
// if it's a date then convert it to UTC datetime based on timezone
|
|
2808
2782
|
if (noTimeSpecified) {
|
|
2809
|
-
|
|
2810
|
-
const offset = ((_moment$tz = moment$1(date).tz(timezone)) === null || _moment$tz === void 0 ? void 0 : _moment$tz.utcOffset()) || 0;
|
|
2783
|
+
const offset = moment$1(date).tz(timezone)?.utcOffset() || 0;
|
|
2811
2784
|
const formattedDate = momentDate.format(format);
|
|
2812
2785
|
const formattedDateWithOffset = moment$1(formattedDate).add(offset, 'minutes').format(dateFormat);
|
|
2813
2786
|
// console.log(formattedDateWithOffset);
|
|
@@ -2820,7 +2793,6 @@ const getDateTimeInUTC = (date, timezone, format) => {
|
|
|
2820
2793
|
function dateTransformer$1(filterKey, filters) {
|
|
2821
2794
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator$1;
|
|
2822
2795
|
const queries = _mapInstanceProperty(filters).call(filters, _ref => {
|
|
2823
|
-
var _context, _context2;
|
|
2824
2796
|
let type = _ref.type,
|
|
2825
2797
|
value = _ref.value,
|
|
2826
2798
|
timezone = _ref.timezone;
|
|
@@ -2830,13 +2802,19 @@ function dateTransformer$1(filterKey, filters) {
|
|
|
2830
2802
|
})) return '';
|
|
2831
2803
|
switch (type) {
|
|
2832
2804
|
case FILTER_TYPES.lessThan:
|
|
2833
|
-
return
|
|
2805
|
+
return `${filterKey} < "${getDateTimeInUTC(value, timezone, dateFormatDayStart$1)}"`;
|
|
2834
2806
|
case FILTER_TYPES.moreThan:
|
|
2835
|
-
return
|
|
2807
|
+
return `${filterKey} > "${getDateTimeInUTC(value, timezone, dateFormatDayEnd$1)}"`;
|
|
2836
2808
|
case FILTER_TYPES.equalTo:
|
|
2837
|
-
return oneLine
|
|
2809
|
+
return oneLine`
|
|
2810
|
+
(${filterKey} >= "${getDateTimeInUTC(value, timezone, dateFormatDayStart$1)}"
|
|
2811
|
+
and ${filterKey} <= "${getDateTimeInUTC(value, timezone, dateFormatDayEnd$1)}")
|
|
2812
|
+
`;
|
|
2838
2813
|
case FILTER_TYPES.range:
|
|
2839
|
-
return oneLine
|
|
2814
|
+
return oneLine`
|
|
2815
|
+
(${filterKey} >= "${getDateTimeInUTC(value.from, timezone, dateFormatDayStart$1)}"
|
|
2816
|
+
and ${filterKey} <= "${getDateTimeInUTC(value.to, timezone, dateFormatDayEnd$1)}")
|
|
2817
|
+
`;
|
|
2840
2818
|
default:
|
|
2841
2819
|
return '';
|
|
2842
2820
|
}
|
|
@@ -2852,7 +2830,7 @@ function dateTransformer$1(filterKey, filters) {
|
|
|
2852
2830
|
* (createdAt >= "2018-02-15T00:00:00.000+01:00" and createdAt <= "2018-02-15T23:59:59.999+01:00")
|
|
2853
2831
|
* ) or some_more_filters
|
|
2854
2832
|
*/
|
|
2855
|
-
return queryString === '' ? null :
|
|
2833
|
+
return queryString === '' ? null : `(${queryString})`;
|
|
2856
2834
|
}
|
|
2857
2835
|
function defaultFilterValidator$1(_ref2) {
|
|
2858
2836
|
let type = _ref2.type,
|
|
@@ -2868,10 +2846,7 @@ function defaultFilterValidator$1(_ref2) {
|
|
|
2868
2846
|
|
|
2869
2847
|
var localizedTextTransformer = (localizedString => {
|
|
2870
2848
|
var _context;
|
|
2871
|
-
return _mapInstanceProperty(_context = _Object$keys(localizedString)).call(_context, locale => {
|
|
2872
|
-
var _context2;
|
|
2873
|
-
return _concatInstanceProperty(_context2 = "".concat(locale, " = \"")).call(_context2, localizedString[locale], "\"");
|
|
2874
|
-
}).join(' and ');
|
|
2849
|
+
return _mapInstanceProperty(_context = _Object$keys(localizedString)).call(_context, locale => `${locale} = "${localizedString[locale]}"`).join(' and ');
|
|
2875
2850
|
});
|
|
2876
2851
|
|
|
2877
2852
|
var styles$i = {
|
|
@@ -2920,7 +2895,6 @@ var GetChannelsQuery = { kind: "Document", definitions: [{ kind: "OperationDefin
|
|
|
2920
2895
|
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 } } } };
|
|
2921
2896
|
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 } } } };
|
|
2922
2897
|
const ChannelPickerInput = _ref => {
|
|
2923
|
-
var _currentOption$data$l, _currentOption$data;
|
|
2924
2898
|
let isClearable = _ref.isClearable,
|
|
2925
2899
|
isDisabled = _ref.isDisabled,
|
|
2926
2900
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -2937,9 +2911,9 @@ const ChannelPickerInput = _ref => {
|
|
|
2937
2911
|
formatMessage = _useIntl.formatMessage;
|
|
2938
2912
|
const dataLocale = useApplicationContext(applicationContext => applicationContext.dataLocale);
|
|
2939
2913
|
const variables = useMemo(() => _objectSpread$1b({
|
|
2940
|
-
sortByNamePath:
|
|
2914
|
+
sortByNamePath: `name.${dataLocale}`
|
|
2941
2915
|
}, role && {
|
|
2942
|
-
|
|
2916
|
+
extraWhere: `roles contains any ("${role}")`
|
|
2943
2917
|
}), [dataLocale, role]);
|
|
2944
2918
|
const _useState = useState(),
|
|
2945
2919
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -2957,7 +2931,7 @@ const ChannelPickerInput = _ref => {
|
|
|
2957
2931
|
}
|
|
2958
2932
|
return channel;
|
|
2959
2933
|
}, [formatLocalizedFieldToString]);
|
|
2960
|
-
const prefixSearchFields = useMemo(() => [
|
|
2934
|
+
const prefixSearchFields = useMemo(() => [`name.${dataLocale}`, 'key'], [dataLocale]);
|
|
2961
2935
|
const loadOptions = useLoadOptions({
|
|
2962
2936
|
query: GetChannelsQuery,
|
|
2963
2937
|
variables,
|
|
@@ -2992,13 +2966,13 @@ const ChannelPickerInput = _ref => {
|
|
|
2992
2966
|
setLoadingError(null);
|
|
2993
2967
|
handleInternalInputChange(event);
|
|
2994
2968
|
}, [handleInternalInputChange]);
|
|
2995
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
2969
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
2996
2970
|
useEffect(() => {
|
|
2997
2971
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
2998
2972
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
2999
2973
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
3000
2974
|
const handleNoOptions = useCallback(() => loadingError ? null : formatMessage(messages$G.noChannelsFound), [loadingError, formatMessage]);
|
|
3001
|
-
const tooltipTitle =
|
|
2975
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
3002
2976
|
return jsx(Constraints.Horizontal, {
|
|
3003
2977
|
max: "scale",
|
|
3004
2978
|
children: jsxs(Spacings.Stack, {
|
|
@@ -3008,7 +2982,7 @@ const ChannelPickerInput = _ref => {
|
|
|
3008
2982
|
children: jsx(AsyncSelectInput, {
|
|
3009
2983
|
id: name,
|
|
3010
2984
|
name: name,
|
|
3011
|
-
placeholder: placeholder
|
|
2985
|
+
placeholder: placeholder ?? formatMessage(messages$G.placeholder),
|
|
3012
2986
|
loadOptions: loadOptionsDebounced,
|
|
3013
2987
|
defaultOptions: true,
|
|
3014
2988
|
showOptionGroupDivider: true,
|
|
@@ -3048,10 +3022,9 @@ let FormattedDateTime = /*#__PURE__*/function (_PureComponent) {
|
|
|
3048
3022
|
value: function render() {
|
|
3049
3023
|
return jsx(ApplicationContext, {
|
|
3050
3024
|
render: _ref => {
|
|
3051
|
-
var _this$props;
|
|
3052
3025
|
let user = _ref.user;
|
|
3053
3026
|
return formatDateTime$1(this.props.type, this.props.value, {
|
|
3054
|
-
timeZone:
|
|
3027
|
+
timeZone: this?.props?.timeZone || user?.timeZone,
|
|
3055
3028
|
locale: this.props.intl.locale
|
|
3056
3029
|
});
|
|
3057
3030
|
}
|
|
@@ -3182,7 +3155,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
3182
3155
|
};
|
|
3183
3156
|
_this.doDelayedUpdate = (updateFunction, event, eventType) => {
|
|
3184
3157
|
const self = _assertThisInitialized(_this);
|
|
3185
|
-
const timeoutKey =
|
|
3158
|
+
const timeoutKey = `${eventType}Timeout`;
|
|
3186
3159
|
// TODO: can't we just use one variable?
|
|
3187
3160
|
clearTimeout(_this[timeoutKey]);
|
|
3188
3161
|
_this[timeoutKey] = _setTimeout(() => {
|
|
@@ -3212,7 +3185,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
3212
3185
|
}, this.props.onEnter ? {
|
|
3213
3186
|
onKeyDown: this.handleEnter
|
|
3214
3187
|
} : {}), filterDataAttributes(this.props));
|
|
3215
|
-
const inputId =
|
|
3188
|
+
const inputId = `throttled-field-${this.props.name}`;
|
|
3216
3189
|
return jsxs(Fragment, {
|
|
3217
3190
|
children: [jsx(AccessibleHidden, {
|
|
3218
3191
|
children: jsx("label", {
|
|
@@ -3221,7 +3194,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
3221
3194
|
})
|
|
3222
3195
|
}), this.props.as === 'textarea' ? jsx(Textarea, _objectSpread$19(_objectSpread$19({}, commonProps), {}, {
|
|
3223
3196
|
id: inputId,
|
|
3224
|
-
className: classnames(styles$h.textarea, styles$h[
|
|
3197
|
+
className: classnames(styles$h.textarea, styles$h[`textarea-${this.props.style}`], {
|
|
3225
3198
|
[styles$h.invalid]: !this.props.isValid,
|
|
3226
3199
|
[styles$h.disabled]: this.props.disabled
|
|
3227
3200
|
}),
|
|
@@ -3232,7 +3205,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
3232
3205
|
id: inputId,
|
|
3233
3206
|
ref: this.props.inputRef,
|
|
3234
3207
|
type: this.props.as,
|
|
3235
|
-
className: classnames(styles$h[
|
|
3208
|
+
className: classnames(styles$h[`input-${this.props.style}`], {
|
|
3236
3209
|
[styles$h.invalid]: !this.props.isValid,
|
|
3237
3210
|
[styles$h.disabled]: this.props.disabled,
|
|
3238
3211
|
[styles$h.granular]: this.props.isGranular
|
|
@@ -3332,8 +3305,7 @@ let SearchInput = /*#__PURE__*/function (_Component) {
|
|
|
3332
3305
|
});
|
|
3333
3306
|
};
|
|
3334
3307
|
_this.handleClear = () => {
|
|
3335
|
-
|
|
3336
|
-
(_this$inputRef = _this.inputRef) === null || _this$inputRef === void 0 || _this$inputRef.focus();
|
|
3308
|
+
_this.inputRef?.focus();
|
|
3337
3309
|
_this.props.onChange(null);
|
|
3338
3310
|
_this.props.onReset();
|
|
3339
3311
|
_this.setState({
|
|
@@ -3445,12 +3417,12 @@ const useExecuteGraphQLRequest = () => {
|
|
|
3445
3417
|
};
|
|
3446
3418
|
const createSearchProductsFromPIMAction = (searchTerm, projectKey) => actions.post({
|
|
3447
3419
|
mcApiProxyTarget: MC_API_PROXY_TARGETS.PIM_SEARCH,
|
|
3448
|
-
uri:
|
|
3420
|
+
uri: `/${projectKey}/search/product-types`,
|
|
3449
3421
|
payload: {
|
|
3450
3422
|
query: {
|
|
3451
3423
|
wildcard: {
|
|
3452
3424
|
field: 'name',
|
|
3453
|
-
value:
|
|
3425
|
+
value: `*${searchTerm}*`,
|
|
3454
3426
|
caseInsensitive: true
|
|
3455
3427
|
}
|
|
3456
3428
|
},
|
|
@@ -3464,9 +3436,8 @@ const useFetchProductTypesFromPIM = _ref => {
|
|
|
3464
3436
|
const dispatch = useAsyncDispatch();
|
|
3465
3437
|
const executeGraphQLRequest = useExecuteGraphQLRequest();
|
|
3466
3438
|
const fetchProductTypesFromPim = useCallback(async searchTerm => {
|
|
3467
|
-
var _result$hits$map, _result$hits;
|
|
3468
3439
|
const result = await dispatch(createSearchProductsFromPIMAction(searchTerm, projectKey));
|
|
3469
|
-
const ids =
|
|
3440
|
+
const ids = result?.hits?.map(hit => hit.id) ?? [];
|
|
3470
3441
|
// Avoid sending any requests if it's clear that nothing is found
|
|
3471
3442
|
if (ids.length === 0) {
|
|
3472
3443
|
return {
|
|
@@ -3501,22 +3472,19 @@ const useFetchProductTypesFromPIM = _ref => {
|
|
|
3501
3472
|
*/
|
|
3502
3473
|
const constructNestedExpression = (reversedPath, predicate) => {
|
|
3503
3474
|
if (reversedPath.length > 0) {
|
|
3504
|
-
return _reduceInstanceProperty(reversedPath).call(reversedPath, (nextNestedValue, nestedSelection) => {
|
|
3505
|
-
var _context;
|
|
3506
|
-
return _concatInstanceProperty(_context = "".concat(nestedSelection, "(")).call(_context, nextNestedValue, ")");
|
|
3507
|
-
}, predicate);
|
|
3475
|
+
return _reduceInstanceProperty(reversedPath).call(reversedPath, (nextNestedValue, nestedSelection) => `${nestedSelection}(${nextNestedValue})`, predicate);
|
|
3508
3476
|
}
|
|
3509
3477
|
return predicate;
|
|
3510
3478
|
};
|
|
3511
3479
|
const constructPrefixSearchPredicate$1 = (prefixSearchFields, lowerBound, upperBound) => {
|
|
3512
3480
|
const constructPrefixSearchExpression = field => {
|
|
3513
|
-
var
|
|
3481
|
+
var _context;
|
|
3514
3482
|
const parts = field.split('.');
|
|
3515
|
-
const _parts$slice$reverse = _reverseInstanceProperty(
|
|
3483
|
+
const _parts$slice$reverse = _reverseInstanceProperty(_context = _sliceInstanceProperty(parts).call(parts)).call(_context),
|
|
3516
3484
|
_parts$slice$reverse2 = _toArray(_parts$slice$reverse),
|
|
3517
3485
|
valueToNest = _parts$slice$reverse2[0],
|
|
3518
3486
|
reversedPathToNestedValue = _sliceInstanceProperty(_parts$slice$reverse2).call(_parts$slice$reverse2, 1);
|
|
3519
|
-
const predicateExpression =
|
|
3487
|
+
const predicateExpression = `${valueToNest} >= "${lowerBound}" and ${valueToNest} < "${upperBound}"`;
|
|
3520
3488
|
return constructNestedExpression(reversedPathToNestedValue, predicateExpression);
|
|
3521
3489
|
};
|
|
3522
3490
|
return _mapInstanceProperty(prefixSearchFields).call(prefixSearchFields, constructPrefixSearchExpression).join(' or ');
|
|
@@ -3524,7 +3492,7 @@ const constructPrefixSearchPredicate$1 = (prefixSearchFields, lowerBound, upperB
|
|
|
3524
3492
|
const constructWherePredicate = (inputValue, prefixSearchFields) => {
|
|
3525
3493
|
const wherePredicate = function () {
|
|
3526
3494
|
if (inputValue.length) {
|
|
3527
|
-
if (isUUID(inputValue)) return
|
|
3495
|
+
if (isUUID(inputValue)) return `id = "${inputValue}"`;else {
|
|
3528
3496
|
const _getPrefixSearchBound = getPrefixSearchBounds(inputValue),
|
|
3529
3497
|
_getPrefixSearchBound2 = _slicedToArray(_getPrefixSearchBound, 2),
|
|
3530
3498
|
lowerBound = _getPrefixSearchBound2[0],
|
|
@@ -3549,7 +3517,6 @@ const useFetchProductTypessFromCTP = _ref2 => {
|
|
|
3549
3517
|
}, [prefixSearchFields, executeGraphQLRequest]);
|
|
3550
3518
|
};
|
|
3551
3519
|
const usePimStatus = () => {
|
|
3552
|
-
var _data$indicesExist;
|
|
3553
3520
|
const _useQuery = useQuery(FetchIndicesExist$1, {
|
|
3554
3521
|
context: {
|
|
3555
3522
|
target: GRAPHQL_TARGETS.PIM_INDEXER
|
|
@@ -3559,20 +3526,17 @@ const usePimStatus = () => {
|
|
|
3559
3526
|
data = _useQuery.data;
|
|
3560
3527
|
return {
|
|
3561
3528
|
data,
|
|
3562
|
-
isProjectIndexed: Boolean(data
|
|
3529
|
+
isProjectIndexed: Boolean(data?.indicesExist?.productTypes?.searchableIndexExists)
|
|
3563
3530
|
};
|
|
3564
3531
|
};
|
|
3565
3532
|
const useProductTypeOptions = _ref3 => {
|
|
3566
3533
|
let prefixSearchFields = _ref3.prefixSearchFields;
|
|
3567
3534
|
const _usePimStatus = usePimStatus(),
|
|
3568
3535
|
isProjectIndexed = _usePimStatus.isProjectIndexed;
|
|
3569
|
-
const _useApplicationContex = useApplicationContext(context => {
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key
|
|
3574
|
-
};
|
|
3575
|
-
}),
|
|
3536
|
+
const _useApplicationContex = useApplicationContext(context => ({
|
|
3537
|
+
dataLocale: context.dataLocale,
|
|
3538
|
+
projectKey: context.project?.key
|
|
3539
|
+
})),
|
|
3576
3540
|
dataLocale = _useApplicationContex.dataLocale,
|
|
3577
3541
|
projectKey = _useApplicationContex.projectKey;
|
|
3578
3542
|
const fetchProductTypesFromPim = useFetchProductTypesFromPIM({
|
|
@@ -3636,10 +3600,9 @@ const useHandlers = onChange => {
|
|
|
3636
3600
|
setInputValue(changedValue);
|
|
3637
3601
|
}, []);
|
|
3638
3602
|
const handleChange = useEventCallback(event => {
|
|
3639
|
-
var _event$target$value;
|
|
3640
3603
|
const eventWithExtractedValue = _objectSpread$17(_objectSpread$17({}, event), {}, {
|
|
3641
3604
|
target: _objectSpread$17(_objectSpread$17({}, event.target), {}, {
|
|
3642
|
-
value:
|
|
3605
|
+
value: event.target.value?.value
|
|
3643
3606
|
})
|
|
3644
3607
|
});
|
|
3645
3608
|
onChange(eventWithExtractedValue);
|
|
@@ -3647,25 +3610,23 @@ const useHandlers = onChange => {
|
|
|
3647
3610
|
return [handleInputChange, handleChange];
|
|
3648
3611
|
};
|
|
3649
3612
|
|
|
3613
|
+
const _excluded$1 = ["extraWhere"];
|
|
3650
3614
|
function ownKeys$16(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3651
|
-
function _objectSpread$16(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
3615
|
+
function _objectSpread$16(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys$16(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys$16(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3652
3616
|
const constructPrefixSearchPredicate = function () {
|
|
3653
3617
|
let prefixSearchFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
3654
3618
|
let lowerBound = arguments.length > 1 ? arguments[1] : undefined;
|
|
3655
3619
|
let upperBound = arguments.length > 2 ? arguments[2] : undefined;
|
|
3656
3620
|
const constructPrefixSearchExpression = field => {
|
|
3657
|
-
var _context
|
|
3621
|
+
var _context;
|
|
3658
3622
|
const path = field.split('.');
|
|
3659
3623
|
const _path$slice$reverse = _reverseInstanceProperty(_context = _sliceInstanceProperty(path).call(path)).call(_context),
|
|
3660
3624
|
_path$slice$reverse2 = _toArray(_path$slice$reverse),
|
|
3661
3625
|
finalValueInPath = _path$slice$reverse2[0],
|
|
3662
3626
|
remainPathInReverse = _sliceInstanceProperty(_path$slice$reverse2).call(_path$slice$reverse2, 1);
|
|
3663
|
-
const comparison =
|
|
3627
|
+
const comparison = `${finalValueInPath} >= "${lowerBound}" and ${finalValueInPath} < "${upperBound}"`;
|
|
3664
3628
|
if (remainPathInReverse.length) {
|
|
3665
|
-
return _reduceInstanceProperty(remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) => {
|
|
3666
|
-
var _context5;
|
|
3667
|
-
return _concatInstanceProperty(_context5 = "".concat(nextPath, "(")).call(_context5, nestedPath, ")");
|
|
3668
|
-
}, comparison);
|
|
3629
|
+
return _reduceInstanceProperty(remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) => `${nextPath}(${nestedPath})`, comparison);
|
|
3669
3630
|
}
|
|
3670
3631
|
return comparison;
|
|
3671
3632
|
};
|
|
@@ -3678,22 +3639,29 @@ const useLoadOptions = _ref => {
|
|
|
3678
3639
|
const client = useApolloClient$1();
|
|
3679
3640
|
const loadOptions = useCallback(function () {
|
|
3680
3641
|
let inputValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3642
|
+
let where;
|
|
3643
|
+
if (inputValue.length) {
|
|
3644
|
+
if (isUUID(inputValue)) {
|
|
3645
|
+
where = `id = "${inputValue}"`;
|
|
3646
|
+
} else {
|
|
3647
|
+
const _getPrefixSearchBound = getPrefixSearchBounds(inputValue),
|
|
3648
|
+
_getPrefixSearchBound2 = _slicedToArray(_getPrefixSearchBound, 2),
|
|
3649
|
+
lowerBound = _getPrefixSearchBound2[0],
|
|
3650
|
+
upperBound = _getPrefixSearchBound2[1];
|
|
3651
|
+
where = constructPrefixSearchPredicate(prefixSearchFields, lowerBound, upperBound);
|
|
3690
3652
|
}
|
|
3691
|
-
}
|
|
3653
|
+
}
|
|
3654
|
+
const _ref2 = variables ?? {},
|
|
3655
|
+
extraWhere = _ref2.extraWhere,
|
|
3656
|
+
restVariables = _objectWithoutProperties(_ref2, _excluded$1);
|
|
3657
|
+
if (typeof extraWhere === 'string') {
|
|
3658
|
+
where = where ? `(${where}) and ${variables.extraWhere}` : variables.extraWhere;
|
|
3659
|
+
}
|
|
3692
3660
|
return client.query({
|
|
3693
3661
|
query,
|
|
3694
3662
|
variables: _objectSpread$16({
|
|
3695
3663
|
where
|
|
3696
|
-
},
|
|
3664
|
+
}, restVariables),
|
|
3697
3665
|
context: {
|
|
3698
3666
|
target: MC_API_PROXY_TARGETS.COMMERCETOOLS_PLATFORM
|
|
3699
3667
|
},
|
|
@@ -3704,7 +3672,6 @@ const useLoadOptions = _ref => {
|
|
|
3704
3672
|
};
|
|
3705
3673
|
|
|
3706
3674
|
function useCurrentOption(_ref) {
|
|
3707
|
-
var _context;
|
|
3708
3675
|
let id = _ref.id,
|
|
3709
3676
|
typename = _ref.typename,
|
|
3710
3677
|
query = _ref.query,
|
|
@@ -3716,7 +3683,7 @@ function useCurrentOption(_ref) {
|
|
|
3716
3683
|
// load from cache when possible to speed up initial render
|
|
3717
3684
|
const canReadFromCache = id && typename && fragment;
|
|
3718
3685
|
const cacheItem = canReadFromCache ? apolloClient.readFragment({
|
|
3719
|
-
id:
|
|
3686
|
+
id: `${typename}:${id}`,
|
|
3720
3687
|
fragment
|
|
3721
3688
|
}) : undefined;
|
|
3722
3689
|
|
|
@@ -3734,7 +3701,7 @@ function useCurrentOption(_ref) {
|
|
|
3734
3701
|
queryData = _useQuery.data,
|
|
3735
3702
|
queryError = _useQuery.error;
|
|
3736
3703
|
const queryItem = queryData && queryDataToItem(queryData);
|
|
3737
|
-
const item = queryItem
|
|
3704
|
+
const item = queryItem ?? cacheItem;
|
|
3738
3705
|
const loading = item ? false : queryLoading;
|
|
3739
3706
|
const error = item ? undefined : queryError;
|
|
3740
3707
|
const data = item && itemToOption(item);
|
|
@@ -3773,7 +3740,6 @@ const convertProductTypeToOption = productType => {
|
|
|
3773
3740
|
};
|
|
3774
3741
|
};
|
|
3775
3742
|
const ProductTypePickerInput = _ref => {
|
|
3776
|
-
var _currentOption$data$l, _currentOption$data;
|
|
3777
3743
|
let isClearable = _ref.isClearable,
|
|
3778
3744
|
isDisabled = _ref.isDisabled,
|
|
3779
3745
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -3804,9 +3770,8 @@ const ProductTypePickerInput = _ref => {
|
|
|
3804
3770
|
itemToOption: convertProductTypeToOption
|
|
3805
3771
|
});
|
|
3806
3772
|
const handleLoadOptions = useCallback(inputValue => loadProductTypes(inputValue).then(_ref3 => {
|
|
3807
|
-
var _data$productTypes;
|
|
3808
3773
|
let data = _ref3.data;
|
|
3809
|
-
return
|
|
3774
|
+
return data.productTypes?.results || [];
|
|
3810
3775
|
}).then(productTypes => _mapInstanceProperty(productTypes).call(productTypes, convertProductTypeToOption)).catch(error => {
|
|
3811
3776
|
setLoadingError(error);
|
|
3812
3777
|
onError(error);
|
|
@@ -3820,12 +3785,12 @@ const ProductTypePickerInput = _ref => {
|
|
|
3820
3785
|
setLoadingError(null);
|
|
3821
3786
|
handleInternalInputChange(event);
|
|
3822
3787
|
}, [handleInternalInputChange]);
|
|
3823
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
3788
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
3824
3789
|
useEffect(() => {
|
|
3825
3790
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
3826
3791
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
3827
3792
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
3828
|
-
const tooltipTitle =
|
|
3793
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
3829
3794
|
return jsx(Constraints.Horizontal, {
|
|
3830
3795
|
max: "scale",
|
|
3831
3796
|
children: currentOption.loading ? jsx(CenteredLoadingSpinner, {}) : jsxs(Spacings.Stack, {
|
|
@@ -3876,7 +3841,6 @@ var messages$C = defineMessages({
|
|
|
3876
3841
|
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 } } } };
|
|
3877
3842
|
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 } } } };
|
|
3878
3843
|
const StatePickerInput = _ref => {
|
|
3879
|
-
var _currentOption$data$l, _currentOption$data;
|
|
3880
3844
|
let isClearable = _ref.isClearable,
|
|
3881
3845
|
isDisabled = _ref.isDisabled,
|
|
3882
3846
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -3891,7 +3855,7 @@ const StatePickerInput = _ref => {
|
|
|
3891
3855
|
formatMessage = _useIntl.formatMessage;
|
|
3892
3856
|
const dataLocale = useApplicationContext(applicationContext => applicationContext.dataLocale);
|
|
3893
3857
|
const variables = useMemo(() => ({
|
|
3894
|
-
sortByNamePath:
|
|
3858
|
+
sortByNamePath: `name.${dataLocale}`
|
|
3895
3859
|
}), [dataLocale]);
|
|
3896
3860
|
const convertStateToOption = useCallback(state => {
|
|
3897
3861
|
const localizedName = formatLocalizedFieldToString(state.nameAllLocales);
|
|
@@ -3906,7 +3870,7 @@ const StatePickerInput = _ref => {
|
|
|
3906
3870
|
_useState2 = _slicedToArray(_useState, 2),
|
|
3907
3871
|
loadingError = _useState2[0],
|
|
3908
3872
|
setLoadingError = _useState2[1];
|
|
3909
|
-
const prefixSearchFields = useMemo(() => [
|
|
3873
|
+
const prefixSearchFields = useMemo(() => [`name.${dataLocale}`, 'key'], [dataLocale]);
|
|
3910
3874
|
const loadOptions = useLoadOptions({
|
|
3911
3875
|
query: GetStatesQuery,
|
|
3912
3876
|
variables,
|
|
@@ -3939,13 +3903,13 @@ const StatePickerInput = _ref => {
|
|
|
3939
3903
|
setLoadingError(null);
|
|
3940
3904
|
handleInternalInputChange(event);
|
|
3941
3905
|
}, [handleInternalInputChange]);
|
|
3942
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
3906
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
3943
3907
|
useEffect(() => {
|
|
3944
3908
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
3945
3909
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
3946
3910
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
3947
3911
|
const handleNoOptions = useCallback(() => loadingError ? null : formatMessage(messages$C.noStatesFound), [loadingError, formatMessage]);
|
|
3948
|
-
const tooltipTitle =
|
|
3912
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
3949
3913
|
return jsx(Constraints.Horizontal, {
|
|
3950
3914
|
max: "scale",
|
|
3951
3915
|
children: currentOption.loading ? jsx(CenteredLoadingSpinner, {}) : jsxs(Spacings.Stack, {
|
|
@@ -4010,26 +3974,23 @@ const CustomFieldTooltip = _ref => {
|
|
|
4010
3974
|
|
|
4011
3975
|
const setToArray = function () {
|
|
4012
3976
|
let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4013
|
-
return
|
|
3977
|
+
return `id in (${_mapInstanceProperty(values).call(values, value => `"${value}"`).join(', ')})`;
|
|
4014
3978
|
};
|
|
4015
3979
|
|
|
4016
3980
|
function capitalizeFirst(text) {
|
|
4017
3981
|
return text.charAt(0).toUpperCase() + _sliceInstanceProperty(text).call(text, 1);
|
|
4018
3982
|
}
|
|
4019
3983
|
|
|
4020
|
-
const getCentAmountClause = (value, operator, locale) => {
|
|
4021
|
-
var _context;
|
|
4022
|
-
return _concatInstanceProperty(_context = "centAmount ".concat(operator, " ")).call(_context, MoneyInput.convertToMoneyValue(value, locale).centAmount);
|
|
4023
|
-
};
|
|
3984
|
+
const getCentAmountClause = (value, operator, locale) => `centAmount ${operator} ${MoneyInput.convertToMoneyValue(value, locale).centAmount}`;
|
|
4024
3985
|
function moneyTransformer(value, option, locale) {
|
|
4025
3986
|
const clauses = [];
|
|
4026
3987
|
if (option === FILTER_TYPES.range) {
|
|
4027
|
-
clauses[0] =
|
|
3988
|
+
clauses[0] = `currencyCode = "${value.from.currencyCode}"`;
|
|
4028
3989
|
clauses[1] = getCentAmountClause(value.from, '>=', locale);
|
|
4029
3990
|
clauses[2] = getCentAmountClause(value.to, '<=', locale);
|
|
4030
3991
|
return clauses.join(' and ');
|
|
4031
3992
|
}
|
|
4032
|
-
clauses[0] =
|
|
3993
|
+
clauses[0] = `currencyCode = "${value.currencyCode}"`;
|
|
4033
3994
|
switch (option) {
|
|
4034
3995
|
case FILTER_TYPES.lessThan:
|
|
4035
3996
|
clauses[1] = getCentAmountClause(value, '<', locale);
|
|
@@ -4046,7 +4007,6 @@ function moneyTransformer(value, option, locale) {
|
|
|
4046
4007
|
return clauses.join(' and ');
|
|
4047
4008
|
}
|
|
4048
4009
|
|
|
4049
|
-
var _templateObject$2, _templateObject2$1;
|
|
4050
4010
|
const formatTime = 'HH:mm:ss.SSS';
|
|
4051
4011
|
|
|
4052
4012
|
/* TimeInput only allows HH:mm:ss and adds the seconds as 00 and
|
|
@@ -4068,7 +4028,6 @@ const defaultFilterValidator = _ref => {
|
|
|
4068
4028
|
const timeTransformer = function (filterKey, filters) {
|
|
4069
4029
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator;
|
|
4070
4030
|
const queries = _mapInstanceProperty(filters).call(filters, _ref2 => {
|
|
4071
|
-
var _context, _context2;
|
|
4072
4031
|
let type = _ref2.type,
|
|
4073
4032
|
value = _ref2.value;
|
|
4074
4033
|
if (!filterValidator({
|
|
@@ -4077,13 +4036,19 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4077
4036
|
})) return '';
|
|
4078
4037
|
switch (type) {
|
|
4079
4038
|
case FILTER_TYPES.lessThan:
|
|
4080
|
-
return
|
|
4039
|
+
return `${filterKey} < "${value}"`;
|
|
4081
4040
|
case FILTER_TYPES.moreThan:
|
|
4082
|
-
return
|
|
4041
|
+
return `${filterKey} > "${value}"`;
|
|
4083
4042
|
case FILTER_TYPES.equalTo:
|
|
4084
|
-
return oneLine
|
|
4043
|
+
return oneLine`
|
|
4044
|
+
(${filterKey} >= "${value}"
|
|
4045
|
+
and ${filterKey} <= "${getEndOfSecond(value)}")
|
|
4046
|
+
`;
|
|
4085
4047
|
case FILTER_TYPES.range:
|
|
4086
|
-
return oneLine
|
|
4048
|
+
return oneLine`
|
|
4049
|
+
(${filterKey} >= "${value.from}"
|
|
4050
|
+
and ${filterKey} <= "${getEndOfSecond(value.to)}")
|
|
4051
|
+
`;
|
|
4087
4052
|
default:
|
|
4088
4053
|
return '';
|
|
4089
4054
|
}
|
|
@@ -4099,7 +4064,7 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4099
4064
|
* (pickUpTime >= "14:00" and pickUpTime <= "15:00")
|
|
4100
4065
|
* ) or some_more_filters
|
|
4101
4066
|
*/
|
|
4102
|
-
return queryString === '' ? null :
|
|
4067
|
+
return queryString === '' ? null : `(${queryString})`;
|
|
4103
4068
|
};
|
|
4104
4069
|
|
|
4105
4070
|
// FIXME: delete once prefix search is supported in ctp api
|
|
@@ -4116,9 +4081,8 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4116
4081
|
// e.g
|
|
4117
4082
|
// where: `masterData(current(name(en >= "${lowerBound}" and en < "${upperBound}")))`
|
|
4118
4083
|
const getPrefixSearchBounds = input => {
|
|
4119
|
-
var _context;
|
|
4120
4084
|
const getNextCharacter = character => String.fromCharCode(character.charCodeAt() + 1);
|
|
4121
|
-
return [input,
|
|
4085
|
+
return [input, `${_sliceInstanceProperty(input).call(input, 0, input.length - 1)}${getNextCharacter(_sliceInstanceProperty(input).call(input, input.length - 1))}`];
|
|
4122
4086
|
};
|
|
4123
4087
|
|
|
4124
4088
|
const _excluded = ["action"];
|
|
@@ -4311,7 +4275,7 @@ const convertChangeValueAction = actionPayload => {
|
|
|
4311
4275
|
* as its dynamic content can not be typed in SDL for the mutation.
|
|
4312
4276
|
*/
|
|
4313
4277
|
const convertAction = (actionName, actionPayload) => {
|
|
4314
|
-
var
|
|
4278
|
+
var _context3, _context4, _context5;
|
|
4315
4279
|
const getNameFromPayload = payload => {
|
|
4316
4280
|
// changeName for `Organizations`
|
|
4317
4281
|
if (typeof payload.name === 'string') return payload;
|
|
@@ -4369,7 +4333,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4369
4333
|
case 'setCustomType':
|
|
4370
4334
|
return {
|
|
4371
4335
|
[actionName]: {
|
|
4372
|
-
typeId:
|
|
4336
|
+
typeId: actionPayload.type?.id,
|
|
4373
4337
|
fields: actionPayload.fields ? _mapInstanceProperty(_context3 = _Object$entries(actionPayload.fields)).call(_context3, _ref => {
|
|
4374
4338
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
4375
4339
|
customField = _ref2[0],
|
|
@@ -4399,10 +4363,10 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4399
4363
|
};
|
|
4400
4364
|
case 'setGeoLocation':
|
|
4401
4365
|
return {
|
|
4402
|
-
[actionName]: actionPayload
|
|
4366
|
+
[actionName]: actionPayload?.geoLocation ? {
|
|
4403
4367
|
geoLocation: {
|
|
4404
4368
|
type: 'Point',
|
|
4405
|
-
coordinates: [_parseFloat(
|
|
4369
|
+
coordinates: [_parseFloat(actionPayload.geoLocation?.longitude), _parseFloat(actionPayload.geoLocation?.latitude)]
|
|
4406
4370
|
}
|
|
4407
4371
|
} : {
|
|
4408
4372
|
undefined
|
|
@@ -4538,7 +4502,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4538
4502
|
case 'setShippingRateInputType':
|
|
4539
4503
|
return {
|
|
4540
4504
|
[actionName]: {
|
|
4541
|
-
shippingRateInputType:
|
|
4505
|
+
shippingRateInputType: actionPayload.shippingRateInputType?.type ? {
|
|
4542
4506
|
[actionPayload.shippingRateInputType.type]: {
|
|
4543
4507
|
values: actionPayload.shippingRateInputType.type === 'CartClassification' ? _mapInstanceProperty(_context4 = _valuesInstanceProperty(actionPayload.shippingRateInputType)).call(_context4, value => ({
|
|
4544
4508
|
key: value.key,
|
|
@@ -4592,8 +4556,8 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4592
4556
|
case 'addAddress':
|
|
4593
4557
|
case 'changeAddress':
|
|
4594
4558
|
{
|
|
4595
|
-
var
|
|
4596
|
-
const _ref3 =
|
|
4559
|
+
var _context6;
|
|
4560
|
+
const _ref3 = actionPayload.address?.custom || {},
|
|
4597
4561
|
_ref3$fields = _ref3.fields,
|
|
4598
4562
|
fields = _ref3$fields === void 0 ? {} : _ref3$fields;
|
|
4599
4563
|
const customFields = isEmpty$3(fields) ? null : _mapInstanceProperty(_context6 = _Object$entries(fields)).call(_context6, _ref4 => {
|
|
@@ -4605,7 +4569,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4605
4569
|
value: _JSON$stringify(value)
|
|
4606
4570
|
};
|
|
4607
4571
|
});
|
|
4608
|
-
const custom =
|
|
4572
|
+
const custom = actionPayload.address?.custom?.type?.id ? {
|
|
4609
4573
|
type: {
|
|
4610
4574
|
id: actionPayload.address.custom.type.id
|
|
4611
4575
|
},
|
|
@@ -4636,7 +4600,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4636
4600
|
value: _JSON$stringify(value)
|
|
4637
4601
|
};
|
|
4638
4602
|
});
|
|
4639
|
-
const customType = type
|
|
4603
|
+
const customType = type?.id ? {
|
|
4640
4604
|
id: type.id
|
|
4641
4605
|
} : null;
|
|
4642
4606
|
return {
|
|
@@ -4659,11 +4623,10 @@ const createGraphQlUpdateActions = actions => _reduceInstanceProperty(actions).c
|
|
|
4659
4623
|
return [...previousActions, convertAction(actionName, actionPayload)];
|
|
4660
4624
|
}, []);
|
|
4661
4625
|
const extractErrorFromGraphQlResponse = graphQlResponse => {
|
|
4662
|
-
|
|
4663
|
-
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) {
|
|
4626
|
+
if (graphQlResponse.networkError?.result?.errors?.length > 0) {
|
|
4664
4627
|
return graphQlResponse.networkError.result.errors;
|
|
4665
4628
|
}
|
|
4666
|
-
if (
|
|
4629
|
+
if (graphQlResponse.graphQLErrors?.length > 0) {
|
|
4667
4630
|
return graphQlResponse.graphQLErrors;
|
|
4668
4631
|
}
|
|
4669
4632
|
return graphQlResponse;
|
|
@@ -4692,16 +4655,14 @@ function omitDeep(obj, fieldsToOmit) {
|
|
|
4692
4655
|
function ownKeys$13(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4693
4656
|
function _objectSpread$13(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$13(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$13(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4694
4657
|
function getPriceChannelName(price) {
|
|
4695
|
-
|
|
4696
|
-
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;
|
|
4658
|
+
return price.channel?.name ?? price.channel?.key ?? null;
|
|
4697
4659
|
}
|
|
4698
4660
|
function getDiscountValue(price) {
|
|
4699
|
-
var _price$value, _price$value2, _price$discounted;
|
|
4700
4661
|
let preciseAmount;
|
|
4701
4662
|
let fractionedAmount;
|
|
4702
|
-
if (
|
|
4663
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision && price.discounted.value.type === PRECISION_TYPES.highPrecision) {
|
|
4703
4664
|
preciseAmount = price.value.preciseAmount - price.discounted.value.preciseAmount;
|
|
4704
|
-
} else if (
|
|
4665
|
+
} else if (price.value?.type === PRECISION_TYPES.highPrecision && price.discounted?.value?.type === PRECISION_TYPES.centPrecision) {
|
|
4705
4666
|
fractionedAmount = getFractionedAmount(price.value) - getFractionedAmount(price.discounted.value);
|
|
4706
4667
|
}
|
|
4707
4668
|
return price.discounted ? _objectSpread$13(_objectSpread$13({}, price.value), {}, {
|
|
@@ -4715,28 +4676,23 @@ function getDiscountValue(price) {
|
|
|
4715
4676
|
function getSelectedPrice(price) {
|
|
4716
4677
|
return price.discounted ? price.discounted : price;
|
|
4717
4678
|
}
|
|
4718
|
-
function getNetUnitPrice(
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
shouldRoundAmount = _ref2.shouldRoundAmount;
|
|
4679
|
+
function getNetUnitPrice(_ref) {
|
|
4680
|
+
let lineItem = _ref.lineItem,
|
|
4681
|
+
shouldRoundAmount = _ref.shouldRoundAmount;
|
|
4722
4682
|
const price = getSelectedPrice(lineItem.price);
|
|
4723
|
-
const filteredPerMethodTaxRate = lineItem
|
|
4724
|
-
var _lineItem$shippingDet;
|
|
4725
|
-
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(_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;
|
|
4726
|
-
});
|
|
4683
|
+
const filteredPerMethodTaxRate = lineItem?.perMethodTaxRate?.filter(perMethodTax => lineItem?.shippingDetails?.targets?.findIndex(target => target?.shippingMethodKey === perMethodTax?.shippingMethodKey) >= 0);
|
|
4727
4684
|
|
|
4728
4685
|
// when shipping mode is multi with the same tax rate
|
|
4729
|
-
if (
|
|
4730
|
-
var _price$value3, _price$value4;
|
|
4686
|
+
if (filteredPerMethodTaxRate?.length > 0 && filteredPerMethodTaxRate[0]?.taxRate?.includedInPrice) {
|
|
4731
4687
|
const taxRate = filteredPerMethodTaxRate[0].taxRate;
|
|
4732
4688
|
let centAmount;
|
|
4733
4689
|
// should accept 0 value
|
|
4734
|
-
if (typeof
|
|
4690
|
+
if (typeof price.value?.centAmount === 'number') {
|
|
4735
4691
|
const amount = price.value.centAmount / (1 + taxRate.amount);
|
|
4736
4692
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4737
4693
|
}
|
|
4738
4694
|
let preciseAmount;
|
|
4739
|
-
if (
|
|
4695
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + taxRate.amount);
|
|
4740
4696
|
return _objectSpread$13(_objectSpread$13({}, price.value), {}, {
|
|
4741
4697
|
centAmount,
|
|
4742
4698
|
preciseAmount
|
|
@@ -4745,15 +4701,14 @@ function getNetUnitPrice(_ref2) {
|
|
|
4745
4701
|
|
|
4746
4702
|
// when shipping mode is single
|
|
4747
4703
|
if (lineItem.taxRate && lineItem.taxRate.includedInPrice) {
|
|
4748
|
-
var _price$value5, _price$value6;
|
|
4749
4704
|
let centAmount;
|
|
4750
4705
|
// should accept 0 value
|
|
4751
|
-
if (typeof
|
|
4706
|
+
if (typeof price.value?.centAmount === 'number') {
|
|
4752
4707
|
const amount = price.value.centAmount / (1 + lineItem.taxRate.amount);
|
|
4753
4708
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4754
4709
|
}
|
|
4755
4710
|
let preciseAmount;
|
|
4756
|
-
if (
|
|
4711
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + lineItem.taxRate.amount);
|
|
4757
4712
|
return _objectSpread$13(_objectSpread$13({}, price.value), {}, {
|
|
4758
4713
|
centAmount,
|
|
4759
4714
|
preciseAmount
|
|
@@ -4787,18 +4742,18 @@ const transformCustomFieldFromGraphQLResponse = resource => {
|
|
|
4787
4742
|
key: resource.custom.type.key,
|
|
4788
4743
|
name: transformLocalizedFieldToLocalizedString(resource.custom.type.nameAllLocales),
|
|
4789
4744
|
fieldDefinitions: _mapInstanceProperty(_context = resource.custom.type.fieldDefinitions).call(_context, fieldDefinition => {
|
|
4790
|
-
var
|
|
4745
|
+
var _context2, _context3;
|
|
4791
4746
|
return {
|
|
4792
4747
|
name: fieldDefinition.name,
|
|
4793
4748
|
required: fieldDefinition.required,
|
|
4794
|
-
type:
|
|
4749
|
+
type: fieldDefinition.type?.elementType?.name === 'LocalizedEnum' ? _objectSpread$12(_objectSpread$12({}, fieldDefinition.type), {}, {
|
|
4795
4750
|
elementType: _objectSpread$12(_objectSpread$12({}, fieldDefinition.type.elementType), {}, {
|
|
4796
4751
|
values: _mapInstanceProperty(_context2 = _valuesInstanceProperty(fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
4797
4752
|
key: value.key,
|
|
4798
4753
|
label: transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
4799
4754
|
}))
|
|
4800
4755
|
})
|
|
4801
|
-
}) :
|
|
4756
|
+
}) : fieldDefinition.type?.name === 'LocalizedEnum' ? _objectSpread$12(_objectSpread$12({}, fieldDefinition.type), {}, {
|
|
4802
4757
|
values: _mapInstanceProperty(_context3 = _valuesInstanceProperty(fieldDefinition.type)).call(_context3, value => ({
|
|
4803
4758
|
key: value.key,
|
|
4804
4759
|
label: transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -4825,7 +4780,7 @@ const convertProductSelectionFromGraphQl = productSelection => {
|
|
|
4825
4780
|
from: 'nameAllLocales',
|
|
4826
4781
|
to: 'name'
|
|
4827
4782
|
}])), {}, {
|
|
4828
|
-
custom: productSelection
|
|
4783
|
+
custom: productSelection?.custom ? transformCustomFieldFromGraphQLResponse(productSelection) : null
|
|
4829
4784
|
});
|
|
4830
4785
|
};
|
|
4831
4786
|
|
|
@@ -4954,7 +4909,7 @@ let CustomFieldDefinitionsConnector = /*#__PURE__*/function (_Component) {
|
|
|
4954
4909
|
value: function componentDidMount() {
|
|
4955
4910
|
var _context;
|
|
4956
4911
|
const hasUnsupportedResource = _someInstanceProperty(_context = this.props.resources).call(_context, resource => !_includesInstanceProperty(customizableResources$1).call(customizableResources$1, resource));
|
|
4957
|
-
!!hasUnsupportedResource ? process.env.NODE_ENV !== "production" ? invariant(false,
|
|
4912
|
+
!!hasUnsupportedResource ? process.env.NODE_ENV !== "production" ? invariant(false, `core/components/custom-field-definitions-connector: some of the specified resources are not supported.`) : invariant(false) : void 0;
|
|
4958
4913
|
}
|
|
4959
4914
|
}, {
|
|
4960
4915
|
key: "render",
|
|
@@ -4973,9 +4928,9 @@ CustomFieldDefinitionsConnector.displayName = 'CustomFieldDefinitionsConnector';
|
|
|
4973
4928
|
CustomFieldDefinitionsConnector.defaultProps = {
|
|
4974
4929
|
resources: []
|
|
4975
4930
|
};
|
|
4976
|
-
const stringifyResources$1 = resources => _mapInstanceProperty(resources).call(resources, resource => "
|
|
4931
|
+
const stringifyResources$1 = resources => _mapInstanceProperty(resources).call(resources, resource => `"${resource}"`).join();
|
|
4977
4932
|
const mapPropsToOptions = ownProps => {
|
|
4978
|
-
const where = ownProps.resources.length > 0 ?
|
|
4933
|
+
const where = ownProps.resources.length > 0 ? `resourceTypeIds contains any (${stringifyResources$1(ownProps.resources)})` : undefined;
|
|
4979
4934
|
return {
|
|
4980
4935
|
variables: {
|
|
4981
4936
|
where,
|
|
@@ -5044,19 +4999,19 @@ const graphQlDocToForm = typeDefinition => {
|
|
|
5044
4999
|
key: typeDefinition.key,
|
|
5045
5000
|
name: transformLocalizedFieldToLocalizedString(typeDefinition.nameAllLocales),
|
|
5046
5001
|
fieldDefinitions: _mapInstanceProperty(_context = typeDefinition.fieldDefinitions).call(_context, fieldDefinition => {
|
|
5047
|
-
var
|
|
5002
|
+
var _context2, _context3;
|
|
5048
5003
|
return {
|
|
5049
5004
|
name: fieldDefinition.name,
|
|
5050
5005
|
required: fieldDefinition.required,
|
|
5051
5006
|
inputHint: fieldDefinition.inputHint,
|
|
5052
|
-
type:
|
|
5007
|
+
type: fieldDefinition.type?.elementType?.name === 'LocalizedEnum' ? _objectSpread$$(_objectSpread$$({}, fieldDefinition.type), {}, {
|
|
5053
5008
|
elementType: _objectSpread$$(_objectSpread$$({}, fieldDefinition.type.elementType), {}, {
|
|
5054
5009
|
values: _mapInstanceProperty(_context2 = _valuesInstanceProperty(fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
5055
5010
|
key: value.key,
|
|
5056
5011
|
label: transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
5057
5012
|
}))
|
|
5058
5013
|
})
|
|
5059
|
-
}) :
|
|
5014
|
+
}) : fieldDefinition.type?.name === 'LocalizedEnum' ? _objectSpread$$(_objectSpread$$({}, fieldDefinition.type), {}, {
|
|
5060
5015
|
values: _mapInstanceProperty(_context3 = _valuesInstanceProperty(fieldDefinition.type)).call(_context3, value => ({
|
|
5061
5016
|
key: value.key,
|
|
5062
5017
|
label: transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -5088,7 +5043,7 @@ const formToGraphQlDoc = formCustomFields => ({
|
|
|
5088
5043
|
// TODO(pa3): find usages and make sure only 1 param is passed
|
|
5089
5044
|
const createEmptyCustomFields = typeDefinition => ({
|
|
5090
5045
|
fields: {},
|
|
5091
|
-
type:
|
|
5046
|
+
type: typeDefinition?.type || {
|
|
5092
5047
|
fieldDefinitions: []
|
|
5093
5048
|
}
|
|
5094
5049
|
});
|
|
@@ -5114,7 +5069,7 @@ let CustomFieldTypeDefinitionsConnector = /*#__PURE__*/function (_Component) {
|
|
|
5114
5069
|
value: function componentDidMount() {
|
|
5115
5070
|
var _context;
|
|
5116
5071
|
const hasUnsupportedResource = _someInstanceProperty(_context = this.props.resources).call(_context, resource => !_includesInstanceProperty(customizableResources).call(customizableResources, resource));
|
|
5117
|
-
!!hasUnsupportedResource ? process.env.NODE_ENV !== "production" ? invariant(false,
|
|
5072
|
+
!!hasUnsupportedResource ? process.env.NODE_ENV !== "production" ? invariant(false, `core/components/custom-field-definitions-connector: some of the specified resources are not supported.`) : invariant(false) : void 0;
|
|
5118
5073
|
}
|
|
5119
5074
|
}, {
|
|
5120
5075
|
key: "render",
|
|
@@ -5139,9 +5094,9 @@ CustomFieldTypeDefinitionsConnector.graphQlDocToForm = graphQlDocToForm;
|
|
|
5139
5094
|
CustomFieldTypeDefinitionsConnector.formToRestDoc = formToRestDoc;
|
|
5140
5095
|
CustomFieldTypeDefinitionsConnector.formToGraphQlDoc = formToGraphQlDoc;
|
|
5141
5096
|
CustomFieldTypeDefinitionsConnector.createEmptyCustomFields = createEmptyCustomFields;
|
|
5142
|
-
const stringifyResources = resources => _mapInstanceProperty(resources).call(resources, resource => "
|
|
5097
|
+
const stringifyResources = resources => _mapInstanceProperty(resources).call(resources, resource => `"${resource}"`).join();
|
|
5143
5098
|
const createGraphQlOptions = ownProps => {
|
|
5144
|
-
const where = ownProps.resources.length > 0 ?
|
|
5099
|
+
const where = ownProps.resources.length > 0 ? `resourceTypeIds contains any (${stringifyResources(ownProps.resources)})` : undefined;
|
|
5145
5100
|
return {
|
|
5146
5101
|
variables: {
|
|
5147
5102
|
where,
|
|
@@ -5217,7 +5172,7 @@ const extractDuplicatedValues = (values, type, language, languages) => {
|
|
|
5217
5172
|
let validatedValues = [];
|
|
5218
5173
|
if (type.name.toLowerCase() === 'money') {
|
|
5219
5174
|
validatedValues = unique(values, ['amount', 'currencyCode']);
|
|
5220
|
-
} else if (type.name.toLowerCase() === 'reference') validatedValues = unique(_filterInstanceProperty(values).call(values, value => value
|
|
5175
|
+
} else if (type.name.toLowerCase() === 'reference') validatedValues = unique(_filterInstanceProperty(values).call(values, value => value?.id), ['id']);else if (type.name.toLowerCase() === 'localizedstring') {
|
|
5221
5176
|
validatedValues = unique(values, languages);
|
|
5222
5177
|
} else validatedValues = unique(values);
|
|
5223
5178
|
return validatedValues;
|
|
@@ -5336,7 +5291,7 @@ const DraggableWrapper = _ref => {
|
|
|
5336
5291
|
children: jsxs(Grid, {
|
|
5337
5292
|
gridTemplateColumns: '1fr 20fr',
|
|
5338
5293
|
gridTemplateRows: "auto 1fr auto",
|
|
5339
|
-
gridGap: customProperties.
|
|
5294
|
+
gridGap: customProperties.spacingM,
|
|
5340
5295
|
children: [jsx(Grid.Item, {
|
|
5341
5296
|
children: jsx(DragHandle, _objectSpread$X({}, provided.dragHandleProps))
|
|
5342
5297
|
}), jsx(Grid.Item, {
|
|
@@ -5433,7 +5388,6 @@ const getSubfieldLanguage = subfieldName => {
|
|
|
5433
5388
|
return subfieldName.substring(lastDotIndex + 1);
|
|
5434
5389
|
};
|
|
5435
5390
|
function CustomLocalizedTextInput(props) {
|
|
5436
|
-
var _value$language;
|
|
5437
5391
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
5438
5392
|
language: applicationContext.dataLocale,
|
|
5439
5393
|
languages: applicationContext.project.languages
|
|
@@ -5458,7 +5412,7 @@ function CustomLocalizedTextInput(props) {
|
|
|
5458
5412
|
props.setFieldValue(props.name, nullifiedIfNeeded);
|
|
5459
5413
|
});
|
|
5460
5414
|
const InputComponent = isMultiLine ? LocalizedMultilineTextInput : LocalizedTextInput;
|
|
5461
|
-
const tooltipTitle = isMultiLine ? '' : value ?
|
|
5415
|
+
const tooltipTitle = isMultiLine ? '' : value ? value[language] ?? '' : '';
|
|
5462
5416
|
return jsx(CustomFieldTooltip, {
|
|
5463
5417
|
title: tooltipTitle,
|
|
5464
5418
|
children: jsx(InputComponent, {
|
|
@@ -5502,8 +5456,7 @@ function CustomBooleanInput(props) {
|
|
|
5502
5456
|
CustomBooleanInput.displayName = 'CustomBooleanInput';
|
|
5503
5457
|
|
|
5504
5458
|
function CustomNumberInput(props) {
|
|
5505
|
-
|
|
5506
|
-
const value = (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : '';
|
|
5459
|
+
const value = props.value ?? '';
|
|
5507
5460
|
const handleChange = makeChangeHandler(rawValue => props.setFieldValue(props.name, !rawValue ? undefined : Number(rawValue)));
|
|
5508
5461
|
return jsx(NumberInput, {
|
|
5509
5462
|
id: props.name,
|
|
@@ -5548,7 +5501,7 @@ const fixAmount = value => {
|
|
|
5548
5501
|
// data user just entered effectively preventing full data from being entered.
|
|
5549
5502
|
const fixEnteredValue = (newValue, initialValue, currencies) => {
|
|
5550
5503
|
const withFixedCurrency = fixCurrencyCode(newValue, currencies);
|
|
5551
|
-
if (!
|
|
5504
|
+
if (!initialValue?.amount) {
|
|
5552
5505
|
return fixAmount(withFixedCurrency);
|
|
5553
5506
|
}
|
|
5554
5507
|
return withFixedCurrency;
|
|
@@ -5614,13 +5567,12 @@ const convertTypeValuesToOptions$1 = defaultMemoize((type, dataLocale, languages
|
|
|
5614
5567
|
key: 'label',
|
|
5615
5568
|
locale: dataLocale,
|
|
5616
5569
|
fallbackOrder: languages,
|
|
5617
|
-
fallback:
|
|
5570
|
+
fallback: `${value.key} (key)`
|
|
5618
5571
|
}),
|
|
5619
5572
|
value: value.key
|
|
5620
5573
|
}));
|
|
5621
5574
|
});
|
|
5622
5575
|
function CustomLocalizedEnumInput(props) {
|
|
5623
|
-
var _options$find$label, _options$find;
|
|
5624
5576
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
5625
5577
|
languages: applicationContext.project.languages,
|
|
5626
5578
|
dataLocale: applicationContext.dataLocale
|
|
@@ -5629,7 +5581,7 @@ function CustomLocalizedEnumInput(props) {
|
|
|
5629
5581
|
dataLocale = _useApplicationContex.dataLocale;
|
|
5630
5582
|
const options = convertTypeValuesToOptions$1(props.fieldDefinition.type, dataLocale, languages);
|
|
5631
5583
|
const handleChange = makeChangeHandler(rawValue => props.setFieldValue(props.name, rawValue));
|
|
5632
|
-
const tooltipTitle = props.value ?
|
|
5584
|
+
const tooltipTitle = props.value ? _findInstanceProperty(options).call(options, option => option.value === props.value)?.label ?? '' : '';
|
|
5633
5585
|
return jsx(CustomFieldTooltip, {
|
|
5634
5586
|
title: tooltipTitle,
|
|
5635
5587
|
children: jsx(SelectInput, {
|
|
@@ -5649,8 +5601,7 @@ function CustomLocalizedEnumInput(props) {
|
|
|
5649
5601
|
CustomLocalizedEnumInput.displayName = 'CustomLocalizedEnumInput';
|
|
5650
5602
|
|
|
5651
5603
|
function CustomRawIdReferenceInput(props) {
|
|
5652
|
-
|
|
5653
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
5604
|
+
const value = props.value?.id || '';
|
|
5654
5605
|
return jsx(CustomFieldTooltip, {
|
|
5655
5606
|
title: value,
|
|
5656
5607
|
children: jsx(TextInput, {
|
|
@@ -5695,7 +5646,7 @@ function getCategoriesByIds(apolloClient, options) {
|
|
|
5695
5646
|
return apolloClient.query({
|
|
5696
5647
|
query: FetchCategoriesByIds,
|
|
5697
5648
|
variables: {
|
|
5698
|
-
where:
|
|
5649
|
+
where: `id in (${_mapInstanceProperty(_context2 = options.ids).call(_context2, id => `"${id}"`).join(', ')})`
|
|
5699
5650
|
},
|
|
5700
5651
|
context: {
|
|
5701
5652
|
target: GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -5794,13 +5745,10 @@ const useReferenceSearchItems = _ref => {
|
|
|
5794
5745
|
};
|
|
5795
5746
|
};
|
|
5796
5747
|
function ReferenceSearch(props) {
|
|
5797
|
-
const ids = useMemo(() => {
|
|
5798
|
-
|
|
5799
|
-
return
|
|
5800
|
-
|
|
5801
|
-
return id;
|
|
5802
|
-
}) : [(_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.id] : [];
|
|
5803
|
-
}, [props.value, props.isMulti]);
|
|
5748
|
+
const ids = useMemo(() => props.value ? props.isMulti ? props.value?.map(_ref2 => {
|
|
5749
|
+
let id = _ref2.id;
|
|
5750
|
+
return id;
|
|
5751
|
+
}) : [props.value?.id] : [], [props.value, props.isMulti]);
|
|
5804
5752
|
const _useReferenceSearchIt = useReferenceSearchItems({
|
|
5805
5753
|
loadItemsBySearchTerm: props.loadItemsBySearchTerm,
|
|
5806
5754
|
loadItemsByIds: props.loadItemsByIds,
|
|
@@ -5811,14 +5759,14 @@ function ReferenceSearch(props) {
|
|
|
5811
5759
|
areSomeItemsMissing = _useReferenceSearchIt.areSomeItemsMissing,
|
|
5812
5760
|
handleLoadItems = _useReferenceSearchIt.handleLoadItems;
|
|
5813
5761
|
if (areItemsLoading) return null;
|
|
5814
|
-
const value = props.isMulti ? items : items
|
|
5762
|
+
const value = props.isMulti ? items : items?.[0];
|
|
5815
5763
|
let filterValue = null;
|
|
5816
5764
|
if (value) filterValue = props.isMulti ? _mapInstanceProperty(value).call(value, props.mapItemToOption) : props.mapItemToOption(value);
|
|
5817
5765
|
const tooltipTitle = value || props.value ? props.mapItemToOption(value || props.value).label : '';
|
|
5818
5766
|
const loadItems = value => _Promise.resolve(handleLoadItems(value)).then(items => _mapInstanceProperty(items).call(items, item => props.mapItemToOption(item)));
|
|
5819
5767
|
const handleChange = event => {
|
|
5820
|
-
var _context
|
|
5821
|
-
const option = props.isMulti ? _mapInstanceProperty(_context = event.target.value).call(_context, item => item.value) :
|
|
5768
|
+
var _context;
|
|
5769
|
+
const option = props.isMulti ? _mapInstanceProperty(_context = event.target.value).call(_context, item => item.value) : event.target.value?.value || null;
|
|
5822
5770
|
props.onChange(option);
|
|
5823
5771
|
};
|
|
5824
5772
|
return jsxs("div", {
|
|
@@ -5889,9 +5837,8 @@ const messages$B = defineMessages({
|
|
|
5889
5837
|
});
|
|
5890
5838
|
|
|
5891
5839
|
function ownKeys$T(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5892
|
-
function _objectSpread$T(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
5840
|
+
function _objectSpread$T(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$T(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$T(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5893
5841
|
function Option$1(props) {
|
|
5894
|
-
var _context, _context2;
|
|
5895
5842
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
5896
5843
|
language: applicationContext.dataLocale,
|
|
5897
5844
|
languages: applicationContext.project.languages
|
|
@@ -5912,19 +5859,19 @@ function Option$1(props) {
|
|
|
5912
5859
|
fallbackOrder: languages
|
|
5913
5860
|
})
|
|
5914
5861
|
}), category.parent && jsx(Text.Detail, {
|
|
5915
|
-
children:
|
|
5862
|
+
children: `${formatMessage(messages$B.parentCategory)}: ${formatLocalizedString(category.parent, {
|
|
5916
5863
|
key: 'name',
|
|
5917
5864
|
locale: language,
|
|
5918
5865
|
fallbackOrder: languages
|
|
5919
|
-
})
|
|
5866
|
+
})}`
|
|
5920
5867
|
}), jsx(Text.Detail, {
|
|
5921
|
-
children:
|
|
5868
|
+
children: `Slug: ${formatLocalizedString(category, {
|
|
5922
5869
|
key: 'slug',
|
|
5923
5870
|
locale: language,
|
|
5924
5871
|
fallbackOrder: languages
|
|
5925
|
-
})
|
|
5872
|
+
})}`
|
|
5926
5873
|
}), category.externalId && jsx(Text.Detail, {
|
|
5927
|
-
children:
|
|
5874
|
+
children: `${formatMessage(messages$B.externalId)}: ${category.externalId || NO_VALUE_FALLBACK}`
|
|
5928
5875
|
})]
|
|
5929
5876
|
})
|
|
5930
5877
|
}));
|
|
@@ -5987,7 +5934,7 @@ var CategorySearchPickerOptionFragment$1 = { kind: "Document", definitions: [{ k
|
|
|
5987
5934
|
function useCachedCategoryOptions(ids) {
|
|
5988
5935
|
const apolloClient = useApolloClient$1();
|
|
5989
5936
|
const fragments = _mapInstanceProperty(ids).call(ids, id => apolloClient.readFragment({
|
|
5990
|
-
id:
|
|
5937
|
+
id: `CategorySearch:${id}`,
|
|
5991
5938
|
fragment: CategorySearchPickerOptionFragment$1
|
|
5992
5939
|
}));
|
|
5993
5940
|
return _mapInstanceProperty(fragments).call(fragments, category => transformLocalizedFieldsForCategory(category, [{
|
|
@@ -6002,8 +5949,8 @@ function useCachedCategoryOptions(ids) {
|
|
|
6002
5949
|
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 } } } };
|
|
6003
5950
|
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 } } } };
|
|
6004
5951
|
const transformCartDiscountResponse = response => {
|
|
6005
|
-
var _context
|
|
6006
|
-
return _mapInstanceProperty(_context =
|
|
5952
|
+
var _context;
|
|
5953
|
+
return _mapInstanceProperty(_context = response.data?.cartDiscounts.results || []).call(_context, cartDiscount => transformLocalizedFieldsForCartDiscount(cartDiscount));
|
|
6007
5954
|
};
|
|
6008
5955
|
function queryCartDiscounts(apolloClient) {
|
|
6009
5956
|
return apolloClient.query({
|
|
@@ -6015,14 +5962,14 @@ function queryCartDiscounts(apolloClient) {
|
|
|
6015
5962
|
}).then(transformCartDiscountResponse);
|
|
6016
5963
|
}
|
|
6017
5964
|
const getWhereClause = function () {
|
|
6018
|
-
var _context2, _context3
|
|
5965
|
+
var _context2, _context3;
|
|
6019
5966
|
let searchText = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
6020
5967
|
let language = arguments.length > 1 ? arguments[1] : undefined;
|
|
6021
5968
|
const query = _trimInstanceProperty(_context2 = _JSON$stringify(searchText)).call(_context2);
|
|
6022
|
-
const idQuery = isUUID(searchText) &&
|
|
6023
|
-
const nameQuery =
|
|
6024
|
-
const keyQuery =
|
|
6025
|
-
return _filterInstanceProperty(
|
|
5969
|
+
const idQuery = isUUID(searchText) && `id = ${query}`;
|
|
5970
|
+
const nameQuery = `name(${language} = ${query})`;
|
|
5971
|
+
const keyQuery = `key = ${query}`;
|
|
5972
|
+
return _filterInstanceProperty(_context3 = [idQuery, nameQuery, keyQuery]).call(_context3, Boolean).join(' or ');
|
|
6026
5973
|
};
|
|
6027
5974
|
function searchCartDiscountsByExactMatch(apolloClient, options) {
|
|
6028
5975
|
return apolloClient.query({
|
|
@@ -6045,10 +5992,7 @@ function getCartDiscountById(apolloClient, options) {
|
|
|
6045
5992
|
context: {
|
|
6046
5993
|
target: GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
6047
5994
|
}
|
|
6048
|
-
}).then(response =>
|
|
6049
|
-
var _response$data2;
|
|
6050
|
-
return (_response$data2 = response.data) !== null && _response$data2 !== void 0 && _response$data2.cartDiscount ? transformLocalizedFieldsForCartDiscount(response.data.cartDiscount) : null;
|
|
6051
|
-
});
|
|
5995
|
+
}).then(response => response.data?.cartDiscount ? transformLocalizedFieldsForCartDiscount(response.data.cartDiscount) : null);
|
|
6052
5996
|
}
|
|
6053
5997
|
|
|
6054
5998
|
const messages$A = defineMessages({
|
|
@@ -6125,7 +6069,7 @@ function CartDiscountReferenceSearch(props) {
|
|
|
6125
6069
|
}),
|
|
6126
6070
|
loading = _useQuery.loading,
|
|
6127
6071
|
data = _useQuery.data;
|
|
6128
|
-
const isExactMatch =
|
|
6072
|
+
const isExactMatch = data?.cartDiscounts.total > QUERY_MAX_LIMIT;
|
|
6129
6073
|
const _useIntl = useIntl(),
|
|
6130
6074
|
formatMessage = _useIntl.formatMessage;
|
|
6131
6075
|
const apolloClient = useApolloClient$1();
|
|
@@ -6262,7 +6206,6 @@ const DropdownIndicator = () => jsx(SearchIcon, {
|
|
|
6262
6206
|
});
|
|
6263
6207
|
DropdownIndicator.displayName = 'DropdownIndicator';
|
|
6264
6208
|
const ProductPickerInput = _ref => {
|
|
6265
|
-
var _currentOption$data$l, _currentOption$data;
|
|
6266
6209
|
let isClearable = _ref.isClearable,
|
|
6267
6210
|
isDisabled = _ref.isDisabled,
|
|
6268
6211
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -6282,20 +6225,19 @@ const ProductPickerInput = _ref => {
|
|
|
6282
6225
|
loadingError = _useState2[0],
|
|
6283
6226
|
setLoadingError = _useState2[1];
|
|
6284
6227
|
const convertProductToOption = useCallback(product => {
|
|
6285
|
-
var _masterData$current;
|
|
6286
6228
|
if (!product) return null;
|
|
6287
6229
|
const id = product.id,
|
|
6288
6230
|
key = product.key,
|
|
6289
6231
|
masterData = product.masterData;
|
|
6290
|
-
const localizedName = formatLocalizedFieldToString(
|
|
6232
|
+
const localizedName = formatLocalizedFieldToString(masterData.current?.nameAllLocales);
|
|
6291
6233
|
return {
|
|
6292
|
-
label: localizedName + (key ?
|
|
6234
|
+
label: localizedName + (key ? ` (key: ${key})` : ''),
|
|
6293
6235
|
value: id,
|
|
6294
6236
|
name: localizedName,
|
|
6295
6237
|
key
|
|
6296
6238
|
};
|
|
6297
6239
|
}, [formatLocalizedFieldToString]);
|
|
6298
|
-
const prefixSearchFields = useMemo(() => [
|
|
6240
|
+
const prefixSearchFields = useMemo(() => [`masterData.current.name.${dataLocale}`, 'key'], [dataLocale]);
|
|
6299
6241
|
const loadOptions = useLoadOptions({
|
|
6300
6242
|
query: GetProductsQuery,
|
|
6301
6243
|
prefixSearchFields
|
|
@@ -6326,12 +6268,12 @@ const ProductPickerInput = _ref => {
|
|
|
6326
6268
|
setLoadingError(null);
|
|
6327
6269
|
handleInternalInputChange(event);
|
|
6328
6270
|
}, [handleInternalInputChange]);
|
|
6329
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
6271
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
6330
6272
|
useEffect(() => {
|
|
6331
6273
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
6332
6274
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
6333
6275
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
6334
|
-
const tooltipTitle =
|
|
6276
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
6335
6277
|
return jsx(Constraints.Horizontal, {
|
|
6336
6278
|
max: "scale",
|
|
6337
6279
|
children: currentOption.loading ? jsx(CenteredLoadingSpinner, {}) : jsxs(Spacings.Stack, {
|
|
@@ -6368,8 +6310,7 @@ const ProductPickerInput = _ref => {
|
|
|
6368
6310
|
ProductPickerInput.displayName = 'ProductPickerInput';
|
|
6369
6311
|
|
|
6370
6312
|
function CustomProductReferenceInput(props) {
|
|
6371
|
-
|
|
6372
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6313
|
+
const value = props.value?.id || '';
|
|
6373
6314
|
return jsx(ProductPickerInput, {
|
|
6374
6315
|
value: value,
|
|
6375
6316
|
name: props.name,
|
|
@@ -6386,8 +6327,7 @@ function CustomProductReferenceInput(props) {
|
|
|
6386
6327
|
CustomProductReferenceInput.displayName = 'CustomProductReferenceInput';
|
|
6387
6328
|
|
|
6388
6329
|
function CustomProductTypeReferenceInput(props) {
|
|
6389
|
-
|
|
6390
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6330
|
+
const value = props.value?.id || '';
|
|
6391
6331
|
return jsx(ProductTypePickerInput, {
|
|
6392
6332
|
value: value,
|
|
6393
6333
|
name: props.name,
|
|
@@ -6403,8 +6343,7 @@ function CustomProductTypeReferenceInput(props) {
|
|
|
6403
6343
|
CustomProductTypeReferenceInput.displayName = 'CustomProductTypeReferenceInput';
|
|
6404
6344
|
|
|
6405
6345
|
function CustomChannelReferenceInput(props) {
|
|
6406
|
-
|
|
6407
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6346
|
+
const value = props.value?.id || '';
|
|
6408
6347
|
return jsx(ChannelPickerInput, {
|
|
6409
6348
|
value: value,
|
|
6410
6349
|
name: props.name,
|
|
@@ -6420,8 +6359,7 @@ function CustomChannelReferenceInput(props) {
|
|
|
6420
6359
|
CustomChannelReferenceInput.displayName = 'CustomChannelReferenceInput';
|
|
6421
6360
|
|
|
6422
6361
|
function CustomStateReferenceInput(props) {
|
|
6423
|
-
|
|
6424
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6362
|
+
const value = props.value?.id || '';
|
|
6425
6363
|
return jsx(StatePickerInput, {
|
|
6426
6364
|
value: value,
|
|
6427
6365
|
name: props.name,
|
|
@@ -6530,14 +6468,13 @@ function CustomTimeInput(props) {
|
|
|
6530
6468
|
CustomTimeInput.displayName = 'CustomTimeInput';
|
|
6531
6469
|
|
|
6532
6470
|
const convertTypeValuesToOptions = defaultMemoize(typeValues => _mapInstanceProperty(typeValues).call(typeValues, typeValue => ({
|
|
6533
|
-
label: typeValue.label ||
|
|
6471
|
+
label: typeValue.label || `${typeValue.key} (key)`,
|
|
6534
6472
|
value: typeValue.key
|
|
6535
6473
|
})));
|
|
6536
6474
|
function CustomEnumInput(props) {
|
|
6537
|
-
var _options$find$label, _options$find;
|
|
6538
6475
|
const options = convertTypeValuesToOptions(_valuesInstanceProperty(props.fieldDefinition.type));
|
|
6539
6476
|
const handleChange = makeChangeHandler(rawValue => props.setFieldValue(props.name, rawValue));
|
|
6540
|
-
const tooltipTitle = props.value ?
|
|
6477
|
+
const tooltipTitle = props.value ? _findInstanceProperty(options).call(options, option => option.value === props.value)?.label ?? '' : '';
|
|
6541
6478
|
return jsx(CustomFieldTooltip, {
|
|
6542
6479
|
title: tooltipTitle,
|
|
6543
6480
|
children: jsx(SelectInput, {
|
|
@@ -6609,9 +6546,9 @@ function ownKeys$P(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySy
|
|
|
6609
6546
|
function _objectSpread$P(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context7 = ownKeys$P(Object(t), !0)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context8 = ownKeys$P(Object(t))).call(_context8, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6610
6547
|
const getTypeName = type => type.name.toLowerCase();
|
|
6611
6548
|
const findLabel = (enumType, key) => {
|
|
6612
|
-
var
|
|
6549
|
+
var _context;
|
|
6613
6550
|
const emptyValue = getTypeName(enumType) === 'enum' ? '' : {};
|
|
6614
|
-
return
|
|
6551
|
+
return _findInstanceProperty(_context = _valuesInstanceProperty(enumType)).call(_context, value => value.key === key)?.label ?? emptyValue;
|
|
6615
6552
|
};
|
|
6616
6553
|
const convertEnumValues = (value, attributeDefinition) => {
|
|
6617
6554
|
var _context2, _context3;
|
|
@@ -6675,7 +6612,7 @@ const attributesMapToNameValuePairs = map => {
|
|
|
6675
6612
|
|
|
6676
6613
|
const getAttributeShortName = (fullName, attributesPrefix) => {
|
|
6677
6614
|
if (!attributesPrefix) return fullName;
|
|
6678
|
-
return fullName.replace(
|
|
6615
|
+
return fullName.replace(`${attributesPrefix}.`, '');
|
|
6679
6616
|
};
|
|
6680
6617
|
function ProductAttributes(props) {
|
|
6681
6618
|
const formik = useFormikContext();
|
|
@@ -6757,19 +6694,19 @@ function ownKeys$O(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySy
|
|
|
6757
6694
|
function _objectSpread$O(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context6 = ownKeys$O(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context7 = ownKeys$O(Object(t))).call(_context7, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6758
6695
|
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 } } } };
|
|
6759
6696
|
const mapAttributeDefinition = definition => {
|
|
6760
|
-
var _context,
|
|
6697
|
+
var _context, _context2, _context3, _context4;
|
|
6761
6698
|
return _objectSpread$O(_objectSpread$O({}, definition), {}, {
|
|
6762
6699
|
required: definition.isRequired,
|
|
6763
6700
|
inputTip: transformLocalizedFieldToLocalizedString(definition.inputTipAllLocales),
|
|
6764
6701
|
label: transformLocalizedFieldToLocalizedString(definition.labelAllLocales),
|
|
6765
|
-
type: _includesInstanceProperty(_context = ['enum', 'lenum']).call(_context,
|
|
6702
|
+
type: _includesInstanceProperty(_context = ['enum', 'lenum']).call(_context, definition.type?.elementType?.name) ? _objectSpread$O(_objectSpread$O({}, definition.type), {}, {
|
|
6766
6703
|
elementType: _objectSpread$O(_objectSpread$O({}, definition.type.elementType), {}, {
|
|
6767
6704
|
values: _mapInstanceProperty(_context2 = _valuesInstanceProperty(definition.type.elementType).results).call(_context2, value => ({
|
|
6768
6705
|
key: value.key,
|
|
6769
6706
|
label: value.label || transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
6770
6707
|
}))
|
|
6771
6708
|
})
|
|
6772
|
-
}) : _includesInstanceProperty(_context3 = ['enum', 'lenum']).call(_context3,
|
|
6709
|
+
}) : _includesInstanceProperty(_context3 = ['enum', 'lenum']).call(_context3, definition.type?.name) ? _objectSpread$O(_objectSpread$O({}, definition.type), {}, {
|
|
6773
6710
|
values: _mapInstanceProperty(_context4 = _valuesInstanceProperty(definition.type).results).call(_context4, value => ({
|
|
6774
6711
|
key: value.key,
|
|
6775
6712
|
label: value.label || transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -7092,15 +7029,21 @@ CustomNestedInput.displayName = 'CustomNestedInput';
|
|
|
7092
7029
|
|
|
7093
7030
|
var styles$d = {
|
|
7094
7031
|
"divider": "divider-module__divider___4-vdy",
|
|
7032
|
+
"divider-horizontal": "divider-module__divider-horizontal___RuUcj",
|
|
7033
|
+
"divider-vertical": "divider-module__divider-vertical___32kJG",
|
|
7095
7034
|
"divider-solid": "divider-module__divider-solid___3Fs4q divider-module__divider___4-vdy",
|
|
7096
7035
|
"divider-dashed": "divider-module__divider-dashed___2Em8A divider-module__divider___4-vdy"
|
|
7097
7036
|
};
|
|
7098
7037
|
function Divider(_ref) {
|
|
7099
|
-
let isDashed = _ref.isDashed
|
|
7038
|
+
let isDashed = _ref.isDashed,
|
|
7039
|
+
_ref$orientation = _ref.orientation,
|
|
7040
|
+
orientation = _ref$orientation === void 0 ? 'horizontal' : _ref$orientation;
|
|
7100
7041
|
return jsx("hr", {
|
|
7101
7042
|
className: classnames({
|
|
7102
7043
|
[styles$d['divider-solid']]: !isDashed,
|
|
7103
|
-
[styles$d['divider-dashed']]: isDashed
|
|
7044
|
+
[styles$d['divider-dashed']]: isDashed,
|
|
7045
|
+
[styles$d['divider-horizontal']]: orientation === 'horizontal',
|
|
7046
|
+
[styles$d['divider-vertical']]: orientation === 'vertical'
|
|
7104
7047
|
})
|
|
7105
7048
|
});
|
|
7106
7049
|
}
|
|
@@ -7114,7 +7057,7 @@ const ExpandButton = props => props.totalValues > 1 ? jsxs(Spacings.Stack, {
|
|
|
7114
7057
|
}), jsx(FlatButton, {
|
|
7115
7058
|
tone: "primary",
|
|
7116
7059
|
icon: props.isExpanded ? jsx(AngleUpIcon, {}) : jsx(AngleDownIcon, {}),
|
|
7117
|
-
label: props.isExpanded ?
|
|
7060
|
+
label: props.isExpanded ? `Hide set items (${props.totalValues})` : `Show all set items (${props.totalValues})`,
|
|
7118
7061
|
onClick: props.onExpand
|
|
7119
7062
|
})]
|
|
7120
7063
|
}) : null;
|
|
@@ -7149,7 +7092,7 @@ const SetButtons = props => {
|
|
|
7149
7092
|
SetButtons.displayName = 'SetButtons';
|
|
7150
7093
|
|
|
7151
7094
|
function ownKeys$M(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7152
|
-
function _objectSpread$M(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
7095
|
+
function _objectSpread$M(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys$M(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys$M(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7153
7096
|
const getDuplicateErrors = setValues => {
|
|
7154
7097
|
/* eslint-disable no-plusplus */
|
|
7155
7098
|
const result = [];
|
|
@@ -7190,13 +7133,10 @@ const getItemIndex = name => {
|
|
|
7190
7133
|
return _parseInt(rawIndex, 10);
|
|
7191
7134
|
};
|
|
7192
7135
|
const makeKeys = amount => times(amount, () => v4());
|
|
7193
|
-
const makeItemFieldName = (fieldName, index) => {
|
|
7194
|
-
var _context;
|
|
7195
|
-
return _concatInstanceProperty(_context = "".concat(fieldName, ".[")).call(_context, index, "]");
|
|
7196
|
-
};
|
|
7136
|
+
const makeItemFieldName = (fieldName, index) => `${fieldName}.[${index}]`;
|
|
7197
7137
|
const makeMapForAllItems = (fieldName, items, value) => _reduceInstanceProperty(items).call(items, (result, item, index) => set(result, makeItemFieldName(fieldName, index), value), {});
|
|
7198
7138
|
function CustomInputSet(props) {
|
|
7199
|
-
var
|
|
7139
|
+
var _context;
|
|
7200
7140
|
const _useToggleState = useToggleState(false),
|
|
7201
7141
|
_useToggleState2 = _slicedToArray(_useToggleState, 2),
|
|
7202
7142
|
isExpanded = _useToggleState2[0],
|
|
@@ -7218,7 +7158,7 @@ function CustomInputSet(props) {
|
|
|
7218
7158
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
7219
7159
|
keys = _useState4[0],
|
|
7220
7160
|
setKeys = _useState4[1];
|
|
7221
|
-
const totalAmount = internalValue
|
|
7161
|
+
const totalAmount = internalValue?.length;
|
|
7222
7162
|
const amountToRender = isExpanded ? totalAmount : 1;
|
|
7223
7163
|
const updateInternalValue = newValue => {
|
|
7224
7164
|
const valueToSet = isEmpty$1(newValue) ? [undefined] : newValue;
|
|
@@ -7265,8 +7205,8 @@ function CustomInputSet(props) {
|
|
|
7265
7205
|
// in <CustomFieldComponent /> where proper component for given field/attribute
|
|
7266
7206
|
// type is selected.
|
|
7267
7207
|
const type = getType(props.fieldDefinition);
|
|
7268
|
-
const typeName = type
|
|
7269
|
-
const areButtonsTopAligned = _includesInstanceProperty(
|
|
7208
|
+
const typeName = type?.name.toLowerCase();
|
|
7209
|
+
const areButtonsTopAligned = _includesInstanceProperty(_context = [CUSTOM_FIELD_TYPES.lenum, CUSTOM_FIELD_TYPES.localizedenum, CUSTOM_FIELD_TYPES.localizedstring, CUSTOM_FIELD_TYPES.string, CUSTOM_FIELD_TYPES.text, CUSTOM_FIELD_TYPES.ltext, CUSTOM_FIELD_TYPES.reference]).call(_context, typeName);
|
|
7270
7210
|
return jsxs(Fragment, {
|
|
7271
7211
|
children: [jsx(AccessibleHidden, {
|
|
7272
7212
|
children: jsx("label", {
|
|
@@ -7344,14 +7284,12 @@ const nonSetComponents = {
|
|
|
7344
7284
|
};
|
|
7345
7285
|
const CustomFieldInput = /*#__PURE__*/memo(props => {
|
|
7346
7286
|
const InputComponent = useMemo(() => {
|
|
7347
|
-
|
|
7348
|
-
const typeName = (_props$fieldDefinitio = props.fieldDefinition.type) === null || _props$fieldDefinitio === void 0 ? void 0 : _props$fieldDefinitio.name.toLowerCase();
|
|
7287
|
+
const typeName = props.fieldDefinition.type?.name.toLowerCase();
|
|
7349
7288
|
if (typeName === 'set') {
|
|
7350
|
-
var _getSetElementType;
|
|
7351
7289
|
// Boolean is the only set element with peculiarities (i.e. way more
|
|
7352
7290
|
// convenient for user to work with it as with select input with three values:
|
|
7353
7291
|
// [true], [false] and [true, false]).
|
|
7354
|
-
if (
|
|
7292
|
+
if (getType(props.fieldDefinition)?.name.toLowerCase() === CUSTOM_FIELD_TYPES.boolean) {
|
|
7355
7293
|
return CustomBooleanInputSet;
|
|
7356
7294
|
}
|
|
7357
7295
|
// All the rest sets are just a fancy wrapper around single-item components
|
|
@@ -7442,9 +7380,9 @@ const CustomFieldErrors = props => {
|
|
|
7442
7380
|
const didFormValidationFail = useDidFormValidationFail();
|
|
7443
7381
|
const errors = _Array$isArray(props.errors) ? mergeSetItemsErrors(props.errors) : props.errors;
|
|
7444
7382
|
return jsxs(Fragment, {
|
|
7445
|
-
children: [props.isTouched || didFormValidationFail &&
|
|
7383
|
+
children: [props.isTouched || didFormValidationFail && errors?.missing && jsx(ErrorMessage, {
|
|
7446
7384
|
intlMessage: messages$K.required
|
|
7447
|
-
}), props.isTouched || didFormValidationFail &&
|
|
7385
|
+
}), props.isTouched || didFormValidationFail && errors?.duplicated && jsx(ErrorMessage, {
|
|
7448
7386
|
intlMessage: messages$K.unique
|
|
7449
7387
|
})]
|
|
7450
7388
|
});
|
|
@@ -7494,10 +7432,9 @@ function _objectSpread$J(e) { for (var r = 1; r < arguments.length; r++) { var _
|
|
|
7494
7432
|
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)."; }
|
|
7495
7433
|
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 } } } };
|
|
7496
7434
|
const CustomFieldsLabelHint = _ref2 => {
|
|
7497
|
-
var _type$name;
|
|
7498
7435
|
let fieldDefinition = _ref2.fieldDefinition;
|
|
7499
7436
|
const type = getType(fieldDefinition);
|
|
7500
|
-
const isReference =
|
|
7437
|
+
const isReference = type.name?.toLowerCase() === 'reference';
|
|
7501
7438
|
const referenceTypeId = type.referenceTypeId;
|
|
7502
7439
|
const isCartDiscountsReference = isReference && referenceTypeId === SEARCHABLE_REFERENCES.cartDiscount;
|
|
7503
7440
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
@@ -7515,7 +7452,7 @@ const CustomFieldsLabelHint = _ref2 => {
|
|
|
7515
7452
|
data = _useQuery.data,
|
|
7516
7453
|
loading = _useQuery.loading;
|
|
7517
7454
|
if (loading) return null;
|
|
7518
|
-
if (
|
|
7455
|
+
if (data?.cartDiscounts.total > QUERY_MAX_LIMIT) {
|
|
7519
7456
|
return jsxs(Spacings.Inline, {
|
|
7520
7457
|
alignItems: "center",
|
|
7521
7458
|
children: [jsx(WarningIcon, {
|
|
@@ -7542,17 +7479,17 @@ function CustomFieldsProductTypeReferenceSubtitle() {
|
|
|
7542
7479
|
// TODO(pa3): this logic may be misplaced and probably
|
|
7543
7480
|
// should belong to <CustomReferenceInput /> component instead.
|
|
7544
7481
|
function CustomFieldsLabelSubtitle(_ref3) {
|
|
7545
|
-
var
|
|
7482
|
+
var _context;
|
|
7546
7483
|
let fieldDefinition = _ref3.fieldDefinition;
|
|
7547
7484
|
const _useIntl2 = useIntl(),
|
|
7548
7485
|
formatMessage = _useIntl2.formatMessage;
|
|
7549
7486
|
const type = getType(fieldDefinition);
|
|
7550
|
-
const isReference =
|
|
7487
|
+
const isReference = type.name?.toLowerCase() === 'reference';
|
|
7551
7488
|
if (!isReference) return null;
|
|
7552
7489
|
const referenceTypeId = type.referenceTypeId;
|
|
7553
7490
|
const referenceTypeName = capitalizeFirst(referenceTypeId);
|
|
7554
7491
|
if (_includesInstanceProperty(_context = [SEARCHABLE_REFERENCES.category, SEARCHABLE_REFERENCES.cartDiscount]).call(_context, referenceTypeId)) return referenceTypeName;
|
|
7555
|
-
return referenceTypeId === SEARCHABLE_REFERENCES.product ? formatMessage(messages$v.productReferenceLabel) : referenceTypeId === SEARCHABLE_REFERENCES.productType ? jsx(CustomFieldsProductTypeReferenceSubtitle, {}) : referenceTypeId === SEARCHABLE_REFERENCES.channel ? formatMessage(messages$v.channelReferenceLabel) : referenceTypeId === SEARCHABLE_REFERENCES.state ? formatMessage(messages$v.stateReferenceLabel) :
|
|
7492
|
+
return referenceTypeId === SEARCHABLE_REFERENCES.product ? formatMessage(messages$v.productReferenceLabel) : referenceTypeId === SEARCHABLE_REFERENCES.productType ? jsx(CustomFieldsProductTypeReferenceSubtitle, {}) : referenceTypeId === SEARCHABLE_REFERENCES.channel ? formatMessage(messages$v.channelReferenceLabel) : referenceTypeId === SEARCHABLE_REFERENCES.state ? formatMessage(messages$v.stateReferenceLabel) : `${referenceTypeName} ID`;
|
|
7556
7493
|
}
|
|
7557
7494
|
const Portal = props => /*#__PURE__*/ReactDOM.createPortal(props.children, document.body);
|
|
7558
7495
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
@@ -7569,7 +7506,7 @@ function CustomFieldsCountIndicator(_ref4) {
|
|
|
7569
7506
|
const formatLocalizedField = useFormatLocalizedFieldToString();
|
|
7570
7507
|
const _useIntl3 = useIntl(),
|
|
7571
7508
|
formatMessage = _useIntl3.formatMessage;
|
|
7572
|
-
return
|
|
7509
|
+
return assignedAttributeGroups?.length > 1 ? jsx(Tooltip, {
|
|
7573
7510
|
title: formatMessage(messages$v.attributeGroupCountTooltip, {
|
|
7574
7511
|
attributeGroups: _mapInstanceProperty(assignedAttributeGroups).call(assignedAttributeGroups, assignedAttributeGroup => formatLocalizedField(assignedAttributeGroup.nameAllLocales)).join(', '),
|
|
7575
7512
|
count: assignedAttributeGroups.length
|
|
@@ -7627,9 +7564,8 @@ const CustomFieldsLabel = /*#__PURE__*/memo(_ref5 => {
|
|
|
7627
7564
|
CustomFieldsLabel.displayName = 'CustomFieldsTitle';
|
|
7628
7565
|
|
|
7629
7566
|
const getFieldName = (parentName, fieldName) => {
|
|
7630
|
-
var _context;
|
|
7631
7567
|
if (!parentName) return fieldName;
|
|
7632
|
-
return
|
|
7568
|
+
return `${parentName}.${fieldName}`;
|
|
7633
7569
|
};
|
|
7634
7570
|
const isNested = fieldDefinition => {
|
|
7635
7571
|
const type = fieldDefinition.type;
|
|
@@ -7654,7 +7590,6 @@ const CustomFieldsInternal = props => {
|
|
|
7654
7590
|
isDragAndDropMode = _useDnDContext.isDragAndDropMode;
|
|
7655
7591
|
return jsx(DroppableWrapper, {
|
|
7656
7592
|
children: _mapInstanceProperty(fieldDefinitions).call(fieldDefinitions, (fieldDefinition, index) => {
|
|
7657
|
-
var _context2;
|
|
7658
7593
|
const fieldName = getFieldName(props.name, fieldDefinition.name);
|
|
7659
7594
|
const isTouched = Boolean(getIn(touched, fieldName));
|
|
7660
7595
|
const fieldErrors = getIn(errors, fieldName);
|
|
@@ -7671,51 +7606,48 @@ const CustomFieldsInternal = props => {
|
|
|
7671
7606
|
return jsx(FastField, {
|
|
7672
7607
|
name: fieldName,
|
|
7673
7608
|
validate: validate,
|
|
7674
|
-
children: () => {
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
children:
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
|
|
7685
|
-
|
|
7686
|
-
|
|
7609
|
+
children: () => jsx(DraggableWrapper, {
|
|
7610
|
+
draggableKey: `${fieldName}-${index}`,
|
|
7611
|
+
draggableId: `${fieldName}-${index}`,
|
|
7612
|
+
index: index,
|
|
7613
|
+
children: jsx(Spacings.Stack, {
|
|
7614
|
+
scale: "xs",
|
|
7615
|
+
children: jsxs("div", {
|
|
7616
|
+
"aria-invalid": _Object$keys(fieldErrors ?? {}).length > 0,
|
|
7617
|
+
"aria-errormessage": `${fieldName}-error`,
|
|
7618
|
+
id: `${fieldName}-error`,
|
|
7619
|
+
children: [jsx(CustomFieldsLabel, {
|
|
7620
|
+
name: fieldName,
|
|
7621
|
+
fieldDefinition: fieldDefinition
|
|
7622
|
+
}), jsxs(Spacings.Stack, {
|
|
7623
|
+
scale: "xs",
|
|
7624
|
+
alignItems: "stretch",
|
|
7625
|
+
children: [isNested(fieldDefinition) ? jsx(CustomNestedFieldInput, {
|
|
7687
7626
|
name: fieldName,
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7706
|
-
onBlur: handleBlur,
|
|
7707
|
-
setFieldValue: props.setFieldValue,
|
|
7708
|
-
hasError: hasError
|
|
7709
|
-
}), jsx(CustomFieldErrors, {
|
|
7710
|
-
isTouched: isTouched,
|
|
7711
|
-
errors: fieldErrors
|
|
7712
|
-
})]
|
|
7627
|
+
value: value,
|
|
7628
|
+
fieldDefinition: fieldDefinition,
|
|
7629
|
+
isDisabled: props.isDisabled || isDragAndDropMode,
|
|
7630
|
+
isReadOnly: props.isReadOnly,
|
|
7631
|
+
onBlur: handleBlur,
|
|
7632
|
+
setFieldValue: props.setFieldValue
|
|
7633
|
+
}) : jsx(CustomFieldInput, {
|
|
7634
|
+
name: fieldName,
|
|
7635
|
+
value: value,
|
|
7636
|
+
fieldDefinition: fieldDefinition,
|
|
7637
|
+
isDisabled: props.isDisabled || isDragAndDropMode,
|
|
7638
|
+
isReadOnly: props.isReadOnly,
|
|
7639
|
+
onBlur: handleBlur,
|
|
7640
|
+
setFieldValue: props.setFieldValue,
|
|
7641
|
+
hasError: hasError
|
|
7642
|
+
}), jsx(CustomFieldErrors, {
|
|
7643
|
+
isTouched: isTouched,
|
|
7644
|
+
errors: fieldErrors
|
|
7713
7645
|
})]
|
|
7714
|
-
})
|
|
7646
|
+
})]
|
|
7715
7647
|
})
|
|
7716
|
-
})
|
|
7717
|
-
}
|
|
7718
|
-
},
|
|
7648
|
+
})
|
|
7649
|
+
})
|
|
7650
|
+
}, `${fieldName}-${index}`);
|
|
7719
7651
|
})
|
|
7720
7652
|
});
|
|
7721
7653
|
};
|
|
@@ -7771,7 +7703,7 @@ var pickerMessages = defineMessages({
|
|
|
7771
7703
|
});
|
|
7772
7704
|
|
|
7773
7705
|
function ownKeys$I(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7774
|
-
function _objectSpread$I(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
7706
|
+
function _objectSpread$I(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$I(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$I(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7775
7707
|
const PRODUCT_SELECTION_MODES = {
|
|
7776
7708
|
INCLUSION: 'Individual',
|
|
7777
7709
|
EXCLUSION: 'IndividualExclusion'
|
|
@@ -7782,11 +7714,10 @@ const PRODUCT_SELECTION_MODES_LABELS = {
|
|
|
7782
7714
|
};
|
|
7783
7715
|
const getMode = mode => mode === PRODUCT_SELECTION_MODES.INCLUSION || mode === PRODUCT_SELECTION_MODES_LABELS.INCLUSION ? 'inclusion' : 'exclusion';
|
|
7784
7716
|
const addModeToLabel = function (ps) {
|
|
7785
|
-
var _context;
|
|
7786
7717
|
let enableExcludingProducts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
7787
7718
|
if (!ps) return undefined;
|
|
7788
7719
|
return _objectSpread$I(_objectSpread$I({}, ps), {}, {
|
|
7789
|
-
label:
|
|
7720
|
+
label: `${ps?.label}${enableExcludingProducts ? ` (type: ${getMode(ps?.mode)})` : ''}`
|
|
7790
7721
|
});
|
|
7791
7722
|
};
|
|
7792
7723
|
|
|
@@ -7798,7 +7729,6 @@ const mapProductSelectionsToOptions$1 = memoize(function () {
|
|
|
7798
7729
|
let enableExcludingProducts = arguments.length > 4 ? arguments[4] : undefined;
|
|
7799
7730
|
const selectedPSList = _Array$isArray(selectedPS) ? selectedPS : [selectedPS];
|
|
7800
7731
|
return _mapInstanceProperty(productSelections).call(productSelections, productSelection => {
|
|
7801
|
-
var _context;
|
|
7802
7732
|
const label = formatLocalizedString(productSelection, {
|
|
7803
7733
|
key: 'name',
|
|
7804
7734
|
locale: dataLocale,
|
|
@@ -7807,14 +7737,13 @@ const mapProductSelectionsToOptions$1 = memoize(function () {
|
|
|
7807
7737
|
return {
|
|
7808
7738
|
id: productSelection.id,
|
|
7809
7739
|
value: productSelection.id,
|
|
7810
|
-
label:
|
|
7740
|
+
label: `${label}${_includesInstanceProperty(selectedPSList).call(selectedPSList, productSelection.id) && enableExcludingProducts ? ` (type: ${getMode(productSelection.mode)})` : ''}`,
|
|
7811
7741
|
key: productSelection.key,
|
|
7812
7742
|
mode: getMode(productSelection.mode)
|
|
7813
7743
|
};
|
|
7814
7744
|
});
|
|
7815
7745
|
});
|
|
7816
7746
|
function ProductSelectionBasicSelectDropdown(props) {
|
|
7817
|
-
var _productSelectionsFet, _productSelectionsFet2;
|
|
7818
7747
|
const intl = useIntl();
|
|
7819
7748
|
const enableExcludingProducts = useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
7820
7749
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -7827,10 +7756,10 @@ function ProductSelectionBasicSelectDropdown(props) {
|
|
|
7827
7756
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
7828
7757
|
dataLocale = _useApplicationContex.dataLocale;
|
|
7829
7758
|
if (productSelectionsFetcher.isLoading) return jsx(CenteredLoadingSpinner, {});
|
|
7830
|
-
const productSelections =
|
|
7759
|
+
const productSelections = productSelectionsFetcher.productSelections?.results ?? [];
|
|
7831
7760
|
const filteredProductSelections = _filterInstanceProperty(productSelections).call(productSelections, ps => {
|
|
7832
|
-
var
|
|
7833
|
-
return !_includesInstanceProperty(
|
|
7761
|
+
var _context;
|
|
7762
|
+
return !_includesInstanceProperty(_context = props.excludedProductSelectionIds).call(_context, ps.id);
|
|
7834
7763
|
});
|
|
7835
7764
|
const onOptionClick = event => {
|
|
7836
7765
|
const productSelectionId = event.target.value;
|
|
@@ -7879,7 +7808,7 @@ const getValueFromOptions$3 = _ref => {
|
|
|
7879
7808
|
// handle async-select-field value transformation
|
|
7880
7809
|
if (isMulti) {
|
|
7881
7810
|
var _context;
|
|
7882
|
-
return _mapInstanceProperty(_context = _filterInstanceProperty(allProductSelectionOptions).call(allProductSelectionOptions, ps => currentlySelectedProductSelections
|
|
7811
|
+
return _mapInstanceProperty(_context = _filterInstanceProperty(allProductSelectionOptions).call(allProductSelectionOptions, ps => currentlySelectedProductSelections?.includes(ps.value))).call(_context, ps => addModeToLabel(ps, enableExcludingProducts));
|
|
7883
7812
|
}
|
|
7884
7813
|
|
|
7885
7814
|
// in case it is not multiselect, then a single valued async-select-input is being requested and the value should have proper format
|
|
@@ -7891,7 +7820,6 @@ const emptyStoreOption$1 = intl => [{
|
|
|
7891
7820
|
isDisabled: true
|
|
7892
7821
|
}];
|
|
7893
7822
|
function ProductSelectionsAsyncSelectDropdown(props) {
|
|
7894
|
-
var _productSelectionsFet3;
|
|
7895
7823
|
const intl = useIntl();
|
|
7896
7824
|
const enableExcludingProducts = useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
7897
7825
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -7904,17 +7832,13 @@ function ProductSelectionsAsyncSelectDropdown(props) {
|
|
|
7904
7832
|
})),
|
|
7905
7833
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
7906
7834
|
dataLocale = _useApplicationContex.dataLocale;
|
|
7907
|
-
const productSelections = useMemo(() =>
|
|
7908
|
-
var _productSelectionsFet, _productSelectionsFet2;
|
|
7909
|
-
return (_productSelectionsFet = (_productSelectionsFet2 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet2 === void 0 ? void 0 : _productSelectionsFet2.results) !== null && _productSelectionsFet !== void 0 ? _productSelectionsFet : [];
|
|
7910
|
-
}, [(_productSelectionsFet3 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet3 === void 0 ? void 0 : _productSelectionsFet3.results]);
|
|
7835
|
+
const productSelections = useMemo(() => productSelectionsFetcher.productSelections?.results ?? [], [productSelectionsFetcher.productSelections?.results]);
|
|
7911
7836
|
const filteredProductSelections = _filterInstanceProperty(productSelections).call(productSelections, ps => {
|
|
7912
7837
|
var _context2;
|
|
7913
7838
|
return !_includesInstanceProperty(_context2 = props.excludedProductSelectionIds).call(_context2, ps.id);
|
|
7914
7839
|
});
|
|
7915
7840
|
const onOptionClick = event => {
|
|
7916
|
-
|
|
7917
|
-
const productSelectionId = (_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.value;
|
|
7841
|
+
const productSelectionId = event.target.value?.value;
|
|
7918
7842
|
const currentProductSelection = _findInstanceProperty(productSelections).call(productSelections, productSelection => productSelection.id === productSelectionId);
|
|
7919
7843
|
props.onChange(currentProductSelection);
|
|
7920
7844
|
};
|
|
@@ -7986,15 +7910,11 @@ function ProductSelectionsAsyncSelectDropdown(props) {
|
|
|
7986
7910
|
}
|
|
7987
7911
|
|
|
7988
7912
|
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 } } } };
|
|
7989
|
-
const createQueryVariables$4 = (productSelections, predicateField) => {
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
limit: 500
|
|
7994
|
-
};
|
|
7995
|
-
};
|
|
7913
|
+
const createQueryVariables$4 = (productSelections, predicateField) => ({
|
|
7914
|
+
where: `${predicateField} in (${_mapInstanceProperty(productSelections).call(productSelections, ps => `"${ps}"`).join(', ')})`,
|
|
7915
|
+
limit: 500
|
|
7916
|
+
});
|
|
7996
7917
|
const useProductSelectionsByFieldFetcher = (productSelections, predicateField) => {
|
|
7997
|
-
var _productSelectionsQue, _productSelectionsQue2;
|
|
7998
7918
|
const productSelectionList = _Array$isArray(productSelections) ? productSelections : [productSelections];
|
|
7999
7919
|
const productSelectionsQuery = useQuery(ProductSelectionsPickerFetcher$1, {
|
|
8000
7920
|
context: {
|
|
@@ -8004,7 +7924,7 @@ const useProductSelectionsByFieldFetcher = (productSelections, predicateField) =
|
|
|
8004
7924
|
skip: productSelectionList.length === 0
|
|
8005
7925
|
});
|
|
8006
7926
|
return {
|
|
8007
|
-
productSelections:
|
|
7927
|
+
productSelections: productSelectionsQuery.data?.productSelections.results ?? [],
|
|
8008
7928
|
isLoading: productSelectionsQuery.loading
|
|
8009
7929
|
};
|
|
8010
7930
|
};
|
|
@@ -8045,8 +7965,8 @@ const createQueryVariables$3 = _ref3 => {
|
|
|
8045
7965
|
var _context;
|
|
8046
7966
|
let searchText = _ref3.searchText;
|
|
8047
7967
|
const sanitizedSearchText = sanitize(_trimInstanceProperty(searchText).call(searchText, searchText));
|
|
8048
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
8049
|
-
const keyQuery =
|
|
7968
|
+
const idQuery = isUUID(sanitizedSearchText) && `id = "${sanitizedSearchText}"`;
|
|
7969
|
+
const keyQuery = `key = "${sanitizedSearchText}"`;
|
|
8050
7970
|
const searchTextQuery = _filterInstanceProperty(_context = [idQuery, keyQuery]).call(_context, Boolean).join(' or ');
|
|
8051
7971
|
return {
|
|
8052
7972
|
where: searchTextQuery || undefined
|
|
@@ -8069,7 +7989,6 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8069
7989
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8070
7990
|
const productSelectionsByFieldFetcher = useProductSelectionsByFieldFetcher(props.value, props.renderSelectInputOptionValuesByField);
|
|
8071
7991
|
const handleLoadOptions = async searchText => {
|
|
8072
|
-
var _data$productSelectio, _data$productSelectio2;
|
|
8073
7992
|
const _await$client$query = await client.query({
|
|
8074
7993
|
query: ProductSelectionsPickerFetcher,
|
|
8075
7994
|
variables: createQueryVariables$3({
|
|
@@ -8081,7 +8000,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8081
8000
|
fetchPolicy: 'network-only'
|
|
8082
8001
|
}),
|
|
8083
8002
|
data = _await$client$query.data;
|
|
8084
|
-
const matchedProductSelections =
|
|
8003
|
+
const matchedProductSelections = data?.productSelections?.results ?? [];
|
|
8085
8004
|
const updatedProductSelections = _mapInstanceProperty(matchedProductSelections).call(matchedProductSelections, convertProductSelectionFromGraphQl);
|
|
8086
8005
|
const filteredProductSelections = _filterInstanceProperty(updatedProductSelections).call(updatedProductSelections, ps => {
|
|
8087
8006
|
var _context2;
|
|
@@ -8097,8 +8016,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8097
8016
|
};
|
|
8098
8017
|
const loadOptionsDebounced = debounce(handleLoadOptions, 500);
|
|
8099
8018
|
const onOptionClick = event => {
|
|
8100
|
-
|
|
8101
|
-
const productSelectionId = (_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.value;
|
|
8019
|
+
const productSelectionId = event.target.value?.value;
|
|
8102
8020
|
const currentProductSelection = _findInstanceProperty(productionSelectionResults).call(productionSelectionResults, productSelection => productSelection.id === productSelectionId);
|
|
8103
8021
|
props.onChange(currentProductSelection);
|
|
8104
8022
|
};
|
|
@@ -8146,11 +8064,11 @@ function ModeSelectInputOption(props) {
|
|
|
8146
8064
|
scale: "xs",
|
|
8147
8065
|
children: [jsx(Text.Detail, {
|
|
8148
8066
|
isBold: true,
|
|
8149
|
-
children:
|
|
8067
|
+
children: data?.label || noValueFallback
|
|
8150
8068
|
}), jsxs(Text.Detail, {
|
|
8151
|
-
children: ["Key: ",
|
|
8069
|
+
children: ["Key: ", data?.key || noValueFallback]
|
|
8152
8070
|
}), jsxs(Text.Detail, {
|
|
8153
|
-
children: ["Type: ",
|
|
8071
|
+
children: ["Type: ", data?.mode || noValueFallback]
|
|
8154
8072
|
})]
|
|
8155
8073
|
})
|
|
8156
8074
|
}));
|
|
@@ -8251,8 +8169,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8251
8169
|
var _context2;
|
|
8252
8170
|
const intl = useIntl();
|
|
8253
8171
|
const handleLoadOptions = async searchTerm => {
|
|
8254
|
-
|
|
8255
|
-
const filteredOptions = (_props$options = props.options) === null || _props$options === void 0 ? void 0 : _filterInstanceProperty(_props$options).call(_props$options, country => {
|
|
8172
|
+
const filteredOptions = props.options?.filter(country => {
|
|
8256
8173
|
var _context;
|
|
8257
8174
|
return _includesInstanceProperty(_context = country.label.toLowerCase()).call(_context, searchTerm.toLowerCase());
|
|
8258
8175
|
});
|
|
@@ -8260,7 +8177,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8260
8177
|
return _sliceInstanceProperty(filteredOptions).call(filteredOptions, 0, props.countriesAsyncLoadingLimit);
|
|
8261
8178
|
}
|
|
8262
8179
|
return [{
|
|
8263
|
-
options:
|
|
8180
|
+
options: props.options?.slice(0, props.countriesAsyncLoadingLimit)
|
|
8264
8181
|
}, {
|
|
8265
8182
|
options: emptyCountryOption(intl)
|
|
8266
8183
|
}];
|
|
@@ -8269,10 +8186,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8269
8186
|
const countries = event.target.value;
|
|
8270
8187
|
props.onChange({
|
|
8271
8188
|
target: _objectSpread$F(_objectSpread$F({}, event.target), {}, {
|
|
8272
|
-
value: _mapInstanceProperty(countries).call(countries, country =>
|
|
8273
|
-
var _country$value;
|
|
8274
|
-
return (_country$value = country === null || country === void 0 ? void 0 : country.value) !== null && _country$value !== void 0 ? _country$value : country;
|
|
8275
|
-
})
|
|
8189
|
+
value: _mapInstanceProperty(countries).call(countries, country => country?.value ?? country)
|
|
8276
8190
|
})
|
|
8277
8191
|
});
|
|
8278
8192
|
};
|
|
@@ -8302,8 +8216,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8302
8216
|
function ownKeys$E(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8303
8217
|
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(_context = ownKeys$E(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$E(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8304
8218
|
function CountriesPicker(props) {
|
|
8305
|
-
|
|
8306
|
-
const CustomCountriesPicker = ((_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.length) <= props.countriesAsyncLoadingLimit ? CountriesBasicSelectDropdown : CountriesAsyncSelectDropdown;
|
|
8219
|
+
const CustomCountriesPicker = props.options?.length <= props.countriesAsyncLoadingLimit ? CountriesBasicSelectDropdown : CountriesAsyncSelectDropdown;
|
|
8307
8220
|
return jsx(Spacings.Stack, {
|
|
8308
8221
|
children: jsx(CustomCountriesPicker, _objectSpread$E({}, props))
|
|
8309
8222
|
});
|
|
@@ -8332,7 +8245,6 @@ var GetCustomerGroupsQuery = { kind: "Document", definitions: [{ kind: "Operatio
|
|
|
8332
8245
|
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 } } } };
|
|
8333
8246
|
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 } } } };
|
|
8334
8247
|
const CustomerGroupPickerInput = _ref => {
|
|
8335
|
-
var _currentOption$data$l, _currentOption$data;
|
|
8336
8248
|
let isClearable = _ref.isClearable,
|
|
8337
8249
|
isDisabled = _ref.isDisabled,
|
|
8338
8250
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -8401,13 +8313,13 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
8401
8313
|
setLoadingError(null);
|
|
8402
8314
|
handleInternalInputChange(event);
|
|
8403
8315
|
}, [handleInternalInputChange]);
|
|
8404
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
8316
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
8405
8317
|
useEffect(() => {
|
|
8406
8318
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
8407
8319
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
8408
8320
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
8409
8321
|
const handleNoOptions = useCallback(() => loadingError ? null : formatMessage(messages$t.noCustomerGroupsFound), [loadingError, formatMessage]);
|
|
8410
|
-
const tooltipTitle =
|
|
8322
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
8411
8323
|
return jsx(Constraints.Horizontal, {
|
|
8412
8324
|
max: "scale",
|
|
8413
8325
|
children: jsxs(Spacings.Stack, {
|
|
@@ -8417,7 +8329,7 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
8417
8329
|
children: jsx(AsyncSelectInput, {
|
|
8418
8330
|
id: name,
|
|
8419
8331
|
name: name,
|
|
8420
|
-
placeholder: placeholder
|
|
8332
|
+
placeholder: placeholder ?? formatMessage(messages$t.placeholder),
|
|
8421
8333
|
loadOptions: loadOptionsDebounced,
|
|
8422
8334
|
defaultOptions: true,
|
|
8423
8335
|
showOptionGroupDivider: true,
|
|
@@ -8446,12 +8358,11 @@ CustomerGroupPickerInput.displayName = 'CustomerGroupPickerInput';
|
|
|
8446
8358
|
const DEFAULT_LENGTH = 50;
|
|
8447
8359
|
const DEFAULT_END = '...';
|
|
8448
8360
|
function truncate (text) {
|
|
8449
|
-
var _context;
|
|
8450
8361
|
let length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_LENGTH;
|
|
8451
8362
|
let end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_END;
|
|
8452
8363
|
if (!text) return '';
|
|
8453
8364
|
if (text.length < length) return text;
|
|
8454
|
-
return
|
|
8365
|
+
return `${text.substring(0, length)}${end}`;
|
|
8455
8366
|
}
|
|
8456
8367
|
|
|
8457
8368
|
const LOWER_STORES_LIMIT = 60;
|
|
@@ -8459,7 +8370,6 @@ const UPPER_STORES_LIMIT = 500;
|
|
|
8459
8370
|
|
|
8460
8371
|
// map store to options
|
|
8461
8372
|
const mapStoresToOptions = _ref => {
|
|
8462
|
-
var _store$productSelecti;
|
|
8463
8373
|
let store = _ref.store,
|
|
8464
8374
|
renderSelectInputOptionValuesByField = _ref.renderSelectInputOptionValuesByField,
|
|
8465
8375
|
dataLocale = _ref.dataLocale;
|
|
@@ -8470,14 +8380,14 @@ const mapStoresToOptions = _ref => {
|
|
|
8470
8380
|
const localizedName = formatLocalizedString(convertedStore, {
|
|
8471
8381
|
key: 'name',
|
|
8472
8382
|
locale: dataLocale,
|
|
8473
|
-
fallback:
|
|
8383
|
+
fallback: `${store.key} (key)`
|
|
8474
8384
|
});
|
|
8475
8385
|
return {
|
|
8476
8386
|
label: localizedName,
|
|
8477
8387
|
value: renderSelectInputOptionValuesByField === 'key' ? store.key : store.id,
|
|
8478
8388
|
key: store.key,
|
|
8479
8389
|
id: store.id,
|
|
8480
|
-
productSelections:
|
|
8390
|
+
productSelections: store.productSelections?.map(productSelectionRef => productSelectionRef.productSelection.id)
|
|
8481
8391
|
};
|
|
8482
8392
|
};
|
|
8483
8393
|
|
|
@@ -8539,7 +8449,7 @@ const getValueFromOptions$1 = _ref => {
|
|
|
8539
8449
|
isMulti = _ref.isMulti;
|
|
8540
8450
|
// handle async-select-field value transformation
|
|
8541
8451
|
if (isMulti) {
|
|
8542
|
-
return _filterInstanceProperty(mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores
|
|
8452
|
+
return _filterInstanceProperty(mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores?.includes(store.value));
|
|
8543
8453
|
}
|
|
8544
8454
|
|
|
8545
8455
|
// return value as undefined if no options is yet selected. It is needed for cases where users sets initial values as empty string
|
|
@@ -8568,13 +8478,13 @@ const StoresAsyncSelectInput = props => {
|
|
|
8568
8478
|
sort: 'createdAt asc',
|
|
8569
8479
|
excludeExtendedStoresList: true,
|
|
8570
8480
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8571
|
-
stores:
|
|
8481
|
+
stores: keysOfStores?.length && keysOfStores,
|
|
8572
8482
|
projectKey: props.projectKey
|
|
8573
8483
|
});
|
|
8574
8484
|
const hasError = AsyncSelectInput.isTouched(props.touched) && hasErrors$2(props.errors) || props.hasError;
|
|
8575
8485
|
const mappedStoresListOptions = useMemo(() => {
|
|
8576
|
-
var _context2
|
|
8577
|
-
return _mapInstanceProperty(_context2 =
|
|
8486
|
+
var _context2;
|
|
8487
|
+
return _mapInstanceProperty(_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8578
8488
|
store,
|
|
8579
8489
|
dataLocale,
|
|
8580
8490
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -8660,21 +8570,20 @@ const StoresBasicSelectInput = props => {
|
|
|
8660
8570
|
sort: 'createdAt asc',
|
|
8661
8571
|
excludeExtendedStoresList: true,
|
|
8662
8572
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8663
|
-
stores:
|
|
8573
|
+
stores: keysOfStores?.length && keysOfStores,
|
|
8664
8574
|
projectKey: props.projectKey
|
|
8665
8575
|
});
|
|
8666
8576
|
const hasError = SelectInput.isTouched(props.touched) && hasErrors$1(props.errors) || props.hasError;
|
|
8667
8577
|
const mappedStoresListOptions = useMemo(() => {
|
|
8668
|
-
var _context2
|
|
8669
|
-
return _mapInstanceProperty(_context2 =
|
|
8578
|
+
var _context2;
|
|
8579
|
+
return _mapInstanceProperty(_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8670
8580
|
store,
|
|
8671
8581
|
dataLocale,
|
|
8672
8582
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
8673
8583
|
}));
|
|
8674
8584
|
}, [dataLocale, storesListFetcher.stores, props.renderSelectInputOptionValuesByField]);
|
|
8675
8585
|
const handleChange = event => {
|
|
8676
|
-
|
|
8677
|
-
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;
|
|
8586
|
+
const value = event.target.value?.value ?? event.target.value;
|
|
8678
8587
|
const currentStore = _findInstanceProperty(mappedStoresListOptions).call(mappedStoresListOptions, store => store.value === value);
|
|
8679
8588
|
|
|
8680
8589
|
// We need complete store info including productSelections
|
|
@@ -8729,7 +8638,6 @@ StoresBasicSelectInput.defaultProps = {
|
|
|
8729
8638
|
|
|
8730
8639
|
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 } } } };
|
|
8731
8640
|
const useTotalNumberOfStoresFetcher = projectKey => {
|
|
8732
|
-
var _totalNumberOfStoresQ;
|
|
8733
8641
|
const totalNumberOfStoresQuery = useQuery(TotalNumberOfStores, {
|
|
8734
8642
|
context: {
|
|
8735
8643
|
target: GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM,
|
|
@@ -8738,7 +8646,7 @@ const useTotalNumberOfStoresFetcher = projectKey => {
|
|
|
8738
8646
|
fetchPolicy: 'network-only'
|
|
8739
8647
|
});
|
|
8740
8648
|
return {
|
|
8741
|
-
total:
|
|
8649
|
+
total: totalNumberOfStoresQuery.data?.totalNumberOfStores.total,
|
|
8742
8650
|
isLoading: totalNumberOfStoresQuery.loading
|
|
8743
8651
|
};
|
|
8744
8652
|
};
|
|
@@ -8756,19 +8664,15 @@ const handlers$1 = {
|
|
|
8756
8664
|
};
|
|
8757
8665
|
|
|
8758
8666
|
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 } } } };
|
|
8759
|
-
const createQueryVariables$2 = (stores, predicateField, shouldFetchProductSelections) => {
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
|
|
8764
|
-
excludeProductSelections: !shouldFetchProductSelections
|
|
8765
|
-
};
|
|
8766
|
-
};
|
|
8667
|
+
const createQueryVariables$2 = (stores, predicateField, shouldFetchProductSelections) => ({
|
|
8668
|
+
where: `${predicateField} in (${_mapInstanceProperty(stores).call(stores, store => `"${store}"`).join(', ')})`,
|
|
8669
|
+
limit: 500,
|
|
8670
|
+
excludeProductSelections: !shouldFetchProductSelections
|
|
8671
|
+
});
|
|
8767
8672
|
const emptyStoresQueryResult = {
|
|
8768
8673
|
results: []
|
|
8769
8674
|
};
|
|
8770
8675
|
const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
8771
|
-
var _storesQuery$data;
|
|
8772
8676
|
let shouldFetchProductSelections = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
8773
8677
|
// incase of single select input stores are sent as single string literal
|
|
8774
8678
|
const storesList = _Array$isArray(stores) ? stores : [stores];
|
|
@@ -8781,29 +8685,29 @@ const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
|
8781
8685
|
skip: storesList.length === 0
|
|
8782
8686
|
});
|
|
8783
8687
|
return {
|
|
8784
|
-
stores:
|
|
8688
|
+
stores: storesQuery.data?.storesByField || emptyStoresQueryResult,
|
|
8785
8689
|
isLoading: storesQuery.loading
|
|
8786
8690
|
};
|
|
8787
8691
|
};
|
|
8788
8692
|
|
|
8789
8693
|
function ownKeys$B(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8790
|
-
function _objectSpread$B(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
8694
|
+
function _objectSpread$B(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context3 = ownKeys$B(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context4 = ownKeys$B(Object(t))).call(_context4, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8791
8695
|
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 } } } };
|
|
8792
8696
|
const hasErrors = errors => {
|
|
8793
8697
|
var _context;
|
|
8794
8698
|
return errors && _someInstanceProperty(_context = _Object$values(errors)).call(_context, Boolean);
|
|
8795
8699
|
};
|
|
8796
8700
|
const createQueryVariables$1 = _ref => {
|
|
8797
|
-
var _context2
|
|
8701
|
+
var _context2;
|
|
8798
8702
|
let searchText = _ref.searchText,
|
|
8799
8703
|
dataLocale = _ref.dataLocale,
|
|
8800
8704
|
allAccessibleStoreKeysThroughDataFencePermissions = _ref.allAccessibleStoreKeysThroughDataFencePermissions,
|
|
8801
8705
|
shouldFetchProductSelections = _ref.shouldFetchProductSelections;
|
|
8802
8706
|
const sanitizedSearchText = sanitize(_trimInstanceProperty(searchText).call(searchText, searchText));
|
|
8803
|
-
const keyQuery =
|
|
8707
|
+
const keyQuery = `key = "${sanitizedSearchText}"`;
|
|
8804
8708
|
|
|
8805
8709
|
// if the user has data fence permissions then we only allow stores to fetched that user has access to
|
|
8806
|
-
if (allAccessibleStoreKeysThroughDataFencePermissions
|
|
8710
|
+
if (allAccessibleStoreKeysThroughDataFencePermissions?.length) {
|
|
8807
8711
|
// if the current search term match the accessible stores keys, then proceed with fetching the store
|
|
8808
8712
|
if (_includesInstanceProperty(allAccessibleStoreKeysThroughDataFencePermissions).call(allAccessibleStoreKeysThroughDataFencePermissions, sanitizedSearchText)) {
|
|
8809
8713
|
return {
|
|
@@ -8819,9 +8723,9 @@ const createQueryVariables$1 = _ref => {
|
|
|
8819
8723
|
excludeProductSelections: !shouldFetchProductSelections
|
|
8820
8724
|
};
|
|
8821
8725
|
}
|
|
8822
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
8823
|
-
const nameQuery =
|
|
8824
|
-
const searchTextQuery = _filterInstanceProperty(
|
|
8726
|
+
const idQuery = isUUID(sanitizedSearchText) && `id = "${sanitizedSearchText}"`;
|
|
8727
|
+
const nameQuery = `name(${dataLocale} = "${sanitizedSearchText}")`;
|
|
8728
|
+
const searchTextQuery = _filterInstanceProperty(_context2 = [idQuery, nameQuery, keyQuery]).call(_context2, Boolean).join(' or ');
|
|
8825
8729
|
return {
|
|
8826
8730
|
skipFetchingStores: false,
|
|
8827
8731
|
where: searchTextQuery,
|
|
@@ -8829,7 +8733,6 @@ const createQueryVariables$1 = _ref => {
|
|
|
8829
8733
|
};
|
|
8830
8734
|
};
|
|
8831
8735
|
const getValueFromOptions = _ref2 => {
|
|
8832
|
-
var _storesByFieldFetcher, _context4;
|
|
8833
8736
|
let isMulti = _ref2.isMulti,
|
|
8834
8737
|
value = _ref2.value,
|
|
8835
8738
|
dataLocale = _ref2.dataLocale,
|
|
@@ -8838,7 +8741,7 @@ const getValueFromOptions = _ref2 => {
|
|
|
8838
8741
|
if (!value) {
|
|
8839
8742
|
return undefined;
|
|
8840
8743
|
}
|
|
8841
|
-
const selectedOptions =
|
|
8744
|
+
const selectedOptions = storesByFieldFetcher.stores?.results.map(store => mapStoresToOptions({
|
|
8842
8745
|
store,
|
|
8843
8746
|
dataLocale,
|
|
8844
8747
|
renderSelectInputOptionValuesByField: renderSelectInputOptionValuesByField
|
|
@@ -8876,9 +8779,8 @@ const StoresSearchSelectInput = props => {
|
|
|
8876
8779
|
},
|
|
8877
8780
|
fetchPolicy: 'network-only'
|
|
8878
8781
|
}).then(_ref3 => {
|
|
8879
|
-
var _data$storesByWherePr, _context5;
|
|
8880
8782
|
let data = _ref3.data;
|
|
8881
|
-
return
|
|
8783
|
+
return data.storesByWherePredicate?.results.map(store => mapStoresToOptions({
|
|
8882
8784
|
store,
|
|
8883
8785
|
dataLocale,
|
|
8884
8786
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -9058,14 +8960,14 @@ var messages$r = defineMessages({
|
|
|
9058
8960
|
|
|
9059
8961
|
function formatDiscount(discount, currencyCode, intl) {
|
|
9060
8962
|
var _context;
|
|
9061
|
-
if (discount.type === 'relative') return
|
|
8963
|
+
if (discount.type === 'relative') return `${discount.permyriad / 100}%`;
|
|
9062
8964
|
if (!discount.money) return null;
|
|
9063
8965
|
const moneyForCurrencyCode = _findInstanceProperty(_context = discount.money).call(_context, discountMoney => discountMoney.currencyCode === currencyCode);
|
|
9064
8966
|
return moneyForCurrencyCode ? formatMoney$2(moneyForCurrencyCode, intl) : null;
|
|
9065
8967
|
}
|
|
9066
8968
|
|
|
9067
8969
|
function formatPercentage(percentage) {
|
|
9068
|
-
return
|
|
8970
|
+
return `${percentage}%`;
|
|
9069
8971
|
}
|
|
9070
8972
|
function convertRatioToPercentage(ratio) {
|
|
9071
8973
|
return _parseFloat((ratio * 100).toFixed(2));
|
|
@@ -9119,8 +9021,8 @@ function validateFilter$2(_ref, intl) {
|
|
|
9119
9021
|
};
|
|
9120
9022
|
}
|
|
9121
9023
|
if (value.option === FILTER_TYPES.range) {
|
|
9122
|
-
const from = validateValue(filterValue
|
|
9123
|
-
const to = from ? null : validateValue(filterValue
|
|
9024
|
+
const from = validateValue(filterValue?.from, typeName, intl);
|
|
9025
|
+
const to = from ? null : validateValue(filterValue?.to, typeName, intl);
|
|
9124
9026
|
return from || to ? {
|
|
9125
9027
|
input: {
|
|
9126
9028
|
from,
|
|
@@ -9157,16 +9059,16 @@ function validateFilter$1(_ref, intl) {
|
|
|
9157
9059
|
type = _ref.type;
|
|
9158
9060
|
if (type === 'range') {
|
|
9159
9061
|
if (validateSingleFilter({
|
|
9160
|
-
value: value
|
|
9062
|
+
value: value?.from
|
|
9161
9063
|
})) return {
|
|
9162
9064
|
from: intl.formatMessage(messages$p.rangeMissingValue)
|
|
9163
9065
|
};
|
|
9164
9066
|
if (validateSingleFilter({
|
|
9165
|
-
value: value
|
|
9067
|
+
value: value?.to
|
|
9166
9068
|
})) return {
|
|
9167
9069
|
to: intl.formatMessage(messages$p.rangeMissingValue)
|
|
9168
9070
|
};
|
|
9169
|
-
if (moment$1(value
|
|
9071
|
+
if (moment$1(value?.to).isBefore(value?.from)) return {
|
|
9170
9072
|
from: intl.formatMessage(messages$p.rangeToSmallerThanFrom)
|
|
9171
9073
|
};
|
|
9172
9074
|
} else if (type === 'equalTo' || type === 'lessThan' || type === 'moreThan') {
|
|
@@ -9236,10 +9138,8 @@ function isEmptyFilter(_ref) {
|
|
|
9236
9138
|
}
|
|
9237
9139
|
|
|
9238
9140
|
function numberTransformer(filterKey, filters) {
|
|
9239
|
-
var _context3;
|
|
9240
9141
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$2;
|
|
9241
9142
|
const queries = _mapInstanceProperty(filters).call(filters, _ref => {
|
|
9242
|
-
var _context, _context2;
|
|
9243
9143
|
let type = _ref.type,
|
|
9244
9144
|
value = _ref.value;
|
|
9245
9145
|
if (!filterValidator({
|
|
@@ -9248,19 +9148,19 @@ function numberTransformer(filterKey, filters) {
|
|
|
9248
9148
|
})) return '';
|
|
9249
9149
|
switch (type) {
|
|
9250
9150
|
case 'lessThan':
|
|
9251
|
-
return
|
|
9151
|
+
return `(* to ${value - 1})`;
|
|
9252
9152
|
case 'moreThan':
|
|
9253
|
-
return
|
|
9153
|
+
return `(${value + 1} to *)`;
|
|
9254
9154
|
case 'equalTo':
|
|
9255
|
-
return
|
|
9155
|
+
return `(${value} to ${value})`;
|
|
9256
9156
|
case 'range':
|
|
9257
|
-
return
|
|
9157
|
+
return `(${value.from} to ${value.to})`;
|
|
9258
9158
|
default:
|
|
9259
9159
|
return '';
|
|
9260
9160
|
}
|
|
9261
9161
|
});
|
|
9262
9162
|
const queryString = _filterInstanceProperty(queries).call(queries, q => q !== '').join(', ');
|
|
9263
|
-
return queryString === '' ? null :
|
|
9163
|
+
return queryString === '' ? null : `${filterKey}: range${queryString}`;
|
|
9264
9164
|
}
|
|
9265
9165
|
function isFilterValid$2(_ref2) {
|
|
9266
9166
|
let type = _ref2.type,
|
|
@@ -9287,11 +9187,9 @@ function graphqlCategoryLevelTransformer(filterKey, filters, filterValidator) {
|
|
|
9287
9187
|
return _filterInstanceProperty(_context = [levelFilterQuery, lastLevelFilterQuery]).call(_context, Boolean);
|
|
9288
9188
|
}
|
|
9289
9189
|
|
|
9290
|
-
var _templateObject$1, _templateObject2;
|
|
9291
9190
|
const dateFormatDayStart = 'YYYY-MM-DDT00:00:00.000Z';
|
|
9292
9191
|
const dateFormatDayEnd = 'YYYY-MM-DDT23:59:59.999Z';
|
|
9293
9192
|
function dateTransformer(filterKey, filters) {
|
|
9294
|
-
var _context;
|
|
9295
9193
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$1;
|
|
9296
9194
|
const queries = _mapInstanceProperty(filters).call(filters, _ref => {
|
|
9297
9195
|
let type = _ref.type,
|
|
@@ -9302,19 +9200,25 @@ function dateTransformer(filterKey, filters) {
|
|
|
9302
9200
|
})) return '';
|
|
9303
9201
|
switch (type) {
|
|
9304
9202
|
case 'lessThan':
|
|
9305
|
-
return
|
|
9203
|
+
return `(* to "${moment$1(value).format(dateFormatDayStart)}")`;
|
|
9306
9204
|
case 'moreThan':
|
|
9307
|
-
return
|
|
9205
|
+
return `("${moment$1(value).format(dateFormatDayEnd)}" to *)`;
|
|
9308
9206
|
case 'equalTo':
|
|
9309
|
-
return oneLine
|
|
9207
|
+
return oneLine`
|
|
9208
|
+
("${moment$1(value).format(dateFormatDayStart)}"
|
|
9209
|
+
to "${moment$1(value).format(dateFormatDayEnd)}")
|
|
9210
|
+
`;
|
|
9310
9211
|
case 'range':
|
|
9311
|
-
return oneLine
|
|
9212
|
+
return oneLine`
|
|
9213
|
+
("${moment$1(value.from).format(dateFormatDayStart)}"
|
|
9214
|
+
to "${moment$1(value.to).format(dateFormatDayEnd)}")
|
|
9215
|
+
`;
|
|
9312
9216
|
default:
|
|
9313
9217
|
return '';
|
|
9314
9218
|
}
|
|
9315
9219
|
});
|
|
9316
9220
|
const queryString = _filterInstanceProperty(queries).call(queries, q => q !== '').join(', ');
|
|
9317
|
-
return queryString === '' ? null :
|
|
9221
|
+
return queryString === '' ? null : `${filterKey}: range${queryString}`;
|
|
9318
9222
|
}
|
|
9319
9223
|
function isFilterValid$1(_ref2) {
|
|
9320
9224
|
let type = _ref2.type,
|
|
@@ -9329,19 +9233,18 @@ function isFilterValid$1(_ref2) {
|
|
|
9329
9233
|
}
|
|
9330
9234
|
|
|
9331
9235
|
function missingLocaleTransformer(filterKey, filters) {
|
|
9332
|
-
var _context;
|
|
9333
9236
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
9334
9237
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
9335
9238
|
if (filters.length === 0) return null;
|
|
9336
9239
|
const missingLocale = filters[0].value.value;
|
|
9337
|
-
return
|
|
9240
|
+
return `${filterKey}.${missingLocale}:missing`;
|
|
9338
9241
|
}
|
|
9339
9242
|
|
|
9340
9243
|
function missingTransformer(filterKey, filters) {
|
|
9341
9244
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
9342
9245
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
9343
9246
|
if (filters.length === 0) return null;
|
|
9344
|
-
return
|
|
9247
|
+
return `${filterKey}:missing`;
|
|
9345
9248
|
}
|
|
9346
9249
|
|
|
9347
9250
|
/**
|
|
@@ -9382,7 +9285,6 @@ function graphqlQueryBuilder(_ref) {
|
|
|
9382
9285
|
}
|
|
9383
9286
|
|
|
9384
9287
|
function referenceTransformer(filterKey, filters) {
|
|
9385
|
-
var _context;
|
|
9386
9288
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid;
|
|
9387
9289
|
const queries = _mapInstanceProperty(filters).call(filters, _ref => {
|
|
9388
9290
|
let type = _ref.type,
|
|
@@ -9393,49 +9295,46 @@ function referenceTransformer(filterKey, filters) {
|
|
|
9393
9295
|
})) return '';
|
|
9394
9296
|
switch (type) {
|
|
9395
9297
|
case 'equalTo':
|
|
9396
|
-
return "
|
|
9298
|
+
return `"${value}"`;
|
|
9397
9299
|
default:
|
|
9398
9300
|
return '';
|
|
9399
9301
|
}
|
|
9400
9302
|
});
|
|
9401
9303
|
const queryString = _filterInstanceProperty(queries).call(queries, q => q !== '').join(', ');
|
|
9402
|
-
return queryString === '' ? null :
|
|
9304
|
+
return queryString === '' ? null : `${filterKey}.id: ${queryString}`;
|
|
9403
9305
|
}
|
|
9404
9306
|
function isFilterValid(_ref2) {
|
|
9405
|
-
var
|
|
9307
|
+
var _context;
|
|
9406
9308
|
let type = _ref2.type,
|
|
9407
9309
|
value = _ref2.value;
|
|
9408
|
-
if (type === 'equalTo' && !_includesInstanceProperty(
|
|
9310
|
+
if (type === 'equalTo' && !_includesInstanceProperty(_context = [null, undefined, '']).call(_context, value)) return true;
|
|
9409
9311
|
return false;
|
|
9410
9312
|
}
|
|
9411
9313
|
|
|
9412
9314
|
function textTransformer(filterKey, queries) {
|
|
9413
|
-
var _context;
|
|
9414
9315
|
if (queries.length === 0) return null;
|
|
9415
9316
|
|
|
9416
9317
|
// Note: we assume for now that there can only be 1 text filter.
|
|
9417
9318
|
const queryValue = queries[0].value;
|
|
9418
|
-
return queryValue ?
|
|
9319
|
+
return queryValue ? `${filterKey}:"${queryValue}"` : null;
|
|
9419
9320
|
}
|
|
9420
9321
|
|
|
9421
9322
|
const composeNumberPredicateFromFilter = (target, value, option) => {
|
|
9422
|
-
var _context, _context2, _context3, _context4, _context5, _context6;
|
|
9423
9323
|
switch (option) {
|
|
9424
9324
|
case FILTER_TYPES.lessThan:
|
|
9425
|
-
return
|
|
9325
|
+
return `${target} < ${value}`;
|
|
9426
9326
|
case FILTER_TYPES.moreThan:
|
|
9427
|
-
return
|
|
9327
|
+
return `${target} > ${value}`;
|
|
9428
9328
|
case FILTER_TYPES.equalTo:
|
|
9429
|
-
return
|
|
9329
|
+
return `${target} = ${value}`;
|
|
9430
9330
|
case FILTER_TYPES.range:
|
|
9431
|
-
return
|
|
9331
|
+
return `${target} >= ${value.from} and ${target} <= ${value.to}`;
|
|
9432
9332
|
default:
|
|
9433
9333
|
return '';
|
|
9434
9334
|
}
|
|
9435
9335
|
};
|
|
9436
9336
|
function customFields (filter, locale) {
|
|
9437
9337
|
const customFieldsPredicates = _mapInstanceProperty(filter).call(filter, customFieldFilter => {
|
|
9438
|
-
var _context7, _context8, _context9, _context10, _context11;
|
|
9439
9338
|
const _customFieldFilter$va = customFieldFilter.value,
|
|
9440
9339
|
target = _customFieldFilter$va.target,
|
|
9441
9340
|
type = _customFieldFilter$va.type,
|
|
@@ -9443,14 +9342,14 @@ function customFields (filter, locale) {
|
|
|
9443
9342
|
option = _customFieldFilter$va.option;
|
|
9444
9343
|
switch (type.name) {
|
|
9445
9344
|
case FIELD_TYPES.Boolean:
|
|
9446
|
-
return
|
|
9345
|
+
return `${target} = ${value.value}`;
|
|
9447
9346
|
case FIELD_TYPES.String:
|
|
9448
|
-
return
|
|
9347
|
+
return `${target} = "${value}"`;
|
|
9449
9348
|
case FIELD_TYPES.LocalizedString:
|
|
9450
|
-
return
|
|
9349
|
+
return `${target}(${localizedTextTransformer(value)})`;
|
|
9451
9350
|
case FIELD_TYPES.Enum:
|
|
9452
9351
|
case FIELD_TYPES.LocalizedEnum:
|
|
9453
|
-
return
|
|
9352
|
+
return `${target} = "${value.value}"`;
|
|
9454
9353
|
case FIELD_TYPES.Time:
|
|
9455
9354
|
return timeTransformer(target, [{
|
|
9456
9355
|
type: option,
|
|
@@ -9465,14 +9364,14 @@ function customFields (filter, locale) {
|
|
|
9465
9364
|
case FIELD_TYPES.Number:
|
|
9466
9365
|
return composeNumberPredicateFromFilter(target, value, option);
|
|
9467
9366
|
case FIELD_TYPES.Money:
|
|
9468
|
-
return
|
|
9367
|
+
return `${target}(${moneyTransformer(value, option, locale)})`;
|
|
9469
9368
|
case FIELD_TYPES.Reference:
|
|
9470
9369
|
case FIELD_TYPES.Set:
|
|
9471
9370
|
default:
|
|
9472
9371
|
throw new Error('Custom field type not recognized');
|
|
9473
9372
|
}
|
|
9474
9373
|
});
|
|
9475
|
-
return
|
|
9374
|
+
return `(custom(fields(${customFieldsPredicates.join(' and ')})))`;
|
|
9476
9375
|
}
|
|
9477
9376
|
|
|
9478
9377
|
// https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/btoa#Unicode_strings
|
|
@@ -9517,7 +9416,7 @@ function ownKeys$z(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySy
|
|
|
9517
9416
|
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(_context = ownKeys$z(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$z(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9518
9417
|
const resourcesWithPlatformLimits = _Object$keys(RESOURCES_WITH_PLATFORM_LIMITS);
|
|
9519
9418
|
const createQueryVariables = platformLimit => _reduceInstanceProperty(resourcesWithPlatformLimits).call(resourcesWithPlatformLimits, (previousIncludedLimits, nextNameOfLimit) => _objectSpread$z({
|
|
9520
|
-
[camelCase(
|
|
9419
|
+
[camelCase(`should include ${nextNameOfLimit}`)]: platformLimit ? nextNameOfLimit === platformLimit : true
|
|
9521
9420
|
}, previousIncludedLimits), {});
|
|
9522
9421
|
|
|
9523
9422
|
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 } } } };
|
|
@@ -9533,7 +9432,7 @@ const usePlatformLimitsFetcher = platformLimit => {
|
|
|
9533
9432
|
error = _useQuery.error,
|
|
9534
9433
|
data = _useQuery.data,
|
|
9535
9434
|
refetch = _useQuery.refetch;
|
|
9536
|
-
const platformLimits = !loading ? omit(data
|
|
9435
|
+
const platformLimits = !loading ? omit(data?.limits, '__typename') : {};
|
|
9537
9436
|
return {
|
|
9538
9437
|
isLoading: loading,
|
|
9539
9438
|
error,
|
|
@@ -9724,11 +9623,10 @@ const getPlatformLimitsStatus = _ref3 => {
|
|
|
9724
9623
|
total = _ref3.total,
|
|
9725
9624
|
intl = _ref3.intl;
|
|
9726
9625
|
if (limit) {
|
|
9727
|
-
|
|
9728
|
-
return _concatInstanceProperty(_context = "(".concat(intl.formatNumber(current), "/")).call(_context, intl.formatNumber(limit), ")");
|
|
9626
|
+
return `(${intl.formatNumber(current)}/${intl.formatNumber(limit)})`;
|
|
9729
9627
|
}
|
|
9730
9628
|
if (total) {
|
|
9731
|
-
return
|
|
9629
|
+
return `(${intl.formatNumber(total)})`;
|
|
9732
9630
|
}
|
|
9733
9631
|
return '';
|
|
9734
9632
|
};
|
|
@@ -9748,18 +9646,17 @@ const useShippingMethodsPlatformLimitsFetcher = () => {
|
|
|
9748
9646
|
};
|
|
9749
9647
|
|
|
9750
9648
|
const useShippingMethodsPlatformLimits = () => {
|
|
9751
|
-
var _platformLimits$shipp;
|
|
9752
9649
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
9753
9650
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
9754
|
-
if (!
|
|
9651
|
+
if (!platformLimits?.shippingMethods?.total) {
|
|
9755
9652
|
return {
|
|
9756
9653
|
hasReachedShippingMethodsWarningLimit: false,
|
|
9757
9654
|
hasReachedShippingMethodsErrorLimit: false
|
|
9758
9655
|
};
|
|
9759
9656
|
}
|
|
9760
|
-
const _platformLimits$
|
|
9761
|
-
limit = _platformLimits$
|
|
9762
|
-
current = _platformLimits$
|
|
9657
|
+
const _platformLimits$shipp = platformLimits.shippingMethods.total,
|
|
9658
|
+
limit = _platformLimits$shipp.limit,
|
|
9659
|
+
current = _platformLimits$shipp.current;
|
|
9763
9660
|
const hasReachedShippingMethodsWarningLimit = getHasExceededWarningThreshold({
|
|
9764
9661
|
limit,
|
|
9765
9662
|
current
|
|
@@ -9775,13 +9672,12 @@ const useShippingMethodsPlatformLimits = () => {
|
|
|
9775
9672
|
};
|
|
9776
9673
|
|
|
9777
9674
|
const PlatformLimitsShippingMethodsNotifications = () => {
|
|
9778
|
-
var _platformLimits$shipp;
|
|
9779
9675
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
9780
9676
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
9781
9677
|
const _useShippingMethodsPl2 = useShippingMethodsPlatformLimits(),
|
|
9782
9678
|
hasReachedShippingMethodsWarningLimit = _useShippingMethodsPl2.hasReachedShippingMethodsWarningLimit,
|
|
9783
9679
|
hasReachedShippingMethodsErrorLimit = _useShippingMethodsPl2.hasReachedShippingMethodsErrorLimit;
|
|
9784
|
-
if (!
|
|
9680
|
+
if (!platformLimits?.shippingMethods?.total) {
|
|
9785
9681
|
return null;
|
|
9786
9682
|
}
|
|
9787
9683
|
if (hasReachedShippingMethodsErrorLimit) {
|
|
@@ -9827,13 +9723,12 @@ var messages$k = defineMessages({
|
|
|
9827
9723
|
});
|
|
9828
9724
|
|
|
9829
9725
|
const PlatformLimitsShippingMethodsStatus = _ref => {
|
|
9830
|
-
var _platformLimits$shipp, _platformLimits$shipp2;
|
|
9831
9726
|
let total = _ref.total;
|
|
9832
9727
|
const intl = useIntl();
|
|
9833
9728
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
9834
9729
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
9835
|
-
const current = platformLimits
|
|
9836
|
-
const limit = platformLimits
|
|
9730
|
+
const current = platformLimits?.shippingMethods?.total?.current;
|
|
9731
|
+
const limit = platformLimits?.shippingMethods?.total?.limit;
|
|
9837
9732
|
return jsx(PlatformLimitsStatusText, {
|
|
9838
9733
|
intlMessage: messages$k.shippingMethodsStatus,
|
|
9839
9734
|
children: getPlatformLimitsStatus({
|
|
@@ -9895,18 +9790,17 @@ const useTaxCategoriesPlatformLimitsFetcher = () => {
|
|
|
9895
9790
|
};
|
|
9896
9791
|
|
|
9897
9792
|
const useTaxCategoriesPlatformLimits = () => {
|
|
9898
|
-
var _platformLimits$taxCa;
|
|
9899
9793
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
9900
9794
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
9901
|
-
if (!
|
|
9795
|
+
if (!platformLimits?.taxCategories?.total) {
|
|
9902
9796
|
return {
|
|
9903
9797
|
hasReachedTaxCategoriesWarningLimit: false,
|
|
9904
9798
|
hasReachedTaxCategoriesErrorLimit: false
|
|
9905
9799
|
};
|
|
9906
9800
|
}
|
|
9907
|
-
const _platformLimits$
|
|
9908
|
-
limit = _platformLimits$
|
|
9909
|
-
current = _platformLimits$
|
|
9801
|
+
const _platformLimits$taxCa = platformLimits.taxCategories.total,
|
|
9802
|
+
limit = _platformLimits$taxCa.limit,
|
|
9803
|
+
current = _platformLimits$taxCa.current;
|
|
9910
9804
|
const hasReachedTaxCategoriesWarningLimit = getHasExceededWarningThreshold({
|
|
9911
9805
|
limit,
|
|
9912
9806
|
current
|
|
@@ -9922,13 +9816,12 @@ const useTaxCategoriesPlatformLimits = () => {
|
|
|
9922
9816
|
};
|
|
9923
9817
|
|
|
9924
9818
|
const PlatformLimitsTaxCategoriesNotifications = () => {
|
|
9925
|
-
var _platformLimits$taxCa;
|
|
9926
9819
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
9927
9820
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
9928
9821
|
const _useTaxCategoriesPlat2 = useTaxCategoriesPlatformLimits(),
|
|
9929
9822
|
hasReachedTaxCategoriesWarningLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesWarningLimit,
|
|
9930
9823
|
hasReachedTaxCategoriesErrorLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesErrorLimit;
|
|
9931
|
-
if (!
|
|
9824
|
+
if (!platformLimits?.taxCategories?.total) {
|
|
9932
9825
|
return null;
|
|
9933
9826
|
}
|
|
9934
9827
|
if (hasReachedTaxCategoriesErrorLimit) {
|
|
@@ -9974,13 +9867,12 @@ var messages$i = defineMessages({
|
|
|
9974
9867
|
});
|
|
9975
9868
|
|
|
9976
9869
|
const PlatformLimitsTaxCategoriesStatus = _ref => {
|
|
9977
|
-
var _platformLimits$taxCa, _platformLimits$taxCa2;
|
|
9978
9870
|
let total = _ref.total;
|
|
9979
9871
|
const intl = useIntl();
|
|
9980
9872
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
9981
9873
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
9982
|
-
const current = platformLimits
|
|
9983
|
-
const limit = platformLimits
|
|
9874
|
+
const current = platformLimits?.taxCategories?.total?.current;
|
|
9875
|
+
const limit = platformLimits?.taxCategories?.total?.limit;
|
|
9984
9876
|
return jsx(PlatformLimitsStatusText, {
|
|
9985
9877
|
intlMessage: messages$i.taxCategoriesStatus,
|
|
9986
9878
|
children: getPlatformLimitsStatus({
|
|
@@ -10042,18 +9934,17 @@ const useZonesPlatformLimitsFetcher = () => {
|
|
|
10042
9934
|
};
|
|
10043
9935
|
|
|
10044
9936
|
const useZonesPlatformLimits = () => {
|
|
10045
|
-
var _platformLimits$zones;
|
|
10046
9937
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10047
9938
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10048
|
-
if (!
|
|
9939
|
+
if (!platformLimits?.zones?.total) {
|
|
10049
9940
|
return {
|
|
10050
9941
|
hasReachedZonesWarningLimit: false,
|
|
10051
9942
|
hasReachedZonesErrorLimit: false
|
|
10052
9943
|
};
|
|
10053
9944
|
}
|
|
10054
|
-
const _platformLimits$
|
|
10055
|
-
limit = _platformLimits$
|
|
10056
|
-
current = _platformLimits$
|
|
9945
|
+
const _platformLimits$zones = platformLimits.zones.total,
|
|
9946
|
+
limit = _platformLimits$zones.limit,
|
|
9947
|
+
current = _platformLimits$zones.current;
|
|
10057
9948
|
const hasReachedZonesWarningLimit = getHasExceededWarningThreshold({
|
|
10058
9949
|
limit,
|
|
10059
9950
|
current
|
|
@@ -10069,13 +9960,12 @@ const useZonesPlatformLimits = () => {
|
|
|
10069
9960
|
};
|
|
10070
9961
|
|
|
10071
9962
|
const PlatformLimitsZonesNotifications = () => {
|
|
10072
|
-
var _platformLimits$zones;
|
|
10073
9963
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10074
9964
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10075
9965
|
const _useZonesPlatformLimi2 = useZonesPlatformLimits(),
|
|
10076
9966
|
hasReachedZonesWarningLimit = _useZonesPlatformLimi2.hasReachedZonesWarningLimit,
|
|
10077
9967
|
hasReachedZonesErrorLimit = _useZonesPlatformLimi2.hasReachedZonesErrorLimit;
|
|
10078
|
-
if (!
|
|
9968
|
+
if (!platformLimits?.zones?.total) {
|
|
10079
9969
|
return null;
|
|
10080
9970
|
}
|
|
10081
9971
|
if (hasReachedZonesErrorLimit) {
|
|
@@ -10121,13 +10011,12 @@ var messages$g = defineMessages({
|
|
|
10121
10011
|
});
|
|
10122
10012
|
|
|
10123
10013
|
const PlatformLimitsZonesStatus = _ref => {
|
|
10124
|
-
var _platformLimits$zones, _platformLimits$zones2;
|
|
10125
10014
|
let total = _ref.total;
|
|
10126
10015
|
const intl = useIntl();
|
|
10127
10016
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10128
10017
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10129
|
-
const current = platformLimits
|
|
10130
|
-
const limit = platformLimits
|
|
10018
|
+
const current = platformLimits?.zones?.total?.current;
|
|
10019
|
+
const limit = platformLimits?.zones?.total?.limit;
|
|
10131
10020
|
return jsx(PlatformLimitsStatusText, {
|
|
10132
10021
|
intlMessage: messages$g.zonesStatus,
|
|
10133
10022
|
children: getPlatformLimitsStatus({
|
|
@@ -10189,18 +10078,17 @@ const useCustomersPlatformLimitsFetcher = () => {
|
|
|
10189
10078
|
};
|
|
10190
10079
|
|
|
10191
10080
|
const useCustomersPlatformLimits$1 = () => {
|
|
10192
|
-
var _platformLimits$custo;
|
|
10193
10081
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10194
10082
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10195
|
-
if (!
|
|
10083
|
+
if (!platformLimits?.customers?.total) {
|
|
10196
10084
|
return {
|
|
10197
10085
|
hasReachedCustomersWarningLimit: false,
|
|
10198
10086
|
hasReachedCustomersErrorLimit: false
|
|
10199
10087
|
};
|
|
10200
10088
|
}
|
|
10201
|
-
const _platformLimits$
|
|
10202
|
-
limit = _platformLimits$
|
|
10203
|
-
current = _platformLimits$
|
|
10089
|
+
const _platformLimits$custo = platformLimits.customers.total,
|
|
10090
|
+
limit = _platformLimits$custo.limit,
|
|
10091
|
+
current = _platformLimits$custo.current;
|
|
10204
10092
|
const hasReachedCustomersWarningLimit = getHasExceededWarningThreshold({
|
|
10205
10093
|
limit,
|
|
10206
10094
|
current
|
|
@@ -10229,13 +10117,12 @@ const useCustomersPlatormLimitsModalState = () => {
|
|
|
10229
10117
|
};
|
|
10230
10118
|
|
|
10231
10119
|
const PlatformLimitsCustomersNotifications = () => {
|
|
10232
|
-
var _platformLimits$custo;
|
|
10233
10120
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10234
10121
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10235
10122
|
const _useCustomersPlatform2 = useCustomersPlatformLimits$1(),
|
|
10236
10123
|
hasReachedCustomersWarningLimit = _useCustomersPlatform2.hasReachedCustomersWarningLimit,
|
|
10237
10124
|
hasReachedCustomersErrorLimit = _useCustomersPlatform2.hasReachedCustomersErrorLimit;
|
|
10238
|
-
if (!
|
|
10125
|
+
if (!platformLimits?.customers?.total) {
|
|
10239
10126
|
return jsx("div", {});
|
|
10240
10127
|
}
|
|
10241
10128
|
if (hasReachedCustomersErrorLimit) {
|
|
@@ -10286,16 +10173,15 @@ var styles$b = {
|
|
|
10286
10173
|
"status": "platform-limits-customers-status-module__status___3rXYM"
|
|
10287
10174
|
};
|
|
10288
10175
|
const PlatformLimitsCustomersStatus = () => {
|
|
10289
|
-
var _platformLimits$custo;
|
|
10290
10176
|
const intl = useIntl();
|
|
10291
10177
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10292
10178
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10293
|
-
if (!
|
|
10179
|
+
if (!platformLimits?.customers?.total) {
|
|
10294
10180
|
return null;
|
|
10295
10181
|
}
|
|
10296
|
-
const _platformLimits$
|
|
10297
|
-
current = _platformLimits$
|
|
10298
|
-
limit = _platformLimits$
|
|
10182
|
+
const _platformLimits$custo = platformLimits.customers.total,
|
|
10183
|
+
current = _platformLimits$custo.current,
|
|
10184
|
+
limit = _platformLimits$custo.limit;
|
|
10299
10185
|
return jsx("div", {
|
|
10300
10186
|
className: styles$b.status,
|
|
10301
10187
|
children: jsx(Text.Detail, {
|
|
@@ -10529,18 +10415,17 @@ const useCustomerGroupsPlatformLimitsFetcher = () => {
|
|
|
10529
10415
|
};
|
|
10530
10416
|
|
|
10531
10417
|
const useCustomerGroupsPlatformLimitsStatus = () => {
|
|
10532
|
-
var _platformLimits$custo;
|
|
10533
10418
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10534
10419
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10535
|
-
if (!
|
|
10420
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
10536
10421
|
return {
|
|
10537
10422
|
hasReachedCustomerGroupsWarningLimit: false,
|
|
10538
10423
|
hasReachedCustomerGroupsErrorLimit: false
|
|
10539
10424
|
};
|
|
10540
10425
|
}
|
|
10541
|
-
const _platformLimits$
|
|
10542
|
-
limit = _platformLimits$
|
|
10543
|
-
current = _platformLimits$
|
|
10426
|
+
const _platformLimits$custo = platformLimits.customerGroups.total,
|
|
10427
|
+
limit = _platformLimits$custo.limit,
|
|
10428
|
+
current = _platformLimits$custo.current;
|
|
10544
10429
|
const hasReachedCustomerGroupsWarningLimit = getHasExceededWarningThreshold({
|
|
10545
10430
|
limit,
|
|
10546
10431
|
current
|
|
@@ -10569,13 +10454,12 @@ const useCustomerGroupsPlatormLimitsModalState = () => {
|
|
|
10569
10454
|
};
|
|
10570
10455
|
|
|
10571
10456
|
const PlatformLimitsCustomerGroupsNotifications = () => {
|
|
10572
|
-
var _platformLimits$custo;
|
|
10573
10457
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10574
10458
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10575
10459
|
const _useCustomerGroupsPla2 = useCustomerGroupsPlatformLimitsStatus(),
|
|
10576
10460
|
hasReachedCustomerGroupsWarningLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsWarningLimit,
|
|
10577
10461
|
hasReachedCustomerGroupsErrorLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsErrorLimit;
|
|
10578
|
-
if (!
|
|
10462
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
10579
10463
|
return jsx("div", {});
|
|
10580
10464
|
}
|
|
10581
10465
|
if (hasReachedCustomerGroupsErrorLimit) {
|
|
@@ -10626,16 +10510,15 @@ var styles$9 = {
|
|
|
10626
10510
|
"status": "platform-limits-customer-groups-status-module__status___6099G"
|
|
10627
10511
|
};
|
|
10628
10512
|
const PlatformLimitsCustomerGroupsStatus = () => {
|
|
10629
|
-
var _platformLimits$custo;
|
|
10630
10513
|
const intl = useIntl();
|
|
10631
10514
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10632
10515
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10633
|
-
if (!
|
|
10516
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
10634
10517
|
return null;
|
|
10635
10518
|
}
|
|
10636
|
-
const _platformLimits$
|
|
10637
|
-
current = _platformLimits$
|
|
10638
|
-
limit = _platformLimits$
|
|
10519
|
+
const _platformLimits$custo = platformLimits.customerGroups.total,
|
|
10520
|
+
current = _platformLimits$custo.current,
|
|
10521
|
+
limit = _platformLimits$custo.limit;
|
|
10639
10522
|
return jsx("div", {
|
|
10640
10523
|
className: styles$9.status,
|
|
10641
10524
|
children: jsx(Text.Detail, {
|
|
@@ -10867,7 +10750,7 @@ var fetchPimIndexStatus = ((apolloClient, projectKey) => async dispatch => {
|
|
|
10867
10750
|
try {
|
|
10868
10751
|
await dispatch(actions.head({
|
|
10869
10752
|
mcApiProxyTarget: MC_API_PROXY_TARGETS.PIM_SEARCH,
|
|
10870
|
-
uri:
|
|
10753
|
+
uri: `/${projectKey}/search/products`
|
|
10871
10754
|
}));
|
|
10872
10755
|
return {
|
|
10873
10756
|
status: 'indexed'
|
|
@@ -10958,8 +10841,8 @@ const getIndexingJobIds = _ref => {
|
|
|
10958
10841
|
products = _ref$data.products,
|
|
10959
10842
|
productTypes = _ref$data.productTypes;
|
|
10960
10843
|
return {
|
|
10961
|
-
productsJobId:
|
|
10962
|
-
productTypesJobId:
|
|
10844
|
+
productsJobId: products?.indexingJobId || products?.existingIndexingJobId,
|
|
10845
|
+
productTypesJobId: productTypes?.indexingJobId || productTypes?.existingIndexingJobId
|
|
10963
10846
|
};
|
|
10964
10847
|
};
|
|
10965
10848
|
let PimIndexerProvider = /*#__PURE__*/function (_PureComponent) {
|
|
@@ -11223,7 +11106,6 @@ const valueMapping = {
|
|
|
11223
11106
|
all: [true, false]
|
|
11224
11107
|
};
|
|
11225
11108
|
const BooleanField = props => {
|
|
11226
|
-
var _context;
|
|
11227
11109
|
let selectedValue;
|
|
11228
11110
|
if (typeof props.value === 'boolean') selectedValue = getBooleanValue(props.value);else if (props.isMulti && _Array$isArray(props.value) && props.value.length) selectedValue = props.value.length === 2 ? 'all' : getBooleanValue(props.value[0]);
|
|
11229
11111
|
const yesLabel = props.intl.formatMessage(messages$8.yes);
|
|
@@ -11237,7 +11119,7 @@ const BooleanField = props => {
|
|
|
11237
11119
|
}];
|
|
11238
11120
|
if (props.isMulti) options.push({
|
|
11239
11121
|
value: 'all',
|
|
11240
|
-
label:
|
|
11122
|
+
label: `${yesLabel} / ${noLabel}`
|
|
11241
11123
|
});
|
|
11242
11124
|
return jsx(SelectInput, {
|
|
11243
11125
|
name: props.name,
|
|
@@ -11401,19 +11283,19 @@ const ScrollToFieldError = () => {
|
|
|
11401
11283
|
if (isValid) return;
|
|
11402
11284
|
const firstErrorElement = document.querySelector('[aria-invalid="true"]');
|
|
11403
11285
|
if (firstErrorElement) {
|
|
11404
|
-
var _ref, _ref2, _document$querySelect, _elementToScrollTo$sc;
|
|
11405
11286
|
// Get a reference to the label.
|
|
11406
11287
|
const firstElementId = firstErrorElement.getAttribute('id');
|
|
11407
|
-
const localizedInputIndex = _indexOfInstanceProperty(firstElementId).call(firstElementId,
|
|
11288
|
+
const localizedInputIndex = _indexOfInstanceProperty(firstElementId).call(firstElementId, `.${dataLocale}`);
|
|
11408
11289
|
|
|
11409
11290
|
// check if locale is appended then remove it from id
|
|
11410
|
-
const id = localizedInputIndex > -1 ? firstElementId.replace(
|
|
11291
|
+
const id = localizedInputIndex > -1 ? firstElementId.replace(`.${dataLocale}`, '') : firstElementId;
|
|
11411
11292
|
|
|
11412
11293
|
// Scroll to the label (if found), otherwise to the input element itself.
|
|
11413
11294
|
|
|
11414
|
-
const elementToScrollTo =
|
|
11415
|
-
|
|
11416
|
-
(
|
|
11295
|
+
const elementToScrollTo =
|
|
11296
|
+
// div is used only for custom fields
|
|
11297
|
+
document.querySelector(`div[aria-errormessage="${firstElementId}"]`) ?? document.querySelector(`label[for="${id}"]`) ?? document.querySelector(`label#${id}`) ?? firstErrorElement;
|
|
11298
|
+
elementToScrollTo.scrollIntoView?.({
|
|
11417
11299
|
behavior: 'smooth'
|
|
11418
11300
|
});
|
|
11419
11301
|
}
|
|
@@ -11439,8 +11321,7 @@ var styles$4 = {
|
|
|
11439
11321
|
"search-mode-menu": "selectable-field-search-input-module__search-mode-menu___Od6Le"
|
|
11440
11322
|
};
|
|
11441
11323
|
const SelectableFieldSearchInput = props => {
|
|
11442
|
-
|
|
11443
|
-
const _useState = useState((_props$initialValue = props.initialValue) !== null && _props$initialValue !== void 0 ? _props$initialValue : ''),
|
|
11324
|
+
const _useState = useState(props.initialValue ?? ''),
|
|
11444
11325
|
_useState2 = _slicedToArray(_useState, 2),
|
|
11445
11326
|
searchText = _useState2[0],
|
|
11446
11327
|
setSearchText = _useState2[1];
|
|
@@ -11476,7 +11357,7 @@ const SelectableFieldSearchInput = props => {
|
|
|
11476
11357
|
});
|
|
11477
11358
|
},
|
|
11478
11359
|
onReset: props.onReset,
|
|
11479
|
-
placeholder:
|
|
11360
|
+
placeholder: props.placeholder ?? intl.formatMessage(messages$5.placeholder),
|
|
11480
11361
|
isDisabled: props.disabled
|
|
11481
11362
|
})
|
|
11482
11363
|
});
|
|
@@ -11537,7 +11418,6 @@ StoreSelectField.defaultProps = {
|
|
|
11537
11418
|
mappedValueField: 'id'
|
|
11538
11419
|
};
|
|
11539
11420
|
|
|
11540
|
-
var _templateObject;
|
|
11541
11421
|
function ownKeys$b(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11542
11422
|
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(_context5 = ownKeys$b(Object(t), !0)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context6 = ownKeys$b(Object(t))).call(_context6, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11543
11423
|
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -11616,7 +11496,10 @@ const VALIDATOR_INTEGER = {
|
|
|
11616
11496
|
* has emitted a warning once in the logs, not for every instance
|
|
11617
11497
|
*/
|
|
11618
11498
|
let hasWarned = false;
|
|
11619
|
-
const warningMessage = oneLineTrim
|
|
11499
|
+
const warningMessage = oneLineTrim`
|
|
11500
|
+
\`validatedInput\` is no longer supported.
|
|
11501
|
+
Please use \`formik\` instead.
|
|
11502
|
+
`;
|
|
11620
11503
|
const ToolTipWrapperComponent = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
11621
11504
|
let children = _ref.children;
|
|
11622
11505
|
return jsx(Constraints.Horizontal, {
|
|
@@ -11765,7 +11648,7 @@ function validatedInput(InnerComponent, validators) {
|
|
|
11765
11648
|
}]);
|
|
11766
11649
|
return ValidatedInput;
|
|
11767
11650
|
}(PureComponent);
|
|
11768
|
-
ValidatedInput.displayName =
|
|
11651
|
+
ValidatedInput.displayName = `ValidatedInput(${_InnerComponent.displayName})`;
|
|
11769
11652
|
ValidatedInput.defaultProps = {
|
|
11770
11653
|
isValid: true,
|
|
11771
11654
|
getInputRef: () => {}
|
|
@@ -11907,7 +11790,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
11907
11790
|
truncate: true,
|
|
11908
11791
|
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$2.filterWholeInput), {}, {
|
|
11909
11792
|
values: {
|
|
11910
|
-
values: "
|
|
11793
|
+
values: `"${props.value}"`
|
|
11911
11794
|
}
|
|
11912
11795
|
})
|
|
11913
11796
|
})
|
|
@@ -11920,7 +11803,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
11920
11803
|
truncate: true,
|
|
11921
11804
|
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$2.filterSeparateValues), {}, {
|
|
11922
11805
|
values: {
|
|
11923
|
-
values: "
|
|
11806
|
+
values: `"${props.multiValue.join('", "')}"` || props.value
|
|
11924
11807
|
}
|
|
11925
11808
|
})
|
|
11926
11809
|
})
|
|
@@ -12212,17 +12095,16 @@ function isEmpty(value) {
|
|
|
12212
12095
|
}
|
|
12213
12096
|
|
|
12214
12097
|
const buildSearchQuery = (searchQuery, searchMode, fragments) => {
|
|
12215
|
-
var _fragments$searchMode;
|
|
12216
12098
|
if (!searchQuery) return '';
|
|
12217
12099
|
const buildAllFieldsQueryString = query => {
|
|
12218
12100
|
const fragmentsArray = _Object$values(fragments);
|
|
12219
|
-
return
|
|
12101
|
+
return `( ${_mapInstanceProperty(fragmentsArray).call(fragmentsArray, fragment => fragment.getQuery(query)).join(' or ')} )`;
|
|
12220
12102
|
};
|
|
12221
12103
|
const trimmedSearchQuery = oneLine(searchQuery);
|
|
12222
12104
|
if (searchMode === 'allFields') {
|
|
12223
12105
|
return buildAllFieldsQueryString(trimmedSearchQuery);
|
|
12224
12106
|
}
|
|
12225
|
-
if (!fragments[searchMode] || typeof
|
|
12107
|
+
if (!fragments[searchMode] || typeof fragments[searchMode]?.getQuery !== 'function') {
|
|
12226
12108
|
return '';
|
|
12227
12109
|
}
|
|
12228
12110
|
return fragments[searchMode].getQuery(trimmedSearchQuery);
|
|
@@ -12453,11 +12335,11 @@ function createResourceReducer(options) {
|
|
|
12453
12335
|
|
|
12454
12336
|
// TODO: validate constant keys
|
|
12455
12337
|
const actionsMap = {
|
|
12456
|
-
[
|
|
12338
|
+
[`${plural}_FETCHED`]: (_, action) => ({
|
|
12457
12339
|
currentQueryResult: action.payload
|
|
12458
12340
|
}),
|
|
12459
|
-
[
|
|
12460
|
-
[
|
|
12341
|
+
[`${single}_UPDATED_IN_LIST`]: updateStatusInList(mergeData),
|
|
12342
|
+
[`${single}_DELETED_IN_LIST`]: (state, _ref) => {
|
|
12461
12343
|
let payload = _ref.payload;
|
|
12462
12344
|
const results = state.currentQueryResult.results;
|
|
12463
12345
|
return {
|
|
@@ -12469,27 +12351,27 @@ function createResourceReducer(options) {
|
|
|
12469
12351
|
})
|
|
12470
12352
|
};
|
|
12471
12353
|
},
|
|
12472
|
-
[
|
|
12354
|
+
[`${single}_FETCHED`]: (_, _ref3) => {
|
|
12473
12355
|
let payload = _ref3.payload;
|
|
12474
12356
|
return {
|
|
12475
12357
|
currentVisible: payload
|
|
12476
12358
|
};
|
|
12477
12359
|
},
|
|
12478
|
-
[
|
|
12360
|
+
[`${single}_CREATED`]: (_ref4, _ref5) => {
|
|
12479
12361
|
let currentVisible = _ref4.currentVisible;
|
|
12480
12362
|
let payload = _ref5.payload;
|
|
12481
12363
|
return {
|
|
12482
12364
|
currentVisible: mergeData(payload, currentVisible)
|
|
12483
12365
|
};
|
|
12484
12366
|
},
|
|
12485
|
-
[
|
|
12367
|
+
[`${single}_UPDATED`]: (_ref6, _ref7) => {
|
|
12486
12368
|
let currentVisible = _ref6.currentVisible;
|
|
12487
12369
|
let payload = _ref7.payload;
|
|
12488
12370
|
return {
|
|
12489
12371
|
currentVisible: mergeData(payload, currentVisible)
|
|
12490
12372
|
};
|
|
12491
12373
|
},
|
|
12492
|
-
[
|
|
12374
|
+
[`${single}_DELETED`]: () => ({
|
|
12493
12375
|
currentVisible: null
|
|
12494
12376
|
})
|
|
12495
12377
|
};
|
|
@@ -12506,12 +12388,11 @@ function formatCustomerAddress(_ref) {
|
|
|
12506
12388
|
}
|
|
12507
12389
|
|
|
12508
12390
|
function formatCustomerName(_ref) {
|
|
12509
|
-
var _context;
|
|
12510
12391
|
let firstName = _ref.firstName,
|
|
12511
12392
|
lastName = _ref.lastName;
|
|
12512
12393
|
if (firstName && !lastName) return _trimInstanceProperty(firstName).call(firstName);
|
|
12513
12394
|
if (!firstName && lastName) return _trimInstanceProperty(lastName).call(lastName);
|
|
12514
|
-
if (firstName && lastName) return
|
|
12395
|
+
if (firstName && lastName) return `${_trimInstanceProperty(firstName).call(firstName)} ${_trimInstanceProperty(lastName).call(lastName)}`;
|
|
12515
12396
|
return NO_VALUE_FALLBACK;
|
|
12516
12397
|
}
|
|
12517
12398
|
|
|
@@ -12561,10 +12442,7 @@ const validateText = (text, intl) => {
|
|
|
12561
12442
|
* @returns {boolean}
|
|
12562
12443
|
*/
|
|
12563
12444
|
const hasErrorCode = (unmappedApiErrors, errorCode) => {
|
|
12564
|
-
return _Array$isArray(unmappedApiErrors) && _someInstanceProperty(unmappedApiErrors).call(unmappedApiErrors, error =>
|
|
12565
|
-
var _error$extensions;
|
|
12566
|
-
return ((_error$extensions = error.extensions) === null || _error$extensions === void 0 ? void 0 : _error$extensions.code) === errorCode;
|
|
12567
|
-
});
|
|
12445
|
+
return _Array$isArray(unmappedApiErrors) && _someInstanceProperty(unmappedApiErrors).call(unmappedApiErrors, error => error.extensions?.code === errorCode);
|
|
12568
12446
|
};
|
|
12569
12447
|
|
|
12570
12448
|
const hasInvalidInputError = errors => hasErrorCode(errors, ERROR_CODES.invalidInput);
|
|
@@ -12576,7 +12454,7 @@ function minusify(value) {
|
|
|
12576
12454
|
return minus.concat(value);
|
|
12577
12455
|
}
|
|
12578
12456
|
|
|
12579
|
-
const flattenOperator = (operator, clauses) => compact(_reduceInstanceProperty(clauses).call(clauses, (result, clause) => _concatInstanceProperty(result).call(result,
|
|
12457
|
+
const flattenOperator = (operator, clauses) => compact(_reduceInstanceProperty(clauses).call(clauses, (result, clause) => _concatInstanceProperty(result).call(result, clause?.[operator] || clause), []));
|
|
12580
12458
|
const argsToArray = args => _reduceInstanceProperty(args).call(args, (result, item) => _concatInstanceProperty(result).call(result, item), []);
|
|
12581
12459
|
const exists = (field, attributeType) => ({
|
|
12582
12460
|
exists: {
|
|
@@ -12633,7 +12511,7 @@ const not = function () {
|
|
|
12633
12511
|
|
|
12634
12512
|
const safelyAddFallback = function (string) {
|
|
12635
12513
|
let fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NO_VALUE_FALLBACK;
|
|
12636
|
-
return string === '' ? fallback : string
|
|
12514
|
+
return string === '' ? fallback : string ?? fallback;
|
|
12637
12515
|
};
|
|
12638
12516
|
|
|
12639
12517
|
var messages$1 = defineMessages({
|
|
@@ -12768,19 +12646,19 @@ const computedProperties = {
|
|
|
12768
12646
|
// has been deleted. See MC-1925 for further information.
|
|
12769
12647
|
const filteredCategories = _filterInstanceProperty(_context6 = product.categories).call(_context6, category => category.obj !== undefined);
|
|
12770
12648
|
return _mapInstanceProperty(filteredCategories).call(filteredCategories, category => {
|
|
12771
|
-
var _context7;
|
|
12772
12649
|
const categoryPath = getPathName(category, language, languages);
|
|
12773
12650
|
const ancestors = getAncestors(category, language);
|
|
12774
|
-
const externalIdValue = category.obj.externalId ?
|
|
12651
|
+
const externalIdValue = category.obj.externalId ?
|
|
12652
|
+
// hardcoding "ext. ID" since this is not part of a message to be
|
|
12775
12653
|
// translated. This has been communicated with Jenn
|
|
12776
|
-
|
|
12654
|
+
`| ext. ID: ${category.obj.externalId}` : '';
|
|
12777
12655
|
return {
|
|
12778
12656
|
id: category.id,
|
|
12779
|
-
name:
|
|
12657
|
+
name: `${formatLocalizedString(category.obj, {
|
|
12780
12658
|
key: 'name',
|
|
12781
12659
|
locale: language,
|
|
12782
12660
|
fallbackOrder: languages
|
|
12783
|
-
})
|
|
12661
|
+
})} ${externalIdValue}`,
|
|
12784
12662
|
path: categoryPath,
|
|
12785
12663
|
level: ancestors.length
|
|
12786
12664
|
};
|
|
@@ -12817,13 +12695,13 @@ const getAttributeValueByType = _ref12 => {
|
|
|
12817
12695
|
value: value
|
|
12818
12696
|
});
|
|
12819
12697
|
case 'enum':
|
|
12820
|
-
return safelyAddFallback(value.label,
|
|
12698
|
+
return safelyAddFallback(value.label, `${value.key} (key)`);
|
|
12821
12699
|
case 'lenum':
|
|
12822
12700
|
return safelyAddFallback(formatLocalizedString(value, {
|
|
12823
12701
|
key: 'label',
|
|
12824
12702
|
locale: projectDataLocale,
|
|
12825
12703
|
fallbackOrder: projectLanguages
|
|
12826
|
-
}),
|
|
12704
|
+
}), `${value.key} (key)`);
|
|
12827
12705
|
case 'number':
|
|
12828
12706
|
return safelyAddFallback(value);
|
|
12829
12707
|
case 'boolean':
|
|
@@ -12946,7 +12824,6 @@ const reorderArrayItems = (array, from, to) => {
|
|
|
12946
12824
|
const mapTimeZonesToOptions = memoize(timeZones => {
|
|
12947
12825
|
var _context;
|
|
12948
12826
|
return _mapInstanceProperty(_context = _Object$entries(timeZones)).call(_context, _ref => {
|
|
12949
|
-
var _context2;
|
|
12950
12827
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
12951
12828
|
code = _ref2[0],
|
|
12952
12829
|
value = _ref2[1];
|
|
@@ -12955,7 +12832,7 @@ const mapTimeZonesToOptions = memoize(timeZones => {
|
|
|
12955
12832
|
//E.g. `(GMT +02:00) Central European Time - Berlin`
|
|
12956
12833
|
// unicode clock hex code: \u25F7
|
|
12957
12834
|
//
|
|
12958
|
-
label:
|
|
12835
|
+
label: `(GMT ${value.offset}) ${value.name}`
|
|
12959
12836
|
};
|
|
12960
12837
|
});
|
|
12961
12838
|
});
|
|
@@ -12963,12 +12840,9 @@ const getTimeZoneId = memoize((selectedTimeZone, timeZones) => {
|
|
|
12963
12840
|
if (timeZones[selectedTimeZone]) {
|
|
12964
12841
|
return selectedTimeZone;
|
|
12965
12842
|
} else {
|
|
12966
|
-
var
|
|
12967
|
-
const fallbackTimeZoneId = _findInstanceProperty(
|
|
12968
|
-
|
|
12969
|
-
return (_timeZones$timeZoneId = timeZones[timeZoneId]) === null || _timeZones$timeZoneId === void 0 || (_timeZones$timeZoneId = _timeZones$timeZoneId.translationFor) === null || _timeZones$timeZoneId === void 0 ? void 0 : _someInstanceProperty(_timeZones$timeZoneId).call(_timeZones$timeZoneId, fallbackTimeZone => fallbackTimeZone === selectedTimeZone);
|
|
12970
|
-
});
|
|
12971
|
-
if (fallbackTimeZoneId !== null && fallbackTimeZoneId !== void 0 && fallbackTimeZoneId.length) {
|
|
12843
|
+
var _context2;
|
|
12844
|
+
const fallbackTimeZoneId = _findInstanceProperty(_context2 = _Object$keys(timeZones)).call(_context2, timeZoneId => timeZones[timeZoneId]?.translationFor?.some(fallbackTimeZone => fallbackTimeZone === selectedTimeZone));
|
|
12845
|
+
if (fallbackTimeZoneId?.length) {
|
|
12972
12846
|
return fallbackTimeZoneId.toString();
|
|
12973
12847
|
} else {
|
|
12974
12848
|
return 'UTC';
|
|
@@ -12976,10 +12850,9 @@ const getTimeZoneId = memoize((selectedTimeZone, timeZones) => {
|
|
|
12976
12850
|
}
|
|
12977
12851
|
});
|
|
12978
12852
|
const getTimeZoneLabel = memoize((selectedTimeZone, timeZones) => {
|
|
12979
|
-
var _context4;
|
|
12980
12853
|
const timeZoneId = getTimeZoneId(selectedTimeZone, timeZones);
|
|
12981
12854
|
const timeZoneData = timeZones[timeZoneId];
|
|
12982
|
-
return
|
|
12855
|
+
return `(GMT ${timeZoneData.offset}) ${timeZoneData.name}`;
|
|
12983
12856
|
});
|
|
12984
12857
|
|
|
12985
12858
|
function ownKeys$3(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -13040,8 +12913,7 @@ const typeDefinitionsExist = typeDefinitions => {
|
|
|
13040
12913
|
return typeDefinitions.length > 0;
|
|
13041
12914
|
};
|
|
13042
12915
|
const typeDefinitionSelected = formValues => {
|
|
13043
|
-
|
|
13044
|
-
return ((_formValues$FIELD_NAM = formValues[FIELD_NAME]) === null || _formValues$FIELD_NAM === void 0 ? void 0 : _formValues$FIELD_NAM.type) && ((_formValues$FIELD_NAM2 = formValues[FIELD_NAME]) === null || _formValues$FIELD_NAM2 === void 0 || (_formValues$FIELD_NAM2 = _formValues$FIELD_NAM2.type) === null || _formValues$FIELD_NAM2 === void 0 ? void 0 : _formValues$FIELD_NAM2.obj);
|
|
12916
|
+
return formValues[FIELD_NAME]?.type && formValues[FIELD_NAME]?.type?.obj;
|
|
13045
12917
|
};
|
|
13046
12918
|
const typeDefinitionContainsFieldDefinitions = formValues => {
|
|
13047
12919
|
return formValues[FIELD_NAME].type.obj.key && formValues[FIELD_NAME].type.obj.fieldDefinitions.length > 0;
|
|
@@ -13076,7 +12948,7 @@ const CustomFieldsInputWrapper = _ref2 => {
|
|
|
13076
12948
|
max: "scale",
|
|
13077
12949
|
children: jsx(CustomFields, {
|
|
13078
12950
|
isReadOnly: isReadOnly,
|
|
13079
|
-
name:
|
|
12951
|
+
name: `${FIELD_NAME}.fields`,
|
|
13080
12952
|
fieldDefinitions: isReadOnly && hideEmptyFields ? fieldDefinitionsWithValues(formValues) : formValues[FIELD_NAME].type.obj.fieldDefinitions
|
|
13081
12953
|
})
|
|
13082
12954
|
});
|
|
@@ -13111,7 +12983,6 @@ const createFormStateFromTypeDefinition = selectedTypeDefinition => {
|
|
|
13111
12983
|
};
|
|
13112
12984
|
};
|
|
13113
12985
|
const CustomTypeSubform = _ref => {
|
|
13114
|
-
var _formValues$FIELD_NAM3, _formValues$FIELD_NAM4;
|
|
13115
12986
|
let typeDefinitions = _ref.typeDefinitions,
|
|
13116
12987
|
isReadOnly = _ref.isReadOnly,
|
|
13117
12988
|
isCondensed = _ref.isCondensed,
|
|
@@ -13143,8 +13014,7 @@ const CustomTypeSubform = _ref => {
|
|
|
13143
13014
|
}
|
|
13144
13015
|
}, [typeDefinitions, setFieldValue, validateForm]);
|
|
13145
13016
|
const typeDefinitionSelected = formValues => {
|
|
13146
|
-
|
|
13147
|
-
return ((_formValues$FIELD_NAM = formValues[FIELD_NAME]) === null || _formValues$FIELD_NAM === void 0 ? void 0 : _formValues$FIELD_NAM.type) && ((_formValues$FIELD_NAM2 = formValues[FIELD_NAME]) === null || _formValues$FIELD_NAM2 === void 0 || (_formValues$FIELD_NAM2 = _formValues$FIELD_NAM2.type) === null || _formValues$FIELD_NAM2 === void 0 ? void 0 : _formValues$FIELD_NAM2.obj);
|
|
13017
|
+
return formValues[FIELD_NAME]?.type && formValues[FIELD_NAME]?.type?.obj;
|
|
13148
13018
|
};
|
|
13149
13019
|
|
|
13150
13020
|
// if the user has read-only permissions, empty fields are hidden, and no type definition is selected, hide the component
|
|
@@ -13159,9 +13029,9 @@ const CustomTypeSubform = _ref => {
|
|
|
13159
13029
|
children: jsx(SelectInput, {
|
|
13160
13030
|
isClearable: true,
|
|
13161
13031
|
"data-testid": "custom-type-select",
|
|
13162
|
-
name:
|
|
13163
|
-
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages,
|
|
13164
|
-
value:
|
|
13032
|
+
name: `${FIELD_NAME}.type.obj.key`,
|
|
13033
|
+
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages, formValues[FIELD_NAME]?.type?.id),
|
|
13034
|
+
value: formValues[FIELD_NAME]?.type?.obj?.key,
|
|
13165
13035
|
onChange: handleTypeDefinitionSelect,
|
|
13166
13036
|
placeholder: formatMessage(messages.typesPlaceholder),
|
|
13167
13037
|
isReadOnly: isReadOnly
|
|
@@ -13180,8 +13050,7 @@ CustomTypeSubform.displayName = 'CustomTypeSubform';
|
|
|
13180
13050
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13181
13051
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context6 = ownKeys(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context7 = ownKeys(Object(t))).call(_context7, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13182
13052
|
const transformFieldType = fieldDefinition => {
|
|
13183
|
-
|
|
13184
|
-
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') {
|
|
13053
|
+
if (fieldDefinition.type?.elementType?.name === 'LocalizedEnum') {
|
|
13185
13054
|
var _context;
|
|
13186
13055
|
return _objectSpread(_objectSpread({}, fieldDefinition.type), {}, {
|
|
13187
13056
|
elementType: _objectSpread(_objectSpread({}, fieldDefinition.type.elementType), {}, {
|
|
@@ -13191,7 +13060,7 @@ const transformFieldType = fieldDefinition => {
|
|
|
13191
13060
|
}))
|
|
13192
13061
|
})
|
|
13193
13062
|
});
|
|
13194
|
-
} else if (
|
|
13063
|
+
} else if (fieldDefinition.type?.name === 'LocalizedEnum') {
|
|
13195
13064
|
var _context2;
|
|
13196
13065
|
return _objectSpread(_objectSpread({}, fieldDefinition.type), {}, {
|
|
13197
13066
|
values: _mapInstanceProperty(_context2 = _valuesInstanceProperty(fieldDefinition.type)).call(_context2, value => ({
|