@plusscommunities/pluss-feature-builder-web 1.0.2-beta.3 → 1.0.3-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/package.json +14 -32
  2. package/rollup.config.js +3 -66
  3. package/src/actions/featureDefinitionsIndex.js +15 -15
  4. package/src/actions/formActions.js +20 -30
  5. package/src/actions/listingActions.js +27 -25
  6. package/src/actions/wizardActions.js +20 -35
  7. package/src/components/BaseFieldConfig.jsx +234 -234
  8. package/src/components/FeatureBuilderSuccessPopup.jsx +9 -15
  9. package/src/components/FeatureBuilderSuccessPopup.module.css +1 -3
  10. package/src/components/Fields.jsx +31 -68
  11. package/src/components/IconLoader.jsx +138 -138
  12. package/src/components/IconSelector.jsx +0 -1
  13. package/src/components/ListingEditor.jsx +2 -3
  14. package/src/components/SidebarLayout.jsx +49 -89
  15. package/src/components/SidebarLayout.module.css +0 -74
  16. package/src/components/index.js +0 -2
  17. package/src/components/listing/GalleryDisplay.jsx +0 -1
  18. package/src/components/listing/ListingFileInput.jsx +98 -80
  19. package/src/components/listing/ListingFileInput.module.css +1 -4
  20. package/src/components/listing/ListingGalleryInput.jsx +4 -1
  21. package/src/components/listing/ListingGalleryInput.module.css +2 -1
  22. package/src/hooks/useFeatureDefinitionLoader.js +6 -2
  23. package/src/images/full.png +0 -0
  24. package/src/images/fullNoTitle.png +0 -0
  25. package/src/images/previewWidget.png +0 -0
  26. package/src/images/widget.png +0 -0
  27. package/src/reducers/featureBuilderReducer.js +17 -22
  28. package/src/screens/Form.module.css +11 -1
  29. package/src/screens/FormFieldsStep.jsx +4 -67
  30. package/src/screens/FormLayoutStep.jsx +384 -424
  31. package/src/screens/FormOverviewStep.jsx +3 -9
  32. package/src/screens/ListingScreen.jsx +0 -1
  33. package/src/selectors/featureBuilderSelectors.js +47 -43
  34. package/src/values.config.default.js +49 -0
  35. package/src/values.config.js +24 -24
  36. package/.babelrc +0 -4
  37. package/dist/index.cjs.js +0 -7786
package/package.json CHANGED
@@ -1,15 +1,18 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-feature-builder-web",
3
- "version": "1.0.2-beta.3",
3
+ "version": "1.0.3-beta.0",
4
4
  "description": "Contains the feature builder extension for the pluss communities ",
5
- "main": "dist/index.cjs.js",
5
+ "exports": {
6
+ ".": "./dist/index.js"
7
+ },
6
8
  "scripts": {
7
- "build": "npm i && rollup -c",
9
+ "build": "rollup -c",
10
+ "prepublishOnly": "(cd .. && npm install) && npm run build",
8
11
  "betapatch": "npm version prepatch --preid=beta",
9
12
  "patch": "npm version patch",
10
- "betaupload": "npm run build && npm publish --access public --tag beta && rm -rf node_modules",
13
+ "betaupload": "npm publish --access public --tag beta",
11
14
  "betaupload:p": "npm run betapatch && npm run betaupload",
12
- "upload": "npm run build && npm publish --access public && rm -rf node_modules",
15
+ "upload": "npm publish --access public",
13
16
  "upload:p": "npm run patch && npm run upload",
14
17
  "copy:add": "run(){ ext=${1:-default}; test -f src/values.config.$ext.js || cp src/values.config.default.js src/values.config.$ext.js; }; run",
15
18
  "copy:get": "echo $npm_package_name",
@@ -18,37 +21,16 @@
18
21
  "copy:upload": "npm run patch; for file in `ls ./src/values.config.*.js`; do dup=`echo $file | sed 's/.*values\\.config\\.\\(.*\\)\\.js/\\1/'`; npm run copy:set $dup; npm run upload; done; npm run copy:set;"
19
22
  },
