@commercetools-frontend/experimental-components 6.2.0 → 6.2.1

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.
@@ -195,7 +195,7 @@ var compact__default = /*#__PURE__*/_interopDefault(compact);
195
195
  var _Set__default = /*#__PURE__*/_interopDefault(_Set);
196
196
  var _spliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_spliceInstanceProperty);
197
197
 
198
- var styles$j = {
198
+ var styles$k = {
199
199
  "loading-container": "centered-loading-spinner-module__loading-container___3_9-h"
200
200
  };
201
201
  /**
@@ -203,7 +203,7 @@ var styles$j = {
203
203
  * - the ui-kit Spacings.Stack does not allow for custom styles, nor does it stretch to fill its container's height
204
204
  */
205
205
  const CenteredLoadingSpinner = () => jsxRuntime.jsx("div", {
206
- className: styles$j['loading-container'],
206
+ className: styles$k['loading-container'],
207
207
  "data-testid": "centered-loading-spinner",
208
208
  children: jsxRuntime.jsx(uiKit.LoadingSpinner, {})
209
209
  });
@@ -245,6 +245,7 @@ const INTERVALS_IN_SECONDS = {
245
245
  [REMINDER_OPTION_10_DAY]: 864000
246
246
  };
247
247
  const EXCLUDING_PRODUCTS = 'excludingProducts';
248
+ const PRODUCT_TAILORING_FOR_ATTRIBUTES = 'productTailoringForAttributes';
248
249
 
249
250
  // TODO: apply a more robust solution to overlaying issues
250
251
  const Z_INDEX_DROPDOWN = 30000;
@@ -1069,7 +1070,7 @@ function ownKeys$1l(e, r) { var t = _Object$keys__default["default"](e); if (_Ob
1069
1070
  function _objectSpread$1l(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$1l(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$1l(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
1070
1071
  function _callSuper$7(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$7() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
1071
1072
  function _isNativeReflectConstruct$7() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$7 = function () { return !!t; })(); }
1072
- var styles$i = {
1073
+ var styles$j = {
1073
1074
  "size": "throttled-field-module__size___324jx",
1074
1075
  "input-text": "throttled-field-module__input-text___3zFFp",
1075
1076
  "input-secondary": "throttled-field-module__input-secondary___cFo9e throttled-field-module__input-text___3zFFp throttled-field-module__size___324jx",
@@ -1178,9 +1179,9 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
1178
1179
  })
1179
1180
  }), this.props.as === 'textarea' ? jsxRuntime.jsx(Textarea__default["default"], _objectSpread$1l(_objectSpread$1l({}, commonProps), {}, {
1180
1181
  id: inputId,
1181
- className: classnames__default["default"](styles$i.textarea, styles$i[`textarea-${this.props.style}`], {
1182
- [styles$i.invalid]: !this.props.isValid,
1183
- [styles$i.disabled]: this.props.disabled
1182
+ className: classnames__default["default"](styles$j.textarea, styles$j[`textarea-${this.props.style}`], {
1183
+ [styles$j.invalid]: !this.props.isValid,
1184
+ [styles$j.disabled]: this.props.disabled
1184
1185
  }),
1185
1186
  rows: 1,
1186
1187
  maxRows: this.props.autoSize ? undefined : 1,
@@ -1189,10 +1190,10 @@ let ThrottledField = /*#__PURE__*/function (_PureComponent) {
1189
1190
  id: inputId,
1190
1191
  ref: this.props.inputRef,
1191
1192
  type: this.props.as,
1192
- className: classnames__default["default"](styles$i[`input-${this.props.style}`], {
1193
- [styles$i.invalid]: !this.props.isValid,
1194
- [styles$i.disabled]: this.props.disabled,
1195
- [styles$i.granular]: this.props.isGranular
1193
+ className: classnames__default["default"](styles$j[`input-${this.props.style}`], {
1194
+ [styles$j.invalid]: !this.props.isValid,
1195
+ [styles$j.disabled]: this.props.disabled,
1196
+ [styles$j.granular]: this.props.isGranular
1196
1197
  })
1197
1198
  }))]
1198
1199
  });
@@ -1237,7 +1238,7 @@ var messages$G = reactIntl.defineMessages({
1237
1238
 
1238
1239
  function _callSuper$6(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$6() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
1239
1240
  function _isNativeReflectConstruct$6() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$6 = function () { return !!t; })(); }
1240
- var styles$h = {
1241
+ var styles$i = {
1241
1242
  "block": "search-input-module__block___1uM-y",
1242
1243
  "container": "search-input-module__container___9u6if",
1243
1244
  "input-container": "search-input-module__input-container___mJnyZ",
@@ -1312,14 +1313,14 @@ let SearchInput = /*#__PURE__*/function (_Component) {
1312
1313
  key: "render",
1313
1314
  value: function render() {
1314
1315
  return jsxRuntime.jsx("div", {
1315
- className: classnames__default["default"](this.props.blockClassName, styles$h.block),
1316
+ className: classnames__default["default"](this.props.blockClassName, styles$i.block),
1316
1317
  children: jsxRuntime.jsxs("div", {
1317
- className: classnames__default["default"](this.props.containerClassName, styles$h.container),
1318
+ className: classnames__default["default"](this.props.containerClassName, styles$i.container),
1318
1319
  children: [jsxRuntime.jsx("div", {
1319
- className: classnames__default["default"](styles$h['input-container'], {
1320
- [styles$h['input-container-hoverable']]: !this.props.disabled,
1321
- [styles$h['input-container-disabled']]: this.props.disabled && this.props.enableDisabledStyle,
1322
- [styles$h['input-container-granular']]: this.props.isGranular
1320
+ className: classnames__default["default"](styles$i['input-container'], {
1321
+ [styles$i['input-container-hoverable']]: !this.props.disabled,
1322
+ [styles$i['input-container-disabled']]: this.props.disabled && this.props.enableDisabledStyle,
1323
+ [styles$i['input-container-granular']]: this.props.isGranular
1323
1324
  }),
1324
1325
  children: jsxRuntime.jsx(ThrottledField, {
1325
1326
  style: "primary",
@@ -1337,8 +1338,8 @@ let SearchInput = /*#__PURE__*/function (_Component) {
1337
1338
  isGranular: this.props.isGranular
1338
1339
  })
1339
1340
  }), this.state.text && jsxRuntime.jsx(uiKit.SecondaryIconButton, {
1340
- className: classnames__default["default"](styles$h['clear-icon-container'], {
1341
- [styles$h['clear-icon-container-granular']]: this.props.isGranular
1341
+ className: classnames__default["default"](styles$i['clear-icon-container'], {
1342
+ [styles$i['clear-icon-container-granular']]: this.props.isGranular
1342
1343
  }),
1343
1344
  icon: jsxRuntime.jsx(uiKit.CloseIcon, {}),
1344
1345
  size: "30",
@@ -1346,9 +1347,9 @@ let SearchInput = /*#__PURE__*/function (_Component) {
1346
1347
  onClick: this.handleClear
1347
1348
  }), jsxRuntime.jsx("div", {
1348
1349
  "data-testid": "search-button",
1349
- className: classnames__default["default"](styles$h['search-icon-container'], {
1350
- [styles$h['search-icon-container-hoverable']]: !this.props.disabled,
1351
- [styles$h['search-icon-container-granular']]: this.props.isGranular
1350
+ className: classnames__default["default"](styles$i['search-icon-container'], {
1351
+ [styles$i['search-icon-container-hoverable']]: !this.props.disabled,
1352
+ [styles$i['search-icon-container-granular']]: this.props.isGranular
1352
1353
  }),
1353
1354
  onClick: this.props.disabled ? null : this.handleSubmit,
1354
1355
  label: "search-button",
@@ -2595,10 +2596,10 @@ function defaultFilterValidator$1(_ref2) {
2595
2596
  return true;
2596
2597
  }
2597
2598
 
2598
- var localizedTextTransformer = (localizedString => {
2599
+ var localizedTextTransformer = localizedString => {
2599
2600
  var _context;
2600
2601
  return _mapInstanceProperty__default["default"](_context = _Object$keys__default["default"](localizedString)).call(_context, locale => `${locale} = "${localizedString[locale]}"`).join(' and ');
2601
- });
2602
+ };
2602
2603
 
2603
2604
  const getCentAmountClause = (value, operator, locale) => `centAmount ${operator} ${uiKit.MoneyInput.convertToMoneyValue(value, locale).centAmount}`;
2604
2605
  function moneyTransformer(value, option, locale) {
@@ -5267,7 +5268,7 @@ function getCartDiscountById(apolloClient, options) {
5267
5268
  }).then(response => response.data?.cartDiscount ? transformLocalizedFieldsForCartDiscount(response.data.cartDiscount) : null);
5268
5269
  }
5269
5270
 
5270
- var styles$g = {
5271
+ var styles$h = {
5271
5272
  "container": "reference-search-module__container___3-iK3",
5272
5273
  "missing-label": "reference-search-module__missing-label___az9AO"
5273
5274
  }; // This is a hashmap of loaded items used to map a value to an item
@@ -5374,9 +5375,9 @@ function ReferenceSearch(props) {
5374
5375
  props.onChange(option);
5375
5376
  };
5376
5377
  return jsxRuntime.jsxs("div", {
5377
- className: styles$g.container,
5378
+ className: styles$h.container,
5378
5379
  children: [areSomeItemsMissing && jsxRuntime.jsx("div", {
5379
- className: styles$g['missing-label'],
5380
+ className: styles$h['missing-label'],
5380
5381
  children: props.referenceIsMissingLabel
5381
5382
  }), jsxRuntime.jsx(CustomFieldTooltip, {
5382
5383
  title: tooltipTitle,
@@ -5696,7 +5697,7 @@ function useCachedCategoryOptions(ids) {
5696
5697
 
5697
5698
  function ownKeys$Z(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
5698
5699
  function _objectSpread$Z(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$Z(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$Z(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
5699
- var styles$f = {
5700
+ var styles$g = {
5700
5701
  "button": "button-module__button___1OzVf",
5701
5702
  "cancel": "button-module__cancel___1-jYL button-module__button___1OzVf",
5702
5703
  "confirm": "button-module__confirm___-W92x button-module__button___1OzVf",
@@ -5732,7 +5733,7 @@ const Button = props => {
5732
5733
  return jsxRuntime.jsx("button", _objectSpread$Z(_objectSpread$Z({
5733
5734
  onClick: isDisabled ? null : onClick,
5734
5735
  type: props.type,
5735
- className: classnames__default["default"](styles$f.button, isDisabled ? styles$f.disabled : null, className),
5736
+ className: classnames__default["default"](styles$g.button, isDisabled ? styles$g.disabled : null, className),
5736
5737
  disabled: isDisabled,
5737
5738
  "aria-label": props['aria-label']
5738
5739
  }, dataProps), {}, {
@@ -5754,15 +5755,15 @@ var messages$z = reactIntl.defineMessages({
5754
5755
 
5755
5756
  function ownKeys$Y(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; }
5756
5757
  function _objectSpread$Y(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$Y(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$Y(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
5757
- var styles$e = {
5758
+ var styles$f = {
5758
5759
  "button": "file-input-module__button___2KypN",
5759
5760
  "input": "file-input-module__input___3MP4D"
5760
5761
  };
5761
5762
  const FileInput = props => jsxRuntime.jsx("label", {
5762
5763
  children: jsxRuntime.jsxs("span", {
5763
- className: styles$e.button,
5764
+ className: styles$f.button,
5764
5765
  children: [jsxRuntime.jsx("input", {
5765
- className: styles$e.input,
5766
+ className: styles$f.input,
5766
5767
  type: "file",
5767
5768
  accept: props.acceptTypes,
5768
5769
  name: props.name,
@@ -6015,7 +6016,7 @@ const CustomerGroupPickerInput = _ref => {
6015
6016
  };
6016
6017
  CustomerGroupPickerInput.displayName = 'CustomerGroupPickerInput';
6017
6018
 
6018
- var styles$d = {
6019
+ var styles$e = {
6019
6020
  "divider": "divider-module__divider___4-vdy",
6020
6021
  "divider-horizontal": "divider-module__divider-horizontal___RuUcj",
6021
6022
  "divider-vertical": "divider-module__divider-vertical___32kJG",
@@ -6028,10 +6029,10 @@ function Divider(_ref) {
6028
6029
  orientation = _ref$orientation === void 0 ? 'horizontal' : _ref$orientation;
6029
6030
  return jsxRuntime.jsx("hr", {
6030
6031
  className: classnames__default["default"]({
6031
- [styles$d['divider-solid']]: !isDashed,
6032
- [styles$d['divider-dashed']]: isDashed,
6033
- [styles$d['divider-horizontal']]: orientation === 'horizontal',
6034
- [styles$d['divider-vertical']]: orientation === 'vertical'
6032
+ [styles$e['divider-solid']]: !isDashed,
6033
+ [styles$e['divider-dashed']]: isDashed,
6034
+ [styles$e['divider-horizontal']]: orientation === 'horizontal',
6035
+ [styles$e['divider-vertical']]: orientation === 'vertical'
6035
6036
  })
6036
6037
  });
6037
6038
  }
@@ -6175,7 +6176,7 @@ const ExpandButton = props => props.totalValues > 1 ? jsxRuntime.jsxs(uiKit.Spac
6175
6176
  }) : null;
6176
6177
  ExpandButton.displayName = 'ExpandButton';
6177
6178
 
6178
- var styles$c = {
6179
+ var styles$d = {
6179
6180
  "topAlign": "set-buttons-module__topAlign___3AZwc",
6180
6181
  "gap": "set-buttons-module__gap___38Qr0"
6181
6182
  }; // TODO(pa3): alignment of buttons made in a kinda ugly way (i.e. gap class).
@@ -6196,7 +6197,7 @@ const SetButtons = props => {
6196
6197
  size: "big",
6197
6198
  icon: jsxRuntime.jsx(uiKit.PlusBoldIcon, {})
6198
6199
  }) : jsxRuntime.jsx("div", {
6199
- className: styles$c.gap
6200
+ className: styles$d.gap
6200
6201
  })]
6201
6202
  })
6202
6203
  });
@@ -6566,7 +6567,7 @@ CustomLocalizedTextInput.displayName = 'CustomLocalizedTextInput';
6566
6567
 
6567
6568
  function ownKeys$S(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; }
6568
6569
  function _objectSpread$S(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$S(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$S(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
6569
- var styles$b = {
6570
+ var styles$c = {
6570
6571
  "container": "custom-money-input-module__container___1fdO2"
6571
6572
  };
6572
6573
  const fixCurrencyCode = (value, currencies) => {
@@ -6631,7 +6632,7 @@ function CustomMoneyInput(props) {
6631
6632
 
6632
6633
  // TODO(pa3): fix setting proper id in UIKit
6633
6634
  return jsxRuntime.jsxs("div", {
6634
- className: styles$b.container,
6635
+ className: styles$c.container,
6635
6636
  "aria-labelledby": props.name,
6636
6637
  children: [jsxRuntime.jsx(uiKit.AccessibleHidden, {
6637
6638
  children: jsxRuntime.jsx("label", {
@@ -7819,10 +7820,15 @@ const useDnDContext = () => {
7819
7820
  const _excluded$1 = ["WrapperComponent"];
7820
7821
  function ownKeys$J(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
7821
7822
  function _objectSpread$J(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$J(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$J(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
7823
+ const textAttributeTypes = ['text', 'ltext'];
7822
7824
  const getFieldName = (parentName, fieldName) => {
7823
7825
  if (!parentName) return fieldName;
7824
7826
  return `${parentName}.${fieldName}`;
7825
7827
  };
7828
+ const isTextAttribute = function () {
7829
+ let fieldDefinitionType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7830
+ return _includesInstanceProperty__default["default"](textAttributeTypes).call(textAttributeTypes, fieldDefinitionType.name);
7831
+ };
7826
7832
  const isNested = fieldDefinition => {
7827
7833
  const type = fieldDefinition.type;
7828
7834
  const typeName = type.name.toLowerCase();
@@ -7841,6 +7847,7 @@ const CustomFieldsInternal = _ref => {
7841
7847
  values = _valuesInstanceProperty__default["default"](_useFormikContext),
7842
7848
  handleBlur = _useFormikContext.handleBlur,
7843
7849
  status = _useFormikContext.status;
7850
+ const isTailoringAttributesEnabled = applicationShell.useFeatureToggle(PRODUCT_TAILORING_FOR_ATTRIBUTES);
7844
7851
  const didFormValidationFail = useDidFormValidationFail();
7845
7852
  const fieldDefinitions = omitSetsOfSets(props.fieldDefinitions);
7846
7853
  const _useDnDContext = useDnDContext(),
@@ -7854,6 +7861,7 @@ const CustomFieldsInternal = _ref => {
7854
7861
  children: _mapInstanceProperty__default["default"](fieldDefinitions).call(fieldDefinitions, (fieldDefinition, index) => {
7855
7862
  const fieldName = getFieldName(props.name, fieldDefinition.name);
7856
7863
  const isTouched = Boolean(formik.getIn(touched, fieldName));
7864
+ const isFieldDisabled = props.isDisabled && !(isTextAttribute(fieldDefinition.type) && isTailoringAttributesEnabled);
7857
7865
  const fieldErrors = formik.getIn(errors, fieldName);
7858
7866
  const value = props.inputValuesConverter(fieldName, formik.getIn(values, fieldName));
7859
7867
 
@@ -7871,7 +7879,7 @@ const CustomFieldsInternal = _ref => {
7871
7879
  name: fieldName,
7872
7880
  value: value,
7873
7881
  fieldDefinition: fieldDefinition,
7874
- isDisabled: props.isDisabled || isDnDMode,
7882
+ isDisabled: isFieldDisabled || isDnDMode,
7875
7883
  isReadOnly: props.isReadOnly,
7876
7884
  onBlur: handleBlur,
7877
7885
  setFieldValue: props.setFieldValue,
@@ -7929,7 +7937,7 @@ const findLabel = (enumType, key) => {
7929
7937
  };
7930
7938
  const convertEnumValues = (value, attributeDefinition) => {
7931
7939
  var _context2, _context3;
7932
- if (isNil__default["default"](value)) return value;
7940
+ if (isEmpty__default["default"](value)) return value;
7933
7941
  const typeName = getTypeName(attributeDefinition.type);
7934
7942
  if (_includesInstanceProperty__default["default"](_context2 = ['enum', 'lenum']).call(_context2, typeName)) return value.key;
7935
7943
  if (typeName === 'set' && _includesInstanceProperty__default["default"](_context3 = ['enum', 'lenum']).call(_context3, getTypeName(attributeDefinition.type.elementType))) return _mapInstanceProperty__default["default"](value).call(value, _ref => {
@@ -7940,7 +7948,7 @@ const convertEnumValues = (value, attributeDefinition) => {
7940
7948
  };
7941
7949
  const customFieldToAttribute = (value, attributeDefinition) => {
7942
7950
  var _context4, _context5;
7943
- if (isNil__default["default"](value)) return value;
7951
+ if (isEmpty__default["default"](value)) return value;
7944
7952
  if (!attributeDefinition) return value;
7945
7953
  const type = attributeDefinition.type;
7946
7954
  const typeName = getTypeName(type);
@@ -8513,7 +8521,7 @@ ProductSelectionsPicker.defaultProps = {
8513
8521
  };
8514
8522
 
8515
8523
  // NOTE: this component is duplicated in `app-shell/from-core`.
8516
- var styles$a = {
8524
+ var styles$b = {
8517
8525
  "colored": "required-indicator-module__colored____YUFm",
8518
8526
  "indicatorAsterisk": "required-indicator-module__indicatorAsterisk___3lEdX"
8519
8527
  };
@@ -8521,8 +8529,8 @@ const RequiredIndicator = _ref => {
8521
8529
  let uncolored = _ref.uncolored;
8522
8530
  return jsxRuntime.jsx("em", {
8523
8531
  className: classnames__default["default"]({
8524
- [styles$a.colored]: !uncolored,
8525
- [styles$a.indicatorAsterisk]: true
8532
+ [styles$b.colored]: !uncolored,
8533
+ [styles$b.indicatorAsterisk]: true
8526
8534
  }),
8527
8535
  children: '*'
8528
8536
  });
@@ -8577,7 +8585,7 @@ var messages$r = reactIntl.defineMessages({
8577
8585
  }
8578
8586
  });
8579
8587
 
8580
- var styles$9 = {
8588
+ var styles$a = {
8581
8589
  "container": "selectable-field-search-input-module__container___z2ltR",
8582
8590
  "search-mode-menu": "selectable-field-search-input-module__search-mode-menu___Od6Le"
8583
8591
  };
@@ -8588,7 +8596,7 @@ const SelectableFieldSearchInput = props => {
8588
8596
  setSearchText = _useState2[1];
8589
8597
  const intl = reactIntl.useIntl();
8590
8598
  return jsxRuntime.jsx("div", {
8591
- className: styles$9.container,
8599
+ className: styles$a.container,
8592
8600
  children: jsxRuntime.jsx(uiKit.SelectableSearchInput, {
8593
8601
  menuHorizontalConstraint: 5,
8594
8602
  options: props.options,
@@ -8985,7 +8993,7 @@ const useStoresByFieldFetcher = function (stores, predicateField, projectKey) {
8985
8993
  function ownKeys$C(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
8986
8994
  function _objectSpread$C(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys$C(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys$C(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
8987
8995
  var FetchStoresByWherePredicate = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchStoresByWherePredicate" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "where" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "skipFetchingStores" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "excludeProductSelections" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", alias: { kind: "Name", value: "storesByWherePredicate" }, name: { kind: "Name", value: "stores" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "where" }, value: { kind: "Variable", name: { kind: "Name", value: "where" } } }], directives: [{ kind: "Directive", name: { kind: "Name", value: "skip" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "skipFetchingStores" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "productSelections" }, arguments: [], directives: [{ kind: "Directive", name: { kind: "Name", value: "skip" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "excludeProductSelections" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "active" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "productSelection" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }] } }] } }] } }] } }], loc: { start: 0, end: 525, source: { body: "query FetchStoresByWherePredicate(\n $where: String!\n $skipFetchingStores: Boolean!\n $excludeProductSelections: Boolean!\n) {\n storesByWherePredicate: stores(where: $where) @skip(if: $skipFetchingStores) {\n results {\n id\n key\n nameAllLocales {\n locale\n value\n }\n productSelections @skip(if: $excludeProductSelections) {\n active\n productSelection {\n id\n nameAllLocales {\n locale\n value\n }\n }\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
8988
- var styles$8 = {
8996
+ var styles$9 = {
8989
8997
  "renderLabelContainer": "stores-search-selector-module__renderLabelContainer___3_PBc",
8990
8998
  "customLabel": "stores-search-selector-module__customLabel___1Xse8"
8991
8999
  }; // check wether there are any errors
@@ -9099,9 +9107,9 @@ const StoresSearchSelectInput = props => {
9099
9107
  const renderNoOptions = _ref4 => {
9100
9108
  let inputValue = _ref4.inputValue;
9101
9109
  return jsxRuntime.jsxs("div", {
9102
- className: styles$8.renderLabelContainer,
9110
+ className: styles$9.renderLabelContainer,
9103
9111
  children: [jsxRuntime.jsx("div", {
9104
- className: styles$8.customLabel,
9112
+ className: styles$9.customLabel,
9105
9113
  children: props?.renderLabel && props?.renderLabel
9106
9114
  }), jsxRuntime.jsx("div", {
9107
9115
  children: intl.formatMessage(inputValue ? messages$q.searchSelectInputNoOptionsFoundMessage : messages$q.searchSelectInputNoValueMessage)
@@ -9160,6 +9168,9 @@ StoresSearchSelectInput.defaultProps = {
9160
9168
 
9161
9169
  function ownKeys$B(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; }
9162
9170
  function _objectSpread$B(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$B(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$B(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
9171
+ var styles$8 = {
9172
+ "customOption": "store-select-input-module__customOption___2SC00"
9173
+ };
9163
9174
  const StoreSelectInput = props => {
9164
9175
  const totalNumberOfStoresFetcher = useTotalNumberOfStoresFetcher(props.projectKey);
9165
9176
  const components = React.useMemo(() => {
@@ -9169,13 +9180,17 @@ const StoreSelectInput = props => {
9169
9180
  if (optionInnerProps.isDisabled) {
9170
9181
  return jsxRuntime.jsx(uiKit.SelectInput.Option, _objectSpread$B({}, optionInnerProps));
9171
9182
  }
9172
- return jsxRuntime.jsx(selectUtils.CustomSelectInputOption, {
9173
- optionType: props.optionType,
9174
- optionInnerProps: optionInnerProps
9183
+ const isSearchSelectInput = totalNumberOfStoresFetcher.total > props.upperStoresLimit;
9184
+ return jsxRuntime.jsx("div", {
9185
+ className: isSearchSelectInput ? styles$8.customOption : '',
9186
+ children: jsxRuntime.jsx(selectUtils.CustomSelectInputOption, {
9187
+ optionType: props.optionType,
9188
+ optionInnerProps: optionInnerProps
9189
+ })
9175
9190
  });
9176
9191
  }
9177
9192
  };
9178
- }, [props.optionType]);
9193
+ }, [props.optionType, totalNumberOfStoresFetcher.total, props.upperStoresLimit]);
9179
9194
  if (totalNumberOfStoresFetcher.isLoading) return jsxRuntime.jsx(CenteredLoadingSpinner, {});
9180
9195
  const CustomStoreSelectInput = totalNumberOfStoresFetcher.total <= props.lowerStoresLimit ? StoresBasicSelectInput : totalNumberOfStoresFetcher.total <= props.upperStoresLimit ? StoresAsyncSelectInput : StoresSearchSelectInput;
9181
9196
  return jsxRuntime.jsx(CustomStoreSelectInput, _objectSpread$B(_objectSpread$B({
@@ -10083,7 +10098,9 @@ const mapTypeDefinitionsToOptions = (typeDefinitions, language, languages, selec
10083
10098
  }));
10084
10099
  };
10085
10100
 
10086
- // Used to generate form state when the user selects a type definition from the dropdown
10101
+ /**
10102
+ * Creates a new form state based on the selected type definition from the dropdown.
10103
+ */
10087
10104
  const createFormStateFromTypeDefinition = selectedTypeDefinition => {
10088
10105
  return {
10089
10106
  type: {
@@ -10106,7 +10123,8 @@ const CustomTypeSubform = _ref => {
10106
10123
  const _useFormikContext = formik.useFormikContext(),
10107
10124
  formValues = _valuesInstanceProperty__default["default"](_useFormikContext),
10108
10125
  setFieldValue = _useFormikContext.setFieldValue,
10109
- validateForm = _useFormikContext.validateForm;
10126
+ validateForm = _useFormikContext.validateForm,
10127
+ initialValues = _useFormikContext.initialValues;
10110
10128
  const _useIntl = reactIntl.useIntl(),
10111
10129
  formatMessage = _useIntl.formatMessage;
10112
10130
  const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
@@ -10119,8 +10137,23 @@ const CustomTypeSubform = _ref => {
10119
10137
  const handleTypeDefinitionSelect = React.useCallback(event => {
10120
10138
  const selectedTypeDefinition = _findInstanceProperty__default["default"](typeDefinitions).call(typeDefinitions, typeDefinition => typeDefinition.type.key === event.target.value);
10121
10139
  if (selectedTypeDefinition) {
10122
- const nextCustom = createFormStateFromTypeDefinition(selectedTypeDefinition);
10123
- setFieldValue(rootFieldName, nextCustom).then(() => {
10140
+ const initialValueCustomType = initialValues[rootFieldName];
10141
+ const selectedCustomTypeKey = selectedTypeDefinition?.type.key;
10142
+ let newFieldValue;
10143
+
10144
+ /**
10145
+ * If the user selects the same custom type that was already selected, we need to reset the `custom` field
10146
+ * back to its initial value to ensure that the form state is consistent with the initial values.
10147
+ */
10148
+ if (initialValueCustomType?.type?.obj?.key === selectedCustomTypeKey) {
10149
+ newFieldValue = initialValueCustomType;
10150
+ /**
10151
+ * Otherwise, set the `custom` field to the new custom type definition.
10152
+ */
10153
+ } else {
10154
+ newFieldValue = createFormStateFromTypeDefinition(selectedTypeDefinition);
10155
+ }
10156
+ setFieldValue(rootFieldName, newFieldValue).then(() => {
10124
10157
  validateForm();
10125
10158
  });
10126
10159
  } else {
@@ -10225,7 +10258,7 @@ const defaultValue = {
10225
10258
  const PimIndexerContext = /*#__PURE__*/React.createContext(defaultValue);
10226
10259
 
10227
10260
  var FetchIndicesExist = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchIndicesExist" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "indicesExist" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "products" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "searchableIndexExists" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "newInProgress" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "productTypes" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "searchableIndexExists" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "newInProgress" }, arguments: [], directives: [] }] } }] } }] } }], loc: { start: 0, end: 191, source: { body: "query FetchIndicesExist {\n indicesExist {\n products {\n searchableIndexExists\n newInProgress\n }\n productTypes {\n searchableIndexExists\n newInProgress\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
10228
- var fetchPimIndexStatus = ((apolloClient, projectKey) => async dispatch => {
10261
+ var fetchPimIndexStatus = (apolloClient, projectKey) => async dispatch => {
10229
10262
  try {
10230
10263
  await dispatch(sdk.actions.head({
10231
10264
  mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.PIM_SEARCH,
@@ -10263,7 +10296,7 @@ var fetchPimIndexStatus = ((apolloClient, projectKey) => async dispatch => {
10263
10296
  status: 'unreachable'
10264
10297
  };
10265
10298
  }
10266
- });
10299
+ };
10267
10300
 
10268
10301
  var messages$n = reactIntl.defineMessages({
10269
10302
  indexingSucceed: {