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