20
23
  "author": "Phillip Suh",
21
- "devDependencies": {
22
- "@babel/cli": "^7.14.3",
23
- "@babel/core": "^7.14.3",
24
- "@babel/plugin-transform-class-properties": "^7.27.1",
25
- "@babel/plugin-transform-optional-chaining": "^7.14.5",
26
- "@babel/plugin-transform-react-jsx": "^7.14.3",
27
- "@babel/plugin-transform-runtime": "^7.14.3",
28
- "@babel/preset-env": "^7.14.2",
29
- "@babel/preset-react": "^7.13.13",
30
- "@rollup/plugin-babel": "^5.3.0",
31
- "@rollup/plugin-image": "^2.0.6",
32
- "@rollup/plugin-json": "^4.1.0",
33
- "autoprefixer": "^10.2.6",
34
- "rollup": "^2.50.1",
35
- "rollup-plugin-local-resolve": "^1.0.7",
36
- "rollup-plugin-styles": "^3.14.1"
37
- },
38
24
  "dependencies": {
39
25
  "@babel/runtime": "^7.14.0"
40
26
  },
41
27
  "peerDependencies": {
42
- "@fortawesome/fontawesome-svg-core": "^6.4.0",
43
- "@fortawesome/free-solid-svg-icons": "^6.4.0",
44
- "@fortawesome/react-fontawesome": "^0.2.0",
45
- "@plusscommunities/pluss-core-web": "^1.6.15-beta.1",
46
- "lodash": "^4.17.4",
47
- "moment": "^2.30.1",
48
- "react": "^16.14.0",
49
- "react-bootstrap": "^0.31.2",
50
- "react-dom": "^16.14.0",
51
- "react-fontawesome": "^1.6.1"
28
+ "@plusscommunities/pluss-core-web": "*",
29
+ "lodash": "*",
30
+ "moment": "*",
31
+ "react": "*",
32
+ "react-bootstrap": "*",
33
+ "react-dom": "*"
52
34
  },
53
35
  "keywords": []
54
36
  }
package/rollup.config.js CHANGED
@@ -1,68 +1,5 @@
1
- import styles from "rollup-plugin-styles";
2
- const autoprefixer = require("autoprefixer");
3
- import babel from "@rollup/plugin-babel";
4
- import json from "@rollup/plugin-json";
5
- import image from "@rollup/plugin-image";
6
- import localResolve from "rollup-plugin-local-resolve";
1
+ import { defineConfig } from "../common/rollup.common";
7
2
 
8
- // the entry point for the library
9
- const input = "src/index.js";
3
+ const inputs = [{ path: "src/index.js", output: "index" }];
10
4
 
11
- var MODE = [
12
- {
13
- format: "cjs",
14
- },
15
- ];
16
-
17
- var config = [];
18
-
19
- MODE.map((m) => {
20
- var conf = {
21
- input: input,
22
- output: {
23
- // then name of your package
24
- name: "@plusscommunities/pluss-feature-builder-web",
25
- file: `dist/index.${m.format}.js`,
26
- format: m.format,
27
- exports: "auto",
28
- },
29
- // this externelizes react to prevent rollup from compiling it
30
- external: [
31
- "react",
32
- "react-dom",
33
- "react-redux",
34
- "react-router-dom",
35
- "@fortawesome/react-fontawesome",
36
- "@fortawesome/fontawesome-svg-core",
37
- "@fortawesome/free-solid-svg-icons",
38
- "@plusscommunities/pluss-core-web",
39
- /@babel\/runtime/,
40
- ],
41
- plugins: [
42
- // these are babel comfigurations
43
- babel({
44
- exclude: "node_modules/**",
45
- presets: ["@babel/preset-react", "@babel/preset-env"],
46
- plugins: [
47
- "@babel/transform-runtime",
48
- "@babel/plugin-transform-react-jsx",
49
- "@babel/plugin-transform-optional-chaining",
50
- ["@babel/plugin-transform-class-properties", { loose: true }],
51
- ],
52
- babelHelpers: "runtime",
53
- }),
54
- // this adds support for styles
55
- styles({
56
- postcss: {
57
- plugins: [autoprefixer()],
58
- },
59
- }),
60
- json(),
61
- image(),
62
- localResolve(),
63
- ],
64
- };
65
- config.push(conf);
66
- });
67
-
68
- export default [...config];
5
+ export default defineConfig(inputs);
@@ -6,25 +6,25 @@ import {
6
6
  updatePermissionNames,
7
7
  } from "./featureBuilderStringsActions";
