@plusscommunities/pluss-feature-builder-web-a 1.0.2-beta.1 → 1.0.2-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1380 -1337
- package/package.json +2 -2
- package/rollup.config.js +1 -0
- package/src/actions/featureDefinitionsIndex.js +15 -15
- package/src/actions/formActions.js +31 -30
- package/src/actions/listingActions.js +27 -25
- package/src/actions/wizardActions.js +23 -35
- package/src/components/BaseFieldConfig.jsx +234 -234
- package/src/components/IconLoader.jsx +138 -138
- package/src/components/IconSelector.jsx +0 -1
- package/src/components/ListingEditor.jsx +2 -3
- package/src/components/SidebarLayout.jsx +49 -89
- package/src/components/SidebarLayout.module.css +0 -74
- package/src/components/index.js +0 -2
- package/src/components/listing/GalleryDisplay.jsx +0 -1
- package/src/components/listing/ListingFileInput.jsx +98 -80
- package/src/components/listing/ListingFileInput.module.css +1 -4
- package/src/components/listing/ListingGalleryInput.jsx +4 -1
- package/src/components/listing/ListingGalleryInput.module.css +2 -1
- package/src/hooks/useFeatureDefinitionLoader.js +6 -2
- package/src/images/full.png +0 -0
- package/src/images/fullNoTitle.png +0 -0
- package/src/images/previewWidget.png +0 -0
- package/src/images/widget.png +0 -0
- package/src/index.js +6 -6
- package/src/reducers/featureBuilderReducer.js +18 -22
- package/src/screens/Form.module.css +11 -1
- package/src/screens/FormLayoutStep.jsx +422 -424
- package/src/screens/FormOverviewStep.jsx +3 -10
- package/src/screens/ListingScreen.jsx +0 -1
- package/src/selectors/featureBuilderSelectors.js +47 -43
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plusscommunities/pluss-feature-builder-web-a",
|
|
3
|
-
"version": "1.0.2-beta.
|
|
3
|
+
"version": "1.0.2-beta.10",
|
|
4
4
|
"description": "Contains the feature builder extension for the pluss communities ",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"scripts": {
|
|
@@ -51,4 +51,4 @@
|
|
|
51
51
|
"react-fontawesome": "^1.6.1"
|
|
52
52
|
},
|
|
53
53
|
"keywords": []
|
|
54
|
-
}
|
|
54
|
+
}
|
package/rollup.config.js
CHANGED
|
@@ -6,25 +6,25 @@ import {
|
|
|
6
6
|
updatePermissionNames,
|
|
7
7
|
} from "./featureBuilderStringsActions";
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
export const
|
|
11
|
-
export const
|
|
9
|
+
const REDUCER_PREFIX = values.reducerKey.toUpperCase();
|
|
10
|
+
export const FETCH_FEATURES_REQUEST = `${REDUCER_PREFIX}_FETCH_FEATURES_REQUEST`;
|
|
11
|
+
export const FETCH_FEATURES_SUCCESS = `${REDUCER_PREFIX}_FETCH_FEATURES_SUCCESS`;
|
|
12
|
+
export const FETCH_FEATURES_FAILURE = `${REDUCER_PREFIX}_FETCH_FEATURES_FAILURE`;
|
|
12
13
|
|
|
13
|
-
export const FEATURE_CREATE_REQUEST =
|
|
14
|
-
export const FEATURE_CREATE_SUCCESS =
|
|
15
|
-
export const FEATURE_CREATE_FAILURE =
|
|
14
|
+
export const FEATURE_CREATE_REQUEST = `${REDUCER_PREFIX}_FEATURE_CREATE_REQUEST`;
|
|
15
|
+
export const FEATURE_CREATE_SUCCESS = `${REDUCER_PREFIX}_FEATURE_CREATE_SUCCESS`;
|
|
16
|
+
export const FEATURE_CREATE_FAILURE = `${REDUCER_PREFIX}_FEATURE_CREATE_FAILURE`;
|
|
16
17
|
|
|
17
|
-
export const FEATURE_EDIT_REQUEST =
|
|
18
|
-
export const FEATURE_EDIT_SUCCESS =
|
|
19
|
-
export const FEATURE_EDIT_FAILURE =
|
|
18
|
+
export const FEATURE_EDIT_REQUEST = `${REDUCER_PREFIX}_FEATURE_EDIT_REQUEST`;
|
|
19
|
+
export const FEATURE_EDIT_SUCCESS = `${REDUCER_PREFIX}_FEATURE_EDIT_SUCCESS`;
|
|
20
|
+
export const FEATURE_EDIT_FAILURE = `${REDUCER_PREFIX}_FEATURE_EDIT_FAILURE`;
|
|
20
21
|
|
|
21
|
-
export const FEATURE_DELETE_REQUEST =
|
|
22
|
-
export const FEATURE_DELETE_FAILURE =
|
|
22
|
+
export const FEATURE_DELETE_REQUEST = `${REDUCER_PREFIX}_FEATURE_DELETE_REQUEST`;
|
|
23
|
+
export const FEATURE_DELETE_FAILURE = `${REDUCER_PREFIX}_FEATURE_DELETE_FAILURE`;
|
|
23
24
|
|
|
24
25
|
// Wizard synchronization action types
|
|
25
|
-
export const SYNC_WIZARD_MODE_FROM_DEFINITION =
|
|
26
|
-
|
|
27
|
-
export const SET_WIZARD_MODE = "SET_WIZARD_MODE";
|
|
26
|
+
export const SYNC_WIZARD_MODE_FROM_DEFINITION = `${REDUCER_PREFIX}_SYNC_WIZARD_MODE_FROM_DEFINITION`;
|
|
27
|
+
export const SET_WIZARD_MODE = `${REDUCER_PREFIX}_SET_WIZARD_MODE`;
|
|
28
28
|
|
|
29
29
|
function fetchFeaturesRequest() {
|
|
30
30
|
return { type: FETCH_FEATURES_REQUEST };
|
|
@@ -160,7 +160,7 @@ export function fetchFeatureDefinitions() {
|
|
|
160
160
|
}
|
|
161
161
|
} catch (err) {
|
|
162
162
|
// Check if it's a 404 (feature doesn't exist)
|
|
163
|
-
if (err.response
|
|
163
|
+
if (err.response?.status === 404) {
|
|
164
164
|
// 404: Feature doesn't exist → create mode
|
|
165
165
|
dispatch(fetchFeaturesSuccess(null, "create"));
|
|
166
166
|
|
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Form Actions for Feature Builder
|
|
3
|
-
* Manages form state including title, icon, fields, layout, and submission
|
|
4
|
-
* Handles CRUD operations for form fields and layout configuration
|
|
5
|
-
* Coordinates with external menu updates and feature definition actions
|
|
6
|
-
*
|
|
7
|
-
* @namespace formActions
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
1
|
import { featureDefinitionActions } from "../webapi/featuresActions";
|
|
11
2
|
import { values } from "../values.config";
|
|
12
3
|
import {
|
|
13
4
|
updateFeatureBuilderString,
|
|
14
5
|
updateFeatureBuilderIcon,
|
|
6
|
+
updatePermissionNames,
|
|
15
7
|
} from "./featureBuilderStringsActions";
|
|
16
|
-
import { toTitleCase } from "../utils/textUtils";
|
|
17
8
|
|
|
18
9
|
/**
|
|
19
10
|
* @typedef {Object} FieldValues
|
|
@@ -40,20 +31,20 @@ import { toTitleCase } from "../utils/textUtils";
|
|
|
40
31
|
*/
|
|
41
32
|
|
|
42
33
|
export const actionsTypes = {
|
|
43
|
-
SET_INITIAL_VALUES:
|
|
44
|
-
SET_TITLE:
|
|
45
|
-
SET_ICON:
|
|
46
|
-
SET_DISPLAY_NAME:
|
|
47
|
-
ADD_FIELD:
|
|
48
|
-
DELETE_FIELD:
|
|
49
|
-
UPDATE_FIELD:
|
|
50
|
-
SET_LAYOUT_GRID_ICON:
|
|
51
|
-
SET_LAYOUT_TYPE:
|
|
52
|
-
SUBMIT_FORM_REQUEST:
|
|
53
|
-
SUBMIT_FORM_SUCCESS:
|
|
54
|
-
SUBMIT_FORM_FAILURE:
|
|
55
|
-
CLEAR_FORM_SUBMISSION_STATE:
|
|
56
|
-
SET_SUMMARY_FIELD:
|
|
34
|
+
SET_INITIAL_VALUES: `${values.reducerKey.toUpperCase()}_SET_INITIAL_VALUES`,
|
|
35
|
+
SET_TITLE: `${values.reducerKey.toUpperCase()}_SET_TITLE`,
|
|
36
|
+
SET_ICON: `${values.reducerKey.toUpperCase()}_SET_ICON`,
|
|
37
|
+
SET_DISPLAY_NAME: `${values.reducerKey.toUpperCase()}_SET_DISPLAY_NAME`,
|
|
38
|
+
ADD_FIELD: `${values.reducerKey.toUpperCase()}_ADD_FIELD`,
|
|
39
|
+
DELETE_FIELD: `${values.reducerKey.toUpperCase()}_DELETE_FIELD`,
|
|
40
|
+
UPDATE_FIELD: `${values.reducerKey.toUpperCase()}_UPDATE_FIELD`,
|
|
41
|
+
SET_LAYOUT_GRID_ICON: `${values.reducerKey.toUpperCase()}_SET_LAYOUT_GRID_ICON`,
|
|
42
|
+
SET_LAYOUT_TYPE: `${values.reducerKey.toUpperCase()}_SET_LAYOUT_TYPE`,
|
|
43
|
+
SUBMIT_FORM_REQUEST: `${values.reducerKey.toUpperCase()}_SUBMIT_FORM_REQUEST`,
|
|
44
|
+
SUBMIT_FORM_SUCCESS: `${values.reducerKey.toUpperCase()}_SUBMIT_FORM_SUCCESS`,
|
|
45
|
+
SUBMIT_FORM_FAILURE: `${values.reducerKey.toUpperCase()}_SUBMIT_FORM_FAILURE`,
|
|
46
|
+
CLEAR_FORM_SUBMISSION_STATE: `${values.reducerKey.toUpperCase()}_CLEAR_FORM_SUBMISSION_STATE`,
|
|
47
|
+
SET_SUMMARY_FIELD: `${values.reducerKey.toUpperCase()}_SET_SUMMARY_FIELD`,
|
|
57
48
|
};
|
|
58
49
|
|
|
59
50
|
/**
|
|
@@ -207,7 +198,7 @@ export const clearFormSubmissionState = () => {
|
|
|
207
198
|
export function submitForm() {
|
|
208
199
|
return async (dispatch, getState) => {
|
|
209
200
|
const state = getState()[values.reducerKey];
|
|
210
|
-
const form = state
|
|
201
|
+
const form = state?.form;
|
|
211
202
|
if (!form) {
|
|
212
203
|
dispatch(
|
|
213
204
|
submitFormFailure(
|
|
@@ -230,9 +221,9 @@ export function submitForm() {
|
|
|
230
221
|
}
|
|
231
222
|
|
|
232
223
|
// Use mode from fetch instead of checking definition ID
|
|
233
|
-
const definitionState = state
|
|
234
|
-
const mode = definitionState
|
|
235
|
-
const definitionId = definitionState
|
|
224
|
+
const definitionState = state?.definition;
|
|
225
|
+
const mode = definitionState?.mode; // Use stored mode from fetch
|
|
226
|
+
const definitionId = definitionState?.id;
|
|
236
227
|
|
|
237
228
|
if (mode === "edit") {
|
|
238
229
|
// Always update when in edit mode
|
|
@@ -270,6 +261,16 @@ export function submitForm() {
|
|
|
270
261
|
}
|
|
271
262
|
|
|
272
263
|
dispatch(submitFormSuccess());
|
|
264
|
+
|
|
265
|
+
// After creating a feature, update menu strings
|
|
266
|
+
if (mode !== "edit") {
|
|
267
|
+
// Update menu string with title and icon
|
|
268
|
+
dispatch(updateFeatureBuilderString(form.title));
|
|
269
|
+
dispatch(updateFeatureBuilderIcon(form.icon));
|
|
270
|
+
|
|
271
|
+
// Update permission names based on feature title
|
|
272
|
+
dispatch(updatePermissionNames(form.title));
|
|
273
|
+
}
|
|
273
274
|
} catch (err) {
|
|
274
275
|
// Handle different types of errors
|
|
275
276
|
let errorToDisplay = err;
|
|
@@ -277,7 +278,7 @@ export function submitForm() {
|
|
|
277
278
|
if (err.response) {
|
|
278
279
|
// API error (400, 401, 404, 500, etc.)
|
|
279
280
|
const { status, data } = err.response;
|
|
280
|
-
if (status === 400 && data
|
|
281
|
+
if (status === 400 && data?.error) {
|
|
281
282
|
errorToDisplay = new Error(`Validation error: ${data.error}`);
|
|
282
283
|
} else if (status === 401) {
|
|
283
284
|
errorToDisplay = new Error(
|
|
@@ -289,7 +290,7 @@ export function submitForm() {
|
|
|
289
290
|
errorToDisplay = new Error("Server error. Please try again later.");
|
|
290
291
|
} else {
|
|
291
292
|
errorToDisplay = new Error(
|
|
292
|
-
|
|
293
|
+
data?.error || `Request failed with status ${status}`,
|
|
293
294
|
);
|
|
294
295
|
}
|
|
295
296
|
} else if (err.request) {
|
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
import { arrayMove } from "@dnd-kit/sortable";
|
|
2
2
|
import { listingActions as webApiActions } from "../webapi/listingActions";
|
|
3
|
+
import { values } from "../values.config";
|
|
3
4
|
|
|
4
5
|
// Action Types
|
|
5
|
-
|
|
6
|
-
export const
|
|
7
|
-
export const
|
|
8
|
-
export const
|
|
9
|
-
export const
|
|
6
|
+
const REDUCER_PREFIX = values.reducerKey.toUpperCase();
|
|
7
|
+
export const FETCH_LISTING_REQUEST = `${REDUCER_PREFIX}_FETCH_LISTING_REQUEST`;
|
|
8
|
+
export const FETCH_LISTING_SUCCESS = `${REDUCER_PREFIX}_FETCH_LISTING_SUCCESS`;
|
|
9
|
+
export const FETCH_LISTING_FAILURE = `${REDUCER_PREFIX}_FETCH_LISTING_FAILURE`;
|
|
10
|
+
export const FETCH_LISTING_SILENT_SUCCESS = `${REDUCER_PREFIX}_FETCH_LISTING_SILENT_SUCCESS`;
|
|
11
|
+
export const FETCH_LISTING_SILENT_FAILURE = `${REDUCER_PREFIX}_FETCH_LISTING_SILENT_FAILURE`;
|
|
10
12
|
|
|
11
|
-
export const REORDER_LISTING_SUCCESS =
|
|
12
|
-
export const REORDER_LISTING_FAILURE =
|
|
13
|
+
export const REORDER_LISTING_SUCCESS = `${REDUCER_PREFIX}_REORDER_LISTING_SUCCESS`;
|
|
14
|
+
export const REORDER_LISTING_FAILURE = `${REDUCER_PREFIX}_REORDER_LISTING_FAILURE`;
|
|
13
15
|
|
|
14
|
-
export const DELETE_LISTING_REQUEST =
|
|
15
|
-
export const DELETE_LISTING_SUCCESS =
|
|
16
|
-
export const DELETE_LISTING_FAILURE =
|
|
16
|
+
export const DELETE_LISTING_REQUEST = `${REDUCER_PREFIX}_DELETE_LISTING_REQUEST`;
|
|
17
|
+
export const DELETE_LISTING_SUCCESS = `${REDUCER_PREFIX}_DELETE_LISTING_SUCCESS`;
|
|
18
|
+
export const DELETE_LISTING_FAILURE = `${REDUCER_PREFIX}_DELETE_LISTING_FAILURE`;
|
|
17
19
|
|
|
18
|
-
export const UNDELETE_LISTING_REQUEST =
|
|
19
|
-
export const UNDELETE_LISTING_SUCCESS =
|
|
20
|
-
export const UNDELETE_LISTING_FAILURE =
|
|
20
|
+
export const UNDELETE_LISTING_REQUEST = `${REDUCER_PREFIX}_UNDELETE_LISTING_REQUEST`;
|
|
21
|
+
export const UNDELETE_LISTING_SUCCESS = `${REDUCER_PREFIX}_UNDELETE_LISTING_SUCCESS`;
|
|
22
|
+
export const UNDELETE_LISTING_FAILURE = `${REDUCER_PREFIX}_UNDELETE_LISTING_FAILURE`;
|
|
21
23
|
|
|
22
|
-
export const CREATE_LISTING_REQUEST =
|
|
23
|
-
export const CREATE_LISTING_SUCCESS =
|
|
24
|
-
export const CREATE_LISTING_FAILURE =
|
|
24
|
+
export const CREATE_LISTING_REQUEST = `${REDUCER_PREFIX}_CREATE_LISTING_REQUEST`;
|
|
25
|
+
export const CREATE_LISTING_SUCCESS = `${REDUCER_PREFIX}_CREATE_LISTING_SUCCESS`;
|
|
26
|
+
export const CREATE_LISTING_FAILURE = `${REDUCER_PREFIX}_CREATE_LISTING_FAILURE`;
|
|
25
27
|
|
|
26
|
-
export const EDIT_LISTING_REQUEST =
|
|
27
|
-
export const EDIT_LISTING_SUCCESS =
|
|
28
|
-
export const EDIT_LISTING_FAILURE =
|
|
28
|
+
export const EDIT_LISTING_REQUEST = `${REDUCER_PREFIX}_EDIT_LISTING_REQUEST`;
|
|
29
|
+
export const EDIT_LISTING_SUCCESS = `${REDUCER_PREFIX}_EDIT_LISTING_SUCCESS`;
|
|
30
|
+
export const EDIT_LISTING_FAILURE = `${REDUCER_PREFIX}_EDIT_LISTING_FAILURE`;
|
|
29
31
|
|
|
30
|
-
export const TOGGLE_LISTING_REQUEST =
|
|
31
|
-
export const TOGGLE_LISTING_SUCCESS =
|
|
32
|
-
export const TOGGLE_LISTING_FAILURE =
|
|
32
|
+
export const TOGGLE_LISTING_REQUEST = `${REDUCER_PREFIX}_TOGGLE_LISTING_REQUEST`;
|
|
33
|
+
export const TOGGLE_LISTING_SUCCESS = `${REDUCER_PREFIX}_TOGGLE_LISTING_SUCCESS`;
|
|
34
|
+
export const TOGGLE_LISTING_FAILURE = `${REDUCER_PREFIX}_TOGGLE_LISTING_FAILURE`;
|
|
33
35
|
|
|
34
|
-
export const SET_SORT_BY =
|
|
35
|
-
export const SET_SHOW_DELETED =
|
|
36
|
+
export const SET_SORT_BY = `${REDUCER_PREFIX}_SET_SORT_BY`;
|
|
37
|
+
export const SET_SHOW_DELETED = `${REDUCER_PREFIX}_SET_SHOW_DELETED`;
|
|
36
38
|
|
|
37
39
|
export const fetchListingRequest = () => ({ type: FETCH_LISTING_REQUEST });
|
|
38
40
|
export const fetchListingSuccess = (listings) => ({
|
|
@@ -210,7 +212,7 @@ export const undeleteListing = (id) => {
|
|
|
210
212
|
const response = await webApiActions.undelete(id, site);
|
|
211
213
|
// If API returns the restored listing, use it; otherwise we'll need to refetch
|
|
212
214
|
const restoredListing = response.data;
|
|
213
|
-
if (restoredListing
|
|
215
|
+
if (restoredListing?.id) {
|
|
214
216
|
dispatch(undeleteListingSuccess(restoredListing));
|
|
215
217
|
} else {
|
|
216
218
|
// Trigger a refetch by dispatching the success with just ID, then fetch updated listings
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wizard Actions for Feature Builder
|
|
3
|
-
* Manages wizard state including navigation, step validation, and mode switching
|
|
4
|
-
* Provides validation logic for overview, fields, and layout steps
|
|
5
|
-
* Coordinates with form state and step progression
|
|
6
|
-
*
|
|
7
|
-
* @namespace wizardActions
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
// Import selectors for form state access
|
|
11
1
|
import {
|
|
12
2
|
selectFormTitle,
|
|
13
3
|
selectFormIcon,
|
|
@@ -16,13 +6,18 @@ import {
|
|
|
16
6
|
selectFormFields,
|
|
17
7
|
} from "../selectors/featureBuilderSelectors";
|
|
18
8
|
|
|
9
|
+
import { clearFormSubmissionState } from "./formActions";
|
|
10
|
+
|
|
11
|
+
import { values } from "../values.config";
|
|
12
|
+
|
|
19
13
|
// Wizard action types
|
|
20
|
-
|
|
21
|
-
export const
|
|
22
|
-
export const
|
|
23
|
-
export const
|
|
24
|
-
export const
|
|
25
|
-
export const
|
|
14
|
+
const REDUCER_PREFIX = values.reducerKey.toUpperCase();
|
|
15
|
+
export const SET_WIZARD_MODE = `${REDUCER_PREFIX}_SET_WIZARD_MODE`;
|
|
16
|
+
export const SET_NAVIGATION_STATE = `${REDUCER_PREFIX}_SET_NAVIGATION_STATE`;
|
|
17
|
+
export const UPDATE_STEP_VALIDATION = `${REDUCER_PREFIX}_UPDATE_STEP_VALIDATION`;
|
|
18
|
+
export const MARK_STEP_COMPLETE = `${REDUCER_PREFIX}_MARK_STEP_COMPLETE`;
|
|
19
|
+
export const RESET_WIZARD_STATE = `${REDUCER_PREFIX}_RESET_WIZARD_STATE`;
|
|
20
|
+
export const VALIDATE_AND_UPDATE_STEP = `${REDUCER_PREFIX}_VALIDATE_AND_UPDATE_STEP`;
|
|
26
21
|
|
|
27
22
|
// Mode setters
|
|
28
23
|
export const setWizardMode = (mode) => ({
|
|
@@ -47,15 +42,10 @@ export const setCurrentStep = (step, previousStep = null) => ({
|
|
|
47
42
|
});
|
|
48
43
|
|
|
49
44
|
export const goToStep = (step) => (dispatch, getState) => {
|
|
50
|
-
const state = getState()[
|
|
51
|
-
const currentStep =
|
|
52
|
-
state &&
|
|
53
|
-
state.wizard &&
|
|
54
|
-
state.wizard.navigation &&
|
|
55
|
-
state.wizard.navigation.currentStep;
|
|
45
|
+
const state = getState()[values.reducerKey];
|
|
46
|
+
const currentStep = state?.wizard?.navigation?.currentStep;
|
|
56
47
|
|
|
57
48
|
// Clear form submission state when changing steps
|
|
58
|
-
const { clearFormSubmissionState } = require("./formActions");
|
|
59
49
|
dispatch(clearFormSubmissionState());
|
|
60
50
|
|
|
61
51
|
dispatch(setCurrentStep(step, currentStep));
|
|
@@ -143,10 +133,9 @@ const getFormValidation = (form, step) => {
|
|
|
143
133
|
|
|
144
134
|
switch (step) {
|
|
145
135
|
case "overview": {
|
|
146
|
-
const hasTitle = form.title
|
|
147
|
-
const hasDisplayName =
|
|
148
|
-
|
|
149
|
-
const hasIcon = form.icon && form.icon.length > 0;
|
|
136
|
+
const hasTitle = form.title?.trim().length > 0;
|
|
137
|
+
const hasDisplayName = form.displayName?.trim().length > 0;
|
|
138
|
+
const hasIcon = form.icon?.length > 0;
|
|
150
139
|
|
|
151
140
|
return {
|
|
152
141
|
isValid: hasTitle && hasDisplayName && hasIcon,
|
|
@@ -158,12 +147,12 @@ const getFormValidation = (form, step) => {
|
|
|
158
147
|
};
|
|
159
148
|
}
|
|
160
149
|
case "fields": {
|
|
161
|
-
const hasTitleField =
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const hasImageField =
|
|
165
|
-
|
|
166
|
-
|
|
150
|
+
const hasTitleField = form.fields?.some(
|
|
151
|
+
(field) => field.id === "mandatory-title",
|
|
152
|
+
);
|
|
153
|
+
const hasImageField = form.fields?.some(
|
|
154
|
+
(field) => field.id === "mandatory-feature-image",
|
|
155
|
+
);
|
|
167
156
|
|
|
168
157
|
// Check each field for missing labels and create field-specific errors
|
|
169
158
|
const fieldErrors = {};
|
|
@@ -202,8 +191,7 @@ const getFormValidation = (form, step) => {
|
|
|
202
191
|
};
|
|
203
192
|
}
|
|
204
193
|
case "layout": {
|
|
205
|
-
const hasLayoutType =
|
|
206
|
-
form.layout && form.layout.type && form.layout.type.length > 0;
|
|
194
|
+
const hasLayoutType = form.layout?.type?.length > 0;
|
|
207
195
|
return {
|
|
208
196
|
isValid: hasLayoutType,
|
|
209
197
|
errors: {
|