@commercetools-frontend/experimental-components 6.4.6 → 7.0.0
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 +1310 -1094
- package/dist/commercetools-frontend-experimental-components.cjs.prod.js +1309 -1093
- package/dist/commercetools-frontend-experimental-components.esm.js +1292 -1090
- package/dist/declarations/src/components/channel-picker-input/channel-picker-input.d.ts +3 -3
- package/dist/declarations/src/components/divider/divider.d.ts +2 -2
- package/dist/declarations/src/components/formatted-date-time/formatted-date-time.d.ts +0 -1
- package/dist/declarations/src/components/recurrent-interval-picker/index.d.ts +2 -0
- package/dist/declarations/src/components/recurrent-interval-picker/recurrent-interval-picker.d.ts +13 -0
- package/dist/declarations/src/components/recurrent-interval-picker/use-recurrence-intervals/index.d.ts +1 -0
- package/dist/declarations/src/{hooks → components/recurrent-interval-picker}/use-recurrence-intervals/use-recurrence-intervals.d.ts +6 -1
- package/dist/declarations/src/components/store-select-input/constants.d.ts +2 -0
- package/dist/declarations/src/components/validated-input/validated-input.d.ts +7 -38
- package/dist/declarations/src/constants/index.d.ts +1 -0
- package/dist/declarations/src/custom-fields/custom-field-definitions-connector/custom-field-definitions-connector.d.ts +0 -1
- package/dist/declarations/src/custom-fields/custom-field-type-definitions-connector/custom-field-type-definitions-connector.d.ts +0 -1
- package/dist/declarations/src/custom-fields/custom-fields/constants.d.ts +36 -0
- package/dist/declarations/src/custom-fields/custom-fields/custom-field-input.d.ts +2 -0
- package/dist/declarations/src/custom-fields/custom-fields/index.d.ts +2 -1
- package/dist/declarations/src/features/picker/shared/hooks/use-load-options.d.ts +1 -1
- package/dist/declarations/src/features/picker/shared/hooks/use-product-type-options.d.ts +2 -2
- package/dist/declarations/src/features/pim-indexer/components/pim-indexer-provider/pim-indexer-provider.d.ts +0 -1
- package/dist/declarations/src/features/pim-indexer/components/with-pim-indexer/with-pim-indexer.d.ts +0 -1
- package/dist/declarations/src/features/platform-limits/business-units/hooks/index.d.ts +2 -0
- package/dist/declarations/src/features/platform-limits/business-units/hooks/use-business-units-platform-limits/index.d.ts +1 -0
- package/dist/declarations/src/features/platform-limits/business-units/hooks/use-business-units-platform-limits/use-business-units-platform-limits.d.ts +10 -0
- package/dist/declarations/src/features/platform-limits/business-units/hooks/use-business-units-platform-limits-fetcher/index.d.ts +1 -0
- package/dist/declarations/src/features/platform-limits/business-units/hooks/use-business-units-platform-limits-fetcher/use-business-units-platform-limits-fetcher.d.ts +12 -0
- package/dist/declarations/src/features/platform-limits/business-units/index.d.ts +1 -0
- package/dist/declarations/src/features/platform-limits/customer-groups/hooks/use-customer-groups-platform-limits/use-customer-groups-platform-limits.d.ts +1 -1
- package/dist/declarations/src/features/platform-limits/customer-groups/hooks/use-customer-groups-platform-limits-fetcher/use-customer-groups-platform-limits-fetcher.d.ts +1 -1
- package/dist/declarations/src/features/platform-limits/customers/hooks/use-customers-platform-limits/use-customers-platform-limits.d.ts +2 -1
- package/dist/declarations/src/features/platform-limits/customers/hooks/use-customers-platform-limits-fetcher/use-customers-platform-limits-fetcher.d.ts +1 -1
- package/dist/declarations/src/features/platform-limits/index.d.ts +3 -0
- package/dist/declarations/src/features/platform-limits/shared/components/index.d.ts +2 -0
- package/dist/declarations/src/features/platform-limits/shared/components/notifications/error/error.d.ts +12 -0
- package/dist/declarations/src/features/platform-limits/shared/components/notifications/error/index.d.ts +1 -0
- package/dist/declarations/src/features/platform-limits/shared/components/notifications/index.d.ts +1 -0
- package/dist/declarations/src/features/platform-limits/shared/components/notifications/notifications.d.ts +7 -0
- package/dist/declarations/src/features/platform-limits/shared/components/notifications/warning/index.d.ts +1 -0
- package/dist/declarations/src/features/platform-limits/shared/components/notifications/warning/warning.d.ts +12 -0
- package/dist/declarations/src/features/platform-limits/shared/components/status-text/index.d.ts +1 -0
- package/dist/declarations/src/features/platform-limits/shared/components/status-text/status-text.d.ts +12 -0
- package/dist/declarations/src/features/platform-limits/shared/constants.d.ts +13 -0
- package/dist/declarations/src/features/platform-limits/shared/hooks/index.d.ts +3 -0
- package/dist/declarations/src/features/platform-limits/shared/hooks/use-intercept-navigation/index.d.ts +1 -0
- package/dist/declarations/src/features/platform-limits/shared/hooks/use-intercept-navigation/use-intercept-navigation.d.ts +7 -0
- package/dist/declarations/src/features/platform-limits/shared/hooks/use-limits-modal-state/index.d.ts +1 -0
- package/dist/declarations/src/features/platform-limits/shared/hooks/use-limits-modal-state/use-limits-modal-state.d.ts +6 -0
- package/dist/declarations/src/features/platform-limits/shared/hooks/use-platform-limits-fetcher/index.d.ts +3 -0
- package/dist/declarations/src/features/platform-limits/shared/hooks/use-platform-limits-fetcher/platform-limits-query-variables.d.ts +2 -0
- package/dist/declarations/src/features/platform-limits/shared/hooks/use-platform-limits-fetcher/use-platform-limits-fetcher.d.ts +7 -0
- package/dist/declarations/src/features/platform-limits/shared/index.d.ts +4 -0
- package/dist/declarations/src/features/platform-limits/shared/utils/index.d.ts +1 -0
- package/dist/declarations/src/features/platform-limits/shared/utils/utils.d.ts +14 -0
- package/dist/declarations/src/features/platform-limits/shipping-methods/hooks/use-shipping-methods-platform-limits/use-shipping-methods-platform-limits.d.ts +1 -1
- package/dist/declarations/src/features/platform-limits/shipping-methods/hooks/use-shipping-methods-platform-limits-fetcher/use-shipping-methods-platform-limits-fetcher.d.ts +1 -1
- package/dist/declarations/src/features/platform-limits/stores/hooks/index.d.ts +3 -0
- package/dist/declarations/src/features/platform-limits/stores/hooks/use-store-platform-limits/index.d.ts +1 -0
- package/dist/declarations/src/features/platform-limits/stores/hooks/use-store-platform-limits/use-store-platform-limits.d.ts +15 -0
- package/dist/declarations/src/features/platform-limits/stores/hooks/use-store-platform-limits-fetcher/index.d.ts +1 -0
- package/dist/declarations/src/features/platform-limits/stores/hooks/use-store-platform-limits-fetcher/use-store-platform-limits-fetcher.d.ts +13 -0
- package/dist/declarations/src/features/platform-limits/stores/hooks/use-store-platform-limits-status/index.d.ts +1 -0
- package/dist/declarations/src/features/platform-limits/stores/hooks/use-store-platform-limits-status/use-store-platform-limits-status.d.ts +5 -0
- package/dist/declarations/src/features/platform-limits/stores/index.d.ts +1 -0
- package/dist/declarations/src/features/platform-limits/tax-categories/hooks/use-tax-categories-platform-limits/use-tax-categories-platform-limits.d.ts +1 -1
- package/dist/declarations/src/features/platform-limits/tax-categories/hooks/use-tax-categories-platform-limits-fetcher/use-tax-categories-platform-limits-fetcher.d.ts +1 -1
- package/dist/declarations/src/features/platform-limits/zones/hooks/use-zones-platform-limits/use-zones-platform-limits.d.ts +1 -1
- package/dist/declarations/src/features/platform-limits/zones/hooks/use-zones-platform-limits-fetcher/use-zones-platform-limits-fetcher.d.ts +1 -1
- package/dist/declarations/src/fields/numeric-format-input/numeric-format-input.d.ts +0 -1
- package/dist/declarations/src/fields/search-input/search-input.d.ts +0 -1
- package/dist/declarations/src/fields/throttled-field/throttled-field.d.ts +0 -1
- package/dist/declarations/src/hooks/index.d.ts +0 -2
- package/dist/declarations/src/hooks/use-persisted-reminder/use-persisted-reminder.d.ts +1 -1
- package/dist/declarations/src/hooks/use-previous/use-previous.d.ts +1 -1
- package/dist/declarations/src/hooks/use-product-selections-fetcher/use-product-selections-fetcher.d.ts +1 -6
- package/dist/declarations/src/hooks/use-stores-list-fetcher/use-stores-list-fetcher.d.ts +1 -8
- package/dist/declarations/src/index.d.ts +10 -8
- package/dist/declarations/src/utils/type-definitions/type-definitions.d.ts +1 -1
- package/dist/styles.css +118 -118
- package/package.json +25 -28
- package/dist/declarations/src/hooks/use-did-form-validation-fail/index.d.ts +0 -1
- package/dist/declarations/src/hooks/use-did-form-validation-fail/use-did-form-validation-fail.d.ts +0 -1
|
@@ -76,7 +76,7 @@ var applicationShell = require('@commercetools-frontend/application-shell');
|
|
|
76
76
|
var _ = require('@commercetools-frontend/ui-kit/');
|
|
77
77
|
var PropTypes = require('prop-types');
|
|
78
78
|
var react$1 = require('@emotion/react');
|
|
79
|
-
var
|
|
79
|
+
var dnd = require('@hello-pangea/dnd');
|
|
80
80
|
var ReactDOM = require('react-dom');
|
|
81
81
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
82
82
|
var selectUtils = require('@commercetools-uikit/select-utils');
|
|
@@ -229,6 +229,9 @@ const CenteredLoadingSpinner = () => jsxRuntime.jsx("div", {
|
|
|
229
229
|
CenteredLoadingSpinner.displayName = 'CenteredLoadingSpinner';
|
|
230
230
|
var CenteredLoadingSpinner$1 = CenteredLoadingSpinner;
|
|
231
231
|
|
|
232
|
+
const LOWER_STORES_LIMIT = 60;
|
|
233
|
+
const UPPER_STORES_LIMIT = 500;
|
|
234
|
+
|
|
232
235
|
const QUERY_MAX_LIMIT = 500;
|
|
233
236
|
const SHOW_TOOLTIP_CHARS_COUNT = 40;
|
|
234
237
|
const SEARCHABLE_REFERENCES = {
|
|
@@ -272,7 +275,7 @@ const PRODUCT_TAILORING_FOR_ATTRIBUTES_FALLBACK_VALUES = 'productTailoringForAtt
|
|
|
272
275
|
// TODO: apply a more robust solution to overlaying issues
|
|
273
276
|
const Z_INDEX_DROPDOWN = 30000;
|
|
274
277
|
|
|
275
|
-
var
|
|
278
|
+
var commonPickerMessages = reactIntl.defineMessages({
|
|
276
279
|
loadingErrorMessage: {
|
|
277
280
|
id: 'Pickers.loadingErrorMessage',
|
|
278
281
|
description: 'Message shown to used when picker fails to load data from server.',
|
|
@@ -285,7 +288,7 @@ var pickerMessages$1 = reactIntl.defineMessages({
|
|
|
285
288
|
}
|
|
286
289
|
});
|
|
287
290
|
|
|
288
|
-
var messages$
|
|
291
|
+
var messages$S = reactIntl.defineMessages({
|
|
289
292
|
noChannelsFound: {
|
|
290
293
|
id: 'Products.ChannelPickerInput.noChannelsFound',
|
|
291
294
|
description: 'The message to display when no channels were found',
|
|
@@ -307,16 +310,19 @@ const getRolesClause = roles => roles && roles.length > 0 ? `roles contains any
|
|
|
307
310
|
const ChannelPickerInput = _ref => {
|
|
308
311
|
let isClearable = _ref.isClearable,
|
|
309
312
|
isDisabled = _ref.isDisabled,
|
|
310
|
-
isReadOnly = _ref.isReadOnly,
|
|
313
|
+
_ref$isReadOnly = _ref.isReadOnly,
|
|
314
|
+
isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
|
|
311
315
|
onChange = _ref.onChange,
|
|
312
316
|
name = _ref.name,
|
|
313
317
|
onBlur = _ref.onBlur,
|
|
314
318
|
value = _ref.value,
|
|
315
319
|
hasError = _ref.hasError,
|
|
316
|
-
onError = _ref.onError,
|
|
320
|
+
_ref$onError = _ref.onError,
|
|
321
|
+
onError = _ref$onError === void 0 ? null : _ref$onError,
|
|
317
322
|
placeholder = _ref.placeholder,
|
|
318
323
|
roles = _ref.roles,
|
|
319
|
-
hasWarning = _ref.hasWarning,
|
|
324
|
+
_ref$hasWarning = _ref.hasWarning,
|
|
325
|
+
hasWarning = _ref$hasWarning === void 0 ? false : _ref$hasWarning,
|
|
320
326
|
_ref$isMulti = _ref.isMulti,
|
|
321
327
|
isMulti = _ref$isMulti === void 0 ? false : _ref$isMulti;
|
|
322
328
|
const formatLocalizedFieldToString = useFormatLocalizedFieldToString();
|
|
@@ -400,7 +406,7 @@ const ChannelPickerInput = _ref => {
|
|
|
400
406
|
if (isCurrentOptionLoadingFailed && onError) onError(currentOptions.error);
|
|
401
407
|
}, [isCurrentOptionLoadingFailed, onError, currentOptions]);
|
|
402
408
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
403
|
-
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$
|
|
409
|
+
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$S.noChannelsFound), [loadingError, formatMessage]);
|
|
404
410
|
const tooltipTitle = !isMulti ? currentSingleOption?.data?.label ?? '' : '';
|
|
405
411
|
const selectedValue = currentOptions.data ?? (isMulti ? [] : null);
|
|
406
412
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
@@ -412,7 +418,7 @@ const ChannelPickerInput = _ref => {
|
|
|
412
418
|
children: jsxRuntime.jsx(uiKit.AsyncSelectInput, {
|
|
413
419
|
id: name,
|
|
414
420
|
name: name,
|
|
415
|
-
placeholder: placeholder ?? formatMessage(messages$
|
|
421
|
+
placeholder: placeholder ?? formatMessage(messages$S.placeholder),
|
|
416
422
|
loadOptions: loadOptionsDebounced,
|
|
417
423
|
defaultOptions: true,
|
|
418
424
|
showOptionGroupDivider: true,
|
|
@@ -435,7 +441,7 @@ const ChannelPickerInput = _ref => {
|
|
|
435
441
|
})
|
|
436
442
|
}), isLoadingFailed && jsxRuntime.jsx(uiKit.Text.Body, {
|
|
437
443
|
tone: "negative",
|
|
438
|
-
intlMessage:
|
|
444
|
+
intlMessage: commonPickerMessages.loadingErrorMessage
|
|
439
445
|
})]
|
|
440
446
|
})
|
|
441
447
|
});
|
|
@@ -469,7 +475,7 @@ let FormattedDateTime = /*#__PURE__*/function (_PureComponent) {
|
|
|
469
475
|
FormattedDateTime.displayName = 'FormattedDateTime';
|
|
470
476
|
var FormattedDateTime$1 = reactIntl.injectIntl(FormattedDateTime);
|
|
471
477
|
|
|
472
|
-
var messages$
|
|
478
|
+
var messages$R = reactIntl.defineMessages({
|
|
473
479
|
noProductTypesFound: {
|
|
474
480
|
id: 'Products.ProductTypePickerInput.noProductTypesFound',
|
|
475
481
|
description: 'The message to display when no product types were found',
|
|
@@ -558,7 +564,7 @@ const ProductTypePickerInput = _ref => {
|
|
|
558
564
|
children: jsxRuntime.jsx(uiKit.AsyncSelectInput, {
|
|
559
565
|
id: name,
|
|
560
566
|
name: name,
|
|
561
|
-
placeholder: formatMessage(messages$
|
|
567
|
+
placeholder: formatMessage(messages$R.placeholder),
|
|
562
568
|
loadOptions: loadOptionsDebounced,
|
|
563
569
|
defaultOptions: [],
|
|
564
570
|
isClearable: isClearable,
|
|
@@ -571,7 +577,7 @@ const ProductTypePickerInput = _ref => {
|
|
|
571
577
|
onInputChange: handleInputChange,
|
|
572
578
|
onBlur: onBlur,
|
|
573
579
|
value: currentOption.data,
|
|
574
|
-
noOptionsMessage: () => loadingError ? null : formatMessage(messages$
|
|
580
|
+
noOptionsMessage: () => loadingError ? null : formatMessage(messages$R.noProductTypesFound),
|
|
575
581
|
hasError: hasError || isLoadingFailed,
|
|
576
582
|
menuPortalZIndex: Z_INDEX_DROPDOWN,
|
|
577
583
|
menuPortalTarget: document.body,
|
|
@@ -579,7 +585,7 @@ const ProductTypePickerInput = _ref => {
|
|
|
579
585
|
})
|
|
580
586
|
}), isLoadingFailed && jsxRuntime.jsx(uiKit.Text.Body, {
|
|
581
587
|
tone: "negative",
|
|
582
|
-
intlMessage:
|
|
588
|
+
intlMessage: commonPickerMessages.loadingErrorMessage
|
|
583
589
|
})]
|
|
584
590
|
})
|
|
585
591
|
});
|
|
@@ -587,7 +593,7 @@ const ProductTypePickerInput = _ref => {
|
|
|
587
593
|
ProductTypePickerInput.displayName = 'ProductTypePickerInput';
|
|
588
594
|
var ProductTypePickerInput$1 = ProductTypePickerInput;
|
|
589
595
|
|
|
590
|
-
var messages$
|
|
596
|
+
var messages$Q = reactIntl.defineMessages({
|
|
591
597
|
noStatesFound: {
|
|
592
598
|
id: 'Products.StatePickerInput.noStatesFound',
|
|
593
599
|
description: 'The message to display when no states were found',
|
|
@@ -671,7 +677,7 @@ const StatePickerInput = _ref => {
|
|
|
671
677
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
672
678
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
673
679
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
674
|
-
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$
|
|
680
|
+
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$Q.noStatesFound), [loadingError, formatMessage]);
|
|
675
681
|
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
676
682
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
677
683
|
max: "scale",
|
|
@@ -683,7 +689,7 @@ const StatePickerInput = _ref => {
|
|
|
683
689
|
id: name,
|
|
684
690
|
name: name,
|
|
685
691
|
horizontalConstraint: "scale",
|
|
686
|
-
placeholder: formatMessage(messages$
|
|
692
|
+
placeholder: formatMessage(messages$Q.placeholder),
|
|
687
693
|
loadOptions: loadOptionsDebounced,
|
|
688
694
|
defaultOptions: true,
|
|
689
695
|
showOptionGroupDivider: true,
|
|
@@ -705,7 +711,7 @@ const StatePickerInput = _ref => {
|
|
|
705
711
|
}, dataLocale)
|
|
706
712
|
}), isLoadingFailed && jsxRuntime.jsx(uiKit.Text.Body, {
|
|
707
713
|
tone: "negative",
|
|
708
|
-
intlMessage:
|
|
714
|
+
intlMessage: commonPickerMessages.loadingErrorMessage
|
|
709
715
|
})]
|
|
710
716
|
})
|
|
711
717
|
});
|
|
@@ -740,7 +746,7 @@ const CustomFieldTooltip = _ref => {
|
|
|
740
746
|
};
|
|
741
747
|
var CustomFieldTooltip$1 = CustomFieldTooltip;
|
|
742
748
|
|
|
743
|
-
var messages$
|
|
749
|
+
var messages$P = reactIntl.defineMessages({
|
|
744
750
|
bottomOption: {
|
|
745
751
|
id: 'Products.Pickers.bottomOption',
|
|
746
752
|
description: 'The message to display at the end of the options menu',
|
|
@@ -752,7 +758,7 @@ function ownKeys$1p(e, r) { var t = _Object$keys__default["default"](e); if (_Ob
|
|
|
752
758
|
function _objectSpread$1p(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$1p(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$1p(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
753
759
|
const getBottomOption = formatMessage => ({
|
|
754
760
|
options: [{
|
|
755
|
-
label: formatMessage ? formatMessage(messages$
|
|
761
|
+
label: formatMessage ? formatMessage(messages$P.bottomOption) : messages$P.bottomOption,
|
|
756
762
|
isBottomOption: true,
|
|
757
763
|
isDisabled: true
|
|
758
764
|
}]
|
|
@@ -1353,7 +1359,7 @@ ThrottledField.defaultProps = {
|
|
|
1353
1359
|
};
|
|
1354
1360
|
var ThrottledField$1 = ThrottledField;
|
|
1355
1361
|
|
|
1356
|
-
var messages$
|
|
1362
|
+
var messages$O = reactIntl.defineMessages({
|
|
1357
1363
|
buttonLabel: {
|
|
1358
1364
|
id: 'SearchInput.buttonLabel',
|
|
1359
1365
|
description: 'Label for "Search" button.',
|
|
@@ -1458,7 +1464,7 @@ let SearchInput = /*#__PURE__*/function (_Component) {
|
|
|
1458
1464
|
"data-testid": this.props.testId || 'search-input',
|
|
1459
1465
|
value: this.state.text,
|
|
1460
1466
|
label: this.props.label,
|
|
1461
|
-
placeholder: this.props.placeholder || this.props.intl.formatMessage(messages$
|
|
1467
|
+
placeholder: this.props.placeholder || this.props.intl.formatMessage(messages$O.placeholder),
|
|
1462
1468
|
inputRef: this.props.inputRef || this.setInputRef,
|
|
1463
1469
|
onChange: this.handleInputChange,
|
|
1464
1470
|
onEnter: this.handleEnter,
|
|
@@ -2028,34 +2034,6 @@ const useStoreKeysInDataFences = _ref => {
|
|
|
2028
2034
|
};
|
|
2029
2035
|
var useStoreKeysInDataFences$1 = useStoreKeysInDataFences;
|
|
2030
2036
|
|
|
2031
|
-
function useDidFormValidationFail() {
|
|
2032
|
-
const _useState = React.useState(false),
|
|
2033
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
2034
|
-
didFormValidationFail = _useState2[0],
|
|
2035
|
-
setDidFormValidationFail = _useState2[1];
|
|
2036
|
-
const _useState3 = React.useState(false),
|
|
2037
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
2038
|
-
wasValidationRequested = _useState4[0],
|
|
2039
|
-
setWasValidationRequested = _useState4[1];
|
|
2040
|
-
const _useFormikContext = formik.useFormikContext(),
|
|
2041
|
-
dirty = _useFormikContext.dirty,
|
|
2042
|
-
isValid = _useFormikContext.isValid,
|
|
2043
|
-
isValidating = _useFormikContext.isValidating;
|
|
2044
|
-
React.useEffect(() => {
|
|
2045
|
-
if (dirty) setWasValidationRequested(false);
|
|
2046
|
-
}, [dirty]);
|
|
2047
|
-
React.useEffect(() => {
|
|
2048
|
-
if (isValidating) setWasValidationRequested(true);
|
|
2049
|
-
}, [isValidating]);
|
|
2050
|
-
React.useEffect(() => {
|
|
2051
|
-
if (wasValidationRequested && !isValid) {
|
|
2052
|
-
setDidFormValidationFail(true);
|
|
2053
|
-
setWasValidationRequested(false);
|
|
2054
|
-
}
|
|
2055
|
-
}, [isValid, setWasValidationRequested, setDidFormValidationFail, wasValidationRequested]);
|
|
2056
|
-
return Boolean(didFormValidationFail);
|
|
2057
|
-
}
|
|
2058
|
-
|
|
2059
2037
|
function ownKeys$1a(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; }
|
|
2060
2038
|
function _objectSpread$1a(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$1a(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$1a(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
2061
2039
|
const TEN_MINUTES_IN_MS = 600000;
|
|
@@ -2132,7 +2110,7 @@ const usePersistedReminder = function () {
|
|
|
2132
2110
|
};
|
|
2133
2111
|
var usePersistedReminder$1 = usePersistedReminder;
|
|
2134
2112
|
|
|
2135
|
-
var messages$
|
|
2113
|
+
var messages$N = reactIntl.defineMessages({
|
|
2136
2114
|
profileUpdated: {
|
|
2137
2115
|
id: 'NotificationText.profileUpdated',
|
|
2138
2116
|
description: 'Label for the notification header',
|
|
@@ -2156,22 +2134,22 @@ const LinkToProfile = props => {
|
|
|
2156
2134
|
return jsxRuntime.jsx(uiKit.Link, {
|
|
2157
2135
|
to: "/account/profile",
|
|
2158
2136
|
children: props.children
|
|
2159
|
-
});
|
|
2137
|
+
}, "link");
|
|
2160
2138
|
};
|
|
2161
2139
|
LinkToProfile.displayName = 'LinkToProfile';
|
|
2162
2140
|
const getLinkToProfile = msg => jsxRuntime.jsx(LinkToProfile, {
|
|
2163
2141
|
children: msg
|
|
2164
|
-
});
|
|
2165
|
-
const getNewLine = () => jsxRuntime.jsx("br", {});
|
|
2142
|
+
}, "linkToProfile");
|
|
2143
|
+
const getNewLine = () => jsxRuntime.jsx("br", {}, crypto.randomUUID());
|
|
2166
2144
|
const NotificationText = () => jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
2167
2145
|
children: [jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
2168
2146
|
scale: "xs",
|
|
2169
2147
|
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
2170
2148
|
as: "p",
|
|
2171
2149
|
isBold: true,
|
|
2172
|
-
intlMessage: messages$
|
|
2150
|
+
intlMessage: messages$N.profileUpdated
|
|
2173
2151
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
2174
|
-
intlMessage: _objectSpread$19(_objectSpread$19({}, messages$
|
|
2152
|
+
intlMessage: _objectSpread$19(_objectSpread$19({}, messages$N.addMoreInformation), {}, {
|
|
2175
2153
|
values: {
|
|
2176
2154
|
newline: getNewLine
|
|
2177
2155
|
}
|
|
@@ -2180,7 +2158,7 @@ const NotificationText = () => jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
|
2180
2158
|
}), jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
2181
2159
|
scale: "xs",
|
|
2182
2160
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
2183
|
-
intlMessage: _objectSpread$19(_objectSpread$19({}, messages$
|
|
2161
|
+
intlMessage: _objectSpread$19(_objectSpread$19({}, messages$N.informationAndProfileLink), {}, {
|
|
2184
2162
|
values: {
|
|
2185
2163
|
newline: getNewLine,
|
|
2186
2164
|
link: getLinkToProfile
|
|
@@ -2263,8 +2241,11 @@ function usePendingRequests() {
|
|
|
2263
2241
|
pendingRequests = _useState2[0],
|
|
2264
2242
|
setPendingRequests = _useState2[1];
|
|
2265
2243
|
const isUnmountedRef = React.useRef(false);
|
|
2266
|
-
React.useEffect(() =>
|
|
2267
|
-
isUnmountedRef.current =
|
|
2244
|
+
React.useEffect(() => {
|
|
2245
|
+
isUnmountedRef.current = false;
|
|
2246
|
+
return () => {
|
|
2247
|
+
isUnmountedRef.current = true;
|
|
2248
|
+
};
|
|
2268
2249
|
}, []);
|
|
2269
2250
|
const change = React.useCallback(delta => {
|
|
2270
2251
|
// FIXME: isMounted is an anti pattern
|
|
@@ -2305,7 +2286,7 @@ const useEventCallback = (fn, dependencies) => {
|
|
|
2305
2286
|
};
|
|
2306
2287
|
var useEventCallback$1 = useEventCallback;
|
|
2307
2288
|
|
|
2308
|
-
var messages$
|
|
2289
|
+
var messages$M = reactIntl.defineMessages({
|
|
2309
2290
|
fallbackHint: {
|
|
2310
2291
|
id: 'KeyFallback.fallbackHint',
|
|
2311
2292
|
description: 'key fallback for a specified resource key (e.g name)',
|
|
@@ -2329,7 +2310,7 @@ const useLocalizedKeyFallback = () => {
|
|
|
2329
2310
|
return values => {
|
|
2330
2311
|
if (!values.resource) return null;
|
|
2331
2312
|
const localizedString = values.resource[values.localizedStringFieldName];
|
|
2332
|
-
const fallbackHintWithKey = intl.formatMessage(messages$
|
|
2313
|
+
const fallbackHintWithKey = intl.formatMessage(messages$M.fallbackHint, {
|
|
2333
2314
|
key: values.resource.key
|
|
2334
2315
|
});
|
|
2335
2316
|
if (!localizedString) return fallbackHintWithKey;
|
|
@@ -2477,7 +2458,7 @@ const convertProductSelectionsFromGraphQl = productSelections => {
|
|
|
2477
2458
|
});
|
|
2478
2459
|
};
|
|
2479
2460
|
|
|
2480
|
-
var FetchProductSelections = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchProductSelections" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "limit" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, defaultValue: { kind: "NullValue" }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "offset" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, defaultValue: { kind: "NullValue" }, 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" } } } }, defaultValue: { kind: "NullValue" }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "where" } }, type: { kind: "NamedType", name: { kind: "Name", value: "String" } }, defaultValue: { kind: "NullValue" }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "productSelections" }, 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: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "version" }, 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: "createdAt" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "lastModifiedAt" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "mode" }, arguments: [], directives: [] }] } }] } }] } }], loc: { start: 0, end:
|
|
2461
|
+
var FetchProductSelections = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchProductSelections" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "limit" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, defaultValue: { kind: "NullValue" }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "offset" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, defaultValue: { kind: "NullValue" }, 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" } } } }, defaultValue: { kind: "NullValue" }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "where" } }, type: { kind: "NamedType", name: { kind: "Name", value: "String" } }, defaultValue: { kind: "NullValue" }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "productSelections" }, 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: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "version" }, 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: "createdAt" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "lastModifiedAt" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "mode" }, arguments: [], directives: [] }] } }] } }] } }], loc: { start: 0, end: 424, source: { body: "query FetchProductSelections(\n $limit: Int = null\n $offset: Int = null\n $sort: [String!] = null\n $where: String = null\n) {\n productSelections(\n limit: $limit\n offset: $offset\n sort: $sort\n where: $where\n ) {\n total\n count\n offset\n results {\n id\n version\n key\n nameAllLocales {\n locale\n value\n }\n createdAt\n lastModifiedAt\n mode\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
2481
2462
|
const createQueryVariables$5 = function () {
|
|
2482
2463
|
let ownProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2483
2464
|
return {
|
|
@@ -2513,841 +2494,244 @@ const useProductSelectionsFetcher = props => {
|
|
|
2513
2494
|
};
|
|
2514
2495
|
var useProductSelectionsFetcher$1 = useProductSelectionsFetcher;
|
|
2515
2496
|
|
|
2516
|
-
const
|
|
2517
|
-
|
|
2518
|
-
|
|
2497
|
+
const setToArray = function () {
|
|
2498
|
+
let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
2499
|
+
return `id in (${_mapInstanceProperty__default["default"](values).call(values, value => `"${value}"`).join(', ')})`;
|
|
2500
|
+
};
|
|
2519
2501
|
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
* { en: 'Hello' } -> true
|
|
2524
|
-
* 'Hello' -> false
|
|
2525
|
-
*/
|
|
2502
|
+
function capitalizeFirst(text) {
|
|
2503
|
+
return text.charAt(0).toUpperCase() + _sliceInstanceProperty__default["default"](text).call(text, 1);
|
|
2504
|
+
}
|
|
2526
2505
|
|
|
2527
|
-
const
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2506
|
+
const PRODUCT_STATUSES = {
|
|
2507
|
+
PUBLISHED: 'published',
|
|
2508
|
+
UNPUBLISHED: 'unpublished',
|
|
2509
|
+
MODIFIED: 'modified'
|
|
2531
2510
|
};
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2511
|
+
const FILTER_TYPES = {
|
|
2512
|
+
lessThan: 'lessThan',
|
|
2513
|
+
moreThan: 'moreThan',
|
|
2514
|
+
equalTo: 'equalTo',
|
|
2515
|
+
range: 'range',
|
|
2516
|
+
missing: 'missing',
|
|
2517
|
+
missingIn: 'missingIn',
|
|
2518
|
+
in: 'in'
|
|
2519
|
+
};
|
|
2520
|
+
const FIELD_TYPES = {
|
|
2521
|
+
Money: 'Money',
|
|
2522
|
+
LocalizedString: 'LocalizedString',
|
|
2523
|
+
Time: 'Time',
|
|
2524
|
+
DateTime: 'DateTime',
|
|
2525
|
+
Boolean: 'Boolean',
|
|
2526
|
+
String: 'String',
|
|
2527
|
+
Enum: 'Enum',
|
|
2528
|
+
LocalizedEnum: 'LocalizedEnum',
|
|
2529
|
+
Number: 'Number',
|
|
2530
|
+
Date: 'Date',
|
|
2531
|
+
Reference: 'Reference',
|
|
2532
|
+
Set: 'Set'
|
|
2543
2533
|
};
|
|
2534
|
+
const PRECISION_TYPES = {
|
|
2535
|
+
highPrecision: 'highPrecision',
|
|
2536
|
+
centPrecision: 'centPrecision'
|
|
2537
|
+
};
|
|
2538
|
+
const ERROR_CODES = {
|
|
2539
|
+
semanticError: 'SemanticError',
|
|
2540
|
+
invalidInput: 'InvalidInput'
|
|
2541
|
+
};
|
|
2542
|
+
const DefaultPageSizes = [20, 50, 100];
|
|
2543
|
+
DefaultPageSizes[0];
|
|
2544
2544
|
|
|
2545
|
-
|
|
2545
|
+
const regexpData = /^data-/;
|
|
2546
|
+
function filterDataAttributes(obj) {
|
|
2547
|
+
var _context, _context2;
|
|
2548
|
+
return _reduceInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](_context2 = _Object$keys__default["default"](obj)).call(_context2, p => regexpData.test(p))).call(_context, (acc, p) => {
|
|
2549
|
+
// eslint-disable-next-line no-param-reassign
|
|
2550
|
+
acc[p] = obj[p];
|
|
2551
|
+
return acc;
|
|
2552
|
+
}, {});
|
|
2553
|
+
}
|
|
2546
2554
|
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
* @param {Object} category - A category result object from graphql
|
|
2552
|
-
* @return {Object} Category (as a REST API representation):
|
|
2553
|
-
* `{ id, obj: { id, name } }`
|
|
2554
|
-
*/
|
|
2555
|
-
function transformLocalizedFieldsForCategory(category) {
|
|
2556
|
-
var _context;
|
|
2557
|
-
let transformationOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [{
|
|
2558
|
-
from: 'nameAllLocales',
|
|
2559
|
-
to: 'name'
|
|
2560
|
-
}];
|
|
2561
|
-
const transformedData = l10n.applyTransformedLocalizedFields(category, transformationOptions);
|
|
2562
|
-
const parent = category.parent ? transformLocalizedFieldsForCategory(category.parent) : null;
|
|
2563
|
-
const ancestors = category.ancestors ? _mapInstanceProperty__default["default"](_context = category.ancestors).call(_context, ancestor => transformLocalizedFieldsForCategory(ancestor)) : null;
|
|
2564
|
-
return _objectSpread$16(_objectSpread$16(_objectSpread$16({}, transformedData), parent ? {
|
|
2565
|
-
parent
|
|
2566
|
-
} : {}), ancestors ? {
|
|
2567
|
-
ancestors
|
|
2568
|
-
} : {});
|
|
2555
|
+
const invalidValues$1 = [null, undefined, ''];
|
|
2556
|
+
function isEmpty$2(_ref) {
|
|
2557
|
+
let value = _ref.value;
|
|
2558
|
+
return _includesInstanceProperty__default["default"](invalidValues$1).call(invalidValues$1, value) || _includesInstanceProperty__default["default"](invalidValues$1).call(invalidValues$1, value.from) && _includesInstanceProperty__default["default"](invalidValues$1).call(invalidValues$1, value.to);
|
|
2569
2559
|
}
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
return l10n.applyTransformedLocalizedFields(cartDiscount, transformationOptions);
|
|
2560
|
+
|
|
2561
|
+
const invalidValues = [null, undefined, ''];
|
|
2562
|
+
function validateSingleFilter(_ref) {
|
|
2563
|
+
let value = _ref.value;
|
|
2564
|
+
return _includesInstanceProperty__default["default"](invalidValues).call(invalidValues, value);
|
|
2576
2565
|
}
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2566
|
+
|
|
2567
|
+
const dateFormatDayStart$1 = 'YYYY-MM-DDT00:00:00.000';
|
|
2568
|
+
const dateFormatDayEnd$1 = 'YYYY-MM-DDT23:59:59.999';
|
|
2569
|
+
const getDateTimeInUTC = (date, timezone, format) => {
|
|
2570
|
+
const dateFormat = 'YYYY-MM-DDTHH:mm:ss.SSS';
|
|
2571
|
+
const momentDate = moment__default["default"](date);
|
|
2572
|
+
// check if the date is date only or datetime
|
|
2573
|
+
const noTimeSpecified = momentDate.hours() === 0 && momentDate.minutes() === 0 && momentDate.seconds() === 0;
|
|
2574
|
+
// if it's a date then convert it to UTC datetime based on timezone
|
|
2575
|
+
if (noTimeSpecified) {
|
|
2576
|
+
const offset = moment__default["default"](date).tz(timezone)?.utcOffset() || 0;
|
|
2577
|
+
const formattedDate = momentDate.format(format);
|
|
2578
|
+
const formattedDateWithOffset = moment__default["default"](formattedDate).add(offset, 'minutes').format(dateFormat);
|
|
2579
|
+
// console.log(formattedDateWithOffset);
|
|
2580
|
+
return formattedDateWithOffset;
|
|
2581
|
+
}
|
|
2582
|
+
// if it's a datetime we assume that it's already in UTC
|
|
2583
|
+
// and just return it
|
|
2584
|
+
return date;
|
|
2585
|
+
};
|
|
2586
|
+
function dateTransformer$1(filterKey, filters) {
|
|
2587
|
+
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator$1;
|
|
2588
|
+
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
2589
|
+
let type = _ref.type,
|
|
2590
|
+
value = _ref.value,
|
|
2591
|
+
timezone = _ref.timezone;
|
|
2592
|
+
if (!filterValidator({
|
|
2593
|
+
type,
|
|
2594
|
+
value
|
|
2595
|
+
})) return '';
|
|
2596
|
+
switch (type) {
|
|
2597
|
+
case FILTER_TYPES.lessThan:
|
|
2598
|
+
return `${filterKey} < "${getDateTimeInUTC(value, timezone, dateFormatDayStart$1)}"`;
|
|
2599
|
+
case FILTER_TYPES.moreThan:
|
|
2600
|
+
return `${filterKey} > "${getDateTimeInUTC(value, timezone, dateFormatDayEnd$1)}"`;
|
|
2601
|
+
case FILTER_TYPES.equalTo:
|
|
2602
|
+
return oneLine__default["default"]`
|
|
2603
|
+
(${filterKey} >= "${getDateTimeInUTC(value, timezone, dateFormatDayStart$1)}"
|
|
2604
|
+
and ${filterKey} <= "${getDateTimeInUTC(value, timezone, dateFormatDayEnd$1)}")
|
|
2605
|
+
`;
|
|
2606
|
+
case FILTER_TYPES.range:
|
|
2607
|
+
return oneLine__default["default"]`
|
|
2608
|
+
(${filterKey} >= "${getDateTimeInUTC(value.from, timezone, dateFormatDayStart$1)}"
|
|
2609
|
+
and ${filterKey} <= "${getDateTimeInUTC(value.to, timezone, dateFormatDayEnd$1)}")
|
|
2610
|
+
`;
|
|
2611
|
+
default:
|
|
2612
|
+
return '';
|
|
2591
2613
|
}
|
|
2592
|
-
}
|
|
2614
|
+
});
|
|
2615
|
+
|
|
2616
|
+
// The separator is and `or` as they are the same filter
|
|
2617
|
+
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(' or ');
|
|
2618
|
+
|
|
2619
|
+
/* The parenthesis involing the `queryString` are needed since they are all part of the
|
|
2620
|
+
* same filter so we need something to work with
|
|
2621
|
+
* (
|
|
2622
|
+
* (createdAt >= "2018-04-25T00:00:00.000+02:00" and createdAt <= "2018-04-25T23:59:59.999+02:00") o
|
|
2623
|
+
* (createdAt >= "2018-02-15T00:00:00.000+01:00" and createdAt <= "2018-02-15T23:59:59.999+01:00")
|
|
2624
|
+
* ) or some_more_filters
|
|
2625
|
+
*/
|
|
2626
|
+
return queryString === '' ? null : `(${queryString})`;
|
|
2627
|
+
}
|
|
2628
|
+
function defaultFilterValidator$1(_ref2) {
|
|
2629
|
+
let type = _ref2.type,
|
|
2630
|
+
value = _ref2.value;
|
|
2631
|
+
if (type !== 'range' && (validateSingleFilter({
|
|
2632
|
+
value
|
|
2633
|
+
}) || !moment__default["default"](value).isValid())) return false;
|
|
2634
|
+
if (type === 'range' && (isEmpty$2({
|
|
2635
|
+
value
|
|
2636
|
+
}) || !moment__default["default"](value.from).isValid() || !moment__default["default"](value.to).isValid())) return false;
|
|
2637
|
+
return true;
|
|
2593
2638
|
}
|
|
2594
2639
|
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
* moved into the JS SDK once discounts is fully 100% migrated to
|
|
2600
|
-
* GraphQL or any other plugin/app needs this functionality. Until
|
|
2601
|
-
* then this serves as a collective set of requirements before
|
|
2602
|
-
* prematurely adding a not fully working set of conversions to the
|
|
2603
|
-
* JS SDK.
|
|
2604
|
-
*/
|
|
2640
|
+
var localizedTextTransformer = localizedString => {
|
|
2641
|
+
var _context;
|
|
2642
|
+
return _mapInstanceProperty__default["default"](_context = _Object$keys__default["default"](localizedString)).call(_context, locale => `${locale} = "${localizedString[locale]}"`).join(' and ');
|
|
2643
|
+
};
|
|
2605
2644
|
|
|
2606
|
-
const
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
}
|
|
2615
|
-
};
|
|
2616
|
-
case 'boolean':
|
|
2617
|
-
case 'date':
|
|
2618
|
-
case 'datetime':
|
|
2619
|
-
case 'ltext':
|
|
2620
|
-
case 'money':
|
|
2621
|
-
case 'number':
|
|
2622
|
-
case 'text':
|
|
2623
|
-
case 'time':
|
|
2624
|
-
return {
|
|
2625
|
-
[attribute.type.name]: {}
|
|
2626
|
-
};
|
|
2627
|
-
case 'enum':
|
|
2628
|
-
case 'lenum':
|
|
2629
|
-
return {
|
|
2630
|
-
[attribute.type.name]: {
|
|
2631
|
-
values: []
|
|
2632
|
-
}
|
|
2633
|
-
};
|
|
2634
|
-
case 'reference':
|
|
2635
|
-
{
|
|
2636
|
-
return {
|
|
2637
|
-
[attribute.type.name]: {
|
|
2638
|
-
referenceTypeId: attribute.type.referenceTypeId
|
|
2639
|
-
}
|
|
2640
|
-
};
|
|
2641
|
-
}
|
|
2642
|
-
default:
|
|
2643
|
-
return attribute.type;
|
|
2645
|
+
const getCentAmountClause = (value, operator, locale) => `centAmount ${operator} ${uiKit.MoneyInput.convertToMoneyValue(value, locale).centAmount}`;
|
|
2646
|
+
function moneyTransformer(value, option, locale) {
|
|
2647
|
+
const clauses = [];
|
|
2648
|
+
if (option === FILTER_TYPES.range) {
|
|
2649
|
+
clauses[0] = `currencyCode = "${value.from.currencyCode}"`;
|
|
2650
|
+
clauses[1] = getCentAmountClause(value.from, '>=', locale);
|
|
2651
|
+
clauses[2] = getCentAmountClause(value.to, '<=', locale);
|
|
2652
|
+
return clauses.join(' and ');
|
|
2644
2653
|
}
|
|
2645
|
-
}
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
return {
|
|
2657
|
-
[money.type]: _objectSpread$16({
|
|
2658
|
-
centAmount: money.centAmount,
|
|
2659
|
-
currencyCode: money.currencyCode
|
|
2660
|
-
}, money.type === PRECISION_TYPES.highPrecision && {
|
|
2661
|
-
preciseAmount: money.preciseAmount,
|
|
2662
|
-
fractionDigits: money.fractionDigits
|
|
2663
|
-
})
|
|
2664
|
-
};
|
|
2665
|
-
case 'absolute':
|
|
2666
|
-
case 'absoluteCart':
|
|
2667
|
-
return {
|
|
2668
|
-
centAmount: money.centAmount,
|
|
2669
|
-
currencyCode: money.currencyCode
|
|
2670
|
-
};
|
|
2654
|
+
clauses[0] = `currencyCode = "${value.currencyCode}"`;
|
|
2655
|
+
switch (option) {
|
|
2656
|
+
case FILTER_TYPES.lessThan:
|
|
2657
|
+
clauses[1] = getCentAmountClause(value, '<', locale);
|
|
2658
|
+
break;
|
|
2659
|
+
case FILTER_TYPES.moreThan:
|
|
2660
|
+
clauses[1] = getCentAmountClause(value, '>', locale);
|
|
2661
|
+
break;
|
|
2662
|
+
case FILTER_TYPES.equalTo:
|
|
2663
|
+
clauses[1] = getCentAmountClause(value, '=', locale);
|
|
2664
|
+
break;
|
|
2671
2665
|
default:
|
|
2672
|
-
|
|
2666
|
+
return '';
|
|
2673
2667
|
}
|
|
2674
|
-
|
|
2668
|
+
return clauses.join(' and ');
|
|
2669
|
+
}
|
|
2675
2670
|
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2671
|
+
const formatTime = 'HH:mm:ss.SSS';
|
|
2672
|
+
|
|
2673
|
+
/* TimeInput only allows HH:mm:ss and adds the seconds as 00 and
|
|
2674
|
+
* the milliseconds always as 000.
|
|
2675
|
+
* This function returns the same time with the
|
|
2679
2676
|
*/
|
|
2680
|
-
const
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
};
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2677
|
+
const getEndOfSecond = value => moment__default["default"](value, formatTime).endOf('minute').format(formatTime);
|
|
2678
|
+
const defaultFilterValidator = _ref => {
|
|
2679
|
+
let type = _ref.type,
|
|
2680
|
+
value = _ref.value;
|
|
2681
|
+
if (type !== FILTER_TYPES.range && validateSingleFilter({
|
|
2682
|
+
value
|
|
2683
|
+
})) return false;
|
|
2684
|
+
if (type === FILTER_TYPES.range && isEmpty$2({
|
|
2685
|
+
value
|
|
2686
|
+
})) return false;
|
|
2687
|
+
return true;
|
|
2688
|
+
};
|
|
2689
|
+
const timeTransformer = function (filterKey, filters) {
|
|
2690
|
+
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator;
|
|
2691
|
+
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref2 => {
|
|
2692
|
+
let type = _ref2.type,
|
|
2693
|
+
value = _ref2.value;
|
|
2694
|
+
if (!filterValidator({
|
|
2695
|
+
type,
|
|
2696
|
+
value
|
|
2697
|
+
})) return '';
|
|
2698
|
+
switch (type) {
|
|
2699
|
+
case FILTER_TYPES.lessThan:
|
|
2700
|
+
return `${filterKey} < "${value}"`;
|
|
2701
|
+
case FILTER_TYPES.moreThan:
|
|
2702
|
+
return `${filterKey} > "${value}"`;
|
|
2703
|
+
case FILTER_TYPES.equalTo:
|
|
2704
|
+
return oneLine__default["default"]`
|
|
2705
|
+
(${filterKey} >= "${value}"
|
|
2706
|
+
and ${filterKey} <= "${getEndOfSecond(value)}")
|
|
2707
|
+
`;
|
|
2708
|
+
case FILTER_TYPES.range:
|
|
2709
|
+
return oneLine__default["default"]`
|
|
2710
|
+
(${filterKey} >= "${value.from}"
|
|
2711
|
+
and ${filterKey} <= "${getEndOfSecond(value.to)}")
|
|
2712
|
+
`;
|
|
2713
|
+
default:
|
|
2714
|
+
return '';
|
|
2701
2715
|
}
|
|
2702
|
-
};
|
|
2716
|
+
});
|
|
2717
|
+
|
|
2718
|
+
// The separator is and `or` as they are the same filter
|
|
2719
|
+
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(' or ');
|
|
2720
|
+
|
|
2721
|
+
/* The parenthesis involing the `queryString` are needed since they are all part of the
|
|
2722
|
+
* same filter so we need something to work with
|
|
2723
|
+
* (
|
|
2724
|
+
* (pickUpTime >= "12:00" and pickUpTime <= "13:00") o
|
|
2725
|
+
* (pickUpTime >= "14:00" and pickUpTime <= "15:00")
|
|
2726
|
+
* ) or some_more_filters
|
|
2727
|
+
*/
|
|
2728
|
+
return queryString === '' ? null : `(${queryString})`;
|
|
2703
2729
|
};
|
|
2704
2730
|
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
*/
|
|
2710
|
-
const convertAction = (actionName, actionPayload) => {
|
|
2711
|
-
var _context3, _context4, _context5, _context6, _context7;
|
|
2712
|
-
const getNameFromPayload = payload => {
|
|
2713
|
-
// changeName for `Organizations`
|
|
2714
|
-
if (typeof payload.name === 'string') return payload;
|
|
2715
|
-
// changeName for `UserProfile`
|
|
2716
|
-
if (payload.firstName || payload.lastName) return payload;
|
|
2717
|
-
// assume `changeName` for LocalizedString type
|
|
2718
|
-
return {
|
|
2719
|
-
name: l10n.transformLocalizedStringToLocalizedField(payload.name)
|
|
2720
|
-
};
|
|
2721
|
-
};
|
|
2722
|
-
switch (actionName) {
|
|
2723
|
-
case 'changeName':
|
|
2724
|
-
return {
|
|
2725
|
-
[actionName]: getNameFromPayload(actionPayload)
|
|
2726
|
-
};
|
|
2727
|
-
case 'setDescription':
|
|
2728
|
-
case 'changeDescription':
|
|
2729
|
-
return {
|
|
2730
|
-
[actionName]: {
|
|
2731
|
-
description: getIsLocalizedString(actionPayload.description) ? l10n.transformLocalizedStringToLocalizedField(actionPayload.description) : actionPayload.description
|
|
2732
|
-
}
|
|
2733
|
-
};
|
|
2734
|
-
case 'setLocalizedDescription':
|
|
2735
|
-
return {
|
|
2736
|
-
[actionName]: {
|
|
2737
|
-
localizedDescription: l10n.transformLocalizedStringToLocalizedField(actionPayload.localizedDescription)
|
|
2738
|
-
}
|
|
2739
|
-
};
|
|
2740
|
-
case 'setName':
|
|
2741
|
-
return {
|
|
2742
|
-
[actionName]: getNameFromPayload(actionPayload)
|
|
2743
|
-
};
|
|
2744
|
-
case 'setLocalizedName':
|
|
2745
|
-
return {
|
|
2746
|
-
[actionName]: {
|
|
2747
|
-
localizedName: l10n.transformLocalizedStringToLocalizedField(actionPayload.localizedName)
|
|
2748
|
-
}
|
|
2749
|
-
};
|
|
2750
|
-
case 'setLineItemCustomField':
|
|
2751
|
-
return {
|
|
2752
|
-
[actionName]: {
|
|
2753
|
-
lineItemId: actionPayload.lineItemId,
|
|
2754
|
-
name: actionPayload.name,
|
|
2755
|
-
value: _JSON$stringify__default["default"](actionPayload.value)
|
|
2756
|
-
}
|
|
2757
|
-
};
|
|
2758
|
-
case 'setCustomLineItemCustomField':
|
|
2759
|
-
return {
|
|
2760
|
-
[actionName]: {
|
|
2761
|
-
customLineItemId: actionPayload.customLineItemId,
|
|
2762
|
-
name: actionPayload.name,
|
|
2763
|
-
value: _JSON$stringify__default["default"](actionPayload.value)
|
|
2764
|
-
}
|
|
2765
|
-
};
|
|
2766
|
-
case 'setCustomField':
|
|
2767
|
-
return {
|
|
2768
|
-
[actionName]: {
|
|
2769
|
-
name: actionPayload.name,
|
|
2770
|
-
value: _JSON$stringify__default["default"](actionPayload.value)
|
|
2771
|
-
}
|
|
2772
|
-
};
|
|
2773
|
-
case 'setCustomType':
|
|
2774
|
-
return {
|
|
2775
|
-
[actionName]: {
|
|
2776
|
-
typeId: actionPayload.type?.id,
|
|
2777
|
-
fields: actionPayload.fields ? _mapInstanceProperty__default["default"](_context3 = _Object$entries__default["default"](actionPayload.fields)).call(_context3, _ref => {
|
|
2778
|
-
let _ref2 = _slicedToArray(_ref, 2),
|
|
2779
|
-
customField = _ref2[0],
|
|
2780
|
-
value = _ref2[1];
|
|
2781
|
-
return {
|
|
2782
|
-
name: customField,
|
|
2783
|
-
value: _JSON$stringify__default["default"](value)
|
|
2784
|
-
};
|
|
2785
|
-
}) : undefined
|
|
2786
|
-
}
|
|
2787
|
-
};
|
|
2788
|
-
case 'removeLocation':
|
|
2789
|
-
return {
|
|
2790
|
-
[actionName]: {
|
|
2791
|
-
location: {
|
|
2792
|
-
country: actionPayload.location.country
|
|
2793
|
-
}
|
|
2794
|
-
}
|
|
2795
|
-
};
|
|
2796
|
-
case 'addLocation':
|
|
2797
|
-
return {
|
|
2798
|
-
[actionName]: {
|
|
2799
|
-
location: {
|
|
2800
|
-
country: actionPayload.location.country
|
|
2801
|
-
}
|
|
2802
|
-
}
|
|
2803
|
-
};
|
|
2804
|
-
case 'setGeoLocation':
|
|
2805
|
-
return {
|
|
2806
|
-
[actionName]: actionPayload?.geoLocation ? {
|
|
2807
|
-
geoLocation: {
|
|
2808
|
-
type: 'Point',
|
|
2809
|
-
coordinates: [_parseFloat__default["default"](actionPayload.geoLocation?.longitude), _parseFloat__default["default"](actionPayload.geoLocation?.latitude)]
|
|
2810
|
-
}
|
|
2811
|
-
} : {
|
|
2812
|
-
undefined
|
|
2813
|
-
}
|
|
2814
|
-
};
|
|
2815
|
-
case 'changeLabel':
|
|
2816
|
-
return {
|
|
2817
|
-
changeLabel: {
|
|
2818
|
-
attributeName: actionPayload.attributeName,
|
|
2819
|
-
label: l10n.transformLocalizedStringToLocalizedField(actionPayload.label)
|
|
2820
|
-
}
|
|
2821
|
-
};
|
|
2822
|
-
case 'setInputTip':
|
|
2823
|
-
return {
|
|
2824
|
-
setInputTip: {
|
|
2825
|
-
attributeName: actionPayload.attributeName,
|
|
2826
|
-
inputTip: l10n.transformLocalizedStringToLocalizedField(actionPayload.inputTip)
|
|
2827
|
-
}
|
|
2828
|
-
};
|
|
2829
|
-
case 'addAttributeDefinition':
|
|
2830
|
-
return {
|
|
2831
|
-
[actionName]: {
|
|
2832
|
-
attributeDefinition: _objectSpread$16(_objectSpread$16({}, actionPayload.attribute), {}, {
|
|
2833
|
-
label: l10n.transformLocalizedStringToLocalizedField(actionPayload.attribute.label),
|
|
2834
|
-
inputTip: l10n.transformLocalizedStringToLocalizedField(actionPayload.attribute.inputTip),
|
|
2835
|
-
type: createAttributeTypeValue(actionPayload.attribute)
|
|
2836
|
-
})
|
|
2837
|
-
}
|
|
2838
|
-
};
|
|
2839
|
-
case 'replaceTaxRate':
|
|
2840
|
-
return {
|
|
2841
|
-
[actionName]: {
|
|
2842
|
-
taxRate: {
|
|
2843
|
-
name: actionPayload.taxRate.name,
|
|
2844
|
-
country: actionPayload.taxRate.country,
|
|
2845
|
-
includedInPrice: actionPayload.taxRate.includedInPrice,
|
|
2846
|
-
amount: actionPayload.taxRate.amount,
|
|
2847
|
-
state: actionPayload.taxRate.state,
|
|
2848
|
-
key: actionPayload.taxRate.key,
|
|
2849
|
-
subRates: actionPayload.taxRate.subRates
|
|
2850
|
-
},
|
|
2851
|
-
taxRateId: actionPayload.taxRateId
|
|
2852
|
-
}
|
|
2853
|
-
};
|
|
2854
|
-
case 'addZone':
|
|
2855
|
-
return {
|
|
2856
|
-
[actionName]: {
|
|
2857
|
-
zone: {
|
|
2858
|
-
id: actionPayload.zone.id,
|
|
2859
|
-
typeId: actionPayload.zone.typeId
|
|
2860
|
-
}
|
|
2861
|
-
}
|
|
2862
|
-
};
|
|
2863
|
-
case 'removeZone':
|
|
2864
|
-
return {
|
|
2865
|
-
[actionName]: {
|
|
2866
|
-
zone: {
|
|
2867
|
-
id: actionPayload.zone.id,
|
|
2868
|
-
typeId: actionPayload.zone.typeId
|
|
2869
|
-
}
|
|
2870
|
-
}
|
|
2871
|
-
};
|
|
2872
|
-
case 'changeTaxCategory':
|
|
2873
|
-
return {
|
|
2874
|
-
[actionName]: {
|
|
2875
|
-
taxCategory: {
|
|
2876
|
-
id: actionPayload.taxCategory.id,
|
|
2877
|
-
typeId: actionPayload.taxCategory.typeId
|
|
2878
|
-
}
|
|
2879
|
-
}
|
|
2880
|
-
};
|
|
2881
|
-
case 'addShippingRate':
|
|
2882
|
-
return {
|
|
2883
|
-
[actionName]: {
|
|
2884
|
-
zone: {
|
|
2885
|
-
id: actionPayload.zone.id,
|
|
2886
|
-
typeId: actionPayload.zone.typeId
|
|
2887
|
-
},
|
|
2888
|
-
shippingRate: {
|
|
2889
|
-
price: {
|
|
2890
|
-
centAmount: actionPayload.shippingRate.price.centAmount,
|
|
2891
|
-
currencyCode: actionPayload.shippingRate.price.currencyCode
|
|
2892
|
-
},
|
|
2893
|
-
freeAbove: actionPayload.shippingRate.freeAbove ? {
|
|
2894
|
-
centAmount: actionPayload.shippingRate.freeAbove.centAmount,
|
|
2895
|
-
currencyCode: actionPayload.shippingRate.freeAbove.currencyCode
|
|
2896
|
-
} : undefined,
|
|
2897
|
-
tiers: actionPayload.shippingRate.tiers ? mapShippingRateTierToGraphQL(actionPayload.shippingRate.tiers) : undefined
|
|
2898
|
-
}
|
|
2899
|
-
}
|
|
2900
|
-
};
|
|
2901
|
-
case 'removeShippingRate':
|
|
2902
|
-
return {
|
|
2903
|
-
[actionName]: {
|
|
2904
|
-
zone: {
|
|
2905
|
-
id: actionPayload.zone.id,
|
|
2906
|
-
typeId: actionPayload.zone.typeId
|
|
2907
|
-
},
|
|
2908
|
-
shippingRate: {
|
|
2909
|
-
price: {
|
|
2910
|
-
centAmount: actionPayload.shippingRate.price.centAmount,
|
|
2911
|
-
currencyCode: actionPayload.shippingRate.price.currencyCode
|
|
2912
|
-
},
|
|
2913
|
-
freeAbove: actionPayload.shippingRate.freeAbove ? {
|
|
2914
|
-
centAmount: actionPayload.shippingRate.freeAbove.centAmount,
|
|
2915
|
-
currencyCode: actionPayload.shippingRate.freeAbove.currencyCode
|
|
2916
|
-
} : undefined,
|
|
2917
|
-
tiers: actionPayload.shippingRate.tiers ? mapShippingRateTierToGraphQL(actionPayload.shippingRate.tiers) : undefined
|
|
2918
|
-
}
|
|
2919
|
-
}
|
|
2920
|
-
};
|
|
2921
|
-
case 'changeValue':
|
|
2922
|
-
return convertChangeValueAction(actionPayload);
|
|
2923
|
-
// product-types -> attributes -> enum
|
|
2924
|
-
case 'addLocalizedEnumValue':
|
|
2925
|
-
return {
|
|
2926
|
-
[actionName]: {
|
|
2927
|
-
attributeName: actionPayload.attributeName,
|
|
2928
|
-
value: _objectSpread$16(_objectSpread$16({}, actionPayload.value), {}, {
|
|
2929
|
-
label: l10n.transformLocalizedStringToLocalizedField(actionPayload.value.label)
|
|
2930
|
-
})
|
|
2931
|
-
}
|
|
2932
|
-
};
|
|
2933
|
-
case 'changeLocalizedEnumValueLabel':
|
|
2934
|
-
return {
|
|
2935
|
-
[actionName]: {
|
|
2936
|
-
attributeName: actionPayload.attributeName,
|
|
2937
|
-
newValue: _objectSpread$16(_objectSpread$16({}, actionPayload.newValue), {}, {
|
|
2938
|
-
label: l10n.transformLocalizedStringToLocalizedField(actionPayload.newValue.label)
|
|
2939
|
-
})
|
|
2940
|
-
}
|
|
2941
|
-
};
|
|
2942
|
-
case 'setShippingRateInputType':
|
|
2943
|
-
return {
|
|
2944
|
-
[actionName]: {
|
|
2945
|
-
shippingRateInputType: actionPayload.shippingRateInputType?.type ? {
|
|
2946
|
-
[actionPayload.shippingRateInputType.type]: {
|
|
2947
|
-
values: actionPayload.shippingRateInputType.type === 'CartClassification' ? _mapInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](actionPayload.shippingRateInputType)).call(_context4, value => ({
|
|
2948
|
-
key: value.key,
|
|
2949
|
-
label: value.allLocaleLabels
|
|
2950
|
-
})) : undefined
|
|
2951
|
-
}
|
|
2952
|
-
} : undefined
|
|
2953
|
-
}
|
|
2954
|
-
};
|
|
2955
|
-
case 'addCustomLineItem':
|
|
2956
|
-
{
|
|
2957
|
-
return {
|
|
2958
|
-
[actionName]: {
|
|
2959
|
-
slug: actionPayload.slug,
|
|
2960
|
-
quantity: actionPayload.quantity,
|
|
2961
|
-
name: l10n.transformLocalizedStringToLocalizedField(actionPayload.name),
|
|
2962
|
-
taxCategory: actionPayload.taxCategory,
|
|
2963
|
-
money: {
|
|
2964
|
-
[actionPayload.money.type]: _objectSpread$16({
|
|
2965
|
-
centAmount: actionPayload.money.centAmount,
|
|
2966
|
-
currencyCode: actionPayload.money.currencyCode
|
|
2967
|
-
}, actionPayload.money.type === PRECISION_TYPES.highPrecision && {
|
|
2968
|
-
preciseAmount: actionPayload.money.preciseAmount,
|
|
2969
|
-
fractionDigits: actionPayload.money.fractionDigits
|
|
2970
|
-
})
|
|
2971
|
-
}
|
|
2972
|
-
}
|
|
2973
|
-
};
|
|
2974
|
-
}
|
|
2975
|
-
case 'setDataFences':
|
|
2976
|
-
return {
|
|
2977
|
-
[actionName]: {
|
|
2978
|
-
dataFences: _reduceInstanceProperty__default["default"](_context5 = actionPayload.dataFences).call(_context5, (nextDataFences, dataFence) => {
|
|
2979
|
-
if (dataFence.type.toLowerCase() === 'store') return [...nextDataFences, {
|
|
2980
|
-
[dataFence.type.toLowerCase()]: {
|
|
2981
|
-
storeKeys: dataFence.storeKeys
|
|
2982
|
-
}
|
|
2983
|
-
}];
|
|
2984
|
-
return nextDataFences;
|
|
2985
|
-
}, [])
|
|
2986
|
-
}
|
|
2987
|
-
};
|
|
2988
|
-
case 'changeTarget':
|
|
2989
|
-
return {
|
|
2990
|
-
[actionName]: {
|
|
2991
|
-
target: {
|
|
2992
|
-
[actionPayload.target.type]: _objectSpread$16(_objectSpread$16(_objectSpread$16({}, omit__default["default"](actionPayload.target, ['type', '__typename'])), actionPayload.target.triggerPattern && {
|
|
2993
|
-
triggerPattern: _mapInstanceProperty__default["default"](_context6 = actionPayload.target.triggerPattern).call(_context6, pattern => ({
|
|
2994
|
-
[pattern.type]: omit__default["default"](pattern, ['type', '__typename'])
|
|
2995
|
-
}))
|
|
2996
|
-
}), actionPayload.target.targetPattern && {
|
|
2997
|
-
targetPattern: _mapInstanceProperty__default["default"](_context7 = actionPayload.target.targetPattern).call(_context7, pattern => ({
|
|
2998
|
-
[pattern.type]: omit__default["default"](pattern, ['type', '__typename'])
|
|
2999
|
-
}))
|
|
3000
|
-
})
|
|
3001
|
-
}
|
|
3002
|
-
}
|
|
3003
|
-
};
|
|
3004
|
-
case 'addAddress':
|
|
3005
|
-
case 'changeAddress':
|
|
3006
|
-
{
|
|
3007
|
-
var _context8;
|
|
3008
|
-
const _ref3 = actionPayload.address?.custom || {},
|
|
3009
|
-
_ref3$fields = _ref3.fields,
|
|
3010
|
-
fields = _ref3$fields === void 0 ? {} : _ref3$fields;
|
|
3011
|
-
const customFields = isEmpty__default["default"](fields) ? null : _mapInstanceProperty__default["default"](_context8 = _Object$entries__default["default"](fields)).call(_context8, _ref4 => {
|
|
3012
|
-
let _ref5 = _slicedToArray(_ref4, 2),
|
|
3013
|
-
name = _ref5[0],
|
|
3014
|
-
value = _ref5[1];
|
|
3015
|
-
return {
|
|
3016
|
-
name,
|
|
3017
|
-
value: _JSON$stringify__default["default"](value)
|
|
3018
|
-
};
|
|
3019
|
-
});
|
|
3020
|
-
const custom = actionPayload.address?.custom?.type?.id ? {
|
|
3021
|
-
type: {
|
|
3022
|
-
id: actionPayload.address.custom.type.id
|
|
3023
|
-
},
|
|
3024
|
-
fields: customFields
|
|
3025
|
-
} : null;
|
|
3026
|
-
return {
|
|
3027
|
-
[actionName]: _objectSpread$16(_objectSpread$16({}, actionPayload), {}, {
|
|
3028
|
-
address: _objectSpread$16(_objectSpread$16({}, omit__default["default"](actionPayload.address, ['__typename'])), {}, {
|
|
3029
|
-
custom
|
|
3030
|
-
})
|
|
3031
|
-
})
|
|
3032
|
-
};
|
|
3033
|
-
}
|
|
3034
|
-
case 'setAddressCustomType':
|
|
3035
|
-
{
|
|
3036
|
-
var _context9;
|
|
3037
|
-
const _ref6 = actionPayload || {},
|
|
3038
|
-
addressId = _ref6.addressId,
|
|
3039
|
-
_ref6$fields = _ref6.fields,
|
|
3040
|
-
fields = _ref6$fields === void 0 ? {} : _ref6$fields,
|
|
3041
|
-
type = _ref6.type;
|
|
3042
|
-
const customFields = isEmpty__default["default"](fields) ? null : _mapInstanceProperty__default["default"](_context9 = _Object$entries__default["default"](fields)).call(_context9, _ref7 => {
|
|
3043
|
-
let _ref8 = _slicedToArray(_ref7, 2),
|
|
3044
|
-
name = _ref8[0],
|
|
3045
|
-
value = _ref8[1];
|
|
3046
|
-
return {
|
|
3047
|
-
name,
|
|
3048
|
-
value: _JSON$stringify__default["default"](value)
|
|
3049
|
-
};
|
|
3050
|
-
});
|
|
3051
|
-
const customType = type?.id ? {
|
|
3052
|
-
id: type.id
|
|
3053
|
-
} : null;
|
|
3054
|
-
return {
|
|
3055
|
-
[actionName]: {
|
|
3056
|
-
addressId,
|
|
3057
|
-
fields: customFields,
|
|
3058
|
-
type: customType
|
|
3059
|
-
}
|
|
3060
|
-
};
|
|
3061
|
-
}
|
|
3062
|
-
default:
|
|
3063
|
-
return {
|
|
3064
|
-
[actionName]: actionPayload
|
|
3065
|
-
};
|
|
3066
|
-
}
|
|
3067
|
-
};
|
|
3068
|
-
const createGraphQlUpdateActions = actions => _reduceInstanceProperty__default["default"](actions).call(actions, (previousActions, _ref9) => {
|
|
3069
|
-
let actionName = _ref9.action,
|
|
3070
|
-
actionPayload = _objectWithoutProperties(_ref9, _excluded$d);
|
|
3071
|
-
return [...previousActions, convertAction(actionName, actionPayload)];
|
|
3072
|
-
}, []);
|
|
3073
|
-
const extractErrorFromGraphQlResponse = graphQlResponse => {
|
|
3074
|
-
if (graphQlResponse.networkError?.result?.errors?.length > 0) {
|
|
3075
|
-
return graphQlResponse.networkError.result.errors;
|
|
3076
|
-
}
|
|
3077
|
-
if (graphQlResponse.graphQLErrors?.length > 0) {
|
|
3078
|
-
return graphQlResponse.graphQLErrors;
|
|
3079
|
-
}
|
|
3080
|
-
return graphQlResponse;
|
|
3081
|
-
};
|
|
3082
|
-
|
|
3083
|
-
var FetchRecurrencePolicies = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchRecurrencePolicies" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "recurrencePolicies" }, 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: "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: 160, source: { body: "query FetchRecurrencePolicies {\n recurrencePolicies {\n results {\n id\n key\n nameAllLocales {\n locale\n value\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
3084
|
-
const isRecurringOrdersDisabledError = error => {
|
|
3085
|
-
var _context;
|
|
3086
|
-
return error.extensions?.code === '403' && _includesInstanceProperty__default["default"](_context = error.message).call(_context, "The feature 'recurring-orders' is not enabled for this project. Please contact commercetools support.");
|
|
3087
|
-
};
|
|
3088
|
-
const useRecurrenceIntervals = () => {
|
|
3089
|
-
const _useQuery = client.useQuery(FetchRecurrencePolicies, {
|
|
3090
|
-
context: {
|
|
3091
|
-
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
3092
|
-
},
|
|
3093
|
-
fetchPolicy: 'cache-and-network'
|
|
3094
|
-
}),
|
|
3095
|
-
data = _useQuery.data,
|
|
3096
|
-
loading = _useQuery.loading,
|
|
3097
|
-
rawError = _useQuery.error;
|
|
3098
|
-
|
|
3099
|
-
// @TODO: Remove these error checks when the feature is enabled by default
|
|
3100
|
-
const extractedErrors = rawError ? extractErrorFromGraphQlResponse(rawError) : [];
|
|
3101
|
-
const isRecurringOrdersDisabled = extractedErrors.length > 0 &&
|
|
3102
|
-
// If the only error is a 403 with the specific message, we assume the feature is disabled
|
|
3103
|
-
_everyInstanceProperty__default["default"](extractedErrors).call(extractedErrors, isRecurringOrdersDisabledError);
|
|
3104
|
-
const error = isRecurringOrdersDisabled ? undefined : rawError;
|
|
3105
|
-
return {
|
|
3106
|
-
recurrencePolicies: data?.recurrencePolicies?.results ?? [],
|
|
3107
|
-
loading,
|
|
3108
|
-
error,
|
|
3109
|
-
isRecurringOrdersDisabled
|
|
3110
|
-
};
|
|
3111
|
-
};
|
|
3112
|
-
|
|
3113
|
-
const setToArray = function () {
|
|
3114
|
-
let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
3115
|
-
return `id in (${_mapInstanceProperty__default["default"](values).call(values, value => `"${value}"`).join(', ')})`;
|
|
3116
|
-
};
|
|
3117
|
-
|
|
3118
|
-
function capitalizeFirst(text) {
|
|
3119
|
-
return text.charAt(0).toUpperCase() + _sliceInstanceProperty__default["default"](text).call(text, 1);
|
|
3120
|
-
}
|
|
3121
|
-
|
|
3122
|
-
const PRODUCT_STATUSES = {
|
|
3123
|
-
PUBLISHED: 'published',
|
|
3124
|
-
UNPUBLISHED: 'unpublished',
|
|
3125
|
-
MODIFIED: 'modified'
|
|
3126
|
-
};
|
|
3127
|
-
const FILTER_TYPES = {
|
|
3128
|
-
lessThan: 'lessThan',
|
|
3129
|
-
moreThan: 'moreThan',
|
|
3130
|
-
equalTo: 'equalTo',
|
|
3131
|
-
range: 'range',
|
|
3132
|
-
missing: 'missing',
|
|
3133
|
-
missingIn: 'missingIn',
|
|
3134
|
-
in: 'in'
|
|
3135
|
-
};
|
|
3136
|
-
const FIELD_TYPES = {
|
|
3137
|
-
Money: 'Money',
|
|
3138
|
-
LocalizedString: 'LocalizedString',
|
|
3139
|
-
Time: 'Time',
|
|
3140
|
-
DateTime: 'DateTime',
|
|
3141
|
-
Boolean: 'Boolean',
|
|
3142
|
-
String: 'String',
|
|
3143
|
-
Enum: 'Enum',
|
|
3144
|
-
LocalizedEnum: 'LocalizedEnum',
|
|
3145
|
-
Number: 'Number',
|
|
3146
|
-
Date: 'Date',
|
|
3147
|
-
Reference: 'Reference',
|
|
3148
|
-
Set: 'Set'
|
|
3149
|
-
};
|
|
3150
|
-
const PRECISION_TYPES = {
|
|
3151
|
-
highPrecision: 'highPrecision',
|
|
3152
|
-
centPrecision: 'centPrecision'
|
|
3153
|
-
};
|
|
3154
|
-
const ERROR_CODES = {
|
|
3155
|
-
semanticError: 'SemanticError',
|
|
3156
|
-
invalidInput: 'InvalidInput'
|
|
3157
|
-
};
|
|
3158
|
-
const DefaultPageSizes = [20, 50, 100];
|
|
3159
|
-
DefaultPageSizes[0];
|
|
3160
|
-
|
|
3161
|
-
const regexpData = /^data-/;
|
|
3162
|
-
function filterDataAttributes(obj) {
|
|
3163
|
-
var _context, _context2;
|
|
3164
|
-
return _reduceInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](_context2 = _Object$keys__default["default"](obj)).call(_context2, p => regexpData.test(p))).call(_context, (acc, p) => {
|
|
3165
|
-
// eslint-disable-next-line no-param-reassign
|
|
3166
|
-
acc[p] = obj[p];
|
|
3167
|
-
return acc;
|
|
3168
|
-
}, {});
|
|
3169
|
-
}
|
|
3170
|
-
|
|
3171
|
-
const invalidValues$1 = [null, undefined, ''];
|
|
3172
|
-
function isEmpty$2(_ref) {
|
|
3173
|
-
let value = _ref.value;
|
|
3174
|
-
return _includesInstanceProperty__default["default"](invalidValues$1).call(invalidValues$1, value) || _includesInstanceProperty__default["default"](invalidValues$1).call(invalidValues$1, value.from) && _includesInstanceProperty__default["default"](invalidValues$1).call(invalidValues$1, value.to);
|
|
3175
|
-
}
|
|
3176
|
-
|
|
3177
|
-
const invalidValues = [null, undefined, ''];
|
|
3178
|
-
function validateSingleFilter(_ref) {
|
|
3179
|
-
let value = _ref.value;
|
|
3180
|
-
return _includesInstanceProperty__default["default"](invalidValues).call(invalidValues, value);
|
|
3181
|
-
}
|
|
3182
|
-
|
|
3183
|
-
const dateFormatDayStart$1 = 'YYYY-MM-DDT00:00:00.000';
|
|
3184
|
-
const dateFormatDayEnd$1 = 'YYYY-MM-DDT23:59:59.999';
|
|
3185
|
-
const getDateTimeInUTC = (date, timezone, format) => {
|
|
3186
|
-
const dateFormat = 'YYYY-MM-DDTHH:mm:ss.SSS';
|
|
3187
|
-
const momentDate = moment__default["default"](date);
|
|
3188
|
-
// check if the date is date only or datetime
|
|
3189
|
-
const noTimeSpecified = momentDate.hours() === 0 && momentDate.minutes() === 0 && momentDate.seconds() === 0;
|
|
3190
|
-
// if it's a date then convert it to UTC datetime based on timezone
|
|
3191
|
-
if (noTimeSpecified) {
|
|
3192
|
-
const offset = moment__default["default"](date).tz(timezone)?.utcOffset() || 0;
|
|
3193
|
-
const formattedDate = momentDate.format(format);
|
|
3194
|
-
const formattedDateWithOffset = moment__default["default"](formattedDate).add(offset, 'minutes').format(dateFormat);
|
|
3195
|
-
// console.log(formattedDateWithOffset);
|
|
3196
|
-
return formattedDateWithOffset;
|
|
3197
|
-
}
|
|
3198
|
-
// if it's a datetime we assume that it's already in UTC
|
|
3199
|
-
// and just return it
|
|
3200
|
-
return date;
|
|
3201
|
-
};
|
|
3202
|
-
function dateTransformer$1(filterKey, filters) {
|
|
3203
|
-
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator$1;
|
|
3204
|
-
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref => {
|
|
3205
|
-
let type = _ref.type,
|
|
3206
|
-
value = _ref.value,
|
|
3207
|
-
timezone = _ref.timezone;
|
|
3208
|
-
if (!filterValidator({
|
|
3209
|
-
type,
|
|
3210
|
-
value
|
|
3211
|
-
})) return '';
|
|
3212
|
-
switch (type) {
|
|
3213
|
-
case FILTER_TYPES.lessThan:
|
|
3214
|
-
return `${filterKey} < "${getDateTimeInUTC(value, timezone, dateFormatDayStart$1)}"`;
|
|
3215
|
-
case FILTER_TYPES.moreThan:
|
|
3216
|
-
return `${filterKey} > "${getDateTimeInUTC(value, timezone, dateFormatDayEnd$1)}"`;
|
|
3217
|
-
case FILTER_TYPES.equalTo:
|
|
3218
|
-
return oneLine__default["default"]`
|
|
3219
|
-
(${filterKey} >= "${getDateTimeInUTC(value, timezone, dateFormatDayStart$1)}"
|
|
3220
|
-
and ${filterKey} <= "${getDateTimeInUTC(value, timezone, dateFormatDayEnd$1)}")
|
|
3221
|
-
`;
|
|
3222
|
-
case FILTER_TYPES.range:
|
|
3223
|
-
return oneLine__default["default"]`
|
|
3224
|
-
(${filterKey} >= "${getDateTimeInUTC(value.from, timezone, dateFormatDayStart$1)}"
|
|
3225
|
-
and ${filterKey} <= "${getDateTimeInUTC(value.to, timezone, dateFormatDayEnd$1)}")
|
|
3226
|
-
`;
|
|
3227
|
-
default:
|
|
3228
|
-
return '';
|
|
3229
|
-
}
|
|
3230
|
-
});
|
|
3231
|
-
|
|
3232
|
-
// The separator is and `or` as they are the same filter
|
|
3233
|
-
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(' or ');
|
|
3234
|
-
|
|
3235
|
-
/* The parenthesis involing the `queryString` are needed since they are all part of the
|
|
3236
|
-
* same filter so we need something to work with
|
|
3237
|
-
* (
|
|
3238
|
-
* (createdAt >= "2018-04-25T00:00:00.000+02:00" and createdAt <= "2018-04-25T23:59:59.999+02:00") o
|
|
3239
|
-
* (createdAt >= "2018-02-15T00:00:00.000+01:00" and createdAt <= "2018-02-15T23:59:59.999+01:00")
|
|
3240
|
-
* ) or some_more_filters
|
|
3241
|
-
*/
|
|
3242
|
-
return queryString === '' ? null : `(${queryString})`;
|
|
3243
|
-
}
|
|
3244
|
-
function defaultFilterValidator$1(_ref2) {
|
|
3245
|
-
let type = _ref2.type,
|
|
3246
|
-
value = _ref2.value;
|
|
3247
|
-
if (type !== 'range' && (validateSingleFilter({
|
|
3248
|
-
value
|
|
3249
|
-
}) || !moment__default["default"](value).isValid())) return false;
|
|
3250
|
-
if (type === 'range' && (isEmpty$2({
|
|
3251
|
-
value
|
|
3252
|
-
}) || !moment__default["default"](value.from).isValid() || !moment__default["default"](value.to).isValid())) return false;
|
|
3253
|
-
return true;
|
|
3254
|
-
}
|
|
3255
|
-
|
|
3256
|
-
var localizedTextTransformer = localizedString => {
|
|
3257
|
-
var _context;
|
|
3258
|
-
return _mapInstanceProperty__default["default"](_context = _Object$keys__default["default"](localizedString)).call(_context, locale => `${locale} = "${localizedString[locale]}"`).join(' and ');
|
|
3259
|
-
};
|
|
3260
|
-
|
|
3261
|
-
const getCentAmountClause = (value, operator, locale) => `centAmount ${operator} ${uiKit.MoneyInput.convertToMoneyValue(value, locale).centAmount}`;
|
|
3262
|
-
function moneyTransformer(value, option, locale) {
|
|
3263
|
-
const clauses = [];
|
|
3264
|
-
if (option === FILTER_TYPES.range) {
|
|
3265
|
-
clauses[0] = `currencyCode = "${value.from.currencyCode}"`;
|
|
3266
|
-
clauses[1] = getCentAmountClause(value.from, '>=', locale);
|
|
3267
|
-
clauses[2] = getCentAmountClause(value.to, '<=', locale);
|
|
3268
|
-
return clauses.join(' and ');
|
|
3269
|
-
}
|
|
3270
|
-
clauses[0] = `currencyCode = "${value.currencyCode}"`;
|
|
3271
|
-
switch (option) {
|
|
3272
|
-
case FILTER_TYPES.lessThan:
|
|
3273
|
-
clauses[1] = getCentAmountClause(value, '<', locale);
|
|
3274
|
-
break;
|
|
3275
|
-
case FILTER_TYPES.moreThan:
|
|
3276
|
-
clauses[1] = getCentAmountClause(value, '>', locale);
|
|
3277
|
-
break;
|
|
3278
|
-
case FILTER_TYPES.equalTo:
|
|
3279
|
-
clauses[1] = getCentAmountClause(value, '=', locale);
|
|
3280
|
-
break;
|
|
3281
|
-
default:
|
|
3282
|
-
return '';
|
|
3283
|
-
}
|
|
3284
|
-
return clauses.join(' and ');
|
|
3285
|
-
}
|
|
3286
|
-
|
|
3287
|
-
const formatTime = 'HH:mm:ss.SSS';
|
|
3288
|
-
|
|
3289
|
-
/* TimeInput only allows HH:mm:ss and adds the seconds as 00 and
|
|
3290
|
-
* the milliseconds always as 000.
|
|
3291
|
-
* This function returns the same time with the
|
|
3292
|
-
*/
|
|
3293
|
-
const getEndOfSecond = value => moment__default["default"](value, formatTime).endOf('minute').format(formatTime);
|
|
3294
|
-
const defaultFilterValidator = _ref => {
|
|
3295
|
-
let type = _ref.type,
|
|
3296
|
-
value = _ref.value;
|
|
3297
|
-
if (type !== FILTER_TYPES.range && validateSingleFilter({
|
|
3298
|
-
value
|
|
3299
|
-
})) return false;
|
|
3300
|
-
if (type === FILTER_TYPES.range && isEmpty$2({
|
|
3301
|
-
value
|
|
3302
|
-
})) return false;
|
|
3303
|
-
return true;
|
|
3304
|
-
};
|
|
3305
|
-
const timeTransformer = function (filterKey, filters) {
|
|
3306
|
-
let filterValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultFilterValidator;
|
|
3307
|
-
const queries = _mapInstanceProperty__default["default"](filters).call(filters, _ref2 => {
|
|
3308
|
-
let type = _ref2.type,
|
|
3309
|
-
value = _ref2.value;
|
|
3310
|
-
if (!filterValidator({
|
|
3311
|
-
type,
|
|
3312
|
-
value
|
|
3313
|
-
})) return '';
|
|
3314
|
-
switch (type) {
|
|
3315
|
-
case FILTER_TYPES.lessThan:
|
|
3316
|
-
return `${filterKey} < "${value}"`;
|
|
3317
|
-
case FILTER_TYPES.moreThan:
|
|
3318
|
-
return `${filterKey} > "${value}"`;
|
|
3319
|
-
case FILTER_TYPES.equalTo:
|
|
3320
|
-
return oneLine__default["default"]`
|
|
3321
|
-
(${filterKey} >= "${value}"
|
|
3322
|
-
and ${filterKey} <= "${getEndOfSecond(value)}")
|
|
3323
|
-
`;
|
|
3324
|
-
case FILTER_TYPES.range:
|
|
3325
|
-
return oneLine__default["default"]`
|
|
3326
|
-
(${filterKey} >= "${value.from}"
|
|
3327
|
-
and ${filterKey} <= "${getEndOfSecond(value.to)}")
|
|
3328
|
-
`;
|
|
3329
|
-
default:
|
|
3330
|
-
return '';
|
|
3331
|
-
}
|
|
3332
|
-
});
|
|
3333
|
-
|
|
3334
|
-
// The separator is and `or` as they are the same filter
|
|
3335
|
-
const queryString = _filterInstanceProperty__default["default"](queries).call(queries, q => q !== '').join(' or ');
|
|
3336
|
-
|
|
3337
|
-
/* The parenthesis involing the `queryString` are needed since they are all part of the
|
|
3338
|
-
* same filter so we need something to work with
|
|
3339
|
-
* (
|
|
3340
|
-
* (pickUpTime >= "12:00" and pickUpTime <= "13:00") o
|
|
3341
|
-
* (pickUpTime >= "14:00" and pickUpTime <= "15:00")
|
|
3342
|
-
* ) or some_more_filters
|
|
3343
|
-
*/
|
|
3344
|
-
return queryString === '' ? null : `(${queryString})`;
|
|
3345
|
-
};
|
|
3346
|
-
|
|
3347
|
-
function formatDateRangeValue(value, type) {
|
|
3348
|
-
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
3349
|
-
locale: 'en',
|
|
3350
|
-
timeZone: moment__default$1["default"].tz.guess()
|
|
2731
|
+
function formatDateRangeValue(value, type) {
|
|
2732
|
+
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
2733
|
+
locale: 'en',
|
|
2734
|
+
timeZone: moment__default$1["default"].tz.guess()
|
|
3351
2735
|
};
|
|
3352
2736
|
if (value.from === value.to) return formatDateTime$1(type, value.from, options);
|
|
3353
2737
|
if (value.from && value.to) return oneLine__default["default"]`
|
|
@@ -4552,8 +3936,8 @@ const getData = (code, field) => {
|
|
|
4552
3936
|
};
|
|
4553
3937
|
const getFractionDigit = code => getData(code, 'fractionDigit');
|
|
4554
3938
|
|
|
4555
|
-
function ownKeys$
|
|
4556
|
-
function _objectSpread$
|
|
3939
|
+
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; }
|
|
3940
|
+
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; }
|
|
4557
3941
|
function formatMoneyRangeValue(value, intl) {
|
|
4558
3942
|
if (value.from === value.to) return formatMoneyValue(value.from, value.currency, intl);
|
|
4559
3943
|
if (value.from && value.to) return `${formatMoneyValue(value.from, value.currency, intl)} -
|
|
@@ -4563,7 +3947,7 @@ function formatMoneyRangeValue(value, intl) {
|
|
|
4563
3947
|
return '';
|
|
4564
3948
|
}
|
|
4565
3949
|
function formatMoneyValue(amount, currency, intl) {
|
|
4566
|
-
return formatMoney$
|
|
3950
|
+
return formatMoney$2(_objectSpread$16({
|
|
4567
3951
|
centAmount: amount,
|
|
4568
3952
|
fractionDigits: getFractionDigit(currency)
|
|
4569
3953
|
}, currency ? {
|
|
@@ -4578,15 +3962,15 @@ function getFractionedAmount(moneyValue) {
|
|
|
4578
3962
|
const amount = moneyValue.type === PRECISION_TYPES.highPrecision ? moneyValue.preciseAmount : moneyValue.centAmount;
|
|
4579
3963
|
return amount / 10 ** fractionDigits;
|
|
4580
3964
|
}
|
|
4581
|
-
function formatMoney$
|
|
4582
|
-
return intl.formatNumber(moneyValue.fractionedAmount ?? getFractionedAmount(moneyValue), _objectSpread$
|
|
3965
|
+
function formatMoney$2(moneyValue, intl, options) {
|
|
3966
|
+
return intl.formatNumber(moneyValue.fractionedAmount ?? getFractionedAmount(moneyValue), _objectSpread$16({
|
|
4583
3967
|
style: 'currency',
|
|
4584
3968
|
currency: moneyValue.currencyCode,
|
|
4585
3969
|
minimumFractionDigits: moneyValue.fractionDigits
|
|
4586
3970
|
}, options));
|
|
4587
3971
|
}
|
|
4588
3972
|
|
|
4589
|
-
var messages$
|
|
3973
|
+
var messages$L = reactIntl.defineMessages({
|
|
4590
3974
|
booleanYes: {
|
|
4591
3975
|
id: 'AttributeTypeFormats.boolean.yes',
|
|
4592
3976
|
description: 'The label for boolean attribute `true` value',
|
|
@@ -4626,10 +4010,10 @@ const formatLtext = _ref3 => {
|
|
|
4626
4010
|
locale: language
|
|
4627
4011
|
});
|
|
4628
4012
|
};
|
|
4629
|
-
const formatMoney = _ref4 => {
|
|
4013
|
+
const formatMoney$1 = _ref4 => {
|
|
4630
4014
|
let value = _ref4.value,
|
|
4631
4015
|
intl = _ref4.intl;
|
|
4632
|
-
return formatMoney$
|
|
4016
|
+
return formatMoney$2(value, intl);
|
|
4633
4017
|
};
|
|
4634
4018
|
const formatReference = _ref5 => {
|
|
4635
4019
|
let value = _ref5.value;
|
|
@@ -4668,7 +4052,7 @@ const formatDateTime = _ref7 => {
|
|
|
4668
4052
|
const formatBoolean = _ref8 => {
|
|
4669
4053
|
let value = _ref8.value,
|
|
4670
4054
|
intl = _ref8.intl;
|
|
4671
|
-
return value ? intl.formatMessage(messages$
|
|
4055
|
+
return value ? intl.formatMessage(messages$L.booleanYes) : intl.formatMessage(messages$L.booleanNo);
|
|
4672
4056
|
};
|
|
4673
4057
|
const formatNilType = _ref9 => {
|
|
4674
4058
|
let value = _ref9.value,
|
|
@@ -4690,144 +4074,717 @@ const formatUnknown = _ref0 => {
|
|
|
4690
4074
|
extra: {
|
|
4691
4075
|
value
|
|
4692
4076
|
}
|
|
4693
|
-
});
|
|
4694
|
-
return fallbackValue;
|
|
4695
|
-
};
|
|
4696
|
-
const formatNested = _ref1 => {
|
|
4697
|
-
let fallbackValue = _ref1.fallbackValue;
|
|
4698
|
-
return fallbackValue;
|
|
4699
|
-
};
|
|
4700
|
-
const formatSet = _ref10 => {
|
|
4701
|
-
let type = _ref10.type,
|
|
4702
|
-
value = _ref10.value,
|
|
4703
|
-
intl = _ref10.intl,
|
|
4704
|
-
language = _ref10.language,
|
|
4705
|
-
languages = _ref10.languages,
|
|
4706
|
-
fallbackValue = _ref10.fallbackValue;
|
|
4707
|
-
const formatedElements = _mapInstanceProperty__default["default"](value).call(value, elementValue => formatAttribute({
|
|
4708
|
-
type: type.elementType,
|
|
4709
|
-
value: elementValue,
|
|
4710
|
-
intl,
|
|
4711
|
-
language,
|
|
4712
|
-
languages,
|
|
4713
|
-
fallbackValue
|
|
4714
|
-
}));
|
|
4715
|
-
return formatedElements.join(', ');
|
|
4077
|
+
});
|
|
4078
|
+
return fallbackValue;
|
|
4079
|
+
};
|
|
4080
|
+
const formatNested = _ref1 => {
|
|
4081
|
+
let fallbackValue = _ref1.fallbackValue;
|
|
4082
|
+
return fallbackValue;
|
|
4083
|
+
};
|
|
4084
|
+
const formatSet = _ref10 => {
|
|
4085
|
+
let type = _ref10.type,
|
|
4086
|
+
value = _ref10.value,
|
|
4087
|
+
intl = _ref10.intl,
|
|
4088
|
+
language = _ref10.language,
|
|
4089
|
+
languages = _ref10.languages,
|
|
4090
|
+
fallbackValue = _ref10.fallbackValue;
|
|
4091
|
+
const formatedElements = _mapInstanceProperty__default["default"](value).call(value, elementValue => formatAttribute({
|
|
4092
|
+
type: type.elementType,
|
|
4093
|
+
value: elementValue,
|
|
4094
|
+
intl,
|
|
4095
|
+
language,
|
|
4096
|
+
languages,
|
|
4097
|
+
fallbackValue
|
|
4098
|
+
}));
|
|
4099
|
+
return formatedElements.join(', ');
|
|
4100
|
+
};
|
|
4101
|
+
const doNotFormat = _ref11 => {
|
|
4102
|
+
let value = _ref11.value;
|
|
4103
|
+
return value;
|
|
4104
|
+
};
|
|
4105
|
+
const getFormatter = type => {
|
|
4106
|
+
if (isNil__default["default"](type)) return formatNilType;else if (type.name === 'nested') return formatNested;else if (type.name === 'set') return formatSet;else if (type.name === 'enum') return formatEnum;else if (type.name === 'lenum') return formatLenum;else if (type.name === 'ltext') return formatLtext;else if (type.name === 'money') return formatMoney$1;else if (type.name === 'reference') return formatReference;else if (type.name === 'date') return formatDate;else if (type.name === 'time') return doNotFormat;else if (type.name === 'datetime') return formatDateTime;else if (type.name === 'boolean') return formatBoolean;else if (type.name === 'text') return doNotFormat;else if (type.name === 'number') return doNotFormat;else return formatUnknown;
|
|
4107
|
+
};
|
|
4108
|
+
function formatAttribute(_ref12) {
|
|
4109
|
+
let type = _ref12.type,
|
|
4110
|
+
value = _ref12.value,
|
|
4111
|
+
intl = _ref12.intl,
|
|
4112
|
+
language = _ref12.language,
|
|
4113
|
+
languages = _ref12.languages,
|
|
4114
|
+
userTimeZone = _ref12.userTimeZone,
|
|
4115
|
+
_ref12$fallbackValue = _ref12.fallbackValue,
|
|
4116
|
+
fallbackValue = _ref12$fallbackValue === void 0 ? constants.NO_VALUE_FALLBACK : _ref12$fallbackValue;
|
|
4117
|
+
if (isNil__default["default"](value)) {
|
|
4118
|
+
return fallbackValue;
|
|
4119
|
+
}
|
|
4120
|
+
const formatter = getFormatter(type);
|
|
4121
|
+
return formatter({
|
|
4122
|
+
type,
|
|
4123
|
+
value,
|
|
4124
|
+
intl,
|
|
4125
|
+
language,
|
|
4126
|
+
languages,
|
|
4127
|
+
userTimeZone,
|
|
4128
|
+
fallbackValue
|
|
4129
|
+
});
|
|
4130
|
+
}
|
|
4131
|
+
|
|
4132
|
+
const attributeTypeNames = {
|
|
4133
|
+
Boolean: 'boolean',
|
|
4134
|
+
Date: 'date',
|
|
4135
|
+
DateTime: 'datetime',
|
|
4136
|
+
Enum: 'enum',
|
|
4137
|
+
LocalizedEnum: 'lenum',
|
|
4138
|
+
LocalizedString: 'ltext',
|
|
4139
|
+
Money: 'money',
|
|
4140
|
+
Nested: 'nested',
|
|
4141
|
+
Reference: 'reference',
|
|
4142
|
+
Set: 'set',
|
|
4143
|
+
String: 'text',
|
|
4144
|
+
Time: 'time',
|
|
4145
|
+
Number: 'number'
|
|
4146
|
+
};
|
|
4147
|
+
const convertToAttributeType = customFieldType => {
|
|
4148
|
+
if (isNil__default["default"](customFieldType)) return customFieldType;
|
|
4149
|
+
const attributeTypeName = attributeTypeNames[customFieldType.name];
|
|
4150
|
+
const elementTypeName = attributeTypeNames[customFieldType.elementType?.name];
|
|
4151
|
+
return {
|
|
4152
|
+
name: attributeTypeName,
|
|
4153
|
+
elementType: {
|
|
4154
|
+
name: elementTypeName
|
|
4155
|
+
}
|
|
4156
|
+
};
|
|
4157
|
+
};
|
|
4158
|
+
const inlineEnumValues = (type, value) => {
|
|
4159
|
+
if (isNil__default["default"](type)) return value;
|
|
4160
|
+
if (type.name === 'Set') {
|
|
4161
|
+
return _mapInstanceProperty__default["default"](value).call(value, setValue => inlineEnumValues(type.elementType, setValue));
|
|
4162
|
+
}
|
|
4163
|
+
if (type.name === 'Enum' || type.name === 'LocalizedEnum') {
|
|
4164
|
+
var _context;
|
|
4165
|
+
return _findInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](type)).call(_context, enumValue => enumValue.key === value);
|
|
4166
|
+
}
|
|
4167
|
+
return value;
|
|
4168
|
+
};
|
|
4169
|
+
|
|
4170
|
+
/**
|
|
4171
|
+
* Formats `Custom Fields`: https://docs.commercetools.com/api/projects/custom-fields
|
|
4172
|
+
* Despite having different names, most of `Custom Field` maps one-to-one with an appropriate
|
|
4173
|
+
* `Product Attribute Type`, hence we can reuse product attributes formatting logic.
|
|
4174
|
+
*
|
|
4175
|
+
* The only exception is `Enum` and `LEnum` types. Unlike when dealing with `Product Attribute Types`,
|
|
4176
|
+
* value in `Custom Fields` contains a key of an `Enum` entry, and not an entry itself.
|
|
4177
|
+
* Therefore, before passing value to attributes formatter we need to replace value with Enum entry.
|
|
4178
|
+
*/
|
|
4179
|
+
function formatCustomField(_ref) {
|
|
4180
|
+
let type = _ref.type,
|
|
4181
|
+
value = _ref.value,
|
|
4182
|
+
intl = _ref.intl,
|
|
4183
|
+
language = _ref.language,
|
|
4184
|
+
languages = _ref.languages,
|
|
4185
|
+
userTimeZone = _ref.userTimeZone;
|
|
4186
|
+
const attributeType = convertToAttributeType(type);
|
|
4187
|
+
return formatAttribute({
|
|
4188
|
+
type: attributeType,
|
|
4189
|
+
value: inlineEnumValues(type, value),
|
|
4190
|
+
intl,
|
|
4191
|
+
language,
|
|
4192
|
+
languages,
|
|
4193
|
+
userTimeZone
|
|
4194
|
+
});
|
|
4195
|
+
}
|
|
4196
|
+
|
|
4197
|
+
// FIXME: delete once prefix search is supported in ctp api
|
|
4198
|
+
|
|
4199
|
+
// Currently prefix search of products in the ctp is not supported.
|
|
4200
|
+
// This is a temporary hack which should be deleted once the feature is
|
|
4201
|
+
// supported in ctp.
|
|
4202
|
+
// It mimics the prefix search feature by computing lower and upper bounds
|
|
4203
|
+
// related to the provided `input`.
|
|
4204
|
+
// usage:
|
|
4205
|
+
// If I want to do a prefix search of term 'F', I get first the bounds
|
|
4206
|
+
// const [lowerBound, upperBound] = getPrefixSearch('F');
|
|
4207
|
+
// and then use them in the search
|
|
4208
|
+
// e.g
|
|
4209
|
+
// where: `masterData(current(name(en >= "${lowerBound}" and en < "${upperBound}")))`
|
|
4210
|
+
const getPrefixSearchBounds = input => {
|
|
4211
|
+
const getNextCharacter = character => String.fromCharCode(character.charCodeAt() + 1);
|
|
4212
|
+
return [input, `${_sliceInstanceProperty__default["default"](input).call(input, 0, input.length - 1)}${getNextCharacter(_sliceInstanceProperty__default["default"](input).call(input, input.length - 1))}`];
|
|
4213
|
+
};
|
|
4214
|
+
var getPrefixSearchBounds$1 = getPrefixSearchBounds;
|
|
4215
|
+
|
|
4216
|
+
const _excluded$d = ["action"];
|
|
4217
|
+
function ownKeys$15(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; }
|
|
4218
|
+
function _objectSpread$15(e) { for (var r = 1; r < arguments.length; r++) { var _context0, _context1; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context0 = ownKeys$15(Object(t), !0)).call(_context0, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context1 = ownKeys$15(Object(t))).call(_context1, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
4219
|
+
|
|
4220
|
+
/**
|
|
4221
|
+
* Checks if a value is a LocalizedString
|
|
4222
|
+
*
|
|
4223
|
+
* { en: 'Hello' } -> true
|
|
4224
|
+
* 'Hello' -> false
|
|
4225
|
+
*/
|
|
4226
|
+
|
|
4227
|
+
const getIsLocalizedString = maybeLocalizedString => {
|
|
4228
|
+
if (typeof maybeLocalizedString === 'string') return false;
|
|
4229
|
+
if (!maybeLocalizedString || typeof maybeLocalizedString === 'object' && _Object$keys__default["default"](maybeLocalizedString).length === 0) return false;
|
|
4230
|
+
return true;
|
|
4231
|
+
};
|
|
4232
|
+
|
|
4233
|
+
/**
|
|
4234
|
+
* Transforms a list of `CustomField` into a `CustomField` object
|
|
4235
|
+
*
|
|
4236
|
+
* [{ name: 'fieldA', value: 'Hello' }] -> { fieldA: 'Hello' }
|
|
4237
|
+
*/
|
|
4238
|
+
const transformCustomFieldsRawToCustomFields = customFieldsRaw => {
|
|
4239
|
+
if (!customFieldsRaw || customFieldsRaw.length === 0) return null;
|
|
4240
|
+
return _reduceInstanceProperty__default["default"](customFieldsRaw).call(customFieldsRaw, (customFields, customField) => _objectSpread$15(_objectSpread$15({}, customFields), {}, {
|
|
4241
|
+
[customField.name]: customField.value
|
|
4242
|
+
}), {});
|
|
4243
|
+
};
|
|
4244
|
+
|
|
4245
|
+
// --- Types mapping ---
|
|
4246
|
+
|
|
4247
|
+
/**
|
|
4248
|
+
* Map category GraphQL shape with nameAllLocales to reference shape
|
|
4249
|
+
* Includes ancestors and parent
|
|
4250
|
+
*
|
|
4251
|
+
* @param {Object} category - A category result object from graphql
|
|
4252
|
+
* @return {Object} Category (as a REST API representation):
|
|
4253
|
+
* `{ id, obj: { id, name } }`
|
|
4254
|
+
*/
|
|
4255
|
+
function transformLocalizedFieldsForCategory(category) {
|
|
4256
|
+
var _context;
|
|
4257
|
+
let transformationOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [{
|
|
4258
|
+
from: 'nameAllLocales',
|
|
4259
|
+
to: 'name'
|
|
4260
|
+
}];
|
|
4261
|
+
const transformedData = l10n.applyTransformedLocalizedFields(category, transformationOptions);
|
|
4262
|
+
const parent = category.parent ? transformLocalizedFieldsForCategory(category.parent) : null;
|
|
4263
|
+
const ancestors = category.ancestors ? _mapInstanceProperty__default["default"](_context = category.ancestors).call(_context, ancestor => transformLocalizedFieldsForCategory(ancestor)) : null;
|
|
4264
|
+
return _objectSpread$15(_objectSpread$15(_objectSpread$15({}, transformedData), parent ? {
|
|
4265
|
+
parent
|
|
4266
|
+
} : {}), ancestors ? {
|
|
4267
|
+
ancestors
|
|
4268
|
+
} : {});
|
|
4269
|
+
}
|
|
4270
|
+
function transformLocalizedFieldsForCartDiscount(cartDiscount) {
|
|
4271
|
+
const transformationOptions = [{
|
|
4272
|
+
from: 'nameAllLocales',
|
|
4273
|
+
to: 'name'
|
|
4274
|
+
}];
|
|
4275
|
+
return l10n.applyTransformedLocalizedFields(cartDiscount, transformationOptions);
|
|
4276
|
+
}
|
|
4277
|
+
function mapShippingRateTierToGraphQL(tiers) {
|
|
4278
|
+
return _reduceInstanceProperty__default["default"](tiers).call(tiers, (graphQlTiers, tier) => [...graphQlTiers, {
|
|
4279
|
+
[tier.type]: {
|
|
4280
|
+
price: tier.price ? {
|
|
4281
|
+
centAmount: tier.price.centAmount,
|
|
4282
|
+
currencyCode: tier.price.currencyCode
|
|
4283
|
+
} : undefined,
|
|
4284
|
+
minimumCentAmount: tier.minimumCentAmount,
|
|
4285
|
+
value: tier.value || undefined,
|
|
4286
|
+
priceFunction: tier.priceFunction ? {
|
|
4287
|
+
function: tier.priceFunction.function,
|
|
4288
|
+
currencyCode: tier.priceFunction.currencyCode
|
|
4289
|
+
} : undefined,
|
|
4290
|
+
score: tier.score
|
|
4291
|
+
}
|
|
4292
|
+
}], []);
|
|
4293
|
+
}
|
|
4294
|
+
|
|
4295
|
+
/**
|
|
4296
|
+
* NOTE:
|
|
4297
|
+
* This module massages update actions produced by the JS SDK
|
|
4298
|
+
* to be compatible with CTP GraphQL mutations. This logic should be
|
|
4299
|
+
* moved into the JS SDK once discounts is fully 100% migrated to
|
|
4300
|
+
* GraphQL or any other plugin/app needs this functionality. Until
|
|
4301
|
+
* then this serves as a collective set of requirements before
|
|
4302
|
+
* prematurely adding a not fully working set of conversions to the
|
|
4303
|
+
* JS SDK.
|
|
4304
|
+
*/
|
|
4305
|
+
|
|
4306
|
+
const createAttributeTypeValue = attribute => {
|
|
4307
|
+
switch (attribute.type.name) {
|
|
4308
|
+
case 'set':
|
|
4309
|
+
return {
|
|
4310
|
+
set: {
|
|
4311
|
+
elementType: createAttributeTypeValue({
|
|
4312
|
+
type: attribute.type.elementType
|
|
4313
|
+
})
|
|
4314
|
+
}
|
|
4315
|
+
};
|
|
4316
|
+
case 'boolean':
|
|
4317
|
+
case 'date':
|
|
4318
|
+
case 'datetime':
|
|
4319
|
+
case 'ltext':
|
|
4320
|
+
case 'money':
|
|
4321
|
+
case 'number':
|
|
4322
|
+
case 'text':
|
|
4323
|
+
case 'time':
|
|
4324
|
+
return {
|
|
4325
|
+
[attribute.type.name]: {}
|
|
4326
|
+
};
|
|
4327
|
+
case 'enum':
|
|
4328
|
+
case 'lenum':
|
|
4329
|
+
return {
|
|
4330
|
+
[attribute.type.name]: {
|
|
4331
|
+
values: []
|
|
4332
|
+
}
|
|
4333
|
+
};
|
|
4334
|
+
case 'reference':
|
|
4335
|
+
{
|
|
4336
|
+
return {
|
|
4337
|
+
[attribute.type.name]: {
|
|
4338
|
+
referenceTypeId: attribute.type.referenceTypeId
|
|
4339
|
+
}
|
|
4340
|
+
};
|
|
4341
|
+
}
|
|
4342
|
+
default:
|
|
4343
|
+
return attribute.type;
|
|
4344
|
+
}
|
|
4716
4345
|
};
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4346
|
+
|
|
4347
|
+
/*
|
|
4348
|
+
* Fixed price supports high precision. Action format is nested with the
|
|
4349
|
+
* the type of the money. Absolute discount only works with cent precision,
|
|
4350
|
+
* hence the action structure is flat.
|
|
4351
|
+
*/
|
|
4352
|
+
const formatMoney = valueType => money => {
|
|
4353
|
+
switch (valueType) {
|
|
4354
|
+
case 'fixed':
|
|
4355
|
+
case 'fixedCart':
|
|
4356
|
+
return {
|
|
4357
|
+
[money.type]: _objectSpread$15({
|
|
4358
|
+
centAmount: money.centAmount,
|
|
4359
|
+
currencyCode: money.currencyCode
|
|
4360
|
+
}, money.type === PRECISION_TYPES.highPrecision && {
|
|
4361
|
+
preciseAmount: money.preciseAmount,
|
|
4362
|
+
fractionDigits: money.fractionDigits
|
|
4363
|
+
})
|
|
4364
|
+
};
|
|
4365
|
+
case 'absolute':
|
|
4366
|
+
case 'absoluteCart':
|
|
4367
|
+
return {
|
|
4368
|
+
centAmount: money.centAmount,
|
|
4369
|
+
currencyCode: money.currencyCode
|
|
4370
|
+
};
|
|
4371
|
+
default:
|
|
4372
|
+
throw new Error('Unexpected value type for money.');
|
|
4373
|
+
}
|
|
4720
4374
|
};
|
|
4721
|
-
|
|
4722
|
-
|
|
4375
|
+
|
|
4376
|
+
/**
|
|
4377
|
+
* converts the `changeValue` action to GraphQL actions variable
|
|
4378
|
+
* @param {Object} actionPayload
|
|
4379
|
+
*/
|
|
4380
|
+
const convertChangeValueAction = actionPayload => {
|
|
4381
|
+
const valueType = actionPayload.value.type;
|
|
4382
|
+
const possibleTypeKeys = {
|
|
4383
|
+
relative: ['permyriad'],
|
|
4384
|
+
absolute: ['money'],
|
|
4385
|
+
absoluteCart: ['money', 'applicationMode'],
|
|
4386
|
+
fixed: ['money'],
|
|
4387
|
+
fixedCart: ['money', 'applicationMode'],
|
|
4388
|
+
giftLineItem: ['product', 'variantId', 'distributionChannel', 'supplyChannel', 'ResourceIdentifierInput']
|
|
4389
|
+
};
|
|
4390
|
+
const filteredValue = pick__default["default"](actionPayload.value, possibleTypeKeys[valueType]);
|
|
4391
|
+
if (filteredValue.money) {
|
|
4392
|
+
var _context2;
|
|
4393
|
+
const moneyFormatter = formatMoney(valueType);
|
|
4394
|
+
filteredValue.money = _mapInstanceProperty__default["default"](_context2 = filteredValue.money).call(_context2, moneyFormatter);
|
|
4395
|
+
}
|
|
4396
|
+
return {
|
|
4397
|
+
changeValue: {
|
|
4398
|
+
value: {
|
|
4399
|
+
[valueType]: filteredValue
|
|
4400
|
+
}
|
|
4401
|
+
}
|
|
4402
|
+
};
|
|
4723
4403
|
};
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
return
|
|
4404
|
+
|
|
4405
|
+
/**
|
|
4406
|
+
* This function changes any payload after the actions have been computed.
|
|
4407
|
+
* Currently we only need to change the `setCustomField` action payload
|
|
4408
|
+
* as its dynamic content can not be typed in SDL for the mutation.
|
|
4409
|
+
*/
|
|
4410
|
+
const convertAction = (actionName, actionPayload) => {
|
|
4411
|
+
var _context3, _context4, _context5, _context6, _context7;
|
|
4412
|
+
const getNameFromPayload = payload => {
|
|
4413
|
+
// changeName for `Organizations`
|
|
4414
|
+
if (typeof payload.name === 'string') return payload;
|
|
4415
|
+
// changeName for `UserProfile`
|
|
4416
|
+
if (payload.firstName || payload.lastName) return payload;
|
|
4417
|
+
// assume `changeName` for LocalizedString type
|
|
4418
|
+
return {
|
|
4419
|
+
name: l10n.transformLocalizedStringToLocalizedField(payload.name)
|
|
4420
|
+
};
|
|
4421
|
+
};
|
|
4422
|
+
switch (actionName) {
|
|
4423
|
+
case 'changeName':
|
|
4424
|
+
return {
|
|
4425
|
+
[actionName]: getNameFromPayload(actionPayload)
|
|
4426
|
+
};
|
|
4427
|
+
case 'setDescription':
|
|
4428
|
+
case 'changeDescription':
|
|
4429
|
+
return {
|
|
4430
|
+
[actionName]: {
|
|
4431
|
+
description: getIsLocalizedString(actionPayload.description) ? l10n.transformLocalizedStringToLocalizedField(actionPayload.description) : actionPayload.description
|
|
4432
|
+
}
|
|
4433
|
+
};
|
|
4434
|
+
case 'setLocalizedDescription':
|
|
4435
|
+
return {
|
|
4436
|
+
[actionName]: {
|
|
4437
|
+
localizedDescription: l10n.transformLocalizedStringToLocalizedField(actionPayload.localizedDescription)
|
|
4438
|
+
}
|
|
4439
|
+
};
|
|
4440
|
+
case 'setName':
|
|
4441
|
+
return {
|
|
4442
|
+
[actionName]: getNameFromPayload(actionPayload)
|
|
4443
|
+
};
|
|
4444
|
+
case 'setLocalizedName':
|
|
4445
|
+
return {
|
|
4446
|
+
[actionName]: {
|
|
4447
|
+
localizedName: l10n.transformLocalizedStringToLocalizedField(actionPayload.localizedName)
|
|
4448
|
+
}
|
|
4449
|
+
};
|
|
4450
|
+
case 'setSlug':
|
|
4451
|
+
return {
|
|
4452
|
+
[actionName]: {
|
|
4453
|
+
slug: l10n.transformLocalizedStringToLocalizedField(actionPayload.slug)
|
|
4454
|
+
}
|
|
4455
|
+
};
|
|
4456
|
+
case 'setLineItemCustomField':
|
|
4457
|
+
return {
|
|
4458
|
+
[actionName]: {
|
|
4459
|
+
lineItemId: actionPayload.lineItemId,
|
|
4460
|
+
name: actionPayload.name,
|
|
4461
|
+
value: _JSON$stringify__default["default"](actionPayload.value)
|
|
4462
|
+
}
|
|
4463
|
+
};
|
|
4464
|
+
case 'setCustomLineItemCustomField':
|
|
4465
|
+
return {
|
|
4466
|
+
[actionName]: {
|
|
4467
|
+
customLineItemId: actionPayload.customLineItemId,
|
|
4468
|
+
name: actionPayload.name,
|
|
4469
|
+
value: _JSON$stringify__default["default"](actionPayload.value)
|
|
4470
|
+
}
|
|
4471
|
+
};
|
|
4472
|
+
case 'setCustomField':
|
|
4473
|
+
return {
|
|
4474
|
+
[actionName]: {
|
|
4475
|
+
name: actionPayload.name,
|
|
4476
|
+
value: _JSON$stringify__default["default"](actionPayload.value)
|
|
4477
|
+
}
|
|
4478
|
+
};
|
|
4479
|
+
case 'setCustomType':
|
|
4480
|
+
return {
|
|
4481
|
+
[actionName]: {
|
|
4482
|
+
typeId: actionPayload.type?.id,
|
|
4483
|
+
fields: actionPayload.fields ? _mapInstanceProperty__default["default"](_context3 = _Object$entries__default["default"](actionPayload.fields)).call(_context3, _ref => {
|
|
4484
|
+
let _ref2 = _slicedToArray(_ref, 2),
|
|
4485
|
+
customField = _ref2[0],
|
|
4486
|
+
value = _ref2[1];
|
|
4487
|
+
return {
|
|
4488
|
+
name: customField,
|
|
4489
|
+
value: _JSON$stringify__default["default"](value)
|
|
4490
|
+
};
|
|
4491
|
+
}) : undefined
|
|
4492
|
+
}
|
|
4493
|
+
};
|
|
4494
|
+
case 'removeLocation':
|
|
4495
|
+
return {
|
|
4496
|
+
[actionName]: {
|
|
4497
|
+
location: {
|
|
4498
|
+
country: actionPayload.location.country
|
|
4499
|
+
}
|
|
4500
|
+
}
|
|
4501
|
+
};
|
|
4502
|
+
case 'addLocation':
|
|
4503
|
+
return {
|
|
4504
|
+
[actionName]: {
|
|
4505
|
+
location: {
|
|
4506
|
+
country: actionPayload.location.country
|
|
4507
|
+
}
|
|
4508
|
+
}
|
|
4509
|
+
};
|
|
4510
|
+
case 'setGeoLocation':
|
|
4511
|
+
return {
|
|
4512
|
+
[actionName]: actionPayload?.geoLocation ? {
|
|
4513
|
+
geoLocation: {
|
|
4514
|
+
type: 'Point',
|
|
4515
|
+
coordinates: [_parseFloat__default["default"](actionPayload.geoLocation?.longitude), _parseFloat__default["default"](actionPayload.geoLocation?.latitude)]
|
|
4516
|
+
}
|
|
4517
|
+
} : {
|
|
4518
|
+
undefined
|
|
4519
|
+
}
|
|
4520
|
+
};
|
|
4521
|
+
case 'changeLabel':
|
|
4522
|
+
return {
|
|
4523
|
+
changeLabel: {
|
|
4524
|
+
attributeName: actionPayload.attributeName,
|
|
4525
|
+
label: l10n.transformLocalizedStringToLocalizedField(actionPayload.label)
|
|
4526
|
+
}
|
|
4527
|
+
};
|
|
4528
|
+
case 'setInputTip':
|
|
4529
|
+
return {
|
|
4530
|
+
setInputTip: {
|
|
4531
|
+
attributeName: actionPayload.attributeName,
|
|
4532
|
+
inputTip: l10n.transformLocalizedStringToLocalizedField(actionPayload.inputTip)
|
|
4533
|
+
}
|
|
4534
|
+
};
|
|
4535
|
+
case 'addAttributeDefinition':
|
|
4536
|
+
return {
|
|
4537
|
+
[actionName]: {
|
|
4538
|
+
attributeDefinition: _objectSpread$15(_objectSpread$15({}, actionPayload.attribute), {}, {
|
|
4539
|
+
label: l10n.transformLocalizedStringToLocalizedField(actionPayload.attribute.label),
|
|
4540
|
+
inputTip: l10n.transformLocalizedStringToLocalizedField(actionPayload.attribute.inputTip),
|
|
4541
|
+
type: createAttributeTypeValue(actionPayload.attribute)
|
|
4542
|
+
})
|
|
4543
|
+
}
|
|
4544
|
+
};
|
|
4545
|
+
case 'replaceTaxRate':
|
|
4546
|
+
return {
|
|
4547
|
+
[actionName]: {
|
|
4548
|
+
taxRate: {
|
|
4549
|
+
name: actionPayload.taxRate.name,
|
|
4550
|
+
country: actionPayload.taxRate.country,
|
|
4551
|
+
includedInPrice: actionPayload.taxRate.includedInPrice,
|
|
4552
|
+
amount: actionPayload.taxRate.amount,
|
|
4553
|
+
state: actionPayload.taxRate.state,
|
|
4554
|
+
key: actionPayload.taxRate.key,
|
|
4555
|
+
subRates: actionPayload.taxRate.subRates
|
|
4556
|
+
},
|
|
4557
|
+
taxRateId: actionPayload.taxRateId
|
|
4558
|
+
}
|
|
4559
|
+
};
|
|
4560
|
+
case 'addZone':
|
|
4561
|
+
return {
|
|
4562
|
+
[actionName]: {
|
|
4563
|
+
zone: {
|
|
4564
|
+
id: actionPayload.zone.id,
|
|
4565
|
+
typeId: actionPayload.zone.typeId
|
|
4566
|
+
}
|
|
4567
|
+
}
|
|
4568
|
+
};
|
|
4569
|
+
case 'removeZone':
|
|
4570
|
+
return {
|
|
4571
|
+
[actionName]: {
|
|
4572
|
+
zone: {
|
|
4573
|
+
id: actionPayload.zone.id,
|
|
4574
|
+
typeId: actionPayload.zone.typeId
|
|
4575
|
+
}
|
|
4576
|
+
}
|
|
4577
|
+
};
|
|
4578
|
+
case 'changeTaxCategory':
|
|
4579
|
+
return {
|
|
4580
|
+
[actionName]: {
|
|
4581
|
+
taxCategory: {
|
|
4582
|
+
id: actionPayload.taxCategory.id,
|
|
4583
|
+
typeId: actionPayload.taxCategory.typeId
|
|
4584
|
+
}
|
|
4585
|
+
}
|
|
4586
|
+
};
|
|
4587
|
+
case 'addShippingRate':
|
|
4588
|
+
return {
|
|
4589
|
+
[actionName]: {
|
|
4590
|
+
zone: {
|
|
4591
|
+
id: actionPayload.zone.id,
|
|
4592
|
+
typeId: actionPayload.zone.typeId
|
|
4593
|
+
},
|
|
4594
|
+
shippingRate: {
|
|
4595
|
+
price: {
|
|
4596
|
+
centAmount: actionPayload.shippingRate.price.centAmount,
|
|
4597
|
+
currencyCode: actionPayload.shippingRate.price.currencyCode
|
|
4598
|
+
},
|
|
4599
|
+
freeAbove: actionPayload.shippingRate.freeAbove ? {
|
|
4600
|
+
centAmount: actionPayload.shippingRate.freeAbove.centAmount,
|
|
4601
|
+
currencyCode: actionPayload.shippingRate.freeAbove.currencyCode
|
|
4602
|
+
} : undefined,
|
|
4603
|
+
tiers: actionPayload.shippingRate.tiers ? mapShippingRateTierToGraphQL(actionPayload.shippingRate.tiers) : undefined
|
|
4604
|
+
}
|
|
4605
|
+
}
|
|
4606
|
+
};
|
|
4607
|
+
case 'removeShippingRate':
|
|
4608
|
+
return {
|
|
4609
|
+
[actionName]: {
|
|
4610
|
+
zone: {
|
|
4611
|
+
id: actionPayload.zone.id,
|
|
4612
|
+
typeId: actionPayload.zone.typeId
|
|
4613
|
+
},
|
|
4614
|
+
shippingRate: {
|
|
4615
|
+
price: {
|
|
4616
|
+
centAmount: actionPayload.shippingRate.price.centAmount,
|
|
4617
|
+
currencyCode: actionPayload.shippingRate.price.currencyCode
|
|
4618
|
+
},
|
|
4619
|
+
freeAbove: actionPayload.shippingRate.freeAbove ? {
|
|
4620
|
+
centAmount: actionPayload.shippingRate.freeAbove.centAmount,
|
|
4621
|
+
currencyCode: actionPayload.shippingRate.freeAbove.currencyCode
|
|
4622
|
+
} : undefined,
|
|
4623
|
+
tiers: actionPayload.shippingRate.tiers ? mapShippingRateTierToGraphQL(actionPayload.shippingRate.tiers) : undefined
|
|
4624
|
+
}
|
|
4625
|
+
}
|
|
4626
|
+
};
|
|
4627
|
+
case 'changeValue':
|
|
4628
|
+
return convertChangeValueAction(actionPayload);
|
|
4629
|
+
// product-types -> attributes -> enum
|
|
4630
|
+
case 'addLocalizedEnumValue':
|
|
4631
|
+
return {
|
|
4632
|
+
[actionName]: {
|
|
4633
|
+
attributeName: actionPayload.attributeName,
|
|
4634
|
+
value: _objectSpread$15(_objectSpread$15({}, actionPayload.value), {}, {
|
|
4635
|
+
label: l10n.transformLocalizedStringToLocalizedField(actionPayload.value.label)
|
|
4636
|
+
})
|
|
4637
|
+
}
|
|
4638
|
+
};
|
|
4639
|
+
case 'changeLocalizedEnumValueLabel':
|
|
4640
|
+
return {
|
|
4641
|
+
[actionName]: {
|
|
4642
|
+
attributeName: actionPayload.attributeName,
|
|
4643
|
+
newValue: _objectSpread$15(_objectSpread$15({}, actionPayload.newValue), {}, {
|
|
4644
|
+
label: l10n.transformLocalizedStringToLocalizedField(actionPayload.newValue.label)
|
|
4645
|
+
})
|
|
4646
|
+
}
|
|
4647
|
+
};
|
|
4648
|
+
case 'setShippingRateInputType':
|
|
4649
|
+
return {
|
|
4650
|
+
[actionName]: {
|
|
4651
|
+
shippingRateInputType: actionPayload.shippingRateInputType?.type ? {
|
|
4652
|
+
[actionPayload.shippingRateInputType.type]: {
|
|
4653
|
+
values: actionPayload.shippingRateInputType.type === 'CartClassification' ? _mapInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](actionPayload.shippingRateInputType)).call(_context4, value => ({
|
|
4654
|
+
key: value.key,
|
|
4655
|
+
label: value.allLocaleLabels
|
|
4656
|
+
})) : undefined
|
|
4657
|
+
}
|
|
4658
|
+
} : undefined
|
|
4659
|
+
}
|
|
4660
|
+
};
|
|
4661
|
+
case 'addCustomLineItem':
|
|
4662
|
+
{
|
|
4663
|
+
return {
|
|
4664
|
+
[actionName]: {
|
|
4665
|
+
slug: actionPayload.slug,
|
|
4666
|
+
quantity: actionPayload.quantity,
|
|
4667
|
+
name: l10n.transformLocalizedStringToLocalizedField(actionPayload.name),
|
|
4668
|
+
taxCategory: actionPayload.taxCategory,
|
|
4669
|
+
money: {
|
|
4670
|
+
[actionPayload.money.type]: _objectSpread$15({
|
|
4671
|
+
centAmount: actionPayload.money.centAmount,
|
|
4672
|
+
currencyCode: actionPayload.money.currencyCode
|
|
4673
|
+
}, actionPayload.money.type === PRECISION_TYPES.highPrecision && {
|
|
4674
|
+
preciseAmount: actionPayload.money.preciseAmount,
|
|
4675
|
+
fractionDigits: actionPayload.money.fractionDigits
|
|
4676
|
+
})
|
|
4677
|
+
}
|
|
4678
|
+
}
|
|
4679
|
+
};
|
|
4680
|
+
}
|
|
4681
|
+
case 'setDataFences':
|
|
4682
|
+
return {
|
|
4683
|
+
[actionName]: {
|
|
4684
|
+
dataFences: _reduceInstanceProperty__default["default"](_context5 = actionPayload.dataFences).call(_context5, (nextDataFences, dataFence) => {
|
|
4685
|
+
if (dataFence.type.toLowerCase() === 'store') return [...nextDataFences, {
|
|
4686
|
+
[dataFence.type.toLowerCase()]: {
|
|
4687
|
+
storeKeys: dataFence.storeKeys
|
|
4688
|
+
}
|
|
4689
|
+
}];
|
|
4690
|
+
return nextDataFences;
|
|
4691
|
+
}, [])
|
|
4692
|
+
}
|
|
4693
|
+
};
|
|
4694
|
+
case 'changeTarget':
|
|
4695
|
+
return {
|
|
4696
|
+
[actionName]: {
|
|
4697
|
+
target: {
|
|
4698
|
+
[actionPayload.target.type]: _objectSpread$15(_objectSpread$15(_objectSpread$15({}, omit__default["default"](actionPayload.target, ['type', '__typename'])), actionPayload.target.triggerPattern && {
|
|
4699
|
+
triggerPattern: _mapInstanceProperty__default["default"](_context6 = actionPayload.target.triggerPattern).call(_context6, pattern => ({
|
|
4700
|
+
[pattern.type]: omit__default["default"](pattern, ['type', '__typename'])
|
|
4701
|
+
}))
|
|
4702
|
+
}), actionPayload.target.targetPattern && {
|
|
4703
|
+
targetPattern: _mapInstanceProperty__default["default"](_context7 = actionPayload.target.targetPattern).call(_context7, pattern => ({
|
|
4704
|
+
[pattern.type]: omit__default["default"](pattern, ['type', '__typename'])
|
|
4705
|
+
}))
|
|
4706
|
+
})
|
|
4707
|
+
}
|
|
4708
|
+
}
|
|
4709
|
+
};
|
|
4710
|
+
case 'addAddress':
|
|
4711
|
+
case 'changeAddress':
|
|
4712
|
+
{
|
|
4713
|
+
var _context8;
|
|
4714
|
+
const _ref3 = actionPayload.address?.custom || {},
|
|
4715
|
+
_ref3$fields = _ref3.fields,
|
|
4716
|
+
fields = _ref3$fields === void 0 ? {} : _ref3$fields;
|
|
4717
|
+
const customFields = isEmpty__default["default"](fields) ? null : _mapInstanceProperty__default["default"](_context8 = _Object$entries__default["default"](fields)).call(_context8, _ref4 => {
|
|
4718
|
+
let _ref5 = _slicedToArray(_ref4, 2),
|
|
4719
|
+
name = _ref5[0],
|
|
4720
|
+
value = _ref5[1];
|
|
4721
|
+
return {
|
|
4722
|
+
name,
|
|
4723
|
+
value: _JSON$stringify__default["default"](value)
|
|
4724
|
+
};
|
|
4725
|
+
});
|
|
4726
|
+
const custom = actionPayload.address?.custom?.type?.id ? {
|
|
4727
|
+
type: {
|
|
4728
|
+
id: actionPayload.address.custom.type.id
|
|
4729
|
+
},
|
|
4730
|
+
fields: customFields
|
|
4731
|
+
} : null;
|
|
4732
|
+
return {
|
|
4733
|
+
[actionName]: _objectSpread$15(_objectSpread$15({}, actionPayload), {}, {
|
|
4734
|
+
address: _objectSpread$15(_objectSpread$15({}, omit__default["default"](actionPayload.address, ['__typename'])), {}, {
|
|
4735
|
+
custom
|
|
4736
|
+
})
|
|
4737
|
+
})
|
|
4738
|
+
};
|
|
4739
|
+
}
|
|
4740
|
+
case 'setAddressCustomType':
|
|
4741
|
+
{
|
|
4742
|
+
var _context9;
|
|
4743
|
+
const _ref6 = actionPayload || {},
|
|
4744
|
+
addressId = _ref6.addressId,
|
|
4745
|
+
_ref6$fields = _ref6.fields,
|
|
4746
|
+
fields = _ref6$fields === void 0 ? {} : _ref6$fields,
|
|
4747
|
+
type = _ref6.type;
|
|
4748
|
+
const customFields = isEmpty__default["default"](fields) ? null : _mapInstanceProperty__default["default"](_context9 = _Object$entries__default["default"](fields)).call(_context9, _ref7 => {
|
|
4749
|
+
let _ref8 = _slicedToArray(_ref7, 2),
|
|
4750
|
+
name = _ref8[0],
|
|
4751
|
+
value = _ref8[1];
|
|
4752
|
+
return {
|
|
4753
|
+
name,
|
|
4754
|
+
value: _JSON$stringify__default["default"](value)
|
|
4755
|
+
};
|
|
4756
|
+
});
|
|
4757
|
+
const customType = type?.id ? {
|
|
4758
|
+
id: type.id
|
|
4759
|
+
} : null;
|
|
4760
|
+
return {
|
|
4761
|
+
[actionName]: {
|
|
4762
|
+
addressId,
|
|
4763
|
+
fields: customFields,
|
|
4764
|
+
type: customType
|
|
4765
|
+
}
|
|
4766
|
+
};
|
|
4767
|
+
}
|
|
4768
|
+
default:
|
|
4769
|
+
return {
|
|
4770
|
+
[actionName]: actionPayload
|
|
4771
|
+
};
|
|
4735
4772
|
}
|
|
4736
|
-
const formatter = getFormatter(type);
|
|
4737
|
-
return formatter({
|
|
4738
|
-
type,
|
|
4739
|
-
value,
|
|
4740
|
-
intl,
|
|
4741
|
-
language,
|
|
4742
|
-
languages,
|
|
4743
|
-
userTimeZone,
|
|
4744
|
-
fallbackValue
|
|
4745
|
-
});
|
|
4746
|
-
}
|
|
4747
|
-
|
|
4748
|
-
const attributeTypeNames = {
|
|
4749
|
-
Boolean: 'boolean',
|
|
4750
|
-
Date: 'date',
|
|
4751
|
-
DateTime: 'datetime',
|
|
4752
|
-
Enum: 'enum',
|
|
4753
|
-
LocalizedEnum: 'lenum',
|
|
4754
|
-
LocalizedString: 'ltext',
|
|
4755
|
-
Money: 'money',
|
|
4756
|
-
Nested: 'nested',
|
|
4757
|
-
Reference: 'reference',
|
|
4758
|
-
Set: 'set',
|
|
4759
|
-
String: 'text',
|
|
4760
|
-
Time: 'time',
|
|
4761
|
-
Number: 'number'
|
|
4762
|
-
};
|
|
4763
|
-
const convertToAttributeType = customFieldType => {
|
|
4764
|
-
if (isNil__default["default"](customFieldType)) return customFieldType;
|
|
4765
|
-
const attributeTypeName = attributeTypeNames[customFieldType.name];
|
|
4766
|
-
const elementTypeName = attributeTypeNames[customFieldType.elementType?.name];
|
|
4767
|
-
return {
|
|
4768
|
-
name: attributeTypeName,
|
|
4769
|
-
elementType: {
|
|
4770
|
-
name: elementTypeName
|
|
4771
|
-
}
|
|
4772
|
-
};
|
|
4773
4773
|
};
|
|
4774
|
-
const
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4774
|
+
const createGraphQlUpdateActions = actions => _reduceInstanceProperty__default["default"](actions).call(actions, (previousActions, _ref9) => {
|
|
4775
|
+
let actionName = _ref9.action,
|
|
4776
|
+
actionPayload = _objectWithoutProperties(_ref9, _excluded$d);
|
|
4777
|
+
return [...previousActions, convertAction(actionName, actionPayload)];
|
|
4778
|
+
}, []);
|
|
4779
|
+
const extractErrorFromGraphQlResponse = graphQlResponse => {
|
|
4780
|
+
if (graphQlResponse.networkError?.result?.errors?.length > 0) {
|
|
4781
|
+
return graphQlResponse.networkError.result.errors;
|
|
4778
4782
|
}
|
|
4779
|
-
if (
|
|
4780
|
-
|
|
4781
|
-
return _findInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](type)).call(_context, enumValue => enumValue.key === value);
|
|
4783
|
+
if (graphQlResponse.graphQLErrors?.length > 0) {
|
|
4784
|
+
return graphQlResponse.graphQLErrors;
|
|
4782
4785
|
}
|
|
4783
|
-
return
|
|
4784
|
-
};
|
|
4785
|
-
|
|
4786
|
-
/**
|
|
4787
|
-
* Formats `Custom Fields`: https://docs.commercetools.com/api/projects/custom-fields
|
|
4788
|
-
* Despite having different names, most of `Custom Field` maps one-to-one with an appropriate
|
|
4789
|
-
* `Product Attribute Type`, hence we can reuse product attributes formatting logic.
|
|
4790
|
-
*
|
|
4791
|
-
* The only exception is `Enum` and `LEnum` types. Unlike when dealing with `Product Attribute Types`,
|
|
4792
|
-
* value in `Custom Fields` contains a key of an `Enum` entry, and not an entry itself.
|
|
4793
|
-
* Therefore, before passing value to attributes formatter we need to replace value with Enum entry.
|
|
4794
|
-
*/
|
|
4795
|
-
function formatCustomField(_ref) {
|
|
4796
|
-
let type = _ref.type,
|
|
4797
|
-
value = _ref.value,
|
|
4798
|
-
intl = _ref.intl,
|
|
4799
|
-
language = _ref.language,
|
|
4800
|
-
languages = _ref.languages,
|
|
4801
|
-
userTimeZone = _ref.userTimeZone;
|
|
4802
|
-
const attributeType = convertToAttributeType(type);
|
|
4803
|
-
return formatAttribute({
|
|
4804
|
-
type: attributeType,
|
|
4805
|
-
value: inlineEnumValues(type, value),
|
|
4806
|
-
intl,
|
|
4807
|
-
language,
|
|
4808
|
-
languages,
|
|
4809
|
-
userTimeZone
|
|
4810
|
-
});
|
|
4811
|
-
}
|
|
4812
|
-
|
|
4813
|
-
// FIXME: delete once prefix search is supported in ctp api
|
|
4814
|
-
|
|
4815
|
-
// Currently prefix search of products in the ctp is not supported.
|
|
4816
|
-
// This is a temporary hack which should be deleted once the feature is
|
|
4817
|
-
// supported in ctp.
|
|
4818
|
-
// It mimics the prefix search feature by computing lower and upper bounds
|
|
4819
|
-
// related to the provided `input`.
|
|
4820
|
-
// usage:
|
|
4821
|
-
// If I want to do a prefix search of term 'F', I get first the bounds
|
|
4822
|
-
// const [lowerBound, upperBound] = getPrefixSearch('F');
|
|
4823
|
-
// and then use them in the search
|
|
4824
|
-
// e.g
|
|
4825
|
-
// where: `masterData(current(name(en >= "${lowerBound}" and en < "${upperBound}")))`
|
|
4826
|
-
const getPrefixSearchBounds = input => {
|
|
4827
|
-
const getNextCharacter = character => String.fromCharCode(character.charCodeAt() + 1);
|
|
4828
|
-
return [input, `${_sliceInstanceProperty__default["default"](input).call(input, 0, input.length - 1)}${getNextCharacter(_sliceInstanceProperty__default["default"](input).call(input, input.length - 1))}`];
|
|
4786
|
+
return graphQlResponse;
|
|
4829
4787
|
};
|
|
4830
|
-
var getPrefixSearchBounds$1 = getPrefixSearchBounds;
|
|
4831
4788
|
|
|
4832
4789
|
const isUUID = string => /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/.test(string);
|
|
4833
4790
|
var isUUID$1 = isUUID;
|
|
@@ -5227,7 +5184,7 @@ function uniqueObjects(items) {
|
|
|
5227
5184
|
|
|
5228
5185
|
*/
|
|
5229
5186
|
|
|
5230
|
-
const messages$
|
|
5187
|
+
const messages$K = reactIntl.defineMessages({
|
|
5231
5188
|
unique: {
|
|
5232
5189
|
id: 'Validation.unique',
|
|
5233
5190
|
description: 'An error message to show if the field must be unique',
|
|
@@ -5269,7 +5226,7 @@ const messages$J = reactIntl.defineMessages({
|
|
|
5269
5226
|
defaultMessage: 'Invalid ID format. Please enter a valid ID.'
|
|
5270
5227
|
}
|
|
5271
5228
|
});
|
|
5272
|
-
var validationMessages = messages$
|
|
5229
|
+
var validationMessages = messages$K;
|
|
5273
5230
|
|
|
5274
5231
|
function getIndexesOfInvalidValues(values) {
|
|
5275
5232
|
let invalidValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
@@ -5528,7 +5485,7 @@ function ReferenceSearch(props) {
|
|
|
5528
5485
|
});
|
|
5529
5486
|
}
|
|
5530
5487
|
|
|
5531
|
-
const messages$
|
|
5488
|
+
const messages$I = reactIntl.defineMessages({
|
|
5532
5489
|
placeholder: {
|
|
5533
5490
|
id: 'CartDiscountReferenceSearch.placeholder',
|
|
5534
5491
|
description: 'Placeholder for search for a cart discount',
|
|
@@ -5555,7 +5512,7 @@ const messages$H = reactIntl.defineMessages({
|
|
|
5555
5512
|
defaultMessage: 'Enter search term'
|
|
5556
5513
|
}
|
|
5557
5514
|
});
|
|
5558
|
-
var messages$
|
|
5515
|
+
var messages$J = messages$I;
|
|
5559
5516
|
|
|
5560
5517
|
function ownKeys$11(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; }
|
|
5561
5518
|
function _objectSpread$11(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$11(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$11(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
@@ -5580,7 +5537,7 @@ function Option$1(props) {
|
|
|
5580
5537
|
fallbackOrder: languages
|
|
5581
5538
|
})
|
|
5582
5539
|
}), jsxRuntime.jsxs(uiKit.Text.Detail, {
|
|
5583
|
-
children: [formatMessage(messages$
|
|
5540
|
+
children: [formatMessage(messages$J.key), ": ", cartDiscount.key || constants.NO_VALUE_FALLBACK]
|
|
5584
5541
|
})]
|
|
5585
5542
|
})
|
|
5586
5543
|
}));
|
|
@@ -5656,10 +5613,10 @@ function CartDiscountReferenceSearch(props) {
|
|
|
5656
5613
|
onBlur: props.onBlur,
|
|
5657
5614
|
onChange: props.onChange,
|
|
5658
5615
|
value: returnNullIfEmpty(props.value),
|
|
5659
|
-
placeholderLabel: formatMessage(messages$
|
|
5660
|
-
searchPromptLabel: formatMessage(messages$
|
|
5661
|
-
noResultsLabel: formatMessage(messages$
|
|
5662
|
-
referenceIsMissingLabel: formatMessage(messages$
|
|
5616
|
+
placeholderLabel: formatMessage(messages$J.placeholder),
|
|
5617
|
+
searchPromptLabel: formatMessage(messages$J.searchPrompt),
|
|
5618
|
+
noResultsLabel: formatMessage(messages$J.noResults),
|
|
5619
|
+
referenceIsMissingLabel: formatMessage(messages$J.isMissing),
|
|
5663
5620
|
mapItemToOption: mapItemToOption,
|
|
5664
5621
|
loadItemsBySearchTerm: loadItemsBySearchTerm,
|
|
5665
5622
|
loadItemsByIds: loadItemsByIds,
|
|
@@ -5669,7 +5626,7 @@ function CartDiscountReferenceSearch(props) {
|
|
|
5669
5626
|
});
|
|
5670
5627
|
}
|
|
5671
5628
|
|
|
5672
|
-
const messages$
|
|
5629
|
+
const messages$G = reactIntl.defineMessages({
|
|
5673
5630
|
placeholder: {
|
|
5674
5631
|
id: 'CategoryReferenceSearch.placeholder',
|
|
5675
5632
|
description: 'Placeholder for search for a category',
|
|
@@ -5701,7 +5658,7 @@ const messages$F = reactIntl.defineMessages({
|
|
|
5701
5658
|
defaultMessage: 'Parent Category'
|
|
5702
5659
|
}
|
|
5703
5660
|
});
|
|
5704
|
-
var messages$
|
|
5661
|
+
var messages$H = messages$G;
|
|
5705
5662
|
|
|
5706
5663
|
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; }
|
|
5707
5664
|
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; }
|
|
@@ -5726,7 +5683,7 @@ function Option(props) {
|
|
|
5726
5683
|
fallbackOrder: languages
|
|
5727
5684
|
})
|
|
5728
5685
|
}), category.parent && jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
5729
|
-
children: `${formatMessage(messages$
|
|
5686
|
+
children: `${formatMessage(messages$H.parentCategory)}: ${l10n.formatLocalizedString(category.parent, {
|
|
5730
5687
|
key: 'name',
|
|
5731
5688
|
locale: language,
|
|
5732
5689
|
fallbackOrder: languages
|
|
@@ -5738,7 +5695,7 @@ function Option(props) {
|
|
|
5738
5695
|
fallbackOrder: languages
|
|
5739
5696
|
})}`
|
|
5740
5697
|
}), category.externalId && jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
5741
|
-
children: `${formatMessage(messages$
|
|
5698
|
+
children: `${formatMessage(messages$H.externalId)}: ${category.externalId || constants.NO_VALUE_FALLBACK}`
|
|
5742
5699
|
})]
|
|
5743
5700
|
})
|
|
5744
5701
|
}));
|
|
@@ -5786,10 +5743,10 @@ function CategoryReferenceSearch(props) {
|
|
|
5786
5743
|
onBlur: props.onBlur,
|
|
5787
5744
|
onChange: props.onChange,
|
|
5788
5745
|
value: props.value,
|
|
5789
|
-
placeholderLabel: formatMessage(messages$
|
|
5790
|
-
searchPromptLabel: formatMessage(messages$
|
|
5791
|
-
noResultsLabel: formatMessage(messages$
|
|
5792
|
-
referenceIsMissingLabel: formatMessage(messages$
|
|
5746
|
+
placeholderLabel: formatMessage(messages$H.placeholder),
|
|
5747
|
+
searchPromptLabel: formatMessage(messages$H.searchPrompt),
|
|
5748
|
+
noResultsLabel: formatMessage(messages$H.noResults),
|
|
5749
|
+
referenceIsMissingLabel: formatMessage(messages$H.isMissing),
|
|
5793
5750
|
mapItemToOption: mapItemToOption,
|
|
5794
5751
|
loadItemsBySearchTerm: loadItemsBySearchTerm,
|
|
5795
5752
|
loadItemsByIds: loadItemsByIds,
|
|
@@ -5866,7 +5823,7 @@ const Button = _ref => {
|
|
|
5866
5823
|
Button.displayName = 'Button';
|
|
5867
5824
|
var Button$1 = Button;
|
|
5868
5825
|
|
|
5869
|
-
var messages$
|
|
5826
|
+
var messages$F = reactIntl.defineMessages({
|
|
5870
5827
|
chooseFile: {
|
|
5871
5828
|
id: 'ButtonFileInput.chooseFile',
|
|
5872
5829
|
description: 'The label text of the field for upload local file',
|
|
@@ -5883,7 +5840,7 @@ var styles$f = {
|
|
|
5883
5840
|
};
|
|
5884
5841
|
const FileInput = _ref => {
|
|
5885
5842
|
let _ref$children = _ref.children,
|
|
5886
|
-
children = _ref$children === void 0 ? jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$Y({}, messages$
|
|
5843
|
+
children = _ref$children === void 0 ? jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$Y({}, messages$F.chooseFile)) : _ref$children,
|
|
5887
5844
|
_ref$allowMultiple = _ref.allowMultiple,
|
|
5888
5845
|
allowMultiple = _ref$allowMultiple === void 0 ? false : _ref$allowMultiple,
|
|
5889
5846
|
_ref$acceptTypes = _ref.acceptTypes,
|
|
@@ -5906,7 +5863,7 @@ const FileInput = _ref => {
|
|
|
5906
5863
|
FileInput.displayName = 'FileInput';
|
|
5907
5864
|
var FileInput$1 = FileInput;
|
|
5908
5865
|
|
|
5909
|
-
var messages$
|
|
5866
|
+
var messages$E = reactIntl.defineMessages({
|
|
5910
5867
|
countriesBasicSelectPlaceholder: {
|
|
5911
5868
|
id: 'CountriesPicker.countriesBasicSelectPlaceholder',
|
|
5912
5869
|
description: 'Placeholder of the basic field for countries',
|
|
@@ -5927,7 +5884,7 @@ var messages$D = reactIntl.defineMessages({
|
|
|
5927
5884
|
function ownKeys$X(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; }
|
|
5928
5885
|
function _objectSpread$X(e) { for (var r = 1; r < arguments.length; r++) { var _context8, _context9; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context8 = ownKeys$X(Object(t), !0)).call(_context8, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context9 = ownKeys$X(Object(t))).call(_context9, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
5929
5886
|
const emptyCountryOption = intl => [{
|
|
5930
|
-
label: intl.formatMessage(messages$
|
|
5887
|
+
label: intl.formatMessage(messages$E.countriesAsyncSelectDropdownTypeAheadPrompt),
|
|
5931
5888
|
value: undefined,
|
|
5932
5889
|
isDisabled: true
|
|
5933
5890
|
}];
|
|
@@ -5970,7 +5927,7 @@ function CountriesAsyncSelectDropdown(props) {
|
|
|
5970
5927
|
var _context7;
|
|
5971
5928
|
return _findInstanceProperty__default["default"](_context7 = props.options).call(_context7, country => country.value === countryCode);
|
|
5972
5929
|
}),
|
|
5973
|
-
placeholder: intl.formatMessage(messages$
|
|
5930
|
+
placeholder: intl.formatMessage(messages$E.countriesAsyncSelectPlaceholder),
|
|
5974
5931
|
loadOptions: handleLoadOptions,
|
|
5975
5932
|
onChange: onOptionChange,
|
|
5976
5933
|
isDisabled: props.isDisabled,
|
|
@@ -5990,7 +5947,7 @@ function CountriesBasicSelectDropdown(props) {
|
|
|
5990
5947
|
value: props.value,
|
|
5991
5948
|
isRequired: props.isRequired,
|
|
5992
5949
|
description: props.description,
|
|
5993
|
-
placeholder: intl.formatMessage(messages$
|
|
5950
|
+
placeholder: intl.formatMessage(messages$E.countriesBasicSelectPlaceholder),
|
|
5994
5951
|
options: props.options,
|
|
5995
5952
|
onChange: props.onChange,
|
|
5996
5953
|
isDisabled: props.isDisabled,
|
|
@@ -6026,7 +5983,7 @@ function CountriesPicker(_ref) {
|
|
|
6026
5983
|
});
|
|
6027
5984
|
}
|
|
6028
5985
|
|
|
6029
|
-
var messages$
|
|
5986
|
+
var messages$D = reactIntl.defineMessages({
|
|
6030
5987
|
noCustomerGroupsFound: {
|
|
6031
5988
|
id: 'Prices.CustomerGroupPickerInput.noCustomerGroupsFound',
|
|
6032
5989
|
description: 'The message to display when no customer groups were found',
|
|
@@ -6116,7 +6073,7 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
6116
6073
|
if (isCurrentOptionLoadingFailed) onError(currentOption.error);
|
|
6117
6074
|
}, [isCurrentOptionLoadingFailed, onError, currentOption]);
|
|
6118
6075
|
const isLoadingFailed = isCurrentOptionLoadingFailed || Boolean(loadingError);
|
|
6119
|
-
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$
|
|
6076
|
+
const handleNoOptions = React.useCallback(() => loadingError ? null : formatMessage(messages$D.noCustomerGroupsFound), [loadingError, formatMessage]);
|
|
6120
6077
|
const tooltipTitle = currentOption?.data?.label ?? '';
|
|
6121
6078
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
6122
6079
|
max: "scale",
|
|
@@ -6127,7 +6084,7 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
6127
6084
|
children: jsxRuntime.jsx(uiKit.AsyncSelectInput, {
|
|
6128
6085
|
id: name,
|
|
6129
6086
|
name: name,
|
|
6130
|
-
placeholder: placeholder ?? formatMessage(messages$
|
|
6087
|
+
placeholder: placeholder ?? formatMessage(messages$D.placeholder),
|
|
6131
6088
|
loadOptions: loadOptionsDebounced,
|
|
6132
6089
|
defaultOptions: true,
|
|
6133
6090
|
showOptionGroupDivider: true,
|
|
@@ -6146,7 +6103,7 @@ const CustomerGroupPickerInput = _ref => {
|
|
|
6146
6103
|
})
|
|
6147
6104
|
}), isLoadingFailed && jsxRuntime.jsx(uiKit.Text.Body, {
|
|
6148
6105
|
tone: "negative",
|
|
6149
|
-
intlMessage:
|
|
6106
|
+
intlMessage: commonPickerMessages.loadingErrorMessage
|
|
6150
6107
|
})]
|
|
6151
6108
|
})
|
|
6152
6109
|
});
|
|
@@ -6162,7 +6119,8 @@ var styles$e = {
|
|
|
6162
6119
|
"divider-dashed": "divider-module__divider-dashed___2Em8A divider-module__divider___4-vdy"
|
|
6163
6120
|
};
|
|
6164
6121
|
function Divider(_ref) {
|
|
6165
|
-
let isDashed = _ref.isDashed,
|
|
6122
|
+
let _ref$isDashed = _ref.isDashed,
|
|
6123
|
+
isDashed = _ref$isDashed === void 0 ? false : _ref$isDashed,
|
|
6166
6124
|
_ref$orientation = _ref.orientation,
|
|
6167
6125
|
orientation = _ref$orientation === void 0 ? 'horizontal' : _ref$orientation;
|
|
6168
6126
|
return jsxRuntime.jsx("hr", {
|
|
@@ -6233,12 +6191,13 @@ const mergeSetItemsErrors = errors => _reduceInstanceProperty__default["default"
|
|
|
6233
6191
|
const CustomFieldErrors = props => {
|
|
6234
6192
|
// We want to highlight fields with errors not only after a form submission,
|
|
6235
6193
|
// but also after manually triggered form validation.
|
|
6236
|
-
const
|
|
6194
|
+
const _useFormikContext = formik.useFormikContext(),
|
|
6195
|
+
isFormValid = _useFormikContext.isValid;
|
|
6237
6196
|
const errors = _Array$isArray__default["default"](props.errors) ? mergeSetItemsErrors(props.errors) : props.errors;
|
|
6238
6197
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6239
|
-
children: [props.isTouched ||
|
|
6198
|
+
children: [props.isTouched || !isFormValid && errors?.missing && jsxRuntime.jsx(_.ErrorMessage, {
|
|
6240
6199
|
intlMessage: validationMessages.required
|
|
6241
|
-
}), props.isTouched ||
|
|
6200
|
+
}), props.isTouched || !isFormValid && errors?.duplicated && jsxRuntime.jsx(_.ErrorMessage, {
|
|
6242
6201
|
intlMessage: validationMessages.unique
|
|
6243
6202
|
})]
|
|
6244
6203
|
});
|
|
@@ -6263,7 +6222,7 @@ const makeChangeHandler = setValue => event => {
|
|
|
6263
6222
|
// attributes.
|
|
6264
6223
|
const omitUnknownValues = (valuesAsMap, fieldDefinitionsAsMap) => omitBy__default["default"](valuesAsMap, (value, key) => isNil__default["default"](fieldDefinitionsAsMap[key]));
|
|
6265
6224
|
|
|
6266
|
-
var messages$
|
|
6225
|
+
var messages$C = reactIntl.defineMessages({
|
|
6267
6226
|
booleanSetInputYesLabel: {
|
|
6268
6227
|
id: 'CustomBooleanInputSet.booleanSetInputYesLabel',
|
|
6269
6228
|
description: 'Custom boolean input set Yes label',
|
|
@@ -6305,13 +6264,13 @@ function CustomBooleanInputSet(props) {
|
|
|
6305
6264
|
formatMessage = _useIntl.formatMessage;
|
|
6306
6265
|
const options = React.useMemo(() => [{
|
|
6307
6266
|
value: 'true',
|
|
6308
|
-
label: formatMessage(messages$
|
|
6267
|
+
label: formatMessage(messages$C.booleanSetInputYesLabel)
|
|
6309
6268
|
}, {
|
|
6310
6269
|
value: 'false',
|
|
6311
|
-
label: formatMessage(messages$
|
|
6270
|
+
label: formatMessage(messages$C.booleanSetInputNoLabel)
|
|
6312
6271
|
}, {
|
|
6313
6272
|
value: 'all',
|
|
6314
|
-
label: formatMessage(messages$
|
|
6273
|
+
label: formatMessage(messages$C.booleanSetInputAllLabel)
|
|
6315
6274
|
}], [formatMessage]);
|
|
6316
6275
|
const handleChange = makeChangeHandler(rawValue => {
|
|
6317
6276
|
const nullifiedIfNeeded = !rawValue ? undefined : valueToBooleanSet(rawValue);
|
|
@@ -6895,7 +6854,7 @@ const NestingLevelContext = /*#__PURE__*/React.createContext(0);
|
|
|
6895
6854
|
var NestingLevelContext$1 = NestingLevelContext;
|
|
6896
6855
|
|
|
6897
6856
|
// eslint-disable-next-line import/prefer-default-export
|
|
6898
|
-
const messages$
|
|
6857
|
+
const messages$B = reactIntl.defineMessages({
|
|
6899
6858
|
aboveFifthLevelWarning: {
|
|
6900
6859
|
id: 'attributeInputByType.nestedAttributes.aboveFifthLevelWarning',
|
|
6901
6860
|
description: 'Warning message shown when nested attribute are above the fifth level',
|
|
@@ -6907,9 +6866,9 @@ const messages$A = reactIntl.defineMessages({
|
|
|
6907
6866
|
defaultMessage: 'Empty'
|
|
6908
6867
|
}
|
|
6909
6868
|
});
|
|
6910
|
-
var customFieldsMessages = messages$
|
|
6869
|
+
var customFieldsMessages = messages$B;
|
|
6911
6870
|
|
|
6912
|
-
var messages$
|
|
6871
|
+
var messages$A = reactIntl.defineMessages({
|
|
6913
6872
|
updateButton: {
|
|
6914
6873
|
id: 'NestedAttributes.Details.updateButton',
|
|
6915
6874
|
description: 'Update button label',
|
|
@@ -6994,7 +6953,7 @@ const EditButton = props => {
|
|
|
6994
6953
|
formatMessage = _useIntl.formatMessage;
|
|
6995
6954
|
return jsxRuntime.jsx(uiKit.Tooltip, {
|
|
6996
6955
|
placement: "top",
|
|
6997
|
-
title: formatMessage(messages$
|
|
6956
|
+
title: formatMessage(messages$A.editTooltip),
|
|
6998
6957
|
children: jsxRuntime.jsx(uiKit.IconButton, {
|
|
6999
6958
|
label: "Edit",
|
|
7000
6959
|
isDisabled: props.isDisabled,
|
|
@@ -7010,12 +6969,12 @@ const DropChangesConfirmation = props => {
|
|
|
7010
6969
|
formatMessage = _useIntl2.formatMessage;
|
|
7011
6970
|
return jsxRuntime.jsx(applicationComponents.ConfirmationDialog, {
|
|
7012
6971
|
isOpen: props.isOpen || false,
|
|
7013
|
-
title: formatMessage(messages$
|
|
7014
|
-
labelPrimary: formatMessage(messages$
|
|
6972
|
+
title: formatMessage(messages$A.confirmationDialogTitle),
|
|
6973
|
+
labelPrimary: formatMessage(messages$A.nestedAttributesConfirmLabel),
|
|
7015
6974
|
onConfirm: props.onConfirm,
|
|
7016
6975
|
onCancel: props.onCancel,
|
|
7017
6976
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
7018
|
-
intlMessage: messages$
|
|
6977
|
+
intlMessage: messages$A.confirmationDialogBody
|
|
7019
6978
|
})
|
|
7020
6979
|
});
|
|
7021
6980
|
};
|
|
@@ -7040,11 +6999,11 @@ const NestedAttributeModalPage = props => {
|
|
|
7040
6999
|
children: [jsxRuntime.jsx(uiKit.SecondaryButton, {
|
|
7041
7000
|
isDisabled: !formik$1.dirty,
|
|
7042
7001
|
iconLeft: jsxRuntime.jsx(uiKit.RevertIcon, {}),
|
|
7043
|
-
label: formatMessage(messages$
|
|
7002
|
+
label: formatMessage(messages$A.cancelButton),
|
|
7044
7003
|
onClick: formik$1.resetForm
|
|
7045
7004
|
}), jsxRuntime.jsx(applicationComponents.CustomFormModalPage.FormPrimaryButton, {
|
|
7046
7005
|
isDisabled: !formik$1.dirty,
|
|
7047
|
-
label: formatMessage(messages$
|
|
7006
|
+
label: formatMessage(messages$A.updateButton),
|
|
7048
7007
|
onClick: formik$1.handleSubmit
|
|
7049
7008
|
})]
|
|
7050
7009
|
}),
|
|
@@ -7086,7 +7045,7 @@ const NestedInputControls = props => {
|
|
|
7086
7045
|
if (nextNestingLevel >= 6) return jsxRuntime.jsx(MaxNestingLevelReached, {});
|
|
7087
7046
|
const hasAttributes = props.productType.attributeDefinitions.length > 0;
|
|
7088
7047
|
if (!hasAttributes) return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
7089
|
-
intlMessage: messages$
|
|
7048
|
+
intlMessage: messages$A.emptyProductType,
|
|
7090
7049
|
tone: "secondary"
|
|
7091
7050
|
});
|
|
7092
7051
|
return jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
@@ -7162,7 +7121,7 @@ const CustomNestedInput = /*#__PURE__*/React.memo(props => {
|
|
|
7162
7121
|
if (nestingLevel !== 0) parentFormik.submitForm();else showNotification({
|
|
7163
7122
|
kind: 'success',
|
|
7164
7123
|
domain: constants.DOMAINS.SIDE,
|
|
7165
|
-
text: formatMessage(messages$
|
|
7124
|
+
text: formatMessage(messages$A.attributeUpdateSucceeded)
|
|
7166
7125
|
});
|
|
7167
7126
|
setSubmitting(false);
|
|
7168
7127
|
},
|
|
@@ -7281,7 +7240,7 @@ function CustomChannelReferenceInput(props) {
|
|
|
7281
7240
|
}
|
|
7282
7241
|
CustomChannelReferenceInput.displayName = 'CustomChannelReferenceInput';
|
|
7283
7242
|
|
|
7284
|
-
var messages$
|
|
7243
|
+
var messages$z = reactIntl.defineMessages({
|
|
7285
7244
|
noProductsFound: {
|
|
7286
7245
|
id: 'Shared.ProductPickerInput.noProductsFound',
|
|
7287
7246
|
description: 'The message to display when no products were found',
|
|
@@ -7379,7 +7338,7 @@ const ProductPickerInput = _ref => {
|
|
|
7379
7338
|
children: jsxRuntime.jsx(uiKit.AsyncSelectInput, {
|
|
7380
7339
|
id: name,
|
|
7381
7340
|
name: name,
|
|
7382
|
-
placeholder: formatMessage(messages$
|
|
7341
|
+
placeholder: formatMessage(messages$z.placeholder),
|
|
7383
7342
|
loadOptions: loadOptionsDebounced,
|
|
7384
7343
|
defaultOptions: [],
|
|
7385
7344
|
isClearable: isClearable,
|
|
@@ -7393,7 +7352,7 @@ const ProductPickerInput = _ref => {
|
|
|
7393
7352
|
onInputChange: handleInputChange,
|
|
7394
7353
|
onBlur: onBlur,
|
|
7395
7354
|
value: currentOption.data,
|
|
7396
|
-
noOptionsMessage: () => isLoadingFailed ? null : formatMessage(messages$
|
|
7355
|
+
noOptionsMessage: () => isLoadingFailed ? null : formatMessage(messages$z.noProductsFound),
|
|
7397
7356
|
hasError: hasError || isLoadingFailed,
|
|
7398
7357
|
menuPortalZIndex: Z_INDEX_DROPDOWN,
|
|
7399
7358
|
menuPortalTarget: document.body,
|
|
@@ -7401,7 +7360,7 @@ const ProductPickerInput = _ref => {
|
|
|
7401
7360
|
})
|
|
7402
7361
|
}), isLoadingFailed && showLoadingErrorMessage && jsxRuntime.jsx(uiKit.Text.Body, {
|
|
7403
7362
|
tone: "negative",
|
|
7404
|
-
intlMessage:
|
|
7363
|
+
intlMessage: commonPickerMessages.loadingErrorMessage
|
|
7405
7364
|
})]
|
|
7406
7365
|
})
|
|
7407
7366
|
});
|
|
@@ -7633,7 +7592,7 @@ const CustomFieldInput = /*#__PURE__*/React.memo(props => {
|
|
|
7633
7592
|
CustomFieldInput.displayName = 'CustomFieldInput';
|
|
7634
7593
|
var CustomFieldInput$1 = CustomFieldInput;
|
|
7635
7594
|
|
|
7636
|
-
var messages$
|
|
7595
|
+
var messages$y = reactIntl.defineMessages({
|
|
7637
7596
|
productReferenceLabel: {
|
|
7638
7597
|
id: 'CustomFieldsLabel.productReferenceLabel',
|
|
7639
7598
|
description: 'Label shown above the product picker input.',
|
|
@@ -7701,7 +7660,7 @@ const CustomFieldsLabelHint = _ref2 => {
|
|
|
7701
7660
|
children: [jsxRuntime.jsx(uiKit.WarningIcon, {
|
|
7702
7661
|
size: "medium",
|
|
7703
7662
|
color: "warning"
|
|
7704
|
-
}), jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$P({}, messages$
|
|
7663
|
+
}), jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$P({}, messages$y.cartDiscountMoreThan500))]
|
|
7705
7664
|
});
|
|
7706
7665
|
}
|
|
7707
7666
|
return l10n.formatLocalizedString(fieldDefinition, {
|
|
@@ -7715,8 +7674,8 @@ function CustomFieldsProductTypeReferenceSubtitle() {
|
|
|
7715
7674
|
formatMessage = _useIntl.formatMessage;
|
|
7716
7675
|
const _usePimStatus = usePimStatus(),
|
|
7717
7676
|
isProjectIndexed = _usePimStatus.isProjectIndexed;
|
|
7718
|
-
if (isProjectIndexed) return formatMessage(messages$
|
|
7719
|
-
return formatMessage(messages$
|
|
7677
|
+
if (isProjectIndexed) return formatMessage(messages$y.productTypeReferenceLabelI);
|
|
7678
|
+
return formatMessage(messages$y.productTypeReferenceLabel);
|
|
7720
7679
|
}
|
|
7721
7680
|
|
|
7722
7681
|
// TODO(pa3): this logic may be misplaced and probably
|
|
@@ -7733,13 +7692,13 @@ function CustomFieldsLabelSubtitle(_ref3) {
|
|
|
7733
7692
|
const referenceTypeName = capitalizeFirst(referenceTypeId);
|
|
7734
7693
|
if (_includesInstanceProperty__default["default"](_context = [SEARCHABLE_REFERENCES.category, SEARCHABLE_REFERENCES.cartDiscount]).call(_context, referenceTypeId)) return referenceTypeName;
|
|
7735
7694
|
if (referenceTypeId === SEARCHABLE_REFERENCES.product) {
|
|
7736
|
-
return formatMessage(messages$
|
|
7695
|
+
return formatMessage(messages$y.productReferenceLabel);
|
|
7737
7696
|
} else if (referenceTypeId === SEARCHABLE_REFERENCES.productType) {
|
|
7738
7697
|
return jsxRuntime.jsx(CustomFieldsProductTypeReferenceSubtitle, {});
|
|
7739
7698
|
} else if (referenceTypeId === SEARCHABLE_REFERENCES.channel) {
|
|
7740
|
-
return formatMessage(messages$
|
|
7699
|
+
return formatMessage(messages$y.channelReferenceLabel);
|
|
7741
7700
|
} else if (referenceTypeId === SEARCHABLE_REFERENCES.state) {
|
|
7742
|
-
return formatMessage(messages$
|
|
7701
|
+
return formatMessage(messages$y.stateReferenceLabel);
|
|
7743
7702
|
} else {
|
|
7744
7703
|
return `${referenceTypeName} ID`;
|
|
7745
7704
|
}
|
|
@@ -7755,7 +7714,7 @@ function CustomFieldsCountIndicator(_ref4) {
|
|
|
7755
7714
|
const _useIntl3 = reactIntl.useIntl(),
|
|
7756
7715
|
formatMessage = _useIntl3.formatMessage;
|
|
7757
7716
|
return assignedAttributeGroups?.length > 1 ? jsxRuntime.jsx(uiKit.Tooltip, {
|
|
7758
|
-
title: formatMessage(messages$
|
|
7717
|
+
title: formatMessage(messages$y.attributeGroupCountTooltip, {
|
|
7759
7718
|
attributeGroups: _mapInstanceProperty__default["default"](assignedAttributeGroups).call(assignedAttributeGroups, assignedAttributeGroup => formatLocalizedField(assignedAttributeGroup.nameAllLocales)).join(', '),
|
|
7760
7719
|
count: assignedAttributeGroups.length
|
|
7761
7720
|
}),
|
|
@@ -7812,7 +7771,7 @@ const CustomFieldsLabel = /*#__PURE__*/React.memo(_ref5 => {
|
|
|
7812
7771
|
CustomFieldsLabel.displayName = 'CustomFieldsTitle';
|
|
7813
7772
|
var CustomFieldsLabel$1 = CustomFieldsLabel;
|
|
7814
7773
|
|
|
7815
|
-
var messages$
|
|
7774
|
+
var messages$x = reactIntl.defineMessages({
|
|
7816
7775
|
referencedProductType: {
|
|
7817
7776
|
id: 'NestedAttributes.referencedProductType',
|
|
7818
7777
|
description: 'Product type referenced hint',
|
|
@@ -7823,7 +7782,7 @@ var messages$w = reactIntl.defineMessages({
|
|
|
7823
7782
|
function ownKeys$O(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; }
|
|
7824
7783
|
function _objectSpread$O(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$O(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$O(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
7825
7784
|
function ProductTypeReference(props) {
|
|
7826
|
-
const productTypeMessage = _objectSpread$O(_objectSpread$O({}, messages$
|
|
7785
|
+
const productTypeMessage = _objectSpread$O(_objectSpread$O({}, messages$x.referencedProductType), {}, {
|
|
7827
7786
|
values: {
|
|
7828
7787
|
productTypeName: props.productType.name
|
|
7829
7788
|
}
|
|
@@ -7847,7 +7806,7 @@ function CustomNestedFieldInput(props) {
|
|
|
7847
7806
|
color: "error"
|
|
7848
7807
|
}), jsxRuntime.jsx(uiKit.Text.Body, {
|
|
7849
7808
|
tone: "negative",
|
|
7850
|
-
intlMessage:
|
|
7809
|
+
intlMessage: commonPickerMessages.loadingErrorMessage
|
|
7851
7810
|
})]
|
|
7852
7811
|
});
|
|
7853
7812
|
if (!productType) return null;
|
|
@@ -7912,7 +7871,7 @@ const DraggableWrapper = _ref2 => {
|
|
|
7912
7871
|
return children;
|
|
7913
7872
|
}
|
|
7914
7873
|
};
|
|
7915
|
-
return jsxRuntime.jsx(
|
|
7874
|
+
return jsxRuntime.jsx(dnd.Draggable, {
|
|
7916
7875
|
draggableId: draggableId,
|
|
7917
7876
|
index: index,
|
|
7918
7877
|
children: (provided, snapshot) => {
|
|
@@ -7951,9 +7910,9 @@ function _objectSpread$L(e) { for (var r = 1; r < arguments.length; r++) { var _
|
|
|
7951
7910
|
const DroppableWrapper = _ref => {
|
|
7952
7911
|
let children = _ref.children,
|
|
7953
7912
|
onDragEnd = _ref.onDragEnd;
|
|
7954
|
-
return jsxRuntime.jsx(
|
|
7913
|
+
return jsxRuntime.jsx(dnd.DragDropContext, {
|
|
7955
7914
|
onDragEnd: onDragEnd,
|
|
7956
|
-
children: jsxRuntime.jsx(
|
|
7915
|
+
children: jsxRuntime.jsx(dnd.Droppable, {
|
|
7957
7916
|
droppableId: "droppable",
|
|
7958
7917
|
children: provided => jsxRuntime.jsxs("div", _objectSpread$L(_objectSpread$L({
|
|
7959
7918
|
ref: provided.innerRef
|
|
@@ -8048,7 +8007,8 @@ const CustomFieldsInternal = _ref => {
|
|
|
8048
8007
|
touched = _useFormikContext.touched,
|
|
8049
8008
|
values = _valuesInstanceProperty__default["default"](_useFormikContext),
|
|
8050
8009
|
handleBlur = _useFormikContext.handleBlur,
|
|
8051
|
-
status = _useFormikContext.status
|
|
8010
|
+
status = _useFormikContext.status,
|
|
8011
|
+
isFormValid = _useFormikContext.isValid;
|
|
8052
8012
|
const _useIntl = reactIntl.useIntl(),
|
|
8053
8013
|
locale = _useIntl.locale;
|
|
8054
8014
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
@@ -8060,7 +8020,6 @@ const CustomFieldsInternal = _ref => {
|
|
|
8060
8020
|
const isTailoringAttributesEnabled = applicationShell.useFeatureToggle(PRODUCT_TAILORING_FOR_ATTRIBUTES);
|
|
8061
8021
|
const isTailoringAttributeForOtherTypes = applicationShell.useFeatureToggle(PRODUCT_TAILORING_FOR_ATTRIBUTES_TYPES_OTHER_THAN_TEXT);
|
|
8062
8022
|
const isTailoringFallbackEnabled = applicationShell.useFeatureToggle(PRODUCT_TAILORING_FOR_ATTRIBUTES_FALLBACK_VALUES);
|
|
8063
|
-
const didFormValidationFail = useDidFormValidationFail();
|
|
8064
8023
|
const fieldDefinitions = omitSetsOfSets(props.fieldDefinitions);
|
|
8065
8024
|
const _useDnDContext = useDnDContext(),
|
|
8066
8025
|
DroppableWrapper = _useDnDContext.DroppableWrapper,
|
|
@@ -8082,7 +8041,7 @@ const CustomFieldsInternal = _ref => {
|
|
|
8082
8041
|
|
|
8083
8042
|
// We want to highlight fields with errors not only after a form submission,
|
|
8084
8043
|
// but also after manually triggered form validation.
|
|
8085
|
-
const hasError = Boolean(fieldErrors) && (isTouched ||
|
|
8044
|
+
const hasError = Boolean(fieldErrors) && (isTouched || !isFormValid);
|
|
8086
8045
|
const validate = value => {
|
|
8087
8046
|
if (fieldDefinition.required && isNil__default["default"](value)) return {
|
|
8088
8047
|
missing: true
|
|
@@ -8787,6 +8746,146 @@ function ProductSelectionsPicker(_ref) {
|
|
|
8787
8746
|
});
|
|
8788
8747
|
}
|
|
8789
8748
|
|
|
8749
|
+
var messages$w = reactIntl.defineMessages({
|
|
8750
|
+
placeholder: {
|
|
8751
|
+
id: 'RecurrentIntervalPicker.placeholder',
|
|
8752
|
+
description: 'The placeholder of the input',
|
|
8753
|
+
defaultMessage: 'Not restricted to any recurrent interval'
|
|
8754
|
+
},
|
|
8755
|
+
missingOptionLabel: {
|
|
8756
|
+
id: 'RecurrentIntervalPicker.missingOptionLabel',
|
|
8757
|
+
description: 'The label of the option when the recurrent interval is not found',
|
|
8758
|
+
defaultMessage: 'Unknown recurrent interval ({value})'
|
|
8759
|
+
},
|
|
8760
|
+
missingSelectedWarning: {
|
|
8761
|
+
id: 'RecurrentIntervalPicker.missingSelectedWarning',
|
|
8762
|
+
description: 'The warning message shown below the input when the selected recurrent interval is not found in the options',
|
|
8763
|
+
defaultMessage: 'The selected recurrent interval could not be retrieved. Please check your recurrence policy configuration.'
|
|
8764
|
+
},
|
|
8765
|
+
noRecurrentIntervalsConfigured: {
|
|
8766
|
+
id: 'RecurrentIntervalPicker.noRecurrentIntervalsConfigured',
|
|
8767
|
+
description: 'Banner warning message shown when no recurrent intervals are configured in the project',
|
|
8768
|
+
defaultMessage: 'No recurrent intervals configured. Please check your recurrence policy configuration'
|
|
8769
|
+
}
|
|
8770
|
+
});
|
|
8771
|
+
|
|
8772
|
+
var FetchRecurrencePolicies = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchRecurrencePolicies" }, 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: "recurrencePolicies" }, 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: "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: 191, source: { body: "query FetchRecurrencePolicies($where: String) {\n recurrencePolicies(where: $where) {\n results {\n id\n key\n nameAllLocales {\n locale\n value\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
8773
|
+
const isRecurringOrdersDisabledError = error => {
|
|
8774
|
+
var _context;
|
|
8775
|
+
return error.extensions?.code === '403' && _includesInstanceProperty__default["default"](_context = error.message).call(_context, "The feature 'recurring-orders' is not enabled for this project. Please contact commercetools support.");
|
|
8776
|
+
};
|
|
8777
|
+
// @TODO: Remove these error checks when the feature is enabled by default
|
|
8778
|
+
const useRecurrenceIntervals = _ref => {
|
|
8779
|
+
let where = _ref.where,
|
|
8780
|
+
_ref$skip = _ref.skip,
|
|
8781
|
+
skip = _ref$skip === void 0 ? false : _ref$skip;
|
|
8782
|
+
const _useQuery = client.useQuery(FetchRecurrencePolicies, {
|
|
8783
|
+
context: {
|
|
8784
|
+
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
8785
|
+
},
|
|
8786
|
+
fetchPolicy: 'cache-and-network',
|
|
8787
|
+
variables: where ? {
|
|
8788
|
+
where
|
|
8789
|
+
} : undefined,
|
|
8790
|
+
skip
|
|
8791
|
+
}),
|
|
8792
|
+
data = _useQuery.data,
|
|
8793
|
+
loading = _useQuery.loading,
|
|
8794
|
+
rawError = _useQuery.error;
|
|
8795
|
+
const extractedErrors = rawError ? extractErrorFromGraphQlResponse(rawError) : [];
|
|
8796
|
+
const isRecurringOrdersDisabled = extractedErrors.length > 0 &&
|
|
8797
|
+
// If the only error is a 403 with the specific message, we assume the feature is disabled.
|
|
8798
|
+
_everyInstanceProperty__default["default"](extractedErrors).call(extractedErrors, isRecurringOrdersDisabledError);
|
|
8799
|
+
const error = isRecurringOrdersDisabled ? undefined : rawError;
|
|
8800
|
+
return {
|
|
8801
|
+
recurrencePolicies: data?.recurrencePolicies?.results ?? [],
|
|
8802
|
+
loading,
|
|
8803
|
+
error,
|
|
8804
|
+
isRecurringOrdersDisabled
|
|
8805
|
+
};
|
|
8806
|
+
};
|
|
8807
|
+
|
|
8808
|
+
const RecurrentIntervalPicker = _ref => {
|
|
8809
|
+
let name = _ref.name,
|
|
8810
|
+
value = _ref.value,
|
|
8811
|
+
onChange = _ref.onChange,
|
|
8812
|
+
onBlur = _ref.onBlur,
|
|
8813
|
+
onError = _ref.onError,
|
|
8814
|
+
_ref$isClearable = _ref.isClearable,
|
|
8815
|
+
isClearable = _ref$isClearable === void 0 ? true : _ref$isClearable,
|
|
8816
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
8817
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
8818
|
+
_ref$isReadOnly = _ref.isReadOnly,
|
|
8819
|
+
isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly;
|
|
8820
|
+
const _useIntl = reactIntl.useIntl(),
|
|
8821
|
+
formatMessage = _useIntl.formatMessage;
|
|
8822
|
+
const dataLocale = applicationShellConnectors.useApplicationContext(applicationContext => applicationContext.dataLocale);
|
|
8823
|
+
const formatLocalizedFieldToString = useFormatLocalizedFieldToString();
|
|
8824
|
+
const skip = isReadOnly && !value;
|
|
8825
|
+
const where = isReadOnly && value ? `id="${value}"` : undefined;
|
|
8826
|
+
const _useRecurrenceInterva = useRecurrenceIntervals({
|
|
8827
|
+
where,
|
|
8828
|
+
skip
|
|
8829
|
+
}),
|
|
8830
|
+
recurrencePolicies = _useRecurrenceInterva.recurrencePolicies,
|
|
8831
|
+
loading = _useRecurrenceInterva.loading,
|
|
8832
|
+
error = _useRecurrenceInterva.error;
|
|
8833
|
+
const selectedIsMissingInData = Boolean(value) && !_someInstanceProperty__default["default"](recurrencePolicies).call(recurrencePolicies, policy => policy.id === value);
|
|
8834
|
+
const options = React.useMemo(() => {
|
|
8835
|
+
if (loading) return [];
|
|
8836
|
+
const mapped = _mapInstanceProperty__default["default"](recurrencePolicies).call(recurrencePolicies, policy => ({
|
|
8837
|
+
value: policy.id,
|
|
8838
|
+
label: formatLocalizedFieldToString(policy.nameAllLocales, policy.key)
|
|
8839
|
+
}));
|
|
8840
|
+
|
|
8841
|
+
// If the selected value cannot be loaded, add it as a missing option
|
|
8842
|
+
if (selectedIsMissingInData && value) {
|
|
8843
|
+
const label = formatMessage(messages$w.missingOptionLabel, {
|
|
8844
|
+
value
|
|
8845
|
+
});
|
|
8846
|
+
return [{
|
|
8847
|
+
value,
|
|
8848
|
+
label
|
|
8849
|
+
}, ...mapped];
|
|
8850
|
+
}
|
|
8851
|
+
return mapped;
|
|
8852
|
+
}, [recurrencePolicies, selectedIsMissingInData, value, dataLocale, formatMessage, formatLocalizedFieldToString, loading]);
|
|
8853
|
+
const noRecurrentIntervalsConfigured = !loading && recurrencePolicies.length === 0;
|
|
8854
|
+
React.useEffect(() => {
|
|
8855
|
+
if (error && onError) {
|
|
8856
|
+
onError(error);
|
|
8857
|
+
}
|
|
8858
|
+
}, [error, onError]);
|
|
8859
|
+
return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
8860
|
+
scale: "s",
|
|
8861
|
+
children: [jsxRuntime.jsx(uiKit.SelectInput, {
|
|
8862
|
+
id: name,
|
|
8863
|
+
name: name,
|
|
8864
|
+
value: value,
|
|
8865
|
+
placeholder: messages$w.placeholder.defaultMessage,
|
|
8866
|
+
options: options,
|
|
8867
|
+
isClearable: isClearable,
|
|
8868
|
+
isReadOnly: isReadOnly,
|
|
8869
|
+
isDisabled: isDisabled || loading || noRecurrentIntervalsConfigured,
|
|
8870
|
+
onChange: onChange,
|
|
8871
|
+
onBlur: onBlur,
|
|
8872
|
+
hasError: !loading && !error && selectedIsMissingInData
|
|
8873
|
+
}), error ? jsxRuntime.jsx(uiKit.Text.Body, {
|
|
8874
|
+
tone: "negative",
|
|
8875
|
+
intlMessage: commonPickerMessages.loadingErrorMessage
|
|
8876
|
+
}) : selectedIsMissingInData ? jsxRuntime.jsx(uiKit.Text.Body, {
|
|
8877
|
+
tone: "negative",
|
|
8878
|
+
intlMessage: messages$w.missingSelectedWarning
|
|
8879
|
+
}) : null, !error && noRecurrentIntervalsConfigured && jsxRuntime.jsx(uiKit.ContentNotification, {
|
|
8880
|
+
type: "warning",
|
|
8881
|
+
children: jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
8882
|
+
intlMessage: messages$w.noRecurrentIntervalsConfigured
|
|
8883
|
+
})
|
|
8884
|
+
})]
|
|
8885
|
+
});
|
|
8886
|
+
};
|
|
8887
|
+
var RecurrentIntervalPicker$1 = RecurrentIntervalPicker;
|
|
8888
|
+
|
|
8790
8889
|
// NOTE: this component is duplicated in `app-shell/from-core`.
|
|
8791
8890
|
var styles$b = {
|
|
8792
8891
|
"colored": "required-indicator-module__colored____YUFm",
|
|
@@ -8943,9 +9042,6 @@ var messages$u = reactIntl.defineMessages({
|
|
|
8943
9042
|
}
|
|
8944
9043
|
});
|
|
8945
9044
|
|
|
8946
|
-
const LOWER_STORES_LIMIT = 60;
|
|
8947
|
-
const UPPER_STORES_LIMIT = 500;
|
|
8948
|
-
|
|
8949
9045
|
// map store to options
|
|
8950
9046
|
const mapStoresToOptions = _ref => {
|
|
8951
9047
|
var _context, _context2;
|
|
@@ -10918,9 +11014,9 @@ const createQueryVariables = platformLimit => _reduceInstanceProperty__default["
|
|
|
10918
11014
|
}, previousIncludedLimits), {});
|
|
10919
11015
|
var createPlatformLimitsQueryVariables = createQueryVariables;
|
|
10920
11016
|
|
|
10921
|
-
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 } } } };
|
|
11017
|
+
var PlatformLimitsFetcherQuery$1 = { 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: "maxGroupsPerCustomer" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "limit" }, 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: 2158, 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 maxGroupsPerCustomer {\n limit\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 } } } };
|
|
10922
11018
|
const usePlatformLimitsFetcher = platformLimit => {
|
|
10923
|
-
const _useQuery = react.useQuery(PlatformLimitsFetcherQuery, {
|
|
11019
|
+
const _useQuery = react.useQuery(PlatformLimitsFetcherQuery$1, {
|
|
10924
11020
|
variables: createPlatformLimitsQueryVariables(platformLimit),
|
|
10925
11021
|
context: {
|
|
10926
11022
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
@@ -10941,6 +11037,8 @@ const usePlatformLimitsFetcher = platformLimit => {
|
|
|
10941
11037
|
};
|
|
10942
11038
|
var usePlatformLimitsFetcher$1 = usePlatformLimitsFetcher;
|
|
10943
11039
|
|
|
11040
|
+
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: "maxGroupsPerCustomer" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "limit" }, 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: 2158, 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 maxGroupsPerCustomer {\n limit\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 } } } };
|
|
11041
|
+
|
|
10944
11042
|
const useLimitsModalState = function () {
|
|
10945
11043
|
let isInitiallyOpen = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
10946
11044
|
const _useState = React.useState(isInitiallyOpen),
|
|
@@ -11067,7 +11165,7 @@ const getCustomerSupportLink = msg => jsxRuntime.jsx(uiKit.Link, {
|
|
|
11067
11165
|
isExternal: true,
|
|
11068
11166
|
to: constants.SUPPORT_PORTAL_URL,
|
|
11069
11167
|
children: msg
|
|
11070
|
-
});
|
|
11168
|
+
}, `msg-${msg}`);
|
|
11071
11169
|
const PlatformLimitWarningNotification = _ref => {
|
|
11072
11170
|
let resource = _ref.resource,
|
|
11073
11171
|
limit = _ref.limit;
|
|
@@ -11905,11 +12003,13 @@ var CustomersCombined = PlatformLimitsCustomersCombined;
|
|
|
11905
12003
|
|
|
11906
12004
|
const useCustomersPlatformLimits = () => {
|
|
11907
12005
|
const _useCustomersPlatform = useCustomersPlatformLimitsFetcher$1(),
|
|
12006
|
+
platformLimits = _useCustomersPlatform.platformLimits,
|
|
11908
12007
|
refetch = _useCustomersPlatform.refetch;
|
|
11909
12008
|
const _useCustomersPlatform2 = useCustomersPlatformLimitsStatus(),
|
|
11910
12009
|
hasReachedCustomersWarningLimit = _useCustomersPlatform2.hasReachedCustomersWarningLimit,
|
|
11911
12010
|
hasReachedCustomersErrorLimit = _useCustomersPlatform2.hasReachedCustomersErrorLimit;
|
|
11912
12011
|
const interceptNavigation = useInterceptNavigation$1(hasReachedCustomersErrorLimit);
|
|
12012
|
+
const maxGroupsPerCustomerLimit = platformLimits?.customers?.maxGroupsPerCustomer?.limit;
|
|
11913
12013
|
return {
|
|
11914
12014
|
CustomersLimits: {
|
|
11915
12015
|
Notifications: CustomersNotification,
|
|
@@ -11919,6 +12019,7 @@ const useCustomersPlatformLimits = () => {
|
|
|
11919
12019
|
ErrorModal: CustomersErrorModal
|
|
11920
12020
|
},
|
|
11921
12021
|
refetchCustomersPlatformLimits: refetch,
|
|
12022
|
+
maxGroupsPerCustomerLimit,
|
|
11922
12023
|
interceptNavigation,
|
|
11923
12024
|
status: {
|
|
11924
12025
|
hasReachedCustomersWarningLimit,
|
|
@@ -11943,6 +12044,38 @@ const injectCustomersPlatformLimits = () => WrappedComponent => {
|
|
|
11943
12044
|
};
|
|
11944
12045
|
var injectCustomersPlatformLimits$1 = injectCustomersPlatformLimits;
|
|
11945
12046
|
|
|
12047
|
+
const useBusinessUnitsPlatformLimitsFetcher = () => {
|
|
12048
|
+
const _usePlatformLimitsFet = usePlatformLimitsFetcher$1(RESOURCES_WITH_PLATFORM_LIMITS.businessUnits),
|
|
12049
|
+
isLoading = _usePlatformLimitsFet.isLoading,
|
|
12050
|
+
error = _usePlatformLimitsFet.error,
|
|
12051
|
+
platformLimits = _usePlatformLimitsFet.platformLimits,
|
|
12052
|
+
refetch = _usePlatformLimitsFet.refetch;
|
|
12053
|
+
const formattedPlatformLimits = {
|
|
12054
|
+
businessUnitsMaxDivisionsLimit: platformLimits.businessUnits?.maxDivisions.limit,
|
|
12055
|
+
businessUnitsMaxDepthLimit: platformLimits.businessUnits?.maxDepthLimit.limit,
|
|
12056
|
+
businessUnitsMaxAssociatesLimit: platformLimits.businessUnits?.maxAssociates.limit,
|
|
12057
|
+
businessUnitsMaxAssociateRolesLimit: platformLimits.businessUnits?.maxAssociateRoles.limit
|
|
12058
|
+
};
|
|
12059
|
+
return {
|
|
12060
|
+
isLoading,
|
|
12061
|
+
error,
|
|
12062
|
+
platformLimits: formattedPlatformLimits,
|
|
12063
|
+
refetch
|
|
12064
|
+
};
|
|
12065
|
+
};
|
|
12066
|
+
var useBusinessUnitsPlatformLimitsFetcher$1 = useBusinessUnitsPlatformLimitsFetcher;
|
|
12067
|
+
|
|
12068
|
+
const useBusinessUnitsLimits = () => {
|
|
12069
|
+
const _useBusinessUnitsPlat = useBusinessUnitsPlatformLimitsFetcher$1(),
|
|
12070
|
+
refetch = _useBusinessUnitsPlat.refetch,
|
|
12071
|
+
platformLimits = _useBusinessUnitsPlat.platformLimits;
|
|
12072
|
+
return {
|
|
12073
|
+
BusinessUnitsLimits: platformLimits,
|
|
12074
|
+
refetchBusinessUnitsPlatformLimits: refetch
|
|
12075
|
+
};
|
|
12076
|
+
};
|
|
12077
|
+
var useBusinessUnitsLimits$1 = useBusinessUnitsLimits;
|
|
12078
|
+
|
|
11946
12079
|
const useCustomerGroupsPlatformLimitsFetcher = () => {
|
|
11947
12080
|
const _usePlatformLimitsFet = usePlatformLimitsFetcher$1(RESOURCES_WITH_PLATFORM_LIMITS.customerGroups),
|
|
11948
12081
|
isLoading = _usePlatformLimitsFet.isLoading,
|
|
@@ -12290,6 +12423,72 @@ const injectCustomerGroupsPlatformLimits = () => WrappedComponent => {
|
|
|
12290
12423
|
};
|
|
12291
12424
|
var injectCustomerGroupsPlatformLimits$1 = injectCustomerGroupsPlatformLimits;
|
|
12292
12425
|
|
|
12426
|
+
const useStoresPlatformLimitsFetcher = () => {
|
|
12427
|
+
const _usePlatformLimitsFet = usePlatformLimitsFetcher$1(RESOURCES_WITH_PLATFORM_LIMITS.stores),
|
|
12428
|
+
isLoading = _usePlatformLimitsFet.isLoading,
|
|
12429
|
+
error = _usePlatformLimitsFet.error,
|
|
12430
|
+
platformLimits = _usePlatformLimitsFet.platformLimits,
|
|
12431
|
+
refetch = _usePlatformLimitsFet.refetch;
|
|
12432
|
+
const formattedPlatformLimits = {
|
|
12433
|
+
total: platformLimits.stores?.total.limit,
|
|
12434
|
+
storeLimit: platformLimits.stores?.total.limit,
|
|
12435
|
+
storeCurrent: platformLimits.stores?.total.current,
|
|
12436
|
+
inventorySupplyChannels: platformLimits.stores?.inventorySupplyChannels.limit,
|
|
12437
|
+
productDistributionChannels: platformLimits.stores?.productDistributionChannels.limit
|
|
12438
|
+
};
|
|
12439
|
+
return {
|
|
12440
|
+
isLoading,
|
|
12441
|
+
error,
|
|
12442
|
+
platformLimits: formattedPlatformLimits,
|
|
12443
|
+
refetch
|
|
12444
|
+
};
|
|
12445
|
+
};
|
|
12446
|
+
var useStoresPlatformLimitsFetcher$1 = useStoresPlatformLimitsFetcher;
|
|
12447
|
+
|
|
12448
|
+
const useStoresPlatformLimits = () => {
|
|
12449
|
+
const _useStoresPlatformLim = useStoresPlatformLimitsFetcher$1(),
|
|
12450
|
+
platformLimits = _useStoresPlatformLim.platformLimits;
|
|
12451
|
+
if (!platformLimits?.total) {
|
|
12452
|
+
return {
|
|
12453
|
+
hasReachedStoresWarningLimit: false,
|
|
12454
|
+
hasReachedStoresErrorLimit: false
|
|
12455
|
+
};
|
|
12456
|
+
}
|
|
12457
|
+
const storeLimit = platformLimits.storeLimit,
|
|
12458
|
+
storeCurrent = platformLimits.storeCurrent;
|
|
12459
|
+
const hasReachedStoresWarningLimit = getHasExceededWarningThreshold({
|
|
12460
|
+
limit: storeLimit,
|
|
12461
|
+
current: storeCurrent
|
|
12462
|
+
});
|
|
12463
|
+
const hasReachedStoresErrorLimit = getHasExceededLimit({
|
|
12464
|
+
limit: storeLimit,
|
|
12465
|
+
current: storeCurrent
|
|
12466
|
+
});
|
|
12467
|
+
return {
|
|
12468
|
+
hasReachedStoresWarningLimit,
|
|
12469
|
+
hasReachedStoresErrorLimit
|
|
12470
|
+
};
|
|
12471
|
+
};
|
|
12472
|
+
var useStoresPlatformLimitsStatus = useStoresPlatformLimits;
|
|
12473
|
+
|
|
12474
|
+
const useStoresLimits = () => {
|
|
12475
|
+
const _useStoresPlatformLim = useStoresPlatformLimitsFetcher$1(),
|
|
12476
|
+
refetch = _useStoresPlatformLim.refetch,
|
|
12477
|
+
platformLimits = _useStoresPlatformLim.platformLimits;
|
|
12478
|
+
const _useStoresPlatformLim2 = useStoresPlatformLimitsStatus(),
|
|
12479
|
+
hasReachedStoresWarningLimit = _useStoresPlatformLim2.hasReachedStoresWarningLimit,
|
|
12480
|
+
hasReachedStoresErrorLimit = _useStoresPlatformLim2.hasReachedStoresErrorLimit;
|
|
12481
|
+
return {
|
|
12482
|
+
StoreLimits: platformLimits,
|
|
12483
|
+
refetchStoresPlatformLimits: refetch,
|
|
12484
|
+
status: {
|
|
12485
|
+
hasReachedStoresWarningLimit,
|
|
12486
|
+
hasReachedStoresErrorLimit
|
|
12487
|
+
}
|
|
12488
|
+
};
|
|
12489
|
+
};
|
|
12490
|
+
var useStoresLimits$1 = useStoresLimits;
|
|
12491
|
+
|
|
12293
12492
|
var messages$c = reactIntl.defineMessages({
|
|
12294
12493
|
yes: {
|
|
12295
12494
|
id: 'BooleanField.yes',
|
|
@@ -13585,7 +13784,7 @@ function formatDiscount(discount, currencyCode, intl) {
|
|
|
13585
13784
|
if (discount.type === 'relative') return `${discount.permyriad / 100}%`;
|
|
13586
13785
|
if (!discount.money) return null;
|
|
13587
13786
|
const moneyForCurrencyCode = _findInstanceProperty__default["default"](_context = discount.money).call(_context, discountMoney => discountMoney.currencyCode === currencyCode);
|
|
13588
|
-
return moneyForCurrencyCode ? formatMoney$
|
|
13787
|
+
return moneyForCurrencyCode ? formatMoney$2(moneyForCurrencyCode, intl) : null;
|
|
13589
13788
|
}
|
|
13590
13789
|
|
|
13591
13790
|
function formatPercentage(percentage) {
|
|
@@ -13731,6 +13930,9 @@ function resolveStatusType(product) {
|
|
|
13731
13930
|
if (published && !hasStagedChanges) return PRODUCT_STATUSES.PUBLISHED;
|
|
13732
13931
|
return PRODUCT_STATUSES.UNPUBLISHED;
|
|
13733
13932
|
}
|
|
13933
|
+
function getStampToneByPublishState(statusCode) {
|
|
13934
|
+
if (statusCode === PRODUCT_STATUSES.UNPUBLISHED) return 'secondary';else if (statusCode === PRODUCT_STATUSES.PUBLISHED) return 'positive';else if (statusCode === PRODUCT_STATUSES.MODIFIED) return 'warning';
|
|
13935
|
+
}
|
|
13734
13936
|
const computedProperties = {
|
|
13735
13937
|
// TODO: show relative time as tooltip
|
|
13736
13938
|
// `intl.formatRelative(<DATETIME>)`
|
|
@@ -13762,7 +13964,7 @@ const computedProperties = {
|
|
|
13762
13964
|
intl = _ref4.intl;
|
|
13763
13965
|
const allVariants = _concatInstanceProperty__default["default"](_context2 = product.variants).call(_context2, product.masterVariant);
|
|
13764
13966
|
const variantPrices = flatMap__default["default"](allVariants, variant => variant.prices);
|
|
13765
|
-
return _mapInstanceProperty__default["default"](_context3 = getMinimumPricesByCurrencyCode(variantPrices)).call(_context3, price => formatMoney$
|
|
13967
|
+
return _mapInstanceProperty__default["default"](_context3 = getMinimumPricesByCurrencyCode(variantPrices)).call(_context3, price => formatMoney$2(price, intl)).join(', ') || constants.NO_VALUE_FALLBACK;
|
|
13766
13968
|
},
|
|
13767
13969
|
sku(_ref5) {
|
|
13768
13970
|
var _context4, _context5;
|
|
@@ -14054,6 +14256,7 @@ var CategorySearchPickerOptionFragment = { kind: "Document", definitions: [{ kin
|
|
|
14054
14256
|
|
|
14055
14257
|
exports.BooleanField = booleanField;
|
|
14056
14258
|
exports.Button = Button$1;
|
|
14259
|
+
exports.CUSTOM_FIELD_TYPES = CUSTOM_FIELD_TYPES;
|
|
14057
14260
|
exports.CartDiscountReferenceSearch = CartDiscountReferenceSearch;
|
|
14058
14261
|
exports.CategoryReferenceSearch = CategoryReferenceSearch;
|
|
14059
14262
|
exports.CategorySearchPickerOptionFragment = CategorySearchPickerOptionFragment;
|
|
@@ -14061,6 +14264,7 @@ exports.CenteredLoadingSpinner = CenteredLoadingSpinner$1;
|
|
|
14061
14264
|
exports.ChannelPickerInput = ChannelPickerInput$1;
|
|
14062
14265
|
exports.CountriesPicker = CountriesPicker;
|
|
14063
14266
|
exports.CustomFieldDefinitionsConnector = customFieldDefinitionsConnector;
|
|
14267
|
+
exports.CustomFieldInput = CustomFieldInput$1;
|
|
14064
14268
|
exports.CustomFieldTooltip = CustomFieldTooltip$1;
|
|
14065
14269
|
exports.CustomFieldTypeDefinitionsConnector = CustomFieldTypeDefinitionsConnector$1;
|
|
14066
14270
|
exports.CustomFields = CustomFields$1;
|
|
@@ -14073,6 +14277,7 @@ exports.EMAIL_REGEX = EMAIL_REGEX;
|
|
|
14073
14277
|
exports.FileInput = FileInput$1;
|
|
14074
14278
|
exports.FormattedDateTime = FormattedDateTime$1;
|
|
14075
14279
|
exports.FormattedLocalizedString = FormattedLocalizedString;
|
|
14280
|
+
exports.LOWER_STORES_LIMIT = LOWER_STORES_LIMIT;
|
|
14076
14281
|
exports.LabelRange = LabelRange$1;
|
|
14077
14282
|
exports.MC_RESOURCES_WITH_KEYS = MC_RESOURCES_WITH_KEYS;
|
|
14078
14283
|
exports.MissingValueField = MissingValueField$1;
|
|
@@ -14081,11 +14286,15 @@ exports.NumericFormatInput = numericFormatInput;
|
|
|
14081
14286
|
exports.Option = Option$2;
|
|
14082
14287
|
exports.PRECISION_TYPES = PRECISION_TYPES;
|
|
14083
14288
|
exports.PimIndexerProvider = pimIndexerProvider;
|
|
14289
|
+
exports.PlatformLimitsFetcherQuery = PlatformLimitsFetcherQuery;
|
|
14084
14290
|
exports.ProductAttributeInput = ProductAttributeInput;
|
|
14085
14291
|
exports.ProductAttributes = ProductAttributes;
|
|
14086
14292
|
exports.ProductPickerInput = ProductPickerInput$1;
|
|
14087
14293
|
exports.ProductSelectionPicker = ProductSelectionsPicker;
|
|
14088
14294
|
exports.QUERY_LIMIT = QUERY_LIMIT;
|
|
14295
|
+
exports.QUERY_MAX_LIMIT = QUERY_MAX_LIMIT;
|
|
14296
|
+
exports.RESOURCES_WITH_PLATFORM_LIMITS = RESOURCES_WITH_PLATFORM_LIMITS;
|
|
14297
|
+
exports.RecurrentIntervalPicker = RecurrentIntervalPicker$1;
|
|
14089
14298
|
exports.RequestCache = RequestCache$1;
|
|
14090
14299
|
exports.RequiredIndicator = RequiredIndicator$1;
|
|
14091
14300
|
exports.ScrollToFieldError = ScrollToFieldError$1;
|
|
@@ -14094,12 +14303,14 @@ exports.SelectableFieldSearchInput = SelectableFieldSearchInput$1;
|
|
|
14094
14303
|
exports.StoreSelectField = StoreSelectField$1;
|
|
14095
14304
|
exports.StoreSelectInput = StoreSelectInput$1;
|
|
14096
14305
|
exports.ThrottledField = ThrottledField$1;
|
|
14306
|
+
exports.UPPER_STORES_LIMIT = UPPER_STORES_LIMIT;
|
|
14097
14307
|
exports.VALIDATOR_INTEGER = VALIDATOR_INTEGER;
|
|
14098
14308
|
exports.VALIDATOR_NUMERIC = VALIDATOR_NUMERIC;
|
|
14099
14309
|
exports.VALIDATOR_REQUIRED = VALIDATOR_REQUIRED;
|
|
14100
14310
|
exports.WithPimIndexer = WithPimIndexer$1;
|
|
14101
14311
|
exports.allowedProperties = allowedProperties;
|
|
14102
14312
|
exports.and = and;
|
|
14313
|
+
exports.attributeToCustomField = attributeToCustomField;
|
|
14103
14314
|
exports.attributesMapToNameValuePairs = attributesMapToNameValuePairs;
|
|
14104
14315
|
exports.base64ToString = base64ToString;
|
|
14105
14316
|
exports.booleanMessages = messages$c;
|
|
@@ -14117,6 +14328,7 @@ exports.convertProductSelectionFromGraphQl = convertProductSelectionFromGraphQl;
|
|
|
14117
14328
|
exports.convertRatioToPercentage = convertRatioToPercentage;
|
|
14118
14329
|
exports.createGraphQlUpdateActions = createGraphQlUpdateActions;
|
|
14119
14330
|
exports.createNextSortDefinition = createNextSortDefinition$1;
|
|
14331
|
+
exports.createPlatformLimitsQueryVariables = createPlatformLimitsQueryVariables;
|
|
14120
14332
|
exports.createReducer = createReducer;
|
|
14121
14333
|
exports.createResourceReducer = createResourceReducer;
|
|
14122
14334
|
exports.customFieldsTransformer = customFields;
|
|
@@ -14133,7 +14345,7 @@ exports.formatCustomerName = formatCustomerName;
|
|
|
14133
14345
|
exports.formatDateRangeValue = formatDateRangeValue;
|
|
14134
14346
|
exports.formatDateTime = formatDateTime$1;
|
|
14135
14347
|
exports.formatDiscount = formatDiscount;
|
|
14136
|
-
exports.formatMoney = formatMoney$
|
|
14348
|
+
exports.formatMoney = formatMoney$2;
|
|
14137
14349
|
exports.formatMoneyRangeValue = formatMoneyRangeValue;
|
|
14138
14350
|
exports.formatMoneyValue = formatMoneyValue;
|
|
14139
14351
|
exports.formatPercentage = formatPercentage;
|
|
@@ -14156,6 +14368,7 @@ exports.getPrefixSearchBounds = getPrefixSearchBounds$1;
|
|
|
14156
14368
|
exports.getPriceChannelName = getPriceChannelName;
|
|
14157
14369
|
exports.getReferenceTypeId = getReferenceTypeId;
|
|
14158
14370
|
exports.getSelectedPrice = getSelectedPrice;
|
|
14371
|
+
exports.getStampToneByPublishState = getStampToneByPublishState;
|
|
14159
14372
|
exports.getTimeZoneId = getTimeZoneId;
|
|
14160
14373
|
exports.getTimeZoneLabel = getTimeZoneLabel;
|
|
14161
14374
|
exports.getTypeNameOfType = getTypeNameOfType;
|
|
@@ -14187,6 +14400,7 @@ exports.isValidISODate = isValidISODate;
|
|
|
14187
14400
|
exports.isValidISODateTime = isValidISODateTime;
|
|
14188
14401
|
exports.isValidISOTime = isValidISOTime;
|
|
14189
14402
|
exports.keepDisplayName = keepDisplayName$1;
|
|
14403
|
+
exports.mapShippingRateTierToGraphQL = mapShippingRateTierToGraphQL;
|
|
14190
14404
|
exports.mapStoresToOptions = mapStoresToOptions;
|
|
14191
14405
|
exports.mapTimeZonesToOptions = mapTimeZonesToOptions;
|
|
14192
14406
|
exports.minusify = minusify;
|
|
@@ -14197,14 +14411,14 @@ exports.not = not;
|
|
|
14197
14411
|
exports.omitDeep = omitDeep;
|
|
14198
14412
|
exports.omitSetsOfSets = omitSetsOfSets;
|
|
14199
14413
|
exports.or = or;
|
|
14200
|
-
exports.pickerMessages =
|
|
14414
|
+
exports.pickerMessages = commonPickerMessages;
|
|
14201
14415
|
exports.range = range;
|
|
14202
14416
|
exports.reorderArrayItems = reorderArrayItems;
|
|
14203
14417
|
exports.resolveStatusType = resolveStatusType;
|
|
14204
14418
|
exports.safelyAddFallback = safelyAddFallback;
|
|
14205
14419
|
exports.sanitize = sanitize;
|
|
14206
14420
|
exports.searchCategories = searchCategories;
|
|
14207
|
-
exports.searchInputMessages = messages$
|
|
14421
|
+
exports.searchInputMessages = messages$O;
|
|
14208
14422
|
exports.setDisplayName = setDisplayName$1;
|
|
14209
14423
|
exports.setToArray = setToArray;
|
|
14210
14424
|
exports.shallowEqual = shallowEqual;
|
|
@@ -14221,6 +14435,7 @@ exports.transformLocalizedFieldsForCategory = transformLocalizedFieldsForCategor
|
|
|
14221
14435
|
exports.truncate = truncate;
|
|
14222
14436
|
exports.unique = unique;
|
|
14223
14437
|
exports.uniqueObjects = uniqueObjects;
|
|
14438
|
+
exports.useBusinessUnitsPlatformLimits = useBusinessUnitsLimits$1;
|
|
14224
14439
|
exports.useCachedCategoryOptions = useCachedCategoryOptions;
|
|
14225
14440
|
exports.useCurrentOption = useCurrentOption;
|
|
14226
14441
|
exports.useCustomFieldsDnDContext = useDnDContext;
|
|
@@ -14244,6 +14459,7 @@ exports.useShippingMethodsPlatformLimits = useShippingMethodsPlatformLimits;
|
|
|
14244
14459
|
exports.useStorage = useStorage$1;
|
|
14245
14460
|
exports.useStoreKeysInDataFences = useStoreKeysInDataFences$1;
|
|
14246
14461
|
exports.useStoresListFetcher = useStoresListFetcher$1;
|
|
14462
|
+
exports.useStoresPlatformLimits = useStoresLimits$1;
|
|
14247
14463
|
exports.useTaxCategoriesPlatformLimits = useTaxCategoriesPlatformLimits;
|
|
14248
14464
|
exports.useTotalNumberOfStoresFetcher = useTotalNumberOfStoresFetcher$1;
|
|
14249
14465
|
exports.validateCustomField = validateFilter$2;
|