8
8
 
9
- export const FETCH_FEATURES_REQUEST = "FETCH_FEATURES_REQUEST";
10
- export const FETCH_FEATURES_SUCCESS = "FETCH_FEATURES_SUCCESS";
11
- export const FETCH_FEATURES_FAILURE = "FETCH_FEATURES_FAILURE";
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 = "FEATURE_CREATE_REQUEST";
14
- export const FEATURE_CREATE_SUCCESS = "FEATURE_CREATE_SUCCESS";
15
- export const FEATURE_CREATE_FAILURE = "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 = "FEATURE_EDIT_REQUEST";
18
- export const FEATURE_EDIT_SUCCESS = "FEATURE_EDIT_SUCCESS";
19
- export const FEATURE_EDIT_FAILURE = "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 = "FEATURE_DELETE_REQUEST";
22
- export const FEATURE_DELETE_FAILURE = "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
- "SYNC_WIZARD_MODE_FROM_DEFINITION";
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 && err.response.status === 404) {
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,9 @@
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,
15
6
  } from "./featureBuilderStringsActions";
16
- import { toTitleCase } from "../utils/textUtils";
17
7
 
18
8
  /**
19
9
  * @typedef {Object} FieldValues
@@ -40,20 +30,20 @@ import { toTitleCase } from "../utils/textUtils";
40
30
  */
41
31
 
42
32
  export const actionsTypes = {
43
- SET_INITIAL_VALUES: "SET_INITIAL_VALUES",
44
- SET_TITLE: "SET_TITLE",
45
- SET_ICON: "SET_ICON",
46
- SET_DISPLAY_NAME: "SET_DISPLAY_NAME",
47
- ADD_FIELD: "ADD_FIELD",
48
- DELETE_FIELD: "DELETE_FIELD",
49
- UPDATE_FIELD: "UPDATE_FIELD",
50
- SET_LAYOUT_GRID_ICON: "SET_LAYOUT_GRID_ICON",
51
- SET_LAYOUT_TYPE: "SET_LAYOUT_TYPE",
52
- SUBMIT_FORM_REQUEST: "SUBMIT_FORM_REQUEST",
53
- SUBMIT_FORM_SUCCESS: "SUBMIT_FORM_SUCCESS",
54
- SUBMIT_FORM_FAILURE: "SUBMIT_FORM_FAILURE",
55
- CLEAR_FORM_SUBMISSION_STATE: "CLEAR_FORM_SUBMISSION_STATE",
56
- SET_SUMMARY_FIELD: "SET_SUMMARY_FIELD",
33
+ SET_INITIAL_VALUES: `${values.reducerKey.toUpperCase()}_SET_INITIAL_VALUES`,
34
+ SET_TITLE: `${values.reducerKey.toUpperCase()}_SET_TITLE`,
35
+ SET_ICON: `${values.reducerKey.toUpperCase()}_SET_ICON`,
36
+ SET_DISPLAY_NAME: `${values.reducerKey.toUpperCase()}_SET_DISPLAY_NAME`,
37
+ ADD_FIELD: `${values.reducerKey.toUpperCase()}_ADD_FIELD`,
38
+ DELETE_FIELD: `${values.reducerKey.toUpperCase()}_DELETE_FIELD`,
39
+ UPDATE_FIELD: `${values.reducerKey.toUpperCase()}_UPDATE_FIELD`,
40
+ SET_LAYOUT_GRID_ICON: `${values.reducerKey.toUpperCase()}_SET_LAYOUT_GRID_ICON`,
41
+ SET_LAYOUT_TYPE: `${values.reducerKey.toUpperCase()}_SET_LAYOUT_TYPE`,
42
+ SUBMIT_FORM_REQUEST: `${values.reducerKey.toUpperCase()}_SUBMIT_FORM_REQUEST`,
43
+ SUBMIT_FORM_SUCCESS: `${values.reducerKey.toUpperCase()}_SUBMIT_FORM_SUCCESS`,
44
+ SUBMIT_FORM_FAILURE: `${values.reducerKey.toUpperCase()}_SUBMIT_FORM_FAILURE`,
45
+ CLEAR_FORM_SUBMISSION_STATE: `${values.reducerKey.toUpperCase()}_CLEAR_FORM_SUBMISSION_STATE`,
46
+ SET_SUMMARY_FIELD: `${values.reducerKey.toUpperCase()}_SET_SUMMARY_FIELD`,
57
47
  };
