@knovator/pagecreator-admin 1.6.2 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +8 -8
- package/index.js +8 -8
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -7228,7 +7228,7 @@ const WidgetForm = ({
|
|
|
7228
7228
|
const currentItemsType = watch(constants.itemTypeAccessor);
|
|
7229
7229
|
// Fetch blog categories when itemsType is 'blogs'
|
|
7230
7230
|
React.useEffect(() => {
|
|
7231
|
-
if (currentItemsType === '
|
|
7231
|
+
if (currentItemsType === 'blog' && blogCategories.length === 0) {
|
|
7232
7232
|
const fetchBlogCategories = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
7233
7233
|
var _a;
|
|
7234
7234
|
try {
|
|
@@ -7244,8 +7244,8 @@ const WidgetForm = ({
|
|
|
7244
7244
|
if ((response === null || response === void 0 ? void 0 : response.code) === 'SUCCESS' && Array.isArray((_a = response.data) === null || _a === void 0 ? void 0 : _a.docs)) {
|
|
7245
7245
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7246
7246
|
const categories = response.data.docs.map(cat => ({
|
|
7247
|
-
value: cat._id,
|
|
7248
|
-
label: cat.name,
|
|
7247
|
+
value: cat._id || cat.id,
|
|
7248
|
+
label: cat.name || cat.nm || cat.label,
|
|
7249
7249
|
slug: cat.slug
|
|
7250
7250
|
}));
|
|
7251
7251
|
setBlogCategories(categories);
|
|
@@ -7261,7 +7261,7 @@ const WidgetForm = ({
|
|
|
7261
7261
|
}, [currentItemsType, baseUrl, token, widgetRoutesPrefix, blogCategories.length]);
|
|
7262
7262
|
// Auto-fetch blogs when category or limit changes
|
|
7263
7263
|
React.useEffect(() => {
|
|
7264
|
-
if (currentItemsType === '
|
|
7264
|
+
if (currentItemsType === 'blog' && blogCategory && blogLimit > 0) {
|
|
7265
7265
|
const fetchBlogsByCategory = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
7266
7266
|
var _a;
|
|
7267
7267
|
try {
|
|
@@ -7273,7 +7273,7 @@ const WidgetForm = ({
|
|
|
7273
7273
|
url: `${widgetRoutesPrefix}/collection-data`,
|
|
7274
7274
|
data: {
|
|
7275
7275
|
search: '',
|
|
7276
|
-
collectionName: '
|
|
7276
|
+
collectionName: 'blog',
|
|
7277
7277
|
collectionItems: []
|
|
7278
7278
|
},
|
|
7279
7279
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -7304,7 +7304,7 @@ const WidgetForm = ({
|
|
|
7304
7304
|
}, [blogCategory, blogLimit, currentItemsType, baseUrl, token, widgetRoutesPrefix]);
|
|
7305
7305
|
// Reset blog category and limit when itemsType changes away from 'blogs'
|
|
7306
7306
|
React.useEffect(() => {
|
|
7307
|
-
if (currentItemsType !== '
|
|
7307
|
+
if (currentItemsType !== 'blog') {
|
|
7308
7308
|
setBlogCategory(null);
|
|
7309
7309
|
setBlogLimit(10);
|
|
7310
7310
|
setBlogCategories([]);
|
|
@@ -7649,7 +7649,7 @@ const WidgetForm = ({
|
|
|
7649
7649
|
callback(filtered);
|
|
7650
7650
|
},
|
|
7651
7651
|
isLoading: blogCategoriesLoading,
|
|
7652
|
-
show: currentItemsType === '
|
|
7652
|
+
show: currentItemsType === 'blog' && !itemsEnabled && ((selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.carouselWidgetTypeValue || (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.fixedCardWidgetTypeValue || !selectedWidgetType) && !!(selectedCollectionType === null || selectedCollectionType === void 0 ? void 0 : selectedCollectionType.value),
|
|
7653
7653
|
placeholder: 'Select blog category...',
|
|
7654
7654
|
wrapperClassName: 'khb_grid-item-1of2 khb_padding-right-1',
|
|
7655
7655
|
customStyles: reactSelectStyles || {},
|
|
@@ -7663,7 +7663,7 @@ const WidgetForm = ({
|
|
|
7663
7663
|
setBlogLimit(value > 0 ? value : 1);
|
|
7664
7664
|
return e;
|
|
7665
7665
|
},
|
|
7666
|
-
show: currentItemsType === '
|
|
7666
|
+
show: currentItemsType === 'blog' && !itemsEnabled && ((selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.carouselWidgetTypeValue || (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.fixedCardWidgetTypeValue || !selectedWidgetType) && !!(selectedCollectionType === null || selectedCollectionType === void 0 ? void 0 : selectedCollectionType.value),
|
|
7667
7667
|
placeholder: 'Enter maximum number of blogs',
|
|
7668
7668
|
wrapperClassName: 'khb_grid-item-1of2 khb_padding-left-1',
|
|
7669
7669
|
validations: {
|
package/index.js
CHANGED
|
@@ -7216,7 +7216,7 @@ const WidgetForm = ({
|
|
|
7216
7216
|
const currentItemsType = watch(constants.itemTypeAccessor);
|
|
7217
7217
|
// Fetch blog categories when itemsType is 'blogs'
|
|
7218
7218
|
useEffect(() => {
|
|
7219
|
-
if (currentItemsType === '
|
|
7219
|
+
if (currentItemsType === 'blog' && blogCategories.length === 0) {
|
|
7220
7220
|
const fetchBlogCategories = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
7221
7221
|
var _a;
|
|
7222
7222
|
try {
|
|
@@ -7232,8 +7232,8 @@ const WidgetForm = ({
|
|
|
7232
7232
|
if ((response === null || response === void 0 ? void 0 : response.code) === 'SUCCESS' && Array.isArray((_a = response.data) === null || _a === void 0 ? void 0 : _a.docs)) {
|
|
7233
7233
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7234
7234
|
const categories = response.data.docs.map(cat => ({
|
|
7235
|
-
value: cat._id,
|
|
7236
|
-
label: cat.name,
|
|
7235
|
+
value: cat._id || cat.id,
|
|
7236
|
+
label: cat.name || cat.nm || cat.label,
|
|
7237
7237
|
slug: cat.slug
|
|
7238
7238
|
}));
|
|
7239
7239
|
setBlogCategories(categories);
|
|
@@ -7249,7 +7249,7 @@ const WidgetForm = ({
|
|
|
7249
7249
|
}, [currentItemsType, baseUrl, token, widgetRoutesPrefix, blogCategories.length]);
|
|
7250
7250
|
// Auto-fetch blogs when category or limit changes
|
|
7251
7251
|
useEffect(() => {
|
|
7252
|
-
if (currentItemsType === '
|
|
7252
|
+
if (currentItemsType === 'blog' && blogCategory && blogLimit > 0) {
|
|
7253
7253
|
const fetchBlogsByCategory = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
7254
7254
|
var _a;
|
|
7255
7255
|
try {
|
|
@@ -7261,7 +7261,7 @@ const WidgetForm = ({
|
|
|
7261
7261
|
url: `${widgetRoutesPrefix}/collection-data`,
|
|
7262
7262
|
data: {
|
|
7263
7263
|
search: '',
|
|
7264
|
-
collectionName: '
|
|
7264
|
+
collectionName: 'blog',
|
|
7265
7265
|
collectionItems: []
|
|
7266
7266
|
},
|
|
7267
7267
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -7292,7 +7292,7 @@ const WidgetForm = ({
|
|
|
7292
7292
|
}, [blogCategory, blogLimit, currentItemsType, baseUrl, token, widgetRoutesPrefix]);
|
|
7293
7293
|
// Reset blog category and limit when itemsType changes away from 'blogs'
|
|
7294
7294
|
useEffect(() => {
|
|
7295
|
-
if (currentItemsType !== '
|
|
7295
|
+
if (currentItemsType !== 'blog') {
|
|
7296
7296
|
setBlogCategory(null);
|
|
7297
7297
|
setBlogLimit(10);
|
|
7298
7298
|
setBlogCategories([]);
|
|
@@ -7637,7 +7637,7 @@ const WidgetForm = ({
|
|
|
7637
7637
|
callback(filtered);
|
|
7638
7638
|
},
|
|
7639
7639
|
isLoading: blogCategoriesLoading,
|
|
7640
|
-
show: currentItemsType === '
|
|
7640
|
+
show: currentItemsType === 'blog' && !itemsEnabled && ((selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.carouselWidgetTypeValue || (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.fixedCardWidgetTypeValue || !selectedWidgetType) && !!(selectedCollectionType === null || selectedCollectionType === void 0 ? void 0 : selectedCollectionType.value),
|
|
7641
7641
|
placeholder: 'Select blog category...',
|
|
7642
7642
|
wrapperClassName: 'khb_grid-item-1of2 khb_padding-right-1',
|
|
7643
7643
|
customStyles: reactSelectStyles || {},
|
|
@@ -7651,7 +7651,7 @@ const WidgetForm = ({
|
|
|
7651
7651
|
setBlogLimit(value > 0 ? value : 1);
|
|
7652
7652
|
return e;
|
|
7653
7653
|
},
|
|
7654
|
-
show: currentItemsType === '
|
|
7654
|
+
show: currentItemsType === 'blog' && !itemsEnabled && ((selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.carouselWidgetTypeValue || (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.fixedCardWidgetTypeValue || !selectedWidgetType) && !!(selectedCollectionType === null || selectedCollectionType === void 0 ? void 0 : selectedCollectionType.value),
|
|
7655
7655
|
placeholder: 'Enter maximum number of blogs',
|
|
7656
7656
|
wrapperClassName: 'khb_grid-item-1of2 khb_padding-left-1',
|
|
7657
7657
|
validations: {
|