@commercetools-frontend/experimental-components 6.1.3 → 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 +467 -614
- package/dist/commercetools-frontend-experimental-components.cjs.prod.js +465 -612
- package/dist/commercetools-frontend-experimental-components.esm.js +465 -612
- package/dist/styles.css +12 -12
- package/package.json +17 -15
|
@@ -29,7 +29,6 @@ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWit
|
|
|
29
29
|
var _toArray = require('@babel/runtime-corejs3/helpers/toArray');
|
|
30
30
|
var _reverseInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reverse');
|
|
31
31
|
var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
|
|
32
|
-
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
33
32
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
34
33
|
var client = require('@apollo/client');
|
|
35
34
|
var react = require('@apollo/client/react');
|
|
@@ -59,7 +58,6 @@ var applicationShell = require('@commercetools-frontend/application-shell');
|
|
|
59
58
|
var debounce = require('debounce-promise');
|
|
60
59
|
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
61
60
|
var pick = require('lodash/pick');
|
|
62
|
-
var _taggedTemplateLiteral = require('@babel/runtime-corejs3/helpers/taggedTemplateLiteral');
|
|
63
61
|
var oneLine = require('common-tags/lib/oneLine');
|
|
64
62
|
var moment = require('moment');
|
|
65
63
|
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
@@ -73,7 +71,6 @@ var isEmpty$3 = require('lodash/isEmpty');
|
|
|
73
71
|
var omit = require('lodash/omit');
|
|
74
72
|
var _Object$freeze = require('@babel/runtime-corejs3/core-js-stable/object/freeze');
|
|
75
73
|
var originalOmitDeep = require('omit-deep');
|
|
76
|
-
var _findIndexInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find-index');
|
|
77
74
|
var _parseInt = require('@babel/runtime-corejs3/core-js-stable/parse-int');
|
|
78
75
|
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
79
76
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
@@ -106,12 +103,14 @@ var uniqBy = require('lodash/uniqBy');
|
|
|
106
103
|
var invariant = require('tiny-invariant');
|
|
107
104
|
var hoistNonReactStatics = require('hoist-non-react-statics');
|
|
108
105
|
var reactRedux = require('react-redux');
|
|
106
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
109
107
|
var _Math$trunc = require('@babel/runtime-corejs3/core-js-stable/math/trunc');
|
|
110
108
|
var _Number$isNaN = require('@babel/runtime-corejs3/core-js-stable/number/is-nan');
|
|
111
109
|
var Cleave = require('cleave.js/react');
|
|
112
110
|
var isFinite = require('lodash/isFinite');
|
|
113
111
|
var isUndefined = require('lodash/isUndefined');
|
|
114
112
|
var _Object$assign = require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
113
|
+
var _findIndexInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find-index');
|
|
115
114
|
var flatMap = require('lodash/flatMap');
|
|
116
115
|
var compact = require('lodash/compact');
|
|
117
116
|
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
@@ -133,7 +132,6 @@ var React__default = /*#__PURE__*/_interopDefault(React);
|
|
|
133
132
|
var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
|
|
134
133
|
var _reverseInstanceProperty__default = /*#__PURE__*/_interopDefault(_reverseInstanceProperty);
|
|
135
134
|
var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
|
|
136
|
-
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
137
135
|
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
138
136
|
var classnames__default = /*#__PURE__*/_interopDefault(classnames);
|
|
139
137
|
var flowRight__default = /*#__PURE__*/_interopDefault(flowRight);
|
|
@@ -163,7 +161,6 @@ var isEmpty__default = /*#__PURE__*/_interopDefault(isEmpty$3);
|
|
|
163
161
|
var omit__default = /*#__PURE__*/_interopDefault(omit);
|
|
164
162
|
var _Object$freeze__default = /*#__PURE__*/_interopDefault(_Object$freeze);
|
|
165
163
|
var originalOmitDeep__default = /*#__PURE__*/_interopDefault(originalOmitDeep);
|
|
166
|
-
var _findIndexInstanceProperty__default = /*#__PURE__*/_interopDefault(_findIndexInstanceProperty);
|
|
167
164
|
var _parseInt__default = /*#__PURE__*/_interopDefault(_parseInt);
|
|
168
165
|
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
169
166
|
var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
|
|
@@ -185,12 +182,14 @@ var flatten__default = /*#__PURE__*/_interopDefault(flatten);
|
|
|
185
182
|
var uniqBy__default = /*#__PURE__*/_interopDefault(uniqBy);
|
|
186
183
|
var invariant__default = /*#__PURE__*/_interopDefault(invariant);
|
|
187
184
|
var hoistNonReactStatics__default = /*#__PURE__*/_interopDefault(hoistNonReactStatics);
|
|
185
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
188
186
|
var _Math$trunc__default = /*#__PURE__*/_interopDefault(_Math$trunc);
|
|
189
187
|
var _Number$isNaN__default = /*#__PURE__*/_interopDefault(_Number$isNaN);
|
|
190
188
|
var Cleave__default = /*#__PURE__*/_interopDefault(Cleave);
|
|
191
189
|
var isFinite__default = /*#__PURE__*/_interopDefault(isFinite);
|
|
192
190
|
var isUndefined__default = /*#__PURE__*/_interopDefault(isUndefined);
|
|
193
191
|
var _Object$assign__default = /*#__PURE__*/_interopDefault(_Object$assign);
|
|
192
|
+
var _findIndexInstanceProperty__default = /*#__PURE__*/_interopDefault(_findIndexInstanceProperty);
|
|
194
193
|
var flatMap__default = /*#__PURE__*/_interopDefault(flatMap);
|
|
195
194
|
var compact__default = /*#__PURE__*/_interopDefault(compact);
|
|
196
195
|
var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
@@ -281,9 +280,8 @@ function _objectSpread$1r(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
|
281
280
|
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 } } } };
|
|
282
281
|
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 } } } };
|
|
283
282
|
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 } } } };
|
|
284
|
-
const getRolesClause = roles => roles && roles.length > 0 ?
|
|
283
|
+
const getRolesClause = roles => roles && roles.length > 0 ? `roles contains any (${_mapInstanceProperty__default["default"](roles).call(roles, role => `"${role}"`).join(',')})` : undefined;
|
|
285
284
|
const ChannelPickerInput = _ref => {
|
|
286
|
-
var _currentOption$data$l, _currentOption$data;
|
|
287
285
|
let isClearable = _ref.isClearable,
|
|
288
286
|
isDisabled = _ref.isDisabled,
|
|
289
287
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -303,7 +301,7 @@ const ChannelPickerInput = _ref => {
|
|
|
303
301
|
const variables = React.useMemo(() => {
|
|
304
302
|
const rolesClause = getRolesClause(roles);
|
|
305
303
|
return _objectSpread$1r({
|
|
306
|
-
sortByNamePath:
|
|
304
|
+
sortByNamePath: `name.${dataLocale}`
|
|
307
305
|
}, rolesClause && {
|
|
308
306
|
extraWhere: rolesClause
|
|
309
307
|
});
|
|
@@ -324,7 +322,7 @@ const ChannelPickerInput = _ref => {
|
|
|
324
322
|
}
|
|
325
323
|
return channel;
|
|
326
324
|
}, [formatLocalizedFieldToString]);
|
|
327
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
325
|
+
const prefixSearchFields = React.useMemo(() => [`name.${dataLocale}`, 'key'], [dataLocale]);
|
|
328
326
|
const loadOptions = useLoadOptions({
|
|
329
327
|
query: GetChannelsQuery,
|
|
330
328
|
variables,
|
|
@@ -359,13 +357,13 @@ const ChannelPickerInput = _ref => {
|
|
|
359
357
|
setLoadingError(null);
|
|
360
358
|
handleInternalInputChange(event);
|
|
361
359
|
}, [handleInternalInputChange]);
|
|
362
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
360
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
363
361
|
React.useEffect(() => {
|
|
364
362
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
365
363
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
366
364
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
367
365
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$K.noChannelsFound), [loadingError, formatMessage]);
|
|
368
|
-
const tooltipTitle =
|
|
366
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
369
367
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
370
368
|
max: "scale",
|
|
371
369
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -375,7 +373,7 @@ const ChannelPickerInput = _ref => {
|
|
|
375
373
|
children: jsxRuntime.jsx(uiKit.AsyncSelectInput, {
|
|
376
374
|
id: name,
|
|
377
375
|
name: name,
|
|
378
|
-
placeholder: placeholder
|
|
376
|
+
placeholder: placeholder ?? formatMessage(messages$K.placeholder),
|
|
379
377
|
loadOptions: loadOptionsDebounced,
|
|
380
378
|
defaultOptions: true,
|
|
381
379
|
showOptionGroupDivider: true,
|
|
@@ -417,10 +415,9 @@ let FormattedDateTime = /*#__PURE__*/function (_PureComponent) {
|
|
|
417
415
|
value: function render() {
|
|
418
416
|
return jsxRuntime.jsx(applicationShellConnectors.ApplicationContext, {
|
|
419
417
|
render: _ref => {
|
|
420
|
-
var _this$props;
|
|
421
418
|
let user = _ref.user;
|
|
422
419
|
return formatDateTime$1(this.props.type, this.props.value, {
|
|
423
|
-
timeZone:
|
|
420
|
+
timeZone: this?.props?.timeZone || user?.timeZone,
|
|
424
421
|
locale: this.props.intl.locale
|
|
425
422
|
});
|
|
426
423
|
}
|
|
@@ -459,7 +456,6 @@ const convertProductTypeToOption = productType => {
|
|
|
459
456
|
};
|
|
460
457
|
};
|
|
461
458
|
const ProductTypePickerInput = _ref => {
|
|
462
|
-
var _currentOption$data$l, _currentOption$data;
|
|
463
459
|
let isClearable = _ref.isClearable,
|
|
464
460
|
isDisabled = _ref.isDisabled,
|
|
465
461
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -491,9 +487,8 @@ const ProductTypePickerInput = _ref => {
|
|
|
491
487
|
itemToOption: convertProductTypeToOption
|
|
492
488
|
});
|
|
493
489
|
const handleLoadOptions = React.useCallback(inputValue => loadProductTypes(inputValue).then(_ref3 => {
|
|
494
|
-
var _data$productTypes;
|
|
495
490
|
let data = _ref3.data;
|
|
496
|
-
return
|
|
491
|
+
return data.productTypes?.results || [];
|
|
497
492
|
}).then(productTypes => _mapInstanceProperty__default["default"](productTypes).call(productTypes, convertProductTypeToOption)).catch(error => {
|
|
498
493
|
setLoadingError(error);
|
|
499
494
|
onError(error);
|
|
@@ -507,12 +502,12 @@ const ProductTypePickerInput = _ref => {
|
|
|
507
502
|
setLoadingError(null);
|
|
508
503
|
handleInternalInputChange(event);
|
|
509
504
|
}, [handleInternalInputChange]);
|
|
510
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
505
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
511
506
|
React.useEffect(() => {
|
|
512
507
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
513
508
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
514
509
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
515
|
-
const tooltipTitle =
|
|
510
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
516
511
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
517
512
|
max: "scale",
|
|
518
513
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -566,7 +561,6 @@ var messages$I = reactIntl.defineMessages({
|
|
|
566
561
|
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 } } } };
|
|
567
562
|
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 } } } };
|
|
568
563
|
const StatePickerInput = _ref => {
|
|
569
|
-
var _currentOption$data$l, _currentOption$data;
|
|
570
564
|
let isClearable = _ref.isClearable,
|
|
571
565
|
isDisabled = _ref.isDisabled,
|
|
572
566
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -582,7 +576,7 @@ const StatePickerInput = _ref => {
|
|
|
582
576
|
formatMessage = _useIntl.formatMessage;
|
|
583
577
|
const dataLocale = applicationShellConnectors.useApplicationContext(applicationContext => applicationContext.dataLocale);
|
|
584
578
|
const variables = React.useMemo(() => ({
|
|
585
|
-
sortByNamePath:
|
|
579
|
+
sortByNamePath: `name.${dataLocale}`
|
|
586
580
|
}), [dataLocale]);
|
|
587
581
|
const convertStateToOption = React.useCallback(state => {
|
|
588
582
|
const localizedName = formatLocalizedFieldToString(state.nameAllLocales);
|
|
@@ -597,7 +591,7 @@ const StatePickerInput = _ref => {
|
|
|
597
591
|
_useState2 = _slicedToArray(_useState, 2),
|
|
598
592
|
loadingError = _useState2[0],
|
|
599
593
|
setLoadingError = _useState2[1];
|
|
600
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
594
|
+
const prefixSearchFields = React.useMemo(() => [`name.${dataLocale}`, 'key'], [dataLocale]);
|
|
601
595
|
const loadOptions = useLoadOptions({
|
|
602
596
|
query: GetStatesQuery,
|
|
603
597
|
variables,
|
|
@@ -630,13 +624,13 @@ const StatePickerInput = _ref => {
|
|
|
630
624
|
setLoadingError(null);
|
|
631
625
|
handleInternalInputChange(event);
|
|
632
626
|
}, [handleInternalInputChange]);
|
|
633
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
627
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
634
628
|
React.useEffect(() => {
|
|
635
629
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
636
630
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
637
631
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
638
632
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$I.noStatesFound), [loadingError, formatMessage]);
|
|
639
|
-
const tooltipTitle =
|
|
633
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
640
634
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
641
635
|
max: "scale",
|
|
642
636
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -750,10 +744,9 @@ const useHandlers = onChange => {
|
|
|
750
744
|
setInputValue(changedValue);
|
|
751
745
|
}, []);
|
|
752
746
|
const handleChange = useEventCallback(event => {
|
|
753
|
-
var _event$target$value;
|
|
754
747
|
const eventWithExtractedValue = _objectSpread$1o(_objectSpread$1o({}, event), {}, {
|
|
755
748
|
target: _objectSpread$1o(_objectSpread$1o({}, event.target), {}, {
|
|
756
|
-
value:
|
|
749
|
+
value: event.target.value?.value
|
|
757
750
|
})
|
|
758
751
|
});
|
|
759
752
|
onChange(eventWithExtractedValue);
|
|
@@ -763,24 +756,21 @@ const useHandlers = onChange => {
|
|
|
763
756
|
|
|
764
757
|
const _excluded$3 = ["extraWhere"];
|
|
765
758
|
function ownKeys$1n(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
766
|
-
function _objectSpread$1n(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
759
|
+
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__default["default"](_context2 = ownKeys$1n(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$1n(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
767
760
|
const constructPrefixSearchPredicate$1 = function () {
|
|
768
761
|
let prefixSearchFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
769
762
|
let lowerBound = arguments.length > 1 ? arguments[1] : undefined;
|
|
770
763
|
let upperBound = arguments.length > 2 ? arguments[2] : undefined;
|
|
771
764
|
const constructPrefixSearchExpression = field => {
|
|
772
|
-
var _context
|
|
765
|
+
var _context;
|
|
773
766
|
const path = field.split('.');
|
|
774
767
|
const _path$slice$reverse = _reverseInstanceProperty__default["default"](_context = _sliceInstanceProperty__default["default"](path).call(path)).call(_context),
|
|
775
768
|
_path$slice$reverse2 = _toArray(_path$slice$reverse),
|
|
776
769
|
finalValueInPath = _path$slice$reverse2[0],
|
|
777
770
|
remainPathInReverse = _sliceInstanceProperty__default["default"](_path$slice$reverse2).call(_path$slice$reverse2, 1);
|
|
778
|
-
const comparison =
|
|
771
|
+
const comparison = `${finalValueInPath} >= "${lowerBound}" and ${finalValueInPath} < "${upperBound}"`;
|
|
779
772
|
if (remainPathInReverse.length) {
|
|
780
|
-
return _reduceInstanceProperty__default["default"](remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) => {
|
|
781
|
-
var _context5;
|
|
782
|
-
return _concatInstanceProperty__default["default"](_context5 = "".concat(nextPath, "(")).call(_context5, nestedPath, ")");
|
|
783
|
-
}, comparison);
|
|
773
|
+
return _reduceInstanceProperty__default["default"](remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) => `${nextPath}(${nestedPath})`, comparison);
|
|
784
774
|
}
|
|
785
775
|
return comparison;
|
|
786
776
|
};
|
|
@@ -796,7 +786,7 @@ const useLoadOptions = _ref => {
|
|
|
796
786
|
let where;
|
|
797
787
|
if (inputValue.length) {
|
|
798
788
|
if (isUUID(inputValue)) {
|
|
799
|
-
where =
|
|
789
|
+
where = `id = "${inputValue}"`;
|
|
800
790
|
} else {
|
|
801
791
|
const _getPrefixSearchBound = getPrefixSearchBounds(inputValue),
|
|
802
792
|
_getPrefixSearchBound2 = _slicedToArray(_getPrefixSearchBound, 2),
|
|
@@ -805,12 +795,11 @@ const useLoadOptions = _ref => {
|
|
|
805
795
|
where = constructPrefixSearchPredicate$1(prefixSearchFields, lowerBound, upperBound);
|
|
806
796
|
}
|
|
807
797
|
}
|
|
808
|
-
const _ref2 = variables
|
|
798
|
+
const _ref2 = variables ?? {},
|
|
809
799
|
extraWhere = _ref2.extraWhere,
|
|
810
800
|
restVariables = _objectWithoutProperties(_ref2, _excluded$3);
|
|
811
801
|
if (typeof extraWhere === 'string') {
|
|
812
|
-
|
|
813
|
-
where = where ? _concatInstanceProperty__default["default"](_context6 = "(".concat(where, ") and ")).call(_context6, variables.extraWhere) : variables.extraWhere;
|
|
802
|
+
where = where ? `(${where}) and ${variables.extraWhere}` : variables.extraWhere;
|
|
814
803
|
}
|
|
815
804
|
return client$1.query({
|
|
816
805
|
query,
|
|
@@ -840,12 +829,12 @@ const useExecuteGraphQLRequest = () => {
|
|
|
840
829
|
};
|
|
841
830
|
const createSearchProductsFromPIMAction = (searchTerm, projectKey) => sdk.actions.post({
|
|
842
831
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.PIM_SEARCH,
|
|
843
|
-
uri:
|
|
832
|
+
uri: `/${projectKey}/search/product-types`,
|
|
844
833
|
payload: {
|
|
845
834
|
query: {
|
|
846
835
|
wildcard: {
|
|
847
836
|
field: 'name',
|
|
848
|
-
value:
|
|
837
|
+
value: `*${searchTerm}*`,
|
|
849
838
|
caseInsensitive: true
|
|
850
839
|
}
|
|
851
840
|
},
|
|
@@ -859,9 +848,8 @@ const useFetchProductTypesFromPIM = _ref => {
|
|
|
859
848
|
const dispatch = sdk.useAsyncDispatch();
|
|
860
849
|
const executeGraphQLRequest = useExecuteGraphQLRequest();
|
|
861
850
|
const fetchProductTypesFromPim = React.useCallback(async searchTerm => {
|
|
862
|
-
var _result$hits$map, _result$hits;
|
|
863
851
|
const result = await dispatch(createSearchProductsFromPIMAction(searchTerm, projectKey));
|
|
864
|
-
const ids =
|
|
852
|
+
const ids = result?.hits?.map(hit => hit.id) ?? [];
|
|
865
853
|
// Avoid sending any requests if it's clear that nothing is found
|
|
866
854
|
if (ids.length === 0) {
|
|
867
855
|
return {
|
|
@@ -896,22 +884,19 @@ const useFetchProductTypesFromPIM = _ref => {
|
|
|
896
884
|
*/
|
|
897
885
|
const constructNestedExpression = (reversedPath, predicate) => {
|
|
898
886
|
if (reversedPath.length > 0) {
|
|
899
|
-
return _reduceInstanceProperty__default["default"](reversedPath).call(reversedPath, (nextNestedValue, nestedSelection) => {
|
|
900
|
-
var _context;
|
|
901
|
-
return _concatInstanceProperty__default["default"](_context = "".concat(nestedSelection, "(")).call(_context, nextNestedValue, ")");
|
|
902
|
-
}, predicate);
|
|
887
|
+
return _reduceInstanceProperty__default["default"](reversedPath).call(reversedPath, (nextNestedValue, nestedSelection) => `${nestedSelection}(${nextNestedValue})`, predicate);
|
|
903
888
|
}
|
|
904
889
|
return predicate;
|
|
905
890
|
};
|
|
906
891
|
const constructPrefixSearchPredicate = (prefixSearchFields, lowerBound, upperBound) => {
|
|
907
892
|
const constructPrefixSearchExpression = field => {
|
|
908
|
-
var
|
|
893
|
+
var _context;
|
|
909
894
|
const parts = field.split('.');
|
|
910
|
-
const _parts$slice$reverse = _reverseInstanceProperty__default["default"](
|
|
895
|
+
const _parts$slice$reverse = _reverseInstanceProperty__default["default"](_context = _sliceInstanceProperty__default["default"](parts).call(parts)).call(_context),
|
|
911
896
|
_parts$slice$reverse2 = _toArray(_parts$slice$reverse),
|
|
912
897
|
valueToNest = _parts$slice$reverse2[0],
|
|
913
898
|
reversedPathToNestedValue = _sliceInstanceProperty__default["default"](_parts$slice$reverse2).call(_parts$slice$reverse2, 1);
|
|
914
|
-
const predicateExpression =
|
|
899
|
+
const predicateExpression = `${valueToNest} >= "${lowerBound}" and ${valueToNest} < "${upperBound}"`;
|
|
915
900
|
return constructNestedExpression(reversedPathToNestedValue, predicateExpression);
|
|
916
901
|
};
|
|
917
902
|
return _mapInstanceProperty__default["default"](prefixSearchFields).call(prefixSearchFields, constructPrefixSearchExpression).join(' or ');
|
|
@@ -919,7 +904,7 @@ const constructPrefixSearchPredicate = (prefixSearchFields, lowerBound, upperBou
|
|
|
919
904
|
const constructWherePredicate = (inputValue, prefixSearchFields) => {
|
|
920
905
|
const wherePredicate = function () {
|
|
921
906
|
if (inputValue.length) {
|
|
922
|
-
if (isUUID(inputValue)) return
|
|
907
|
+
if (isUUID(inputValue)) return `id = "${inputValue}"`;else {
|
|
923
908
|
const _getPrefixSearchBound = getPrefixSearchBounds(inputValue),
|
|
924
909
|
_getPrefixSearchBound2 = _slicedToArray(_getPrefixSearchBound, 2),
|
|
925
910
|
lowerBound = _getPrefixSearchBound2[0],
|
|
@@ -944,7 +929,6 @@ const useFetchProductTypessFromCTP = _ref2 => {
|
|
|
944
929
|
}, [prefixSearchFields, executeGraphQLRequest]);
|
|
945
930
|
};
|
|
946
931
|
const usePimStatus = () => {
|
|
947
|
-
var _data$indicesExist;
|
|
948
932
|
const _useQuery = react.useQuery(FetchIndicesExist$1, {
|
|
949
933
|
context: {
|
|
950
934
|
target: constants.GRAPHQL_TARGETS.PIM_INDEXER
|
|
@@ -954,20 +938,17 @@ const usePimStatus = () => {
|
|
|
954
938
|
data = _useQuery.data;
|
|
955
939
|
return {
|
|
956
940
|
data,
|
|
957
|
-
isProjectIndexed: Boolean(data
|
|
941
|
+
isProjectIndexed: Boolean(data?.indicesExist?.productTypes?.searchableIndexExists)
|
|
958
942
|
};
|
|
959
943
|
};
|
|
960
944
|
const useProductTypeOptions = _ref3 => {
|
|
961
945
|
let prefixSearchFields = _ref3.prefixSearchFields;
|
|
962
946
|
const _usePimStatus = usePimStatus(),
|
|
963
947
|
isProjectIndexed = _usePimStatus.isProjectIndexed;
|
|
964
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => {
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key
|
|
969
|
-
};
|
|
970
|
-
}),
|
|
948
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
949
|
+
dataLocale: context.dataLocale,
|
|
950
|
+
projectKey: context.project?.key
|
|
951
|
+
})),
|
|
971
952
|
dataLocale = _useApplicationContex.dataLocale,
|
|
972
953
|
projectKey = _useApplicationContex.projectKey;
|
|
973
954
|
const fetchProductTypesFromPim = useFetchProductTypesFromPIM({
|
|
@@ -984,7 +965,6 @@ const useProductTypeOptions = _ref3 => {
|
|
|
984
965
|
};
|
|
985
966
|
|
|
986
967
|
function useCurrentOption(_ref) {
|
|
987
|
-
var _context;
|
|
988
968
|
let id = _ref.id,
|
|
989
969
|
typename = _ref.typename,
|
|
990
970
|
query = _ref.query,
|
|
@@ -996,7 +976,7 @@ function useCurrentOption(_ref) {
|
|
|
996
976
|
// load from cache when possible to speed up initial render
|
|
997
977
|
const canReadFromCache = id && typename && fragment;
|
|
998
978
|
const cacheItem = canReadFromCache ? apolloClient.readFragment({
|
|
999
|
-
id:
|
|
979
|
+
id: `${typename}:${id}`,
|
|
1000
980
|
fragment
|
|
1001
981
|
}) : undefined;
|
|
1002
982
|
|
|
@@ -1014,7 +994,7 @@ function useCurrentOption(_ref) {
|
|
|
1014
994
|
queryData = _useQuery.data,
|
|
1015
995
|
queryError = _useQuery.error;
|
|
1016
996
|
const queryItem = queryData && queryDataToItem(queryData);
|
|
1017
|
-
const item = queryItem
|
|
997
|
+
const item = queryItem ?? cacheItem;
|
|
1018
998
|
const loading = item ? false : queryLoading;
|
|
1019
999
|
const error = item ? undefined : queryError;
|
|
1020
1000
|
const data = item && itemToOption(item);
|
|
@@ -1043,10 +1023,7 @@ const setDisplayName = nextDisplayName => Component => {
|
|
|
1043
1023
|
|
|
1044
1024
|
const keepDisplayName = component => setDisplayName(getDisplayName(component));
|
|
1045
1025
|
|
|
1046
|
-
const wrapDisplayName = (BaseComponent, hocName) => {
|
|
1047
|
-
var _context;
|
|
1048
|
-
return _concatInstanceProperty__default["default"](_context = "".concat(hocName, "(")).call(_context, getDisplayName(BaseComponent), ")");
|
|
1049
|
-
};
|
|
1026
|
+
const wrapDisplayName = (BaseComponent, hocName) => `${hocName}(${getDisplayName(BaseComponent)})`;
|
|
1050
1027
|
|
|
1051
1028
|
function ownKeys$1m(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1052
1029
|
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__default["default"](_context = ownKeys$1m(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$1m(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
@@ -1161,7 +1138,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
1161
1138
|
};
|
|
1162
1139
|
_this.doDelayedUpdate = (updateFunction, event, eventType) => {
|
|
1163
1140
|
const self = _this;
|
|
1164
|
-
const timeoutKey =
|
|
1141
|
+
const timeoutKey = `${eventType}Timeout`;
|
|
1165
1142
|
// TODO: can't we just use one variable?
|
|
1166
1143
|
clearTimeout(_this[timeoutKey]);
|
|
1167
1144
|
_this[timeoutKey] = _setTimeout__default["default"](() => {
|
|
@@ -1192,7 +1169,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
1192
1169
|
}, this.props.onEnter ? {
|
|
1193
1170
|
onKeyDown: this.handleEnter
|
|
1194
1171
|
} : {}), filterDataAttributes(this.props));
|
|
1195
|
-
const inputId =
|
|
1172
|
+
const inputId = `throttled-field-${this.props.name}`;
|
|
1196
1173
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1197
1174
|
children: [jsxRuntime.jsx(uiKit.AccessibleHidden, {
|
|
1198
1175
|
children: jsxRuntime.jsx("label", {
|
|
@@ -1201,7 +1178,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
1201
1178
|
})
|
|
1202
1179
|
}), this.props.as === 'textarea' ? jsxRuntime.jsx(Textarea__default["default"], _objectSpread$1l(_objectSpread$1l({}, commonProps), {}, {
|
|
1203
1180
|
id: inputId,
|
|
1204
|
-
className: classnames__default["default"](styles$i.textarea, styles$i[
|
|
1181
|
+
className: classnames__default["default"](styles$i.textarea, styles$i[`textarea-${this.props.style}`], {
|
|
1205
1182
|
[styles$i.invalid]: !this.props.isValid,
|
|
1206
1183
|
[styles$i.disabled]: this.props.disabled
|
|
1207
1184
|
}),
|
|
@@ -1212,7 +1189,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
1212
1189
|
id: inputId,
|
|
1213
1190
|
ref: this.props.inputRef,
|
|
1214
1191
|
type: this.props.as,
|
|
1215
|
-
className: classnames__default["default"](styles$i[
|
|
1192
|
+
className: classnames__default["default"](styles$i[`input-${this.props.style}`], {
|
|
1216
1193
|
[styles$i.invalid]: !this.props.isValid,
|
|
1217
1194
|
[styles$i.disabled]: this.props.disabled,
|
|
1218
1195
|
[styles$i.granular]: this.props.isGranular
|
|
@@ -1309,8 +1286,7 @@ let SearchInput = /*#__PURE__*/function (_Component) {
|
|
|
1309
1286
|
});
|
|
1310
1287
|
};
|
|
1311
1288
|
_this.handleClear = () => {
|
|
1312
|
-
|
|
1313
|
-
(_this$inputRef = _this.inputRef) === null || _this$inputRef === void 0 || _this$inputRef.focus();
|
|
1289
|
+
_this.inputRef?.focus();
|
|
1314
1290
|
_this.props.onChange(null);
|
|
1315
1291
|
_this.props.onReset();
|
|
1316
1292
|
_this.setState({
|
|
@@ -1412,16 +1388,15 @@ function ownKeys$1k(e, r) { var t = _Object$keys__default["default"](e); if (_Ob
|
|
|
1412
1388
|
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__default["default"](_context = ownKeys$1k(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$1k(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1413
1389
|
const injectDataTablePaginationState = initialValues => Component => {
|
|
1414
1390
|
const WithDataTablePaginationState = props => {
|
|
1415
|
-
var _initialValues$tableS, _initialValues$tableS2;
|
|
1416
1391
|
const _usePaginationState = uiKit.usePaginationState({
|
|
1417
|
-
page: initialValues
|
|
1418
|
-
perPage: initialValues
|
|
1392
|
+
page: initialValues?.page,
|
|
1393
|
+
perPage: initialValues?.perPage
|
|
1419
1394
|
}),
|
|
1420
1395
|
page = _usePaginationState.page,
|
|
1421
1396
|
perPage = _usePaginationState.perPage;
|
|
1422
1397
|
const tableSorting = uiKit.useDataTableSortingState({
|
|
1423
|
-
key: initialValues
|
|
1424
|
-
order: initialValues
|
|
1398
|
+
key: initialValues?.tableSorting?.key,
|
|
1399
|
+
order: initialValues?.tableSorting?.order
|
|
1425
1400
|
});
|
|
1426
1401
|
return jsxRuntime.jsx(Component, _objectSpread$1k(_objectSpread$1k({}, props), {}, {
|
|
1427
1402
|
dataTablePaginationState: {
|
|
@@ -1455,7 +1430,7 @@ const injectNotifications = function () {
|
|
|
1455
1430
|
[propName]: notifications
|
|
1456
1431
|
}));
|
|
1457
1432
|
};
|
|
1458
|
-
WrappedComponent.displayName =
|
|
1433
|
+
WrappedComponent.displayName = `withNotifications(${getDisplayName(Component)}`;
|
|
1459
1434
|
return WrappedComponent;
|
|
1460
1435
|
};
|
|
1461
1436
|
};
|
|
@@ -1564,10 +1539,7 @@ const isNil = value => typeof value === 'undefined' || value === null;
|
|
|
1564
1539
|
const useStorage = (storageKey, initialStorageValue, options) => {
|
|
1565
1540
|
var _context;
|
|
1566
1541
|
const mergedOptions = _objectSpread$1e(_objectSpread$1e({}, defaultOptions$2), options);
|
|
1567
|
-
const userId = applicationShellConnectors.useApplicationContext(context =>
|
|
1568
|
-
var _context$user;
|
|
1569
|
-
return (_context$user = context.user) === null || _context$user === void 0 ? void 0 : _context$user.id;
|
|
1570
|
-
});
|
|
1542
|
+
const userId = applicationShellConnectors.useApplicationContext(context => context.user?.id);
|
|
1571
1543
|
const scopedStorageKey = _filterInstanceProperty__default["default"](_context = [mergedOptions.segregateByUser && userId, storageKey]).call(_context, Boolean).join('/');
|
|
1572
1544
|
const readFromStorage = React.useCallback(() => {
|
|
1573
1545
|
const rawStorageValue = getStorage(mergedOptions.storageType).getItem(scopedStorageKey);
|
|
@@ -1586,9 +1558,8 @@ const useStorage = (storageKey, initialStorageValue, options) => {
|
|
|
1586
1558
|
return parsedStorageValue;
|
|
1587
1559
|
}, [mergedOptions.storageType, scopedStorageKey]);
|
|
1588
1560
|
const initializeStorageValue = () => {
|
|
1589
|
-
var _ref, _readFromStorage;
|
|
1590
1561
|
// default the storage value to the initial provided value when provided
|
|
1591
|
-
return
|
|
1562
|
+
return readFromStorage() ?? initialStorageValue ?? null;
|
|
1592
1563
|
};
|
|
1593
1564
|
const _useState = React.useState(initializeStorageValue),
|
|
1594
1565
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -1676,7 +1647,7 @@ function useFormatLocalizedFieldToString() {
|
|
|
1676
1647
|
}
|
|
1677
1648
|
|
|
1678
1649
|
function ownKeys$1c(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1679
|
-
function _objectSpread$1c(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
1650
|
+
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__default["default"](_context = ownKeys$1c(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$1c(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1680
1651
|
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 } } } };
|
|
1681
1652
|
const MC_RESOURCES_WITH_KEYS = {
|
|
1682
1653
|
ASSOCIATE_ROLE: 'ASSOCIATE_ROLE',
|
|
@@ -1753,14 +1724,13 @@ const getSkipVariables = resourceType => {
|
|
|
1753
1724
|
});
|
|
1754
1725
|
};
|
|
1755
1726
|
const getWhereClause$1 = function () {
|
|
1756
|
-
var _context, _context2, _context3;
|
|
1757
1727
|
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1758
1728
|
field = _ref.field,
|
|
1759
1729
|
fieldValue = _ref.fieldValue,
|
|
1760
1730
|
id = _ref.id;
|
|
1761
1731
|
if (!id && !fieldValue) return null;
|
|
1762
|
-
if (!id) return
|
|
1763
|
-
return
|
|
1732
|
+
if (!id) return `${field} = "${fieldValue}"`;
|
|
1733
|
+
return `${field} = "${fieldValue}" and id != "${id}"`;
|
|
1764
1734
|
};
|
|
1765
1735
|
const getQueryVariables = _ref2 => {
|
|
1766
1736
|
let resourceType = _ref2.resourceType,
|
|
@@ -1779,7 +1749,6 @@ const getQueryVariables = _ref2 => {
|
|
|
1779
1749
|
}, skipVariables);
|
|
1780
1750
|
};
|
|
1781
1751
|
const useIsFieldDuplicated = () => {
|
|
1782
|
-
var _Object$values$;
|
|
1783
1752
|
const _useLazyQuery = hooks.useLazyQuery(FetchResourceTypeDuplicatedField, {
|
|
1784
1753
|
context: {
|
|
1785
1754
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -1794,7 +1763,7 @@ const useIsFieldDuplicated = () => {
|
|
|
1794
1763
|
return {
|
|
1795
1764
|
getQueryVariables,
|
|
1796
1765
|
isLoading: loading,
|
|
1797
|
-
isFieldDuplicated: data ?
|
|
1766
|
+
isFieldDuplicated: data ? _Object$values__default["default"](data)[0]?.total > 0 : null,
|
|
1798
1767
|
queryIsFieldDuplicated: execute
|
|
1799
1768
|
};
|
|
1800
1769
|
};
|
|
@@ -1847,16 +1816,14 @@ function ownKeys$1b(e, r) { var t = _Object$keys__default["default"](e); if (_Ob
|
|
|
1847
1816
|
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__default["default"](_context2 = ownKeys$1b(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$1b(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1848
1817
|
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 } } } };
|
|
1849
1818
|
const filterStoresOutdatedDanglingProductSelections = storesQueryResult => {
|
|
1850
|
-
var _storesQueryResult$re;
|
|
1851
1819
|
if (!storesQueryResult) return null;
|
|
1852
1820
|
return {
|
|
1853
1821
|
total: storesQueryResult.total,
|
|
1854
1822
|
count: storesQueryResult.count,
|
|
1855
1823
|
offset: storesQueryResult.offset,
|
|
1856
|
-
results:
|
|
1857
|
-
var _store$productSelecti;
|
|
1824
|
+
results: storesQueryResult.results?.map(store => {
|
|
1858
1825
|
return _objectSpread$1b(_objectSpread$1b({}, store), {}, {
|
|
1859
|
-
productSelections:
|
|
1826
|
+
productSelections: store.productSelections?.filter(productSelectionRef => Boolean(productSelectionRef.productSelection))
|
|
1860
1827
|
});
|
|
1861
1828
|
})
|
|
1862
1829
|
};
|
|
@@ -1868,7 +1835,7 @@ const createQueryVariables$6 = ownProps => {
|
|
|
1868
1835
|
offset: ownProps.offset,
|
|
1869
1836
|
sort: _sortInstanceProperty__default["default"](ownProps)
|
|
1870
1837
|
}, Boolean(ownProps.stores) && {
|
|
1871
|
-
where:
|
|
1838
|
+
where: `key in (${_mapInstanceProperty__default["default"](_context = ownProps.stores).call(_context, store => `"${store}"`).join(', ')})`
|
|
1872
1839
|
}), {}, {
|
|
1873
1840
|
excludeExtendedStoresList: ownProps.excludeExtendedStoresList,
|
|
1874
1841
|
excludeProductSelections: ownProps.excludeProductSelections
|
|
@@ -1893,10 +1860,7 @@ const useStoresListFetcher = props => {
|
|
|
1893
1860
|
projectKey: props.projectKey
|
|
1894
1861
|
},
|
|
1895
1862
|
fetchPolicy: 'network-only',
|
|
1896
|
-
onError: graphqlErrorResponse =>
|
|
1897
|
-
var _props$onError;
|
|
1898
|
-
return (_props$onError = props.onError) === null || _props$onError === void 0 ? void 0 : _props$onError.call(props, graphqlErrorResponse);
|
|
1899
|
-
}
|
|
1863
|
+
onError: graphqlErrorResponse => props.onError?.(graphqlErrorResponse)
|
|
1900
1864
|
}),
|
|
1901
1865
|
data = _useQuery.data,
|
|
1902
1866
|
refetch = _useQuery.refetch,
|
|
@@ -1904,7 +1868,7 @@ const useStoresListFetcher = props => {
|
|
|
1904
1868
|
return {
|
|
1905
1869
|
isLoading: loading,
|
|
1906
1870
|
refetch,
|
|
1907
|
-
stores: filterStoresOutdatedDanglingProductSelections(data
|
|
1871
|
+
stores: filterStoresOutdatedDanglingProductSelections(data?.stores),
|
|
1908
1872
|
refetchQuery: {
|
|
1909
1873
|
query: FetchStoresQuery,
|
|
1910
1874
|
variables: queryVariables,
|
|
@@ -1968,18 +1932,13 @@ const handlers$5 = {
|
|
|
1968
1932
|
}
|
|
1969
1933
|
};
|
|
1970
1934
|
|
|
1971
|
-
const toPermission = (permission, resourceName) => {
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
}
|
|
1975
|
-
const
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
var _context2;
|
|
1979
|
-
return (// e.g applicationContext.dataFences?.store?.orders?.canViewOrders?.values
|
|
1980
|
-
_concatInstanceProperty__default["default"](_context2 = "dataFences.store.".concat(resourceName, ".")).call(_context2, permission, ".values")
|
|
1981
|
-
);
|
|
1982
|
-
};
|
|
1935
|
+
const toPermission = (permission, resourceName) => camelCase__default["default"](`can ${permission} ${resourceName}`);
|
|
1936
|
+
const createPermissionsComposePath = permission =>
|
|
1937
|
+
// e.g applicationContext.permissions?.canViewOrders
|
|
1938
|
+
`permissions.${permission}`;
|
|
1939
|
+
const createDataFencesComposePath = resourceName => permission =>
|
|
1940
|
+
// e.g applicationContext.dataFences?.store?.orders?.canViewOrders?.values
|
|
1941
|
+
`dataFences.store.${resourceName}.${permission}.values`;
|
|
1983
1942
|
const useStoreKeysInDataFences = _ref => {
|
|
1984
1943
|
let resourceName = _ref.resourceName,
|
|
1985
1944
|
_ref$permission = _ref.permission,
|
|
@@ -2387,7 +2346,7 @@ const usePersistedTableConfiguration = props => {
|
|
|
2387
2346
|
* Therefore, if it will be missing from the local storage and hence we use the [] as default.
|
|
2388
2347
|
*/
|
|
2389
2348
|
const getVisibleColumns = React.useCallback(() => {
|
|
2390
|
-
if (cachedVisibleTableConfiguration
|
|
2349
|
+
if (cachedVisibleTableConfiguration?.columnsConfig) {
|
|
2391
2350
|
return retrieveColumnsWithCachedConfiguration({
|
|
2392
2351
|
allAvailableColumnsConfiguration,
|
|
2393
2352
|
cachedVisibleTableConfiguration: cachedVisibleTableConfiguration.columnsConfig,
|
|
@@ -2401,8 +2360,8 @@ const usePersistedTableConfiguration = props => {
|
|
|
2401
2360
|
return {
|
|
2402
2361
|
visibleColumns,
|
|
2403
2362
|
visibleColumnKeys,
|
|
2404
|
-
cachedVisibleColumnsConfiguration: cachedVisibleTableConfiguration
|
|
2405
|
-
cachedDisplaySettings: cachedVisibleTableConfiguration
|
|
2363
|
+
cachedVisibleColumnsConfiguration: cachedVisibleTableConfiguration?.columnsConfig,
|
|
2364
|
+
cachedDisplaySettings: cachedVisibleTableConfiguration?.displaySettings,
|
|
2406
2365
|
handleCachedTableConfigurationUpdate: update => handleCacheUpdate({
|
|
2407
2366
|
update,
|
|
2408
2367
|
cachedVisibleTableConfiguration,
|
|
@@ -2413,7 +2372,6 @@ const usePersistedTableConfiguration = props => {
|
|
|
2413
2372
|
|
|
2414
2373
|
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 } } } };
|
|
2415
2374
|
const useProductSelectionsTotalFetcher = props => {
|
|
2416
|
-
var _data$productSelectio;
|
|
2417
2375
|
const _useQuery = hooks.useQuery(FetchProductSelectionsTotal, {
|
|
2418
2376
|
context: {
|
|
2419
2377
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -2423,7 +2381,7 @@ const useProductSelectionsTotalFetcher = props => {
|
|
|
2423
2381
|
data = _useQuery.data;
|
|
2424
2382
|
return {
|
|
2425
2383
|
isLoading: loading,
|
|
2426
|
-
total: data
|
|
2384
|
+
total: data?.productSelections?.total
|
|
2427
2385
|
};
|
|
2428
2386
|
};
|
|
2429
2387
|
|
|
@@ -2444,7 +2402,7 @@ function _objectSpread$17(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
|
2444
2402
|
// eslint-disable-next-line import/prefer-default-export
|
|
2445
2403
|
const convertProductSelectionsFromGraphQl = productSelections => {
|
|
2446
2404
|
var _context;
|
|
2447
|
-
return
|
|
2405
|
+
return productSelections?.results && _objectSpread$17(_objectSpread$17({}, productSelections), {}, {
|
|
2448
2406
|
results: _mapInstanceProperty__default["default"](_context = productSelections.results).call(_context, productSelection => _objectSpread$17({}, l10n.applyTransformedLocalizedFields(productSelection, [{
|
|
2449
2407
|
from: 'nameAllLocales',
|
|
2450
2408
|
to: 'name'
|
|
@@ -2481,7 +2439,7 @@ const useProductSelectionsFetcher = props => {
|
|
|
2481
2439
|
refetch = _useQuery.refetch;
|
|
2482
2440
|
return {
|
|
2483
2441
|
isLoading: loading,
|
|
2484
|
-
productSelections: convertProductSelectionsFromGraphQl(data
|
|
2442
|
+
productSelections: convertProductSelectionsFromGraphQl(data?.productSelections) || emptyProductSelections,
|
|
2485
2443
|
refetch
|
|
2486
2444
|
};
|
|
2487
2445
|
};
|
|
@@ -2496,7 +2454,7 @@ const handlers$3 = {
|
|
|
2496
2454
|
|
|
2497
2455
|
const setToArray = function () {
|
|
2498
2456
|
let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
2499
|
-
return
|
|
2457
|
+
return `id in (${_mapInstanceProperty__default["default"](values).call(values, value => `"${value}"`).join(', ')})`;
|
|
2500
2458
|
};
|
|
2501
2459
|
|
|
2502
2460
|
function capitalizeFirst(text) {
|
|
@@ -2564,7 +2522,6 @@ function validateSingleFilter(_ref) {
|
|
|
2564
2522
|
return _includesInstanceProperty__default["default"](invalidValues).call(invalidValues, value);
|
|
2565
2523
|
}
|
|
2566
2524
|
|
|
2567
|
-
var _templateObject$4, _templateObject2$2;
|
|
2568
2525
|
const dateFormatDayStart$1 = 'YYYY-MM-DDT00:00:00.000';
|
|
2569
2526
|
const dateFormatDayEnd$1 = 'YYYY-MM-DDT23:59:59.999';
|
|
2570
2527
|
const getDateTimeInUTC = (date, timezone, format) => {
|
|
@@ -2574,8 +2531,7 @@ const getDateTimeInUTC = (date, timezone, format) => {
|
|
|
2574
2531
|
const noTimeSpecified = momentDate.hours() === 0 && momentDate.minutes() === 0 && momentDate.seconds() === 0;
|
|
2575
2532
|
// if it's a date then convert it to UTC datetime based on timezone
|
|
2576
2533
|
if (noTimeSpecified) {
|
|
2577
|
-
|
|
2578
|
-
const offset = ((_moment$tz = moment__default["default"](date).tz(timezone)) === null || _moment$tz === void 0 ? void 0 : _moment$tz.utcOffset()) || 0;
|
|
2534
|
+
const offset = moment__default["default"](date).tz(timezone)?.utcOffset() || 0;
|
|
2579
2535
|
const formattedDate = momentDate.format(format);
|
|
2580
2536
|
const formattedDateWithOffset = moment__default["default"](formattedDate).add(offset, 'minutes').format(dateFormat);
|
|
2581
2537
|
// console.log(formattedDateWithOffset);
|
|
@@ -2588,7 +2544,6 @@ const getDateTimeInUTC = (date, timezone, format) => {
|
|
|
2588
2544
|
function dateTransformer$1(filterKey, filters) {
|
|
2589
2545
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator$1;
|
|
2590
2546
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
2591
|
-
var _context, _context2;
|
|
2592
2547
|
let type = _ref.type,
|
|
2593
2548
|
value = _ref.value,
|
|
2594
2549
|
timezone = _ref.timezone;
|
|
@@ -2598,13 +2553,19 @@ function dateTransformer$1(filterKey, filters) {
|
|
|
2598
2553
|
})) return '';
|
|
2599
2554
|
switch (type) {
|
|
2600
2555
|
case FILTER_TYPES.lessThan:
|
|
2601
|
-
return
|
|
2556
|
+
return `${filterKey} < "${getDateTimeInUTC(value, timezone, dateFormatDayStart$1)}"`;
|
|
2602
2557
|
case FILTER_TYPES.moreThan:
|
|
2603
|
-
return
|
|
2558
|
+
return `${filterKey} > "${getDateTimeInUTC(value, timezone, dateFormatDayEnd$1)}"`;
|
|
2604
2559
|
case FILTER_TYPES.equalTo:
|
|
2605
|
-
return oneLine__default["default"]
|
|
2560
|
+
return oneLine__default["default"]`
|
|
2561
|
+
(${filterKey} >= "${getDateTimeInUTC(value, timezone, dateFormatDayStart$1)}"
|
|
2562
|
+
and ${filterKey} <= "${getDateTimeInUTC(value, timezone, dateFormatDayEnd$1)}")
|
|
2563
|
+
`;
|
|
2606
2564
|
case FILTER_TYPES.range:
|
|
2607
|
-
return oneLine__default["default"]
|
|
2565
|
+
return oneLine__default["default"]`
|
|
2566
|
+
(${filterKey} >= "${getDateTimeInUTC(value.from, timezone, dateFormatDayStart$1)}"
|
|
2567
|
+
and ${filterKey} <= "${getDateTimeInUTC(value.to, timezone, dateFormatDayEnd$1)}")
|
|
2568
|
+
`;
|
|
2608
2569
|
default:
|
|
2609
2570
|
return '';
|
|
2610
2571
|
}
|
|
@@ -2620,7 +2581,7 @@ function dateTransformer$1(filterKey, filters) {
|
|
|
2620
2581
|
* (createdAt >= "2018-02-15T00:00:00.000+01:00" and createdAt <= "2018-02-15T23:59:59.999+01:00")
|
|
2621
2582
|
* ) or some_more_filters
|
|
2622
2583
|
*/
|
|
2623
|
-
return queryString === '' ? null :
|
|
2584
|
+
return queryString === '' ? null : `(${queryString})`;
|
|
2624
2585
|
}
|
|
2625
2586
|
function defaultFilterValidator$1(_ref2) {
|
|
2626
2587
|
let type = _ref2.type,
|
|
@@ -2636,25 +2597,19 @@ function defaultFilterValidator$1(_ref2) {
|
|
|
2636
2597
|
|
|
2637
2598
|
var localizedTextTransformer = (localizedString => {
|
|
2638
2599
|
var _context;
|
|
2639
|
-
return _mapInstanceProperty__default["default"](_context = _Object$keys__default["default"](localizedString)).call(_context, locale => {
|
|
2640
|
-
var _context2;
|
|
2641
|
-
return _concatInstanceProperty__default["default"](_context2 = "".concat(locale, " = \"")).call(_context2, localizedString[locale], "\"");
|
|
2642
|
-
}).join(' and ');
|
|
2600
|
+
return _mapInstanceProperty__default["default"](_context = _Object$keys__default["default"](localizedString)).call(_context, locale => `${locale} = "${localizedString[locale]}"`).join(' and ');
|
|
2643
2601
|
});
|
|
2644
2602
|
|
|
2645
|
-
const getCentAmountClause = (value, operator, locale) => {
|
|
2646
|
-
var _context;
|
|
2647
|
-
return _concatInstanceProperty__default["default"](_context = "centAmount ".concat(operator, " ")).call(_context, uiKit.MoneyInput.convertToMoneyValue(value, locale).centAmount);
|
|
2648
|
-
};
|
|
2603
|
+
const getCentAmountClause = (value, operator, locale) => `centAmount ${operator} ${uiKit.MoneyInput.convertToMoneyValue(value, locale).centAmount}`;
|
|
2649
2604
|
function moneyTransformer(value, option, locale) {
|
|
2650
2605
|
const clauses = [];
|
|
2651
2606
|
if (option === FILTER_TYPES.range) {
|
|
2652
|
-
clauses[0] =
|
|
2607
|
+
clauses[0] = `currencyCode = "${value.from.currencyCode}"`;
|
|
2653
2608
|
clauses[1] = getCentAmountClause(value.from, '>=', locale);
|
|
2654
2609
|
clauses[2] = getCentAmountClause(value.to, '<=', locale);
|
|
2655
2610
|
return clauses.join(' and ');
|
|
2656
2611
|
}
|
|
2657
|
-
clauses[0] =
|
|
2612
|
+
clauses[0] = `currencyCode = "${value.currencyCode}"`;
|
|
2658
2613
|
switch (option) {
|
|
2659
2614
|
case FILTER_TYPES.lessThan:
|
|
2660
2615
|
clauses[1] = getCentAmountClause(value, '<', locale);
|
|
@@ -2671,7 +2626,6 @@ function moneyTransformer(value, option, locale) {
|
|
|
2671
2626
|
return clauses.join(' and ');
|
|
2672
2627
|
}
|
|
2673
2628
|
|
|
2674
|
-
var _templateObject$3, _templateObject2$1;
|
|
2675
2629
|
const formatTime = 'HH:mm:ss.SSS';
|
|
2676
2630
|
|
|
2677
2631
|
/* TimeInput only allows HH:mm:ss and adds the seconds as 00 and
|
|
@@ -2693,7 +2647,6 @@ const defaultFilterValidator = _ref => {
|
|
|
2693
2647
|
const timeTransformer = function (filterKey, filters) {
|
|
2694
2648
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator;
|
|
2695
2649
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref2 => {
|
|
2696
|
-
var _context, _context2;
|
|
2697
2650
|
let type = _ref2.type,
|
|
2698
2651
|
value = _ref2.value;
|
|
2699
2652
|
if (!filterValidator({
|
|
@@ -2702,13 +2655,19 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
2702
2655
|
})) return '';
|
|
2703
2656
|
switch (type) {
|
|
2704
2657
|
case FILTER_TYPES.lessThan:
|
|
2705
|
-
return
|
|
2658
|
+
return `${filterKey} < "${value}"`;
|
|
2706
2659
|
case FILTER_TYPES.moreThan:
|
|
2707
|
-
return
|
|
2660
|
+
return `${filterKey} > "${value}"`;
|
|
2708
2661
|
case FILTER_TYPES.equalTo:
|
|
2709
|
-
return oneLine__default["default"]
|
|
2662
|
+
return oneLine__default["default"]`
|
|
2663
|
+
(${filterKey} >= "${value}"
|
|
2664
|
+
and ${filterKey} <= "${getEndOfSecond(value)}")
|
|
2665
|
+
`;
|
|
2710
2666
|
case FILTER_TYPES.range:
|
|
2711
|
-
return oneLine__default["default"]
|
|
2667
|
+
return oneLine__default["default"]`
|
|
2668
|
+
(${filterKey} >= "${value.from}"
|
|
2669
|
+
and ${filterKey} <= "${getEndOfSecond(value.to)}")
|
|
2670
|
+
`;
|
|
2712
2671
|
default:
|
|
2713
2672
|
return '';
|
|
2714
2673
|
}
|
|
@@ -2724,19 +2683,21 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
2724
2683
|
* (pickUpTime >= "14:00" and pickUpTime <= "15:00")
|
|
2725
2684
|
* ) or some_more_filters
|
|
2726
2685
|
*/
|
|
2727
|
-
return queryString === '' ? null :
|
|
2686
|
+
return queryString === '' ? null : `(${queryString})`;
|
|
2728
2687
|
};
|
|
2729
2688
|
|
|
2730
|
-
var _templateObject$2;
|
|
2731
2689
|
function formatDateRangeValue(value, type) {
|
|
2732
2690
|
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
2733
2691
|
locale: 'en',
|
|
2734
2692
|
timeZone: moment__default$1["default"].tz.guess()
|
|
2735
2693
|
};
|
|
2736
2694
|
if (value.from === value.to) return formatDateTime$1(type, value.from, options);
|
|
2737
|
-
if (value.from && value.to) return oneLine__default["default"]
|
|
2738
|
-
|
|
2739
|
-
|
|
2695
|
+
if (value.from && value.to) return oneLine__default["default"]`
|
|
2696
|
+
${formatDateTime$1(type, value.from, options)} -
|
|
2697
|
+
${formatDateTime$1(type, value.to, options)}
|
|
2698
|
+
`;
|
|
2699
|
+
if (value.from) return `from ${formatDateTime$1(type, value.from, options)}`;
|
|
2700
|
+
if (value.to) return `to ${formatDateTime$1(type, value.to, options)}`;
|
|
2740
2701
|
return '';
|
|
2741
2702
|
}
|
|
2742
2703
|
function formatDateTime$1(type, value) {
|
|
@@ -3933,13 +3894,13 @@ const getData = (code, field) => {
|
|
|
3933
3894
|
const getFractionDigit = code => getData(code, 'fractionDigit');
|
|
3934
3895
|
|
|
3935
3896
|
function ownKeys$16(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3936
|
-
function _objectSpread$16(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
3897
|
+
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__default["default"](_context = ownKeys$16(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$16(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
3937
3898
|
function formatMoneyRangeValue(value, intl) {
|
|
3938
|
-
var _context;
|
|
3939
3899
|
if (value.from === value.to) return formatMoneyValue(value.from, value.currency, intl);
|
|
3940
|
-
if (value.from && value.to) return
|
|
3941
|
-
|
|
3942
|
-
if (value.
|
|
3900
|
+
if (value.from && value.to) return `${formatMoneyValue(value.from, value.currency, intl)} -
|
|
3901
|
+
${formatMoneyValue(value.to, value.currency, intl)}`;
|
|
3902
|
+
if (value.from) return `from ${formatMoneyValue(value.from, value.currency, intl)}`;
|
|
3903
|
+
if (value.to) return `to ${formatMoneyValue(value.to, value.currency, intl)}`;
|
|
3943
3904
|
return '';
|
|
3944
3905
|
}
|
|
3945
3906
|
function formatMoneyValue(amount, currency, intl) {
|
|
@@ -3959,8 +3920,7 @@ function getFractionedAmount(moneyValue) {
|
|
|
3959
3920
|
return amount / 10 ** fractionDigits;
|
|
3960
3921
|
}
|
|
3961
3922
|
function formatMoney$2(moneyValue, intl, options) {
|
|
3962
|
-
|
|
3963
|
-
return intl.formatNumber((_moneyValue$fractione = moneyValue.fractionedAmount) !== null && _moneyValue$fractione !== void 0 ? _moneyValue$fractione : getFractionedAmount(moneyValue), _objectSpread$16({
|
|
3923
|
+
return intl.formatNumber(moneyValue.fractionedAmount ?? getFractionedAmount(moneyValue), _objectSpread$16({
|
|
3964
3924
|
style: 'currency',
|
|
3965
3925
|
currency: moneyValue.currencyCode,
|
|
3966
3926
|
minimumFractionDigits: moneyValue.fractionDigits
|
|
@@ -3981,13 +3941,11 @@ var messages$D = reactIntl.defineMessages({
|
|
|
3981
3941
|
});
|
|
3982
3942
|
|
|
3983
3943
|
const formatEnum = _ref => {
|
|
3984
|
-
var _context;
|
|
3985
3944
|
let value = _ref.value,
|
|
3986
3945
|
fallbackValue = _ref.fallbackValue;
|
|
3987
|
-
return value.label ||
|
|
3946
|
+
return value.label || `${fallbackValue} (${value.key})`;
|
|
3988
3947
|
};
|
|
3989
3948
|
const formatLenum = _ref2 => {
|
|
3990
|
-
var _context2;
|
|
3991
3949
|
let value = _ref2.value,
|
|
3992
3950
|
language = _ref2.language,
|
|
3993
3951
|
languages = _ref2.languages,
|
|
@@ -3995,7 +3953,7 @@ const formatLenum = _ref2 => {
|
|
|
3995
3953
|
return l10n.formatLocalizedString(value, {
|
|
3996
3954
|
key: 'label',
|
|
3997
3955
|
locale: language,
|
|
3998
|
-
fallback:
|
|
3956
|
+
fallback: `${fallbackValue} (${value.key})`,
|
|
3999
3957
|
fallbackOrder: languages
|
|
4000
3958
|
});
|
|
4001
3959
|
};
|
|
@@ -4031,7 +3989,6 @@ const formatDate = _ref6 => {
|
|
|
4031
3989
|
});
|
|
4032
3990
|
};
|
|
4033
3991
|
const formatDateTime = _ref7 => {
|
|
4034
|
-
var _context3;
|
|
4035
3992
|
let value = _ref7.value,
|
|
4036
3993
|
userTimeZone = _ref7.userTimeZone,
|
|
4037
3994
|
intl = _ref7.intl;
|
|
@@ -4047,7 +4004,7 @@ const formatDateTime = _ref7 => {
|
|
|
4047
4004
|
// defaults to utc if timeZone is not provided
|
|
4048
4005
|
timeZone: userTimeZone || 'utc'
|
|
4049
4006
|
});
|
|
4050
|
-
return
|
|
4007
|
+
return `${date} (${time})`;
|
|
4051
4008
|
};
|
|
4052
4009
|
const formatBoolean = _ref8 => {
|
|
4053
4010
|
let value = _ref8.value,
|
|
@@ -4070,7 +4027,7 @@ const formatUnknown = _ref10 => {
|
|
|
4070
4027
|
fallbackValue = _ref10.fallbackValue;
|
|
4071
4028
|
// NOTE This is reporting within the render function, which is supposed to
|
|
4072
4029
|
// be pure. This is quite bad as this is a side-effect in the render fn.
|
|
4073
|
-
sentry.reportErrorToSentry(new Error(
|
|
4030
|
+
sentry.reportErrorToSentry(new Error(`Unhandled custom attribute type '${type.name}' for value`), {
|
|
4074
4031
|
extra: {
|
|
4075
4032
|
value
|
|
4076
4033
|
}
|
|
@@ -4143,10 +4100,9 @@ const attributeTypeNames = {
|
|
|
4143
4100
|
Number: 'number'
|
|
4144
4101
|
};
|
|
4145
4102
|
const convertToAttributeType = customFieldType => {
|
|
4146
|
-
var _customFieldType$elem;
|
|
4147
4103
|
if (isNil__default["default"](customFieldType)) return customFieldType;
|
|
4148
4104
|
const attributeTypeName = attributeTypeNames[customFieldType.name];
|
|
4149
|
-
const elementTypeName = attributeTypeNames[
|
|
4105
|
+
const elementTypeName = attributeTypeNames[customFieldType.elementType?.name];
|
|
4150
4106
|
return {
|
|
4151
4107
|
name: attributeTypeName,
|
|
4152
4108
|
elementType: {
|
|
@@ -4207,9 +4163,8 @@ function formatCustomField(_ref) {
|
|
|
4207
4163
|
// e.g
|
|
4208
4164
|
// where: `masterData(current(name(en >= "${lowerBound}" and en < "${upperBound}")))`
|
|
4209
4165
|
const getPrefixSearchBounds = input => {
|
|
4210
|
-
var _context;
|
|
4211
4166
|
const getNextCharacter = character => String.fromCharCode(character.charCodeAt() + 1);
|
|
4212
|
-
return [input,
|
|
4167
|
+
return [input, `${_sliceInstanceProperty__default["default"](input).call(input, 0, input.length - 1)}${getNextCharacter(_sliceInstanceProperty__default["default"](input).call(input, input.length - 1))}`];
|
|
4213
4168
|
};
|
|
4214
4169
|
|
|
4215
4170
|
const _excluded$2 = ["action"];
|
|
@@ -4402,7 +4357,7 @@ const convertChangeValueAction = actionPayload => {
|
|
|
4402
4357
|
* as its dynamic content can not be typed in SDL for the mutation.
|
|
4403
4358
|
*/
|
|
4404
4359
|
const convertAction = (actionName, actionPayload) => {
|
|
4405
|
-
var
|
|
4360
|
+
var _context3, _context4, _context5;
|
|
4406
4361
|
const getNameFromPayload = payload => {
|
|
4407
4362
|
// changeName for `Organizations`
|
|
4408
4363
|
if (typeof payload.name === 'string') return payload;
|
|
@@ -4467,7 +4422,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4467
4422
|
case 'setCustomType':
|
|
4468
4423
|
return {
|
|
4469
4424
|
[actionName]: {
|
|
4470
|
-
typeId:
|
|
4425
|
+
typeId: actionPayload.type?.id,
|
|
4471
4426
|
fields: actionPayload.fields ? _mapInstanceProperty__default["default"](_context3 = _Object$entries__default["default"](actionPayload.fields)).call(_context3, _ref => {
|
|
4472
4427
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
4473
4428
|
customField = _ref2[0],
|
|
@@ -4497,10 +4452,10 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4497
4452
|
};
|
|
4498
4453
|
case 'setGeoLocation':
|
|
4499
4454
|
return {
|
|
4500
|
-
[actionName]: actionPayload
|
|
4455
|
+
[actionName]: actionPayload?.geoLocation ? {
|
|
4501
4456
|
geoLocation: {
|
|
4502
4457
|
type: 'Point',
|
|
4503
|
-
coordinates: [_parseFloat__default["default"](
|
|
4458
|
+
coordinates: [_parseFloat__default["default"](actionPayload.geoLocation?.longitude), _parseFloat__default["default"](actionPayload.geoLocation?.latitude)]
|
|
4504
4459
|
}
|
|
4505
4460
|
} : {
|
|
4506
4461
|
undefined
|
|
@@ -4636,7 +4591,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4636
4591
|
case 'setShippingRateInputType':
|
|
4637
4592
|
return {
|
|
4638
4593
|
[actionName]: {
|
|
4639
|
-
shippingRateInputType:
|
|
4594
|
+
shippingRateInputType: actionPayload.shippingRateInputType?.type ? {
|
|
4640
4595
|
[actionPayload.shippingRateInputType.type]: {
|
|
4641
4596
|
values: actionPayload.shippingRateInputType.type === 'CartClassification' ? _mapInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](actionPayload.shippingRateInputType)).call(_context4, value => ({
|
|
4642
4597
|
key: value.key,
|
|
@@ -4690,8 +4645,8 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4690
4645
|
case 'addAddress':
|
|
4691
4646
|
case 'changeAddress':
|
|
4692
4647
|
{
|
|
4693
|
-
var
|
|
4694
|
-
const _ref3 =
|
|
4648
|
+
var _context6;
|
|
4649
|
+
const _ref3 = actionPayload.address?.custom || {},
|
|
4695
4650
|
_ref3$fields = _ref3.fields,
|
|
4696
4651
|
fields = _ref3$fields === void 0 ? {} : _ref3$fields;
|
|
4697
4652
|
const customFields = isEmpty__default["default"](fields) ? null : _mapInstanceProperty__default["default"](_context6 = _Object$entries__default["default"](fields)).call(_context6, _ref4 => {
|
|
@@ -4703,7 +4658,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4703
4658
|
value: _JSON$stringify__default["default"](value)
|
|
4704
4659
|
};
|
|
4705
4660
|
});
|
|
4706
|
-
const custom =
|
|
4661
|
+
const custom = actionPayload.address?.custom?.type?.id ? {
|
|
4707
4662
|
type: {
|
|
4708
4663
|
id: actionPayload.address.custom.type.id
|
|
4709
4664
|
},
|
|
@@ -4734,7 +4689,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4734
4689
|
value: _JSON$stringify__default["default"](value)
|
|
4735
4690
|
};
|
|
4736
4691
|
});
|
|
4737
|
-
const customType = type
|
|
4692
|
+
const customType = type?.id ? {
|
|
4738
4693
|
id: type.id
|
|
4739
4694
|
} : null;
|
|
4740
4695
|
return {
|
|
@@ -4757,11 +4712,10 @@ const createGraphQlUpdateActions = actions => _reduceInstanceProperty__default["
|
|
|
4757
4712
|
return [...previousActions, convertAction(actionName, actionPayload)];
|
|
4758
4713
|
}, []);
|
|
4759
4714
|
const extractErrorFromGraphQlResponse = graphQlResponse => {
|
|
4760
|
-
|
|
4761
|
-
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) {
|
|
4715
|
+
if (graphQlResponse.networkError?.result?.errors?.length > 0) {
|
|
4762
4716
|
return graphQlResponse.networkError.result.errors;
|
|
4763
4717
|
}
|
|
4764
|
-
if (
|
|
4718
|
+
if (graphQlResponse.graphQLErrors?.length > 0) {
|
|
4765
4719
|
return graphQlResponse.graphQLErrors;
|
|
4766
4720
|
}
|
|
4767
4721
|
return graphQlResponse;
|
|
@@ -4822,16 +4776,14 @@ function omitDeep(obj, fieldsToOmit) {
|
|
|
4822
4776
|
function ownKeys$14(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4823
4777
|
function _objectSpread$14(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$14(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$14(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
4824
4778
|
function getPriceChannelName(price) {
|
|
4825
|
-
|
|
4826
|
-
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;
|
|
4779
|
+
return price.channel?.name ?? price.channel?.key ?? null;
|
|
4827
4780
|
}
|
|
4828
4781
|
function getDiscountValue(price) {
|
|
4829
|
-
var _price$value, _price$value2, _price$discounted;
|
|
4830
4782
|
let preciseAmount;
|
|
4831
4783
|
let fractionedAmount;
|
|
4832
|
-
if (
|
|
4784
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision && price.discounted.value.type === PRECISION_TYPES.highPrecision) {
|
|
4833
4785
|
preciseAmount = price.value.preciseAmount - price.discounted.value.preciseAmount;
|
|
4834
|
-
} else if (
|
|
4786
|
+
} else if (price.value?.type === PRECISION_TYPES.highPrecision && price.discounted?.value?.type === PRECISION_TYPES.centPrecision) {
|
|
4835
4787
|
fractionedAmount = getFractionedAmount(price.value) - getFractionedAmount(price.discounted.value);
|
|
4836
4788
|
}
|
|
4837
4789
|
return price.discounted ? _objectSpread$14(_objectSpread$14({}, price.value), {}, {
|
|
@@ -4845,28 +4797,23 @@ function getDiscountValue(price) {
|
|
|
4845
4797
|
function getSelectedPrice(price) {
|
|
4846
4798
|
return price.discounted ? price.discounted : price;
|
|
4847
4799
|
}
|
|
4848
|
-
function getNetUnitPrice(
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
shouldRoundAmount = _ref2.shouldRoundAmount;
|
|
4800
|
+
function getNetUnitPrice(_ref) {
|
|
4801
|
+
let lineItem = _ref.lineItem,
|
|
4802
|
+
shouldRoundAmount = _ref.shouldRoundAmount;
|
|
4852
4803
|
const price = getSelectedPrice(lineItem.price);
|
|
4853
|
-
const filteredPerMethodTaxRate = lineItem
|
|
4854
|
-
var _lineItem$shippingDet;
|
|
4855
|
-
return (lineItem === null || lineItem === void 0 || (_lineItem$shippingDet = lineItem.shippingDetails) === null || _lineItem$shippingDet === void 0 || (_lineItem$shippingDet = _lineItem$shippingDet.targets) === null || _lineItem$shippingDet === void 0 ? void 0 : _findIndexInstanceProperty__default["default"](_lineItem$shippingDet).call(_lineItem$shippingDet, target => (target === null || target === void 0 ? void 0 : target.shippingMethodKey) === (perMethodTax === null || perMethodTax === void 0 ? void 0 : perMethodTax.shippingMethodKey))) >= 0;
|
|
4856
|
-
});
|
|
4804
|
+
const filteredPerMethodTaxRate = lineItem?.perMethodTaxRate?.filter(perMethodTax => lineItem?.shippingDetails?.targets?.findIndex(target => target?.shippingMethodKey === perMethodTax?.shippingMethodKey) >= 0);
|
|
4857
4805
|
|
|
4858
4806
|
// when shipping mode is multi with the same tax rate
|
|
4859
|
-
if (
|
|
4860
|
-
var _price$value3, _price$value4;
|
|
4807
|
+
if (filteredPerMethodTaxRate?.length > 0 && filteredPerMethodTaxRate[0]?.taxRate?.includedInPrice) {
|
|
4861
4808
|
const taxRate = filteredPerMethodTaxRate[0].taxRate;
|
|
4862
4809
|
let centAmount;
|
|
4863
4810
|
// should accept 0 value
|
|
4864
|
-
if (typeof
|
|
4811
|
+
if (typeof price.value?.centAmount === 'number') {
|
|
4865
4812
|
const amount = price.value.centAmount / (1 + taxRate.amount);
|
|
4866
4813
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4867
4814
|
}
|
|
4868
4815
|
let preciseAmount;
|
|
4869
|
-
if (
|
|
4816
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + taxRate.amount);
|
|
4870
4817
|
return _objectSpread$14(_objectSpread$14({}, price.value), {}, {
|
|
4871
4818
|
centAmount,
|
|
4872
4819
|
preciseAmount
|
|
@@ -4875,15 +4822,14 @@ function getNetUnitPrice(_ref2) {
|
|
|
4875
4822
|
|
|
4876
4823
|
// when shipping mode is single
|
|
4877
4824
|
if (lineItem.taxRate && lineItem.taxRate.includedInPrice) {
|
|
4878
|
-
var _price$value5, _price$value6;
|
|
4879
4825
|
let centAmount;
|
|
4880
4826
|
// should accept 0 value
|
|
4881
|
-
if (typeof
|
|
4827
|
+
if (typeof price.value?.centAmount === 'number') {
|
|
4882
4828
|
const amount = price.value.centAmount / (1 + lineItem.taxRate.amount);
|
|
4883
4829
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4884
4830
|
}
|
|
4885
4831
|
let preciseAmount;
|
|
4886
|
-
if (
|
|
4832
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + lineItem.taxRate.amount);
|
|
4887
4833
|
return _objectSpread$14(_objectSpread$14({}, price.value), {}, {
|
|
4888
4834
|
centAmount,
|
|
4889
4835
|
preciseAmount
|
|
@@ -4917,18 +4863,18 @@ const transformCustomFieldFromGraphQLResponse = resource => {
|
|
|
4917
4863
|
key: resource.custom.type.key,
|
|
4918
4864
|
name: l10n.transformLocalizedFieldToLocalizedString(resource.custom.type.nameAllLocales),
|
|
4919
4865
|
fieldDefinitions: _mapInstanceProperty__default["default"](_context = resource.custom.type.fieldDefinitions).call(_context, fieldDefinition => {
|
|
4920
|
-
var
|
|
4866
|
+
var _context2, _context3;
|
|
4921
4867
|
return {
|
|
4922
4868
|
name: fieldDefinition.name,
|
|
4923
4869
|
required: fieldDefinition.required,
|
|
4924
|
-
type:
|
|
4870
|
+
type: fieldDefinition.type?.elementType?.name === 'LocalizedEnum' ? _objectSpread$13(_objectSpread$13({}, fieldDefinition.type), {}, {
|
|
4925
4871
|
elementType: _objectSpread$13(_objectSpread$13({}, fieldDefinition.type.elementType), {}, {
|
|
4926
4872
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
4927
4873
|
key: value.key,
|
|
4928
4874
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
4929
4875
|
}))
|
|
4930
4876
|
})
|
|
4931
|
-
}) :
|
|
4877
|
+
}) : fieldDefinition.type?.name === 'LocalizedEnum' ? _objectSpread$13(_objectSpread$13({}, fieldDefinition.type), {}, {
|
|
4932
4878
|
values: _mapInstanceProperty__default["default"](_context3 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context3, value => ({
|
|
4933
4879
|
key: value.key,
|
|
4934
4880
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -4955,7 +4901,7 @@ const convertProductSelectionFromGraphQl = productSelection => {
|
|
|
4955
4901
|
from: 'nameAllLocales',
|
|
4956
4902
|
to: 'name'
|
|
4957
4903
|
}])), {}, {
|
|
4958
|
-
custom: productSelection
|
|
4904
|
+
custom: productSelection?.custom ? transformCustomFieldFromGraphQLResponse(productSelection) : null
|
|
4959
4905
|
});
|
|
4960
4906
|
};
|
|
4961
4907
|
|
|
@@ -5078,7 +5024,7 @@ function omitSetsOfSets() {
|
|
|
5078
5024
|
* duplicated in original values
|
|
5079
5025
|
*/
|
|
5080
5026
|
function unique(values, properties) {
|
|
5081
|
-
var
|
|
5027
|
+
var _context;
|
|
5082
5028
|
let ignoredValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['', null, undefined];
|
|
5083
5029
|
const duplicateValues = [];
|
|
5084
5030
|
let realValues;
|
|
@@ -5087,20 +5033,19 @@ function unique(values, properties) {
|
|
|
5087
5033
|
realValues = _filterInstanceProperty__default["default"](values).call(values, value => !_includesInstanceProperty__default["default"](ignoredValues).call(ignoredValues, value));
|
|
5088
5034
|
if (!realValues.length) return [];
|
|
5089
5035
|
if (properties) realValues = _mapInstanceProperty__default["default"](realValues).call(realValues, value => _reduceInstanceProperty__default["default"](properties).call(properties, (prev, curr) => {
|
|
5090
|
-
var _context;
|
|
5091
5036
|
const currentValue = value[curr] || '';
|
|
5092
|
-
return
|
|
5037
|
+
return `${prev}:${currentValue}`;
|
|
5093
5038
|
}, ''));else realValues = _sliceInstanceProperty__default["default"](values).call(values, 0);
|
|
5094
5039
|
|
|
5095
5040
|
// TODO: checking for dupes like this is slow, find a better way
|
|
5096
|
-
_reduceInstanceProperty__default["default"](
|
|
5041
|
+
_reduceInstanceProperty__default["default"](_context = _sortInstanceProperty__default["default"](realValues).call(realValues)).call(_context, (prev, curr) => {
|
|
5097
5042
|
if (curr === null) return curr;
|
|
5098
5043
|
if (curr !== '' && prev === curr && _indexOfInstanceProperty__default["default"](duplicateValues).call(duplicateValues, curr) === -1) duplicateValues.push(curr);
|
|
5099
5044
|
return curr;
|
|
5100
5045
|
});
|
|
5101
5046
|
if (properties) return _mapInstanceProperty__default["default"](duplicateValues).call(duplicateValues, value => {
|
|
5102
|
-
var
|
|
5103
|
-
const parts = _sliceInstanceProperty__default["default"](
|
|
5047
|
+
var _context2;
|
|
5048
|
+
const parts = _sliceInstanceProperty__default["default"](_context2 = value.split(':')).call(_context2, 1);
|
|
5104
5049
|
return _reduceInstanceProperty__default["default"](properties).call(properties, (prev, curr, index) => {
|
|
5105
5050
|
// eslint-disable-next-line no-param-reassign
|
|
5106
5051
|
prev[curr] = parts[index];
|
|
@@ -5119,14 +5064,14 @@ function unique(values, properties) {
|
|
|
5119
5064
|
* @return Array<Object> returns an array of objects with all duplicated values
|
|
5120
5065
|
*/
|
|
5121
5066
|
function uniqueObjects(items) {
|
|
5122
|
-
var
|
|
5067
|
+
var _context3;
|
|
5123
5068
|
const emptyValues = [undefined, null, ''];
|
|
5124
|
-
const itemsWorkingSet = items && items.length ? _filterInstanceProperty__default["default"](
|
|
5069
|
+
const itemsWorkingSet = items && items.length ? _filterInstanceProperty__default["default"](_context3 = _sliceInstanceProperty__default["default"](items).call(items)).call(_context3, x => !_includesInstanceProperty__default["default"](emptyValues).call(emptyValues, x)) : [];
|
|
5125
5070
|
const duplicateValues = _reduceInstanceProperty__default["default"](itemsWorkingSet).call(itemsWorkingSet, (acc, item, index) => {
|
|
5126
|
-
var
|
|
5071
|
+
var _context4;
|
|
5127
5072
|
if (item === null) return acc;
|
|
5128
|
-
const isDuplicate = _reduceInstanceProperty__default["default"](
|
|
5129
|
-
).call(
|
|
5073
|
+
const isDuplicate = _reduceInstanceProperty__default["default"](_context4 = _sliceInstanceProperty__default["default"](itemsWorkingSet).call(itemsWorkingSet, index + 1) // get sub-array after this index
|
|
5074
|
+
).call(_context4, (duplicateAcc, comparisonItem, comparisonIndex) => {
|
|
5130
5075
|
if (comparisonItem === null) return duplicateAcc;
|
|
5131
5076
|
|
|
5132
5077
|
// check if its a dupe
|
|
@@ -5253,7 +5198,7 @@ function getCategoriesByIds(apolloClient, options) {
|
|
|
5253
5198
|
return apolloClient.query({
|
|
5254
5199
|
query: FetchCategoriesByIds,
|
|
5255
5200
|
variables: {
|
|
5256
|
-
where:
|
|
5201
|
+
where: `id in (${_mapInstanceProperty__default["default"](_context2 = options.ids).call(_context2, id => `"${id}"`).join(', ')})`
|
|
5257
5202
|
},
|
|
5258
5203
|
context: {
|
|
5259
5204
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -5273,8 +5218,8 @@ function getCategoriesByIds(apolloClient, options) {
|
|
|
5273
5218
|
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 } } } };
|
|
5274
5219
|
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 } } } };
|
|
5275
5220
|
const transformCartDiscountResponse = response => {
|
|
5276
|
-
var _context
|
|
5277
|
-
return _mapInstanceProperty__default["default"](_context =
|
|
5221
|
+
var _context;
|
|
5222
|
+
return _mapInstanceProperty__default["default"](_context = response.data?.cartDiscounts.results || []).call(_context, cartDiscount => transformLocalizedFieldsForCartDiscount(cartDiscount));
|
|
5278
5223
|
};
|
|
5279
5224
|
function queryCartDiscounts(apolloClient) {
|
|
5280
5225
|
return apolloClient.query({
|
|
@@ -5286,14 +5231,14 @@ function queryCartDiscounts(apolloClient) {
|
|
|
5286
5231
|
}).then(transformCartDiscountResponse);
|
|
5287
5232
|
}
|
|
5288
5233
|
const getWhereClause = function () {
|
|
5289
|
-
var _context2, _context3
|
|
5234
|
+
var _context2, _context3;
|
|
5290
5235
|
let searchText = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
5291
5236
|
let language = arguments.length > 1 ? arguments[1] : undefined;
|
|
5292
5237
|
const query = _trimInstanceProperty__default["default"](_context2 = _JSON$stringify__default["default"](searchText)).call(_context2);
|
|
5293
|
-
const idQuery = isUUID(searchText) &&
|
|
5294
|
-
const nameQuery =
|
|
5295
|
-
const keyQuery =
|
|
5296
|
-
return _filterInstanceProperty__default["default"](
|
|
5238
|
+
const idQuery = isUUID(searchText) && `id = ${query}`;
|
|
5239
|
+
const nameQuery = `name(${language} = ${query})`;
|
|
5240
|
+
const keyQuery = `key = ${query}`;
|
|
5241
|
+
return _filterInstanceProperty__default["default"](_context3 = [idQuery, nameQuery, keyQuery]).call(_context3, Boolean).join(' or ');
|
|
5297
5242
|
};
|
|
5298
5243
|
function searchCartDiscountsByExactMatch(apolloClient, options) {
|
|
5299
5244
|
return apolloClient.query({
|
|
@@ -5316,10 +5261,7 @@ function getCartDiscountById(apolloClient, options) {
|
|
|
5316
5261
|
context: {
|
|
5317
5262
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
5318
5263
|
}
|
|
5319
|
-
}).then(response =>
|
|
5320
|
-
var _response$data2;
|
|
5321
|
-
return (_response$data2 = response.data) !== null && _response$data2 !== void 0 && _response$data2.cartDiscount ? transformLocalizedFieldsForCartDiscount(response.data.cartDiscount) : null;
|
|
5322
|
-
});
|
|
5264
|
+
}).then(response => response.data?.cartDiscount ? transformLocalizedFieldsForCartDiscount(response.data.cartDiscount) : null);
|
|
5323
5265
|
}
|
|
5324
5266
|
|
|
5325
5267
|
var styles$g = {
|
|
@@ -5404,13 +5346,10 @@ const useReferenceSearchItems = _ref => {
|
|
|
5404
5346
|
};
|
|
5405
5347
|
};
|
|
5406
5348
|
function ReferenceSearch(props) {
|
|
5407
|
-
const ids = React.useMemo(() => {
|
|
5408
|
-
|
|
5409
|
-
return
|
|
5410
|
-
|
|
5411
|
-
return id;
|
|
5412
|
-
}) : [(_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.id] : [];
|
|
5413
|
-
}, [props.value, props.isMulti]);
|
|
5349
|
+
const ids = React.useMemo(() => props.value ? props.isMulti ? props.value?.map(_ref2 => {
|
|
5350
|
+
let id = _ref2.id;
|
|
5351
|
+
return id;
|
|
5352
|
+
}) : [props.value?.id] : [], [props.value, props.isMulti]);
|
|
5414
5353
|
const _useReferenceSearchIt = useReferenceSearchItems({
|
|
5415
5354
|
loadItemsBySearchTerm: props.loadItemsBySearchTerm,
|
|
5416
5355
|
loadItemsByIds: props.loadItemsByIds,
|
|
@@ -5421,14 +5360,14 @@ function ReferenceSearch(props) {
|
|
|
5421
5360
|
areSomeItemsMissing = _useReferenceSearchIt.areSomeItemsMissing,
|
|
5422
5361
|
handleLoadItems = _useReferenceSearchIt.handleLoadItems;
|
|
5423
5362
|
if (areItemsLoading) return null;
|
|
5424
|
-
const value = props.isMulti ? items : items
|
|
5363
|
+
const value = props.isMulti ? items : items?.[0];
|
|
5425
5364
|
let filterValue = null;
|
|
5426
5365
|
if (value) filterValue = props.isMulti ? _mapInstanceProperty__default["default"](value).call(value, props.mapItemToOption) : props.mapItemToOption(value);
|
|
5427
5366
|
const tooltipTitle = value || props.value ? props.mapItemToOption(value || props.value).label : '';
|
|
5428
5367
|
const loadItems = value => _Promise__default["default"].resolve(handleLoadItems(value)).then(items => _mapInstanceProperty__default["default"](items).call(items, item => props.mapItemToOption(item)));
|
|
5429
5368
|
const handleChange = event => {
|
|
5430
|
-
var _context
|
|
5431
|
-
const option = props.isMulti ? _mapInstanceProperty__default["default"](_context = event.target.value).call(_context, item => item.value) :
|
|
5369
|
+
var _context;
|
|
5370
|
+
const option = props.isMulti ? _mapInstanceProperty__default["default"](_context = event.target.value).call(_context, item => item.value) : event.target.value?.value || null;
|
|
5432
5371
|
props.onChange(option);
|
|
5433
5372
|
};
|
|
5434
5373
|
return jsxRuntime.jsxs("div", {
|
|
@@ -5542,7 +5481,7 @@ function CartDiscountReferenceSearch(props) {
|
|
|
5542
5481
|
}),
|
|
5543
5482
|
loading = _useQuery.loading,
|
|
5544
5483
|
data = _useQuery.data;
|
|
5545
|
-
const isExactMatch =
|
|
5484
|
+
const isExactMatch = data?.cartDiscounts.total > QUERY_MAX_LIMIT;
|
|
5546
5485
|
const _useIntl = reactIntl.useIntl(),
|
|
5547
5486
|
formatMessage = _useIntl.formatMessage;
|
|
5548
5487
|
const apolloClient = client.useApolloClient();
|
|
@@ -5642,9 +5581,8 @@ const messages$A = reactIntl.defineMessages({
|
|
|
5642
5581
|
});
|
|
5643
5582
|
|
|
5644
5583
|
function ownKeys$$(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5645
|
-
function _objectSpread$$(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
5584
|
+
function _objectSpread$$(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$$(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$$(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
5646
5585
|
function Option(props) {
|
|
5647
|
-
var _context, _context2;
|
|
5648
5586
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
5649
5587
|
language: applicationContext.dataLocale,
|
|
5650
5588
|
languages: applicationContext.project.languages
|
|
@@ -5665,19 +5603,19 @@ function Option(props) {
|
|
|
5665
5603
|
fallbackOrder: languages
|
|
5666
5604
|
})
|
|
5667
5605
|
}), category.parent && jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
5668
|
-
children:
|
|
5606
|
+
children: `${formatMessage(messages$A.parentCategory)}: ${l10n.formatLocalizedString(category.parent, {
|
|
5669
5607
|
key: 'name',
|
|
5670
5608
|
locale: language,
|
|
5671
5609
|
fallbackOrder: languages
|
|
5672
|
-
})
|
|
5610
|
+
})}`
|
|
5673
5611
|
}), jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
5674
|
-
children:
|
|
5612
|
+
children: `Slug: ${l10n.formatLocalizedString(category, {
|
|
5675
5613
|
key: 'slug',
|
|
5676
5614
|
locale: language,
|
|
5677
5615
|
fallbackOrder: languages
|
|
5678
|
-
})
|
|
5616
|
+
})}`
|
|
5679
5617
|
}), category.externalId && jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
5680
|
-
children:
|
|
5618
|
+
children: `${formatMessage(messages$A.externalId)}: ${category.externalId || constants.NO_VALUE_FALLBACK}`
|
|
5681
5619
|
})]
|
|
5682
5620
|
})
|
|
5683
5621
|
}));
|
|
@@ -5741,7 +5679,7 @@ var CategorySearchPickerOptionFragment$1 = { kind: "Document", definitions: [{ k
|
|
|
5741
5679
|
function useCachedCategoryOptions(ids) {
|
|
5742
5680
|
const apolloClient = client.useApolloClient();
|
|
5743
5681
|
const fragments = _mapInstanceProperty__default["default"](ids).call(ids, id => apolloClient.readFragment({
|
|
5744
|
-
id:
|
|
5682
|
+
id: `CategorySearch:${id}`,
|
|
5745
5683
|
fragment: CategorySearchPickerOptionFragment$1
|
|
5746
5684
|
}));
|
|
5747
5685
|
return _mapInstanceProperty__default["default"](fragments).call(fragments, category => transformLocalizedFieldsForCategory(category, [{
|
|
@@ -5866,8 +5804,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
5866
5804
|
var _context2;
|
|
5867
5805
|
const intl = reactIntl.useIntl();
|
|
5868
5806
|
const handleLoadOptions = async searchTerm => {
|
|
5869
|
-
|
|
5870
|
-
const filteredOptions = (_props$options = props.options) === null || _props$options === void 0 ? void 0 : _filterInstanceProperty__default["default"](_props$options).call(_props$options, country => {
|
|
5807
|
+
const filteredOptions = props.options?.filter(country => {
|
|
5871
5808
|
var _context;
|
|
5872
5809
|
return _includesInstanceProperty__default["default"](_context = country.label.toLowerCase()).call(_context, searchTerm.toLowerCase());
|
|
5873
5810
|
});
|
|
@@ -5875,7 +5812,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
5875
5812
|
return _sliceInstanceProperty__default["default"](filteredOptions).call(filteredOptions, 0, props.countriesAsyncLoadingLimit);
|
|
5876
5813
|
}
|
|
5877
5814
|
return [{
|
|
5878
|
-
options:
|
|
5815
|
+
options: props.options?.slice(0, props.countriesAsyncLoadingLimit)
|
|
5879
5816
|
}, {
|
|
5880
5817
|
options: emptyCountryOption(intl)
|
|
5881
5818
|
}];
|
|
@@ -5884,10 +5821,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
5884
5821
|
const countries = event.target.value;
|
|
5885
5822
|
props.onChange({
|
|
5886
5823
|
target: _objectSpread$X(_objectSpread$X({}, event.target), {}, {
|
|
5887
|
-
value: _mapInstanceProperty__default["default"](countries).call(countries, country =>
|
|
5888
|
-
var _country$value;
|
|
5889
|
-
return (_country$value = country === null || country === void 0 ? void 0 : country.value) !== null && _country$value !== void 0 ? _country$value : country;
|
|
5890
|
-
})
|
|
5824
|
+
value: _mapInstanceProperty__default["default"](countries).call(countries, country => country?.value ?? country)
|
|
5891
5825
|
})
|
|
5892
5826
|
});
|
|
5893
5827
|
};
|
|
@@ -5939,8 +5873,7 @@ const COUNTRIES_ASYNC_LOADING_LIMIT = 60;
|
|
|
5939
5873
|
function ownKeys$W(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5940
5874
|
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__default["default"](_context = ownKeys$W(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$W(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
5941
5875
|
function CountriesPicker(props) {
|
|
5942
|
-
|
|
5943
|
-
const CustomCountriesPicker = ((_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.length) <= props.countriesAsyncLoadingLimit ? CountriesBasicSelectDropdown : CountriesAsyncSelectDropdown;
|
|
5876
|
+
const CustomCountriesPicker = props.options?.length <= props.countriesAsyncLoadingLimit ? CountriesBasicSelectDropdown : CountriesAsyncSelectDropdown;
|
|
5944
5877
|
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
5945
5878
|
children: jsxRuntime.jsx(CustomCountriesPicker, _objectSpread$W({}, props))
|
|
5946
5879
|
});
|
|
@@ -5969,7 +5902,6 @@ var GetCustomerGroupsQuery = { kind: "Document", definitions: [{ kind: "Operatio
|
|
|
5969
5902
|
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 } } } };
|
|
5970
5903
|
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 } } } };
|
|
5971
5904
|
const CustomerGroupPickerInput = _ref => {
|
|
5972
|
-
var _currentOption$data$l, _currentOption$data;
|
|
5973
5905
|
let isClearable = _ref.isClearable,
|
|
5974
5906
|
isDisabled = _ref.isDisabled,
|
|
5975
5907
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -6038,13 +5970,13 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
6038
5970
|
setLoadingError(null);
|
|
6039
5971
|
handleInternalInputChange(event);
|
|
6040
5972
|
}, [handleInternalInputChange]);
|
|
6041
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
5973
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
6042
5974
|
React.useEffect(() => {
|
|
6043
5975
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
6044
5976
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
6045
5977
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
6046
5978
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$x.noCustomerGroupsFound), [loadingError, formatMessage]);
|
|
6047
|
-
const tooltipTitle =
|
|
5979
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
6048
5980
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
6049
5981
|
max: "scale",
|
|
6050
5982
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -6054,7 +5986,7 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
6054
5986
|
children: jsxRuntime.jsx(uiKit.AsyncSelectInput, {
|
|
6055
5987
|
id: name,
|
|
6056
5988
|
name: name,
|
|
6057
|
-
placeholder: placeholder
|
|
5989
|
+
placeholder: placeholder ?? formatMessage(messages$x.placeholder),
|
|
6058
5990
|
loadOptions: loadOptionsDebounced,
|
|
6059
5991
|
defaultOptions: true,
|
|
6060
5992
|
showOptionGroupDivider: true,
|
|
@@ -6148,9 +6080,9 @@ const CustomFieldErrors = props => {
|
|
|
6148
6080
|
const didFormValidationFail = useDidFormValidationFail();
|
|
6149
6081
|
const errors = _Array$isArray__default["default"](props.errors) ? mergeSetItemsErrors(props.errors) : props.errors;
|
|
6150
6082
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6151
|
-
children: [props.isTouched || didFormValidationFail &&
|
|
6083
|
+
children: [props.isTouched || didFormValidationFail && errors?.missing && jsxRuntime.jsx(_.ErrorMessage, {
|
|
6152
6084
|
intlMessage: messages$C.required
|
|
6153
|
-
}), props.isTouched || didFormValidationFail &&
|
|
6085
|
+
}), props.isTouched || didFormValidationFail && errors?.duplicated && jsxRuntime.jsx(_.ErrorMessage, {
|
|
6154
6086
|
intlMessage: messages$C.unique
|
|
6155
6087
|
})]
|
|
6156
6088
|
});
|
|
@@ -6234,7 +6166,7 @@ const ExpandButton = props => props.totalValues > 1 ? jsxRuntime.jsxs(uiKit.Spac
|
|
|
6234
6166
|
}), jsxRuntime.jsx(uiKit.FlatButton, {
|
|
6235
6167
|
tone: "primary",
|
|
6236
6168
|
icon: props.isExpanded ? jsxRuntime.jsx(uiKit.AngleUpIcon, {}) : jsxRuntime.jsx(uiKit.AngleDownIcon, {}),
|
|
6237
|
-
label: props.isExpanded ?
|
|
6169
|
+
label: props.isExpanded ? `Hide set items (${props.totalValues})` : `Show all set items (${props.totalValues})`,
|
|
6238
6170
|
onClick: props.onExpand
|
|
6239
6171
|
})]
|
|
6240
6172
|
}) : null;
|
|
@@ -6269,7 +6201,7 @@ const SetButtons = props => {
|
|
|
6269
6201
|
SetButtons.displayName = 'SetButtons';
|
|
6270
6202
|
|
|
6271
6203
|
function ownKeys$U(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6272
|
-
function _objectSpread$U(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
6204
|
+
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__default["default"](_context2 = ownKeys$U(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$U(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
6273
6205
|
const getDuplicateErrors = setValues => {
|
|
6274
6206
|
/* eslint-disable no-plusplus */
|
|
6275
6207
|
const result = [];
|
|
@@ -6309,13 +6241,10 @@ const getItemIndex = name => {
|
|
|
6309
6241
|
return _parseInt__default["default"](rawIndex, 10);
|
|
6310
6242
|
};
|
|
6311
6243
|
const makeKeys = amount => times__default["default"](amount, () => uuid.v4());
|
|
6312
|
-
const makeItemFieldName = (fieldName, index) => {
|
|
6313
|
-
var _context;
|
|
6314
|
-
return _concatInstanceProperty__default["default"](_context = "".concat(fieldName, ".[")).call(_context, index, "]");
|
|
6315
|
-
};
|
|
6244
|
+
const makeItemFieldName = (fieldName, index) => `${fieldName}.[${index}]`;
|
|
6316
6245
|
const makeMapForAllItems = (fieldName, items, value) => _reduceInstanceProperty__default["default"](items).call(items, (result, item, index) => set__default["default"](result, makeItemFieldName(fieldName, index), value), {});
|
|
6317
6246
|
function CustomInputSet(props) {
|
|
6318
|
-
var
|
|
6247
|
+
var _context;
|
|
6319
6248
|
const _useToggleState = uiKit.useToggleState(false),
|
|
6320
6249
|
_useToggleState2 = _slicedToArray(_useToggleState, 2),
|
|
6321
6250
|
isExpanded = _useToggleState2[0],
|
|
@@ -6337,7 +6266,7 @@ function CustomInputSet(props) {
|
|
|
6337
6266
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
6338
6267
|
keys = _useState4[0],
|
|
6339
6268
|
setKeys = _useState4[1];
|
|
6340
|
-
const totalAmount = internalValue
|
|
6269
|
+
const totalAmount = internalValue?.length;
|
|
6341
6270
|
const amountToRender = isExpanded ? totalAmount : 1;
|
|
6342
6271
|
const updateInternalValue = newValue => {
|
|
6343
6272
|
const valueToSet = isEmpty$1(newValue) ? [undefined] : newValue;
|
|
@@ -6384,8 +6313,8 @@ function CustomInputSet(props) {
|
|
|
6384
6313
|
// in <CustomFieldComponent /> where proper component for given field/attribute
|
|
6385
6314
|
// type is selected.
|
|
6386
6315
|
const type = getType(props.fieldDefinition);
|
|
6387
|
-
const typeName = type
|
|
6388
|
-
const areButtonsTopAligned = _includesInstanceProperty__default["default"](
|
|
6316
|
+
const typeName = type?.name.toLowerCase();
|
|
6317
|
+
const areButtonsTopAligned = _includesInstanceProperty__default["default"](_context = [CUSTOM_FIELD_TYPES.lenum, CUSTOM_FIELD_TYPES.localizedenum, CUSTOM_FIELD_TYPES.localizedstring, CUSTOM_FIELD_TYPES.string, CUSTOM_FIELD_TYPES.text, CUSTOM_FIELD_TYPES.ltext, CUSTOM_FIELD_TYPES.reference]).call(_context, typeName);
|
|
6389
6318
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6390
6319
|
children: [jsxRuntime.jsx(uiKit.AccessibleHidden, {
|
|
6391
6320
|
children: jsxRuntime.jsx("label", {
|
|
@@ -6504,17 +6433,16 @@ function CustomDateTimeInput(props) {
|
|
|
6504
6433
|
CustomDateTimeInput.displayName = 'CustomDateTimeInput';
|
|
6505
6434
|
|
|
6506
6435
|
const convertTypeValuesToOptions$1 = reselect.defaultMemoize(typeValues => _mapInstanceProperty__default["default"](typeValues).call(typeValues, typeValue => ({
|
|
6507
|
-
label: typeValue.label ||
|
|
6436
|
+
label: typeValue.label || `${typeValue.key} (key)`,
|
|
6508
6437
|
value: typeValue.key
|
|
6509
6438
|
})));
|
|
6510
6439
|
function CustomEnumInput(props) {
|
|
6511
|
-
var _options$find$label, _options$find;
|
|
6512
6440
|
const options = convertTypeValuesToOptions$1(_valuesInstanceProperty__default["default"](props.fieldDefinition.type));
|
|
6513
6441
|
const handleChange = makeChangeHandler(rawValue => {
|
|
6514
6442
|
props.setFieldValue(props.name, rawValue);
|
|
6515
6443
|
props.renderWarnings && props.handleWarningChange(props.name, props.fieldDefinition, rawValue);
|
|
6516
6444
|
});
|
|
6517
|
-
const tooltipTitle = props.value ?
|
|
6445
|
+
const tooltipTitle = props.value ? _findInstanceProperty__default["default"](options).call(options, option => option.value === props.value)?.label ?? '' : '';
|
|
6518
6446
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
6519
6447
|
title: tooltipTitle,
|
|
6520
6448
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
@@ -6543,13 +6471,12 @@ const convertTypeValuesToOptions = reselect.defaultMemoize((type, dataLocale, la
|
|
|
6543
6471
|
key: 'label',
|
|
6544
6472
|
locale: dataLocale,
|
|
6545
6473
|
fallbackOrder: languages,
|
|
6546
|
-
fallback:
|
|
6474
|
+
fallback: `${value.key} (key)`
|
|
6547
6475
|
}),
|
|
6548
6476
|
value: value.key
|
|
6549
6477
|
}));
|
|
6550
6478
|
});
|
|
6551
6479
|
function CustomLocalizedEnumInput(props) {
|
|
6552
|
-
var _options$find$label, _options$find;
|
|
6553
6480
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
6554
6481
|
languages: applicationContext.project.languages,
|
|
6555
6482
|
dataLocale: applicationContext.dataLocale
|
|
@@ -6561,7 +6488,7 @@ function CustomLocalizedEnumInput(props) {
|
|
|
6561
6488
|
props.setFieldValue(props.name, rawValue);
|
|
6562
6489
|
props.renderWarnings && props.handleWarningChange(props.name, props.fieldDefinition, rawValue);
|
|
6563
6490
|
});
|
|
6564
|
-
const tooltipTitle = props.value ?
|
|
6491
|
+
const tooltipTitle = props.value ? _findInstanceProperty__default["default"](options).call(options, option => option.value === props.value)?.label ?? '' : '';
|
|
6565
6492
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
6566
6493
|
title: tooltipTitle,
|
|
6567
6494
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
@@ -6590,7 +6517,6 @@ const getSubfieldLanguage = subfieldName => {
|
|
|
6590
6517
|
return subfieldName.substring(lastDotIndex + 1);
|
|
6591
6518
|
};
|
|
6592
6519
|
function CustomLocalizedTextInput(props) {
|
|
6593
|
-
var _value$language;
|
|
6594
6520
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
6595
6521
|
language: applicationContext.dataLocale,
|
|
6596
6522
|
languages: applicationContext.project.languages
|
|
@@ -6616,7 +6542,7 @@ function CustomLocalizedTextInput(props) {
|
|
|
6616
6542
|
props.renderWarnings && props.handleWarningChange(props.name, props.fieldDefinition, rawValue);
|
|
6617
6543
|
});
|
|
6618
6544
|
const InputComponent = isMultiLine ? uiKit.LocalizedMultilineTextInput : uiKit.LocalizedTextInput;
|
|
6619
|
-
const tooltipTitle = isMultiLine ? '' : value ?
|
|
6545
|
+
const tooltipTitle = isMultiLine ? '' : value ? value[language] ?? '' : '';
|
|
6620
6546
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
6621
6547
|
title: tooltipTitle,
|
|
6622
6548
|
children: jsxRuntime.jsx(InputComponent, {
|
|
@@ -6665,7 +6591,7 @@ const fixAmount = value => {
|
|
|
6665
6591
|
// data user just entered effectively preventing full data from being entered.
|
|
6666
6592
|
const fixEnteredValue = (newValue, initialValue, currencies) => {
|
|
6667
6593
|
const withFixedCurrency = fixCurrencyCode(newValue, currencies);
|
|
6668
|
-
if (!
|
|
6594
|
+
if (!initialValue?.amount) {
|
|
6669
6595
|
return fixAmount(withFixedCurrency);
|
|
6670
6596
|
}
|
|
6671
6597
|
return withFixedCurrency;
|
|
@@ -6732,19 +6658,19 @@ function ownKeys$R(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
6732
6658
|
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__default["default"](_context6 = ownKeys$R(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context7 = ownKeys$R(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
6733
6659
|
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 } } } };
|
|
6734
6660
|
const mapAttributeDefinition = definition => {
|
|
6735
|
-
var _context,
|
|
6661
|
+
var _context, _context2, _context3, _context4;
|
|
6736
6662
|
return _objectSpread$R(_objectSpread$R({}, definition), {}, {
|
|
6737
6663
|
required: definition.isRequired,
|
|
6738
6664
|
inputTip: l10n.transformLocalizedFieldToLocalizedString(definition.inputTipAllLocales),
|
|
6739
6665
|
label: l10n.transformLocalizedFieldToLocalizedString(definition.labelAllLocales),
|
|
6740
|
-
type: _includesInstanceProperty__default["default"](_context = ['enum', 'lenum']).call(_context,
|
|
6666
|
+
type: _includesInstanceProperty__default["default"](_context = ['enum', 'lenum']).call(_context, definition.type?.elementType?.name) ? _objectSpread$R(_objectSpread$R({}, definition.type), {}, {
|
|
6741
6667
|
elementType: _objectSpread$R(_objectSpread$R({}, definition.type.elementType), {}, {
|
|
6742
6668
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](definition.type.elementType).results).call(_context2, value => ({
|
|
6743
6669
|
key: value.key,
|
|
6744
6670
|
label: value.label || l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
6745
6671
|
}))
|
|
6746
6672
|
})
|
|
6747
|
-
}) : _includesInstanceProperty__default["default"](_context3 = ['enum', 'lenum']).call(_context3,
|
|
6673
|
+
}) : _includesInstanceProperty__default["default"](_context3 = ['enum', 'lenum']).call(_context3, definition.type?.name) ? _objectSpread$R(_objectSpread$R({}, definition.type), {}, {
|
|
6748
6674
|
values: _mapInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](definition.type).results).call(_context4, value => ({
|
|
6749
6675
|
key: value.key,
|
|
6750
6676
|
label: value.label || l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -7082,8 +7008,7 @@ const CustomNestedInput = /*#__PURE__*/React.memo(props => {
|
|
|
7082
7008
|
CustomNestedInput.displayName = 'CustomNestedInput';
|
|
7083
7009
|
|
|
7084
7010
|
function CustomNumberInput(props) {
|
|
7085
|
-
|
|
7086
|
-
const value = (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : '';
|
|
7011
|
+
const value = props.value ?? '';
|
|
7087
7012
|
const handleChange = makeChangeHandler(rawValue => {
|
|
7088
7013
|
props.setFieldValue(props.name, !rawValue ? undefined : Number(rawValue));
|
|
7089
7014
|
props.renderWarnings && props.handleWarningChange(props.name, props.fieldDefinition, rawValue);
|
|
@@ -7157,8 +7082,7 @@ function CustomCategoryReferenceInput(props) {
|
|
|
7157
7082
|
CustomCategoryReferenceInput.displayName = 'CustomCategoryReferenceInput';
|
|
7158
7083
|
|
|
7159
7084
|
function CustomChannelReferenceInput(props) {
|
|
7160
|
-
|
|
7161
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
7085
|
+
const value = props.value?.id || '';
|
|
7162
7086
|
return jsxRuntime.jsx(ChannelPickerInput, {
|
|
7163
7087
|
value: value,
|
|
7164
7088
|
name: props.name,
|
|
@@ -7194,7 +7118,6 @@ const DropdownIndicator = () => jsxRuntime.jsx(uiKit.SearchIcon, {
|
|
|
7194
7118
|
});
|
|
7195
7119
|
DropdownIndicator.displayName = 'DropdownIndicator';
|
|
7196
7120
|
const ProductPickerInput = _ref => {
|
|
7197
|
-
var _currentOption$data$l, _currentOption$data;
|
|
7198
7121
|
let isClearable = _ref.isClearable,
|
|
7199
7122
|
isDisabled = _ref.isDisabled,
|
|
7200
7123
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -7215,20 +7138,19 @@ const ProductPickerInput = _ref => {
|
|
|
7215
7138
|
loadingError = _useState2[0],
|
|
7216
7139
|
setLoadingError = _useState2[1];
|
|
7217
7140
|
const convertProductToOption = React.useCallback(product => {
|
|
7218
|
-
var _masterData$current;
|
|
7219
7141
|
if (!product) return null;
|
|
7220
7142
|
const id = product.id,
|
|
7221
7143
|
key = product.key,
|
|
7222
7144
|
masterData = product.masterData;
|
|
7223
|
-
const localizedName = formatLocalizedFieldToString(
|
|
7145
|
+
const localizedName = formatLocalizedFieldToString(masterData.current?.nameAllLocales);
|
|
7224
7146
|
return {
|
|
7225
|
-
label: localizedName + (key ?
|
|
7147
|
+
label: localizedName + (key ? ` (key: ${key})` : ''),
|
|
7226
7148
|
value: id,
|
|
7227
7149
|
name: localizedName,
|
|
7228
7150
|
key
|
|
7229
7151
|
};
|
|
7230
7152
|
}, [formatLocalizedFieldToString]);
|
|
7231
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
7153
|
+
const prefixSearchFields = React.useMemo(() => [`masterData.current.name.${dataLocale}`, 'key'], [dataLocale]);
|
|
7232
7154
|
const loadOptions = useLoadOptions({
|
|
7233
7155
|
query: GetProductsQuery,
|
|
7234
7156
|
prefixSearchFields
|
|
@@ -7259,12 +7181,12 @@ const ProductPickerInput = _ref => {
|
|
|
7259
7181
|
setLoadingError(null);
|
|
7260
7182
|
handleInternalInputChange(event);
|
|
7261
7183
|
}, [handleInternalInputChange]);
|
|
7262
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
7184
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
7263
7185
|
React.useEffect(() => {
|
|
7264
7186
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
7265
7187
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
7266
7188
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
7267
|
-
const tooltipTitle =
|
|
7189
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
7268
7190
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
7269
7191
|
max: "scale",
|
|
7270
7192
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -7304,8 +7226,7 @@ const ProductPickerInput = _ref => {
|
|
|
7304
7226
|
ProductPickerInput.displayName = 'ProductPickerInput';
|
|
7305
7227
|
|
|
7306
7228
|
function CustomProductReferenceInput(props) {
|
|
7307
|
-
|
|
7308
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
7229
|
+
const value = props.value?.id || '';
|
|
7309
7230
|
return jsxRuntime.jsx(ProductPickerInput, {
|
|
7310
7231
|
value: value,
|
|
7311
7232
|
name: props.name,
|
|
@@ -7323,8 +7244,7 @@ function CustomProductReferenceInput(props) {
|
|
|
7323
7244
|
CustomProductReferenceInput.displayName = 'CustomProductReferenceInput';
|
|
7324
7245
|
|
|
7325
7246
|
function CustomProductTypeReferenceInput(props) {
|
|
7326
|
-
|
|
7327
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
7247
|
+
const value = props.value?.id || '';
|
|
7328
7248
|
return jsxRuntime.jsx(ProductTypePickerInput, {
|
|
7329
7249
|
value: value,
|
|
7330
7250
|
name: props.name,
|
|
@@ -7341,8 +7261,7 @@ function CustomProductTypeReferenceInput(props) {
|
|
|
7341
7261
|
CustomProductTypeReferenceInput.displayName = 'CustomProductTypeReferenceInput';
|
|
7342
7262
|
|
|
7343
7263
|
function CustomRawIdReferenceInput(props) {
|
|
7344
|
-
|
|
7345
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
7264
|
+
const value = props.value?.id || '';
|
|
7346
7265
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
7347
7266
|
title: value,
|
|
7348
7267
|
children: jsxRuntime.jsx(uiKit.TextInput, {
|
|
@@ -7360,8 +7279,7 @@ function CustomRawIdReferenceInput(props) {
|
|
|
7360
7279
|
CustomRawIdReferenceInput.displayName = 'CustomRawIdReferenceInput';
|
|
7361
7280
|
|
|
7362
7281
|
function CustomStateReferenceInput(props) {
|
|
7363
|
-
|
|
7364
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
7282
|
+
const value = props.value?.id || '';
|
|
7365
7283
|
return jsxRuntime.jsx(StatePickerInput, {
|
|
7366
7284
|
value: value,
|
|
7367
7285
|
name: props.name,
|
|
@@ -7497,14 +7415,12 @@ const nonSetComponents = {
|
|
|
7497
7415
|
};
|
|
7498
7416
|
const CustomFieldInput = /*#__PURE__*/React.memo(props => {
|
|
7499
7417
|
const InputComponent = React.useMemo(() => {
|
|
7500
|
-
|
|
7501
|
-
const typeName = (_props$fieldDefinitio = props.fieldDefinition.type) === null || _props$fieldDefinitio === void 0 ? void 0 : _props$fieldDefinitio.name.toLowerCase();
|
|
7418
|
+
const typeName = props.fieldDefinition.type?.name.toLowerCase();
|
|
7502
7419
|
if (typeName === 'set') {
|
|
7503
|
-
var _getSetElementType;
|
|
7504
7420
|
// Boolean is the only set element with peculiarities (i.e. way more
|
|
7505
7421
|
// convenient for user to work with it as with select input with three values:
|
|
7506
7422
|
// [true], [false] and [true, false]).
|
|
7507
|
-
if (
|
|
7423
|
+
if (getType(props.fieldDefinition)?.name.toLowerCase() === CUSTOM_FIELD_TYPES.boolean) {
|
|
7508
7424
|
return CustomBooleanInputSet;
|
|
7509
7425
|
}
|
|
7510
7426
|
// All the rest sets are just a fancy wrapper around single-item components
|
|
@@ -7571,10 +7487,9 @@ function ownKeys$P(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
7571
7487
|
function _objectSpread$P(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$P(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$P(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
7572
7488
|
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 } } } };
|
|
7573
7489
|
const CustomFieldsLabelHint = _ref2 => {
|
|
7574
|
-
var _type$name;
|
|
7575
7490
|
let fieldDefinition = _ref2.fieldDefinition;
|
|
7576
7491
|
const type = getType(fieldDefinition);
|
|
7577
|
-
const isReference =
|
|
7492
|
+
const isReference = type.name?.toLowerCase() === 'reference';
|
|
7578
7493
|
const referenceTypeId = type.referenceTypeId;
|
|
7579
7494
|
const isCartDiscountsReference = isReference && referenceTypeId === SEARCHABLE_REFERENCES.cartDiscount;
|
|
7580
7495
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
@@ -7592,7 +7507,7 @@ const CustomFieldsLabelHint = _ref2 => {
|
|
|
7592
7507
|
data = _useQuery.data,
|
|
7593
7508
|
loading = _useQuery.loading;
|
|
7594
7509
|
if (loading) return null;
|
|
7595
|
-
if (
|
|
7510
|
+
if (data?.cartDiscounts.total > QUERY_MAX_LIMIT) {
|
|
7596
7511
|
return jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
7597
7512
|
alignItems: "center",
|
|
7598
7513
|
children: [jsxRuntime.jsx(uiKit.WarningIcon, {
|
|
@@ -7619,17 +7534,17 @@ function CustomFieldsProductTypeReferenceSubtitle() {
|
|
|
7619
7534
|
// TODO(pa3): this logic may be misplaced and probably
|
|
7620
7535
|
// should belong to <CustomReferenceInput /> component instead.
|
|
7621
7536
|
function CustomFieldsLabelSubtitle(_ref3) {
|
|
7622
|
-
var
|
|
7537
|
+
var _context;
|
|
7623
7538
|
let fieldDefinition = _ref3.fieldDefinition;
|
|
7624
7539
|
const _useIntl2 = reactIntl.useIntl(),
|
|
7625
7540
|
formatMessage = _useIntl2.formatMessage;
|
|
7626
7541
|
const type = getType(fieldDefinition);
|
|
7627
|
-
const isReference =
|
|
7542
|
+
const isReference = type.name?.toLowerCase() === 'reference';
|
|
7628
7543
|
if (!isReference) return null;
|
|
7629
7544
|
const referenceTypeId = type.referenceTypeId;
|
|
7630
7545
|
const referenceTypeName = capitalizeFirst(referenceTypeId);
|
|
7631
7546
|
if (_includesInstanceProperty__default["default"](_context = [SEARCHABLE_REFERENCES.category, SEARCHABLE_REFERENCES.cartDiscount]).call(_context, referenceTypeId)) return referenceTypeName;
|
|
7632
|
-
return referenceTypeId === SEARCHABLE_REFERENCES.product ? formatMessage(messages$t.productReferenceLabel) : referenceTypeId === SEARCHABLE_REFERENCES.productType ? jsxRuntime.jsx(CustomFieldsProductTypeReferenceSubtitle, {}) : referenceTypeId === SEARCHABLE_REFERENCES.channel ? formatMessage(messages$t.channelReferenceLabel) : referenceTypeId === SEARCHABLE_REFERENCES.state ? formatMessage(messages$t.stateReferenceLabel) :
|
|
7547
|
+
return referenceTypeId === SEARCHABLE_REFERENCES.product ? formatMessage(messages$t.productReferenceLabel) : referenceTypeId === SEARCHABLE_REFERENCES.productType ? jsxRuntime.jsx(CustomFieldsProductTypeReferenceSubtitle, {}) : referenceTypeId === SEARCHABLE_REFERENCES.channel ? formatMessage(messages$t.channelReferenceLabel) : referenceTypeId === SEARCHABLE_REFERENCES.state ? formatMessage(messages$t.stateReferenceLabel) : `${referenceTypeName} ID`;
|
|
7633
7548
|
}
|
|
7634
7549
|
const Portal = props => /*#__PURE__*/ReactDOM__default["default"].createPortal(props.children, document.body);
|
|
7635
7550
|
var _ref$1 = {
|
|
@@ -7641,7 +7556,7 @@ function CustomFieldsCountIndicator(_ref4) {
|
|
|
7641
7556
|
const formatLocalizedField = useFormatLocalizedFieldToString();
|
|
7642
7557
|
const _useIntl3 = reactIntl.useIntl(),
|
|
7643
7558
|
formatMessage = _useIntl3.formatMessage;
|
|
7644
|
-
return
|
|
7559
|
+
return assignedAttributeGroups?.length > 1 ? jsxRuntime.jsx(uiKit.Tooltip, {
|
|
7645
7560
|
title: formatMessage(messages$t.attributeGroupCountTooltip, {
|
|
7646
7561
|
attributeGroups: _mapInstanceProperty__default["default"](assignedAttributeGroups).call(assignedAttributeGroups, assignedAttributeGroup => formatLocalizedField(assignedAttributeGroup.nameAllLocales)).join(', '),
|
|
7647
7562
|
count: assignedAttributeGroups.length
|
|
@@ -7900,11 +7815,10 @@ const useDnDContext = () => {
|
|
|
7900
7815
|
|
|
7901
7816
|
const _excluded$1 = ["WrapperComponent"];
|
|
7902
7817
|
function ownKeys$J(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7903
|
-
function _objectSpread$J(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
7818
|
+
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__default["default"](_context = ownKeys$J(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$J(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
7904
7819
|
const getFieldName = (parentName, fieldName) => {
|
|
7905
|
-
var _context;
|
|
7906
7820
|
if (!parentName) return fieldName;
|
|
7907
|
-
return
|
|
7821
|
+
return `${parentName}.${fieldName}`;
|
|
7908
7822
|
};
|
|
7909
7823
|
const isNested = fieldDefinition => {
|
|
7910
7824
|
const type = fieldDefinition.type;
|
|
@@ -7935,7 +7849,6 @@ const CustomFieldsInternal = _ref => {
|
|
|
7935
7849
|
return jsxRuntime.jsx(DroppableWrapper, {
|
|
7936
7850
|
onDragEnd: onDragEnd,
|
|
7937
7851
|
children: _mapInstanceProperty__default["default"](fieldDefinitions).call(fieldDefinitions, (fieldDefinition, index) => {
|
|
7938
|
-
var _context2, _context3;
|
|
7939
7852
|
const fieldName = getFieldName(props.name, fieldDefinition.name);
|
|
7940
7853
|
const isTouched = Boolean(formik.getIn(touched, fieldName));
|
|
7941
7854
|
const fieldErrors = formik.getIn(errors, fieldName);
|
|
@@ -7960,7 +7873,7 @@ const CustomFieldsInternal = _ref => {
|
|
|
7960
7873
|
onBlur: handleBlur,
|
|
7961
7874
|
setFieldValue: props.setFieldValue,
|
|
7962
7875
|
hasError: hasError,
|
|
7963
|
-
hasWarning: props.renderWarnings &&
|
|
7876
|
+
hasWarning: props.renderWarnings && status?.warnings[fieldName],
|
|
7964
7877
|
handleWarningChange: props.handleWarningChange,
|
|
7965
7878
|
renderWarnings: props.renderWarnings
|
|
7966
7879
|
};
|
|
@@ -7968,36 +7881,33 @@ const CustomFieldsInternal = _ref => {
|
|
|
7968
7881
|
return jsxRuntime.jsx(formik.FastField, {
|
|
7969
7882
|
name: fieldName,
|
|
7970
7883
|
validate: validate,
|
|
7971
|
-
children: () => {
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
children: jsxRuntime.
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
isTouched: isTouched,
|
|
7993
|
-
errors: fieldErrors
|
|
7994
|
-
})]
|
|
7884
|
+
children: () => jsxRuntime.jsx(DraggableWrapper, {
|
|
7885
|
+
draggableKey: `${fieldName}-${index}`,
|
|
7886
|
+
draggableId: `${fieldName}-${index}`,
|
|
7887
|
+
index: index,
|
|
7888
|
+
children: jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
7889
|
+
scale: "xs",
|
|
7890
|
+
children: jsxRuntime.jsxs("div", {
|
|
7891
|
+
"aria-invalid": _Object$keys__default["default"](fieldErrors ?? {}).length > 0,
|
|
7892
|
+
"aria-errormessage": `${fieldName}-error`,
|
|
7893
|
+
id: `${fieldName}-error`,
|
|
7894
|
+
children: [jsxRuntime.jsx(CustomFieldsLabel, {
|
|
7895
|
+
name: fieldName,
|
|
7896
|
+
fieldDefinition: fieldDefinition
|
|
7897
|
+
}), jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
7898
|
+
scale: "xs",
|
|
7899
|
+
alignItems: "stretch",
|
|
7900
|
+
children: [WrapperComponent ? jsxRuntime.jsx(WrapperComponent, {
|
|
7901
|
+
children: Field
|
|
7902
|
+
}) : Field, props.renderWarnings && status?.warnings[fieldName] && props.renderCustomWarnings(fieldDefinition), jsxRuntime.jsx(CustomFieldErrors, {
|
|
7903
|
+
isTouched: isTouched,
|
|
7904
|
+
errors: fieldErrors
|
|
7995
7905
|
})]
|
|
7996
|
-
})
|
|
7906
|
+
})]
|
|
7997
7907
|
})
|
|
7998
|
-
})
|
|
7999
|
-
}
|
|
8000
|
-
},
|
|
7908
|
+
})
|
|
7909
|
+
})
|
|
7910
|
+
}, `${fieldName}-${index}-${fieldKey}`);
|
|
8001
7911
|
})
|
|
8002
7912
|
});
|
|
8003
7913
|
};
|
|
@@ -8010,9 +7920,9 @@ function ownKeys$I(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
8010
7920
|
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__default["default"](_context7 = ownKeys$I(Object(t), !0)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context8 = ownKeys$I(Object(t))).call(_context8, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
8011
7921
|
const getTypeName = type => type.name.toLowerCase();
|
|
8012
7922
|
const findLabel = (enumType, key) => {
|
|
8013
|
-
var
|
|
7923
|
+
var _context;
|
|
8014
7924
|
const emptyValue = getTypeName(enumType) === 'enum' ? '' : {};
|
|
8015
|
-
return
|
|
7925
|
+
return _findInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](enumType)).call(_context, value => value.key === key)?.label ?? emptyValue;
|
|
8016
7926
|
};
|
|
8017
7927
|
const convertEnumValues = (value, attributeDefinition) => {
|
|
8018
7928
|
var _context2, _context3;
|
|
@@ -8078,7 +7988,7 @@ const attributesMapToNameValuePairs = map => {
|
|
|
8078
7988
|
const _excluded = ["WrapperComponent"];
|
|
8079
7989
|
const getAttributeShortName = (fullName, attributesPrefix) => {
|
|
8080
7990
|
if (!attributesPrefix) return fullName;
|
|
8081
|
-
return fullName.replace(
|
|
7991
|
+
return fullName.replace(`${attributesPrefix}.`, '');
|
|
8082
7992
|
};
|
|
8083
7993
|
function ProductAttributes(_ref) {
|
|
8084
7994
|
let WrapperComponent = _ref.WrapperComponent,
|
|
@@ -8176,7 +8086,7 @@ var pickerMessages = reactIntl.defineMessages({
|
|
|
8176
8086
|
});
|
|
8177
8087
|
|
|
8178
8088
|
function ownKeys$H(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8179
|
-
function _objectSpread$H(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
8089
|
+
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__default["default"](_context = ownKeys$H(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$H(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
8180
8090
|
const PRODUCT_SELECTION_MODES = {
|
|
8181
8091
|
INCLUSION: 'Individual',
|
|
8182
8092
|
EXCLUSION: 'IndividualExclusion'
|
|
@@ -8187,11 +8097,10 @@ const PRODUCT_SELECTION_MODES_LABELS = {
|
|
|
8187
8097
|
};
|
|
8188
8098
|
const getMode = mode => mode === PRODUCT_SELECTION_MODES.INCLUSION || mode === PRODUCT_SELECTION_MODES_LABELS.INCLUSION ? 'inclusion' : 'exclusion';
|
|
8189
8099
|
const addModeToLabel = function (ps) {
|
|
8190
|
-
var _context;
|
|
8191
8100
|
let enableExcludingProducts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
8192
8101
|
if (!ps) return undefined;
|
|
8193
8102
|
return _objectSpread$H(_objectSpread$H({}, ps), {}, {
|
|
8194
|
-
label:
|
|
8103
|
+
label: `${ps?.label}${enableExcludingProducts ? ` (type: ${getMode(ps?.mode)})` : ''}`
|
|
8195
8104
|
});
|
|
8196
8105
|
};
|
|
8197
8106
|
|
|
@@ -8208,7 +8117,7 @@ const getValueFromOptions$3 = _ref => {
|
|
|
8208
8117
|
// handle async-select-field value transformation
|
|
8209
8118
|
if (isMulti) {
|
|
8210
8119
|
var _context;
|
|
8211
|
-
return _mapInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](allProductSelectionOptions).call(allProductSelectionOptions, ps => currentlySelectedProductSelections
|
|
8120
|
+
return _mapInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](allProductSelectionOptions).call(allProductSelectionOptions, ps => currentlySelectedProductSelections?.includes(ps.value))).call(_context, ps => addModeToLabel(ps, enableExcludingProducts));
|
|
8212
8121
|
}
|
|
8213
8122
|
|
|
8214
8123
|
// in case it is not multiselect, then a single valued async-select-input is being requested and the value should have proper format
|
|
@@ -8220,7 +8129,6 @@ const emptyStoreOption$1 = intl => [{
|
|
|
8220
8129
|
isDisabled: true
|
|
8221
8130
|
}];
|
|
8222
8131
|
function ProductSelectionsAsyncSelectDropdown(props) {
|
|
8223
|
-
var _productSelectionsFet3;
|
|
8224
8132
|
const intl = reactIntl.useIntl();
|
|
8225
8133
|
const enableExcludingProducts = applicationShell.useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
8226
8134
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -8233,17 +8141,13 @@ function ProductSelectionsAsyncSelectDropdown(props) {
|
|
|
8233
8141
|
})),
|
|
8234
8142
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
8235
8143
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8236
|
-
const productSelections = React.useMemo(() =>
|
|
8237
|
-
var _productSelectionsFet, _productSelectionsFet2;
|
|
8238
|
-
return (_productSelectionsFet = (_productSelectionsFet2 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet2 === void 0 ? void 0 : _productSelectionsFet2.results) !== null && _productSelectionsFet !== void 0 ? _productSelectionsFet : [];
|
|
8239
|
-
}, [(_productSelectionsFet3 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet3 === void 0 ? void 0 : _productSelectionsFet3.results]);
|
|
8144
|
+
const productSelections = React.useMemo(() => productSelectionsFetcher.productSelections?.results ?? [], [productSelectionsFetcher.productSelections?.results]);
|
|
8240
8145
|
const filteredProductSelections = _filterInstanceProperty__default["default"](productSelections).call(productSelections, ps => {
|
|
8241
8146
|
var _context2;
|
|
8242
8147
|
return !_includesInstanceProperty__default["default"](_context2 = props.excludedProductSelectionIds).call(_context2, ps.id);
|
|
8243
8148
|
});
|
|
8244
8149
|
const onOptionClick = event => {
|
|
8245
|
-
|
|
8246
|
-
const productSelectionId = (_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.value;
|
|
8150
|
+
const productSelectionId = event.target.value?.value;
|
|
8247
8151
|
const currentProductSelection = _findInstanceProperty__default["default"](productSelections).call(productSelections, productSelection => productSelection.id === productSelectionId);
|
|
8248
8152
|
props.onChange(currentProductSelection);
|
|
8249
8153
|
};
|
|
@@ -8326,7 +8230,6 @@ const mapProductSelectionsToOptions$1 = memoize__default["default"](function ()
|
|
|
8326
8230
|
let enableExcludingProducts = arguments.length > 4 ? arguments[4] : undefined;
|
|
8327
8231
|
const selectedPSList = _Array$isArray__default["default"](selectedPS) ? selectedPS : [selectedPS];
|
|
8328
8232
|
return _mapInstanceProperty__default["default"](productSelections).call(productSelections, productSelection => {
|
|
8329
|
-
var _context;
|
|
8330
8233
|
const label = l10n.formatLocalizedString(productSelection, {
|
|
8331
8234
|
key: 'name',
|
|
8332
8235
|
locale: dataLocale,
|
|
@@ -8335,14 +8238,13 @@ const mapProductSelectionsToOptions$1 = memoize__default["default"](function ()
|
|
|
8335
8238
|
return {
|
|
8336
8239
|
id: productSelection.id,
|
|
8337
8240
|
value: productSelection.id,
|
|
8338
|
-
label:
|
|
8241
|
+
label: `${label}${_includesInstanceProperty__default["default"](selectedPSList).call(selectedPSList, productSelection.id) && enableExcludingProducts ? ` (type: ${getMode(productSelection.mode)})` : ''}`,
|
|
8339
8242
|
key: productSelection.key,
|
|
8340
8243
|
mode: getMode(productSelection.mode)
|
|
8341
8244
|
};
|
|
8342
8245
|
});
|
|
8343
8246
|
});
|
|
8344
8247
|
function ProductSelectionBasicSelectDropdown(props) {
|
|
8345
|
-
var _productSelectionsFet, _productSelectionsFet2;
|
|
8346
8248
|
const intl = reactIntl.useIntl();
|
|
8347
8249
|
const enableExcludingProducts = applicationShell.useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
8348
8250
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -8355,10 +8257,10 @@ function ProductSelectionBasicSelectDropdown(props) {
|
|
|
8355
8257
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
8356
8258
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8357
8259
|
if (productSelectionsFetcher.isLoading) return jsxRuntime.jsx(CenteredLoadingSpinner, {});
|
|
8358
|
-
const productSelections =
|
|
8260
|
+
const productSelections = productSelectionsFetcher.productSelections?.results ?? [];
|
|
8359
8261
|
const filteredProductSelections = _filterInstanceProperty__default["default"](productSelections).call(productSelections, ps => {
|
|
8360
|
-
var
|
|
8361
|
-
return !_includesInstanceProperty__default["default"](
|
|
8262
|
+
var _context;
|
|
8263
|
+
return !_includesInstanceProperty__default["default"](_context = props.excludedProductSelectionIds).call(_context, ps.id);
|
|
8362
8264
|
});
|
|
8363
8265
|
const onOptionClick = event => {
|
|
8364
8266
|
const productSelectionId = event.target.value;
|
|
@@ -8395,15 +8297,11 @@ function ProductSelectionBasicSelectDropdown(props) {
|
|
|
8395
8297
|
}
|
|
8396
8298
|
|
|
8397
8299
|
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 } } } };
|
|
8398
|
-
const createQueryVariables$4 = (productSelections, predicateField) => {
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
limit: 500
|
|
8403
|
-
};
|
|
8404
|
-
};
|
|
8300
|
+
const createQueryVariables$4 = (productSelections, predicateField) => ({
|
|
8301
|
+
where: `${predicateField} in (${_mapInstanceProperty__default["default"](productSelections).call(productSelections, ps => `"${ps}"`).join(', ')})`,
|
|
8302
|
+
limit: 500
|
|
8303
|
+
});
|
|
8405
8304
|
const useProductSelectionsByFieldFetcher = (productSelections, predicateField) => {
|
|
8406
|
-
var _productSelectionsQue, _productSelectionsQue2;
|
|
8407
8305
|
const productSelectionList = _Array$isArray__default["default"](productSelections) ? productSelections : [productSelections];
|
|
8408
8306
|
const productSelectionsQuery = react.useQuery(ProductSelectionsPickerFetcher$1, {
|
|
8409
8307
|
context: {
|
|
@@ -8413,7 +8311,7 @@ const useProductSelectionsByFieldFetcher = (productSelections, predicateField) =
|
|
|
8413
8311
|
skip: productSelectionList.length === 0
|
|
8414
8312
|
});
|
|
8415
8313
|
return {
|
|
8416
|
-
productSelections:
|
|
8314
|
+
productSelections: productSelectionsQuery.data?.productSelections.results ?? [],
|
|
8417
8315
|
isLoading: productSelectionsQuery.loading
|
|
8418
8316
|
};
|
|
8419
8317
|
};
|
|
@@ -8454,8 +8352,8 @@ const createQueryVariables$3 = _ref3 => {
|
|
|
8454
8352
|
var _context;
|
|
8455
8353
|
let searchText = _ref3.searchText;
|
|
8456
8354
|
const sanitizedSearchText = sanitize(_trimInstanceProperty__default["default"](searchText).call(searchText, searchText));
|
|
8457
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
8458
|
-
const keyQuery =
|
|
8355
|
+
const idQuery = isUUID(sanitizedSearchText) && `id = "${sanitizedSearchText}"`;
|
|
8356
|
+
const keyQuery = `key = "${sanitizedSearchText}"`;
|
|
8459
8357
|
const searchTextQuery = _filterInstanceProperty__default["default"](_context = [idQuery, keyQuery]).call(_context, Boolean).join(' or ');
|
|
8460
8358
|
return {
|
|
8461
8359
|
where: searchTextQuery || undefined
|
|
@@ -8478,7 +8376,6 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8478
8376
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8479
8377
|
const productSelectionsByFieldFetcher = useProductSelectionsByFieldFetcher(props.value, props.renderSelectInputOptionValuesByField);
|
|
8480
8378
|
const handleLoadOptions = async searchText => {
|
|
8481
|
-
var _data$productSelectio, _data$productSelectio2;
|
|
8482
8379
|
const _await$client$query = await client$1.query({
|
|
8483
8380
|
query: ProductSelectionsPickerFetcher,
|
|
8484
8381
|
variables: createQueryVariables$3({
|
|
@@ -8490,7 +8387,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8490
8387
|
fetchPolicy: 'network-only'
|
|
8491
8388
|
}),
|
|
8492
8389
|
data = _await$client$query.data;
|
|
8493
|
-
const matchedProductSelections =
|
|
8390
|
+
const matchedProductSelections = data?.productSelections?.results ?? [];
|
|
8494
8391
|
const updatedProductSelections = _mapInstanceProperty__default["default"](matchedProductSelections).call(matchedProductSelections, convertProductSelectionFromGraphQl);
|
|
8495
8392
|
const filteredProductSelections = _filterInstanceProperty__default["default"](updatedProductSelections).call(updatedProductSelections, ps => {
|
|
8496
8393
|
var _context2;
|
|
@@ -8506,8 +8403,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8506
8403
|
};
|
|
8507
8404
|
const loadOptionsDebounced = debounce__default["default"](handleLoadOptions, 500);
|
|
8508
8405
|
const onOptionClick = event => {
|
|
8509
|
-
|
|
8510
|
-
const productSelectionId = (_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.value;
|
|
8406
|
+
const productSelectionId = event.target.value?.value;
|
|
8511
8407
|
const currentProductSelection = _findInstanceProperty__default["default"](productionSelectionResults).call(productionSelectionResults, productSelection => productSelection.id === productSelectionId);
|
|
8512
8408
|
props.onChange(currentProductSelection);
|
|
8513
8409
|
};
|
|
@@ -8559,11 +8455,11 @@ function ModeSelectInputOption(props) {
|
|
|
8559
8455
|
scale: "xs",
|
|
8560
8456
|
children: [jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
8561
8457
|
isBold: true,
|
|
8562
|
-
children:
|
|
8458
|
+
children: data?.label || noValueFallback
|
|
8563
8459
|
}), jsxRuntime.jsxs(uiKit.Text.Detail, {
|
|
8564
|
-
children: ["Key: ",
|
|
8460
|
+
children: ["Key: ", data?.key || noValueFallback]
|
|
8565
8461
|
}), jsxRuntime.jsxs(uiKit.Text.Detail, {
|
|
8566
|
-
children: ["Type: ",
|
|
8462
|
+
children: ["Type: ", data?.mode || noValueFallback]
|
|
8567
8463
|
})]
|
|
8568
8464
|
})
|
|
8569
8465
|
}));
|
|
@@ -8645,19 +8541,19 @@ const ScrollToFieldError = () => {
|
|
|
8645
8541
|
if (isValid) return;
|
|
8646
8542
|
const firstErrorElement = document.querySelector('[aria-invalid="true"]');
|
|
8647
8543
|
if (firstErrorElement) {
|
|
8648
|
-
var _ref, _ref2, _document$querySelect, _elementToScrollTo$sc;
|
|
8649
8544
|
// Get a reference to the label.
|
|
8650
8545
|
const firstElementId = firstErrorElement.getAttribute('id');
|
|
8651
|
-
const localizedInputIndex = _indexOfInstanceProperty__default["default"](firstElementId).call(firstElementId,
|
|
8546
|
+
const localizedInputIndex = _indexOfInstanceProperty__default["default"](firstElementId).call(firstElementId, `.${dataLocale}`);
|
|
8652
8547
|
|
|
8653
8548
|
// check if locale is appended then remove it from id
|
|
8654
|
-
const id = localizedInputIndex > -1 ? firstElementId.replace(
|
|
8549
|
+
const id = localizedInputIndex > -1 ? firstElementId.replace(`.${dataLocale}`, '') : firstElementId;
|
|
8655
8550
|
|
|
8656
8551
|
// Scroll to the label (if found), otherwise to the input element itself.
|
|
8657
8552
|
|
|
8658
|
-
const elementToScrollTo =
|
|
8659
|
-
|
|
8660
|
-
(
|
|
8553
|
+
const elementToScrollTo =
|
|
8554
|
+
// div is used only for custom fields
|
|
8555
|
+
document.querySelector(`div[aria-errormessage="${firstElementId}"]`) ?? document.querySelector(`label[for="${id}"]`) ?? document.querySelector(`label#${id}`) ?? firstErrorElement;
|
|
8556
|
+
elementToScrollTo.scrollIntoView?.({
|
|
8661
8557
|
behavior: 'smooth'
|
|
8662
8558
|
});
|
|
8663
8559
|
}
|
|
@@ -8683,8 +8579,7 @@ var styles$9 = {
|
|
|
8683
8579
|
"search-mode-menu": "selectable-field-search-input-module__search-mode-menu___Od6Le"
|
|
8684
8580
|
};
|
|
8685
8581
|
const SelectableFieldSearchInput = props => {
|
|
8686
|
-
|
|
8687
|
-
const _useState = React.useState((_props$initialValue = props.initialValue) !== null && _props$initialValue !== void 0 ? _props$initialValue : ''),
|
|
8582
|
+
const _useState = React.useState(props.initialValue ?? ''),
|
|
8688
8583
|
_useState2 = _slicedToArray(_useState, 2),
|
|
8689
8584
|
searchText = _useState2[0],
|
|
8690
8585
|
setSearchText = _useState2[1];
|
|
@@ -8720,7 +8615,7 @@ const SelectableFieldSearchInput = props => {
|
|
|
8720
8615
|
});
|
|
8721
8616
|
},
|
|
8722
8617
|
onReset: props.onReset,
|
|
8723
|
-
placeholder:
|
|
8618
|
+
placeholder: props.placeholder ?? intl.formatMessage(messages$r.placeholder),
|
|
8724
8619
|
isDisabled: props.disabled
|
|
8725
8620
|
})
|
|
8726
8621
|
});
|
|
@@ -8770,7 +8665,6 @@ const UPPER_STORES_LIMIT = 500;
|
|
|
8770
8665
|
|
|
8771
8666
|
// map store to options
|
|
8772
8667
|
const mapStoresToOptions = _ref => {
|
|
8773
|
-
var _store$productSelecti;
|
|
8774
8668
|
let store = _ref.store,
|
|
8775
8669
|
renderSelectInputOptionValuesByField = _ref.renderSelectInputOptionValuesByField,
|
|
8776
8670
|
dataLocale = _ref.dataLocale;
|
|
@@ -8781,14 +8675,14 @@ const mapStoresToOptions = _ref => {
|
|
|
8781
8675
|
const localizedName = l10n.formatLocalizedString(convertedStore, {
|
|
8782
8676
|
key: 'name',
|
|
8783
8677
|
locale: dataLocale,
|
|
8784
|
-
fallback:
|
|
8678
|
+
fallback: `${store.key} (key)`
|
|
8785
8679
|
});
|
|
8786
8680
|
return {
|
|
8787
8681
|
label: localizedName,
|
|
8788
8682
|
value: renderSelectInputOptionValuesByField === 'key' ? store.key : store.id,
|
|
8789
8683
|
key: store.key,
|
|
8790
8684
|
id: store.id,
|
|
8791
|
-
productSelections:
|
|
8685
|
+
productSelections: store.productSelections?.map(productSelectionRef => productSelectionRef.productSelection.id)
|
|
8792
8686
|
};
|
|
8793
8687
|
};
|
|
8794
8688
|
|
|
@@ -8817,7 +8711,7 @@ const getValueFromOptions$1 = _ref => {
|
|
|
8817
8711
|
isMulti = _ref.isMulti;
|
|
8818
8712
|
// handle async-select-field value transformation
|
|
8819
8713
|
if (isMulti) {
|
|
8820
|
-
return _filterInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores
|
|
8714
|
+
return _filterInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores?.includes(store.value));
|
|
8821
8715
|
}
|
|
8822
8716
|
|
|
8823
8717
|
// return value as undefined if no options is yet selected. It is needed for cases where users sets initial values as empty string
|
|
@@ -8836,7 +8730,7 @@ const emptyStoreOption = intl => [{
|
|
|
8836
8730
|
const StoresAsyncSelectInput = props => {
|
|
8837
8731
|
const intl = reactIntl.useIntl();
|
|
8838
8732
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
8839
|
-
dataLocale: applicationContext.dataLocale
|
|
8733
|
+
dataLocale: applicationContext.dataLocale || applicationContext.user?.locale
|
|
8840
8734
|
})),
|
|
8841
8735
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8842
8736
|
const keysOfStores = props.allAccessibleStoreKeysThroughDataFencePermissions;
|
|
@@ -8846,13 +8740,13 @@ const StoresAsyncSelectInput = props => {
|
|
|
8846
8740
|
sort: 'createdAt asc',
|
|
8847
8741
|
excludeExtendedStoresList: true,
|
|
8848
8742
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8849
|
-
stores:
|
|
8743
|
+
stores: keysOfStores?.length && keysOfStores,
|
|
8850
8744
|
projectKey: props.projectKey
|
|
8851
8745
|
});
|
|
8852
8746
|
const hasError = uiKit.AsyncSelectInput.isTouched(props.touched) && hasErrors$2(props.errors) || props.hasError;
|
|
8853
8747
|
const mappedStoresListOptions = React.useMemo(() => {
|
|
8854
|
-
var _context2
|
|
8855
|
-
return _mapInstanceProperty__default["default"](_context2 =
|
|
8748
|
+
var _context2;
|
|
8749
|
+
return _mapInstanceProperty__default["default"](_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8856
8750
|
store,
|
|
8857
8751
|
dataLocale,
|
|
8858
8752
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -8938,7 +8832,7 @@ const hasErrors$1 = errors => {
|
|
|
8938
8832
|
const StoresBasicSelectInput = props => {
|
|
8939
8833
|
const intl = reactIntl.useIntl();
|
|
8940
8834
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
8941
|
-
dataLocale: applicationContext.dataLocale
|
|
8835
|
+
dataLocale: applicationContext.dataLocale || applicationContext.user?.locale
|
|
8942
8836
|
})),
|
|
8943
8837
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8944
8838
|
const keysOfStores = props.allAccessibleStoreKeysThroughDataFencePermissions;
|
|
@@ -8948,31 +8842,30 @@ const StoresBasicSelectInput = props => {
|
|
|
8948
8842
|
sort: 'createdAt asc',
|
|
8949
8843
|
excludeExtendedStoresList: true,
|
|
8950
8844
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8951
|
-
stores:
|
|
8845
|
+
stores: keysOfStores?.length && keysOfStores,
|
|
8952
8846
|
projectKey: props.projectKey
|
|
8953
8847
|
});
|
|
8954
8848
|
const hasError = uiKit.SelectInput.isTouched(props.touched) && hasErrors$1(props.errors) || props.hasError;
|
|
8955
8849
|
const mappedStoresListOptions = React.useMemo(() => {
|
|
8956
|
-
var _context2
|
|
8957
|
-
const results = _mapInstanceProperty__default["default"](_context2 =
|
|
8850
|
+
var _context2;
|
|
8851
|
+
const results = _mapInstanceProperty__default["default"](_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8958
8852
|
store,
|
|
8959
8853
|
dataLocale,
|
|
8960
8854
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
8961
8855
|
}));
|
|
8962
|
-
return props
|
|
8856
|
+
return props?.renderLabel ? [{
|
|
8963
8857
|
options: getCustomGroupLabelOption(props.renderLabel)
|
|
8964
8858
|
}, {
|
|
8965
8859
|
options: results
|
|
8966
8860
|
}] : results;
|
|
8967
|
-
}, [dataLocale, storesListFetcher.stores, props.renderSelectInputOptionValuesByField, props
|
|
8861
|
+
}, [dataLocale, storesListFetcher.stores, props.renderSelectInputOptionValuesByField, props?.renderLabel]);
|
|
8968
8862
|
const handleChange = event => {
|
|
8969
|
-
|
|
8970
|
-
const
|
|
8971
|
-
const listOptions = props !== null && props !== void 0 && props.renderLabel ? mappedStoresListOptions[1].options : mappedStoresListOptions;
|
|
8863
|
+
const value = event.target.value?.value ?? event.target.value;
|
|
8864
|
+
const listOptions = props?.renderLabel ? mappedStoresListOptions[1].options : mappedStoresListOptions;
|
|
8972
8865
|
const currentStore = _findInstanceProperty__default["default"](listOptions).call(listOptions, store => store.value === value);
|
|
8973
8866
|
|
|
8974
8867
|
// We need complete store info including productSelections
|
|
8975
|
-
if (!props.shouldFetchProductSelections && !
|
|
8868
|
+
if (!props.shouldFetchProductSelections && !props?.renderLabel) {
|
|
8976
8869
|
props.onChange(event);
|
|
8977
8870
|
} else {
|
|
8978
8871
|
props.onChange({
|
|
@@ -9026,7 +8919,6 @@ StoresBasicSelectInput.defaultProps = {
|
|
|
9026
8919
|
|
|
9027
8920
|
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 } } } };
|
|
9028
8921
|
const useTotalNumberOfStoresFetcher = projectKey => {
|
|
9029
|
-
var _totalNumberOfStoresQ;
|
|
9030
8922
|
const totalNumberOfStoresQuery = react.useQuery(TotalNumberOfStores, {
|
|
9031
8923
|
context: {
|
|
9032
8924
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM,
|
|
@@ -9035,7 +8927,7 @@ const useTotalNumberOfStoresFetcher = projectKey => {
|
|
|
9035
8927
|
fetchPolicy: 'network-only'
|
|
9036
8928
|
});
|
|
9037
8929
|
return {
|
|
9038
|
-
total:
|
|
8930
|
+
total: totalNumberOfStoresQuery.data?.totalNumberOfStores.total,
|
|
9039
8931
|
isLoading: totalNumberOfStoresQuery.loading
|
|
9040
8932
|
};
|
|
9041
8933
|
};
|
|
@@ -9053,19 +8945,15 @@ const handlers$2 = {
|
|
|
9053
8945
|
};
|
|
9054
8946
|
|
|
9055
8947
|
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 } } } };
|
|
9056
|
-
const createQueryVariables$2 = (stores, predicateField, shouldFetchProductSelections) => {
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
excludeProductSelections: !shouldFetchProductSelections
|
|
9062
|
-
};
|
|
9063
|
-
};
|
|
8948
|
+
const createQueryVariables$2 = (stores, predicateField, shouldFetchProductSelections) => ({
|
|
8949
|
+
where: `${predicateField} in (${_mapInstanceProperty__default["default"](stores).call(stores, store => `"${store}"`).join(', ')})`,
|
|
8950
|
+
limit: 500,
|
|
8951
|
+
excludeProductSelections: !shouldFetchProductSelections
|
|
8952
|
+
});
|
|
9064
8953
|
const emptyStoresQueryResult = {
|
|
9065
8954
|
results: []
|
|
9066
8955
|
};
|
|
9067
8956
|
const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
9068
|
-
var _storesQuery$data;
|
|
9069
8957
|
let shouldFetchProductSelections = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
9070
8958
|
// incase of single select input stores are sent as single string literal
|
|
9071
8959
|
const storesList = _Array$isArray__default["default"](stores) ? stores : [stores];
|
|
@@ -9078,13 +8966,13 @@ const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
|
9078
8966
|
skip: storesList.length === 0
|
|
9079
8967
|
});
|
|
9080
8968
|
return {
|
|
9081
|
-
stores:
|
|
8969
|
+
stores: storesQuery.data?.storesByField || emptyStoresQueryResult,
|
|
9082
8970
|
isLoading: storesQuery.loading
|
|
9083
8971
|
};
|
|
9084
8972
|
};
|
|
9085
8973
|
|
|
9086
8974
|
function ownKeys$C(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9087
|
-
function _objectSpread$C(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
8975
|
+
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__default["default"](_context3 = ownKeys$C(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys$C(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
9088
8976
|
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 } } } };
|
|
9089
8977
|
var styles$8 = {
|
|
9090
8978
|
"renderLabelContainer": "stores-search-selector-module__renderLabelContainer___3_PBc",
|
|
@@ -9095,16 +8983,16 @@ const hasErrors = errors => {
|
|
|
9095
8983
|
return errors && _someInstanceProperty__default["default"](_context = _Object$values__default["default"](errors)).call(_context, Boolean);
|
|
9096
8984
|
};
|
|
9097
8985
|
const createQueryVariables$1 = _ref => {
|
|
9098
|
-
var _context2
|
|
8986
|
+
var _context2;
|
|
9099
8987
|
let searchText = _ref.searchText,
|
|
9100
8988
|
dataLocale = _ref.dataLocale,
|
|
9101
8989
|
allAccessibleStoreKeysThroughDataFencePermissions = _ref.allAccessibleStoreKeysThroughDataFencePermissions,
|
|
9102
8990
|
shouldFetchProductSelections = _ref.shouldFetchProductSelections;
|
|
9103
8991
|
const sanitizedSearchText = sanitize(_trimInstanceProperty__default["default"](searchText).call(searchText, searchText));
|
|
9104
|
-
const keyQuery =
|
|
8992
|
+
const keyQuery = `key = "${sanitizedSearchText}"`;
|
|
9105
8993
|
|
|
9106
8994
|
// if the user has data fence permissions then we only allow stores to fetched that user has access to
|
|
9107
|
-
if (allAccessibleStoreKeysThroughDataFencePermissions
|
|
8995
|
+
if (allAccessibleStoreKeysThroughDataFencePermissions?.length) {
|
|
9108
8996
|
// if the current search term match the accessible stores keys, then proceed with fetching the store
|
|
9109
8997
|
if (_includesInstanceProperty__default["default"](allAccessibleStoreKeysThroughDataFencePermissions).call(allAccessibleStoreKeysThroughDataFencePermissions, sanitizedSearchText)) {
|
|
9110
8998
|
return {
|
|
@@ -9120,9 +9008,9 @@ const createQueryVariables$1 = _ref => {
|
|
|
9120
9008
|
excludeProductSelections: !shouldFetchProductSelections
|
|
9121
9009
|
};
|
|
9122
9010
|
}
|
|
9123
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
9124
|
-
const nameQuery =
|
|
9125
|
-
const searchTextQuery = _filterInstanceProperty__default["default"](
|
|
9011
|
+
const idQuery = isUUID(sanitizedSearchText) && `id = "${sanitizedSearchText}"`;
|
|
9012
|
+
const nameQuery = `name(${dataLocale} = "${sanitizedSearchText}")`;
|
|
9013
|
+
const searchTextQuery = _filterInstanceProperty__default["default"](_context2 = [idQuery, nameQuery, keyQuery]).call(_context2, Boolean).join(' or ');
|
|
9126
9014
|
return {
|
|
9127
9015
|
skipFetchingStores: false,
|
|
9128
9016
|
where: searchTextQuery,
|
|
@@ -9130,7 +9018,6 @@ const createQueryVariables$1 = _ref => {
|
|
|
9130
9018
|
};
|
|
9131
9019
|
};
|
|
9132
9020
|
const getValueFromOptions = _ref2 => {
|
|
9133
|
-
var _storesByFieldFetcher, _context4;
|
|
9134
9021
|
let isMulti = _ref2.isMulti,
|
|
9135
9022
|
value = _ref2.value,
|
|
9136
9023
|
dataLocale = _ref2.dataLocale,
|
|
@@ -9139,7 +9026,7 @@ const getValueFromOptions = _ref2 => {
|
|
|
9139
9026
|
if (!value) {
|
|
9140
9027
|
return undefined;
|
|
9141
9028
|
}
|
|
9142
|
-
const selectedOptions =
|
|
9029
|
+
const selectedOptions = storesByFieldFetcher.stores?.results.map(store => mapStoresToOptions({
|
|
9143
9030
|
store,
|
|
9144
9031
|
dataLocale,
|
|
9145
9032
|
renderSelectInputOptionValuesByField: renderSelectInputOptionValuesByField
|
|
@@ -9155,7 +9042,7 @@ const getValueFromOptions = _ref2 => {
|
|
|
9155
9042
|
const StoresSearchSelectInput = props => {
|
|
9156
9043
|
// hooks
|
|
9157
9044
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
9158
|
-
dataLocale: applicationContext.dataLocale
|
|
9045
|
+
dataLocale: applicationContext.dataLocale || applicationContext.user?.locale
|
|
9159
9046
|
})),
|
|
9160
9047
|
dataLocale = _useApplicationContex.dataLocale;
|
|
9161
9048
|
const intl = reactIntl.useIntl();
|
|
@@ -9177,9 +9064,8 @@ const StoresSearchSelectInput = props => {
|
|
|
9177
9064
|
},
|
|
9178
9065
|
fetchPolicy: 'network-only'
|
|
9179
9066
|
}).then(_ref3 => {
|
|
9180
|
-
var _data$storesByWherePr, _context5;
|
|
9181
9067
|
let data = _ref3.data;
|
|
9182
|
-
const result =
|
|
9068
|
+
const result = data.storesByWherePredicate?.results.map(store => mapStoresToOptions({
|
|
9183
9069
|
store,
|
|
9184
9070
|
dataLocale,
|
|
9185
9071
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -9200,7 +9086,7 @@ const StoresSearchSelectInput = props => {
|
|
|
9200
9086
|
className: styles$8.renderLabelContainer,
|
|
9201
9087
|
children: [jsxRuntime.jsx("div", {
|
|
9202
9088
|
className: styles$8.customLabel,
|
|
9203
|
-
children:
|
|
9089
|
+
children: props?.renderLabel && props?.renderLabel
|
|
9204
9090
|
}), jsxRuntime.jsx("div", {
|
|
9205
9091
|
children: intl.formatMessage(inputValue ? messages$q.searchSelectInputNoOptionsFoundMessage : messages$q.searchSelectInputNoValueMessage)
|
|
9206
9092
|
})]
|
|
@@ -9373,7 +9259,6 @@ StoreSelectField.defaultProps = {
|
|
|
9373
9259
|
mappedValueField: 'id'
|
|
9374
9260
|
};
|
|
9375
9261
|
|
|
9376
|
-
var _templateObject$1;
|
|
9377
9262
|
function ownKeys$z(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9378
9263
|
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__default["default"](_context5 = ownKeys$z(Object(t), !0)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context6 = ownKeys$z(Object(t))).call(_context6, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
9379
9264
|
function _callSuper$5(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$5() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
@@ -9446,7 +9331,10 @@ const VALIDATOR_INTEGER = {
|
|
|
9446
9331
|
}
|
|
9447
9332
|
}
|
|
9448
9333
|
});
|
|
9449
|
-
commonTags.oneLineTrim
|
|
9334
|
+
commonTags.oneLineTrim`
|
|
9335
|
+
\`validatedInput\` is no longer supported.
|
|
9336
|
+
Please use \`formik\` instead.
|
|
9337
|
+
`;
|
|
9450
9338
|
const ToolTipWrapperComponent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
9451
9339
|
let children = _ref.children;
|
|
9452
9340
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
@@ -9591,7 +9479,7 @@ function validatedInput(InnerComponent, validators) {
|
|
|
9591
9479
|
}
|
|
9592
9480
|
}]);
|
|
9593
9481
|
}(React.PureComponent);
|
|
9594
|
-
ValidatedInput.displayName =
|
|
9482
|
+
ValidatedInput.displayName = `ValidatedInput(${_InnerComponent.displayName})`;
|
|
9595
9483
|
ValidatedInput.defaultProps = {
|
|
9596
9484
|
isValid: true,
|
|
9597
9485
|
getInputRef: () => {}
|
|
@@ -9674,9 +9562,9 @@ CustomFieldDefinitionsConnector.displayName = 'CustomFieldDefinitionsConnector';
|
|
|
9674
9562
|
CustomFieldDefinitionsConnector.defaultProps = {
|
|
9675
9563
|
resources: []
|
|
9676
9564
|
};
|
|
9677
|
-
const stringifyResources$1 = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => "
|
|
9565
|
+
const stringifyResources$1 = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => `"${resource}"`).join();
|
|
9678
9566
|
const mapPropsToOptions = ownProps => {
|
|
9679
|
-
const where = ownProps.resources.length > 0 ?
|
|
9567
|
+
const where = ownProps.resources.length > 0 ? `resourceTypeIds contains any (${stringifyResources$1(ownProps.resources)})` : undefined;
|
|
9680
9568
|
return {
|
|
9681
9569
|
variables: {
|
|
9682
9570
|
where,
|
|
@@ -9745,19 +9633,19 @@ const graphQlDocToForm = typeDefinition => {
|
|
|
9745
9633
|
key: typeDefinition.key,
|
|
9746
9634
|
name: l10n.transformLocalizedFieldToLocalizedString(typeDefinition.nameAllLocales),
|
|
9747
9635
|
fieldDefinitions: _mapInstanceProperty__default["default"](_context = typeDefinition.fieldDefinitions).call(_context, fieldDefinition => {
|
|
9748
|
-
var
|
|
9636
|
+
var _context2, _context3;
|
|
9749
9637
|
return {
|
|
9750
9638
|
name: fieldDefinition.name,
|
|
9751
9639
|
required: fieldDefinition.required,
|
|
9752
9640
|
inputHint: fieldDefinition.inputHint,
|
|
9753
|
-
type:
|
|
9641
|
+
type: fieldDefinition.type?.elementType?.name === 'LocalizedEnum' ? _objectSpread$x(_objectSpread$x({}, fieldDefinition.type), {}, {
|
|
9754
9642
|
elementType: _objectSpread$x(_objectSpread$x({}, fieldDefinition.type.elementType), {}, {
|
|
9755
9643
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
9756
9644
|
key: value.key,
|
|
9757
9645
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
9758
9646
|
}))
|
|
9759
9647
|
})
|
|
9760
|
-
}) :
|
|
9648
|
+
}) : fieldDefinition.type?.name === 'LocalizedEnum' ? _objectSpread$x(_objectSpread$x({}, fieldDefinition.type), {}, {
|
|
9761
9649
|
values: _mapInstanceProperty__default["default"](_context3 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context3, value => ({
|
|
9762
9650
|
key: value.key,
|
|
9763
9651
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -9789,7 +9677,7 @@ const formToGraphQlDoc = formCustomFields => ({
|
|
|
9789
9677
|
// TODO(pa3): find usages and make sure only 1 param is passed
|
|
9790
9678
|
const createEmptyCustomFields = typeDefinition => ({
|
|
9791
9679
|
fields: {},
|
|
9792
|
-
type:
|
|
9680
|
+
type: typeDefinition?.type || {
|
|
9793
9681
|
fieldDefinitions: []
|
|
9794
9682
|
}
|
|
9795
9683
|
});
|
|
@@ -9797,7 +9685,7 @@ const createEmptyCustomFields = typeDefinition => ({
|
|
|
9797
9685
|
function _callSuper$3(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$3() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
9798
9686
|
function _isNativeReflectConstruct$3() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$3 = function () { return !!t; })(); }
|
|
9799
9687
|
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 } } } };
|
|
9800
|
-
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'];
|
|
9688
|
+
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'];
|
|
9801
9689
|
const emptyTypeDefinitions = {
|
|
9802
9690
|
total: 0,
|
|
9803
9691
|
count: 0,
|
|
@@ -9838,9 +9726,9 @@ CustomFieldTypeDefinitionsConnector.graphQlDocToForm = graphQlDocToForm;
|
|
|
9838
9726
|
CustomFieldTypeDefinitionsConnector.formToRestDoc = formToRestDoc;
|
|
9839
9727
|
CustomFieldTypeDefinitionsConnector.formToGraphQlDoc = formToGraphQlDoc;
|
|
9840
9728
|
CustomFieldTypeDefinitionsConnector.createEmptyCustomFields = createEmptyCustomFields;
|
|
9841
|
-
const stringifyResources = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => "
|
|
9729
|
+
const stringifyResources = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => `"${resource}"`).join();
|
|
9842
9730
|
const createGraphQlOptions = ownProps => {
|
|
9843
|
-
const where = ownProps.resources.length > 0 ?
|
|
9731
|
+
const where = ownProps.resources.length > 0 ? `resourceTypeIds contains any (${stringifyResources(ownProps.resources)})` : undefined;
|
|
9844
9732
|
return {
|
|
9845
9733
|
variables: {
|
|
9846
9734
|
where,
|
|
@@ -9890,7 +9778,7 @@ const extractDuplicatedValues = (values, type, language, languages) => {
|
|
|
9890
9778
|
let validatedValues = [];
|
|
9891
9779
|
if (type.name.toLowerCase() === 'money') {
|
|
9892
9780
|
validatedValues = unique(values, ['amount', 'currencyCode']);
|
|
9893
|
-
} else if (type.name.toLowerCase() === 'reference') validatedValues = unique(_filterInstanceProperty__default["default"](values).call(values, value => value
|
|
9781
|
+
} else if (type.name.toLowerCase() === 'reference') validatedValues = unique(_filterInstanceProperty__default["default"](values).call(values, value => value?.id), ['id']);else if (type.name.toLowerCase() === 'localizedstring') {
|
|
9894
9782
|
validatedValues = unique(values, languages);
|
|
9895
9783
|
} else validatedValues = unique(values);
|
|
9896
9784
|
return validatedValues;
|
|
@@ -10023,10 +9911,9 @@ var messages$o = reactIntl.defineMessages({
|
|
|
10023
9911
|
const FIELD_NAME = 'custom';
|
|
10024
9912
|
|
|
10025
9913
|
function ownKeys$u(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10026
|
-
function _objectSpread$u(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
9914
|
+
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__default["default"](_context6 = ownKeys$u(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context7 = ownKeys$u(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
10027
9915
|
const transformFieldType = fieldDefinition => {
|
|
10028
|
-
|
|
10029
|
-
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') {
|
|
9916
|
+
if (fieldDefinition.type?.elementType?.name === 'LocalizedEnum') {
|
|
10030
9917
|
var _context;
|
|
10031
9918
|
return _objectSpread$u(_objectSpread$u({}, fieldDefinition.type), {}, {
|
|
10032
9919
|
elementType: _objectSpread$u(_objectSpread$u({}, fieldDefinition.type.elementType), {}, {
|
|
@@ -10036,7 +9923,7 @@ const transformFieldType = fieldDefinition => {
|
|
|
10036
9923
|
}))
|
|
10037
9924
|
})
|
|
10038
9925
|
});
|
|
10039
|
-
} else if (
|
|
9926
|
+
} else if (fieldDefinition.type?.name === 'LocalizedEnum') {
|
|
10040
9927
|
var _context2;
|
|
10041
9928
|
return _objectSpread$u(_objectSpread$u({}, fieldDefinition.type), {}, {
|
|
10042
9929
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context2, value => ({
|
|
@@ -10083,9 +9970,9 @@ const createFormStateFromResource = resource => {
|
|
|
10083
9970
|
};
|
|
10084
9971
|
};
|
|
10085
9972
|
const createGraphQlDocFromFormState = formState => {
|
|
10086
|
-
var
|
|
9973
|
+
var _context5;
|
|
10087
9974
|
// Unset the custom type if it's not in the form state
|
|
10088
|
-
if (!
|
|
9975
|
+
if (!formState[FIELD_NAME]?.type?.id) {
|
|
10089
9976
|
return {
|
|
10090
9977
|
[FIELD_NAME]: {}
|
|
10091
9978
|
};
|
|
@@ -10111,8 +9998,7 @@ const createGraphQlDocFromFormState = formState => {
|
|
|
10111
9998
|
|
|
10112
9999
|
// Creates a root field name accessor for `custom` form state
|
|
10113
10000
|
const createRootFieldName = rootFieldName => {
|
|
10114
|
-
|
|
10115
|
-
return rootFieldName ? _concatInstanceProperty__default["default"](_context6 = "".concat(rootFieldName, ".")).call(_context6, FIELD_NAME) : FIELD_NAME;
|
|
10001
|
+
return rootFieldName ? `${rootFieldName}.${FIELD_NAME}` : FIELD_NAME;
|
|
10116
10002
|
};
|
|
10117
10003
|
|
|
10118
10004
|
function ownKeys$t(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -10121,8 +10007,7 @@ const typeDefinitionsExist = typeDefinitions => {
|
|
|
10121
10007
|
return typeDefinitions.length > 0;
|
|
10122
10008
|
};
|
|
10123
10009
|
const typeDefinitionSelected = (formValues, rootFieldName) => {
|
|
10124
|
-
|
|
10125
|
-
return ((_getIn = formik.getIn(formValues, rootFieldName)) === null || _getIn === void 0 ? void 0 : _getIn.type) && ((_getIn2 = formik.getIn(formValues, rootFieldName)) === null || _getIn2 === void 0 || (_getIn2 = _getIn2.type) === null || _getIn2 === void 0 ? void 0 : _getIn2.obj);
|
|
10010
|
+
return formik.getIn(formValues, rootFieldName)?.type && formik.getIn(formValues, rootFieldName)?.type?.obj;
|
|
10126
10011
|
};
|
|
10127
10012
|
const typeDefinitionContainsFieldDefinitions = (formValues, rootFieldName) => {
|
|
10128
10013
|
return formik.getIn(formValues, rootFieldName).type.obj.key && formik.getIn(formValues, rootFieldName).type.obj.fieldDefinitions.length > 0;
|
|
@@ -10159,7 +10044,7 @@ const CustomFieldsInputWrapper = _ref2 => {
|
|
|
10159
10044
|
max: "scale",
|
|
10160
10045
|
children: jsxRuntime.jsx(CustomFields, {
|
|
10161
10046
|
isReadOnly: isReadOnly,
|
|
10162
|
-
name:
|
|
10047
|
+
name: `${rootFieldName}.fields`,
|
|
10163
10048
|
fieldDefinitions: isReadOnly && hideEmptyFields ? fieldDefinitionsWithValues(formValues, rootFieldName) : formik.getIn(formValues, rootFieldName).type.obj.fieldDefinitions
|
|
10164
10049
|
})
|
|
10165
10050
|
});
|
|
@@ -10194,7 +10079,6 @@ const createFormStateFromTypeDefinition = selectedTypeDefinition => {
|
|
|
10194
10079
|
};
|
|
10195
10080
|
};
|
|
10196
10081
|
const CustomTypeSubform = _ref => {
|
|
10197
|
-
var _getIn3, _getIn4;
|
|
10198
10082
|
let typeDefinitions = _ref.typeDefinitions,
|
|
10199
10083
|
isReadOnly = _ref.isReadOnly,
|
|
10200
10084
|
isCondensed = _ref.isCondensed,
|
|
@@ -10229,8 +10113,7 @@ const CustomTypeSubform = _ref => {
|
|
|
10229
10113
|
}
|
|
10230
10114
|
}, [typeDefinitions, setFieldValue, validateForm, rootFieldName]);
|
|
10231
10115
|
const typeDefinitionSelected = formValues => {
|
|
10232
|
-
|
|
10233
|
-
return ((_getIn = formik.getIn(formValues, rootFieldName)) === null || _getIn === void 0 ? void 0 : _getIn.type) && ((_getIn2 = formik.getIn(formValues, rootFieldName)) === null || _getIn2 === void 0 || (_getIn2 = _getIn2.type) === null || _getIn2 === void 0 ? void 0 : _getIn2.obj);
|
|
10116
|
+
return formik.getIn(formValues, rootFieldName)?.type && formik.getIn(formValues, rootFieldName)?.type?.obj;
|
|
10234
10117
|
};
|
|
10235
10118
|
|
|
10236
10119
|
// if the user has read-only permissions, empty fields are hidden, and no type definition is selected, hide the component
|
|
@@ -10245,9 +10128,9 @@ const CustomTypeSubform = _ref => {
|
|
|
10245
10128
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
10246
10129
|
isClearable: true,
|
|
10247
10130
|
"data-testid": "custom-type-select",
|
|
10248
|
-
name:
|
|
10249
|
-
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages,
|
|
10250
|
-
value:
|
|
10131
|
+
name: `${rootFieldName}.type.obj.key`,
|
|
10132
|
+
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages, formik.getIn(formValues, rootFieldName)?.type?.id),
|
|
10133
|
+
value: formik.getIn(formValues, rootFieldName)?.type?.obj?.key,
|
|
10251
10134
|
onChange: handleTypeDefinitionSelect,
|
|
10252
10135
|
placeholder: formatMessage(messages$o.typesPlaceholder),
|
|
10253
10136
|
isReadOnly: isReadOnly
|
|
@@ -10328,7 +10211,7 @@ var fetchPimIndexStatus = ((apolloClient, projectKey) => async dispatch => {
|
|
|
10328
10211
|
try {
|
|
10329
10212
|
await dispatch(sdk.actions.head({
|
|
10330
10213
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.PIM_SEARCH,
|
|
10331
|
-
uri:
|
|
10214
|
+
uri: `/${projectKey}/search/products`
|
|
10332
10215
|
}));
|
|
10333
10216
|
return {
|
|
10334
10217
|
status: 'indexed'
|
|
@@ -10394,8 +10277,8 @@ const getIndexingJobIds = _ref => {
|
|
|
10394
10277
|
products = _ref$data.products,
|
|
10395
10278
|
productTypes = _ref$data.productTypes;
|
|
10396
10279
|
return {
|
|
10397
|
-
productsJobId:
|
|
10398
|
-
productTypesJobId:
|
|
10280
|
+
productsJobId: products?.indexingJobId || products?.existingIndexingJobId,
|
|
10281
|
+
productTypesJobId: productTypes?.indexingJobId || productTypes?.existingIndexingJobId
|
|
10399
10282
|
};
|
|
10400
10283
|
};
|
|
10401
10284
|
let PimIndexerProvider = /*#__PURE__*/function (_PureComponent) {
|
|
@@ -10646,6 +10529,7 @@ function usePimIndexer() {
|
|
|
10646
10529
|
|
|
10647
10530
|
// eslint-disable-next-line import/prefer-default-export
|
|
10648
10531
|
const RESOURCES_WITH_PLATFORM_LIMITS = {
|
|
10532
|
+
businessUnits: 'businessUnits',
|
|
10649
10533
|
shoppingLists: 'shoppingLists',
|
|
10650
10534
|
productDiscounts: 'productDiscounts',
|
|
10651
10535
|
cartDiscounts: 'cartDiscounts',
|
|
@@ -10662,10 +10546,10 @@ function ownKeys$p(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
10662
10546
|
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__default["default"](_context = ownKeys$p(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$p(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
10663
10547
|
const resourcesWithPlatformLimits = _Object$keys__default["default"](RESOURCES_WITH_PLATFORM_LIMITS);
|
|
10664
10548
|
const createQueryVariables = platformLimit => _reduceInstanceProperty__default["default"](resourcesWithPlatformLimits).call(resourcesWithPlatformLimits, (previousIncludedLimits, nextNameOfLimit) => _objectSpread$p({
|
|
10665
|
-
[camelCase__default["default"](
|
|
10549
|
+
[camelCase__default["default"](`should include ${nextNameOfLimit}`)]: platformLimit ? nextNameOfLimit === platformLimit : true
|
|
10666
10550
|
}, previousIncludedLimits), {});
|
|
10667
10551
|
|
|
10668
|
-
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 } } } };
|
|
10552
|
+
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 } } } };
|
|
10669
10553
|
const usePlatformLimitsFetcher = platformLimit => {
|
|
10670
10554
|
const _useQuery = react.useQuery(PlatformLimitsFetcherQuery, {
|
|
10671
10555
|
variables: createQueryVariables(platformLimit),
|
|
@@ -10678,7 +10562,7 @@ const usePlatformLimitsFetcher = platformLimit => {
|
|
|
10678
10562
|
error = _useQuery.error,
|
|
10679
10563
|
data = _useQuery.data,
|
|
10680
10564
|
refetch = _useQuery.refetch;
|
|
10681
|
-
const platformLimits = !loading ? omit__default["default"](data
|
|
10565
|
+
const platformLimits = !loading ? omit__default["default"](data?.limits, '__typename') : {};
|
|
10682
10566
|
return {
|
|
10683
10567
|
isLoading: loading,
|
|
10684
10568
|
error,
|
|
@@ -10869,11 +10753,10 @@ const getPlatformLimitsStatus = _ref3 => {
|
|
|
10869
10753
|
total = _ref3.total,
|
|
10870
10754
|
intl = _ref3.intl;
|
|
10871
10755
|
if (limit) {
|
|
10872
|
-
|
|
10873
|
-
return _concatInstanceProperty__default["default"](_context = "(".concat(intl.formatNumber(current), "/")).call(_context, intl.formatNumber(limit), ")");
|
|
10756
|
+
return `(${intl.formatNumber(current)}/${intl.formatNumber(limit)})`;
|
|
10874
10757
|
}
|
|
10875
10758
|
if (total) {
|
|
10876
|
-
return
|
|
10759
|
+
return `(${intl.formatNumber(total)})`;
|
|
10877
10760
|
}
|
|
10878
10761
|
return '';
|
|
10879
10762
|
};
|
|
@@ -10893,18 +10776,17 @@ const useShippingMethodsPlatformLimitsFetcher = () => {
|
|
|
10893
10776
|
};
|
|
10894
10777
|
|
|
10895
10778
|
const useShippingMethodsPlatformLimits = () => {
|
|
10896
|
-
var _platformLimits$shipp;
|
|
10897
10779
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
10898
10780
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
10899
|
-
if (!
|
|
10781
|
+
if (!platformLimits?.shippingMethods?.total) {
|
|
10900
10782
|
return {
|
|
10901
10783
|
hasReachedShippingMethodsWarningLimit: false,
|
|
10902
10784
|
hasReachedShippingMethodsErrorLimit: false
|
|
10903
10785
|
};
|
|
10904
10786
|
}
|
|
10905
|
-
const _platformLimits$
|
|
10906
|
-
limit = _platformLimits$
|
|
10907
|
-
current = _platformLimits$
|
|
10787
|
+
const _platformLimits$shipp = platformLimits.shippingMethods.total,
|
|
10788
|
+
limit = _platformLimits$shipp.limit,
|
|
10789
|
+
current = _platformLimits$shipp.current;
|
|
10908
10790
|
const hasReachedShippingMethodsWarningLimit = getHasExceededWarningThreshold({
|
|
10909
10791
|
limit,
|
|
10910
10792
|
current
|
|
@@ -10920,13 +10802,12 @@ const useShippingMethodsPlatformLimits = () => {
|
|
|
10920
10802
|
};
|
|
10921
10803
|
|
|
10922
10804
|
const PlatformLimitsShippingMethodsNotifications = () => {
|
|
10923
|
-
var _platformLimits$shipp;
|
|
10924
10805
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
10925
10806
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
10926
10807
|
const _useShippingMethodsPl2 = useShippingMethodsPlatformLimits(),
|
|
10927
10808
|
hasReachedShippingMethodsWarningLimit = _useShippingMethodsPl2.hasReachedShippingMethodsWarningLimit,
|
|
10928
10809
|
hasReachedShippingMethodsErrorLimit = _useShippingMethodsPl2.hasReachedShippingMethodsErrorLimit;
|
|
10929
|
-
if (!
|
|
10810
|
+
if (!platformLimits?.shippingMethods?.total) {
|
|
10930
10811
|
return null;
|
|
10931
10812
|
}
|
|
10932
10813
|
if (hasReachedShippingMethodsErrorLimit) {
|
|
@@ -10972,13 +10853,12 @@ var messages$j = reactIntl.defineMessages({
|
|
|
10972
10853
|
});
|
|
10973
10854
|
|
|
10974
10855
|
const PlatformLimitsShippingMethodsStatus = _ref => {
|
|
10975
|
-
var _platformLimits$shipp, _platformLimits$shipp2;
|
|
10976
10856
|
let total = _ref.total;
|
|
10977
10857
|
const intl = reactIntl.useIntl();
|
|
10978
10858
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
10979
10859
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
10980
|
-
const current = platformLimits
|
|
10981
|
-
const limit = platformLimits
|
|
10860
|
+
const current = platformLimits?.shippingMethods?.total?.current;
|
|
10861
|
+
const limit = platformLimits?.shippingMethods?.total?.limit;
|
|
10982
10862
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
10983
10863
|
intlMessage: messages$j.shippingMethodsStatus,
|
|
10984
10864
|
children: getPlatformLimitsStatus({
|
|
@@ -11040,18 +10920,17 @@ const useTaxCategoriesPlatformLimitsFetcher = () => {
|
|
|
11040
10920
|
};
|
|
11041
10921
|
|
|
11042
10922
|
const useTaxCategoriesPlatformLimits = () => {
|
|
11043
|
-
var _platformLimits$taxCa;
|
|
11044
10923
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
11045
10924
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
11046
|
-
if (!
|
|
10925
|
+
if (!platformLimits?.taxCategories?.total) {
|
|
11047
10926
|
return {
|
|
11048
10927
|
hasReachedTaxCategoriesWarningLimit: false,
|
|
11049
10928
|
hasReachedTaxCategoriesErrorLimit: false
|
|
11050
10929
|
};
|
|
11051
10930
|
}
|
|
11052
|
-
const _platformLimits$
|
|
11053
|
-
limit = _platformLimits$
|
|
11054
|
-
current = _platformLimits$
|
|
10931
|
+
const _platformLimits$taxCa = platformLimits.taxCategories.total,
|
|
10932
|
+
limit = _platformLimits$taxCa.limit,
|
|
10933
|
+
current = _platformLimits$taxCa.current;
|
|
11055
10934
|
const hasReachedTaxCategoriesWarningLimit = getHasExceededWarningThreshold({
|
|
11056
10935
|
limit,
|
|
11057
10936
|
current
|
|
@@ -11067,13 +10946,12 @@ const useTaxCategoriesPlatformLimits = () => {
|
|
|
11067
10946
|
};
|
|
11068
10947
|
|
|
11069
10948
|
const PlatformLimitsTaxCategoriesNotifications = () => {
|
|
11070
|
-
var _platformLimits$taxCa;
|
|
11071
10949
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
11072
10950
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
11073
10951
|
const _useTaxCategoriesPlat2 = useTaxCategoriesPlatformLimits(),
|
|
11074
10952
|
hasReachedTaxCategoriesWarningLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesWarningLimit,
|
|
11075
10953
|
hasReachedTaxCategoriesErrorLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesErrorLimit;
|
|
11076
|
-
if (!
|
|
10954
|
+
if (!platformLimits?.taxCategories?.total) {
|
|
11077
10955
|
return null;
|
|
11078
10956
|
}
|
|
11079
10957
|
if (hasReachedTaxCategoriesErrorLimit) {
|
|
@@ -11119,13 +10997,12 @@ var messages$h = reactIntl.defineMessages({
|
|
|
11119
10997
|
});
|
|
11120
10998
|
|
|
11121
10999
|
const PlatformLimitsTaxCategoriesStatus = _ref => {
|
|
11122
|
-
var _platformLimits$taxCa, _platformLimits$taxCa2;
|
|
11123
11000
|
let total = _ref.total;
|
|
11124
11001
|
const intl = reactIntl.useIntl();
|
|
11125
11002
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
11126
11003
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
11127
|
-
const current = platformLimits
|
|
11128
|
-
const limit = platformLimits
|
|
11004
|
+
const current = platformLimits?.taxCategories?.total?.current;
|
|
11005
|
+
const limit = platformLimits?.taxCategories?.total?.limit;
|
|
11129
11006
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
11130
11007
|
intlMessage: messages$h.taxCategoriesStatus,
|
|
11131
11008
|
children: getPlatformLimitsStatus({
|
|
@@ -11187,18 +11064,17 @@ const useZonesPlatformLimitsFetcher = () => {
|
|
|
11187
11064
|
};
|
|
11188
11065
|
|
|
11189
11066
|
const useZonesPlatformLimits = () => {
|
|
11190
|
-
var _platformLimits$zones;
|
|
11191
11067
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
11192
11068
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
11193
|
-
if (!
|
|
11069
|
+
if (!platformLimits?.zones?.total) {
|
|
11194
11070
|
return {
|
|
11195
11071
|
hasReachedZonesWarningLimit: false,
|
|
11196
11072
|
hasReachedZonesErrorLimit: false
|
|
11197
11073
|
};
|
|
11198
11074
|
}
|
|
11199
|
-
const _platformLimits$
|
|
11200
|
-
limit = _platformLimits$
|
|
11201
|
-
current = _platformLimits$
|
|
11075
|
+
const _platformLimits$zones = platformLimits.zones.total,
|
|
11076
|
+
limit = _platformLimits$zones.limit,
|
|
11077
|
+
current = _platformLimits$zones.current;
|
|
11202
11078
|
const hasReachedZonesWarningLimit = getHasExceededWarningThreshold({
|
|
11203
11079
|
limit,
|
|
11204
11080
|
current
|
|
@@ -11214,13 +11090,12 @@ const useZonesPlatformLimits = () => {
|
|
|
11214
11090
|
};
|
|
11215
11091
|
|
|
11216
11092
|
const PlatformLimitsZonesNotifications = () => {
|
|
11217
|
-
var _platformLimits$zones;
|
|
11218
11093
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
11219
11094
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
11220
11095
|
const _useZonesPlatformLimi2 = useZonesPlatformLimits(),
|
|
11221
11096
|
hasReachedZonesWarningLimit = _useZonesPlatformLimi2.hasReachedZonesWarningLimit,
|
|
11222
11097
|
hasReachedZonesErrorLimit = _useZonesPlatformLimi2.hasReachedZonesErrorLimit;
|
|
11223
|
-
if (!
|
|
11098
|
+
if (!platformLimits?.zones?.total) {
|
|
11224
11099
|
return null;
|
|
11225
11100
|
}
|
|
11226
11101
|
if (hasReachedZonesErrorLimit) {
|
|
@@ -11266,13 +11141,12 @@ var messages$f = reactIntl.defineMessages({
|
|
|
11266
11141
|
});
|
|
11267
11142
|
|
|
11268
11143
|
const PlatformLimitsZonesStatus = _ref => {
|
|
11269
|
-
var _platformLimits$zones, _platformLimits$zones2;
|
|
11270
11144
|
let total = _ref.total;
|
|
11271
11145
|
const intl = reactIntl.useIntl();
|
|
11272
11146
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
11273
11147
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
11274
|
-
const current = platformLimits
|
|
11275
|
-
const limit = platformLimits
|
|
11148
|
+
const current = platformLimits?.zones?.total?.current;
|
|
11149
|
+
const limit = platformLimits?.zones?.total?.limit;
|
|
11276
11150
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
11277
11151
|
intlMessage: messages$f.zonesStatus,
|
|
11278
11152
|
children: getPlatformLimitsStatus({
|
|
@@ -11334,18 +11208,17 @@ const useCustomersPlatformLimitsFetcher = () => {
|
|
|
11334
11208
|
};
|
|
11335
11209
|
|
|
11336
11210
|
const useCustomersPlatformLimits$1 = () => {
|
|
11337
|
-
var _platformLimits$custo;
|
|
11338
11211
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
11339
11212
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
11340
|
-
if (!
|
|
11213
|
+
if (!platformLimits?.customers?.total) {
|
|
11341
11214
|
return {
|
|
11342
11215
|
hasReachedCustomersWarningLimit: false,
|
|
11343
11216
|
hasReachedCustomersErrorLimit: false
|
|
11344
11217
|
};
|
|
11345
11218
|
}
|
|
11346
|
-
const _platformLimits$
|
|
11347
|
-
limit = _platformLimits$
|
|
11348
|
-
current = _platformLimits$
|
|
11219
|
+
const _platformLimits$custo = platformLimits.customers.total,
|
|
11220
|
+
limit = _platformLimits$custo.limit,
|
|
11221
|
+
current = _platformLimits$custo.current;
|
|
11349
11222
|
const hasReachedCustomersWarningLimit = getHasExceededWarningThreshold({
|
|
11350
11223
|
limit,
|
|
11351
11224
|
current
|
|
@@ -11374,13 +11247,12 @@ const useCustomersPlatormLimitsModalState = () => {
|
|
|
11374
11247
|
};
|
|
11375
11248
|
|
|
11376
11249
|
const PlatformLimitsCustomersNotifications = () => {
|
|
11377
|
-
var _platformLimits$custo;
|
|
11378
11250
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
11379
11251
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
11380
11252
|
const _useCustomersPlatform2 = useCustomersPlatformLimits$1(),
|
|
11381
11253
|
hasReachedCustomersWarningLimit = _useCustomersPlatform2.hasReachedCustomersWarningLimit,
|
|
11382
11254
|
hasReachedCustomersErrorLimit = _useCustomersPlatform2.hasReachedCustomersErrorLimit;
|
|
11383
|
-
if (!
|
|
11255
|
+
if (!platformLimits?.customers?.total) {
|
|
11384
11256
|
return jsxRuntime.jsx("div", {});
|
|
11385
11257
|
}
|
|
11386
11258
|
if (hasReachedCustomersErrorLimit) {
|
|
@@ -11431,16 +11303,15 @@ var styles$6 = {
|
|
|
11431
11303
|
"status": "platform-limits-customers-status-module__status___3rXYM"
|
|
11432
11304
|
};
|
|
11433
11305
|
const PlatformLimitsCustomersStatus = () => {
|
|
11434
|
-
var _platformLimits$custo;
|
|
11435
11306
|
const intl = reactIntl.useIntl();
|
|
11436
11307
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
11437
11308
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
11438
|
-
if (!
|
|
11309
|
+
if (!platformLimits?.customers?.total) {
|
|
11439
11310
|
return null;
|
|
11440
11311
|
}
|
|
11441
|
-
const _platformLimits$
|
|
11442
|
-
current = _platformLimits$
|
|
11443
|
-
limit = _platformLimits$
|
|
11312
|
+
const _platformLimits$custo = platformLimits.customers.total,
|
|
11313
|
+
current = _platformLimits$custo.current,
|
|
11314
|
+
limit = _platformLimits$custo.limit;
|
|
11444
11315
|
return jsxRuntime.jsx("div", {
|
|
11445
11316
|
className: styles$6.status,
|
|
11446
11317
|
children: jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
@@ -11674,18 +11545,17 @@ const useCustomerGroupsPlatformLimitsFetcher = () => {
|
|
|
11674
11545
|
};
|
|
11675
11546
|
|
|
11676
11547
|
const useCustomerGroupsPlatformLimitsStatus = () => {
|
|
11677
|
-
var _platformLimits$custo;
|
|
11678
11548
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
11679
11549
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
11680
|
-
if (!
|
|
11550
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
11681
11551
|
return {
|
|
11682
11552
|
hasReachedCustomerGroupsWarningLimit: false,
|
|
11683
11553
|
hasReachedCustomerGroupsErrorLimit: false
|
|
11684
11554
|
};
|
|
11685
11555
|
}
|
|
11686
|
-
const _platformLimits$
|
|
11687
|
-
limit = _platformLimits$
|
|
11688
|
-
current = _platformLimits$
|
|
11556
|
+
const _platformLimits$custo = platformLimits.customerGroups.total,
|
|
11557
|
+
limit = _platformLimits$custo.limit,
|
|
11558
|
+
current = _platformLimits$custo.current;
|
|
11689
11559
|
const hasReachedCustomerGroupsWarningLimit = getHasExceededWarningThreshold({
|
|
11690
11560
|
limit,
|
|
11691
11561
|
current
|
|
@@ -11714,13 +11584,12 @@ const useCustomerGroupsPlatormLimitsModalState = () => {
|
|
|
11714
11584
|
};
|
|
11715
11585
|
|
|
11716
11586
|
const PlatformLimitsCustomerGroupsNotifications = () => {
|
|
11717
|
-
var _platformLimits$custo;
|
|
11718
11587
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
11719
11588
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
11720
11589
|
const _useCustomerGroupsPla2 = useCustomerGroupsPlatformLimitsStatus(),
|
|
11721
11590
|
hasReachedCustomerGroupsWarningLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsWarningLimit,
|
|
11722
11591
|
hasReachedCustomerGroupsErrorLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsErrorLimit;
|
|
11723
|
-
if (!
|
|
11592
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
11724
11593
|
return jsxRuntime.jsx("div", {});
|
|
11725
11594
|
}
|
|
11726
11595
|
if (hasReachedCustomerGroupsErrorLimit) {
|
|
@@ -11771,16 +11640,15 @@ var styles$4 = {
|
|
|
11771
11640
|
"status": "platform-limits-customer-groups-status-module__status___6099G"
|
|
11772
11641
|
};
|
|
11773
11642
|
const PlatformLimitsCustomerGroupsStatus = () => {
|
|
11774
|
-
var _platformLimits$custo;
|
|
11775
11643
|
const intl = reactIntl.useIntl();
|
|
11776
11644
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
11777
11645
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
11778
|
-
if (!
|
|
11646
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
11779
11647
|
return null;
|
|
11780
11648
|
}
|
|
11781
|
-
const _platformLimits$
|
|
11782
|
-
current = _platformLimits$
|
|
11783
|
-
limit = _platformLimits$
|
|
11649
|
+
const _platformLimits$custo = platformLimits.customerGroups.total,
|
|
11650
|
+
current = _platformLimits$custo.current,
|
|
11651
|
+
limit = _platformLimits$custo.limit;
|
|
11784
11652
|
return jsxRuntime.jsx("div", {
|
|
11785
11653
|
className: styles$4.status,
|
|
11786
11654
|
children: jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
@@ -12026,7 +11894,6 @@ const valueMapping = {
|
|
|
12026
11894
|
all: [true, false]
|
|
12027
11895
|
};
|
|
12028
11896
|
const BooleanField = props => {
|
|
12029
|
-
var _context;
|
|
12030
11897
|
let selectedValue;
|
|
12031
11898
|
if (typeof props.value === 'boolean') selectedValue = getBooleanValue(props.value);else if (props.isMulti && _Array$isArray__default["default"](props.value) && props.value.length) selectedValue = props.value.length === 2 ? 'all' : getBooleanValue(props.value[0]);
|
|
12032
11899
|
const yesLabel = props.intl.formatMessage(messages$8.yes);
|
|
@@ -12040,7 +11907,7 @@ const BooleanField = props => {
|
|
|
12040
11907
|
}];
|
|
12041
11908
|
if (props.isMulti) options.push({
|
|
12042
11909
|
value: 'all',
|
|
12043
|
-
label:
|
|
11910
|
+
label: `${yesLabel} / ${noLabel}`
|
|
12044
11911
|
});
|
|
12045
11912
|
return jsxRuntime.jsx(uiKit.SelectInput, {
|
|
12046
11913
|
name: props.name,
|
|
@@ -12155,7 +12022,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
12155
12022
|
truncate: true,
|
|
12156
12023
|
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$5.filterWholeInput), {}, {
|
|
12157
12024
|
values: {
|
|
12158
|
-
values: "
|
|
12025
|
+
values: `"${props.value}"`
|
|
12159
12026
|
}
|
|
12160
12027
|
})
|
|
12161
12028
|
})
|
|
@@ -12168,7 +12035,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
12168
12035
|
truncate: true,
|
|
12169
12036
|
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$5.filterSeparateValues), {}, {
|
|
12170
12037
|
values: {
|
|
12171
|
-
values: "
|
|
12038
|
+
values: `"${props.multiValue.join('", "')}"` || props.value
|
|
12172
12039
|
}
|
|
12173
12040
|
})
|
|
12174
12041
|
})
|
|
@@ -12458,17 +12325,16 @@ function isEmpty(value) {
|
|
|
12458
12325
|
}
|
|
12459
12326
|
|
|
12460
12327
|
const buildSearchQuery = (searchQuery, searchMode, fragments) => {
|
|
12461
|
-
var _fragments$searchMode;
|
|
12462
12328
|
if (!searchQuery) return '';
|
|
12463
12329
|
const buildAllFieldsQueryString = query => {
|
|
12464
12330
|
const fragmentsArray = _Object$values__default["default"](fragments);
|
|
12465
|
-
return
|
|
12331
|
+
return `( ${_mapInstanceProperty__default["default"](fragmentsArray).call(fragmentsArray, fragment => fragment.getQuery(query)).join(' or ')} )`;
|
|
12466
12332
|
};
|
|
12467
12333
|
const trimmedSearchQuery = oneLine__default["default"](searchQuery);
|
|
12468
12334
|
if (searchMode === 'allFields') {
|
|
12469
12335
|
return buildAllFieldsQueryString(trimmedSearchQuery);
|
|
12470
12336
|
}
|
|
12471
|
-
if (!fragments[searchMode] || typeof
|
|
12337
|
+
if (!fragments[searchMode] || typeof fragments[searchMode]?.getQuery !== 'function') {
|
|
12472
12338
|
return '';
|
|
12473
12339
|
}
|
|
12474
12340
|
return fragments[searchMode].getQuery(trimmedSearchQuery);
|
|
@@ -12757,11 +12623,11 @@ function createResourceReducer(options) {
|
|
|
12757
12623
|
|
|
12758
12624
|
// TODO: validate constant keys
|
|
12759
12625
|
const actionsMap = {
|
|
12760
|
-
[
|
|
12626
|
+
[`${plural}_FETCHED`]: (_, action) => ({
|
|
12761
12627
|
currentQueryResult: action.payload
|
|
12762
12628
|
}),
|
|
12763
|
-
[
|
|
12764
|
-
[
|
|
12629
|
+
[`${single}_UPDATED_IN_LIST`]: updateStatusInList(mergeData),
|
|
12630
|
+
[`${single}_DELETED_IN_LIST`]: (state, _ref) => {
|
|
12765
12631
|
let payload = _ref.payload;
|
|
12766
12632
|
const results = state.currentQueryResult.results;
|
|
12767
12633
|
return {
|
|
@@ -12773,27 +12639,27 @@ function createResourceReducer(options) {
|
|
|
12773
12639
|
})
|
|
12774
12640
|
};
|
|
12775
12641
|
},
|
|
12776
|
-
[
|
|
12642
|
+
[`${single}_FETCHED`]: (_, _ref3) => {
|
|
12777
12643
|
let payload = _ref3.payload;
|
|
12778
12644
|
return {
|
|
12779
12645
|
currentVisible: payload
|
|
12780
12646
|
};
|
|
12781
12647
|
},
|
|
12782
|
-
[
|
|
12648
|
+
[`${single}_CREATED`]: (_ref4, _ref5) => {
|
|
12783
12649
|
let currentVisible = _ref4.currentVisible;
|
|
12784
12650
|
let payload = _ref5.payload;
|
|
12785
12651
|
return {
|
|
12786
12652
|
currentVisible: mergeData(payload, currentVisible)
|
|
12787
12653
|
};
|
|
12788
12654
|
},
|
|
12789
|
-
[
|
|
12655
|
+
[`${single}_UPDATED`]: (_ref6, _ref7) => {
|
|
12790
12656
|
let currentVisible = _ref6.currentVisible;
|
|
12791
12657
|
let payload = _ref7.payload;
|
|
12792
12658
|
return {
|
|
12793
12659
|
currentVisible: mergeData(payload, currentVisible)
|
|
12794
12660
|
};
|
|
12795
12661
|
},
|
|
12796
|
-
[
|
|
12662
|
+
[`${single}_DELETED`]: () => ({
|
|
12797
12663
|
currentVisible: null
|
|
12798
12664
|
})
|
|
12799
12665
|
};
|
|
@@ -12810,12 +12676,11 @@ function formatCustomerAddress(_ref) {
|
|
|
12810
12676
|
}
|
|
12811
12677
|
|
|
12812
12678
|
function formatCustomerName(_ref) {
|
|
12813
|
-
var _context;
|
|
12814
12679
|
let firstName = _ref.firstName,
|
|
12815
12680
|
lastName = _ref.lastName;
|
|
12816
12681
|
if (firstName && !lastName) return _trimInstanceProperty__default["default"](firstName).call(firstName);
|
|
12817
12682
|
if (!firstName && lastName) return _trimInstanceProperty__default["default"](lastName).call(lastName);
|
|
12818
|
-
if (firstName && lastName) return
|
|
12683
|
+
if (firstName && lastName) return `${_trimInstanceProperty__default["default"](firstName).call(firstName)} ${_trimInstanceProperty__default["default"](lastName).call(lastName)}`;
|
|
12819
12684
|
return constants.NO_VALUE_FALLBACK;
|
|
12820
12685
|
}
|
|
12821
12686
|
|
|
@@ -12844,23 +12709,21 @@ function base64ToString(value) {
|
|
|
12844
12709
|
}
|
|
12845
12710
|
|
|
12846
12711
|
const composeNumberPredicateFromFilter = (target, value, option) => {
|
|
12847
|
-
var _context, _context2, _context3, _context4, _context5, _context6;
|
|
12848
12712
|
switch (option) {
|
|
12849
12713
|
case FILTER_TYPES.lessThan:
|
|
12850
|
-
return
|
|
12714
|
+
return `${target} < ${value}`;
|
|
12851
12715
|
case FILTER_TYPES.moreThan:
|
|
12852
|
-
return
|
|
12716
|
+
return `${target} > ${value}`;
|
|
12853
12717
|
case FILTER_TYPES.equalTo:
|
|
12854
|
-
return
|
|
12718
|
+
return `${target} = ${value}`;
|
|
12855
12719
|
case FILTER_TYPES.range:
|
|
12856
|
-
return
|
|
12720
|
+
return `${target} >= ${value.from} and ${target} <= ${value.to}`;
|
|
12857
12721
|
default:
|
|
12858
12722
|
return '';
|
|
12859
12723
|
}
|
|
12860
12724
|
};
|
|
12861
12725
|
function customFields (filter, locale) {
|
|
12862
12726
|
const customFieldsPredicates = _mapInstanceProperty__default["default"](filter).call(filter, customFieldFilter => {
|
|
12863
|
-
var _context7, _context8, _context9, _context10, _context11;
|
|
12864
12727
|
const _customFieldFilter$va = customFieldFilter.value,
|
|
12865
12728
|
target = _customFieldFilter$va.target,
|
|
12866
12729
|
type = _customFieldFilter$va.type,
|
|
@@ -12868,14 +12731,14 @@ function customFields (filter, locale) {
|
|
|
12868
12731
|
option = _customFieldFilter$va.option;
|
|
12869
12732
|
switch (type.name) {
|
|
12870
12733
|
case FIELD_TYPES.Boolean:
|
|
12871
|
-
return
|
|
12734
|
+
return `${target} = ${value.value}`;
|
|
12872
12735
|
case FIELD_TYPES.String:
|
|
12873
|
-
return
|
|
12736
|
+
return `${target} = "${value}"`;
|
|
12874
12737
|
case FIELD_TYPES.LocalizedString:
|
|
12875
|
-
return
|
|
12738
|
+
return `${target}(${localizedTextTransformer(value)})`;
|
|
12876
12739
|
case FIELD_TYPES.Enum:
|
|
12877
12740
|
case FIELD_TYPES.LocalizedEnum:
|
|
12878
|
-
return
|
|
12741
|
+
return `${target} = "${value.value}"`;
|
|
12879
12742
|
case FIELD_TYPES.Time:
|
|
12880
12743
|
return timeTransformer(target, [{
|
|
12881
12744
|
type: option,
|
|
@@ -12890,14 +12753,14 @@ function customFields (filter, locale) {
|
|
|
12890
12753
|
case FIELD_TYPES.Number:
|
|
12891
12754
|
return composeNumberPredicateFromFilter(target, value, option);
|
|
12892
12755
|
case FIELD_TYPES.Money:
|
|
12893
|
-
return
|
|
12756
|
+
return `${target}(${moneyTransformer(value, option, locale)})`;
|
|
12894
12757
|
case FIELD_TYPES.Reference:
|
|
12895
12758
|
case FIELD_TYPES.Set:
|
|
12896
12759
|
default:
|
|
12897
12760
|
throw new Error('Custom field type not recognized');
|
|
12898
12761
|
}
|
|
12899
12762
|
});
|
|
12900
|
-
return
|
|
12763
|
+
return `(custom(fields(${customFieldsPredicates.join(' and ')})))`;
|
|
12901
12764
|
}
|
|
12902
12765
|
|
|
12903
12766
|
/**
|
|
@@ -12938,10 +12801,8 @@ function graphqlQueryBuilder(_ref) {
|
|
|
12938
12801
|
}
|
|
12939
12802
|
|
|
12940
12803
|
function numberTransformer(filterKey, filters) {
|
|
12941
|
-
var _context3;
|
|
12942
12804
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$2;
|
|
12943
12805
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
12944
|
-
var _context, _context2;
|
|
12945
12806
|
let type = _ref.type,
|
|
12946
12807
|
value = _ref.value;
|
|
12947
12808
|
if (!filterValidator({
|
|
@@ -12950,19 +12811,19 @@ function numberTransformer(filterKey, filters) {
|
|
|
12950
12811
|
})) return '';
|
|
12951
12812
|
switch (type) {
|
|
12952
12813
|
case 'lessThan':
|
|
12953
|
-
return
|
|
12814
|
+
return `(* to ${_parseInt__default["default"](value) - 1})`;
|
|
12954
12815
|
case 'moreThan':
|
|
12955
|
-
return
|
|
12816
|
+
return `(${_parseInt__default["default"](value) + 1} to *)`;
|
|
12956
12817
|
case 'equalTo':
|
|
12957
|
-
return
|
|
12818
|
+
return `(${value} to ${value})`;
|
|
12958
12819
|
case 'range':
|
|
12959
|
-
return
|
|
12820
|
+
return `(${value.from} to ${value.to})`;
|
|
12960
12821
|
default:
|
|
12961
12822
|
return '';
|
|
12962
12823
|
}
|
|
12963
12824
|
});
|
|
12964
12825
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
12965
|
-
return queryString === '' ? null :
|
|
12826
|
+
return queryString === '' ? null : `${filterKey}: range${queryString}`;
|
|
12966
12827
|
}
|
|
12967
12828
|
function isFilterValid$2(_ref2) {
|
|
12968
12829
|
let type = _ref2.type,
|
|
@@ -12989,11 +12850,9 @@ function graphqlCategoryLevelTransformer(filterKey, filters, filterValidator) {
|
|
|
12989
12850
|
return _filterInstanceProperty__default["default"](_context = [levelFilterQuery, lastLevelFilterQuery]).call(_context, Boolean);
|
|
12990
12851
|
}
|
|
12991
12852
|
|
|
12992
|
-
var _templateObject, _templateObject2;
|
|
12993
12853
|
const dateFormatDayStart = 'YYYY-MM-DDT00:00:00.000Z';
|
|
12994
12854
|
const dateFormatDayEnd = 'YYYY-MM-DDT23:59:59.999Z';
|
|
12995
12855
|
function dateTransformer(filterKey, filters) {
|
|
12996
|
-
var _context;
|
|
12997
12856
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$1;
|
|
12998
12857
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
12999
12858
|
let type = _ref.type,
|
|
@@ -13004,19 +12863,25 @@ function dateTransformer(filterKey, filters) {
|
|
|
13004
12863
|
})) return '';
|
|
13005
12864
|
switch (type) {
|
|
13006
12865
|
case 'lessThan':
|
|
13007
|
-
return
|
|
12866
|
+
return `(* to "${moment__default["default"](value).format(dateFormatDayStart)}")`;
|
|
13008
12867
|
case 'moreThan':
|
|
13009
|
-
return
|
|
12868
|
+
return `("${moment__default["default"](value).format(dateFormatDayEnd)}" to *)`;
|
|
13010
12869
|
case 'equalTo':
|
|
13011
|
-
return oneLine__default["default"]
|
|
12870
|
+
return oneLine__default["default"]`
|
|
12871
|
+
("${moment__default["default"](value).format(dateFormatDayStart)}"
|
|
12872
|
+
to "${moment__default["default"](value).format(dateFormatDayEnd)}")
|
|
12873
|
+
`;
|
|
13012
12874
|
case 'range':
|
|
13013
|
-
return oneLine__default["default"]
|
|
12875
|
+
return oneLine__default["default"]`
|
|
12876
|
+
("${moment__default["default"](value.from).format(dateFormatDayStart)}"
|
|
12877
|
+
to "${moment__default["default"](value.to).format(dateFormatDayEnd)}")
|
|
12878
|
+
`;
|
|
13014
12879
|
default:
|
|
13015
12880
|
return '';
|
|
13016
12881
|
}
|
|
13017
12882
|
});
|
|
13018
12883
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
13019
|
-
return queryString === '' ? null :
|
|
12884
|
+
return queryString === '' ? null : `${filterKey}: range${queryString}`;
|
|
13020
12885
|
}
|
|
13021
12886
|
function isFilterValid$1(_ref2) {
|
|
13022
12887
|
let type = _ref2.type,
|
|
@@ -13034,20 +12899,18 @@ function missingTransformer(filterKey, filters) {
|
|
|
13034
12899
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
13035
12900
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
13036
12901
|
if (filters.length === 0) return null;
|
|
13037
|
-
return
|
|
12902
|
+
return `${filterKey}:missing`;
|
|
13038
12903
|
}
|
|
13039
12904
|
|
|
13040
12905
|
function missingLocaleTransformer(filterKey, filters) {
|
|
13041
|
-
var _context;
|
|
13042
12906
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
13043
12907
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
13044
12908
|
if (filters.length === 0) return null;
|
|
13045
12909
|
const missingLocale = filters[0].value.value;
|
|
13046
|
-
return
|
|
12910
|
+
return `${filterKey}.${missingLocale}:missing`;
|
|
13047
12911
|
}
|
|
13048
12912
|
|
|
13049
12913
|
function referenceTransformer(filterKey, filters) {
|
|
13050
|
-
var _context;
|
|
13051
12914
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid;
|
|
13052
12915
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
13053
12916
|
let type = _ref.type,
|
|
@@ -13058,29 +12921,28 @@ function referenceTransformer(filterKey, filters) {
|
|
|
13058
12921
|
})) return '';
|
|
13059
12922
|
switch (type) {
|
|
13060
12923
|
case 'equalTo':
|
|
13061
|
-
return "
|
|
12924
|
+
return `"${value}"`;
|
|
13062
12925
|
default:
|
|
13063
12926
|
return '';
|
|
13064
12927
|
}
|
|
13065
12928
|
});
|
|
13066
12929
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
13067
|
-
return queryString === '' ? null :
|
|
12930
|
+
return queryString === '' ? null : `${filterKey}.id: ${queryString}`;
|
|
13068
12931
|
}
|
|
13069
12932
|
function isFilterValid(_ref2) {
|
|
13070
|
-
var
|
|
12933
|
+
var _context;
|
|
13071
12934
|
let type = _ref2.type,
|
|
13072
12935
|
value = _ref2.value;
|
|
13073
|
-
if (type === 'equalTo' && !_includesInstanceProperty__default["default"](
|
|
12936
|
+
if (type === 'equalTo' && !_includesInstanceProperty__default["default"](_context = [null, undefined, '']).call(_context, value)) return true;
|
|
13074
12937
|
return false;
|
|
13075
12938
|
}
|
|
13076
12939
|
|
|
13077
12940
|
function textTransformer(filterKey, queries) {
|
|
13078
|
-
var _context;
|
|
13079
12941
|
if (queries.length === 0) return null;
|
|
13080
12942
|
|
|
13081
12943
|
// Note: we assume for now that there can only be 1 text filter.
|
|
13082
12944
|
const queryValue = queries[0].value;
|
|
13083
|
-
return queryValue ?
|
|
12945
|
+
return queryValue ? `${filterKey}:"${queryValue}"` : null;
|
|
13084
12946
|
}
|
|
13085
12947
|
|
|
13086
12948
|
function isValidISOTime(_ref) {
|
|
@@ -13165,8 +13027,8 @@ function validateFilter$2(_ref, intl) {
|
|
|
13165
13027
|
};
|
|
13166
13028
|
}
|
|
13167
13029
|
if (value.option === FILTER_TYPES.range) {
|
|
13168
|
-
const from = validateValue(filterValue
|
|
13169
|
-
const to = from ? null : validateValue(filterValue
|
|
13030
|
+
const from = validateValue(filterValue?.from, typeName, intl);
|
|
13031
|
+
const to = from ? null : validateValue(filterValue?.to, typeName, intl);
|
|
13170
13032
|
return from || to ? {
|
|
13171
13033
|
input: {
|
|
13172
13034
|
from,
|
|
@@ -13203,16 +13065,16 @@ function validateFilter$1(_ref, intl) {
|
|
|
13203
13065
|
type = _ref.type;
|
|
13204
13066
|
if (type === 'range') {
|
|
13205
13067
|
if (validateSingleFilter({
|
|
13206
|
-
value: value
|
|
13068
|
+
value: value?.from
|
|
13207
13069
|
})) return {
|
|
13208
13070
|
from: intl.formatMessage(messages$2.rangeMissingValue)
|
|
13209
13071
|
};
|
|
13210
13072
|
if (validateSingleFilter({
|
|
13211
|
-
value: value
|
|
13073
|
+
value: value?.to
|
|
13212
13074
|
})) return {
|
|
13213
13075
|
to: intl.formatMessage(messages$2.rangeMissingValue)
|
|
13214
13076
|
};
|
|
13215
|
-
if (moment__default["default"](value
|
|
13077
|
+
if (moment__default["default"](value?.to).isBefore(value?.from)) return {
|
|
13216
13078
|
from: intl.formatMessage(messages$2.rangeToSmallerThanFrom)
|
|
13217
13079
|
};
|
|
13218
13080
|
} else if (type === 'equalTo' || type === 'lessThan' || type === 'moreThan') {
|
|
@@ -13289,14 +13151,14 @@ const validateText = function (text, intl) {
|
|
|
13289
13151
|
|
|
13290
13152
|
function formatDiscount(discount, currencyCode, intl) {
|
|
13291
13153
|
var _context;
|
|
13292
|
-
if (discount.type === 'relative') return
|
|
13154
|
+
if (discount.type === 'relative') return `${discount.permyriad / 100}%`;
|
|
13293
13155
|
if (!discount.money) return null;
|
|
13294
13156
|
const moneyForCurrencyCode = _findInstanceProperty__default["default"](_context = discount.money).call(_context, discountMoney => discountMoney.currencyCode === currencyCode);
|
|
13295
13157
|
return moneyForCurrencyCode ? formatMoney$2(moneyForCurrencyCode, intl) : null;
|
|
13296
13158
|
}
|
|
13297
13159
|
|
|
13298
13160
|
function formatPercentage(percentage) {
|
|
13299
|
-
return
|
|
13161
|
+
return `${percentage}%`;
|
|
13300
13162
|
}
|
|
13301
13163
|
function convertRatioToPercentage(ratio) {
|
|
13302
13164
|
return _parseFloat__default["default"]((ratio * 100).toFixed(2));
|
|
@@ -13310,10 +13172,7 @@ function convertRatioToPercentage(ratio) {
|
|
|
13310
13172
|
* @returns {boolean}
|
|
13311
13173
|
*/
|
|
13312
13174
|
const hasErrorCode = (unmappedApiErrors, errorCode) => {
|
|
13313
|
-
return _Array$isArray__default["default"](unmappedApiErrors) && _someInstanceProperty__default["default"](unmappedApiErrors).call(unmappedApiErrors, error =>
|
|
13314
|
-
var _error$extensions;
|
|
13315
|
-
return ((_error$extensions = error.extensions) === null || _error$extensions === void 0 ? void 0 : _error$extensions.code) === errorCode;
|
|
13316
|
-
});
|
|
13175
|
+
return _Array$isArray__default["default"](unmappedApiErrors) && _someInstanceProperty__default["default"](unmappedApiErrors).call(unmappedApiErrors, error => error.extensions?.code === errorCode);
|
|
13317
13176
|
};
|
|
13318
13177
|
|
|
13319
13178
|
const hasInvalidInputError = errors => hasErrorCode(errors, ERROR_CODES.invalidInput);
|
|
@@ -13325,7 +13184,7 @@ function minusify(value) {
|
|
|
13325
13184
|
return minus.concat(value);
|
|
13326
13185
|
}
|
|
13327
13186
|
|
|
13328
|
-
const flattenOperator = (operator, clauses) => compact__default["default"](_reduceInstanceProperty__default["default"](clauses).call(clauses, (result, clause) => _concatInstanceProperty__default["default"](result).call(result,
|
|
13187
|
+
const flattenOperator = (operator, clauses) => compact__default["default"](_reduceInstanceProperty__default["default"](clauses).call(clauses, (result, clause) => _concatInstanceProperty__default["default"](result).call(result, clause?.[operator] || clause), []));
|
|
13329
13188
|
const argsToArray = args => _reduceInstanceProperty__default["default"](args).call(args, (result, item) => _concatInstanceProperty__default["default"](result).call(result, item), []);
|
|
13330
13189
|
const exists = (field, attributeType) => ({
|
|
13331
13190
|
exists: {
|
|
@@ -13382,7 +13241,7 @@ const not = function () {
|
|
|
13382
13241
|
|
|
13383
13242
|
const safelyAddFallback = function (string) {
|
|
13384
13243
|
let fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : constants.NO_VALUE_FALLBACK;
|
|
13385
|
-
return string === '' ? fallback : string
|
|
13244
|
+
return string === '' ? fallback : string ?? fallback;
|
|
13386
13245
|
};
|
|
13387
13246
|
|
|
13388
13247
|
var messages = reactIntl.defineMessages({
|
|
@@ -13517,19 +13376,19 @@ const computedProperties = {
|
|
|
13517
13376
|
// has been deleted. See MC-1925 for further information.
|
|
13518
13377
|
const filteredCategories = _filterInstanceProperty__default["default"](_context6 = product.categories).call(_context6, category => category.obj !== undefined);
|
|
13519
13378
|
return _mapInstanceProperty__default["default"](filteredCategories).call(filteredCategories, category => {
|
|
13520
|
-
var _context7;
|
|
13521
13379
|
const categoryPath = getPathName(category, language, languages);
|
|
13522
13380
|
const ancestors = getAncestors(category, language);
|
|
13523
|
-
const externalIdValue = category.obj.externalId ?
|
|
13381
|
+
const externalIdValue = category.obj.externalId ?
|
|
13382
|
+
// hardcoding "ext. ID" since this is not part of a message to be
|
|
13524
13383
|
// translated. This has been communicated with Jenn
|
|
13525
|
-
|
|
13384
|
+
`| ext. ID: ${category.obj.externalId}` : '';
|
|
13526
13385
|
return {
|
|
13527
13386
|
id: category.id,
|
|
13528
|
-
name:
|
|
13387
|
+
name: `${l10n.formatLocalizedString(category.obj, {
|
|
13529
13388
|
key: 'name',
|
|
13530
13389
|
locale: language,
|
|
13531
13390
|
fallbackOrder: languages
|
|
13532
|
-
})
|
|
13391
|
+
})} ${externalIdValue}`,
|
|
13533
13392
|
path: categoryPath,
|
|
13534
13393
|
level: ancestors.length
|
|
13535
13394
|
};
|
|
@@ -13566,13 +13425,13 @@ const getAttributeValueByType = _ref12 => {
|
|
|
13566
13425
|
value: value
|
|
13567
13426
|
});
|
|
13568
13427
|
case 'enum':
|
|
13569
|
-
return safelyAddFallback(value.label,
|
|
13428
|
+
return safelyAddFallback(value.label, `${value.key} (key)`);
|
|
13570
13429
|
case 'lenum':
|
|
13571
13430
|
return safelyAddFallback(l10n.formatLocalizedString(value, {
|
|
13572
13431
|
key: 'label',
|
|
13573
13432
|
locale: projectDataLocale,
|
|
13574
13433
|
fallbackOrder: projectLanguages
|
|
13575
|
-
}),
|
|
13434
|
+
}), `${value.key} (key)`);
|
|
13576
13435
|
case 'number':
|
|
13577
13436
|
return safelyAddFallback(value);
|
|
13578
13437
|
case 'boolean':
|
|
@@ -13694,7 +13553,6 @@ const reorderArrayItems = (array, from, to) => {
|
|
|
13694
13553
|
const mapTimeZonesToOptions = memoize__default["default"](timeZones => {
|
|
13695
13554
|
var _context;
|
|
13696
13555
|
return _mapInstanceProperty__default["default"](_context = _Object$entries__default["default"](timeZones)).call(_context, _ref => {
|
|
13697
|
-
var _context2;
|
|
13698
13556
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
13699
13557
|
code = _ref2[0],
|
|
13700
13558
|
value = _ref2[1];
|
|
@@ -13703,7 +13561,7 @@ const mapTimeZonesToOptions = memoize__default["default"](timeZones => {
|
|
|
13703
13561
|
//E.g. `(GMT +02:00) Central European Time - Berlin`
|
|
13704
13562
|
// unicode clock hex code: \u25F7
|
|
13705
13563
|
//
|
|
13706
|
-
label:
|
|
13564
|
+
label: `(GMT ${value.offset}) ${value.name}`
|
|
13707
13565
|
};
|
|
13708
13566
|
});
|
|
13709
13567
|
});
|
|
@@ -13711,12 +13569,9 @@ const getTimeZoneId = memoize__default["default"]((selectedTimeZone, timeZones)
|
|
|
13711
13569
|
if (timeZones[selectedTimeZone]) {
|
|
13712
13570
|
return selectedTimeZone;
|
|
13713
13571
|
} else {
|
|
13714
|
-
var
|
|
13715
|
-
const fallbackTimeZoneId = _findInstanceProperty__default["default"](
|
|
13716
|
-
|
|
13717
|
-
return (_timeZones$timeZoneId = timeZones[timeZoneId]) === null || _timeZones$timeZoneId === void 0 || (_timeZones$timeZoneId = _timeZones$timeZoneId.translationFor) === null || _timeZones$timeZoneId === void 0 ? void 0 : _someInstanceProperty__default["default"](_timeZones$timeZoneId).call(_timeZones$timeZoneId, fallbackTimeZone => fallbackTimeZone === selectedTimeZone);
|
|
13718
|
-
});
|
|
13719
|
-
if (fallbackTimeZoneId !== null && fallbackTimeZoneId !== void 0 && fallbackTimeZoneId.length) {
|
|
13572
|
+
var _context2;
|
|
13573
|
+
const fallbackTimeZoneId = _findInstanceProperty__default["default"](_context2 = _Object$keys__default["default"](timeZones)).call(_context2, timeZoneId => timeZones[timeZoneId]?.translationFor?.some(fallbackTimeZone => fallbackTimeZone === selectedTimeZone));
|
|
13574
|
+
if (fallbackTimeZoneId?.length) {
|
|
13720
13575
|
return fallbackTimeZoneId.toString();
|
|
13721
13576
|
} else {
|
|
13722
13577
|
return 'UTC';
|
|
@@ -13724,21 +13579,19 @@ const getTimeZoneId = memoize__default["default"]((selectedTimeZone, timeZones)
|
|
|
13724
13579
|
}
|
|
13725
13580
|
});
|
|
13726
13581
|
const getTimeZoneLabel = memoize__default["default"]((selectedTimeZone, timeZones) => {
|
|
13727
|
-
var _context4;
|
|
13728
13582
|
const timeZoneId = getTimeZoneId(selectedTimeZone, timeZones);
|
|
13729
13583
|
const timeZoneData = timeZones[timeZoneId];
|
|
13730
|
-
return
|
|
13584
|
+
return `(GMT ${timeZoneData.offset}) ${timeZoneData.name}`;
|
|
13731
13585
|
});
|
|
13732
13586
|
|
|
13733
13587
|
const DEFAULT_LENGTH = 50;
|
|
13734
13588
|
const DEFAULT_END = '...';
|
|
13735
13589
|
function truncate (text) {
|
|
13736
|
-
var _context;
|
|
13737
13590
|
let length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_LENGTH;
|
|
13738
13591
|
let end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_END;
|
|
13739
13592
|
if (!text) return '';
|
|
13740
13593
|
if (text.length < length) return text;
|
|
13741
|
-
return
|
|
13594
|
+
return `${text.substring(0, length)}${end}`;
|
|
13742
13595
|
}
|
|
13743
13596
|
|
|
13744
13597
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|