@commercetools-frontend/experimental-components 5.4.4 → 5.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commercetools-frontend-experimental-components.cjs.dev.js +457 -603
- package/dist/commercetools-frontend-experimental-components.cjs.prod.js +455 -601
- package/dist/commercetools-frontend-experimental-components.esm.js +455 -601
- package/dist/styles.css +24 -24
- package/package.json +12 -12
|
@@ -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';
|
|
@@ -76,7 +74,6 @@ 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
|
-
extraWhere:
|
|
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);
|
|
@@ -3649,24 +3612,21 @@ const useHandlers = onChange => {
|
|
|
3649
3612
|
|
|
3650
3613
|
const _excluded$1 = ["extraWhere"];
|
|
3651
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; }
|
|
3652
|
-
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; }
|
|
3653
3616
|
const constructPrefixSearchPredicate = function () {
|
|
3654
3617
|
let prefixSearchFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
3655
3618
|
let lowerBound = arguments.length > 1 ? arguments[1] : undefined;
|
|
3656
3619
|
let upperBound = arguments.length > 2 ? arguments[2] : undefined;
|
|
3657
3620
|
const constructPrefixSearchExpression = field => {
|
|
3658
|
-
var _context
|
|
3621
|
+
var _context;
|
|
3659
3622
|
const path = field.split('.');
|
|
3660
3623
|
const _path$slice$reverse = _reverseInstanceProperty(_context = _sliceInstanceProperty(path).call(path)).call(_context),
|
|
3661
3624
|
_path$slice$reverse2 = _toArray(_path$slice$reverse),
|
|
3662
3625
|
finalValueInPath = _path$slice$reverse2[0],
|
|
3663
3626
|
remainPathInReverse = _sliceInstanceProperty(_path$slice$reverse2).call(_path$slice$reverse2, 1);
|
|
3664
|
-
const comparison =
|
|
3627
|
+
const comparison = `${finalValueInPath} >= "${lowerBound}" and ${finalValueInPath} < "${upperBound}"`;
|
|
3665
3628
|
if (remainPathInReverse.length) {
|
|
3666
|
-
return _reduceInstanceProperty(remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) => {
|
|
3667
|
-
var _context5;
|
|
3668
|
-
return _concatInstanceProperty(_context5 = "".concat(nextPath, "(")).call(_context5, nestedPath, ")");
|
|
3669
|
-
}, comparison);
|
|
3629
|
+
return _reduceInstanceProperty(remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) => `${nextPath}(${nestedPath})`, comparison);
|
|
3670
3630
|
}
|
|
3671
3631
|
return comparison;
|
|
3672
3632
|
};
|
|
@@ -3682,7 +3642,7 @@ const useLoadOptions = _ref => {
|
|
|
3682
3642
|
let where;
|
|
3683
3643
|
if (inputValue.length) {
|
|
3684
3644
|
if (isUUID(inputValue)) {
|
|
3685
|
-
where =
|
|
3645
|
+
where = `id = "${inputValue}"`;
|
|
3686
3646
|
} else {
|
|
3687
3647
|
const _getPrefixSearchBound = getPrefixSearchBounds(inputValue),
|
|
3688
3648
|
_getPrefixSearchBound2 = _slicedToArray(_getPrefixSearchBound, 2),
|
|
@@ -3691,12 +3651,11 @@ const useLoadOptions = _ref => {
|
|
|
3691
3651
|
where = constructPrefixSearchPredicate(prefixSearchFields, lowerBound, upperBound);
|
|
3692
3652
|
}
|
|
3693
3653
|
}
|
|
3694
|
-
const _ref2 = variables
|
|
3654
|
+
const _ref2 = variables ?? {},
|
|
3695
3655
|
extraWhere = _ref2.extraWhere,
|
|
3696
3656
|
restVariables = _objectWithoutProperties(_ref2, _excluded$1);
|
|
3697
3657
|
if (typeof extraWhere === 'string') {
|
|
3698
|
-
|
|
3699
|
-
where = where ? _concatInstanceProperty(_context6 = "(".concat(where, ") and ")).call(_context6, variables.extraWhere) : variables.extraWhere;
|
|
3658
|
+
where = where ? `(${where}) and ${variables.extraWhere}` : variables.extraWhere;
|
|
3700
3659
|
}
|
|
3701
3660
|
return client.query({
|
|
3702
3661
|
query,
|
|
@@ -3713,7 +3672,6 @@ const useLoadOptions = _ref => {
|
|
|
3713
3672
|
};
|
|
3714
3673
|
|
|
3715
3674
|
function useCurrentOption(_ref) {
|
|
3716
|
-
var _context;
|
|
3717
3675
|
let id = _ref.id,
|
|
3718
3676
|
typename = _ref.typename,
|
|
3719
3677
|
query = _ref.query,
|
|
@@ -3725,7 +3683,7 @@ function useCurrentOption(_ref) {
|
|
|
3725
3683
|
// load from cache when possible to speed up initial render
|
|
3726
3684
|
const canReadFromCache = id && typename && fragment;
|
|
3727
3685
|
const cacheItem = canReadFromCache ? apolloClient.readFragment({
|
|
3728
|
-
id:
|
|
3686
|
+
id: `${typename}:${id}`,
|
|
3729
3687
|
fragment
|
|
3730
3688
|
}) : undefined;
|
|
3731
3689
|
|
|
@@ -3743,7 +3701,7 @@ function useCurrentOption(_ref) {
|
|
|
3743
3701
|
queryData = _useQuery.data,
|
|
3744
3702
|
queryError = _useQuery.error;
|
|
3745
3703
|
const queryItem = queryData && queryDataToItem(queryData);
|
|
3746
|
-
const item = queryItem
|
|
3704
|
+
const item = queryItem ?? cacheItem;
|
|
3747
3705
|
const loading = item ? false : queryLoading;
|
|
3748
3706
|
const error = item ? undefined : queryError;
|
|
3749
3707
|
const data = item && itemToOption(item);
|
|
@@ -3782,7 +3740,6 @@ const convertProductTypeToOption = productType => {
|
|
|
3782
3740
|
};
|
|
3783
3741
|
};
|
|
3784
3742
|
const ProductTypePickerInput = _ref => {
|
|
3785
|
-
var _currentOption$data$l, _currentOption$data;
|
|
3786
3743
|
let isClearable = _ref.isClearable,
|
|
3787
3744
|
isDisabled = _ref.isDisabled,
|
|
3788
3745
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -3813,9 +3770,8 @@ const ProductTypePickerInput = _ref => {
|
|
|
3813
3770
|
itemToOption: convertProductTypeToOption
|
|
3814
3771
|
});
|
|
3815
3772
|
const handleLoadOptions = useCallback(inputValue => loadProductTypes(inputValue).then(_ref3 => {
|
|
3816
|
-
var _data$productTypes;
|
|
3817
3773
|
let data = _ref3.data;
|
|
3818
|
-
return
|
|
3774
|
+
return data.productTypes?.results || [];
|
|
3819
3775
|
}).then(productTypes => _mapInstanceProperty(productTypes).call(productTypes, convertProductTypeToOption)).catch(error => {
|
|
3820
3776
|
setLoadingError(error);
|
|
3821
3777
|
onError(error);
|
|
@@ -3829,12 +3785,12 @@ const ProductTypePickerInput = _ref => {
|
|
|
3829
3785
|
setLoadingError(null);
|
|
3830
3786
|
handleInternalInputChange(event);
|
|
3831
3787
|
}, [handleInternalInputChange]);
|
|
3832
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
3788
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
3833
3789
|
useEffect(() => {
|
|
3834
3790
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
3835
3791
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
3836
3792
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
3837
|
-
const tooltipTitle =
|
|
3793
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
3838
3794
|
return jsx(Constraints.Horizontal, {
|
|
3839
3795
|
max: "scale",
|
|
3840
3796
|
children: currentOption.loading ? jsx(CenteredLoadingSpinner, {}) : jsxs(Spacings.Stack, {
|
|
@@ -3885,7 +3841,6 @@ var messages$C = defineMessages({
|
|
|
3885
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 } } } };
|
|
3886
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 } } } };
|
|
3887
3843
|
const StatePickerInput = _ref => {
|
|
3888
|
-
var _currentOption$data$l, _currentOption$data;
|
|
3889
3844
|
let isClearable = _ref.isClearable,
|
|
3890
3845
|
isDisabled = _ref.isDisabled,
|
|
3891
3846
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -3900,7 +3855,7 @@ const StatePickerInput = _ref => {
|
|
|
3900
3855
|
formatMessage = _useIntl.formatMessage;
|
|
3901
3856
|
const dataLocale = useApplicationContext(applicationContext => applicationContext.dataLocale);
|
|
3902
3857
|
const variables = useMemo(() => ({
|
|
3903
|
-
sortByNamePath:
|
|
3858
|
+
sortByNamePath: `name.${dataLocale}`
|
|
3904
3859
|
}), [dataLocale]);
|
|
3905
3860
|
const convertStateToOption = useCallback(state => {
|
|
3906
3861
|
const localizedName = formatLocalizedFieldToString(state.nameAllLocales);
|
|
@@ -3915,7 +3870,7 @@ const StatePickerInput = _ref => {
|
|
|
3915
3870
|
_useState2 = _slicedToArray(_useState, 2),
|
|
3916
3871
|
loadingError = _useState2[0],
|
|
3917
3872
|
setLoadingError = _useState2[1];
|
|
3918
|
-
const prefixSearchFields = useMemo(() => [
|
|
3873
|
+
const prefixSearchFields = useMemo(() => [`name.${dataLocale}`, 'key'], [dataLocale]);
|
|
3919
3874
|
const loadOptions = useLoadOptions({
|
|
3920
3875
|
query: GetStatesQuery,
|
|
3921
3876
|
variables,
|
|
@@ -3948,13 +3903,13 @@ const StatePickerInput = _ref => {
|
|
|
3948
3903
|
setLoadingError(null);
|
|
3949
3904
|
handleInternalInputChange(event);
|
|
3950
3905
|
}, [handleInternalInputChange]);
|
|
3951
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
3906
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
3952
3907
|
useEffect(() => {
|
|
3953
3908
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
3954
3909
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
3955
3910
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
3956
3911
|
const handleNoOptions = useCallback(() => loadingError ? null : formatMessage(messages$C.noStatesFound), [loadingError, formatMessage]);
|
|
3957
|
-
const tooltipTitle =
|
|
3912
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
3958
3913
|
return jsx(Constraints.Horizontal, {
|
|
3959
3914
|
max: "scale",
|
|
3960
3915
|
children: currentOption.loading ? jsx(CenteredLoadingSpinner, {}) : jsxs(Spacings.Stack, {
|
|
@@ -4019,26 +3974,23 @@ const CustomFieldTooltip = _ref => {
|
|
|
4019
3974
|
|
|
4020
3975
|
const setToArray = function () {
|
|
4021
3976
|
let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4022
|
-
return
|
|
3977
|
+
return `id in (${_mapInstanceProperty(values).call(values, value => `"${value}"`).join(', ')})`;
|
|
4023
3978
|
};
|
|
4024
3979
|
|
|
4025
3980
|
function capitalizeFirst(text) {
|
|
4026
3981
|
return text.charAt(0).toUpperCase() + _sliceInstanceProperty(text).call(text, 1);
|
|
4027
3982
|
}
|
|
4028
3983
|
|
|
4029
|
-
const getCentAmountClause = (value, operator, locale) => {
|
|
4030
|
-
var _context;
|
|
4031
|
-
return _concatInstanceProperty(_context = "centAmount ".concat(operator, " ")).call(_context, MoneyInput.convertToMoneyValue(value, locale).centAmount);
|
|
4032
|
-
};
|
|
3984
|
+
const getCentAmountClause = (value, operator, locale) => `centAmount ${operator} ${MoneyInput.convertToMoneyValue(value, locale).centAmount}`;
|
|
4033
3985
|
function moneyTransformer(value, option, locale) {
|
|
4034
3986
|
const clauses = [];
|
|
4035
3987
|
if (option === FILTER_TYPES.range) {
|
|
4036
|
-
clauses[0] =
|
|
3988
|
+
clauses[0] = `currencyCode = "${value.from.currencyCode}"`;
|
|
4037
3989
|
clauses[1] = getCentAmountClause(value.from, '>=', locale);
|
|
4038
3990
|
clauses[2] = getCentAmountClause(value.to, '<=', locale);
|
|
4039
3991
|
return clauses.join(' and ');
|
|
4040
3992
|
}
|
|
4041
|
-
clauses[0] =
|
|
3993
|
+
clauses[0] = `currencyCode = "${value.currencyCode}"`;
|
|
4042
3994
|
switch (option) {
|
|
4043
3995
|
case FILTER_TYPES.lessThan:
|
|
4044
3996
|
clauses[1] = getCentAmountClause(value, '<', locale);
|
|
@@ -4055,7 +4007,6 @@ function moneyTransformer(value, option, locale) {
|
|
|
4055
4007
|
return clauses.join(' and ');
|
|
4056
4008
|
}
|
|
4057
4009
|
|
|
4058
|
-
var _templateObject$2, _templateObject2$1;
|
|
4059
4010
|
const formatTime = 'HH:mm:ss.SSS';
|
|
4060
4011
|
|
|
4061
4012
|
/* TimeInput only allows HH:mm:ss and adds the seconds as 00 and
|
|
@@ -4077,7 +4028,6 @@ const defaultFilterValidator = _ref => {
|
|
|
4077
4028
|
const timeTransformer = function (filterKey, filters) {
|
|
4078
4029
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator;
|
|
4079
4030
|
const queries = _mapInstanceProperty(filters).call(filters, _ref2 => {
|
|
4080
|
-
var _context, _context2;
|
|
4081
4031
|
let type = _ref2.type,
|
|
4082
4032
|
value = _ref2.value;
|
|
4083
4033
|
if (!filterValidator({
|
|
@@ -4086,13 +4036,19 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4086
4036
|
})) return '';
|
|
4087
4037
|
switch (type) {
|
|
4088
4038
|
case FILTER_TYPES.lessThan:
|
|
4089
|
-
return
|
|
4039
|
+
return `${filterKey} < "${value}"`;
|
|
4090
4040
|
case FILTER_TYPES.moreThan:
|
|
4091
|
-
return
|
|
4041
|
+
return `${filterKey} > "${value}"`;
|
|
4092
4042
|
case FILTER_TYPES.equalTo:
|
|
4093
|
-
return oneLine
|
|
4043
|
+
return oneLine`
|
|
4044
|
+
(${filterKey} >= "${value}"
|
|
4045
|
+
and ${filterKey} <= "${getEndOfSecond(value)}")
|
|
4046
|
+
`;
|
|
4094
4047
|
case FILTER_TYPES.range:
|
|
4095
|
-
return oneLine
|
|
4048
|
+
return oneLine`
|
|
4049
|
+
(${filterKey} >= "${value.from}"
|
|
4050
|
+
and ${filterKey} <= "${getEndOfSecond(value.to)}")
|
|
4051
|
+
`;
|
|
4096
4052
|
default:
|
|
4097
4053
|
return '';
|
|
4098
4054
|
}
|
|
@@ -4108,7 +4064,7 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4108
4064
|
* (pickUpTime >= "14:00" and pickUpTime <= "15:00")
|
|
4109
4065
|
* ) or some_more_filters
|
|
4110
4066
|
*/
|
|
4111
|
-
return queryString === '' ? null :
|
|
4067
|
+
return queryString === '' ? null : `(${queryString})`;
|
|
4112
4068
|
};
|
|
4113
4069
|
|
|
4114
4070
|
// FIXME: delete once prefix search is supported in ctp api
|
|
@@ -4125,9 +4081,8 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
4125
4081
|
// e.g
|
|
4126
4082
|
// where: `masterData(current(name(en >= "${lowerBound}" and en < "${upperBound}")))`
|
|
4127
4083
|
const getPrefixSearchBounds = input => {
|
|
4128
|
-
var _context;
|
|
4129
4084
|
const getNextCharacter = character => String.fromCharCode(character.charCodeAt() + 1);
|
|
4130
|
-
return [input,
|
|
4085
|
+
return [input, `${_sliceInstanceProperty(input).call(input, 0, input.length - 1)}${getNextCharacter(_sliceInstanceProperty(input).call(input, input.length - 1))}`];
|
|
4131
4086
|
};
|
|
4132
4087
|
|
|
4133
4088
|
const _excluded = ["action"];
|
|
@@ -4320,7 +4275,7 @@ const convertChangeValueAction = actionPayload => {
|
|
|
4320
4275
|
* as its dynamic content can not be typed in SDL for the mutation.
|
|
4321
4276
|
*/
|
|
4322
4277
|
const convertAction = (actionName, actionPayload) => {
|
|
4323
|
-
var
|
|
4278
|
+
var _context3, _context4, _context5;
|
|
4324
4279
|
const getNameFromPayload = payload => {
|
|
4325
4280
|
// changeName for `Organizations`
|
|
4326
4281
|
if (typeof payload.name === 'string') return payload;
|
|
@@ -4378,7 +4333,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4378
4333
|
case 'setCustomType':
|
|
4379
4334
|
return {
|
|
4380
4335
|
[actionName]: {
|
|
4381
|
-
typeId:
|
|
4336
|
+
typeId: actionPayload.type?.id,
|
|
4382
4337
|
fields: actionPayload.fields ? _mapInstanceProperty(_context3 = _Object$entries(actionPayload.fields)).call(_context3, _ref => {
|
|
4383
4338
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
4384
4339
|
customField = _ref2[0],
|
|
@@ -4408,10 +4363,10 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4408
4363
|
};
|
|
4409
4364
|
case 'setGeoLocation':
|
|
4410
4365
|
return {
|
|
4411
|
-
[actionName]: actionPayload
|
|
4366
|
+
[actionName]: actionPayload?.geoLocation ? {
|
|
4412
4367
|
geoLocation: {
|
|
4413
4368
|
type: 'Point',
|
|
4414
|
-
coordinates: [_parseFloat(
|
|
4369
|
+
coordinates: [_parseFloat(actionPayload.geoLocation?.longitude), _parseFloat(actionPayload.geoLocation?.latitude)]
|
|
4415
4370
|
}
|
|
4416
4371
|
} : {
|
|
4417
4372
|
undefined
|
|
@@ -4547,7 +4502,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4547
4502
|
case 'setShippingRateInputType':
|
|
4548
4503
|
return {
|
|
4549
4504
|
[actionName]: {
|
|
4550
|
-
shippingRateInputType:
|
|
4505
|
+
shippingRateInputType: actionPayload.shippingRateInputType?.type ? {
|
|
4551
4506
|
[actionPayload.shippingRateInputType.type]: {
|
|
4552
4507
|
values: actionPayload.shippingRateInputType.type === 'CartClassification' ? _mapInstanceProperty(_context4 = _valuesInstanceProperty(actionPayload.shippingRateInputType)).call(_context4, value => ({
|
|
4553
4508
|
key: value.key,
|
|
@@ -4601,8 +4556,8 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4601
4556
|
case 'addAddress':
|
|
4602
4557
|
case 'changeAddress':
|
|
4603
4558
|
{
|
|
4604
|
-
var
|
|
4605
|
-
const _ref3 =
|
|
4559
|
+
var _context6;
|
|
4560
|
+
const _ref3 = actionPayload.address?.custom || {},
|
|
4606
4561
|
_ref3$fields = _ref3.fields,
|
|
4607
4562
|
fields = _ref3$fields === void 0 ? {} : _ref3$fields;
|
|
4608
4563
|
const customFields = isEmpty$3(fields) ? null : _mapInstanceProperty(_context6 = _Object$entries(fields)).call(_context6, _ref4 => {
|
|
@@ -4614,7 +4569,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4614
4569
|
value: _JSON$stringify(value)
|
|
4615
4570
|
};
|
|
4616
4571
|
});
|
|
4617
|
-
const custom =
|
|
4572
|
+
const custom = actionPayload.address?.custom?.type?.id ? {
|
|
4618
4573
|
type: {
|
|
4619
4574
|
id: actionPayload.address.custom.type.id
|
|
4620
4575
|
},
|
|
@@ -4645,7 +4600,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4645
4600
|
value: _JSON$stringify(value)
|
|
4646
4601
|
};
|
|
4647
4602
|
});
|
|
4648
|
-
const customType = type
|
|
4603
|
+
const customType = type?.id ? {
|
|
4649
4604
|
id: type.id
|
|
4650
4605
|
} : null;
|
|
4651
4606
|
return {
|
|
@@ -4668,11 +4623,10 @@ const createGraphQlUpdateActions = actions => _reduceInstanceProperty(actions).c
|
|
|
4668
4623
|
return [...previousActions, convertAction(actionName, actionPayload)];
|
|
4669
4624
|
}, []);
|
|
4670
4625
|
const extractErrorFromGraphQlResponse = graphQlResponse => {
|
|
4671
|
-
|
|
4672
|
-
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) {
|
|
4673
4627
|
return graphQlResponse.networkError.result.errors;
|
|
4674
4628
|
}
|
|
4675
|
-
if (
|
|
4629
|
+
if (graphQlResponse.graphQLErrors?.length > 0) {
|
|
4676
4630
|
return graphQlResponse.graphQLErrors;
|
|
4677
4631
|
}
|
|
4678
4632
|
return graphQlResponse;
|
|
@@ -4701,16 +4655,14 @@ function omitDeep(obj, fieldsToOmit) {
|
|
|
4701
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; }
|
|
4702
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; }
|
|
4703
4657
|
function getPriceChannelName(price) {
|
|
4704
|
-
|
|
4705
|
-
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;
|
|
4706
4659
|
}
|
|
4707
4660
|
function getDiscountValue(price) {
|
|
4708
|
-
var _price$value, _price$value2, _price$discounted;
|
|
4709
4661
|
let preciseAmount;
|
|
4710
4662
|
let fractionedAmount;
|
|
4711
|
-
if (
|
|
4663
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision && price.discounted.value.type === PRECISION_TYPES.highPrecision) {
|
|
4712
4664
|
preciseAmount = price.value.preciseAmount - price.discounted.value.preciseAmount;
|
|
4713
|
-
} else if (
|
|
4665
|
+
} else if (price.value?.type === PRECISION_TYPES.highPrecision && price.discounted?.value?.type === PRECISION_TYPES.centPrecision) {
|
|
4714
4666
|
fractionedAmount = getFractionedAmount(price.value) - getFractionedAmount(price.discounted.value);
|
|
4715
4667
|
}
|
|
4716
4668
|
return price.discounted ? _objectSpread$13(_objectSpread$13({}, price.value), {}, {
|
|
@@ -4724,28 +4676,23 @@ function getDiscountValue(price) {
|
|
|
4724
4676
|
function getSelectedPrice(price) {
|
|
4725
4677
|
return price.discounted ? price.discounted : price;
|
|
4726
4678
|
}
|
|
4727
|
-
function getNetUnitPrice(
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
shouldRoundAmount = _ref2.shouldRoundAmount;
|
|
4679
|
+
function getNetUnitPrice(_ref) {
|
|
4680
|
+
let lineItem = _ref.lineItem,
|
|
4681
|
+
shouldRoundAmount = _ref.shouldRoundAmount;
|
|
4731
4682
|
const price = getSelectedPrice(lineItem.price);
|
|
4732
|
-
const filteredPerMethodTaxRate = lineItem
|
|
4733
|
-
var _lineItem$shippingDet;
|
|
4734
|
-
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;
|
|
4735
|
-
});
|
|
4683
|
+
const filteredPerMethodTaxRate = lineItem?.perMethodTaxRate?.filter(perMethodTax => lineItem?.shippingDetails?.targets?.findIndex(target => target?.shippingMethodKey === perMethodTax?.shippingMethodKey) >= 0);
|
|
4736
4684
|
|
|
4737
4685
|
// when shipping mode is multi with the same tax rate
|
|
4738
|
-
if (
|
|
4739
|
-
var _price$value3, _price$value4;
|
|
4686
|
+
if (filteredPerMethodTaxRate?.length > 0 && filteredPerMethodTaxRate[0]?.taxRate?.includedInPrice) {
|
|
4740
4687
|
const taxRate = filteredPerMethodTaxRate[0].taxRate;
|
|
4741
4688
|
let centAmount;
|
|
4742
4689
|
// should accept 0 value
|
|
4743
|
-
if (typeof
|
|
4690
|
+
if (typeof price.value?.centAmount === 'number') {
|
|
4744
4691
|
const amount = price.value.centAmount / (1 + taxRate.amount);
|
|
4745
4692
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4746
4693
|
}
|
|
4747
4694
|
let preciseAmount;
|
|
4748
|
-
if (
|
|
4695
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + taxRate.amount);
|
|
4749
4696
|
return _objectSpread$13(_objectSpread$13({}, price.value), {}, {
|
|
4750
4697
|
centAmount,
|
|
4751
4698
|
preciseAmount
|
|
@@ -4754,15 +4701,14 @@ function getNetUnitPrice(_ref2) {
|
|
|
4754
4701
|
|
|
4755
4702
|
// when shipping mode is single
|
|
4756
4703
|
if (lineItem.taxRate && lineItem.taxRate.includedInPrice) {
|
|
4757
|
-
var _price$value5, _price$value6;
|
|
4758
4704
|
let centAmount;
|
|
4759
4705
|
// should accept 0 value
|
|
4760
|
-
if (typeof
|
|
4706
|
+
if (typeof price.value?.centAmount === 'number') {
|
|
4761
4707
|
const amount = price.value.centAmount / (1 + lineItem.taxRate.amount);
|
|
4762
4708
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4763
4709
|
}
|
|
4764
4710
|
let preciseAmount;
|
|
4765
|
-
if (
|
|
4711
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + lineItem.taxRate.amount);
|
|
4766
4712
|
return _objectSpread$13(_objectSpread$13({}, price.value), {}, {
|
|
4767
4713
|
centAmount,
|
|
4768
4714
|
preciseAmount
|
|
@@ -4796,18 +4742,18 @@ const transformCustomFieldFromGraphQLResponse = resource => {
|
|
|
4796
4742
|
key: resource.custom.type.key,
|
|
4797
4743
|
name: transformLocalizedFieldToLocalizedString(resource.custom.type.nameAllLocales),
|
|
4798
4744
|
fieldDefinitions: _mapInstanceProperty(_context = resource.custom.type.fieldDefinitions).call(_context, fieldDefinition => {
|
|
4799
|
-
var
|
|
4745
|
+
var _context2, _context3;
|
|
4800
4746
|
return {
|
|
4801
4747
|
name: fieldDefinition.name,
|
|
4802
4748
|
required: fieldDefinition.required,
|
|
4803
|
-
type:
|
|
4749
|
+
type: fieldDefinition.type?.elementType?.name === 'LocalizedEnum' ? _objectSpread$12(_objectSpread$12({}, fieldDefinition.type), {}, {
|
|
4804
4750
|
elementType: _objectSpread$12(_objectSpread$12({}, fieldDefinition.type.elementType), {}, {
|
|
4805
4751
|
values: _mapInstanceProperty(_context2 = _valuesInstanceProperty(fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
4806
4752
|
key: value.key,
|
|
4807
4753
|
label: transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
4808
4754
|
}))
|
|
4809
4755
|
})
|
|
4810
|
-
}) :
|
|
4756
|
+
}) : fieldDefinition.type?.name === 'LocalizedEnum' ? _objectSpread$12(_objectSpread$12({}, fieldDefinition.type), {}, {
|
|
4811
4757
|
values: _mapInstanceProperty(_context3 = _valuesInstanceProperty(fieldDefinition.type)).call(_context3, value => ({
|
|
4812
4758
|
key: value.key,
|
|
4813
4759
|
label: transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -4834,7 +4780,7 @@ const convertProductSelectionFromGraphQl = productSelection => {
|
|
|
4834
4780
|
from: 'nameAllLocales',
|
|
4835
4781
|
to: 'name'
|
|
4836
4782
|
}])), {}, {
|
|
4837
|
-
custom: productSelection
|
|
4783
|
+
custom: productSelection?.custom ? transformCustomFieldFromGraphQLResponse(productSelection) : null
|
|
4838
4784
|
});
|
|
4839
4785
|
};
|
|
4840
4786
|
|
|
@@ -4963,7 +4909,7 @@ let CustomFieldDefinitionsConnector = /*#__PURE__*/function (_Component) {
|
|
|
4963
4909
|
value: function componentDidMount() {
|
|
4964
4910
|
var _context;
|
|
4965
4911
|
const hasUnsupportedResource = _someInstanceProperty(_context = this.props.resources).call(_context, resource => !_includesInstanceProperty(customizableResources$1).call(customizableResources$1, resource));
|
|
4966
|
-
!!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;
|
|
4967
4913
|
}
|
|
4968
4914
|
}, {
|
|
4969
4915
|
key: "render",
|
|
@@ -4982,9 +4928,9 @@ CustomFieldDefinitionsConnector.displayName = 'CustomFieldDefinitionsConnector';
|
|
|
4982
4928
|
CustomFieldDefinitionsConnector.defaultProps = {
|
|
4983
4929
|
resources: []
|
|
4984
4930
|
};
|
|
4985
|
-
const stringifyResources$1 = resources => _mapInstanceProperty(resources).call(resources, resource => "
|
|
4931
|
+
const stringifyResources$1 = resources => _mapInstanceProperty(resources).call(resources, resource => `"${resource}"`).join();
|
|
4986
4932
|
const mapPropsToOptions = ownProps => {
|
|
4987
|
-
const where = ownProps.resources.length > 0 ?
|
|
4933
|
+
const where = ownProps.resources.length > 0 ? `resourceTypeIds contains any (${stringifyResources$1(ownProps.resources)})` : undefined;
|
|
4988
4934
|
return {
|
|
4989
4935
|
variables: {
|
|
4990
4936
|
where,
|
|
@@ -5053,19 +4999,19 @@ const graphQlDocToForm = typeDefinition => {
|
|
|
5053
4999
|
key: typeDefinition.key,
|
|
5054
5000
|
name: transformLocalizedFieldToLocalizedString(typeDefinition.nameAllLocales),
|
|
5055
5001
|
fieldDefinitions: _mapInstanceProperty(_context = typeDefinition.fieldDefinitions).call(_context, fieldDefinition => {
|
|
5056
|
-
var
|
|
5002
|
+
var _context2, _context3;
|
|
5057
5003
|
return {
|
|
5058
5004
|
name: fieldDefinition.name,
|
|
5059
5005
|
required: fieldDefinition.required,
|
|
5060
5006
|
inputHint: fieldDefinition.inputHint,
|
|
5061
|
-
type:
|
|
5007
|
+
type: fieldDefinition.type?.elementType?.name === 'LocalizedEnum' ? _objectSpread$$(_objectSpread$$({}, fieldDefinition.type), {}, {
|
|
5062
5008
|
elementType: _objectSpread$$(_objectSpread$$({}, fieldDefinition.type.elementType), {}, {
|
|
5063
5009
|
values: _mapInstanceProperty(_context2 = _valuesInstanceProperty(fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
5064
5010
|
key: value.key,
|
|
5065
5011
|
label: transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
5066
5012
|
}))
|
|
5067
5013
|
})
|
|
5068
|
-
}) :
|
|
5014
|
+
}) : fieldDefinition.type?.name === 'LocalizedEnum' ? _objectSpread$$(_objectSpread$$({}, fieldDefinition.type), {}, {
|
|
5069
5015
|
values: _mapInstanceProperty(_context3 = _valuesInstanceProperty(fieldDefinition.type)).call(_context3, value => ({
|
|
5070
5016
|
key: value.key,
|
|
5071
5017
|
label: transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -5097,7 +5043,7 @@ const formToGraphQlDoc = formCustomFields => ({
|
|
|
5097
5043
|
// TODO(pa3): find usages and make sure only 1 param is passed
|
|
5098
5044
|
const createEmptyCustomFields = typeDefinition => ({
|
|
5099
5045
|
fields: {},
|
|
5100
|
-
type:
|
|
5046
|
+
type: typeDefinition?.type || {
|
|
5101
5047
|
fieldDefinitions: []
|
|
5102
5048
|
}
|
|
5103
5049
|
});
|
|
@@ -5123,7 +5069,7 @@ let CustomFieldTypeDefinitionsConnector = /*#__PURE__*/function (_Component) {
|
|
|
5123
5069
|
value: function componentDidMount() {
|
|
5124
5070
|
var _context;
|
|
5125
5071
|
const hasUnsupportedResource = _someInstanceProperty(_context = this.props.resources).call(_context, resource => !_includesInstanceProperty(customizableResources).call(customizableResources, resource));
|
|
5126
|
-
!!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;
|
|
5127
5073
|
}
|
|
5128
5074
|
}, {
|
|
5129
5075
|
key: "render",
|
|
@@ -5148,9 +5094,9 @@ CustomFieldTypeDefinitionsConnector.graphQlDocToForm = graphQlDocToForm;
|
|
|
5148
5094
|
CustomFieldTypeDefinitionsConnector.formToRestDoc = formToRestDoc;
|
|
5149
5095
|
CustomFieldTypeDefinitionsConnector.formToGraphQlDoc = formToGraphQlDoc;
|
|
5150
5096
|
CustomFieldTypeDefinitionsConnector.createEmptyCustomFields = createEmptyCustomFields;
|
|
5151
|
-
const stringifyResources = resources => _mapInstanceProperty(resources).call(resources, resource => "
|
|
5097
|
+
const stringifyResources = resources => _mapInstanceProperty(resources).call(resources, resource => `"${resource}"`).join();
|
|
5152
5098
|
const createGraphQlOptions = ownProps => {
|
|
5153
|
-
const where = ownProps.resources.length > 0 ?
|
|
5099
|
+
const where = ownProps.resources.length > 0 ? `resourceTypeIds contains any (${stringifyResources(ownProps.resources)})` : undefined;
|
|
5154
5100
|
return {
|
|
5155
5101
|
variables: {
|
|
5156
5102
|
where,
|
|
@@ -5226,7 +5172,7 @@ const extractDuplicatedValues = (values, type, language, languages) => {
|
|
|
5226
5172
|
let validatedValues = [];
|
|
5227
5173
|
if (type.name.toLowerCase() === 'money') {
|
|
5228
5174
|
validatedValues = unique(values, ['amount', 'currencyCode']);
|
|
5229
|
-
} 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') {
|
|
5230
5176
|
validatedValues = unique(values, languages);
|
|
5231
5177
|
} else validatedValues = unique(values);
|
|
5232
5178
|
return validatedValues;
|
|
@@ -5442,7 +5388,6 @@ const getSubfieldLanguage = subfieldName => {
|
|
|
5442
5388
|
return subfieldName.substring(lastDotIndex + 1);
|
|
5443
5389
|
};
|
|
5444
5390
|
function CustomLocalizedTextInput(props) {
|
|
5445
|
-
var _value$language;
|
|
5446
5391
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
5447
5392
|
language: applicationContext.dataLocale,
|
|
5448
5393
|
languages: applicationContext.project.languages
|
|
@@ -5467,7 +5412,7 @@ function CustomLocalizedTextInput(props) {
|
|
|
5467
5412
|
props.setFieldValue(props.name, nullifiedIfNeeded);
|
|
5468
5413
|
});
|
|
5469
5414
|
const InputComponent = isMultiLine ? LocalizedMultilineTextInput : LocalizedTextInput;
|
|
5470
|
-
const tooltipTitle = isMultiLine ? '' : value ?
|
|
5415
|
+
const tooltipTitle = isMultiLine ? '' : value ? value[language] ?? '' : '';
|
|
5471
5416
|
return jsx(CustomFieldTooltip, {
|
|
5472
5417
|
title: tooltipTitle,
|
|
5473
5418
|
children: jsx(InputComponent, {
|
|
@@ -5511,8 +5456,7 @@ function CustomBooleanInput(props) {
|
|
|
5511
5456
|
CustomBooleanInput.displayName = 'CustomBooleanInput';
|
|
5512
5457
|
|
|
5513
5458
|
function CustomNumberInput(props) {
|
|
5514
|
-
|
|
5515
|
-
const value = (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : '';
|
|
5459
|
+
const value = props.value ?? '';
|
|
5516
5460
|
const handleChange = makeChangeHandler(rawValue => props.setFieldValue(props.name, !rawValue ? undefined : Number(rawValue)));
|
|
5517
5461
|
return jsx(NumberInput, {
|
|
5518
5462
|
id: props.name,
|
|
@@ -5557,7 +5501,7 @@ const fixAmount = value => {
|
|
|
5557
5501
|
// data user just entered effectively preventing full data from being entered.
|
|
5558
5502
|
const fixEnteredValue = (newValue, initialValue, currencies) => {
|
|
5559
5503
|
const withFixedCurrency = fixCurrencyCode(newValue, currencies);
|
|
5560
|
-
if (!
|
|
5504
|
+
if (!initialValue?.amount) {
|
|
5561
5505
|
return fixAmount(withFixedCurrency);
|
|
5562
5506
|
}
|
|
5563
5507
|
return withFixedCurrency;
|
|
@@ -5623,13 +5567,12 @@ const convertTypeValuesToOptions$1 = defaultMemoize((type, dataLocale, languages
|
|
|
5623
5567
|
key: 'label',
|
|
5624
5568
|
locale: dataLocale,
|
|
5625
5569
|
fallbackOrder: languages,
|
|
5626
|
-
fallback:
|
|
5570
|
+
fallback: `${value.key} (key)`
|
|
5627
5571
|
}),
|
|
5628
5572
|
value: value.key
|
|
5629
5573
|
}));
|
|
5630
5574
|
});
|
|
5631
5575
|
function CustomLocalizedEnumInput(props) {
|
|
5632
|
-
var _options$find$label, _options$find;
|
|
5633
5576
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
5634
5577
|
languages: applicationContext.project.languages,
|
|
5635
5578
|
dataLocale: applicationContext.dataLocale
|
|
@@ -5638,7 +5581,7 @@ function CustomLocalizedEnumInput(props) {
|
|
|
5638
5581
|
dataLocale = _useApplicationContex.dataLocale;
|
|
5639
5582
|
const options = convertTypeValuesToOptions$1(props.fieldDefinition.type, dataLocale, languages);
|
|
5640
5583
|
const handleChange = makeChangeHandler(rawValue => props.setFieldValue(props.name, rawValue));
|
|
5641
|
-
const tooltipTitle = props.value ?
|
|
5584
|
+
const tooltipTitle = props.value ? _findInstanceProperty(options).call(options, option => option.value === props.value)?.label ?? '' : '';
|
|
5642
5585
|
return jsx(CustomFieldTooltip, {
|
|
5643
5586
|
title: tooltipTitle,
|
|
5644
5587
|
children: jsx(SelectInput, {
|
|
@@ -5658,8 +5601,7 @@ function CustomLocalizedEnumInput(props) {
|
|
|
5658
5601
|
CustomLocalizedEnumInput.displayName = 'CustomLocalizedEnumInput';
|
|
5659
5602
|
|
|
5660
5603
|
function CustomRawIdReferenceInput(props) {
|
|
5661
|
-
|
|
5662
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
5604
|
+
const value = props.value?.id || '';
|
|
5663
5605
|
return jsx(CustomFieldTooltip, {
|
|
5664
5606
|
title: value,
|
|
5665
5607
|
children: jsx(TextInput, {
|
|
@@ -5704,7 +5646,7 @@ function getCategoriesByIds(apolloClient, options) {
|
|
|
5704
5646
|
return apolloClient.query({
|
|
5705
5647
|
query: FetchCategoriesByIds,
|
|
5706
5648
|
variables: {
|
|
5707
|
-
where:
|
|
5649
|
+
where: `id in (${_mapInstanceProperty(_context2 = options.ids).call(_context2, id => `"${id}"`).join(', ')})`
|
|
5708
5650
|
},
|
|
5709
5651
|
context: {
|
|
5710
5652
|
target: GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -5803,13 +5745,10 @@ const useReferenceSearchItems = _ref => {
|
|
|
5803
5745
|
};
|
|
5804
5746
|
};
|
|
5805
5747
|
function ReferenceSearch(props) {
|
|
5806
|
-
const ids = useMemo(() => {
|
|
5807
|
-
|
|
5808
|
-
return
|
|
5809
|
-
|
|
5810
|
-
return id;
|
|
5811
|
-
}) : [(_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.id] : [];
|
|
5812
|
-
}, [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]);
|
|
5813
5752
|
const _useReferenceSearchIt = useReferenceSearchItems({
|
|
5814
5753
|
loadItemsBySearchTerm: props.loadItemsBySearchTerm,
|
|
5815
5754
|
loadItemsByIds: props.loadItemsByIds,
|
|
@@ -5820,14 +5759,14 @@ function ReferenceSearch(props) {
|
|
|
5820
5759
|
areSomeItemsMissing = _useReferenceSearchIt.areSomeItemsMissing,
|
|
5821
5760
|
handleLoadItems = _useReferenceSearchIt.handleLoadItems;
|
|
5822
5761
|
if (areItemsLoading) return null;
|
|
5823
|
-
const value = props.isMulti ? items : items
|
|
5762
|
+
const value = props.isMulti ? items : items?.[0];
|
|
5824
5763
|
let filterValue = null;
|
|
5825
5764
|
if (value) filterValue = props.isMulti ? _mapInstanceProperty(value).call(value, props.mapItemToOption) : props.mapItemToOption(value);
|
|
5826
5765
|
const tooltipTitle = value || props.value ? props.mapItemToOption(value || props.value).label : '';
|
|
5827
5766
|
const loadItems = value => _Promise.resolve(handleLoadItems(value)).then(items => _mapInstanceProperty(items).call(items, item => props.mapItemToOption(item)));
|
|
5828
5767
|
const handleChange = event => {
|
|
5829
|
-
var _context
|
|
5830
|
-
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;
|
|
5831
5770
|
props.onChange(option);
|
|
5832
5771
|
};
|
|
5833
5772
|
return jsxs("div", {
|
|
@@ -5898,9 +5837,8 @@ const messages$B = defineMessages({
|
|
|
5898
5837
|
});
|
|
5899
5838
|
|
|
5900
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; }
|
|
5901
|
-
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; }
|
|
5902
5841
|
function Option$1(props) {
|
|
5903
|
-
var _context, _context2;
|
|
5904
5842
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
5905
5843
|
language: applicationContext.dataLocale,
|
|
5906
5844
|
languages: applicationContext.project.languages
|
|
@@ -5921,19 +5859,19 @@ function Option$1(props) {
|
|
|
5921
5859
|
fallbackOrder: languages
|
|
5922
5860
|
})
|
|
5923
5861
|
}), category.parent && jsx(Text.Detail, {
|
|
5924
|
-
children:
|
|
5862
|
+
children: `${formatMessage(messages$B.parentCategory)}: ${formatLocalizedString(category.parent, {
|
|
5925
5863
|
key: 'name',
|
|
5926
5864
|
locale: language,
|
|
5927
5865
|
fallbackOrder: languages
|
|
5928
|
-
})
|
|
5866
|
+
})}`
|
|
5929
5867
|
}), jsx(Text.Detail, {
|
|
5930
|
-
children:
|
|
5868
|
+
children: `Slug: ${formatLocalizedString(category, {
|
|
5931
5869
|
key: 'slug',
|
|
5932
5870
|
locale: language,
|
|
5933
5871
|
fallbackOrder: languages
|
|
5934
|
-
})
|
|
5872
|
+
})}`
|
|
5935
5873
|
}), category.externalId && jsx(Text.Detail, {
|
|
5936
|
-
children:
|
|
5874
|
+
children: `${formatMessage(messages$B.externalId)}: ${category.externalId || NO_VALUE_FALLBACK}`
|
|
5937
5875
|
})]
|
|
5938
5876
|
})
|
|
5939
5877
|
}));
|
|
@@ -5996,7 +5934,7 @@ var CategorySearchPickerOptionFragment$1 = { kind: "Document", definitions: [{ k
|
|
|
5996
5934
|
function useCachedCategoryOptions(ids) {
|
|
5997
5935
|
const apolloClient = useApolloClient$1();
|
|
5998
5936
|
const fragments = _mapInstanceProperty(ids).call(ids, id => apolloClient.readFragment({
|
|
5999
|
-
id:
|
|
5937
|
+
id: `CategorySearch:${id}`,
|
|
6000
5938
|
fragment: CategorySearchPickerOptionFragment$1
|
|
6001
5939
|
}));
|
|
6002
5940
|
return _mapInstanceProperty(fragments).call(fragments, category => transformLocalizedFieldsForCategory(category, [{
|
|
@@ -6011,8 +5949,8 @@ function useCachedCategoryOptions(ids) {
|
|
|
6011
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 } } } };
|
|
6012
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 } } } };
|
|
6013
5951
|
const transformCartDiscountResponse = response => {
|
|
6014
|
-
var _context
|
|
6015
|
-
return _mapInstanceProperty(_context =
|
|
5952
|
+
var _context;
|
|
5953
|
+
return _mapInstanceProperty(_context = response.data?.cartDiscounts.results || []).call(_context, cartDiscount => transformLocalizedFieldsForCartDiscount(cartDiscount));
|
|
6016
5954
|
};
|
|
6017
5955
|
function queryCartDiscounts(apolloClient) {
|
|
6018
5956
|
return apolloClient.query({
|
|
@@ -6024,14 +5962,14 @@ function queryCartDiscounts(apolloClient) {
|
|
|
6024
5962
|
}).then(transformCartDiscountResponse);
|
|
6025
5963
|
}
|
|
6026
5964
|
const getWhereClause = function () {
|
|
6027
|
-
var _context2, _context3
|
|
5965
|
+
var _context2, _context3;
|
|
6028
5966
|
let searchText = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
6029
5967
|
let language = arguments.length > 1 ? arguments[1] : undefined;
|
|
6030
5968
|
const query = _trimInstanceProperty(_context2 = _JSON$stringify(searchText)).call(_context2);
|
|
6031
|
-
const idQuery = isUUID(searchText) &&
|
|
6032
|
-
const nameQuery =
|
|
6033
|
-
const keyQuery =
|
|
6034
|
-
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 ');
|
|
6035
5973
|
};
|
|
6036
5974
|
function searchCartDiscountsByExactMatch(apolloClient, options) {
|
|
6037
5975
|
return apolloClient.query({
|
|
@@ -6054,10 +5992,7 @@ function getCartDiscountById(apolloClient, options) {
|
|
|
6054
5992
|
context: {
|
|
6055
5993
|
target: GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
6056
5994
|
}
|
|
6057
|
-
}).then(response =>
|
|
6058
|
-
var _response$data2;
|
|
6059
|
-
return (_response$data2 = response.data) !== null && _response$data2 !== void 0 && _response$data2.cartDiscount ? transformLocalizedFieldsForCartDiscount(response.data.cartDiscount) : null;
|
|
6060
|
-
});
|
|
5995
|
+
}).then(response => response.data?.cartDiscount ? transformLocalizedFieldsForCartDiscount(response.data.cartDiscount) : null);
|
|
6061
5996
|
}
|
|
6062
5997
|
|
|
6063
5998
|
const messages$A = defineMessages({
|
|
@@ -6134,7 +6069,7 @@ function CartDiscountReferenceSearch(props) {
|
|
|
6134
6069
|
}),
|
|
6135
6070
|
loading = _useQuery.loading,
|
|
6136
6071
|
data = _useQuery.data;
|
|
6137
|
-
const isExactMatch =
|
|
6072
|
+
const isExactMatch = data?.cartDiscounts.total > QUERY_MAX_LIMIT;
|
|
6138
6073
|
const _useIntl = useIntl(),
|
|
6139
6074
|
formatMessage = _useIntl.formatMessage;
|
|
6140
6075
|
const apolloClient = useApolloClient$1();
|
|
@@ -6271,7 +6206,6 @@ const DropdownIndicator = () => jsx(SearchIcon, {
|
|
|
6271
6206
|
});
|
|
6272
6207
|
DropdownIndicator.displayName = 'DropdownIndicator';
|
|
6273
6208
|
const ProductPickerInput = _ref => {
|
|
6274
|
-
var _currentOption$data$l, _currentOption$data;
|
|
6275
6209
|
let isClearable = _ref.isClearable,
|
|
6276
6210
|
isDisabled = _ref.isDisabled,
|
|
6277
6211
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -6291,20 +6225,19 @@ const ProductPickerInput = _ref => {
|
|
|
6291
6225
|
loadingError = _useState2[0],
|
|
6292
6226
|
setLoadingError = _useState2[1];
|
|
6293
6227
|
const convertProductToOption = useCallback(product => {
|
|
6294
|
-
var _masterData$current;
|
|
6295
6228
|
if (!product) return null;
|
|
6296
6229
|
const id = product.id,
|
|
6297
6230
|
key = product.key,
|
|
6298
6231
|
masterData = product.masterData;
|
|
6299
|
-
const localizedName = formatLocalizedFieldToString(
|
|
6232
|
+
const localizedName = formatLocalizedFieldToString(masterData.current?.nameAllLocales);
|
|
6300
6233
|
return {
|
|
6301
|
-
label: localizedName + (key ?
|
|
6234
|
+
label: localizedName + (key ? ` (key: ${key})` : ''),
|
|
6302
6235
|
value: id,
|
|
6303
6236
|
name: localizedName,
|
|
6304
6237
|
key
|
|
6305
6238
|
};
|
|
6306
6239
|
}, [formatLocalizedFieldToString]);
|
|
6307
|
-
const prefixSearchFields = useMemo(() => [
|
|
6240
|
+
const prefixSearchFields = useMemo(() => [`masterData.current.name.${dataLocale}`, 'key'], [dataLocale]);
|
|
6308
6241
|
const loadOptions = useLoadOptions({
|
|
6309
6242
|
query: GetProductsQuery,
|
|
6310
6243
|
prefixSearchFields
|
|
@@ -6335,12 +6268,12 @@ const ProductPickerInput = _ref => {
|
|
|
6335
6268
|
setLoadingError(null);
|
|
6336
6269
|
handleInternalInputChange(event);
|
|
6337
6270
|
}, [handleInternalInputChange]);
|
|
6338
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
6271
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
6339
6272
|
useEffect(() => {
|
|
6340
6273
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
6341
6274
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
6342
6275
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
6343
|
-
const tooltipTitle =
|
|
6276
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
6344
6277
|
return jsx(Constraints.Horizontal, {
|
|
6345
6278
|
max: "scale",
|
|
6346
6279
|
children: currentOption.loading ? jsx(CenteredLoadingSpinner, {}) : jsxs(Spacings.Stack, {
|
|
@@ -6377,8 +6310,7 @@ const ProductPickerInput = _ref => {
|
|
|
6377
6310
|
ProductPickerInput.displayName = 'ProductPickerInput';
|
|
6378
6311
|
|
|
6379
6312
|
function CustomProductReferenceInput(props) {
|
|
6380
|
-
|
|
6381
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6313
|
+
const value = props.value?.id || '';
|
|
6382
6314
|
return jsx(ProductPickerInput, {
|
|
6383
6315
|
value: value,
|
|
6384
6316
|
name: props.name,
|
|
@@ -6395,8 +6327,7 @@ function CustomProductReferenceInput(props) {
|
|
|
6395
6327
|
CustomProductReferenceInput.displayName = 'CustomProductReferenceInput';
|
|
6396
6328
|
|
|
6397
6329
|
function CustomProductTypeReferenceInput(props) {
|
|
6398
|
-
|
|
6399
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6330
|
+
const value = props.value?.id || '';
|
|
6400
6331
|
return jsx(ProductTypePickerInput, {
|
|
6401
6332
|
value: value,
|
|
6402
6333
|
name: props.name,
|
|
@@ -6412,8 +6343,7 @@ function CustomProductTypeReferenceInput(props) {
|
|
|
6412
6343
|
CustomProductTypeReferenceInput.displayName = 'CustomProductTypeReferenceInput';
|
|
6413
6344
|
|
|
6414
6345
|
function CustomChannelReferenceInput(props) {
|
|
6415
|
-
|
|
6416
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6346
|
+
const value = props.value?.id || '';
|
|
6417
6347
|
return jsx(ChannelPickerInput, {
|
|
6418
6348
|
value: value,
|
|
6419
6349
|
name: props.name,
|
|
@@ -6429,8 +6359,7 @@ function CustomChannelReferenceInput(props) {
|
|
|
6429
6359
|
CustomChannelReferenceInput.displayName = 'CustomChannelReferenceInput';
|
|
6430
6360
|
|
|
6431
6361
|
function CustomStateReferenceInput(props) {
|
|
6432
|
-
|
|
6433
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
6362
|
+
const value = props.value?.id || '';
|
|
6434
6363
|
return jsx(StatePickerInput, {
|
|
6435
6364
|
value: value,
|
|
6436
6365
|
name: props.name,
|
|
@@ -6539,14 +6468,13 @@ function CustomTimeInput(props) {
|
|
|
6539
6468
|
CustomTimeInput.displayName = 'CustomTimeInput';
|
|
6540
6469
|
|
|
6541
6470
|
const convertTypeValuesToOptions = defaultMemoize(typeValues => _mapInstanceProperty(typeValues).call(typeValues, typeValue => ({
|
|
6542
|
-
label: typeValue.label ||
|
|
6471
|
+
label: typeValue.label || `${typeValue.key} (key)`,
|
|
6543
6472
|
value: typeValue.key
|
|
6544
6473
|
})));
|
|
6545
6474
|
function CustomEnumInput(props) {
|
|
6546
|
-
var _options$find$label, _options$find;
|
|
6547
6475
|
const options = convertTypeValuesToOptions(_valuesInstanceProperty(props.fieldDefinition.type));
|
|
6548
6476
|
const handleChange = makeChangeHandler(rawValue => props.setFieldValue(props.name, rawValue));
|
|
6549
|
-
const tooltipTitle = props.value ?
|
|
6477
|
+
const tooltipTitle = props.value ? _findInstanceProperty(options).call(options, option => option.value === props.value)?.label ?? '' : '';
|
|
6550
6478
|
return jsx(CustomFieldTooltip, {
|
|
6551
6479
|
title: tooltipTitle,
|
|
6552
6480
|
children: jsx(SelectInput, {
|
|
@@ -6618,9 +6546,9 @@ function ownKeys$P(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySy
|
|
|
6618
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; }
|
|
6619
6547
|
const getTypeName = type => type.name.toLowerCase();
|
|
6620
6548
|
const findLabel = (enumType, key) => {
|
|
6621
|
-
var
|
|
6549
|
+
var _context;
|
|
6622
6550
|
const emptyValue = getTypeName(enumType) === 'enum' ? '' : {};
|
|
6623
|
-
return
|
|
6551
|
+
return _findInstanceProperty(_context = _valuesInstanceProperty(enumType)).call(_context, value => value.key === key)?.label ?? emptyValue;
|
|
6624
6552
|
};
|
|
6625
6553
|
const convertEnumValues = (value, attributeDefinition) => {
|
|
6626
6554
|
var _context2, _context3;
|
|
@@ -6684,7 +6612,7 @@ const attributesMapToNameValuePairs = map => {
|
|
|
6684
6612
|
|
|
6685
6613
|
const getAttributeShortName = (fullName, attributesPrefix) => {
|
|
6686
6614
|
if (!attributesPrefix) return fullName;
|
|
6687
|
-
return fullName.replace(
|
|
6615
|
+
return fullName.replace(`${attributesPrefix}.`, '');
|
|
6688
6616
|
};
|
|
6689
6617
|
function ProductAttributes(props) {
|
|
6690
6618
|
const formik = useFormikContext();
|
|
@@ -6766,19 +6694,19 @@ function ownKeys$O(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySy
|
|
|
6766
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; }
|
|
6767
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 } } } };
|
|
6768
6696
|
const mapAttributeDefinition = definition => {
|
|
6769
|
-
var _context,
|
|
6697
|
+
var _context, _context2, _context3, _context4;
|
|
6770
6698
|
return _objectSpread$O(_objectSpread$O({}, definition), {}, {
|
|
6771
6699
|
required: definition.isRequired,
|
|
6772
6700
|
inputTip: transformLocalizedFieldToLocalizedString(definition.inputTipAllLocales),
|
|
6773
6701
|
label: transformLocalizedFieldToLocalizedString(definition.labelAllLocales),
|
|
6774
|
-
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), {}, {
|
|
6775
6703
|
elementType: _objectSpread$O(_objectSpread$O({}, definition.type.elementType), {}, {
|
|
6776
6704
|
values: _mapInstanceProperty(_context2 = _valuesInstanceProperty(definition.type.elementType).results).call(_context2, value => ({
|
|
6777
6705
|
key: value.key,
|
|
6778
6706
|
label: value.label || transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
6779
6707
|
}))
|
|
6780
6708
|
})
|
|
6781
|
-
}) : _includesInstanceProperty(_context3 = ['enum', 'lenum']).call(_context3,
|
|
6709
|
+
}) : _includesInstanceProperty(_context3 = ['enum', 'lenum']).call(_context3, definition.type?.name) ? _objectSpread$O(_objectSpread$O({}, definition.type), {}, {
|
|
6782
6710
|
values: _mapInstanceProperty(_context4 = _valuesInstanceProperty(definition.type).results).call(_context4, value => ({
|
|
6783
6711
|
key: value.key,
|
|
6784
6712
|
label: value.label || transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -7129,7 +7057,7 @@ const ExpandButton = props => props.totalValues > 1 ? jsxs(Spacings.Stack, {
|
|
|
7129
7057
|
}), jsx(FlatButton, {
|
|
7130
7058
|
tone: "primary",
|
|
7131
7059
|
icon: props.isExpanded ? jsx(AngleUpIcon, {}) : jsx(AngleDownIcon, {}),
|
|
7132
|
-
label: props.isExpanded ?
|
|
7060
|
+
label: props.isExpanded ? `Hide set items (${props.totalValues})` : `Show all set items (${props.totalValues})`,
|
|
7133
7061
|
onClick: props.onExpand
|
|
7134
7062
|
})]
|
|
7135
7063
|
}) : null;
|
|
@@ -7164,7 +7092,7 @@ const SetButtons = props => {
|
|
|
7164
7092
|
SetButtons.displayName = 'SetButtons';
|
|
7165
7093
|
|
|
7166
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; }
|
|
7167
|
-
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; }
|
|
7168
7096
|
const getDuplicateErrors = setValues => {
|
|
7169
7097
|
/* eslint-disable no-plusplus */
|
|
7170
7098
|
const result = [];
|
|
@@ -7205,13 +7133,10 @@ const getItemIndex = name => {
|
|
|
7205
7133
|
return _parseInt(rawIndex, 10);
|
|
7206
7134
|
};
|
|
7207
7135
|
const makeKeys = amount => times(amount, () => v4());
|
|
7208
|
-
const makeItemFieldName = (fieldName, index) => {
|
|
7209
|
-
var _context;
|
|
7210
|
-
return _concatInstanceProperty(_context = "".concat(fieldName, ".[")).call(_context, index, "]");
|
|
7211
|
-
};
|
|
7136
|
+
const makeItemFieldName = (fieldName, index) => `${fieldName}.[${index}]`;
|
|
7212
7137
|
const makeMapForAllItems = (fieldName, items, value) => _reduceInstanceProperty(items).call(items, (result, item, index) => set(result, makeItemFieldName(fieldName, index), value), {});
|
|
7213
7138
|
function CustomInputSet(props) {
|
|
7214
|
-
var
|
|
7139
|
+
var _context;
|
|
7215
7140
|
const _useToggleState = useToggleState(false),
|
|
7216
7141
|
_useToggleState2 = _slicedToArray(_useToggleState, 2),
|
|
7217
7142
|
isExpanded = _useToggleState2[0],
|
|
@@ -7233,7 +7158,7 @@ function CustomInputSet(props) {
|
|
|
7233
7158
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
7234
7159
|
keys = _useState4[0],
|
|
7235
7160
|
setKeys = _useState4[1];
|
|
7236
|
-
const totalAmount = internalValue
|
|
7161
|
+
const totalAmount = internalValue?.length;
|
|
7237
7162
|
const amountToRender = isExpanded ? totalAmount : 1;
|
|
7238
7163
|
const updateInternalValue = newValue => {
|
|
7239
7164
|
const valueToSet = isEmpty$1(newValue) ? [undefined] : newValue;
|
|
@@ -7280,8 +7205,8 @@ function CustomInputSet(props) {
|
|
|
7280
7205
|
// in <CustomFieldComponent /> where proper component for given field/attribute
|
|
7281
7206
|
// type is selected.
|
|
7282
7207
|
const type = getType(props.fieldDefinition);
|
|
7283
|
-
const typeName = type
|
|
7284
|
-
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);
|
|
7285
7210
|
return jsxs(Fragment, {
|
|
7286
7211
|
children: [jsx(AccessibleHidden, {
|
|
7287
7212
|
children: jsx("label", {
|
|
@@ -7359,14 +7284,12 @@ const nonSetComponents = {
|
|
|
7359
7284
|
};
|
|
7360
7285
|
const CustomFieldInput = /*#__PURE__*/memo(props => {
|
|
7361
7286
|
const InputComponent = useMemo(() => {
|
|
7362
|
-
|
|
7363
|
-
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();
|
|
7364
7288
|
if (typeName === 'set') {
|
|
7365
|
-
var _getSetElementType;
|
|
7366
7289
|
// Boolean is the only set element with peculiarities (i.e. way more
|
|
7367
7290
|
// convenient for user to work with it as with select input with three values:
|
|
7368
7291
|
// [true], [false] and [true, false]).
|
|
7369
|
-
if (
|
|
7292
|
+
if (getType(props.fieldDefinition)?.name.toLowerCase() === CUSTOM_FIELD_TYPES.boolean) {
|
|
7370
7293
|
return CustomBooleanInputSet;
|
|
7371
7294
|
}
|
|
7372
7295
|
// All the rest sets are just a fancy wrapper around single-item components
|
|
@@ -7457,9 +7380,9 @@ const CustomFieldErrors = props => {
|
|
|
7457
7380
|
const didFormValidationFail = useDidFormValidationFail();
|
|
7458
7381
|
const errors = _Array$isArray(props.errors) ? mergeSetItemsErrors(props.errors) : props.errors;
|
|
7459
7382
|
return jsxs(Fragment, {
|
|
7460
|
-
children: [props.isTouched || didFormValidationFail &&
|
|
7383
|
+
children: [props.isTouched || didFormValidationFail && errors?.missing && jsx(ErrorMessage, {
|
|
7461
7384
|
intlMessage: messages$K.required
|
|
7462
|
-
}), props.isTouched || didFormValidationFail &&
|
|
7385
|
+
}), props.isTouched || didFormValidationFail && errors?.duplicated && jsx(ErrorMessage, {
|
|
7463
7386
|
intlMessage: messages$K.unique
|
|
7464
7387
|
})]
|
|
7465
7388
|
});
|
|
@@ -7509,10 +7432,9 @@ function _objectSpread$J(e) { for (var r = 1; r < arguments.length; r++) { var _
|
|
|
7509
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)."; }
|
|
7510
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 } } } };
|
|
7511
7434
|
const CustomFieldsLabelHint = _ref2 => {
|
|
7512
|
-
var _type$name;
|
|
7513
7435
|
let fieldDefinition = _ref2.fieldDefinition;
|
|
7514
7436
|
const type = getType(fieldDefinition);
|
|
7515
|
-
const isReference =
|
|
7437
|
+
const isReference = type.name?.toLowerCase() === 'reference';
|
|
7516
7438
|
const referenceTypeId = type.referenceTypeId;
|
|
7517
7439
|
const isCartDiscountsReference = isReference && referenceTypeId === SEARCHABLE_REFERENCES.cartDiscount;
|
|
7518
7440
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
@@ -7530,7 +7452,7 @@ const CustomFieldsLabelHint = _ref2 => {
|
|
|
7530
7452
|
data = _useQuery.data,
|
|
7531
7453
|
loading = _useQuery.loading;
|
|
7532
7454
|
if (loading) return null;
|
|
7533
|
-
if (
|
|
7455
|
+
if (data?.cartDiscounts.total > QUERY_MAX_LIMIT) {
|
|
7534
7456
|
return jsxs(Spacings.Inline, {
|
|
7535
7457
|
alignItems: "center",
|
|
7536
7458
|
children: [jsx(WarningIcon, {
|
|
@@ -7557,17 +7479,17 @@ function CustomFieldsProductTypeReferenceSubtitle() {
|
|
|
7557
7479
|
// TODO(pa3): this logic may be misplaced and probably
|
|
7558
7480
|
// should belong to <CustomReferenceInput /> component instead.
|
|
7559
7481
|
function CustomFieldsLabelSubtitle(_ref3) {
|
|
7560
|
-
var
|
|
7482
|
+
var _context;
|
|
7561
7483
|
let fieldDefinition = _ref3.fieldDefinition;
|
|
7562
7484
|
const _useIntl2 = useIntl(),
|
|
7563
7485
|
formatMessage = _useIntl2.formatMessage;
|
|
7564
7486
|
const type = getType(fieldDefinition);
|
|
7565
|
-
const isReference =
|
|
7487
|
+
const isReference = type.name?.toLowerCase() === 'reference';
|
|
7566
7488
|
if (!isReference) return null;
|
|
7567
7489
|
const referenceTypeId = type.referenceTypeId;
|
|
7568
7490
|
const referenceTypeName = capitalizeFirst(referenceTypeId);
|
|
7569
7491
|
if (_includesInstanceProperty(_context = [SEARCHABLE_REFERENCES.category, SEARCHABLE_REFERENCES.cartDiscount]).call(_context, referenceTypeId)) return referenceTypeName;
|
|
7570
|
-
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`;
|
|
7571
7493
|
}
|
|
7572
7494
|
const Portal = props => /*#__PURE__*/ReactDOM.createPortal(props.children, document.body);
|
|
7573
7495
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
@@ -7584,7 +7506,7 @@ function CustomFieldsCountIndicator(_ref4) {
|
|
|
7584
7506
|
const formatLocalizedField = useFormatLocalizedFieldToString();
|
|
7585
7507
|
const _useIntl3 = useIntl(),
|
|
7586
7508
|
formatMessage = _useIntl3.formatMessage;
|
|
7587
|
-
return
|
|
7509
|
+
return assignedAttributeGroups?.length > 1 ? jsx(Tooltip, {
|
|
7588
7510
|
title: formatMessage(messages$v.attributeGroupCountTooltip, {
|
|
7589
7511
|
attributeGroups: _mapInstanceProperty(assignedAttributeGroups).call(assignedAttributeGroups, assignedAttributeGroup => formatLocalizedField(assignedAttributeGroup.nameAllLocales)).join(', '),
|
|
7590
7512
|
count: assignedAttributeGroups.length
|
|
@@ -7642,9 +7564,8 @@ const CustomFieldsLabel = /*#__PURE__*/memo(_ref5 => {
|
|
|
7642
7564
|
CustomFieldsLabel.displayName = 'CustomFieldsTitle';
|
|
7643
7565
|
|
|
7644
7566
|
const getFieldName = (parentName, fieldName) => {
|
|
7645
|
-
var _context;
|
|
7646
7567
|
if (!parentName) return fieldName;
|
|
7647
|
-
return
|
|
7568
|
+
return `${parentName}.${fieldName}`;
|
|
7648
7569
|
};
|
|
7649
7570
|
const isNested = fieldDefinition => {
|
|
7650
7571
|
const type = fieldDefinition.type;
|
|
@@ -7669,7 +7590,6 @@ const CustomFieldsInternal = props => {
|
|
|
7669
7590
|
isDragAndDropMode = _useDnDContext.isDragAndDropMode;
|
|
7670
7591
|
return jsx(DroppableWrapper, {
|
|
7671
7592
|
children: _mapInstanceProperty(fieldDefinitions).call(fieldDefinitions, (fieldDefinition, index) => {
|
|
7672
|
-
var _context2;
|
|
7673
7593
|
const fieldName = getFieldName(props.name, fieldDefinition.name);
|
|
7674
7594
|
const isTouched = Boolean(getIn(touched, fieldName));
|
|
7675
7595
|
const fieldErrors = getIn(errors, fieldName);
|
|
@@ -7686,51 +7606,48 @@ const CustomFieldsInternal = props => {
|
|
|
7686
7606
|
return jsx(FastField, {
|
|
7687
7607
|
name: fieldName,
|
|
7688
7608
|
validate: validate,
|
|
7689
|
-
children: () => {
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
children:
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
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, {
|
|
7626
|
+
name: fieldName,
|
|
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, {
|
|
7702
7634
|
name: fieldName,
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
onBlur: handleBlur,
|
|
7714
|
-
setFieldValue: props.setFieldValue
|
|
7715
|
-
}) : jsx(CustomFieldInput, {
|
|
7716
|
-
name: fieldName,
|
|
7717
|
-
value: value,
|
|
7718
|
-
fieldDefinition: fieldDefinition,
|
|
7719
|
-
isDisabled: props.isDisabled || isDragAndDropMode,
|
|
7720
|
-
isReadOnly: props.isReadOnly,
|
|
7721
|
-
onBlur: handleBlur,
|
|
7722
|
-
setFieldValue: props.setFieldValue,
|
|
7723
|
-
hasError: hasError
|
|
7724
|
-
}), jsx(CustomFieldErrors, {
|
|
7725
|
-
isTouched: isTouched,
|
|
7726
|
-
errors: fieldErrors
|
|
7727
|
-
})]
|
|
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
|
|
7728
7645
|
})]
|
|
7729
|
-
})
|
|
7646
|
+
})]
|
|
7730
7647
|
})
|
|
7731
|
-
})
|
|
7732
|
-
}
|
|
7733
|
-
},
|
|
7648
|
+
})
|
|
7649
|
+
})
|
|
7650
|
+
}, `${fieldName}-${index}`);
|
|
7734
7651
|
})
|
|
7735
7652
|
});
|
|
7736
7653
|
};
|
|
@@ -7786,7 +7703,7 @@ var pickerMessages = defineMessages({
|
|
|
7786
7703
|
});
|
|
7787
7704
|
|
|
7788
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; }
|
|
7789
|
-
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; }
|
|
7790
7707
|
const PRODUCT_SELECTION_MODES = {
|
|
7791
7708
|
INCLUSION: 'Individual',
|
|
7792
7709
|
EXCLUSION: 'IndividualExclusion'
|
|
@@ -7797,11 +7714,10 @@ const PRODUCT_SELECTION_MODES_LABELS = {
|
|
|
7797
7714
|
};
|
|
7798
7715
|
const getMode = mode => mode === PRODUCT_SELECTION_MODES.INCLUSION || mode === PRODUCT_SELECTION_MODES_LABELS.INCLUSION ? 'inclusion' : 'exclusion';
|
|
7799
7716
|
const addModeToLabel = function (ps) {
|
|
7800
|
-
var _context;
|
|
7801
7717
|
let enableExcludingProducts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
7802
7718
|
if (!ps) return undefined;
|
|
7803
7719
|
return _objectSpread$I(_objectSpread$I({}, ps), {}, {
|
|
7804
|
-
label:
|
|
7720
|
+
label: `${ps?.label}${enableExcludingProducts ? ` (type: ${getMode(ps?.mode)})` : ''}`
|
|
7805
7721
|
});
|
|
7806
7722
|
};
|
|
7807
7723
|
|
|
@@ -7813,7 +7729,6 @@ const mapProductSelectionsToOptions$1 = memoize(function () {
|
|
|
7813
7729
|
let enableExcludingProducts = arguments.length > 4 ? arguments[4] : undefined;
|
|
7814
7730
|
const selectedPSList = _Array$isArray(selectedPS) ? selectedPS : [selectedPS];
|
|
7815
7731
|
return _mapInstanceProperty(productSelections).call(productSelections, productSelection => {
|
|
7816
|
-
var _context;
|
|
7817
7732
|
const label = formatLocalizedString(productSelection, {
|
|
7818
7733
|
key: 'name',
|
|
7819
7734
|
locale: dataLocale,
|
|
@@ -7822,14 +7737,13 @@ const mapProductSelectionsToOptions$1 = memoize(function () {
|
|
|
7822
7737
|
return {
|
|
7823
7738
|
id: productSelection.id,
|
|
7824
7739
|
value: productSelection.id,
|
|
7825
|
-
label:
|
|
7740
|
+
label: `${label}${_includesInstanceProperty(selectedPSList).call(selectedPSList, productSelection.id) && enableExcludingProducts ? ` (type: ${getMode(productSelection.mode)})` : ''}`,
|
|
7826
7741
|
key: productSelection.key,
|
|
7827
7742
|
mode: getMode(productSelection.mode)
|
|
7828
7743
|
};
|
|
7829
7744
|
});
|
|
7830
7745
|
});
|
|
7831
7746
|
function ProductSelectionBasicSelectDropdown(props) {
|
|
7832
|
-
var _productSelectionsFet, _productSelectionsFet2;
|
|
7833
7747
|
const intl = useIntl();
|
|
7834
7748
|
const enableExcludingProducts = useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
7835
7749
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -7842,10 +7756,10 @@ function ProductSelectionBasicSelectDropdown(props) {
|
|
|
7842
7756
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
7843
7757
|
dataLocale = _useApplicationContex.dataLocale;
|
|
7844
7758
|
if (productSelectionsFetcher.isLoading) return jsx(CenteredLoadingSpinner, {});
|
|
7845
|
-
const productSelections =
|
|
7759
|
+
const productSelections = productSelectionsFetcher.productSelections?.results ?? [];
|
|
7846
7760
|
const filteredProductSelections = _filterInstanceProperty(productSelections).call(productSelections, ps => {
|
|
7847
|
-
var
|
|
7848
|
-
return !_includesInstanceProperty(
|
|
7761
|
+
var _context;
|
|
7762
|
+
return !_includesInstanceProperty(_context = props.excludedProductSelectionIds).call(_context, ps.id);
|
|
7849
7763
|
});
|
|
7850
7764
|
const onOptionClick = event => {
|
|
7851
7765
|
const productSelectionId = event.target.value;
|
|
@@ -7894,7 +7808,7 @@ const getValueFromOptions$3 = _ref => {
|
|
|
7894
7808
|
// handle async-select-field value transformation
|
|
7895
7809
|
if (isMulti) {
|
|
7896
7810
|
var _context;
|
|
7897
|
-
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));
|
|
7898
7812
|
}
|
|
7899
7813
|
|
|
7900
7814
|
// in case it is not multiselect, then a single valued async-select-input is being requested and the value should have proper format
|
|
@@ -7906,7 +7820,6 @@ const emptyStoreOption$1 = intl => [{
|
|
|
7906
7820
|
isDisabled: true
|
|
7907
7821
|
}];
|
|
7908
7822
|
function ProductSelectionsAsyncSelectDropdown(props) {
|
|
7909
|
-
var _productSelectionsFet3;
|
|
7910
7823
|
const intl = useIntl();
|
|
7911
7824
|
const enableExcludingProducts = useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
7912
7825
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -7919,17 +7832,13 @@ function ProductSelectionsAsyncSelectDropdown(props) {
|
|
|
7919
7832
|
})),
|
|
7920
7833
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
7921
7834
|
dataLocale = _useApplicationContex.dataLocale;
|
|
7922
|
-
const productSelections = useMemo(() =>
|
|
7923
|
-
var _productSelectionsFet, _productSelectionsFet2;
|
|
7924
|
-
return (_productSelectionsFet = (_productSelectionsFet2 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet2 === void 0 ? void 0 : _productSelectionsFet2.results) !== null && _productSelectionsFet !== void 0 ? _productSelectionsFet : [];
|
|
7925
|
-
}, [(_productSelectionsFet3 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet3 === void 0 ? void 0 : _productSelectionsFet3.results]);
|
|
7835
|
+
const productSelections = useMemo(() => productSelectionsFetcher.productSelections?.results ?? [], [productSelectionsFetcher.productSelections?.results]);
|
|
7926
7836
|
const filteredProductSelections = _filterInstanceProperty(productSelections).call(productSelections, ps => {
|
|
7927
7837
|
var _context2;
|
|
7928
7838
|
return !_includesInstanceProperty(_context2 = props.excludedProductSelectionIds).call(_context2, ps.id);
|
|
7929
7839
|
});
|
|
7930
7840
|
const onOptionClick = event => {
|
|
7931
|
-
|
|
7932
|
-
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;
|
|
7933
7842
|
const currentProductSelection = _findInstanceProperty(productSelections).call(productSelections, productSelection => productSelection.id === productSelectionId);
|
|
7934
7843
|
props.onChange(currentProductSelection);
|
|
7935
7844
|
};
|
|
@@ -8001,15 +7910,11 @@ function ProductSelectionsAsyncSelectDropdown(props) {
|
|
|
8001
7910
|
}
|
|
8002
7911
|
|
|
8003
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 } } } };
|
|
8004
|
-
const createQueryVariables$4 = (productSelections, predicateField) => {
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
limit: 500
|
|
8009
|
-
};
|
|
8010
|
-
};
|
|
7913
|
+
const createQueryVariables$4 = (productSelections, predicateField) => ({
|
|
7914
|
+
where: `${predicateField} in (${_mapInstanceProperty(productSelections).call(productSelections, ps => `"${ps}"`).join(', ')})`,
|
|
7915
|
+
limit: 500
|
|
7916
|
+
});
|
|
8011
7917
|
const useProductSelectionsByFieldFetcher = (productSelections, predicateField) => {
|
|
8012
|
-
var _productSelectionsQue, _productSelectionsQue2;
|
|
8013
7918
|
const productSelectionList = _Array$isArray(productSelections) ? productSelections : [productSelections];
|
|
8014
7919
|
const productSelectionsQuery = useQuery(ProductSelectionsPickerFetcher$1, {
|
|
8015
7920
|
context: {
|
|
@@ -8019,7 +7924,7 @@ const useProductSelectionsByFieldFetcher = (productSelections, predicateField) =
|
|
|
8019
7924
|
skip: productSelectionList.length === 0
|
|
8020
7925
|
});
|
|
8021
7926
|
return {
|
|
8022
|
-
productSelections:
|
|
7927
|
+
productSelections: productSelectionsQuery.data?.productSelections.results ?? [],
|
|
8023
7928
|
isLoading: productSelectionsQuery.loading
|
|
8024
7929
|
};
|
|
8025
7930
|
};
|
|
@@ -8060,8 +7965,8 @@ const createQueryVariables$3 = _ref3 => {
|
|
|
8060
7965
|
var _context;
|
|
8061
7966
|
let searchText = _ref3.searchText;
|
|
8062
7967
|
const sanitizedSearchText = sanitize(_trimInstanceProperty(searchText).call(searchText, searchText));
|
|
8063
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
8064
|
-
const keyQuery =
|
|
7968
|
+
const idQuery = isUUID(sanitizedSearchText) && `id = "${sanitizedSearchText}"`;
|
|
7969
|
+
const keyQuery = `key = "${sanitizedSearchText}"`;
|
|
8065
7970
|
const searchTextQuery = _filterInstanceProperty(_context = [idQuery, keyQuery]).call(_context, Boolean).join(' or ');
|
|
8066
7971
|
return {
|
|
8067
7972
|
where: searchTextQuery || undefined
|
|
@@ -8084,7 +7989,6 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8084
7989
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8085
7990
|
const productSelectionsByFieldFetcher = useProductSelectionsByFieldFetcher(props.value, props.renderSelectInputOptionValuesByField);
|
|
8086
7991
|
const handleLoadOptions = async searchText => {
|
|
8087
|
-
var _data$productSelectio, _data$productSelectio2;
|
|
8088
7992
|
const _await$client$query = await client.query({
|
|
8089
7993
|
query: ProductSelectionsPickerFetcher,
|
|
8090
7994
|
variables: createQueryVariables$3({
|
|
@@ -8096,7 +8000,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8096
8000
|
fetchPolicy: 'network-only'
|
|
8097
8001
|
}),
|
|
8098
8002
|
data = _await$client$query.data;
|
|
8099
|
-
const matchedProductSelections =
|
|
8003
|
+
const matchedProductSelections = data?.productSelections?.results ?? [];
|
|
8100
8004
|
const updatedProductSelections = _mapInstanceProperty(matchedProductSelections).call(matchedProductSelections, convertProductSelectionFromGraphQl);
|
|
8101
8005
|
const filteredProductSelections = _filterInstanceProperty(updatedProductSelections).call(updatedProductSelections, ps => {
|
|
8102
8006
|
var _context2;
|
|
@@ -8112,8 +8016,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8112
8016
|
};
|
|
8113
8017
|
const loadOptionsDebounced = debounce(handleLoadOptions, 500);
|
|
8114
8018
|
const onOptionClick = event => {
|
|
8115
|
-
|
|
8116
|
-
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;
|
|
8117
8020
|
const currentProductSelection = _findInstanceProperty(productionSelectionResults).call(productionSelectionResults, productSelection => productSelection.id === productSelectionId);
|
|
8118
8021
|
props.onChange(currentProductSelection);
|
|
8119
8022
|
};
|
|
@@ -8161,11 +8064,11 @@ function ModeSelectInputOption(props) {
|
|
|
8161
8064
|
scale: "xs",
|
|
8162
8065
|
children: [jsx(Text.Detail, {
|
|
8163
8066
|
isBold: true,
|
|
8164
|
-
children:
|
|
8067
|
+
children: data?.label || noValueFallback
|
|
8165
8068
|
}), jsxs(Text.Detail, {
|
|
8166
|
-
children: ["Key: ",
|
|
8069
|
+
children: ["Key: ", data?.key || noValueFallback]
|
|
8167
8070
|
}), jsxs(Text.Detail, {
|
|
8168
|
-
children: ["Type: ",
|
|
8071
|
+
children: ["Type: ", data?.mode || noValueFallback]
|
|
8169
8072
|
})]
|
|
8170
8073
|
})
|
|
8171
8074
|
}));
|
|
@@ -8266,8 +8169,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8266
8169
|
var _context2;
|
|
8267
8170
|
const intl = useIntl();
|
|
8268
8171
|
const handleLoadOptions = async searchTerm => {
|
|
8269
|
-
|
|
8270
|
-
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 => {
|
|
8271
8173
|
var _context;
|
|
8272
8174
|
return _includesInstanceProperty(_context = country.label.toLowerCase()).call(_context, searchTerm.toLowerCase());
|
|
8273
8175
|
});
|
|
@@ -8275,7 +8177,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8275
8177
|
return _sliceInstanceProperty(filteredOptions).call(filteredOptions, 0, props.countriesAsyncLoadingLimit);
|
|
8276
8178
|
}
|
|
8277
8179
|
return [{
|
|
8278
|
-
options:
|
|
8180
|
+
options: props.options?.slice(0, props.countriesAsyncLoadingLimit)
|
|
8279
8181
|
}, {
|
|
8280
8182
|
options: emptyCountryOption(intl)
|
|
8281
8183
|
}];
|
|
@@ -8284,10 +8186,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8284
8186
|
const countries = event.target.value;
|
|
8285
8187
|
props.onChange({
|
|
8286
8188
|
target: _objectSpread$F(_objectSpread$F({}, event.target), {}, {
|
|
8287
|
-
value: _mapInstanceProperty(countries).call(countries, country =>
|
|
8288
|
-
var _country$value;
|
|
8289
|
-
return (_country$value = country === null || country === void 0 ? void 0 : country.value) !== null && _country$value !== void 0 ? _country$value : country;
|
|
8290
|
-
})
|
|
8189
|
+
value: _mapInstanceProperty(countries).call(countries, country => country?.value ?? country)
|
|
8291
8190
|
})
|
|
8292
8191
|
});
|
|
8293
8192
|
};
|
|
@@ -8317,8 +8216,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
8317
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; }
|
|
8318
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; }
|
|
8319
8218
|
function CountriesPicker(props) {
|
|
8320
|
-
|
|
8321
|
-
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;
|
|
8322
8220
|
return jsx(Spacings.Stack, {
|
|
8323
8221
|
children: jsx(CustomCountriesPicker, _objectSpread$E({}, props))
|
|
8324
8222
|
});
|
|
@@ -8347,7 +8245,6 @@ var GetCustomerGroupsQuery = { kind: "Document", definitions: [{ kind: "Operatio
|
|
|
8347
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 } } } };
|
|
8348
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 } } } };
|
|
8349
8247
|
const CustomerGroupPickerInput = _ref => {
|
|
8350
|
-
var _currentOption$data$l, _currentOption$data;
|
|
8351
8248
|
let isClearable = _ref.isClearable,
|
|
8352
8249
|
isDisabled = _ref.isDisabled,
|
|
8353
8250
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -8416,13 +8313,13 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
8416
8313
|
setLoadingError(null);
|
|
8417
8314
|
handleInternalInputChange(event);
|
|
8418
8315
|
}, [handleInternalInputChange]);
|
|
8419
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
8316
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
8420
8317
|
useEffect(() => {
|
|
8421
8318
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
8422
8319
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
8423
8320
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
8424
8321
|
const handleNoOptions = useCallback(() => loadingError ? null : formatMessage(messages$t.noCustomerGroupsFound), [loadingError, formatMessage]);
|
|
8425
|
-
const tooltipTitle =
|
|
8322
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
8426
8323
|
return jsx(Constraints.Horizontal, {
|
|
8427
8324
|
max: "scale",
|
|
8428
8325
|
children: jsxs(Spacings.Stack, {
|
|
@@ -8432,7 +8329,7 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
8432
8329
|
children: jsx(AsyncSelectInput, {
|
|
8433
8330
|
id: name,
|
|
8434
8331
|
name: name,
|
|
8435
|
-
placeholder: placeholder
|
|
8332
|
+
placeholder: placeholder ?? formatMessage(messages$t.placeholder),
|
|
8436
8333
|
loadOptions: loadOptionsDebounced,
|
|
8437
8334
|
defaultOptions: true,
|
|
8438
8335
|
showOptionGroupDivider: true,
|
|
@@ -8461,12 +8358,11 @@ CustomerGroupPickerInput.displayName = 'CustomerGroupPickerInput';
|
|
|
8461
8358
|
const DEFAULT_LENGTH = 50;
|
|
8462
8359
|
const DEFAULT_END = '...';
|
|
8463
8360
|
function truncate (text) {
|
|
8464
|
-
var _context;
|
|
8465
8361
|
let length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_LENGTH;
|
|
8466
8362
|
let end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_END;
|
|
8467
8363
|
if (!text) return '';
|
|
8468
8364
|
if (text.length < length) return text;
|
|
8469
|
-
return
|
|
8365
|
+
return `${text.substring(0, length)}${end}`;
|
|
8470
8366
|
}
|
|
8471
8367
|
|
|
8472
8368
|
const LOWER_STORES_LIMIT = 60;
|
|
@@ -8474,7 +8370,6 @@ const UPPER_STORES_LIMIT = 500;
|
|
|
8474
8370
|
|
|
8475
8371
|
// map store to options
|
|
8476
8372
|
const mapStoresToOptions = _ref => {
|
|
8477
|
-
var _store$productSelecti;
|
|
8478
8373
|
let store = _ref.store,
|
|
8479
8374
|
renderSelectInputOptionValuesByField = _ref.renderSelectInputOptionValuesByField,
|
|
8480
8375
|
dataLocale = _ref.dataLocale;
|
|
@@ -8485,14 +8380,14 @@ const mapStoresToOptions = _ref => {
|
|
|
8485
8380
|
const localizedName = formatLocalizedString(convertedStore, {
|
|
8486
8381
|
key: 'name',
|
|
8487
8382
|
locale: dataLocale,
|
|
8488
|
-
fallback:
|
|
8383
|
+
fallback: `${store.key} (key)`
|
|
8489
8384
|
});
|
|
8490
8385
|
return {
|
|
8491
8386
|
label: localizedName,
|
|
8492
8387
|
value: renderSelectInputOptionValuesByField === 'key' ? store.key : store.id,
|
|
8493
8388
|
key: store.key,
|
|
8494
8389
|
id: store.id,
|
|
8495
|
-
productSelections:
|
|
8390
|
+
productSelections: store.productSelections?.map(productSelectionRef => productSelectionRef.productSelection.id)
|
|
8496
8391
|
};
|
|
8497
8392
|
};
|
|
8498
8393
|
|
|
@@ -8554,7 +8449,7 @@ const getValueFromOptions$1 = _ref => {
|
|
|
8554
8449
|
isMulti = _ref.isMulti;
|
|
8555
8450
|
// handle async-select-field value transformation
|
|
8556
8451
|
if (isMulti) {
|
|
8557
|
-
return _filterInstanceProperty(mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores
|
|
8452
|
+
return _filterInstanceProperty(mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores?.includes(store.value));
|
|
8558
8453
|
}
|
|
8559
8454
|
|
|
8560
8455
|
// return value as undefined if no options is yet selected. It is needed for cases where users sets initial values as empty string
|
|
@@ -8583,13 +8478,13 @@ const StoresAsyncSelectInput = props => {
|
|
|
8583
8478
|
sort: 'createdAt asc',
|
|
8584
8479
|
excludeExtendedStoresList: true,
|
|
8585
8480
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8586
|
-
stores:
|
|
8481
|
+
stores: keysOfStores?.length && keysOfStores,
|
|
8587
8482
|
projectKey: props.projectKey
|
|
8588
8483
|
});
|
|
8589
8484
|
const hasError = AsyncSelectInput.isTouched(props.touched) && hasErrors$2(props.errors) || props.hasError;
|
|
8590
8485
|
const mappedStoresListOptions = useMemo(() => {
|
|
8591
|
-
var _context2
|
|
8592
|
-
return _mapInstanceProperty(_context2 =
|
|
8486
|
+
var _context2;
|
|
8487
|
+
return _mapInstanceProperty(_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8593
8488
|
store,
|
|
8594
8489
|
dataLocale,
|
|
8595
8490
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -8675,21 +8570,20 @@ const StoresBasicSelectInput = props => {
|
|
|
8675
8570
|
sort: 'createdAt asc',
|
|
8676
8571
|
excludeExtendedStoresList: true,
|
|
8677
8572
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8678
|
-
stores:
|
|
8573
|
+
stores: keysOfStores?.length && keysOfStores,
|
|
8679
8574
|
projectKey: props.projectKey
|
|
8680
8575
|
});
|
|
8681
8576
|
const hasError = SelectInput.isTouched(props.touched) && hasErrors$1(props.errors) || props.hasError;
|
|
8682
8577
|
const mappedStoresListOptions = useMemo(() => {
|
|
8683
|
-
var _context2
|
|
8684
|
-
return _mapInstanceProperty(_context2 =
|
|
8578
|
+
var _context2;
|
|
8579
|
+
return _mapInstanceProperty(_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8685
8580
|
store,
|
|
8686
8581
|
dataLocale,
|
|
8687
8582
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
8688
8583
|
}));
|
|
8689
8584
|
}, [dataLocale, storesListFetcher.stores, props.renderSelectInputOptionValuesByField]);
|
|
8690
8585
|
const handleChange = event => {
|
|
8691
|
-
|
|
8692
|
-
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;
|
|
8693
8587
|
const currentStore = _findInstanceProperty(mappedStoresListOptions).call(mappedStoresListOptions, store => store.value === value);
|
|
8694
8588
|
|
|
8695
8589
|
// We need complete store info including productSelections
|
|
@@ -8744,7 +8638,6 @@ StoresBasicSelectInput.defaultProps = {
|
|
|
8744
8638
|
|
|
8745
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 } } } };
|
|
8746
8640
|
const useTotalNumberOfStoresFetcher = projectKey => {
|
|
8747
|
-
var _totalNumberOfStoresQ;
|
|
8748
8641
|
const totalNumberOfStoresQuery = useQuery(TotalNumberOfStores, {
|
|
8749
8642
|
context: {
|
|
8750
8643
|
target: GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM,
|
|
@@ -8753,7 +8646,7 @@ const useTotalNumberOfStoresFetcher = projectKey => {
|
|
|
8753
8646
|
fetchPolicy: 'network-only'
|
|
8754
8647
|
});
|
|
8755
8648
|
return {
|
|
8756
|
-
total:
|
|
8649
|
+
total: totalNumberOfStoresQuery.data?.totalNumberOfStores.total,
|
|
8757
8650
|
isLoading: totalNumberOfStoresQuery.loading
|
|
8758
8651
|
};
|
|
8759
8652
|
};
|
|
@@ -8771,19 +8664,15 @@ const handlers$1 = {
|
|
|
8771
8664
|
};
|
|
8772
8665
|
|
|
8773
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 } } } };
|
|
8774
|
-
const createQueryVariables$2 = (stores, predicateField, shouldFetchProductSelections) => {
|
|
8775
|
-
|
|
8776
|
-
|
|
8777
|
-
|
|
8778
|
-
|
|
8779
|
-
excludeProductSelections: !shouldFetchProductSelections
|
|
8780
|
-
};
|
|
8781
|
-
};
|
|
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
|
+
});
|
|
8782
8672
|
const emptyStoresQueryResult = {
|
|
8783
8673
|
results: []
|
|
8784
8674
|
};
|
|
8785
8675
|
const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
8786
|
-
var _storesQuery$data;
|
|
8787
8676
|
let shouldFetchProductSelections = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
8788
8677
|
// incase of single select input stores are sent as single string literal
|
|
8789
8678
|
const storesList = _Array$isArray(stores) ? stores : [stores];
|
|
@@ -8796,29 +8685,29 @@ const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
|
8796
8685
|
skip: storesList.length === 0
|
|
8797
8686
|
});
|
|
8798
8687
|
return {
|
|
8799
|
-
stores:
|
|
8688
|
+
stores: storesQuery.data?.storesByField || emptyStoresQueryResult,
|
|
8800
8689
|
isLoading: storesQuery.loading
|
|
8801
8690
|
};
|
|
8802
8691
|
};
|
|
8803
8692
|
|
|
8804
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; }
|
|
8805
|
-
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; }
|
|
8806
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 } } } };
|
|
8807
8696
|
const hasErrors = errors => {
|
|
8808
8697
|
var _context;
|
|
8809
8698
|
return errors && _someInstanceProperty(_context = _Object$values(errors)).call(_context, Boolean);
|
|
8810
8699
|
};
|
|
8811
8700
|
const createQueryVariables$1 = _ref => {
|
|
8812
|
-
var _context2
|
|
8701
|
+
var _context2;
|
|
8813
8702
|
let searchText = _ref.searchText,
|
|
8814
8703
|
dataLocale = _ref.dataLocale,
|
|
8815
8704
|
allAccessibleStoreKeysThroughDataFencePermissions = _ref.allAccessibleStoreKeysThroughDataFencePermissions,
|
|
8816
8705
|
shouldFetchProductSelections = _ref.shouldFetchProductSelections;
|
|
8817
8706
|
const sanitizedSearchText = sanitize(_trimInstanceProperty(searchText).call(searchText, searchText));
|
|
8818
|
-
const keyQuery =
|
|
8707
|
+
const keyQuery = `key = "${sanitizedSearchText}"`;
|
|
8819
8708
|
|
|
8820
8709
|
// if the user has data fence permissions then we only allow stores to fetched that user has access to
|
|
8821
|
-
if (allAccessibleStoreKeysThroughDataFencePermissions
|
|
8710
|
+
if (allAccessibleStoreKeysThroughDataFencePermissions?.length) {
|
|
8822
8711
|
// if the current search term match the accessible stores keys, then proceed with fetching the store
|
|
8823
8712
|
if (_includesInstanceProperty(allAccessibleStoreKeysThroughDataFencePermissions).call(allAccessibleStoreKeysThroughDataFencePermissions, sanitizedSearchText)) {
|
|
8824
8713
|
return {
|
|
@@ -8834,9 +8723,9 @@ const createQueryVariables$1 = _ref => {
|
|
|
8834
8723
|
excludeProductSelections: !shouldFetchProductSelections
|
|
8835
8724
|
};
|
|
8836
8725
|
}
|
|
8837
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
8838
|
-
const nameQuery =
|
|
8839
|
-
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 ');
|
|
8840
8729
|
return {
|
|
8841
8730
|
skipFetchingStores: false,
|
|
8842
8731
|
where: searchTextQuery,
|
|
@@ -8844,7 +8733,6 @@ const createQueryVariables$1 = _ref => {
|
|
|
8844
8733
|
};
|
|
8845
8734
|
};
|
|
8846
8735
|
const getValueFromOptions = _ref2 => {
|
|
8847
|
-
var _storesByFieldFetcher, _context4;
|
|
8848
8736
|
let isMulti = _ref2.isMulti,
|
|
8849
8737
|
value = _ref2.value,
|
|
8850
8738
|
dataLocale = _ref2.dataLocale,
|
|
@@ -8853,7 +8741,7 @@ const getValueFromOptions = _ref2 => {
|
|
|
8853
8741
|
if (!value) {
|
|
8854
8742
|
return undefined;
|
|
8855
8743
|
}
|
|
8856
|
-
const selectedOptions =
|
|
8744
|
+
const selectedOptions = storesByFieldFetcher.stores?.results.map(store => mapStoresToOptions({
|
|
8857
8745
|
store,
|
|
8858
8746
|
dataLocale,
|
|
8859
8747
|
renderSelectInputOptionValuesByField: renderSelectInputOptionValuesByField
|
|
@@ -8891,9 +8779,8 @@ const StoresSearchSelectInput = props => {
|
|
|
8891
8779
|
},
|
|
8892
8780
|
fetchPolicy: 'network-only'
|
|
8893
8781
|
}).then(_ref3 => {
|
|
8894
|
-
var _data$storesByWherePr, _context5;
|
|
8895
8782
|
let data = _ref3.data;
|
|
8896
|
-
return
|
|
8783
|
+
return data.storesByWherePredicate?.results.map(store => mapStoresToOptions({
|
|
8897
8784
|
store,
|
|
8898
8785
|
dataLocale,
|
|
8899
8786
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -9073,14 +8960,14 @@ var messages$r = defineMessages({
|
|
|
9073
8960
|
|
|
9074
8961
|
function formatDiscount(discount, currencyCode, intl) {
|
|
9075
8962
|
var _context;
|
|
9076
|
-
if (discount.type === 'relative') return
|
|
8963
|
+
if (discount.type === 'relative') return `${discount.permyriad / 100}%`;
|
|
9077
8964
|
if (!discount.money) return null;
|
|
9078
8965
|
const moneyForCurrencyCode = _findInstanceProperty(_context = discount.money).call(_context, discountMoney => discountMoney.currencyCode === currencyCode);
|
|
9079
8966
|
return moneyForCurrencyCode ? formatMoney$2(moneyForCurrencyCode, intl) : null;
|
|
9080
8967
|
}
|
|
9081
8968
|
|
|
9082
8969
|
function formatPercentage(percentage) {
|
|
9083
|
-
return
|
|
8970
|
+
return `${percentage}%`;
|
|
9084
8971
|
}
|
|
9085
8972
|
function convertRatioToPercentage(ratio) {
|
|
9086
8973
|
return _parseFloat((ratio * 100).toFixed(2));
|
|
@@ -9134,8 +9021,8 @@ function validateFilter$2(_ref, intl) {
|
|
|
9134
9021
|
};
|
|
9135
9022
|
}
|
|
9136
9023
|
if (value.option === FILTER_TYPES.range) {
|
|
9137
|
-
const from = validateValue(filterValue
|
|
9138
|
-
const to = from ? null : validateValue(filterValue
|
|
9024
|
+
const from = validateValue(filterValue?.from, typeName, intl);
|
|
9025
|
+
const to = from ? null : validateValue(filterValue?.to, typeName, intl);
|
|
9139
9026
|
return from || to ? {
|
|
9140
9027
|
input: {
|
|
9141
9028
|
from,
|
|
@@ -9172,16 +9059,16 @@ function validateFilter$1(_ref, intl) {
|
|
|
9172
9059
|
type = _ref.type;
|
|
9173
9060
|
if (type === 'range') {
|
|
9174
9061
|
if (validateSingleFilter({
|
|
9175
|
-
value: value
|
|
9062
|
+
value: value?.from
|
|
9176
9063
|
})) return {
|
|
9177
9064
|
from: intl.formatMessage(messages$p.rangeMissingValue)
|
|
9178
9065
|
};
|
|
9179
9066
|
if (validateSingleFilter({
|
|
9180
|
-
value: value
|
|
9067
|
+
value: value?.to
|
|
9181
9068
|
})) return {
|
|
9182
9069
|
to: intl.formatMessage(messages$p.rangeMissingValue)
|
|
9183
9070
|
};
|
|
9184
|
-
if (moment$1(value
|
|
9071
|
+
if (moment$1(value?.to).isBefore(value?.from)) return {
|
|
9185
9072
|
from: intl.formatMessage(messages$p.rangeToSmallerThanFrom)
|
|
9186
9073
|
};
|
|
9187
9074
|
} else if (type === 'equalTo' || type === 'lessThan' || type === 'moreThan') {
|
|
@@ -9251,10 +9138,8 @@ function isEmptyFilter(_ref) {
|
|
|
9251
9138
|
}
|
|
9252
9139
|
|
|
9253
9140
|
function numberTransformer(filterKey, filters) {
|
|
9254
|
-
var _context3;
|
|
9255
9141
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$2;
|
|
9256
9142
|
const queries = _mapInstanceProperty(filters).call(filters, _ref => {
|
|
9257
|
-
var _context, _context2;
|
|
9258
9143
|
let type = _ref.type,
|
|
9259
9144
|
value = _ref.value;
|
|
9260
9145
|
if (!filterValidator({
|
|
@@ -9263,19 +9148,19 @@ function numberTransformer(filterKey, filters) {
|
|
|
9263
9148
|
})) return '';
|
|
9264
9149
|
switch (type) {
|
|
9265
9150
|
case 'lessThan':
|
|
9266
|
-
return
|
|
9151
|
+
return `(* to ${value - 1})`;
|
|
9267
9152
|
case 'moreThan':
|
|
9268
|
-
return
|
|
9153
|
+
return `(${value + 1} to *)`;
|
|
9269
9154
|
case 'equalTo':
|
|
9270
|
-
return
|
|
9155
|
+
return `(${value} to ${value})`;
|
|
9271
9156
|
case 'range':
|
|
9272
|
-
return
|
|
9157
|
+
return `(${value.from} to ${value.to})`;
|
|
9273
9158
|
default:
|
|
9274
9159
|
return '';
|
|
9275
9160
|
}
|
|
9276
9161
|
});
|
|
9277
9162
|
const queryString = _filterInstanceProperty(queries).call(queries, q => q !== '').join(', ');
|
|
9278
|
-
return queryString === '' ? null :
|
|
9163
|
+
return queryString === '' ? null : `${filterKey}: range${queryString}`;
|
|
9279
9164
|
}
|
|
9280
9165
|
function isFilterValid$2(_ref2) {
|
|
9281
9166
|
let type = _ref2.type,
|
|
@@ -9302,11 +9187,9 @@ function graphqlCategoryLevelTransformer(filterKey, filters, filterValidator) {
|
|
|
9302
9187
|
return _filterInstanceProperty(_context = [levelFilterQuery, lastLevelFilterQuery]).call(_context, Boolean);
|
|
9303
9188
|
}
|
|
9304
9189
|
|
|
9305
|
-
var _templateObject$1, _templateObject2;
|
|
9306
9190
|
const dateFormatDayStart = 'YYYY-MM-DDT00:00:00.000Z';
|
|
9307
9191
|
const dateFormatDayEnd = 'YYYY-MM-DDT23:59:59.999Z';
|
|
9308
9192
|
function dateTransformer(filterKey, filters) {
|
|
9309
|
-
var _context;
|
|
9310
9193
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$1;
|
|
9311
9194
|
const queries = _mapInstanceProperty(filters).call(filters, _ref => {
|
|
9312
9195
|
let type = _ref.type,
|
|
@@ -9317,19 +9200,25 @@ function dateTransformer(filterKey, filters) {
|
|
|
9317
9200
|
})) return '';
|
|
9318
9201
|
switch (type) {
|
|
9319
9202
|
case 'lessThan':
|
|
9320
|
-
return
|
|
9203
|
+
return `(* to "${moment$1(value).format(dateFormatDayStart)}")`;
|
|
9321
9204
|
case 'moreThan':
|
|
9322
|
-
return
|
|
9205
|
+
return `("${moment$1(value).format(dateFormatDayEnd)}" to *)`;
|
|
9323
9206
|
case 'equalTo':
|
|
9324
|
-
return oneLine
|
|
9207
|
+
return oneLine`
|
|
9208
|
+
("${moment$1(value).format(dateFormatDayStart)}"
|
|
9209
|
+
to "${moment$1(value).format(dateFormatDayEnd)}")
|
|
9210
|
+
`;
|
|
9325
9211
|
case 'range':
|
|
9326
|
-
return oneLine
|
|
9212
|
+
return oneLine`
|
|
9213
|
+
("${moment$1(value.from).format(dateFormatDayStart)}"
|
|
9214
|
+
to "${moment$1(value.to).format(dateFormatDayEnd)}")
|
|
9215
|
+
`;
|
|
9327
9216
|
default:
|
|
9328
9217
|
return '';
|
|
9329
9218
|
}
|
|
9330
9219
|
});
|
|
9331
9220
|
const queryString = _filterInstanceProperty(queries).call(queries, q => q !== '').join(', ');
|
|
9332
|
-
return queryString === '' ? null :
|
|
9221
|
+
return queryString === '' ? null : `${filterKey}: range${queryString}`;
|
|
9333
9222
|
}
|
|
9334
9223
|
function isFilterValid$1(_ref2) {
|
|
9335
9224
|
let type = _ref2.type,
|
|
@@ -9344,19 +9233,18 @@ function isFilterValid$1(_ref2) {
|
|
|
9344
9233
|
}
|
|
9345
9234
|
|
|
9346
9235
|
function missingLocaleTransformer(filterKey, filters) {
|
|
9347
|
-
var _context;
|
|
9348
9236
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
9349
9237
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
9350
9238
|
if (filters.length === 0) return null;
|
|
9351
9239
|
const missingLocale = filters[0].value.value;
|
|
9352
|
-
return
|
|
9240
|
+
return `${filterKey}.${missingLocale}:missing`;
|
|
9353
9241
|
}
|
|
9354
9242
|
|
|
9355
9243
|
function missingTransformer(filterKey, filters) {
|
|
9356
9244
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
9357
9245
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
9358
9246
|
if (filters.length === 0) return null;
|
|
9359
|
-
return
|
|
9247
|
+
return `${filterKey}:missing`;
|
|
9360
9248
|
}
|
|
9361
9249
|
|
|
9362
9250
|
/**
|
|
@@ -9397,7 +9285,6 @@ function graphqlQueryBuilder(_ref) {
|
|
|
9397
9285
|
}
|
|
9398
9286
|
|
|
9399
9287
|
function referenceTransformer(filterKey, filters) {
|
|
9400
|
-
var _context;
|
|
9401
9288
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid;
|
|
9402
9289
|
const queries = _mapInstanceProperty(filters).call(filters, _ref => {
|
|
9403
9290
|
let type = _ref.type,
|
|
@@ -9408,49 +9295,46 @@ function referenceTransformer(filterKey, filters) {
|
|
|
9408
9295
|
})) return '';
|
|
9409
9296
|
switch (type) {
|
|
9410
9297
|
case 'equalTo':
|
|
9411
|
-
return "
|
|
9298
|
+
return `"${value}"`;
|
|
9412
9299
|
default:
|
|
9413
9300
|
return '';
|
|
9414
9301
|
}
|
|
9415
9302
|
});
|
|
9416
9303
|
const queryString = _filterInstanceProperty(queries).call(queries, q => q !== '').join(', ');
|
|
9417
|
-
return queryString === '' ? null :
|
|
9304
|
+
return queryString === '' ? null : `${filterKey}.id: ${queryString}`;
|
|
9418
9305
|
}
|
|
9419
9306
|
function isFilterValid(_ref2) {
|
|
9420
|
-
var
|
|
9307
|
+
var _context;
|
|
9421
9308
|
let type = _ref2.type,
|
|
9422
9309
|
value = _ref2.value;
|
|
9423
|
-
if (type === 'equalTo' && !_includesInstanceProperty(
|
|
9310
|
+
if (type === 'equalTo' && !_includesInstanceProperty(_context = [null, undefined, '']).call(_context, value)) return true;
|
|
9424
9311
|
return false;
|
|
9425
9312
|
}
|
|
9426
9313
|
|
|
9427
9314
|
function textTransformer(filterKey, queries) {
|
|
9428
|
-
var _context;
|
|
9429
9315
|
if (queries.length === 0) return null;
|
|
9430
9316
|
|
|
9431
9317
|
// Note: we assume for now that there can only be 1 text filter.
|
|
9432
9318
|
const queryValue = queries[0].value;
|
|
9433
|
-
return queryValue ?
|
|
9319
|
+
return queryValue ? `${filterKey}:"${queryValue}"` : null;
|
|
9434
9320
|
}
|
|
9435
9321
|
|
|
9436
9322
|
const composeNumberPredicateFromFilter = (target, value, option) => {
|
|
9437
|
-
var _context, _context2, _context3, _context4, _context5, _context6;
|
|
9438
9323
|
switch (option) {
|
|
9439
9324
|
case FILTER_TYPES.lessThan:
|
|
9440
|
-
return
|
|
9325
|
+
return `${target} < ${value}`;
|
|
9441
9326
|
case FILTER_TYPES.moreThan:
|
|
9442
|
-
return
|
|
9327
|
+
return `${target} > ${value}`;
|
|
9443
9328
|
case FILTER_TYPES.equalTo:
|
|
9444
|
-
return
|
|
9329
|
+
return `${target} = ${value}`;
|
|
9445
9330
|
case FILTER_TYPES.range:
|
|
9446
|
-
return
|
|
9331
|
+
return `${target} >= ${value.from} and ${target} <= ${value.to}`;
|
|
9447
9332
|
default:
|
|
9448
9333
|
return '';
|
|
9449
9334
|
}
|
|
9450
9335
|
};
|
|
9451
9336
|
function customFields (filter, locale) {
|
|
9452
9337
|
const customFieldsPredicates = _mapInstanceProperty(filter).call(filter, customFieldFilter => {
|
|
9453
|
-
var _context7, _context8, _context9, _context10, _context11;
|
|
9454
9338
|
const _customFieldFilter$va = customFieldFilter.value,
|
|
9455
9339
|
target = _customFieldFilter$va.target,
|
|
9456
9340
|
type = _customFieldFilter$va.type,
|
|
@@ -9458,14 +9342,14 @@ function customFields (filter, locale) {
|
|
|
9458
9342
|
option = _customFieldFilter$va.option;
|
|
9459
9343
|
switch (type.name) {
|
|
9460
9344
|
case FIELD_TYPES.Boolean:
|
|
9461
|
-
return
|
|
9345
|
+
return `${target} = ${value.value}`;
|
|
9462
9346
|
case FIELD_TYPES.String:
|
|
9463
|
-
return
|
|
9347
|
+
return `${target} = "${value}"`;
|
|
9464
9348
|
case FIELD_TYPES.LocalizedString:
|
|
9465
|
-
return
|
|
9349
|
+
return `${target}(${localizedTextTransformer(value)})`;
|
|
9466
9350
|
case FIELD_TYPES.Enum:
|
|
9467
9351
|
case FIELD_TYPES.LocalizedEnum:
|
|
9468
|
-
return
|
|
9352
|
+
return `${target} = "${value.value}"`;
|
|
9469
9353
|
case FIELD_TYPES.Time:
|
|
9470
9354
|
return timeTransformer(target, [{
|
|
9471
9355
|
type: option,
|
|
@@ -9480,14 +9364,14 @@ function customFields (filter, locale) {
|
|
|
9480
9364
|
case FIELD_TYPES.Number:
|
|
9481
9365
|
return composeNumberPredicateFromFilter(target, value, option);
|
|
9482
9366
|
case FIELD_TYPES.Money:
|
|
9483
|
-
return
|
|
9367
|
+
return `${target}(${moneyTransformer(value, option, locale)})`;
|
|
9484
9368
|
case FIELD_TYPES.Reference:
|
|
9485
9369
|
case FIELD_TYPES.Set:
|
|
9486
9370
|
default:
|
|
9487
9371
|
throw new Error('Custom field type not recognized');
|
|
9488
9372
|
}
|
|
9489
9373
|
});
|
|
9490
|
-
return
|
|
9374
|
+
return `(custom(fields(${customFieldsPredicates.join(' and ')})))`;
|
|
9491
9375
|
}
|
|
9492
9376
|
|
|
9493
9377
|
// https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/btoa#Unicode_strings
|
|
@@ -9532,7 +9416,7 @@ function ownKeys$z(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySy
|
|
|
9532
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; }
|
|
9533
9417
|
const resourcesWithPlatformLimits = _Object$keys(RESOURCES_WITH_PLATFORM_LIMITS);
|
|
9534
9418
|
const createQueryVariables = platformLimit => _reduceInstanceProperty(resourcesWithPlatformLimits).call(resourcesWithPlatformLimits, (previousIncludedLimits, nextNameOfLimit) => _objectSpread$z({
|
|
9535
|
-
[camelCase(
|
|
9419
|
+
[camelCase(`should include ${nextNameOfLimit}`)]: platformLimit ? nextNameOfLimit === platformLimit : true
|
|
9536
9420
|
}, previousIncludedLimits), {});
|
|
9537
9421
|
|
|
9538
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 } } } };
|
|
@@ -9548,7 +9432,7 @@ const usePlatformLimitsFetcher = platformLimit => {
|
|
|
9548
9432
|
error = _useQuery.error,
|
|
9549
9433
|
data = _useQuery.data,
|
|
9550
9434
|
refetch = _useQuery.refetch;
|
|
9551
|
-
const platformLimits = !loading ? omit(data
|
|
9435
|
+
const platformLimits = !loading ? omit(data?.limits, '__typename') : {};
|
|
9552
9436
|
return {
|
|
9553
9437
|
isLoading: loading,
|
|
9554
9438
|
error,
|
|
@@ -9739,11 +9623,10 @@ const getPlatformLimitsStatus = _ref3 => {
|
|
|
9739
9623
|
total = _ref3.total,
|
|
9740
9624
|
intl = _ref3.intl;
|
|
9741
9625
|
if (limit) {
|
|
9742
|
-
|
|
9743
|
-
return _concatInstanceProperty(_context = "(".concat(intl.formatNumber(current), "/")).call(_context, intl.formatNumber(limit), ")");
|
|
9626
|
+
return `(${intl.formatNumber(current)}/${intl.formatNumber(limit)})`;
|
|
9744
9627
|
}
|
|
9745
9628
|
if (total) {
|
|
9746
|
-
return
|
|
9629
|
+
return `(${intl.formatNumber(total)})`;
|
|
9747
9630
|
}
|
|
9748
9631
|
return '';
|
|
9749
9632
|
};
|
|
@@ -9763,18 +9646,17 @@ const useShippingMethodsPlatformLimitsFetcher = () => {
|
|
|
9763
9646
|
};
|
|
9764
9647
|
|
|
9765
9648
|
const useShippingMethodsPlatformLimits = () => {
|
|
9766
|
-
var _platformLimits$shipp;
|
|
9767
9649
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
9768
9650
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
9769
|
-
if (!
|
|
9651
|
+
if (!platformLimits?.shippingMethods?.total) {
|
|
9770
9652
|
return {
|
|
9771
9653
|
hasReachedShippingMethodsWarningLimit: false,
|
|
9772
9654
|
hasReachedShippingMethodsErrorLimit: false
|
|
9773
9655
|
};
|
|
9774
9656
|
}
|
|
9775
|
-
const _platformLimits$
|
|
9776
|
-
limit = _platformLimits$
|
|
9777
|
-
current = _platformLimits$
|
|
9657
|
+
const _platformLimits$shipp = platformLimits.shippingMethods.total,
|
|
9658
|
+
limit = _platformLimits$shipp.limit,
|
|
9659
|
+
current = _platformLimits$shipp.current;
|
|
9778
9660
|
const hasReachedShippingMethodsWarningLimit = getHasExceededWarningThreshold({
|
|
9779
9661
|
limit,
|
|
9780
9662
|
current
|
|
@@ -9790,13 +9672,12 @@ const useShippingMethodsPlatformLimits = () => {
|
|
|
9790
9672
|
};
|
|
9791
9673
|
|
|
9792
9674
|
const PlatformLimitsShippingMethodsNotifications = () => {
|
|
9793
|
-
var _platformLimits$shipp;
|
|
9794
9675
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
9795
9676
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
9796
9677
|
const _useShippingMethodsPl2 = useShippingMethodsPlatformLimits(),
|
|
9797
9678
|
hasReachedShippingMethodsWarningLimit = _useShippingMethodsPl2.hasReachedShippingMethodsWarningLimit,
|
|
9798
9679
|
hasReachedShippingMethodsErrorLimit = _useShippingMethodsPl2.hasReachedShippingMethodsErrorLimit;
|
|
9799
|
-
if (!
|
|
9680
|
+
if (!platformLimits?.shippingMethods?.total) {
|
|
9800
9681
|
return null;
|
|
9801
9682
|
}
|
|
9802
9683
|
if (hasReachedShippingMethodsErrorLimit) {
|
|
@@ -9842,13 +9723,12 @@ var messages$k = defineMessages({
|
|
|
9842
9723
|
});
|
|
9843
9724
|
|
|
9844
9725
|
const PlatformLimitsShippingMethodsStatus = _ref => {
|
|
9845
|
-
var _platformLimits$shipp, _platformLimits$shipp2;
|
|
9846
9726
|
let total = _ref.total;
|
|
9847
9727
|
const intl = useIntl();
|
|
9848
9728
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
9849
9729
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
9850
|
-
const current = platformLimits
|
|
9851
|
-
const limit = platformLimits
|
|
9730
|
+
const current = platformLimits?.shippingMethods?.total?.current;
|
|
9731
|
+
const limit = platformLimits?.shippingMethods?.total?.limit;
|
|
9852
9732
|
return jsx(PlatformLimitsStatusText, {
|
|
9853
9733
|
intlMessage: messages$k.shippingMethodsStatus,
|
|
9854
9734
|
children: getPlatformLimitsStatus({
|
|
@@ -9910,18 +9790,17 @@ const useTaxCategoriesPlatformLimitsFetcher = () => {
|
|
|
9910
9790
|
};
|
|
9911
9791
|
|
|
9912
9792
|
const useTaxCategoriesPlatformLimits = () => {
|
|
9913
|
-
var _platformLimits$taxCa;
|
|
9914
9793
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
9915
9794
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
9916
|
-
if (!
|
|
9795
|
+
if (!platformLimits?.taxCategories?.total) {
|
|
9917
9796
|
return {
|
|
9918
9797
|
hasReachedTaxCategoriesWarningLimit: false,
|
|
9919
9798
|
hasReachedTaxCategoriesErrorLimit: false
|
|
9920
9799
|
};
|
|
9921
9800
|
}
|
|
9922
|
-
const _platformLimits$
|
|
9923
|
-
limit = _platformLimits$
|
|
9924
|
-
current = _platformLimits$
|
|
9801
|
+
const _platformLimits$taxCa = platformLimits.taxCategories.total,
|
|
9802
|
+
limit = _platformLimits$taxCa.limit,
|
|
9803
|
+
current = _platformLimits$taxCa.current;
|
|
9925
9804
|
const hasReachedTaxCategoriesWarningLimit = getHasExceededWarningThreshold({
|
|
9926
9805
|
limit,
|
|
9927
9806
|
current
|
|
@@ -9937,13 +9816,12 @@ const useTaxCategoriesPlatformLimits = () => {
|
|
|
9937
9816
|
};
|
|
9938
9817
|
|
|
9939
9818
|
const PlatformLimitsTaxCategoriesNotifications = () => {
|
|
9940
|
-
var _platformLimits$taxCa;
|
|
9941
9819
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
9942
9820
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
9943
9821
|
const _useTaxCategoriesPlat2 = useTaxCategoriesPlatformLimits(),
|
|
9944
9822
|
hasReachedTaxCategoriesWarningLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesWarningLimit,
|
|
9945
9823
|
hasReachedTaxCategoriesErrorLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesErrorLimit;
|
|
9946
|
-
if (!
|
|
9824
|
+
if (!platformLimits?.taxCategories?.total) {
|
|
9947
9825
|
return null;
|
|
9948
9826
|
}
|
|
9949
9827
|
if (hasReachedTaxCategoriesErrorLimit) {
|
|
@@ -9989,13 +9867,12 @@ var messages$i = defineMessages({
|
|
|
9989
9867
|
});
|
|
9990
9868
|
|
|
9991
9869
|
const PlatformLimitsTaxCategoriesStatus = _ref => {
|
|
9992
|
-
var _platformLimits$taxCa, _platformLimits$taxCa2;
|
|
9993
9870
|
let total = _ref.total;
|
|
9994
9871
|
const intl = useIntl();
|
|
9995
9872
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
9996
9873
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
9997
|
-
const current = platformLimits
|
|
9998
|
-
const limit = platformLimits
|
|
9874
|
+
const current = platformLimits?.taxCategories?.total?.current;
|
|
9875
|
+
const limit = platformLimits?.taxCategories?.total?.limit;
|
|
9999
9876
|
return jsx(PlatformLimitsStatusText, {
|
|
10000
9877
|
intlMessage: messages$i.taxCategoriesStatus,
|
|
10001
9878
|
children: getPlatformLimitsStatus({
|
|
@@ -10057,18 +9934,17 @@ const useZonesPlatformLimitsFetcher = () => {
|
|
|
10057
9934
|
};
|
|
10058
9935
|
|
|
10059
9936
|
const useZonesPlatformLimits = () => {
|
|
10060
|
-
var _platformLimits$zones;
|
|
10061
9937
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10062
9938
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10063
|
-
if (!
|
|
9939
|
+
if (!platformLimits?.zones?.total) {
|
|
10064
9940
|
return {
|
|
10065
9941
|
hasReachedZonesWarningLimit: false,
|
|
10066
9942
|
hasReachedZonesErrorLimit: false
|
|
10067
9943
|
};
|
|
10068
9944
|
}
|
|
10069
|
-
const _platformLimits$
|
|
10070
|
-
limit = _platformLimits$
|
|
10071
|
-
current = _platformLimits$
|
|
9945
|
+
const _platformLimits$zones = platformLimits.zones.total,
|
|
9946
|
+
limit = _platformLimits$zones.limit,
|
|
9947
|
+
current = _platformLimits$zones.current;
|
|
10072
9948
|
const hasReachedZonesWarningLimit = getHasExceededWarningThreshold({
|
|
10073
9949
|
limit,
|
|
10074
9950
|
current
|
|
@@ -10084,13 +9960,12 @@ const useZonesPlatformLimits = () => {
|
|
|
10084
9960
|
};
|
|
10085
9961
|
|
|
10086
9962
|
const PlatformLimitsZonesNotifications = () => {
|
|
10087
|
-
var _platformLimits$zones;
|
|
10088
9963
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10089
9964
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10090
9965
|
const _useZonesPlatformLimi2 = useZonesPlatformLimits(),
|
|
10091
9966
|
hasReachedZonesWarningLimit = _useZonesPlatformLimi2.hasReachedZonesWarningLimit,
|
|
10092
9967
|
hasReachedZonesErrorLimit = _useZonesPlatformLimi2.hasReachedZonesErrorLimit;
|
|
10093
|
-
if (!
|
|
9968
|
+
if (!platformLimits?.zones?.total) {
|
|
10094
9969
|
return null;
|
|
10095
9970
|
}
|
|
10096
9971
|
if (hasReachedZonesErrorLimit) {
|
|
@@ -10136,13 +10011,12 @@ var messages$g = defineMessages({
|
|
|
10136
10011
|
});
|
|
10137
10012
|
|
|
10138
10013
|
const PlatformLimitsZonesStatus = _ref => {
|
|
10139
|
-
var _platformLimits$zones, _platformLimits$zones2;
|
|
10140
10014
|
let total = _ref.total;
|
|
10141
10015
|
const intl = useIntl();
|
|
10142
10016
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
10143
10017
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
10144
|
-
const current = platformLimits
|
|
10145
|
-
const limit = platformLimits
|
|
10018
|
+
const current = platformLimits?.zones?.total?.current;
|
|
10019
|
+
const limit = platformLimits?.zones?.total?.limit;
|
|
10146
10020
|
return jsx(PlatformLimitsStatusText, {
|
|
10147
10021
|
intlMessage: messages$g.zonesStatus,
|
|
10148
10022
|
children: getPlatformLimitsStatus({
|
|
@@ -10204,18 +10078,17 @@ const useCustomersPlatformLimitsFetcher = () => {
|
|
|
10204
10078
|
};
|
|
10205
10079
|
|
|
10206
10080
|
const useCustomersPlatformLimits$1 = () => {
|
|
10207
|
-
var _platformLimits$custo;
|
|
10208
10081
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10209
10082
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10210
|
-
if (!
|
|
10083
|
+
if (!platformLimits?.customers?.total) {
|
|
10211
10084
|
return {
|
|
10212
10085
|
hasReachedCustomersWarningLimit: false,
|
|
10213
10086
|
hasReachedCustomersErrorLimit: false
|
|
10214
10087
|
};
|
|
10215
10088
|
}
|
|
10216
|
-
const _platformLimits$
|
|
10217
|
-
limit = _platformLimits$
|
|
10218
|
-
current = _platformLimits$
|
|
10089
|
+
const _platformLimits$custo = platformLimits.customers.total,
|
|
10090
|
+
limit = _platformLimits$custo.limit,
|
|
10091
|
+
current = _platformLimits$custo.current;
|
|
10219
10092
|
const hasReachedCustomersWarningLimit = getHasExceededWarningThreshold({
|
|
10220
10093
|
limit,
|
|
10221
10094
|
current
|
|
@@ -10244,13 +10117,12 @@ const useCustomersPlatormLimitsModalState = () => {
|
|
|
10244
10117
|
};
|
|
10245
10118
|
|
|
10246
10119
|
const PlatformLimitsCustomersNotifications = () => {
|
|
10247
|
-
var _platformLimits$custo;
|
|
10248
10120
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10249
10121
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10250
10122
|
const _useCustomersPlatform2 = useCustomersPlatformLimits$1(),
|
|
10251
10123
|
hasReachedCustomersWarningLimit = _useCustomersPlatform2.hasReachedCustomersWarningLimit,
|
|
10252
10124
|
hasReachedCustomersErrorLimit = _useCustomersPlatform2.hasReachedCustomersErrorLimit;
|
|
10253
|
-
if (!
|
|
10125
|
+
if (!platformLimits?.customers?.total) {
|
|
10254
10126
|
return jsx("div", {});
|
|
10255
10127
|
}
|
|
10256
10128
|
if (hasReachedCustomersErrorLimit) {
|
|
@@ -10301,16 +10173,15 @@ var styles$b = {
|
|
|
10301
10173
|
"status": "platform-limits-customers-status-module__status___3rXYM"
|
|
10302
10174
|
};
|
|
10303
10175
|
const PlatformLimitsCustomersStatus = () => {
|
|
10304
|
-
var _platformLimits$custo;
|
|
10305
10176
|
const intl = useIntl();
|
|
10306
10177
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
10307
10178
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
10308
|
-
if (!
|
|
10179
|
+
if (!platformLimits?.customers?.total) {
|
|
10309
10180
|
return null;
|
|
10310
10181
|
}
|
|
10311
|
-
const _platformLimits$
|
|
10312
|
-
current = _platformLimits$
|
|
10313
|
-
limit = _platformLimits$
|
|
10182
|
+
const _platformLimits$custo = platformLimits.customers.total,
|
|
10183
|
+
current = _platformLimits$custo.current,
|
|
10184
|
+
limit = _platformLimits$custo.limit;
|
|
10314
10185
|
return jsx("div", {
|
|
10315
10186
|
className: styles$b.status,
|
|
10316
10187
|
children: jsx(Text.Detail, {
|
|
@@ -10544,18 +10415,17 @@ const useCustomerGroupsPlatformLimitsFetcher = () => {
|
|
|
10544
10415
|
};
|
|
10545
10416
|
|
|
10546
10417
|
const useCustomerGroupsPlatformLimitsStatus = () => {
|
|
10547
|
-
var _platformLimits$custo;
|
|
10548
10418
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10549
10419
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10550
|
-
if (!
|
|
10420
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
10551
10421
|
return {
|
|
10552
10422
|
hasReachedCustomerGroupsWarningLimit: false,
|
|
10553
10423
|
hasReachedCustomerGroupsErrorLimit: false
|
|
10554
10424
|
};
|
|
10555
10425
|
}
|
|
10556
|
-
const _platformLimits$
|
|
10557
|
-
limit = _platformLimits$
|
|
10558
|
-
current = _platformLimits$
|
|
10426
|
+
const _platformLimits$custo = platformLimits.customerGroups.total,
|
|
10427
|
+
limit = _platformLimits$custo.limit,
|
|
10428
|
+
current = _platformLimits$custo.current;
|
|
10559
10429
|
const hasReachedCustomerGroupsWarningLimit = getHasExceededWarningThreshold({
|
|
10560
10430
|
limit,
|
|
10561
10431
|
current
|
|
@@ -10584,13 +10454,12 @@ const useCustomerGroupsPlatormLimitsModalState = () => {
|
|
|
10584
10454
|
};
|
|
10585
10455
|
|
|
10586
10456
|
const PlatformLimitsCustomerGroupsNotifications = () => {
|
|
10587
|
-
var _platformLimits$custo;
|
|
10588
10457
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10589
10458
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10590
10459
|
const _useCustomerGroupsPla2 = useCustomerGroupsPlatformLimitsStatus(),
|
|
10591
10460
|
hasReachedCustomerGroupsWarningLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsWarningLimit,
|
|
10592
10461
|
hasReachedCustomerGroupsErrorLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsErrorLimit;
|
|
10593
|
-
if (!
|
|
10462
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
10594
10463
|
return jsx("div", {});
|
|
10595
10464
|
}
|
|
10596
10465
|
if (hasReachedCustomerGroupsErrorLimit) {
|
|
@@ -10641,16 +10510,15 @@ var styles$9 = {
|
|
|
10641
10510
|
"status": "platform-limits-customer-groups-status-module__status___6099G"
|
|
10642
10511
|
};
|
|
10643
10512
|
const PlatformLimitsCustomerGroupsStatus = () => {
|
|
10644
|
-
var _platformLimits$custo;
|
|
10645
10513
|
const intl = useIntl();
|
|
10646
10514
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
10647
10515
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
10648
|
-
if (!
|
|
10516
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
10649
10517
|
return null;
|
|
10650
10518
|
}
|
|
10651
|
-
const _platformLimits$
|
|
10652
|
-
current = _platformLimits$
|
|
10653
|
-
limit = _platformLimits$
|
|
10519
|
+
const _platformLimits$custo = platformLimits.customerGroups.total,
|
|
10520
|
+
current = _platformLimits$custo.current,
|
|
10521
|
+
limit = _platformLimits$custo.limit;
|
|
10654
10522
|
return jsx("div", {
|
|
10655
10523
|
className: styles$9.status,
|
|
10656
10524
|
children: jsx(Text.Detail, {
|
|
@@ -10882,7 +10750,7 @@ var fetchPimIndexStatus = ((apolloClient, projectKey) => async dispatch => {
|
|
|
10882
10750
|
try {
|
|
10883
10751
|
await dispatch(actions.head({
|
|
10884
10752
|
mcApiProxyTarget: MC_API_PROXY_TARGETS.PIM_SEARCH,
|
|
10885
|
-
uri:
|
|
10753
|
+
uri: `/${projectKey}/search/products`
|
|
10886
10754
|
}));
|
|
10887
10755
|
return {
|
|
10888
10756
|
status: 'indexed'
|
|
@@ -10973,8 +10841,8 @@ const getIndexingJobIds = _ref => {
|
|
|
10973
10841
|
products = _ref$data.products,
|
|
10974
10842
|
productTypes = _ref$data.productTypes;
|
|
10975
10843
|
return {
|
|
10976
|
-
productsJobId:
|
|
10977
|
-
productTypesJobId:
|
|
10844
|
+
productsJobId: products?.indexingJobId || products?.existingIndexingJobId,
|
|
10845
|
+
productTypesJobId: productTypes?.indexingJobId || productTypes?.existingIndexingJobId
|
|
10978
10846
|
};
|
|
10979
10847
|
};
|
|
10980
10848
|
let PimIndexerProvider = /*#__PURE__*/function (_PureComponent) {
|
|
@@ -11238,7 +11106,6 @@ const valueMapping = {
|
|
|
11238
11106
|
all: [true, false]
|
|
11239
11107
|
};
|
|
11240
11108
|
const BooleanField = props => {
|
|
11241
|
-
var _context;
|
|
11242
11109
|
let selectedValue;
|
|
11243
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]);
|
|
11244
11111
|
const yesLabel = props.intl.formatMessage(messages$8.yes);
|
|
@@ -11252,7 +11119,7 @@ const BooleanField = props => {
|
|
|
11252
11119
|
}];
|
|
11253
11120
|
if (props.isMulti) options.push({
|
|
11254
11121
|
value: 'all',
|
|
11255
|
-
label:
|
|
11122
|
+
label: `${yesLabel} / ${noLabel}`
|
|
11256
11123
|
});
|
|
11257
11124
|
return jsx(SelectInput, {
|
|
11258
11125
|
name: props.name,
|
|
@@ -11416,19 +11283,19 @@ const ScrollToFieldError = () => {
|
|
|
11416
11283
|
if (isValid) return;
|
|
11417
11284
|
const firstErrorElement = document.querySelector('[aria-invalid="true"]');
|
|
11418
11285
|
if (firstErrorElement) {
|
|
11419
|
-
var _ref, _ref2, _document$querySelect, _elementToScrollTo$sc;
|
|
11420
11286
|
// Get a reference to the label.
|
|
11421
11287
|
const firstElementId = firstErrorElement.getAttribute('id');
|
|
11422
|
-
const localizedInputIndex = _indexOfInstanceProperty(firstElementId).call(firstElementId,
|
|
11288
|
+
const localizedInputIndex = _indexOfInstanceProperty(firstElementId).call(firstElementId, `.${dataLocale}`);
|
|
11423
11289
|
|
|
11424
11290
|
// check if locale is appended then remove it from id
|
|
11425
|
-
const id = localizedInputIndex > -1 ? firstElementId.replace(
|
|
11291
|
+
const id = localizedInputIndex > -1 ? firstElementId.replace(`.${dataLocale}`, '') : firstElementId;
|
|
11426
11292
|
|
|
11427
11293
|
// Scroll to the label (if found), otherwise to the input element itself.
|
|
11428
11294
|
|
|
11429
|
-
const elementToScrollTo =
|
|
11430
|
-
|
|
11431
|
-
(
|
|
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?.({
|
|
11432
11299
|
behavior: 'smooth'
|
|
11433
11300
|
});
|
|
11434
11301
|
}
|
|
@@ -11454,8 +11321,7 @@ var styles$4 = {
|
|
|
11454
11321
|
"search-mode-menu": "selectable-field-search-input-module__search-mode-menu___Od6Le"
|
|
11455
11322
|
};
|
|
11456
11323
|
const SelectableFieldSearchInput = props => {
|
|
11457
|
-
|
|
11458
|
-
const _useState = useState((_props$initialValue = props.initialValue) !== null && _props$initialValue !== void 0 ? _props$initialValue : ''),
|
|
11324
|
+
const _useState = useState(props.initialValue ?? ''),
|
|
11459
11325
|
_useState2 = _slicedToArray(_useState, 2),
|
|
11460
11326
|
searchText = _useState2[0],
|
|
11461
11327
|
setSearchText = _useState2[1];
|
|
@@ -11491,7 +11357,7 @@ const SelectableFieldSearchInput = props => {
|
|
|
11491
11357
|
});
|
|
11492
11358
|
},
|
|
11493
11359
|
onReset: props.onReset,
|
|
11494
|
-
placeholder:
|
|
11360
|
+
placeholder: props.placeholder ?? intl.formatMessage(messages$5.placeholder),
|
|
11495
11361
|
isDisabled: props.disabled
|
|
11496
11362
|
})
|
|
11497
11363
|
});
|
|
@@ -11552,7 +11418,6 @@ StoreSelectField.defaultProps = {
|
|
|
11552
11418
|
mappedValueField: 'id'
|
|
11553
11419
|
};
|
|
11554
11420
|
|
|
11555
|
-
var _templateObject;
|
|
11556
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; }
|
|
11557
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; }
|
|
11558
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); }; }
|
|
@@ -11631,7 +11496,10 @@ const VALIDATOR_INTEGER = {
|
|
|
11631
11496
|
* has emitted a warning once in the logs, not for every instance
|
|
11632
11497
|
*/
|
|
11633
11498
|
let hasWarned = false;
|
|
11634
|
-
const warningMessage = oneLineTrim
|
|
11499
|
+
const warningMessage = oneLineTrim`
|
|
11500
|
+
\`validatedInput\` is no longer supported.
|
|
11501
|
+
Please use \`formik\` instead.
|
|
11502
|
+
`;
|
|
11635
11503
|
const ToolTipWrapperComponent = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
11636
11504
|
let children = _ref.children;
|
|
11637
11505
|
return jsx(Constraints.Horizontal, {
|
|
@@ -11780,7 +11648,7 @@ function validatedInput(InnerComponent, validators) {
|
|
|
11780
11648
|
}]);
|
|
11781
11649
|
return ValidatedInput;
|
|
11782
11650
|
}(PureComponent);
|
|
11783
|
-
ValidatedInput.displayName =
|
|
11651
|
+
ValidatedInput.displayName = `ValidatedInput(${_InnerComponent.displayName})`;
|
|
11784
11652
|
ValidatedInput.defaultProps = {
|
|
11785
11653
|
isValid: true,
|
|
11786
11654
|
getInputRef: () => {}
|
|
@@ -11922,7 +11790,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
11922
11790
|
truncate: true,
|
|
11923
11791
|
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$2.filterWholeInput), {}, {
|
|
11924
11792
|
values: {
|
|
11925
|
-
values: "
|
|
11793
|
+
values: `"${props.value}"`
|
|
11926
11794
|
}
|
|
11927
11795
|
})
|
|
11928
11796
|
})
|
|
@@ -11935,7 +11803,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
11935
11803
|
truncate: true,
|
|
11936
11804
|
intlMessage: _objectSpread$8(_objectSpread$8({}, messages$2.filterSeparateValues), {}, {
|
|
11937
11805
|
values: {
|
|
11938
|
-
values: "
|
|
11806
|
+
values: `"${props.multiValue.join('", "')}"` || props.value
|
|
11939
11807
|
}
|
|
11940
11808
|
})
|
|
11941
11809
|
})
|
|
@@ -12227,17 +12095,16 @@ function isEmpty(value) {
|
|
|
12227
12095
|
}
|
|
12228
12096
|
|
|
12229
12097
|
const buildSearchQuery = (searchQuery, searchMode, fragments) => {
|
|
12230
|
-
var _fragments$searchMode;
|
|
12231
12098
|
if (!searchQuery) return '';
|
|
12232
12099
|
const buildAllFieldsQueryString = query => {
|
|
12233
12100
|
const fragmentsArray = _Object$values(fragments);
|
|
12234
|
-
return
|
|
12101
|
+
return `( ${_mapInstanceProperty(fragmentsArray).call(fragmentsArray, fragment => fragment.getQuery(query)).join(' or ')} )`;
|
|
12235
12102
|
};
|
|
12236
12103
|
const trimmedSearchQuery = oneLine(searchQuery);
|
|
12237
12104
|
if (searchMode === 'allFields') {
|
|
12238
12105
|
return buildAllFieldsQueryString(trimmedSearchQuery);
|
|
12239
12106
|
}
|
|
12240
|
-
if (!fragments[searchMode] || typeof
|
|
12107
|
+
if (!fragments[searchMode] || typeof fragments[searchMode]?.getQuery !== 'function') {
|
|
12241
12108
|
return '';
|
|
12242
12109
|
}
|
|
12243
12110
|
return fragments[searchMode].getQuery(trimmedSearchQuery);
|
|
@@ -12468,11 +12335,11 @@ function createResourceReducer(options) {
|
|
|
12468
12335
|
|
|
12469
12336
|
// TODO: validate constant keys
|
|
12470
12337
|
const actionsMap = {
|
|
12471
|
-
[
|
|
12338
|
+
[`${plural}_FETCHED`]: (_, action) => ({
|
|
12472
12339
|
currentQueryResult: action.payload
|
|
12473
12340
|
}),
|
|
12474
|
-
[
|
|
12475
|
-
[
|
|
12341
|
+
[`${single}_UPDATED_IN_LIST`]: updateStatusInList(mergeData),
|
|
12342
|
+
[`${single}_DELETED_IN_LIST`]: (state, _ref) => {
|
|
12476
12343
|
let payload = _ref.payload;
|
|
12477
12344
|
const results = state.currentQueryResult.results;
|
|
12478
12345
|
return {
|
|
@@ -12484,27 +12351,27 @@ function createResourceReducer(options) {
|
|
|
12484
12351
|
})
|
|
12485
12352
|
};
|
|
12486
12353
|
},
|
|
12487
|
-
[
|
|
12354
|
+
[`${single}_FETCHED`]: (_, _ref3) => {
|
|
12488
12355
|
let payload = _ref3.payload;
|
|
12489
12356
|
return {
|
|
12490
12357
|
currentVisible: payload
|
|
12491
12358
|
};
|
|
12492
12359
|
},
|
|
12493
|
-
[
|
|
12360
|
+
[`${single}_CREATED`]: (_ref4, _ref5) => {
|
|
12494
12361
|
let currentVisible = _ref4.currentVisible;
|
|
12495
12362
|
let payload = _ref5.payload;
|
|
12496
12363
|
return {
|
|
12497
12364
|
currentVisible: mergeData(payload, currentVisible)
|
|
12498
12365
|
};
|
|
12499
12366
|
},
|
|
12500
|
-
[
|
|
12367
|
+
[`${single}_UPDATED`]: (_ref6, _ref7) => {
|
|
12501
12368
|
let currentVisible = _ref6.currentVisible;
|
|
12502
12369
|
let payload = _ref7.payload;
|
|
12503
12370
|
return {
|
|
12504
12371
|
currentVisible: mergeData(payload, currentVisible)
|
|
12505
12372
|
};
|
|
12506
12373
|
},
|
|
12507
|
-
[
|
|
12374
|
+
[`${single}_DELETED`]: () => ({
|
|
12508
12375
|
currentVisible: null
|
|
12509
12376
|
})
|
|
12510
12377
|
};
|
|
@@ -12521,12 +12388,11 @@ function formatCustomerAddress(_ref) {
|
|
|
12521
12388
|
}
|
|
12522
12389
|
|
|
12523
12390
|
function formatCustomerName(_ref) {
|
|
12524
|
-
var _context;
|
|
12525
12391
|
let firstName = _ref.firstName,
|
|
12526
12392
|
lastName = _ref.lastName;
|
|
12527
12393
|
if (firstName && !lastName) return _trimInstanceProperty(firstName).call(firstName);
|
|
12528
12394
|
if (!firstName && lastName) return _trimInstanceProperty(lastName).call(lastName);
|
|
12529
|
-
if (firstName && lastName) return
|
|
12395
|
+
if (firstName && lastName) return `${_trimInstanceProperty(firstName).call(firstName)} ${_trimInstanceProperty(lastName).call(lastName)}`;
|
|
12530
12396
|
return NO_VALUE_FALLBACK;
|
|
12531
12397
|
}
|
|
12532
12398
|
|
|
@@ -12576,10 +12442,7 @@ const validateText = (text, intl) => {
|
|
|
12576
12442
|
* @returns {boolean}
|
|
12577
12443
|
*/
|
|
12578
12444
|
const hasErrorCode = (unmappedApiErrors, errorCode) => {
|
|
12579
|
-
return _Array$isArray(unmappedApiErrors) && _someInstanceProperty(unmappedApiErrors).call(unmappedApiErrors, error =>
|
|
12580
|
-
var _error$extensions;
|
|
12581
|
-
return ((_error$extensions = error.extensions) === null || _error$extensions === void 0 ? void 0 : _error$extensions.code) === errorCode;
|
|
12582
|
-
});
|
|
12445
|
+
return _Array$isArray(unmappedApiErrors) && _someInstanceProperty(unmappedApiErrors).call(unmappedApiErrors, error => error.extensions?.code === errorCode);
|
|
12583
12446
|
};
|
|
12584
12447
|
|
|
12585
12448
|
const hasInvalidInputError = errors => hasErrorCode(errors, ERROR_CODES.invalidInput);
|
|
@@ -12591,7 +12454,7 @@ function minusify(value) {
|
|
|
12591
12454
|
return minus.concat(value);
|
|
12592
12455
|
}
|
|
12593
12456
|
|
|
12594
|
-
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), []));
|
|
12595
12458
|
const argsToArray = args => _reduceInstanceProperty(args).call(args, (result, item) => _concatInstanceProperty(result).call(result, item), []);
|
|
12596
12459
|
const exists = (field, attributeType) => ({
|
|
12597
12460
|
exists: {
|
|
@@ -12648,7 +12511,7 @@ const not = function () {
|
|
|
12648
12511
|
|
|
12649
12512
|
const safelyAddFallback = function (string) {
|
|
12650
12513
|
let fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NO_VALUE_FALLBACK;
|
|
12651
|
-
return string === '' ? fallback : string
|
|
12514
|
+
return string === '' ? fallback : string ?? fallback;
|
|
12652
12515
|
};
|
|
12653
12516
|
|
|
12654
12517
|
var messages$1 = defineMessages({
|
|
@@ -12783,19 +12646,19 @@ const computedProperties = {
|
|
|
12783
12646
|
// has been deleted. See MC-1925 for further information.
|
|
12784
12647
|
const filteredCategories = _filterInstanceProperty(_context6 = product.categories).call(_context6, category => category.obj !== undefined);
|
|
12785
12648
|
return _mapInstanceProperty(filteredCategories).call(filteredCategories, category => {
|
|
12786
|
-
var _context7;
|
|
12787
12649
|
const categoryPath = getPathName(category, language, languages);
|
|
12788
12650
|
const ancestors = getAncestors(category, language);
|
|
12789
|
-
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
|
|
12790
12653
|
// translated. This has been communicated with Jenn
|
|
12791
|
-
|
|
12654
|
+
`| ext. ID: ${category.obj.externalId}` : '';
|
|
12792
12655
|
return {
|
|
12793
12656
|
id: category.id,
|
|
12794
|
-
name:
|
|
12657
|
+
name: `${formatLocalizedString(category.obj, {
|
|
12795
12658
|
key: 'name',
|
|
12796
12659
|
locale: language,
|
|
12797
12660
|
fallbackOrder: languages
|
|
12798
|
-
})
|
|
12661
|
+
})} ${externalIdValue}`,
|
|
12799
12662
|
path: categoryPath,
|
|
12800
12663
|
level: ancestors.length
|
|
12801
12664
|
};
|
|
@@ -12832,13 +12695,13 @@ const getAttributeValueByType = _ref12 => {
|
|
|
12832
12695
|
value: value
|
|
12833
12696
|
});
|
|
12834
12697
|
case 'enum':
|
|
12835
|
-
return safelyAddFallback(value.label,
|
|
12698
|
+
return safelyAddFallback(value.label, `${value.key} (key)`);
|
|
12836
12699
|
case 'lenum':
|
|
12837
12700
|
return safelyAddFallback(formatLocalizedString(value, {
|
|
12838
12701
|
key: 'label',
|
|
12839
12702
|
locale: projectDataLocale,
|
|
12840
12703
|
fallbackOrder: projectLanguages
|
|
12841
|
-
}),
|
|
12704
|
+
}), `${value.key} (key)`);
|
|
12842
12705
|
case 'number':
|
|
12843
12706
|
return safelyAddFallback(value);
|
|
12844
12707
|
case 'boolean':
|
|
@@ -12961,7 +12824,6 @@ const reorderArrayItems = (array, from, to) => {
|
|
|
12961
12824
|
const mapTimeZonesToOptions = memoize(timeZones => {
|
|
12962
12825
|
var _context;
|
|
12963
12826
|
return _mapInstanceProperty(_context = _Object$entries(timeZones)).call(_context, _ref => {
|
|
12964
|
-
var _context2;
|
|
12965
12827
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
12966
12828
|
code = _ref2[0],
|
|
12967
12829
|
value = _ref2[1];
|
|
@@ -12970,7 +12832,7 @@ const mapTimeZonesToOptions = memoize(timeZones => {
|
|
|
12970
12832
|
//E.g. `(GMT +02:00) Central European Time - Berlin`
|
|
12971
12833
|
// unicode clock hex code: \u25F7
|
|
12972
12834
|
//
|
|
12973
|
-
label:
|
|
12835
|
+
label: `(GMT ${value.offset}) ${value.name}`
|
|
12974
12836
|
};
|
|
12975
12837
|
});
|
|
12976
12838
|
});
|
|
@@ -12978,12 +12840,9 @@ const getTimeZoneId = memoize((selectedTimeZone, timeZones) => {
|
|
|
12978
12840
|
if (timeZones[selectedTimeZone]) {
|
|
12979
12841
|
return selectedTimeZone;
|
|
12980
12842
|
} else {
|
|
12981
|
-
var
|
|
12982
|
-
const fallbackTimeZoneId = _findInstanceProperty(
|
|
12983
|
-
|
|
12984
|
-
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);
|
|
12985
|
-
});
|
|
12986
|
-
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) {
|
|
12987
12846
|
return fallbackTimeZoneId.toString();
|
|
12988
12847
|
} else {
|
|
12989
12848
|
return 'UTC';
|
|
@@ -12991,10 +12850,9 @@ const getTimeZoneId = memoize((selectedTimeZone, timeZones) => {
|
|
|
12991
12850
|
}
|
|
12992
12851
|
});
|
|
12993
12852
|
const getTimeZoneLabel = memoize((selectedTimeZone, timeZones) => {
|
|
12994
|
-
var _context4;
|
|
12995
12853
|
const timeZoneId = getTimeZoneId(selectedTimeZone, timeZones);
|
|
12996
12854
|
const timeZoneData = timeZones[timeZoneId];
|
|
12997
|
-
return
|
|
12855
|
+
return `(GMT ${timeZoneData.offset}) ${timeZoneData.name}`;
|
|
12998
12856
|
});
|
|
12999
12857
|
|
|
13000
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; }
|
|
@@ -13055,8 +12913,7 @@ const typeDefinitionsExist = typeDefinitions => {
|
|
|
13055
12913
|
return typeDefinitions.length > 0;
|
|
13056
12914
|
};
|
|
13057
12915
|
const typeDefinitionSelected = formValues => {
|
|
13058
|
-
|
|
13059
|
-
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;
|
|
13060
12917
|
};
|
|
13061
12918
|
const typeDefinitionContainsFieldDefinitions = formValues => {
|
|
13062
12919
|
return formValues[FIELD_NAME].type.obj.key && formValues[FIELD_NAME].type.obj.fieldDefinitions.length > 0;
|
|
@@ -13091,7 +12948,7 @@ const CustomFieldsInputWrapper = _ref2 => {
|
|
|
13091
12948
|
max: "scale",
|
|
13092
12949
|
children: jsx(CustomFields, {
|
|
13093
12950
|
isReadOnly: isReadOnly,
|
|
13094
|
-
name:
|
|
12951
|
+
name: `${FIELD_NAME}.fields`,
|
|
13095
12952
|
fieldDefinitions: isReadOnly && hideEmptyFields ? fieldDefinitionsWithValues(formValues) : formValues[FIELD_NAME].type.obj.fieldDefinitions
|
|
13096
12953
|
})
|
|
13097
12954
|
});
|
|
@@ -13126,7 +12983,6 @@ const createFormStateFromTypeDefinition = selectedTypeDefinition => {
|
|
|
13126
12983
|
};
|
|
13127
12984
|
};
|
|
13128
12985
|
const CustomTypeSubform = _ref => {
|
|
13129
|
-
var _formValues$FIELD_NAM3, _formValues$FIELD_NAM4;
|
|
13130
12986
|
let typeDefinitions = _ref.typeDefinitions,
|
|
13131
12987
|
isReadOnly = _ref.isReadOnly,
|
|
13132
12988
|
isCondensed = _ref.isCondensed,
|
|
@@ -13158,8 +13014,7 @@ const CustomTypeSubform = _ref => {
|
|
|
13158
13014
|
}
|
|
13159
13015
|
}, [typeDefinitions, setFieldValue, validateForm]);
|
|
13160
13016
|
const typeDefinitionSelected = formValues => {
|
|
13161
|
-
|
|
13162
|
-
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;
|
|
13163
13018
|
};
|
|
13164
13019
|
|
|
13165
13020
|
// if the user has read-only permissions, empty fields are hidden, and no type definition is selected, hide the component
|
|
@@ -13174,9 +13029,9 @@ const CustomTypeSubform = _ref => {
|
|
|
13174
13029
|
children: jsx(SelectInput, {
|
|
13175
13030
|
isClearable: true,
|
|
13176
13031
|
"data-testid": "custom-type-select",
|
|
13177
|
-
name:
|
|
13178
|
-
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages,
|
|
13179
|
-
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,
|
|
13180
13035
|
onChange: handleTypeDefinitionSelect,
|
|
13181
13036
|
placeholder: formatMessage(messages.typesPlaceholder),
|
|
13182
13037
|
isReadOnly: isReadOnly
|
|
@@ -13195,8 +13050,7 @@ CustomTypeSubform.displayName = 'CustomTypeSubform';
|
|
|
13195
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; }
|
|
13196
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; }
|
|
13197
13052
|
const transformFieldType = fieldDefinition => {
|
|
13198
|
-
|
|
13199
|
-
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') {
|
|
13200
13054
|
var _context;
|
|
13201
13055
|
return _objectSpread(_objectSpread({}, fieldDefinition.type), {}, {
|
|
13202
13056
|
elementType: _objectSpread(_objectSpread({}, fieldDefinition.type.elementType), {}, {
|
|
@@ -13206,7 +13060,7 @@ const transformFieldType = fieldDefinition => {
|
|
|
13206
13060
|
}))
|
|
13207
13061
|
})
|
|
13208
13062
|
});
|
|
13209
|
-
} else if (
|
|
13063
|
+
} else if (fieldDefinition.type?.name === 'LocalizedEnum') {
|
|
13210
13064
|
var _context2;
|
|
13211
13065
|
return _objectSpread(_objectSpread({}, fieldDefinition.type), {}, {
|
|
13212
13066
|
values: _mapInstanceProperty(_context2 = _valuesInstanceProperty(fieldDefinition.type)).call(_context2, value => ({
|