Merge branch 'develop' into 'main'
AW-483-484-485-fix-bugs See merge request witapp/aura-webapp!789
This commit is contained in:
commit
7b9f107814
@ -16,10 +16,10 @@ function AnonymousPaymentPage() {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { products } = useFunnel({
|
const { products } = useFunnel({
|
||||||
funnel: ELocalesPlacement.EmailGenerator,
|
funnel: ELocalesPlacement.EmailGenerator,
|
||||||
paymentPlacement: "TODO:FUNNEL"
|
paymentPlacement: "TODO:FUNNEL",
|
||||||
});
|
});
|
||||||
const activeProduct = products[0];
|
const activeProduct = products[0];
|
||||||
const activeProductFromStore = useSelector(selectors.selectActiveProduct)
|
const activeProductFromStore = useSelector(selectors.selectActiveProduct);
|
||||||
const { session, createSession } = useSession();
|
const { session, createSession } = useSession();
|
||||||
const utm = useSelector(selectors.selectUTM);
|
const utm = useSelector(selectors.selectUTM);
|
||||||
const feature = useSelector(selectors.selectFeature);
|
const feature = useSelector(selectors.selectFeature);
|
||||||
@ -37,7 +37,7 @@ function AnonymousPaymentPage() {
|
|||||||
_feature.includes("/v1/gender") ? "" : _feature
|
_feature.includes("/v1/gender") ? "" : _feature
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
dispatch(actions.privacyPolicy.updateChecked(true))
|
dispatch(actions.privacyPolicy.updateChecked(true));
|
||||||
}, [dispatch, location.pathname]);
|
}, [dispatch, location.pathname]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -45,19 +45,21 @@ function AnonymousPaymentPage() {
|
|||||||
return setIsParametersInitialized(true);
|
return setIsParametersInitialized(true);
|
||||||
}
|
}
|
||||||
(async () => {
|
(async () => {
|
||||||
await createSession(ESourceAuthorization["aura.test.payment"])
|
await createSession(ESourceAuthorization["aura.test.payment"]);
|
||||||
})()
|
})();
|
||||||
}, [utm, feature, isParametersInitialized])
|
}, [utm, feature, isParametersInitialized]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!!activeProduct) {
|
if (!!activeProduct) {
|
||||||
dispatch(actions.payment.update({
|
dispatch(
|
||||||
activeProduct
|
actions.payment.update({
|
||||||
}))
|
activeProduct,
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}, [activeProduct]);
|
}, [activeProduct]);
|
||||||
|
|
||||||
function onPaymentError(error?: string | undefined): void {
|
function onPaymentError(error?: string | null): void {
|
||||||
if (error === "Product not found") {
|
if (error === "Product not found") {
|
||||||
return navigate(routes.client.compatibilityV2TrialChoice());
|
return navigate(routes.client.compatibilityV2TrialChoice());
|
||||||
}
|
}
|
||||||
@ -71,7 +73,7 @@ function AnonymousPaymentPage() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
{!!activeProductFromStore && session?.["aura.test.payment"]?.length ?
|
{!!activeProductFromStore && session?.["aura.test.payment"]?.length ? (
|
||||||
<PaymentPage
|
<PaymentPage
|
||||||
// placementKey={EPlacementKeys["aura.placement.payment"]}
|
// placementKey={EPlacementKeys["aura.placement.payment"]}
|
||||||
funnel={ELocalesPlacement.EmailGenerator}
|
funnel={ELocalesPlacement.EmailGenerator}
|
||||||
@ -82,11 +84,11 @@ function AnonymousPaymentPage() {
|
|||||||
isAnonymous={true}
|
isAnonymous={true}
|
||||||
sessionId={session?.["aura.test.payment"]}
|
sessionId={session?.["aura.test.payment"]}
|
||||||
/>
|
/>
|
||||||
:
|
) : (
|
||||||
<Loader color={LoaderColor.Black} />
|
<Loader color={LoaderColor.Black} />
|
||||||
}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AnonymousPaymentPage
|
export default AnonymousPaymentPage;
|
||||||
|
|||||||
@ -22,7 +22,7 @@ interface ICheckoutFormProps {
|
|||||||
funnel: ELocalesPlacement;
|
funnel: ELocalesPlacement;
|
||||||
paymentPlacement: string;
|
paymentPlacement: string;
|
||||||
onSuccess?: () => void;
|
onSuccess?: () => void;
|
||||||
onError?: (error?: string) => void;
|
onError?: (error?: string | null) => void;
|
||||||
onModalClosed?: () => void;
|
onModalClosed?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,14 +66,15 @@ export default function CheckoutForm({
|
|||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (error && onError) {
|
// if (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
if (error === "card_type_error") {
|
if (error === "card_type_error") {
|
||||||
return setIsCardTypeError(true);
|
return setIsCardTypeError(true);
|
||||||
|
} else {
|
||||||
|
setIsCardTypeError(false);
|
||||||
}
|
}
|
||||||
|
onError?.(error);
|
||||||
onError(error);
|
// }
|
||||||
}
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [error]);
|
}, [error]);
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ const getPrice = (product: IFunnelPaymentVariant | null) => {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return (product.trialPrice || 0) / 100;
|
return (product.trialPrice || 0) / 100;
|
||||||
}
|
};
|
||||||
|
|
||||||
interface IPaymentFormProps {
|
interface IPaymentFormProps {
|
||||||
isSinglePayment?: boolean;
|
isSinglePayment?: boolean;
|
||||||
@ -23,7 +23,7 @@ interface IPaymentFormProps {
|
|||||||
funnel: ELocalesPlacement;
|
funnel: ELocalesPlacement;
|
||||||
paymentPlacement: string;
|
paymentPlacement: string;
|
||||||
trialInterval: number;
|
trialInterval: number;
|
||||||
onPaymentError?: (error?: string) => void;
|
onPaymentError?: (error?: string | null) => void;
|
||||||
onPaymentSuccess?: () => void;
|
onPaymentSuccess?: () => void;
|
||||||
onModalClosed?: () => void;
|
onModalClosed?: () => void;
|
||||||
}
|
}
|
||||||
@ -36,7 +36,7 @@ function PaymentForm({
|
|||||||
trialInterval,
|
trialInterval,
|
||||||
onPaymentError,
|
onPaymentError,
|
||||||
onPaymentSuccess,
|
onPaymentSuccess,
|
||||||
onModalClosed
|
onModalClosed,
|
||||||
}: IPaymentFormProps) {
|
}: IPaymentFormProps) {
|
||||||
const { translate } = useTranslations(ELocalesPlacement.V1);
|
const { translate } = useTranslations(ELocalesPlacement.V1);
|
||||||
const currency = useSelector(selectors.selectCurrency);
|
const currency = useSelector(selectors.selectCurrency);
|
||||||
@ -48,9 +48,9 @@ function PaymentForm({
|
|||||||
{
|
{
|
||||||
id: EPaymentMethod.CREDIT_CARD,
|
id: EPaymentMethod.CREDIT_CARD,
|
||||||
icon: "/payment-form/credit-card.svg",
|
icon: "/payment-form/credit-card.svg",
|
||||||
title: translate("payment_modal.credit_card")
|
title: translate("payment_modal.credit_card"),
|
||||||
}
|
},
|
||||||
]
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -62,11 +62,15 @@ function PaymentForm({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div
|
<div
|
||||||
className={`${styles["payment-modal"]} ${isLoading ? styles.hide : ""} ${className}`}
|
className={`${styles["payment-modal"]} ${
|
||||||
|
isLoading ? styles.hide : ""
|
||||||
|
} ${className}`}
|
||||||
>
|
>
|
||||||
{!isSinglePayment && <Title variant="h3" className={styles.title}>
|
{!isSinglePayment && (
|
||||||
|
<Title variant="h3" className={styles.title}>
|
||||||
{translate("payment_modal.title")}
|
{translate("payment_modal.title")}
|
||||||
</Title>}
|
</Title>
|
||||||
|
)}
|
||||||
<PaymentMethodsChoice
|
<PaymentMethodsChoice
|
||||||
paymentMethods={paymentMethodsButtons}
|
paymentMethods={paymentMethodsButtons}
|
||||||
selectedPaymentMethod={paymentMethodsButtons[0].id}
|
selectedPaymentMethod={paymentMethodsButtons[0].id}
|
||||||
@ -95,19 +99,21 @@ function PaymentForm({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className={styles["payment-method-container"]}>
|
<div className={styles["payment-method-container"]}>
|
||||||
{!!activeProduct && <CheckoutForm
|
{!!activeProduct && (
|
||||||
|
<CheckoutForm
|
||||||
funnel={funnel}
|
funnel={funnel}
|
||||||
paymentPlacement={paymentPlacement}
|
paymentPlacement={paymentPlacement}
|
||||||
activeProduct={activeProduct}
|
activeProduct={activeProduct}
|
||||||
onError={onPaymentError}
|
onError={onPaymentError}
|
||||||
onSuccess={onPaymentSuccess}
|
onSuccess={onPaymentSuccess}
|
||||||
onModalClosed={onModalClosed}
|
onModalClosed={onModalClosed}
|
||||||
/>}
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<p className={styles.address}>{translate("payment_modal.address")}</p>
|
<p className={styles.address}>{translate("payment_modal.address")}</p>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default PaymentForm
|
export default PaymentForm;
|
||||||
|
|||||||
@ -28,7 +28,7 @@ interface IPaymentPageProps {
|
|||||||
sessionId?: string;
|
sessionId?: string;
|
||||||
funnel: ELocalesPlacement;
|
funnel: ELocalesPlacement;
|
||||||
paymentPlacement: string;
|
paymentPlacement: string;
|
||||||
onError?: (error?: string) => void;
|
onError?: (error?: string | null) => void;
|
||||||
onSuccess?: () => void;
|
onSuccess?: () => void;
|
||||||
onBack?: () => void;
|
onBack?: () => void;
|
||||||
onPopState?: () => void;
|
onPopState?: () => void;
|
||||||
@ -89,7 +89,8 @@ function PaymentPage({
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
function onPaymentError(error?: string | undefined): void {
|
function onPaymentError(error?: string | null): void {
|
||||||
|
if (error) {
|
||||||
setIsPaymentError(true);
|
setIsPaymentError(true);
|
||||||
if (error !== "Product not found") {
|
if (error !== "Product not found") {
|
||||||
metricService.reachGoal(EGoals.PAYMENT_ERROR, [
|
metricService.reachGoal(EGoals.PAYMENT_ERROR, [
|
||||||
@ -97,6 +98,9 @@ function PaymentPage({
|
|||||||
EMetrics.KLAVIYO,
|
EMetrics.KLAVIYO,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
setIsPaymentError(false);
|
||||||
|
}
|
||||||
onError?.(error);
|
onError?.(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -263,6 +263,7 @@ export const usePayment = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const submitInlineForm = (address?: AddressFields) => {
|
const submitInlineForm = (address?: AddressFields) => {
|
||||||
|
setError(null);
|
||||||
if (address) {
|
if (address) {
|
||||||
addressRef.current = address;
|
addressRef.current = address;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,12 +59,12 @@ function CompatibilityV2Routes() {
|
|||||||
const { setTheme } = useTheme();
|
const { setTheme } = useTheme();
|
||||||
|
|
||||||
const { isReady, variant: darkThemeCompatibilityV2Variant } = useUnleash({
|
const { isReady, variant: darkThemeCompatibilityV2Variant } = useUnleash({
|
||||||
flag: EUnleashFlags.darkThemeCompatibilityV2
|
flag: EUnleashFlags.darkThemeCompatibilityV2,
|
||||||
})
|
});
|
||||||
|
|
||||||
const { funnelData } = useFunnel({
|
const { funnelData } = useFunnel({
|
||||||
funnel: ELocalesPlacement.CompatibilityV2,
|
funnel: ELocalesPlacement.CompatibilityV2,
|
||||||
paymentPlacement: ""
|
paymentPlacement: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
const availablePaths = useMemo(() => {
|
const availablePaths = useMemo(() => {
|
||||||
@ -95,7 +95,7 @@ function CompatibilityV2Routes() {
|
|||||||
dispatch(actions.compatibilityV2.update({ fromRedesign: true }));
|
dispatch(actions.compatibilityV2.update({ fromRedesign: true }));
|
||||||
}, [dispatch]);
|
}, [dispatch]);
|
||||||
|
|
||||||
function onPaymentError(error?: string | undefined): void {
|
function onPaymentError(error?: string | null): void {
|
||||||
if (error === "Product not found") {
|
if (error === "Product not found") {
|
||||||
return navigate(routes.client.compatibilityV2TrialChoice());
|
return navigate(routes.client.compatibilityV2TrialChoice());
|
||||||
}
|
}
|
||||||
@ -115,14 +115,18 @@ function CompatibilityV2Routes() {
|
|||||||
function onPopState(): void {
|
function onPopState(): void {
|
||||||
if (!availablePaths.main_secret_discount) return;
|
if (!availablePaths.main_secret_discount) return;
|
||||||
if (
|
if (
|
||||||
document.location.toString() === `${window.location.origin}${routes.client.compatibilityV2Payment()}` ||
|
document.location.toString() ===
|
||||||
document.location.toString() === `${window.location.origin}${routes.client.compatibilityV2TrialPayment()}`
|
`${window.location.origin}${routes.client.compatibilityV2Payment()}` ||
|
||||||
|
document.location.toString() ===
|
||||||
|
`${
|
||||||
|
window.location.origin
|
||||||
|
}${routes.client.compatibilityV2TrialPayment()}`
|
||||||
) {
|
) {
|
||||||
navigate(routes.client.compatibilityV2SaveOff());
|
navigate(routes.client.compatibilityV2SaveOff());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPaymentErrorDiscount(error?: string | undefined): void {
|
function onPaymentErrorDiscount(error?: string | null): void {
|
||||||
if (error === "Product not found") {
|
if (error === "Product not found") {
|
||||||
return navigate(routes.client.compatibilityV2SecretDiscount());
|
return navigate(routes.client.compatibilityV2SecretDiscount());
|
||||||
}
|
}
|
||||||
@ -140,20 +144,22 @@ function CompatibilityV2Routes() {
|
|||||||
}
|
}
|
||||||
return () => {
|
return () => {
|
||||||
setTheme(ESiteTheme.Light);
|
setTheme(ESiteTheme.Light);
|
||||||
}
|
};
|
||||||
}, [darkThemeCompatibilityV2Variant])
|
}, [darkThemeCompatibilityV2Variant]);
|
||||||
|
|
||||||
if (!isReady) {
|
if (!isReady) {
|
||||||
return <div
|
return (
|
||||||
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
height: "100dvh"
|
height: "100dvh",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Loader color={LoaderColor.Black} />
|
<Loader color={LoaderColor.Black} />
|
||||||
</div>
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -171,19 +177,21 @@ function CompatibilityV2Routes() {
|
|||||||
funnel={ELocalesPlacement.CompatibilityV2}
|
funnel={ELocalesPlacement.CompatibilityV2}
|
||||||
paymentPlacement="add_consultant"
|
paymentPlacement="add_consultant"
|
||||||
nextRoute={
|
nextRoute={
|
||||||
availablePaths.add_guides ?
|
availablePaths.add_guides
|
||||||
routes.client.compatibilityV2AddGuides() :
|
? routes.client.compatibilityV2AddGuides()
|
||||||
`${routes.client.getInformationPartner()}?path=back`
|
: `${routes.client.getInformationPartner()}?path=back`
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV2AddGuides())}
|
path={removePrefix(routes.client.compatibilityV2AddGuides())}
|
||||||
element={<AddGuides
|
element={
|
||||||
|
<AddGuides
|
||||||
funnel={ELocalesPlacement.CompatibilityV2}
|
funnel={ELocalesPlacement.CompatibilityV2}
|
||||||
paymentPlacement="add_guides"
|
paymentPlacement="add_guides"
|
||||||
/>}
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
</Route>
|
</Route>
|
||||||
@ -196,23 +204,29 @@ function CompatibilityV2Routes() {
|
|||||||
>
|
>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV2PaymentModal())}
|
path={removePrefix(routes.client.compatibilityV2PaymentModal())}
|
||||||
element={<PaymentPage
|
element={
|
||||||
|
<PaymentPage
|
||||||
funnel={ELocalesPlacement.CompatibilityV2}
|
funnel={ELocalesPlacement.CompatibilityV2}
|
||||||
paymentPlacement="main"
|
paymentPlacement="main"
|
||||||
onError={onPaymentError}
|
onError={onPaymentError}
|
||||||
onSuccess={onPaymentSuccess}
|
onSuccess={onPaymentSuccess}
|
||||||
onBack={onBack}
|
onBack={onBack}
|
||||||
onPopState={onPopState}
|
onPopState={onPopState}
|
||||||
/>}
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV2SecretDiscountPaymentModal())}
|
path={removePrefix(
|
||||||
element={<PaymentPage
|
routes.client.compatibilityV2SecretDiscountPaymentModal()
|
||||||
|
)}
|
||||||
|
element={
|
||||||
|
<PaymentPage
|
||||||
funnel={ELocalesPlacement.CompatibilityV2}
|
funnel={ELocalesPlacement.CompatibilityV2}
|
||||||
paymentPlacement="main_secret_discount"
|
paymentPlacement="main_secret_discount"
|
||||||
onError={onPaymentErrorDiscount}
|
onError={onPaymentErrorDiscount}
|
||||||
onSuccess={onPaymentSuccessDiscount}
|
onSuccess={onPaymentSuccessDiscount}
|
||||||
/>}
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route
|
<Route
|
||||||
@ -258,7 +272,9 @@ function CompatibilityV2Routes() {
|
|||||||
element={<Birthdate />}
|
element={<Birthdate />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV2BirthdatePartner())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV2BirthdatePartner()
|
||||||
|
)}
|
||||||
element={<BirthdatePartner />}
|
element={<BirthdatePartner />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
@ -266,11 +282,15 @@ function CompatibilityV2Routes() {
|
|||||||
element={<DateEvent />}
|
element={<DateEvent />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV2PalmsInformation())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV2PalmsInformation()
|
||||||
|
)}
|
||||||
element={<PalmsInformation />}
|
element={<PalmsInformation />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV2PalmsInformationPartner())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV2PalmsInformationPartner()
|
||||||
|
)}
|
||||||
element={<PalmsInformationPartner />}
|
element={<PalmsInformationPartner />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
@ -296,11 +316,15 @@ function CompatibilityV2Routes() {
|
|||||||
element={<CheckingPhone />}
|
element={<CheckingPhone />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV2ElementResonates())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV2ElementResonates()
|
||||||
|
)}
|
||||||
element={<ElementResonates />}
|
element={<ElementResonates />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV2FavoriteColor())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV2FavoriteColor()
|
||||||
|
)}
|
||||||
element={<FavoriteColor />}
|
element={<FavoriteColor />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
@ -314,7 +338,9 @@ function CompatibilityV2Routes() {
|
|||||||
element={<HeadOrHeartResult />}
|
element={<HeadOrHeartResult />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV2RelateFollowing())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV2RelateFollowing()
|
||||||
|
)}
|
||||||
element={<RelateFollowing />}
|
element={<RelateFollowing />}
|
||||||
>
|
>
|
||||||
<Route path=":questionId" element={<RelateFollowing />} />
|
<Route path=":questionId" element={<RelateFollowing />} />
|
||||||
@ -329,7 +355,9 @@ function CompatibilityV2Routes() {
|
|||||||
element={<LetScan />}
|
element={<LetScan />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV2ScanInstruction())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV2ScanInstruction()
|
||||||
|
)}
|
||||||
element={<ScanInstruction />}
|
element={<ScanInstruction />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
@ -342,7 +370,9 @@ function CompatibilityV2Routes() {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV2TrialChoiceVideo())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV2TrialChoiceVideo()
|
||||||
|
)}
|
||||||
element={<TrialChoiceVideo />}
|
element={<TrialChoiceVideo />}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@ -57,7 +57,7 @@ function CompatibilityV3Routes() {
|
|||||||
|
|
||||||
const { funnelData } = useFunnel({
|
const { funnelData } = useFunnel({
|
||||||
funnel: ELocalesPlacement.CompatibilityV3,
|
funnel: ELocalesPlacement.CompatibilityV3,
|
||||||
paymentPlacement: ""
|
paymentPlacement: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
const availablePaths = useMemo(() => {
|
const availablePaths = useMemo(() => {
|
||||||
@ -88,7 +88,7 @@ function CompatibilityV3Routes() {
|
|||||||
dispatch(actions.compatibilityV3.update({ fromRedesign: true }));
|
dispatch(actions.compatibilityV3.update({ fromRedesign: true }));
|
||||||
}, [dispatch]);
|
}, [dispatch]);
|
||||||
|
|
||||||
function onPaymentError(error?: string | undefined): void {
|
function onPaymentError(error?: string | null): void {
|
||||||
if (error === "Product not found") {
|
if (error === "Product not found") {
|
||||||
return navigate(routes.client.compatibilityV3TrialChoice());
|
return navigate(routes.client.compatibilityV3TrialChoice());
|
||||||
}
|
}
|
||||||
@ -108,14 +108,18 @@ function CompatibilityV3Routes() {
|
|||||||
function onPopState(): void {
|
function onPopState(): void {
|
||||||
if (!availablePaths.main_secret_discount) return;
|
if (!availablePaths.main_secret_discount) return;
|
||||||
if (
|
if (
|
||||||
document.location.toString() === `${window.location.origin}${routes.client.compatibilityV3Payment()}` ||
|
document.location.toString() ===
|
||||||
document.location.toString() === `${window.location.origin}${routes.client.compatibilityV3TrialPayment()}`
|
`${window.location.origin}${routes.client.compatibilityV3Payment()}` ||
|
||||||
|
document.location.toString() ===
|
||||||
|
`${
|
||||||
|
window.location.origin
|
||||||
|
}${routes.client.compatibilityV3TrialPayment()}`
|
||||||
) {
|
) {
|
||||||
navigate(routes.client.compatibilityV3SaveOff());
|
navigate(routes.client.compatibilityV3SaveOff());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPaymentErrorDiscount(error?: string | undefined): void {
|
function onPaymentErrorDiscount(error?: string | null): void {
|
||||||
if (error === "Product not found") {
|
if (error === "Product not found") {
|
||||||
return navigate(routes.client.compatibilityV3SecretDiscount());
|
return navigate(routes.client.compatibilityV3SecretDiscount());
|
||||||
}
|
}
|
||||||
@ -142,19 +146,21 @@ function CompatibilityV3Routes() {
|
|||||||
funnel={ELocalesPlacement.CompatibilityV3}
|
funnel={ELocalesPlacement.CompatibilityV3}
|
||||||
paymentPlacement="add_consultant"
|
paymentPlacement="add_consultant"
|
||||||
nextRoute={
|
nextRoute={
|
||||||
availablePaths.add_guides ?
|
availablePaths.add_guides
|
||||||
routes.client.compatibilityV3AddGuides() :
|
? routes.client.compatibilityV3AddGuides()
|
||||||
`${routes.client.getInformationPartner()}?path=back`
|
: `${routes.client.getInformationPartner()}?path=back`
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV3AddGuides())}
|
path={removePrefix(routes.client.compatibilityV3AddGuides())}
|
||||||
element={<AddGuides
|
element={
|
||||||
|
<AddGuides
|
||||||
funnel={ELocalesPlacement.CompatibilityV3}
|
funnel={ELocalesPlacement.CompatibilityV3}
|
||||||
paymentPlacement="add_guides"
|
paymentPlacement="add_guides"
|
||||||
/>}
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
</Route>
|
</Route>
|
||||||
@ -167,23 +173,29 @@ function CompatibilityV3Routes() {
|
|||||||
>
|
>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV3PaymentModal())}
|
path={removePrefix(routes.client.compatibilityV3PaymentModal())}
|
||||||
element={<PaymentPage
|
element={
|
||||||
|
<PaymentPage
|
||||||
funnel={ELocalesPlacement.CompatibilityV3}
|
funnel={ELocalesPlacement.CompatibilityV3}
|
||||||
paymentPlacement="main"
|
paymentPlacement="main"
|
||||||
onError={onPaymentError}
|
onError={onPaymentError}
|
||||||
onSuccess={onPaymentSuccess}
|
onSuccess={onPaymentSuccess}
|
||||||
onBack={onBack}
|
onBack={onBack}
|
||||||
onPopState={onPopState}
|
onPopState={onPopState}
|
||||||
/>}
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV3SecretDiscountPaymentModal())}
|
path={removePrefix(
|
||||||
element={<PaymentPage
|
routes.client.compatibilityV3SecretDiscountPaymentModal()
|
||||||
|
)}
|
||||||
|
element={
|
||||||
|
<PaymentPage
|
||||||
funnel={ELocalesPlacement.CompatibilityV3}
|
funnel={ELocalesPlacement.CompatibilityV3}
|
||||||
paymentPlacement="main_secret_discount"
|
paymentPlacement="main_secret_discount"
|
||||||
onError={onPaymentErrorDiscount}
|
onError={onPaymentErrorDiscount}
|
||||||
onSuccess={onPaymentSuccessDiscount}
|
onSuccess={onPaymentSuccessDiscount}
|
||||||
/>}
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route
|
<Route
|
||||||
@ -225,7 +237,9 @@ function CompatibilityV3Routes() {
|
|||||||
element={<Birthdate />}
|
element={<Birthdate />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV3BirthdatePartner())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV3BirthdatePartner()
|
||||||
|
)}
|
||||||
element={<BirthdatePartner />}
|
element={<BirthdatePartner />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
@ -233,11 +247,15 @@ function CompatibilityV3Routes() {
|
|||||||
element={<DateEvent />}
|
element={<DateEvent />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV3PalmsInformation())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV3PalmsInformation()
|
||||||
|
)}
|
||||||
element={<PalmsInformation />}
|
element={<PalmsInformation />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV3PalmsInformationPartner())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV3PalmsInformationPartner()
|
||||||
|
)}
|
||||||
element={<PalmsInformationPartner />}
|
element={<PalmsInformationPartner />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
@ -263,11 +281,15 @@ function CompatibilityV3Routes() {
|
|||||||
element={<CheckingPhone />}
|
element={<CheckingPhone />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV3ElementResonates())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV3ElementResonates()
|
||||||
|
)}
|
||||||
element={<ElementResonates />}
|
element={<ElementResonates />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV3FavoriteColor())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV3FavoriteColor()
|
||||||
|
)}
|
||||||
element={<FavoriteColor />}
|
element={<FavoriteColor />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
@ -281,7 +303,9 @@ function CompatibilityV3Routes() {
|
|||||||
element={<HeadOrHeartResult />}
|
element={<HeadOrHeartResult />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV3RelateFollowing())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV3RelateFollowing()
|
||||||
|
)}
|
||||||
element={<RelateFollowing />}
|
element={<RelateFollowing />}
|
||||||
>
|
>
|
||||||
<Route path=":questionId" element={<RelateFollowing />} />
|
<Route path=":questionId" element={<RelateFollowing />} />
|
||||||
@ -296,7 +320,9 @@ function CompatibilityV3Routes() {
|
|||||||
element={<LetScan />}
|
element={<LetScan />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV3ScanInstruction())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV3ScanInstruction()
|
||||||
|
)}
|
||||||
element={<ScanInstruction />}
|
element={<ScanInstruction />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
@ -309,7 +335,9 @@ function CompatibilityV3Routes() {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV3TrialChoiceVideo())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV3TrialChoiceVideo()
|
||||||
|
)}
|
||||||
element={<TrialChoiceVideo />}
|
element={<TrialChoiceVideo />}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@ -82,7 +82,7 @@ function CompatibilityV4Routes() {
|
|||||||
|
|
||||||
const { funnelData } = useFunnel({
|
const { funnelData } = useFunnel({
|
||||||
funnel: ELocalesPlacement.CompatibilityV4,
|
funnel: ELocalesPlacement.CompatibilityV4,
|
||||||
paymentPlacement: ""
|
paymentPlacement: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
const availablePaths = useMemo(() => {
|
const availablePaths = useMemo(() => {
|
||||||
@ -113,7 +113,7 @@ function CompatibilityV4Routes() {
|
|||||||
dispatch(actions.compatibilityV4.update({ fromRedesign: true }));
|
dispatch(actions.compatibilityV4.update({ fromRedesign: true }));
|
||||||
}, [dispatch]);
|
}, [dispatch]);
|
||||||
|
|
||||||
function onPaymentError(error?: string | undefined): void {
|
function onPaymentError(error?: string | null): void {
|
||||||
if (error === "Product not found") {
|
if (error === "Product not found") {
|
||||||
return navigate(routes.client.compatibilityV4TrialChoice());
|
return navigate(routes.client.compatibilityV4TrialChoice());
|
||||||
}
|
}
|
||||||
@ -133,14 +133,18 @@ function CompatibilityV4Routes() {
|
|||||||
function onPopState(): void {
|
function onPopState(): void {
|
||||||
if (!availablePaths.main_secret_discount) return;
|
if (!availablePaths.main_secret_discount) return;
|
||||||
if (
|
if (
|
||||||
document.location.toString() === `${window.location.origin}${routes.client.compatibilityV4Payment()}` ||
|
document.location.toString() ===
|
||||||
document.location.toString() === `${window.location.origin}${routes.client.compatibilityV4TrialPayment()}`
|
`${window.location.origin}${routes.client.compatibilityV4Payment()}` ||
|
||||||
|
document.location.toString() ===
|
||||||
|
`${
|
||||||
|
window.location.origin
|
||||||
|
}${routes.client.compatibilityV4TrialPayment()}`
|
||||||
) {
|
) {
|
||||||
navigate(routes.client.compatibilityV4SaveOff());
|
navigate(routes.client.compatibilityV4SaveOff());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPaymentErrorDiscount(error?: string | undefined): void {
|
function onPaymentErrorDiscount(error?: string | null): void {
|
||||||
if (error === "Product not found") {
|
if (error === "Product not found") {
|
||||||
return navigate(routes.client.compatibilityV4SecretDiscount());
|
return navigate(routes.client.compatibilityV4SecretDiscount());
|
||||||
}
|
}
|
||||||
@ -167,19 +171,21 @@ function CompatibilityV4Routes() {
|
|||||||
funnel={ELocalesPlacement.CompatibilityV4}
|
funnel={ELocalesPlacement.CompatibilityV4}
|
||||||
paymentPlacement="add_consultant"
|
paymentPlacement="add_consultant"
|
||||||
nextRoute={
|
nextRoute={
|
||||||
availablePaths.add_guides ?
|
availablePaths.add_guides
|
||||||
routes.client.compatibilityV4AddGuides() :
|
? routes.client.compatibilityV4AddGuides()
|
||||||
`${routes.client.getInformationPartner()}?path=back`
|
: `${routes.client.getInformationPartner()}?path=back`
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV4AddGuides())}
|
path={removePrefix(routes.client.compatibilityV4AddGuides())}
|
||||||
element={<AddGuides
|
element={
|
||||||
|
<AddGuides
|
||||||
funnel={ELocalesPlacement.CompatibilityV4}
|
funnel={ELocalesPlacement.CompatibilityV4}
|
||||||
paymentPlacement="add_guides"
|
paymentPlacement="add_guides"
|
||||||
/>}
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
</Route>
|
</Route>
|
||||||
@ -192,23 +198,29 @@ function CompatibilityV4Routes() {
|
|||||||
>
|
>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV4PaymentModal())}
|
path={removePrefix(routes.client.compatibilityV4PaymentModal())}
|
||||||
element={<PaymentPage
|
element={
|
||||||
|
<PaymentPage
|
||||||
funnel={ELocalesPlacement.CompatibilityV4}
|
funnel={ELocalesPlacement.CompatibilityV4}
|
||||||
paymentPlacement="main"
|
paymentPlacement="main"
|
||||||
onError={onPaymentError}
|
onError={onPaymentError}
|
||||||
onSuccess={onPaymentSuccess}
|
onSuccess={onPaymentSuccess}
|
||||||
onBack={onBack}
|
onBack={onBack}
|
||||||
onPopState={onPopState}
|
onPopState={onPopState}
|
||||||
/>}
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV4SecretDiscountPaymentModal())}
|
path={removePrefix(
|
||||||
element={<PaymentPage
|
routes.client.compatibilityV4SecretDiscountPaymentModal()
|
||||||
|
)}
|
||||||
|
element={
|
||||||
|
<PaymentPage
|
||||||
funnel={ELocalesPlacement.CompatibilityV4}
|
funnel={ELocalesPlacement.CompatibilityV4}
|
||||||
paymentPlacement="main_secret_discount"
|
paymentPlacement="main_secret_discount"
|
||||||
onError={onPaymentErrorDiscount}
|
onError={onPaymentErrorDiscount}
|
||||||
onSuccess={onPaymentSuccessDiscount}
|
onSuccess={onPaymentSuccessDiscount}
|
||||||
/>}
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route
|
<Route
|
||||||
@ -271,34 +283,44 @@ function CompatibilityV4Routes() {
|
|||||||
element={<HeadOrHeartResult />}
|
element={<HeadOrHeartResult />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(
|
path={removePrefix(routes.client.compatibilityV4Loading())}
|
||||||
routes.client.compatibilityV4Loading()
|
|
||||||
)}
|
|
||||||
element={<Loading />}
|
element={<Loading />}
|
||||||
/>
|
/>
|
||||||
<Route element={<StepperLayout />}>
|
<Route element={<StepperLayout />}>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV4WhatAddToAnalysis())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV4WhatAddToAnalysis()
|
||||||
|
)}
|
||||||
element={<WhatAddToAnalysis />}
|
element={<WhatAddToAnalysis />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV4PotentialPartnerName())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV4PotentialPartnerName()
|
||||||
|
)}
|
||||||
element={<PotentialPartnerName />}
|
element={<PotentialPartnerName />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV4PotentialPartnerBirthdate())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV4PotentialPartnerBirthdate()
|
||||||
|
)}
|
||||||
element={<PotentialPartnerBirthdate />}
|
element={<PotentialPartnerBirthdate />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV4FormerPartnerName())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV4FormerPartnerName()
|
||||||
|
)}
|
||||||
element={<FormerPartnerName />}
|
element={<FormerPartnerName />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV4FormerPartnerBirthdate())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV4FormerPartnerBirthdate()
|
||||||
|
)}
|
||||||
element={<FormerPartnerBirthdate />}
|
element={<FormerPartnerBirthdate />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV4GenderPartner())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV4GenderPartner()
|
||||||
|
)}
|
||||||
element={<GenderPartner />}
|
element={<GenderPartner />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
@ -310,7 +332,9 @@ function CompatibilityV4Routes() {
|
|||||||
element={<Birthplace />}
|
element={<Birthplace />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV4BirthplacePartner())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV4BirthplacePartner()
|
||||||
|
)}
|
||||||
element={<BirthplacePartner />}
|
element={<BirthplacePartner />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
@ -322,15 +346,21 @@ function CompatibilityV4Routes() {
|
|||||||
element={<YourAnalysis />}
|
element={<YourAnalysis />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV4PartnerAnalysis())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV4PartnerAnalysis()
|
||||||
|
)}
|
||||||
element={<PartnerAnalysis />}
|
element={<PartnerAnalysis />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV4ResultAnalysis())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV4ResultAnalysis()
|
||||||
|
)}
|
||||||
element={<ResultAnalysis />}
|
element={<ResultAnalysis />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV4PartnerSimilarity())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV4PartnerSimilarity()
|
||||||
|
)}
|
||||||
element={<PartnerSimilarity />}
|
element={<PartnerSimilarity />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
@ -338,7 +368,9 @@ function CompatibilityV4Routes() {
|
|||||||
element={<ReviewPage />}
|
element={<ReviewPage />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV4BirthdatePartner())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV4BirthdatePartner()
|
||||||
|
)}
|
||||||
element={<BirthdatePartner />}
|
element={<BirthdatePartner />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
@ -346,11 +378,15 @@ function CompatibilityV4Routes() {
|
|||||||
element={<DateEvent />}
|
element={<DateEvent />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV4PalmsInformation())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV4PalmsInformation()
|
||||||
|
)}
|
||||||
element={<PalmsInformation />}
|
element={<PalmsInformation />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV4PalmsInformationPartner())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV4PalmsInformationPartner()
|
||||||
|
)}
|
||||||
element={<PalmsInformationPartner />}
|
element={<PalmsInformationPartner />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
@ -370,9 +406,7 @@ function CompatibilityV4Routes() {
|
|||||||
element={<CalculateInAdvance />}
|
element={<CalculateInAdvance />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(
|
path={removePrefix(routes.client.compatibilityV4AlmostThere())}
|
||||||
routes.client.compatibilityV4AlmostThere()
|
|
||||||
)}
|
|
||||||
element={<AlmostThere />}
|
element={<AlmostThere />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
@ -400,9 +434,7 @@ function CompatibilityV4Routes() {
|
|||||||
element={<YourInclination />}
|
element={<YourInclination />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(
|
path={removePrefix(routes.client.compatibilityV4YourFear())}
|
||||||
routes.client.compatibilityV4YourFear()
|
|
||||||
)}
|
|
||||||
element={<YourFear />}
|
element={<YourFear />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
@ -418,11 +450,15 @@ function CompatibilityV4Routes() {
|
|||||||
element={<StressResponse />}
|
element={<StressResponse />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV4ElementResonates())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV4ElementResonates()
|
||||||
|
)}
|
||||||
element={<ElementResonates />}
|
element={<ElementResonates />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV4FavoriteColor())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV4FavoriteColor()
|
||||||
|
)}
|
||||||
element={<FavoriteColor />}
|
element={<FavoriteColor />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
@ -430,7 +466,9 @@ function CompatibilityV4Routes() {
|
|||||||
element={<HeadOrHeart />}
|
element={<HeadOrHeart />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV4RelateFollowing())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV4RelateFollowing()
|
||||||
|
)}
|
||||||
element={<RelateFollowing />}
|
element={<RelateFollowing />}
|
||||||
>
|
>
|
||||||
<Route path=":questionId" element={<RelateFollowing />} />
|
<Route path=":questionId" element={<RelateFollowing />} />
|
||||||
@ -445,7 +483,9 @@ function CompatibilityV4Routes() {
|
|||||||
element={<LetScan />}
|
element={<LetScan />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV4ScanInstruction())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV4ScanInstruction()
|
||||||
|
)}
|
||||||
element={<ScanInstruction />}
|
element={<ScanInstruction />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
@ -458,7 +498,9 @@ function CompatibilityV4Routes() {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV4TrialChoiceVideo())}
|
path={removePrefix(
|
||||||
|
routes.client.compatibilityV4TrialChoiceVideo()
|
||||||
|
)}
|
||||||
element={<TrialChoiceVideo />}
|
element={<TrialChoiceVideo />}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ const removePrefix = (path: string) => path.replace(emailMarketingV1Prefix, "");
|
|||||||
function MarketingLandingV1Routes() {
|
function MarketingLandingV1Routes() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
function onPaymentError(error?: string | undefined): void {
|
function onPaymentError(error?: string | null): void {
|
||||||
if (error === "Product not found") {
|
if (error === "Product not found") {
|
||||||
return navigate(routes.client.emailMarketingV1SpecialOffer());
|
return navigate(routes.client.emailMarketingV1SpecialOffer());
|
||||||
}
|
}
|
||||||
@ -38,12 +38,15 @@ function MarketingLandingV1Routes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onPopState(): void {
|
function onPopState(): void {
|
||||||
if (document.location.toString() === `${window.location.origin}${routes.client.emailMarketingV1SpecialOffer()}`) {
|
if (
|
||||||
|
document.location.toString() ===
|
||||||
|
`${window.location.origin}${routes.client.emailMarketingV1SpecialOffer()}`
|
||||||
|
) {
|
||||||
navigate(routes.client.emailMarketingV1SaveOff());
|
navigate(routes.client.emailMarketingV1SaveOff());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPaymentErrorDiscount(error?: string | undefined): void {
|
function onPaymentErrorDiscount(error?: string | null): void {
|
||||||
if (error === "Product not found") {
|
if (error === "Product not found") {
|
||||||
return navigate(routes.client.emailMarketingV1SecretDiscount());
|
return navigate(routes.client.emailMarketingV1SecretDiscount());
|
||||||
}
|
}
|
||||||
@ -69,17 +72,21 @@ function MarketingLandingV1Routes() {
|
|||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.emailMarketingV1AddConsultant())}
|
path={removePrefix(routes.client.emailMarketingV1AddConsultant())}
|
||||||
element={<AddConsultant
|
element={
|
||||||
|
<AddConsultant
|
||||||
funnel={ELocalesPlacement.EmailMarketingCompatibilityV1}
|
funnel={ELocalesPlacement.EmailMarketingCompatibilityV1}
|
||||||
paymentPlacement="add_consultant"
|
paymentPlacement="add_consultant"
|
||||||
/>}
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.emailMarketingV1AddGuides())}
|
path={removePrefix(routes.client.emailMarketingV1AddGuides())}
|
||||||
element={<AddGuides
|
element={
|
||||||
|
<AddGuides
|
||||||
funnel={ELocalesPlacement.EmailMarketingCompatibilityV1}
|
funnel={ELocalesPlacement.EmailMarketingCompatibilityV1}
|
||||||
paymentPlacement="add_guides"
|
paymentPlacement="add_guides"
|
||||||
/>}
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
</Route>
|
</Route>
|
||||||
@ -92,26 +99,38 @@ function MarketingLandingV1Routes() {
|
|||||||
>
|
>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.emailMarketingV1PaymentModal())}
|
path={removePrefix(routes.client.emailMarketingV1PaymentModal())}
|
||||||
element={<PaymentPage
|
element={
|
||||||
|
<PaymentPage
|
||||||
funnel={ELocalesPlacement.EmailMarketingCompatibilityV1}
|
funnel={ELocalesPlacement.EmailMarketingCompatibilityV1}
|
||||||
paymentPlacement="main"
|
paymentPlacement="main"
|
||||||
onError={onPaymentError}
|
onError={onPaymentError}
|
||||||
onSuccess={onPaymentSuccess}
|
onSuccess={onPaymentSuccess}
|
||||||
onBack={onBack}
|
onBack={onBack}
|
||||||
onPopState={onPopState}
|
onPopState={onPopState}
|
||||||
/>}
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.emailMarketingV1SecretDiscountPaymentModal())}
|
path={removePrefix(
|
||||||
element={<PaymentPage
|
routes.client.emailMarketingV1SecretDiscountPaymentModal()
|
||||||
|
)}
|
||||||
|
element={
|
||||||
|
<PaymentPage
|
||||||
funnel={ELocalesPlacement.EmailMarketingCompatibilityV1}
|
funnel={ELocalesPlacement.EmailMarketingCompatibilityV1}
|
||||||
paymentPlacement="main_secret_discount"
|
paymentPlacement="main_secret_discount"
|
||||||
onError={onPaymentErrorDiscount}
|
onError={onPaymentErrorDiscount}
|
||||||
onSuccess={onPaymentSuccessDiscount}
|
onSuccess={onPaymentSuccessDiscount}
|
||||||
/>}
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route element={<div className={styles.container}><Outlet /></div>}>
|
<Route
|
||||||
|
element={
|
||||||
|
<div className={styles.container}>
|
||||||
|
<Outlet />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.emailMarketingV1Landing())}
|
path={removePrefix(routes.client.emailMarketingV1Landing())}
|
||||||
element={<MarketingLanding />}
|
element={<MarketingLanding />}
|
||||||
|
|||||||
@ -62,19 +62,19 @@ const availableUrlsDarkTheme = [
|
|||||||
routes.client.palmistryV1Camera(),
|
routes.client.palmistryV1Camera(),
|
||||||
routes.client.palmistryV1ScannedPhoto(),
|
routes.client.palmistryV1ScannedPhoto(),
|
||||||
routes.client.palmistryV1Email(),
|
routes.client.palmistryV1Email(),
|
||||||
]
|
];
|
||||||
|
|
||||||
function PalmistryV1Routes() {
|
function PalmistryV1Routes() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
const { isReady, variant: darkThemePalmistryV1Variant } = useUnleash({
|
const { isReady, variant: darkThemePalmistryV1Variant } = useUnleash({
|
||||||
flag: EUnleashFlags.darkThemePalmistryV1
|
flag: EUnleashFlags.darkThemePalmistryV1,
|
||||||
})
|
});
|
||||||
|
|
||||||
const { funnelData } = useFunnel({
|
const { funnelData } = useFunnel({
|
||||||
funnel: ELocalesPlacement.PalmistryV1,
|
funnel: ELocalesPlacement.PalmistryV1,
|
||||||
paymentPlacement: ""
|
paymentPlacement: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
const availablePaths = useMemo(() => {
|
const availablePaths = useMemo(() => {
|
||||||
@ -105,7 +105,7 @@ function PalmistryV1Routes() {
|
|||||||
dispatch(actions.palmistry.update({ fromRedesign: true }));
|
dispatch(actions.palmistry.update({ fromRedesign: true }));
|
||||||
}, [dispatch]);
|
}, [dispatch]);
|
||||||
|
|
||||||
function onPaymentError(error?: string | undefined): void {
|
function onPaymentError(error?: string | null): void {
|
||||||
if (error === "Product not found") {
|
if (error === "Product not found") {
|
||||||
return navigate(routes.client.palmistryV1TrialChoice());
|
return navigate(routes.client.palmistryV1TrialChoice());
|
||||||
}
|
}
|
||||||
@ -125,14 +125,16 @@ function PalmistryV1Routes() {
|
|||||||
function onPopState(): void {
|
function onPopState(): void {
|
||||||
if (!availablePaths.main_secret_discount) return;
|
if (!availablePaths.main_secret_discount) return;
|
||||||
if (
|
if (
|
||||||
document.location.toString() === `${window.location.origin}${routes.client.palmistryV1Payment()}` ||
|
document.location.toString() ===
|
||||||
document.location.toString() === `${window.location.origin}${routes.client.palmistryV1TrialPayment()}`
|
`${window.location.origin}${routes.client.palmistryV1Payment()}` ||
|
||||||
|
document.location.toString() ===
|
||||||
|
`${window.location.origin}${routes.client.palmistryV1TrialPayment()}`
|
||||||
) {
|
) {
|
||||||
navigate(routes.client.palmistryV1SaveOff());
|
navigate(routes.client.palmistryV1SaveOff());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPaymentErrorDiscount(error?: string | undefined): void {
|
function onPaymentErrorDiscount(error?: string | null): void {
|
||||||
if (error === "Product not found") {
|
if (error === "Product not found") {
|
||||||
return navigate(routes.client.palmistryV1SecretDiscount());
|
return navigate(routes.client.palmistryV1SecretDiscount());
|
||||||
}
|
}
|
||||||
@ -157,19 +159,21 @@ function PalmistryV1Routes() {
|
|||||||
} else {
|
} else {
|
||||||
document.body.classList.remove("dark-theme");
|
document.body.classList.remove("dark-theme");
|
||||||
}
|
}
|
||||||
}, [window.location.pathname])
|
}, [window.location.pathname]);
|
||||||
|
|
||||||
if (!isReady) {
|
if (!isReady) {
|
||||||
return <div
|
return (
|
||||||
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
height: "100dvh"
|
height: "100dvh",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Loader color={LoaderColor.Black} />
|
<Loader color={LoaderColor.Black} />
|
||||||
</div>
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -187,19 +191,21 @@ function PalmistryV1Routes() {
|
|||||||
funnel={ELocalesPlacement.PalmistryV1}
|
funnel={ELocalesPlacement.PalmistryV1}
|
||||||
paymentPlacement="add_consultant"
|
paymentPlacement="add_consultant"
|
||||||
nextRoute={
|
nextRoute={
|
||||||
availablePaths.add_guides ?
|
availablePaths.add_guides
|
||||||
routes.client.palmistryV1AddGuides() :
|
? routes.client.palmistryV1AddGuides()
|
||||||
`${routes.client.getInformationPartner()}?path=back`
|
: `${routes.client.getInformationPartner()}?path=back`
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.palmistryV1AddGuides())}
|
path={removePrefix(routes.client.palmistryV1AddGuides())}
|
||||||
element={<AddGuides
|
element={
|
||||||
|
<AddGuides
|
||||||
funnel={ELocalesPlacement.PalmistryV1}
|
funnel={ELocalesPlacement.PalmistryV1}
|
||||||
paymentPlacement="add_guides"
|
paymentPlacement="add_guides"
|
||||||
/>}
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
</Route>
|
</Route>
|
||||||
@ -212,23 +218,29 @@ function PalmistryV1Routes() {
|
|||||||
>
|
>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.palmistryV1PaymentModal())}
|
path={removePrefix(routes.client.palmistryV1PaymentModal())}
|
||||||
element={<PaymentPage
|
element={
|
||||||
|
<PaymentPage
|
||||||
funnel={ELocalesPlacement.PalmistryV1}
|
funnel={ELocalesPlacement.PalmistryV1}
|
||||||
paymentPlacement="main"
|
paymentPlacement="main"
|
||||||
onError={onPaymentError}
|
onError={onPaymentError}
|
||||||
onSuccess={onPaymentSuccess}
|
onSuccess={onPaymentSuccess}
|
||||||
onBack={onBack}
|
onBack={onBack}
|
||||||
onPopState={onPopState}
|
onPopState={onPopState}
|
||||||
/>}
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.palmistryV1SecretDiscountPaymentModal())}
|
path={removePrefix(
|
||||||
element={<PaymentPage
|
routes.client.palmistryV1SecretDiscountPaymentModal()
|
||||||
|
)}
|
||||||
|
element={
|
||||||
|
<PaymentPage
|
||||||
funnel={ELocalesPlacement.PalmistryV1}
|
funnel={ELocalesPlacement.PalmistryV1}
|
||||||
paymentPlacement="main_secret_discount"
|
paymentPlacement="main_secret_discount"
|
||||||
onError={onPaymentErrorDiscount}
|
onError={onPaymentErrorDiscount}
|
||||||
onSuccess={onPaymentSuccessDiscount}
|
onSuccess={onPaymentSuccessDiscount}
|
||||||
/>}
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route
|
<Route
|
||||||
|
|||||||
@ -28,7 +28,7 @@ function PalmistryV2Routes() {
|
|||||||
dispatch(actions.palmistry.update({ fromRedesign: true }));
|
dispatch(actions.palmistry.update({ fromRedesign: true }));
|
||||||
}, [dispatch]);
|
}, [dispatch]);
|
||||||
|
|
||||||
function onPaymentError(error?: string | undefined): void {
|
function onPaymentError(error?: string | null): void {
|
||||||
if (error === "Product not found") {
|
if (error === "Product not found") {
|
||||||
return navigate(routes.client.palmistryV2TrialPayment());
|
return navigate(routes.client.palmistryV2TrialPayment());
|
||||||
}
|
}
|
||||||
@ -41,7 +41,10 @@ function PalmistryV2Routes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onPopState(): void {
|
function onPopState(): void {
|
||||||
if (document.location.toString() === `${window.location.origin}${routes.client.palmistryV2TrialPayment()}`) {
|
if (
|
||||||
|
document.location.toString() ===
|
||||||
|
`${window.location.origin}${routes.client.palmistryV2TrialPayment()}`
|
||||||
|
) {
|
||||||
navigate(routes.client.palmistryV2SaveOff());
|
navigate(routes.client.palmistryV2SaveOff());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -50,7 +53,7 @@ function PalmistryV2Routes() {
|
|||||||
navigate(routes.client.palmistryV2SaveOff());
|
navigate(routes.client.palmistryV2SaveOff());
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPaymentErrorDiscount(error?: string | undefined): void {
|
function onPaymentErrorDiscount(error?: string | null): void {
|
||||||
if (error === "Product not found") {
|
if (error === "Product not found") {
|
||||||
return navigate(routes.client.palmistryV2SecretDiscount());
|
return navigate(routes.client.palmistryV2SecretDiscount());
|
||||||
}
|
}
|
||||||
@ -85,10 +88,12 @@ function PalmistryV2Routes() {
|
|||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.palmistryV2AddGuides())}
|
path={removePrefix(routes.client.palmistryV2AddGuides())}
|
||||||
element={<AddGuides
|
element={
|
||||||
|
<AddGuides
|
||||||
funnel={ELocalesPlacement.EmailMarketingPalmistryV2}
|
funnel={ELocalesPlacement.EmailMarketingPalmistryV2}
|
||||||
paymentPlacement="add_guides"
|
paymentPlacement="add_guides"
|
||||||
/>}
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
</Route>
|
</Route>
|
||||||
@ -101,23 +106,29 @@ function PalmistryV2Routes() {
|
|||||||
>
|
>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.palmistryV2PaymentModal())}
|
path={removePrefix(routes.client.palmistryV2PaymentModal())}
|
||||||
element={<PaymentPage
|
element={
|
||||||
|
<PaymentPage
|
||||||
funnel={ELocalesPlacement.EmailMarketingPalmistryV2}
|
funnel={ELocalesPlacement.EmailMarketingPalmistryV2}
|
||||||
paymentPlacement="main"
|
paymentPlacement="main"
|
||||||
onError={onPaymentError}
|
onError={onPaymentError}
|
||||||
onSuccess={onPaymentSuccess}
|
onSuccess={onPaymentSuccess}
|
||||||
onBack={onBack}
|
onBack={onBack}
|
||||||
onPopState={onPopState}
|
onPopState={onPopState}
|
||||||
/>}
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.palmistryV2SecretDiscountPaymentModal())}
|
path={removePrefix(
|
||||||
element={<PaymentPage
|
routes.client.palmistryV2SecretDiscountPaymentModal()
|
||||||
|
)}
|
||||||
|
element={
|
||||||
|
<PaymentPage
|
||||||
funnel={ELocalesPlacement.EmailMarketingPalmistryV2}
|
funnel={ELocalesPlacement.EmailMarketingPalmistryV2}
|
||||||
paymentPlacement="main_secret_discount"
|
paymentPlacement="main_secret_discount"
|
||||||
onError={onPaymentErrorDiscount}
|
onError={onPaymentErrorDiscount}
|
||||||
onSuccess={onPaymentSuccessDiscount}
|
onSuccess={onPaymentSuccessDiscount}
|
||||||
/>}
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route
|
<Route
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user