@plusscommunities/pluss-feature-builder-web-c 1.0.4 → 1.0.6-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.
package/dist/index.cjs.js CHANGED
@@ -48,40 +48,40 @@ var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_obje
48
48
  It can be swapped prior to publishing via copy:set
49
49
  */
50
50
  const values = {
51
- featureKey: "feature-builder-c",
52
- featureKeyRoute: "/feature-builder-c",
51
+ featureKey: "feature-builder-d",
52
+ featureKeyRoute: "/feature-builder-d",
53
53
  // Dynamic route prefix
54
- featureId: "feature-builder-c-default",
54
+ featureId: "feature-builder-d-default",
55
55
  // Fixed ID for the single feature definition
56
- reducerKey: "featureBuilderC",
56
+ reducerKey: "featureBuilderD",
57
57
  // Define reducer 'slice' key.
58
- singularName: "Build Your Feature C",
59
- description: "Create custom forms for mobile application (Variant C).",
58
+ singularName: "Build Your Feature D",
59
+ description: "Create custom forms for mobile application (Variant D).",
60
60
  emptyText: "No custom forms available",
61
- textMenuTitle: "Build Your Feature C",
62
- textPermissionFeatureBuilderDefinition: "Build Your Feature C Definition",
63
- textPermissionFeatureBuilderContent: "Create and Manage Content in Build Your Feature C",
61
+ textMenuTitle: "Build Your Feature D",
62
+ textPermissionFeatureBuilderDefinition: "Build Your Feature D Definition",
63
+ textPermissionFeatureBuilderContent: "Create and Manage Content in Build Your Feature D",
64
64
  // Routes
65
- routeFormOverviewStep: "/feature-builder-c/definition/overview",
66
- routeFormFieldsStep: "/feature-builder-c/definition/fields",
67
- routeFormLayoutStep: "/feature-builder-c/definition/layout",
68
- routeListingScreen: "/feature-builder-c/listing",
69
- routeCreateListing: "/feature-builder-c/listing/create",
70
- routeEditListing: "/feature-builder-c/listing/edit/:id",
65
+ routeFormOverviewStep: "/feature-builder-d/definition/overview",
66
+ routeFormFieldsStep: "/feature-builder-d/definition/fields",
67
+ routeFormLayoutStep: "/feature-builder-d/definition/layout",
68
+ routeListingScreen: "/feature-builder-d/listing",
69
+ routeCreateListing: "/feature-builder-d/listing/create",
70
+ routeEditListing: "/feature-builder-d/listing/edit/:id",
71
71
  // Screen names
72
- screenFormOverviewStep: "FormOverviewStepC",
73
- screenFormFieldsStep: "FormFieldsStepC",
74
- screenFormLayoutStep: "FormLayoutStepC",
75
- screenListingScreen: "ListingScreenC",
72
+ screenFormOverviewStep: "FormOverviewStepD",
73
+ screenFormFieldsStep: "FormFieldsStepD",
74
+ screenFormLayoutStep: "FormLayoutStepD",
75
+ screenListingScreen: "ListingScreenD",
76
76
  // Page names
77
- pageCreateListing: "CreateListingPageC",
78
- pageEditListing: "EditListingPageC",
77
+ pageCreateListing: "CreateListingPageD",
78
+ pageEditListing: "EditListingPageD",
79
79
  // Permissions
80
- permissionFeatureBuilderDefinition: "featureBuilderDefinitionC",
81
- permissionFeatureBuilderContent: "featureBuilderContentC",
80
+ permissionFeatureBuilderDefinition: "featureBuilderDefinitionD",
81
+ permissionFeatureBuilderContent: "featureBuilderContentD",
82
82
  // Menu
83
83
  menuIcon: "tool",
84
- menuKey: "feature-builder-definition-c",
84
+ menuKey: "feature-builder-definition-d",
85
85
  menuIsFontAwesome: true,
86
86
  menuOrder: 20,
87
87
  // Lower number = higher priority
@@ -577,8 +577,8 @@ const DeleteConfirmationPopup = _ref => {
577
577
  }, "Please wait while we delete the ", itemText, "...")));
578
578
  };
579
579
 
