11/**
2- * Settings step - Configure About, Contact, FAQ pages, Post Types, and Login Destination
2+ * Settings step - Configure About, Contact, FAQ pages, and Post Types
33 * Multi-step process with 5 sub-steps
44 */
55/* global OnboardingStep, ProgressPlannerOnboardData */
66
77class PrplSettingsStep extends OnboardingStep {
8- subSteps = [
9- 'homepage' ,
10- 'about' ,
11- 'contact' ,
12- 'faq' ,
13- 'post-types' ,
14- 'login-destination' ,
15- ] ;
8+ subSteps = [ 'homepage' , 'about' , 'contact' , 'faq' , 'post-types' ] ;
169
1710 defaultSettings = {
1811 homepage : {
@@ -34,9 +27,6 @@ class PrplSettingsStep extends OnboardingStep {
3427 'post-types' : {
3528 selectedTypes : [ ] , // Array of selected post type slugs
3629 } ,
37- 'login-destination' : {
38- redirectOnLogin : false , // Checkbox state
39- } ,
4030 } ;
4131
4232 constructor ( ) {
@@ -137,7 +127,7 @@ class PrplSettingsStep extends OnboardingStep {
137127
138128 /**
139129 * Setup event listeners for a sub-step
140- * @param {string } subStepName - Name of sub-step (about/contact/faq/post-types/login-destination )
130+ * @param {string } subStepName - Name of sub-step (about/contact/faq/post-types)
141131 * @param {Object } subStepData - Data for this sub-step
142132 * @param {Object } state - Wizard state
143133 */
@@ -153,16 +143,6 @@ class PrplSettingsStep extends OnboardingStep {
153143 // Handle post types sub-step
154144 if ( subStepName === 'post-types' ) {
155145 this . setupPostTypesListeners ( subStepName , subStepData , state ) ;
156- return ;
157- }
158-
159- // Handle login destination sub-step
160- if ( subStepName === 'login-destination' ) {
161- this . setupLoginDestinationListeners (
162- subStepName ,
163- subStepData ,
164- state
165- ) ;
166146 }
167147 }
168148
@@ -342,60 +322,6 @@ class PrplSettingsStep extends OnboardingStep {
342322 this . updateSaveButtonState ( saveButton , subStepData ) ;
343323 }
344324
345- /**
346- * Setup event listeners for login destination sub-step
347- * @param {string } subStepName - Name of sub-step
348- * @param {Object } subStepData - Data for this sub-step
349- * @param {Object } state - Wizard state
350- */
351- setupLoginDestinationListeners ( subStepName , subStepData , state ) {
352- const container = this . popover . querySelector (
353- `.prpl-setting-item[data-page="${ subStepName } "]`
354- ) ;
355- const saveButton = this . popover . querySelector (
356- `#prpl-save-${ subStepName } -setting`
357- ) ;
358-
359- if ( ! container || ! saveButton ) {
360- return ;
361- }
362-
363- // Get checkbox
364- const checkbox = container . querySelector (
365- 'input[type="checkbox"][name="prpl-redirect-on-login"]'
366- ) ;
367-
368- if ( ! checkbox ) {
369- return ;
370- }
371-
372- // Initialize from checkbox that is already set in template, or from saved data
373- if ( subStepData . redirectOnLogin === undefined ) {
374- subStepData . redirectOnLogin = checkbox . checked ;
375- } else {
376- checkbox . checked = subStepData . redirectOnLogin ;
377- }
378-
379- // Add change listener
380- checkbox . addEventListener ( 'change' , ( e ) => {
381- subStepData . redirectOnLogin = e . target . checked ;
382- this . updateSaveButtonState ( saveButton , subStepData ) ;
383-
384- // Update Next/Dashboard button if on last sub-step
385- if ( this . currentSubStep === this . subSteps . length - 1 ) {
386- this . updateNextButton ( ) ;
387- }
388- } ) ;
389-
390- // Save button handler - just advances to next sub-step
391- saveButton . addEventListener ( 'click' , ( ) => {
392- this . advanceSubStep ( state ) ;
393- } ) ;
394-
395- // Initial button state
396- this . updateSaveButtonState ( saveButton , subStepData ) ;
397- }
398-
399325 /**
400326 * Advance to next sub-step
401327 * @param {Object } state - Wizard state
@@ -445,11 +371,6 @@ class PrplSettingsStep extends OnboardingStep {
445371 return subStepData . selectedTypes . length > 0 ;
446372 }
447373
448- // Handle login destination sub-step - always valid (checkbox is optional)
449- if ( subStepData . redirectOnLogin !== undefined ) {
450- return true ;
451- }
452-
453374 return false ;
454375 }
455376
@@ -525,12 +446,6 @@ class PrplSettingsStep extends OnboardingStep {
525446 } ) ;
526447 }
527448
528- // Add login destination
529- const loginData = state . data . settings [ 'login-destination' ] ;
530- if ( loginData && loginData . redirectOnLogin ) {
531- formDataObj . append ( 'prpl-redirect-on-login' , '1' ) ;
532- }
533-
534449 // Send single AJAX request
535450 const response = await fetch (
536451 ProgressPlannerOnboardData . adminAjaxUrl ,
0 commit comments