@commercetools-frontend/experimental-components 6.1.2 → 6.1.4
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 +468 -614
- package/dist/commercetools-frontend-experimental-components.cjs.prod.js +466 -612
- package/dist/commercetools-frontend-experimental-components.esm.js +466 -612
- package/dist/styles.css +12 -12
- package/package.json +21 -19
|
@@ -25,7 +25,6 @@ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/esm/objectW
|
|
|
25
25
|
import _toArray from '@babel/runtime-corejs3/helpers/esm/toArray';
|
|
26
26
|
import _reverseInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reverse';
|
|
27
27
|
import _sliceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/slice';
|
|
28
|
-
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
29
28
|
import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
|
|
30
29
|
import { useApolloClient, useQuery as useQuery$1 } from '@apollo/client';
|
|
31
30
|
import { useQuery, useApolloClient as useApolloClient$1 } from '@apollo/client/react';
|
|
@@ -55,7 +54,6 @@ import { useFeatureToggle, useAdapterStatus } from '@commercetools-frontend/appl
|
|
|
55
54
|
import debounce from 'debounce-promise';
|
|
56
55
|
import _findInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
57
56
|
import pick from 'lodash/pick';
|
|
58
|
-
import _taggedTemplateLiteral from '@babel/runtime-corejs3/helpers/esm/taggedTemplateLiteral';
|
|
59
57
|
import oneLine from 'common-tags/lib/oneLine';
|
|
60
58
|
import moment from 'moment';
|
|
61
59
|
import _someInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/some';
|
|
@@ -69,7 +67,6 @@ import isEmpty$3 from 'lodash/isEmpty';
|
|
|
69
67
|
import omit from 'lodash/omit';
|
|
70
68
|
import _Object$freeze from '@babel/runtime-corejs3/core-js-stable/object/freeze';
|
|
71
69
|
import originalOmitDeep from 'omit-deep';
|
|
72
|
-
import _findIndexInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/find-index';
|
|
73
70
|
import _parseInt from '@babel/runtime-corejs3/core-js-stable/parse-int';
|
|
74
71
|
import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
|
|
75
72
|
import _indexOfInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/index-of';
|
|
@@ -102,12 +99,14 @@ import uniqBy from 'lodash/uniqBy';
|
|
|
102
99
|
import invariant from 'tiny-invariant';
|
|
103
100
|
import hoistNonReactStatics from 'hoist-non-react-statics';
|
|
104
101
|
import { connect } from 'react-redux';
|
|
102
|
+
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
105
103
|
import _Math$trunc from '@babel/runtime-corejs3/core-js-stable/math/trunc';
|
|
106
104
|
import _Number$isNaN from '@babel/runtime-corejs3/core-js-stable/number/is-nan';
|
|
107
105
|
import Cleave from 'cleave.js/react';
|
|
108
106
|
import isFinite from 'lodash/isFinite';
|
|
109
107
|
import isUndefined from 'lodash/isUndefined';
|
|
110
108
|
import _Object$assign from '@babel/runtime-corejs3/core-js-stable/object/assign';
|
|
109
|
+
import _findIndexInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/find-index';
|
|
111
110
|
import flatMap from 'lodash/flatMap';
|
|
112
111
|
import compact from 'lodash/compact';
|
|
113
112
|
import _Set from '@babel/runtime-corejs3/core-js-stable/set';
|
|
@@ -199,9 +198,8 @@ function _objectSpread$1r(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
|
199
198
|
var GetChannelsQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetChannelsQuery" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "where" } }, type: { kind: "NamedType", name: { kind: "Name", value: "String" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "sortByNamePath" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "channels" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "where" }, value: { kind: "Variable", name: { kind: "Name", value: "where" } } }, { kind: "Argument", name: { kind: "Name", value: "sort" }, value: { kind: "ListValue", values: [{ kind: "Variable", name: { kind: "Name", value: "sortByNamePath" } }, { kind: "StringValue", value: "key", block: false }] } }, { kind: "Argument", name: { kind: "Name", value: "limit" }, value: { kind: "IntValue", value: "60" } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "FragmentSpread", name: { kind: "Name", value: "PickerInputChannel" }, directives: [] }] } }] } }] } }, { kind: "FragmentDefinition", name: { kind: "Name", value: "PickerInputChannel" }, typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Channel" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 392, source: { body: "fragment PickerInputChannel on Channel {\n id\n key\n nameAllLocales {\n locale\n value\n }\n}\n\nquery GetChannelsQuery($where: String, $sortByNamePath: String!) {\n channels(where: $where, sort: [$sortByNamePath, \"key\"], limit: 60) {\n total\n results {\n ...PickerInputChannel\n }\n }\n}\n\nquery GetChannelQuery($id: String) {\n channel(id: $id) {\n ...PickerInputChannel\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
200
199
|
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 } } } };
|
|
201
200
|
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 } } } };
|
|
202
|
-
const getRolesClause = roles => roles && roles.length > 0 ?
|
|
201
|
+
const getRolesClause = roles => roles && roles.length > 0 ? `roles contains any (${_mapInstanceProperty(roles).call(roles, role => `"${role}"`).join(',')})` : undefined;
|
|
203
202
|
const ChannelPickerInput = _ref => {
|
|
204
|
-
var _currentOption$data$l, _currentOption$data;
|
|
205
203
|
let isClearable = _ref.isClearable,
|
|
206
204
|
isDisabled = _ref.isDisabled,
|
|
207
205
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -221,7 +219,7 @@ const ChannelPickerInput = _ref => {
|
|
|
221
219
|
const variables = useMemo(() => {
|
|
222
220
|
const rolesClause = getRolesClause(roles);
|
|
223
221
|
return _objectSpread$1r({
|
|
224
|
-
sortByNamePath:
|
|
222
|
+
sortByNamePath: `name.${dataLocale}`
|
|
225
223
|
}, rolesClause && {
|
|
226
224
|
extraWhere: rolesClause
|
|
227
225
|
});
|
|
@@ -242,7 +240,7 @@ const ChannelPickerInput = _ref => {
|
|
|
242
240
|
}
|
|
243
241
|
return channel;
|
|
244
242
|
}, [formatLocalizedFieldToString]);
|
|
245
|
-
const prefixSearchFields = useMemo(() => [
|
|
243
|
+
const prefixSearchFields = useMemo(() => [`name.${dataLocale}`, 'key'], [dataLocale]);
|
|
246
244
|
const loadOptions = useLoadOptions({
|
|
247
245
|
query: GetChannelsQuery,
|
|
248
246
|
variables,
|
|
@@ -277,13 +275,13 @@ const ChannelPickerInput = _ref => {
|
|
|
277
275
|
setLoadingError(null);
|
|
278
276
|
handleInternalInputChange(event);
|
|
279
277
|
}, [handleInternalInputChange]);
|
|
280
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
278
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
281
279
|
useEffect(() => {
|
|
282
280
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
283
281
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
284
282
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
285
283
|
const handleNoOptions = useCallback(() => loadingError ? null : formatMessage(messages$K.noChannelsFound), [loadingError, formatMessage]);
|
|
286
|
-
const tooltipTitle =
|
|
284
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
287
285
|
return jsx(Constraints.Horizontal, {
|
|
288
286
|
max: "scale",
|
|
289
287
|
children: jsxs(Spacings.Stack, {
|
|
@@ -293,7 +291,7 @@ const ChannelPickerInput = _ref => {
|
|
|
293
291
|
children: jsx(AsyncSelectInput, {
|
|
294
292
|
id: name,
|
|
295
293
|
name: name,
|
|
296
|
-
placeholder: placeholder
|
|
294
|
+
placeholder: placeholder ?? formatMessage(messages$K.placeholder),
|
|
297
295
|
loadOptions: loadOptionsDebounced,
|
|
298
296
|
defaultOptions: true,
|
|
299
297
|
showOptionGroupDivider: true,
|
|
@@ -335,10 +333,9 @@ let FormattedDateTime = /*#__PURE__*/function (_PureComponent) {
|
|
|
335
333
|
value: function render() {
|
|
336
334
|
return jsx(ApplicationContext, {
|
|
337
335
|
render: _ref => {
|
|
338
|
-
var _this$props;
|
|
339
336
|
let user = _ref.user;
|
|
340
337
|
return formatDateTime$1(this.props.type, this.props.value, {
|
|
341
|
-
timeZone:
|
|
338
|
+
timeZone: this?.props?.timeZone || user?.timeZone,
|
|
342
339
|
locale: this.props.intl.locale
|
|
343
340
|
});
|
|
344
341
|
}
|
|
@@ -377,7 +374,6 @@ const convertProductTypeToOption = productType => {
|
|
|
377
374
|
};
|
|
378
375
|
};
|
|
379
376
|
const ProductTypePickerInput = _ref => {
|
|
380
|
-
var _currentOption$data$l, _currentOption$data;
|
|
381
377
|
let isClearable = _ref.isClearable,
|
|
382
378
|
isDisabled = _ref.isDisabled,
|
|
383
379
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -409,9 +405,8 @@ const ProductTypePickerInput = _ref => {
|
|
|
409
405
|
itemToOption: convertProductTypeToOption
|
|
410
406
|
});
|
|
411
407
|
const handleLoadOptions = useCallback(inputValue => loadProductTypes(inputValue).then(_ref3 => {
|
|
412
|
-
var _data$productTypes;
|
|
413
408
|
let data = _ref3.data;
|
|
414
|
-
return
|
|
409
|
+
return data.productTypes?.results || [];
|
|
415
410
|
}).then(productTypes => _mapInstanceProperty(productTypes).call(productTypes, convertProductTypeToOption)).catch(error => {
|
|
416
411
|
setLoadingError(error);
|
|
417
412
|
onError(error);
|
|
@@ -425,12 +420,12 @@ const ProductTypePickerInput = _ref => {
|
|
|
425
420
|
setLoadingError(null);
|
|
426
421
|
handleInternalInputChange(event);
|
|
427
422
|
}, [handleInternalInputChange]);
|
|
428
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
423
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
429
424
|
useEffect(() => {
|
|
430
425
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
431
426
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
432
427
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
433
|
-
const tooltipTitle =
|
|
428
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
434
429
|
return jsx(Constraints.Horizontal, {
|
|
435
430
|
max: "scale",
|
|
436
431
|
children: currentOption.loading ? jsx(CenteredLoadingSpinner, {}) : jsxs(Spacings.Stack, {
|
|
@@ -484,7 +479,6 @@ var messages$I = defineMessages({
|
|
|
484
479
|
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 } } } };
|
|
485
480
|
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 } } } };
|
|
486
481
|
const StatePickerInput = _ref => {
|
|
487
|
-
var _currentOption$data$l, _currentOption$data;
|
|
488
482
|
let isClearable = _ref.isClearable,
|
|
489
483
|
isDisabled = _ref.isDisabled,
|
|
490
484
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -500,7 +494,7 @@ const StatePickerInput = _ref => {
|
|
|
500
494
|
formatMessage = _useIntl.formatMessage;
|
|
501
495
|
const dataLocale = useApplicationContext(applicationContext => applicationContext.dataLocale);
|
|
502
496
|
const variables = useMemo(() => ({
|
|
503
|
-
sortByNamePath:
|
|
497
|
+
sortByNamePath: `name.${dataLocale}`
|
|
504
498
|
}), [dataLocale]);
|
|
505
499
|
const convertStateToOption = useCallback(state => {
|
|
506
500
|
const localizedName = formatLocalizedFieldToString(state.nameAllLocales);
|
|
@@ -515,7 +509,7 @@ const StatePickerInput = _ref => {
|
|
|
515
509
|
_useState2 = _slicedToArray(_useState, 2),
|
|
516
510
|
loadingError = _useState2[0],
|
|
517
511
|
setLoadingError = _useState2[1];
|
|
518
|
-
const prefixSearchFields = useMemo(() => [
|
|
512
|
+
const prefixSearchFields = useMemo(() => [`name.${dataLocale}`, 'key'], [dataLocale]);
|
|
519
513
|
const loadOptions = useLoadOptions({
|
|
520
514
|
query: GetStatesQuery,
|
|
521
515
|
variables,
|
|
@@ -548,13 +542,13 @@ const StatePickerInput = _ref => {
|
|
|
548
542
|
setLoadingError(null);
|
|
549
543
|
handleInternalInputChange(event);
|
|
550
544
|
}, [handleInternalInputChange]);
|
|
551
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
545
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
552
546
|
useEffect(() => {
|
|
553
547
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
554
548
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
555
549
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
556
550
|
const handleNoOptions = useCallback(() => loadingError ? null : formatMessage(messages$I.noStatesFound), [loadingError, formatMessage]);
|
|
557
|
-
const tooltipTitle =
|
|
551
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
558
552
|
return jsx(Constraints.Horizontal, {
|
|
559
553
|
max: "scale",
|
|
560
554
|
children: currentOption.loading ? jsx(CenteredLoadingSpinner, {}) : jsxs(Spacings.Stack, {
|
|
@@ -668,10 +662,9 @@ const useHandlers = onChange => {
|
|
|
668
662
|
setInputValue(changedValue);
|
|
669
663
|
}, []);
|
|
670
664
|
const handleChange = useEventCallback(event => {
|
|
671
|
-
var _event$target$value;
|
|
672
665
|
const eventWithExtractedValue = _objectSpread$1o(_objectSpread$1o({}, event), {}, {
|
|
673
666
|
target: _objectSpread$1o(_objectSpread$1o({}, event.target), {}, {
|
|
674
|
-
value:
|
|
667
|
+
value: event.target.value?.value
|
|
675
668
|
})
|
|
676
669
|
});
|
|
677
670
|
onChange(eventWithExtractedValue);
|
|
@@ -681,24 +674,21 @@ const useHandlers = onChange => {
|
|
|
681
674
|
|
|
682
675
|
const _excluded$3 = ["extraWhere"];
|
|
683
676
|
function ownKeys$1n(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; }
|
|
684
|
-
function _objectSpread$1n(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
677
|
+
function _objectSpread$1n(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys$1n(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys$1n(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
685
678
|
const constructPrefixSearchPredicate$1 = function () {
|
|
686
679
|
let prefixSearchFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
687
680
|
let lowerBound = arguments.length > 1 ? arguments[1] : undefined;
|
|
688
681
|
let upperBound = arguments.length > 2 ? arguments[2] : undefined;
|
|
689
682
|
const constructPrefixSearchExpression = field => {
|
|
690
|
-
var _context
|
|
683
|
+
var _context;
|
|
691
684
|
const path = field.split('.');
|
|
692
685
|
const _path$slice$reverse = _reverseInstanceProperty(_context = _sliceInstanceProperty(path).call(path)).call(_context),
|
|
693
686
|
_path$slice$reverse2 = _toArray(_path$slice$reverse),
|
|
694
687
|
finalValueInPath = _path$slice$reverse2[0],
|
|
695
688
|
remainPathInReverse = _sliceInstanceProperty(_path$slice$reverse2).call(_path$slice$reverse2, 1);
|
|
696
|
-
const comparison =
|
|
689
|
+
const comparison = `${finalValueInPath} >= "${lowerBound}" and ${finalValueInPath} < "${upperBound}"`;
|
|
697
690
|
if (remainPathInReverse.length) {
|
|
698
|
-
return _reduceInstanceProperty(remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) => {
|
|
699
|
-
var _context5;
|
|
700
|
-
return _concatInstanceProperty(_context5 = "".concat(nextPath, "(")).call(_context5, nestedPath, ")");
|
|
701
|
-
}, comparison);
|
|
691
|
+
return _reduceInstanceProperty(remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) => `${nextPath}(${nestedPath})`, comparison);
|
|
702
692
|
}
|
|
703
693
|
return comparison;
|
|
704
694
|
};
|
|
@@ -714,7 +704,7 @@ const useLoadOptions = _ref => {
|
|
|
714
704
|
let where;
|
|
715
705
|
if (inputValue.length) {
|
|
716
706
|
if (isUUID(inputValue)) {
|
|
717
|
-
where =
|
|
707
|
+
where = `id = "${inputValue}"`;
|
|
718
708
|
} else {
|
|
719
709
|
const _getPrefixSearchBound = getPrefixSearchBounds(inputValue),
|
|
720
710
|
_getPrefixSearchBound2 = _slicedToArray(_getPrefixSearchBound, 2),
|
|
@@ -723,12 +713,11 @@ const useLoadOptions = _ref => {
|
|
|
723
713
|
where = constructPrefixSearchPredicate$1(prefixSearchFields, lowerBound, upperBound);
|
|
724
714
|
}
|
|
725
715
|
}
|
|
726
|
-
const _ref2 = variables
|
|
716
|
+
const _ref2 = variables ?? {},
|
|
727
717
|
extraWhere = _ref2.extraWhere,
|
|
728
718
|
restVariables = _objectWithoutProperties(_ref2, _excluded$3);
|
|
729
719
|
if (typeof extraWhere === 'string') {
|
|
730
|
-
|
|
731
|
-
where = where ? _concatInstanceProperty(_context6 = "(".concat(where, ") and ")).call(_context6, variables.extraWhere) : variables.extraWhere;
|
|
720
|
+
where = where ? `(${where}) and ${variables.extraWhere}` : variables.extraWhere;
|
|
732
721
|
}
|
|
733
722
|
return client.query({
|
|
734
723
|
query,
|
|
@@ -758,12 +747,12 @@ const useExecuteGraphQLRequest = () => {
|
|
|
758
747
|
};
|
|
759
748
|
const createSearchProductsFromPIMAction = (searchTerm, projectKey) => actions.post({
|
|
760
749
|
mcApiProxyTarget: MC_API_PROXY_TARGETS.PIM_SEARCH,
|
|
761
|
-
uri:
|
|
750
|
+
uri: `/${projectKey}/search/product-types`,
|
|
762
751
|
payload: {
|
|
763
752
|
query: {
|
|
764
753
|
wildcard: {
|
|
765
754
|
field: 'name',
|
|
766
|
-
value:
|
|
755
|
+
value: `*${searchTerm}*`,
|
|
767
756
|
caseInsensitive: true
|
|
768
757
|
}
|
|
769
758
|
},
|
|
@@ -777,9 +766,8 @@ const useFetchProductTypesFromPIM = _ref => {
|
|
|
777
766
|
const dispatch = useAsyncDispatch();
|
|
778
767
|
const executeGraphQLRequest = useExecuteGraphQLRequest();
|
|
779
768
|
const fetchProductTypesFromPim = useCallback(async searchTerm => {
|
|
780
|
-
var _result$hits$map, _result$hits;
|
|
781
769
|
const result = await dispatch(createSearchProductsFromPIMAction(searchTerm, projectKey));
|
|
782
|
-
const ids =
|
|
770
|
+
const ids = result?.hits?.map(hit => hit.id) ?? [];
|
|
783
771
|
// Avoid sending any requests if it's clear that nothing is found
|
|
784
772
|
if (ids.length === 0) {
|
|
785
773
|
return {
|
|
@@ -814,22 +802,19 @@ const useFetchProductTypesFromPIM = _ref => {
|
|
|
814
802
|
*/
|
|
815
803
|
const constructNestedExpression = (reversedPath, predicate) => {
|
|
816
804
|
if (reversedPath.length > 0) {
|
|
817
|
-
return _reduceInstanceProperty(reversedPath).call(reversedPath, (nextNestedValue, nestedSelection) => {
|
|
818
|
-
var _context;
|
|
819
|
-
return _concatInstanceProperty(_context = "".concat(nestedSelection, "(")).call(_context, nextNestedValue, ")");
|
|
820
|
-
}, predicate);
|
|
805
|
+
return _reduceInstanceProperty(reversedPath).call(reversedPath, (nextNestedValue, nestedSelection) => `${nestedSelection}(${nextNestedValue})`, predicate);
|
|
821
806
|
}
|
|
822
807
|
return predicate;
|
|
823
808
|
};
|
|
824
809
|
const constructPrefixSearchPredicate = (prefixSearchFields, lowerBound, upperBound) => {
|
|
825
810
|
const constructPrefixSearchExpression = field => {
|
|
826
|
-
var
|
|
811
|
+
var _context;
|
|
827
812
|
const parts = field.split('.');
|
|
828
|
-
const _parts$slice$reverse = _reverseInstanceProperty(
|
|
813
|
+
const _parts$slice$reverse = _reverseInstanceProperty(_context = _sliceInstanceProperty(parts).call(parts)).call(_context),
|
|
829
814
|
_parts$slice$reverse2 = _toArray(_parts$slice$reverse),
|
|
830
815
|
valueToNest = _parts$slice$reverse2[0],
|
|
831
816
|
reversedPathToNestedValue = _sliceInstanceProperty(_parts$slice$reverse2).call(_parts$slice$reverse2, 1);
|
|
832
|
-
const predicateExpression =
|
|
817
|
+
const predicateExpression = `${valueToNest} >= "${lowerBound}" and ${valueToNest} < "${upperBound}"`;
|
|
833
818
|
return constructNestedExpression(reversedPathToNestedValue, predicateExpression);
|
|
834
819
|
};
|
|
835
820
|
return _mapInstanceProperty(prefixSearchFields).call(prefixSearchFields, constructPrefixSearchExpression).join(' or ');
|
|
@@ -837,7 +822,7 @@ const constructPrefixSearchPredicate = (prefixSearchFields, lowerBound, upperBou
|
|
|
837
822
|
const constructWherePredicate = (inputValue, prefixSearchFields) => {
|
|
838
823
|
const wherePredicate = function () {
|
|
839
824
|
if (inputValue.length) {
|
|
840
|
-
if (isUUID(inputValue)) return
|
|
825
|
+
if (isUUID(inputValue)) return `id = "${inputValue}"`;else {
|
|
841
826
|
const _getPrefixSearchBound = getPrefixSearchBounds(inputValue),
|
|
842
827
|
_getPrefixSearchBound2 = _slicedToArray(_getPrefixSearchBound, 2),
|
|
843
828
|
lowerBound = _getPrefixSearchBound2[0],
|
|
@@ -862,7 +847,6 @@ const useFetchProductTypessFromCTP = _ref2 => {
|
|
|
862
847
|
}, [prefixSearchFields, executeGraphQLRequest]);
|
|
863
848
|
};
|
|
864
849
|
const usePimStatus = () => {
|
|
865
|
-
var _data$indicesExist;
|
|
866
850
|
const _useQuery = useQuery(FetchIndicesExist$1, {
|
|
867
851
|
context: {
|
|
868
852
|
target: GRAPHQL_TARGETS.PIM_INDEXER
|
|
@@ -872,20 +856,17 @@ const usePimStatus = () => {
|
|
|
872
856
|
data = _useQuery.data;
|
|
873
857
|
return {
|
|
874
858
|
data,
|
|
875
|
-
isProjectIndexed: Boolean(data
|
|
859
|
+
isProjectIndexed: Boolean(data?.indicesExist?.productTypes?.searchableIndexExists)
|
|
876
860
|
};
|
|
877
861
|
};
|
|
878
862
|
const useProductTypeOptions = _ref3 => {
|
|
879
863
|
let prefixSearchFields = _ref3.prefixSearchFields;
|
|
880
864
|
const _usePimStatus = usePimStatus(),
|
|
881
865
|
isProjectIndexed = _usePimStatus.isProjectIndexed;
|
|
882
|
-
const _useApplicationContex = useApplicationContext(context => {
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key
|
|
887
|
-
};
|
|
888
|
-
}),
|
|
866
|
+
const _useApplicationContex = useApplicationContext(context => ({
|
|
867
|
+
dataLocale: context.dataLocale,
|
|
868
|
+
projectKey: context.project?.key
|
|
869
|
+
})),
|
|
889
870
|
dataLocale = _useApplicationContex.dataLocale,
|
|
890
871
|
projectKey = _useApplicationContex.projectKey;
|
|
891
872
|
const fetchProductTypesFromPim = useFetchProductTypesFromPIM({
|
|
@@ -902,7 +883,6 @@ const useProductTypeOptions = _ref3 => {
|
|
|
902
883
|
};
|
|
903
884
|
|
|
904
885
|
function useCurrentOption(_ref) {
|
|
905
|
-
var _context;
|
|
906
886
|
let id = _ref.id,
|
|
907
887
|
typename = _ref.typename,
|
|
908
888
|
query = _ref.query,
|
|
@@ -914,7 +894,7 @@ function useCurrentOption(_ref) {
|
|
|
914
894
|
// load from cache when possible to speed up initial render
|
|
915
895
|
const canReadFromCache = id && typename && fragment;
|
|
916
896
|
const cacheItem = canReadFromCache ? apolloClient.readFragment({
|
|
917
|
-
id:
|
|
897
|
+
id: `${typename}:${id}`,
|
|
918
898
|
fragment
|
|
919
899
|
}) : undefined;
|
|
920
900
|
|
|
@@ -932,7 +912,7 @@ function useCurrentOption(_ref) {
|
|
|
932
912
|
queryData = _useQuery.data,
|
|
933
913
|
queryError = _useQuery.error;
|
|
934
914
|
const queryItem = queryData && queryDataToItem(queryData);
|
|
935
|
-
const item = queryItem
|
|
915
|
+
const item = queryItem ?? cacheItem;
|
|
936
916
|
const loading = item ? false : queryLoading;
|
|
937
917
|
const error = item ? undefined : queryError;
|
|
938
918
|
const data = item && itemToOption(item);
|
|
@@ -961,10 +941,7 @@ const setDisplayName = nextDisplayName => Component => {
|
|
|
961
941
|
|
|
962
942
|
const keepDisplayName = component => setDisplayName(getDisplayName(component));
|
|
963
943
|
|
|
964
|
-
const wrapDisplayName = (BaseComponent, hocName) => {
|
|
965
|
-
var _context;
|
|
966
|
-
return _concatInstanceProperty(_context = "".concat(hocName, "(")).call(_context, getDisplayName(BaseComponent), ")");
|
|
967
|
-
};
|
|
944
|
+
const wrapDisplayName = (BaseComponent, hocName) => `${hocName}(${getDisplayName(BaseComponent)})`;
|
|
968
945
|
|
|
969
946
|
function ownKeys$1m(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; }
|
|
970
947
|
function _objectSpread$1m(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$1m(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$1m(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -1079,7 +1056,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
1079
1056
|
};
|
|
1080
1057
|
_this.doDelayedUpdate = (updateFunction, event, eventType) => {
|
|
1081
1058
|
const self = _this;
|
|
1082
|
-
const timeoutKey =
|
|
1059
|
+
const timeoutKey = `${eventType}Timeout`;
|
|
1083
1060
|
// TODO: can't we just use one variable?
|
|
1084
1061
|
clearTimeout(_this[timeoutKey]);
|
|
1085
1062
|
_this[timeoutKey] = _setTimeout(() => {
|
|
@@ -1110,7 +1087,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
1110
1087
|
}, this.props.onEnter ? {
|
|
1111
1088
|
onKeyDown: this.handleEnter
|
|
1112
1089
|
} : {}), filterDataAttributes(this.props));
|
|
1113
|
-
const inputId =
|
|
1090
|
+
const inputId = `throttled-field-${this.props.name}`;
|
|
1114
1091
|
return jsxs(Fragment, {
|
|
1115
1092
|
children: [jsx(AccessibleHidden, {
|
|
1116
1093
|
children: jsx("label", {
|
|
@@ -1119,7 +1096,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
1119
1096
|
})
|
|
1120
1097
|
}), this.props.as === 'textarea' ? jsx(Textarea, _objectSpread$1l(_objectSpread$1l({}, commonProps), {}, {
|
|
1121
1098
|
id: inputId,
|
|
1122
|
-
className: classnames(styles$i.textarea, styles$i[
|
|
1099
|
+
className: classnames(styles$i.textarea, styles$i[`textarea-${this.props.style}`], {
|
|
1123
1100
|
[styles$i.invalid]: !this.props.isValid,
|
|
1124
1101
|
[styles$i.disabled]: this.props.disabled
|
|
1125
1102
|
}),
|
|
@@ -1130,7 +1107,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
1130
1107
|
id: inputId,
|
|
1131
1108
|
ref: this.props.inputRef,
|
|
1132
1109
|
type: this.props.as,
|
|
1133
|
-
className: classnames(styles$i[
|
|
1110
|
+
className: classnames(styles$i[`input-${this.props.style}`], {
|
|
1134
1111
|
[styles$i.invalid]: !this.props.isValid,
|
|
1135
1112
|
[styles$i.disabled]: this.props.disabled,
|
|
1136
1113
|
[styles$i.granular]: this.props.isGranular
|
|
@@ -1227,8 +1204,7 @@ let SearchInput = /*#__PURE__*/function (_Component) {
|
|
|
1227
1204
|
});
|
|
1228
1205
|
};
|
|
1229
1206
|
_this.handleClear = () => {
|
|
1230
|
-
|
|
1231
|
-
(_this$inputRef = _this.inputRef) === null || _this$inputRef === void 0 || _this$inputRef.focus();
|
|
1207
|
+
_this.inputRef?.focus();
|
|
1232
1208
|
_this.props.onChange(null);
|
|
1233
1209
|
_this.props.onReset();
|
|
1234
1210
|
_this.setState({
|
|
@@ -1330,16 +1306,15 @@ function ownKeys$1k(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertyS
|
|
|
1330
1306
|
function _objectSpread$1k(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$1k(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$1k(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1331
1307
|
const injectDataTablePaginationState = initialValues => Component => {
|
|
1332
1308
|
const WithDataTablePaginationState = props => {
|
|
1333
|
-
var _initialValues$tableS, _initialValues$tableS2;
|
|
1334
1309
|
const _usePaginationState = usePaginationState({
|
|
1335
|
-
page: initialValues
|
|
1336
|
-
perPage: initialValues
|
|
1310
|
+
page: initialValues?.page,
|
|
1311
|
+
perPage: initialValues?.perPage
|
|
1337
1312
|
}),
|
|
1338
1313
|
page = _usePaginationState.page,
|
|
1339
1314
|
perPage = _usePaginationState.perPage;
|
|
1340
1315
|
const tableSorting = useDataTableSortingState({
|
|
1341
|
-
key: initialValues
|
|
1342
|
-
order: initialValues
|
|
1316
|
+
key: initialValues?.tableSorting?.key,
|
|
1317
|
+
order: initialValues?.tableSorting?.order
|
|
1343
1318
|
});
|
|
1344
1319
|
return jsx(Component, _objectSpread$1k(_objectSpread$1k({}, props), {}, {
|
|
1345
1320
|
dataTablePaginationState: {
|
|
@@ -1373,7 +1348,7 @@ const injectNotifications = function () {
|
|
|
1373
1348
|
[propName]: notifications
|
|
1374
1349
|
}));
|
|
1375
1350
|
};
|
|
1376
|
-
WrappedComponent.displayName =
|
|
1351
|
+
WrappedComponent.displayName = `withNotifications(${getDisplayName(Component)}`;
|
|
1377
1352
|
return WrappedComponent;
|
|
1378
1353
|
};
|
|
1379
1354
|
};
|
|
@@ -1482,10 +1457,7 @@ const isNil = value => typeof value === 'undefined' || value === null;
|
|
|
1482
1457
|
const useStorage = (storageKey, initialStorageValue, options) => {
|
|
1483
1458
|
var _context;
|
|
1484
1459
|
const mergedOptions = _objectSpread$1e(_objectSpread$1e({}, defaultOptions$2), options);
|
|
1485
|
-
const userId = useApplicationContext(context =>
|
|
1486
|
-
var _context$user;
|
|
1487
|
-
return (_context$user = context.user) === null || _context$user === void 0 ? void 0 : _context$user.id;
|
|
1488
|
-
});
|
|
1460
|
+
const userId = useApplicationContext(context => context.user?.id);
|
|
1489
1461
|
const scopedStorageKey = _filterInstanceProperty(_context = [mergedOptions.segregateByUser && userId, storageKey]).call(_context, Boolean).join('/');
|
|
1490
1462
|
const readFromStorage = useCallback(() => {
|
|
1491
1463
|
const rawStorageValue = getStorage(mergedOptions.storageType).getItem(scopedStorageKey);
|
|
@@ -1504,9 +1476,8 @@ const useStorage = (storageKey, initialStorageValue, options) => {
|
|
|
1504
1476
|
return parsedStorageValue;
|
|
1505
1477
|
}, [mergedOptions.storageType, scopedStorageKey]);
|
|
1506
1478
|
const initializeStorageValue = () => {
|
|
1507
|
-
var _ref, _readFromStorage;
|
|
1508
1479
|
// default the storage value to the initial provided value when provided
|
|
1509
|
-
return
|
|
1480
|
+
return readFromStorage() ?? initialStorageValue ?? null;
|
|
1510
1481
|
};
|
|
1511
1482
|
const _useState = useState(initializeStorageValue),
|
|
1512
1483
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -1594,7 +1565,7 @@ function useFormatLocalizedFieldToString() {
|
|
|
1594
1565
|
}
|
|
1595
1566
|
|
|
1596
1567
|
function ownKeys$1c(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; }
|
|
1597
|
-
function _objectSpread$1c(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
1568
|
+
function _objectSpread$1c(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$1c(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$1c(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1598
1569
|
var FetchResourceTypeDuplicatedField = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchResourceTypeDuplicatedField" }, 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: "skipAssociateRoles" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipAttributeGroups" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipBusinessUnits" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipCarts" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipCartDiscounts" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipCategories" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipChannels" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipCustomers" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipCustomerGroups" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipDiscountCodes" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipInventoryEntries" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipOrders" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipPayments" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipProducts" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipProductDiscounts" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipProductSelections" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipProductTypes" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipShippingMethods" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipStores" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipTaxCategories" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipZones" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "associateRoles" }, 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: "skipAssociateRoles" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "attributeGroups" }, 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: "skipAttributeGroups" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "businessUnits" }, 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: "skipBusinessUnits" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "carts" }, 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: "skipCarts" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "cartDiscounts" }, 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: "skipCartDiscounts" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "categories" }, 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: "skipCategories" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "channels" }, 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: "skipChannels" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "customers" }, 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: "skipCustomers" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "customerGroups" }, 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: "skipCustomerGroups" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "discountCodes" }, 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: "skipDiscountCodes" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "inventoryEntries" }, 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: "skipInventoryEntries" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "orders" }, 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: "skipOrders" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "payments" }, 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: "skipPayments" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "products" }, 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: "skipProducts" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "productDiscounts" }, 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: "skipProductDiscounts" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "productSelections" }, 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: "skipProductSelections" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "productTypes" }, 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: "skipProductTypes" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "shippingMethods" }, 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: "skipShippingMethods" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }, { kind: "Field", 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: "skipStores" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "taxCategories" }, 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: "skipTaxCategories" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "zones" }, 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: "skipZones" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 2220, source: { body: "query FetchResourceTypeDuplicatedField(\n $where: String\n $skipAssociateRoles: Boolean!\n $skipAttributeGroups: Boolean!\n $skipBusinessUnits: Boolean!\n $skipCarts: Boolean!\n $skipCartDiscounts: Boolean!\n $skipCategories: Boolean!\n $skipChannels: Boolean!\n $skipCustomers: Boolean!\n $skipCustomerGroups: Boolean!\n $skipDiscountCodes: Boolean!\n $skipInventoryEntries: Boolean!\n $skipOrders: Boolean!\n $skipPayments: Boolean!\n $skipProducts: Boolean!\n $skipProductDiscounts: Boolean!\n $skipProductSelections: Boolean!\n $skipProductTypes: Boolean!\n $skipShippingMethods: Boolean!\n $skipStores: Boolean!\n $skipTaxCategories: Boolean!\n $skipZones: Boolean!\n) {\n associateRoles(where: $where) @skip(if: $skipAssociateRoles) {\n total\n }\n attributeGroups(where: $where) @skip(if: $skipAttributeGroups) {\n total\n }\n businessUnits(where: $where) @skip(if: $skipBusinessUnits) {\n total\n }\n carts(where: $where) @skip(if: $skipCarts) {\n total\n }\n cartDiscounts(where: $where) @skip(if: $skipCartDiscounts) {\n total\n }\n categories(where: $where) @skip(if: $skipCategories) {\n total\n }\n channels(where: $where) @skip(if: $skipChannels) {\n total\n }\n customers(where: $where) @skip(if: $skipCustomers) {\n total\n }\n customerGroups(where: $where) @skip(if: $skipCustomerGroups) {\n total\n }\n discountCodes(where: $where) @skip(if: $skipDiscountCodes) {\n total\n }\n inventoryEntries(where: $where) @skip(if: $skipInventoryEntries) {\n total\n }\n orders(where: $where) @skip(if: $skipOrders) {\n total\n }\n payments(where: $where) @skip(if: $skipPayments) {\n total\n }\n products(where: $where) @skip(if: $skipProducts) {\n total\n }\n productDiscounts(where: $where) @skip(if: $skipProductDiscounts) {\n total\n }\n productSelections(where: $where) @skip(if: $skipProductSelections) {\n total\n }\n productTypes(where: $where) @skip(if: $skipProductTypes) {\n total\n }\n shippingMethods(where: $where) @skip(if: $skipShippingMethods) {\n total\n }\n stores(where: $where) @skip(if: $skipStores) {\n total\n }\n taxCategories(where: $where) @skip(if: $skipTaxCategories) {\n total\n }\n zones(where: $where) @skip(if: $skipZones) {\n total\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
1599
1570
|
const MC_RESOURCES_WITH_KEYS = {
|
|
1600
1571
|
ASSOCIATE_ROLE: 'ASSOCIATE_ROLE',
|
|
@@ -1671,14 +1642,13 @@ const getSkipVariables = resourceType => {
|
|
|
1671
1642
|
});
|
|
1672
1643
|
};
|
|
1673
1644
|
const getWhereClause$1 = function () {
|
|
1674
|
-
var _context, _context2, _context3;
|
|
1675
1645
|
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1676
1646
|
field = _ref.field,
|
|
1677
1647
|
fieldValue = _ref.fieldValue,
|
|
1678
1648
|
id = _ref.id;
|
|
1679
1649
|
if (!id && !fieldValue) return null;
|
|
1680
|
-
if (!id) return
|
|
1681
|
-
return
|
|
1650
|
+
if (!id) return `${field} = "${fieldValue}"`;
|
|
1651
|
+
return `${field} = "${fieldValue}" and id != "${id}"`;
|
|
1682
1652
|
};
|
|
1683
1653
|
const getQueryVariables = _ref2 => {
|
|
1684
1654
|
let resourceType = _ref2.resourceType,
|
|
@@ -1697,7 +1667,6 @@ const getQueryVariables = _ref2 => {
|
|
|
1697
1667
|
}, skipVariables);
|
|
1698
1668
|
};
|
|
1699
1669
|
const useIsFieldDuplicated = () => {
|
|
1700
|
-
var _Object$values$;
|
|
1701
1670
|
const _useLazyQuery = useLazyQuery(FetchResourceTypeDuplicatedField, {
|
|
1702
1671
|
context: {
|
|
1703
1672
|
target: GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -1712,7 +1681,7 @@ const useIsFieldDuplicated = () => {
|
|
|
1712
1681
|
return {
|
|
1713
1682
|
getQueryVariables,
|
|
1714
1683
|
isLoading: loading,
|
|
1715
|
-
isFieldDuplicated: data ?
|
|
1684
|
+
isFieldDuplicated: data ? _Object$values(data)[0]?.total > 0 : null,
|
|
1716
1685
|
queryIsFieldDuplicated: execute
|
|
1717
1686
|
};
|
|
1718
1687
|
};
|
|
@@ -1765,16 +1734,14 @@ function ownKeys$1b(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertyS
|
|
|
1765
1734
|
function _objectSpread$1b(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys$1b(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys$1b(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1766
1735
|
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 } } } };
|
|
1767
1736
|
const filterStoresOutdatedDanglingProductSelections = storesQueryResult => {
|
|
1768
|
-
var _storesQueryResult$re;
|
|
1769
1737
|
if (!storesQueryResult) return null;
|
|
1770
1738
|
return {
|
|
1771
1739
|
total: storesQueryResult.total,
|
|
1772
1740
|
count: storesQueryResult.count,
|
|
1773
1741
|
offset: storesQueryResult.offset,
|
|
1774
|
-
results:
|
|
1775
|
-
var _store$productSelecti;
|
|
1742
|
+
results: storesQueryResult.results?.map(store => {
|
|
1776
1743
|
return _objectSpread$1b(_objectSpread$1b({}, store), {}, {
|
|
1777
|
-
productSelections:
|
|
1744
|
+
productSelections: store.productSelections?.filter(productSelectionRef => Boolean(productSelectionRef.productSelection))
|
|
1778
1745
|
});
|
|
1779
1746
|
})
|
|
1780
1747
|
};
|
|
@@ -1786,7 +1753,7 @@ const createQueryVariables$6 = ownProps => {
|
|
|
1786
1753
|
offset: ownProps.offset,
|
|
1787
1754
|
sort: _sortInstanceProperty(ownProps)
|
|
1788
1755
|
}, Boolean(ownProps.stores) && {
|
|
1789
|
-
where:
|
|
1756
|
+
where: `key in (${_mapInstanceProperty(_context = ownProps.stores).call(_context, store => `"${store}"`).join(', ')})`
|
|
1790
1757
|
}), {}, {
|
|
1791
1758
|
excludeExtendedStoresList: ownProps.excludeExtendedStoresList,
|
|
1792
1759
|
excludeProductSelections: ownProps.excludeProductSelections
|
|
@@ -1811,10 +1778,7 @@ const useStoresListFetcher = props => {
|
|
|
1811
1778
|
projectKey: props.projectKey
|
|
1812
1779
|
},
|
|
1813
1780
|
fetchPolicy: 'network-only',
|
|
1814
|
-
onError: graphqlErrorResponse =>
|
|
1815
|
-
var _props$onError;
|
|
1816
|
-
return (_props$onError = props.onError) === null || _props$onError === void 0 ? void 0 : _props$onError.call(props, graphqlErrorResponse);
|
|
1817
|
-
}
|
|
1781
|
+
onError: graphqlErrorResponse => props.onError?.(graphqlErrorResponse)
|
|
1818
1782
|
}),
|
|
1819
1783
|
data = _useQuery.data,
|
|
1820
1784
|
refetch = _useQuery.refetch,
|
|
@@ -1822,7 +1786,7 @@ const useStoresListFetcher = props => {
|
|
|
1822
1786
|
return {
|
|
1823
1787
|
isLoading: loading,
|
|
1824
1788
|
refetch,
|
|
1825
|
-
stores: filterStoresOutdatedDanglingProductSelections(data
|
|
1789
|
+
stores: filterStoresOutdatedDanglingProductSelections(data?.stores),
|
|
1826
1790
|
refetchQuery: {
|
|
1827
1791
|
query: FetchStoresQuery,
|
|
1828
1792
|
variables: queryVariables,
|
|
@@ -1886,18 +1850,13 @@ const handlers$5 = {
|
|
|
1886
1850
|
}
|
|
1887
1851
|
};
|
|
1888
1852
|
|
|
1889
|
-
const toPermission = (permission, resourceName) => {
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
}
|
|
1893
|
-
const
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
var _context2;
|
|
1897
|
-
return (// e.g applicationContext.dataFences?.store?.orders?.canViewOrders?.values
|
|
1898
|
-
_concatInstanceProperty(_context2 = "dataFences.store.".concat(resourceName, ".")).call(_context2, permission, ".values")
|
|
1899
|
-
);
|
|
1900
|
-
};
|
|
1853
|
+
const toPermission = (permission, resourceName) => camelCase(`can ${permission} ${resourceName}`);
|
|
1854
|
+
const createPermissionsComposePath = permission =>
|
|
1855
|
+
// e.g applicationContext.permissions?.canViewOrders
|
|
1856
|
+
`permissions.${permission}`;
|
|
1857
|
+
const createDataFencesComposePath = resourceName => permission =>
|
|
1858
|
+
// e.g applicationContext.dataFences?.store?.orders?.canViewOrders?.values
|
|
1859
|
+
`dataFences.store.${resourceName}.${permission}.values`;
|
|
1901
1860
|
const useStoreKeysInDataFences = _ref => {
|
|
1902
1861
|
let resourceName = _ref.resourceName,
|
|
1903
1862
|
_ref$permission = _ref.permission,
|
|
@@ -2305,7 +2264,7 @@ const usePersistedTableConfiguration = props => {
|
|
|
2305
2264
|
* Therefore, if it will be missing from the local storage and hence we use the [] as default.
|
|
2306
2265
|
*/
|
|
2307
2266
|
const getVisibleColumns = useCallback(() => {
|
|
2308
|
-
if (cachedVisibleTableConfiguration
|
|
2267
|
+
if (cachedVisibleTableConfiguration?.columnsConfig) {
|
|
2309
2268
|
return retrieveColumnsWithCachedConfiguration({
|
|
2310
2269
|
allAvailableColumnsConfiguration,
|
|
2311
2270
|
cachedVisibleTableConfiguration: cachedVisibleTableConfiguration.columnsConfig,
|
|
@@ -2319,8 +2278,8 @@ const usePersistedTableConfiguration = props => {
|
|
|
2319
2278
|
return {
|
|
2320
2279
|
visibleColumns,
|
|
2321
2280
|
visibleColumnKeys,
|
|
2322
|
-
cachedVisibleColumnsConfiguration: cachedVisibleTableConfiguration
|
|
2323
|
-
cachedDisplaySettings: cachedVisibleTableConfiguration
|
|
2281
|
+
cachedVisibleColumnsConfiguration: cachedVisibleTableConfiguration?.columnsConfig,
|
|
2282
|
+
cachedDisplaySettings: cachedVisibleTableConfiguration?.displaySettings,
|
|
2324
2283
|
handleCachedTableConfigurationUpdate: update => handleCacheUpdate({
|
|
2325
2284
|
update,
|
|
2326
2285
|
cachedVisibleTableConfiguration,
|
|
@@ -2331,7 +2290,6 @@ const usePersistedTableConfiguration = props => {
|
|
|
2331
2290
|
|
|
2332
2291
|
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 } } } };
|
|
2333
2292
|
const useProductSelectionsTotalFetcher = props => {
|
|
2334
|
-
var _data$productSelectio;
|
|
2335
2293
|
const _useQuery = useQuery$2(FetchProductSelectionsTotal, {
|
|
2336
2294
|
context: {
|
|
2337
2295
|
target: GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -2341,7 +2299,7 @@ const useProductSelectionsTotalFetcher = props => {
|
|
|
2341
2299
|
data = _useQuery.data;
|
|
2342
2300
|
return {
|
|
2343
2301
|
isLoading: loading,
|
|
2344
|
-
total: data
|
|
2302
|
+
total: data?.productSelections?.total
|
|
2345
2303
|
};
|
|
2346
2304
|
};
|
|
2347
2305
|
|
|
@@ -2362,7 +2320,7 @@ function _objectSpread$17(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
|
2362
2320
|
// eslint-disable-next-line import/prefer-default-export
|
|
2363
2321
|
const convertProductSelectionsFromGraphQl = productSelections => {
|
|
2364
2322
|
var _context;
|
|
2365
|
-
return
|
|
2323
|
+
return productSelections?.results && _objectSpread$17(_objectSpread$17({}, productSelections), {}, {
|
|
2366
2324
|
results: _mapInstanceProperty(_context = productSelections.results).call(_context, productSelection => _objectSpread$17({}, applyTransformedLocalizedFields(productSelection, [{
|
|
2367
2325
|
from: 'nameAllLocales',
|
|
2368
2326
|
to: 'name'
|
|
@@ -2399,7 +2357,7 @@ const useProductSelectionsFetcher = props => {
|
|
|
2399
2357
|
refetch = _useQuery.refetch;
|
|
2400
2358
|
return {
|
|
2401
2359
|
isLoading: loading,
|
|
2402
|
-
productSelections: convertProductSelectionsFromGraphQl(data
|
|
2360
|
+
productSelections: convertProductSelectionsFromGraphQl(data?.productSelections) || emptyProductSelections,
|
|
2403
2361
|
refetch
|
|
2404
2362
|
};
|
|
2405
2363
|
};
|
|
@@ -2414,7 +2372,7 @@ const handlers$3 = {
|
|
|
2414
2372
|
|
|
2415
2373
|
const setToArray = function () {
|
|
2416
2374
|
let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
2417
|
-
return
|
|
2375
|
+
return `id in (${_mapInstanceProperty(values).call(values, value => `"${value}"`).join(', ')})`;
|
|
2418
2376
|
};
|
|
2419
2377
|
|
|
2420
2378
|
function capitalizeFirst(text) {
|
|
@@ -2482,7 +2440,6 @@ function validateSingleFilter(_ref) {
|
|
|
2482
2440
|
return _includesInstanceProperty(invalidValues).call(invalidValues, value);
|
|
2483
2441
|
}
|
|
2484
2442
|
|
|
2485
|
-
var _templateObject$4, _templateObject2$2;
|
|
2486
2443
|
const dateFormatDayStart$1 = 'YYYY-MM-DDT00:00:00.000';
|
|
2487
2444
|
const dateFormatDayEnd$1 = 'YYYY-MM-DDT23:59:59.999';
|
|
2488
2445
|
const getDateTimeInUTC = (date, timezone, format) => {
|
|
@@ -2492,8 +2449,7 @@ const getDateTimeInUTC = (date, timezone, format) => {
|
|
|
2492
2449
|
const noTimeSpecified = momentDate.hours() === 0 && momentDate.minutes() === 0 && momentDate.seconds() === 0;
|
|
2493
2450
|
// if it's a date then convert it to UTC datetime based on timezone
|
|
2494
2451
|
if (noTimeSpecified) {
|
|
2495
|
-
|
|
2496
|
-
const offset = ((_moment$tz = moment(date).tz(timezone)) === null || _moment$tz === void 0 ? void 0 : _moment$tz.utcOffset()) || 0;
|
|
2452
|
+
const offset = moment(date).tz(timezone)?.utcOffset() || 0;
|
|
2497
2453
|
const formattedDate = momentDate.format(format);
|
|
2498
2454
|
const formattedDateWithOffset = moment(formattedDate).add(offset, 'minutes').format(dateFormat);
|
|
2499
2455
|
// console.log(formattedDateWithOffset);
|
|
@@ -2506,7 +2462,6 @@ const getDateTimeInUTC = (date, timezone, format) => {
|
|
|
2506
2462
|
function dateTransformer$1(filterKey, filters) {
|
|
2507
2463
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator$1;
|
|
2508
2464
|
const queries = _mapInstanceProperty(filters).call(filters, _ref => {
|
|
2509
|
-
var _context, _context2;
|
|
2510
2465
|
let type = _ref.type,
|
|
2511
2466
|
value = _ref.value,
|
|
2512
2467
|
timezone = _ref.timezone;
|
|
@@ -2516,13 +2471,19 @@ function dateTransformer$1(filterKey, filters) {
|
|
|
2516
2471
|
})) return '';
|
|
2517
2472
|
switch (type) {
|
|
2518
2473
|
case FILTER_TYPES.lessThan:
|
|
2519
|
-
return
|
|
2474
|
+
return `${filterKey} < "${getDateTimeInUTC(value, timezone, dateFormatDayStart$1)}"`;
|
|
2520
2475
|
case FILTER_TYPES.moreThan:
|
|
2521
|
-
return
|
|
2476
|
+
return `${filterKey} > "${getDateTimeInUTC(value, timezone, dateFormatDayEnd$1)}"`;
|
|
2522
2477
|
case FILTER_TYPES.equalTo:
|
|
2523
|
-
return oneLine
|
|
2478
|
+
return oneLine`
|
|
2479
|
+
(${filterKey} >= "${getDateTimeInUTC(value, timezone, dateFormatDayStart$1)}"
|
|
2480
|
+
and ${filterKey} <= "${getDateTimeInUTC(value, timezone, dateFormatDayEnd$1)}")
|
|
2481
|
+
`;
|
|
2524
2482
|
case FILTER_TYPES.range:
|
|
2525
|
-
return oneLine
|
|
2483
|
+
return oneLine`
|
|
2484
|
+
(${filterKey} >= "${getDateTimeInUTC(value.from, timezone, dateFormatDayStart$1)}"
|
|
2485
|
+
and ${filterKey} <= "${getDateTimeInUTC(value.to, timezone, dateFormatDayEnd$1)}")
|
|
2486
|
+
`;
|
|
2526
2487
|
default:
|
|
2527
2488
|
return '';
|
|
2528
2489
|
}
|
|
@@ -2538,7 +2499,7 @@ function dateTransformer$1(filterKey, filters) {
|
|
|
2538
2499
|
* (createdAt >= "2018-02-15T00:00:00.000+01:00" and createdAt <= "2018-02-15T23:59:59.999+01:00")
|
|
2539
2500
|
* ) or some_more_filters
|
|
2540
2501
|
*/
|
|
2541
|
-
return queryString === '' ? null :
|
|
2502
|
+
return queryString === '' ? null : `(${queryString})`;
|
|
2542
2503
|
}
|
|
2543
2504
|
function defaultFilterValidator$1(_ref2) {
|
|
2544
2505
|
let type = _ref2.type,
|
|
@@ -2554,25 +2515,19 @@ function defaultFilterValidator$1(_ref2) {
|
|
|
2554
2515
|
|
|
2555
2516
|
var localizedTextTransformer = (localizedString => {
|
|
2556
2517
|
var _context;
|
|
2557
|
-
return _mapInstanceProperty(_context = _Object$keys(localizedString)).call(_context, locale => {
|
|
2558
|
-
var _context2;
|
|
2559
|
-
return _concatInstanceProperty(_context2 = "".concat(locale, " = \"")).call(_context2, localizedString[locale], "\"");
|
|
2560
|
-
}).join(' and ');
|
|
2518
|
+
return _mapInstanceProperty(_context = _Object$keys(localizedString)).call(_context, locale => `${locale} = "${localizedString[locale]}"`).join(' and ');
|
|
2561
2519
|
});
|
|
2562
2520
|
|
|
2563
|
-
const getCentAmountClause = (value, operator, locale) => {
|
|
2564
|
-
var _context;
|
|
2565
|
-
return _concatInstanceProperty(_context = "centAmount ".concat(operator, " ")).call(_context, MoneyInput.convertToMoneyValue(value, locale).centAmount);
|
|
2566
|
-
};
|
|
2521
|
+
const getCentAmountClause = (value, operator, locale) => `centAmount ${operator} ${MoneyInput.convertToMoneyValue(value, locale).centAmount}`;
|
|
2567
2522
|
function moneyTransformer(value, option, locale) {
|
|
2568
2523
|
const clauses = [];
|
|
2569
2524
|
if (option === FILTER_TYPES.range) {
|
|
2570
|
-
clauses[0] =
|
|
2525
|
+
clauses[0] = `currencyCode = "${value.from.currencyCode}"`;
|
|
2571
2526
|
clauses[1] = getCentAmountClause(value.from, '>=', locale);
|
|
2572
2527
|
clauses[2] = getCentAmountClause(value.to, '<=', locale);
|
|
2573
2528
|
return clauses.join(' and ');
|
|
2574
2529
|
}
|
|
2575
|
-
clauses[0] =
|
|
2530
|
+
clauses[0] = `currencyCode = "${value.currencyCode}"`;
|
|
2576
2531
|
switch (option) {
|
|
2577
2532
|
case FILTER_TYPES.lessThan:
|
|
2578
2533
|
clauses[1] = getCentAmountClause(value, '<', locale);
|
|
@@ -2589,7 +2544,6 @@ function moneyTransformer(value, option, locale) {
|
|
|
2589
2544
|
return clauses.join(' and ');
|
|
2590
2545
|
}
|
|
2591
2546
|
|
|
2592
|
-
var _templateObject$3, _templateObject2$1;
|
|
2593
2547
|
const formatTime = 'HH:mm:ss.SSS';
|
|
2594
2548
|
|
|
2595
2549
|
/* TimeInput only allows HH:mm:ss and adds the seconds as 00 and
|
|
@@ -2611,7 +2565,6 @@ const defaultFilterValidator = _ref => {
|
|
|
2611
2565
|
const timeTransformer = function (filterKey, filters) {
|
|
2612
2566
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator;
|
|
2613
2567
|
const queries = _mapInstanceProperty(filters).call(filters, _ref2 => {
|
|
2614
|
-
var _context, _context2;
|
|
2615
2568
|
let type = _ref2.type,
|
|
2616
2569
|
value = _ref2.value;
|
|
2617
2570
|
if (!filterValidator({
|
|
@@ -2620,13 +2573,19 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
2620
2573
|
})) return '';
|
|
2621
2574
|
switch (type) {
|
|
2622
2575
|
case FILTER_TYPES.lessThan:
|
|
2623
|
-
return
|
|
2576
|
+
return `${filterKey} < "${value}"`;
|
|
2624
2577
|
case FILTER_TYPES.moreThan:
|
|
2625
|
-
return
|
|
2578
|
+
return `${filterKey} > "${value}"`;
|
|
2626
2579
|
case FILTER_TYPES.equalTo:
|
|
2627
|
-
return oneLine
|
|
2580
|
+
return oneLine`
|
|
2581
|
+
(${filterKey} >= "${value}"
|
|
2582
|
+
and ${filterKey} <= "${getEndOfSecond(value)}")
|
|
2583
|
+
`;
|
|
2628
2584
|
case FILTER_TYPES.range:
|
|
2629
|
-
return oneLine
|
|
2585
|
+
return oneLine`
|
|
2586
|
+
(${filterKey} >= "${value.from}"
|
|
2587
|
+
and ${filterKey} <= "${getEndOfSecond(value.to)}")
|
|
2588
|
+
`;
|
|
2630
2589
|
default:
|
|
2631
2590
|
return '';
|
|
2632
2591
|
}
|
|
@@ -2642,19 +2601,21 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
2642
2601
|
* (pickUpTime >= "14:00" and pickUpTime <= "15:00")
|
|
2643
2602
|
* ) or some_more_filters
|
|
2644
2603
|
*/
|
|
2645
|
-
return queryString === '' ? null :
|
|
2604
|
+
return queryString === '' ? null : `(${queryString})`;
|
|
2646
2605
|
};
|
|
2647
2606
|
|
|
2648
|
-
var _templateObject$2;
|
|
2649
2607
|
function formatDateRangeValue(value, type) {
|
|
2650
2608
|
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
2651
2609
|
locale: 'en',
|
|
2652
2610
|
timeZone: moment$1.tz.guess()
|
|
2653
2611
|
};
|
|
2654
2612
|
if (value.from === value.to) return formatDateTime$1(type, value.from, options);
|
|
2655
|
-
if (value.from && value.to) return oneLine
|
|
2656
|
-
|
|
2657
|
-
|
|
2613
|
+
if (value.from && value.to) return oneLine`
|
|
2614
|
+
${formatDateTime$1(type, value.from, options)} -
|
|
2615
|
+
${formatDateTime$1(type, value.to, options)}
|
|
2616
|
+
`;
|
|
2617
|
+
if (value.from) return `from ${formatDateTime$1(type, value.from, options)}`;
|
|
2618
|
+
if (value.to) return `to ${formatDateTime$1(type, value.to, options)}`;
|
|
2658
2619
|
return '';
|
|
2659
2620
|
}
|
|
2660
2621
|
function formatDateTime$1(type, value) {
|
|
@@ -3851,13 +3812,13 @@ const getData = (code, field) => {
|
|
|
3851
3812
|
const getFractionDigit = code => getData(code, 'fractionDigit');
|
|
3852
3813
|
|
|
3853
3814
|
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; }
|
|
3854
|
-
function _objectSpread$16(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
3815
|
+
function _objectSpread$16(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$16(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$16(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3855
3816
|
function formatMoneyRangeValue(value, intl) {
|
|
3856
|
-
var _context;
|
|
3857
3817
|
if (value.from === value.to) return formatMoneyValue(value.from, value.currency, intl);
|
|
3858
|
-
if (value.from && value.to) return
|
|
3859
|
-
|
|
3860
|
-
if (value.
|
|
3818
|
+
if (value.from && value.to) return `${formatMoneyValue(value.from, value.currency, intl)} -
|
|
3819
|
+
${formatMoneyValue(value.to, value.currency, intl)}`;
|
|
3820
|
+
if (value.from) return `from ${formatMoneyValue(value.from, value.currency, intl)}`;
|
|
3821
|
+
if (value.to) return `to ${formatMoneyValue(value.to, value.currency, intl)}`;
|
|
3861
3822
|
return '';
|
|
3862
3823
|
}
|
|
3863
3824
|
function formatMoneyValue(amount, currency, intl) {
|
|
@@ -3877,8 +3838,7 @@ function getFractionedAmount(moneyValue) {
|
|
|
3877
3838
|
return amount / 10 ** fractionDigits;
|
|
3878
3839
|
}
|
|
3879
3840
|
function formatMoney$2(moneyValue, intl, options) {
|
|
3880
|
-
|
|
3881
|
-
return intl.formatNumber((_moneyValue$fractione = moneyValue.fractionedAmount) !== null && _moneyValue$fractione !== void 0 ? _moneyValue$fractione : getFractionedAmount(moneyValue), _objectSpread$16({
|
|
3841
|
+
return intl.formatNumber(moneyValue.fractionedAmount ?? getFractionedAmount(moneyValue), _objectSpread$16({
|
|
3882
3842
|
style: 'currency',
|
|
3883
3843
|
currency: moneyValue.currencyCode,
|
|
3884
3844
|
minimumFractionDigits: moneyValue.fractionDigits
|
|
@@ -3899,13 +3859,11 @@ var messages$D = defineMessages({
|
|
|
3899
3859
|
});
|
|
3900
3860
|
|
|
3901
3861
|
const formatEnum = _ref => {
|
|
3902
|
-
var _context;
|
|
3903
3862
|
let value = _ref.value,
|
|
3904
3863
|
fallbackValue = _ref.fallbackValue;
|
|
3905
|
-
return value.label ||
|
|
3864
|
+
return value.label || `${fallbackValue} (${value.key})`;
|
|
3906
3865
|
};
|
|
3907
3866
|
const formatLenum = _ref2 => {
|
|
3908
|
-
var _context2;
|
|
3909
3867
|
let value = _ref2.value,
|
|
3910
3868
|
language = _ref2.language,
|
|
3911
3869
|
languages = _ref2.languages,
|
|
@@ -3913,7 +3871,7 @@ const formatLenum = _ref2 => {
|
|
|
3913
3871
|
return formatLocalizedString(value, {
|
|
3914
3872
|
key: 'label',
|
|
3915
3873
|
locale: language,
|
|
3916
|
-
fallback:
|
|
3874
|
+
fallback: `${fallbackValue} (${value.key})`,
|
|
3917
3875
|
fallbackOrder: languages
|
|
3918
3876
|
});
|
|
3919
3877
|
};
|
|
@@ -3949,7 +3907,6 @@ const formatDate = _ref6 => {
|
|
|
3949
3907
|
});
|
|
3950
3908
|
};
|
|
3951
3909
|
const formatDateTime = _ref7 => {
|
|
3952
|
-
var _context3;
|
|
3953
3910
|
let value = _ref7.value,
|
|
3954
3911
|
userTimeZone = _ref7.userTimeZone,
|
|
3955
3912
|
intl = _ref7.intl;
|
|
@@ -3965,7 +3922,7 @@ const formatDateTime = _ref7 => {
|
|
|
3965
3922
|
// defaults to utc if timeZone is not provided
|
|
3966
3923
|
timeZone: userTimeZone || 'utc'
|
|
3967
3924
|
});
|
|
3968
|
-
return
|
|
3925
|
+
return `${date} (${time})`;
|
|
3969
3926
|
};
|
|
3970
3927
|
const formatBoolean = _ref8 => {
|
|
3971
3928
|
let value = _ref8.value,
|
|
@@ -3988,7 +3945,7 @@ const formatUnknown = _ref10 => {
|
|
|
3988
3945
|
fallbackValue = _ref10.fallbackValue;
|
|
3989
3946
|
// NOTE This is reporting within the render function, which is supposed to
|
|
3990
3947
|
// be pure. This is quite bad as this is a side-effect in the render fn.
|
|
3991
|
-
reportErrorToSentry(new Error(
|
|
3948
|
+
reportErrorToSentry(new Error(`Unhandled custom attribute type '${type.name}' for value`), {
|
|
3992
3949
|
extra: {
|
|
3993
3950
|
value
|
|
3994
3951
|
}
|
|
@@ -4061,10 +4018,9 @@ const attributeTypeNames = {
|
|
|
4061
4018
|
Number: 'number'
|
|
4062
4019
|
};
|
|
4063
4020
|
const convertToAttributeType = customFieldType => {
|
|
4064
|
-
var _customFieldType$elem;
|
|
4065
4021
|
if (isNil$1(customFieldType)) return customFieldType;
|
|
4066
4022
|
const attributeTypeName = attributeTypeNames[customFieldType.name];
|
|
4067
|
-
const elementTypeName = attributeTypeNames[
|
|
4023
|
+
const elementTypeName = attributeTypeNames[customFieldType.elementType?.name];
|
|
4068
4024
|
return {
|
|
4069
4025
|
name: attributeTypeName,
|
|
4070
4026
|
elementType: {
|
|
@@ -4125,9 +4081,8 @@ function formatCustomField(_ref) {
|
|
|
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$2 = ["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;
|
|
@@ -4385,7 +4340,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4385
4340
|
case 'setCustomType':
|
|
4386
4341
|
return {
|
|
4387
4342
|
[actionName]: {
|
|
4388
|
-
typeId:
|
|
4343
|
+
typeId: actionPayload.type?.id,
|
|
4389
4344
|
fields: actionPayload.fields ? _mapInstanceProperty(_context3 = _Object$entries(actionPayload.fields)).call(_context3, _ref => {
|
|
4390
4345
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
4391
4346
|
customField = _ref2[0],
|
|
@@ -4415,10 +4370,10 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4415
4370
|
};
|
|
4416
4371
|
case 'setGeoLocation':
|
|
4417
4372
|
return {
|
|
4418
|
-
[actionName]: actionPayload
|
|
4373
|
+
[actionName]: actionPayload?.geoLocation ? {
|
|
4419
4374
|
geoLocation: {
|
|
4420
4375
|
type: 'Point',
|
|
4421
|
-
coordinates: [_parseFloat(
|
|
4376
|
+
coordinates: [_parseFloat(actionPayload.geoLocation?.longitude), _parseFloat(actionPayload.geoLocation?.latitude)]
|
|
4422
4377
|
}
|
|
4423
4378
|
} : {
|
|
4424
4379
|
undefined
|
|
@@ -4554,7 +4509,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4554
4509
|
case 'setShippingRateInputType':
|
|
4555
4510
|
return {
|
|
4556
4511
|
[actionName]: {
|
|
4557
|
-
shippingRateInputType:
|
|
4512
|
+
shippingRateInputType: actionPayload.shippingRateInputType?.type ? {
|
|
4558
4513
|
[actionPayload.shippingRateInputType.type]: {
|
|
4559
4514
|
values: actionPayload.shippingRateInputType.type === 'CartClassification' ? _mapInstanceProperty(_context4 = _valuesInstanceProperty(actionPayload.shippingRateInputType)).call(_context4, value => ({
|
|
4560
4515
|
key: value.key,
|
|
@@ -4608,8 +4563,8 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4608
4563
|
case 'addAddress':
|
|
4609
4564
|
case 'changeAddress':
|
|
4610
4565
|
{
|
|
4611
|
-
var
|
|
4612
|
-
const _ref3 =
|
|
4566
|
+
var _context6;
|
|
4567
|
+
const _ref3 = actionPayload.address?.custom || {},
|
|
4613
4568
|
_ref3$fields = _ref3.fields,
|
|
4614
4569
|
fields = _ref3$fields === void 0 ? {} : _ref3$fields;
|
|
4615
4570
|
const customFields = isEmpty$3(fields) ? null : _mapInstanceProperty(_context6 = _Object$entries(fields)).call(_context6, _ref4 => {
|
|
@@ -4621,7 +4576,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4621
4576
|
value: _JSON$stringify(value)
|
|
4622
4577
|
};
|
|
4623
4578
|
});
|
|
4624
|
-
const custom =
|
|
4579
|
+
const custom = actionPayload.address?.custom?.type?.id ? {
|
|
4625
4580
|
type: {
|
|
4626
4581
|
id: actionPayload.address.custom.type.id
|
|
4627
4582
|
},
|
|
@@ -4652,7 +4607,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4652
4607
|
value: _JSON$stringify(value)
|
|
4653
4608
|
};
|
|
4654
4609
|
});
|
|
4655
|
-
const customType = type
|
|
4610
|
+
const customType = type?.id ? {
|
|
4656
4611
|
id: type.id
|
|
4657
4612
|
} : null;
|
|
4658
4613
|
return {
|
|
@@ -4675,11 +4630,10 @@ const createGraphQlUpdateActions = actions => _reduceInstanceProperty(actions).c
|
|
|
4675
4630
|
return [...previousActions, convertAction(actionName, actionPayload)];
|
|
4676
4631
|
}, []);
|
|
4677
4632
|
const extractErrorFromGraphQlResponse = graphQlResponse => {
|
|
4678
|
-
|
|
4679
|
-
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) {
|
|
4633
|
+
if (graphQlResponse.networkError?.result?.errors?.length > 0) {
|
|
4680
4634
|
return graphQlResponse.networkError.result.errors;
|
|
4681
4635
|
}
|
|
4682
|
-
if (
|
|
4636
|
+
if (graphQlResponse.graphQLErrors?.length > 0) {
|
|
4683
4637
|
return graphQlResponse.graphQLErrors;
|
|
4684
4638
|
}
|
|
4685
4639
|
return graphQlResponse;
|
|
@@ -4740,16 +4694,14 @@ function omitDeep(obj, fieldsToOmit) {
|
|
|
4740
4694
|
function ownKeys$14(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; }
|
|
4741
4695
|
function _objectSpread$14(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$14(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$14(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4742
4696
|
function getPriceChannelName(price) {
|
|
4743
|
-
|
|
4744
|
-
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;
|
|
4697
|
+
return price.channel?.name ?? price.channel?.key ?? null;
|
|
4745
4698
|
}
|
|
4746
4699
|
function getDiscountValue(price) {
|
|
4747
|
-
var _price$value, _price$value2, _price$discounted;
|
|
4748
4700
|
let preciseAmount;
|
|
4749
4701
|
let fractionedAmount;
|
|
4750
|
-
if (
|
|
4702
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision && price.discounted.value.type === PRECISION_TYPES.highPrecision) {
|
|
4751
4703
|
preciseAmount = price.value.preciseAmount - price.discounted.value.preciseAmount;
|
|
4752
|
-
} else if (
|
|
4704
|
+
} else if (price.value?.type === PRECISION_TYPES.highPrecision && price.discounted?.value?.type === PRECISION_TYPES.centPrecision) {
|
|
4753
4705
|
fractionedAmount = getFractionedAmount(price.value) - getFractionedAmount(price.discounted.value);
|
|
4754
4706
|
}
|
|
4755
4707
|
return price.discounted ? _objectSpread$14(_objectSpread$14({}, price.value), {}, {
|
|
@@ -4763,28 +4715,23 @@ function getDiscountValue(price) {
|
|
|
4763
4715
|
function getSelectedPrice(price) {
|
|
4764
4716
|
return price.discounted ? price.discounted : price;
|
|
4765
4717
|
}
|
|
4766
|
-
function getNetUnitPrice(
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
shouldRoundAmount = _ref2.shouldRoundAmount;
|
|
4718
|
+
function getNetUnitPrice(_ref) {
|
|
4719
|
+
let lineItem = _ref.lineItem,
|
|
4720
|
+
shouldRoundAmount = _ref.shouldRoundAmount;
|
|
4770
4721
|
const price = getSelectedPrice(lineItem.price);
|
|
4771
|
-
const filteredPerMethodTaxRate = lineItem
|
|
4772
|
-
var _lineItem$shippingDet;
|
|
4773
|
-
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;
|
|
4774
|
-
});
|
|
4722
|
+
const filteredPerMethodTaxRate = lineItem?.perMethodTaxRate?.filter(perMethodTax => lineItem?.shippingDetails?.targets?.findIndex(target => target?.shippingMethodKey === perMethodTax?.shippingMethodKey) >= 0);
|
|
4775
4723
|
|
|
4776
4724
|
// when shipping mode is multi with the same tax rate
|
|
4777
|
-
if (
|
|
4778
|
-
var _price$value3, _price$value4;
|
|
4725
|
+
if (filteredPerMethodTaxRate?.length > 0 && filteredPerMethodTaxRate[0]?.taxRate?.includedInPrice) {
|
|
4779
4726
|
const taxRate = filteredPerMethodTaxRate[0].taxRate;
|
|
4780
4727
|
let centAmount;
|
|
4781
4728
|
// should accept 0 value
|
|
4782
|
-
if (typeof
|
|
4729
|
+
if (typeof price.value?.centAmount === 'number') {
|
|
4783
4730
|
const amount = price.value.centAmount / (1 + taxRate.amount);
|
|
4784
4731
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4785
4732
|
}
|
|
4786
4733
|
let preciseAmount;
|
|
4787
|
-
if (
|
|
4734
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + taxRate.amount);
|
|
4788
4735
|
return _objectSpread$14(_objectSpread$14({}, price.value), {}, {
|
|
4789
4736
|
centAmount,
|
|
4790
4737
|
preciseAmount
|
|
@@ -4793,15 +4740,14 @@ function getNetUnitPrice(_ref2) {
|
|
|
4793
4740
|
|
|
4794
4741
|
// when shipping mode is single
|
|
4795
4742
|
if (lineItem.taxRate && lineItem.taxRate.includedInPrice) {
|
|
4796
|
-
var _price$value5, _price$value6;
|
|
4797
4743
|
let centAmount;
|
|
4798
4744
|
// should accept 0 value
|
|
4799
|
-
if (typeof
|
|
4745
|
+
if (typeof price.value?.centAmount === 'number') {
|
|
4800
4746
|
const amount = price.value.centAmount / (1 + lineItem.taxRate.amount);
|
|
4801
4747
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4802
4748
|
}
|
|
4803
4749
|
let preciseAmount;
|
|
4804
|
-
if (
|
|
4750
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + lineItem.taxRate.amount);
|
|
4805
4751
|
return _objectSpread$14(_objectSpread$14({}, price.value), {}, {
|
|
4806
4752
|
centAmount,
|
|
4807
4753
|
preciseAmount
|
|
@@ -4835,18 +4781,18 @@ const transformCustomFieldFromGraphQLResponse = resource => {
|
|
|
4835
4781
|
key: resource.custom.type.key,
|
|
4836
4782
|
name: transformLocalizedFieldToLocalizedString(resource.custom.type.nameAllLocales),
|
|
4837
4783
|
fieldDefinitions: _mapInstanceProperty(_context = resource.custom.type.fieldDefinitions).call(_context, fieldDefinition => {
|
|
4838
|
-
var
|
|
4784
|
+
var _context2, _context3;
|
|
4839
4785
|
return {
|
|
4840
4786
|
name: fieldDefinition.name,
|
|
4841
4787
|
required: fieldDefinition.required,
|
|
4842
|
-
type:
|
|
4788
|
+
type: fieldDefinition.type?.elementType?.name === 'LocalizedEnum' ? _objectSpread$13(_objectSpread$13({}, fieldDefinition.type), {}, {
|
|
4843
4789
|
elementType: _objectSpread$13(_objectSpread$13({}, fieldDefinition.type.elementType), {}, {
|
|
4844
4790
|
values: _mapInstanceProperty(_context2 = _valuesInstanceProperty(fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
4845
4791
|
key: value.key,
|
|
4846
4792
|
label: transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
4847
4793
|
}))
|
|
4848
4794
|
})
|
|
4849
|
-
}) :
|
|
4795
|
+
}) : fieldDefinition.type?.name === 'LocalizedEnum' ? _objectSpread$13(_objectSpread$13({}, fieldDefinition.type), {}, {
|
|
4850
4796
|
values: _mapInstanceProperty(_context3 = _valuesInstanceProperty(fieldDefinition.type)).call(_context3, value => ({
|
|
4851
4797
|
key: value.key,
|
|
4852
4798
|
label: transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -4873,7 +4819,7 @@ const convertProductSelectionFromGraphQl = productSelection => {
|
|
|
4873
4819
|
from: 'nameAllLocales',
|
|
4874
4820
|
to: 'name'
|
|
4875
4821
|
}])), {}, {
|
|
4876
|
-
custom: productSelection
|
|
4822
|
+
custom: productSelection?.custom ? transformCustomFieldFromGraphQLResponse(productSelection) : null
|
|
4877
4823
|
});
|
|
4878
4824
|
};
|
|
4879
4825
|
|
|
@@ -4996,7 +4942,7 @@ function omitSetsOfSets() {
|
|
|
4996
4942
|
* duplicated in original values
|
|
4997
4943
|
*/
|
|
4998
4944
|
function unique(values, properties) {
|
|
4999
|
-
var
|
|
4945
|
+
var _context;
|
|
5000
4946
|
let ignoredValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['', null, undefined];
|
|
5001
4947
|
const duplicateValues = [];
|
|
5002
4948
|
let realValues;
|
|
@@ -5005,20 +4951,19 @@ function unique(values, properties) {
|
|
|
5005
4951
|
realValues = _filterInstanceProperty(values).call(values, value => !_includesInstanceProperty(ignoredValues).call(ignoredValues, value));
|
|
5006
4952
|
if (!realValues.length) return [];
|
|
5007
4953
|
if (properties) realValues = _mapInstanceProperty(realValues).call(realValues, value => _reduceInstanceProperty(properties).call(properties, (prev, curr) => {
|
|
5008
|
-
var _context;
|
|
5009
4954
|
const currentValue = value[curr] || '';
|
|
5010
|
-
return
|
|
4955
|
+
return `${prev}:${currentValue}`;
|
|
5011
4956
|
}, ''));else realValues = _sliceInstanceProperty(values).call(values, 0);
|
|
5012
4957
|
|
|
5013
4958
|
// TODO: checking for dupes like this is slow, find a better way
|
|
5014
|
-
_reduceInstanceProperty(
|
|
4959
|
+
_reduceInstanceProperty(_context = _sortInstanceProperty(realValues).call(realValues)).call(_context, (prev, curr) => {
|
|
5015
4960
|
if (curr === null) return curr;
|
|
5016
4961
|
if (curr !== '' && prev === curr && _indexOfInstanceProperty(duplicateValues).call(duplicateValues, curr) === -1) duplicateValues.push(curr);
|
|
5017
4962
|
return curr;
|
|
5018
4963
|
});
|
|
5019
4964
|
if (properties) return _mapInstanceProperty(duplicateValues).call(duplicateValues, value => {
|
|
5020
|
-
var
|
|
5021
|
-
const parts = _sliceInstanceProperty(
|
|
4965
|
+
var _context2;
|
|
4966
|
+
const parts = _sliceInstanceProperty(_context2 = value.split(':')).call(_context2, 1);
|
|
5022
4967
|
return _reduceInstanceProperty(properties).call(properties, (prev, curr, index) => {
|
|
5023
4968
|
// eslint-disable-next-line no-param-reassign
|
|
5024
4969
|
prev[curr] = parts[index];
|
|
@@ -5037,14 +4982,14 @@ function unique(values, properties) {
|
|
|
5037
4982
|
* @return Array<Object> returns an array of objects with all duplicated values
|
|
5038
4983
|
*/
|
|
5039
4984
|
function uniqueObjects(items) {
|
|
5040
|
-
var
|
|
4985
|
+
var _context3;
|
|
5041
4986
|
const emptyValues = [undefined, null, ''];
|
|
5042
|
-
const itemsWorkingSet = items && items.length ? _filterInstanceProperty(
|
|
4987
|
+
const itemsWorkingSet = items && items.length ? _filterInstanceProperty(_context3 = _sliceInstanceProperty(items).call(items)).call(_context3, x => !_includesInstanceProperty(emptyValues).call(emptyValues, x)) : [];
|
|
5043
4988
|
const duplicateValues = _reduceInstanceProperty(itemsWorkingSet).call(itemsWorkingSet, (acc, item, index) => {
|
|
5044
|
-
var
|
|
4989
|
+
var _context4;
|
|
5045
4990
|
if (item === null) return acc;
|
|
5046
|
-
const isDuplicate = _reduceInstanceProperty(
|
|
5047
|
-
).call(
|
|
4991
|
+
const isDuplicate = _reduceInstanceProperty(_context4 = _sliceInstanceProperty(itemsWorkingSet).call(itemsWorkingSet, index + 1) // get sub-array after this index
|
|
4992
|
+
).call(_context4, (duplicateAcc, comparisonItem, comparisonIndex) => {
|
|
5048
4993
|
if (comparisonItem === null) return duplicateAcc;
|
|
5049
4994
|
|
|
5050
4995
|
// check if its a dupe
|
|
@@ -5171,7 +5116,7 @@ function getCategoriesByIds(apolloClient, options) {
|
|
|
5171
5116
|
return apolloClient.query({
|
|
5172
5117
|
query: FetchCategoriesByIds,
|
|
5173
5118
|
variables: {
|
|
5174
|
-
where:
|
|
5119
|
+
where: `id in (${_mapInstanceProperty(_context2 = options.ids).call(_context2, id => `"${id}"`).join(', ')})`
|
|
5175
5120
|
},
|
|
5176
5121
|
context: {
|
|
5177
5122
|
target: GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -5191,8 +5136,8 @@ function getCategoriesByIds(apolloClient, options) {
|
|
|
5191
5136
|
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 } } } };
|
|
5192
5137
|
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 } } } };
|
|
5193
5138
|
const transformCartDiscountResponse = response => {
|
|
5194
|
-
var _context
|
|
5195
|
-
return _mapInstanceProperty(_context =
|
|
5139
|
+
var _context;
|
|
5140
|
+
return _mapInstanceProperty(_context = response.data?.cartDiscounts.results || []).call(_context, cartDiscount => transformLocalizedFieldsForCartDiscount(cartDiscount));
|
|
5196
5141
|
};
|
|
5197
5142
|
function queryCartDiscounts(apolloClient) {
|
|
5198
5143
|
return apolloClient.query({
|
|
@@ -5204,14 +5149,14 @@ function queryCartDiscounts(apolloClient) {
|
|
|
5204
5149
|
}).then(transformCartDiscountResponse);
|
|
5205
5150
|
}
|
|
5206
5151
|
const getWhereClause = function () {
|
|
5207
|
-
var _context2, _context3
|
|
5152
|
+
var _context2, _context3;
|
|
5208
5153
|
let searchText = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
5209
5154
|
let language = arguments.length > 1 ? arguments[1] : undefined;
|
|
5210
5155
|
const query = _trimInstanceProperty(_context2 = _JSON$stringify(searchText)).call(_context2);
|
|
5211
|
-
const idQuery = isUUID(searchText) &&
|
|
5212
|
-
const nameQuery =
|
|
5213
|
-
const keyQuery =
|
|
5214
|
-
return _filterInstanceProperty(
|
|
5156
|
+
const idQuery = isUUID(searchText) && `id = ${query}`;
|
|
5157
|
+
const nameQuery = `name(${language} = ${query})`;
|
|
5158
|
+
const keyQuery = `key = ${query}`;
|
|
5159
|
+
return _filterInstanceProperty(_context3 = [idQuery, nameQuery, keyQuery]).call(_context3, Boolean).join(' or ');
|
|
5215
5160
|
};
|
|
5216
5161
|
function searchCartDiscountsByExactMatch(apolloClient, options) {
|
|
5217
5162
|
return apolloClient.query({
|
|
@@ -5234,10 +5179,7 @@ function getCartDiscountById(apolloClient, options) {
|
|
|
5234
5179
|
context: {
|
|
5235
5180
|
target: GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
5236
5181
|
}
|
|
5237
|
-
}).then(response =>
|
|
5238
|
-
var _response$data2;
|
|
5239
|
-
return (_response$data2 = response.data) !== null && _response$data2 !== void 0 && _response$data2.cartDiscount ? transformLocalizedFieldsForCartDiscount(response.data.cartDiscount) : null;
|
|
5240
|
-
});
|
|
5182
|
+
}).then(response => response.data?.cartDiscount ? transformLocalizedFieldsForCartDiscount(response.data.cartDiscount) : null);
|
|
5241
5183
|
}
|
|
5242
5184
|
|
|
5243
5185
|
var styles$g = {
|
|
@@ -5322,13 +5264,10 @@ const useReferenceSearchItems = _ref => {
|
|
|
5322
5264
|
};
|
|
5323
5265
|
};
|
|
5324
5266
|
function ReferenceSearch(props) {
|
|
5325
|
-
const ids = useMemo(() => {
|
|
5326
|
-
|
|
5327
|
-
return
|
|
5328
|
-
|
|
5329
|
-
return id;
|
|
5330
|
-
}) : [(_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.id] : [];
|
|
5331
|
-
}, [props.value, props.isMulti]);
|
|
5267
|
+
const ids = useMemo(() => props.value ? props.isMulti ? props.value?.map(_ref2 => {
|
|
5268
|
+
let id = _ref2.id;
|
|
5269
|
+
return id;
|
|
5270
|
+
}) : [props.value?.id] : [], [props.value, props.isMulti]);
|
|
5332
5271
|
const _useReferenceSearchIt = useReferenceSearchItems({
|
|
5333
5272
|
loadItemsBySearchTerm: props.loadItemsBySearchTerm,
|
|
5334
5273
|
loadItemsByIds: props.loadItemsByIds,
|
|
@@ -5339,14 +5278,14 @@ function ReferenceSearch(props) {
|
|
|
5339
5278
|
areSomeItemsMissing = _useReferenceSearchIt.areSomeItemsMissing,
|
|
5340
5279
|
handleLoadItems = _useReferenceSearchIt.handleLoadItems;
|
|
5341
5280
|
if (areItemsLoading) return null;
|
|
5342
|
-
const value = props.isMulti ? items : items
|
|
5281
|
+
const value = props.isMulti ? items : items?.[0];
|
|
5343
5282
|
let filterValue = null;
|
|
5344
5283
|
if (value) filterValue = props.isMulti ? _mapInstanceProperty(value).call(value, props.mapItemToOption) : props.mapItemToOption(value);
|
|
5345
5284
|
const tooltipTitle = value || props.value ? props.mapItemToOption(value || props.value).label : '';
|
|
5346
5285
|
const loadItems = value => _Promise.resolve(handleLoadItems(value)).then(items => _mapInstanceProperty(items).call(items, item => props.mapItemToOption(item)));
|
|
5347
5286
|
const handleChange = event => {
|
|
5348
|
-
var _context
|
|
5349
|
-
const option = props.isMulti ? _mapInstanceProperty(_context = event.target.value).call(_context, item => item.value) :
|
|
5287
|
+
var _context;
|
|
5288
|
+
const option = props.isMulti ? _mapInstanceProperty(_context = event.target.value).call(_context, item => item.value) : event.target.value?.value || null;
|
|
5350
5289
|
props.onChange(option);
|
|
5351
5290
|
};
|
|
5352
5291
|
return jsxs("div", {
|
|
@@ -5460,7 +5399,7 @@ function CartDiscountReferenceSearch(props) {
|
|
|
5460
5399
|
}),
|
|
5461
5400
|
loading = _useQuery.loading,
|
|
5462
5401
|
data = _useQuery.data;
|
|
5463
|
-
const isExactMatch =
|
|
5402
|
+
const isExactMatch = data?.cartDiscounts.total > QUERY_MAX_LIMIT;
|
|
5464
5403
|
const _useIntl = useIntl(),
|
|
5465
5404
|
formatMessage = _useIntl.formatMessage;
|
|
5466
5405
|
const apolloClient = useApolloClient();
|
|
@@ -5560,9 +5499,8 @@ const messages$A = defineMessages({
|
|
|
5560
5499
|
});
|
|
5561
5500
|
|
|
5562
5501
|
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; }
|
|
5563
|
-
function _objectSpread$$(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
5502
|
+
function _objectSpread$$(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$$(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$$(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5564
5503
|
function Option(props) {
|
|
5565
|
-
var _context, _context2;
|
|
5566
5504
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
5567
5505
|
language: applicationContext.dataLocale,
|
|
5568
5506
|
languages: applicationContext.project.languages
|
|
@@ -5583,19 +5521,19 @@ function Option(props) {
|
|
|
5583
5521
|
fallbackOrder: languages
|
|
5584
5522
|
})
|
|
5585
5523
|
}), category.parent && jsx(Text.Detail, {
|
|
5586
|
-
children:
|
|
5524
|
+
children: `${formatMessage(messages$A.parentCategory)}: ${formatLocalizedString(category.parent, {
|
|
5587
5525
|
key: 'name',
|
|
5588
5526
|
locale: language,
|
|
5589
5527
|
fallbackOrder: languages
|
|
5590
|
-
})
|
|
5528
|
+
})}`
|
|
5591
5529
|
}), jsx(Text.Detail, {
|
|
5592
|
-
children:
|
|
5530
|
+
children: `Slug: ${formatLocalizedString(category, {
|
|
5593
5531
|
key: 'slug',
|
|
5594
5532
|
locale: language,
|
|
5595
5533
|
fallbackOrder: languages
|
|
5596
|
-
})
|
|
5534
|
+
})}`
|
|
5597
5535
|
}), category.externalId && jsx(Text.Detail, {
|
|
5598
|
-
children:
|
|
5536
|
+
children: `${formatMessage(messages$A.externalId)}: ${category.externalId || NO_VALUE_FALLBACK}`
|
|
5599
5537
|
})]
|
|
5600
5538
|
})
|
|
5601
5539
|
}));
|
|
@@ -5659,7 +5597,7 @@ var CategorySearchPickerOptionFragment$1 = { kind: "Document", definitions: [{ k
|
|
|
5659
5597
|
function useCachedCategoryOptions(ids) {
|
|
5660
5598
|
const apolloClient = useApolloClient();
|
|
5661
5599
|
const fragments = _mapInstanceProperty(ids).call(ids, id => apolloClient.readFragment({
|
|
5662
|
-
id:
|
|
5600
|
+
id: `CategorySearch:${id}`,
|
|
5663
5601
|
fragment: CategorySearchPickerOptionFragment$1
|
|
5664
5602
|
}));
|
|
5665
5603
|
return _mapInstanceProperty(fragments).call(fragments, category => transformLocalizedFieldsForCategory(category, [{
|
|
@@ -5784,8 +5722,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
5784
5722
|
var _context2;
|
|
5785
5723
|
const intl = useIntl();
|
|
5786
5724
|
const handleLoadOptions = async searchTerm => {
|
|
5787
|
-
|
|
5788
|
-
const filteredOptions = (_props$options = props.options) === null || _props$options === void 0 ? void 0 : _filterInstanceProperty(_props$options).call(_props$options, country => {
|
|
5725
|
+
const filteredOptions = props.options?.filter(country => {
|
|
5789
5726
|
var _context;
|
|
5790
5727
|
return _includesInstanceProperty(_context = country.label.toLowerCase()).call(_context, searchTerm.toLowerCase());
|
|
5791
5728
|
});
|
|
@@ -5793,7 +5730,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
5793
5730
|
return _sliceInstanceProperty(filteredOptions).call(filteredOptions, 0, props.countriesAsyncLoadingLimit);
|
|
5794
5731
|
}
|
|
5795
5732
|
return [{
|
|
5796
|
-
options:
|
|
5733
|
+
options: props.options?.slice(0, props.countriesAsyncLoadingLimit)
|
|
5797
5734
|
}, {
|
|
5798
5735
|
options: emptyCountryOption(intl)
|
|
5799
5736
|
}];
|
|
@@ -5802,10 +5739,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
5802
5739
|
const countries = event.target.value;
|
|
5803
5740
|
props.onChange({
|
|
5804
5741
|
target: _objectSpread$X(_objectSpread$X({}, event.target), {}, {
|
|
5805
|
-
value: _mapInstanceProperty(countries).call(countries, country =>
|
|
5806
|
-
var _country$value;
|
|
5807
|
-
return (_country$value = country === null || country === void 0 ? void 0 : country.value) !== null && _country$value !== void 0 ? _country$value : country;
|
|
5808
|
-
})
|
|
5742
|
+
value: _mapInstanceProperty(countries).call(countries, country => country?.value ?? country)
|
|
5809
5743
|
})
|
|
5810
5744
|
});
|
|
5811
5745
|
};
|
|
@@ -5857,8 +5791,7 @@ const COUNTRIES_ASYNC_LOADING_LIMIT = 60;
|
|
|
5857
5791
|
function ownKeys$W(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; }
|
|
5858
5792
|
function _objectSpread$W(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$W(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$W(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5859
5793
|
function CountriesPicker(props) {
|
|
5860
|
-
|
|
5861
|
-
const CustomCountriesPicker = ((_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.length) <= props.countriesAsyncLoadingLimit ? CountriesBasicSelectDropdown : CountriesAsyncSelectDropdown;
|
|
5794
|
+
const CustomCountriesPicker = props.options?.length <= props.countriesAsyncLoadingLimit ? CountriesBasicSelectDropdown : CountriesAsyncSelectDropdown;
|
|
5862
5795
|
return jsx(Spacings.Stack, {
|
|
5863
5796
|
children: jsx(CustomCountriesPicker, _objectSpread$W({}, props))
|
|
5864
5797
|
});
|
|
@@ -5887,7 +5820,6 @@ var GetCustomerGroupsQuery = { kind: "Document", definitions: [{ kind: "Operatio
|
|
|
5887
5820
|
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 } } } };
|
|
5888
5821
|
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 } } } };
|
|
5889
5822
|
const CustomerGroupPickerInput = _ref => {
|
|
5890
|
-
var _currentOption$data$l, _currentOption$data;
|
|
5891
5823
|
let isClearable = _ref.isClearable,
|
|
5892
5824
|
isDisabled = _ref.isDisabled,
|
|
5893
5825
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -5956,13 +5888,13 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
5956
5888
|
setLoadingError(null);
|
|
5957
5889
|
handleInternalInputChange(event);
|
|
5958
5890
|
}, [handleInternalInputChange]);
|
|
5959
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
5891
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
5960
5892
|
useEffect(() => {
|
|
5961
5893
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
5962
5894
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
5963
5895
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
5964
5896
|
const handleNoOptions = useCallback(() => loadingError ? null : formatMessage(messages$x.noCustomerGroupsFound), [loadingError, formatMessage]);
|
|
5965
|
-
const tooltipTitle =
|
|
5897
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
5966
5898
|
return jsx(Constraints.Horizontal, {
|
|
5967
5899
|
max: "scale",
|
|
5968
5900
|
children: jsxs(Spacings.Stack, {
|
|
@@ -5972,7 +5904,7 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
5972
5904
|
children: jsx(AsyncSelectInput, {
|
|
5973
5905
|
id: name,
|
|
5974
5906
|
name: name,
|
|
5975
|
-
placeholder: placeholder
|
|
5907
|
+
placeholder: placeholder ?? formatMessage(messages$x.placeholder),
|
|
5976
5908
|
loadOptions: loadOptionsDebounced,
|
|
5977
5909
|
defaultOptions: true,
|
|
5978
5910
|
showOptionGroupDivider: true,
|
|
@@ -6066,9 +5998,9 @@ const CustomFieldErrors = props => {
|
|
|
6066
5998
|
const didFormValidationFail = useDidFormValidationFail();
|
|
6067
5999
|
const errors = _Array$isArray(props.errors) ? mergeSetItemsErrors(props.errors) : props.errors;
|
|
6068
6000
|
return jsxs(Fragment, {
|
|
6069
|
-
children: [props.isTouched || didFormValidationFail &&
|
|
6001
|
+
children: [props.isTouched || didFormValidationFail && errors?.missing && jsx(ErrorMessage, {
|
|
6070
6002
|
intlMessage: messages$C.required
|
|
6071
|
-
}), props.isTouched || didFormValidationFail &&
|
|
6003
|
+
}), props.isTouched || didFormValidationFail && errors?.duplicated && jsx(ErrorMessage, {
|
|
6072
6004
|
intlMessage: messages$C.unique
|
|
6073
6005
|
})]
|
|
6074
6006
|
});
|
|
@@ -6152,7 +6084,7 @@ const ExpandButton = props => props.totalValues > 1 ? jsxs(Spacings.Stack, {
|
|
|
6152
6084
|
}), jsx(FlatButton, {
|
|
6153
6085
|
tone: "primary",
|
|
6154
6086
|
icon: props.isExpanded ? jsx(AngleUpIcon, {}) : jsx(AngleDownIcon, {}),
|
|
6155
|
-
label: props.isExpanded ?
|
|
6087
|
+
label: props.isExpanded ? `Hide set items (${props.totalValues})` : `Show all set items (${props.totalValues})`,
|
|
6156
6088
|
onClick: props.onExpand
|
|
6157
6089
|
})]
|
|
6158
6090
|
}) : null;
|
|
@@ -6187,7 +6119,7 @@ const SetButtons = props => {
|
|
|
6187
6119
|
SetButtons.displayName = 'SetButtons';
|
|
6188
6120
|
|
|
6189
6121
|
function ownKeys$U(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; }
|
|
6190
|
-
function _objectSpread$U(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
6122
|
+
function _objectSpread$U(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys$U(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys$U(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6191
6123
|
const getDuplicateErrors = setValues => {
|
|
6192
6124
|
/* eslint-disable no-plusplus */
|
|
6193
6125
|
const result = [];
|
|
@@ -6227,13 +6159,10 @@ const getItemIndex = name => {
|
|
|
6227
6159
|
return _parseInt(rawIndex, 10);
|
|
6228
6160
|
};
|
|
6229
6161
|
const makeKeys = amount => times(amount, () => v4());
|
|
6230
|
-
const makeItemFieldName = (fieldName, index) => {
|
|
6231
|
-
var _context;
|
|
6232
|
-
return _concatInstanceProperty(_context = "".concat(fieldName, ".[")).call(_context, index, "]");
|
|
6233
|
-
};
|
|
6162
|
+
const makeItemFieldName = (fieldName, index) => `${fieldName}.[${index}]`;
|
|
6234
6163
|
const makeMapForAllItems = (fieldName, items, value) => _reduceInstanceProperty(items).call(items, (result, item, index) => set(result, makeItemFieldName(fieldName, index), value), {});
|
|
6235
6164
|
function CustomInputSet(props) {
|
|
6236
|
-
var
|
|
6165
|
+
var _context;
|
|
6237
6166
|
const _useToggleState = useToggleState(false),
|
|
6238
6167
|
_useToggleState2 = _slicedToArray(_useToggleState, 2),
|
|
6239
6168
|
isExpanded = _useToggleState2[0],
|
|
@@ -6255,7 +6184,7 @@ function CustomInputSet(props) {
|
|
|
6255
6184
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
6256
6185
|
keys = _useState4[0],
|
|
6257
6186
|
setKeys = _useState4[1];
|
|
6258
|
-
const totalAmount = internalValue
|
|
6187
|
+
const totalAmount = internalValue?.length;
|
|
6259
6188
|
const amountToRender = isExpanded ? totalAmount : 1;
|
|
6260
6189
|
const updateInternalValue = newValue => {
|
|
6261
6190
|
const valueToSet = isEmpty$1(newValue) ? [undefined] : newValue;
|
|
@@ -6302,8 +6231,8 @@ function CustomInputSet(props) {
|
|
|
6302
6231
|
// in <CustomFieldComponent /> where proper component for given field/attribute
|
|
6303
6232
|
// type is selected.
|
|
6304
6233
|
const type = getType(props.fieldDefinition);
|
|
6305
|
-
const typeName = type
|
|
6306
|
-
const areButtonsTopAligned = _includesInstanceProperty(
|
|
6234
|
+
const typeName = type?.name.toLowerCase();
|
|
6235
|
+
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);
|
|
6307
6236
|
return jsxs(Fragment, {
|
|
6308
6237
|
children: [jsx(AccessibleHidden, {
|
|
6309
6238
|
children: jsx("label", {
|
|
@@ -6422,17 +6351,16 @@ function CustomDateTimeInput(props) {
|
|
|
6422
6351
|
CustomDateTimeInput.displayName = 'CustomDateTimeInput';
|
|
6423
6352
|
|
|
6424
6353
|
const convertTypeValuesToOptions$1 = defaultMemoize(typeValues => _mapInstanceProperty(typeValues).call(typeValues, typeValue => ({
|
|
6425
|
-
label: typeValue.label ||
|
|
6354
|
+
label: typeValue.label || `${typeValue.key} (key)`,
|
|
6426
6355
|
value: typeValue.key
|
|
6427
6356
|
})));
|
|
6428
6357
|
function CustomEnumInput(props) {
|
|
6429
|
-
var _options$find$label, _options$find;
|
|
6430
6358
|
const options = convertTypeValuesToOptions$1(_valuesInstanceProperty(props.fieldDefinition.type));
|
|
6431
6359
|
const handleChange = makeChangeHandler(rawValue => {
|
|
6432
6360
|
props.setFieldValue(props.name, rawValue);
|
|
6433
6361
|
props.renderWarnings && props.handleWarningChange(props.name, props.fieldDefinition, rawValue);
|
|
6434
6362
|
});
|
|
6435
|
-
const tooltipTitle = props.value ?
|
|
6363
|
+
const tooltipTitle = props.value ? _findInstanceProperty(options).call(options, option => option.value === props.value)?.label ?? '' : '';
|
|
6436
6364
|
return jsx(CustomFieldTooltip, {
|
|
6437
6365
|
title: tooltipTitle,
|
|
6438
6366
|
children: jsx(SelectInput, {
|
|
@@ -6461,13 +6389,12 @@ const convertTypeValuesToOptions = defaultMemoize((type, dataLocale, languages)
|
|
|
6461
6389
|
key: 'label',
|
|
6462
6390
|
locale: dataLocale,
|
|
6463
6391
|
fallbackOrder: languages,
|
|
6464
|
-
fallback:
|
|
6392
|
+
fallback: `${value.key} (key)`
|
|
6465
6393
|
}),
|
|
6466
6394
|
value: value.key
|
|
6467
6395
|
}));
|
|
6468
6396
|
});
|
|
6469
6397
|
function CustomLocalizedEnumInput(props) {
|
|
6470
|
-
var _options$find$label, _options$find;
|
|
6471
6398
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
6472
6399
|
languages: applicationContext.project.languages,
|
|
6473
6400
|
dataLocale: applicationContext.dataLocale
|
|
@@ -6479,7 +6406,7 @@ function CustomLocalizedEnumInput(props) {
|
|
|
6479
6406
|
props.setFieldValue(props.name, rawValue);
|
|
6480
6407
|
props.renderWarnings && props.handleWarningChange(props.name, props.fieldDefinition, rawValue);
|
|
6481
6408
|
});
|
|
6482
|
-
const tooltipTitle = props.value ?
|
|
6409
|
+
const tooltipTitle = props.value ? _findInstanceProperty(options).call(options, option => option.value === props.value)?.label ?? '' : '';
|
|
6483
6410
|
return jsx(CustomFieldTooltip, {
|
|
6484
6411
|
title: tooltipTitle,
|
|
6485
6412
|
children: jsx(SelectInput, {
|
|
@@ -6508,7 +6435,6 @@ const getSubfieldLanguage = subfieldName => {
|
|
|
6508
6435
|
return subfieldName.substring(lastDotIndex + 1);
|
|
6509
6436
|
};
|
|
6510
6437
|
function CustomLocalizedTextInput(props) {
|
|
6511
|
-
var _value$language;
|
|
6512
6438
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
6513
6439
|
language: applicationContext.dataLocale,
|
|
6514
6440
|
languages: applicationContext.project.languages
|
|
@@ -6534,7 +6460,7 @@ function CustomLocalizedTextInput(props) {
|
|
|
6534
6460
|
props.renderWarnings && props.handleWarningChange(props.name, props.fieldDefinition, rawValue);
|
|
6535
6461
|
});
|
|
6536
6462
|
const InputComponent = isMultiLine ? LocalizedMultilineTextInput : LocalizedTextInput;
|
|
6537
|
-
const tooltipTitle = isMultiLine ? '' : value ?
|
|
6463
|
+
const tooltipTitle = isMultiLine ? '' : value ? value[language] ?? '' : '';
|
|
6538
6464
|
return jsx(CustomFieldTooltip, {
|
|
6539
6465
|
title: tooltipTitle,
|
|
6540
6466
|
children: jsx(InputComponent, {
|
|
@@ -6583,7 +6509,7 @@ const fixAmount = value => {
|
|
|
6583
6509
|
// data user just entered effectively preventing full data from being entered.
|
|
6584
6510
|
const fixEnteredValue = (newValue, initialValue, currencies) => {
|
|
6585
6511
|
const withFixedCurrency = fixCurrencyCode(newValue, currencies);
|
|
6586
|
-
if (!
|
|
6512
|
+
if (!initialValue?.amount) {
|
|
6587
6513
|
return fixAmount(withFixedCurrency);
|
|
6588
6514
|
}
|
|
6589
6515
|
return withFixedCurrency;
|
|
@@ -6650,19 +6576,19 @@ function ownKeys$R(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySy
|
|
|
6650
6576
|
function _objectSpread$R(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context6 = ownKeys$R(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context7 = ownKeys$R(Object(t))).call(_context7, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6651
6577
|
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 } } } };
|
|
6652
6578
|
const mapAttributeDefinition = definition => {
|
|
6653
|
-
var _context,
|
|
6579
|
+
var _context, _context2, _context3, _context4;
|
|
6654
6580
|
return _objectSpread$R(_objectSpread$R({}, definition), {}, {
|
|
6655
6581
|
required: definition.isRequired,
|
|
6656
6582
|
inputTip: transformLocalizedFieldToLocalizedString(definition.inputTipAllLocales),
|
|
6657
6583
|
label: transformLocalizedFieldToLocalizedString(definition.labelAllLocales),
|
|
6658
|
-
type: _includesInstanceProperty(_context = ['enum', 'lenum']).call(_context,
|
|
6584
|
+
type: _includesInstanceProperty(_context = ['enum', 'lenum']).call(_context, definition.type?.elementType?.name) ? _objectSpread$R(_objectSpread$R({}, definition.type), {}, {
|
|
6659
6585
|
elementType: _objectSpread$R(_objectSpread$R({}, definition.type.elementType), {}, {
|
|
6660
6586
|
values: _mapInstanceProperty(_context2 = _valuesInstanceProperty(definition.type.elementType).results).call(_context2, value => ({
|
|
6661
6587
|
key: value.key,
|
|
6662
6588
|
label: value.label || transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
6663
6589
|
}))
|
|
6664
6590
|
})
|
|
6665
|
-
}) : _includesInstanceProperty(_context3 = ['enum', 'lenum']).call(_context3,
|
|
6591
|
+
}) : _includesInstanceProperty(_context3 = ['enum', 'lenum']).call(_context3, definition.type?.name) ? _objectSpread$R(_objectSpread$R({}, definition.type), {}, {
|
|
6666
6592
|
values: _mapInstanceProperty(_context4 = _valuesInstanceProperty(definition.type).results).call(_context4, value => ({
|
|
6667
6593
|
key: value.key,
|
|
6668
6594
|
label: value.label || transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -7000,8 +6926,7 @@ const CustomNestedInput = /*#__PURE__*/memo(props => {
|
|
|
7000
6926
|
CustomNestedInput.displayName = 'CustomNestedInput';
|
|
7001
6927
|
|
|
7002
6928
|
function CustomNumberInput(props) {
|
|
7003
|
-
|
|
7004
|
-
const value = (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : '';
|
|
6929
|
+
const value = props.value ?? '';
|
|
7005
6930
|
const handleChange = makeChangeHandler(rawValue => {
|
|
7006
6931
|
props.setFieldValue(props.name, !rawValue ? undefined : Number(rawValue));
|
|
7007
6932
|
props.renderWarnings && props.handleWarningChange(props.name, props.fieldDefinition, rawValue);
|
|
@@ -7075,8 +7000,7 @@ function CustomCategoryReferenceInput(props) {
|
|
|
7075
7000
|
CustomCategoryReferenceInput.displayName = 'CustomCategoryReferenceInput';
|
|
7076
7001
|
|
|
7077
7002
|
function CustomChannelReferenceInput(props) {
|
|
7078
|
-
|
|
7079
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
7003
|
+
const value = props.value?.id || '';
|
|
7080
7004
|
return jsx(ChannelPickerInput, {
|
|
7081
7005
|
value: value,
|
|
7082
7006
|
name: props.name,
|
|
@@ -7112,7 +7036,6 @@ const DropdownIndicator = () => jsx(SearchIcon, {
|
|
|
7112
7036
|
});
|
|
7113
7037
|
DropdownIndicator.displayName = 'DropdownIndicator';
|
|
7114
7038
|
const ProductPickerInput = _ref => {
|
|
7115
|
-
var _currentOption$data$l, _currentOption$data;
|
|
7116
7039
|
let isClearable = _ref.isClearable,
|
|
7117
7040
|
isDisabled = _ref.isDisabled,
|
|
7118
7041
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -7133,20 +7056,19 @@ const ProductPickerInput = _ref => {
|
|
|
7133
7056
|
loadingError = _useState2[0],
|
|
7134
7057
|
setLoadingError = _useState2[1];
|
|
7135
7058
|
const convertProductToOption = useCallback(product => {
|
|
7136
|
-
var _masterData$current;
|
|
7137
7059
|
if (!product) return null;
|
|
7138
7060
|
const id = product.id,
|
|
7139
7061
|
key = product.key,
|
|
7140
7062
|
masterData = product.masterData;
|
|
7141
|
-
const localizedName = formatLocalizedFieldToString(
|
|
7063
|
+
const localizedName = formatLocalizedFieldToString(masterData.current?.nameAllLocales);
|
|
7142
7064
|
return {
|
|
7143
|
-
label: localizedName + (key ?
|
|
7065
|
+
label: localizedName + (key ? ` (key: ${key})` : ''),
|
|
7144
7066
|
value: id,
|
|
7145
7067
|
name: localizedName,
|
|
7146
7068
|
key
|
|
7147
7069
|
};
|
|
7148
7070
|
}, [formatLocalizedFieldToString]);
|
|
7149
|
-
const prefixSearchFields = useMemo(() => [
|
|
7071
|
+
const prefixSearchFields = useMemo(() => [`masterData.current.name.${dataLocale}`, 'key'], [dataLocale]);
|
|
7150
7072
|
const loadOptions = useLoadOptions({
|
|
7151
7073
|
query: GetProductsQuery,
|
|
7152
7074
|
prefixSearchFields
|
|
@@ -7177,12 +7099,12 @@ const ProductPickerInput = _ref => {
|
|
|
7177
7099
|
setLoadingError(null);
|
|
7178
7100
|
handleInternalInputChange(event);
|
|
7179
7101
|
}, [handleInternalInputChange]);
|
|
7180
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
7102
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
7181
7103
|
useEffect(() => {
|
|
7182
7104
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
7183
7105
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
7184
7106
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
7185
|
-
const tooltipTitle =
|
|
7107
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
7186
7108
|
return jsx(Constraints.Horizontal, {
|
|
7187
7109
|
max: "scale",
|
|
7188
7110
|
children: currentOption.loading ? jsx(CenteredLoadingSpinner, {}) : jsxs(Spacings.Stack, {
|
|
@@ -7222,8 +7144,7 @@ const ProductPickerInput = _ref => {
|
|
|
7222
7144
|
ProductPickerInput.displayName = 'ProductPickerInput';
|
|
7223
7145
|
|
|
7224
7146
|
function CustomProductReferenceInput(props) {
|
|
7225
|
-
|
|
7226
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
7147
|
+
const value = props.value?.id || '';
|
|
7227
7148
|
return jsx(ProductPickerInput, {
|
|
7228
7149
|
value: value,
|
|
7229
7150
|
name: props.name,
|
|
@@ -7241,8 +7162,7 @@ function CustomProductReferenceInput(props) {
|
|
|
7241
7162
|
CustomProductReferenceInput.displayName = 'CustomProductReferenceInput';
|
|
7242
7163
|
|
|
7243
7164
|
function CustomProductTypeReferenceInput(props) {
|
|
7244
|
-
|
|
7245
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
7165
|
+
const value = props.value?.id || '';
|
|
7246
7166
|
return jsx(ProductTypePickerInput, {
|
|
7247
7167
|
value: value,
|
|
7248
7168
|
name: props.name,
|
|
@@ -7259,8 +7179,7 @@ function CustomProductTypeReferenceInput(props) {
|
|
|
7259
7179
|
CustomProductTypeReferenceInput.displayName = 'CustomProductTypeReferenceInput';
|
|
7260
7180
|
|
|
7261
7181
|
function CustomRawIdReferenceInput(props) {
|
|
7262
|
-
|
|
7263
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
7182
|
+
const value = props.value?.id || '';
|
|
7264
7183
|
return jsx(CustomFieldTooltip, {
|
|
7265
7184
|
title: value,
|
|
7266
7185
|
children: jsx(TextInput, {
|
|
@@ -7278,8 +7197,7 @@ function CustomRawIdReferenceInput(props) {
|
|
|
7278
7197
|
CustomRawIdReferenceInput.displayName = 'CustomRawIdReferenceInput';
|
|
7279
7198
|
|
|
7280
7199
|
function CustomStateReferenceInput(props) {
|
|
7281
|
-
|
|
7282
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
7200
|
+
const value = props.value?.id || '';
|
|
7283
7201
|
return jsx(StatePickerInput, {
|
|
7284
7202
|
value: value,
|
|
7285
7203
|
name: props.name,
|
|
@@ -7415,14 +7333,12 @@ const nonSetComponents = {
|
|
|
7415
7333
|
};
|
|
7416
7334
|
const CustomFieldInput = /*#__PURE__*/memo(props => {
|
|
7417
7335
|
const InputComponent = useMemo(() => {
|
|
7418
|
-
|
|
7419
|
-
const typeName = (_props$fieldDefinitio = props.fieldDefinition.type) === null || _props$fieldDefinitio === void 0 ? void 0 : _props$fieldDefinitio.name.toLowerCase();
|
|
7336
|
+
const typeName = props.fieldDefinition.type?.name.toLowerCase();
|
|
7420
7337
|
if (typeName === 'set') {
|
|
7421
|
-
var _getSetElementType;
|
|
7422
7338
|
// Boolean is the only set element with peculiarities (i.e. way more
|
|
7423
7339
|
// convenient for user to work with it as with select input with three values:
|
|
7424
7340
|
// [true], [false] and [true, false]).
|
|
7425
|
-
if (
|
|
7341
|
+
if (getType(props.fieldDefinition)?.name.toLowerCase() === CUSTOM_FIELD_TYPES.boolean) {
|
|
7426
7342
|
return CustomBooleanInputSet;
|
|
7427
7343
|
}
|
|
7428
7344
|
// All the rest sets are just a fancy wrapper around single-item components
|
|
@@ -7490,10 +7406,9 @@ function _objectSpread$P(e) { for (var r = 1; r < arguments.length; r++) { var _
|
|
|
7490
7406
|
function _EMOTION_STRINGIFIED_CSS_ERROR__$1() { 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)."; }
|
|
7491
7407
|
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 } } } };
|
|
7492
7408
|
const CustomFieldsLabelHint = _ref2 => {
|
|
7493
|
-
var _type$name;
|
|
7494
7409
|
let fieldDefinition = _ref2.fieldDefinition;
|
|
7495
7410
|
const type = getType(fieldDefinition);
|
|
7496
|
-
const isReference =
|
|
7411
|
+
const isReference = type.name?.toLowerCase() === 'reference';
|
|
7497
7412
|
const referenceTypeId = type.referenceTypeId;
|
|
7498
7413
|
const isCartDiscountsReference = isReference && referenceTypeId === SEARCHABLE_REFERENCES.cartDiscount;
|
|
7499
7414
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
@@ -7511,7 +7426,7 @@ const CustomFieldsLabelHint = _ref2 => {
|
|
|
7511
7426
|
data = _useQuery.data,
|
|
7512
7427
|
loading = _useQuery.loading;
|
|
7513
7428
|
if (loading) return null;
|
|
7514
|
-
if (
|
|
7429
|
+
if (data?.cartDiscounts.total > QUERY_MAX_LIMIT) {
|
|
7515
7430
|
return jsxs(Spacings.Inline, {
|
|
7516
7431
|
alignItems: "center",
|
|
7517
7432
|
children: [jsx(WarningIcon, {
|
|
@@ -7538,17 +7453,17 @@ function CustomFieldsProductTypeReferenceSubtitle() {
|
|
|
7538
7453
|
// TODO(pa3): this logic may be misplaced and probably
|
|
7539
7454
|
// should belong to <CustomReferenceInput /> component instead.
|
|
7540
7455
|
function CustomFieldsLabelSubtitle(_ref3) {
|
|
7541
|
-
var
|
|
7456
|
+
var _context;
|
|
7542
7457
|
let fieldDefinition = _ref3.fieldDefinition;
|
|
7543
7458
|
const _useIntl2 = useIntl(),
|
|
7544
7459
|
formatMessage = _useIntl2.formatMessage;
|
|
7545
7460
|
const type = getType(fieldDefinition);
|
|
7546
|
-
const isReference =
|
|
7461
|
+
const isReference = type.name?.toLowerCase() === 'reference';
|
|
7547
7462
|
if (!isReference) return null;
|
|
7548
7463
|
const referenceTypeId = type.referenceTypeId;
|
|
7549
7464
|
const referenceTypeName = capitalizeFirst(referenceTypeId);
|
|
7550
7465
|
if (_includesInstanceProperty(_context = [SEARCHABLE_REFERENCES.category, SEARCHABLE_REFERENCES.cartDiscount]).call(_context, referenceTypeId)) return referenceTypeName;
|
|
7551
|
-
return referenceTypeId === SEARCHABLE_REFERENCES.product ? formatMessage(messages$t.productReferenceLabel) : referenceTypeId === SEARCHABLE_REFERENCES.productType ? jsx(CustomFieldsProductTypeReferenceSubtitle, {}) : referenceTypeId === SEARCHABLE_REFERENCES.channel ? formatMessage(messages$t.channelReferenceLabel) : referenceTypeId === SEARCHABLE_REFERENCES.state ? formatMessage(messages$t.stateReferenceLabel) :
|
|
7466
|
+
return referenceTypeId === SEARCHABLE_REFERENCES.product ? formatMessage(messages$t.productReferenceLabel) : referenceTypeId === SEARCHABLE_REFERENCES.productType ? jsx(CustomFieldsProductTypeReferenceSubtitle, {}) : referenceTypeId === SEARCHABLE_REFERENCES.channel ? formatMessage(messages$t.channelReferenceLabel) : referenceTypeId === SEARCHABLE_REFERENCES.state ? formatMessage(messages$t.stateReferenceLabel) : `${referenceTypeName} ID`;
|
|
7552
7467
|
}
|
|
7553
7468
|
const Portal = props => /*#__PURE__*/ReactDOM.createPortal(props.children, document.body);
|
|
7554
7469
|
var _ref$1 = process.env.NODE_ENV === "production" ? {
|
|
@@ -7565,7 +7480,7 @@ function CustomFieldsCountIndicator(_ref4) {
|
|
|
7565
7480
|
const formatLocalizedField = useFormatLocalizedFieldToString();
|
|
7566
7481
|
const _useIntl3 = useIntl(),
|
|
7567
7482
|
formatMessage = _useIntl3.formatMessage;
|
|
7568
|
-
return
|
|
7483
|
+
return assignedAttributeGroups?.length > 1 ? jsx(Tooltip, {
|
|
7569
7484
|
title: formatMessage(messages$t.attributeGroupCountTooltip, {
|
|
7570
7485
|
attributeGroups: _mapInstanceProperty(assignedAttributeGroups).call(assignedAttributeGroups, assignedAttributeGroup => formatLocalizedField(assignedAttributeGroup.nameAllLocales)).join(', '),
|
|
7571
7486
|
count: assignedAttributeGroups.length
|
|
@@ -7830,11 +7745,10 @@ const useDnDContext = () => {
|
|
|
7830
7745
|
|
|
7831
7746
|
const _excluded$1 = ["WrapperComponent"];
|
|
7832
7747
|
function ownKeys$J(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; }
|
|
7833
|
-
function _objectSpread$J(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
7748
|
+
function _objectSpread$J(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$J(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$J(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7834
7749
|
const getFieldName = (parentName, fieldName) => {
|
|
7835
|
-
var _context;
|
|
7836
7750
|
if (!parentName) return fieldName;
|
|
7837
|
-
return
|
|
7751
|
+
return `${parentName}.${fieldName}`;
|
|
7838
7752
|
};
|
|
7839
7753
|
const isNested = fieldDefinition => {
|
|
7840
7754
|
const type = fieldDefinition.type;
|
|
@@ -7865,7 +7779,6 @@ const CustomFieldsInternal = _ref => {
|
|
|
7865
7779
|
return jsx(DroppableWrapper, {
|
|
7866
7780
|
onDragEnd: onDragEnd,
|
|
7867
7781
|
children: _mapInstanceProperty(fieldDefinitions).call(fieldDefinitions, (fieldDefinition, index) => {
|
|
7868
|
-
var _context2, _context3;
|
|
7869
7782
|
const fieldName = getFieldName(props.name, fieldDefinition.name);
|
|
7870
7783
|
const isTouched = Boolean(getIn(touched, fieldName));
|
|
7871
7784
|
const fieldErrors = getIn(errors, fieldName);
|
|
@@ -7890,7 +7803,7 @@ const CustomFieldsInternal = _ref => {
|
|
|
7890
7803
|
onBlur: handleBlur,
|
|
7891
7804
|
setFieldValue: props.setFieldValue,
|
|
7892
7805
|
hasError: hasError,
|
|
7893
|
-
hasWarning: props.renderWarnings &&
|
|
7806
|
+
hasWarning: props.renderWarnings && status?.warnings[fieldName],
|
|
7894
7807
|
handleWarningChange: props.handleWarningChange,
|
|
7895
7808
|
renderWarnings: props.renderWarnings
|
|
7896
7809
|
};
|
|
@@ -7898,36 +7811,33 @@ const CustomFieldsInternal = _ref => {
|
|
|
7898
7811
|
return jsx(FastField, {
|
|
7899
7812
|
name: fieldName,
|
|
7900
7813
|
validate: validate,
|
|
7901
|
-
children: () => {
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
children:
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
isTouched: isTouched,
|
|
7923
|
-
errors: fieldErrors
|
|
7924
|
-
})]
|
|
7814
|
+
children: () => jsx(DraggableWrapper, {
|
|
7815
|
+
draggableKey: `${fieldName}-${index}`,
|
|
7816
|
+
draggableId: `${fieldName}-${index}`,
|
|
7817
|
+
index: index,
|
|
7818
|
+
children: jsx(Spacings.Stack, {
|
|
7819
|
+
scale: "xs",
|
|
7820
|
+
children: jsxs("div", {
|
|
7821
|
+
"aria-invalid": _Object$keys(fieldErrors ?? {}).length > 0,
|
|
7822
|
+
"aria-errormessage": `${fieldName}-error`,
|
|
7823
|
+
id: `${fieldName}-error`,
|
|
7824
|
+
children: [jsx(CustomFieldsLabel, {
|
|
7825
|
+
name: fieldName,
|
|
7826
|
+
fieldDefinition: fieldDefinition
|
|
7827
|
+
}), jsxs(Spacings.Stack, {
|
|
7828
|
+
scale: "xs",
|
|
7829
|
+
alignItems: "stretch",
|
|
7830
|
+
children: [WrapperComponent ? jsx(WrapperComponent, {
|
|
7831
|
+
children: Field
|
|
7832
|
+
}) : Field, props.renderWarnings && status?.warnings[fieldName] && props.renderCustomWarnings(fieldDefinition), jsx(CustomFieldErrors, {
|
|
7833
|
+
isTouched: isTouched,
|
|
7834
|
+
errors: fieldErrors
|
|
7925
7835
|
})]
|
|
7926
|
-
})
|
|
7836
|
+
})]
|
|
7927
7837
|
})
|
|
7928
|
-
})
|
|
7929
|
-
}
|
|
7930
|
-
},
|
|
7838
|
+
})
|
|
7839
|
+
})
|
|
7840
|
+
}, `${fieldName}-${index}-${fieldKey}`);
|
|
7931
7841
|
})
|
|
7932
7842
|
});
|
|
7933
7843
|
};
|
|
@@ -7940,9 +7850,9 @@ function ownKeys$I(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySy
|
|
|
7940
7850
|
function _objectSpread$I(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context7 = ownKeys$I(Object(t), !0)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context8 = ownKeys$I(Object(t))).call(_context8, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7941
7851
|
const getTypeName = type => type.name.toLowerCase();
|
|
7942
7852
|
const findLabel = (enumType, key) => {
|
|
7943
|
-
var
|
|
7853
|
+
var _context;
|
|
7944
7854
|
const emptyValue = getTypeName(enumType) === 'enum' ? '' : {};
|
|
7945
|
-
return
|
|
7855
|
+
return _findInstanceProperty(_context = _valuesInstanceProperty(enumType)).call(_context, value => value.key === key)?.label ?? emptyValue;
|
|
7946
7856
|
};
|
|
7947
7857
|
const convertEnumValues = (value, attributeDefinition) => {
|
|
7948
7858
|
var _context2, _context3;
|
|
@@ -8008,7 +7918,7 @@ const attributesMapToNameValuePairs = map => {
|
|
|
8008
7918
|
const _excluded = ["WrapperComponent"];
|
|
8009
7919
|
const getAttributeShortName = (fullName, attributesPrefix) => {
|
|
8010
7920
|
if (!attributesPrefix) return fullName;
|
|
8011
|
-
return fullName.replace(
|
|
7921
|
+
return fullName.replace(`${attributesPrefix}.`, '');
|
|
8012
7922
|
};
|
|
8013
7923
|
function ProductAttributes(_ref) {
|
|
8014
7924
|
let WrapperComponent = _ref.WrapperComponent,
|
|
@@ -8106,7 +8016,7 @@ var pickerMessages = defineMessages({
|
|
|
8106
8016
|
});
|
|
8107
8017
|
|
|
8108
8018
|
function ownKeys$H(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; }
|
|
8109
|
-
function _objectSpread$H(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
8019
|
+
function _objectSpread$H(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$H(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$H(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8110
8020
|
const PRODUCT_SELECTION_MODES = {
|
|
8111
8021
|
INCLUSION: 'Individual',
|
|
8112
8022
|
EXCLUSION: 'IndividualExclusion'
|
|
@@ -8117,11 +8027,10 @@ const PRODUCT_SELECTION_MODES_LABELS = {
|
|
|
8117
8027
|
};
|
|
8118
8028
|
const getMode = mode => mode === PRODUCT_SELECTION_MODES.INCLUSION || mode === PRODUCT_SELECTION_MODES_LABELS.INCLUSION ? 'inclusion' : 'exclusion';
|
|
8119
8029
|
const addModeToLabel = function (ps) {
|
|
8120
|
-
var _context;
|
|
8121
8030
|
let enableExcludingProducts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
8122
8031
|
if (!ps) return undefined;
|
|
8123
8032
|
return _objectSpread$H(_objectSpread$H({}, ps), {}, {
|
|
8124
|
-
label:
|
|
8033
|
+
label: `${ps?.label}${enableExcludingProducts ? ` (type: ${getMode(ps?.mode)})` : ''}`
|
|
8125
8034
|
});
|
|
8126
8035
|
};
|
|
8127
8036
|
|
|
@@ -8138,7 +8047,7 @@ const getValueFromOptions$3 = _ref => {
|
|
|
8138
8047
|
// handle async-select-field value transformation
|
|
8139
8048
|
if (isMulti) {
|
|
8140
8049
|
var _context;
|
|
8141
|
-
return _mapInstanceProperty(_context = _filterInstanceProperty(allProductSelectionOptions).call(allProductSelectionOptions, ps => currentlySelectedProductSelections
|
|
8050
|
+
return _mapInstanceProperty(_context = _filterInstanceProperty(allProductSelectionOptions).call(allProductSelectionOptions, ps => currentlySelectedProductSelections?.includes(ps.value))).call(_context, ps => addModeToLabel(ps, enableExcludingProducts));
|
|
8142
8051
|
}
|
|
8143
8052
|
|
|
8144
8053
|
// in case it is not multiselect, then a single valued async-select-input is being requested and the value should have proper format
|
|
@@ -8150,7 +8059,6 @@ const emptyStoreOption$1 = intl => [{
|
|
|
8150
8059
|
isDisabled: true
|
|
8151
8060
|
}];
|
|
8152
8061
|
function ProductSelectionsAsyncSelectDropdown(props) {
|
|
8153
|
-
var _productSelectionsFet3;
|
|
8154
8062
|
const intl = useIntl();
|
|
8155
8063
|
const enableExcludingProducts = useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
8156
8064
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -8163,17 +8071,13 @@ function ProductSelectionsAsyncSelectDropdown(props) {
|
|
|
8163
8071
|
})),
|
|
8164
8072
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
8165
8073
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8166
|
-
const productSelections = useMemo(() =>
|
|
8167
|
-
var _productSelectionsFet, _productSelectionsFet2;
|
|
8168
|
-
return (_productSelectionsFet = (_productSelectionsFet2 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet2 === void 0 ? void 0 : _productSelectionsFet2.results) !== null && _productSelectionsFet !== void 0 ? _productSelectionsFet : [];
|
|
8169
|
-
}, [(_productSelectionsFet3 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet3 === void 0 ? void 0 : _productSelectionsFet3.results]);
|
|
8074
|
+
const productSelections = useMemo(() => productSelectionsFetcher.productSelections?.results ?? [], [productSelectionsFetcher.productSelections?.results]);
|
|
8170
8075
|
const filteredProductSelections = _filterInstanceProperty(productSelections).call(productSelections, ps => {
|
|
8171
8076
|
var _context2;
|
|
8172
8077
|
return !_includesInstanceProperty(_context2 = props.excludedProductSelectionIds).call(_context2, ps.id);
|
|
8173
8078
|
});
|
|
8174
8079
|
const onOptionClick = event => {
|
|
8175
|
-
|
|
8176
|
-
const productSelectionId = (_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.value;
|
|
8080
|
+
const productSelectionId = event.target.value?.value;
|
|
8177
8081
|
const currentProductSelection = _findInstanceProperty(productSelections).call(productSelections, productSelection => productSelection.id === productSelectionId);
|
|
8178
8082
|
props.onChange(currentProductSelection);
|
|
8179
8083
|
};
|
|
@@ -8256,7 +8160,6 @@ const mapProductSelectionsToOptions$1 = memoize(function () {
|
|
|
8256
8160
|
let enableExcludingProducts = arguments.length > 4 ? arguments[4] : undefined;
|
|
8257
8161
|
const selectedPSList = _Array$isArray(selectedPS) ? selectedPS : [selectedPS];
|
|
8258
8162
|
return _mapInstanceProperty(productSelections).call(productSelections, productSelection => {
|
|
8259
|
-
var _context;
|
|
8260
8163
|
const label = formatLocalizedString(productSelection, {
|
|
8261
8164
|
key: 'name',
|
|
8262
8165
|
locale: dataLocale,
|
|
@@ -8265,14 +8168,13 @@ const mapProductSelectionsToOptions$1 = memoize(function () {
|
|
|
8265
8168
|
return {
|
|
8266
8169
|
id: productSelection.id,
|
|
8267
8170
|
value: productSelection.id,
|
|
8268
|
-
label:
|
|
8171
|
+
label: `${label}${_includesInstanceProperty(selectedPSList).call(selectedPSList, productSelection.id) && enableExcludingProducts ? ` (type: ${getMode(productSelection.mode)})` : ''}`,
|
|
8269
8172
|
key: productSelection.key,
|
|
8270
8173
|
mode: getMode(productSelection.mode)
|
|
8271
8174
|
};
|
|
8272
8175
|
});
|
|
8273
8176
|
});
|
|
8274
8177
|
function ProductSelectionBasicSelectDropdown(props) {
|
|
8275
|
-
var _productSelectionsFet, _productSelectionsFet2;
|
|
8276
8178
|
const intl = useIntl();
|
|
8277
8179
|
const enableExcludingProducts = useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
8278
8180
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -8285,10 +8187,10 @@ function ProductSelectionBasicSelectDropdown(props) {
|
|
|
8285
8187
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
8286
8188
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8287
8189
|
if (productSelectionsFetcher.isLoading) return jsx(CenteredLoadingSpinner, {});
|
|
8288
|
-
const productSelections =
|
|
8190
|
+
const productSelections = productSelectionsFetcher.productSelections?.results ?? [];
|
|
8289
8191
|
const filteredProductSelections = _filterInstanceProperty(productSelections).call(productSelections, ps => {
|
|
8290
|
-
var
|
|
8291
|
-
return !_includesInstanceProperty(
|
|
8192
|
+
var _context;
|
|
8193
|
+
return !_includesInstanceProperty(_context = props.excludedProductSelectionIds).call(_context, ps.id);
|
|
8292
8194
|
});
|
|
8293
8195
|
const onOptionClick = event => {
|
|
8294
8196
|
const productSelectionId = event.target.value;
|
|
@@ -8325,15 +8227,11 @@ function ProductSelectionBasicSelectDropdown(props) {
|
|
|
8325
8227
|
}
|
|
8326
8228
|
|
|
8327
8229
|
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 } } } };
|
|
8328
|
-
const createQueryVariables$4 = (productSelections, predicateField) => {
|
|
8329
|
-
|
|
8330
|
-
|
|
8331
|
-
|
|
8332
|
-
limit: 500
|
|
8333
|
-
};
|
|
8334
|
-
};
|
|
8230
|
+
const createQueryVariables$4 = (productSelections, predicateField) => ({
|
|
8231
|
+
where: `${predicateField} in (${_mapInstanceProperty(productSelections).call(productSelections, ps => `"${ps}"`).join(', ')})`,
|
|
8232
|
+
limit: 500
|
|
8233
|
+
});
|
|
8335
8234
|
const useProductSelectionsByFieldFetcher = (productSelections, predicateField) => {
|
|
8336
|
-
var _productSelectionsQue, _productSelectionsQue2;
|
|
8337
8235
|
const productSelectionList = _Array$isArray(productSelections) ? productSelections : [productSelections];
|
|
8338
8236
|
const productSelectionsQuery = useQuery(ProductSelectionsPickerFetcher$1, {
|
|
8339
8237
|
context: {
|
|
@@ -8343,7 +8241,7 @@ const useProductSelectionsByFieldFetcher = (productSelections, predicateField) =
|
|
|
8343
8241
|
skip: productSelectionList.length === 0
|
|
8344
8242
|
});
|
|
8345
8243
|
return {
|
|
8346
|
-
productSelections:
|
|
8244
|
+
productSelections: productSelectionsQuery.data?.productSelections.results ?? [],
|
|
8347
8245
|
isLoading: productSelectionsQuery.loading
|
|
8348
8246
|
};
|
|
8349
8247
|
};
|
|
@@ -8384,8 +8282,8 @@ const createQueryVariables$3 = _ref3 => {
|
|
|
8384
8282
|
var _context;
|
|
8385
8283
|
let searchText = _ref3.searchText;
|
|
8386
8284
|
const sanitizedSearchText = sanitize(_trimInstanceProperty(searchText).call(searchText, searchText));
|
|
8387
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
8388
|
-
const keyQuery =
|
|
8285
|
+
const idQuery = isUUID(sanitizedSearchText) && `id = "${sanitizedSearchText}"`;
|
|
8286
|
+
const keyQuery = `key = "${sanitizedSearchText}"`;
|
|
8389
8287
|
const searchTextQuery = _filterInstanceProperty(_context = [idQuery, keyQuery]).call(_context, Boolean).join(' or ');
|
|
8390
8288
|
return {
|
|
8391
8289
|
where: searchTextQuery || undefined
|
|
@@ -8408,7 +8306,6 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8408
8306
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8409
8307
|
const productSelectionsByFieldFetcher = useProductSelectionsByFieldFetcher(props.value, props.renderSelectInputOptionValuesByField);
|
|
8410
8308
|
const handleLoadOptions = async searchText => {
|
|
8411
|
-
var _data$productSelectio, _data$productSelectio2;
|
|
8412
8309
|
const _await$client$query = await client.query({
|
|
8413
8310
|
query: ProductSelectionsPickerFetcher,
|
|
8414
8311
|
variables: createQueryVariables$3({
|
|
@@ -8420,7 +8317,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8420
8317
|
fetchPolicy: 'network-only'
|
|
8421
8318
|
}),
|
|
8422
8319
|
data = _await$client$query.data;
|
|
8423
|
-
const matchedProductSelections =
|
|
8320
|
+
const matchedProductSelections = data?.productSelections?.results ?? [];
|
|
8424
8321
|
const updatedProductSelections = _mapInstanceProperty(matchedProductSelections).call(matchedProductSelections, convertProductSelectionFromGraphQl);
|
|
8425
8322
|
const filteredProductSelections = _filterInstanceProperty(updatedProductSelections).call(updatedProductSelections, ps => {
|
|
8426
8323
|
var _context2;
|
|
@@ -8436,8 +8333,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8436
8333
|
};
|
|
8437
8334
|
const loadOptionsDebounced = debounce(handleLoadOptions, 500);
|
|
8438
8335
|
const onOptionClick = event => {
|
|
8439
|
-
|
|
8440
|
-
const productSelectionId = (_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.value;
|
|
8336
|
+
const productSelectionId = event.target.value?.value;
|
|
8441
8337
|
const currentProductSelection = _findInstanceProperty(productionSelectionResults).call(productionSelectionResults, productSelection => productSelection.id === productSelectionId);
|
|
8442
8338
|
props.onChange(currentProductSelection);
|
|
8443
8339
|
};
|
|
@@ -8489,11 +8385,11 @@ function ModeSelectInputOption(props) {
|
|
|
8489
8385
|
scale: "xs",
|
|
8490
8386
|
children: [jsx(Text.Detail, {
|
|
8491
8387
|
isBold: true,
|
|
8492
|
-
children:
|
|
8388
|
+
children: data?.label || noValueFallback
|
|
8493
8389
|
}), jsxs(Text.Detail, {
|
|
8494
|
-
children: ["Key: ",
|
|
8390
|
+
children: ["Key: ", data?.key || noValueFallback]
|
|
8495
8391
|
}), jsxs(Text.Detail, {
|
|
8496
|
-
children: ["Type: ",
|
|
8392
|
+
children: ["Type: ", data?.mode || noValueFallback]
|
|
8497
8393
|
})]
|
|
8498
8394
|
})
|
|
8499
8395
|
}));
|
|
@@ -8575,19 +8471,19 @@ const ScrollToFieldError = () => {
|
|
|
8575
8471
|
if (isValid) return;
|
|
8576
8472
|
const firstErrorElement = document.querySelector('[aria-invalid="true"]');
|
|
8577
8473
|
if (firstErrorElement) {
|
|
8578
|
-
var _ref, _ref2, _document$querySelect, _elementToScrollTo$sc;
|
|
8579
8474
|
// Get a reference to the label.
|
|
8580
8475
|
const firstElementId = firstErrorElement.getAttribute('id');
|
|
8581
|
-
const localizedInputIndex = _indexOfInstanceProperty(firstElementId).call(firstElementId,
|
|
8476
|
+
const localizedInputIndex = _indexOfInstanceProperty(firstElementId).call(firstElementId, `.${dataLocale}`);
|
|
8582
8477
|
|
|
8583
8478
|
// check if locale is appended then remove it from id
|
|
8584
|
-
const id = localizedInputIndex > -1 ? firstElementId.replace(
|
|
8479
|
+
const id = localizedInputIndex > -1 ? firstElementId.replace(`.${dataLocale}`, '') : firstElementId;
|
|
8585
8480
|
|
|
8586
8481
|
// Scroll to the label (if found), otherwise to the input element itself.
|
|
8587
8482
|
|
|
8588
|
-
const elementToScrollTo =
|
|
8589
|
-
|
|
8590
|
-
(
|
|
8483
|
+
const elementToScrollTo =
|
|
8484
|
+
// div is used only for custom fields
|
|
8485
|
+
document.querySelector(`div[aria-errormessage="${firstElementId}"]`) ?? document.querySelector(`label[for="${id}"]`) ?? document.querySelector(`label#${id}`) ?? firstErrorElement;
|
|
8486
|
+
elementToScrollTo.scrollIntoView?.({
|
|
8591
8487
|
behavior: 'smooth'
|
|
8592
8488
|
});
|
|
8593
8489
|
}
|
|
@@ -8613,8 +8509,7 @@ var styles$9 = {
|
|
|
8613
8509
|
"search-mode-menu": "selectable-field-search-input-module__search-mode-menu___Od6Le"
|
|
8614
8510
|
};
|
|
8615
8511
|
const SelectableFieldSearchInput = props => {
|
|
8616
|
-
|
|
8617
|
-
const _useState = useState((_props$initialValue = props.initialValue) !== null && _props$initialValue !== void 0 ? _props$initialValue : ''),
|
|
8512
|
+
const _useState = useState(props.initialValue ?? ''),
|
|
8618
8513
|
_useState2 = _slicedToArray(_useState, 2),
|
|
8619
8514
|
searchText = _useState2[0],
|
|
8620
8515
|
setSearchText = _useState2[1];
|
|
@@ -8650,7 +8545,7 @@ const SelectableFieldSearchInput = props => {
|
|
|
8650
8545
|
});
|
|
8651
8546
|
},
|
|
8652
8547
|
onReset: props.onReset,
|
|
8653
|
-
placeholder:
|
|
8548
|
+
placeholder: props.placeholder ?? intl.formatMessage(messages$r.placeholder),
|
|
8654
8549
|
isDisabled: props.disabled
|
|
8655
8550
|
})
|
|
8656
8551
|
});
|
|
@@ -8700,7 +8595,6 @@ const UPPER_STORES_LIMIT = 500;
|
|
|
8700
8595
|
|
|
8701
8596
|
// map store to options
|
|
8702
8597
|
const mapStoresToOptions = _ref => {
|
|
8703
|
-
var _store$productSelecti;
|
|
8704
8598
|
let store = _ref.store,
|
|
8705
8599
|
renderSelectInputOptionValuesByField = _ref.renderSelectInputOptionValuesByField,
|
|
8706
8600
|
dataLocale = _ref.dataLocale;
|
|
@@ -8711,14 +8605,14 @@ const mapStoresToOptions = _ref => {
|
|
|
8711
8605
|
const localizedName = formatLocalizedString(convertedStore, {
|
|
8712
8606
|
key: 'name',
|
|
8713
8607
|
locale: dataLocale,
|
|
8714
|
-
fallback:
|
|
8608
|
+
fallback: `${store.key} (key)`
|
|
8715
8609
|
});
|
|
8716
8610
|
return {
|
|
8717
8611
|
label: localizedName,
|
|
8718
8612
|
value: renderSelectInputOptionValuesByField === 'key' ? store.key : store.id,
|
|
8719
8613
|
key: store.key,
|
|
8720
8614
|
id: store.id,
|
|
8721
|
-
productSelections:
|
|
8615
|
+
productSelections: store.productSelections?.map(productSelectionRef => productSelectionRef.productSelection.id)
|
|
8722
8616
|
};
|
|
8723
8617
|
};
|
|
8724
8618
|
|
|
@@ -8747,7 +8641,7 @@ const getValueFromOptions$1 = _ref => {
|
|
|
8747
8641
|
isMulti = _ref.isMulti;
|
|
8748
8642
|
// handle async-select-field value transformation
|
|
8749
8643
|
if (isMulti) {
|
|
8750
|
-
return _filterInstanceProperty(mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores
|
|
8644
|
+
return _filterInstanceProperty(mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores?.includes(store.value));
|
|
8751
8645
|
}
|
|
8752
8646
|
|
|
8753
8647
|
// return value as undefined if no options is yet selected. It is needed for cases where users sets initial values as empty string
|
|
@@ -8766,7 +8660,7 @@ const emptyStoreOption = intl => [{
|
|
|
8766
8660
|
const StoresAsyncSelectInput = props => {
|
|
8767
8661
|
const intl = useIntl();
|
|
8768
8662
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
8769
|
-
dataLocale: applicationContext.dataLocale
|
|
8663
|
+
dataLocale: applicationContext.dataLocale || applicationContext.user?.locale
|
|
8770
8664
|
})),
|
|
8771
8665
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8772
8666
|
const keysOfStores = props.allAccessibleStoreKeysThroughDataFencePermissions;
|
|
@@ -8776,13 +8670,13 @@ const StoresAsyncSelectInput = props => {
|
|
|
8776
8670
|
sort: 'createdAt asc',
|
|
8777
8671
|
excludeExtendedStoresList: true,
|
|
8778
8672
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8779
|
-
stores:
|
|
8673
|
+
stores: keysOfStores?.length && keysOfStores,
|
|
8780
8674
|
projectKey: props.projectKey
|
|
8781
8675
|
});
|
|
8782
8676
|
const hasError = AsyncSelectInput.isTouched(props.touched) && hasErrors$2(props.errors) || props.hasError;
|
|
8783
8677
|
const mappedStoresListOptions = useMemo(() => {
|
|
8784
|
-
var _context2
|
|
8785
|
-
return _mapInstanceProperty(_context2 =
|
|
8678
|
+
var _context2;
|
|
8679
|
+
return _mapInstanceProperty(_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8786
8680
|
store,
|
|
8787
8681
|
dataLocale,
|
|
8788
8682
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -8868,7 +8762,7 @@ const hasErrors$1 = errors => {
|
|
|
8868
8762
|
const StoresBasicSelectInput = props => {
|
|
8869
8763
|
const intl = useIntl();
|
|
8870
8764
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
8871
|
-
dataLocale: applicationContext.dataLocale
|
|
8765
|
+
dataLocale: applicationContext.dataLocale || applicationContext.user?.locale
|
|
8872
8766
|
})),
|
|
8873
8767
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8874
8768
|
const keysOfStores = props.allAccessibleStoreKeysThroughDataFencePermissions;
|
|
@@ -8878,30 +8772,30 @@ const StoresBasicSelectInput = props => {
|
|
|
8878
8772
|
sort: 'createdAt asc',
|
|
8879
8773
|
excludeExtendedStoresList: true,
|
|
8880
8774
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8881
|
-
stores:
|
|
8775
|
+
stores: keysOfStores?.length && keysOfStores,
|
|
8882
8776
|
projectKey: props.projectKey
|
|
8883
8777
|
});
|
|
8884
8778
|
const hasError = SelectInput.isTouched(props.touched) && hasErrors$1(props.errors) || props.hasError;
|
|
8885
8779
|
const mappedStoresListOptions = useMemo(() => {
|
|
8886
|
-
var _context2
|
|
8887
|
-
const results = _mapInstanceProperty(_context2 =
|
|
8780
|
+
var _context2;
|
|
8781
|
+
const results = _mapInstanceProperty(_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8888
8782
|
store,
|
|
8889
8783
|
dataLocale,
|
|
8890
8784
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
8891
8785
|
}));
|
|
8892
|
-
return props
|
|
8786
|
+
return props?.renderLabel ? [{
|
|
8893
8787
|
options: getCustomGroupLabelOption(props.renderLabel)
|
|
8894
8788
|
}, {
|
|
8895
8789
|
options: results
|
|
8896
8790
|
}] : results;
|
|
8897
|
-
}, [dataLocale, storesListFetcher.stores, props.renderSelectInputOptionValuesByField, props
|
|
8791
|
+
}, [dataLocale, storesListFetcher.stores, props.renderSelectInputOptionValuesByField, props?.renderLabel]);
|
|
8898
8792
|
const handleChange = event => {
|
|
8899
|
-
|
|
8900
|
-
const
|
|
8901
|
-
const currentStore = _findInstanceProperty(
|
|
8793
|
+
const value = event.target.value?.value ?? event.target.value;
|
|
8794
|
+
const listOptions = props?.renderLabel ? mappedStoresListOptions[1].options : mappedStoresListOptions;
|
|
8795
|
+
const currentStore = _findInstanceProperty(listOptions).call(listOptions, store => store.value === value);
|
|
8902
8796
|
|
|
8903
8797
|
// We need complete store info including productSelections
|
|
8904
|
-
if (!props.shouldFetchProductSelections) {
|
|
8798
|
+
if (!props.shouldFetchProductSelections && !props?.renderLabel) {
|
|
8905
8799
|
props.onChange(event);
|
|
8906
8800
|
} else {
|
|
8907
8801
|
props.onChange({
|
|
@@ -8955,7 +8849,6 @@ StoresBasicSelectInput.defaultProps = {
|
|
|
8955
8849
|
|
|
8956
8850
|
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 } } } };
|
|
8957
8851
|
const useTotalNumberOfStoresFetcher = projectKey => {
|
|
8958
|
-
var _totalNumberOfStoresQ;
|
|
8959
8852
|
const totalNumberOfStoresQuery = useQuery(TotalNumberOfStores, {
|
|
8960
8853
|
context: {
|
|
8961
8854
|
target: GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM,
|
|
@@ -8964,7 +8857,7 @@ const useTotalNumberOfStoresFetcher = projectKey => {
|
|
|
8964
8857
|
fetchPolicy: 'network-only'
|
|
8965
8858
|
});
|
|
8966
8859
|
return {
|
|
8967
|
-
total:
|
|
8860
|
+
total: totalNumberOfStoresQuery.data?.totalNumberOfStores.total,
|
|
8968
8861
|
isLoading: totalNumberOfStoresQuery.loading
|
|
8969
8862
|
};
|
|
8970
8863
|
};
|
|
@@ -8982,19 +8875,15 @@ const handlers$2 = {
|
|
|
8982
8875
|
};
|
|
8983
8876
|
|
|
8984
8877
|
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 } } } };
|
|
8985
|
-
const createQueryVariables$2 = (stores, predicateField, shouldFetchProductSelections) => {
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
excludeProductSelections: !shouldFetchProductSelections
|
|
8991
|
-
};
|
|
8992
|
-
};
|
|
8878
|
+
const createQueryVariables$2 = (stores, predicateField, shouldFetchProductSelections) => ({
|
|
8879
|
+
where: `${predicateField} in (${_mapInstanceProperty(stores).call(stores, store => `"${store}"`).join(', ')})`,
|
|
8880
|
+
limit: 500,
|
|
8881
|
+
excludeProductSelections: !shouldFetchProductSelections
|
|
8882
|
+
});
|
|
8993
8883
|
const emptyStoresQueryResult = {
|
|
8994
8884
|
results: []
|
|
8995
8885
|
};
|
|
8996
8886
|
const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
8997
|
-
var _storesQuery$data;
|
|
8998
8887
|
let shouldFetchProductSelections = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
8999
8888
|
// incase of single select input stores are sent as single string literal
|
|
9000
8889
|
const storesList = _Array$isArray(stores) ? stores : [stores];
|
|
@@ -9007,13 +8896,13 @@ const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
|
9007
8896
|
skip: storesList.length === 0
|
|
9008
8897
|
});
|
|
9009
8898
|
return {
|
|
9010
|
-
stores:
|
|
8899
|
+
stores: storesQuery.data?.storesByField || emptyStoresQueryResult,
|
|
9011
8900
|
isLoading: storesQuery.loading
|
|
9012
8901
|
};
|
|
9013
8902
|
};
|
|
9014
8903
|
|
|
9015
8904
|
function ownKeys$C(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; }
|
|
9016
|
-
function _objectSpread$C(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
8905
|
+
function _objectSpread$C(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context3 = ownKeys$C(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context4 = ownKeys$C(Object(t))).call(_context4, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9017
8906
|
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 } } } };
|
|
9018
8907
|
var styles$8 = {
|
|
9019
8908
|
"renderLabelContainer": "stores-search-selector-module__renderLabelContainer___3_PBc",
|
|
@@ -9024,16 +8913,16 @@ const hasErrors = errors => {
|
|
|
9024
8913
|
return errors && _someInstanceProperty(_context = _Object$values(errors)).call(_context, Boolean);
|
|
9025
8914
|
};
|
|
9026
8915
|
const createQueryVariables$1 = _ref => {
|
|
9027
|
-
var _context2
|
|
8916
|
+
var _context2;
|
|
9028
8917
|
let searchText = _ref.searchText,
|
|
9029
8918
|
dataLocale = _ref.dataLocale,
|
|
9030
8919
|
allAccessibleStoreKeysThroughDataFencePermissions = _ref.allAccessibleStoreKeysThroughDataFencePermissions,
|
|
9031
8920
|
shouldFetchProductSelections = _ref.shouldFetchProductSelections;
|
|
9032
8921
|
const sanitizedSearchText = sanitize(_trimInstanceProperty(searchText).call(searchText, searchText));
|
|
9033
|
-
const keyQuery =
|
|
8922
|
+
const keyQuery = `key = "${sanitizedSearchText}"`;
|
|
9034
8923
|
|
|
9035
8924
|
// if the user has data fence permissions then we only allow stores to fetched that user has access to
|
|
9036
|
-
if (allAccessibleStoreKeysThroughDataFencePermissions
|
|
8925
|
+
if (allAccessibleStoreKeysThroughDataFencePermissions?.length) {
|
|
9037
8926
|
// if the current search term match the accessible stores keys, then proceed with fetching the store
|
|
9038
8927
|
if (_includesInstanceProperty(allAccessibleStoreKeysThroughDataFencePermissions).call(allAccessibleStoreKeysThroughDataFencePermissions, sanitizedSearchText)) {
|
|
9039
8928
|
return {
|
|
@@ -9049,9 +8938,9 @@ const createQueryVariables$1 = _ref => {
|
|
|
9049
8938
|
excludeProductSelections: !shouldFetchProductSelections
|
|
9050
8939
|
};
|
|
9051
8940
|
}
|
|
9052
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
9053
|
-
const nameQuery =
|
|
9054
|
-
const searchTextQuery = _filterInstanceProperty(
|
|
8941
|
+
const idQuery = isUUID(sanitizedSearchText) && `id = "${sanitizedSearchText}"`;
|
|
8942
|
+
const nameQuery = `name(${dataLocale} = "${sanitizedSearchText}")`;
|
|
8943
|
+
const searchTextQuery = _filterInstanceProperty(_context2 = [idQuery, nameQuery, keyQuery]).call(_context2, Boolean).join(' or ');
|
|
9055
8944
|
return {
|
|
9056
8945
|
skipFetchingStores: false,
|
|
9057
8946
|
where: searchTextQuery,
|
|
@@ -9059,7 +8948,6 @@ const createQueryVariables$1 = _ref => {
|
|
|
9059
8948
|
};
|
|
9060
8949
|
};
|
|
9061
8950
|
const getValueFromOptions = _ref2 => {
|
|
9062
|
-
var _storesByFieldFetcher, _context4;
|
|
9063
8951
|
let isMulti = _ref2.isMulti,
|
|
9064
8952
|
value = _ref2.value,
|
|
9065
8953
|
dataLocale = _ref2.dataLocale,
|
|
@@ -9068,7 +8956,7 @@ const getValueFromOptions = _ref2 => {
|
|
|
9068
8956
|
if (!value) {
|
|
9069
8957
|
return undefined;
|
|
9070
8958
|
}
|
|
9071
|
-
const selectedOptions =
|
|
8959
|
+
const selectedOptions = storesByFieldFetcher.stores?.results.map(store => mapStoresToOptions({
|
|
9072
8960
|
store,
|
|
9073
8961
|
dataLocale,
|
|
9074
8962
|
renderSelectInputOptionValuesByField: renderSelectInputOptionValuesByField
|
|
@@ -9084,7 +8972,7 @@ const getValueFromOptions = _ref2 => {
|
|
|
9084
8972
|
const StoresSearchSelectInput = props => {
|
|
9085
8973
|
// hooks
|
|
9086
8974
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
9087
|
-
dataLocale: applicationContext.dataLocale
|
|
8975
|
+
dataLocale: applicationContext.dataLocale || applicationContext.user?.locale
|
|
9088
8976
|
})),
|
|
9089
8977
|
dataLocale = _useApplicationContex.dataLocale;
|
|
9090
8978
|
const intl = useIntl();
|
|
@@ -9106,9 +8994,8 @@ const StoresSearchSelectInput = props => {
|
|
|
9106
8994
|
},
|
|
9107
8995
|
fetchPolicy: 'network-only'
|
|
9108
8996
|
}).then(_ref3 => {
|
|
9109
|
-
var _data$storesByWherePr, _context5;
|
|
9110
8997
|
let data = _ref3.data;
|
|
9111
|
-
const result =
|
|
8998
|
+
const result = data.storesByWherePredicate?.results.map(store => mapStoresToOptions({
|
|
9112
8999
|
store,
|
|
9113
9000
|
dataLocale,
|
|
9114
9001
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -9129,7 +9016,7 @@ const StoresSearchSelectInput = props => {
|
|
|
9129
9016
|
className: styles$8.renderLabelContainer,
|
|
9130
9017
|
children: [jsx("div", {
|
|
9131
9018
|
className: styles$8.customLabel,
|
|
9132
|
-
children:
|
|
9019
|
+
children: props?.renderLabel && props?.renderLabel
|
|
9133
9020
|
}), jsx("div", {
|
|
9134
9021
|
children: intl.formatMessage(inputValue ? messages$q.searchSelectInputNoOptionsFoundMessage : messages$q.searchSelectInputNoValueMessage)
|
|
9135
9022
|
})]
|
|
@@ -9302,7 +9189,6 @@ StoreSelectField.defaultProps = {
|
|
|
9302
9189
|
mappedValueField: 'id'
|
|
9303
9190
|
};
|
|
9304
9191
|
|
|
9305
|
-
var _templateObject$1;
|
|
9306
9192
|
function ownKeys$z(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; }
|
|
9307
9193
|
function _objectSpread$z(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context5 = ownKeys$z(Object(t), !0)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context6 = ownKeys$z(Object(t))).call(_context6, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9308
9194
|
function _callSuper$5(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$5() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
@@ -9381,7 +9267,10 @@ const VALIDATOR_INTEGER = {
|
|
|
9381
9267
|
* has emitted a warning once in the logs, not for every instance
|
|
9382
9268
|
*/
|
|
9383
9269
|
let hasWarned = false;
|
|
9384
|
-
const warningMessage = oneLineTrim
|
|
9270
|
+
const warningMessage = oneLineTrim`
|
|
9271
|
+
\`validatedInput\` is no longer supported.
|
|
9272
|
+
Please use \`formik\` instead.
|
|
9273
|
+
`;
|
|
9385
9274
|
const ToolTipWrapperComponent = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
9386
9275
|
let children = _ref.children;
|
|
9387
9276
|
return jsx(Constraints.Horizontal, {
|
|
@@ -9528,7 +9417,7 @@ function validatedInput(InnerComponent, validators) {
|
|
|
9528
9417
|
}
|
|
9529
9418
|
}]);
|
|
9530
9419
|
}(PureComponent);
|
|
9531
|
-
ValidatedInput.displayName =
|
|
9420
|
+
ValidatedInput.displayName = `ValidatedInput(${_InnerComponent.displayName})`;
|
|
9532
9421
|
ValidatedInput.defaultProps = {
|
|
9533
9422
|
isValid: true,
|
|
9534
9423
|
getInputRef: () => {}
|
|
@@ -9593,7 +9482,7 @@ let CustomFieldDefinitionsConnector = /*#__PURE__*/function (_Component) {
|
|
|
9593
9482
|
value: function componentDidMount() {
|
|
9594
9483
|
var _context;
|
|
9595
9484
|
const hasUnsupportedResource = _someInstanceProperty(_context = this.props.resources).call(_context, resource => !_includesInstanceProperty(customizableResources$1).call(customizableResources$1, resource));
|
|
9596
|
-
!!hasUnsupportedResource ? process.env.NODE_ENV !== "production" ? invariant(false,
|
|
9485
|
+
!!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;
|
|
9597
9486
|
}
|
|
9598
9487
|
}, {
|
|
9599
9488
|
key: "render",
|
|
@@ -9611,9 +9500,9 @@ CustomFieldDefinitionsConnector.displayName = 'CustomFieldDefinitionsConnector';
|
|
|
9611
9500
|
CustomFieldDefinitionsConnector.defaultProps = {
|
|
9612
9501
|
resources: []
|
|
9613
9502
|
};
|
|
9614
|
-
const stringifyResources$1 = resources => _mapInstanceProperty(resources).call(resources, resource => "
|
|
9503
|
+
const stringifyResources$1 = resources => _mapInstanceProperty(resources).call(resources, resource => `"${resource}"`).join();
|
|
9615
9504
|
const mapPropsToOptions = ownProps => {
|
|
9616
|
-
const where = ownProps.resources.length > 0 ?
|
|
9505
|
+
const where = ownProps.resources.length > 0 ? `resourceTypeIds contains any (${stringifyResources$1(ownProps.resources)})` : undefined;
|
|
9617
9506
|
return {
|
|
9618
9507
|
variables: {
|
|
9619
9508
|
where,
|
|
@@ -9682,19 +9571,19 @@ const graphQlDocToForm = typeDefinition => {
|
|
|
9682
9571
|
key: typeDefinition.key,
|
|
9683
9572
|
name: transformLocalizedFieldToLocalizedString(typeDefinition.nameAllLocales),
|
|
9684
9573
|
fieldDefinitions: _mapInstanceProperty(_context = typeDefinition.fieldDefinitions).call(_context, fieldDefinition => {
|
|
9685
|
-
var
|
|
9574
|
+
var _context2, _context3;
|
|
9686
9575
|
return {
|
|
9687
9576
|
name: fieldDefinition.name,
|
|
9688
9577
|
required: fieldDefinition.required,
|
|
9689
9578
|
inputHint: fieldDefinition.inputHint,
|
|
9690
|
-
type:
|
|
9579
|
+
type: fieldDefinition.type?.elementType?.name === 'LocalizedEnum' ? _objectSpread$x(_objectSpread$x({}, fieldDefinition.type), {}, {
|
|
9691
9580
|
elementType: _objectSpread$x(_objectSpread$x({}, fieldDefinition.type.elementType), {}, {
|
|
9692
9581
|
values: _mapInstanceProperty(_context2 = _valuesInstanceProperty(fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
9693
9582
|
key: value.key,
|
|
9694
9583
|
label: transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
9695
9584
|
}))
|
|
9696
9585
|
})
|
|
9697
|
-
}) :
|
|
9586
|
+
}) : fieldDefinition.type?.name === 'LocalizedEnum' ? _objectSpread$x(_objectSpread$x({}, fieldDefinition.type), {}, {
|
|
9698
9587
|
values: _mapInstanceProperty(_context3 = _valuesInstanceProperty(fieldDefinition.type)).call(_context3, value => ({
|
|
9699
9588
|
key: value.key,
|
|
9700
9589
|
label: transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -9726,7 +9615,7 @@ const formToGraphQlDoc = formCustomFields => ({
|
|
|
9726
9615
|
// TODO(pa3): find usages and make sure only 1 param is passed
|
|
9727
9616
|
const createEmptyCustomFields = typeDefinition => ({
|
|
9728
9617
|
fields: {},
|
|
9729
|
-
type:
|
|
9618
|
+
type: typeDefinition?.type || {
|
|
9730
9619
|
fieldDefinitions: []
|
|
9731
9620
|
}
|
|
9732
9621
|
});
|
|
@@ -9734,7 +9623,7 @@ const createEmptyCustomFields = typeDefinition => ({
|
|
|
9734
9623
|
function _callSuper$3(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$3() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
9735
9624
|
function _isNativeReflectConstruct$3() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$3 = function () { return !!t; })(); }
|
|
9736
9625
|
var FetchTypeDefinitionsWithNamesQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchTypeDefinitionsWithNamesQuery" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "where" } }, type: { kind: "NamedType", name: { kind: "Name", value: "String" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "limit" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "offset" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "typeDefinitions" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "where" }, value: { kind: "Variable", name: { kind: "Name", value: "where" } } }, { kind: "Argument", name: { kind: "Name", value: "limit" }, value: { kind: "Variable", name: { kind: "Name", value: "limit" } } }, { kind: "Argument", name: { kind: "Name", value: "offset" }, value: { kind: "Variable", name: { kind: "Name", value: "offset" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "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: "value" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "fieldDefinitions" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "required" }, 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: "ReferenceType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "referenceTypeId" }, arguments: [], directives: [] }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "SetType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "elementType" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ReferenceType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "referenceTypeId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "EnumType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "values" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "label" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "LocalizedEnumType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "values" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "LocalizedEnumType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "values" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "EnumType" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "values" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "label" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "inputHint" }, arguments: [], directives: [] }] } }] } }] } }] } }], loc: { start: 0, end: 1445, source: { body: "query FetchTypeDefinitionsWithNamesQuery(\n $where: String\n $limit: Int\n $offset: Int\n) {\n typeDefinitions(where: $where, limit: $limit, offset: $offset) {\n results {\n id\n key\n nameAllLocales {\n value\n locale\n }\n fieldDefinitions {\n required\n type {\n name\n ... on ReferenceType {\n referenceTypeId\n }\n ... on SetType {\n elementType {\n name\n ... on ReferenceType {\n referenceTypeId\n name\n }\n ... on EnumType {\n values {\n key\n label\n }\n name\n }\n ... on LocalizedEnumType {\n values {\n key\n labelAllLocales {\n locale\n value\n }\n }\n }\n }\n }\n ... on LocalizedEnumType {\n values {\n key\n labelAllLocales {\n locale\n value\n }\n }\n }\n ... on EnumType {\n values {\n key\n label\n }\n name\n }\n }\n name\n labelAllLocales {\n value\n locale\n }\n inputHint\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
9737
|
-
const customizableResources = ['asset', 'address', 'business-unit', 'category', 'channel', 'customer', 'customer-group', 'order', 'quote', 'order-delivery', 'store', 'discount-code', 'inventory-entry', 'line-item', 'custom-line-item', 'product-price', 'payment', 'payment-interface-interaction', 'shipping-method', 'shopping-list', 'shopping-list-text-line-item', 'standalone-price', 'review', 'cart-discount', 'product-selection', 'order-return-item', 'order-parcel'];
|
|
9626
|
+
const customizableResources = ['asset', 'address', 'associate-role', 'business-unit', 'category', 'channel', 'customer', 'customer-group', 'order', 'quote', 'order-delivery', 'store', 'discount-code', 'inventory-entry', 'line-item', 'custom-line-item', 'product-price', 'payment', 'payment-interface-interaction', 'shipping-method', 'shopping-list', 'shopping-list-text-line-item', 'standalone-price', 'review', 'cart-discount', 'product-selection', 'order-return-item', 'order-parcel'];
|
|
9738
9627
|
const emptyTypeDefinitions = {
|
|
9739
9628
|
total: 0,
|
|
9740
9629
|
count: 0,
|
|
@@ -9751,7 +9640,7 @@ let CustomFieldTypeDefinitionsConnector = /*#__PURE__*/function (_Component) {
|
|
|
9751
9640
|
value: function componentDidMount() {
|
|
9752
9641
|
var _context;
|
|
9753
9642
|
const hasUnsupportedResource = _someInstanceProperty(_context = this.props.resources).call(_context, resource => !_includesInstanceProperty(customizableResources).call(customizableResources, resource));
|
|
9754
|
-
!!hasUnsupportedResource ? process.env.NODE_ENV !== "production" ? invariant(false,
|
|
9643
|
+
!!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;
|
|
9755
9644
|
}
|
|
9756
9645
|
}, {
|
|
9757
9646
|
key: "render",
|
|
@@ -9775,9 +9664,9 @@ CustomFieldTypeDefinitionsConnector.graphQlDocToForm = graphQlDocToForm;
|
|
|
9775
9664
|
CustomFieldTypeDefinitionsConnector.formToRestDoc = formToRestDoc;
|
|
9776
9665
|
CustomFieldTypeDefinitionsConnector.formToGraphQlDoc = formToGraphQlDoc;
|
|
9777
9666
|
CustomFieldTypeDefinitionsConnector.createEmptyCustomFields = createEmptyCustomFields;
|
|
9778
|
-
const stringifyResources = resources => _mapInstanceProperty(resources).call(resources, resource => "
|
|
9667
|
+
const stringifyResources = resources => _mapInstanceProperty(resources).call(resources, resource => `"${resource}"`).join();
|
|
9779
9668
|
const createGraphQlOptions = ownProps => {
|
|
9780
|
-
const where = ownProps.resources.length > 0 ?
|
|
9669
|
+
const where = ownProps.resources.length > 0 ? `resourceTypeIds contains any (${stringifyResources(ownProps.resources)})` : undefined;
|
|
9781
9670
|
return {
|
|
9782
9671
|
variables: {
|
|
9783
9672
|
where,
|
|
@@ -9827,7 +9716,7 @@ const extractDuplicatedValues = (values, type, language, languages) => {
|
|
|
9827
9716
|
let validatedValues = [];
|
|
9828
9717
|
if (type.name.toLowerCase() === 'money') {
|
|
9829
9718
|
validatedValues = unique(values, ['amount', 'currencyCode']);
|
|
9830
|
-
} else if (type.name.toLowerCase() === 'reference') validatedValues = unique(_filterInstanceProperty(values).call(values, value => value
|
|
9719
|
+
} else if (type.name.toLowerCase() === 'reference') validatedValues = unique(_filterInstanceProperty(values).call(values, value => value?.id), ['id']);else if (type.name.toLowerCase() === 'localizedstring') {
|
|
9831
9720
|
validatedValues = unique(values, languages);
|
|
9832
9721
|
} else validatedValues = unique(values);
|
|
9833
9722
|
return validatedValues;
|
|
@@ -9960,10 +9849,9 @@ var messages$o = defineMessages({
|
|
|
9960
9849
|
const FIELD_NAME = 'custom';
|
|
9961
9850
|
|
|
9962
9851
|
function ownKeys$u(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; }
|
|
9963
|
-
function _objectSpread$u(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
9852
|
+
function _objectSpread$u(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context6 = ownKeys$u(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context7 = ownKeys$u(Object(t))).call(_context7, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9964
9853
|
const transformFieldType = fieldDefinition => {
|
|
9965
|
-
|
|
9966
|
-
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') {
|
|
9854
|
+
if (fieldDefinition.type?.elementType?.name === 'LocalizedEnum') {
|
|
9967
9855
|
var _context;
|
|
9968
9856
|
return _objectSpread$u(_objectSpread$u({}, fieldDefinition.type), {}, {
|
|
9969
9857
|
elementType: _objectSpread$u(_objectSpread$u({}, fieldDefinition.type.elementType), {}, {
|
|
@@ -9973,7 +9861,7 @@ const transformFieldType = fieldDefinition => {
|
|
|
9973
9861
|
}))
|
|
9974
9862
|
})
|
|
9975
9863
|
});
|
|
9976
|
-
} else if (
|
|
9864
|
+
} else if (fieldDefinition.type?.name === 'LocalizedEnum') {
|
|
9977
9865
|
var _context2;
|
|
9978
9866
|
return _objectSpread$u(_objectSpread$u({}, fieldDefinition.type), {}, {
|
|
9979
9867
|
values: _mapInstanceProperty(_context2 = _valuesInstanceProperty(fieldDefinition.type)).call(_context2, value => ({
|
|
@@ -10020,9 +9908,9 @@ const createFormStateFromResource = resource => {
|
|
|
10020
9908
|
};
|
|
10021
9909
|
};
|
|
10022
9910
|
const createGraphQlDocFromFormState = formState => {
|
|
10023
|
-
var
|
|
9911
|
+
var _context5;
|
|
10024
9912
|
// Unset the custom type if it's not in the form state
|
|
10025
|
-
if (!
|
|
9913
|
+
if (!formState[FIELD_NAME]?.type?.id) {
|
|
10026
9914
|
return {
|
|
10027
9915
|
[FIELD_NAME]: {}
|
|
10028
9916
|
};
|
|
@@ -10048,8 +9936,7 @@ const createGraphQlDocFromFormState = formState => {
|
|
|
10048
9936
|
|
|
10049
9937
|
// Creates a root field name accessor for `custom` form state
|
|
10050
9938
|
const createRootFieldName = rootFieldName => {
|
|
10051
|
-
|
|
10052
|
-
return rootFieldName ? _concatInstanceProperty(_context6 = "".concat(rootFieldName, ".")).call(_context6, FIELD_NAME) : FIELD_NAME;
|
|
9939
|
+
return rootFieldName ? `${rootFieldName}.${FIELD_NAME}` : FIELD_NAME;
|
|
10053
9940
|
};
|
|
10054
9941
|
|
|
10055
9942
|
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; }
|
|
@@ -10058,8 +9945,7 @@ const typeDefinitionsExist = typeDefinitions => {
|
|
|
10058
9945
|
return typeDefinitions.length > 0;
|
|
10059
9946
|
};
|
|
10060
9947
|
const typeDefinitionSelected = (formValues, rootFieldName) => {
|
|
10061
|
-
|
|
10062
|
-
return ((_getIn = getIn(formValues, rootFieldName)) === null || _getIn === void 0 ? void 0 : _getIn.type) && ((_getIn2 = getIn(formValues, rootFieldName)) === null || _getIn2 === void 0 || (_getIn2 = _getIn2.type) === null || _getIn2 === void 0 ? void 0 : _getIn2.obj);
|
|
9948
|
+
return getIn(formValues, rootFieldName)?.type && getIn(formValues, rootFieldName)?.type?.obj;
|
|
10063
9949
|
};
|
|
10064
9950
|
const typeDefinitionContainsFieldDefinitions = (formValues, rootFieldName) => {
|
|
10065
9951
|
return getIn(formValues, rootFieldName).type.obj.key && getIn(formValues, rootFieldName).type.obj.fieldDefinitions.length > 0;
|
|
@@ -10096,7 +9982,7 @@ const CustomFieldsInputWrapper = _ref2 => {
|
|
|
10096
9982
|
max: "scale",
|
|
10097
9983
|
children: jsx(CustomFields, {
|
|
10098
9984
|
isReadOnly: isReadOnly,
|
|
10099
|
-
name:
|
|
9985
|
+
name: `${rootFieldName}.fields`,
|
|
10100
9986
|
fieldDefinitions: isReadOnly && hideEmptyFields ? fieldDefinitionsWithValues(formValues, rootFieldName) : getIn(formValues, rootFieldName).type.obj.fieldDefinitions
|
|
10101
9987
|
})
|
|
10102
9988
|
});
|
|
@@ -10131,7 +10017,6 @@ const createFormStateFromTypeDefinition = selectedTypeDefinition => {
|
|
|
10131
10017
|
};
|
|
10132
10018
|
};
|
|
10133
10019
|
const CustomTypeSubform = _ref => {
|
|
10134
|
-
var _getIn3, _getIn4;
|
|
10135
10020
|
let typeDefinitions = _ref.typeDefinitions,
|
|
10136
10021
|
isReadOnly = _ref.isReadOnly,
|
|
10137
10022
|
isCondensed = _ref.isCondensed,
|
|
@@ -10166,8 +10051,7 @@ const CustomTypeSubform = _ref => {
|
|
|
10166
10051
|
}
|
|
10167
10052
|
}, [typeDefinitions, setFieldValue, validateForm, rootFieldName]);
|
|
10168
10053
|
const typeDefinitionSelected = formValues => {
|
|
10169
|
-
|
|
10170
|
-
return ((_getIn = getIn(formValues, rootFieldName)) === null || _getIn === void 0 ? void 0 : _getIn.type) && ((_getIn2 = getIn(formValues, rootFieldName)) === null || _getIn2 === void 0 || (_getIn2 = _getIn2.type) === null || _getIn2 === void 0 ? void 0 : _getIn2.obj);
|
|
10054
|
+
return getIn(formValues, rootFieldName)?.type && getIn(formValues, rootFieldName)?.type?.obj;
|
|
10171
10055
|
};
|
|
10172
10056
|
|
|
10173
10057
|
// if the user has read-only permissions, empty fields are hidden, and no type definition is selected, hide the component
|
|
@@ -10182,9 +10066,9 @@ const CustomTypeSubform = _ref => {
|
|
|
10182
10066
|
children: jsx(SelectInput, {
|
|
10183
10067
|
isClearable: true,
|
|
10184
10068
|
"data-testid": "custom-type-select",
|
|
10185
|
-
name:
|
|
10186
|
-
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages,
|
|
10187
|
-
value:
|
|
10069
|
+
name: `${rootFieldName}.type.obj.key`,
|
|
10070
|
+
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages, getIn(formValues, rootFieldName)?.type?.id),
|
|
10071
|
+
value: getIn(formValues, rootFieldName)?.type?.obj?.key,
|
|
10188
10072
|
onChange: handleTypeDefinitionSelect,
|
|
10189
10073
|
placeholder: formatMessage(messages$o.typesPlaceholder),
|
|
10190
10074
|
isReadOnly: isReadOnly
|
|
@@ -10265,7 +10149,7 @@ var fetchPimIndexStatus = ((apolloClient, projectKey) => async dispatch => {
|
|
|
10265
10149
|
try {
|
|
10266
10150
|
await dispatch(actions.head({
|
|
10267
10151
|
mcApiProxyTarget: MC_API_PROXY_TARGETS.PIM_SEARCH,
|
|
10268
|
-
uri:
|
|
10152
|
+
uri: `/${projectKey}/search/products`
|
|
10269
10153
|
}));
|
|
10270
10154
|
return {
|
|
10271
10155
|
status: 'indexed'
|
|
@@ -10331,8 +10215,8 @@ const getIndexingJobIds = _ref => {
|
|
|
10331
10215
|
products = _ref$data.products,
|
|
10332
10216
|
productTypes = _ref$data.productTypes;
|
|
10333
10217
|
return {
|
|
10334
|
-
productsJobId:
|
|
10335
|
-
productTypesJobId:
|
|
10218
|
+
productsJobId: products?.indexingJobId || products?.existingIndexingJobId,
|
|
10219
|
+
productTypesJobId: productTypes?.indexingJobId || productTypes?.existingIndexingJobId
|
|
10336
10220
|
};
|
|
10337
10221
|
};
|
|
10338
10222
|
let PimIndexerProvider = /*#__PURE__*/function (_PureComponent) {
|
|
@@ -10583,6 +10467,7 @@ function usePimIndexer() {
|
|
|
10583
10467
|
|
|
10584
10468
|
// eslint-disable-next-line import/prefer-default-export
|
|
10585
10469
|
const RESOURCES_WITH_PLATFORM_LIMITS = {
|
|
10470
|
+
businessUnits: 'businessUnits',
|
|
10586
10471
|
shoppingLists: 'shoppingLists',
|
|
10587
10472
|
productDiscounts: 'productDiscounts',
|
|
10588
10473
|
cartDiscounts: 'cartDiscounts',
|
|
@@ -10599,10 +10484,10 @@ function ownKeys$p(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySy
|
|
|
10599
10484
|
function _objectSpread$p(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$p(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$p(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10600
10485
|
const resourcesWithPlatformLimits = _Object$keys(RESOURCES_WITH_PLATFORM_LIMITS);
|
|
10601
10486
|
const createQueryVariables = platformLimit => _reduceInstanceProperty(resourcesWithPlatformLimits).call(resourcesWithPlatformLimits, (previousIncludedLimits, nextNameOfLimit) => _objectSpread$p({
|
|
10602
|
-
[camelCase(
|
|
10487
|
+
[camelCase(`should include ${nextNameOfLimit}`)]: platformLimit ? nextNameOfLimit === platformLimit : true
|
|
10603
10488
|
}, previousIncludedLimits), {});
|
|
10604
10489
|
|
|
10605
|
-
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 } } } };
|
|
10490
|
+
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: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeBusinessUnits" } }, 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: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "businessUnits" }, arguments: [], directives: [{ kind: "Directive", name: { kind: "Name", value: "include" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "shouldIncludeBusinessUnits" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "maxDivisions" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "limit" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "maxDepthLimit" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "limit" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "maxAssociates" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "limit" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "maxAssociateRoles" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "limit" }, arguments: [], directives: [] }] } }] } }] } }] } }], loc: { start: 0, end: 2107, 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 $shouldIncludeBusinessUnits: 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 businessUnits @include(if: $shouldIncludeBusinessUnits) {\n maxDivisions {\n limit\n }\n maxDepthLimit {\n limit\n }\n maxAssociates {\n limit\n }\n maxAssociateRoles {\n limit\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
10606
10491
|
const usePlatformLimitsFetcher = platformLimit => {
|
|
10607
10492
|
const _useQuery = useQuery(PlatformLimitsFetcherQuery, {
|
|
10608
10493
|
variables: createQueryVariables(platformLimit),
|
|
@@ -10615,7 +10500,7 @@ const usePlatformLimitsFetcher = platformLimit => {
|
|
|
10615
10500
|
error = _useQuery.error,
|
|
10616
10501
|
data = _useQuery.data,
|
|
10617
10502
|
refetch = _useQuery.refetch;
|
|
10618
|
-
const platformLimits = !loading ? omit(data
|
|
10503
|
+
const platformLimits = !loading ? omit(data?.limits, '__typename') : {};
|
|
10619
10504
|
return {
|
|
10620
10505
|
isLoading: loading,
|
|
10621
10506
|
error,
|
|
@@ -10806,11 +10691,10 @@ const getPlatformLimitsStatus = _ref3 => {
|
|
|
10806
10691
|
total = _ref3.total,
|
|
10807
10692
|
intl = _ref3.intl;
|
|
10808
10693
|
if (limit) {
|
|
10809
|
-
|
|
10810
|
-
return _concatInstanceProperty(_context = "(".concat(intl.formatNumber(current), "/")).call(_context, intl.formatNumber(limit), ")");
|
|
10694
|
+
return `(${intl.formatNumber(current)}/${intl.formatNumber(limit)})`;
|
|
10811
10695
|
}
|
|
10812
10696
|
if (total) {
|
|
10813
|
-
return
|
|
10697
|
+
return `(${intl.formatNumber(total)})`;
|
|
10814
10698
|
}
|
|
10815
10699
|
return '';
|
|
10816
10700
|
};
|
|
@@ -10830,18 +10714,17 @@ const useShippingMethodsPlatformLimitsFetcher = () => {
|
|
|
10830
10714
|
};
|
|
10831
10715
|
|
|
10832
10716
|
const useShippingMethodsPlatformLimits = () => {
|
|
10833
|
-
var _platformLimits$shipp;
|
|
10834
10717
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
10835
10718
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
10836
|
-
if (!
|
|
10719
|
+
if (!platformLimits?.shippingMethods?.total) {
|
|
10837
10720
|
return {
|
|
10838
10721
|
hasReachedShippingMethodsWarningLimit: false,
|
|
10839
10722
|
hasReachedShippingMethodsErrorLimit: false
|
|
10840
10723
|
};
|
|
10841
10724
|
}
|
|
10842
|
-
const _platformLimits$
|
|
10843
|
-
limit = _platformLimits$
|
|
10844
|
-
current = _platformLimits$
|
|
10725
|
+
const _platformLimits$shipp = platformLimits.shippingMethods.total,
|
|
10726
|
+
limit = _platformLimits$shipp.limit,
|
|
10727
|
+
current = _platformLimits$shipp.current;
|
|
10845
10728
|
const hasReachedShippingMethodsWarningLimit = getHasExceededWarningThreshold({
|
|
10846
10729
|
limit,
|
|
10847
10730
|
current
|
|
@@ -10857,13 +10740,12 @@ const useShippingMethodsPlatformLimits = () => {
|
|
|
10857
10740
|
};
|
|
10858
10741
|
|
|
10859
10742
|
const PlatformLimitsShippingMethodsNotifications = () => {
|
|
10860
|
-
var _platformLimits$shipp;
|
|
10861
10743
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
10862
10744
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
10863
10745
|
const _useShippingMethodsPl2 = useShippingMethodsPlatformLimits(),
|
|
10864
10746
|
hasReachedShippingMethodsWarningLimit = _useShippingMethodsPl2.hasReachedShippingMethodsWarningLimit,
|
|
10865
10747
|
hasReachedShippingMethodsErrorLimit = _useShippingMethodsPl2.hasReachedShippingMethodsErrorLimit;
|
|
10866
|
-
if (!
|
|
10748
|
+
if (!platformLimits?.shippingMethods?.total) {
|
|
10867
10749
|
return null;
|
|
10868
10750
|
}
|
|
10869
10751
|
if (hasReachedShippingMethodsErrorLimit) {
|
|
@@ -10909,13 +10791,12 @@ var messages$j = defineMessages({
|
|
|
10909
10791
|
});
|
|
10910
10792
|
|
|
10911
10793
|
const PlatformLimitsShippingMethodsStatus = _ref => {
|
|
10912
|
-
var _platformLimits$shipp, _platformLimits$shipp2;
|
|
10913
10794
|
let total = _ref.total;
|
|
10914
10795
|
const intl = useIntl();
|
|
10915
10796
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
10916
10797
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
10917
|
-
const current = platformLimits
|
|
10918
|
-
const limit = platformLimits
|
|
10798
|
+
const current = platformLimits?.shippingMethods?.total?.current;
|
|
10799
|
+
const limit = platformLimits?.shippingMethods?.total?.limit;
|
|
10919
10800
|
return jsx(PlatformLimitsStatusText, {
|
|
10920
10801
|
intlMessage: messages$j.shippingMethodsStatus,
|
|
10921
10802
|
children: getPlatformLimitsStatus({
|
|
@@ -10977,18 +10858,17 @@ const useTaxCategoriesPlatformLimitsFetcher = () => {
|
|
|
10977
10858
|
};
|
|
10978
10859
|
|
|
10979
10860
|
const useTaxCategoriesPlatformLimits = () => {
|
|
10980
|
-
var _platformLimits$taxCa;
|
|
10981
10861
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
10982
10862
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
10983
|
-
if (!
|
|
10863
|
+
if (!platformLimits?.taxCategories?.total) {
|
|
10984
10864
|
return {
|
|
10985
10865
|
hasReachedTaxCategoriesWarningLimit: false,
|
|
10986
10866
|
hasReachedTaxCategoriesErrorLimit: false
|
|
10987
10867
|
};
|
|
10988
10868
|
}
|
|
10989
|
-
const _platformLimits$
|
|
10990
|
-
limit = _platformLimits$
|
|
10991
|
-
current = _platformLimits$
|
|
10869
|
+
const _platformLimits$taxCa = platformLimits.taxCategories.total,
|
|
10870
|
+
limit = _platformLimits$taxCa.limit,
|
|
10871
|
+
current = _platformLimits$taxCa.current;
|
|
10992
10872
|
const hasReachedTaxCategoriesWarningLimit = getHasExceededWarningThreshold({
|
|
10993
10873
|
limit,
|
|
10994
10874
|
current
|
|
@@ -11004,13 +10884,12 @@ const useTaxCategoriesPlatformLimits = () => {
|
|
|
11004
10884
|
};
|
|
11005
10885
|
|
|
11006
10886
|
const PlatformLimitsTaxCategoriesNotifications = () => {
|
|
11007
|
-
var _platformLimits$taxCa;
|
|
11008
10887
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
11009
10888
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
11010
10889
|
const _useTaxCategoriesPlat2 = useTaxCategoriesPlatformLimits(),
|
|
11011
10890
|
hasReachedTaxCategoriesWarningLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesWarningLimit,
|
|
11012
10891
|
hasReachedTaxCategoriesErrorLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesErrorLimit;
|
|
11013
|
-
if (!
|
|
10892
|
+
if (!platformLimits?.taxCategories?.total) {
|
|
11014
10893
|
return null;
|
|
11015
10894
|
}
|
|
11016
10895
|
if (hasReachedTaxCategoriesErrorLimit) {
|
|
@@ -11056,13 +10935,12 @@ var messages$h = defineMessages({
|
|
|
11056
10935
|
});
|
|
11057
10936
|
|
|
11058
10937
|
const PlatformLimitsTaxCategoriesStatus = _ref => {
|
|
11059
|
-
var _platformLimits$taxCa, _platformLimits$taxCa2;
|
|
11060
10938
|
let total = _ref.total;
|
|
11061
10939
|
const intl = useIntl();
|
|
11062
10940
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
11063
10941
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
11064
|
-
const current = platformLimits
|
|
11065
|
-
const limit = platformLimits
|
|
10942
|
+
const current = platformLimits?.taxCategories?.total?.current;
|
|
10943
|
+
const limit = platformLimits?.taxCategories?.total?.limit;
|
|
11066
10944
|
return jsx(PlatformLimitsStatusText, {
|
|
11067
10945
|
intlMessage: messages$h.taxCategoriesStatus,
|
|
11068
10946
|
children: getPlatformLimitsStatus({
|
|
@@ -11124,18 +11002,17 @@ const useZonesPlatformLimitsFetcher = () => {
|
|
|
11124
11002
|
};
|
|
11125
11003
|
|
|
11126
11004
|
const useZonesPlatformLimits = () => {
|
|
11127
|
-
var _platformLimits$zones;
|
|
11128
11005
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
11129
11006
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
11130
|
-
if (!
|
|
11007
|
+
if (!platformLimits?.zones?.total) {
|
|
11131
11008
|
return {
|
|
11132
11009
|
hasReachedZonesWarningLimit: false,
|
|
11133
11010
|
hasReachedZonesErrorLimit: false
|
|
11134
11011
|
};
|
|
11135
11012
|
}
|
|
11136
|
-
const _platformLimits$
|
|
11137
|
-
limit = _platformLimits$
|
|
11138
|
-
current = _platformLimits$
|
|
11013
|
+
const _platformLimits$zones = platformLimits.zones.total,
|
|
11014
|
+
limit = _platformLimits$zones.limit,
|
|
11015
|
+
current = _platformLimits$zones.current;
|
|
11139
11016
|
const hasReachedZonesWarningLimit = getHasExceededWarningThreshold({
|
|
11140
11017
|
limit,
|
|
11141
11018
|
current
|
|
@@ -11151,13 +11028,12 @@ const useZonesPlatformLimits = () => {
|
|
|
11151
11028
|
};
|
|
11152
11029
|
|
|
11153
11030
|
const PlatformLimitsZonesNotifications = () => {
|
|
11154
|
-
var _platformLimits$zones;
|
|
11155
11031
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
11156
11032
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
11157
11033
|
const _useZonesPlatformLimi2 = useZonesPlatformLimits(),
|
|
11158
11034
|
hasReachedZonesWarningLimit = _useZonesPlatformLimi2.hasReachedZonesWarningLimit,
|
|
11159
11035
|
hasReachedZonesErrorLimit = _useZonesPlatformLimi2.hasReachedZonesErrorLimit;
|
|
11160
|
-
if (!
|
|
11036
|
+
if (!platformLimits?.zones?.total) {
|
|
11161
11037
|
return null;
|
|
11162
11038
|
}
|
|
11163
11039
|
if (hasReachedZonesErrorLimit) {
|
|
@@ -11203,13 +11079,12 @@ var messages$f = defineMessages({
|
|
|
11203
11079
|
});
|
|
11204
11080
|
|
|
11205
11081
|
const PlatformLimitsZonesStatus = _ref => {
|
|
11206
|
-
var _platformLimits$zones, _platformLimits$zones2;
|
|
11207
11082
|
let total = _ref.total;
|
|
11208
11083
|
const intl = useIntl();
|
|
11209
11084
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
11210
11085
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
11211
|
-
const current = platformLimits
|
|
11212
|
-
const limit = platformLimits
|
|
11086
|
+
const current = platformLimits?.zones?.total?.current;
|
|
11087
|
+
const limit = platformLimits?.zones?.total?.limit;
|
|
11213
11088
|
return jsx(PlatformLimitsStatusText, {
|
|
11214
11089
|
intlMessage: messages$f.zonesStatus,
|
|
11215
11090
|
children: getPlatformLimitsStatus({
|
|
@@ -11271,18 +11146,17 @@ const useCustomersPlatformLimitsFetcher = () => {
|
|
|
11271
11146
|
};
|
|
11272
11147
|
|
|
11273
11148
|
const useCustomersPlatformLimits$1 = () => {
|
|
11274
|
-
var _platformLimits$custo;
|
|
11275
11149
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
11276
11150
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
11277
|
-
if (!
|
|
11151
|
+
if (!platformLimits?.customers?.total) {
|
|
11278
11152
|
return {
|
|
11279
11153
|
hasReachedCustomersWarningLimit: false,
|
|
11280
11154
|
hasReachedCustomersErrorLimit: false
|
|
11281
11155
|
};
|
|
11282
11156
|
}
|
|
11283
|
-
const _platformLimits$
|
|
11284
|
-
limit = _platformLimits$
|
|
11285
|
-
current = _platformLimits$
|
|
11157
|
+
const _platformLimits$custo = platformLimits.customers.total,
|
|
11158
|
+
limit = _platformLimits$custo.limit,
|
|
11159
|
+
current = _platformLimits$custo.current;
|
|
11286
11160
|
const hasReachedCustomersWarningLimit = getHasExceededWarningThreshold({
|
|
11287
11161
|
limit,
|
|
11288
11162
|
current
|
|
@@ -11311,13 +11185,12 @@ const useCustomersPlatormLimitsModalState = () => {
|
|
|
11311
11185
|
};
|
|
11312
11186
|
|
|
11313
11187
|
const PlatformLimitsCustomersNotifications = () => {
|
|
11314
|
-
var _platformLimits$custo;
|
|
11315
11188
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
11316
11189
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
11317
11190
|
const _useCustomersPlatform2 = useCustomersPlatformLimits$1(),
|
|
11318
11191
|
hasReachedCustomersWarningLimit = _useCustomersPlatform2.hasReachedCustomersWarningLimit,
|
|
11319
11192
|
hasReachedCustomersErrorLimit = _useCustomersPlatform2.hasReachedCustomersErrorLimit;
|
|
11320
|
-
if (!
|
|
11193
|
+
if (!platformLimits?.customers?.total) {
|
|
11321
11194
|
return jsx("div", {});
|
|
11322
11195
|
}
|
|
11323
11196
|
if (hasReachedCustomersErrorLimit) {
|
|
@@ -11368,16 +11241,15 @@ var styles$6 = {
|
|
|
11368
11241
|
"status": "platform-limits-customers-status-module__status___3rXYM"
|
|
11369
11242
|
};
|
|
11370
11243
|
const PlatformLimitsCustomersStatus = () => {
|
|
11371
|
-
var _platformLimits$custo;
|
|
11372
11244
|
const intl = useIntl();
|
|
11373
11245
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
11374
11246
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
11375
|
-
if (!
|
|
11247
|
+
if (!platformLimits?.customers?.total) {
|
|
11376
11248
|
return null;
|
|
11377
11249
|
}
|
|
11378
|
-
const _platformLimits$
|
|
11379
|
-
current = _platformLimits$
|
|
11380
|
-
limit = _platformLimits$
|
|
11250
|
+
const _platformLimits$custo = platformLimits.customers.total,
|
|
11251
|
+
current = _platformLimits$custo.current,
|
|
11252
|
+
limit = _platformLimits$custo.limit;
|
|
11381
11253
|
return jsx("div", {
|
|
11382
11254
|
className: styles$6.status,
|
|
11383
11255
|
children: jsx(Text.Detail, {
|
|
@@ -11611,18 +11483,17 @@ const useCustomerGroupsPlatformLimitsFetcher = () => {
|
|
|
11611
11483
|
};
|
|
11612
11484
|
|
|
11613
11485
|
const useCustomerGroupsPlatformLimitsStatus = () => {
|
|
11614
|
-
var _platformLimits$custo;
|
|
11615
11486
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
11616
11487
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
11617
|
-
if (!
|
|
11488
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
11618
11489
|
return {
|
|
11619
11490
|
hasReachedCustomerGroupsWarningLimit: false,
|
|
11620
11491
|
hasReachedCustomerGroupsErrorLimit: false
|
|
11621
11492
|
};
|
|
11622
11493
|
}
|
|
11623
|
-
const _platformLimits$
|
|
11624
|
-
limit = _platformLimits$
|
|
11625
|
-
current = _platformLimits$
|
|
11494
|
+
const _platformLimits$custo = platformLimits.customerGroups.total,
|
|
11495
|
+
limit = _platformLimits$custo.limit,
|
|
11496
|
+
current = _platformLimits$custo.current;
|
|
11626
11497
|
const hasReachedCustomerGroupsWarningLimit = getHasExceededWarningThreshold({
|
|
11627
11498
|
limit,
|
|
11628
11499
|
current
|
|
@@ -11651,13 +11522,12 @@ const useCustomerGroupsPlatormLimitsModalState = () => {
|
|
|
11651
11522
|
};
|
|
11652
11523
|
|
|
11653
11524
|
const PlatformLimitsCustomerGroupsNotifications = () => {
|
|
11654
|
-
var _platformLimits$custo;
|
|
11655
11525
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
11656
11526
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
11657
11527
|
const _useCustomerGroupsPla2 = useCustomerGroupsPlatformLimitsStatus(),
|
|
11658
11528
|
hasReachedCustomerGroupsWarningLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsWarningLimit,
|
|
11659
11529
|
hasReachedCustomerGroupsErrorLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsErrorLimit;
|
|
11660
|
-
if (!
|
|
11530
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
11661
11531
|
return jsx("div", {});
|
|
11662
11532
|
}
|
|
11663
11533
|
if (hasReachedCustomerGroupsErrorLimit) {
|
|
@@ -11708,16 +11578,15 @@ var styles$4 = {
|
|
|
11708
11578
|
"status": "platform-limits-customer-groups-status-module__status___6099G"
|
|
11709
11579
|
};
|
|
11710
11580
|
const PlatformLimitsCustomerGroupsStatus = () => {
|
|
11711
|
-
var _platformLimits$custo;
|
|
11712
11581
|
const intl = useIntl();
|
|
11713
11582
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
11714
11583
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
11715
|
-
if (!
|
|
11584
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
11716
11585
|
return null;
|
|
11717
11586
|
}
|
|
11718
|
-
const _platformLimits$
|
|
11719
|
-
current = _platformLimits$
|
|
11720
|
-
limit = _platformLimits$
|
|
11587
|
+
const _platformLimits$custo = platformLimits.customerGroups.total,
|
|
11588
|
+
current = _platformLimits$custo.current,
|
|
11589
|
+
limit = _platformLimits$custo.limit;
|
|
11721
11590
|
return jsx("div", {
|
|
11722
11591
|
className: styles$4.status,
|
|
11723
11592
|
children: jsx(Text.Detail, {
|
|
@@ -11963,7 +11832,6 @@ const valueMapping = {
|
|
|
11963
11832
|
all: [true, false]
|
|
11964
11833
|
};
|
|
11965
11834
|
const BooleanField = props => {
|
|
11966
|
-
var _context;
|
|
11967
11835
|
let selectedValue;
|
|
11968
11836
|
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]);
|
|
11969
11837
|
const yesLabel = props.intl.formatMessage(messages$8.yes);
|
|
@@ -11977,7 +11845,7 @@ const BooleanField = props => {
|
|
|
11977
11845
|
}];
|
|
11978
11846
|
if (props.isMulti) options.push({
|
|
11979
11847
|
value: 'all',
|
|
11980
|
-
label:
|
|
11848
|
+
label: `${yesLabel} / ${noLabel}`
|
|
11981
11849
|
});
|
|
11982
11850
|
return jsx(SelectInput, {
|
|
11983
11851
|
name: props.name,
|
|
@@ -12092,7 +11960,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
12092
11960
|
truncate: true,
|
|
12093
11961
|
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$5.filterWholeInput), {}, {
|
|
12094
11962
|
values: {
|
|
12095
|
-
values: "
|
|
11963
|
+
values: `"${props.value}"`
|
|
12096
11964
|
}
|
|
12097
11965
|
})
|
|
12098
11966
|
})
|
|
@@ -12105,7 +11973,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
12105
11973
|
truncate: true,
|
|
12106
11974
|
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$5.filterSeparateValues), {}, {
|
|
12107
11975
|
values: {
|
|
12108
|
-
values: "
|
|
11976
|
+
values: `"${props.multiValue.join('", "')}"` || props.value
|
|
12109
11977
|
}
|
|
12110
11978
|
})
|
|
12111
11979
|
})
|
|
@@ -12395,17 +12263,16 @@ function isEmpty(value) {
|
|
|
12395
12263
|
}
|
|
12396
12264
|
|
|
12397
12265
|
const buildSearchQuery = (searchQuery, searchMode, fragments) => {
|
|
12398
|
-
var _fragments$searchMode;
|
|
12399
12266
|
if (!searchQuery) return '';
|
|
12400
12267
|
const buildAllFieldsQueryString = query => {
|
|
12401
12268
|
const fragmentsArray = _Object$values(fragments);
|
|
12402
|
-
return
|
|
12269
|
+
return `( ${_mapInstanceProperty(fragmentsArray).call(fragmentsArray, fragment => fragment.getQuery(query)).join(' or ')} )`;
|
|
12403
12270
|
};
|
|
12404
12271
|
const trimmedSearchQuery = oneLine(searchQuery);
|
|
12405
12272
|
if (searchMode === 'allFields') {
|
|
12406
12273
|
return buildAllFieldsQueryString(trimmedSearchQuery);
|
|
12407
12274
|
}
|
|
12408
|
-
if (!fragments[searchMode] || typeof
|
|
12275
|
+
if (!fragments[searchMode] || typeof fragments[searchMode]?.getQuery !== 'function') {
|
|
12409
12276
|
return '';
|
|
12410
12277
|
}
|
|
12411
12278
|
return fragments[searchMode].getQuery(trimmedSearchQuery);
|
|
@@ -12694,11 +12561,11 @@ function createResourceReducer(options) {
|
|
|
12694
12561
|
|
|
12695
12562
|
// TODO: validate constant keys
|
|
12696
12563
|
const actionsMap = {
|
|
12697
|
-
[
|
|
12564
|
+
[`${plural}_FETCHED`]: (_, action) => ({
|
|
12698
12565
|
currentQueryResult: action.payload
|
|
12699
12566
|
}),
|
|
12700
|
-
[
|
|
12701
|
-
[
|
|
12567
|
+
[`${single}_UPDATED_IN_LIST`]: updateStatusInList(mergeData),
|
|
12568
|
+
[`${single}_DELETED_IN_LIST`]: (state, _ref) => {
|
|
12702
12569
|
let payload = _ref.payload;
|
|
12703
12570
|
const results = state.currentQueryResult.results;
|
|
12704
12571
|
return {
|
|
@@ -12710,27 +12577,27 @@ function createResourceReducer(options) {
|
|
|
12710
12577
|
})
|
|
12711
12578
|
};
|
|
12712
12579
|
},
|
|
12713
|
-
[
|
|
12580
|
+
[`${single}_FETCHED`]: (_, _ref3) => {
|
|
12714
12581
|
let payload = _ref3.payload;
|
|
12715
12582
|
return {
|
|
12716
12583
|
currentVisible: payload
|
|
12717
12584
|
};
|
|
12718
12585
|
},
|
|
12719
|
-
[
|
|
12586
|
+
[`${single}_CREATED`]: (_ref4, _ref5) => {
|
|
12720
12587
|
let currentVisible = _ref4.currentVisible;
|
|
12721
12588
|
let payload = _ref5.payload;
|
|
12722
12589
|
return {
|
|
12723
12590
|
currentVisible: mergeData(payload, currentVisible)
|
|
12724
12591
|
};
|
|
12725
12592
|
},
|
|
12726
|
-
[
|
|
12593
|
+
[`${single}_UPDATED`]: (_ref6, _ref7) => {
|
|
12727
12594
|
let currentVisible = _ref6.currentVisible;
|
|
12728
12595
|
let payload = _ref7.payload;
|
|
12729
12596
|
return {
|
|
12730
12597
|
currentVisible: mergeData(payload, currentVisible)
|
|
12731
12598
|
};
|
|
12732
12599
|
},
|
|
12733
|
-
[
|
|
12600
|
+
[`${single}_DELETED`]: () => ({
|
|
12734
12601
|
currentVisible: null
|
|
12735
12602
|
})
|
|
12736
12603
|
};
|
|
@@ -12747,12 +12614,11 @@ function formatCustomerAddress(_ref) {
|
|
|
12747
12614
|
}
|
|
12748
12615
|
|
|
12749
12616
|
function formatCustomerName(_ref) {
|
|
12750
|
-
var _context;
|
|
12751
12617
|
let firstName = _ref.firstName,
|
|
12752
12618
|
lastName = _ref.lastName;
|
|
12753
12619
|
if (firstName && !lastName) return _trimInstanceProperty(firstName).call(firstName);
|
|
12754
12620
|
if (!firstName && lastName) return _trimInstanceProperty(lastName).call(lastName);
|
|
12755
|
-
if (firstName && lastName) return
|
|
12621
|
+
if (firstName && lastName) return `${_trimInstanceProperty(firstName).call(firstName)} ${_trimInstanceProperty(lastName).call(lastName)}`;
|
|
12756
12622
|
return NO_VALUE_FALLBACK;
|
|
12757
12623
|
}
|
|
12758
12624
|
|
|
@@ -12781,23 +12647,21 @@ function base64ToString(value) {
|
|
|
12781
12647
|
}
|
|
12782
12648
|
|
|
12783
12649
|
const composeNumberPredicateFromFilter = (target, value, option) => {
|
|
12784
|
-
var _context, _context2, _context3, _context4, _context5, _context6;
|
|
12785
12650
|
switch (option) {
|
|
12786
12651
|
case FILTER_TYPES.lessThan:
|
|
12787
|
-
return
|
|
12652
|
+
return `${target} < ${value}`;
|
|
12788
12653
|
case FILTER_TYPES.moreThan:
|
|
12789
|
-
return
|
|
12654
|
+
return `${target} > ${value}`;
|
|
12790
12655
|
case FILTER_TYPES.equalTo:
|
|
12791
|
-
return
|
|
12656
|
+
return `${target} = ${value}`;
|
|
12792
12657
|
case FILTER_TYPES.range:
|
|
12793
|
-
return
|
|
12658
|
+
return `${target} >= ${value.from} and ${target} <= ${value.to}`;
|
|
12794
12659
|
default:
|
|
12795
12660
|
return '';
|
|
12796
12661
|
}
|
|
12797
12662
|
};
|
|
12798
12663
|
function customFields (filter, locale) {
|
|
12799
12664
|
const customFieldsPredicates = _mapInstanceProperty(filter).call(filter, customFieldFilter => {
|
|
12800
|
-
var _context7, _context8, _context9, _context10, _context11;
|
|
12801
12665
|
const _customFieldFilter$va = customFieldFilter.value,
|
|
12802
12666
|
target = _customFieldFilter$va.target,
|
|
12803
12667
|
type = _customFieldFilter$va.type,
|
|
@@ -12805,14 +12669,14 @@ function customFields (filter, locale) {
|
|
|
12805
12669
|
option = _customFieldFilter$va.option;
|
|
12806
12670
|
switch (type.name) {
|
|
12807
12671
|
case FIELD_TYPES.Boolean:
|
|
12808
|
-
return
|
|
12672
|
+
return `${target} = ${value.value}`;
|
|
12809
12673
|
case FIELD_TYPES.String:
|
|
12810
|
-
return
|
|
12674
|
+
return `${target} = "${value}"`;
|
|
12811
12675
|
case FIELD_TYPES.LocalizedString:
|
|
12812
|
-
return
|
|
12676
|
+
return `${target}(${localizedTextTransformer(value)})`;
|
|
12813
12677
|
case FIELD_TYPES.Enum:
|
|
12814
12678
|
case FIELD_TYPES.LocalizedEnum:
|
|
12815
|
-
return
|
|
12679
|
+
return `${target} = "${value.value}"`;
|
|
12816
12680
|
case FIELD_TYPES.Time:
|
|
12817
12681
|
return timeTransformer(target, [{
|
|
12818
12682
|
type: option,
|
|
@@ -12827,14 +12691,14 @@ function customFields (filter, locale) {
|
|
|
12827
12691
|
case FIELD_TYPES.Number:
|
|
12828
12692
|
return composeNumberPredicateFromFilter(target, value, option);
|
|
12829
12693
|
case FIELD_TYPES.Money:
|
|
12830
|
-
return
|
|
12694
|
+
return `${target}(${moneyTransformer(value, option, locale)})`;
|
|
12831
12695
|
case FIELD_TYPES.Reference:
|
|
12832
12696
|
case FIELD_TYPES.Set:
|
|
12833
12697
|
default:
|
|
12834
12698
|
throw new Error('Custom field type not recognized');
|
|
12835
12699
|
}
|
|
12836
12700
|
});
|
|
12837
|
-
return
|
|
12701
|
+
return `(custom(fields(${customFieldsPredicates.join(' and ')})))`;
|
|
12838
12702
|
}
|
|
12839
12703
|
|
|
12840
12704
|
/**
|
|
@@ -12875,10 +12739,8 @@ function graphqlQueryBuilder(_ref) {
|
|
|
12875
12739
|
}
|
|
12876
12740
|
|
|
12877
12741
|
function numberTransformer(filterKey, filters) {
|
|
12878
|
-
var _context3;
|
|
12879
12742
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$2;
|
|
12880
12743
|
const queries = _mapInstanceProperty(filters).call(filters, _ref => {
|
|
12881
|
-
var _context, _context2;
|
|
12882
12744
|
let type = _ref.type,
|
|
12883
12745
|
value = _ref.value;
|
|
12884
12746
|
if (!filterValidator({
|
|
@@ -12887,19 +12749,19 @@ function numberTransformer(filterKey, filters) {
|
|
|
12887
12749
|
})) return '';
|
|
12888
12750
|
switch (type) {
|
|
12889
12751
|
case 'lessThan':
|
|
12890
|
-
return
|
|
12752
|
+
return `(* to ${_parseInt(value) - 1})`;
|
|
12891
12753
|
case 'moreThan':
|
|
12892
|
-
return
|
|
12754
|
+
return `(${_parseInt(value) + 1} to *)`;
|
|
12893
12755
|
case 'equalTo':
|
|
12894
|
-
return
|
|
12756
|
+
return `(${value} to ${value})`;
|
|
12895
12757
|
case 'range':
|
|
12896
|
-
return
|
|
12758
|
+
return `(${value.from} to ${value.to})`;
|
|
12897
12759
|
default:
|
|
12898
12760
|
return '';
|
|
12899
12761
|
}
|
|
12900
12762
|
});
|
|
12901
12763
|
const queryString = _filterInstanceProperty(queries).call(queries, q => q !== '').join(', ');
|
|
12902
|
-
return queryString === '' ? null :
|
|
12764
|
+
return queryString === '' ? null : `${filterKey}: range${queryString}`;
|
|
12903
12765
|
}
|
|
12904
12766
|
function isFilterValid$2(_ref2) {
|
|
12905
12767
|
let type = _ref2.type,
|
|
@@ -12926,11 +12788,9 @@ function graphqlCategoryLevelTransformer(filterKey, filters, filterValidator) {
|
|
|
12926
12788
|
return _filterInstanceProperty(_context = [levelFilterQuery, lastLevelFilterQuery]).call(_context, Boolean);
|
|
12927
12789
|
}
|
|
12928
12790
|
|
|
12929
|
-
var _templateObject, _templateObject2;
|
|
12930
12791
|
const dateFormatDayStart = 'YYYY-MM-DDT00:00:00.000Z';
|
|
12931
12792
|
const dateFormatDayEnd = 'YYYY-MM-DDT23:59:59.999Z';
|
|
12932
12793
|
function dateTransformer(filterKey, filters) {
|
|
12933
|
-
var _context;
|
|
12934
12794
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$1;
|
|
12935
12795
|
const queries = _mapInstanceProperty(filters).call(filters, _ref => {
|
|
12936
12796
|
let type = _ref.type,
|
|
@@ -12941,19 +12801,25 @@ function dateTransformer(filterKey, filters) {
|
|
|
12941
12801
|
})) return '';
|
|
12942
12802
|
switch (type) {
|
|
12943
12803
|
case 'lessThan':
|
|
12944
|
-
return
|
|
12804
|
+
return `(* to "${moment(value).format(dateFormatDayStart)}")`;
|
|
12945
12805
|
case 'moreThan':
|
|
12946
|
-
return
|
|
12806
|
+
return `("${moment(value).format(dateFormatDayEnd)}" to *)`;
|
|
12947
12807
|
case 'equalTo':
|
|
12948
|
-
return oneLine
|
|
12808
|
+
return oneLine`
|
|
12809
|
+
("${moment(value).format(dateFormatDayStart)}"
|
|
12810
|
+
to "${moment(value).format(dateFormatDayEnd)}")
|
|
12811
|
+
`;
|
|
12949
12812
|
case 'range':
|
|
12950
|
-
return oneLine
|
|
12813
|
+
return oneLine`
|
|
12814
|
+
("${moment(value.from).format(dateFormatDayStart)}"
|
|
12815
|
+
to "${moment(value.to).format(dateFormatDayEnd)}")
|
|
12816
|
+
`;
|
|
12951
12817
|
default:
|
|
12952
12818
|
return '';
|
|
12953
12819
|
}
|
|
12954
12820
|
});
|
|
12955
12821
|
const queryString = _filterInstanceProperty(queries).call(queries, q => q !== '').join(', ');
|
|
12956
|
-
return queryString === '' ? null :
|
|
12822
|
+
return queryString === '' ? null : `${filterKey}: range${queryString}`;
|
|
12957
12823
|
}
|
|
12958
12824
|
function isFilterValid$1(_ref2) {
|
|
12959
12825
|
let type = _ref2.type,
|
|
@@ -12971,20 +12837,18 @@ function missingTransformer(filterKey, filters) {
|
|
|
12971
12837
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
12972
12838
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
12973
12839
|
if (filters.length === 0) return null;
|
|
12974
|
-
return
|
|
12840
|
+
return `${filterKey}:missing`;
|
|
12975
12841
|
}
|
|
12976
12842
|
|
|
12977
12843
|
function missingLocaleTransformer(filterKey, filters) {
|
|
12978
|
-
var _context;
|
|
12979
12844
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
12980
12845
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
12981
12846
|
if (filters.length === 0) return null;
|
|
12982
12847
|
const missingLocale = filters[0].value.value;
|
|
12983
|
-
return
|
|
12848
|
+
return `${filterKey}.${missingLocale}:missing`;
|
|
12984
12849
|
}
|
|
12985
12850
|
|
|
12986
12851
|
function referenceTransformer(filterKey, filters) {
|
|
12987
|
-
var _context;
|
|
12988
12852
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid;
|
|
12989
12853
|
const queries = _mapInstanceProperty(filters).call(filters, _ref => {
|
|
12990
12854
|
let type = _ref.type,
|
|
@@ -12995,29 +12859,28 @@ function referenceTransformer(filterKey, filters) {
|
|
|
12995
12859
|
})) return '';
|
|
12996
12860
|
switch (type) {
|
|
12997
12861
|
case 'equalTo':
|
|
12998
|
-
return "
|
|
12862
|
+
return `"${value}"`;
|
|
12999
12863
|
default:
|
|
13000
12864
|
return '';
|
|
13001
12865
|
}
|
|
13002
12866
|
});
|
|
13003
12867
|
const queryString = _filterInstanceProperty(queries).call(queries, q => q !== '').join(', ');
|
|
13004
|
-
return queryString === '' ? null :
|
|
12868
|
+
return queryString === '' ? null : `${filterKey}.id: ${queryString}`;
|
|
13005
12869
|
}
|
|
13006
12870
|
function isFilterValid(_ref2) {
|
|
13007
|
-
var
|
|
12871
|
+
var _context;
|
|
13008
12872
|
let type = _ref2.type,
|
|
13009
12873
|
value = _ref2.value;
|
|
13010
|
-
if (type === 'equalTo' && !_includesInstanceProperty(
|
|
12874
|
+
if (type === 'equalTo' && !_includesInstanceProperty(_context = [null, undefined, '']).call(_context, value)) return true;
|
|
13011
12875
|
return false;
|
|
13012
12876
|
}
|
|
13013
12877
|
|
|
13014
12878
|
function textTransformer(filterKey, queries) {
|
|
13015
|
-
var _context;
|
|
13016
12879
|
if (queries.length === 0) return null;
|
|
13017
12880
|
|
|
13018
12881
|
// Note: we assume for now that there can only be 1 text filter.
|
|
13019
12882
|
const queryValue = queries[0].value;
|
|
13020
|
-
return queryValue ?
|
|
12883
|
+
return queryValue ? `${filterKey}:"${queryValue}"` : null;
|
|
13021
12884
|
}
|
|
13022
12885
|
|
|
13023
12886
|
function isValidISOTime(_ref) {
|
|
@@ -13102,8 +12965,8 @@ function validateFilter$2(_ref, intl) {
|
|
|
13102
12965
|
};
|
|
13103
12966
|
}
|
|
13104
12967
|
if (value.option === FILTER_TYPES.range) {
|
|
13105
|
-
const from = validateValue(filterValue
|
|
13106
|
-
const to = from ? null : validateValue(filterValue
|
|
12968
|
+
const from = validateValue(filterValue?.from, typeName, intl);
|
|
12969
|
+
const to = from ? null : validateValue(filterValue?.to, typeName, intl);
|
|
13107
12970
|
return from || to ? {
|
|
13108
12971
|
input: {
|
|
13109
12972
|
from,
|
|
@@ -13140,16 +13003,16 @@ function validateFilter$1(_ref, intl) {
|
|
|
13140
13003
|
type = _ref.type;
|
|
13141
13004
|
if (type === 'range') {
|
|
13142
13005
|
if (validateSingleFilter({
|
|
13143
|
-
value: value
|
|
13006
|
+
value: value?.from
|
|
13144
13007
|
})) return {
|
|
13145
13008
|
from: intl.formatMessage(messages$2.rangeMissingValue)
|
|
13146
13009
|
};
|
|
13147
13010
|
if (validateSingleFilter({
|
|
13148
|
-
value: value
|
|
13011
|
+
value: value?.to
|
|
13149
13012
|
})) return {
|
|
13150
13013
|
to: intl.formatMessage(messages$2.rangeMissingValue)
|
|
13151
13014
|
};
|
|
13152
|
-
if (moment(value
|
|
13015
|
+
if (moment(value?.to).isBefore(value?.from)) return {
|
|
13153
13016
|
from: intl.formatMessage(messages$2.rangeToSmallerThanFrom)
|
|
13154
13017
|
};
|
|
13155
13018
|
} else if (type === 'equalTo' || type === 'lessThan' || type === 'moreThan') {
|
|
@@ -13226,14 +13089,14 @@ const validateText = function (text, intl) {
|
|
|
13226
13089
|
|
|
13227
13090
|
function formatDiscount(discount, currencyCode, intl) {
|
|
13228
13091
|
var _context;
|
|
13229
|
-
if (discount.type === 'relative') return
|
|
13092
|
+
if (discount.type === 'relative') return `${discount.permyriad / 100}%`;
|
|
13230
13093
|
if (!discount.money) return null;
|
|
13231
13094
|
const moneyForCurrencyCode = _findInstanceProperty(_context = discount.money).call(_context, discountMoney => discountMoney.currencyCode === currencyCode);
|
|
13232
13095
|
return moneyForCurrencyCode ? formatMoney$2(moneyForCurrencyCode, intl) : null;
|
|
13233
13096
|
}
|
|
13234
13097
|
|
|
13235
13098
|
function formatPercentage(percentage) {
|
|
13236
|
-
return
|
|
13099
|
+
return `${percentage}%`;
|
|
13237
13100
|
}
|
|
13238
13101
|
function convertRatioToPercentage(ratio) {
|
|
13239
13102
|
return _parseFloat((ratio * 100).toFixed(2));
|
|
@@ -13247,10 +13110,7 @@ function convertRatioToPercentage(ratio) {
|
|
|
13247
13110
|
* @returns {boolean}
|
|
13248
13111
|
*/
|
|
13249
13112
|
const hasErrorCode = (unmappedApiErrors, errorCode) => {
|
|
13250
|
-
return _Array$isArray(unmappedApiErrors) && _someInstanceProperty(unmappedApiErrors).call(unmappedApiErrors, error =>
|
|
13251
|
-
var _error$extensions;
|
|
13252
|
-
return ((_error$extensions = error.extensions) === null || _error$extensions === void 0 ? void 0 : _error$extensions.code) === errorCode;
|
|
13253
|
-
});
|
|
13113
|
+
return _Array$isArray(unmappedApiErrors) && _someInstanceProperty(unmappedApiErrors).call(unmappedApiErrors, error => error.extensions?.code === errorCode);
|
|
13254
13114
|
};
|
|
13255
13115
|
|
|
13256
13116
|
const hasInvalidInputError = errors => hasErrorCode(errors, ERROR_CODES.invalidInput);
|
|
@@ -13262,7 +13122,7 @@ function minusify(value) {
|
|
|
13262
13122
|
return minus.concat(value);
|
|
13263
13123
|
}
|
|
13264
13124
|
|
|
13265
|
-
const flattenOperator = (operator, clauses) => compact(_reduceInstanceProperty(clauses).call(clauses, (result, clause) => _concatInstanceProperty(result).call(result,
|
|
13125
|
+
const flattenOperator = (operator, clauses) => compact(_reduceInstanceProperty(clauses).call(clauses, (result, clause) => _concatInstanceProperty(result).call(result, clause?.[operator] || clause), []));
|
|
13266
13126
|
const argsToArray = args => _reduceInstanceProperty(args).call(args, (result, item) => _concatInstanceProperty(result).call(result, item), []);
|
|
13267
13127
|
const exists = (field, attributeType) => ({
|
|
13268
13128
|
exists: {
|
|
@@ -13319,7 +13179,7 @@ const not = function () {
|
|
|
13319
13179
|
|
|
13320
13180
|
const safelyAddFallback = function (string) {
|
|
13321
13181
|
let fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NO_VALUE_FALLBACK;
|
|
13322
|
-
return string === '' ? fallback : string
|
|
13182
|
+
return string === '' ? fallback : string ?? fallback;
|
|
13323
13183
|
};
|
|
13324
13184
|
|
|
13325
13185
|
var messages = defineMessages({
|
|
@@ -13454,19 +13314,19 @@ const computedProperties = {
|
|
|
13454
13314
|
// has been deleted. See MC-1925 for further information.
|
|
13455
13315
|
const filteredCategories = _filterInstanceProperty(_context6 = product.categories).call(_context6, category => category.obj !== undefined);
|
|
13456
13316
|
return _mapInstanceProperty(filteredCategories).call(filteredCategories, category => {
|
|
13457
|
-
var _context7;
|
|
13458
13317
|
const categoryPath = getPathName(category, language, languages);
|
|
13459
13318
|
const ancestors = getAncestors(category, language);
|
|
13460
|
-
const externalIdValue = category.obj.externalId ?
|
|
13319
|
+
const externalIdValue = category.obj.externalId ?
|
|
13320
|
+
// hardcoding "ext. ID" since this is not part of a message to be
|
|
13461
13321
|
// translated. This has been communicated with Jenn
|
|
13462
|
-
|
|
13322
|
+
`| ext. ID: ${category.obj.externalId}` : '';
|
|
13463
13323
|
return {
|
|
13464
13324
|
id: category.id,
|
|
13465
|
-
name:
|
|
13325
|
+
name: `${formatLocalizedString(category.obj, {
|
|
13466
13326
|
key: 'name',
|
|
13467
13327
|
locale: language,
|
|
13468
13328
|
fallbackOrder: languages
|
|
13469
|
-
})
|
|
13329
|
+
})} ${externalIdValue}`,
|
|
13470
13330
|
path: categoryPath,
|
|
13471
13331
|
level: ancestors.length
|
|
13472
13332
|
};
|
|
@@ -13503,13 +13363,13 @@ const getAttributeValueByType = _ref12 => {
|
|
|
13503
13363
|
value: value
|
|
13504
13364
|
});
|
|
13505
13365
|
case 'enum':
|
|
13506
|
-
return safelyAddFallback(value.label,
|
|
13366
|
+
return safelyAddFallback(value.label, `${value.key} (key)`);
|
|
13507
13367
|
case 'lenum':
|
|
13508
13368
|
return safelyAddFallback(formatLocalizedString(value, {
|
|
13509
13369
|
key: 'label',
|
|
13510
13370
|
locale: projectDataLocale,
|
|
13511
13371
|
fallbackOrder: projectLanguages
|
|
13512
|
-
}),
|
|
13372
|
+
}), `${value.key} (key)`);
|
|
13513
13373
|
case 'number':
|
|
13514
13374
|
return safelyAddFallback(value);
|
|
13515
13375
|
case 'boolean':
|
|
@@ -13631,7 +13491,6 @@ const reorderArrayItems = (array, from, to) => {
|
|
|
13631
13491
|
const mapTimeZonesToOptions = memoize(timeZones => {
|
|
13632
13492
|
var _context;
|
|
13633
13493
|
return _mapInstanceProperty(_context = _Object$entries(timeZones)).call(_context, _ref => {
|
|
13634
|
-
var _context2;
|
|
13635
13494
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
13636
13495
|
code = _ref2[0],
|
|
13637
13496
|
value = _ref2[1];
|
|
@@ -13640,7 +13499,7 @@ const mapTimeZonesToOptions = memoize(timeZones => {
|
|
|
13640
13499
|
//E.g. `(GMT +02:00) Central European Time - Berlin`
|
|
13641
13500
|
// unicode clock hex code: \u25F7
|
|
13642
13501
|
//
|
|
13643
|
-
label:
|
|
13502
|
+
label: `(GMT ${value.offset}) ${value.name}`
|
|
13644
13503
|
};
|
|
13645
13504
|
});
|
|
13646
13505
|
});
|
|
@@ -13648,12 +13507,9 @@ const getTimeZoneId = memoize((selectedTimeZone, timeZones) => {
|
|
|
13648
13507
|
if (timeZones[selectedTimeZone]) {
|
|
13649
13508
|
return selectedTimeZone;
|
|
13650
13509
|
} else {
|
|
13651
|
-
var
|
|
13652
|
-
const fallbackTimeZoneId = _findInstanceProperty(
|
|
13653
|
-
|
|
13654
|
-
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);
|
|
13655
|
-
});
|
|
13656
|
-
if (fallbackTimeZoneId !== null && fallbackTimeZoneId !== void 0 && fallbackTimeZoneId.length) {
|
|
13510
|
+
var _context2;
|
|
13511
|
+
const fallbackTimeZoneId = _findInstanceProperty(_context2 = _Object$keys(timeZones)).call(_context2, timeZoneId => timeZones[timeZoneId]?.translationFor?.some(fallbackTimeZone => fallbackTimeZone === selectedTimeZone));
|
|
13512
|
+
if (fallbackTimeZoneId?.length) {
|
|
13657
13513
|
return fallbackTimeZoneId.toString();
|
|
13658
13514
|
} else {
|
|
13659
13515
|
return 'UTC';
|
|
@@ -13661,21 +13517,19 @@ const getTimeZoneId = memoize((selectedTimeZone, timeZones) => {
|
|
|
13661
13517
|
}
|
|
13662
13518
|
});
|
|
13663
13519
|
const getTimeZoneLabel = memoize((selectedTimeZone, timeZones) => {
|
|
13664
|
-
var _context4;
|
|
13665
13520
|
const timeZoneId = getTimeZoneId(selectedTimeZone, timeZones);
|
|
13666
13521
|
const timeZoneData = timeZones[timeZoneId];
|
|
13667
|
-
return
|
|
13522
|
+
return `(GMT ${timeZoneData.offset}) ${timeZoneData.name}`;
|
|
13668
13523
|
});
|
|
13669
13524
|
|
|
13670
13525
|
const DEFAULT_LENGTH = 50;
|
|
13671
13526
|
const DEFAULT_END = '...';
|
|
13672
13527
|
function truncate (text) {
|
|
13673
|
-
var _context;
|
|
13674
13528
|
let length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_LENGTH;
|
|
13675
13529
|
let end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_END;
|
|
13676
13530
|
if (!text) return '';
|
|
13677
13531
|
if (text.length < length) return text;
|
|
13678
|
-
return
|
|
13532
|
+
return `${text.substring(0, length)}${end}`;
|
|
13679
13533
|
}
|
|
13680
13534
|
|
|
13681
13535
|
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; }
|