Merge branch 'refs/heads/main' into develop

# Conflicts:
#	index.html
#	src/components/pages/ABDesign/v1/pages/TrialPayment/components/PaymentModal/index.tsx
#	src/components/pages/PaymentWithEmailPage/index.tsx
#	src/components/pages/TrialPayment/components/PaymentModal/index.tsx
This commit is contained in:
dev.daminik00 2024-06-01 00:40:02 +02:00
commit 94dbeea433
10 changed files with 75 additions and 11 deletions

View File

@ -2,7 +2,10 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<link rel="preload" as="image" href="/leo.webp" fetchpriority="high" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
@ -65,6 +68,50 @@
></script> -->
</head>
<body>
<!-- Yandex.Metrika counter -->
<script type="text/javascript" async="async">
(function (m, e, t, r, i, k, a) {
m[i] =
m[i] ||
function () {
(m[i].a = m[i].a || []).push(arguments);
};
m[i].l = 1 * new Date();
for (var j = 0; j < document.scripts.length; j++) {
if (document.scripts[j].src === r) {
return;
}
}
(k = e.createElement(t)),
(a = e.getElementsByTagName(t)[0]),
(k.async = 1),
(k.src = r),
a.parentNode.insertBefore(k, a);
})(
window,
document,
"script",
"https://mc.yandex.ru/metrika/tag.js",
"ym"
);
ym(95799066, "init", {
clickmap: true,
trackLinks: true,
accurateTrackBounce: true,
webvisor: true,
});
</script>
<noscript>
<div>
<img
src="https://mc.yandex.ru/watch/95799066"
style="position: absolute; left: -9999px"
alt=""
/>
</div>
</noscript>
<!-- /Yandex.Metrika counter -->
<noscript>You need to enable JavaScript to run this app.</noscript>
<noscript
><div>

View File

@ -88,6 +88,8 @@ function EmailEnterPage({
const handleClick = () => {
authorize();
if (typeof window.ym === "function")
window.ym(95799066, "reachGoal", "EnteredEmail");
};
const authorize = async () => {

View File

@ -6,6 +6,7 @@ import Title from "@/components/Title";
import MainButton from "@/components/MainButton";
import { useDispatch } from "react-redux";
import { actions } from "@/store";
import { useEffect } from "react";
function PaymentSuccessPage(): JSX.Element {
const { t } = useTranslation();
@ -16,6 +17,11 @@ function PaymentSuccessPage(): JSX.Element {
navigate(routes.client.addReport());
};
useEffect(() => {
if (typeof window.ym === "function")
window.ym(95799066, "reachGoal", "PaymentSuccess");
}, []);
return (
<section className={`${styles.page} page`}>
<img

View File

@ -93,6 +93,8 @@ function EmailEnterPage({
const handleClick = () => {
authorize();
if (typeof window.ym === "function")
window.ym(95799066, "reachGoal", "EnteredEmail");
};
const authorize = async () => {

View File

@ -143,7 +143,6 @@ function PaymentModal({
activeProduct={_activeProduct}
client_secret={clientSecret}
subscriptionReceiptId={paymentIntentId}
returnUrl={window.location.href}
/>
</div>
)}

View File

@ -4,6 +4,7 @@ import Title from "@/components/Title";
import MainButton from "@/components/MainButton";
import { useNavigate } from "react-router-dom";
import routes from "@/routes";
import { useEffect } from "react";
function SuccessPaymentPage(): JSX.Element {
const { t } = useTranslation();
@ -13,6 +14,11 @@ function SuccessPaymentPage(): JSX.Element {
? "The payment was successful"
: "The information has been sent to your email";
useEffect(() => {
if (typeof window.ym === "function")
window.ym(95799066, "reachGoal", "PaymentSuccess");
}, []);
return (
<section className={`${styles.page} page`}>
<img

View File

@ -141,7 +141,6 @@ function PaymentModal({
activeProduct={_activeProduct}
client_secret={clientSecret}
subscriptionReceiptId={paymentIntentId}
returnUrl={window.location.href}
/>
</div>
)}

View File

@ -43,6 +43,8 @@ export default function StepEmail() {
const authorize = async () => {
await authorization(email, ESourceAuthorization["aura.palmistry"]);
if (typeof window.ym === "function")
window.ym(95799066, "reachGoal", "EnteredEmail");
setIsAuth(true);
};

View File

@ -115,13 +115,14 @@ export const useAuthentication = () => {
setIsLoading(true);
const payload = getAuthorizationPayload(email, source);
const { token, userId } = await api.authorization(payload);
if (userId?.length && !!window.ym) {
const { user } = await api.getUser({ token });
if (userId?.length && !!window.ym && typeof window.ym === 'function') {
window.ym(95799066, 'userParams', {
email: user.email,
UserID: userId
})
window.ym(95799066, 'setUserID', userId);
}
const { user } = await api.getUser({ token });
signUp(token, user);
setToken(token);
dispatch(actions.status.update("registred"));

View File

@ -38,11 +38,11 @@ const init = async () => {
const isProduction = import.meta.env.MODE === "production";
// SCRIPTS TO HEAD
const yandexMetric = () => {
const script = document.createElement("script");
script.setAttribute("src", "/metrics/yandex.js");
document.head.appendChild(script);
};
// const yandexMetric = () => {
// const script = document.createElement("script");
// script.setAttribute("src", "/metrics/yandex.js");
// document.head.appendChild(script);
// };
const smartLook = () => {
if (!config.smartlook_manage) return;
@ -51,7 +51,7 @@ const init = async () => {
document.head.appendChild(script);
};
if (isProduction) {
yandexMetric();
// yandexMetric();
smartLook();
}