58
48
 
59
49
  /**
@@ -207,7 +197,7 @@ export const clearFormSubmissionState = () => {
207
197
  export function submitForm() {
208
198
  return async (dispatch, getState) => {
209
199
  const state = getState()[values.reducerKey];
210
- const form = state && state.form;
200
+ const form = state?.form;
211
201
  if (!form) {
212
202
  dispatch(
213
203
  submitFormFailure(
@@ -230,9 +220,9 @@ export function submitForm() {
230
220
  }
231
221
 
232
222
  // Use mode from fetch instead of checking definition ID
233
- const definitionState = state && state.definition;
234
- const mode = definitionState && definitionState.mode; // Use stored mode from fetch
235
- const definitionId = definitionState && definitionState.id;
223
+ const definitionState = state?.definition;
224
+ const mode = definitionState?.mode; // Use stored mode from fetch
225
+ const definitionId = definitionState?.id;
236
226
 
237
227
  if (mode === "edit") {
238
228
  // Always update when in edit mode
@@ -277,7 +267,7 @@ export function submitForm() {
277
267
  if (err.response) {
278
268
  // API error (400, 401, 404, 500, etc.)
279
269
  const { status, data } = err.response;
280
- if (status === 400 && data && data.error) {
270
+ if (status === 400 && data?.error) {
281
271
  errorToDisplay = new Error(`Validation error: ${data.error}`);
282
272
  } else if (status === 401) {
283
273
  errorToDisplay = new Error(
@@ -289,7 +279,7 @@ export function submitForm() {
289
279
  errorToDisplay = new Error("Server error. Please try again later.");
290
280
  } else {
291
281
  errorToDisplay = new Error(
292
- (data && data.error) || `Request failed with status ${status}`,
282
+ data?.error || `Request failed with status ${status}`,
293
283
  );
294
284
  }
295
285
  } 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
- export const FETCH_LISTING_REQUEST = "FETCH_LISTING_REQUEST";
6
- export const FETCH_LISTING_SUCCESS = "FETCH_LISTING_SUCCESS";
7
- export const FETCH_LISTING_FAILURE = "FETCH_LISTING_FAILURE";
8
- export const FETCH_LISTING_SILENT_SUCCESS = "FETCH_LISTING_SILENT_SUCCESS";
9
- export const FETCH_LISTING_SILENT_FAILURE = "FETCH_LISTING_SILENT_FAILURE";
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 = "REORDER_LISTING_SUCCESS";
12
- export const REORDER_LISTING_FAILURE = "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 = "DELETE_LISTING_REQUEST";
15
- export const DELETE_LISTING_SUCCESS = "DELETE_LISTING_SUCCESS";
16
- export const DELETE_LISTING_FAILURE = "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 = "UNDELETE_LISTING_REQUEST";
19
- export const UNDELETE_LISTING_SUCCESS = "UNDELETE_LISTING_SUCCESS";
20
- export const UNDELETE_LISTING_FAILURE = "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 = "CREATE_LISTING_REQUEST";
23
- export const CREATE_LISTING_SUCCESS = "CREATE_LISTING_SUCCESS";
24
- export const CREATE_LISTING_FAILURE = "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 = "EDIT_LISTING_REQUEST";
27
- export const EDIT_LISTING_SUCCESS = "EDIT_LISTING_SUCCESS";
28
- export const EDIT_LISTING_FAILURE = "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 = "TOGGLE_LISTING_REQUEST";
31
- export const TOGGLE_LISTING_SUCCESS = "TOGGLE_LISTING_SUCCESS";
32
- export const TOGGLE_LISTING_FAILURE = "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 = "SET_SORT_BY";
35
- export const SET_SHOW_DELETED = "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 && restoredListing.id) {
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,17 +6,18 @@ import {
16
6
  selectFormFields,
17
7
  } from "../selectors/featureBuilderSelectors";
18
8
 
19
- // Import values config and form actions
20
- import { values } from "../values.config";
21
9
  import { clearFormSubmissionState } from "./formActions";
22
10
 
11
+ import { values } from "../values.config";
12
+
23
13
  // Wizard action types
24
- export const SET_WIZARD_MODE = "SET_WIZARD_MODE";
25
- export const SET_NAVIGATION_STATE = "SET_NAVIGATION_STATE";
26
- export const UPDATE_STEP_VALIDATION = "UPDATE_STEP_VALIDATION";
27
- export const MARK_STEP_COMPLETE = "MARK_STEP_COMPLETE";
28
- export const RESET_WIZARD_STATE = "RESET_WIZARD_STATE";
29
- export const VALIDATE_AND_UPDATE_STEP = "VALIDATE_AND_UPDATE_STEP";
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`;
30
21
 
31
22
  // Mode setters
32
23
  export const setWizardMode = (mode) => ({
@@ -52,11 +43,7 @@ export const setCurrentStep = (step, previousStep = null) => ({
52
43
 
53
44
  export const goToStep = (step) => (dispatch, getState) => {
54
45
  const state = getState()[values.reducerKey];
55
- const currentStep =
56
- state &&
57
- state.wizard &&
58
- state.wizard.navigation &&
59
- state.wizard.navigation.currentStep;
46
+ const currentStep = state?.wizard?.navigation?.currentStep;
60
47
 
61
48
  // Clear form submission state when changing steps
62
49
  dispatch(clearFormSubmissionState());
@@ -146,10 +133,9 @@ const getFormValidation = (form, step) => {
146
133
 
147
134
  switch (step) {
148
135
  case "overview": {
149
- const hasTitle = form.title && form.title.trim().length > 0;
150
- const hasDisplayName =
151
- form.displayName && form.displayName.trim().length > 0;
152
- 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;
153
139
 
154
140
  return {
155
141
  isValid: hasTitle && hasDisplayName && hasIcon,
@@ -161,12 +147,12 @@ const getFormValidation = (form, step) => {
161
147
  };
162
148
  }
163
149
  case "fields": {
164
- const hasTitleField =
165
- form.fields &&
166
- form.fields.some((field) => field.id === "mandatory-title");
167
- const hasImageField =
168
- form.fields &&
169
- form.fields.some((field) => field.id === "mandatory-feature-image");
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
+ );
170
156
 
171
157
  // Check each field for missing labels and create field-specific errors
172
158
  const fieldErrors = {};
@@ -205,8 +191,7 @@ const getFormValidation = (form, step) => {
205
191
  };
206
192
  }
207
193
  case "layout": {
208
- const hasLayoutType =
209
- form.layout && form.layout.type && form.layout.type.length > 0;
194
+ const hasLayoutType = form.layout?.type?.length > 0;
210
195
  return {
211
196
  isValid: hasLayoutType,
212
197
  errors: {