Merge branch 'AW-125-feauture-parameter' into 'develop'

AW-125-feature-parameter

See merge request witapp/aura-webapp!210
This commit is contained in:
Daniil Chemerkin 2024-06-29 15:35:06 +00:00
commit 4ac4386d72
6 changed files with 22 additions and 4 deletions

View File

@ -173,6 +173,7 @@ export interface ICreateAuthorizePayload {
partner?: Partial<Exclude<ICreateAuthorizeUser, "relationship_status">>; partner?: Partial<Exclude<ICreateAuthorizeUser, "relationship_status">>;
sign?: boolean; sign?: boolean;
signDate?: string; signDate?: string;
feature?: string;
} }
export interface ICreateAuthorizeResponse { export interface ICreateAuthorizeResponse {

View File

@ -6,7 +6,7 @@ import routes from "@/routes";
import { actions, selectors } from "@/store"; import { actions, selectors } from "@/store";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { useNavigate, useParams } from "react-router-dom"; import { useLocation, useNavigate, useParams } from "react-router-dom";
import BackgroundTopBlob from "../../ui/BackgroundTopBlob"; import BackgroundTopBlob from "../../ui/BackgroundTopBlob";
import { useDynamicSize } from "@/hooks/useDynamicSize"; import { useDynamicSize } from "@/hooks/useDynamicSize";
import Header from "../../components/Header"; import Header from "../../components/Header";
@ -22,6 +22,7 @@ interface IGenderPageProps {
function GenderPage({ productKey }: IGenderPageProps): JSX.Element { function GenderPage({ productKey }: IGenderPageProps): JSX.Element {
const dispatch = useDispatch(); const dispatch = useDispatch();
const navigate = useNavigate(); const navigate = useNavigate();
const location = useLocation();
const { targetId } = useParams(); const { targetId } = useParams();
const { width: pageWidth, elementRef: pageRef } = useDynamicSize({}); const { width: pageWidth, elementRef: pageRef } = useDynamicSize({});
const [selectedGender, setSelectedGender] = useState<Gender | null>(null); const [selectedGender, setSelectedGender] = useState<Gender | null>(null);
@ -30,9 +31,11 @@ function GenderPage({ productKey }: IGenderPageProps): JSX.Element {
); );
useEffect(() => { useEffect(() => {
const feature = location.pathname.replace("/v1/gender/", "");
const isShowTryApp = targetId === "i"; const isShowTryApp = targetId === "i";
dispatch(actions.userConfig.addIsShowTryApp(isShowTryApp)); dispatch(actions.userConfig.addIsShowTryApp(isShowTryApp));
}, [dispatch, targetId]); dispatch(actions.userConfig.setFeature(feature.includes("/v1/gender") ? "" : feature));
}, [dispatch, location.pathname, targetId]);
useEffect(() => { useEffect(() => {
if (privacyPolicyChecked && selectedGender) { if (privacyPolicyChecked && selectedGender) {

View File

@ -15,6 +15,7 @@ import { useDispatch, useSelector } from "react-redux";
export const useAuthentication = () => { export const useAuthentication = () => {
const api = useApi(); const api = useApi();
const feature = useSelector(selectors.selectFeature)
const { i18n } = useTranslation(); const { i18n } = useTranslation();
const dispatch = useDispatch(); const dispatch = useDispatch();
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
@ -98,7 +99,8 @@ export const useAuthentication = () => {
}, },
}, },
sign: checked, sign: checked,
signDate: dateOfCheck signDate: dateOfCheck,
feature
}) })
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [ }, [

View File

@ -38,7 +38,7 @@ function ABDesignV1Routes() {
<Routes> <Routes>
<Route element={<LayoutABDesignV1 />}> <Route element={<LayoutABDesignV1 />}>
<Route path={routes.client.genderV1()} element={<GenderPage />}> <Route path={routes.client.genderV1()} element={<GenderPage />}>
<Route path=":targetId" element={<GenderPage />} /> <Route path=":targetId*" element={<GenderPage />} />
</Route> </Route>
<Route <Route
path={routes.client.questionnaireV1()} path={routes.client.questionnaireV1()}

View File

@ -48,6 +48,7 @@ import userConfig, {
actions as userConfigActions, actions as userConfigActions,
selectUserDeviceType, selectUserDeviceType,
selectIsShowTryApp, selectIsShowTryApp,
selectFeature,
selectIsForceShortPath, selectIsForceShortPath,
} from "./userConfig"; } from "./userConfig";
import compatibilities, { import compatibilities, {
@ -121,6 +122,7 @@ export const selectors = {
selectQuestionnaire, selectQuestionnaire,
selectUserDeviceType, selectUserDeviceType,
selectIsShowTryApp, selectIsShowTryApp,
selectFeature,
selectIsForceShortPath, selectIsForceShortPath,
selectOpenAiToken, selectOpenAiToken,
selectPalmistryLines, selectPalmistryLines,

View File

@ -10,12 +10,14 @@ interface IUserConfig {
deviceType: EUserDeviceType; deviceType: EUserDeviceType;
isShowTryApp: boolean; isShowTryApp: boolean;
isForceShortPath: boolean; isForceShortPath: boolean;
feature: string;
} }
const initialState: IUserConfig = { const initialState: IUserConfig = {
deviceType: EUserDeviceType.ios, deviceType: EUserDeviceType.ios,
isShowTryApp: false, isShowTryApp: false,
isForceShortPath: false, isForceShortPath: false,
feature: "",
}; };
const userConfigSlice = createSlice({ const userConfigSlice = createSlice({
@ -37,6 +39,10 @@ const userConfigSlice = createSlice({
state.isForceShortPath = action.payload; state.isForceShortPath = action.payload;
return state; return state;
}, },
setFeature(state, action: PayloadAction<string>) {
state.feature = action.payload;
return state;
},
}, },
extraReducers: (builder) => builder.addCase("reset", () => initialState), extraReducers: (builder) => builder.addCase("reset", () => initialState),
}); });
@ -54,4 +60,8 @@ export const selectIsForceShortPath = createSelector(
(state: { userConfig: IUserConfig }) => state.userConfig.isForceShortPath, (state: { userConfig: IUserConfig }) => state.userConfig.isForceShortPath,
(userConfig) => userConfig (userConfig) => userConfig
); );
export const selectFeature = createSelector(
(state: { userConfig: IUserConfig }) => state.userConfig.feature,
(userConfig) => userConfig
);
export default userConfigSlice.reducer; export default userConfigSlice.reducer;