@commercetools-frontend/experimental-components 6.1.2 → 6.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commercetools-frontend-experimental-components.cjs.dev.js +468 -614
- package/dist/commercetools-frontend-experimental-components.cjs.prod.js +466 -612
- package/dist/commercetools-frontend-experimental-components.esm.js +466 -612
- package/dist/styles.css +12 -12
- package/package.json +21 -19
|
@@ -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);
|
|
@@ -186,12 +183,14 @@ var flatten__default = /*#__PURE__*/_interopDefault(flatten);
|
|
|
186
183
|
var uniqBy__default = /*#__PURE__*/_interopDefault(uniqBy);
|
|
187
184
|
var invariant__default = /*#__PURE__*/_interopDefault(invariant);
|
|
188
185
|
var hoistNonReactStatics__default = /*#__PURE__*/_interopDefault(hoistNonReactStatics);
|
|
186
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
189
187
|
var _Math$trunc__default = /*#__PURE__*/_interopDefault(_Math$trunc);
|
|
190
188
|
var _Number$isNaN__default = /*#__PURE__*/_interopDefault(_Number$isNaN);
|
|
191
189
|
var Cleave__default = /*#__PURE__*/_interopDefault(Cleave);
|
|
192
190
|
var isFinite__default = /*#__PURE__*/_interopDefault(isFinite);
|
|
193
191
|
var isUndefined__default = /*#__PURE__*/_interopDefault(isUndefined);
|
|
194
192
|
var _Object$assign__default = /*#__PURE__*/_interopDefault(_Object$assign);
|
|
193
|
+
var _findIndexInstanceProperty__default = /*#__PURE__*/_interopDefault(_findIndexInstanceProperty);
|
|
195
194
|
var flatMap__default = /*#__PURE__*/_interopDefault(flatMap);
|
|
196
195
|
var compact__default = /*#__PURE__*/_interopDefault(compact);
|
|
197
196
|
var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
@@ -282,9 +281,8 @@ function _objectSpread$1r(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
|
282
281
|
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 } } } };
|
|
283
282
|
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 } } } };
|
|
284
283
|
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 } } } };
|
|
285
|
-
const getRolesClause = roles => roles && roles.length > 0 ?
|
|
284
|
+
const getRolesClause = roles => roles && roles.length > 0 ? `roles contains any (${_mapInstanceProperty__default["default"](roles).call(roles, role => `"${role}"`).join(',')})` : undefined;
|
|
286
285
|
const ChannelPickerInput = _ref => {
|
|
287
|
-
var _currentOption$data$l, _currentOption$data;
|
|
288
286
|
let isClearable = _ref.isClearable,
|
|
289
287
|
isDisabled = _ref.isDisabled,
|
|
290
288
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -304,7 +302,7 @@ const ChannelPickerInput = _ref => {
|
|
|
304
302
|
const variables = React.useMemo(() => {
|
|
305
303
|
const rolesClause = getRolesClause(roles);
|
|
306
304
|
return _objectSpread$1r({
|
|
307
|
-
sortByNamePath:
|
|
305
|
+
sortByNamePath: `name.${dataLocale}`
|
|
308
306
|
}, rolesClause && {
|
|
309
307
|
extraWhere: rolesClause
|
|
310
308
|
});
|
|
@@ -325,7 +323,7 @@ const ChannelPickerInput = _ref => {
|
|
|
325
323
|
}
|
|
326
324
|
return channel;
|
|
327
325
|
}, [formatLocalizedFieldToString]);
|
|
328
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
326
|
+
const prefixSearchFields = React.useMemo(() => [`name.${dataLocale}`, 'key'], [dataLocale]);
|
|
329
327
|
const loadOptions = useLoadOptions({
|
|
330
328
|
query: GetChannelsQuery,
|
|
331
329
|
variables,
|
|
@@ -360,13 +358,13 @@ const ChannelPickerInput = _ref => {
|
|
|
360
358
|
setLoadingError(null);
|
|
361
359
|
handleInternalInputChange(event);
|
|
362
360
|
}, [handleInternalInputChange]);
|
|
363
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
361
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
364
362
|
React.useEffect(() => {
|
|
365
363
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
366
364
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
367
365
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
368
366
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$K.noChannelsFound), [loadingError, formatMessage]);
|
|
369
|
-
const tooltipTitle =
|
|
367
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
370
368
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
371
369
|
max: "scale",
|
|
372
370
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -376,7 +374,7 @@ const ChannelPickerInput = _ref => {
|
|
|
376
374
|
children: jsxRuntime.jsx(uiKit.AsyncSelectInput, {
|
|
377
375
|
id: name,
|
|
378
376
|
name: name,
|
|
379
|
-
placeholder: placeholder
|
|
377
|
+
placeholder: placeholder ?? formatMessage(messages$K.placeholder),
|
|
380
378
|
loadOptions: loadOptionsDebounced,
|
|
381
379
|
defaultOptions: true,
|
|
382
380
|
showOptionGroupDivider: true,
|
|
@@ -418,10 +416,9 @@ let FormattedDateTime = /*#__PURE__*/function (_PureComponent) {
|
|
|
418
416
|
value: function render() {
|
|
419
417
|
return jsxRuntime.jsx(applicationShellConnectors.ApplicationContext, {
|
|
420
418
|
render: _ref => {
|
|
421
|
-
var _this$props;
|
|
422
419
|
let user = _ref.user;
|
|
423
420
|
return formatDateTime$1(this.props.type, this.props.value, {
|
|
424
|
-
timeZone:
|
|
421
|
+
timeZone: this?.props?.timeZone || user?.timeZone,
|
|
425
422
|
locale: this.props.intl.locale
|
|
426
423
|
});
|
|
427
424
|
}
|
|
@@ -460,7 +457,6 @@ const convertProductTypeToOption = productType => {
|
|
|
460
457
|
};
|
|
461
458
|
};
|
|
462
459
|
const ProductTypePickerInput = _ref => {
|
|
463
|
-
var _currentOption$data$l, _currentOption$data;
|
|
464
460
|
let isClearable = _ref.isClearable,
|
|
465
461
|
isDisabled = _ref.isDisabled,
|
|
466
462
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -492,9 +488,8 @@ const ProductTypePickerInput = _ref => {
|
|
|
492
488
|
itemToOption: convertProductTypeToOption
|
|
493
489
|
});
|
|
494
490
|
const handleLoadOptions = React.useCallback(inputValue => loadProductTypes(inputValue).then(_ref3 => {
|
|
495
|
-
var _data$productTypes;
|
|
496
491
|
let data = _ref3.data;
|
|
497
|
-
return
|
|
492
|
+
return data.productTypes?.results || [];
|
|
498
493
|
}).then(productTypes => _mapInstanceProperty__default["default"](productTypes).call(productTypes, convertProductTypeToOption)).catch(error => {
|
|
499
494
|
setLoadingError(error);
|
|
500
495
|
onError(error);
|
|
@@ -508,12 +503,12 @@ const ProductTypePickerInput = _ref => {
|
|
|
508
503
|
setLoadingError(null);
|
|
509
504
|
handleInternalInputChange(event);
|
|
510
505
|
}, [handleInternalInputChange]);
|
|
511
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
506
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
512
507
|
React.useEffect(() => {
|
|
513
508
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
514
509
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
515
510
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
516
|
-
const tooltipTitle =
|
|
511
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
517
512
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
518
513
|
max: "scale",
|
|
519
514
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -567,7 +562,6 @@ var messages$I = reactIntl.defineMessages({
|
|
|
567
562
|
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 } } } };
|
|
568
563
|
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 } } } };
|
|
569
564
|
const StatePickerInput = _ref => {
|
|
570
|
-
var _currentOption$data$l, _currentOption$data;
|
|
571
565
|
let isClearable = _ref.isClearable,
|
|
572
566
|
isDisabled = _ref.isDisabled,
|
|
573
567
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -583,7 +577,7 @@ const StatePickerInput = _ref => {
|
|
|
583
577
|
formatMessage = _useIntl.formatMessage;
|
|
584
578
|
const dataLocale = applicationShellConnectors.useApplicationContext(applicationContext => applicationContext.dataLocale);
|
|
585
579
|
const variables = React.useMemo(() => ({
|
|
586
|
-
sortByNamePath:
|
|
580
|
+
sortByNamePath: `name.${dataLocale}`
|
|
587
581
|
}), [dataLocale]);
|
|
588
582
|
const convertStateToOption = React.useCallback(state => {
|
|
589
583
|
const localizedName = formatLocalizedFieldToString(state.nameAllLocales);
|
|
@@ -598,7 +592,7 @@ const StatePickerInput = _ref => {
|
|
|
598
592
|
_useState2 = _slicedToArray(_useState, 2),
|
|
599
593
|
loadingError = _useState2[0],
|
|
600
594
|
setLoadingError = _useState2[1];
|
|
601
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
595
|
+
const prefixSearchFields = React.useMemo(() => [`name.${dataLocale}`, 'key'], [dataLocale]);
|
|
602
596
|
const loadOptions = useLoadOptions({
|
|
603
597
|
query: GetStatesQuery,
|
|
604
598
|
variables,
|
|
@@ -631,13 +625,13 @@ const StatePickerInput = _ref => {
|
|
|
631
625
|
setLoadingError(null);
|
|
632
626
|
handleInternalInputChange(event);
|
|
633
627
|
}, [handleInternalInputChange]);
|
|
634
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
628
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
635
629
|
React.useEffect(() => {
|
|
636
630
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
637
631
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
638
632
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
639
633
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$I.noStatesFound), [loadingError, formatMessage]);
|
|
640
|
-
const tooltipTitle =
|
|
634
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
641
635
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
642
636
|
max: "scale",
|
|
643
637
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -751,10 +745,9 @@ const useHandlers = onChange => {
|
|
|
751
745
|
setInputValue(changedValue);
|
|
752
746
|
}, []);
|
|
753
747
|
const handleChange = useEventCallback(event => {
|
|
754
|
-
var _event$target$value;
|
|
755
748
|
const eventWithExtractedValue = _objectSpread$1o(_objectSpread$1o({}, event), {}, {
|
|
756
749
|
target: _objectSpread$1o(_objectSpread$1o({}, event.target), {}, {
|
|
757
|
-
value:
|
|
750
|
+
value: event.target.value?.value
|
|
758
751
|
})
|
|
759
752
|
});
|
|
760
753
|
onChange(eventWithExtractedValue);
|
|
@@ -764,24 +757,21 @@ const useHandlers = onChange => {
|
|
|
764
757
|
|
|
765
758
|
const _excluded$3 = ["extraWhere"];
|
|
766
759
|
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; }
|
|
767
|
-
function _objectSpread$1n(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
760
|
+
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; }
|
|
768
761
|
const constructPrefixSearchPredicate$1 = function () {
|
|
769
762
|
let prefixSearchFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
770
763
|
let lowerBound = arguments.length > 1 ? arguments[1] : undefined;
|
|
771
764
|
let upperBound = arguments.length > 2 ? arguments[2] : undefined;
|
|
772
765
|
const constructPrefixSearchExpression = field => {
|
|
773
|
-
var _context
|
|
766
|
+
var _context;
|
|
774
767
|
const path = field.split('.');
|
|
775
768
|
const _path$slice$reverse = _reverseInstanceProperty__default["default"](_context = _sliceInstanceProperty__default["default"](path).call(path)).call(_context),
|
|
776
769
|
_path$slice$reverse2 = _toArray(_path$slice$reverse),
|
|
777
770
|
finalValueInPath = _path$slice$reverse2[0],
|
|
778
771
|
remainPathInReverse = _sliceInstanceProperty__default["default"](_path$slice$reverse2).call(_path$slice$reverse2, 1);
|
|
779
|
-
const comparison =
|
|
772
|
+
const comparison = `${finalValueInPath} >= "${lowerBound}" and ${finalValueInPath} < "${upperBound}"`;
|
|
780
773
|
if (remainPathInReverse.length) {
|
|
781
|
-
return _reduceInstanceProperty__default["default"](remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) => {
|
|
782
|
-
var _context5;
|
|
783
|
-
return _concatInstanceProperty__default["default"](_context5 = "".concat(nextPath, "(")).call(_context5, nestedPath, ")");
|
|
784
|
-
}, comparison);
|
|
774
|
+
return _reduceInstanceProperty__default["default"](remainPathInReverse).call(remainPathInReverse, (nestedPath, nextPath) => `${nextPath}(${nestedPath})`, comparison);
|
|
785
775
|
}
|
|
786
776
|
return comparison;
|
|
787
777
|
};
|
|
@@ -797,7 +787,7 @@ const useLoadOptions = _ref => {
|
|
|
797
787
|
let where;
|
|
798
788
|
if (inputValue.length) {
|
|
799
789
|
if (isUUID(inputValue)) {
|
|
800
|
-
where =
|
|
790
|
+
where = `id = "${inputValue}"`;
|
|
801
791
|
} else {
|
|
802
792
|
const _getPrefixSearchBound = getPrefixSearchBounds(inputValue),
|
|
803
793
|
_getPrefixSearchBound2 = _slicedToArray(_getPrefixSearchBound, 2),
|
|
@@ -806,12 +796,11 @@ const useLoadOptions = _ref => {
|
|
|
806
796
|
where = constructPrefixSearchPredicate$1(prefixSearchFields, lowerBound, upperBound);
|
|
807
797
|
}
|
|
808
798
|
}
|
|
809
|
-
const _ref2 = variables
|
|
799
|
+
const _ref2 = variables ?? {},
|
|
810
800
|
extraWhere = _ref2.extraWhere,
|
|
811
801
|
restVariables = _objectWithoutProperties(_ref2, _excluded$3);
|
|
812
802
|
if (typeof extraWhere === 'string') {
|
|
813
|
-
|
|
814
|
-
where = where ? _concatInstanceProperty__default["default"](_context6 = "(".concat(where, ") and ")).call(_context6, variables.extraWhere) : variables.extraWhere;
|
|
803
|
+
where = where ? `(${where}) and ${variables.extraWhere}` : variables.extraWhere;
|
|
815
804
|
}
|
|
816
805
|
return client$1.query({
|
|
817
806
|
query,
|
|
@@ -841,12 +830,12 @@ const useExecuteGraphQLRequest = () => {
|
|
|
841
830
|
};
|
|
842
831
|
const createSearchProductsFromPIMAction = (searchTerm, projectKey) => sdk.actions.post({
|
|
843
832
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.PIM_SEARCH,
|
|
844
|
-
uri:
|
|
833
|
+
uri: `/${projectKey}/search/product-types`,
|
|
845
834
|
payload: {
|
|
846
835
|
query: {
|
|
847
836
|
wildcard: {
|
|
848
837
|
field: 'name',
|
|
849
|
-
value:
|
|
838
|
+
value: `*${searchTerm}*`,
|
|
850
839
|
caseInsensitive: true
|
|
851
840
|
}
|
|
852
841
|
},
|
|
@@ -860,9 +849,8 @@ const useFetchProductTypesFromPIM = _ref => {
|
|
|
860
849
|
const dispatch = sdk.useAsyncDispatch();
|
|
861
850
|
const executeGraphQLRequest = useExecuteGraphQLRequest();
|
|
862
851
|
const fetchProductTypesFromPim = React.useCallback(async searchTerm => {
|
|
863
|
-
var _result$hits$map, _result$hits;
|
|
864
852
|
const result = await dispatch(createSearchProductsFromPIMAction(searchTerm, projectKey));
|
|
865
|
-
const ids =
|
|
853
|
+
const ids = result?.hits?.map(hit => hit.id) ?? [];
|
|
866
854
|
// Avoid sending any requests if it's clear that nothing is found
|
|
867
855
|
if (ids.length === 0) {
|
|
868
856
|
return {
|
|
@@ -897,22 +885,19 @@ const useFetchProductTypesFromPIM = _ref => {
|
|
|
897
885
|
*/
|
|
898
886
|
const constructNestedExpression = (reversedPath, predicate) => {
|
|
899
887
|
if (reversedPath.length > 0) {
|
|
900
|
-
return _reduceInstanceProperty__default["default"](reversedPath).call(reversedPath, (nextNestedValue, nestedSelection) => {
|
|
901
|
-
var _context;
|
|
902
|
-
return _concatInstanceProperty__default["default"](_context = "".concat(nestedSelection, "(")).call(_context, nextNestedValue, ")");
|
|
903
|
-
}, predicate);
|
|
888
|
+
return _reduceInstanceProperty__default["default"](reversedPath).call(reversedPath, (nextNestedValue, nestedSelection) => `${nestedSelection}(${nextNestedValue})`, predicate);
|
|
904
889
|
}
|
|
905
890
|
return predicate;
|
|
906
891
|
};
|
|
907
892
|
const constructPrefixSearchPredicate = (prefixSearchFields, lowerBound, upperBound) => {
|
|
908
893
|
const constructPrefixSearchExpression = field => {
|
|
909
|
-
var
|
|
894
|
+
var _context;
|
|
910
895
|
const parts = field.split('.');
|
|
911
|
-
const _parts$slice$reverse = _reverseInstanceProperty__default["default"](
|
|
896
|
+
const _parts$slice$reverse = _reverseInstanceProperty__default["default"](_context = _sliceInstanceProperty__default["default"](parts).call(parts)).call(_context),
|
|
912
897
|
_parts$slice$reverse2 = _toArray(_parts$slice$reverse),
|
|
913
898
|
valueToNest = _parts$slice$reverse2[0],
|
|
914
899
|
reversedPathToNestedValue = _sliceInstanceProperty__default["default"](_parts$slice$reverse2).call(_parts$slice$reverse2, 1);
|
|
915
|
-
const predicateExpression =
|
|
900
|
+
const predicateExpression = `${valueToNest} >= "${lowerBound}" and ${valueToNest} < "${upperBound}"`;
|
|
916
901
|
return constructNestedExpression(reversedPathToNestedValue, predicateExpression);
|
|
917
902
|
};
|
|
918
903
|
return _mapInstanceProperty__default["default"](prefixSearchFields).call(prefixSearchFields, constructPrefixSearchExpression).join(' or ');
|
|
@@ -920,7 +905,7 @@ const constructPrefixSearchPredicate = (prefixSearchFields, lowerBound, upperBou
|
|
|
920
905
|
const constructWherePredicate = (inputValue, prefixSearchFields) => {
|
|
921
906
|
const wherePredicate = function () {
|
|
922
907
|
if (inputValue.length) {
|
|
923
|
-
if (isUUID(inputValue)) return
|
|
908
|
+
if (isUUID(inputValue)) return `id = "${inputValue}"`;else {
|
|
924
909
|
const _getPrefixSearchBound = getPrefixSearchBounds(inputValue),
|
|
925
910
|
_getPrefixSearchBound2 = _slicedToArray(_getPrefixSearchBound, 2),
|
|
926
911
|
lowerBound = _getPrefixSearchBound2[0],
|
|
@@ -945,7 +930,6 @@ const useFetchProductTypessFromCTP = _ref2 => {
|
|
|
945
930
|
}, [prefixSearchFields, executeGraphQLRequest]);
|
|
946
931
|
};
|
|
947
932
|
const usePimStatus = () => {
|
|
948
|
-
var _data$indicesExist;
|
|
949
933
|
const _useQuery = react.useQuery(FetchIndicesExist$1, {
|
|
950
934
|
context: {
|
|
951
935
|
target: constants.GRAPHQL_TARGETS.PIM_INDEXER
|
|
@@ -955,20 +939,17 @@ const usePimStatus = () => {
|
|
|
955
939
|
data = _useQuery.data;
|
|
956
940
|
return {
|
|
957
941
|
data,
|
|
958
|
-
isProjectIndexed: Boolean(data
|
|
942
|
+
isProjectIndexed: Boolean(data?.indicesExist?.productTypes?.searchableIndexExists)
|
|
959
943
|
};
|
|
960
944
|
};
|
|
961
945
|
const useProductTypeOptions = _ref3 => {
|
|
962
946
|
let prefixSearchFields = _ref3.prefixSearchFields;
|
|
963
947
|
const _usePimStatus = usePimStatus(),
|
|
964
948
|
isProjectIndexed = _usePimStatus.isProjectIndexed;
|
|
965
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => {
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key
|
|
970
|
-
};
|
|
971
|
-
}),
|
|
949
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
950
|
+
dataLocale: context.dataLocale,
|
|
951
|
+
projectKey: context.project?.key
|
|
952
|
+
})),
|
|
972
953
|
dataLocale = _useApplicationContex.dataLocale,
|
|
973
954
|
projectKey = _useApplicationContex.projectKey;
|
|
974
955
|
const fetchProductTypesFromPim = useFetchProductTypesFromPIM({
|
|
@@ -985,7 +966,6 @@ const useProductTypeOptions = _ref3 => {
|
|
|
985
966
|
};
|
|
986
967
|
|
|
987
968
|
function useCurrentOption(_ref) {
|
|
988
|
-
var _context;
|
|
989
969
|
let id = _ref.id,
|
|
990
970
|
typename = _ref.typename,
|
|
991
971
|
query = _ref.query,
|
|
@@ -997,7 +977,7 @@ function useCurrentOption(_ref) {
|
|
|
997
977
|
// load from cache when possible to speed up initial render
|
|
998
978
|
const canReadFromCache = id && typename && fragment;
|
|
999
979
|
const cacheItem = canReadFromCache ? apolloClient.readFragment({
|
|
1000
|
-
id:
|
|
980
|
+
id: `${typename}:${id}`,
|
|
1001
981
|
fragment
|
|
1002
982
|
}) : undefined;
|
|
1003
983
|
|
|
@@ -1015,7 +995,7 @@ function useCurrentOption(_ref) {
|
|
|
1015
995
|
queryData = _useQuery.data,
|
|
1016
996
|
queryError = _useQuery.error;
|
|
1017
997
|
const queryItem = queryData && queryDataToItem(queryData);
|
|
1018
|
-
const item = queryItem
|
|
998
|
+
const item = queryItem ?? cacheItem;
|
|
1019
999
|
const loading = item ? false : queryLoading;
|
|
1020
1000
|
const error = item ? undefined : queryError;
|
|
1021
1001
|
const data = item && itemToOption(item);
|
|
@@ -1044,10 +1024,7 @@ const setDisplayName = nextDisplayName => Component => {
|
|
|
1044
1024
|
|
|
1045
1025
|
const keepDisplayName = component => setDisplayName(getDisplayName(component));
|
|
1046
1026
|
|
|
1047
|
-
const wrapDisplayName = (BaseComponent, hocName) => {
|
|
1048
|
-
var _context;
|
|
1049
|
-
return _concatInstanceProperty__default["default"](_context = "".concat(hocName, "(")).call(_context, getDisplayName(BaseComponent), ")");
|
|
1050
|
-
};
|
|
1027
|
+
const wrapDisplayName = (BaseComponent, hocName) => `${hocName}(${getDisplayName(BaseComponent)})`;
|
|
1051
1028
|
|
|
1052
1029
|
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; }
|
|
1053
1030
|
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; }
|
|
@@ -1162,7 +1139,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
1162
1139
|
};
|
|
1163
1140
|
_this.doDelayedUpdate = (updateFunction, event, eventType) => {
|
|
1164
1141
|
const self = _this;
|
|
1165
|
-
const timeoutKey =
|
|
1142
|
+
const timeoutKey = `${eventType}Timeout`;
|
|
1166
1143
|
// TODO: can't we just use one variable?
|
|
1167
1144
|
clearTimeout(_this[timeoutKey]);
|
|
1168
1145
|
_this[timeoutKey] = _setTimeout__default["default"](() => {
|
|
@@ -1193,7 +1170,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
1193
1170
|
}, this.props.onEnter ? {
|
|
1194
1171
|
onKeyDown: this.handleEnter
|
|
1195
1172
|
} : {}), filterDataAttributes(this.props));
|
|
1196
|
-
const inputId =
|
|
1173
|
+
const inputId = `throttled-field-${this.props.name}`;
|
|
1197
1174
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1198
1175
|
children: [jsxRuntime.jsx(uiKit.AccessibleHidden, {
|
|
1199
1176
|
children: jsxRuntime.jsx("label", {
|
|
@@ -1202,7 +1179,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
1202
1179
|
})
|
|
1203
1180
|
}), this.props.as === 'textarea' ? jsxRuntime.jsx(Textarea__default["default"], _objectSpread$1l(_objectSpread$1l({}, commonProps), {}, {
|
|
1204
1181
|
id: inputId,
|
|
1205
|
-
className: classnames__default["default"](styles$i.textarea, styles$i[
|
|
1182
|
+
className: classnames__default["default"](styles$i.textarea, styles$i[`textarea-${this.props.style}`], {
|
|
1206
1183
|
[styles$i.invalid]: !this.props.isValid,
|
|
1207
1184
|
[styles$i.disabled]: this.props.disabled
|
|
1208
1185
|
}),
|
|
@@ -1213,7 +1190,7 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
|
|
|
1213
1190
|
id: inputId,
|
|
1214
1191
|
ref: this.props.inputRef,
|
|
1215
1192
|
type: this.props.as,
|
|
1216
|
-
className: classnames__default["default"](styles$i[
|
|
1193
|
+
className: classnames__default["default"](styles$i[`input-${this.props.style}`], {
|
|
1217
1194
|
[styles$i.invalid]: !this.props.isValid,
|
|
1218
1195
|
[styles$i.disabled]: this.props.disabled,
|
|
1219
1196
|
[styles$i.granular]: this.props.isGranular
|
|
@@ -1310,8 +1287,7 @@ let SearchInput = /*#__PURE__*/function (_Component) {
|
|
|
1310
1287
|
});
|
|
1311
1288
|
};
|
|
1312
1289
|
_this.handleClear = () => {
|
|
1313
|
-
|
|
1314
|
-
(_this$inputRef = _this.inputRef) === null || _this$inputRef === void 0 || _this$inputRef.focus();
|
|
1290
|
+
_this.inputRef?.focus();
|
|
1315
1291
|
_this.props.onChange(null);
|
|
1316
1292
|
_this.props.onReset();
|
|
1317
1293
|
_this.setState({
|
|
@@ -1413,16 +1389,15 @@ function ownKeys$1k(e, r) { var t = _Object$keys__default["default"](e); if (_Ob
|
|
|
1413
1389
|
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; }
|
|
1414
1390
|
const injectDataTablePaginationState = initialValues => Component => {
|
|
1415
1391
|
const WithDataTablePaginationState = props => {
|
|
1416
|
-
var _initialValues$tableS, _initialValues$tableS2;
|
|
1417
1392
|
const _usePaginationState = uiKit.usePaginationState({
|
|
1418
|
-
page: initialValues
|
|
1419
|
-
perPage: initialValues
|
|
1393
|
+
page: initialValues?.page,
|
|
1394
|
+
perPage: initialValues?.perPage
|
|
1420
1395
|
}),
|
|
1421
1396
|
page = _usePaginationState.page,
|
|
1422
1397
|
perPage = _usePaginationState.perPage;
|
|
1423
1398
|
const tableSorting = uiKit.useDataTableSortingState({
|
|
1424
|
-
key: initialValues
|
|
1425
|
-
order: initialValues
|
|
1399
|
+
key: initialValues?.tableSorting?.key,
|
|
1400
|
+
order: initialValues?.tableSorting?.order
|
|
1426
1401
|
});
|
|
1427
1402
|
return jsxRuntime.jsx(Component, _objectSpread$1k(_objectSpread$1k({}, props), {}, {
|
|
1428
1403
|
dataTablePaginationState: {
|
|
@@ -1456,7 +1431,7 @@ const injectNotifications = function () {
|
|
|
1456
1431
|
[propName]: notifications
|
|
1457
1432
|
}));
|
|
1458
1433
|
};
|
|
1459
|
-
WrappedComponent.displayName =
|
|
1434
|
+
WrappedComponent.displayName = `withNotifications(${getDisplayName(Component)}`;
|
|
1460
1435
|
return WrappedComponent;
|
|
1461
1436
|
};
|
|
1462
1437
|
};
|
|
@@ -1565,10 +1540,7 @@ const isNil = value => typeof value === 'undefined' || value === null;
|
|
|
1565
1540
|
const useStorage = (storageKey, initialStorageValue, options) => {
|
|
1566
1541
|
var _context;
|
|
1567
1542
|
const mergedOptions = _objectSpread$1e(_objectSpread$1e({}, defaultOptions$2), options);
|
|
1568
|
-
const userId = applicationShellConnectors.useApplicationContext(context =>
|
|
1569
|
-
var _context$user;
|
|
1570
|
-
return (_context$user = context.user) === null || _context$user === void 0 ? void 0 : _context$user.id;
|
|
1571
|
-
});
|
|
1543
|
+
const userId = applicationShellConnectors.useApplicationContext(context => context.user?.id);
|
|
1572
1544
|
const scopedStorageKey = _filterInstanceProperty__default["default"](_context = [mergedOptions.segregateByUser && userId, storageKey]).call(_context, Boolean).join('/');
|
|
1573
1545
|
const readFromStorage = React.useCallback(() => {
|
|
1574
1546
|
const rawStorageValue = getStorage(mergedOptions.storageType).getItem(scopedStorageKey);
|
|
@@ -1587,9 +1559,8 @@ const useStorage = (storageKey, initialStorageValue, options) => {
|
|
|
1587
1559
|
return parsedStorageValue;
|
|
1588
1560
|
}, [mergedOptions.storageType, scopedStorageKey]);
|
|
1589
1561
|
const initializeStorageValue = () => {
|
|
1590
|
-
var _ref, _readFromStorage;
|
|
1591
1562
|
// default the storage value to the initial provided value when provided
|
|
1592
|
-
return
|
|
1563
|
+
return readFromStorage() ?? initialStorageValue ?? null;
|
|
1593
1564
|
};
|
|
1594
1565
|
const _useState = React.useState(initializeStorageValue),
|
|
1595
1566
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -1677,7 +1648,7 @@ function useFormatLocalizedFieldToString() {
|
|
|
1677
1648
|
}
|
|
1678
1649
|
|
|
1679
1650
|
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; }
|
|
1680
|
-
function _objectSpread$1c(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
1651
|
+
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; }
|
|
1681
1652
|
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 } } } };
|
|
1682
1653
|
const MC_RESOURCES_WITH_KEYS = {
|
|
1683
1654
|
ASSOCIATE_ROLE: 'ASSOCIATE_ROLE',
|
|
@@ -1754,14 +1725,13 @@ const getSkipVariables = resourceType => {
|
|
|
1754
1725
|
});
|
|
1755
1726
|
};
|
|
1756
1727
|
const getWhereClause$1 = function () {
|
|
1757
|
-
var _context, _context2, _context3;
|
|
1758
1728
|
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1759
1729
|
field = _ref.field,
|
|
1760
1730
|
fieldValue = _ref.fieldValue,
|
|
1761
1731
|
id = _ref.id;
|
|
1762
1732
|
if (!id && !fieldValue) return null;
|
|
1763
|
-
if (!id) return
|
|
1764
|
-
return
|
|
1733
|
+
if (!id) return `${field} = "${fieldValue}"`;
|
|
1734
|
+
return `${field} = "${fieldValue}" and id != "${id}"`;
|
|
1765
1735
|
};
|
|
1766
1736
|
const getQueryVariables = _ref2 => {
|
|
1767
1737
|
let resourceType = _ref2.resourceType,
|
|
@@ -1780,7 +1750,6 @@ const getQueryVariables = _ref2 => {
|
|
|
1780
1750
|
}, skipVariables);
|
|
1781
1751
|
};
|
|
1782
1752
|
const useIsFieldDuplicated = () => {
|
|
1783
|
-
var _Object$values$;
|
|
1784
1753
|
const _useLazyQuery = hooks.useLazyQuery(FetchResourceTypeDuplicatedField, {
|
|
1785
1754
|
context: {
|
|
1786
1755
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -1795,7 +1764,7 @@ const useIsFieldDuplicated = () => {
|
|
|
1795
1764
|
return {
|
|
1796
1765
|
getQueryVariables,
|
|
1797
1766
|
isLoading: loading,
|
|
1798
|
-
isFieldDuplicated: data ?
|
|
1767
|
+
isFieldDuplicated: data ? _Object$values__default["default"](data)[0]?.total > 0 : null,
|
|
1799
1768
|
queryIsFieldDuplicated: execute
|
|
1800
1769
|
};
|
|
1801
1770
|
};
|
|
@@ -1848,16 +1817,14 @@ function ownKeys$1b(e, r) { var t = _Object$keys__default["default"](e); if (_Ob
|
|
|
1848
1817
|
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; }
|
|
1849
1818
|
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 } } } };
|
|
1850
1819
|
const filterStoresOutdatedDanglingProductSelections = storesQueryResult => {
|
|
1851
|
-
var _storesQueryResult$re;
|
|
1852
1820
|
if (!storesQueryResult) return null;
|
|
1853
1821
|
return {
|
|
1854
1822
|
total: storesQueryResult.total,
|
|
1855
1823
|
count: storesQueryResult.count,
|
|
1856
1824
|
offset: storesQueryResult.offset,
|
|
1857
|
-
results:
|
|
1858
|
-
var _store$productSelecti;
|
|
1825
|
+
results: storesQueryResult.results?.map(store => {
|
|
1859
1826
|
return _objectSpread$1b(_objectSpread$1b({}, store), {}, {
|
|
1860
|
-
productSelections:
|
|
1827
|
+
productSelections: store.productSelections?.filter(productSelectionRef => Boolean(productSelectionRef.productSelection))
|
|
1861
1828
|
});
|
|
1862
1829
|
})
|
|
1863
1830
|
};
|
|
@@ -1869,7 +1836,7 @@ const createQueryVariables$6 = ownProps => {
|
|
|
1869
1836
|
offset: ownProps.offset,
|
|
1870
1837
|
sort: _sortInstanceProperty__default["default"](ownProps)
|
|
1871
1838
|
}, Boolean(ownProps.stores) && {
|
|
1872
|
-
where:
|
|
1839
|
+
where: `key in (${_mapInstanceProperty__default["default"](_context = ownProps.stores).call(_context, store => `"${store}"`).join(', ')})`
|
|
1873
1840
|
}), {}, {
|
|
1874
1841
|
excludeExtendedStoresList: ownProps.excludeExtendedStoresList,
|
|
1875
1842
|
excludeProductSelections: ownProps.excludeProductSelections
|
|
@@ -1894,10 +1861,7 @@ const useStoresListFetcher = props => {
|
|
|
1894
1861
|
projectKey: props.projectKey
|
|
1895
1862
|
},
|
|
1896
1863
|
fetchPolicy: 'network-only',
|
|
1897
|
-
onError: graphqlErrorResponse =>
|
|
1898
|
-
var _props$onError;
|
|
1899
|
-
return (_props$onError = props.onError) === null || _props$onError === void 0 ? void 0 : _props$onError.call(props, graphqlErrorResponse);
|
|
1900
|
-
}
|
|
1864
|
+
onError: graphqlErrorResponse => props.onError?.(graphqlErrorResponse)
|
|
1901
1865
|
}),
|
|
1902
1866
|
data = _useQuery.data,
|
|
1903
1867
|
refetch = _useQuery.refetch,
|
|
@@ -1905,7 +1869,7 @@ const useStoresListFetcher = props => {
|
|
|
1905
1869
|
return {
|
|
1906
1870
|
isLoading: loading,
|
|
1907
1871
|
refetch,
|
|
1908
|
-
stores: filterStoresOutdatedDanglingProductSelections(data
|
|
1872
|
+
stores: filterStoresOutdatedDanglingProductSelections(data?.stores),
|
|
1909
1873
|
refetchQuery: {
|
|
1910
1874
|
query: FetchStoresQuery,
|
|
1911
1875
|
variables: queryVariables,
|
|
@@ -1969,18 +1933,13 @@ const handlers$5 = {
|
|
|
1969
1933
|
}
|
|
1970
1934
|
};
|
|
1971
1935
|
|
|
1972
|
-
const toPermission = (permission, resourceName) => {
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
}
|
|
1976
|
-
const
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
var _context2;
|
|
1980
|
-
return (// e.g applicationContext.dataFences?.store?.orders?.canViewOrders?.values
|
|
1981
|
-
_concatInstanceProperty__default["default"](_context2 = "dataFences.store.".concat(resourceName, ".")).call(_context2, permission, ".values")
|
|
1982
|
-
);
|
|
1983
|
-
};
|
|
1936
|
+
const toPermission = (permission, resourceName) => camelCase__default["default"](`can ${permission} ${resourceName}`);
|
|
1937
|
+
const createPermissionsComposePath = permission =>
|
|
1938
|
+
// e.g applicationContext.permissions?.canViewOrders
|
|
1939
|
+
`permissions.${permission}`;
|
|
1940
|
+
const createDataFencesComposePath = resourceName => permission =>
|
|
1941
|
+
// e.g applicationContext.dataFences?.store?.orders?.canViewOrders?.values
|
|
1942
|
+
`dataFences.store.${resourceName}.${permission}.values`;
|
|
1984
1943
|
const useStoreKeysInDataFences = _ref => {
|
|
1985
1944
|
let resourceName = _ref.resourceName,
|
|
1986
1945
|
_ref$permission = _ref.permission,
|
|
@@ -2388,7 +2347,7 @@ const usePersistedTableConfiguration = props => {
|
|
|
2388
2347
|
* Therefore, if it will be missing from the local storage and hence we use the [] as default.
|
|
2389
2348
|
*/
|
|
2390
2349
|
const getVisibleColumns = React.useCallback(() => {
|
|
2391
|
-
if (cachedVisibleTableConfiguration
|
|
2350
|
+
if (cachedVisibleTableConfiguration?.columnsConfig) {
|
|
2392
2351
|
return retrieveColumnsWithCachedConfiguration({
|
|
2393
2352
|
allAvailableColumnsConfiguration,
|
|
2394
2353
|
cachedVisibleTableConfiguration: cachedVisibleTableConfiguration.columnsConfig,
|
|
@@ -2402,8 +2361,8 @@ const usePersistedTableConfiguration = props => {
|
|
|
2402
2361
|
return {
|
|
2403
2362
|
visibleColumns,
|
|
2404
2363
|
visibleColumnKeys,
|
|
2405
|
-
cachedVisibleColumnsConfiguration: cachedVisibleTableConfiguration
|
|
2406
|
-
cachedDisplaySettings: cachedVisibleTableConfiguration
|
|
2364
|
+
cachedVisibleColumnsConfiguration: cachedVisibleTableConfiguration?.columnsConfig,
|
|
2365
|
+
cachedDisplaySettings: cachedVisibleTableConfiguration?.displaySettings,
|
|
2407
2366
|
handleCachedTableConfigurationUpdate: update => handleCacheUpdate({
|
|
2408
2367
|
update,
|
|
2409
2368
|
cachedVisibleTableConfiguration,
|
|
@@ -2414,7 +2373,6 @@ const usePersistedTableConfiguration = props => {
|
|
|
2414
2373
|
|
|
2415
2374
|
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 } } } };
|
|
2416
2375
|
const useProductSelectionsTotalFetcher = props => {
|
|
2417
|
-
var _data$productSelectio;
|
|
2418
2376
|
const _useQuery = hooks.useQuery(FetchProductSelectionsTotal, {
|
|
2419
2377
|
context: {
|
|
2420
2378
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -2424,7 +2382,7 @@ const useProductSelectionsTotalFetcher = props => {
|
|
|
2424
2382
|
data = _useQuery.data;
|
|
2425
2383
|
return {
|
|
2426
2384
|
isLoading: loading,
|
|
2427
|
-
total: data
|
|
2385
|
+
total: data?.productSelections?.total
|
|
2428
2386
|
};
|
|
2429
2387
|
};
|
|
2430
2388
|
|
|
@@ -2445,7 +2403,7 @@ function _objectSpread$17(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
|
2445
2403
|
// eslint-disable-next-line import/prefer-default-export
|
|
2446
2404
|
const convertProductSelectionsFromGraphQl = productSelections => {
|
|
2447
2405
|
var _context;
|
|
2448
|
-
return
|
|
2406
|
+
return productSelections?.results && _objectSpread$17(_objectSpread$17({}, productSelections), {}, {
|
|
2449
2407
|
results: _mapInstanceProperty__default["default"](_context = productSelections.results).call(_context, productSelection => _objectSpread$17({}, l10n.applyTransformedLocalizedFields(productSelection, [{
|
|
2450
2408
|
from: 'nameAllLocales',
|
|
2451
2409
|
to: 'name'
|
|
@@ -2482,7 +2440,7 @@ const useProductSelectionsFetcher = props => {
|
|
|
2482
2440
|
refetch = _useQuery.refetch;
|
|
2483
2441
|
return {
|
|
2484
2442
|
isLoading: loading,
|
|
2485
|
-
productSelections: convertProductSelectionsFromGraphQl(data
|
|
2443
|
+
productSelections: convertProductSelectionsFromGraphQl(data?.productSelections) || emptyProductSelections,
|
|
2486
2444
|
refetch
|
|
2487
2445
|
};
|
|
2488
2446
|
};
|
|
@@ -2497,7 +2455,7 @@ const handlers$3 = {
|
|
|
2497
2455
|
|
|
2498
2456
|
const setToArray = function () {
|
|
2499
2457
|
let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
2500
|
-
return
|
|
2458
|
+
return `id in (${_mapInstanceProperty__default["default"](values).call(values, value => `"${value}"`).join(', ')})`;
|
|
2501
2459
|
};
|
|
2502
2460
|
|
|
2503
2461
|
function capitalizeFirst(text) {
|
|
@@ -2565,7 +2523,6 @@ function validateSingleFilter(_ref) {
|
|
|
2565
2523
|
return _includesInstanceProperty__default["default"](invalidValues).call(invalidValues, value);
|
|
2566
2524
|
}
|
|
2567
2525
|
|
|
2568
|
-
var _templateObject$4, _templateObject2$2;
|
|
2569
2526
|
const dateFormatDayStart$1 = 'YYYY-MM-DDT00:00:00.000';
|
|
2570
2527
|
const dateFormatDayEnd$1 = 'YYYY-MM-DDT23:59:59.999';
|
|
2571
2528
|
const getDateTimeInUTC = (date, timezone, format) => {
|
|
@@ -2575,8 +2532,7 @@ const getDateTimeInUTC = (date, timezone, format) => {
|
|
|
2575
2532
|
const noTimeSpecified = momentDate.hours() === 0 && momentDate.minutes() === 0 && momentDate.seconds() === 0;
|
|
2576
2533
|
// if it's a date then convert it to UTC datetime based on timezone
|
|
2577
2534
|
if (noTimeSpecified) {
|
|
2578
|
-
|
|
2579
|
-
const offset = ((_moment$tz = moment__default["default"](date).tz(timezone)) === null || _moment$tz === void 0 ? void 0 : _moment$tz.utcOffset()) || 0;
|
|
2535
|
+
const offset = moment__default["default"](date).tz(timezone)?.utcOffset() || 0;
|
|
2580
2536
|
const formattedDate = momentDate.format(format);
|
|
2581
2537
|
const formattedDateWithOffset = moment__default["default"](formattedDate).add(offset, 'minutes').format(dateFormat);
|
|
2582
2538
|
// console.log(formattedDateWithOffset);
|
|
@@ -2589,7 +2545,6 @@ const getDateTimeInUTC = (date, timezone, format) => {
|
|
|
2589
2545
|
function dateTransformer$1(filterKey, filters) {
|
|
2590
2546
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator$1;
|
|
2591
2547
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
2592
|
-
var _context, _context2;
|
|
2593
2548
|
let type = _ref.type,
|
|
2594
2549
|
value = _ref.value,
|
|
2595
2550
|
timezone = _ref.timezone;
|
|
@@ -2599,13 +2554,19 @@ function dateTransformer$1(filterKey, filters) {
|
|
|
2599
2554
|
})) return '';
|
|
2600
2555
|
switch (type) {
|
|
2601
2556
|
case FILTER_TYPES.lessThan:
|
|
2602
|
-
return
|
|
2557
|
+
return `${filterKey} < "${getDateTimeInUTC(value, timezone, dateFormatDayStart$1)}"`;
|
|
2603
2558
|
case FILTER_TYPES.moreThan:
|
|
2604
|
-
return
|
|
2559
|
+
return `${filterKey} > "${getDateTimeInUTC(value, timezone, dateFormatDayEnd$1)}"`;
|
|
2605
2560
|
case FILTER_TYPES.equalTo:
|
|
2606
|
-
return oneLine__default["default"]
|
|
2561
|
+
return oneLine__default["default"]`
|
|
2562
|
+
(${filterKey} >= "${getDateTimeInUTC(value, timezone, dateFormatDayStart$1)}"
|
|
2563
|
+
and ${filterKey} <= "${getDateTimeInUTC(value, timezone, dateFormatDayEnd$1)}")
|
|
2564
|
+
`;
|
|
2607
2565
|
case FILTER_TYPES.range:
|
|
2608
|
-
return oneLine__default["default"]
|
|
2566
|
+
return oneLine__default["default"]`
|
|
2567
|
+
(${filterKey} >= "${getDateTimeInUTC(value.from, timezone, dateFormatDayStart$1)}"
|
|
2568
|
+
and ${filterKey} <= "${getDateTimeInUTC(value.to, timezone, dateFormatDayEnd$1)}")
|
|
2569
|
+
`;
|
|
2609
2570
|
default:
|
|
2610
2571
|
return '';
|
|
2611
2572
|
}
|
|
@@ -2621,7 +2582,7 @@ function dateTransformer$1(filterKey, filters) {
|
|
|
2621
2582
|
* (createdAt >= "2018-02-15T00:00:00.000+01:00" and createdAt <= "2018-02-15T23:59:59.999+01:00")
|
|
2622
2583
|
* ) or some_more_filters
|
|
2623
2584
|
*/
|
|
2624
|
-
return queryString === '' ? null :
|
|
2585
|
+
return queryString === '' ? null : `(${queryString})`;
|
|
2625
2586
|
}
|
|
2626
2587
|
function defaultFilterValidator$1(_ref2) {
|
|
2627
2588
|
let type = _ref2.type,
|
|
@@ -2637,25 +2598,19 @@ function defaultFilterValidator$1(_ref2) {
|
|
|
2637
2598
|
|
|
2638
2599
|
var localizedTextTransformer = (localizedString => {
|
|
2639
2600
|
var _context;
|
|
2640
|
-
return _mapInstanceProperty__default["default"](_context = _Object$keys__default["default"](localizedString)).call(_context, locale => {
|
|
2641
|
-
var _context2;
|
|
2642
|
-
return _concatInstanceProperty__default["default"](_context2 = "".concat(locale, " = \"")).call(_context2, localizedString[locale], "\"");
|
|
2643
|
-
}).join(' and ');
|
|
2601
|
+
return _mapInstanceProperty__default["default"](_context = _Object$keys__default["default"](localizedString)).call(_context, locale => `${locale} = "${localizedString[locale]}"`).join(' and ');
|
|
2644
2602
|
});
|
|
2645
2603
|
|
|
2646
|
-
const getCentAmountClause = (value, operator, locale) => {
|
|
2647
|
-
var _context;
|
|
2648
|
-
return _concatInstanceProperty__default["default"](_context = "centAmount ".concat(operator, " ")).call(_context, uiKit.MoneyInput.convertToMoneyValue(value, locale).centAmount);
|
|
2649
|
-
};
|
|
2604
|
+
const getCentAmountClause = (value, operator, locale) => `centAmount ${operator} ${uiKit.MoneyInput.convertToMoneyValue(value, locale).centAmount}`;
|
|
2650
2605
|
function moneyTransformer(value, option, locale) {
|
|
2651
2606
|
const clauses = [];
|
|
2652
2607
|
if (option === FILTER_TYPES.range) {
|
|
2653
|
-
clauses[0] =
|
|
2608
|
+
clauses[0] = `currencyCode = "${value.from.currencyCode}"`;
|
|
2654
2609
|
clauses[1] = getCentAmountClause(value.from, '>=', locale);
|
|
2655
2610
|
clauses[2] = getCentAmountClause(value.to, '<=', locale);
|
|
2656
2611
|
return clauses.join(' and ');
|
|
2657
2612
|
}
|
|
2658
|
-
clauses[0] =
|
|
2613
|
+
clauses[0] = `currencyCode = "${value.currencyCode}"`;
|
|
2659
2614
|
switch (option) {
|
|
2660
2615
|
case FILTER_TYPES.lessThan:
|
|
2661
2616
|
clauses[1] = getCentAmountClause(value, '<', locale);
|
|
@@ -2672,7 +2627,6 @@ function moneyTransformer(value, option, locale) {
|
|
|
2672
2627
|
return clauses.join(' and ');
|
|
2673
2628
|
}
|
|
2674
2629
|
|
|
2675
|
-
var _templateObject$3, _templateObject2$1;
|
|
2676
2630
|
const formatTime = 'HH:mm:ss.SSS';
|
|
2677
2631
|
|
|
2678
2632
|
/* TimeInput only allows HH:mm:ss and adds the seconds as 00 and
|
|
@@ -2694,7 +2648,6 @@ const defaultFilterValidator = _ref => {
|
|
|
2694
2648
|
const timeTransformer = function (filterKey, filters) {
|
|
2695
2649
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator;
|
|
2696
2650
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref2 => {
|
|
2697
|
-
var _context, _context2;
|
|
2698
2651
|
let type = _ref2.type,
|
|
2699
2652
|
value = _ref2.value;
|
|
2700
2653
|
if (!filterValidator({
|
|
@@ -2703,13 +2656,19 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
2703
2656
|
})) return '';
|
|
2704
2657
|
switch (type) {
|
|
2705
2658
|
case FILTER_TYPES.lessThan:
|
|
2706
|
-
return
|
|
2659
|
+
return `${filterKey} < "${value}"`;
|
|
2707
2660
|
case FILTER_TYPES.moreThan:
|
|
2708
|
-
return
|
|
2661
|
+
return `${filterKey} > "${value}"`;
|
|
2709
2662
|
case FILTER_TYPES.equalTo:
|
|
2710
|
-
return oneLine__default["default"]
|
|
2663
|
+
return oneLine__default["default"]`
|
|
2664
|
+
(${filterKey} >= "${value}"
|
|
2665
|
+
and ${filterKey} <= "${getEndOfSecond(value)}")
|
|
2666
|
+
`;
|
|
2711
2667
|
case FILTER_TYPES.range:
|
|
2712
|
-
return oneLine__default["default"]
|
|
2668
|
+
return oneLine__default["default"]`
|
|
2669
|
+
(${filterKey} >= "${value.from}"
|
|
2670
|
+
and ${filterKey} <= "${getEndOfSecond(value.to)}")
|
|
2671
|
+
`;
|
|
2713
2672
|
default:
|
|
2714
2673
|
return '';
|
|
2715
2674
|
}
|
|
@@ -2725,19 +2684,21 @@ const timeTransformer = function (filterKey, filters) {
|
|
|
2725
2684
|
* (pickUpTime >= "14:00" and pickUpTime <= "15:00")
|
|
2726
2685
|
* ) or some_more_filters
|
|
2727
2686
|
*/
|
|
2728
|
-
return queryString === '' ? null :
|
|
2687
|
+
return queryString === '' ? null : `(${queryString})`;
|
|
2729
2688
|
};
|
|
2730
2689
|
|
|
2731
|
-
var _templateObject$2;
|
|
2732
2690
|
function formatDateRangeValue(value, type) {
|
|
2733
2691
|
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
2734
2692
|
locale: 'en',
|
|
2735
2693
|
timeZone: moment__default$1["default"].tz.guess()
|
|
2736
2694
|
};
|
|
2737
2695
|
if (value.from === value.to) return formatDateTime$1(type, value.from, options);
|
|
2738
|
-
if (value.from && value.to) return oneLine__default["default"]
|
|
2739
|
-
|
|
2740
|
-
|
|
2696
|
+
if (value.from && value.to) return oneLine__default["default"]`
|
|
2697
|
+
${formatDateTime$1(type, value.from, options)} -
|
|
2698
|
+
${formatDateTime$1(type, value.to, options)}
|
|
2699
|
+
`;
|
|
2700
|
+
if (value.from) return `from ${formatDateTime$1(type, value.from, options)}`;
|
|
2701
|
+
if (value.to) return `to ${formatDateTime$1(type, value.to, options)}`;
|
|
2741
2702
|
return '';
|
|
2742
2703
|
}
|
|
2743
2704
|
function formatDateTime$1(type, value) {
|
|
@@ -3934,13 +3895,13 @@ const getData = (code, field) => {
|
|
|
3934
3895
|
const getFractionDigit = code => getData(code, 'fractionDigit');
|
|
3935
3896
|
|
|
3936
3897
|
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; }
|
|
3937
|
-
function _objectSpread$16(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
3898
|
+
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; }
|
|
3938
3899
|
function formatMoneyRangeValue(value, intl) {
|
|
3939
|
-
var _context;
|
|
3940
3900
|
if (value.from === value.to) return formatMoneyValue(value.from, value.currency, intl);
|
|
3941
|
-
if (value.from && value.to) return
|
|
3942
|
-
|
|
3943
|
-
if (value.
|
|
3901
|
+
if (value.from && value.to) return `${formatMoneyValue(value.from, value.currency, intl)} -
|
|
3902
|
+
${formatMoneyValue(value.to, value.currency, intl)}`;
|
|
3903
|
+
if (value.from) return `from ${formatMoneyValue(value.from, value.currency, intl)}`;
|
|
3904
|
+
if (value.to) return `to ${formatMoneyValue(value.to, value.currency, intl)}`;
|
|
3944
3905
|
return '';
|
|
3945
3906
|
}
|
|
3946
3907
|
function formatMoneyValue(amount, currency, intl) {
|
|
@@ -3960,8 +3921,7 @@ function getFractionedAmount(moneyValue) {
|
|
|
3960
3921
|
return amount / 10 ** fractionDigits;
|
|
3961
3922
|
}
|
|
3962
3923
|
function formatMoney$2(moneyValue, intl, options) {
|
|
3963
|
-
|
|
3964
|
-
return intl.formatNumber((_moneyValue$fractione = moneyValue.fractionedAmount) !== null && _moneyValue$fractione !== void 0 ? _moneyValue$fractione : getFractionedAmount(moneyValue), _objectSpread$16({
|
|
3924
|
+
return intl.formatNumber(moneyValue.fractionedAmount ?? getFractionedAmount(moneyValue), _objectSpread$16({
|
|
3965
3925
|
style: 'currency',
|
|
3966
3926
|
currency: moneyValue.currencyCode,
|
|
3967
3927
|
minimumFractionDigits: moneyValue.fractionDigits
|
|
@@ -3982,13 +3942,11 @@ var messages$D = reactIntl.defineMessages({
|
|
|
3982
3942
|
});
|
|
3983
3943
|
|
|
3984
3944
|
const formatEnum = _ref => {
|
|
3985
|
-
var _context;
|
|
3986
3945
|
let value = _ref.value,
|
|
3987
3946
|
fallbackValue = _ref.fallbackValue;
|
|
3988
|
-
return value.label ||
|
|
3947
|
+
return value.label || `${fallbackValue} (${value.key})`;
|
|
3989
3948
|
};
|
|
3990
3949
|
const formatLenum = _ref2 => {
|
|
3991
|
-
var _context2;
|
|
3992
3950
|
let value = _ref2.value,
|
|
3993
3951
|
language = _ref2.language,
|
|
3994
3952
|
languages = _ref2.languages,
|
|
@@ -3996,7 +3954,7 @@ const formatLenum = _ref2 => {
|
|
|
3996
3954
|
return l10n.formatLocalizedString(value, {
|
|
3997
3955
|
key: 'label',
|
|
3998
3956
|
locale: language,
|
|
3999
|
-
fallback:
|
|
3957
|
+
fallback: `${fallbackValue} (${value.key})`,
|
|
4000
3958
|
fallbackOrder: languages
|
|
4001
3959
|
});
|
|
4002
3960
|
};
|
|
@@ -4032,7 +3990,6 @@ const formatDate = _ref6 => {
|
|
|
4032
3990
|
});
|
|
4033
3991
|
};
|
|
4034
3992
|
const formatDateTime = _ref7 => {
|
|
4035
|
-
var _context3;
|
|
4036
3993
|
let value = _ref7.value,
|
|
4037
3994
|
userTimeZone = _ref7.userTimeZone,
|
|
4038
3995
|
intl = _ref7.intl;
|
|
@@ -4048,7 +4005,7 @@ const formatDateTime = _ref7 => {
|
|
|
4048
4005
|
// defaults to utc if timeZone is not provided
|
|
4049
4006
|
timeZone: userTimeZone || 'utc'
|
|
4050
4007
|
});
|
|
4051
|
-
return
|
|
4008
|
+
return `${date} (${time})`;
|
|
4052
4009
|
};
|
|
4053
4010
|
const formatBoolean = _ref8 => {
|
|
4054
4011
|
let value = _ref8.value,
|
|
@@ -4071,7 +4028,7 @@ const formatUnknown = _ref10 => {
|
|
|
4071
4028
|
fallbackValue = _ref10.fallbackValue;
|
|
4072
4029
|
// NOTE This is reporting within the render function, which is supposed to
|
|
4073
4030
|
// be pure. This is quite bad as this is a side-effect in the render fn.
|
|
4074
|
-
sentry.reportErrorToSentry(new Error(
|
|
4031
|
+
sentry.reportErrorToSentry(new Error(`Unhandled custom attribute type '${type.name}' for value`), {
|
|
4075
4032
|
extra: {
|
|
4076
4033
|
value
|
|
4077
4034
|
}
|
|
@@ -4144,10 +4101,9 @@ const attributeTypeNames = {
|
|
|
4144
4101
|
Number: 'number'
|
|
4145
4102
|
};
|
|
4146
4103
|
const convertToAttributeType = customFieldType => {
|
|
4147
|
-
var _customFieldType$elem;
|
|
4148
4104
|
if (isNil__default["default"](customFieldType)) return customFieldType;
|
|
4149
4105
|
const attributeTypeName = attributeTypeNames[customFieldType.name];
|
|
4150
|
-
const elementTypeName = attributeTypeNames[
|
|
4106
|
+
const elementTypeName = attributeTypeNames[customFieldType.elementType?.name];
|
|
4151
4107
|
return {
|
|
4152
4108
|
name: attributeTypeName,
|
|
4153
4109
|
elementType: {
|
|
@@ -4208,9 +4164,8 @@ function formatCustomField(_ref) {
|
|
|
4208
4164
|
// e.g
|
|
4209
4165
|
// where: `masterData(current(name(en >= "${lowerBound}" and en < "${upperBound}")))`
|
|
4210
4166
|
const getPrefixSearchBounds = input => {
|
|
4211
|
-
var _context;
|
|
4212
4167
|
const getNextCharacter = character => String.fromCharCode(character.charCodeAt() + 1);
|
|
4213
|
-
return [input,
|
|
4168
|
+
return [input, `${_sliceInstanceProperty__default["default"](input).call(input, 0, input.length - 1)}${getNextCharacter(_sliceInstanceProperty__default["default"](input).call(input, input.length - 1))}`];
|
|
4214
4169
|
};
|
|
4215
4170
|
|
|
4216
4171
|
const _excluded$2 = ["action"];
|
|
@@ -4403,7 +4358,7 @@ const convertChangeValueAction = actionPayload => {
|
|
|
4403
4358
|
* as its dynamic content can not be typed in SDL for the mutation.
|
|
4404
4359
|
*/
|
|
4405
4360
|
const convertAction = (actionName, actionPayload) => {
|
|
4406
|
-
var
|
|
4361
|
+
var _context3, _context4, _context5;
|
|
4407
4362
|
const getNameFromPayload = payload => {
|
|
4408
4363
|
// changeName for `Organizations`
|
|
4409
4364
|
if (typeof payload.name === 'string') return payload;
|
|
@@ -4468,7 +4423,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4468
4423
|
case 'setCustomType':
|
|
4469
4424
|
return {
|
|
4470
4425
|
[actionName]: {
|
|
4471
|
-
typeId:
|
|
4426
|
+
typeId: actionPayload.type?.id,
|
|
4472
4427
|
fields: actionPayload.fields ? _mapInstanceProperty__default["default"](_context3 = _Object$entries__default["default"](actionPayload.fields)).call(_context3, _ref => {
|
|
4473
4428
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
4474
4429
|
customField = _ref2[0],
|
|
@@ -4498,10 +4453,10 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4498
4453
|
};
|
|
4499
4454
|
case 'setGeoLocation':
|
|
4500
4455
|
return {
|
|
4501
|
-
[actionName]: actionPayload
|
|
4456
|
+
[actionName]: actionPayload?.geoLocation ? {
|
|
4502
4457
|
geoLocation: {
|
|
4503
4458
|
type: 'Point',
|
|
4504
|
-
coordinates: [_parseFloat__default["default"](
|
|
4459
|
+
coordinates: [_parseFloat__default["default"](actionPayload.geoLocation?.longitude), _parseFloat__default["default"](actionPayload.geoLocation?.latitude)]
|
|
4505
4460
|
}
|
|
4506
4461
|
} : {
|
|
4507
4462
|
undefined
|
|
@@ -4637,7 +4592,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4637
4592
|
case 'setShippingRateInputType':
|
|
4638
4593
|
return {
|
|
4639
4594
|
[actionName]: {
|
|
4640
|
-
shippingRateInputType:
|
|
4595
|
+
shippingRateInputType: actionPayload.shippingRateInputType?.type ? {
|
|
4641
4596
|
[actionPayload.shippingRateInputType.type]: {
|
|
4642
4597
|
values: actionPayload.shippingRateInputType.type === 'CartClassification' ? _mapInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](actionPayload.shippingRateInputType)).call(_context4, value => ({
|
|
4643
4598
|
key: value.key,
|
|
@@ -4691,8 +4646,8 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4691
4646
|
case 'addAddress':
|
|
4692
4647
|
case 'changeAddress':
|
|
4693
4648
|
{
|
|
4694
|
-
var
|
|
4695
|
-
const _ref3 =
|
|
4649
|
+
var _context6;
|
|
4650
|
+
const _ref3 = actionPayload.address?.custom || {},
|
|
4696
4651
|
_ref3$fields = _ref3.fields,
|
|
4697
4652
|
fields = _ref3$fields === void 0 ? {} : _ref3$fields;
|
|
4698
4653
|
const customFields = isEmpty__default["default"](fields) ? null : _mapInstanceProperty__default["default"](_context6 = _Object$entries__default["default"](fields)).call(_context6, _ref4 => {
|
|
@@ -4704,7 +4659,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4704
4659
|
value: _JSON$stringify__default["default"](value)
|
|
4705
4660
|
};
|
|
4706
4661
|
});
|
|
4707
|
-
const custom =
|
|
4662
|
+
const custom = actionPayload.address?.custom?.type?.id ? {
|
|
4708
4663
|
type: {
|
|
4709
4664
|
id: actionPayload.address.custom.type.id
|
|
4710
4665
|
},
|
|
@@ -4735,7 +4690,7 @@ const convertAction = (actionName, actionPayload) => {
|
|
|
4735
4690
|
value: _JSON$stringify__default["default"](value)
|
|
4736
4691
|
};
|
|
4737
4692
|
});
|
|
4738
|
-
const customType = type
|
|
4693
|
+
const customType = type?.id ? {
|
|
4739
4694
|
id: type.id
|
|
4740
4695
|
} : null;
|
|
4741
4696
|
return {
|
|
@@ -4758,11 +4713,10 @@ const createGraphQlUpdateActions = actions => _reduceInstanceProperty__default["
|
|
|
4758
4713
|
return [...previousActions, convertAction(actionName, actionPayload)];
|
|
4759
4714
|
}, []);
|
|
4760
4715
|
const extractErrorFromGraphQlResponse = graphQlResponse => {
|
|
4761
|
-
|
|
4762
|
-
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) {
|
|
4716
|
+
if (graphQlResponse.networkError?.result?.errors?.length > 0) {
|
|
4763
4717
|
return graphQlResponse.networkError.result.errors;
|
|
4764
4718
|
}
|
|
4765
|
-
if (
|
|
4719
|
+
if (graphQlResponse.graphQLErrors?.length > 0) {
|
|
4766
4720
|
return graphQlResponse.graphQLErrors;
|
|
4767
4721
|
}
|
|
4768
4722
|
return graphQlResponse;
|
|
@@ -4823,16 +4777,14 @@ function omitDeep(obj, fieldsToOmit) {
|
|
|
4823
4777
|
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; }
|
|
4824
4778
|
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; }
|
|
4825
4779
|
function getPriceChannelName(price) {
|
|
4826
|
-
|
|
4827
|
-
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;
|
|
4780
|
+
return price.channel?.name ?? price.channel?.key ?? null;
|
|
4828
4781
|
}
|
|
4829
4782
|
function getDiscountValue(price) {
|
|
4830
|
-
var _price$value, _price$value2, _price$discounted;
|
|
4831
4783
|
let preciseAmount;
|
|
4832
4784
|
let fractionedAmount;
|
|
4833
|
-
if (
|
|
4785
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision && price.discounted.value.type === PRECISION_TYPES.highPrecision) {
|
|
4834
4786
|
preciseAmount = price.value.preciseAmount - price.discounted.value.preciseAmount;
|
|
4835
|
-
} else if (
|
|
4787
|
+
} else if (price.value?.type === PRECISION_TYPES.highPrecision && price.discounted?.value?.type === PRECISION_TYPES.centPrecision) {
|
|
4836
4788
|
fractionedAmount = getFractionedAmount(price.value) - getFractionedAmount(price.discounted.value);
|
|
4837
4789
|
}
|
|
4838
4790
|
return price.discounted ? _objectSpread$14(_objectSpread$14({}, price.value), {}, {
|
|
@@ -4846,28 +4798,23 @@ function getDiscountValue(price) {
|
|
|
4846
4798
|
function getSelectedPrice(price) {
|
|
4847
4799
|
return price.discounted ? price.discounted : price;
|
|
4848
4800
|
}
|
|
4849
|
-
function getNetUnitPrice(
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
shouldRoundAmount = _ref2.shouldRoundAmount;
|
|
4801
|
+
function getNetUnitPrice(_ref) {
|
|
4802
|
+
let lineItem = _ref.lineItem,
|
|
4803
|
+
shouldRoundAmount = _ref.shouldRoundAmount;
|
|
4853
4804
|
const price = getSelectedPrice(lineItem.price);
|
|
4854
|
-
const filteredPerMethodTaxRate = lineItem
|
|
4855
|
-
var _lineItem$shippingDet;
|
|
4856
|
-
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;
|
|
4857
|
-
});
|
|
4805
|
+
const filteredPerMethodTaxRate = lineItem?.perMethodTaxRate?.filter(perMethodTax => lineItem?.shippingDetails?.targets?.findIndex(target => target?.shippingMethodKey === perMethodTax?.shippingMethodKey) >= 0);
|
|
4858
4806
|
|
|
4859
4807
|
// when shipping mode is multi with the same tax rate
|
|
4860
|
-
if (
|
|
4861
|
-
var _price$value3, _price$value4;
|
|
4808
|
+
if (filteredPerMethodTaxRate?.length > 0 && filteredPerMethodTaxRate[0]?.taxRate?.includedInPrice) {
|
|
4862
4809
|
const taxRate = filteredPerMethodTaxRate[0].taxRate;
|
|
4863
4810
|
let centAmount;
|
|
4864
4811
|
// should accept 0 value
|
|
4865
|
-
if (typeof
|
|
4812
|
+
if (typeof price.value?.centAmount === 'number') {
|
|
4866
4813
|
const amount = price.value.centAmount / (1 + taxRate.amount);
|
|
4867
4814
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4868
4815
|
}
|
|
4869
4816
|
let preciseAmount;
|
|
4870
|
-
if (
|
|
4817
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + taxRate.amount);
|
|
4871
4818
|
return _objectSpread$14(_objectSpread$14({}, price.value), {}, {
|
|
4872
4819
|
centAmount,
|
|
4873
4820
|
preciseAmount
|
|
@@ -4876,15 +4823,14 @@ function getNetUnitPrice(_ref2) {
|
|
|
4876
4823
|
|
|
4877
4824
|
// when shipping mode is single
|
|
4878
4825
|
if (lineItem.taxRate && lineItem.taxRate.includedInPrice) {
|
|
4879
|
-
var _price$value5, _price$value6;
|
|
4880
4826
|
let centAmount;
|
|
4881
4827
|
// should accept 0 value
|
|
4882
|
-
if (typeof
|
|
4828
|
+
if (typeof price.value?.centAmount === 'number') {
|
|
4883
4829
|
const amount = price.value.centAmount / (1 + lineItem.taxRate.amount);
|
|
4884
4830
|
centAmount = shouldRoundAmount ? Math.round(amount) : amount;
|
|
4885
4831
|
}
|
|
4886
4832
|
let preciseAmount;
|
|
4887
|
-
if (
|
|
4833
|
+
if (price.value?.type === PRECISION_TYPES.highPrecision) preciseAmount = price.value.preciseAmount / (1 + lineItem.taxRate.amount);
|
|
4888
4834
|
return _objectSpread$14(_objectSpread$14({}, price.value), {}, {
|
|
4889
4835
|
centAmount,
|
|
4890
4836
|
preciseAmount
|
|
@@ -4918,18 +4864,18 @@ const transformCustomFieldFromGraphQLResponse = resource => {
|
|
|
4918
4864
|
key: resource.custom.type.key,
|
|
4919
4865
|
name: l10n.transformLocalizedFieldToLocalizedString(resource.custom.type.nameAllLocales),
|
|
4920
4866
|
fieldDefinitions: _mapInstanceProperty__default["default"](_context = resource.custom.type.fieldDefinitions).call(_context, fieldDefinition => {
|
|
4921
|
-
var
|
|
4867
|
+
var _context2, _context3;
|
|
4922
4868
|
return {
|
|
4923
4869
|
name: fieldDefinition.name,
|
|
4924
4870
|
required: fieldDefinition.required,
|
|
4925
|
-
type:
|
|
4871
|
+
type: fieldDefinition.type?.elementType?.name === 'LocalizedEnum' ? _objectSpread$13(_objectSpread$13({}, fieldDefinition.type), {}, {
|
|
4926
4872
|
elementType: _objectSpread$13(_objectSpread$13({}, fieldDefinition.type.elementType), {}, {
|
|
4927
4873
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
4928
4874
|
key: value.key,
|
|
4929
4875
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
4930
4876
|
}))
|
|
4931
4877
|
})
|
|
4932
|
-
}) :
|
|
4878
|
+
}) : fieldDefinition.type?.name === 'LocalizedEnum' ? _objectSpread$13(_objectSpread$13({}, fieldDefinition.type), {}, {
|
|
4933
4879
|
values: _mapInstanceProperty__default["default"](_context3 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context3, value => ({
|
|
4934
4880
|
key: value.key,
|
|
4935
4881
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -4956,7 +4902,7 @@ const convertProductSelectionFromGraphQl = productSelection => {
|
|
|
4956
4902
|
from: 'nameAllLocales',
|
|
4957
4903
|
to: 'name'
|
|
4958
4904
|
}])), {}, {
|
|
4959
|
-
custom: productSelection
|
|
4905
|
+
custom: productSelection?.custom ? transformCustomFieldFromGraphQLResponse(productSelection) : null
|
|
4960
4906
|
});
|
|
4961
4907
|
};
|
|
4962
4908
|
|
|
@@ -5079,7 +5025,7 @@ function omitSetsOfSets() {
|
|
|
5079
5025
|
* duplicated in original values
|
|
5080
5026
|
*/
|
|
5081
5027
|
function unique(values, properties) {
|
|
5082
|
-
var
|
|
5028
|
+
var _context;
|
|
5083
5029
|
let ignoredValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['', null, undefined];
|
|
5084
5030
|
const duplicateValues = [];
|
|
5085
5031
|
let realValues;
|
|
@@ -5088,20 +5034,19 @@ function unique(values, properties) {
|
|
|
5088
5034
|
realValues = _filterInstanceProperty__default["default"](values).call(values, value => !_includesInstanceProperty__default["default"](ignoredValues).call(ignoredValues, value));
|
|
5089
5035
|
if (!realValues.length) return [];
|
|
5090
5036
|
if (properties) realValues = _mapInstanceProperty__default["default"](realValues).call(realValues, value => _reduceInstanceProperty__default["default"](properties).call(properties, (prev, curr) => {
|
|
5091
|
-
var _context;
|
|
5092
5037
|
const currentValue = value[curr] || '';
|
|
5093
|
-
return
|
|
5038
|
+
return `${prev}:${currentValue}`;
|
|
5094
5039
|
}, ''));else realValues = _sliceInstanceProperty__default["default"](values).call(values, 0);
|
|
5095
5040
|
|
|
5096
5041
|
// TODO: checking for dupes like this is slow, find a better way
|
|
5097
|
-
_reduceInstanceProperty__default["default"](
|
|
5042
|
+
_reduceInstanceProperty__default["default"](_context = _sortInstanceProperty__default["default"](realValues).call(realValues)).call(_context, (prev, curr) => {
|
|
5098
5043
|
if (curr === null) return curr;
|
|
5099
5044
|
if (curr !== '' && prev === curr && _indexOfInstanceProperty__default["default"](duplicateValues).call(duplicateValues, curr) === -1) duplicateValues.push(curr);
|
|
5100
5045
|
return curr;
|
|
5101
5046
|
});
|
|
5102
5047
|
if (properties) return _mapInstanceProperty__default["default"](duplicateValues).call(duplicateValues, value => {
|
|
5103
|
-
var
|
|
5104
|
-
const parts = _sliceInstanceProperty__default["default"](
|
|
5048
|
+
var _context2;
|
|
5049
|
+
const parts = _sliceInstanceProperty__default["default"](_context2 = value.split(':')).call(_context2, 1);
|
|
5105
5050
|
return _reduceInstanceProperty__default["default"](properties).call(properties, (prev, curr, index) => {
|
|
5106
5051
|
// eslint-disable-next-line no-param-reassign
|
|
5107
5052
|
prev[curr] = parts[index];
|
|
@@ -5120,14 +5065,14 @@ function unique(values, properties) {
|
|
|
5120
5065
|
* @return Array<Object> returns an array of objects with all duplicated values
|
|
5121
5066
|
*/
|
|
5122
5067
|
function uniqueObjects(items) {
|
|
5123
|
-
var
|
|
5068
|
+
var _context3;
|
|
5124
5069
|
const emptyValues = [undefined, null, ''];
|
|
5125
|
-
const itemsWorkingSet = items && items.length ? _filterInstanceProperty__default["default"](
|
|
5070
|
+
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)) : [];
|
|
5126
5071
|
const duplicateValues = _reduceInstanceProperty__default["default"](itemsWorkingSet).call(itemsWorkingSet, (acc, item, index) => {
|
|
5127
|
-
var
|
|
5072
|
+
var _context4;
|
|
5128
5073
|
if (item === null) return acc;
|
|
5129
|
-
const isDuplicate = _reduceInstanceProperty__default["default"](
|
|
5130
|
-
).call(
|
|
5074
|
+
const isDuplicate = _reduceInstanceProperty__default["default"](_context4 = _sliceInstanceProperty__default["default"](itemsWorkingSet).call(itemsWorkingSet, index + 1) // get sub-array after this index
|
|
5075
|
+
).call(_context4, (duplicateAcc, comparisonItem, comparisonIndex) => {
|
|
5131
5076
|
if (comparisonItem === null) return duplicateAcc;
|
|
5132
5077
|
|
|
5133
5078
|
// check if its a dupe
|
|
@@ -5254,7 +5199,7 @@ function getCategoriesByIds(apolloClient, options) {
|
|
|
5254
5199
|
return apolloClient.query({
|
|
5255
5200
|
query: FetchCategoriesByIds,
|
|
5256
5201
|
variables: {
|
|
5257
|
-
where:
|
|
5202
|
+
where: `id in (${_mapInstanceProperty__default["default"](_context2 = options.ids).call(_context2, id => `"${id}"`).join(', ')})`
|
|
5258
5203
|
},
|
|
5259
5204
|
context: {
|
|
5260
5205
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -5274,8 +5219,8 @@ function getCategoriesByIds(apolloClient, options) {
|
|
|
5274
5219
|
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 } } } };
|
|
5275
5220
|
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 } } } };
|
|
5276
5221
|
const transformCartDiscountResponse = response => {
|
|
5277
|
-
var _context
|
|
5278
|
-
return _mapInstanceProperty__default["default"](_context =
|
|
5222
|
+
var _context;
|
|
5223
|
+
return _mapInstanceProperty__default["default"](_context = response.data?.cartDiscounts.results || []).call(_context, cartDiscount => transformLocalizedFieldsForCartDiscount(cartDiscount));
|
|
5279
5224
|
};
|
|
5280
5225
|
function queryCartDiscounts(apolloClient) {
|
|
5281
5226
|
return apolloClient.query({
|
|
@@ -5287,14 +5232,14 @@ function queryCartDiscounts(apolloClient) {
|
|
|
5287
5232
|
}).then(transformCartDiscountResponse);
|
|
5288
5233
|
}
|
|
5289
5234
|
const getWhereClause = function () {
|
|
5290
|
-
var _context2, _context3
|
|
5235
|
+
var _context2, _context3;
|
|
5291
5236
|
let searchText = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
5292
5237
|
let language = arguments.length > 1 ? arguments[1] : undefined;
|
|
5293
5238
|
const query = _trimInstanceProperty__default["default"](_context2 = _JSON$stringify__default["default"](searchText)).call(_context2);
|
|
5294
|
-
const idQuery = isUUID(searchText) &&
|
|
5295
|
-
const nameQuery =
|
|
5296
|
-
const keyQuery =
|
|
5297
|
-
return _filterInstanceProperty__default["default"](
|
|
5239
|
+
const idQuery = isUUID(searchText) && `id = ${query}`;
|
|
5240
|
+
const nameQuery = `name(${language} = ${query})`;
|
|
5241
|
+
const keyQuery = `key = ${query}`;
|
|
5242
|
+
return _filterInstanceProperty__default["default"](_context3 = [idQuery, nameQuery, keyQuery]).call(_context3, Boolean).join(' or ');
|
|
5298
5243
|
};
|
|
5299
5244
|
function searchCartDiscountsByExactMatch(apolloClient, options) {
|
|
5300
5245
|
return apolloClient.query({
|
|
@@ -5317,10 +5262,7 @@ function getCartDiscountById(apolloClient, options) {
|
|
|
5317
5262
|
context: {
|
|
5318
5263
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
5319
5264
|
}
|
|
5320
|
-
}).then(response =>
|
|
5321
|
-
var _response$data2;
|
|
5322
|
-
return (_response$data2 = response.data) !== null && _response$data2 !== void 0 && _response$data2.cartDiscount ? transformLocalizedFieldsForCartDiscount(response.data.cartDiscount) : null;
|
|
5323
|
-
});
|
|
5265
|
+
}).then(response => response.data?.cartDiscount ? transformLocalizedFieldsForCartDiscount(response.data.cartDiscount) : null);
|
|
5324
5266
|
}
|
|
5325
5267
|
|
|
5326
5268
|
var styles$g = {
|
|
@@ -5405,13 +5347,10 @@ const useReferenceSearchItems = _ref => {
|
|
|
5405
5347
|
};
|
|
5406
5348
|
};
|
|
5407
5349
|
function ReferenceSearch(props) {
|
|
5408
|
-
const ids = React.useMemo(() => {
|
|
5409
|
-
|
|
5410
|
-
return
|
|
5411
|
-
|
|
5412
|
-
return id;
|
|
5413
|
-
}) : [(_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.id] : [];
|
|
5414
|
-
}, [props.value, props.isMulti]);
|
|
5350
|
+
const ids = React.useMemo(() => props.value ? props.isMulti ? props.value?.map(_ref2 => {
|
|
5351
|
+
let id = _ref2.id;
|
|
5352
|
+
return id;
|
|
5353
|
+
}) : [props.value?.id] : [], [props.value, props.isMulti]);
|
|
5415
5354
|
const _useReferenceSearchIt = useReferenceSearchItems({
|
|
5416
5355
|
loadItemsBySearchTerm: props.loadItemsBySearchTerm,
|
|
5417
5356
|
loadItemsByIds: props.loadItemsByIds,
|
|
@@ -5422,14 +5361,14 @@ function ReferenceSearch(props) {
|
|
|
5422
5361
|
areSomeItemsMissing = _useReferenceSearchIt.areSomeItemsMissing,
|
|
5423
5362
|
handleLoadItems = _useReferenceSearchIt.handleLoadItems;
|
|
5424
5363
|
if (areItemsLoading) return null;
|
|
5425
|
-
const value = props.isMulti ? items : items
|
|
5364
|
+
const value = props.isMulti ? items : items?.[0];
|
|
5426
5365
|
let filterValue = null;
|
|
5427
5366
|
if (value) filterValue = props.isMulti ? _mapInstanceProperty__default["default"](value).call(value, props.mapItemToOption) : props.mapItemToOption(value);
|
|
5428
5367
|
const tooltipTitle = value || props.value ? props.mapItemToOption(value || props.value).label : '';
|
|
5429
5368
|
const loadItems = value => _Promise__default["default"].resolve(handleLoadItems(value)).then(items => _mapInstanceProperty__default["default"](items).call(items, item => props.mapItemToOption(item)));
|
|
5430
5369
|
const handleChange = event => {
|
|
5431
|
-
var _context
|
|
5432
|
-
const option = props.isMulti ? _mapInstanceProperty__default["default"](_context = event.target.value).call(_context, item => item.value) :
|
|
5370
|
+
var _context;
|
|
5371
|
+
const option = props.isMulti ? _mapInstanceProperty__default["default"](_context = event.target.value).call(_context, item => item.value) : event.target.value?.value || null;
|
|
5433
5372
|
props.onChange(option);
|
|
5434
5373
|
};
|
|
5435
5374
|
return jsxRuntime.jsxs("div", {
|
|
@@ -5543,7 +5482,7 @@ function CartDiscountReferenceSearch(props) {
|
|
|
5543
5482
|
}),
|
|
5544
5483
|
loading = _useQuery.loading,
|
|
5545
5484
|
data = _useQuery.data;
|
|
5546
|
-
const isExactMatch =
|
|
5485
|
+
const isExactMatch = data?.cartDiscounts.total > QUERY_MAX_LIMIT;
|
|
5547
5486
|
const _useIntl = reactIntl.useIntl(),
|
|
5548
5487
|
formatMessage = _useIntl.formatMessage;
|
|
5549
5488
|
const apolloClient = client.useApolloClient();
|
|
@@ -5643,9 +5582,8 @@ const messages$A = reactIntl.defineMessages({
|
|
|
5643
5582
|
});
|
|
5644
5583
|
|
|
5645
5584
|
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; }
|
|
5646
|
-
function _objectSpread$$(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
5585
|
+
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; }
|
|
5647
5586
|
function Option(props) {
|
|
5648
|
-
var _context, _context2;
|
|
5649
5587
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
5650
5588
|
language: applicationContext.dataLocale,
|
|
5651
5589
|
languages: applicationContext.project.languages
|
|
@@ -5666,19 +5604,19 @@ function Option(props) {
|
|
|
5666
5604
|
fallbackOrder: languages
|
|
5667
5605
|
})
|
|
5668
5606
|
}), category.parent && jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
5669
|
-
children:
|
|
5607
|
+
children: `${formatMessage(messages$A.parentCategory)}: ${l10n.formatLocalizedString(category.parent, {
|
|
5670
5608
|
key: 'name',
|
|
5671
5609
|
locale: language,
|
|
5672
5610
|
fallbackOrder: languages
|
|
5673
|
-
})
|
|
5611
|
+
})}`
|
|
5674
5612
|
}), jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
5675
|
-
children:
|
|
5613
|
+
children: `Slug: ${l10n.formatLocalizedString(category, {
|
|
5676
5614
|
key: 'slug',
|
|
5677
5615
|
locale: language,
|
|
5678
5616
|
fallbackOrder: languages
|
|
5679
|
-
})
|
|
5617
|
+
})}`
|
|
5680
5618
|
}), category.externalId && jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
5681
|
-
children:
|
|
5619
|
+
children: `${formatMessage(messages$A.externalId)}: ${category.externalId || constants.NO_VALUE_FALLBACK}`
|
|
5682
5620
|
})]
|
|
5683
5621
|
})
|
|
5684
5622
|
}));
|
|
@@ -5742,7 +5680,7 @@ var CategorySearchPickerOptionFragment$1 = { kind: "Document", definitions: [{ k
|
|
|
5742
5680
|
function useCachedCategoryOptions(ids) {
|
|
5743
5681
|
const apolloClient = client.useApolloClient();
|
|
5744
5682
|
const fragments = _mapInstanceProperty__default["default"](ids).call(ids, id => apolloClient.readFragment({
|
|
5745
|
-
id:
|
|
5683
|
+
id: `CategorySearch:${id}`,
|
|
5746
5684
|
fragment: CategorySearchPickerOptionFragment$1
|
|
5747
5685
|
}));
|
|
5748
5686
|
return _mapInstanceProperty__default["default"](fragments).call(fragments, category => transformLocalizedFieldsForCategory(category, [{
|
|
@@ -5867,8 +5805,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
5867
5805
|
var _context2;
|
|
5868
5806
|
const intl = reactIntl.useIntl();
|
|
5869
5807
|
const handleLoadOptions = async searchTerm => {
|
|
5870
|
-
|
|
5871
|
-
const filteredOptions = (_props$options = props.options) === null || _props$options === void 0 ? void 0 : _filterInstanceProperty__default["default"](_props$options).call(_props$options, country => {
|
|
5808
|
+
const filteredOptions = props.options?.filter(country => {
|
|
5872
5809
|
var _context;
|
|
5873
5810
|
return _includesInstanceProperty__default["default"](_context = country.label.toLowerCase()).call(_context, searchTerm.toLowerCase());
|
|
5874
5811
|
});
|
|
@@ -5876,7 +5813,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
5876
5813
|
return _sliceInstanceProperty__default["default"](filteredOptions).call(filteredOptions, 0, props.countriesAsyncLoadingLimit);
|
|
5877
5814
|
}
|
|
5878
5815
|
return [{
|
|
5879
|
-
options:
|
|
5816
|
+
options: props.options?.slice(0, props.countriesAsyncLoadingLimit)
|
|
5880
5817
|
}, {
|
|
5881
5818
|
options: emptyCountryOption(intl)
|
|
5882
5819
|
}];
|
|
@@ -5885,10 +5822,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
5885
5822
|
const countries = event.target.value;
|
|
5886
5823
|
props.onChange({
|
|
5887
5824
|
target: _objectSpread$X(_objectSpread$X({}, event.target), {}, {
|
|
5888
|
-
value: _mapInstanceProperty__default["default"](countries).call(countries, country =>
|
|
5889
|
-
var _country$value;
|
|
5890
|
-
return (_country$value = country === null || country === void 0 ? void 0 : country.value) !== null && _country$value !== void 0 ? _country$value : country;
|
|
5891
|
-
})
|
|
5825
|
+
value: _mapInstanceProperty__default["default"](countries).call(countries, country => country?.value ?? country)
|
|
5892
5826
|
})
|
|
5893
5827
|
});
|
|
5894
5828
|
};
|
|
@@ -5940,8 +5874,7 @@ const COUNTRIES_ASYNC_LOADING_LIMIT = 60;
|
|
|
5940
5874
|
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; }
|
|
5941
5875
|
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; }
|
|
5942
5876
|
function CountriesPicker(props) {
|
|
5943
|
-
|
|
5944
|
-
const CustomCountriesPicker = ((_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.length) <= props.countriesAsyncLoadingLimit ? CountriesBasicSelectDropdown : CountriesAsyncSelectDropdown;
|
|
5877
|
+
const CustomCountriesPicker = props.options?.length <= props.countriesAsyncLoadingLimit ? CountriesBasicSelectDropdown : CountriesAsyncSelectDropdown;
|
|
5945
5878
|
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
5946
5879
|
children: jsxRuntime.jsx(CustomCountriesPicker, _objectSpread$W({}, props))
|
|
5947
5880
|
});
|
|
@@ -5970,7 +5903,6 @@ var GetCustomerGroupsQuery = { kind: "Document", definitions: [{ kind: "Operatio
|
|
|
5970
5903
|
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 } } } };
|
|
5971
5904
|
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 } } } };
|
|
5972
5905
|
const CustomerGroupPickerInput = _ref => {
|
|
5973
|
-
var _currentOption$data$l, _currentOption$data;
|
|
5974
5906
|
let isClearable = _ref.isClearable,
|
|
5975
5907
|
isDisabled = _ref.isDisabled,
|
|
5976
5908
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -6039,13 +5971,13 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
6039
5971
|
setLoadingError(null);
|
|
6040
5972
|
handleInternalInputChange(event);
|
|
6041
5973
|
}, [handleInternalInputChange]);
|
|
6042
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
5974
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
6043
5975
|
React.useEffect(() => {
|
|
6044
5976
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
6045
5977
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
6046
5978
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
6047
5979
|
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$x.noCustomerGroupsFound), [loadingError, formatMessage]);
|
|
6048
|
-
const tooltipTitle =
|
|
5980
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
6049
5981
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
6050
5982
|
max: "scale",
|
|
6051
5983
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -6055,7 +5987,7 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
6055
5987
|
children: jsxRuntime.jsx(uiKit.AsyncSelectInput, {
|
|
6056
5988
|
id: name,
|
|
6057
5989
|
name: name,
|
|
6058
|
-
placeholder: placeholder
|
|
5990
|
+
placeholder: placeholder ?? formatMessage(messages$x.placeholder),
|
|
6059
5991
|
loadOptions: loadOptionsDebounced,
|
|
6060
5992
|
defaultOptions: true,
|
|
6061
5993
|
showOptionGroupDivider: true,
|
|
@@ -6149,9 +6081,9 @@ const CustomFieldErrors = props => {
|
|
|
6149
6081
|
const didFormValidationFail = useDidFormValidationFail();
|
|
6150
6082
|
const errors = _Array$isArray__default["default"](props.errors) ? mergeSetItemsErrors(props.errors) : props.errors;
|
|
6151
6083
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6152
|
-
children: [props.isTouched || didFormValidationFail &&
|
|
6084
|
+
children: [props.isTouched || didFormValidationFail && errors?.missing && jsxRuntime.jsx(_.ErrorMessage, {
|
|
6153
6085
|
intlMessage: messages$C.required
|
|
6154
|
-
}), props.isTouched || didFormValidationFail &&
|
|
6086
|
+
}), props.isTouched || didFormValidationFail && errors?.duplicated && jsxRuntime.jsx(_.ErrorMessage, {
|
|
6155
6087
|
intlMessage: messages$C.unique
|
|
6156
6088
|
})]
|
|
6157
6089
|
});
|
|
@@ -6235,7 +6167,7 @@ const ExpandButton = props => props.totalValues > 1 ? jsxRuntime.jsxs(uiKit.Spac
|
|
|
6235
6167
|
}), jsxRuntime.jsx(uiKit.FlatButton, {
|
|
6236
6168
|
tone: "primary",
|
|
6237
6169
|
icon: props.isExpanded ? jsxRuntime.jsx(uiKit.AngleUpIcon, {}) : jsxRuntime.jsx(uiKit.AngleDownIcon, {}),
|
|
6238
|
-
label: props.isExpanded ?
|
|
6170
|
+
label: props.isExpanded ? `Hide set items (${props.totalValues})` : `Show all set items (${props.totalValues})`,
|
|
6239
6171
|
onClick: props.onExpand
|
|
6240
6172
|
})]
|
|
6241
6173
|
}) : null;
|
|
@@ -6270,7 +6202,7 @@ const SetButtons = props => {
|
|
|
6270
6202
|
SetButtons.displayName = 'SetButtons';
|
|
6271
6203
|
|
|
6272
6204
|
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; }
|
|
6273
|
-
function _objectSpread$U(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
6205
|
+
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; }
|
|
6274
6206
|
const getDuplicateErrors = setValues => {
|
|
6275
6207
|
/* eslint-disable no-plusplus */
|
|
6276
6208
|
const result = [];
|
|
@@ -6310,13 +6242,10 @@ const getItemIndex = name => {
|
|
|
6310
6242
|
return _parseInt__default["default"](rawIndex, 10);
|
|
6311
6243
|
};
|
|
6312
6244
|
const makeKeys = amount => times__default["default"](amount, () => uuid.v4());
|
|
6313
|
-
const makeItemFieldName = (fieldName, index) => {
|
|
6314
|
-
var _context;
|
|
6315
|
-
return _concatInstanceProperty__default["default"](_context = "".concat(fieldName, ".[")).call(_context, index, "]");
|
|
6316
|
-
};
|
|
6245
|
+
const makeItemFieldName = (fieldName, index) => `${fieldName}.[${index}]`;
|
|
6317
6246
|
const makeMapForAllItems = (fieldName, items, value) => _reduceInstanceProperty__default["default"](items).call(items, (result, item, index) => set__default["default"](result, makeItemFieldName(fieldName, index), value), {});
|
|
6318
6247
|
function CustomInputSet(props) {
|
|
6319
|
-
var
|
|
6248
|
+
var _context;
|
|
6320
6249
|
const _useToggleState = uiKit.useToggleState(false),
|
|
6321
6250
|
_useToggleState2 = _slicedToArray(_useToggleState, 2),
|
|
6322
6251
|
isExpanded = _useToggleState2[0],
|
|
@@ -6338,7 +6267,7 @@ function CustomInputSet(props) {
|
|
|
6338
6267
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
6339
6268
|
keys = _useState4[0],
|
|
6340
6269
|
setKeys = _useState4[1];
|
|
6341
|
-
const totalAmount = internalValue
|
|
6270
|
+
const totalAmount = internalValue?.length;
|
|
6342
6271
|
const amountToRender = isExpanded ? totalAmount : 1;
|
|
6343
6272
|
const updateInternalValue = newValue => {
|
|
6344
6273
|
const valueToSet = isEmpty$1(newValue) ? [undefined] : newValue;
|
|
@@ -6385,8 +6314,8 @@ function CustomInputSet(props) {
|
|
|
6385
6314
|
// in <CustomFieldComponent /> where proper component for given field/attribute
|
|
6386
6315
|
// type is selected.
|
|
6387
6316
|
const type = getType(props.fieldDefinition);
|
|
6388
|
-
const typeName = type
|
|
6389
|
-
const areButtonsTopAligned = _includesInstanceProperty__default["default"](
|
|
6317
|
+
const typeName = type?.name.toLowerCase();
|
|
6318
|
+
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);
|
|
6390
6319
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6391
6320
|
children: [jsxRuntime.jsx(uiKit.AccessibleHidden, {
|
|
6392
6321
|
children: jsxRuntime.jsx("label", {
|
|
@@ -6505,17 +6434,16 @@ function CustomDateTimeInput(props) {
|
|
|
6505
6434
|
CustomDateTimeInput.displayName = 'CustomDateTimeInput';
|
|
6506
6435
|
|
|
6507
6436
|
const convertTypeValuesToOptions$1 = reselect.defaultMemoize(typeValues => _mapInstanceProperty__default["default"](typeValues).call(typeValues, typeValue => ({
|
|
6508
|
-
label: typeValue.label ||
|
|
6437
|
+
label: typeValue.label || `${typeValue.key} (key)`,
|
|
6509
6438
|
value: typeValue.key
|
|
6510
6439
|
})));
|
|
6511
6440
|
function CustomEnumInput(props) {
|
|
6512
|
-
var _options$find$label, _options$find;
|
|
6513
6441
|
const options = convertTypeValuesToOptions$1(_valuesInstanceProperty__default["default"](props.fieldDefinition.type));
|
|
6514
6442
|
const handleChange = makeChangeHandler(rawValue => {
|
|
6515
6443
|
props.setFieldValue(props.name, rawValue);
|
|
6516
6444
|
props.renderWarnings && props.handleWarningChange(props.name, props.fieldDefinition, rawValue);
|
|
6517
6445
|
});
|
|
6518
|
-
const tooltipTitle = props.value ?
|
|
6446
|
+
const tooltipTitle = props.value ? _findInstanceProperty__default["default"](options).call(options, option => option.value === props.value)?.label ?? '' : '';
|
|
6519
6447
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
6520
6448
|
title: tooltipTitle,
|
|
6521
6449
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
@@ -6544,13 +6472,12 @@ const convertTypeValuesToOptions = reselect.defaultMemoize((type, dataLocale, la
|
|
|
6544
6472
|
key: 'label',
|
|
6545
6473
|
locale: dataLocale,
|
|
6546
6474
|
fallbackOrder: languages,
|
|
6547
|
-
fallback:
|
|
6475
|
+
fallback: `${value.key} (key)`
|
|
6548
6476
|
}),
|
|
6549
6477
|
value: value.key
|
|
6550
6478
|
}));
|
|
6551
6479
|
});
|
|
6552
6480
|
function CustomLocalizedEnumInput(props) {
|
|
6553
|
-
var _options$find$label, _options$find;
|
|
6554
6481
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
6555
6482
|
languages: applicationContext.project.languages,
|
|
6556
6483
|
dataLocale: applicationContext.dataLocale
|
|
@@ -6562,7 +6489,7 @@ function CustomLocalizedEnumInput(props) {
|
|
|
6562
6489
|
props.setFieldValue(props.name, rawValue);
|
|
6563
6490
|
props.renderWarnings && props.handleWarningChange(props.name, props.fieldDefinition, rawValue);
|
|
6564
6491
|
});
|
|
6565
|
-
const tooltipTitle = props.value ?
|
|
6492
|
+
const tooltipTitle = props.value ? _findInstanceProperty__default["default"](options).call(options, option => option.value === props.value)?.label ?? '' : '';
|
|
6566
6493
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
6567
6494
|
title: tooltipTitle,
|
|
6568
6495
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
@@ -6591,7 +6518,6 @@ const getSubfieldLanguage = subfieldName => {
|
|
|
6591
6518
|
return subfieldName.substring(lastDotIndex + 1);
|
|
6592
6519
|
};
|
|
6593
6520
|
function CustomLocalizedTextInput(props) {
|
|
6594
|
-
var _value$language;
|
|
6595
6521
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
6596
6522
|
language: applicationContext.dataLocale,
|
|
6597
6523
|
languages: applicationContext.project.languages
|
|
@@ -6617,7 +6543,7 @@ function CustomLocalizedTextInput(props) {
|
|
|
6617
6543
|
props.renderWarnings && props.handleWarningChange(props.name, props.fieldDefinition, rawValue);
|
|
6618
6544
|
});
|
|
6619
6545
|
const InputComponent = isMultiLine ? uiKit.LocalizedMultilineTextInput : uiKit.LocalizedTextInput;
|
|
6620
|
-
const tooltipTitle = isMultiLine ? '' : value ?
|
|
6546
|
+
const tooltipTitle = isMultiLine ? '' : value ? value[language] ?? '' : '';
|
|
6621
6547
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
6622
6548
|
title: tooltipTitle,
|
|
6623
6549
|
children: jsxRuntime.jsx(InputComponent, {
|
|
@@ -6666,7 +6592,7 @@ const fixAmount = value => {
|
|
|
6666
6592
|
// data user just entered effectively preventing full data from being entered.
|
|
6667
6593
|
const fixEnteredValue = (newValue, initialValue, currencies) => {
|
|
6668
6594
|
const withFixedCurrency = fixCurrencyCode(newValue, currencies);
|
|
6669
|
-
if (!
|
|
6595
|
+
if (!initialValue?.amount) {
|
|
6670
6596
|
return fixAmount(withFixedCurrency);
|
|
6671
6597
|
}
|
|
6672
6598
|
return withFixedCurrency;
|
|
@@ -6733,19 +6659,19 @@ function ownKeys$R(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
6733
6659
|
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; }
|
|
6734
6660
|
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 } } } };
|
|
6735
6661
|
const mapAttributeDefinition = definition => {
|
|
6736
|
-
var _context,
|
|
6662
|
+
var _context, _context2, _context3, _context4;
|
|
6737
6663
|
return _objectSpread$R(_objectSpread$R({}, definition), {}, {
|
|
6738
6664
|
required: definition.isRequired,
|
|
6739
6665
|
inputTip: l10n.transformLocalizedFieldToLocalizedString(definition.inputTipAllLocales),
|
|
6740
6666
|
label: l10n.transformLocalizedFieldToLocalizedString(definition.labelAllLocales),
|
|
6741
|
-
type: _includesInstanceProperty__default["default"](_context = ['enum', 'lenum']).call(_context,
|
|
6667
|
+
type: _includesInstanceProperty__default["default"](_context = ['enum', 'lenum']).call(_context, definition.type?.elementType?.name) ? _objectSpread$R(_objectSpread$R({}, definition.type), {}, {
|
|
6742
6668
|
elementType: _objectSpread$R(_objectSpread$R({}, definition.type.elementType), {}, {
|
|
6743
6669
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](definition.type.elementType).results).call(_context2, value => ({
|
|
6744
6670
|
key: value.key,
|
|
6745
6671
|
label: value.label || l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
6746
6672
|
}))
|
|
6747
6673
|
})
|
|
6748
|
-
}) : _includesInstanceProperty__default["default"](_context3 = ['enum', 'lenum']).call(_context3,
|
|
6674
|
+
}) : _includesInstanceProperty__default["default"](_context3 = ['enum', 'lenum']).call(_context3, definition.type?.name) ? _objectSpread$R(_objectSpread$R({}, definition.type), {}, {
|
|
6749
6675
|
values: _mapInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](definition.type).results).call(_context4, value => ({
|
|
6750
6676
|
key: value.key,
|
|
6751
6677
|
label: value.label || l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -7083,8 +7009,7 @@ const CustomNestedInput = /*#__PURE__*/React.memo(props => {
|
|
|
7083
7009
|
CustomNestedInput.displayName = 'CustomNestedInput';
|
|
7084
7010
|
|
|
7085
7011
|
function CustomNumberInput(props) {
|
|
7086
|
-
|
|
7087
|
-
const value = (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : '';
|
|
7012
|
+
const value = props.value ?? '';
|
|
7088
7013
|
const handleChange = makeChangeHandler(rawValue => {
|
|
7089
7014
|
props.setFieldValue(props.name, !rawValue ? undefined : Number(rawValue));
|
|
7090
7015
|
props.renderWarnings && props.handleWarningChange(props.name, props.fieldDefinition, rawValue);
|
|
@@ -7158,8 +7083,7 @@ function CustomCategoryReferenceInput(props) {
|
|
|
7158
7083
|
CustomCategoryReferenceInput.displayName = 'CustomCategoryReferenceInput';
|
|
7159
7084
|
|
|
7160
7085
|
function CustomChannelReferenceInput(props) {
|
|
7161
|
-
|
|
7162
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
7086
|
+
const value = props.value?.id || '';
|
|
7163
7087
|
return jsxRuntime.jsx(ChannelPickerInput, {
|
|
7164
7088
|
value: value,
|
|
7165
7089
|
name: props.name,
|
|
@@ -7195,7 +7119,6 @@ const DropdownIndicator = () => jsxRuntime.jsx(uiKit.SearchIcon, {
|
|
|
7195
7119
|
});
|
|
7196
7120
|
DropdownIndicator.displayName = 'DropdownIndicator';
|
|
7197
7121
|
const ProductPickerInput = _ref => {
|
|
7198
|
-
var _currentOption$data$l, _currentOption$data;
|
|
7199
7122
|
let isClearable = _ref.isClearable,
|
|
7200
7123
|
isDisabled = _ref.isDisabled,
|
|
7201
7124
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -7216,20 +7139,19 @@ const ProductPickerInput = _ref => {
|
|
|
7216
7139
|
loadingError = _useState2[0],
|
|
7217
7140
|
setLoadingError = _useState2[1];
|
|
7218
7141
|
const convertProductToOption = React.useCallback(product => {
|
|
7219
|
-
var _masterData$current;
|
|
7220
7142
|
if (!product) return null;
|
|
7221
7143
|
const id = product.id,
|
|
7222
7144
|
key = product.key,
|
|
7223
7145
|
masterData = product.masterData;
|
|
7224
|
-
const localizedName = formatLocalizedFieldToString(
|
|
7146
|
+
const localizedName = formatLocalizedFieldToString(masterData.current?.nameAllLocales);
|
|
7225
7147
|
return {
|
|
7226
|
-
label: localizedName + (key ?
|
|
7148
|
+
label: localizedName + (key ? ` (key: ${key})` : ''),
|
|
7227
7149
|
value: id,
|
|
7228
7150
|
name: localizedName,
|
|
7229
7151
|
key
|
|
7230
7152
|
};
|
|
7231
7153
|
}, [formatLocalizedFieldToString]);
|
|
7232
|
-
const prefixSearchFields = React.useMemo(() => [
|
|
7154
|
+
const prefixSearchFields = React.useMemo(() => [`masterData.current.name.${dataLocale}`, 'key'], [dataLocale]);
|
|
7233
7155
|
const loadOptions = useLoadOptions({
|
|
7234
7156
|
query: GetProductsQuery,
|
|
7235
7157
|
prefixSearchFields
|
|
@@ -7260,12 +7182,12 @@ const ProductPickerInput = _ref => {
|
|
|
7260
7182
|
setLoadingError(null);
|
|
7261
7183
|
handleInternalInputChange(event);
|
|
7262
7184
|
}, [handleInternalInputChange]);
|
|
7263
|
-
const isCurrentOptionLoadingFailed = Boolean(currentOption
|
|
7185
|
+
const isCurrentOptionLoadingFailed = Boolean(currentOption?.error);
|
|
7264
7186
|
React.useEffect(() => {
|
|
7265
7187
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
7266
7188
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
7267
7189
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
7268
|
-
const tooltipTitle =
|
|
7190
|
+
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
7269
7191
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
7270
7192
|
max: "scale",
|
|
7271
7193
|
children: currentOption.loading ? jsxRuntime.jsx(CenteredLoadingSpinner, {}) : jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
@@ -7305,8 +7227,7 @@ const ProductPickerInput = _ref => {
|
|
|
7305
7227
|
ProductPickerInput.displayName = 'ProductPickerInput';
|
|
7306
7228
|
|
|
7307
7229
|
function CustomProductReferenceInput(props) {
|
|
7308
|
-
|
|
7309
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
7230
|
+
const value = props.value?.id || '';
|
|
7310
7231
|
return jsxRuntime.jsx(ProductPickerInput, {
|
|
7311
7232
|
value: value,
|
|
7312
7233
|
name: props.name,
|
|
@@ -7324,8 +7245,7 @@ function CustomProductReferenceInput(props) {
|
|
|
7324
7245
|
CustomProductReferenceInput.displayName = 'CustomProductReferenceInput';
|
|
7325
7246
|
|
|
7326
7247
|
function CustomProductTypeReferenceInput(props) {
|
|
7327
|
-
|
|
7328
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
7248
|
+
const value = props.value?.id || '';
|
|
7329
7249
|
return jsxRuntime.jsx(ProductTypePickerInput, {
|
|
7330
7250
|
value: value,
|
|
7331
7251
|
name: props.name,
|
|
@@ -7342,8 +7262,7 @@ function CustomProductTypeReferenceInput(props) {
|
|
|
7342
7262
|
CustomProductTypeReferenceInput.displayName = 'CustomProductTypeReferenceInput';
|
|
7343
7263
|
|
|
7344
7264
|
function CustomRawIdReferenceInput(props) {
|
|
7345
|
-
|
|
7346
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
7265
|
+
const value = props.value?.id || '';
|
|
7347
7266
|
return jsxRuntime.jsx(CustomFieldTooltip, {
|
|
7348
7267
|
title: value,
|
|
7349
7268
|
children: jsxRuntime.jsx(uiKit.TextInput, {
|
|
@@ -7361,8 +7280,7 @@ function CustomRawIdReferenceInput(props) {
|
|
|
7361
7280
|
CustomRawIdReferenceInput.displayName = 'CustomRawIdReferenceInput';
|
|
7362
7281
|
|
|
7363
7282
|
function CustomStateReferenceInput(props) {
|
|
7364
|
-
|
|
7365
|
-
const value = ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id) || '';
|
|
7283
|
+
const value = props.value?.id || '';
|
|
7366
7284
|
return jsxRuntime.jsx(StatePickerInput, {
|
|
7367
7285
|
value: value,
|
|
7368
7286
|
name: props.name,
|
|
@@ -7498,14 +7416,12 @@ const nonSetComponents = {
|
|
|
7498
7416
|
};
|
|
7499
7417
|
const CustomFieldInput = /*#__PURE__*/React.memo(props => {
|
|
7500
7418
|
const InputComponent = React.useMemo(() => {
|
|
7501
|
-
|
|
7502
|
-
const typeName = (_props$fieldDefinitio = props.fieldDefinition.type) === null || _props$fieldDefinitio === void 0 ? void 0 : _props$fieldDefinitio.name.toLowerCase();
|
|
7419
|
+
const typeName = props.fieldDefinition.type?.name.toLowerCase();
|
|
7503
7420
|
if (typeName === 'set') {
|
|
7504
|
-
var _getSetElementType;
|
|
7505
7421
|
// Boolean is the only set element with peculiarities (i.e. way more
|
|
7506
7422
|
// convenient for user to work with it as with select input with three values:
|
|
7507
7423
|
// [true], [false] and [true, false]).
|
|
7508
|
-
if (
|
|
7424
|
+
if (getType(props.fieldDefinition)?.name.toLowerCase() === CUSTOM_FIELD_TYPES.boolean) {
|
|
7509
7425
|
return CustomBooleanInputSet;
|
|
7510
7426
|
}
|
|
7511
7427
|
// All the rest sets are just a fancy wrapper around single-item components
|
|
@@ -7573,10 +7489,9 @@ function _objectSpread$P(e) { for (var r = 1; r < arguments.length; r++) { var _
|
|
|
7573
7489
|
function _EMOTION_STRINGIFIED_CSS_ERROR__$1() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
7574
7490
|
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 } } } };
|
|
7575
7491
|
const CustomFieldsLabelHint = _ref2 => {
|
|
7576
|
-
var _type$name;
|
|
7577
7492
|
let fieldDefinition = _ref2.fieldDefinition;
|
|
7578
7493
|
const type = getType(fieldDefinition);
|
|
7579
|
-
const isReference =
|
|
7494
|
+
const isReference = type.name?.toLowerCase() === 'reference';
|
|
7580
7495
|
const referenceTypeId = type.referenceTypeId;
|
|
7581
7496
|
const isCartDiscountsReference = isReference && referenceTypeId === SEARCHABLE_REFERENCES.cartDiscount;
|
|
7582
7497
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
@@ -7594,7 +7509,7 @@ const CustomFieldsLabelHint = _ref2 => {
|
|
|
7594
7509
|
data = _useQuery.data,
|
|
7595
7510
|
loading = _useQuery.loading;
|
|
7596
7511
|
if (loading) return null;
|
|
7597
|
-
if (
|
|
7512
|
+
if (data?.cartDiscounts.total > QUERY_MAX_LIMIT) {
|
|
7598
7513
|
return jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
7599
7514
|
alignItems: "center",
|
|
7600
7515
|
children: [jsxRuntime.jsx(uiKit.WarningIcon, {
|
|
@@ -7621,17 +7536,17 @@ function CustomFieldsProductTypeReferenceSubtitle() {
|
|
|
7621
7536
|
// TODO(pa3): this logic may be misplaced and probably
|
|
7622
7537
|
// should belong to <CustomReferenceInput /> component instead.
|
|
7623
7538
|
function CustomFieldsLabelSubtitle(_ref3) {
|
|
7624
|
-
var
|
|
7539
|
+
var _context;
|
|
7625
7540
|
let fieldDefinition = _ref3.fieldDefinition;
|
|
7626
7541
|
const _useIntl2 = reactIntl.useIntl(),
|
|
7627
7542
|
formatMessage = _useIntl2.formatMessage;
|
|
7628
7543
|
const type = getType(fieldDefinition);
|
|
7629
|
-
const isReference =
|
|
7544
|
+
const isReference = type.name?.toLowerCase() === 'reference';
|
|
7630
7545
|
if (!isReference) return null;
|
|
7631
7546
|
const referenceTypeId = type.referenceTypeId;
|
|
7632
7547
|
const referenceTypeName = capitalizeFirst(referenceTypeId);
|
|
7633
7548
|
if (_includesInstanceProperty__default["default"](_context = [SEARCHABLE_REFERENCES.category, SEARCHABLE_REFERENCES.cartDiscount]).call(_context, referenceTypeId)) return referenceTypeName;
|
|
7634
|
-
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) :
|
|
7549
|
+
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`;
|
|
7635
7550
|
}
|
|
7636
7551
|
const Portal = props => /*#__PURE__*/ReactDOM__default["default"].createPortal(props.children, document.body);
|
|
7637
7552
|
var _ref$1 = process.env.NODE_ENV === "production" ? {
|
|
@@ -7648,7 +7563,7 @@ function CustomFieldsCountIndicator(_ref4) {
|
|
|
7648
7563
|
const formatLocalizedField = useFormatLocalizedFieldToString();
|
|
7649
7564
|
const _useIntl3 = reactIntl.useIntl(),
|
|
7650
7565
|
formatMessage = _useIntl3.formatMessage;
|
|
7651
|
-
return
|
|
7566
|
+
return assignedAttributeGroups?.length > 1 ? jsxRuntime.jsx(uiKit.Tooltip, {
|
|
7652
7567
|
title: formatMessage(messages$t.attributeGroupCountTooltip, {
|
|
7653
7568
|
attributeGroups: _mapInstanceProperty__default["default"](assignedAttributeGroups).call(assignedAttributeGroups, assignedAttributeGroup => formatLocalizedField(assignedAttributeGroup.nameAllLocales)).join(', '),
|
|
7654
7569
|
count: assignedAttributeGroups.length
|
|
@@ -7913,11 +7828,10 @@ const useDnDContext = () => {
|
|
|
7913
7828
|
|
|
7914
7829
|
const _excluded$1 = ["WrapperComponent"];
|
|
7915
7830
|
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; }
|
|
7916
|
-
function _objectSpread$J(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
7831
|
+
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; }
|
|
7917
7832
|
const getFieldName = (parentName, fieldName) => {
|
|
7918
|
-
var _context;
|
|
7919
7833
|
if (!parentName) return fieldName;
|
|
7920
|
-
return
|
|
7834
|
+
return `${parentName}.${fieldName}`;
|
|
7921
7835
|
};
|
|
7922
7836
|
const isNested = fieldDefinition => {
|
|
7923
7837
|
const type = fieldDefinition.type;
|
|
@@ -7948,7 +7862,6 @@ const CustomFieldsInternal = _ref => {
|
|
|
7948
7862
|
return jsxRuntime.jsx(DroppableWrapper, {
|
|
7949
7863
|
onDragEnd: onDragEnd,
|
|
7950
7864
|
children: _mapInstanceProperty__default["default"](fieldDefinitions).call(fieldDefinitions, (fieldDefinition, index) => {
|
|
7951
|
-
var _context2, _context3;
|
|
7952
7865
|
const fieldName = getFieldName(props.name, fieldDefinition.name);
|
|
7953
7866
|
const isTouched = Boolean(formik.getIn(touched, fieldName));
|
|
7954
7867
|
const fieldErrors = formik.getIn(errors, fieldName);
|
|
@@ -7973,7 +7886,7 @@ const CustomFieldsInternal = _ref => {
|
|
|
7973
7886
|
onBlur: handleBlur,
|
|
7974
7887
|
setFieldValue: props.setFieldValue,
|
|
7975
7888
|
hasError: hasError,
|
|
7976
|
-
hasWarning: props.renderWarnings &&
|
|
7889
|
+
hasWarning: props.renderWarnings && status?.warnings[fieldName],
|
|
7977
7890
|
handleWarningChange: props.handleWarningChange,
|
|
7978
7891
|
renderWarnings: props.renderWarnings
|
|
7979
7892
|
};
|
|
@@ -7981,36 +7894,33 @@ const CustomFieldsInternal = _ref => {
|
|
|
7981
7894
|
return jsxRuntime.jsx(formik.FastField, {
|
|
7982
7895
|
name: fieldName,
|
|
7983
7896
|
validate: validate,
|
|
7984
|
-
children: () => {
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
children: jsxRuntime.
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
isTouched: isTouched,
|
|
8006
|
-
errors: fieldErrors
|
|
8007
|
-
})]
|
|
7897
|
+
children: () => jsxRuntime.jsx(DraggableWrapper, {
|
|
7898
|
+
draggableKey: `${fieldName}-${index}`,
|
|
7899
|
+
draggableId: `${fieldName}-${index}`,
|
|
7900
|
+
index: index,
|
|
7901
|
+
children: jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
7902
|
+
scale: "xs",
|
|
7903
|
+
children: jsxRuntime.jsxs("div", {
|
|
7904
|
+
"aria-invalid": _Object$keys__default["default"](fieldErrors ?? {}).length > 0,
|
|
7905
|
+
"aria-errormessage": `${fieldName}-error`,
|
|
7906
|
+
id: `${fieldName}-error`,
|
|
7907
|
+
children: [jsxRuntime.jsx(CustomFieldsLabel, {
|
|
7908
|
+
name: fieldName,
|
|
7909
|
+
fieldDefinition: fieldDefinition
|
|
7910
|
+
}), jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
7911
|
+
scale: "xs",
|
|
7912
|
+
alignItems: "stretch",
|
|
7913
|
+
children: [WrapperComponent ? jsxRuntime.jsx(WrapperComponent, {
|
|
7914
|
+
children: Field
|
|
7915
|
+
}) : Field, props.renderWarnings && status?.warnings[fieldName] && props.renderCustomWarnings(fieldDefinition), jsxRuntime.jsx(CustomFieldErrors, {
|
|
7916
|
+
isTouched: isTouched,
|
|
7917
|
+
errors: fieldErrors
|
|
8008
7918
|
})]
|
|
8009
|
-
})
|
|
7919
|
+
})]
|
|
8010
7920
|
})
|
|
8011
|
-
})
|
|
8012
|
-
}
|
|
8013
|
-
},
|
|
7921
|
+
})
|
|
7922
|
+
})
|
|
7923
|
+
}, `${fieldName}-${index}-${fieldKey}`);
|
|
8014
7924
|
})
|
|
8015
7925
|
});
|
|
8016
7926
|
};
|
|
@@ -8023,9 +7933,9 @@ function ownKeys$I(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
8023
7933
|
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; }
|
|
8024
7934
|
const getTypeName = type => type.name.toLowerCase();
|
|
8025
7935
|
const findLabel = (enumType, key) => {
|
|
8026
|
-
var
|
|
7936
|
+
var _context;
|
|
8027
7937
|
const emptyValue = getTypeName(enumType) === 'enum' ? '' : {};
|
|
8028
|
-
return
|
|
7938
|
+
return _findInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](enumType)).call(_context, value => value.key === key)?.label ?? emptyValue;
|
|
8029
7939
|
};
|
|
8030
7940
|
const convertEnumValues = (value, attributeDefinition) => {
|
|
8031
7941
|
var _context2, _context3;
|
|
@@ -8091,7 +8001,7 @@ const attributesMapToNameValuePairs = map => {
|
|
|
8091
8001
|
const _excluded = ["WrapperComponent"];
|
|
8092
8002
|
const getAttributeShortName = (fullName, attributesPrefix) => {
|
|
8093
8003
|
if (!attributesPrefix) return fullName;
|
|
8094
|
-
return fullName.replace(
|
|
8004
|
+
return fullName.replace(`${attributesPrefix}.`, '');
|
|
8095
8005
|
};
|
|
8096
8006
|
function ProductAttributes(_ref) {
|
|
8097
8007
|
let WrapperComponent = _ref.WrapperComponent,
|
|
@@ -8189,7 +8099,7 @@ var pickerMessages = reactIntl.defineMessages({
|
|
|
8189
8099
|
});
|
|
8190
8100
|
|
|
8191
8101
|
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; }
|
|
8192
|
-
function _objectSpread$H(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
8102
|
+
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; }
|
|
8193
8103
|
const PRODUCT_SELECTION_MODES = {
|
|
8194
8104
|
INCLUSION: 'Individual',
|
|
8195
8105
|
EXCLUSION: 'IndividualExclusion'
|
|
@@ -8200,11 +8110,10 @@ const PRODUCT_SELECTION_MODES_LABELS = {
|
|
|
8200
8110
|
};
|
|
8201
8111
|
const getMode = mode => mode === PRODUCT_SELECTION_MODES.INCLUSION || mode === PRODUCT_SELECTION_MODES_LABELS.INCLUSION ? 'inclusion' : 'exclusion';
|
|
8202
8112
|
const addModeToLabel = function (ps) {
|
|
8203
|
-
var _context;
|
|
8204
8113
|
let enableExcludingProducts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
8205
8114
|
if (!ps) return undefined;
|
|
8206
8115
|
return _objectSpread$H(_objectSpread$H({}, ps), {}, {
|
|
8207
|
-
label:
|
|
8116
|
+
label: `${ps?.label}${enableExcludingProducts ? ` (type: ${getMode(ps?.mode)})` : ''}`
|
|
8208
8117
|
});
|
|
8209
8118
|
};
|
|
8210
8119
|
|
|
@@ -8221,7 +8130,7 @@ const getValueFromOptions$3 = _ref => {
|
|
|
8221
8130
|
// handle async-select-field value transformation
|
|
8222
8131
|
if (isMulti) {
|
|
8223
8132
|
var _context;
|
|
8224
|
-
return _mapInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](allProductSelectionOptions).call(allProductSelectionOptions, ps => currentlySelectedProductSelections
|
|
8133
|
+
return _mapInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](allProductSelectionOptions).call(allProductSelectionOptions, ps => currentlySelectedProductSelections?.includes(ps.value))).call(_context, ps => addModeToLabel(ps, enableExcludingProducts));
|
|
8225
8134
|
}
|
|
8226
8135
|
|
|
8227
8136
|
// in case it is not multiselect, then a single valued async-select-input is being requested and the value should have proper format
|
|
@@ -8233,7 +8142,6 @@ const emptyStoreOption$1 = intl => [{
|
|
|
8233
8142
|
isDisabled: true
|
|
8234
8143
|
}];
|
|
8235
8144
|
function ProductSelectionsAsyncSelectDropdown(props) {
|
|
8236
|
-
var _productSelectionsFet3;
|
|
8237
8145
|
const intl = reactIntl.useIntl();
|
|
8238
8146
|
const enableExcludingProducts = applicationShell.useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
8239
8147
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -8246,17 +8154,13 @@ function ProductSelectionsAsyncSelectDropdown(props) {
|
|
|
8246
8154
|
})),
|
|
8247
8155
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
8248
8156
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8249
|
-
const productSelections = React.useMemo(() =>
|
|
8250
|
-
var _productSelectionsFet, _productSelectionsFet2;
|
|
8251
|
-
return (_productSelectionsFet = (_productSelectionsFet2 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet2 === void 0 ? void 0 : _productSelectionsFet2.results) !== null && _productSelectionsFet !== void 0 ? _productSelectionsFet : [];
|
|
8252
|
-
}, [(_productSelectionsFet3 = productSelectionsFetcher.productSelections) === null || _productSelectionsFet3 === void 0 ? void 0 : _productSelectionsFet3.results]);
|
|
8157
|
+
const productSelections = React.useMemo(() => productSelectionsFetcher.productSelections?.results ?? [], [productSelectionsFetcher.productSelections?.results]);
|
|
8253
8158
|
const filteredProductSelections = _filterInstanceProperty__default["default"](productSelections).call(productSelections, ps => {
|
|
8254
8159
|
var _context2;
|
|
8255
8160
|
return !_includesInstanceProperty__default["default"](_context2 = props.excludedProductSelectionIds).call(_context2, ps.id);
|
|
8256
8161
|
});
|
|
8257
8162
|
const onOptionClick = event => {
|
|
8258
|
-
|
|
8259
|
-
const productSelectionId = (_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.value;
|
|
8163
|
+
const productSelectionId = event.target.value?.value;
|
|
8260
8164
|
const currentProductSelection = _findInstanceProperty__default["default"](productSelections).call(productSelections, productSelection => productSelection.id === productSelectionId);
|
|
8261
8165
|
props.onChange(currentProductSelection);
|
|
8262
8166
|
};
|
|
@@ -8339,7 +8243,6 @@ const mapProductSelectionsToOptions$1 = memoize__default["default"](function ()
|
|
|
8339
8243
|
let enableExcludingProducts = arguments.length > 4 ? arguments[4] : undefined;
|
|
8340
8244
|
const selectedPSList = _Array$isArray__default["default"](selectedPS) ? selectedPS : [selectedPS];
|
|
8341
8245
|
return _mapInstanceProperty__default["default"](productSelections).call(productSelections, productSelection => {
|
|
8342
|
-
var _context;
|
|
8343
8246
|
const label = l10n.formatLocalizedString(productSelection, {
|
|
8344
8247
|
key: 'name',
|
|
8345
8248
|
locale: dataLocale,
|
|
@@ -8348,14 +8251,13 @@ const mapProductSelectionsToOptions$1 = memoize__default["default"](function ()
|
|
|
8348
8251
|
return {
|
|
8349
8252
|
id: productSelection.id,
|
|
8350
8253
|
value: productSelection.id,
|
|
8351
|
-
label:
|
|
8254
|
+
label: `${label}${_includesInstanceProperty__default["default"](selectedPSList).call(selectedPSList, productSelection.id) && enableExcludingProducts ? ` (type: ${getMode(productSelection.mode)})` : ''}`,
|
|
8352
8255
|
key: productSelection.key,
|
|
8353
8256
|
mode: getMode(productSelection.mode)
|
|
8354
8257
|
};
|
|
8355
8258
|
});
|
|
8356
8259
|
});
|
|
8357
8260
|
function ProductSelectionBasicSelectDropdown(props) {
|
|
8358
|
-
var _productSelectionsFet, _productSelectionsFet2;
|
|
8359
8261
|
const intl = reactIntl.useIntl();
|
|
8360
8262
|
const enableExcludingProducts = applicationShell.useFeatureToggle(EXCLUDING_PRODUCTS);
|
|
8361
8263
|
const productSelectionsFetcher = useProductSelectionsFetcher({
|
|
@@ -8368,10 +8270,10 @@ function ProductSelectionBasicSelectDropdown(props) {
|
|
|
8368
8270
|
projectLanguages = _useApplicationContex.projectLanguages,
|
|
8369
8271
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8370
8272
|
if (productSelectionsFetcher.isLoading) return jsxRuntime.jsx(CenteredLoadingSpinner, {});
|
|
8371
|
-
const productSelections =
|
|
8273
|
+
const productSelections = productSelectionsFetcher.productSelections?.results ?? [];
|
|
8372
8274
|
const filteredProductSelections = _filterInstanceProperty__default["default"](productSelections).call(productSelections, ps => {
|
|
8373
|
-
var
|
|
8374
|
-
return !_includesInstanceProperty__default["default"](
|
|
8275
|
+
var _context;
|
|
8276
|
+
return !_includesInstanceProperty__default["default"](_context = props.excludedProductSelectionIds).call(_context, ps.id);
|
|
8375
8277
|
});
|
|
8376
8278
|
const onOptionClick = event => {
|
|
8377
8279
|
const productSelectionId = event.target.value;
|
|
@@ -8408,15 +8310,11 @@ function ProductSelectionBasicSelectDropdown(props) {
|
|
|
8408
8310
|
}
|
|
8409
8311
|
|
|
8410
8312
|
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 } } } };
|
|
8411
|
-
const createQueryVariables$4 = (productSelections, predicateField) => {
|
|
8412
|
-
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
limit: 500
|
|
8416
|
-
};
|
|
8417
|
-
};
|
|
8313
|
+
const createQueryVariables$4 = (productSelections, predicateField) => ({
|
|
8314
|
+
where: `${predicateField} in (${_mapInstanceProperty__default["default"](productSelections).call(productSelections, ps => `"${ps}"`).join(', ')})`,
|
|
8315
|
+
limit: 500
|
|
8316
|
+
});
|
|
8418
8317
|
const useProductSelectionsByFieldFetcher = (productSelections, predicateField) => {
|
|
8419
|
-
var _productSelectionsQue, _productSelectionsQue2;
|
|
8420
8318
|
const productSelectionList = _Array$isArray__default["default"](productSelections) ? productSelections : [productSelections];
|
|
8421
8319
|
const productSelectionsQuery = react.useQuery(ProductSelectionsPickerFetcher$1, {
|
|
8422
8320
|
context: {
|
|
@@ -8426,7 +8324,7 @@ const useProductSelectionsByFieldFetcher = (productSelections, predicateField) =
|
|
|
8426
8324
|
skip: productSelectionList.length === 0
|
|
8427
8325
|
});
|
|
8428
8326
|
return {
|
|
8429
|
-
productSelections:
|
|
8327
|
+
productSelections: productSelectionsQuery.data?.productSelections.results ?? [],
|
|
8430
8328
|
isLoading: productSelectionsQuery.loading
|
|
8431
8329
|
};
|
|
8432
8330
|
};
|
|
@@ -8467,8 +8365,8 @@ const createQueryVariables$3 = _ref3 => {
|
|
|
8467
8365
|
var _context;
|
|
8468
8366
|
let searchText = _ref3.searchText;
|
|
8469
8367
|
const sanitizedSearchText = sanitize(_trimInstanceProperty__default["default"](searchText).call(searchText, searchText));
|
|
8470
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
8471
|
-
const keyQuery =
|
|
8368
|
+
const idQuery = isUUID(sanitizedSearchText) && `id = "${sanitizedSearchText}"`;
|
|
8369
|
+
const keyQuery = `key = "${sanitizedSearchText}"`;
|
|
8472
8370
|
const searchTextQuery = _filterInstanceProperty__default["default"](_context = [idQuery, keyQuery]).call(_context, Boolean).join(' or ');
|
|
8473
8371
|
return {
|
|
8474
8372
|
where: searchTextQuery || undefined
|
|
@@ -8491,7 +8389,6 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8491
8389
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8492
8390
|
const productSelectionsByFieldFetcher = useProductSelectionsByFieldFetcher(props.value, props.renderSelectInputOptionValuesByField);
|
|
8493
8391
|
const handleLoadOptions = async searchText => {
|
|
8494
|
-
var _data$productSelectio, _data$productSelectio2;
|
|
8495
8392
|
const _await$client$query = await client$1.query({
|
|
8496
8393
|
query: ProductSelectionsPickerFetcher,
|
|
8497
8394
|
variables: createQueryVariables$3({
|
|
@@ -8503,7 +8400,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8503
8400
|
fetchPolicy: 'network-only'
|
|
8504
8401
|
}),
|
|
8505
8402
|
data = _await$client$query.data;
|
|
8506
|
-
const matchedProductSelections =
|
|
8403
|
+
const matchedProductSelections = data?.productSelections?.results ?? [];
|
|
8507
8404
|
const updatedProductSelections = _mapInstanceProperty__default["default"](matchedProductSelections).call(matchedProductSelections, convertProductSelectionFromGraphQl);
|
|
8508
8405
|
const filteredProductSelections = _filterInstanceProperty__default["default"](updatedProductSelections).call(updatedProductSelections, ps => {
|
|
8509
8406
|
var _context2;
|
|
@@ -8519,8 +8416,7 @@ function ProductSelectionsSearchSelectDropdown(props) {
|
|
|
8519
8416
|
};
|
|
8520
8417
|
const loadOptionsDebounced = debounce__default["default"](handleLoadOptions, 500);
|
|
8521
8418
|
const onOptionClick = event => {
|
|
8522
|
-
|
|
8523
|
-
const productSelectionId = (_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.value;
|
|
8419
|
+
const productSelectionId = event.target.value?.value;
|
|
8524
8420
|
const currentProductSelection = _findInstanceProperty__default["default"](productionSelectionResults).call(productionSelectionResults, productSelection => productSelection.id === productSelectionId);
|
|
8525
8421
|
props.onChange(currentProductSelection);
|
|
8526
8422
|
};
|
|
@@ -8572,11 +8468,11 @@ function ModeSelectInputOption(props) {
|
|
|
8572
8468
|
scale: "xs",
|
|
8573
8469
|
children: [jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
8574
8470
|
isBold: true,
|
|
8575
|
-
children:
|
|
8471
|
+
children: data?.label || noValueFallback
|
|
8576
8472
|
}), jsxRuntime.jsxs(uiKit.Text.Detail, {
|
|
8577
|
-
children: ["Key: ",
|
|
8473
|
+
children: ["Key: ", data?.key || noValueFallback]
|
|
8578
8474
|
}), jsxRuntime.jsxs(uiKit.Text.Detail, {
|
|
8579
|
-
children: ["Type: ",
|
|
8475
|
+
children: ["Type: ", data?.mode || noValueFallback]
|
|
8580
8476
|
})]
|
|
8581
8477
|
})
|
|
8582
8478
|
}));
|
|
@@ -8658,19 +8554,19 @@ const ScrollToFieldError = () => {
|
|
|
8658
8554
|
if (isValid) return;
|
|
8659
8555
|
const firstErrorElement = document.querySelector('[aria-invalid="true"]');
|
|
8660
8556
|
if (firstErrorElement) {
|
|
8661
|
-
var _ref, _ref2, _document$querySelect, _elementToScrollTo$sc;
|
|
8662
8557
|
// Get a reference to the label.
|
|
8663
8558
|
const firstElementId = firstErrorElement.getAttribute('id');
|
|
8664
|
-
const localizedInputIndex = _indexOfInstanceProperty__default["default"](firstElementId).call(firstElementId,
|
|
8559
|
+
const localizedInputIndex = _indexOfInstanceProperty__default["default"](firstElementId).call(firstElementId, `.${dataLocale}`);
|
|
8665
8560
|
|
|
8666
8561
|
// check if locale is appended then remove it from id
|
|
8667
|
-
const id = localizedInputIndex > -1 ? firstElementId.replace(
|
|
8562
|
+
const id = localizedInputIndex > -1 ? firstElementId.replace(`.${dataLocale}`, '') : firstElementId;
|
|
8668
8563
|
|
|
8669
8564
|
// Scroll to the label (if found), otherwise to the input element itself.
|
|
8670
8565
|
|
|
8671
|
-
const elementToScrollTo =
|
|
8672
|
-
|
|
8673
|
-
(
|
|
8566
|
+
const elementToScrollTo =
|
|
8567
|
+
// div is used only for custom fields
|
|
8568
|
+
document.querySelector(`div[aria-errormessage="${firstElementId}"]`) ?? document.querySelector(`label[for="${id}"]`) ?? document.querySelector(`label#${id}`) ?? firstErrorElement;
|
|
8569
|
+
elementToScrollTo.scrollIntoView?.({
|
|
8674
8570
|
behavior: 'smooth'
|
|
8675
8571
|
});
|
|
8676
8572
|
}
|
|
@@ -8696,8 +8592,7 @@ var styles$9 = {
|
|
|
8696
8592
|
"search-mode-menu": "selectable-field-search-input-module__search-mode-menu___Od6Le"
|
|
8697
8593
|
};
|
|
8698
8594
|
const SelectableFieldSearchInput = props => {
|
|
8699
|
-
|
|
8700
|
-
const _useState = React.useState((_props$initialValue = props.initialValue) !== null && _props$initialValue !== void 0 ? _props$initialValue : ''),
|
|
8595
|
+
const _useState = React.useState(props.initialValue ?? ''),
|
|
8701
8596
|
_useState2 = _slicedToArray(_useState, 2),
|
|
8702
8597
|
searchText = _useState2[0],
|
|
8703
8598
|
setSearchText = _useState2[1];
|
|
@@ -8733,7 +8628,7 @@ const SelectableFieldSearchInput = props => {
|
|
|
8733
8628
|
});
|
|
8734
8629
|
},
|
|
8735
8630
|
onReset: props.onReset,
|
|
8736
|
-
placeholder:
|
|
8631
|
+
placeholder: props.placeholder ?? intl.formatMessage(messages$r.placeholder),
|
|
8737
8632
|
isDisabled: props.disabled
|
|
8738
8633
|
})
|
|
8739
8634
|
});
|
|
@@ -8783,7 +8678,6 @@ const UPPER_STORES_LIMIT = 500;
|
|
|
8783
8678
|
|
|
8784
8679
|
// map store to options
|
|
8785
8680
|
const mapStoresToOptions = _ref => {
|
|
8786
|
-
var _store$productSelecti;
|
|
8787
8681
|
let store = _ref.store,
|
|
8788
8682
|
renderSelectInputOptionValuesByField = _ref.renderSelectInputOptionValuesByField,
|
|
8789
8683
|
dataLocale = _ref.dataLocale;
|
|
@@ -8794,14 +8688,14 @@ const mapStoresToOptions = _ref => {
|
|
|
8794
8688
|
const localizedName = l10n.formatLocalizedString(convertedStore, {
|
|
8795
8689
|
key: 'name',
|
|
8796
8690
|
locale: dataLocale,
|
|
8797
|
-
fallback:
|
|
8691
|
+
fallback: `${store.key} (key)`
|
|
8798
8692
|
});
|
|
8799
8693
|
return {
|
|
8800
8694
|
label: localizedName,
|
|
8801
8695
|
value: renderSelectInputOptionValuesByField === 'key' ? store.key : store.id,
|
|
8802
8696
|
key: store.key,
|
|
8803
8697
|
id: store.id,
|
|
8804
|
-
productSelections:
|
|
8698
|
+
productSelections: store.productSelections?.map(productSelectionRef => productSelectionRef.productSelection.id)
|
|
8805
8699
|
};
|
|
8806
8700
|
};
|
|
8807
8701
|
|
|
@@ -8830,7 +8724,7 @@ const getValueFromOptions$1 = _ref => {
|
|
|
8830
8724
|
isMulti = _ref.isMulti;
|
|
8831
8725
|
// handle async-select-field value transformation
|
|
8832
8726
|
if (isMulti) {
|
|
8833
|
-
return _filterInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores
|
|
8727
|
+
return _filterInstanceProperty__default["default"](mappedStoresListOptions).call(mappedStoresListOptions, store => currentlySelectedStores?.includes(store.value));
|
|
8834
8728
|
}
|
|
8835
8729
|
|
|
8836
8730
|
// return value as undefined if no options is yet selected. It is needed for cases where users sets initial values as empty string
|
|
@@ -8849,7 +8743,7 @@ const emptyStoreOption = intl => [{
|
|
|
8849
8743
|
const StoresAsyncSelectInput = props => {
|
|
8850
8744
|
const intl = reactIntl.useIntl();
|
|
8851
8745
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
8852
|
-
dataLocale: applicationContext.dataLocale
|
|
8746
|
+
dataLocale: applicationContext.dataLocale || applicationContext.user?.locale
|
|
8853
8747
|
})),
|
|
8854
8748
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8855
8749
|
const keysOfStores = props.allAccessibleStoreKeysThroughDataFencePermissions;
|
|
@@ -8859,13 +8753,13 @@ const StoresAsyncSelectInput = props => {
|
|
|
8859
8753
|
sort: 'createdAt asc',
|
|
8860
8754
|
excludeExtendedStoresList: true,
|
|
8861
8755
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8862
|
-
stores:
|
|
8756
|
+
stores: keysOfStores?.length && keysOfStores,
|
|
8863
8757
|
projectKey: props.projectKey
|
|
8864
8758
|
});
|
|
8865
8759
|
const hasError = uiKit.AsyncSelectInput.isTouched(props.touched) && hasErrors$2(props.errors) || props.hasError;
|
|
8866
8760
|
const mappedStoresListOptions = React.useMemo(() => {
|
|
8867
|
-
var _context2
|
|
8868
|
-
return _mapInstanceProperty__default["default"](_context2 =
|
|
8761
|
+
var _context2;
|
|
8762
|
+
return _mapInstanceProperty__default["default"](_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8869
8763
|
store,
|
|
8870
8764
|
dataLocale,
|
|
8871
8765
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -8951,7 +8845,7 @@ const hasErrors$1 = errors => {
|
|
|
8951
8845
|
const StoresBasicSelectInput = props => {
|
|
8952
8846
|
const intl = reactIntl.useIntl();
|
|
8953
8847
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
8954
|
-
dataLocale: applicationContext.dataLocale
|
|
8848
|
+
dataLocale: applicationContext.dataLocale || applicationContext.user?.locale
|
|
8955
8849
|
})),
|
|
8956
8850
|
dataLocale = _useApplicationContex.dataLocale;
|
|
8957
8851
|
const keysOfStores = props.allAccessibleStoreKeysThroughDataFencePermissions;
|
|
@@ -8961,30 +8855,30 @@ const StoresBasicSelectInput = props => {
|
|
|
8961
8855
|
sort: 'createdAt asc',
|
|
8962
8856
|
excludeExtendedStoresList: true,
|
|
8963
8857
|
excludeProductSelections: !props.shouldFetchProductSelections,
|
|
8964
|
-
stores:
|
|
8858
|
+
stores: keysOfStores?.length && keysOfStores,
|
|
8965
8859
|
projectKey: props.projectKey
|
|
8966
8860
|
});
|
|
8967
8861
|
const hasError = uiKit.SelectInput.isTouched(props.touched) && hasErrors$1(props.errors) || props.hasError;
|
|
8968
8862
|
const mappedStoresListOptions = React.useMemo(() => {
|
|
8969
|
-
var _context2
|
|
8970
|
-
const results = _mapInstanceProperty__default["default"](_context2 =
|
|
8863
|
+
var _context2;
|
|
8864
|
+
const results = _mapInstanceProperty__default["default"](_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8971
8865
|
store,
|
|
8972
8866
|
dataLocale,
|
|
8973
8867
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
8974
8868
|
}));
|
|
8975
|
-
return props
|
|
8869
|
+
return props?.renderLabel ? [{
|
|
8976
8870
|
options: getCustomGroupLabelOption(props.renderLabel)
|
|
8977
8871
|
}, {
|
|
8978
8872
|
options: results
|
|
8979
8873
|
}] : results;
|
|
8980
|
-
}, [dataLocale, storesListFetcher.stores, props.renderSelectInputOptionValuesByField, props
|
|
8874
|
+
}, [dataLocale, storesListFetcher.stores, props.renderSelectInputOptionValuesByField, props?.renderLabel]);
|
|
8981
8875
|
const handleChange = event => {
|
|
8982
|
-
|
|
8983
|
-
const
|
|
8984
|
-
const currentStore = _findInstanceProperty__default["default"](
|
|
8876
|
+
const value = event.target.value?.value ?? event.target.value;
|
|
8877
|
+
const listOptions = props?.renderLabel ? mappedStoresListOptions[1].options : mappedStoresListOptions;
|
|
8878
|
+
const currentStore = _findInstanceProperty__default["default"](listOptions).call(listOptions, store => store.value === value);
|
|
8985
8879
|
|
|
8986
8880
|
// We need complete store info including productSelections
|
|
8987
|
-
if (!props.shouldFetchProductSelections) {
|
|
8881
|
+
if (!props.shouldFetchProductSelections && !props?.renderLabel) {
|
|
8988
8882
|
props.onChange(event);
|
|
8989
8883
|
} else {
|
|
8990
8884
|
props.onChange({
|
|
@@ -9038,7 +8932,6 @@ StoresBasicSelectInput.defaultProps = {
|
|
|
9038
8932
|
|
|
9039
8933
|
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 } } } };
|
|
9040
8934
|
const useTotalNumberOfStoresFetcher = projectKey => {
|
|
9041
|
-
var _totalNumberOfStoresQ;
|
|
9042
8935
|
const totalNumberOfStoresQuery = react.useQuery(TotalNumberOfStores, {
|
|
9043
8936
|
context: {
|
|
9044
8937
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM,
|
|
@@ -9047,7 +8940,7 @@ const useTotalNumberOfStoresFetcher = projectKey => {
|
|
|
9047
8940
|
fetchPolicy: 'network-only'
|
|
9048
8941
|
});
|
|
9049
8942
|
return {
|
|
9050
|
-
total:
|
|
8943
|
+
total: totalNumberOfStoresQuery.data?.totalNumberOfStores.total,
|
|
9051
8944
|
isLoading: totalNumberOfStoresQuery.loading
|
|
9052
8945
|
};
|
|
9053
8946
|
};
|
|
@@ -9065,19 +8958,15 @@ const handlers$2 = {
|
|
|
9065
8958
|
};
|
|
9066
8959
|
|
|
9067
8960
|
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 } } } };
|
|
9068
|
-
const createQueryVariables$2 = (stores, predicateField, shouldFetchProductSelections) => {
|
|
9069
|
-
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
|
|
9073
|
-
excludeProductSelections: !shouldFetchProductSelections
|
|
9074
|
-
};
|
|
9075
|
-
};
|
|
8961
|
+
const createQueryVariables$2 = (stores, predicateField, shouldFetchProductSelections) => ({
|
|
8962
|
+
where: `${predicateField} in (${_mapInstanceProperty__default["default"](stores).call(stores, store => `"${store}"`).join(', ')})`,
|
|
8963
|
+
limit: 500,
|
|
8964
|
+
excludeProductSelections: !shouldFetchProductSelections
|
|
8965
|
+
});
|
|
9076
8966
|
const emptyStoresQueryResult = {
|
|
9077
8967
|
results: []
|
|
9078
8968
|
};
|
|
9079
8969
|
const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
9080
|
-
var _storesQuery$data;
|
|
9081
8970
|
let shouldFetchProductSelections = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
9082
8971
|
// incase of single select input stores are sent as single string literal
|
|
9083
8972
|
const storesList = _Array$isArray__default["default"](stores) ? stores : [stores];
|
|
@@ -9090,13 +8979,13 @@ const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
|
|
|
9090
8979
|
skip: storesList.length === 0
|
|
9091
8980
|
});
|
|
9092
8981
|
return {
|
|
9093
|
-
stores:
|
|
8982
|
+
stores: storesQuery.data?.storesByField || emptyStoresQueryResult,
|
|
9094
8983
|
isLoading: storesQuery.loading
|
|
9095
8984
|
};
|
|
9096
8985
|
};
|
|
9097
8986
|
|
|
9098
8987
|
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; }
|
|
9099
|
-
function _objectSpread$C(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
8988
|
+
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; }
|
|
9100
8989
|
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 } } } };
|
|
9101
8990
|
var styles$8 = {
|
|
9102
8991
|
"renderLabelContainer": "stores-search-selector-module__renderLabelContainer___3_PBc",
|
|
@@ -9107,16 +8996,16 @@ const hasErrors = errors => {
|
|
|
9107
8996
|
return errors && _someInstanceProperty__default["default"](_context = _Object$values__default["default"](errors)).call(_context, Boolean);
|
|
9108
8997
|
};
|
|
9109
8998
|
const createQueryVariables$1 = _ref => {
|
|
9110
|
-
var _context2
|
|
8999
|
+
var _context2;
|
|
9111
9000
|
let searchText = _ref.searchText,
|
|
9112
9001
|
dataLocale = _ref.dataLocale,
|
|
9113
9002
|
allAccessibleStoreKeysThroughDataFencePermissions = _ref.allAccessibleStoreKeysThroughDataFencePermissions,
|
|
9114
9003
|
shouldFetchProductSelections = _ref.shouldFetchProductSelections;
|
|
9115
9004
|
const sanitizedSearchText = sanitize(_trimInstanceProperty__default["default"](searchText).call(searchText, searchText));
|
|
9116
|
-
const keyQuery =
|
|
9005
|
+
const keyQuery = `key = "${sanitizedSearchText}"`;
|
|
9117
9006
|
|
|
9118
9007
|
// if the user has data fence permissions then we only allow stores to fetched that user has access to
|
|
9119
|
-
if (allAccessibleStoreKeysThroughDataFencePermissions
|
|
9008
|
+
if (allAccessibleStoreKeysThroughDataFencePermissions?.length) {
|
|
9120
9009
|
// if the current search term match the accessible stores keys, then proceed with fetching the store
|
|
9121
9010
|
if (_includesInstanceProperty__default["default"](allAccessibleStoreKeysThroughDataFencePermissions).call(allAccessibleStoreKeysThroughDataFencePermissions, sanitizedSearchText)) {
|
|
9122
9011
|
return {
|
|
@@ -9132,9 +9021,9 @@ const createQueryVariables$1 = _ref => {
|
|
|
9132
9021
|
excludeProductSelections: !shouldFetchProductSelections
|
|
9133
9022
|
};
|
|
9134
9023
|
}
|
|
9135
|
-
const idQuery = isUUID(sanitizedSearchText) &&
|
|
9136
|
-
const nameQuery =
|
|
9137
|
-
const searchTextQuery = _filterInstanceProperty__default["default"](
|
|
9024
|
+
const idQuery = isUUID(sanitizedSearchText) && `id = "${sanitizedSearchText}"`;
|
|
9025
|
+
const nameQuery = `name(${dataLocale} = "${sanitizedSearchText}")`;
|
|
9026
|
+
const searchTextQuery = _filterInstanceProperty__default["default"](_context2 = [idQuery, nameQuery, keyQuery]).call(_context2, Boolean).join(' or ');
|
|
9138
9027
|
return {
|
|
9139
9028
|
skipFetchingStores: false,
|
|
9140
9029
|
where: searchTextQuery,
|
|
@@ -9142,7 +9031,6 @@ const createQueryVariables$1 = _ref => {
|
|
|
9142
9031
|
};
|
|
9143
9032
|
};
|
|
9144
9033
|
const getValueFromOptions = _ref2 => {
|
|
9145
|
-
var _storesByFieldFetcher, _context4;
|
|
9146
9034
|
let isMulti = _ref2.isMulti,
|
|
9147
9035
|
value = _ref2.value,
|
|
9148
9036
|
dataLocale = _ref2.dataLocale,
|
|
@@ -9151,7 +9039,7 @@ const getValueFromOptions = _ref2 => {
|
|
|
9151
9039
|
if (!value) {
|
|
9152
9040
|
return undefined;
|
|
9153
9041
|
}
|
|
9154
|
-
const selectedOptions =
|
|
9042
|
+
const selectedOptions = storesByFieldFetcher.stores?.results.map(store => mapStoresToOptions({
|
|
9155
9043
|
store,
|
|
9156
9044
|
dataLocale,
|
|
9157
9045
|
renderSelectInputOptionValuesByField: renderSelectInputOptionValuesByField
|
|
@@ -9167,7 +9055,7 @@ const getValueFromOptions = _ref2 => {
|
|
|
9167
9055
|
const StoresSearchSelectInput = props => {
|
|
9168
9056
|
// hooks
|
|
9169
9057
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
9170
|
-
dataLocale: applicationContext.dataLocale
|
|
9058
|
+
dataLocale: applicationContext.dataLocale || applicationContext.user?.locale
|
|
9171
9059
|
})),
|
|
9172
9060
|
dataLocale = _useApplicationContex.dataLocale;
|
|
9173
9061
|
const intl = reactIntl.useIntl();
|
|
@@ -9189,9 +9077,8 @@ const StoresSearchSelectInput = props => {
|
|
|
9189
9077
|
},
|
|
9190
9078
|
fetchPolicy: 'network-only'
|
|
9191
9079
|
}).then(_ref3 => {
|
|
9192
|
-
var _data$storesByWherePr, _context5;
|
|
9193
9080
|
let data = _ref3.data;
|
|
9194
|
-
const result =
|
|
9081
|
+
const result = data.storesByWherePredicate?.results.map(store => mapStoresToOptions({
|
|
9195
9082
|
store,
|
|
9196
9083
|
dataLocale,
|
|
9197
9084
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
@@ -9212,7 +9099,7 @@ const StoresSearchSelectInput = props => {
|
|
|
9212
9099
|
className: styles$8.renderLabelContainer,
|
|
9213
9100
|
children: [jsxRuntime.jsx("div", {
|
|
9214
9101
|
className: styles$8.customLabel,
|
|
9215
|
-
children:
|
|
9102
|
+
children: props?.renderLabel && props?.renderLabel
|
|
9216
9103
|
}), jsxRuntime.jsx("div", {
|
|
9217
9104
|
children: intl.formatMessage(inputValue ? messages$q.searchSelectInputNoOptionsFoundMessage : messages$q.searchSelectInputNoValueMessage)
|
|
9218
9105
|
})]
|
|
@@ -9385,7 +9272,6 @@ StoreSelectField.defaultProps = {
|
|
|
9385
9272
|
mappedValueField: 'id'
|
|
9386
9273
|
};
|
|
9387
9274
|
|
|
9388
|
-
var _templateObject$1;
|
|
9389
9275
|
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; }
|
|
9390
9276
|
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; }
|
|
9391
9277
|
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)); }
|
|
@@ -9464,7 +9350,10 @@ const VALIDATOR_INTEGER = {
|
|
|
9464
9350
|
* has emitted a warning once in the logs, not for every instance
|
|
9465
9351
|
*/
|
|
9466
9352
|
let hasWarned = false;
|
|
9467
|
-
const warningMessage = commonTags.oneLineTrim
|
|
9353
|
+
const warningMessage = commonTags.oneLineTrim`
|
|
9354
|
+
\`validatedInput\` is no longer supported.
|
|
9355
|
+
Please use \`formik\` instead.
|
|
9356
|
+
`;
|
|
9468
9357
|
const ToolTipWrapperComponent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
9469
9358
|
let children = _ref.children;
|
|
9470
9359
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
@@ -9611,7 +9500,7 @@ function validatedInput(InnerComponent, validators) {
|
|
|
9611
9500
|
}
|
|
9612
9501
|
}]);
|
|
9613
9502
|
}(React.PureComponent);
|
|
9614
|
-
ValidatedInput.displayName =
|
|
9503
|
+
ValidatedInput.displayName = `ValidatedInput(${_InnerComponent.displayName})`;
|
|
9615
9504
|
ValidatedInput.defaultProps = {
|
|
9616
9505
|
isValid: true,
|
|
9617
9506
|
getInputRef: () => {}
|
|
@@ -9676,7 +9565,7 @@ let CustomFieldDefinitionsConnector = /*#__PURE__*/function (_Component) {
|
|
|
9676
9565
|
value: function componentDidMount() {
|
|
9677
9566
|
var _context;
|
|
9678
9567
|
const hasUnsupportedResource = _someInstanceProperty__default["default"](_context = this.props.resources).call(_context, resource => !_includesInstanceProperty__default["default"](customizableResources$1).call(customizableResources$1, resource));
|
|
9679
|
-
!!hasUnsupportedResource ? process.env.NODE_ENV !== "production" ? invariant__default["default"](false,
|
|
9568
|
+
!!hasUnsupportedResource ? process.env.NODE_ENV !== "production" ? invariant__default["default"](false, `core/components/custom-field-definitions-connector: some of the specified resources are not supported.`) : invariant__default["default"](false) : void 0;
|
|
9680
9569
|
}
|
|
9681
9570
|
}, {
|
|
9682
9571
|
key: "render",
|
|
@@ -9694,9 +9583,9 @@ CustomFieldDefinitionsConnector.displayName = 'CustomFieldDefinitionsConnector';
|
|
|
9694
9583
|
CustomFieldDefinitionsConnector.defaultProps = {
|
|
9695
9584
|
resources: []
|
|
9696
9585
|
};
|
|
9697
|
-
const stringifyResources$1 = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => "
|
|
9586
|
+
const stringifyResources$1 = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => `"${resource}"`).join();
|
|
9698
9587
|
const mapPropsToOptions = ownProps => {
|
|
9699
|
-
const where = ownProps.resources.length > 0 ?
|
|
9588
|
+
const where = ownProps.resources.length > 0 ? `resourceTypeIds contains any (${stringifyResources$1(ownProps.resources)})` : undefined;
|
|
9700
9589
|
return {
|
|
9701
9590
|
variables: {
|
|
9702
9591
|
where,
|
|
@@ -9765,19 +9654,19 @@ const graphQlDocToForm = typeDefinition => {
|
|
|
9765
9654
|
key: typeDefinition.key,
|
|
9766
9655
|
name: l10n.transformLocalizedFieldToLocalizedString(typeDefinition.nameAllLocales),
|
|
9767
9656
|
fieldDefinitions: _mapInstanceProperty__default["default"](_context = typeDefinition.fieldDefinitions).call(_context, fieldDefinition => {
|
|
9768
|
-
var
|
|
9657
|
+
var _context2, _context3;
|
|
9769
9658
|
return {
|
|
9770
9659
|
name: fieldDefinition.name,
|
|
9771
9660
|
required: fieldDefinition.required,
|
|
9772
9661
|
inputHint: fieldDefinition.inputHint,
|
|
9773
|
-
type:
|
|
9662
|
+
type: fieldDefinition.type?.elementType?.name === 'LocalizedEnum' ? _objectSpread$x(_objectSpread$x({}, fieldDefinition.type), {}, {
|
|
9774
9663
|
elementType: _objectSpread$x(_objectSpread$x({}, fieldDefinition.type.elementType), {}, {
|
|
9775
9664
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type.elementType)).call(_context2, value => ({
|
|
9776
9665
|
key: value.key,
|
|
9777
9666
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
9778
9667
|
}))
|
|
9779
9668
|
})
|
|
9780
|
-
}) :
|
|
9669
|
+
}) : fieldDefinition.type?.name === 'LocalizedEnum' ? _objectSpread$x(_objectSpread$x({}, fieldDefinition.type), {}, {
|
|
9781
9670
|
values: _mapInstanceProperty__default["default"](_context3 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context3, value => ({
|
|
9782
9671
|
key: value.key,
|
|
9783
9672
|
label: l10n.transformLocalizedFieldToLocalizedString(value.labelAllLocales)
|
|
@@ -9809,7 +9698,7 @@ const formToGraphQlDoc = formCustomFields => ({
|
|
|
9809
9698
|
// TODO(pa3): find usages and make sure only 1 param is passed
|
|
9810
9699
|
const createEmptyCustomFields = typeDefinition => ({
|
|
9811
9700
|
fields: {},
|
|
9812
|
-
type:
|
|
9701
|
+
type: typeDefinition?.type || {
|
|
9813
9702
|
fieldDefinitions: []
|
|
9814
9703
|
}
|
|
9815
9704
|
});
|
|
@@ -9817,7 +9706,7 @@ const createEmptyCustomFields = typeDefinition => ({
|
|
|
9817
9706
|
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)); }
|
|
9818
9707
|
function _isNativeReflectConstruct$3() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$3 = function () { return !!t; })(); }
|
|
9819
9708
|
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 } } } };
|
|
9820
|
-
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'];
|
|
9709
|
+
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'];
|
|
9821
9710
|
const emptyTypeDefinitions = {
|
|
9822
9711
|
total: 0,
|
|
9823
9712
|
count: 0,
|
|
@@ -9834,7 +9723,7 @@ let CustomFieldTypeDefinitionsConnector = /*#__PURE__*/function (_Component) {
|
|
|
9834
9723
|
value: function componentDidMount() {
|
|
9835
9724
|
var _context;
|
|
9836
9725
|
const hasUnsupportedResource = _someInstanceProperty__default["default"](_context = this.props.resources).call(_context, resource => !_includesInstanceProperty__default["default"](customizableResources).call(customizableResources, resource));
|
|
9837
|
-
!!hasUnsupportedResource ? process.env.NODE_ENV !== "production" ? invariant__default["default"](false,
|
|
9726
|
+
!!hasUnsupportedResource ? process.env.NODE_ENV !== "production" ? invariant__default["default"](false, `core/components/custom-field-definitions-connector: some of the specified resources are not supported.`) : invariant__default["default"](false) : void 0;
|
|
9838
9727
|
}
|
|
9839
9728
|
}, {
|
|
9840
9729
|
key: "render",
|
|
@@ -9858,9 +9747,9 @@ CustomFieldTypeDefinitionsConnector.graphQlDocToForm = graphQlDocToForm;
|
|
|
9858
9747
|
CustomFieldTypeDefinitionsConnector.formToRestDoc = formToRestDoc;
|
|
9859
9748
|
CustomFieldTypeDefinitionsConnector.formToGraphQlDoc = formToGraphQlDoc;
|
|
9860
9749
|
CustomFieldTypeDefinitionsConnector.createEmptyCustomFields = createEmptyCustomFields;
|
|
9861
|
-
const stringifyResources = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => "
|
|
9750
|
+
const stringifyResources = resources => _mapInstanceProperty__default["default"](resources).call(resources, resource => `"${resource}"`).join();
|
|
9862
9751
|
const createGraphQlOptions = ownProps => {
|
|
9863
|
-
const where = ownProps.resources.length > 0 ?
|
|
9752
|
+
const where = ownProps.resources.length > 0 ? `resourceTypeIds contains any (${stringifyResources(ownProps.resources)})` : undefined;
|
|
9864
9753
|
return {
|
|
9865
9754
|
variables: {
|
|
9866
9755
|
where,
|
|
@@ -9910,7 +9799,7 @@ const extractDuplicatedValues = (values, type, language, languages) => {
|
|
|
9910
9799
|
let validatedValues = [];
|
|
9911
9800
|
if (type.name.toLowerCase() === 'money') {
|
|
9912
9801
|
validatedValues = unique(values, ['amount', 'currencyCode']);
|
|
9913
|
-
} else if (type.name.toLowerCase() === 'reference') validatedValues = unique(_filterInstanceProperty__default["default"](values).call(values, value => value
|
|
9802
|
+
} else if (type.name.toLowerCase() === 'reference') validatedValues = unique(_filterInstanceProperty__default["default"](values).call(values, value => value?.id), ['id']);else if (type.name.toLowerCase() === 'localizedstring') {
|
|
9914
9803
|
validatedValues = unique(values, languages);
|
|
9915
9804
|
} else validatedValues = unique(values);
|
|
9916
9805
|
return validatedValues;
|
|
@@ -10043,10 +9932,9 @@ var messages$o = reactIntl.defineMessages({
|
|
|
10043
9932
|
const FIELD_NAME = 'custom';
|
|
10044
9933
|
|
|
10045
9934
|
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; }
|
|
10046
|
-
function _objectSpread$u(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
9935
|
+
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; }
|
|
10047
9936
|
const transformFieldType = fieldDefinition => {
|
|
10048
|
-
|
|
10049
|
-
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') {
|
|
9937
|
+
if (fieldDefinition.type?.elementType?.name === 'LocalizedEnum') {
|
|
10050
9938
|
var _context;
|
|
10051
9939
|
return _objectSpread$u(_objectSpread$u({}, fieldDefinition.type), {}, {
|
|
10052
9940
|
elementType: _objectSpread$u(_objectSpread$u({}, fieldDefinition.type.elementType), {}, {
|
|
@@ -10056,7 +9944,7 @@ const transformFieldType = fieldDefinition => {
|
|
|
10056
9944
|
}))
|
|
10057
9945
|
})
|
|
10058
9946
|
});
|
|
10059
|
-
} else if (
|
|
9947
|
+
} else if (fieldDefinition.type?.name === 'LocalizedEnum') {
|
|
10060
9948
|
var _context2;
|
|
10061
9949
|
return _objectSpread$u(_objectSpread$u({}, fieldDefinition.type), {}, {
|
|
10062
9950
|
values: _mapInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](fieldDefinition.type)).call(_context2, value => ({
|
|
@@ -10103,9 +9991,9 @@ const createFormStateFromResource = resource => {
|
|
|
10103
9991
|
};
|
|
10104
9992
|
};
|
|
10105
9993
|
const createGraphQlDocFromFormState = formState => {
|
|
10106
|
-
var
|
|
9994
|
+
var _context5;
|
|
10107
9995
|
// Unset the custom type if it's not in the form state
|
|
10108
|
-
if (!
|
|
9996
|
+
if (!formState[FIELD_NAME]?.type?.id) {
|
|
10109
9997
|
return {
|
|
10110
9998
|
[FIELD_NAME]: {}
|
|
10111
9999
|
};
|
|
@@ -10131,8 +10019,7 @@ const createGraphQlDocFromFormState = formState => {
|
|
|
10131
10019
|
|
|
10132
10020
|
// Creates a root field name accessor for `custom` form state
|
|
10133
10021
|
const createRootFieldName = rootFieldName => {
|
|
10134
|
-
|
|
10135
|
-
return rootFieldName ? _concatInstanceProperty__default["default"](_context6 = "".concat(rootFieldName, ".")).call(_context6, FIELD_NAME) : FIELD_NAME;
|
|
10022
|
+
return rootFieldName ? `${rootFieldName}.${FIELD_NAME}` : FIELD_NAME;
|
|
10136
10023
|
};
|
|
10137
10024
|
|
|
10138
10025
|
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; }
|
|
@@ -10141,8 +10028,7 @@ const typeDefinitionsExist = typeDefinitions => {
|
|
|
10141
10028
|
return typeDefinitions.length > 0;
|
|
10142
10029
|
};
|
|
10143
10030
|
const typeDefinitionSelected = (formValues, rootFieldName) => {
|
|
10144
|
-
|
|
10145
|
-
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);
|
|
10031
|
+
return formik.getIn(formValues, rootFieldName)?.type && formik.getIn(formValues, rootFieldName)?.type?.obj;
|
|
10146
10032
|
};
|
|
10147
10033
|
const typeDefinitionContainsFieldDefinitions = (formValues, rootFieldName) => {
|
|
10148
10034
|
return formik.getIn(formValues, rootFieldName).type.obj.key && formik.getIn(formValues, rootFieldName).type.obj.fieldDefinitions.length > 0;
|
|
@@ -10179,7 +10065,7 @@ const CustomFieldsInputWrapper = _ref2 => {
|
|
|
10179
10065
|
max: "scale",
|
|
10180
10066
|
children: jsxRuntime.jsx(CustomFields, {
|
|
10181
10067
|
isReadOnly: isReadOnly,
|
|
10182
|
-
name:
|
|
10068
|
+
name: `${rootFieldName}.fields`,
|
|
10183
10069
|
fieldDefinitions: isReadOnly && hideEmptyFields ? fieldDefinitionsWithValues(formValues, rootFieldName) : formik.getIn(formValues, rootFieldName).type.obj.fieldDefinitions
|
|
10184
10070
|
})
|
|
10185
10071
|
});
|
|
@@ -10214,7 +10100,6 @@ const createFormStateFromTypeDefinition = selectedTypeDefinition => {
|
|
|
10214
10100
|
};
|
|
10215
10101
|
};
|
|
10216
10102
|
const CustomTypeSubform = _ref => {
|
|
10217
|
-
var _getIn3, _getIn4;
|
|
10218
10103
|
let typeDefinitions = _ref.typeDefinitions,
|
|
10219
10104
|
isReadOnly = _ref.isReadOnly,
|
|
10220
10105
|
isCondensed = _ref.isCondensed,
|
|
@@ -10249,8 +10134,7 @@ const CustomTypeSubform = _ref => {
|
|
|
10249
10134
|
}
|
|
10250
10135
|
}, [typeDefinitions, setFieldValue, validateForm, rootFieldName]);
|
|
10251
10136
|
const typeDefinitionSelected = formValues => {
|
|
10252
|
-
|
|
10253
|
-
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);
|
|
10137
|
+
return formik.getIn(formValues, rootFieldName)?.type && formik.getIn(formValues, rootFieldName)?.type?.obj;
|
|
10254
10138
|
};
|
|
10255
10139
|
|
|
10256
10140
|
// if the user has read-only permissions, empty fields are hidden, and no type definition is selected, hide the component
|
|
@@ -10265,9 +10149,9 @@ const CustomTypeSubform = _ref => {
|
|
|
10265
10149
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
10266
10150
|
isClearable: true,
|
|
10267
10151
|
"data-testid": "custom-type-select",
|
|
10268
|
-
name:
|
|
10269
|
-
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages,
|
|
10270
|
-
value:
|
|
10152
|
+
name: `${rootFieldName}.type.obj.key`,
|
|
10153
|
+
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages, formik.getIn(formValues, rootFieldName)?.type?.id),
|
|
10154
|
+
value: formik.getIn(formValues, rootFieldName)?.type?.obj?.key,
|
|
10271
10155
|
onChange: handleTypeDefinitionSelect,
|
|
10272
10156
|
placeholder: formatMessage(messages$o.typesPlaceholder),
|
|
10273
10157
|
isReadOnly: isReadOnly
|
|
@@ -10348,7 +10232,7 @@ var fetchPimIndexStatus = ((apolloClient, projectKey) => async dispatch => {
|
|
|
10348
10232
|
try {
|
|
10349
10233
|
await dispatch(sdk.actions.head({
|
|
10350
10234
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.PIM_SEARCH,
|
|
10351
|
-
uri:
|
|
10235
|
+
uri: `/${projectKey}/search/products`
|
|
10352
10236
|
}));
|
|
10353
10237
|
return {
|
|
10354
10238
|
status: 'indexed'
|
|
@@ -10414,8 +10298,8 @@ const getIndexingJobIds = _ref => {
|
|
|
10414
10298
|
products = _ref$data.products,
|
|
10415
10299
|
productTypes = _ref$data.productTypes;
|
|
10416
10300
|
return {
|
|
10417
|
-
productsJobId:
|
|
10418
|
-
productTypesJobId:
|
|
10301
|
+
productsJobId: products?.indexingJobId || products?.existingIndexingJobId,
|
|
10302
|
+
productTypesJobId: productTypes?.indexingJobId || productTypes?.existingIndexingJobId
|
|
10419
10303
|
};
|
|
10420
10304
|
};
|
|
10421
10305
|
let PimIndexerProvider = /*#__PURE__*/function (_PureComponent) {
|
|
@@ -10666,6 +10550,7 @@ function usePimIndexer() {
|
|
|
10666
10550
|
|
|
10667
10551
|
// eslint-disable-next-line import/prefer-default-export
|
|
10668
10552
|
const RESOURCES_WITH_PLATFORM_LIMITS = {
|
|
10553
|
+
businessUnits: 'businessUnits',
|
|
10669
10554
|
shoppingLists: 'shoppingLists',
|
|
10670
10555
|
productDiscounts: 'productDiscounts',
|
|
10671
10556
|
cartDiscounts: 'cartDiscounts',
|
|
@@ -10682,10 +10567,10 @@ function ownKeys$p(e, r) { var t = _Object$keys__default["default"](e); if (_Obj
|
|
|
10682
10567
|
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; }
|
|
10683
10568
|
const resourcesWithPlatformLimits = _Object$keys__default["default"](RESOURCES_WITH_PLATFORM_LIMITS);
|
|
10684
10569
|
const createQueryVariables = platformLimit => _reduceInstanceProperty__default["default"](resourcesWithPlatformLimits).call(resourcesWithPlatformLimits, (previousIncludedLimits, nextNameOfLimit) => _objectSpread$p({
|
|
10685
|
-
[camelCase__default["default"](
|
|
10570
|
+
[camelCase__default["default"](`should include ${nextNameOfLimit}`)]: platformLimit ? nextNameOfLimit === platformLimit : true
|
|
10686
10571
|
}, previousIncludedLimits), {});
|
|
10687
10572
|
|
|
10688
|
-
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 } } } };
|
|
10573
|
+
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 } } } };
|
|
10689
10574
|
const usePlatformLimitsFetcher = platformLimit => {
|
|
10690
10575
|
const _useQuery = react.useQuery(PlatformLimitsFetcherQuery, {
|
|
10691
10576
|
variables: createQueryVariables(platformLimit),
|
|
@@ -10698,7 +10583,7 @@ const usePlatformLimitsFetcher = platformLimit => {
|
|
|
10698
10583
|
error = _useQuery.error,
|
|
10699
10584
|
data = _useQuery.data,
|
|
10700
10585
|
refetch = _useQuery.refetch;
|
|
10701
|
-
const platformLimits = !loading ? omit__default["default"](data
|
|
10586
|
+
const platformLimits = !loading ? omit__default["default"](data?.limits, '__typename') : {};
|
|
10702
10587
|
return {
|
|
10703
10588
|
isLoading: loading,
|
|
10704
10589
|
error,
|
|
@@ -10889,11 +10774,10 @@ const getPlatformLimitsStatus = _ref3 => {
|
|
|
10889
10774
|
total = _ref3.total,
|
|
10890
10775
|
intl = _ref3.intl;
|
|
10891
10776
|
if (limit) {
|
|
10892
|
-
|
|
10893
|
-
return _concatInstanceProperty__default["default"](_context = "(".concat(intl.formatNumber(current), "/")).call(_context, intl.formatNumber(limit), ")");
|
|
10777
|
+
return `(${intl.formatNumber(current)}/${intl.formatNumber(limit)})`;
|
|
10894
10778
|
}
|
|
10895
10779
|
if (total) {
|
|
10896
|
-
return
|
|
10780
|
+
return `(${intl.formatNumber(total)})`;
|
|
10897
10781
|
}
|
|
10898
10782
|
return '';
|
|
10899
10783
|
};
|
|
@@ -10913,18 +10797,17 @@ const useShippingMethodsPlatformLimitsFetcher = () => {
|
|
|
10913
10797
|
};
|
|
10914
10798
|
|
|
10915
10799
|
const useShippingMethodsPlatformLimits = () => {
|
|
10916
|
-
var _platformLimits$shipp;
|
|
10917
10800
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
10918
10801
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
10919
|
-
if (!
|
|
10802
|
+
if (!platformLimits?.shippingMethods?.total) {
|
|
10920
10803
|
return {
|
|
10921
10804
|
hasReachedShippingMethodsWarningLimit: false,
|
|
10922
10805
|
hasReachedShippingMethodsErrorLimit: false
|
|
10923
10806
|
};
|
|
10924
10807
|
}
|
|
10925
|
-
const _platformLimits$
|
|
10926
|
-
limit = _platformLimits$
|
|
10927
|
-
current = _platformLimits$
|
|
10808
|
+
const _platformLimits$shipp = platformLimits.shippingMethods.total,
|
|
10809
|
+
limit = _platformLimits$shipp.limit,
|
|
10810
|
+
current = _platformLimits$shipp.current;
|
|
10928
10811
|
const hasReachedShippingMethodsWarningLimit = getHasExceededWarningThreshold({
|
|
10929
10812
|
limit,
|
|
10930
10813
|
current
|
|
@@ -10940,13 +10823,12 @@ const useShippingMethodsPlatformLimits = () => {
|
|
|
10940
10823
|
};
|
|
10941
10824
|
|
|
10942
10825
|
const PlatformLimitsShippingMethodsNotifications = () => {
|
|
10943
|
-
var _platformLimits$shipp;
|
|
10944
10826
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
10945
10827
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
10946
10828
|
const _useShippingMethodsPl2 = useShippingMethodsPlatformLimits(),
|
|
10947
10829
|
hasReachedShippingMethodsWarningLimit = _useShippingMethodsPl2.hasReachedShippingMethodsWarningLimit,
|
|
10948
10830
|
hasReachedShippingMethodsErrorLimit = _useShippingMethodsPl2.hasReachedShippingMethodsErrorLimit;
|
|
10949
|
-
if (!
|
|
10831
|
+
if (!platformLimits?.shippingMethods?.total) {
|
|
10950
10832
|
return null;
|
|
10951
10833
|
}
|
|
10952
10834
|
if (hasReachedShippingMethodsErrorLimit) {
|
|
@@ -10992,13 +10874,12 @@ var messages$j = reactIntl.defineMessages({
|
|
|
10992
10874
|
});
|
|
10993
10875
|
|
|
10994
10876
|
const PlatformLimitsShippingMethodsStatus = _ref => {
|
|
10995
|
-
var _platformLimits$shipp, _platformLimits$shipp2;
|
|
10996
10877
|
let total = _ref.total;
|
|
10997
10878
|
const intl = reactIntl.useIntl();
|
|
10998
10879
|
const _useShippingMethodsPl = useShippingMethodsPlatformLimitsFetcher(),
|
|
10999
10880
|
platformLimits = _useShippingMethodsPl.platformLimits;
|
|
11000
|
-
const current = platformLimits
|
|
11001
|
-
const limit = platformLimits
|
|
10881
|
+
const current = platformLimits?.shippingMethods?.total?.current;
|
|
10882
|
+
const limit = platformLimits?.shippingMethods?.total?.limit;
|
|
11002
10883
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
11003
10884
|
intlMessage: messages$j.shippingMethodsStatus,
|
|
11004
10885
|
children: getPlatformLimitsStatus({
|
|
@@ -11060,18 +10941,17 @@ const useTaxCategoriesPlatformLimitsFetcher = () => {
|
|
|
11060
10941
|
};
|
|
11061
10942
|
|
|
11062
10943
|
const useTaxCategoriesPlatformLimits = () => {
|
|
11063
|
-
var _platformLimits$taxCa;
|
|
11064
10944
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
11065
10945
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
11066
|
-
if (!
|
|
10946
|
+
if (!platformLimits?.taxCategories?.total) {
|
|
11067
10947
|
return {
|
|
11068
10948
|
hasReachedTaxCategoriesWarningLimit: false,
|
|
11069
10949
|
hasReachedTaxCategoriesErrorLimit: false
|
|
11070
10950
|
};
|
|
11071
10951
|
}
|
|
11072
|
-
const _platformLimits$
|
|
11073
|
-
limit = _platformLimits$
|
|
11074
|
-
current = _platformLimits$
|
|
10952
|
+
const _platformLimits$taxCa = platformLimits.taxCategories.total,
|
|
10953
|
+
limit = _platformLimits$taxCa.limit,
|
|
10954
|
+
current = _platformLimits$taxCa.current;
|
|
11075
10955
|
const hasReachedTaxCategoriesWarningLimit = getHasExceededWarningThreshold({
|
|
11076
10956
|
limit,
|
|
11077
10957
|
current
|
|
@@ -11087,13 +10967,12 @@ const useTaxCategoriesPlatformLimits = () => {
|
|
|
11087
10967
|
};
|
|
11088
10968
|
|
|
11089
10969
|
const PlatformLimitsTaxCategoriesNotifications = () => {
|
|
11090
|
-
var _platformLimits$taxCa;
|
|
11091
10970
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
11092
10971
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
11093
10972
|
const _useTaxCategoriesPlat2 = useTaxCategoriesPlatformLimits(),
|
|
11094
10973
|
hasReachedTaxCategoriesWarningLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesWarningLimit,
|
|
11095
10974
|
hasReachedTaxCategoriesErrorLimit = _useTaxCategoriesPlat2.hasReachedTaxCategoriesErrorLimit;
|
|
11096
|
-
if (!
|
|
10975
|
+
if (!platformLimits?.taxCategories?.total) {
|
|
11097
10976
|
return null;
|
|
11098
10977
|
}
|
|
11099
10978
|
if (hasReachedTaxCategoriesErrorLimit) {
|
|
@@ -11139,13 +11018,12 @@ var messages$h = reactIntl.defineMessages({
|
|
|
11139
11018
|
});
|
|
11140
11019
|
|
|
11141
11020
|
const PlatformLimitsTaxCategoriesStatus = _ref => {
|
|
11142
|
-
var _platformLimits$taxCa, _platformLimits$taxCa2;
|
|
11143
11021
|
let total = _ref.total;
|
|
11144
11022
|
const intl = reactIntl.useIntl();
|
|
11145
11023
|
const _useTaxCategoriesPlat = useTaxCategoriesPlatformLimitsFetcher(),
|
|
11146
11024
|
platformLimits = _useTaxCategoriesPlat.platformLimits;
|
|
11147
|
-
const current = platformLimits
|
|
11148
|
-
const limit = platformLimits
|
|
11025
|
+
const current = platformLimits?.taxCategories?.total?.current;
|
|
11026
|
+
const limit = platformLimits?.taxCategories?.total?.limit;
|
|
11149
11027
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
11150
11028
|
intlMessage: messages$h.taxCategoriesStatus,
|
|
11151
11029
|
children: getPlatformLimitsStatus({
|
|
@@ -11207,18 +11085,17 @@ const useZonesPlatformLimitsFetcher = () => {
|
|
|
11207
11085
|
};
|
|
11208
11086
|
|
|
11209
11087
|
const useZonesPlatformLimits = () => {
|
|
11210
|
-
var _platformLimits$zones;
|
|
11211
11088
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
11212
11089
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
11213
|
-
if (!
|
|
11090
|
+
if (!platformLimits?.zones?.total) {
|
|
11214
11091
|
return {
|
|
11215
11092
|
hasReachedZonesWarningLimit: false,
|
|
11216
11093
|
hasReachedZonesErrorLimit: false
|
|
11217
11094
|
};
|
|
11218
11095
|
}
|
|
11219
|
-
const _platformLimits$
|
|
11220
|
-
limit = _platformLimits$
|
|
11221
|
-
current = _platformLimits$
|
|
11096
|
+
const _platformLimits$zones = platformLimits.zones.total,
|
|
11097
|
+
limit = _platformLimits$zones.limit,
|
|
11098
|
+
current = _platformLimits$zones.current;
|
|
11222
11099
|
const hasReachedZonesWarningLimit = getHasExceededWarningThreshold({
|
|
11223
11100
|
limit,
|
|
11224
11101
|
current
|
|
@@ -11234,13 +11111,12 @@ const useZonesPlatformLimits = () => {
|
|
|
11234
11111
|
};
|
|
11235
11112
|
|
|
11236
11113
|
const PlatformLimitsZonesNotifications = () => {
|
|
11237
|
-
var _platformLimits$zones;
|
|
11238
11114
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
11239
11115
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
11240
11116
|
const _useZonesPlatformLimi2 = useZonesPlatformLimits(),
|
|
11241
11117
|
hasReachedZonesWarningLimit = _useZonesPlatformLimi2.hasReachedZonesWarningLimit,
|
|
11242
11118
|
hasReachedZonesErrorLimit = _useZonesPlatformLimi2.hasReachedZonesErrorLimit;
|
|
11243
|
-
if (!
|
|
11119
|
+
if (!platformLimits?.zones?.total) {
|
|
11244
11120
|
return null;
|
|
11245
11121
|
}
|
|
11246
11122
|
if (hasReachedZonesErrorLimit) {
|
|
@@ -11286,13 +11162,12 @@ var messages$f = reactIntl.defineMessages({
|
|
|
11286
11162
|
});
|
|
11287
11163
|
|
|
11288
11164
|
const PlatformLimitsZonesStatus = _ref => {
|
|
11289
|
-
var _platformLimits$zones, _platformLimits$zones2;
|
|
11290
11165
|
let total = _ref.total;
|
|
11291
11166
|
const intl = reactIntl.useIntl();
|
|
11292
11167
|
const _useZonesPlatformLimi = useZonesPlatformLimitsFetcher(),
|
|
11293
11168
|
platformLimits = _useZonesPlatformLimi.platformLimits;
|
|
11294
|
-
const current = platformLimits
|
|
11295
|
-
const limit = platformLimits
|
|
11169
|
+
const current = platformLimits?.zones?.total?.current;
|
|
11170
|
+
const limit = platformLimits?.zones?.total?.limit;
|
|
11296
11171
|
return jsxRuntime.jsx(PlatformLimitsStatusText, {
|
|
11297
11172
|
intlMessage: messages$f.zonesStatus,
|
|
11298
11173
|
children: getPlatformLimitsStatus({
|
|
@@ -11354,18 +11229,17 @@ const useCustomersPlatformLimitsFetcher = () => {
|
|
|
11354
11229
|
};
|
|
11355
11230
|
|
|
11356
11231
|
const useCustomersPlatformLimits$1 = () => {
|
|
11357
|
-
var _platformLimits$custo;
|
|
11358
11232
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
11359
11233
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
11360
|
-
if (!
|
|
11234
|
+
if (!platformLimits?.customers?.total) {
|
|
11361
11235
|
return {
|
|
11362
11236
|
hasReachedCustomersWarningLimit: false,
|
|
11363
11237
|
hasReachedCustomersErrorLimit: false
|
|
11364
11238
|
};
|
|
11365
11239
|
}
|
|
11366
|
-
const _platformLimits$
|
|
11367
|
-
limit = _platformLimits$
|
|
11368
|
-
current = _platformLimits$
|
|
11240
|
+
const _platformLimits$custo = platformLimits.customers.total,
|
|
11241
|
+
limit = _platformLimits$custo.limit,
|
|
11242
|
+
current = _platformLimits$custo.current;
|
|
11369
11243
|
const hasReachedCustomersWarningLimit = getHasExceededWarningThreshold({
|
|
11370
11244
|
limit,
|
|
11371
11245
|
current
|
|
@@ -11394,13 +11268,12 @@ const useCustomersPlatormLimitsModalState = () => {
|
|
|
11394
11268
|
};
|
|
11395
11269
|
|
|
11396
11270
|
const PlatformLimitsCustomersNotifications = () => {
|
|
11397
|
-
var _platformLimits$custo;
|
|
11398
11271
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
11399
11272
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
11400
11273
|
const _useCustomersPlatform2 = useCustomersPlatformLimits$1(),
|
|
11401
11274
|
hasReachedCustomersWarningLimit = _useCustomersPlatform2.hasReachedCustomersWarningLimit,
|
|
11402
11275
|
hasReachedCustomersErrorLimit = _useCustomersPlatform2.hasReachedCustomersErrorLimit;
|
|
11403
|
-
if (!
|
|
11276
|
+
if (!platformLimits?.customers?.total) {
|
|
11404
11277
|
return jsxRuntime.jsx("div", {});
|
|
11405
11278
|
}
|
|
11406
11279
|
if (hasReachedCustomersErrorLimit) {
|
|
@@ -11451,16 +11324,15 @@ var styles$6 = {
|
|
|
11451
11324
|
"status": "platform-limits-customers-status-module__status___3rXYM"
|
|
11452
11325
|
};
|
|
11453
11326
|
const PlatformLimitsCustomersStatus = () => {
|
|
11454
|
-
var _platformLimits$custo;
|
|
11455
11327
|
const intl = reactIntl.useIntl();
|
|
11456
11328
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher(),
|
|
11457
11329
|
platformLimits = _useCustomersPlatform.platformLimits;
|
|
11458
|
-
if (!
|
|
11330
|
+
if (!platformLimits?.customers?.total) {
|
|
11459
11331
|
return null;
|
|
11460
11332
|
}
|
|
11461
|
-
const _platformLimits$
|
|
11462
|
-
current = _platformLimits$
|
|
11463
|
-
limit = _platformLimits$
|
|
11333
|
+
const _platformLimits$custo = platformLimits.customers.total,
|
|
11334
|
+
current = _platformLimits$custo.current,
|
|
11335
|
+
limit = _platformLimits$custo.limit;
|
|
11464
11336
|
return jsxRuntime.jsx("div", {
|
|
11465
11337
|
className: styles$6.status,
|
|
11466
11338
|
children: jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
@@ -11694,18 +11566,17 @@ const useCustomerGroupsPlatformLimitsFetcher = () => {
|
|
|
11694
11566
|
};
|
|
11695
11567
|
|
|
11696
11568
|
const useCustomerGroupsPlatformLimitsStatus = () => {
|
|
11697
|
-
var _platformLimits$custo;
|
|
11698
11569
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
11699
11570
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
11700
|
-
if (!
|
|
11571
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
11701
11572
|
return {
|
|
11702
11573
|
hasReachedCustomerGroupsWarningLimit: false,
|
|
11703
11574
|
hasReachedCustomerGroupsErrorLimit: false
|
|
11704
11575
|
};
|
|
11705
11576
|
}
|
|
11706
|
-
const _platformLimits$
|
|
11707
|
-
limit = _platformLimits$
|
|
11708
|
-
current = _platformLimits$
|
|
11577
|
+
const _platformLimits$custo = platformLimits.customerGroups.total,
|
|
11578
|
+
limit = _platformLimits$custo.limit,
|
|
11579
|
+
current = _platformLimits$custo.current;
|
|
11709
11580
|
const hasReachedCustomerGroupsWarningLimit = getHasExceededWarningThreshold({
|
|
11710
11581
|
limit,
|
|
11711
11582
|
current
|
|
@@ -11734,13 +11605,12 @@ const useCustomerGroupsPlatormLimitsModalState = () => {
|
|
|
11734
11605
|
};
|
|
11735
11606
|
|
|
11736
11607
|
const PlatformLimitsCustomerGroupsNotifications = () => {
|
|
11737
|
-
var _platformLimits$custo;
|
|
11738
11608
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
11739
11609
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
11740
11610
|
const _useCustomerGroupsPla2 = useCustomerGroupsPlatformLimitsStatus(),
|
|
11741
11611
|
hasReachedCustomerGroupsWarningLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsWarningLimit,
|
|
11742
11612
|
hasReachedCustomerGroupsErrorLimit = _useCustomerGroupsPla2.hasReachedCustomerGroupsErrorLimit;
|
|
11743
|
-
if (!
|
|
11613
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
11744
11614
|
return jsxRuntime.jsx("div", {});
|
|
11745
11615
|
}
|
|
11746
11616
|
if (hasReachedCustomerGroupsErrorLimit) {
|
|
@@ -11791,16 +11661,15 @@ var styles$4 = {
|
|
|
11791
11661
|
"status": "platform-limits-customer-groups-status-module__status___6099G"
|
|
11792
11662
|
};
|
|
11793
11663
|
const PlatformLimitsCustomerGroupsStatus = () => {
|
|
11794
|
-
var _platformLimits$custo;
|
|
11795
11664
|
const intl = reactIntl.useIntl();
|
|
11796
11665
|
const _useCustomerGroupsPla = useCustomerGroupsPlatformLimitsFetcher(),
|
|
11797
11666
|
platformLimits = _useCustomerGroupsPla.platformLimits;
|
|
11798
|
-
if (!
|
|
11667
|
+
if (!platformLimits?.customerGroups?.total) {
|
|
11799
11668
|
return null;
|
|
11800
11669
|
}
|
|
11801
|
-
const _platformLimits$
|
|
11802
|
-
current = _platformLimits$
|
|
11803
|
-
limit = _platformLimits$
|
|
11670
|
+
const _platformLimits$custo = platformLimits.customerGroups.total,
|
|
11671
|
+
current = _platformLimits$custo.current,
|
|
11672
|
+
limit = _platformLimits$custo.limit;
|
|
11804
11673
|
return jsxRuntime.jsx("div", {
|
|
11805
11674
|
className: styles$4.status,
|
|
11806
11675
|
children: jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
@@ -12046,7 +11915,6 @@ const valueMapping = {
|
|
|
12046
11915
|
all: [true, false]
|
|
12047
11916
|
};
|
|
12048
11917
|
const BooleanField = props => {
|
|
12049
|
-
var _context;
|
|
12050
11918
|
let selectedValue;
|
|
12051
11919
|
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]);
|
|
12052
11920
|
const yesLabel = props.intl.formatMessage(messages$8.yes);
|
|
@@ -12060,7 +11928,7 @@ const BooleanField = props => {
|
|
|
12060
11928
|
}];
|
|
12061
11929
|
if (props.isMulti) options.push({
|
|
12062
11930
|
value: 'all',
|
|
12063
|
-
label:
|
|
11931
|
+
label: `${yesLabel} / ${noLabel}`
|
|
12064
11932
|
});
|
|
12065
11933
|
return jsxRuntime.jsx(uiKit.SelectInput, {
|
|
12066
11934
|
name: props.name,
|
|
@@ -12175,7 +12043,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
12175
12043
|
truncate: true,
|
|
12176
12044
|
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$5.filterWholeInput), {}, {
|
|
12177
12045
|
values: {
|
|
12178
|
-
values: "
|
|
12046
|
+
values: `"${props.value}"`
|
|
12179
12047
|
}
|
|
12180
12048
|
})
|
|
12181
12049
|
})
|
|
@@ -12188,7 +12056,7 @@ const MultiValueSelectorDropdown = props => {
|
|
|
12188
12056
|
truncate: true,
|
|
12189
12057
|
intlMessage: _objectSpread$5(_objectSpread$5({}, messages$5.filterSeparateValues), {}, {
|
|
12190
12058
|
values: {
|
|
12191
|
-
values: "
|
|
12059
|
+
values: `"${props.multiValue.join('", "')}"` || props.value
|
|
12192
12060
|
}
|
|
12193
12061
|
})
|
|
12194
12062
|
})
|
|
@@ -12478,17 +12346,16 @@ function isEmpty(value) {
|
|
|
12478
12346
|
}
|
|
12479
12347
|
|
|
12480
12348
|
const buildSearchQuery = (searchQuery, searchMode, fragments) => {
|
|
12481
|
-
var _fragments$searchMode;
|
|
12482
12349
|
if (!searchQuery) return '';
|
|
12483
12350
|
const buildAllFieldsQueryString = query => {
|
|
12484
12351
|
const fragmentsArray = _Object$values__default["default"](fragments);
|
|
12485
|
-
return
|
|
12352
|
+
return `( ${_mapInstanceProperty__default["default"](fragmentsArray).call(fragmentsArray, fragment => fragment.getQuery(query)).join(' or ')} )`;
|
|
12486
12353
|
};
|
|
12487
12354
|
const trimmedSearchQuery = oneLine__default["default"](searchQuery);
|
|
12488
12355
|
if (searchMode === 'allFields') {
|
|
12489
12356
|
return buildAllFieldsQueryString(trimmedSearchQuery);
|
|
12490
12357
|
}
|
|
12491
|
-
if (!fragments[searchMode] || typeof
|
|
12358
|
+
if (!fragments[searchMode] || typeof fragments[searchMode]?.getQuery !== 'function') {
|
|
12492
12359
|
return '';
|
|
12493
12360
|
}
|
|
12494
12361
|
return fragments[searchMode].getQuery(trimmedSearchQuery);
|
|
@@ -12777,11 +12644,11 @@ function createResourceReducer(options) {
|
|
|
12777
12644
|
|
|
12778
12645
|
// TODO: validate constant keys
|
|
12779
12646
|
const actionsMap = {
|
|
12780
|
-
[
|
|
12647
|
+
[`${plural}_FETCHED`]: (_, action) => ({
|
|
12781
12648
|
currentQueryResult: action.payload
|
|
12782
12649
|
}),
|
|
12783
|
-
[
|
|
12784
|
-
[
|
|
12650
|
+
[`${single}_UPDATED_IN_LIST`]: updateStatusInList(mergeData),
|
|
12651
|
+
[`${single}_DELETED_IN_LIST`]: (state, _ref) => {
|
|
12785
12652
|
let payload = _ref.payload;
|
|
12786
12653
|
const results = state.currentQueryResult.results;
|
|
12787
12654
|
return {
|
|
@@ -12793,27 +12660,27 @@ function createResourceReducer(options) {
|
|
|
12793
12660
|
})
|
|
12794
12661
|
};
|
|
12795
12662
|
},
|
|
12796
|
-
[
|
|
12663
|
+
[`${single}_FETCHED`]: (_, _ref3) => {
|
|
12797
12664
|
let payload = _ref3.payload;
|
|
12798
12665
|
return {
|
|
12799
12666
|
currentVisible: payload
|
|
12800
12667
|
};
|
|
12801
12668
|
},
|
|
12802
|
-
[
|
|
12669
|
+
[`${single}_CREATED`]: (_ref4, _ref5) => {
|
|
12803
12670
|
let currentVisible = _ref4.currentVisible;
|
|
12804
12671
|
let payload = _ref5.payload;
|
|
12805
12672
|
return {
|
|
12806
12673
|
currentVisible: mergeData(payload, currentVisible)
|
|
12807
12674
|
};
|
|
12808
12675
|
},
|
|
12809
|
-
[
|
|
12676
|
+
[`${single}_UPDATED`]: (_ref6, _ref7) => {
|
|
12810
12677
|
let currentVisible = _ref6.currentVisible;
|
|
12811
12678
|
let payload = _ref7.payload;
|
|
12812
12679
|
return {
|
|
12813
12680
|
currentVisible: mergeData(payload, currentVisible)
|
|
12814
12681
|
};
|
|
12815
12682
|
},
|
|
12816
|
-
[
|
|
12683
|
+
[`${single}_DELETED`]: () => ({
|
|
12817
12684
|
currentVisible: null
|
|
12818
12685
|
})
|
|
12819
12686
|
};
|
|
@@ -12830,12 +12697,11 @@ function formatCustomerAddress(_ref) {
|
|
|
12830
12697
|
}
|
|
12831
12698
|
|
|
12832
12699
|
function formatCustomerName(_ref) {
|
|
12833
|
-
var _context;
|
|
12834
12700
|
let firstName = _ref.firstName,
|
|
12835
12701
|
lastName = _ref.lastName;
|
|
12836
12702
|
if (firstName && !lastName) return _trimInstanceProperty__default["default"](firstName).call(firstName);
|
|
12837
12703
|
if (!firstName && lastName) return _trimInstanceProperty__default["default"](lastName).call(lastName);
|
|
12838
|
-
if (firstName && lastName) return
|
|
12704
|
+
if (firstName && lastName) return `${_trimInstanceProperty__default["default"](firstName).call(firstName)} ${_trimInstanceProperty__default["default"](lastName).call(lastName)}`;
|
|
12839
12705
|
return constants.NO_VALUE_FALLBACK;
|
|
12840
12706
|
}
|
|
12841
12707
|
|
|
@@ -12864,23 +12730,21 @@ function base64ToString(value) {
|
|
|
12864
12730
|
}
|
|
12865
12731
|
|
|
12866
12732
|
const composeNumberPredicateFromFilter = (target, value, option) => {
|
|
12867
|
-
var _context, _context2, _context3, _context4, _context5, _context6;
|
|
12868
12733
|
switch (option) {
|
|
12869
12734
|
case FILTER_TYPES.lessThan:
|
|
12870
|
-
return
|
|
12735
|
+
return `${target} < ${value}`;
|
|
12871
12736
|
case FILTER_TYPES.moreThan:
|
|
12872
|
-
return
|
|
12737
|
+
return `${target} > ${value}`;
|
|
12873
12738
|
case FILTER_TYPES.equalTo:
|
|
12874
|
-
return
|
|
12739
|
+
return `${target} = ${value}`;
|
|
12875
12740
|
case FILTER_TYPES.range:
|
|
12876
|
-
return
|
|
12741
|
+
return `${target} >= ${value.from} and ${target} <= ${value.to}`;
|
|
12877
12742
|
default:
|
|
12878
12743
|
return '';
|
|
12879
12744
|
}
|
|
12880
12745
|
};
|
|
12881
12746
|
function customFields (filter, locale) {
|
|
12882
12747
|
const customFieldsPredicates = _mapInstanceProperty__default["default"](filter).call(filter, customFieldFilter => {
|
|
12883
|
-
var _context7, _context8, _context9, _context10, _context11;
|
|
12884
12748
|
const _customFieldFilter$va = customFieldFilter.value,
|
|
12885
12749
|
target = _customFieldFilter$va.target,
|
|
12886
12750
|
type = _customFieldFilter$va.type,
|
|
@@ -12888,14 +12752,14 @@ function customFields (filter, locale) {
|
|
|
12888
12752
|
option = _customFieldFilter$va.option;
|
|
12889
12753
|
switch (type.name) {
|
|
12890
12754
|
case FIELD_TYPES.Boolean:
|
|
12891
|
-
return
|
|
12755
|
+
return `${target} = ${value.value}`;
|
|
12892
12756
|
case FIELD_TYPES.String:
|
|
12893
|
-
return
|
|
12757
|
+
return `${target} = "${value}"`;
|
|
12894
12758
|
case FIELD_TYPES.LocalizedString:
|
|
12895
|
-
return
|
|
12759
|
+
return `${target}(${localizedTextTransformer(value)})`;
|
|
12896
12760
|
case FIELD_TYPES.Enum:
|
|
12897
12761
|
case FIELD_TYPES.LocalizedEnum:
|
|
12898
|
-
return
|
|
12762
|
+
return `${target} = "${value.value}"`;
|
|
12899
12763
|
case FIELD_TYPES.Time:
|
|
12900
12764
|
return timeTransformer(target, [{
|
|
12901
12765
|
type: option,
|
|
@@ -12910,14 +12774,14 @@ function customFields (filter, locale) {
|
|
|
12910
12774
|
case FIELD_TYPES.Number:
|
|
12911
12775
|
return composeNumberPredicateFromFilter(target, value, option);
|
|
12912
12776
|
case FIELD_TYPES.Money:
|
|
12913
|
-
return
|
|
12777
|
+
return `${target}(${moneyTransformer(value, option, locale)})`;
|
|
12914
12778
|
case FIELD_TYPES.Reference:
|
|
12915
12779
|
case FIELD_TYPES.Set:
|
|
12916
12780
|
default:
|
|
12917
12781
|
throw new Error('Custom field type not recognized');
|
|
12918
12782
|
}
|
|
12919
12783
|
});
|
|
12920
|
-
return
|
|
12784
|
+
return `(custom(fields(${customFieldsPredicates.join(' and ')})))`;
|
|
12921
12785
|
}
|
|
12922
12786
|
|
|
12923
12787
|
/**
|
|
@@ -12958,10 +12822,8 @@ function graphqlQueryBuilder(_ref) {
|
|
|
12958
12822
|
}
|
|
12959
12823
|
|
|
12960
12824
|
function numberTransformer(filterKey, filters) {
|
|
12961
|
-
var _context3;
|
|
12962
12825
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$2;
|
|
12963
12826
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
12964
|
-
var _context, _context2;
|
|
12965
12827
|
let type = _ref.type,
|
|
12966
12828
|
value = _ref.value;
|
|
12967
12829
|
if (!filterValidator({
|
|
@@ -12970,19 +12832,19 @@ function numberTransformer(filterKey, filters) {
|
|
|
12970
12832
|
})) return '';
|
|
12971
12833
|
switch (type) {
|
|
12972
12834
|
case 'lessThan':
|
|
12973
|
-
return
|
|
12835
|
+
return `(* to ${_parseInt__default["default"](value) - 1})`;
|
|
12974
12836
|
case 'moreThan':
|
|
12975
|
-
return
|
|
12837
|
+
return `(${_parseInt__default["default"](value) + 1} to *)`;
|
|
12976
12838
|
case 'equalTo':
|
|
12977
|
-
return
|
|
12839
|
+
return `(${value} to ${value})`;
|
|
12978
12840
|
case 'range':
|
|
12979
|
-
return
|
|
12841
|
+
return `(${value.from} to ${value.to})`;
|
|
12980
12842
|
default:
|
|
12981
12843
|
return '';
|
|
12982
12844
|
}
|
|
12983
12845
|
});
|
|
12984
12846
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
12985
|
-
return queryString === '' ? null :
|
|
12847
|
+
return queryString === '' ? null : `${filterKey}: range${queryString}`;
|
|
12986
12848
|
}
|
|
12987
12849
|
function isFilterValid$2(_ref2) {
|
|
12988
12850
|
let type = _ref2.type,
|
|
@@ -13009,11 +12871,9 @@ function graphqlCategoryLevelTransformer(filterKey, filters, filterValidator) {
|
|
|
13009
12871
|
return _filterInstanceProperty__default["default"](_context = [levelFilterQuery, lastLevelFilterQuery]).call(_context, Boolean);
|
|
13010
12872
|
}
|
|
13011
12873
|
|
|
13012
|
-
var _templateObject, _templateObject2;
|
|
13013
12874
|
const dateFormatDayStart = 'YYYY-MM-DDT00:00:00.000Z';
|
|
13014
12875
|
const dateFormatDayEnd = 'YYYY-MM-DDT23:59:59.999Z';
|
|
13015
12876
|
function dateTransformer(filterKey, filters) {
|
|
13016
|
-
var _context;
|
|
13017
12877
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid$1;
|
|
13018
12878
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
13019
12879
|
let type = _ref.type,
|
|
@@ -13024,19 +12884,25 @@ function dateTransformer(filterKey, filters) {
|
|
|
13024
12884
|
})) return '';
|
|
13025
12885
|
switch (type) {
|
|
13026
12886
|
case 'lessThan':
|
|
13027
|
-
return
|
|
12887
|
+
return `(* to "${moment__default["default"](value).format(dateFormatDayStart)}")`;
|
|
13028
12888
|
case 'moreThan':
|
|
13029
|
-
return
|
|
12889
|
+
return `("${moment__default["default"](value).format(dateFormatDayEnd)}" to *)`;
|
|
13030
12890
|
case 'equalTo':
|
|
13031
|
-
return oneLine__default["default"]
|
|
12891
|
+
return oneLine__default["default"]`
|
|
12892
|
+
("${moment__default["default"](value).format(dateFormatDayStart)}"
|
|
12893
|
+
to "${moment__default["default"](value).format(dateFormatDayEnd)}")
|
|
12894
|
+
`;
|
|
13032
12895
|
case 'range':
|
|
13033
|
-
return oneLine__default["default"]
|
|
12896
|
+
return oneLine__default["default"]`
|
|
12897
|
+
("${moment__default["default"](value.from).format(dateFormatDayStart)}"
|
|
12898
|
+
to "${moment__default["default"](value.to).format(dateFormatDayEnd)}")
|
|
12899
|
+
`;
|
|
13034
12900
|
default:
|
|
13035
12901
|
return '';
|
|
13036
12902
|
}
|
|
13037
12903
|
});
|
|
13038
12904
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
13039
|
-
return queryString === '' ? null :
|
|
12905
|
+
return queryString === '' ? null : `${filterKey}: range${queryString}`;
|
|
13040
12906
|
}
|
|
13041
12907
|
function isFilterValid$1(_ref2) {
|
|
13042
12908
|
let type = _ref2.type,
|
|
@@ -13054,20 +12920,18 @@ function missingTransformer(filterKey, filters) {
|
|
|
13054
12920
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
13055
12921
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
13056
12922
|
if (filters.length === 0) return null;
|
|
13057
|
-
return
|
|
12923
|
+
return `${filterKey}:missing`;
|
|
13058
12924
|
}
|
|
13059
12925
|
|
|
13060
12926
|
function missingLocaleTransformer(filterKey, filters) {
|
|
13061
|
-
var _context;
|
|
13062
12927
|
// Note: we assume for now that there can only be 1 missing filter value,
|
|
13063
12928
|
// as the API doesn't support yet multiple OR values (for missing).
|
|
13064
12929
|
if (filters.length === 0) return null;
|
|
13065
12930
|
const missingLocale = filters[0].value.value;
|
|
13066
|
-
return
|
|
12931
|
+
return `${filterKey}.${missingLocale}:missing`;
|
|
13067
12932
|
}
|
|
13068
12933
|
|
|
13069
12934
|
function referenceTransformer(filterKey, filters) {
|
|
13070
|
-
var _context;
|
|
13071
12935
|
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFilterValid;
|
|
13072
12936
|
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
13073
12937
|
let type = _ref.type,
|
|
@@ -13078,29 +12942,28 @@ function referenceTransformer(filterKey, filters) {
|
|
|
13078
12942
|
})) return '';
|
|
13079
12943
|
switch (type) {
|
|
13080
12944
|
case 'equalTo':
|
|
13081
|
-
return "
|
|
12945
|
+
return `"${value}"`;
|
|
13082
12946
|
default:
|
|
13083
12947
|
return '';
|
|
13084
12948
|
}
|
|
13085
12949
|
});
|
|
13086
12950
|
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(', ');
|
|
13087
|
-
return queryString === '' ? null :
|
|
12951
|
+
return queryString === '' ? null : `${filterKey}.id: ${queryString}`;
|
|
13088
12952
|
}
|
|
13089
12953
|
function isFilterValid(_ref2) {
|
|
13090
|
-
var
|
|
12954
|
+
var _context;
|
|
13091
12955
|
let type = _ref2.type,
|
|
13092
12956
|
value = _ref2.value;
|
|
13093
|
-
if (type === 'equalTo' && !_includesInstanceProperty__default["default"](
|
|
12957
|
+
if (type === 'equalTo' && !_includesInstanceProperty__default["default"](_context = [null, undefined, '']).call(_context, value)) return true;
|
|
13094
12958
|
return false;
|
|
13095
12959
|
}
|
|
13096
12960
|
|
|
13097
12961
|
function textTransformer(filterKey, queries) {
|
|
13098
|
-
var _context;
|
|
13099
12962
|
if (queries.length === 0) return null;
|
|
13100
12963
|
|
|
13101
12964
|
// Note: we assume for now that there can only be 1 text filter.
|
|
13102
12965
|
const queryValue = queries[0].value;
|
|
13103
|
-
return queryValue ?
|
|
12966
|
+
return queryValue ? `${filterKey}:"${queryValue}"` : null;
|
|
13104
12967
|
}
|
|
13105
12968
|
|
|
13106
12969
|
function isValidISOTime(_ref) {
|
|
@@ -13185,8 +13048,8 @@ function validateFilter$2(_ref, intl) {
|
|
|
13185
13048
|
};
|
|
13186
13049
|
}
|
|
13187
13050
|
if (value.option === FILTER_TYPES.range) {
|
|
13188
|
-
const from = validateValue(filterValue
|
|
13189
|
-
const to = from ? null : validateValue(filterValue
|
|
13051
|
+
const from = validateValue(filterValue?.from, typeName, intl);
|
|
13052
|
+
const to = from ? null : validateValue(filterValue?.to, typeName, intl);
|
|
13190
13053
|
return from || to ? {
|
|
13191
13054
|
input: {
|
|
13192
13055
|
from,
|
|
@@ -13223,16 +13086,16 @@ function validateFilter$1(_ref, intl) {
|
|
|
13223
13086
|
type = _ref.type;
|
|
13224
13087
|
if (type === 'range') {
|
|
13225
13088
|
if (validateSingleFilter({
|
|
13226
|
-
value: value
|
|
13089
|
+
value: value?.from
|
|
13227
13090
|
})) return {
|
|
13228
13091
|
from: intl.formatMessage(messages$2.rangeMissingValue)
|
|
13229
13092
|
};
|
|
13230
13093
|
if (validateSingleFilter({
|
|
13231
|
-
value: value
|
|
13094
|
+
value: value?.to
|
|
13232
13095
|
})) return {
|
|
13233
13096
|
to: intl.formatMessage(messages$2.rangeMissingValue)
|
|
13234
13097
|
};
|
|
13235
|
-
if (moment__default["default"](value
|
|
13098
|
+
if (moment__default["default"](value?.to).isBefore(value?.from)) return {
|
|
13236
13099
|
from: intl.formatMessage(messages$2.rangeToSmallerThanFrom)
|
|
13237
13100
|
};
|
|
13238
13101
|
} else if (type === 'equalTo' || type === 'lessThan' || type === 'moreThan') {
|
|
@@ -13309,14 +13172,14 @@ const validateText = function (text, intl) {
|
|
|
13309
13172
|
|
|
13310
13173
|
function formatDiscount(discount, currencyCode, intl) {
|
|
13311
13174
|
var _context;
|
|
13312
|
-
if (discount.type === 'relative') return
|
|
13175
|
+
if (discount.type === 'relative') return `${discount.permyriad / 100}%`;
|
|
13313
13176
|
if (!discount.money) return null;
|
|
13314
13177
|
const moneyForCurrencyCode = _findInstanceProperty__default["default"](_context = discount.money).call(_context, discountMoney => discountMoney.currencyCode === currencyCode);
|
|
13315
13178
|
return moneyForCurrencyCode ? formatMoney$2(moneyForCurrencyCode, intl) : null;
|
|
13316
13179
|
}
|
|
13317
13180
|
|
|
13318
13181
|
function formatPercentage(percentage) {
|
|
13319
|
-
return
|
|
13182
|
+
return `${percentage}%`;
|
|
13320
13183
|
}
|
|
13321
13184
|
function convertRatioToPercentage(ratio) {
|
|
13322
13185
|
return _parseFloat__default["default"]((ratio * 100).toFixed(2));
|
|
@@ -13330,10 +13193,7 @@ function convertRatioToPercentage(ratio) {
|
|
|
13330
13193
|
* @returns {boolean}
|
|
13331
13194
|
*/
|
|
13332
13195
|
const hasErrorCode = (unmappedApiErrors, errorCode) => {
|
|
13333
|
-
return _Array$isArray__default["default"](unmappedApiErrors) && _someInstanceProperty__default["default"](unmappedApiErrors).call(unmappedApiErrors, error =>
|
|
13334
|
-
var _error$extensions;
|
|
13335
|
-
return ((_error$extensions = error.extensions) === null || _error$extensions === void 0 ? void 0 : _error$extensions.code) === errorCode;
|
|
13336
|
-
});
|
|
13196
|
+
return _Array$isArray__default["default"](unmappedApiErrors) && _someInstanceProperty__default["default"](unmappedApiErrors).call(unmappedApiErrors, error => error.extensions?.code === errorCode);
|
|
13337
13197
|
};
|
|
13338
13198
|
|
|
13339
13199
|
const hasInvalidInputError = errors => hasErrorCode(errors, ERROR_CODES.invalidInput);
|
|
@@ -13345,7 +13205,7 @@ function minusify(value) {
|
|
|
13345
13205
|
return minus.concat(value);
|
|
13346
13206
|
}
|
|
13347
13207
|
|
|
13348
|
-
const flattenOperator = (operator, clauses) => compact__default["default"](_reduceInstanceProperty__default["default"](clauses).call(clauses, (result, clause) => _concatInstanceProperty__default["default"](result).call(result,
|
|
13208
|
+
const flattenOperator = (operator, clauses) => compact__default["default"](_reduceInstanceProperty__default["default"](clauses).call(clauses, (result, clause) => _concatInstanceProperty__default["default"](result).call(result, clause?.[operator] || clause), []));
|
|
13349
13209
|
const argsToArray = args => _reduceInstanceProperty__default["default"](args).call(args, (result, item) => _concatInstanceProperty__default["default"](result).call(result, item), []);
|
|
13350
13210
|
const exists = (field, attributeType) => ({
|
|
13351
13211
|
exists: {
|
|
@@ -13402,7 +13262,7 @@ const not = function () {
|
|
|
13402
13262
|
|
|
13403
13263
|
const safelyAddFallback = function (string) {
|
|
13404
13264
|
let fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : constants.NO_VALUE_FALLBACK;
|
|
13405
|
-
return string === '' ? fallback : string
|
|
13265
|
+
return string === '' ? fallback : string ?? fallback;
|
|
13406
13266
|
};
|
|
13407
13267
|
|
|
13408
13268
|
var messages = reactIntl.defineMessages({
|
|
@@ -13537,19 +13397,19 @@ const computedProperties = {
|
|
|
13537
13397
|
// has been deleted. See MC-1925 for further information.
|
|
13538
13398
|
const filteredCategories = _filterInstanceProperty__default["default"](_context6 = product.categories).call(_context6, category => category.obj !== undefined);
|
|
13539
13399
|
return _mapInstanceProperty__default["default"](filteredCategories).call(filteredCategories, category => {
|
|
13540
|
-
var _context7;
|
|
13541
13400
|
const categoryPath = getPathName(category, language, languages);
|
|
13542
13401
|
const ancestors = getAncestors(category, language);
|
|
13543
|
-
const externalIdValue = category.obj.externalId ?
|
|
13402
|
+
const externalIdValue = category.obj.externalId ?
|
|
13403
|
+
// hardcoding "ext. ID" since this is not part of a message to be
|
|
13544
13404
|
// translated. This has been communicated with Jenn
|
|
13545
|
-
|
|
13405
|
+
`| ext. ID: ${category.obj.externalId}` : '';
|
|
13546
13406
|
return {
|
|
13547
13407
|
id: category.id,
|
|
13548
|
-
name:
|
|
13408
|
+
name: `${l10n.formatLocalizedString(category.obj, {
|
|
13549
13409
|
key: 'name',
|
|
13550
13410
|
locale: language,
|
|
13551
13411
|
fallbackOrder: languages
|
|
13552
|
-
})
|
|
13412
|
+
})} ${externalIdValue}`,
|
|
13553
13413
|
path: categoryPath,
|
|
13554
13414
|
level: ancestors.length
|
|
13555
13415
|
};
|
|
@@ -13586,13 +13446,13 @@ const getAttributeValueByType = _ref12 => {
|
|
|
13586
13446
|
value: value
|
|
13587
13447
|
});
|
|
13588
13448
|
case 'enum':
|
|
13589
|
-
return safelyAddFallback(value.label,
|
|
13449
|
+
return safelyAddFallback(value.label, `${value.key} (key)`);
|
|
13590
13450
|
case 'lenum':
|
|
13591
13451
|
return safelyAddFallback(l10n.formatLocalizedString(value, {
|
|
13592
13452
|
key: 'label',
|
|
13593
13453
|
locale: projectDataLocale,
|
|
13594
13454
|
fallbackOrder: projectLanguages
|
|
13595
|
-
}),
|
|
13455
|
+
}), `${value.key} (key)`);
|
|
13596
13456
|
case 'number':
|
|
13597
13457
|
return safelyAddFallback(value);
|
|
13598
13458
|
case 'boolean':
|
|
@@ -13714,7 +13574,6 @@ const reorderArrayItems = (array, from, to) => {
|
|
|
13714
13574
|
const mapTimeZonesToOptions = memoize__default["default"](timeZones => {
|
|
13715
13575
|
var _context;
|
|
13716
13576
|
return _mapInstanceProperty__default["default"](_context = _Object$entries__default["default"](timeZones)).call(_context, _ref => {
|
|
13717
|
-
var _context2;
|
|
13718
13577
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
13719
13578
|
code = _ref2[0],
|
|
13720
13579
|
value = _ref2[1];
|
|
@@ -13723,7 +13582,7 @@ const mapTimeZonesToOptions = memoize__default["default"](timeZones => {
|
|
|
13723
13582
|
//E.g. `(GMT +02:00) Central European Time - Berlin`
|
|
13724
13583
|
// unicode clock hex code: \u25F7
|
|
13725
13584
|
//
|
|
13726
|
-
label:
|
|
13585
|
+
label: `(GMT ${value.offset}) ${value.name}`
|
|
13727
13586
|
};
|
|
13728
13587
|
});
|
|
13729
13588
|
});
|
|
@@ -13731,12 +13590,9 @@ const getTimeZoneId = memoize__default["default"]((selectedTimeZone, timeZones)
|
|
|
13731
13590
|
if (timeZones[selectedTimeZone]) {
|
|
13732
13591
|
return selectedTimeZone;
|
|
13733
13592
|
} else {
|
|
13734
|
-
var
|
|
13735
|
-
const fallbackTimeZoneId = _findInstanceProperty__default["default"](
|
|
13736
|
-
|
|
13737
|
-
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);
|
|
13738
|
-
});
|
|
13739
|
-
if (fallbackTimeZoneId !== null && fallbackTimeZoneId !== void 0 && fallbackTimeZoneId.length) {
|
|
13593
|
+
var _context2;
|
|
13594
|
+
const fallbackTimeZoneId = _findInstanceProperty__default["default"](_context2 = _Object$keys__default["default"](timeZones)).call(_context2, timeZoneId => timeZones[timeZoneId]?.translationFor?.some(fallbackTimeZone => fallbackTimeZone === selectedTimeZone));
|
|
13595
|
+
if (fallbackTimeZoneId?.length) {
|
|
13740
13596
|
return fallbackTimeZoneId.toString();
|
|
13741
13597
|
} else {
|
|
13742
13598
|
return 'UTC';
|
|
@@ -13744,21 +13600,19 @@ const getTimeZoneId = memoize__default["default"]((selectedTimeZone, timeZones)
|
|
|
13744
13600
|
}
|
|
13745
13601
|
});
|
|
13746
13602
|
const getTimeZoneLabel = memoize__default["default"]((selectedTimeZone, timeZones) => {
|
|
13747
|
-
var _context4;
|
|
13748
13603
|
const timeZoneId = getTimeZoneId(selectedTimeZone, timeZones);
|
|
13749
13604
|
const timeZoneData = timeZones[timeZoneId];
|
|
13750
|
-
return
|
|
13605
|
+
return `(GMT ${timeZoneData.offset}) ${timeZoneData.name}`;
|
|
13751
13606
|
});
|
|
13752
13607
|
|
|
13753
13608
|
const DEFAULT_LENGTH = 50;
|
|
13754
13609
|
const DEFAULT_END = '...';
|
|
13755
13610
|
function truncate (text) {
|
|
13756
|
-
var _context;
|
|
13757
13611
|
let length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_LENGTH;
|
|
13758
13612
|
let end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_END;
|
|
13759
13613
|
if (!text) return '';
|
|
13760
13614
|
if (text.length < length) return text;
|
|
13761
|
-
return
|
|
13615
|
+
return `${text.substring(0, length)}${end}`;
|
|
13762
13616
|
}
|
|
13763
13617
|
|
|
13764
13618
|
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; }
|