580
- var css$v = ".FeatureBuilderSuccessPopup_module_successContent__5b4b36c2 {\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tgap: 20px;\n\tpadding: 20px 0;\n}\n\n.FeatureBuilderSuccessPopup_module_gifPlaceholder__5b4b36c2 {\n\twidth: 100%;\n\tmax-width: 400px;\n}\n\n.FeatureBuilderSuccessPopup_module_gifContainer__5b4b36c2 {\n\twidth: 100%;\n\theight: 200px;\n\tbackground-color: #f5f5f5;\n\tborder: 2px dashed #ccc;\n\tborder-radius: 8px;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n}\n\n.FeatureBuilderSuccessPopup_module_gifPlaceholderText__5b4b36c2 {\n\tcolor: #999;\n\tfont-size: 14px;\n\ttext-align: center;\n\tpadding: 20px;\n}\n\n.FeatureBuilderSuccessPopup_module_successMessage__5b4b36c2 {\n\ttext-align: center;\n\tcolor: #666;\n\tfont-size: 16px;\n\tline-height: 1.5;\n\tmax-width: 400px;\n}\n\n.FeatureBuilderSuccessPopup_module_featureName__5b4b36c2 {\n\tfont-weight: 600;\n\tcolor: #333;\n}\n";
581
- var modules_b5a7fccb = {"successContent":"FeatureBuilderSuccessPopup_module_successContent__5b4b36c2","gifPlaceholder":"FeatureBuilderSuccessPopup_module_gifPlaceholder__5b4b36c2","gifContainer":"FeatureBuilderSuccessPopup_module_gifContainer__5b4b36c2","gifPlaceholderText":"FeatureBuilderSuccessPopup_module_gifPlaceholderText__5b4b36c2","successMessage":"FeatureBuilderSuccessPopup_module_successMessage__5b4b36c2","featureName":"FeatureBuilderSuccessPopup_module_featureName__5b4b36c2"};
580
+ var css$v = ".FeatureBuilderSuccessPopup_module_successContent__a6544e11 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 20px;\n\tpadding: 20px 0;\n}\n\n.FeatureBuilderSuccessPopup_module_gifPlaceholder__a6544e11 {\n\twidth: 100%;\n\tmax-width: 400px;\n}\n\n.FeatureBuilderSuccessPopup_module_gifContainer__a6544e11 {\n\twidth: 100%;\n\theight: 200px;\n\tbackground-color: #f5f5f5;\n\tborder: 2px dashed #ccc;\n\tborder-radius: 8px;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n}\n\n.FeatureBuilderSuccessPopup_module_gifPlaceholderText__a6544e11 {\n\tcolor: #999;\n\tfont-size: 14px;\n\ttext-align: center;\n\tpadding: 20px;\n}\n\n.FeatureBuilderSuccessPopup_module_successMessage__a6544e11 {\n\tfont-size: 16px;\n\tline-height: 1.5;\n\tmax-width: 400px;\n\tcolor: #181c4a;\n}\n\n.FeatureBuilderSuccessPopup_module_featureName__a6544e11 {\n\tfont-weight: 600;\n\tcolor: #333;\n}\n";
581
+ var modules_b5a7fccb = {"successContent":"FeatureBuilderSuccessPopup_module_successContent__a6544e11","gifPlaceholder":"FeatureBuilderSuccessPopup_module_gifPlaceholder__a6544e11","gifContainer":"FeatureBuilderSuccessPopup_module_gifContainer__a6544e11","gifPlaceholderText":"FeatureBuilderSuccessPopup_module_gifPlaceholderText__a6544e11","successMessage":"FeatureBuilderSuccessPopup_module_successMessage__a6544e11","featureName":"FeatureBuilderSuccessPopup_module_featureName__a6544e11"};
582
582
  n(css$v,{});
583
583
 
