Skip to content

Commit

Permalink
Refactored names for better understanding
Browse files Browse the repository at this point in the history
  • Loading branch information
officiallygod committed Aug 23, 2022
1 parent dd63813 commit c793c68
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/OnboardingSPA/components/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ const App = () => {
isDrawerOpen: select(nfdOnboardingStore).isDrawerOpened(),
newfoldBrand: select(nfdOnboardingStore).getNewfoldBrand(),
onboardingFlow: select(nfdOnboardingStore).getOnboardingFlow(),
flowData: select(nfdOnboardingStore).getCurrentOnboardingFlowData(),
socialData: select(nfdOnboardingStore).getCurrentOnboardingSocialData(),
flowData: select(nfdOnboardingStore).getOnboardingFlowData(),
socialData: select(nfdOnboardingStore).getOnboardingSocialData(),
firstStep: select(nfdOnboardingStore).getFirstStep(),
};
}, []);
Expand Down
2 changes: 1 addition & 1 deletion src/OnboardingSPA/components/ExitToWordPress/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const ExitToWordPress = ({
const { flowData } = useSelect(
(select) => {
return {
flowData: select(nfdOnboardingStore).getCurrentOnboardingFlowData(),
flowData: select(nfdOnboardingStore).getOnboardingFlowData(),
};
},
[location.pathname]
Expand Down
2 changes: 1 addition & 1 deletion src/OnboardingSPA/components/Header/step-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const StepNavigation = () => {
return {
nextStep: select(nfdOnboardingStore).getNextStep(),
previousStep: select(nfdOnboardingStore).getPreviousStep(),
flowData: select(nfdOnboardingStore).getCurrentOnboardingFlowData(),
flowData: select(nfdOnboardingStore).getOnboardingFlowData(),
};
},
[location.pathname]
Expand Down
2 changes: 1 addition & 1 deletion src/OnboardingSPA/components/SkipButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const SkipButton = () => {
return {
previousStep: select(nfdOnboardingStore).getPreviousStep(),
nextStep: select(nfdOnboardingStore).getNextStep(),
flowData: select(nfdOnboardingStore).getCurrentOnboardingFlowData(),
flowData: select(nfdOnboardingStore).getOnboardingFlowData(),
};
},
[]
Expand Down
4 changes: 2 additions & 2 deletions src/OnboardingSPA/pages/Steps/BasicInfo/basicInfoForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ const BasicInfoForm = () => {

const { flowData, socialData } = useSelect((select) => {
return {
flowData: select(nfdOnboardingStore).getCurrentOnboardingFlowData(),
socialData: select(nfdOnboardingStore).getCurrentOnboardingSocialData()
flowData: select(nfdOnboardingStore).getOnboardingFlowData(),
socialData: select(nfdOnboardingStore).getOnboardingSocialData()
};
}, []);

Expand Down
2 changes: 1 addition & 1 deletion src/OnboardingSPA/pages/Steps/BasicInfo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const StepBasicInfo = () => {
(select) => {
return {
currentStep: select(nfdOnboardingStore).getCurrentStep(),
flowData: select(nfdOnboardingStore).getCurrentOnboardingFlowData()
flowData: select(nfdOnboardingStore).getOnboardingFlowData()
};
},
[]
Expand Down
2 changes: 1 addition & 1 deletion src/OnboardingSPA/pages/Steps/DesignThemes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const StepDesignThemes = () => {

const { flowData } = useSelect((select) => {
return {
flowData: select(nfdOnboardingStore).getCurrentOnboardingFlowData()
flowData: select(nfdOnboardingStore).getOnboardingFlowData()
};
}, []);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const StepAddress = () => {
const navigate = useNavigate();

let flowData = useSelect((select) =>
select(nfdOnboardingStore).getCurrentOnboardingFlowData()
select(nfdOnboardingStore).getOnboardingFlowData()
);

const settings = useWPSettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const StepProducts = () => {
} = useDispatch(nfdOnboardingStore);

let flowData = useSelect((select) =>
select(nfdOnboardingStore).getCurrentOnboardingFlowData()
select(nfdOnboardingStore).getOnboardingFlowData()
);
let productInfo = flowData.storeDetails.productInfo;
useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/OnboardingSPA/pages/Steps/Ecommerce/StepTax/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const StepTax = () => {
const navigate = useNavigate();

let flowData = useSelect((select) =>
select(nfdOnboardingStore).getCurrentOnboardingFlowData()
select(nfdOnboardingStore).getOnboardingFlowData()
);

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const GetStartedExperience = () => {
const { enqueueRequest, flushQueue, setCurrentOnboardingFlowData } = useDispatch( nfdOnboardingStore );
const { flowData, currentStep } = useSelect( ( select ) => {
return {
flowData: select(nfdOnboardingStore).getCurrentOnboardingFlowData(),
flowData: select(nfdOnboardingStore).getOnboardingFlowData(),
currentStep: select(nfdOnboardingStore).getCurrentStep(),
};
}, [] );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const StepPrimarySetup = () => {
(select) => {
return {
currentStep: select(nfdOnboardingStore).getCurrentStep(),
flowData: select(nfdOnboardingStore).getCurrentOnboardingFlowData()
flowData: select(nfdOnboardingStore).getOnboardingFlowData()
};
},
[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const StepPrimarySetup = () => {
const { currentStep, flowData } = useSelect((select) => {
return {
currentStep: select(nfdOnboardingStore).getCurrentStep(),
flowData: select(nfdOnboardingStore).getCurrentOnboardingFlowData()
flowData: select(nfdOnboardingStore).getOnboardingFlowData()
};
}, []);

Expand Down
2 changes: 1 addition & 1 deletion src/OnboardingSPA/pages/Steps/GetStarted/Welcome/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const StepWelcome = () => {
(select) => {
return {
currentStep: select(nfdOnboardingStore).getCurrentStep(),
flowData: select(nfdOnboardingStore).getCurrentOnboardingFlowData(),
flowData: select(nfdOnboardingStore).getOnboardingFlowData(),
brandName: select(nfdOnboardingStore).getNewfoldBrandName(),
};
},
Expand Down
2 changes: 1 addition & 1 deletion src/OnboardingSPA/pages/Steps/TopPriority/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const StepTopPriority = ( props ) => {
const { currentStep, flowData } = useSelect( ( select ) => {
return {
currentStep: select(nfdOnboardingStore).getCurrentStep(),
flowData: select(nfdOnboardingStore).getCurrentOnboardingFlowData(),
flowData: select(nfdOnboardingStore).getOnboardingFlowData(),
};
}, [] );

Expand Down
18 changes: 14 additions & 4 deletions src/OnboardingSPA/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,24 @@ export function getHireExpertsUrl( state ) {
return hireExpertsUrl;
}

/**
* Gets the current complete Onboarding Data
*
* @param {*} state
* @return string
*/
export function getOnboardingData(state) {
return state?.data;
}

/**
* Gets the current Onboarding Flow Data
*
* @param {*} state
* @return string
*/
export function getCurrentOnboardingFlowData( state ) {
return state.data.flowData;
export function getOnboardingFlowData( state ) {
return state?.data?.flowData;
}

/**
Expand All @@ -79,8 +89,8 @@ export function getCurrentOnboardingFlowData( state ) {
* @param {*} state
* @return string
*/
export function getCurrentOnboardingSocialData(state) {
return state.data.socialData;
export function getOnboardingSocialData(state) {
return state?.data?.socialData;
}


Expand Down

0 comments on commit c793c68

Please sign in to comment.