Compare commits
No commits in common. "e34e65b33715013f06f07f6389b9a420bc849da1" and "b952a76ccb0f4f11fdd263a127aa396e5054a3f3" have entirely different histories.
e34e65b337
...
b952a76ccb
1
.env
1
.env
|
|
@ -1,2 +1 @@
|
|||
VITE_API_BASE_URL=https://my-public-node-1.projscale.dev/api/v1
|
||||
SENTRY_DSN=https://4ef061d22eee4876ad8bb313134ebf009ed96c9da98742289ff733a301fcd184@k1.hawk.so/0
|
||||
|
|
@ -9,7 +9,6 @@
|
|||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
"@hookform/resolvers": "^3.3.4",
|
||||
"@sentry/react": "^9.1.0",
|
||||
"@ton/core": "^0.59.1",
|
||||
"@tonconnect/ui-react": "^2.0.2",
|
||||
"@vkruglikov/react-telegram-web-app": "^2.1.9",
|
||||
|
|
@ -1311,98 +1310,6 @@
|
|||
"win32"
|
||||
]
|
||||
},
|
||||
"node_modules/@sentry-internal/browser-utils": {
|
||||
"version": "9.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry-internal/browser-utils/-/browser-utils-9.1.0.tgz",
|
||||
"integrity": "sha512-S1uT+kkFlstWpwnaBTIJSwwAID8PS3aA0fIidOjNezeoUE5gOvpsjDATo9q+sl6FbGWynxMz6EnYSrq/5tuaBQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sentry/core": "9.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry-internal/feedback": {
|
||||
"version": "9.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-9.1.0.tgz",
|
||||
"integrity": "sha512-jTDCqkqH3QDC8m9WO4mB06hqnBRsl3p7ozoh0E774UvNB6blOEZjShhSGMMEy5jbbJajPWsOivCofUtFAwbfGw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sentry/core": "9.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry-internal/replay": {
|
||||
"version": "9.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry-internal/replay/-/replay-9.1.0.tgz",
|
||||
"integrity": "sha512-E2xrUoms90qvm0BVOuaZ8QfkMoTUEgoIW/35uOeaqNcL7uOIj8c5cSEQQKit2Dr7CL6W+Ci5c6Khdyd5C0NL5w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sentry-internal/browser-utils": "9.1.0",
|
||||
"@sentry/core": "9.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry-internal/replay-canvas": {
|
||||
"version": "9.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-9.1.0.tgz",
|
||||
"integrity": "sha512-gxredVe+mOgfNqDJ3dTLiRON3FK1rZ8d0LHp7TICK/umLkWFkuso0DbNeyKU+3XCEjCr9VM7ZRqTDMzmY6zyVg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sentry-internal/replay": "9.1.0",
|
||||
"@sentry/core": "9.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/browser": {
|
||||
"version": "9.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-9.1.0.tgz",
|
||||
"integrity": "sha512-G55e5j77DqRW3LkalJLAjRRfuyKrjHaKTnwIYXa6ycO+Q1+l14pEUxu+eK5Abu2rtSdViwRSb5/G6a/miSUlYA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sentry-internal/browser-utils": "9.1.0",
|
||||
"@sentry-internal/feedback": "9.1.0",
|
||||
"@sentry-internal/replay": "9.1.0",
|
||||
"@sentry-internal/replay-canvas": "9.1.0",
|
||||
"@sentry/core": "9.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/core": {
|
||||
"version": "9.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-9.1.0.tgz",
|
||||
"integrity": "sha512-djWEzSBpMgqdF3GQuxO+kXCUX+Mgq42G4Uah/HSUBvPDHKipMmyWlutGRoFyVPPOnCDgpHu3wCt83wbpEyVmDw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@sentry/react": {
|
||||
"version": "9.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@sentry/react/-/react-9.1.0.tgz",
|
||||
"integrity": "sha512-aP2sXHH+erbomuzU762ktg340IGDh8zD7ueuqwBwGu98fhCpTYsLXiS85I29tUvPLljwNU9puLPmxbgW4iZ2tQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sentry/browser": "9.1.0",
|
||||
"@sentry/core": "9.1.0",
|
||||
"hoist-non-react-statics": "^3.3.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.14.0 || 17.x || 18.x || 19.x"
|
||||
}
|
||||
},
|
||||
"node_modules/@ton/core": {
|
||||
"version": "0.59.1",
|
||||
"resolved": "https://registry.npmjs.org/@ton/core/-/core-0.59.1.tgz",
|
||||
|
|
@ -3754,6 +3661,7 @@
|
|||
"resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz",
|
||||
"integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==",
|
||||
"license": "BSD-3-Clause",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"react-is": "^16.7.0"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@hookform/resolvers": "^3.3.4",
|
||||
"@sentry/react": "^9.1.0",
|
||||
"@ton/core": "^0.59.1",
|
||||
"@tonconnect/ui-react": "^2.0.2",
|
||||
"@vkruglikov/react-telegram-web-app": "^2.1.9",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
export const Routes = {
|
||||
Root: "/uploadContent",
|
||||
ViewContent: "/viewContent",
|
||||
SentryCheck: "/sentryCheck",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,17 +7,6 @@ import { ViewContentPage } from "~/pages/view-content";
|
|||
const router = createBrowserRouter([
|
||||
{ path: Routes.Root, element: <RootPage /> },
|
||||
{ path: Routes.ViewContent, element: <ViewContentPage /> },
|
||||
{ path: Routes.SentryCheck, element: <div className="flex justify-center items-center h-screen">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary p-2 border bg-red-900"
|
||||
onClick={() => {
|
||||
throw new Error("Sentry Test Error");
|
||||
}}
|
||||
>
|
||||
Sentry Test Error
|
||||
</button>
|
||||
</div> },
|
||||
]);
|
||||
|
||||
export const AppRouter = () => {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import './shared/services/sentry/index.ts';
|
||||
import { StrictMode } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,60 +0,0 @@
|
|||
import { useHapticFeedback } from "@vkruglikov/react-telegram-web-app";
|
||||
import { Button } from "~/shared/ui/button";
|
||||
|
||||
type DisclaimerModalProps = {
|
||||
onConfirm(): void;
|
||||
};
|
||||
|
||||
export const DisclaimerModal = ({
|
||||
onConfirm,
|
||||
}: DisclaimerModalProps) => {
|
||||
const [impactOccurred] = useHapticFeedback();
|
||||
|
||||
const handleClick = (fn: () => void) => {
|
||||
impactOccurred("light");
|
||||
fn();
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className={
|
||||
"fixed left-0 top-0 z-30 flex h-full w-full items-center justify-center bg-black/80 px-[15px]"
|
||||
}
|
||||
>
|
||||
<div className={"flex flex-col gap-[30px]"}>
|
||||
<div
|
||||
className={
|
||||
"border border-white bg-[#1D1D1B] px-[10px] py-[16px] text-start flex flex-col gap-12"
|
||||
}
|
||||
>
|
||||
<p className="mt-4">
|
||||
«Внимание!
|
||||
</p>
|
||||
<p className="">
|
||||
MY снимает с себя ответственность за правомерность загрузки контента пользователем.
|
||||
</p>
|
||||
<p className="flex flex-col">
|
||||
<span className="tracking-[.25em] w-full">
|
||||
Сервис исходит из личной
|
||||
</span>
|
||||
ответственности пользователя перед законом и третьими лицами. MY категорически не приемлет любые виды пиратства, но признает за Пользователем право принятия самостоятельных решений.
|
||||
</p>
|
||||
<p className="flex flex-col">
|
||||
<span className="tracking-[.25em] w-full">
|
||||
Перед загрузкой контента
|
||||
</span>
|
||||
необходимо убедиться, что первые 30 секунд контента, которые будут использоваться для превью, не содержат материалов, нарушающих возрастное ограничение 18+»
|
||||
</p>
|
||||
<Button
|
||||
className={"mt-[20px]"}
|
||||
label={"Принять и продолжить"}
|
||||
includeArrows={false}
|
||||
onClick={() => handleClick(onConfirm)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { useEffect, useMemo, useState } from "react";
|
||||
import { useMemo } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { z } from "zod";
|
||||
|
|
@ -15,7 +15,6 @@ import { Checkbox } from "~/shared/ui/checkbox";
|
|||
import { AudioPlayer } from "~/shared/ui/audio-player";
|
||||
import { HashtagInput } from "~/shared/ui/hashtag-input";
|
||||
import { Replace } from "~/shared/ui/icons/replace";
|
||||
import { DisclaimerModal } from "./components/disclaimer-modal";
|
||||
|
||||
type DataStepProps = {
|
||||
nextStep(): void;
|
||||
|
|
@ -23,8 +22,6 @@ type DataStepProps = {
|
|||
|
||||
export const DataStep = ({ nextStep }: DataStepProps) => {
|
||||
const rootStore = useRootStore();
|
||||
const [disclaimerAccepted, setDisclaimerAccepted] = useState(false);
|
||||
|
||||
|
||||
const formSchema = useMemo(() => {
|
||||
return z.object({
|
||||
|
|
@ -67,28 +64,8 @@ export const DataStep = ({ nextStep }: DataStepProps) => {
|
|||
rootStore.setFileType('');
|
||||
}
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const storedValue = localStorage.getItem('disclaimerAccepted');
|
||||
if (storedValue === 'true') {
|
||||
setDisclaimerAccepted(true);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handleConfirmDisclaimer = () => {
|
||||
setDisclaimerAccepted(true);
|
||||
localStorage.setItem('disclaimerAccepted', 'true');
|
||||
};
|
||||
|
||||
return (
|
||||
<section className={"mt-4 px-4 pb-8"}>
|
||||
|
||||
{(rootStore.fileSrc && !disclaimerAccepted) &&
|
||||
(<DisclaimerModal
|
||||
onConfirm={() => {
|
||||
handleConfirmDisclaimer()}}
|
||||
/>)}
|
||||
|
||||
<div className={"mb-[30px] flex flex-col text-sm"}>
|
||||
<span className={"ml-4"}>/Заполните информацию о контенте</span>
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ type WelcomeStepProps = {
|
|||
export const WelcomeStep = ({ nextStep }: WelcomeStepProps) => {
|
||||
const [tonConnectUI] = useTonConnectUI();
|
||||
const [isLoaded, setLoaded] = useState(false);
|
||||
const [isConnected, setIsConnected] = useState(tonConnectUI.connected);
|
||||
|
||||
console.log("💩💩💩 enter WelcomeStep");
|
||||
|
||||
|
|
@ -19,43 +18,21 @@ export const WelcomeStep = ({ nextStep }: WelcomeStepProps) => {
|
|||
|
||||
console.log("💩💩💩 after useAuth");
|
||||
|
||||
useEffect(() => {
|
||||
localStorage.setItem('disclaimerAccepted', 'false');
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const unsubscribe = tonConnectUI.onStatusChange((wallet) => {
|
||||
setIsConnected(!!wallet);
|
||||
});
|
||||
|
||||
return () => {
|
||||
unsubscribe();
|
||||
};
|
||||
}, [tonConnectUI]);
|
||||
|
||||
const handleNextClick = async () => {
|
||||
if (tonConnectUI.connected) {
|
||||
const handleNextClick = async () => {
|
||||
if (tonConnectUI.connected) {
|
||||
await auth.mutateAsync();
|
||||
nextStep();
|
||||
} else {
|
||||
try {
|
||||
await tonConnectUI.openModal();
|
||||
await auth.mutateAsync();
|
||||
nextStep();
|
||||
} else {
|
||||
try {
|
||||
await tonConnectUI.openModal();
|
||||
await auth.mutateAsync();
|
||||
} catch (error) {
|
||||
console.error('Failed to connect or authenticate:', error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleDisconnect = async () => {
|
||||
if (isConnected){
|
||||
try {
|
||||
await tonConnectUI.disconnect();
|
||||
} catch (error) {
|
||||
console.error('Failed to disconnect:', error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to connect or authenticate:', error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// useEffect(() => {
|
||||
// const first = setTimeout(async () => {
|
||||
// console.log("💩💩💩 call auth");
|
||||
|
|
@ -97,8 +74,8 @@ export const WelcomeStep = ({ nextStep }: WelcomeStepProps) => {
|
|||
}
|
||||
|
||||
return (
|
||||
<section className={"mt-4 flex flex-col justify-between min-h-[calc(100vh-32px)] px-4"}>
|
||||
<div className="flex items-center justify-center overflow-hidden w-[100%] h-[400px]">
|
||||
<section className={"mt-4 flex flex-col px-4"}>
|
||||
<div className={"flex items-center justify-center"}>
|
||||
<img
|
||||
alt={"splash"}
|
||||
className={" w-full shrink-0"}
|
||||
|
|
@ -106,65 +83,30 @@ export const WelcomeStep = ({ nextStep }: WelcomeStepProps) => {
|
|||
/>
|
||||
</div>
|
||||
|
||||
<div className={"flex flex-col mt-4"}>
|
||||
<div className={"flex gap-2 text-sm"}>
|
||||
<span>/ Добро пожаловать в MY</span>
|
||||
<div className={"flex gap-2 text-sm"}>
|
||||
<span>/ Добро пожаловать в MY</span>
|
||||
|
||||
<div className={"flex items-center gap-0"}>
|
||||
<span>[</span>
|
||||
<div className={"mb-0.5 h-3 w-3 rounded-full bg-primary"} />
|
||||
<span>]:</span>
|
||||
</div>
|
||||
<div className={"flex items-center gap-0"}>
|
||||
<span>[</span>
|
||||
<div className={"mb-0.5 h-3 w-3 rounded-full bg-primary"} />
|
||||
<span>]:</span>
|
||||
</div>
|
||||
|
||||
|
||||
{isConnected ?
|
||||
<>
|
||||
<div className={"mt-2"}>
|
||||
<p className={"text-sm"}>
|
||||
Вы зарегистрированы под кошельком:
|
||||
<span className={"font-bold pl-1"}>{tonConnectUI.account?.address.slice(2, 9)}...{tonConnectUI.account?.address.slice(-4)}</span>
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex flex-col">
|
||||
<Button
|
||||
className={"mt-[30px]"}
|
||||
label={"Продолжить"}
|
||||
includeArrows={false}
|
||||
isLoading={auth.isLoading}
|
||||
onClick={handleNextClick}
|
||||
/>
|
||||
<Button
|
||||
className={"mt-[20px] bg-inherit"}
|
||||
label={"Изменить кошелек"}
|
||||
includeArrows={false}
|
||||
isLoading={false}
|
||||
onClick={handleDisconnect}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
:
|
||||
<>
|
||||
<div className={"mt-2"}>
|
||||
<p className={"text-sm"}>
|
||||
Здесь вы можете загрузить свой контент. <br/> Для продолжения подключите кошелек.
|
||||
</p>
|
||||
</div>
|
||||
<div className={"mt-2"}>
|
||||
<p className={"text-sm"}>
|
||||
Не волнуйтесь. Вы сможете поменять свой выбор в любой момент.
|
||||
</p>
|
||||
</div>
|
||||
<Button
|
||||
className={"mt-[30px]"}
|
||||
label={"Подключить криптокошелёк TON"}
|
||||
includeArrows={true}
|
||||
isLoading={auth.isLoading}
|
||||
onClick={handleNextClick}
|
||||
/>
|
||||
</>}
|
||||
|
||||
</div>
|
||||
|
||||
<div className={"mt-2"}>
|
||||
<p className={"text-sm"}>
|
||||
децентрализованную систему монетизации контента. для продолжения
|
||||
необходимо подключить криптокошелек TON
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
className={"mt-[30px]"}
|
||||
label={"Подключить криптокошелёк TON"}
|
||||
includeArrows={true}
|
||||
isLoading={auth.isLoading}
|
||||
onClick={handleNextClick}
|
||||
/>
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
import { useHapticFeedback } from "@vkruglikov/react-telegram-web-app";
|
||||
import { Button } from "~/shared/ui/button";
|
||||
|
||||
type CongratsModalProps = {
|
||||
onConfirm(): void;
|
||||
};
|
||||
|
||||
export const CongratsModal = ({
|
||||
onConfirm,
|
||||
}: CongratsModalProps) => {
|
||||
const [impactOccurred] = useHapticFeedback();
|
||||
|
||||
const handleClick = (fn: () => void) => {
|
||||
impactOccurred("light");
|
||||
fn();
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className={
|
||||
"fixed left-0 top-0 z-30 flex h-full w-full items-center justify-center bg-black/80 px-[15px]"
|
||||
}
|
||||
>
|
||||
<div className={"flex flex-col gap-[30px]"}>
|
||||
<div
|
||||
className={
|
||||
"border border-white bg-[#1D1D1B] px-[10px] py-[16px] text-start flex flex-col gap-12"
|
||||
}
|
||||
>
|
||||
<p className="mt-12">
|
||||
<span className="text-xl">🎉</span>
|
||||
<span className="px-1 font-bold">Поздравляем с покупкой!</span>
|
||||
<span className="text-xl">🎉</span>
|
||||
</p>
|
||||
<p className="">
|
||||
Ваш контент уже в пути! В ближайшее время в чат-боте <strong>MY Player</strong> вам придёт сообщение с доступом к купленному материалу. В этом чат-боте будет храниться весь ваш приобретённый контент.
|
||||
</p>
|
||||
<p className="flex flex-col">
|
||||
<strong className="w-full">Теперь вы можете самостоятельно осуществить продажу купленного контента.</strong>
|
||||
<span>
|
||||
Перешлите сообщение из чата My-Player друзьям или опубликуйте в своём Telegram-канале. Каждый, кто купит контент по вашей ссылке, принесёт вам доход, а автору — заслуженное вознаграждение.
|
||||
</span>
|
||||
</p>
|
||||
<p className="flex flex-col">
|
||||
Спасибо, что выбираете MY!
|
||||
</p>
|
||||
<Button
|
||||
className={"mt-[20px]"}
|
||||
label={"Ок"}
|
||||
includeArrows={false}
|
||||
onClick={() => handleClick(onConfirm)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
import { useHapticFeedback } from "@vkruglikov/react-telegram-web-app";
|
||||
import { Button } from "~/shared/ui/button";
|
||||
|
||||
type ErrorModalProps = {
|
||||
onConfirm(): void;
|
||||
};
|
||||
|
||||
export const ErrorModal = ({
|
||||
onConfirm,
|
||||
}: ErrorModalProps) => {
|
||||
const [impactOccurred] = useHapticFeedback();
|
||||
|
||||
const handleClick = (fn: () => void) => {
|
||||
impactOccurred("light");
|
||||
fn();
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className={
|
||||
"fixed left-0 top-0 z-30 flex h-full w-full items-center justify-center bg-black/80 px-[15px]"
|
||||
}
|
||||
>
|
||||
<div className={"flex flex-col gap-[30px]"}>
|
||||
<div
|
||||
className={
|
||||
"border border-white bg-[#1D1D1B] px-[10px] py-[16px] text-start flex flex-col gap-12"
|
||||
}
|
||||
>
|
||||
<p className="mt-12">
|
||||
<span className="px-1 font-bold">Ошибка запроса транзакции</span>
|
||||
</p>
|
||||
<p className="">
|
||||
Не удалось отправить запрос на выполнение транзакции.
|
||||
</p>
|
||||
<p className="flex flex-col">
|
||||
<span>
|
||||
Попробуйте переподключить кошелек и повторить попытку. Если ошибка сохраняется, попробуйте запросить транзакцию еще раз.
|
||||
</span>
|
||||
</p>
|
||||
<p className="flex flex-col">
|
||||
Если проблема не исчезает, убедитесь, что ваш кошелек работает корректно, или свяжитесь с поддержкой.
|
||||
</p>
|
||||
<Button
|
||||
className={"mt-[20px]"}
|
||||
label={"Ок"}
|
||||
includeArrows={false}
|
||||
onClick={() => handleClick(onConfirm)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
@ -5,11 +5,9 @@ import { useWebApp } from "@vkruglikov/react-telegram-web-app";
|
|||
import { Button } from "~/shared/ui/button";
|
||||
import { usePurchaseContent, useViewContent } from "~/shared/services/content";
|
||||
import { fromNanoTON } from "~/shared/utils";
|
||||
import {useCallback, useEffect, useMemo, useState} from "react";
|
||||
import {useCallback, useEffect, useMemo} from "react";
|
||||
import { AudioPlayer } from "~/shared/ui/audio-player";
|
||||
import {useAuth} from "~/shared/services/auth";
|
||||
import { CongratsModal } from "./components/congrats-modal";
|
||||
import { ErrorModal } from "./components/error-modal";
|
||||
|
||||
export const ViewContentPage = () => {
|
||||
const WebApp = useWebApp();
|
||||
|
|
@ -22,8 +20,8 @@ export const ViewContentPage = () => {
|
|||
|
||||
const auth = useAuth();
|
||||
|
||||
const [isCongratsModal, setIsCongratsModal] = useState(false);
|
||||
const [isErrorModal, setIsErrorModal] = useState(false);
|
||||
|
||||
|
||||
const handleBuyContent = useCallback(async () => {
|
||||
try {
|
||||
if (!tonConnectUI.connected) {
|
||||
|
|
@ -52,14 +50,11 @@ export const ViewContentPage = () => {
|
|||
|
||||
if (transactionResponse.boc) {
|
||||
void refetchContent()
|
||||
setIsCongratsModal(true);
|
||||
console.log(transactionResponse.boc, "PURCHASED")
|
||||
} else {
|
||||
setIsErrorModal(true);
|
||||
console.error("Transaction failed:", transactionResponse);
|
||||
}
|
||||
} catch (error) {
|
||||
setIsErrorModal(true);
|
||||
console.error("Error handling Ton Connect subscription:", error);
|
||||
}
|
||||
}, [content, tonConnectUI.connected]);
|
||||
|
|
@ -76,28 +71,19 @@ export const ViewContentPage = () => {
|
|||
return () => clearInterval(interval)
|
||||
}, []);
|
||||
|
||||
const handleConfirmCongrats = () => {
|
||||
setIsCongratsModal(!isCongratsModal);
|
||||
};
|
||||
|
||||
const handleErrorModal = () => {
|
||||
setIsErrorModal(!isErrorModal);
|
||||
}
|
||||
|
||||
return (
|
||||
<main className={"min-h-screen flex w-full flex-col gap-[50px] px-4 "}>
|
||||
{isCongratsModal && <CongratsModal
|
||||
onConfirm={handleConfirmCongrats}/>}
|
||||
{isErrorModal && <ErrorModal
|
||||
onConfirm={handleErrorModal}/>}
|
||||
{content?.data?.content_type.startsWith("audio") && content?.data?.display_options?.metadata?.image && (
|
||||
<div className={"mt-[30px] h-[314px] w-full"}>
|
||||
<img
|
||||
alt={"content_image"}
|
||||
className={"h-full w-full object-cover object-center"}
|
||||
src={content?.data?.display_options?.metadata?.image}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<main className={"min-h-screen flex w-full flex-col gap-[50px] px-4 "}>
|
||||
{content?.data?.content_type.startsWith("audio") && content?.data?.display_options?.metadata?.image && (
|
||||
<div className={"mt-[30px] h-[314px] w-full"}>
|
||||
<img
|
||||
alt={"content_image"}
|
||||
className={"h-full w-full object-cover object-center"}
|
||||
src={content?.data?.display_options?.metadata?.image}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{content?.data?.content_type.startsWith("audio") ? (
|
||||
<AudioPlayer src={content?.data?.display_options?.content_url} />
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { useRef } from "react";
|
||||
import { useTonConnectUI } from "@tonconnect/ui-react";
|
||||
import { useTonConnectUI, useTonWallet } from "@tonconnect/ui-react";
|
||||
import { useMutation } from "react-query";
|
||||
import { request } from "~/shared/libs";
|
||||
import { useWebApp } from "@vkruglikov/react-telegram-web-app";
|
||||
|
|
@ -9,7 +9,7 @@ const payloadTTLMS = 1000 * 60 * 20;
|
|||
|
||||
export const useAuth = () => {
|
||||
const WebApp = useWebApp();
|
||||
// const wallet = useTonWallet();
|
||||
const wallet = useTonWallet();
|
||||
const [tonConnectUI] = useTonConnectUI();
|
||||
const interval = useRef<ReturnType<typeof setInterval> | undefined>();
|
||||
|
||||
|
|
@ -94,20 +94,17 @@ export const useAuth = () => {
|
|||
});
|
||||
}
|
||||
|
||||
// Commented this part for two reasons:
|
||||
// 1) When we include ton_proof from the wallet it fails the call for a reason of bad ton_proof
|
||||
// 2) This call could happen only if the first case happened and it means that the ton_proof is already have been stored once before
|
||||
// Case 2: Connected with proof - use it
|
||||
// if (wallet?.connectItems?.tonProof && !("error" in wallet.connectItems.tonProof)) {
|
||||
// console.log("DEBUG: Using existing proof", wallet.connectItems.tonProof.proof);
|
||||
// return makeAuthRequest({
|
||||
// twa_data: WebApp.initData,
|
||||
// ton_proof: {
|
||||
// account: wallet.account,
|
||||
// ton_proof: wallet.connectItems.tonProof.proof,
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
if (wallet?.connectItems?.tonProof && !("error" in wallet.connectItems.tonProof)) {
|
||||
console.log("DEBUG: Using existing proof");
|
||||
return makeAuthRequest({
|
||||
twa_data: WebApp.initData,
|
||||
ton_proof: {
|
||||
account: wallet.account,
|
||||
ton_proof: wallet.connectItems.tonProof.proof,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Case 3: Connected without proof - already authenticated
|
||||
console.log("DEBUG: Connected without proof, proceeding without it");
|
||||
|
|
|
|||
|
|
@ -1,42 +0,0 @@
|
|||
import { useEffect } from "react";
|
||||
import * as Sentry from "@sentry/react";
|
||||
import {
|
||||
createRoutesFromChildren,
|
||||
matchRoutes,
|
||||
useLocation,
|
||||
useNavigationType,
|
||||
} from "react-router-dom";
|
||||
|
||||
Sentry.init({
|
||||
dsn: import.meta.env.SENTRY_DSN,
|
||||
integrations: [
|
||||
// See docs for support of different versions of variation of react router
|
||||
// https://docs.sentry.io/platforms/javascript/guides/react/configuration/integrations/react-router/
|
||||
Sentry.reactRouterV6BrowserTracingIntegration({
|
||||
useEffect,
|
||||
useLocation,
|
||||
useNavigationType,
|
||||
createRoutesFromChildren,
|
||||
matchRoutes,
|
||||
}),
|
||||
Sentry.replayIntegration(),
|
||||
],
|
||||
|
||||
// Set tracesSampleRate to 1.0 to capture 100%
|
||||
// of transactions for tracing.
|
||||
// Learn more at
|
||||
// https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
|
||||
tracesSampleRate: 1.0,
|
||||
|
||||
// Set `tracePropagationTargets` to control for which URLs trace propagation should be enabled
|
||||
tracePropagationTargets: [
|
||||
/^\//,
|
||||
new RegExp(`^${import.meta.env.VITE_API_BASE_URL}`),
|
||||
],
|
||||
// Capture Replay for 10% of all sessions,
|
||||
// plus for 100% of sessions with an error
|
||||
// Learn more at
|
||||
// https://docs.sentry.io/platforms/javascript/session-replay/configuration/#general-integration-configuration
|
||||
replaysSessionSampleRate: 0.1,
|
||||
replaysOnErrorSampleRate: 1.0,
|
||||
});
|
||||
57
yarn.lock
57
yarn.lock
|
|
@ -386,61 +386,6 @@
|
|||
resolved "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.12.0.tgz"
|
||||
integrity sha512-ZYmr5mS2wd4Dew/JjT0Fqi2NPB/ZhZ2VvPp7SmvPZb4Y1CG/LRcS6tcRo2cYU7zLK5A7cdbhWnnWmUjoI4qapg==
|
||||
|
||||
"@sentry-internal/browser-utils@9.1.0":
|
||||
version "9.1.0"
|
||||
resolved "https://registry.npmjs.org/@sentry-internal/browser-utils/-/browser-utils-9.1.0.tgz"
|
||||
integrity sha512-S1uT+kkFlstWpwnaBTIJSwwAID8PS3aA0fIidOjNezeoUE5gOvpsjDATo9q+sl6FbGWynxMz6EnYSrq/5tuaBQ==
|
||||
dependencies:
|
||||
"@sentry/core" "9.1.0"
|
||||
|
||||
"@sentry-internal/feedback@9.1.0":
|
||||
version "9.1.0"
|
||||
resolved "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-9.1.0.tgz"
|
||||
integrity sha512-jTDCqkqH3QDC8m9WO4mB06hqnBRsl3p7ozoh0E774UvNB6blOEZjShhSGMMEy5jbbJajPWsOivCofUtFAwbfGw==
|
||||
dependencies:
|
||||
"@sentry/core" "9.1.0"
|
||||
|
||||
"@sentry-internal/replay-canvas@9.1.0":
|
||||
version "9.1.0"
|
||||
resolved "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-9.1.0.tgz"
|
||||
integrity sha512-gxredVe+mOgfNqDJ3dTLiRON3FK1rZ8d0LHp7TICK/umLkWFkuso0DbNeyKU+3XCEjCr9VM7ZRqTDMzmY6zyVg==
|
||||
dependencies:
|
||||
"@sentry-internal/replay" "9.1.0"
|
||||
"@sentry/core" "9.1.0"
|
||||
|
||||
"@sentry-internal/replay@9.1.0":
|
||||
version "9.1.0"
|
||||
resolved "https://registry.npmjs.org/@sentry-internal/replay/-/replay-9.1.0.tgz"
|
||||
integrity sha512-E2xrUoms90qvm0BVOuaZ8QfkMoTUEgoIW/35uOeaqNcL7uOIj8c5cSEQQKit2Dr7CL6W+Ci5c6Khdyd5C0NL5w==
|
||||
dependencies:
|
||||
"@sentry-internal/browser-utils" "9.1.0"
|
||||
"@sentry/core" "9.1.0"
|
||||
|
||||
"@sentry/browser@9.1.0":
|
||||
version "9.1.0"
|
||||
resolved "https://registry.npmjs.org/@sentry/browser/-/browser-9.1.0.tgz"
|
||||
integrity sha512-G55e5j77DqRW3LkalJLAjRRfuyKrjHaKTnwIYXa6ycO+Q1+l14pEUxu+eK5Abu2rtSdViwRSb5/G6a/miSUlYA==
|
||||
dependencies:
|
||||
"@sentry-internal/browser-utils" "9.1.0"
|
||||
"@sentry-internal/feedback" "9.1.0"
|
||||
"@sentry-internal/replay" "9.1.0"
|
||||
"@sentry-internal/replay-canvas" "9.1.0"
|
||||
"@sentry/core" "9.1.0"
|
||||
|
||||
"@sentry/core@9.1.0":
|
||||
version "9.1.0"
|
||||
resolved "https://registry.npmjs.org/@sentry/core/-/core-9.1.0.tgz"
|
||||
integrity sha512-djWEzSBpMgqdF3GQuxO+kXCUX+Mgq42G4Uah/HSUBvPDHKipMmyWlutGRoFyVPPOnCDgpHu3wCt83wbpEyVmDw==
|
||||
|
||||
"@sentry/react@^9.1.0":
|
||||
version "9.1.0"
|
||||
resolved "https://registry.npmjs.org/@sentry/react/-/react-9.1.0.tgz"
|
||||
integrity sha512-aP2sXHH+erbomuzU762ktg340IGDh8zD7ueuqwBwGu98fhCpTYsLXiS85I29tUvPLljwNU9puLPmxbgW4iZ2tQ==
|
||||
dependencies:
|
||||
"@sentry/browser" "9.1.0"
|
||||
"@sentry/core" "9.1.0"
|
||||
hoist-non-react-statics "^3.3.2"
|
||||
|
||||
"@ton/core@^0.59.1":
|
||||
version "0.59.1"
|
||||
resolved "https://registry.npmjs.org/@ton/core/-/core-0.59.1.tgz"
|
||||
|
|
@ -2644,7 +2589,7 @@ react-tag-input@^6.10.3:
|
|||
classnames "~2.3.1"
|
||||
lodash-es "^4.17.21"
|
||||
|
||||
"react@^16.14.0 || 17.x || 18.x || 19.x", "react@^16.8.0 || ^17 || ^18", "react@^16.8.0 || ^17.0.0 || ^18.0.0", react@^18, react@^18.2.0, "react@>= 16.14", react@>=16.6.0, react@>=16.8, react@>=17.0.0:
|
||||
"react@^16.8.0 || ^17 || ^18", "react@^16.8.0 || ^17.0.0 || ^18.0.0", react@^18, react@^18.2.0, "react@>= 16.14", react@>=16.6.0, react@>=16.8, react@>=17.0.0:
|
||||
version "18.2.0"
|
||||
resolved "https://registry.npmjs.org/react/-/react-18.2.0.tgz"
|
||||
integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==
|
||||
|
|
|
|||
Loading…
Reference in New Issue