584
584
  const {
@@ -591,8 +591,7 @@ const FeatureBuilderSuccessPopup = _ref => {
591
591
  let {
592
592
  isOpen,
593
593
  onClose,
594
- featureName,
595
- displayName
594
+ featureName
596
595
  } = _ref;
597
596
  if (!isOpen) {
598
597
  return null;
@@ -603,9 +602,10 @@ const FeatureBuilderSuccessPopup = _ref => {
603
602
  onClick: onClose,
604
603
  isActive: true
605
604
  }];
605
+ const capitalisedName = featureName && featureName[0].toUpperCase() + featureName.slice(1);
606
606
  return /*#__PURE__*/React__default["default"].createElement(Popup$3, {
607
- title: "".concat(featureName, " Created"),
608
- subtitle: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("span", null, featureName), " is now saved and available for your communities!"),
607
+ title: "".concat(capitalisedName, " Created"),
608
+ subtitle: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, capitalisedName, " is now saved and available for your communities!"),
609
609
  onClose: onClose,
610
610
  buttons: buttons,
611
611
  hasPadding: true,
@@ -615,9 +615,9 @@ const FeatureBuilderSuccessPopup = _ref => {
615
615
  className: modules_b5a7fccb.successContent
616
616
  }, /*#__PURE__*/React__default["default"].createElement("div", {
617
617
  className: modules_b5a7fccb.successMessage
618
- }, "To activate this feature, please add it to your sites using the Feature Picker."), /*#__PURE__*/React__default["default"].createElement("div", {
618
+ }, capitalisedName, " is saved and ready to go. To use it, add it to your site using the ", /*#__PURE__*/React__default["default"].createElement("b", null, "Feature Picker.")), /*#__PURE__*/React__default["default"].createElement("div", {
619
619
  className: modules_b5a7fccb.successMessage
620
- }, "Team members with the right permissions can start creating content for the communities that have installed the feature.")));
620
+ }, "Once added, your team can start creating content for the feature.")));
621
621
  };
622
622
 
623
623
  var css$u = ".FeatureBuilderWelcomePopup_module_welcomeContent__0e08704b {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 20px;\n\tpadding: 20px 0;\n}\n\n.FeatureBuilderWelcomePopup_module_welcomeMessage__0e08704b {\n\tcolor: #666;\n\tfont-size: 16px;\n\tline-height: 1.6;\n\twidth: 100%;\n}\n\n.FeatureBuilderWelcomePopup_module_welcomeMessage__0e08704b p {\n\tmargin: 0 0 16px 0;\n}\n\n.FeatureBuilderWelcomePopup_module_welcomeMessage__0e08704b p:last-child {\n\tmargin-bottom: 0;\n}\n";
@@ -3578,8 +3578,6 @@ const Field = props => {
3578
3578
  className: "".concat(modules_eca69fd0.field, " ").concat(hasError ? modules_eca69fd0["field--invalid"] : "")
3579
3579
  }, fieldContent));
3580
3580
  };
