HEX
Server: Apache
System: Linux efa57bbe-abb1-400d-2985-3b056fbc2701.secureserver.net 6.1.147-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jul 24 12:33:32 EDT 2025 x86_64
User: root (0)
PHP: 8.0.30.4
Disabled: NONE
Upload Files
File: /var/www/wp-content/mu-plugins/vendor/wpex/godaddy-launch/src/publish-guide/store/reducer.js
/**
 * WordPress dependencies
 */
import { combineReducers } from '@wordpress/data';

/**
 * Reducer for storing the Publish Guide's FAB activated state.
 *
 * @param {Object} state  Previous state.
 * @param {Object} action Action object.
 *
 * @return {Object} Updated state.
 */
export function publishGuideFabActive( state = false, action ) {
	switch ( action.type ) {
		case 'ACTIVATE_PUBLISH_GUIDE_FAB':
			return true;
		case 'DEACTIVATE_PUBLISH_GUIDE_FAB':
			return false;
	}

	return state;
}

/**
 * Reducer for storing the Publish Guide's open state.
 *
 * @param {Object} state  Previous state.
 * @param {Object} action Action object.
 *
 * @return {Object} Updated state.
 */
export function publishGuideActive( state = false, action ) {
	switch ( action.type ) {
		case 'OPEN_PUBLISH_GUIDE':
			return true;
		case 'CLOSE_PUBLISH_GUIDE':
			return false;
		case 'TOGGLE_PUBLISH_GUIDE':
			return ! state;
	}

	return state;
}

/**
 * Reducer for storing the Publish Guide's items state.
 *
 * @param {Object} state  Previous state.
 * @param {Object} action Action object.
 *
 * @return {Object} Updated state.
 */
export function guideItems( state = [], action ) {
	switch ( action.type ) {
		case 'SET_GUIDE_ITEMS':
			return [ ...action.guideItems ];
	}

	return state;
}

export default combineReducers( {
	guideItems,
	publishGuideActive,
	publishGuideFabActive,
} );