@knovator/pagecreator-admin 1.7.7 → 1.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -1775,6 +1775,16 @@ const TRANSLATION_PAIRS_WIDGET = {
1775
1775
  tabNameRequired: 'Tab Name is required',
1776
1776
  subtitle: 'Subtitle',
1777
1777
  subTitlePlaceholder: 'Enter Subtitle',
1778
+ quote: 'Quote',
1779
+ quotePlaceholder: 'Enter quote',
1780
+ personName: 'Person Name',
1781
+ personNamePlaceholder: 'Enter person name',
1782
+ personRole: 'Person Role',
1783
+ personRolePlaceholder: 'Enter person role',
1784
+ personOrganization: 'Organization',
1785
+ personOrganizationPlaceholder: 'Enter organization',
1786
+ rating: 'Rating',
1787
+ ratingPlaceholder: 'Enter rating',
1778
1788
  altText: 'Alt Text',
1779
1789
  altTextPlaceholder: 'Enter alt text',
1780
1790
  link: 'Link',
@@ -3849,6 +3859,7 @@ const SimpleForm = /*#__PURE__*/React.forwardRef(({
3849
3859
  setError,
3850
3860
  languages
3851
3861
  }, ref) => {
3862
+ const isMultilingualWidgetField = accessor => accessor === 'widgetTitles' || accessor === 'widgetSubtitles';
3852
3863
  const inputRenderer = schema => {
3853
3864
  var _a, _b, _c, _d;
3854
3865
  let input;
@@ -3933,7 +3944,7 @@ const SimpleForm = /*#__PURE__*/React.forwardRef(({
3933
3944
  case 'url':
3934
3945
  case 'color':
3935
3946
  default:
3936
- if (Array.isArray(languages) && languages.length > 0 && schema.accessor === 'widgetTitles') {
3947
+ if (Array.isArray(languages) && languages.length > 0 && isMultilingualWidgetField(schema.accessor)) {
3937
3948
  input = languages.map(lang => {
3938
3949
  var _a, _b;
3939
3950
  return /*#__PURE__*/React__default["default"].createElement(Input, {
@@ -3965,7 +3976,7 @@ const SimpleForm = /*#__PURE__*/React.forwardRef(({
3965
3976
  break;
3966
3977
  }
3967
3978
  } else if (schema.Input) {
3968
- if (Array.isArray(languages) && languages.length > 0 && schema.accessor === 'widgetTitles') {
3979
+ if (Array.isArray(languages) && languages.length > 0 && isMultilingualWidgetField(schema.accessor)) {
3969
3980
  input = languages.map(lang => (/*#__PURE__*/React__default["default"].createElement("div", {
3970
3981
  key: lang.code,
3971
3982
  className: classNames__default["default"]('khb_input-wrapper', schema.wrapperClassName)
@@ -6806,6 +6817,7 @@ const ItemsAccordian = ({
6806
6817
  itemType,
6807
6818
  languages,
6808
6819
  clearError,
6820
+ widgetType,
6809
6821
  addText: _addText = 'Add',
6810
6822
  deleteText: _deleteText = 'Delete'
6811
6823
  }) => {
@@ -6829,6 +6841,7 @@ const ItemsAccordian = ({
6829
6841
  name,
6830
6842
  control
6831
6843
  });
6844
+ const isTestimonialWidget = widgetType === 'Testimonial';
6832
6845
  const onItemsToggleClick = (index, status) => {
6833
6846
  var _a;
6834
6847
  const newItemsShow = [...itemsShow];
@@ -6846,6 +6859,18 @@ const ItemsAccordian = ({
6846
6859
  // eslint-disable-next-line react-hooks/exhaustive-deps
6847
6860
  }, [errors, name, errors === null || errors === void 0 ? void 0 : errors[name]]);
6848
6861
  const addTab = index => {
6862
+ if (isTestimonialWidget) {
6863
+ appendItem({
6864
+ quote: '',
6865
+ personName: '',
6866
+ personRole: '',
6867
+ personOrganization: '',
6868
+ rating: 5,
6869
+ itemType,
6870
+ sequence: index
6871
+ });
6872
+ return;
6873
+ }
6849
6874
  appendItem({
6850
6875
  altText: '',
6851
6876
  link: '',
@@ -6869,7 +6894,7 @@ const ItemsAccordian = ({
6869
6894
  }, /*#__PURE__*/React__default["default"].createElement("div", {
6870
6895
  className: "khb_item-items"
6871
6896
  }, items === null || items === void 0 ? void 0 : items.map((field, index) => {
6872
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
6897
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
6873
6898
  return /*#__PURE__*/React__default["default"].createElement(Accordian, {
6874
6899
  key: index,
6875
6900
  open: itemsShow[index],
@@ -6889,7 +6914,51 @@ const ItemsAccordian = ({
6889
6914
  }, _deleteText))
6890
6915
  }, /*#__PURE__*/React__default["default"].createElement("div", {
6891
6916
  className: "khb-form-items"
6892
- }, Array.isArray(languages) && languages.length > 0 ? (/*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, languages.map(lang => {
6917
+ }, isTestimonialWidget ? (/*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Input, {
6918
+ rest: register(`${name}.${index}.quote`),
6919
+ label: widgetTranslations.quote,
6920
+ error: (_d = (_c = (_b = (_a = errors[name]) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b['quote']) === null || _c === void 0 ? void 0 : _c.message) === null || _d === void 0 ? void 0 : _d.toString(),
6921
+ type: "text",
6922
+ className: "w-full p-2",
6923
+ placeholder: widgetTranslations.quotePlaceholder
6924
+ }), /*#__PURE__*/React__default["default"].createElement(Input, {
6925
+ rest: register(`${name}.${index}.personName`),
6926
+ label: widgetTranslations.personName,
6927
+ error: (_h = (_g = (_f = (_e = errors[name]) === null || _e === void 0 ? void 0 : _e[index]) === null || _f === void 0 ? void 0 : _f['personName']) === null || _g === void 0 ? void 0 : _g.message) === null || _h === void 0 ? void 0 : _h.toString(),
6928
+ type: "text",
6929
+ className: "w-full p-2",
6930
+ placeholder: widgetTranslations.personNamePlaceholder
6931
+ }), /*#__PURE__*/React__default["default"].createElement(Input, {
6932
+ rest: register(`${name}.${index}.personRole`),
6933
+ label: widgetTranslations.personRole,
6934
+ error: (_m = (_l = (_k = (_j = errors[name]) === null || _j === void 0 ? void 0 : _j[index]) === null || _k === void 0 ? void 0 : _k['personRole']) === null || _l === void 0 ? void 0 : _l.message) === null || _m === void 0 ? void 0 : _m.toString(),
6935
+ type: "text",
6936
+ className: "w-full p-2",
6937
+ placeholder: widgetTranslations.personRolePlaceholder
6938
+ }), /*#__PURE__*/React__default["default"].createElement(Input, {
6939
+ rest: register(`${name}.${index}.personOrganization`),
6940
+ label: widgetTranslations.personOrganization,
6941
+ error: (_r = (_q = (_p = (_o = errors[name]) === null || _o === void 0 ? void 0 : _o[index]) === null || _p === void 0 ? void 0 : _p['personOrganization']) === null || _q === void 0 ? void 0 : _q.message) === null || _r === void 0 ? void 0 : _r.toString(),
6942
+ type: "text",
6943
+ className: "w-full p-2",
6944
+ placeholder: widgetTranslations.personOrganizationPlaceholder
6945
+ }), /*#__PURE__*/React__default["default"].createElement(Input, {
6946
+ rest: register(`${name}.${index}.rating`, {
6947
+ min: {
6948
+ value: 0,
6949
+ message: 'Rating should be greater than or equal to 0'
6950
+ },
6951
+ max: {
6952
+ value: 5,
6953
+ message: 'Rating should be less than or equal to 5'
6954
+ }
6955
+ }),
6956
+ label: widgetTranslations.rating,
6957
+ error: (_v = (_u = (_t = (_s = errors[name]) === null || _s === void 0 ? void 0 : _s[index]) === null || _t === void 0 ? void 0 : _t['rating']) === null || _u === void 0 ? void 0 : _u.message) === null || _v === void 0 ? void 0 : _v.toString(),
6958
+ type: "number",
6959
+ className: "w-full p-2",
6960
+ placeholder: widgetTranslations.ratingPlaceholder
6961
+ }))) : (/*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, Array.isArray(languages) && languages.length > 0 ? (/*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, languages.map(lang => {
6893
6962
  var _a, _b, _c, _d, _e, _f, _g, _h;
6894
6963
  return /*#__PURE__*/React__default["default"].createElement(Input, {
6895
6964
  rest: register(`${name}.${index}.titles.${lang.code}`),
@@ -6902,7 +6971,7 @@ const ItemsAccordian = ({
6902
6971
  }))) : (/*#__PURE__*/React__default["default"].createElement(Input, {
6903
6972
  rest: register(`${name}.${index}.title`),
6904
6973
  label: commonTranslations.title,
6905
- error: (_d = (_c = (_b = (_a = errors[name]) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b['title']) === null || _c === void 0 ? void 0 : _c.message) === null || _d === void 0 ? void 0 : _d.toString(),
6974
+ error: (_z = (_y = (_x = (_w = errors[name]) === null || _w === void 0 ? void 0 : _w[index]) === null || _x === void 0 ? void 0 : _x['title']) === null || _y === void 0 ? void 0 : _y.message) === null || _z === void 0 ? void 0 : _z.toString(),
6906
6975
  type: "text",
6907
6976
  className: "w-full p-2",
6908
6977
  placeholder: commonTranslations.titlePlaceholder
@@ -6941,7 +7010,7 @@ const ItemsAccordian = ({
6941
7010
  register: register,
6942
7011
  label: widgetTranslations.srcset,
6943
7012
  name: `${name}.${index}.srcset`,
6944
- errors: (_f = (_e = errors[name]) === null || _e === void 0 ? void 0 : _e[index]) === null || _f === void 0 ? void 0 : _f['srcset'],
7013
+ errors: (_1 = (_0 = errors[name]) === null || _0 === void 0 ? void 0 : _0[index]) === null || _1 === void 0 ? void 0 : _1['srcset'],
6945
7014
  screenSizeRequired: widgetTranslations.screenSizeRequired,
6946
7015
  heightRequired: widgetTranslations.heightRequired,
6947
7016
  minHeight: widgetTranslations.minHeight,
@@ -6976,7 +7045,7 @@ const ItemsAccordian = ({
6976
7045
  label: widgetTranslations.image,
6977
7046
  control: control,
6978
7047
  name: `${name}.${index}.img`,
6979
- error: (_k = (_j = (_h = (_g = errors[name]) === null || _g === void 0 ? void 0 : _g[index]) === null || _h === void 0 ? void 0 : _h['img']) === null || _j === void 0 ? void 0 : _j.message) === null || _k === void 0 ? void 0 : _k.toString(),
7048
+ error: (_5 = (_4 = (_3 = (_2 = errors[name]) === null || _2 === void 0 ? void 0 : _2[index]) === null || _3 === void 0 ? void 0 : _3['img']) === null || _4 === void 0 ? void 0 : _4.message) === null || _5 === void 0 ? void 0 : _5.toString(),
6980
7049
  baseUrl: imageBaseUrl ? imageBaseUrl : baseUrl,
6981
7050
  setError: setError,
6982
7051
  clearError: clearError,
@@ -6992,7 +7061,7 @@ const ItemsAccordian = ({
6992
7061
  }, widgetTranslations.dragDrop)), /*#__PURE__*/React__default["default"].createElement("p", {
6993
7062
  className: "khb_img-text-2"
6994
7063
  }, widgetTranslations.allowedFormat))
6995
- }))));
7064
+ }))))));
6996
7065
  })));
6997
7066
  };
6998
7067
 
@@ -7179,6 +7248,7 @@ const constants = {
7179
7248
  textWidgetTypeValue: 'Text',
7180
7249
  htmlWidgetTypeValue: 'HTML',
7181
7250
  linksWidgetTypeValue: 'Links',
7251
+ testimonialWidgetTypeValue: 'Testimonial',
7182
7252
  pagesItemsTypeValue: 'pages',
7183
7253
  tabsAccessor: 'tabs',
7184
7254
  webItems: 'webItems',
@@ -7251,6 +7321,7 @@ const WidgetForm = ({
7251
7321
  const [blogCategoriesLoading, setBlogCategoriesLoading] = React.useState(false);
7252
7322
  const pagesLoadedRef = React.useRef(false);
7253
7323
  const blogCategoryInitialized = React.useRef(false);
7324
+ const selectedWidgetTypeValue = (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) || getValues(constants.widgetTypeAccessor);
7254
7325
  React.useEffect(() => {
7255
7326
  if (data && formState === 'UPDATE') {
7256
7327
  const widgetType = widgetTypes.find(type => type.value === (data === null || data === void 0 ? void 0 : data.widgetType));
@@ -7454,6 +7525,12 @@ const WidgetForm = ({
7454
7525
  setValue(constants.collectionNameAccessor, constants.pagesItemsTypeValue);
7455
7526
  const pagesOption = itemsTypes.find(item => item.value === constants.pagesItemsTypeValue);
7456
7527
  if (pagesOption) setSelectedCollectionType(pagesOption);
7528
+ } else if ((widgetType === null || widgetType === void 0 ? void 0 : widgetType.value) === constants.testimonialWidgetTypeValue) {
7529
+ setItemsEnabled(true);
7530
+ setSelectedCollectionType(undefined);
7531
+ setSelectedCollectionItems([]);
7532
+ setValue(constants.itemTypeAccessor, constants.imageItemsTypeValue);
7533
+ setValue(constants.collectionNameAccessor, constants.imageItemsTypeValue);
7457
7534
  } else {
7458
7535
  setItemsEnabled(true);
7459
7536
  }
@@ -7669,6 +7746,22 @@ const WidgetForm = ({
7669
7746
  },
7670
7747
  info: widgetTranslations.widgetTitleInfo,
7671
7748
  Input: customInputs && customInputs['widgetTitle'] ? customInputs['widgetTitle'] : undefined
7749
+ }, Array.isArray(languages) && languages.length > 0 ? {
7750
+ label: widgetTranslations.subtitle,
7751
+ accessor: 'widgetSubtitles',
7752
+ required: false,
7753
+ type: customInputs && customInputs['widgetSubtitles'] ? undefined : 'text',
7754
+ placeholder: widgetTranslations.subTitlePlaceholder,
7755
+ onInput: handleCapitalize,
7756
+ Input: customInputs && customInputs['widgetSubtitles'] ? customInputs['widgetSubtitles'] : undefined
7757
+ } : {
7758
+ label: widgetTranslations.subtitle,
7759
+ accessor: 'widgetSubtitle',
7760
+ required: false,
7761
+ type: customInputs && customInputs['widgetSubtitle'] ? undefined : 'text',
7762
+ onInput: handleCapitalize,
7763
+ placeholder: widgetTranslations.subTitlePlaceholder,
7764
+ Input: customInputs && customInputs['widgetSubtitle'] ? customInputs['widgetSubtitle'] : undefined
7672
7765
  }, {
7673
7766
  label: widgetTranslations.widgetType,
7674
7767
  required: true,
@@ -7713,7 +7806,7 @@ const WidgetForm = ({
7713
7806
  label: widgetTranslations.itemsType,
7714
7807
  required: true,
7715
7808
  editable: false,
7716
- show: (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) !== constants.textWidgetTypeValue && (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) !== constants.htmlWidgetTypeValue,
7809
+ show: selectedWidgetTypeValue !== constants.textWidgetTypeValue && selectedWidgetTypeValue !== constants.htmlWidgetTypeValue && selectedWidgetTypeValue !== constants.testimonialWidgetTypeValue,
7717
7810
  accessor: constants.itemTypeAccessor,
7718
7811
  type: 'select',
7719
7812
  validations: {
@@ -7925,7 +8018,8 @@ const WidgetForm = ({
7925
8018
  register: register,
7926
8019
  loading: loading,
7927
8020
  addText: commonTranslations.add,
7928
- deleteText: commonTranslations.delete
8021
+ deleteText: commonTranslations.delete,
8022
+ widgetType: selectedWidgetTypeValue
7929
8023
  }), /*#__PURE__*/React__default["default"].createElement(ItemsAccordian, {
7930
8024
  languages: languages,
7931
8025
  clearError: clearErrors,
@@ -7942,7 +8036,8 @@ const WidgetForm = ({
7942
8036
  control: control,
7943
8037
  register: register,
7944
8038
  addText: commonTranslations.add,
7945
- deleteText: commonTranslations.delete
8039
+ deleteText: commonTranslations.delete,
8040
+ widgetType: selectedWidgetTypeValue
7946
8041
  }))));
7947
8042
  };
7948
8043
 
package/index.js CHANGED
@@ -1763,6 +1763,16 @@ const TRANSLATION_PAIRS_WIDGET = {
1763
1763
  tabNameRequired: 'Tab Name is required',
1764
1764
  subtitle: 'Subtitle',
1765
1765
  subTitlePlaceholder: 'Enter Subtitle',
1766
+ quote: 'Quote',
1767
+ quotePlaceholder: 'Enter quote',
1768
+ personName: 'Person Name',
1769
+ personNamePlaceholder: 'Enter person name',
1770
+ personRole: 'Person Role',
1771
+ personRolePlaceholder: 'Enter person role',
1772
+ personOrganization: 'Organization',
1773
+ personOrganizationPlaceholder: 'Enter organization',
1774
+ rating: 'Rating',
1775
+ ratingPlaceholder: 'Enter rating',
1766
1776
  altText: 'Alt Text',
1767
1777
  altTextPlaceholder: 'Enter alt text',
1768
1778
  link: 'Link',
@@ -3837,6 +3847,7 @@ const SimpleForm = /*#__PURE__*/forwardRef(({
3837
3847
  setError,
3838
3848
  languages
3839
3849
  }, ref) => {
3850
+ const isMultilingualWidgetField = accessor => accessor === 'widgetTitles' || accessor === 'widgetSubtitles';
3840
3851
  const inputRenderer = schema => {
3841
3852
  var _a, _b, _c, _d;
3842
3853
  let input;
@@ -3921,7 +3932,7 @@ const SimpleForm = /*#__PURE__*/forwardRef(({
3921
3932
  case 'url':
3922
3933
  case 'color':
3923
3934
  default:
3924
- if (Array.isArray(languages) && languages.length > 0 && schema.accessor === 'widgetTitles') {
3935
+ if (Array.isArray(languages) && languages.length > 0 && isMultilingualWidgetField(schema.accessor)) {
3925
3936
  input = languages.map(lang => {
3926
3937
  var _a, _b;
3927
3938
  return /*#__PURE__*/React.createElement(Input, {
@@ -3953,7 +3964,7 @@ const SimpleForm = /*#__PURE__*/forwardRef(({
3953
3964
  break;
3954
3965
  }
3955
3966
  } else if (schema.Input) {
3956
- if (Array.isArray(languages) && languages.length > 0 && schema.accessor === 'widgetTitles') {
3967
+ if (Array.isArray(languages) && languages.length > 0 && isMultilingualWidgetField(schema.accessor)) {
3957
3968
  input = languages.map(lang => (/*#__PURE__*/React.createElement("div", {
3958
3969
  key: lang.code,
3959
3970
  className: classNames('khb_input-wrapper', schema.wrapperClassName)
@@ -6794,6 +6805,7 @@ const ItemsAccordian = ({
6794
6805
  itemType,
6795
6806
  languages,
6796
6807
  clearError,
6808
+ widgetType,
6797
6809
  addText: _addText = 'Add',
6798
6810
  deleteText: _deleteText = 'Delete'
6799
6811
  }) => {
@@ -6817,6 +6829,7 @@ const ItemsAccordian = ({
6817
6829
  name,
6818
6830
  control
6819
6831
  });
6832
+ const isTestimonialWidget = widgetType === 'Testimonial';
6820
6833
  const onItemsToggleClick = (index, status) => {
6821
6834
  var _a;
6822
6835
  const newItemsShow = [...itemsShow];
@@ -6834,6 +6847,18 @@ const ItemsAccordian = ({
6834
6847
  // eslint-disable-next-line react-hooks/exhaustive-deps
6835
6848
  }, [errors, name, errors === null || errors === void 0 ? void 0 : errors[name]]);
6836
6849
  const addTab = index => {
6850
+ if (isTestimonialWidget) {
6851
+ appendItem({
6852
+ quote: '',
6853
+ personName: '',
6854
+ personRole: '',
6855
+ personOrganization: '',
6856
+ rating: 5,
6857
+ itemType,
6858
+ sequence: index
6859
+ });
6860
+ return;
6861
+ }
6837
6862
  appendItem({
6838
6863
  altText: '',
6839
6864
  link: '',
@@ -6857,7 +6882,7 @@ const ItemsAccordian = ({
6857
6882
  }, /*#__PURE__*/React.createElement("div", {
6858
6883
  className: "khb_item-items"
6859
6884
  }, items === null || items === void 0 ? void 0 : items.map((field, index) => {
6860
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
6885
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
6861
6886
  return /*#__PURE__*/React.createElement(Accordian, {
6862
6887
  key: index,
6863
6888
  open: itemsShow[index],
@@ -6877,7 +6902,51 @@ const ItemsAccordian = ({
6877
6902
  }, _deleteText))
6878
6903
  }, /*#__PURE__*/React.createElement("div", {
6879
6904
  className: "khb-form-items"
6880
- }, Array.isArray(languages) && languages.length > 0 ? (/*#__PURE__*/React.createElement(React.Fragment, null, languages.map(lang => {
6905
+ }, isTestimonialWidget ? (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Input, {
6906
+ rest: register(`${name}.${index}.quote`),
6907
+ label: widgetTranslations.quote,
6908
+ error: (_d = (_c = (_b = (_a = errors[name]) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b['quote']) === null || _c === void 0 ? void 0 : _c.message) === null || _d === void 0 ? void 0 : _d.toString(),
6909
+ type: "text",
6910
+ className: "w-full p-2",
6911
+ placeholder: widgetTranslations.quotePlaceholder
6912
+ }), /*#__PURE__*/React.createElement(Input, {
6913
+ rest: register(`${name}.${index}.personName`),
6914
+ label: widgetTranslations.personName,
6915
+ error: (_h = (_g = (_f = (_e = errors[name]) === null || _e === void 0 ? void 0 : _e[index]) === null || _f === void 0 ? void 0 : _f['personName']) === null || _g === void 0 ? void 0 : _g.message) === null || _h === void 0 ? void 0 : _h.toString(),
6916
+ type: "text",
6917
+ className: "w-full p-2",
6918
+ placeholder: widgetTranslations.personNamePlaceholder
6919
+ }), /*#__PURE__*/React.createElement(Input, {
6920
+ rest: register(`${name}.${index}.personRole`),
6921
+ label: widgetTranslations.personRole,
6922
+ error: (_m = (_l = (_k = (_j = errors[name]) === null || _j === void 0 ? void 0 : _j[index]) === null || _k === void 0 ? void 0 : _k['personRole']) === null || _l === void 0 ? void 0 : _l.message) === null || _m === void 0 ? void 0 : _m.toString(),
6923
+ type: "text",
6924
+ className: "w-full p-2",
6925
+ placeholder: widgetTranslations.personRolePlaceholder
6926
+ }), /*#__PURE__*/React.createElement(Input, {
6927
+ rest: register(`${name}.${index}.personOrganization`),
6928
+ label: widgetTranslations.personOrganization,
6929
+ error: (_r = (_q = (_p = (_o = errors[name]) === null || _o === void 0 ? void 0 : _o[index]) === null || _p === void 0 ? void 0 : _p['personOrganization']) === null || _q === void 0 ? void 0 : _q.message) === null || _r === void 0 ? void 0 : _r.toString(),
6930
+ type: "text",
6931
+ className: "w-full p-2",
6932
+ placeholder: widgetTranslations.personOrganizationPlaceholder
6933
+ }), /*#__PURE__*/React.createElement(Input, {
6934
+ rest: register(`${name}.${index}.rating`, {
6935
+ min: {
6936
+ value: 0,
6937
+ message: 'Rating should be greater than or equal to 0'
6938
+ },
6939
+ max: {
6940
+ value: 5,
6941
+ message: 'Rating should be less than or equal to 5'
6942
+ }
6943
+ }),
6944
+ label: widgetTranslations.rating,
6945
+ error: (_v = (_u = (_t = (_s = errors[name]) === null || _s === void 0 ? void 0 : _s[index]) === null || _t === void 0 ? void 0 : _t['rating']) === null || _u === void 0 ? void 0 : _u.message) === null || _v === void 0 ? void 0 : _v.toString(),
6946
+ type: "number",
6947
+ className: "w-full p-2",
6948
+ placeholder: widgetTranslations.ratingPlaceholder
6949
+ }))) : (/*#__PURE__*/React.createElement(React.Fragment, null, Array.isArray(languages) && languages.length > 0 ? (/*#__PURE__*/React.createElement(React.Fragment, null, languages.map(lang => {
6881
6950
  var _a, _b, _c, _d, _e, _f, _g, _h;
6882
6951
  return /*#__PURE__*/React.createElement(Input, {
6883
6952
  rest: register(`${name}.${index}.titles.${lang.code}`),
@@ -6890,7 +6959,7 @@ const ItemsAccordian = ({
6890
6959
  }))) : (/*#__PURE__*/React.createElement(Input, {
6891
6960
  rest: register(`${name}.${index}.title`),
6892
6961
  label: commonTranslations.title,
6893
- error: (_d = (_c = (_b = (_a = errors[name]) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b['title']) === null || _c === void 0 ? void 0 : _c.message) === null || _d === void 0 ? void 0 : _d.toString(),
6962
+ error: (_z = (_y = (_x = (_w = errors[name]) === null || _w === void 0 ? void 0 : _w[index]) === null || _x === void 0 ? void 0 : _x['title']) === null || _y === void 0 ? void 0 : _y.message) === null || _z === void 0 ? void 0 : _z.toString(),
6894
6963
  type: "text",
6895
6964
  className: "w-full p-2",
6896
6965
  placeholder: commonTranslations.titlePlaceholder
@@ -6929,7 +6998,7 @@ const ItemsAccordian = ({
6929
6998
  register: register,
6930
6999
  label: widgetTranslations.srcset,
6931
7000
  name: `${name}.${index}.srcset`,
6932
- errors: (_f = (_e = errors[name]) === null || _e === void 0 ? void 0 : _e[index]) === null || _f === void 0 ? void 0 : _f['srcset'],
7001
+ errors: (_1 = (_0 = errors[name]) === null || _0 === void 0 ? void 0 : _0[index]) === null || _1 === void 0 ? void 0 : _1['srcset'],
6933
7002
  screenSizeRequired: widgetTranslations.screenSizeRequired,
6934
7003
  heightRequired: widgetTranslations.heightRequired,
6935
7004
  minHeight: widgetTranslations.minHeight,
@@ -6964,7 +7033,7 @@ const ItemsAccordian = ({
6964
7033
  label: widgetTranslations.image,
6965
7034
  control: control,
6966
7035
  name: `${name}.${index}.img`,
6967
- error: (_k = (_j = (_h = (_g = errors[name]) === null || _g === void 0 ? void 0 : _g[index]) === null || _h === void 0 ? void 0 : _h['img']) === null || _j === void 0 ? void 0 : _j.message) === null || _k === void 0 ? void 0 : _k.toString(),
7036
+ error: (_5 = (_4 = (_3 = (_2 = errors[name]) === null || _2 === void 0 ? void 0 : _2[index]) === null || _3 === void 0 ? void 0 : _3['img']) === null || _4 === void 0 ? void 0 : _4.message) === null || _5 === void 0 ? void 0 : _5.toString(),
6968
7037
  baseUrl: imageBaseUrl ? imageBaseUrl : baseUrl,
6969
7038
  setError: setError,
6970
7039
  clearError: clearError,
@@ -6980,7 +7049,7 @@ const ItemsAccordian = ({
6980
7049
  }, widgetTranslations.dragDrop)), /*#__PURE__*/React.createElement("p", {
6981
7050
  className: "khb_img-text-2"
6982
7051
  }, widgetTranslations.allowedFormat))
6983
- }))));
7052
+ }))))));
6984
7053
  })));
6985
7054
  };
6986
7055
 
@@ -7167,6 +7236,7 @@ const constants = {
7167
7236
  textWidgetTypeValue: 'Text',
7168
7237
  htmlWidgetTypeValue: 'HTML',
7169
7238
  linksWidgetTypeValue: 'Links',
7239
+ testimonialWidgetTypeValue: 'Testimonial',
7170
7240
  pagesItemsTypeValue: 'pages',
7171
7241
  tabsAccessor: 'tabs',
7172
7242
  webItems: 'webItems',
@@ -7239,6 +7309,7 @@ const WidgetForm = ({
7239
7309
  const [blogCategoriesLoading, setBlogCategoriesLoading] = useState(false);
7240
7310
  const pagesLoadedRef = useRef(false);
7241
7311
  const blogCategoryInitialized = useRef(false);
7312
+ const selectedWidgetTypeValue = (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) || getValues(constants.widgetTypeAccessor);
7242
7313
  useEffect(() => {
7243
7314
  if (data && formState === 'UPDATE') {
7244
7315
  const widgetType = widgetTypes.find(type => type.value === (data === null || data === void 0 ? void 0 : data.widgetType));
@@ -7442,6 +7513,12 @@ const WidgetForm = ({
7442
7513
  setValue(constants.collectionNameAccessor, constants.pagesItemsTypeValue);
7443
7514
  const pagesOption = itemsTypes.find(item => item.value === constants.pagesItemsTypeValue);
7444
7515
  if (pagesOption) setSelectedCollectionType(pagesOption);
7516
+ } else if ((widgetType === null || widgetType === void 0 ? void 0 : widgetType.value) === constants.testimonialWidgetTypeValue) {
7517
+ setItemsEnabled(true);
7518
+ setSelectedCollectionType(undefined);
7519
+ setSelectedCollectionItems([]);
7520
+ setValue(constants.itemTypeAccessor, constants.imageItemsTypeValue);
7521
+ setValue(constants.collectionNameAccessor, constants.imageItemsTypeValue);
7445
7522
  } else {
7446
7523
  setItemsEnabled(true);
7447
7524
  }
@@ -7657,6 +7734,22 @@ const WidgetForm = ({
7657
7734
  },
7658
7735
  info: widgetTranslations.widgetTitleInfo,
7659
7736
  Input: customInputs && customInputs['widgetTitle'] ? customInputs['widgetTitle'] : undefined
7737
+ }, Array.isArray(languages) && languages.length > 0 ? {
7738
+ label: widgetTranslations.subtitle,
7739
+ accessor: 'widgetSubtitles',
7740
+ required: false,
7741
+ type: customInputs && customInputs['widgetSubtitles'] ? undefined : 'text',
7742
+ placeholder: widgetTranslations.subTitlePlaceholder,
7743
+ onInput: handleCapitalize,
7744
+ Input: customInputs && customInputs['widgetSubtitles'] ? customInputs['widgetSubtitles'] : undefined
7745
+ } : {
7746
+ label: widgetTranslations.subtitle,
7747
+ accessor: 'widgetSubtitle',
7748
+ required: false,
7749
+ type: customInputs && customInputs['widgetSubtitle'] ? undefined : 'text',
7750
+ onInput: handleCapitalize,
7751
+ placeholder: widgetTranslations.subTitlePlaceholder,
7752
+ Input: customInputs && customInputs['widgetSubtitle'] ? customInputs['widgetSubtitle'] : undefined
7660
7753
  }, {
7661
7754
  label: widgetTranslations.widgetType,
7662
7755
  required: true,
@@ -7701,7 +7794,7 @@ const WidgetForm = ({
7701
7794
  label: widgetTranslations.itemsType,
7702
7795
  required: true,
7703
7796
  editable: false,
7704
- show: (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) !== constants.textWidgetTypeValue && (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) !== constants.htmlWidgetTypeValue,
7797
+ show: selectedWidgetTypeValue !== constants.textWidgetTypeValue && selectedWidgetTypeValue !== constants.htmlWidgetTypeValue && selectedWidgetTypeValue !== constants.testimonialWidgetTypeValue,
7705
7798
  accessor: constants.itemTypeAccessor,
7706
7799
  type: 'select',
7707
7800
  validations: {
@@ -7913,7 +8006,8 @@ const WidgetForm = ({
7913
8006
  register: register,
7914
8007
  loading: loading,
7915
8008
  addText: commonTranslations.add,
7916
- deleteText: commonTranslations.delete
8009
+ deleteText: commonTranslations.delete,
8010
+ widgetType: selectedWidgetTypeValue
7917
8011
  }), /*#__PURE__*/React.createElement(ItemsAccordian, {
7918
8012
  languages: languages,
7919
8013
  clearError: clearErrors,
@@ -7930,7 +8024,8 @@ const WidgetForm = ({
7930
8024
  control: control,
7931
8025
  register: register,
7932
8026
  addText: commonTranslations.add,
7933
- deleteText: commonTranslations.delete
8027
+ deleteText: commonTranslations.delete,
8028
+ widgetType: selectedWidgetTypeValue
7934
8029
  }))));
7935
8030
  };
7936
8031
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knovator/pagecreator-admin",
3
- "version": "1.7.7",
3
+ "version": "1.7.9",
4
4
  "dependencies": {
5
5
  "classnames": "^2.3.1",
6
6
  "react-beautiful-dnd": "^13.1.0",
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { ItemsAccordianProps } from '../../../types';
3
- declare const ItemsAccordian: ({ show, title, id, collapseId, toggleShow, loading, name, errors, control, register, setError, itemType, languages, clearError, addText, deleteText, }: ItemsAccordianProps) => JSX.Element;
3
+ declare const ItemsAccordian: ({ show, title, id, collapseId, toggleShow, loading, name, errors, control, register, setError, itemType, languages, clearError, widgetType, addText, deleteText, }: ItemsAccordianProps) => JSX.Element;
4
4
  export default ItemsAccordian;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { FormProps } from '../../../types';
3
- declare const WidgetForm: ({ formRef, customInputs, onPrimaryButtonClick }: FormProps) => JSX.Element | null;
3
+ declare const WidgetForm: ({ formRef, customInputs, onPrimaryButtonClick, }: FormProps) => JSX.Element | null;
4
4
  export default WidgetForm;
@@ -3,7 +3,7 @@ import { WidgetProps } from '../../../types';
3
3
  declare const Widget: {
4
4
  ({ routes, loader, explicitForm, imageBaseUrl, permissions, preConfirmDelete, formatListItem, formatOptionLabel, imageMaxSize, translations, children, onPrimaryButtonClick, }: WidgetProps): JSX.Element;
5
5
  Table: ({ extraActions, extraColumns }: import("../../../types").DerivedTableProps) => JSX.Element;
6
- Form: ({ formRef, customInputs, onPrimaryButtonClick }: import("../../../types").FormProps) => JSX.Element | null;
6
+ Form: ({ formRef, customInputs, onPrimaryButtonClick, }: import("../../../types").FormProps) => JSX.Element | null;
7
7
  AddButton: () => JSX.Element;
8
8
  Search: () => JSX.Element;
9
9
  Pagination: () => JSX.Element;
@@ -86,6 +86,16 @@ declare const TRANSLATION_PAIRS_WIDGET: {
86
86
  tabNameRequired: string;
87
87
  subtitle: string;
88
88
  subTitlePlaceholder: string;
89
+ quote: string;
90
+ quotePlaceholder: string;
91
+ personName: string;
92
+ personNamePlaceholder: string;
93
+ personRole: string;
94
+ personRolePlaceholder: string;
95
+ personOrganization: string;
96
+ personOrganizationPlaceholder: string;
97
+ rating: string;
98
+ ratingPlaceholder: string;
89
99
  altText: string;
90
100
  altTextPlaceholder: string;
91
101
  link: string;
@@ -178,6 +178,16 @@ export interface WidgetTranslationPairs {
178
178
  tabNameRequired: string;
179
179
  subtitle: string;
180
180
  subTitlePlaceholder: string;
181
+ quote: string;
182
+ quotePlaceholder: string;
183
+ personName: string;
184
+ personNamePlaceholder: string;
185
+ personRole: string;
186
+ personRolePlaceholder: string;
187
+ personOrganization: string;
188
+ personOrganizationPlaceholder: string;
189
+ rating: string;
190
+ ratingPlaceholder: string;
181
191
  altText: string;
182
192
  altTextPlaceholder: string;
183
193
  link: string;
@@ -313,6 +323,7 @@ export interface ItemsAccordianProps {
313
323
  register: any;
314
324
  setError: any;
315
325
  clearError: (key: string) => void;
326
+ widgetType?: string;
316
327
  }
317
328
  export interface TabItemProps {
318
329
  showDelete?: boolean;