3581
-
3582
- // Padlock icon component for base fields
3583
3581
  const PadlockIcon = () => {
3584
3582
  const icon = iconImports.lock;
3585
3583
  return /*#__PURE__*/React__default["default"].createElement("span", {
@@ -3624,25 +3622,21 @@ const TitleField = props => {
3624
3622
  const {
3625
3623
  placeholder,
3626
3624
  label,
3627
- isRequired,
3628
3625
  helpText
3629
3626
  } = props.values;
3630
3627
  return /*#__PURE__*/React__default["default"].createElement(BaseFieldConfig, {
3631
3628
  label: label,
3632
3629
  placeholder: placeholder,
3633
3630
  helpText: helpText,
3634
- isRequired: true // Title fields are always required
3635
- ,
3631
+ isRequired: true,
3636
3632
  setLabel: setLabel,
3637
- setPlaceholder: () => {},
3633
+ setPlaceholder: setPlaceholder,
3638
3634
  setHelpText: setHelpText,
3639
- toggleIsRequired: () => {} // Disable toggling - title fields are always required
3640
- ,
3635
+ toggleIsRequired: () => {},
3641
3636
  stepErrors: stepErrors,
3642
3637
  showWarnings: showWarnings,
3643
3638
  id: id,
3644
- fieldType: "title",
3645
- id: id // Fix: pass the field ID
3639
+ fieldType: "title"
3646
3640
  });
3647
3641
  };
3648
3642
  const TextField = props => {
@@ -3652,30 +3646,28 @@ const TextField = props => {
3652
3646
  setHelpText,
3653
3647
  stepErrors,
3654
3648
  showWarnings,
3649
+ toggleIsRequired,
3655
3650
  id
3656
3651
  } = props;
3657
3652
  const {
3658
3653
  placeholder,
3659
3654
  label,
3660
- isRequired,
3661
- helpText
3655
+ helpText,
3656
+ isRequired
3662
3657
  } = props.values;
3663
3658
  return /*#__PURE__*/React__default["default"].createElement(BaseFieldConfig, {
3664
3659
  label: label,
3665
3660
  placeholder: placeholder,
3666
3661
  helpText: helpText,
3667
- isRequired: true // Text fields are always required
3668
- ,
3662
+ isRequired: isRequired,
3669
3663
  setLabel: setLabel,
3670
- setPlaceholder: () => {},
3664
+ setPlaceholder: setPlaceholder,
3671
3665
  setHelpText: setHelpText,
3672
- toggleIsRequired: () => {} // Disable toggling - text fields are always required
3673
- ,
3666
+ toggleIsRequired: toggleIsRequired,
3674
3667
  stepErrors: stepErrors,
3675
3668
  showWarnings: showWarnings,
3676
3669
  id: id,
3677
- fieldType: "text",
3678
- id: id // Fix: pass the field ID
3670
+ fieldType: "text"
3679
3671
  });
3680
3672
  };
3681
3673
  const DescriptionField = props => {
@@ -3687,7 +3679,7 @@ const DescriptionField = props => {
3687
3679
  stepErrors,
3688
3680
  showWarnings,
3689
3681
  setUseAsSummary,
3690
- id // Get ID from root props
3682
+ id
3691
3683
  } = props;
3692
3684
  const {
3693
3685
  placeholder,
@@ -3702,7 +3694,7 @@ const DescriptionField = props => {
3702
3694
  helpText: helpText,
3703
3695
  isRequired: isRequired,
3704
3696
  setLabel: setLabel,
3705
- setPlaceholder: () => {},
3697
+ setPlaceholder: setPlaceholder,
3706
3698
  setHelpText: setHelpText,
3707
3699
  toggleIsRequired: toggleIsRequired,
3708
3700
  stepErrors: stepErrors,
@@ -3722,7 +3714,7 @@ const ImageField = props => {
3722
3714
  toggleAllowCaption,
3723
3715
  stepErrors,
3724
3716
  showWarnings,
3725
- id // Get ID from root props
3717
+ id
3726
3718
  } = props;
3727
3719
  const {
3728
3720
  label,
@@ -3745,8 +3737,7 @@ const ImageField = props => {
3745
3737
  toggleAllowCaption: toggleAllowCaption,
3746
3738
  stepErrors: stepErrors,
3747
3739
  showWarnings: showWarnings,
3748
- id: id // Fix: pass the field ID
3749
- ,
3740
+ id: id,
3750
3741
  fieldType: "image"
3751
3742
  });
3752
3743
  };
@@ -3756,7 +3747,7 @@ const FeatureImageField = props => {
3756
3747
  setHelpText,
3757
3748
  stepErrors,
3758
3749
  showWarnings,
3759
- id // Get ID from root props
3750
+ id
3760
3751
  } = props;
3761
3752
  const {
3762
3753
  label,
@@ -3767,17 +3758,14 @@ const FeatureImageField = props => {
3767
3758
  label: label,
3768
3759
  placeholder: placeholder,
3769
3760
  helpText: helpText,
3770
- isRequired: true // Feature image fields are always required
3771
- ,
3761
+ isRequired: true,
3772
3762
  setLabel: setLabel,
3773
3763
  setPlaceholder: () => {},
3774
3764
  setHelpText: setHelpText,
3775
- toggleIsRequired: () => {} // Disable toggling - feature image fields are always required
3776
- ,
3765
+ toggleIsRequired: () => {},
3777
3766
  stepErrors: stepErrors,
3778
3767
  showWarnings: showWarnings,
3779
- id: id // Fix: pass the field ID
3780
- ,
3768
+ id: id,
3781
3769
  fieldType: "feature-image",
3782
3770
  customLabel: "Label"
3783
3771
  });
@@ -3793,7 +3781,7 @@ const GalleryField = props => {
3793
3781
  setAllowedTypes,
3794
3782
  stepErrors,
3795
3783
  showWarnings,
3796
- id // Get ID from root props
3784
+ id
3797
3785
  } = props;
3798
3786
  const {
3799
3787
  label,
@@ -3836,7 +3824,8 @@ const CTAField = props => {
3836
3824
  setHelpText,
3837
3825
  setPlaceholder,
3838
3826
  stepErrors,
3839
- showWarnings
3827
+ showWarnings,
3828
+ id
3840
3829
  } = props;
3841
3830
  const {
3842
3831
  label,
@@ -3844,23 +3833,18 @@ const CTAField = props => {
3844
3833
  helpText,
3845
3834
  placeholder
3846
3835
  } = props.values;
3847
- const {
3848
- id
3849
- } = props; // Get ID from root props
3850
-
3851
3836
  return /*#__PURE__*/React__default["default"].createElement(BaseFieldConfig, {
3852
3837
  label: label,
3853
3838
  placeholder: placeholder,
3854
3839
  helpText: helpText,
3855
3840
  isRequired: isRequired,
3856
3841
  setLabel: setLabel,
3857
- setPlaceholder: () => {},
3842
+ setPlaceholder: setPlaceholder,
3858
3843
  setHelpText: setHelpText,
3859
3844
  toggleIsRequired: toggleIsRequired,
3860
3845
  stepErrors: stepErrors,
3861
3846
  showWarnings: showWarnings,
3862
- id: id // Fix: pass the field ID
3863
- ,
3847
+ id: id,
3864
3848
  fieldType: "cta"
3865
3849
  });
3866
3850
  };
@@ -3870,11 +3854,9 @@ const FileField = props => {
3870
3854
  setLabel,
3871
3855
  setHelpText,
3872
3856
  stepErrors,
3873
- showWarnings
3874
- } = props;
3875
- const {
3857
+ showWarnings,
3876
3858
  id
3877
- } = props; // Get ID from root props
3859
+ } = props;
3878
3860
  const {
3879
3861
  label,
3880
3862
  isRequired,
@@ -4116,32 +4098,20 @@ const FormFieldsStepInner = props => {
4116
4098
  UseCase: "Link to reservations, bookings, or external sites",
4117
4099
  Icon: "arrow-circle-right"
4118
4100
  }];
4119
-
4120
- // Use custom hook to handle definition loading
4121
4101
  const {
4122
4102
  definition,
4123
4103
  definitionIsLoading,
4124
4104
  reloadDefinition
4125
4105
  } = useFeatureDefinitionLoader();
4126
-
4127
- // Get form state for display name
4128
4106
  const formDisplayName = reactRedux.useSelector(selectFormDisplayName);
4129
-
4130
- // Get wizard state
4131
4107
  const isCreateMode = reactRedux.useSelector(selectIsCreateMode);
4132
4108
  const isEditMode = reactRedux.useSelector(selectIsEditMode);
4133
-
4134
- // Get validation state
4135
4109
  const isStepValid = reactRedux.useSelector(selectIsStepValid("fields"));
4136
4110
  const stepErrors = reactRedux.useSelector(selectStepErrors("fields"));
4137
4111
  const showWarnings = !isStepValid && Object.keys(stepErrors).length > 0;
4138
-
4139
- // Get submission state
4140
4112
  const isSubmitting = reactRedux.useSelector(selectFormIsSubmitting);
4141
4113
  const submitError = reactRedux.useSelector(selectFormSubmitError);
4142
4114
  const submitSuccess = reactRedux.useSelector(selectFormSubmitSuccess);
4143
-
4144
- // Toast management functions
4145
4115
  const addToast = (type, message) => {
4146
4116
  const id = Date.now();
4147
4117
  setToasts(prev => [...prev, {
@@ -4155,9 +4125,6 @@ const FormFieldsStepInner = props => {
4155
4125
  setToasts(prev => prev.filter(toast => toast.id !== id));
4156
4126
  };
4157
4127
 
4158
- // Note: Removed automatic redirect after successful save in edit mode
4159
- // User should stay on the current step until they manually navigate
4160
-
4161
4128
  // Handle successful submission with optimistic update and redirect
4162
4129
  React__default["default"].useEffect(() => {
4163
4130
  if (submitSuccess && !isSubmitting) {
@@ -4165,14 +4132,11 @@ const FormFieldsStepInner = props => {
4165
4132
  addToast("success", "Changes saved");
4166
4133
  dispatch(clearFormSubmissionState());
4167
4134
  } else {
4168
- // In create mode, show success toast and redirect immediately
4169
4135
  addToast("success", "Feature created successfully");
4170
-
4171
- // Clear submission state and redirect to overview step
4172
4136
  dispatch(clearFormSubmissionState());
4173
4137
  setTimeout(() => {
4174
4138
  history.push(values.routeFormOverviewStep);
4175
- }, 1000); // Brief delay to show toast
4139
+ }, 1000);
4176
4140
  }
4177
4141
  }
4178
4142
  }, [submitSuccess, isEditMode, isSubmitting, dispatch, history]);
@@ -4186,8 +4150,6 @@ const FormFieldsStepInner = props => {
4186
4150
  }, 1000);
4187
4151
  }
4188
4152
  }, [submitError]);
4189
-
4190
- // Scroll to top when validation errors appear
4191
4153
  React.useEffect(() => {
4192
4154
  if (showWarnings) {
4193
4155
  // Scroll to top of form to show validation errors
@@ -4197,24 +4159,15 @@ const FormFieldsStepInner = props => {
4197
4159
  });
4198
4160
  }
4199
4161
  }, [showWarnings]);
4200
-
4201
- // Error boundary handlers
4202
4162
  const handleRefresh = () => {
4203
- // Refresh current step data
4204
4163
  dispatch(validateAndUpdateStep("fields"));
4205
4164
  };
4206
4165
  React.useEffect(() => {
4207
- // Set current step when component mounts
4208
4166
  dispatch(setCurrentStepAndSave("fields"));
4209
4167
  }, [dispatch]);
4210
-
4211
- // Add effect to handle definition loading and validation in edit mode
4212
- // ADD THIS EFFECT: Hydrate form data from definition on refresh
4213
4168
  React.useEffect(() => {
4214
4169
  if (definition && !definitionIsLoading && isFormInitial) {
4215
4170
  dispatch(setInitialValues(definition));
4216
-
4217
- // In edit mode, trigger validation after setting initial values
4218
4171
  if (isEditMode) {
4219
4172
  setTimeout(() => {
4220
4173
  dispatch(validateAndUpdateStep("fields"));
@@ -4224,9 +4177,7 @@ const FormFieldsStepInner = props => {
4224
4177
  }, [definition, definitionIsLoading, isFormInitial, isEditMode, dispatch]);
4225
4178
  React.useEffect(() => {
4226
4179
  // In edit mode, trigger validation when definition is available
4227
- // Note: The new effect above handles the data population, this handles re-validation
4228
4180
  if (isEditMode && definition && !definitionIsLoading && !isFormInitial) {
4229
- // Only validate if form is NOT initial (meaning it has data)
4230
4181
  setTimeout(() => {
4231
4182
  dispatch(validateAndUpdateStep("fields"));
4232
4183
  }, 100);
@@ -4234,59 +4185,47 @@ const FormFieldsStepInner = props => {
4234
4185
  }, [definition, definitionIsLoading, isEditMode, isFormInitial, dispatch]);
4235
4186
  function handleAddField(fieldType) {
4236
4187
  dispatch(addField(fieldType));
4237
- setShowFieldSelector(false); // Close popup after adding field
4188
+ setShowFieldSelector(false);
4238
4189
  }
4239
4190
  function handleOpenFieldSelector() {
4240
- setReplacingFieldIndex(null); // Reset to add mode
4191
+ setReplacingFieldIndex(null);
4241
4192
  setShowFieldSelector(true);
4242
4193
  }
4243
4194
  function handleCloseFieldSelector() {
4244
- setReplacingFieldIndex(null); // Reset replacement state
4195
+ setReplacingFieldIndex(null);
4245
4196
  setShowFieldSelector(false);
4246
4197
  }
4247
4198
  function handleDeleteField(fieldId) {
4248
4199
  dispatch(deleteField(fieldId));
4249
4200
  }
4250
4201
  function handleReplaceField(fieldIndex) {
4251
- // Store the field index to replace and open the field selector
4252
4202
  setReplacingFieldIndex(fieldIndex);
4253
4203
  setShowFieldSelector(true);
4254
4204
  }
4255
4205
  function handleAddReplacementField(fieldType) {
4256
4206
  const fieldIndex = replacingFieldIndex;
4257
4207
  if (fieldIndex !== null) {
4258
- // Delete the current field at this index
4259
4208
  const currentField = allFields[fieldIndex];
4260
4209
  if (currentField && !currentField.isMandatory) {
4261
4210
  dispatch(deleteField(currentField.id));
4262
4211
  }
4263
-
4264
- // Add the new field
4265
4212
  dispatch(addField(fieldType));
4266
-
4267
- // Reset replacement state
4268
4213
  setReplacingFieldIndex(null);
4269
4214
  setShowFieldSelector(false);
4270
4215
  }
4271
4216
  }
4272
4217
  function handleNext() {
4273
- // Validate before proceeding
4274
4218
  const validationResult = dispatch(validateAndUpdateStep("fields"));
4275
-
4276
- // If validation passes, navigate to next step
4277
4219
  if (validationResult !== null && validationResult !== void 0 && validationResult.isValid) {
4278
- // Clear form submission state when changing steps
4279
4220
  dispatch(clearFormSubmissionState());
4280
4221
  if (isCreateMode) {
4281
4222
  history.push(values.routeFormLayoutStep);
4282
4223
  } else {
4283
- // In edit mode, navigate directly
4284
4224
  history.push(values.routeFormLayoutStep);
4285
4225
  }
4286
4226
  }
4287
4227
  // If validation fails, scroll to top to show error summary
4288
4228
  else {
4289
- // Scroll to top of form to show validation errors
4290
4229
  window.scrollTo({
4291
4230
  top: 0,
4292
4231
  behavior: "smooth"
@@ -4294,42 +4233,29 @@ const FormFieldsStepInner = props => {
4294
4233
  }
4295
4234
  }
4296
4235
  function handlePrevious() {
4297
- // Clear form submission state when changing steps
4298
4236
  dispatch(clearFormSubmissionState());
4299
4237
  if (isCreateMode) {
4300
4238
  history.push(values.routeFormOverviewStep);
4301
4239
  } else {
4302
- // In edit mode, go back to overview screen
4303
4240
  history.push(values.routeFormOverviewStep);
4304
4241
  }
4305
4242
  }
4306
4243
  function handleSaveStep() {
4307
- // Validate before saving in edit mode
4308
4244
  const validationResult = dispatch(validateAndUpdateStep("fields"));
4309
-
4310
- // If validation passes, save the entire form
4311
4245
  if (validationResult !== null && validationResult !== void 0 && validationResult.isValid) {
4312
4246
  dispatch(submitForm());
4313
4247
  }
4314
4248
  // If validation fails, scroll to top to show error summary
4315
4249
  else {
4316
- // Scroll to top of form to show validation errors
4317
4250
  window.scrollTo({
4318
4251
  top: 0,
4319
4252
  behavior: "smooth"
4320
4253
  });
4321
4254
  }
4322
4255
  }
4323
-
4324
- // Get all fields in unified list (base + custom)
4325
4256
  const allFields = fields || [];
4326
-
4327
- // Create sorted copy for rendering
4328
4257
  const sortedFields = allFields.slice().sort((a, b) => a.order - b.order);
4329
4258
 
4330
- // Filter description fields for summary demo
4331
- allFields.filter(field => field.type === "description");
4332
-
4333
4259
  // Check for definition management permission
4334
4260
  if (!PlussCore__namespace.Session.validateAccess(auth.site, values.permissionFeatureBuilderDefinition, auth)) {
4335
4261
  return /*#__PURE__*/React__default["default"].createElement("div", {
@@ -4586,11 +4512,9 @@ const useField = id => {
4586
4512
  dispatch(updateFieldById(id, updatedField));
4587
4513
  }
4588
4514
  function setUseAsSummary(value) {
4589
- // When setting a field as summary, use the new action to ensure only one field is selected
4590
4515
  if (value) {
4591
4516
  dispatch(setSummaryField(id));
4592
4517
  } else {
4593
- // When unsetting, use regular update to unset this specific field
4594
4518
  const updatedField = {
4595
4519
  values: _objectSpread$5(_objectSpread$5({}, values), {}, {
4596
4520
  useAsSummary: false
@@ -4623,11 +4547,8 @@ const FormLayoutStepInner = props => {
4623
4547
  const overviewIcon = reactRedux.useSelector(selectFormIcon);
4624
4548
  const definitionId = reactRedux.useSelector(selectDefinitionId);
4625
4549
  const layoutType = (layout === null || layout === void 0 ? void 0 : layout.type) || "round";
4626
- // Get wizard state
4627
4550
  const isCreateMode = reactRedux.useSelector(selectIsCreateMode);
4628
4551
  const isEditMode = reactRedux.useSelector(selectIsEditMode);
4629
-
4630
- // Use custom hook to handle definition loading
4631
4552
  const {
4632
4553
  definition,
4633
4554
  definitionIsLoading
@@ -4644,14 +4565,8 @@ const FormLayoutStepInner = props => {
4644
4565
  const isSubmitting = reactRedux.useSelector(selectFormIsSubmitting);
4645
4566
  const submitError = reactRedux.useSelector(selectFormSubmitError);
4646
4567
  const submitSuccess = reactRedux.useSelector(selectFormSubmitSuccess);
4647
-
4648
- // Toast state
4649
4568
  const [toasts, setToasts] = React__default["default"].useState([]);
4650
-
4651
- // Success popup state
4652
4569
  const [showSuccessPopup, setShowSuccessPopup] = React__default["default"].useState(false);
4653
-
4654
- // Toast management functions
4655
4570
  const addToast = (type, message) => {
4656
4571
  const id = Date.now();
4657
4572
  setToasts(prev => [...prev, {
@@ -4664,28 +4579,21 @@ const FormLayoutStepInner = props => {
4664
4579
  const removeToast = id => {
4665
4580
  setToasts(prev => prev.filter(toast => toast.id !== id));
4666
4581
  };
4667
-
4668
- // Handle success popup close
4669
4582
  const handleSuccessPopupClose = () => {
4670
4583
  setShowSuccessPopup(false);
4671
4584
  dispatch(clearFormSubmissionState());
4672
- history.push(values.routeFormOverviewStep);
4585
+ window.location.replace(values.routeFormOverviewStep);
4673
4586
  };
4674
-
4675
- // Handle successful submission with popup and redirect
4676
4587
  React.useEffect(() => {
4677
4588
  if (submitSuccess && !isSubmitting) {
4678
4589
  if (isEditMode) {
4679
4590
  addToast("success", "Changes saved");
4680
4591
  dispatch(clearFormSubmissionState());
4681
4592
  } else {
4682
- // In create mode, show success popup
4683
4593
  setShowSuccessPopup(true);
4684
4594
  }
4685
4595
  }
4686
4596
  }, [submitSuccess, isEditMode, isSubmitting, dispatch]);
4687
-
4688
- // Handle submit error
4689
4597
  React.useEffect(() => {
4690
4598
  if (submitError) {
4691
4599
  addToast("error", "It didn't work. Please try again.");
@@ -4694,10 +4602,7 @@ const FormLayoutStepInner = props => {
4694
4602
  }, 1000);
4695
4603
  }
4696
4604
  }, [submitError]);
4697
-
4698
- // Error boundary handlers
4699
4605
  const handleRefresh = () => {
4700
- // Refresh current step data
4701
4606
  dispatch(validateAndUpdateStep("layout"));
4702
4607
  };
4703
4608
  const layoutOptions = [{
@@ -4739,8 +4644,6 @@ const FormLayoutStepInner = props => {
4739
4644
  }
4740
4645
  }
4741
4646
  }, [definition, definitionIsLoading, isFormInitial, isEditMode, dispatch]);
4742
-
4743
- // Add effect to handle definition loading and validation in edit mode
4744
4647
  React.useEffect(() => {
4745
4648
  // In edit mode, trigger validation when definition is available
4746
4649
  // Note: The new effect above handles data population, this handles re-validation
@@ -4755,23 +4658,20 @@ const FormLayoutStepInner = props => {
4755
4658
  dispatch(setLayoutType(layoutType));
4756
4659
  }
4757
4660
  function handlePrevious() {
4758
- // Clear form submission state when changing steps
4759
4661
  dispatch(clearFormSubmissionState());
4760
4662
  if (isCreateMode) {
4761
4663
  history.push(values.routeFormFieldsStep);
4762
4664
  } else {
4763
- // In edit mode, go back to fields screen
4764
4665
  history.push(values.routeFormFieldsStep);
4765
4666
  }
4766
4667
  }
4767
4668
  function handleNext() {
4768
- // Validate before proceeding
4669
+ if (isSubmitting) {
4670
+ return;
4671
+ }
4769
4672
  const validationResult = dispatch(validateAndUpdateStep("layout"));
4770
-
4771
- // If validation passes, proceed with submission/navigation
4772
4673
  if (validationResult !== null && validationResult !== void 0 && validationResult.isValid) {
4773
4674
  if (isCreateMode) {
4774
- // In create mode, submit form - success popup will be shown by useEffect
4775
4675
  dispatch(submitForm());
4776
4676
  } else {
4777
4677
  // In edit mode, just save changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-feature-builder-web-c",
3
- "version": "1.0.4",
3
+ "version": "1.0.6-beta.0",
4
4
  "description": "Contains the feature builder extension for the pluss communities ",
5
5
  "main": "dist/index.cjs.js",
6
6
  "scripts": {
@@ -39,16 +39,16 @@
39
39
  "@babel/runtime": "^7.14.0"
40
40
  },
41
41
  "peerDependencies": {
42
- "@fortawesome/fontawesome-svg-core": "*",
43
- "@fortawesome/free-solid-svg-icons": "*",
44
- "@fortawesome/react-fontawesome": "*",
45
- "@plusscommunities/pluss-core-web": "*",
46
- "lodash": "*",
47
- "moment": "*",
48
- "react": "*",
49
- "react-bootstrap": "*",
50
- "react-dom": "*",
51
- "react-fontawesome": "*"
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"
52
52
  },
53
53
  "keywords": []
54
54
  }