trans main

This commit is contained in:
Nastya 2025-03-03 03:32:21 +03:00
commit b91e5ba663
51 changed files with 1538 additions and 514 deletions

@ -16,9 +16,10 @@
"@babel/plugin-proposal-private-property-in-object": "^7.21.11", "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@emotion/react": "^11.10.5", "@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5", "@emotion/styled": "^11.10.5",
"@frontend/kitui": "^1.0.82", "@frontend/kitui": "^1.0.86",
"@mui/icons-material": "^5.10.14", "@mui/icons-material": "^5.10.14",
"@mui/material": "^5.10.14", "@mui/material": "^5.10.14",
"@mui/x-date-pickers": "^7.13.0",
"@popperjs/core": "^2.11.8", "@popperjs/core": "^2.11.8",
"axios": "^1.4.0", "axios": "^1.4.0",
"buffer": "^6.0.3", "buffer": "^6.0.3",
@ -29,6 +30,7 @@
"immer": "^10.0.2", "immer": "^10.0.2",
"isomorphic-fetch": "^3.0.0", "isomorphic-fetch": "^3.0.0",
"js-big-decimal": "^2.0.7", "js-big-decimal": "^2.0.7",
"moment": "^2.30.1",
"notistack": "^3.0.1", "notistack": "^3.0.1",
"pdfjs-dist": "3.6.172", "pdfjs-dist": "3.6.172",
"react": "^18.2.0", "react": "^18.2.0",
@ -39,6 +41,7 @@
"react-slick": "^0.29.0", "react-slick": "^0.29.0",
"slick-carousel": "^1.8.1", "slick-carousel": "^1.8.1",
"swr": "^2.2.5", "swr": "^2.2.5",
"transliteration": "^2.3.5",
"use-debounce": "^10.0.0", "use-debounce": "^10.0.0",
"web-vitals": "^2.1.0", "web-vitals": "^2.1.0",
"yup": "^1.1.1", "yup": "^1.1.1",

@ -1,9 +1,10 @@
import { UserAccount } from "@frontend/kitui"; import { UserAccount } from "@frontend/kitui";
import makeRequest from "@api/makeRequest"; import makeRequest from "@api/makeRequest";
import Cart from "@root/pages/Cart/Cart";
import { parseAxiosError } from "@root/utils/parse-error"; import { parseAxiosError } from "@root/utils/parse-error";
const API_URL = `${process.env.REACT_APP_DOMAIN}/customer/v1.0.0`; const API_URL = `${process.env.REACT_APP_DOMAIN}/customer/v1.0.1`;
export const patchCart = async ( export const patchCart = async (
tariffId: string tariffId: string

@ -44,7 +44,7 @@ export type RawDetails = {
Value: string | number | KeyValue[][]; Value: string | number | KeyValue[][];
}; };
const API_URL = `${process.env.REACT_APP_DOMAIN}/customer/v1.0.0`; const API_URL = `${process.env.REACT_APP_DOMAIN}/customer/v1.0.1`;
export const getHistory = async (): Promise< export const getHistory = async (): Promise<
[GetHistoryResponse | GetHistoryResponse2 | null, string?] [GetHistoryResponse | GetHistoryResponse2 | null, string?]

@ -5,7 +5,7 @@ import { clearUserData } from "@root/stores/user";
import { clearCustomTariffs } from "@root/stores/customTariffs"; import { clearCustomTariffs } from "@root/stores/customTariffs";
import { clearTickets } from "@root/stores/tickets"; import { clearTickets } from "@root/stores/tickets";
import { redirect } from "react-router-dom"; import { redirect } from "react-router-dom";
import { setNotEnoughMoneyAmount } from "@stores/cart"; import { setNotEnoughMoneyAmount } from "@stores/notEnoughMoneyAmount";
interface MakeRequest { interface MakeRequest {
method?: Method | undefined; method?: Method | undefined;

@ -1,7 +1,7 @@
import makeRequest from "@api/makeRequest"; import makeRequest from "@api/makeRequest";
import { parseAxiosError } from "@root/utils/parse-error"; import { parseAxiosError } from "@root/utils/parse-error";
const API_URL = `${process.env.REACT_APP_DOMAIN}/customer/v1.0.0`; const API_URL = `${process.env.REACT_APP_DOMAIN}/customer/v1.0.1`;
type GetRecentlyPurchasedTariffsResponse = { type GetRecentlyPurchasedTariffsResponse = {
id: string; id: string;

@ -8,6 +8,7 @@ import type {
} from "@root/model/privilege"; } from "@root/model/privilege";
import type { GetTariffsResponse } from "@root/model/tariff"; import type { GetTariffsResponse } from "@root/model/tariff";
import { removeTariffFromCart } from "@root/stores/user"; import { removeTariffFromCart } from "@root/stores/user";
import axios from "axios";
interface CreateTariffBody { interface CreateTariffBody {
name: string; name: string;
@ -134,3 +135,24 @@ export const getTariffArray = async (tariffIds: string[] | undefined) => {
return tariffs; return tariffs;
}; };
const apiUrl = process.env.REACT_APP_DOMAIN + "/requestquiz";
export async function sendContactFormRequest(body: {
contact: string;
whoami: string;
}) {
try {
const a = await axios(apiUrl + "/callme", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
data: body,
});
return [a];
} catch (nativeError) {
const [error] = parseAxiosError(nativeError);
return [null, `Ошибка при отправке запроса. ${error}`];
}
}

@ -55,7 +55,7 @@ export const sendDocuments = async (
const sendDocumentsResponse = await makeRequest<FormData, Verification>({ const sendDocumentsResponse = await makeRequest<FormData, Verification>({
method: "POST", method: "POST",
url: API_URL, url: API_URL,
body: jsonToFormdata({ ...documents, egrule: documents.inn }), body: jsonToFormdata({ ...documents}),
useToken: true, useToken: true,
withCredentials: true, withCredentials: true,
}); });
@ -72,11 +72,23 @@ export const updateDocuments = async (
documents: UpdateDocumentsArgs documents: UpdateDocumentsArgs
): Promise<[Verification | "OK" | null, string?]> => { ): Promise<[Verification | "OK" | null, string?]> => {
try { try {
// .replace(/\s/g, '_')
// if (documents.inn) {
// documents.inn.append("name", "blob");
// }
// if (documents.rule) {
// documents.rule.append("name", "blob");
// }
// if (documents.certificate) {
// documents.certificate.append("name", "blob");
// }
console.log("documents")
console.log(documents)
const updateDocumentsResponse = await makeRequest<FormData, Verification>({ const updateDocumentsResponse = await makeRequest<FormData, Verification>({
method: "PUT", method: "PUT",
url: `${API_URL}`, url: `${API_URL}`,
body: jsonToFormdata( body: jsonToFormdata(
documents.inn ? { ...documents, egrule: documents.inn } : documents documents.inn ? { ...documents} : documents
), ),
useToken: true, useToken: true,
withCredentials: true, withCredentials: true,
@ -93,6 +105,8 @@ export const updateDocuments = async (
export const updateDocument = async ( export const updateDocument = async (
body: FormData body: FormData
): Promise<[Verification | "OK" | null, string?]> => { ): Promise<[Verification | "OK" | null, string?]> => {
console.log("body")
console.log(body)
try { try {
const updateDocumentResponse = await makeRequest<FormData, Verification>({ const updateDocumentResponse = await makeRequest<FormData, Verification>({
method: "PATCH", method: "PATCH",

@ -6,8 +6,12 @@ const isStaging = (() => {
const host = window.location.hostname; const host = window.location.hostname;
return host.includes("s") ? "s" : ""; return host.includes("s") ? "s" : "";
})(); })();
const isLocalhost = (() => {
const host = window.location.hostname;
return host.includes("localhost");
})();
const API_URL = `${process.env.REACT_APP_DOMAIN}/customer/v1.0.0`; const API_URL = `${process.env.REACT_APP_DOMAIN}/customer/v1.0.1`;
interface PaymentBody { interface PaymentBody {
type: string; type: string;
@ -19,12 +23,20 @@ export const sendPayment = async ({
body, body,
fromSquiz, fromSquiz,
paymentPurpose, paymentPurpose,
cc
}: { }: {
userId: string; userId: string;
body: PaymentBody; body: PaymentBody;
fromSquiz: boolean; fromSquiz: boolean;
paymentPurpose: "paycart" | "replenishwallet"; paymentPurpose: "paycart" | "replenishwallet";
cc?: boolean
}): Promise<[SendPaymentResponse | null, string?]> => { }): Promise<[SendPaymentResponse | null, string?]> => {
let returnLink = `${isLocalhost ? "localhost:3000" : `https://${isStaging}hub.pena.digital`}/afterpay?from=${
fromSquiz ? "quiz" : "hub"
}&purpose=${paymentPurpose}&userid=${userId}`
if (cc) returnLink = returnLink + "&cc=true"
const reqeustBody = { const reqeustBody = {
currency: "RUB", currency: "RUB",
bankCard: { bankCard: {
@ -36,9 +48,7 @@ export const sendPayment = async ({
}, },
phoneNumber: "79000000000", phoneNumber: "79000000000",
login: "login_test", login: "login_test",
returnUrl: `https://${isStaging}hub.pena.digital/afterpay?from=${ returnUrl: returnLink,
fromSquiz ? "quiz" : "hub"
}&purpose=${paymentPurpose}&userid=${userId}`,
...body, ...body,
}; };

@ -0,0 +1,38 @@
import { useLocation } from "react-router-dom";
import { Box, SxProps, Theme } from "@mui/material";
interface Props {
sx?: SxProps<Theme>;
}
export default function CloseIcon({ sx }: Props) {
const location = useLocation();
return (
<Box
sx={{
width: "30px",
height: "30px",
display: "flex",
alignItems: "center",
justifyContent: "center",
flexShrink: 0,
"&:hover path": {
stroke: "#7E2AEA",
},
...sx
}}
>
<svg
width="26"
height="26"
viewBox="0 0 26 26"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M1 1L25 25M1 25L25 1"
stroke={location.pathname === "/" ? "white" : "black"}
/>
</svg>
</Box>
);
}

@ -0,0 +1,22 @@
import { useLocation } from "react-router-dom";
import { Box, SxProps, Theme } from "@mui/material";
interface Props {
sx?: SxProps<Theme>;
}
export default function NotebookWithPencil({ sx }: Props) {
return (
<Box
sx={{
height: "24px",
...sx
}}
>
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5.88766 6.5124H15.3537M5.88766 10.4075H12.0172M5.88766 14.398H9.18792M18.988 4.41492V3.69678C18.988 3.14449 18.5403 2.69678 17.988 2.69678H3.19922C2.64693 2.69678 2.19922 3.14449 2.19922 3.69678V19.7038C2.19922 20.5407 3.16577 21.0074 3.8211 20.4869L6.25047 18.5577C6.42733 18.4173 6.64652 18.3408 6.87236 18.3408H17.988C18.5403 18.3408 18.988 17.8931 18.988 17.3408V15.2147" stroke="#7E2AEA" stroke-width="1.5" stroke-linecap="round" />
<path d="M20.383 7.29034L20.9133 6.76001L20.383 6.22968L19.8527 6.76001L20.383 7.29034ZM15.9919 11.6815L15.4615 11.1511L14.9312 11.6815L15.4615 12.2118L15.9919 11.6815ZM16.7185 12.4081L16.1882 12.9384L16.7185 13.4688L17.2489 12.9384L16.7185 12.4081ZM21.1096 8.01698L21.64 8.54731L22.1703 8.01698L21.64 7.48665L21.1096 8.01698ZM14.4001 13.2732L14.9304 12.7429L14.4001 12.2126L13.8698 12.7429L14.4001 13.2732ZM14.0817 13.5917L13.5514 13.0613C13.5011 13.1115 13.4583 13.1686 13.4242 13.2309L14.0817 13.5917ZM13.1982 15.2018L12.5407 14.841C12.3803 15.1333 12.4321 15.4964 12.6678 15.7321C12.9036 15.9679 13.2667 16.0197 13.559 15.8593L13.1982 15.2018ZM14.8083 14.3183L15.1691 14.9758C15.2314 14.9417 15.2885 14.8988 15.3387 14.8486L14.8083 14.3183ZM15.1267 13.9999L15.6571 14.5302L16.1874 13.9999L15.6571 13.4696L15.1267 13.9999ZM21.9075 5.76585L21.3772 5.23552L20.8468 5.76585L21.3772 6.29618L21.9075 5.76585ZM22.2812 5.39209L22.8116 4.86176C22.5187 4.56887 22.0438 4.56887 21.7509 4.86176L22.2812 5.39209ZM23.0079 6.11874L23.5382 6.64907C23.8311 6.35617 23.8311 5.8813 23.5382 5.58841L23.0079 6.11874ZM22.6341 6.4925L22.1038 7.02283L22.6341 7.55316L23.1645 7.02283L22.6341 6.4925ZM19.8527 6.76001L15.4615 11.1511L16.5222 12.2118L20.9133 7.82067L19.8527 6.76001ZM15.4615 12.2118L16.1882 12.9384L17.2489 11.8778L16.5222 11.1511L15.4615 12.2118ZM17.2489 12.9384L21.64 8.54731L20.5793 7.48665L16.1882 11.8778L17.2489 12.9384ZM21.64 7.48665L20.9133 6.76001L19.8527 7.82067L20.5793 8.54731L21.64 7.48665ZM13.8698 12.7429L13.5514 13.0613L14.612 14.122L14.9304 13.8036L13.8698 12.7429ZM13.4242 13.2309L12.5407 14.841L13.8557 15.5626L14.7392 13.9524L13.4242 13.2309ZM13.559 15.8593L15.1691 14.9758L14.4475 13.6608L12.8374 14.5443L13.559 15.8593ZM15.3387 14.8486L15.6571 14.5302L14.5964 13.4696L14.278 13.788L15.3387 14.8486ZM15.6571 13.4696L14.9304 12.7429L13.8698 13.8036L14.5964 14.5302L15.6571 13.4696ZM22.4378 6.29618L22.8116 5.92242L21.7509 4.86176L21.3772 5.23552L22.4378 6.29618ZM21.7509 5.92242L22.4776 6.64907L23.5382 5.58841L22.8116 4.86176L21.7509 5.92242ZM22.4776 5.58841L22.1038 5.96217L23.1645 7.02283L23.5382 6.64907L22.4776 5.58841ZM23.1645 5.96217L22.4378 5.23552L21.3772 6.29618L22.1038 7.02283L23.1645 5.96217Z" fill="#7E2AEA" />
</svg>
</Box>
);
}

@ -0,0 +1,20 @@
import { useLocation } from "react-router-dom";
import { Box, SxProps, Theme } from "@mui/material";
interface Props {
sx?: SxProps<Theme>;
}
export default function CloseIcon({ sx }: Props) {
const location = useLocation();
return (
<Box
sx={sx}
>
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5.88766 6.5124H15.3537M5.88766 10.4075H12.0172M5.88766 14.398H9.18792M18.988 4.41492V3.69678C18.988 3.14449 18.5403 2.69678 17.988 2.69678H3.19922C2.64693 2.69678 2.19922 3.14449 2.19922 3.69678V19.7038C2.19922 20.5407 3.16577 21.0074 3.8211 20.4869L6.25047 18.5577C6.42733 18.4173 6.64652 18.3408 6.87236 18.3408H17.988C18.5403 18.3408 18.988 17.8931 18.988 17.3408V15.2147" stroke="#7E2AEA" stroke-width="1.5" stroke-linecap="round" />
<path d="M20.383 7.29034L20.9133 6.76001L20.383 6.22968L19.8527 6.76001L20.383 7.29034ZM15.9919 11.6815L15.4615 11.1511L14.9312 11.6815L15.4615 12.2118L15.9919 11.6815ZM16.7185 12.4081L16.1882 12.9384L16.7185 13.4688L17.2489 12.9384L16.7185 12.4081ZM21.1096 8.01698L21.64 8.54731L22.1703 8.01698L21.64 7.48665L21.1096 8.01698ZM14.4001 13.2732L14.9304 12.7429L14.4001 12.2126L13.8698 12.7429L14.4001 13.2732ZM14.0817 13.5917L13.5514 13.0613C13.5011 13.1115 13.4583 13.1686 13.4242 13.2309L14.0817 13.5917ZM13.1982 15.2018L12.5407 14.841C12.3803 15.1333 12.4321 15.4964 12.6678 15.7321C12.9036 15.9679 13.2667 16.0197 13.559 15.8593L13.1982 15.2018ZM14.8083 14.3183L15.1691 14.9758C15.2314 14.9417 15.2885 14.8988 15.3387 14.8486L14.8083 14.3183ZM15.1267 13.9999L15.6571 14.5302L16.1874 13.9999L15.6571 13.4696L15.1267 13.9999ZM21.9075 5.76585L21.3772 5.23552L20.8468 5.76585L21.3772 6.29618L21.9075 5.76585ZM22.2812 5.39209L22.8116 4.86176C22.5187 4.56887 22.0438 4.56887 21.7509 4.86176L22.2812 5.39209ZM23.0079 6.11874L23.5382 6.64907C23.8311 6.35617 23.8311 5.8813 23.5382 5.58841L23.0079 6.11874ZM22.6341 6.4925L22.1038 7.02283L22.6341 7.55316L23.1645 7.02283L22.6341 6.4925ZM19.8527 6.76001L15.4615 11.1511L16.5222 12.2118L20.9133 7.82067L19.8527 6.76001ZM15.4615 12.2118L16.1882 12.9384L17.2489 11.8778L16.5222 11.1511L15.4615 12.2118ZM17.2489 12.9384L21.64 8.54731L20.5793 7.48665L16.1882 11.8778L17.2489 12.9384ZM21.64 7.48665L20.9133 6.76001L19.8527 7.82067L20.5793 8.54731L21.64 7.48665ZM13.8698 12.7429L13.5514 13.0613L14.612 14.122L14.9304 13.8036L13.8698 12.7429ZM13.4242 13.2309L12.5407 14.841L13.8557 15.5626L14.7392 13.9524L13.4242 13.2309ZM13.559 15.8593L15.1691 14.9758L14.4475 13.6608L12.8374 14.5443L13.559 15.8593ZM15.3387 14.8486L15.6571 14.5302L14.5964 13.4696L14.278 13.788L15.3387 14.8486ZM15.6571 13.4696L14.9304 12.7429L13.8698 13.8036L14.5964 14.5302L15.6571 13.4696ZM22.4378 6.29618L22.8116 5.92242L21.7509 4.86176L21.3772 5.23552L22.4378 6.29618ZM21.7509 5.92242L22.4776 6.64907L23.5382 5.58841L22.8116 4.86176L21.7509 5.92242ZM22.4776 5.58841L22.1038 5.96217L23.1645 7.02283L23.5382 6.64907L22.4776 5.58841ZM23.1645 5.96217L22.4378 5.23552L21.3772 6.29618L22.1038 7.02283L23.1645 5.96217Z" fill="#7E2AEA" />
</svg>
</Box>
);
}

@ -0,0 +1,152 @@
import type { ChangeEvent, FocusEvent, KeyboardEvent } from "react";
import React, { useEffect, useState } from "react";
import type { InputProps, SxProps, Theme } from "@mui/material";
import {
Box,
FormControl,
Input,
InputLabel,
Typography,
useTheme,
} from "@mui/material";
interface CustomTextFieldProps {
placeholder: string;
id?: string;
value?: string;
error?: string;
emptyError?: boolean;
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
text?: string;
maxLength?: number;
sx?: SxProps<Theme>;
sxForm?: SxProps<Theme>;
InputProps?: Partial<InputProps>;
type?: string;
rows?: number;
className?: string;
disabled?: boolean;
}
export default function CustomTextField({
placeholder,
id,
value = "",
onChange,
onKeyDown,
onBlur,
text,
sx,
error,
emptyError,
InputProps,
maxLength = 200,
type = "",
rows = 0,
sxForm,
className,
disabled,
}: CustomTextFieldProps) {
const theme = useTheme();
const [inputValue, setInputValue] = useState("");
const [isInputActive, setIsInputActive] = useState(false);
useEffect(() => {
setInputValue(value);
}, [value]);
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
if (event.target.value.length <= maxLength) {
const inputValue = event.target.value;
if (type === "number") {
setInputValue(inputValue.replace(/\D/g, ""));
} else {
setInputValue(inputValue);
}
if (onChange) {
onChange(event);
}
}
};
const handleInputFocus = () => {
setIsInputActive(true);
};
const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>) => {
setIsInputActive(false);
if (onBlur) {
onBlur(event);
}
};
return (
<FormControl
fullWidth
variant="standard"
sx={{ p: 0, ...sxForm }}
className={className || ""}
>
{error && (
<InputLabel
sx={{
fontSize: "13.5px",
marginTop: "3px",
}}
>
{error}
</InputLabel>
)}
<Input
id={id}
defaultValue={text}
fullWidth
value={inputValue}
placeholder={placeholder}
onChange={handleInputChange}
error={!!error || emptyError}
onFocus={handleInputFocus}
onBlur={handleInputBlur}
onKeyDown={onKeyDown}
multiline={rows > 0}
rows={rows}
disabled={disabled}
disableUnderline
sx={{
maxLength: maxLength,
borderRadius: "10px",
fontSize: "18px",
lineHeight: "21px",
p: "13px",
border: `${isInputActive ? "black 2px" : "#9A9AAF 1px"} solid`,
backgroundColor: theme.palette.background.default,
height: "48px",
...sx,
}}
data-cy="textfield"
/>
{isInputActive && inputValue.length >= maxLength - 7 && (
<Box
sx={{
display: "flex",
marginTop: "5px",
marginLeft: "auto",
position: "absolute",
bottom: "-25px",
right: "0",
}}
>
<Typography fontSize="14px">{inputValue.length}</Typography>
<span>/</span>
<Typography fontSize="14px">{maxLength}</Typography>
</Box>
)}
</FormControl>
);
}

@ -13,7 +13,7 @@ import { ReactComponent as CrossIcon } from "@root/assets/Icons/cross.svg";
import type { MouseEvent } from "react"; import type { MouseEvent } from "react";
import CustomTariffAccordion from "@root/components/CustomTariffAccordion"; import CustomTariffAccordion from "@root/components/CustomTariffAccordion";
import { setNotEnoughMoneyAmount } from "@root/stores/cart"; import { setNotEnoughMoneyAmount } from "@root/stores/notEnoughMoneyAmount";
const name: Record<string, string> = { const name: Record<string, string> = {
templategen: "Шаблонизатор", templategen: "Шаблонизатор",

@ -19,8 +19,8 @@ import { Link, useNavigate } from "react-router-dom";
import { withErrorBoundary } from "react-error-boundary"; import { withErrorBoundary } from "react-error-boundary";
import { handleComponentError } from "@root/utils/handleComponentError"; import { handleComponentError } from "@root/utils/handleComponentError";
import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline"; import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline";
import { setNotEnoughMoneyAmount, useCartStore } from "@root/stores/cart"; import { setNotEnoughMoneyAmount, startPayCartProcess, useNotEnoughMoneyAmount } from "@root/stores/notEnoughMoneyAmount";
import { useDiffMoney } from "@root/stores/diffMoney"; import { RSCOpen } from "@root/stores/requestSquizCreate";
function Drawers() { function Drawers() {
const [openNotificationsModal, setOpenNotificationsModal] = useState<boolean>(false); const [openNotificationsModal, setOpenNotificationsModal] = useState<boolean>(false);
@ -34,9 +34,10 @@ function Drawers() {
const cart = useCart(); const cart = useCart();
console.log("боковой cart", cart.priceAfterDiscounts) console.log("боковой cart", cart.priceAfterDiscounts)
const userAccount = useUserStore((state) => state.userAccount); const userAccount = useUserStore((state) => state.userAccount);
const userId = useUserStore((state) => state.userId) || "";
const tickets = useTicketStore((state) => state.tickets); const tickets = useTicketStore((state) => state.tickets);
const notEnoughMoneyAmount = useCartStore(state => state.notEnoughMoneyAmount); const notEnoughMoneyAmount = useNotEnoughMoneyAmount(state => state.notEnoughMoneyAmount);
const { setNewDiff } = useDiffMoney() const siteReadyPayCart = useNotEnoughMoneyAmount(state => state.siteReadyPayCart)
const notificationsCount = tickets.filter( const notificationsCount = tickets.filter(
({ user, top_message }) => user !== top_message.user_id && top_message.shown.me !== 1 ({ user, top_message }) => user !== top_message.user_id && top_message.shown.me !== 1
@ -45,12 +46,15 @@ function Drawers() {
async function handlePayClick() { async function handlePayClick() {
setLoading(true); setLoading(true);
const isCC = cart.services.length > 0 && cart.services[0].tariffs.some(t => t.privileges[0].privilegeId === "quizManual")
const [payCartResponse, payCartError] = await payCart(); const [payCartResponse, payCartError] = await payCart();
if (payCartError) { if (payCartError) {
if (payCartError.includes("insufficient funds: ")) { if (payCartError.includes("insufficient funds: ")) {
const notEnoughMoneyAmount = parseInt(payCartError.replace(/^.*insufficient\sfunds:\s(?=\d+$)/, "")); const notEnoughMoneyAmount = parseInt(payCartError.replace(/^.*insufficient\sfunds:\s(?=\d+$)/, ""));
setNotEnoughMoneyAmount(notEnoughMoneyAmount); setNotEnoughMoneyAmount(notEnoughMoneyAmount);
startPayCartProcess(userId)
} }
setLoading(false); setLoading(false);
@ -60,6 +64,7 @@ function Drawers() {
} }
if (payCartResponse) { if (payCartResponse) {
if (isCC) RSCOpen()
setUserAccount(payCartResponse); setUserAccount(payCartResponse);
} }
@ -69,10 +74,8 @@ function Drawers() {
function handleReplenishWallet() { function handleReplenishWallet() {
setIsDrawerOpen(false); setIsDrawerOpen(false);
if (location.pathname.includes("/payment")) { if (siteReadyPayCart === null) startPayCartProcess(userId)
setNewDiff(notEnoughMoneyAmount) navigate("/payment");
}
navigate("/payment", { state: { notEnoughMoneyAmount } });
} }
return ( return (
@ -180,7 +183,6 @@ function Drawers() {
</IconButton> </IconButton>
<Drawer anchor={"right"} open={isDrawerOpen} onClose={() => { <Drawer anchor={"right"} open={isDrawerOpen} onClose={() => {
setIsDrawerOpen(false) setIsDrawerOpen(false)
setNotEnoughMoneyAmount(0)
}} sx={{ background: "rgba(0, 0, 0, 0.55)" }}> }} sx={{ background: "rgba(0, 0, 0, 0.55)" }}>
<SectionWrapper <SectionWrapper
maxWidth="lg" maxWidth="lg"
@ -248,7 +250,7 @@ function Drawers() {
Здесь написана окончательная стоимость всех услуг сложенных в корзину с учётом всех скидок. Здесь написана окончательная стоимость всех услуг сложенных в корзину с учётом всех скидок.
</Typography> </Typography>
<Typography color={theme.palette.gray.dark}> <Typography color={theme.palette.gray.dark}>
После нажатия кнопки оплатить, вы будете перенаправлены на форму оплаты, для оплаты ВСЕЙ корзины (рекомендуем перед оплатой, убрать все лишнее) После нажатия кнопки оплатить (пополнить), вы будете перенаправлены на форму оплаты, для оплаты ВСЕЙ корзины (рекомендуем перед оплатой, убрать все лишнее)
</Typography> </Typography>
</Box> </Box>
<Box <Box

@ -108,7 +108,7 @@ export default function Chat({ open = false, onclickArrow, sx }: Props) {
const workingHoursMessage = const workingHoursMessage =
"Здравствуйте, задайте ваш вопрос и наш оператор вам ответит в течение 10 минут"; "Здравствуйте, задайте ваш вопрос и наш оператор вам ответит в течение 10 минут";
const offHoursMessage = const offHoursMessage =
"Здравствуйте, к сожалению, сейчас операторы не работают. Задайте ваш вопрос, и вам ответят в 10:00 по московскому времени"; "Здравствуйте, задайте ваш вопрос и наш оператор вам ответит в течение 10 минут";
const date = new Date(); const date = new Date();
const currentHourUTC = date.getUTCHours(); const currentHourUTC = date.getUTCHours();
const MscTime = 3; // Москва UTC+3; const MscTime = 3; // Москва UTC+3;
@ -421,14 +421,6 @@ export default function Chat({ open = false, onclickArrow, sx }: Props) {
> >
онлайн-консультант онлайн-консультант
</Typography> </Typography>
<Typography
sx={{
fontSize: "16px",
lineHeight: "19px",
}}
>
время работы 10:00-3:00 по мск
</Typography>
</Box> </Box>
</Box> </Box>
<Box <Box

@ -0,0 +1,50 @@
import { IconButton, SxProps } from "@mui/material";
type InfoProps = {
width?: number;
height?: number;
sx?: SxProps;
onClick?: any;
className?: string;
color?: string;
};
export default function InfoButton({
width = 20,
height = 20,
sx,
onClick,
className,
color = "#7e2aea",
}: InfoProps) {
return (
<IconButton sx={sx} className={className} onClick={onClick}>
<svg
width={width}
height={height}
viewBox="0 0 20 20"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M10 19C14.9706 19 19 14.9706 19 10C19 5.02944 14.9706 1 10 1C5.02944 1 1 5.02944 1 10C1 14.9706 5.02944 19 10 19Z"
stroke={color}
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M9.25 9.25H10V14.5H10.75"
stroke={color}
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M9.8125 7C10.4338 7 10.9375 6.49632 10.9375 5.875C10.9375 5.25368 10.4338 4.75 9.8125 4.75C9.19118 4.75 8.6875 5.25368 8.6875 5.875C8.6875 6.49632 9.19118 7 9.8125 7Z"
fill={color}
/>
</svg>
</IconButton>
);
}

@ -28,7 +28,7 @@ import {
import { currencyFormatter } from "@root/utils/currencyFormatter"; import { currencyFormatter } from "@root/utils/currencyFormatter";
import { clearCustomTariffs } from "@root/stores/customTariffs"; import { clearCustomTariffs } from "@root/stores/customTariffs";
import { clearTickets } from "@root/stores/tickets"; import { clearTickets } from "@root/stores/tickets";
import {setNotEnoughMoneyAmount} from "@stores/cart" import {setNotEnoughMoneyAmount} from "@stores/notEnoughMoneyAmount"
interface Props { interface Props {
isLoggedIn: boolean; isLoggedIn: boolean;

@ -17,7 +17,7 @@ import { logout } from "@root/api/auth";
import { enqueueSnackbar } from "notistack"; import { enqueueSnackbar } from "notistack";
import { clearCustomTariffs } from "@root/stores/customTariffs"; import { clearCustomTariffs } from "@root/stores/customTariffs";
import { clearTickets } from "@root/stores/tickets"; import { clearTickets } from "@root/stores/tickets";
import {setNotEnoughMoneyAmount} from "@stores/cart" import {setNotEnoughMoneyAmount} from "@stores/notEnoughMoneyAmount"
type MenuItem = { type MenuItem = {
name: string; name: string;

@ -17,7 +17,7 @@ import { currencyFormatter } from "@root/utils/currencyFormatter";
import { clearTickets } from "@root/stores/tickets"; import { clearTickets } from "@root/stores/tickets";
import type { ReactNode } from "react"; import type { ReactNode } from "react";
import {setNotEnoughMoneyAmount} from "@stores/cart" import {setNotEnoughMoneyAmount} from "@stores/notEnoughMoneyAmount"
interface Props { interface Props {
children: ReactNode; children: ReactNode;

@ -18,7 +18,7 @@ import { clearTickets } from "@root/stores/tickets";
import { currencyFormatter } from "@root/utils/currencyFormatter"; import { currencyFormatter } from "@root/utils/currencyFormatter";
import walletIcon from "@root/assets/Icons/wallet_icon.svg"; import walletIcon from "@root/assets/Icons/wallet_icon.svg";
import {setNotEnoughMoneyAmount} from "@stores/cart" import {setNotEnoughMoneyAmount} from "@stores/notEnoughMoneyAmount"
export const NavbarPanel = () => { export const NavbarPanel = () => {
const navigate = useNavigate(); const navigate = useNavigate();

@ -72,10 +72,10 @@ export const Select = ({ items, selectedItem, setSelectedItem }: SelectProps) =>
className="select" className="select"
value="" value=""
open={opened} open={opened}
onClick={() => setOpened((isOpened) => !isOpened)}
MenuProps={{ disablePortal: true }} MenuProps={{ disablePortal: true }}
sx={{ width: "100%",zIndex: 1, }} sx={{ width: "100%",zIndex: 1, }}
onChange={selectItem} onChange={selectItem}
onClick={() => setOpened((isOpened) => !isOpened)}
> >
{items.map((item, index) => ( {items.map((item, index) => (
<MenuItem key={item + index} value={index} sx={{ padding: "12px" }}> <MenuItem key={item + index} value={index} sx={{ padding: "12px" }}>

@ -7,8 +7,10 @@ import { Loader } from "./Loader";
import { currencyFormatter } from "@root/utils/currencyFormatter"; import { currencyFormatter } from "@root/utils/currencyFormatter";
import { payCart } from "@root/api/cart"; import { payCart } from "@root/api/cart";
import { setUserAccount } from "@root/stores/user"; import { setUserAccount, useUserStore } from "@root/stores/user";
import { setNotEnoughMoneyAmount, useCartStore } from "@root/stores/cart"; import { setNotEnoughMoneyAmount, startPayCartProcess, useNotEnoughMoneyAmount } from "@root/stores/notEnoughMoneyAmount";
import { RSCOpen } from "@root/stores/requestSquizCreate";
import { useCart } from "@root/utils/hooks/useCart";
interface Props { interface Props {
priceBeforeDiscounts: number; priceBeforeDiscounts: number;
@ -19,13 +21,16 @@ interface Props {
export default function TotalPrice({ priceAfterDiscounts, priceBeforeDiscounts, isConstructor = false }: Props) { export default function TotalPrice({ priceAfterDiscounts, priceBeforeDiscounts, isConstructor = false }: Props) {
const theme = useTheme(); const theme = useTheme();
const upMd = useMediaQuery(theme.breakpoints.up("md")); const upMd = useMediaQuery(theme.breakpoints.up("md"));
const notEnoughMoneyAmount = useCartStore(state => state.notEnoughMoneyAmount); const notEnoughMoneyAmount = useNotEnoughMoneyAmount(state => state.notEnoughMoneyAmount);
const userId = useUserStore(store => store.userId) || ""
const [loading, setLoading] = useState<boolean>(false); const [loading, setLoading] = useState<boolean>(false);
const navigate = useNavigate(); const navigate = useNavigate();
const cart = useCart();
async function handlePayClick() { async function handlePayClick() {
setLoading(true); setLoading(true);
const isCC = cart.services.length > 0 && cart.services[0].tariffs.some(t => t.privileges[0].privilegeId === "quizManual")
const [payCartResponse, payCartError] = await payCart(); const [payCartResponse, payCartError] = await payCart();
if (payCartError) { if (payCartError) {
@ -41,6 +46,7 @@ export default function TotalPrice({ priceAfterDiscounts, priceBeforeDiscounts,
} }
if (payCartResponse) { if (payCartResponse) {
if (isCC) RSCOpen()
setUserAccount(payCartResponse); setUserAccount(payCartResponse);
} }
@ -48,6 +54,7 @@ export default function TotalPrice({ priceAfterDiscounts, priceBeforeDiscounts,
} }
function handleReplenishWallet() { function handleReplenishWallet() {
startPayCartProcess(userId)
navigate("/payment", { state: { notEnoughMoneyAmount } }); navigate("/payment", { state: { notEnoughMoneyAmount } });
} }

@ -1,4 +1,4 @@
import React from "react"; import React, { useEffect } from "react";
import ReactDOM from "react-dom/client"; import ReactDOM from "react-dom/client";
import { import {
BrowserRouter, BrowserRouter,
@ -9,6 +9,7 @@ import {
useNavigate, useNavigate,
} from "react-router-dom"; } from "react-router-dom";
import { CssBaseline, ThemeProvider } from "@mui/material"; import { CssBaseline, ThemeProvider } from "@mui/material";
import { AdapterMoment } from "@mui/x-date-pickers/AdapterMoment";
import Faq from "./pages/Faq/Faq"; import Faq from "./pages/Faq/Faq";
import Wallet from "./pages/Wallet"; import Wallet from "./pages/Wallet";
import Payment from "./pages/Payment/Payment"; import Payment from "./pages/Payment/Payment";
@ -35,6 +36,8 @@ import {
setUser, setUser,
setUserAccount, setUserAccount,
useUserStore, useUserStore,
OriginalUserSquizAccount,
setQuizUserAccount
} from "./stores/user"; } from "./stores/user";
import TariffConstructor from "./pages/TariffConstructor/TariffConstructor"; import TariffConstructor from "./pages/TariffConstructor/TariffConstructor";
import { import {
@ -44,6 +47,7 @@ import {
useUserFetcher, useUserFetcher,
} from "@frontend/kitui"; } from "@frontend/kitui";
import { pdfjs } from "react-pdf"; import { pdfjs } from "react-pdf";
import { ruRU } from "@mui/x-date-pickers/locales";
import { theme } from "./utils/theme"; import { theme } from "./utils/theme";
import PPofData from "@root/docs/PPofData"; import PPofData from "@root/docs/PPofData";
import Docs from "@root/docs/docs"; import Docs from "@root/docs/docs";
@ -55,15 +59,22 @@ import OutdatedLink from "@root/pages/auth/OutdatedLink";
import { verify } from "./pages/AccountSettings/helper"; import { verify } from "./pages/AccountSettings/helper";
import AfterPay from "./pages/AfterPay"; import AfterPay from "./pages/AfterPay";
import { PageNotFound } from "./pages/PageNotFound"; import { PageNotFound } from "./pages/PageNotFound";
import {setNotEnoughMoneyAmount} from "@stores/cart" import { useNotEnoughMoneyAmount } from "@stores/notEnoughMoneyAmount"
import { usePipeSubscriber } from "./utils/hooks/usePipeSubscriber";
import { useAfterPay } from "./utils/hooks/useAutoPay";
import { LocalizationProvider } from "@mui/x-date-pickers";
import { ModalRequestCreate } from "./pages/Tariffs/ModalRequestCreate";
import * as crutch from "./useUserAccountFetcher";
import { useCart } from "./utils/hooks/useCart";
pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.js`; pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.js`;
const localeText =
ruRU.components.MuiLocalizationProvider.defaultProps.localeText;
const App = () => { const App = () => {
const location = useLocation(); const location = useLocation();
const userId = useUserStore((state) => state.userId); const userId = useUserStore(state => state.userId);
const navigate = useNavigate(); const navigate = useNavigate();
if(location.pathname !== "/cart"){setNotEnoughMoneyAmount(0)}
useUserFetcher({ useUserFetcher({
url: process.env.REACT_APP_DOMAIN + `/user/${userId}`, url: process.env.REACT_APP_DOMAIN + `/user/${userId}`,
userId, userId,
@ -79,7 +90,7 @@ const App = () => {
}); });
useUserAccountFetcher({ useUserAccountFetcher({
url: process.env.REACT_APP_DOMAIN + "/customer/v1.0.0/account", url: process.env.REACT_APP_DOMAIN + "/customer/v1.0.1/account",
userId, userId,
onNewUserAccount: setUserAccount, onNewUserAccount: setUserAccount,
onError: (error) => { onError: (error) => {
@ -93,8 +104,32 @@ const App = () => {
}, },
}); });
crutch.useUserAccountFetcher<OriginalUserSquizAccount>({
url: `${process.env.REACT_APP_DOMAIN}/squiz/account/get`,
userId,
onNewUserAccount: setQuizUserAccount,
onError: (error) => {
const errorMessage = getMessageFromFetchError(error);
if (errorMessage) {
enqueueSnackbar(errorMessage);
clearUserData();
clearAuthToken();
navigate("/signin");
}
},
});
usePipeSubscriber()
verify(userId); verify(userId);
useAfterPay()
console.log("location")
console.log(location)
console.log("window.location")
console.log(window.location)
if (location.state?.redirectTo) if (location.state?.redirectTo)
return ( return (
<Navigate <Navigate
@ -115,6 +150,9 @@ const App = () => {
<Route path="/changepwd/expired" element={<OutdatedLink />} /> <Route path="/changepwd/expired" element={<OutdatedLink />} />
</Routes> </Routes>
)} )}
<ModalRequestCreate />
<Routes location={location.state?.backgroundLocation || location}> <Routes location={location.state?.backgroundLocation || location}>
<Route path="/" element={<Landing />} /> <Route path="/" element={<Landing />} />
<Route <Route
@ -142,7 +180,7 @@ const App = () => {
to="/" to="/"
replace replace
state={{ state={{
redirectTo: window.location.pathname + window.location.search, redirectTo: `/changepwd${location.search}`,
}} }}
/> />
} }
@ -202,11 +240,17 @@ const root = ReactDOM.createRoot(
root.render( root.render(
// <React.StrictMode> // <React.StrictMode>
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<BrowserRouter> <LocalizationProvider
<CssBaseline /> dateAdapter={AdapterMoment}
<SnackbarProvider /> adapterLocale="ru"
<App /> localeText={localeText}
</BrowserRouter> >
<BrowserRouter>
<CssBaseline />
<SnackbarProvider />
<App />
</BrowserRouter>
</LocalizationProvider>
</ThemeProvider> </ThemeProvider>
// </React.StrictMode> // </React.StrictMode>
); );

@ -1,4 +1,5 @@
import type { Attachment } from "@root/model/attachment" import type { Attachment } from "@root/model/attachment"
import { UserAccount } from "@frontend/kitui"
export type File = { export type File = {
name: "inn" | "rule" | "egrule" | "certificate"; name: "inn" | "rule" | "egrule" | "certificate";
@ -8,21 +9,21 @@ export type File = {
export interface Verification { export interface Verification {
_id: string; _id: string;
accepted: boolean; accepted: boolean;
status: "org" | "nko"; status: UserAccount["status"];
updated_at: string; updated_at: string;
comment: string; comment: string;
files: File[]; files: File[];
} }
export type SendDocumentsArgs = { export type SendDocumentsArgs = {
status: "org" | "nko"; status: UserAccount["status"];
inn: Attachment; inn: Attachment;
rule: Attachment; rule: Attachment;
certificate?: Attachment; certificate?: Attachment;
}; };
export type UpdateDocumentsArgs = { export type UpdateDocumentsArgs = {
status: "org" | "nko"; status: UserAccount["status"];
inn?: Attachment; inn?: Attachment;
rule?: Attachment; rule?: Attachment;
certificate?: Attachment; certificate?: Attachment;

@ -33,6 +33,8 @@ function AccountSettings() {
const comment = useUserStore((state) => state.comment) const comment = useUserStore((state) => state.comment)
const userId = useUserStore((state) => state.userId) ?? "" const userId = useUserStore((state) => state.userId) ?? ""
console.log(user)
const [onChangeTypeLP, setOnChangeTypeLP] = useState<LP>("") const [onChangeTypeLP, setOnChangeTypeLP] = useState<LP>("")
const [readySend, setReadySend] = useState(false) const [readySend, setReadySend] = useState(false)
@ -51,10 +53,10 @@ function AccountSettings() {
const type = onChangeTypeLP const type = onChangeTypeLP
setOnChangeTypeLP("") setOnChangeTypeLP("")
setReadySend(false) setReadySend(false)
if (type === "email" && user?.email !== settingsFields.email.value) setSettingsField("email", user?.email || "") if (type === "email" && user?.email !== settingsFields.email.value) setSettingsField("email", user?.email || user?.login || "")
if (type === "password") setSettingsField("password", "") if (type === "password") setSettingsField("password", "")
if (type === "all") { if (type === "all") {
setSettingsField("email", user?.email || "") setSettingsField("email", user?.email || user?.login || "")
setSettingsField("password", "") setSettingsField("password", "")
} }
} }

@ -63,10 +63,8 @@ export default function DocumentItem({
useEffect(() => { useEffect(() => {
if (typeof documentUrl === 'string') { if (typeof documentUrl === 'string') {
if (!documentUrl.includes("pena.digital")) { if (!documentUrl.includes("pena.digital")) {
console.log(documentUrl)
fetch(documentUrl) fetch(documentUrl)
.then(e => { .then(e => {
console.log(e)
setReadyShowDocument(true) setReadyShowDocument(true)
}) })
.catch(e => console.log(e)) .catch(e => console.log(e))

@ -43,10 +43,8 @@ export default function DocumentUploadItem({
useEffect(() => { useEffect(() => {
if (typeof urlOrFile === 'string') { if (typeof urlOrFile === 'string') {
if (!urlOrFile.includes("pena.digital")) { if (!urlOrFile.includes("pena.digital")) {
console.log(documentUrl)
fetch(documentUrl) fetch(documentUrl)
.then(e => { .then(e => {
console.log(e)
setReadyShowDocument(true) setReadyShowDocument(true)
}) })
.catch(e => console.log(e)) .catch(e => console.log(e))

@ -19,7 +19,7 @@ export default function UserFields({
const upMd = useMediaQuery(theme.breakpoints.up("md")) const upMd = useMediaQuery(theme.breakpoints.up("md"))
const { settingsFields, user } = useUserStore((state) => state) const { settingsFields, user } = useUserStore((state) => state)
const a = useUserStore((state) => state)
const textFieldProps = { const textFieldProps = {
gap: upMd ? "16px" : "10px", gap: upMd ? "16px" : "10px",

@ -1,135 +1,28 @@
import { useState, useEffect } from "react"; import { useNavigate, useSearchParams } from "react-router-dom";
import {
Box,
Button,
Typography,
useTheme,
useMediaQuery,
} from "@mui/material";
import { payCart } from "@root/api/cart";
import { useUserStore } from "@root/stores/user";
import wallet_icon from "@root/assets/Icons/ColorWallet.svg";
import { Link, useSearchParams } from "react-router-dom";
const MINUTE = 1000 * 60;
//Раньше эта страничка благодарила за покупку и перенаправляла сталкера своей дорогой.
//Чтобы не мелькать хабом перед перенаправлением на другие домены - логика останется на этом отдельном url адресе
//Эта страничка ТОЛЬКО перенаправляет на нужный адрес. Процесс автопокупки после пополнения лежит на хуке useAutoPay
export default () => { export default () => {
const [redirectUrl, setRedirectUrl] = useState<string>("/"); const navigate = useNavigate();
const theme = useTheme();
const phone = useMediaQuery(theme.breakpoints.down(375));
const userId = useUserStore((state) => state.user?._id);
const [searchParams] = useSearchParams(); const [searchParams] = useSearchParams();
const paymentUserId = searchParams.get("userid");
useEffect(() => { const userId = searchParams.get("userid");
const from = searchParams.get("from") || "hub"; const from = searchParams.get("from") || "hub";
const purpose = searchParams.get("purpose"); const purpose = searchParams.get("purpose")
const isCC = searchParams.get("cc")
if (purpose === "paycart" || from !== "quiz") { const host = window.location.hostname;
let tryCount = 0; const domain = (host.includes("s") ? "s" : "") + from;
const pathname = from.includes("hub") ? "/tariffs" : "/list";
if (userId !== paymentUserId) { let link = `https://${domain}.pena.digital${pathname}?purpose=${purpose}&userid=${userId}`
return;
}
const payCartPendingRequestDeadline = localStorage.getItem( console.log("isCC")
"payCartPendingRequestDeadline" if (isCC) link = link + "&cc=true"
);
const deadline = payCartPendingRequestDeadline
? Number(payCartPendingRequestDeadline)
: Date.now() + 20 * MINUTE;
localStorage.setItem( document.location.href = link
"payCartPendingRequestDeadline", return <></>;
deadline.toString()
);
tryPayCart();
async function tryPayCart() {
tryCount += 1;
if (Date.now() > deadline) {
localStorage.removeItem("payCartPendingRequestDeadline");
return;
}
const [, payCartError] = await payCart();
if (!payCartError) {
localStorage.removeItem("payCartPendingRequestDeadline");
return;
}
setTimeout(tryPayCart, tryCount > 5 ? MINUTE : MINUTE / 6);
}
}
const host = window.location.hostname;
const domain = (host.includes("s") ? "s" : "") + from;
const pathname = from === "hub" ? "/tariffs" : "/list";
setRedirectUrl(
`https://${domain}.pena.digital${pathname}?afterpay=${true}&userid=${userId}`
);
}, []);
return (
<Box
sx={{
width: "100vw",
height: "100vh",
p: phone ? "76px 16px" : "117px 0 0 0",
}}
>
<Box
sx={{
display: "flex",
flexDirection: "column",
alignItems: "center",
}}
>
<Box
component="img"
src={wallet_icon}
sx={{
width: phone ? "338px" : "auto",
height: phone ? "215px" : "auto",
mb: "60px",
}}
/>
<Typography
sx={{
fontSize: phone ? "24px" : "36px",
fontWeight: 500,
lineHeight: "28.44px",
textAlign: "center",
mb: "10px",
}}
>
Спасибо за оплату!
</Typography>
<Typography
sx={{
fontSize: "18px",
lineHeight: "21.33px",
textAlign: "center",
color: theme.palette.gray.dark,
mb: "30px",
}}
>
Ваш платеж принят и в течение 10 минут товары будут зачислены
</Typography>
<Button
component={Link}
to={redirectUrl.toString()}
replace={true}
variant="pena-contained-dark"
>
На главную
</Button>
</Box>
</Box>
);
}; };

@ -63,7 +63,7 @@ export default function Section2() {
</Box> </Box>
{/* {upMd ? <WideTemplCard name="PenaDoc" desc="Сервис автоматизации, избавляющий от рутины */} {/* {upMd ? <WideTemplCard name="PenaDoc" desc="Сервис автоматизации, избавляющий от рутины */}
{/*в документообороте. 1 раз делаешь шаблон и используешь всю жизнь " light={false} sx={{ marginTop: "126px" }} /> : <TemplCardPhonePink />}*/} {/*в документообороте. 1 раз делаешь шаблон и используешь всю жизнь " light={false} sx={{ marginTop: "126px" }} /> : <TemplCardPhonePink />}*/}
{upMd ? <WideTemplCard name="PenaQuiz" desc="Конструктор quiz опросов, для любых видов исследований и quiz маркетинга, арбитража трафика" image={card2ImageBig} light={false} sx={{ marginTop: "126px" }} /> {upMd ? <WideTemplCard name="PenaQuiz" desc="Конструктор квиз опросов, для любых видов исследований и квиз маркетинга, арбитража трафика" image={card2ImageBig} light={false} sx={{ marginTop: "126px" }} />
: :
<Box <Box
sx={{ sx={{
@ -78,7 +78,7 @@ export default function Section2() {
> >
<CardWithLink <CardWithLink
headerText="PenaQuiz" headerText="PenaQuiz"
text="Конструктор quiz опросов, для любых видов исследований и quiz маркетинга, арбитража трафика" text="Конструктор квиз опросов, для любых видов исследований и квиз маркетинга, арбитража трафика"
linkHref="#" linkHref="#"
image={card2Image} image={card2Image}
isHighlighted={!upMd} isHighlighted={!upMd}

@ -32,8 +32,7 @@ import PaymentMethodCard from "./PaymentMethodCard";
import { SorryModal } from "./SorryModal"; import { SorryModal } from "./SorryModal";
import { WarnModal } from "./WarnModal"; import { WarnModal } from "./WarnModal";
import { mutate } from "swr"; import { mutate } from "swr";
import { useCartStore } from "@root/stores/cart"; import { calcTimeOfReadyPayCart, cancelPayCartProcess, setNotEnoughMoneyAmount, startPayCartProcess, useNotEnoughMoneyAmount } from "@root/stores/notEnoughMoneyAmount";
import { useDiffMoney } from "@root/stores/diffMoney";
type PaymentMethod = { type PaymentMethod = {
label: string; label: string;
@ -55,119 +54,134 @@ type PaymentMethodType = (typeof paymentMethods)[number]["name"];
export default function Payment() { export default function Payment() {
const theme = useTheme(); const theme = useTheme();
const upMd = useMediaQuery(theme.breakpoints.up("md"));
const upSm = useMediaQuery(theme.breakpoints.up("sm"));
const isTablet = useMediaQuery(theme.breakpoints.down(1000));
const [promocodeField, setPromocodeField] = useState<string>("");
const [selectedPaymentMethod, setSelectedPaymentMethod] =
useState<PaymentMethodType | null>("");
const [warnModalOpen, setWarnModalOpen] = useState<boolean>(false);
const [sorryModalOpen, setSorryModalOpen] = useState<boolean>(false);
const [paymentValueField, setPaymentValueField] = useState<string>("0");
const [paymentLink, setPaymentLink] = useState<string>("");
const [fromSquiz, setIsFromSquiz] = useState<boolean>(false);
const location = useLocation(); const location = useLocation();
console.log("location", location);
console.log("location", location.state);
const verificationStatus = useUserStore((state) => state.verificationStatus);
const userId = useUserStore((state) => state.userId);
const navigate = useNavigate(); const navigate = useNavigate();
const handleCustomBackNavigation = useHistoryTracker(); const handleCustomBackNavigation = useHistoryTracker();
const {diffMoney, setNewDiff} = useDiffMoney() const userId = useUserStore((state) => state.userId) || "";
const verificationStatus = useUserStore((state) => state.verificationStatus);
const notEnoughMoneyAmount = const upMd = useMediaQuery(theme.breakpoints.up("md"));
(location.state?.notEnoughMoneyAmount as number) ?? 0; const upSm = useMediaQuery(theme.breakpoints.up("sm"));
const isTablet = useMediaQuery(theme.breakpoints.down(1000));
const [promocodeField, setPromocodeField] = useState<string>("");
const [selectedPaymentMethod, setSelectedPaymentMethod] = useState<PaymentMethodType | null>("");
const [paymentValueField, setPaymentValueField] = useState<string>("0");
const [fromSquiz, setIsFromSquiz] = useState<boolean>(false);
const [cc, setCC] = useState<boolean>(false);
const [warnModalOpen, setWarnModalOpen] = useState<boolean>(false);
const [sorryModalOpen, setSorryModalOpen] = useState<boolean>(false);
const notEnoughMoneyAmount = useNotEnoughMoneyAmount(state => state.notEnoughMoneyAmount)
const siteReadyPayCart = useNotEnoughMoneyAmount(state => state.siteReadyPayCart)
const paymentValue = parseFloat( const paymentValue = parseFloat(
bigDecimal.multiply(parseFloat(paymentValueField), 100) bigDecimal.multiply(parseFloat(paymentValueField), 100)
); );
useEffect(() => { //Отмена состояния сайта "в процессе покупки корзины, просто нехватило деняк"
console.log(diffMoney) useEffect(() => {
if (diffMoney > 0) { return () => {
setNewDiff(0) //При выходе со страницы оплаты мы точно не в состоянии покупки корзины
setPaymentValueField((diffMoney / 100).toString()) cancelPayCartProcess()
} }
}, [diffMoney]) }, [])
//Тут записываем начальную сумму в инпут (если стоит флаг что мы в процессе покупки)
useEffect(() => {
if (siteReadyPayCart !== null && siteReadyPayCart[userId] !== undefined && calcTimeOfReadyPayCart(siteReadyPayCart[userId]))
setPaymentValueField((notEnoughMoneyAmount / 100).toString());//Сколько нехватило на хабе
}, [notEnoughMoneyAmount, siteReadyPayCart])
useLayoutEffect(() => { useLayoutEffect(() => {
setPaymentValueField((notEnoughMoneyAmount / 100).toString()); //Предустановленное значение - это либо 0, либо сколько нам нехватило на хабе, либо сколько нам нехватило на квизе
const params = new URLSearchParams(window.location.search); const params = new URLSearchParams(window.location.search);
const fromSquiz = params.get("action"); const fromSquiz = params.get("action");
if (fromSquiz === "squizpay") { const userid = params.get("user");
const currentCC = params.get("cc");
if (currentCC) setCC(true)
if (fromSquiz === "squizpay" && userid !== null) {
setIsFromSquiz(true); setIsFromSquiz(true);
setPaymentValueField((Number(params.get("dif") || "0") / 100).toString());
} }
//Принимаем параметры из странички и очищаем url адрес до красивого состояния
navigate(`/payment`, { navigate(`/payment`, {
replace: true, replace: true,
}); });
}, [ ]); }, []);
//https://shub.pena.digital/quizpayment?action=squizpay&dif=9800&data=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY2ODVhNTc4OTgzZWU3N2Y4ZTFlNjNkYyIsImF1ZCI6InBlbmEiLCJpc3MiOiJwZW5hLWF1dGgtc2VydmljZSIsImlhdCI6MTcyMjIyMjgzMywiZXhwIjoxNzI3NDA2ODMzfQ.My1KJWFk034MiMdImQSlzf5p4Sn5Dhboj2VvPQteh59tD_CwXyPtePEyev3thV_58IbOOgJ5cgeBm0JKn7atgMgRMpNQVdeYKtf6HYvVoAqkrMcT1LHgAlEQ0TcaXssFKCQGuiCVltHY3UE-kQv5TeydBpO3U9BDKvMqRqv5-Xo&userid=6685a578983ee77f8e1e63dc
async function handleChoosePaymentClick() { const handlePaymentClick = () => {
if (!selectedPaymentMethod) {
enqueueSnackbar("Введите метод оплаты");
return;
}
if (Number(paymentValueField) === 0) { if (Number(paymentValueField) === 0) {
enqueueSnackbar("Введите сумму"); enqueueSnackbar("Введите сумму");
return; return;
} }
if (selectedPaymentMethod === "rspay") {
if (selectedPaymentMethod !== "rspay") {
const [sendPaymentResponse, sendPaymentError] = await sendPayment({
userId: userId ?? "",
fromSquiz,
body: {
type: selectedPaymentMethod,
amount: Number(
bigDecimal.floor(
bigDecimal.multiply(Number(paymentValueField), 100)
)
),
},
paymentPurpose: notEnoughMoneyAmount ? "paycart" : "replenishwallet",
});
if (sendPaymentError) {
return enqueueSnackbar(sendPaymentError);
}
if (sendPaymentResponse) {
setPaymentLink(sendPaymentResponse.link);
}
return;
} else {
if (verificationStatus !== VerificationStatus.VERIFICATED) {
setWarnModalOpen(true);
return;
}
if (Number(paymentValueField) < 900) { if (Number(paymentValueField) < 900) {
enqueueSnackbar("Минимальная сумма 900р"); enqueueSnackbar("Минимальная сумма 900р");
return; return;
} }
if (verificationStatus !== VerificationStatus.VERIFICATED) {
const [sendRSPaymentResponse] = await sendRSPayment( setWarnModalOpen(true);
Number(paymentValueField) return;
);
if (sendRSPaymentResponse) {
return enqueueSnackbar(sendRSPaymentResponse);
} }
startPayRS()
enqueueSnackbar( } else {
"Cпасибо за заявку, в течении 24 часов вам будет выставлен счёт для оплаты услуг." startPayCard()
);
navigate("/settings");
} }
} }
const startPayRS = async () => {
const [sendRSPaymentResponse] = await sendRSPayment(
Number(paymentValueField)
);
if (sendRSPaymentResponse) {
return enqueueSnackbar(sendRSPaymentResponse);
}
enqueueSnackbar(
"Cпасибо за заявку, в течении 24 часов вам будет выставлен счёт для оплаты услуг."
);
navigate("/settings");
}
const startPayCard = async () => {
if (!selectedPaymentMethod) {
enqueueSnackbar("Введите метод оплаты");
return
}
const [sendPaymentResponse, sendPaymentError] = await sendPayment({
userId: userId ?? "",
fromSquiz,
body: {
type: selectedPaymentMethod,
amount: Number(
bigDecimal.floor(
bigDecimal.multiply(Number(paymentValueField), 100)
)
),
},
paymentPurpose: notEnoughMoneyAmount ? "paycart" : "replenishwallet",
cc
});
if (sendPaymentError) {
return enqueueSnackbar(sendPaymentError);
}
//Произошёл запрос на пополнение счёта. Нам вернули ссылку для перехода на страницу пополнения.
if (sendPaymentResponse) {
document.location.href = sendPaymentResponse.link;
}
}
async function handleApplyPromocode() { async function handleApplyPromocode() {
if (!promocodeField) return; if (!promocodeField) return;
@ -250,7 +264,6 @@ export default function Payment() {
image={image} image={image}
onClick={() => { onClick={() => {
setSelectedPaymentMethod(name); setSelectedPaymentMethod(name);
setPaymentLink("");
}} }}
unpopular={false} unpopular={false}
/> />
@ -261,7 +274,6 @@ export default function Payment() {
image={rsPayLogo} image={rsPayLogo}
onClick={async () => { onClick={async () => {
setSelectedPaymentMethod("rspay"); setSelectedPaymentMethod("rspay");
setPaymentLink("");
}} }}
unpopular={false} unpopular={false}
/> />
@ -297,76 +309,59 @@ export default function Payment() {
> >
{upMd && <Typography mb="56px">Выберите способ оплаты</Typography>} {upMd && <Typography mb="56px">Выберите способ оплаты</Typography>}
<Typography mb="20px">К оплате</Typography> <Typography mb="20px">К оплате</Typography>
{paymentLink ? ( {
<Typography siteReadyPayCart?.[userId] && notEnoughMoneyAmount > 0 ?
sx={{ <Typography
fontWeight: 500, sx={{
fontSize: "20px", fontWeight: 500,
lineHeight: "48px", fontSize: "20px",
mb: "28px", lineHeight: "48px",
}} mb: "28px",
> }}
{currencyFormatter.format( >
Number(bigDecimal.divide(bigDecimal.floor(paymentValue), 100)) {currencyFormatter.format(
)} Number(bigDecimal.divide(bigDecimal.floor(paymentValue), 100))
</Typography> )}
) : ( </Typography>
<InputTextfield :
TextfieldProps={{ <InputTextfield
placeholder: "К оплате", TextfieldProps={{
value: paymentValueField, placeholder: "К оплате",
type: "number", value: paymentValueField,
}} type: "number",
onChange={(e) => { }}
const value = parseFloat( onChange={(e) => {
e.target.value.replace(/^0+(?=\d\.)/, "") const value = parseFloat(
); e.target.value.replace(/^0+(?=\d\.)/, "")
setPaymentValueField(isNaN(value) ? "" : value.toString()); );
}} setPaymentValueField(isNaN(value) ? "" : value.toString());
id="payment-amount" }}
gap={upMd ? "16px" : "10px"} id="payment-amount"
color={"#F2F3F7"} gap={upMd ? "16px" : "10px"}
FormInputSx={{ mb: "28px" }} color={"#F2F3F7"}
/> FormInputSx={{ mb: "28px" }}
)} />
}
</Box> </Box>
{paymentLink ? ( <Button
<Button variant="pena-outlined-light"
variant="pena-outlined-light" disabled={!isFinite(paymentValue)}
component="a" onClick={handlePaymentClick}
href={paymentLink} sx={{
sx={{ mt: "auto",
mt: "auto", color: "black",
color: "black", border: `1px solid ${theme.palette.purple.main}`,
border: `1px solid ${theme.palette.purple.main}`, "&:hover": {
"&:hover": { color: "white",
backgroundColor: theme.palette.purple.dark, },
border: `1px solid ${theme.palette.purple.dark}`, "&:active": {
}, color: "white",
}} },
> }}
Оплатить >
</Button> Оплатить
) : ( </Button>
<Button
variant="pena-outlined-light"
disabled={!isFinite(paymentValue)}
onClick={handleChoosePaymentClick}
sx={{
mt: "auto",
color: "black",
border: `1px solid ${theme.palette.purple.main}`,
"&:hover": {
color: "white",
},
"&:active": {
color: "white",
},
}}
>
Выбрать
</Button>
)}
</Box> </Box>
</Box> </Box>
<WarnModal open={warnModalOpen} setOpen={setWarnModalOpen} /> <WarnModal open={warnModalOpen} setOpen={setWarnModalOpen} />

@ -1,6 +1,6 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { ApologyPage } from "../ApologyPage"; import { ApologyPage } from "../ApologyPage";
import { useNavigate } from "react-router-dom"; import { redirect, useNavigate } from "react-router-dom";
import { import {
clearAuthToken, clearAuthToken,
getMessageFromFetchError, getMessageFromFetchError,
@ -19,13 +19,14 @@ import {
import { logout } from "@root/api/auth"; import { logout } from "@root/api/auth";
import { clearCustomTariffs } from "@root/stores/customTariffs"; import { clearCustomTariffs } from "@root/stores/customTariffs";
import { clearTickets } from "@root/stores/tickets"; import { clearTickets } from "@root/stores/tickets";
import {setNotEnoughMoneyAmount} from "@stores/cart" import { setNotEnoughMoneyAmount, startPayCartProcess } from "@stores/notEnoughMoneyAmount"
const params = new URLSearchParams(window.location.search); const params = new URLSearchParams(window.location.search);
const action = params.get("action"); let action = params.get("action");
const dif = params.get("dif"); let dif = params.get("dif");
const token = params.get("data"); let token = params.get("data");
const userId = params.get("userid"); let userId = params.get("userid");
let currentCC = params.get("cc");
let first = true; let first = true;
@ -33,15 +34,23 @@ export default function QuizPayment() {
const navigate = useNavigate(); const navigate = useNavigate();
const [message, setMessage] = useState("Идёт загрузка"); const [message, setMessage] = useState("Идёт загрузка");
const user = useUserStore((state) => state.user); const user = useUserStore((state) => state.user);
const currentUserId = useUserStore((state) => state.user?._id);
const fromSquiz = params.get("action");
useEffect( useEffect(() => {
function redirectIfSignedIn() { if (!first && userId !== null && currentUserId === userId) {
if (!first && user?._id === userId) if (fromSquiz === "squizpay") {
navigate(`/payment?action=${action}&dif=${dif}&user=${userId}`, { setNotEnoughMoneyAmount(Number(params.get("dif") || 0));//Сколько нехватило на квизе
startPayCartProcess(userId)
let link = `/payment?action=${action}&dif=${dif}&user=${userId}`
if (currentCC) link = link + "&cc=true"
navigate(link, {
replace: true, replace: true,
}); });
}, }
[navigate, user] }
},
[currentUserId]
); );
@ -64,24 +73,13 @@ export default function QuizPayment() {
clearCustomTariffs(); clearCustomTariffs();
clearTickets(); clearTickets();
setNotEnoughMoneyAmount(0) setNotEnoughMoneyAmount(0)
await logout(); logout();
} }
setUserId(userId);
setAuthToken(token); setAuthToken(token);
// setAuthToken(data.data.accessToken)
setUserId(userId);
// useUserFetcher({
// url: process.env.REACT_APP_DOMAIN + `/user/${userId}`,
// userId,
// onNewUser: (user) => {
// setUser(user)
// navigate(`/payment?action=${action}&dif=${dif}`, { replace: true })
// },
// onError: () => { },
// })
return; return;
})(); })();
} else { } else {

@ -42,8 +42,6 @@ function TariffConstructor() {
}} }}
> >
{Object.entries(customTariffs).filter(([serviceKey]) => serviceKey === "squiz").map(([serviceKey, privileges], index) => { {Object.entries(customTariffs).filter(([serviceKey]) => serviceKey === "squiz").map(([serviceKey, privileges], index) => {
console.log("privileges")
console.log(privileges)
return ( return (
<Box key={serviceKey}> <Box key={serviceKey}>
<Box <Box

@ -53,8 +53,6 @@ export default function TariffPrivilegeSlider({ privilege }: Props) {
); );
function handleSliderChange(measurement: PrivilegeName) { function handleSliderChange(measurement: PrivilegeName) {
console.log(measurement)
console.log(sliderSettingsByType)
return (value: number | number[]) => { return (value: number | number[]) => {
if (Number(value) < Number(sliderSettingsByType[measurement]?.min)) { if (Number(value) < Number(sliderSettingsByType[measurement]?.min)) {

@ -0,0 +1,329 @@
import { Box, Button, IconButton, Modal, Typography, useMediaQuery, useTheme } from "@mui/material"
import { Form, Formik, useFormik } from "formik"
import CustomTextField from "@components/CustomTextField"
import InfoButton from "@components/InfoButton";
import { sendContactFormRequest } from "@api/tariff"
import { TimePicker } from "@mui/x-date-pickers"
import moment, { Moment } from "moment"
import { enqueueSnackbar } from "notistack"
import { useState } from "react"
import CloseIcon from "@root/assets/Icons/CloseIcon";
import { useRequestSquizCreate, RSCClose } from "@root/stores/requestSquizCreate"
interface Values {
contact: string;
dogiebusiness: string;
imagination: string;
name: string;
time?: Moment | null;
}
const initialValues: Values = {
contact: "",//phone number
// whoami: {},
dogiebusiness: "",
imagination: "",
name: "",
time: null
};
interface FP {
title: string
desc?: string
placeholder: string
value: string
onChange: any
rows?: number
}
const Field = ({
title,
desc,
placeholder,
value,
onChange,
rows,
}: FP) => {
return (
<Box
sx={{
m: "15px 0"
}}
>
<Typography
sx={{
fontSize: "18px",
fontWeight: 500,
lineHeight: "21.33px",
mb: "10px",
}}
>{title}</Typography>
{desc && <Typography
sx={{
fontSize: "18px",
mb: "10px",
color: "#9A9AAF"
}}
>{desc}</Typography>}
<CustomTextField
value={value}
placeholder={placeholder}
maxLength={200}
onChange={onChange}
rows={rows || 0}
sx={rows !== undefined ? { height: "68px" } : {}}
/>
</Box>
)
}
export const ModalRequestCreate = () => {
const theme = useTheme()
const isMobile = useMediaQuery(theme.breakpoints.down(650));
const [isSending, setIsSending] = useState(false)
const open = useRequestSquizCreate(store => store.isRSCOpen)
console.log(open)
if (isSending) return (
<Modal
open={open}
onClose={() => {
RSCClose()
setIsSending(false)
}}
>
<Box sx={{
position: 'absolute' as 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
bgcolor: 'background.paper',
boxShadow: 24,
width: isMobile ? "343px" : "418px",
borderRadius: "10px",
p: "50px"
}}>
<Typography
sx={{
fontSize: "24px",
fontWeight: 500,
lineHeight: "28.44px",
textAlign: "center"
}}
>Спасибо за заявку!</Typography>
<Typography
sx={{
fontSize: "18px",
lineHeight: "21.33px",
color: "#4D4D4D",
m: "5px 0 30px 0"
}}
>С вами свяжутся в течение 24 часов</Typography>
<Button
variant="contained"
fullWidth
onClick={() => {
RSCClose()
setIsSending(false)
}}
sx={{
py: "12px",
bgcolor: "rgb(126, 42, 234)",
borderRadius: "8px",
"&:hover": {
backgroundColor: "#581CA7",
},
"&:active": {
color: "white",
backgroundColor: "black",
},
}}
>Ок</Button>
</Box>
</Modal>
)
return (
<Modal
open={open}
onClose={RSCClose}
>
<Box sx={{
position: 'absolute' as 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
bgcolor: 'background.paper',
boxShadow: 24,
width: isMobile ? "344px" : "620px",
borderRadius: "10px"
}}>
<Box>
<Box
sx={{
width: "100%",
height: "68px",
backgroundColor: theme.palette.background.default,
borderRadius: "10px 10px 0 0"
}}
>
<Typography
sx={{
fontSize: "18px",
padding: "20px",
color: "rgb(154, 154, 175)",
borderRadius: "10px 10px 0 0"
}}
>
Заполните форму, чтобы оставить заявку на создание квиза
</Typography>
</Box>
<IconButton
onClick={RSCClose}
sx={{
width: "12px",
height: "12px",
position: "absolute",
right: "15px",
top: "15px",
}}
>
<CloseIcon sx={{ width: "12px", height: "12px", transform: "scale(1.5)" }} />
</IconButton>
</Box>
<Box
sx={{
p: "15px 70px 50px 50px",
}}
>
<Formik
initialValues={initialValues}
onSubmit={async (values, formikHelpers) => {
if (values.contact.length < 8) return enqueueSnackbar("Пожалуйста, оставьте контактные данные")
const resp = await sendContactFormRequest({
contact: values.contact,
whoami: JSON.stringify({
dogiebusiness: values.dogiebusiness,
imagination: values.imagination,
name: values.name,
time: moment(values.time).format("hh:mm")
})
})
//@ts-ignore
if (resp[0]?.status === 200) {
enqueueSnackbar("Запрос успешно отправлен")
setIsSending(true)
}
if (resp[1]) {
//@ts-ignore
enqueueSnackbar(resp[1])
}
}}
>
{({ values, isSubmitting, setFieldValue }) => (<>
<Form>
<Field
title="Ваше имя"
placeholder="Иван"
value={values.name}
onChange={({ target }: any) => setFieldValue("name", target.value)}
/>
<Field
title="Какой у вас бизнес?"
placeholder="Логистика"
value={values.dogiebusiness}
onChange={({ target }: any) => setFieldValue("dogiebusiness", target.value)}
/>
<Field
title="Ваши контактные данные"
placeholder="Не менее 8 символов"
value={values.contact}
onChange={({ target }: any) => setFieldValue("contact", target.value)}
desc="(Telegram, WhatsApp, номер телефона)"
/>
<Field
title="Ваши пожелания к квизу"
placeholder="Введите свой текст здесь"
value={values.imagination}
onChange={({ target }: any) => setFieldValue("imagination", target.value)}
rows={2}
/>
<Box
sx={{
m: "15px 0"
}}
>
<Typography
sx={{
fontSize: "18px",
fontWeight: 500,
lineHeight: "21.33px",
mb: "10px",
}}
>Во сколько вам можно позвонить? </Typography>
<Typography
sx={{
fontSize: "18px",
mb: "10px",
color: "#9A9AAF"
}}
>Москва (GMT+3)</Typography>
<TimePicker
onChange={(e) => setFieldValue("time", e)}
ampm={false}
value={values.time}
views={['hours', 'minutes']} format="hh:mm"
sx={{
border: "#c4c4c4 1px solid",
borderRadius: "4px",
"& .MuiInputBase-root": {
display: "flex"
}
}}
/>
</Box>
<Box
sx={{
display: "flex"
}}>
<Button
variant="contained"
fullWidth
type="submit"
disabled={isSubmitting}
sx={{
py: "12px",
bgcolor: "rgb(126, 42, 234)",
borderRadius: "8px",
"&:hover": {
backgroundColor: "#581CA7",
},
"&:active": {
color: "white",
backgroundColor: "black",
},
}}
>Отправить</Button>
<InfoButton sx={{
ml: "15px",
width: "48px"
}} />
</Box>
</Form>
</>)}
</Formik>
</Box>
</Box>
</Modal >
)
}

@ -1,7 +1,8 @@
import { Box, Typography, Tooltip, SxProps, Theme, Button, Badge, useTheme, useMediaQuery, } from "@mui/material"; import { Box, Typography, Tooltip, SxProps, Theme, Button, Badge, useTheme, useMediaQuery, IconButton, } from "@mui/material";
import { MouseEventHandler, ReactNode } from "react"; import { MouseEventHandler, ReactNode } from "react";
import { cardShadow } from "@root/utils/theme"; import { cardShadow } from "@root/utils/theme";
import { relative } from "path"; import { relative } from "path";
import NotebookWithPencil from "@root/assets/Icons/NotebookWithPencil copy";
interface Props { interface Props {
icon: ReactNode; icon: ReactNode;
@ -15,11 +16,12 @@ interface Props {
text?: string; text?: string;
}; };
price?: ReactNode; price?: ReactNode;
sendRequestToCreate?: () => void;
} }
export default function TariffCard({ icon, headerText, text, sx, price, buttonProps, discount }: Props) { export default function TariffCard({ icon, headerText, text, sx, price, buttonProps, discount, sendRequestToCreate }: Props) {
const theme = useTheme(); const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down(600)); const isMobile = useMediaQuery(theme.breakpoints.down(600));
return ( return (
<Box <Box
sx={{ sx={{
@ -79,20 +81,20 @@ export default function TariffCard({ icon, headerText, text, sx, price, buttonPr
</Box> </Box>
)} )}
</Box> </Box>
{/* <Tooltip title={<Typography>{headerText}</Typography>} placement="top"> */} {/* <Tooltip title={<Typography>{headerText}</Typography>} placement="top"> */}
<Typography <Typography
variant="h5" variant="h5"
sx={{ sx={{
mt: "14px", mt: "14px",
mb: "10px", mb: "10px",
textOverflow: "ellipsis", textOverflow: "ellipsis",
overflow: "hidden", overflow: "hidden",
whiteSpace: "nowrap", whiteSpace: "nowrap",
width: "100%", width: "100%",
}} }}
> >
{headerText} {headerText}
</Typography> </Typography>
{/* </Tooltip> {/* </Tooltip>
<Tooltip <Tooltip
title={text.map((line, index) => ( title={text.map((line, index) => (
@ -100,29 +102,67 @@ export default function TariffCard({ icon, headerText, text, sx, price, buttonPr
))} ))}
placement="top" placement="top"
> */} > */}
<Box <Box
sx={{ sx={{
width: "100%", width: "100%",
mb: "auto", mb: "auto",
}} }}
> >
<Typography sx={{ overflow: "hidden", textOverflow: "ellipsis" }}> <Typography sx={{ overflow: "hidden", textOverflow: "ellipsis" }}>
{text} {text}
</Typography> </Typography>
</Box> </Box>
{/* </Tooltip> */} {/* </Tooltip> */}
{buttonProps && ( <Box
<Button
onClick={buttonProps.onClick} sx={{
variant="pena-outlined-purple" display: "flex",
sx={{ width: "100%",
mt: "10px", alignItems: "center",
...buttonProps.sx, }}>
}} {buttonProps && (
> <Button
{buttonProps.text} onClick={buttonProps.onClick}
</Button> variant="pena-outlined-purple"
)} sx={{
mt: "10px",
...buttonProps.sx,
}}
>
{buttonProps.text}
</Button>
)}
{Boolean(sendRequestToCreate) && (
<Box
sx={{
ml: isMobile ? "10px" : "20px",
bgcolor: "#F2F3F7",
borderRadius: "8px",
}}
>
{isMobile ?
<IconButton
onClick={sendRequestToCreate}
sx={{
p:"12px",
}}
>
<NotebookWithPencil />
</IconButton>
:
<Button
sx={{
color: "#7E2AEA",
p: "10px 14px",
}}
onClick={sendRequestToCreate}
>
Запросить
</Button>
}
</Box>
)}
</Box>
</Box> </Box>
); );
} }

@ -89,14 +89,14 @@ export default function Tariffs() {
<WideTemplCard <WideTemplCard
sx={{ marginTop: "55px" }} sx={{ marginTop: "55px" }}
name={"PenaQuiz"} name={"PenaQuiz"}
desc={"Конструктор quiz опросов, для любых видов исследований и quiz маркетинга, арбитража трафика"} desc={"Конструктор квиз опросов, для любых видов исследований и квиз маркетинга, арбитража трафика"}
image={CardImage2} image={CardImage2}
href={"https://quiz.pena.digital"} href={"https://quiz.pena.digital"}
/> />
: :
<TemplCardPhoneLight <TemplCardPhoneLight
name={"PenaQuiz"} name={"PenaQuiz"}
desc={"Конструктор quiz опросов, для любых видов исследований и quiz маркетинга, арбитража трафика"} desc={"Конструктор квиз опросов, для любых видов исследований и квиз маркетинга, арбитража трафика"}
image={CardImage2} image={CardImage2}
href={"https://quiz.pena.digital"} href={"https://quiz.pena.digital"}
/> />

@ -28,8 +28,10 @@ import TariffCard from "./TariffCard";
import { useDiscounts } from "@root/api/price"; import { useDiscounts } from "@root/api/price";
import { Select } from "@components/Select"; import { Select } from "@components/Select";
import { Tabs } from "@components/Tabs"; import { Tabs } from "@components/Tabs";
import { useRequestSquizCreate, RSCOpen, RSCClose } from "@root/stores/requestSquizCreate"
const subPages = ["Базовый тариф PenaQuiz", 'Убрать логотип "PenaQuiz"']; const subPagesTime = ["Базовый тариф PenaQuiz", 'Убрать логотип "PenaQuiz"'];
const subPagesVolume = ["Заявки квиз", 'Заказать создание квиза'];
const StepperText: Record<string, string> = { const StepperText: Record<string, string> = {
volume: "Тарифы на объём", volume: "Тарифы на объём",
@ -43,10 +45,13 @@ function TariffPage() {
const isTablet = useMediaQuery(theme.breakpoints.down(1000)); const isTablet = useMediaQuery(theme.breakpoints.down(1000));
const location = useLocation(); const location = useLocation();
const tariffs = useTariffStore((state) => state.tariffs); const tariffs = useTariffStore((state) => state.tariffs);
const [selectedItem, setSelectedItem] = useState<number>(0); const [selectedItemTime, setSelectedItemTime] = useState<number>(0);
const [selectedItemVolume, setSelectedItemVolume] = useState<number>(0);
const purchasesAmount = const purchasesAmount =
useUserStore((state) => state.userAccount?.wallet.spent) ?? 0; useUserStore((state) => state.userAccount?.wallet.spent) ?? 0;
const userId = useUserStore((state) => state.user?._id) ?? ""; const userId = useUserStore((state) => state.user?._id) ?? "";
const userPrivilegies = useUserStore(store => store.quizUserAccount?.privileges);
console.log(userPrivilegies)
const discounts = useDiscounts(userId); const discounts = useDiscounts(userId);
const isUserNko = const isUserNko =
useUserStore((state) => state.userAccount?.status) === "nko"; useUserStore((state) => state.userAccount?.status) === "nko";
@ -68,25 +73,14 @@ function TariffPage() {
} }
const filteredTariffs = tariffs.filter((tariff) => { const filteredTariffs = tariffs.filter((tariff) => {
if (tariff.privileges[0] === undefined) return false; if (tariff.privileges[0] === undefined || tariff.isDeleted || tariff.isCustom) return false;
if ( if (unit === "time") {
(tariff.privileges[0].type === "day") === (unit === "time") && if (selectedItemTime === 0 && tariff.privileges[0].privilegeId === "quizUnlimTime") return true
!tariff.isDeleted && if (selectedItemTime === 1 && tariff.privileges[0].privilegeId === "squizHideBadge") return true
!tariff.isCustom
) {
if (
((selectedItem === 0 && unit === "time") || unit !== "time") &&
tariff.privileges[0].serviceKey === "squiz" &&
tariff.privileges[0].privilegeId !== "squizHideBadge"
)
return true;
} }
if ( if (unit === "volume") {
selectedItem === 1 && if (selectedItemVolume === 0 && tariff.privileges[0].privilegeId === "quizCnt") return true
unit === "time" && if (selectedItemVolume === 1 && tariff.privileges[0].privilegeId === "quizManual") return true
tariff.privileges[0].privilegeId === "squizHideBadge"
) {
return true;
} }
return false; return false;
}); });
@ -95,6 +89,7 @@ function TariffPage() {
filteredTariffs: Tariff[], filteredTariffs: Tariff[],
addFreeTariff = false addFreeTariff = false
) => { ) => {
const isCC = userPrivilegies?.quizManual?.amount !== undefined && userPrivilegies?.quizManual?.amount > 0 && unit === "volume" && selectedItemVolume === 1
const tariffElements = filteredTariffs const tariffElements = filteredTariffs
.filter((tariff) => tariff.privileges.length > 0) .filter((tariff) => tariff.privileges.length > 0)
.map((tariff, index) => { .map((tariff, index) => {
@ -104,7 +99,7 @@ function TariffPage() {
purchasesAmount, purchasesAmount,
currentTariffs ?? [], currentTariffs ?? [],
isUserNko, isUserNko,
userId userId,
); );
return ( return (
@ -133,6 +128,7 @@ function TariffPage() {
text: "Выбрать", text: "Выбрать",
onClick: () => handleTariffItemClick(tariff._id), onClick: () => handleTariffItemClick(tariff._id),
}} }}
sendRequestToCreate={isCC ? RSCOpen : undefined}
headerText={tariff.name} headerText={tariff.name}
text={tariff.description || ""} text={tariff.description || ""}
price={ price={
@ -206,15 +202,32 @@ function TariffPage() {
<> <>
{isMobile ? ( {isMobile ? (
<Select <Select
items={subPages} items={subPagesTime}
selectedItem={selectedItem} selectedItem={selectedItemTime}
setSelectedItem={setSelectedItem} setSelectedItem={setSelectedItemTime}
/> />
) : ( ) : (
<Tabs <Tabs
items={subPages} items={subPagesTime}
selectedItem={selectedItem} selectedItem={selectedItemTime}
setSelectedItem={setSelectedItem} setSelectedItem={setSelectedItemTime}
/>
)}
</>
)}
{unit === "volume" && (
<>
{isMobile ? (
<Select
items={subPagesVolume}
selectedItem={selectedItemVolume}
setSelectedItem={setSelectedItemVolume}
/>
) : (
<Tabs
items={subPagesVolume}
selectedItem={selectedItemVolume}
setSelectedItem={setSelectedItemVolume}
/> />
)} )}
</> </>
@ -231,7 +244,7 @@ function TariffPage() {
}))`, }))`,
}} }}
> >
{createTariffElements(filteredTariffs, true)} {createTariffElements(filteredTariffs, unit === "time" || (unit === "volume" && selectedItemVolume !== 1))}
</Box> </Box>
{/*{recentlyPurchased.length > 0 && (*/} {/*{recentlyPurchased.length > 0 && (*/}
{/* <>*/} {/* <>*/}

@ -75,6 +75,8 @@ export default function RecoverPassword() {
useEffect(() => { useEffect(() => {
const params = new URLSearchParams(window.location.search); const params = new URLSearchParams(window.location.search);
const authToken = params.get("auth"); const authToken = params.get("auth");
console.log("authToken")
console.log(authToken)
setTokenUser(authToken); setTokenUser(authToken);
history.pushState(null, document.title, "/changepwd"); history.pushState(null, document.title, "/changepwd");

@ -1,22 +0,0 @@
import { create } from "zustand";
import { devtools } from "zustand/middleware";
interface CartStore {
notEnoughMoneyAmount: number;
}
export const useCartStore = create<CartStore>()(
devtools(
(get, set) => ({
notEnoughMoneyAmount: 0,
}),
{
name: "Cart",
enabled: process.env.NODE_ENV === "development",
trace: true,
actionsBlacklist: "rejected",
}
)
);
export const setNotEnoughMoneyAmount = (amount: number) => useCartStore.setState({ notEnoughMoneyAmount: amount });

@ -1,14 +0,0 @@
import { HistoryRecord, HistoryRecord2 } from "@root/api/history";
import { create } from "zustand";
import { devtools, persist } from "zustand/middleware";
type DiffMoneyType = {
diffMoney: number;
setNewDiff: (diff: number) => void
};
export const useDiffMoney = create<DiffMoneyType>((set) => ({
diffMoney: 0,
setNewDiff: (diff: number) => set({diffMoney: diff})
}));

@ -0,0 +1,38 @@
import moment from "moment";
import { create } from "zustand";
import { devtools } from "zustand/middleware";
interface CartStore {
notEnoughMoneyAmount: number;
siteReadyPayCart: Record<string, string> | null;
}
const initialState: CartStore = {
notEnoughMoneyAmount: 0,
siteReadyPayCart: null
}
//Была попытка оплатить корзину. Тут записанна недостающая сумма.
export const useNotEnoughMoneyAmount = create<CartStore>()(
devtools(
(get, set) => initialState,
{
name: "notEnoughMoneyAmount",
enabled: process.env.NODE_ENV === "development",
trace: true,
actionsBlacklist: "rejected",
}
)
);
export const setNotEnoughMoneyAmount = (amount: number) => useNotEnoughMoneyAmount.setState({ notEnoughMoneyAmount: amount });
export const setSiteReadyPayCart = (flag: Record<string, string> | null) => useNotEnoughMoneyAmount.setState({ siteReadyPayCart: flag });
export const startPayCartProcess = (userId: string) => setSiteReadyPayCart({ [userId]: moment().add(20, 'minutes').format("X") });
export const cancelPayCartProcess = () => setSiteReadyPayCart(null);
export const calcTimeOfReadyPayCart = (deadline: string) => {
const ready = Number(deadline) > Number(moment().format("X"))
if (!ready) {
cancelPayCartProcess()
}
return ready
}

@ -0,0 +1,25 @@
import { Privilege } from "@frontend/kitui";
import { create } from "zustand"
import { devtools } from "zustand/middleware"
interface RequestSquizCreate {
isRSCOpen: boolean;
}
const initialState: RequestSquizCreate = {
isRSCOpen: false
}
export const useRequestSquizCreate = create<RequestSquizCreate>()(
devtools(
(get, set) => initialState,
{
name: "Privileges",
enabled: process.env.NODE_ENV === "development",
}
)
)
export const RSCOpen = () => useRequestSquizCreate.setState({ isRSCOpen: true })
export const RSCClose = () => useRequestSquizCreate.setState({ isRSCOpen: false })

@ -14,23 +14,42 @@ import { patchUser } from "@root/api/user"
import { UserAccountSettingsFieldStatus, VerificationStatus } from "@root/model/account" import { UserAccountSettingsFieldStatus, VerificationStatus } from "@root/model/account"
import { patchCurrency, deleteCart, patchCart } from "@root/api/cart" import { patchCurrency, deleteCart, patchCart } from "@root/api/cart"
import { User, UserAccount, UserName, getInitials, patchUserAccount } from "@frontend/kitui" import { User, UserAccount, UserName, getInitials, patchUserAccount } from "@frontend/kitui"
import { setNotEnoughMoneyAmount } from "./cart"; import { cancelPayCartProcess, setNotEnoughMoneyAmount, setSiteReadyPayCart, useNotEnoughMoneyAmount } from "./notEnoughMoneyAmount";
type Privilege = {
amount: number;
created_at: string;
id: string;
privilege_id: string;
privilege_name: string;
};
interface UserStore { interface UserStore {
userId: string | null; userId: string | null;
user: User | null; user: User | null;
userAccount: UserAccount | null; userAccount: UserAccount | null;
settingsFields: UserSettingsFieldStatus & UserAccountSettingsFieldStatus & { hasError: boolean }; settingsFields: UserSettingsFieldStatus & UserAccountSettingsFieldStatus & { hasError: boolean };
verificationStatus: VerificationStatus; verificationStatus: VerificationStatus;
verificationType: "juridical" | "nko"; verificationType: "juridical" | "nko";
isDocumentsDialogOpen: boolean; isDocumentsDialogOpen: boolean;
dialogType: "juridical" | "nko" | ""; dialogType: "juridical" | "nko" | "";
documents: UserDocuments; documents: UserDocuments;
documentsUrl: UserDocumentsUrl; documentsUrl: UserDocumentsUrl;
comment: string; comment: string;
initials: string; initials: string;
quizUserAccount: OriginalUserSquizAccount | null;
} }
export type OriginalUserSquizAccount = {
created_at: string;
deleted: boolean;
email: string;
id: string;
privileges: Record<string, Privilege>;
privilege_name: string;
};
const defaultFieldValues = { const defaultFieldValues = {
value: "", value: "",
error: null, error: null,
@ -58,6 +77,7 @@ const initialState: UserStore = {
userId: null, userId: null,
user: null, user: null,
userAccount: null, userAccount: null,
quizUserAccount: null,
settingsFields: { ...defaultFields }, settingsFields: { ...defaultFields },
verificationStatus: VerificationStatus.NOT_VERIFICATED, verificationStatus: VerificationStatus.NOT_VERIFICATED,
verificationType: "juridical", verificationType: "juridical",
@ -103,10 +123,22 @@ export const useUserStore = create<UserStore>()(
export const setVerificationStatus = (verificationStatus: VerificationStatus) => export const setVerificationStatus = (verificationStatus: VerificationStatus) =>
useUserStore.setState({ verificationStatus }) useUserStore.setState({ verificationStatus })
export const setVerificationType = (verificationType: "nko" | "org") => export const setVerificationType = (verificationType: UserAccount["status"]) =>
useUserStore.setState({ useUserStore.setState({
verificationType: verificationType === "org" ? "juridical" : "nko", verificationType: verificationType === "org" ? "juridical" : "nko",
}) })
export const setUserStatus = (status: UserAccount["status"]) =>
useUserStore.setState(
produce<UserStore>((state) => {
if (state.userAccount !== null) state.userAccount.status = status
})
)
export const setWallet = (wallet: UserAccount["wallet"]) =>
useUserStore.setState(
produce<UserStore>((state) => {
if (state.userAccount !== null) state.userAccount.wallet = wallet
})
)
export const setUserId = (userId: string | null) => useUserStore.setState({ userId }) export const setUserId = (userId: string | null) => useUserStore.setState({ userId })
export const setUser = (user: User) => export const setUser = (user: User) =>
@ -114,7 +146,7 @@ export const setUser = (user: User) =>
produce<UserStore>((state) => { produce<UserStore>((state) => {
state.user = user state.user = user
state.settingsFields.email.value = user?.email ?? "" state.settingsFields.email.value = user?.email || user?.login || ""
state.settingsFields.phoneNumber.value = user?.phoneNumber ?? "" state.settingsFields.phoneNumber.value = user?.phoneNumber ?? ""
state.settingsFields.password.value = "" state.settingsFields.password.value = ""
}) })
@ -139,12 +171,36 @@ export const setUserAccount = (user: UserAccount) =>
} }
) )
export const setCart = (cart: string[]) => export const setQuizUserAccount = (quizUserAccount: OriginalUserSquizAccount) => useUserStore.setState({ quizUserAccount });
export const setNewNames = (name: UserName) =>
useUserStore.setState( useUserStore.setState(
produce<UserStore>((state) => { produce<UserStore>((state) => {
if (state.userAccount) state.userAccount.cart = cart state.settingsFields.firstname.value = name.firstname ?? ""
state.settingsFields.secondname.value = name.secondname ?? ""
state.settingsFields.middlename.value = name.middlename ?? ""
state.settingsFields.orgname.value = name.orgname ?? ""
}),
false,
{
type: "setNewNames",
payload: name,
}
)
export const setCart = (cart: string[]) => {
useUserStore.setState(
produce<UserStore>((state) => {
if (state.userAccount) {
state.userAccount.cart = cart
}
}) })
) )
//Изменение корзины ведёт к отмене этих 2 параметров всегда
setNotEnoughMoneyAmount(0)
cancelPayCartProcess()
}
export const setComment = (comment: string) => useUserStore.setState({ comment }) export const setComment = (comment: string) => useUserStore.setState({ comment })
@ -216,7 +272,7 @@ export const setUploadedDocument = (type: UserDocumentTypes, fileName: string, u
}) })
) )
export const setSettingsField = (fieldName: UserSettingsField | keyof UserName, value: string) => export const setSettingsField = (fieldName: UserSettingsField | keyof UserName, value: string) =>
useUserStore.setState( useUserStore.setState(
produce<UserStore>((state) => { produce<UserStore>((state) => {
if (!state.settingsFields) return if (!state.settingsFields) return
@ -247,15 +303,15 @@ export const sendUserData = async () => {
if (!state.settingsFields) return if (!state.settingsFields) return
const isPatchingUser = const isPatchingUser =
state.settingsFields.email.touched || state.settingsFields.email.touched ||
state.settingsFields.password.touched || state.settingsFields.password.touched ||
state.settingsFields.phoneNumber.touched state.settingsFields.phoneNumber.touched
const isPatchingUserAccount = const isPatchingUserAccount =
state.settingsFields.firstname.touched || state.settingsFields.firstname.touched ||
state.settingsFields.secondname.touched || state.settingsFields.secondname.touched ||
state.settingsFields.middlename.touched || state.settingsFields.middlename.touched ||
state.settingsFields.orgname.touched state.settingsFields.orgname.touched
const userPayload: PatchUserRequest = {} const userPayload: PatchUserRequest = {}
@ -273,7 +329,7 @@ export const sendUserData = async () => {
await Promise.all([ await Promise.all([
isPatchingUser && patchUser(userPayload).then(([user]) => user && setUser(user)), isPatchingUser && patchUser(userPayload).then(([user]) => user && setUser(user)),
isPatchingUserAccount && patchUserAccount(userAccountPayload).then(setUserAccount), isPatchingUserAccount && patchUserAccount(userAccountPayload, "v1.0.1").then(setUserAccount),
]) ])
} }
@ -283,11 +339,11 @@ export const addTariffToCart = async (tariffId: string) => {
if (patchCartError === undefined) { if (patchCartError === undefined) {
setCart(patchCartResponse) setCart(patchCartResponse)
} }
return({patchCartResponse, patchCartError}) return ({ patchCartResponse, patchCartError })
} }
export const removeTariffFromCart = async (tariffId: string) => { export const removeTariffFromCart = async (tariffId: string) => {
setNotEnoughMoneyAmount(0); setNotEnoughMoneyAmount(0);
const [deleteCartResponse, deleteCartError] = await deleteCart(tariffId) const [deleteCartResponse, deleteCartError] = await deleteCart(tariffId)
if (!deleteCartError) { if (!deleteCartError) {

@ -0,0 +1,61 @@
import { useEffect, useLayoutEffect, useRef } from "react";
import { createUserAccount, devlog, getAuthToken, setAuthToken } from "@frontend/kitui";
import { isAxiosError } from "axios";
import makeRequest from "@api/makeRequest";
import type { UserAccount } from "@frontend/kitui";
export const useUserAccountFetcher = <T = UserAccount>({
onError,
onNewUserAccount,
url,
userId,
}: {
url: string;
userId: string | null;
onNewUserAccount: (response: T) => void;
onError?: (error: any) => void;
}) => {
console.log("начало работы useUserAccountFetcher")
const onNewUserAccountRef = useRef(onNewUserAccount);
const onErrorRef = useRef(onError);
useLayoutEffect(() => {
onNewUserAccountRef.current = onNewUserAccount;
onErrorRef.current = onError;
}, [onError, onNewUserAccount]);
useEffect(() => {
if (!userId) return;
const controller = new AbortController();
makeRequest<never, T>({
url,
contentType: true,
method: "GET",
useToken: true,
withCredentials: false,
signal: controller.signal,
})
.then((result) => {
devlog("User account", result);
onNewUserAccountRef.current(result);
})
.catch((error) => {
devlog("Error fetching user account", error);
if (isAxiosError(error) && error.response?.status === 404) {
createUserAccount(controller.signal, url.replace("get", "create"), "v1.0.1")
.then((result) => {
devlog("Created user account", result);
onNewUserAccountRef.current(result as T);
})
.catch((error) => {
if (error.response?.status === 409) return;
devlog("Error creating user account", error);
onErrorRef.current?.(error);
});
} else {
onErrorRef.current?.(error);
}
});
return () => controller.abort();
}, [url, userId]);
};

@ -0,0 +1,72 @@
import { payCart } from "@root/api/cart";
import { calcTimeOfReadyPayCart, cancelPayCartProcess, setNotEnoughMoneyAmount, setSiteReadyPayCart, startPayCartProcess, useNotEnoughMoneyAmount } from "@root/stores/notEnoughMoneyAmount";
import { useUserStore } from "@root/stores/user";
import moment from "moment";
import { enqueueSnackbar } from "notistack";
import { useEffect } from "react";
import { useSearchParams } from "react-router-dom";
import { RSCOpen } from "@root/stores/requestSquizCreate";
import { useCartTariffs } from "./useCartTariffs";
export const useAfterPay = () => {
const [searchParams, setSearchParams] = useSearchParams();
const userId = useUserStore(store => store.userId)
const userAccount = useUserStore(state => state.userAccount);
const siteReadyPayCart = useNotEnoughMoneyAmount(state => state.siteReadyPayCart);
const cartTariffs = useCartTariffs();
console.log("cartTariffs")
// console.log(cartTariffs)
// const isCC = cartTariffs !== null && cartTariffs !== undefined && cartTariffs.length > 0 && cartTariffs.some(t => t.privileges[0].privilegeId === "quizManual")
const purpose = searchParams.get("purpose");
const from = searchParams.get("from");
const action = searchParams.get("action");
const paymentUserId = searchParams.get("userid");
useEffect(() => {
//Звёзды сошлись, будем оплачивать корзину
if (from !== "quiz" && paymentUserId && paymentUserId === userId) {
//Чистим url адрес от параметров. (Если нет action. Если есть - значит мы пришли из квиза)
if (action === null) setSearchParams({}, { replace: true })
// navigate(`/tariffs`, {
// replace: true,
// });
if (purpose === "paycart") {
(async () => {
//Проверяем можем ли мы оплатить корзину здесь и сейчас
const [, payCartError] = await payCart();
if (payCartError) {
//Не получилось купить корзину. Ставим флаг, что сайт в состоянии ожидания пополнения счёта для оплаты
startPayCartProcess(paymentUserId)
} else {
enqueueSnackbar("Товары успешно приобретены")
cancelPayCartProcess()
if (true) RSCOpen()
}
})()
}
}
}, [purpose, from, paymentUserId])
useEffect(() => {
if (userId !== null && siteReadyPayCart !== null && siteReadyPayCart[userId] !== undefined) {
const deadline = siteReadyPayCart[userId]
if (calcTimeOfReadyPayCart(deadline)) {
//Время ещё не вышло. У нас стоит флаг покупать корзину если время не вышло.
(async () => {
const [, payCartError] = await payCart();
if (!payCartError) {
enqueueSnackbar("Товары успешно приобретены")
cancelPayCartProcess()
}
})()
}
}
}, [userAccount, userId, siteReadyPayCart])
}

@ -0,0 +1,66 @@
import { Ticket, UserAccount, UserName, getAuthToken, useSSESubscription } from "@frontend/kitui"
import { setCart, setNewNames, setUserStatus, setWallet, useUserStore } from "@root/stores/user";
import { useSSETab } from "./useSSETab";
import { cancelPayCartProcess } from "@root/stores/notEnoughMoneyAmount";
type Ping = [{ event: "ping" }]
type SomeChange = [{
"id": UserAccount["_id"],
"userId": UserAccount["userId"],
"cart": UserAccount["cart"],
"wallet": {
"cash": UserAccount["wallet"]["cash"],
"currency": UserAccount["wallet"]["currency"],
"spent": UserAccount["wallet"]["spent"],
"purchasesAmount": UserAccount["wallet"]["purchasesAmount"],
"money": UserAccount["wallet"]["money"],
"lastPaymentId": string;
},
"name": UserName,
"status": UserAccount["status"],
"isDeleted": UserAccount["isDeleted"],
"createdAt": UserAccount["createdAt"];
"updatedAt": UserAccount["updatedAt"];
"from": string;
"partner": string;
}]
type PipeMessage = Ping | SomeChange
export const usePipeSubscriber = () => {
const token = getAuthToken();
const userId = useUserStore((state) => state.userId);
const { isActiveSSETab, updateSSEValue } = useSSETab<Ticket[]>("pipe");
useSSESubscription({
enabled: Boolean(token) && Boolean(userId) && isActiveSSETab,
url:
process.env.REACT_APP_DOMAIN +
`/customer/v1.0.1/account/pipe?Authorization=${token}`,
onNewData: (data) => {
let message = data[0] as PipeMessage
updateSSEValue(message)
//Пропускаем пингование
if ('event' in message && message.event === "ping") return
if ('cart' in message) {
setCart(message.cart as string[])
cancelPayCartProcess()
}
else if ('wallet' in message) {
setWallet(message.wallet as UserAccount["wallet"])
cancelPayCartProcess()
}
else if ('name' in message) {
setNewNames(message.name as UserName)
}
else if ('status' in message) {
setUserStatus(message.status as UserAccount["status"])
}
},
marker: "pipe",
});
}

@ -74,6 +74,7 @@ export const useSSETab = <T = unknown>(
}; };
const setOpenTime = () => { const setOpenTime = () => {
//Время установлено - пропускаем
if (openTimeSetted) { if (openTimeSetted) {
return; return;
} }

@ -1,4 +1,5 @@
import type { Attachment } from "@root/model/attachment" import type { Attachment } from "@root/model/attachment"
import { transliterate } from 'transliteration';
type KeyValue<T = string> = { type KeyValue<T = string> = {
[key: string]: T; [key: string]: T;
@ -24,11 +25,15 @@ export const jsonToFormdata = (
json: KeyValue<string | Attachment> json: KeyValue<string | Attachment>
): FormData => { ): FormData => {
const formData = new FormData() const formData = new FormData()
if (json.egrule !== undefined) delete json.egrule
console.log("json")
console.log(json)
for (const key in json) { for (const key in json) {
if (!key) continue if (!key) continue
const value = json[key] const value = json[key]
if (typeof value !== "string") value.name = transliterate(value.name.replace(/\s/g, '_'))
if (typeof value !== "string") { if (typeof value !== "string") {
formData.append(key, convertBinaryStringToFile(value)) formData.append(key, convertBinaryStringToFile(value))
@ -38,6 +43,7 @@ export const jsonToFormdata = (
formData.append(key, value) formData.append(key, value)
} }
console.log("formData")
console.log(formData)
return formData return formData
} }

@ -1,8 +1,9 @@
import { Navigate, Outlet } from "react-router-dom" import { Navigate, Outlet, useLocation } from "react-router-dom"
import { useUserStore } from "@root/stores/user" import { useUserStore } from "@root/stores/user"
export default function PrivateRoute() { export default function PrivateRoute() {
const location = useLocation()
const user = useUserStore(state => state.user) const user = useUserStore(state => state.user)
return user ? <Outlet /> : <Navigate to="/" replace /> return user ? <Outlet /> : <Navigate to="/" replace />

104
yarn.lock

@ -1138,6 +1138,13 @@
dependencies: dependencies:
regenerator-runtime "^0.14.0" regenerator-runtime "^0.14.0"
"@babel/runtime@^7.25.0":
version "7.25.0"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.25.0.tgz#3af9a91c1b739c569d5d80cc917280919c544ecb"
integrity sha512-7dRy4DwXwtzBrPbZflqxnvfxLF8kdZXPkhymtDeFoFqE6ldzjQFgYTtYIFARcLEYDrqfBfYcZt1WqFxRoyC9Rw==
dependencies:
regenerator-runtime "^0.14.0"
"@babel/template@^7.22.15", "@babel/template@^7.24.0", "@babel/template@^7.3.3": "@babel/template@^7.22.15", "@babel/template@^7.24.0", "@babel/template@^7.3.3":
version "7.24.0" version "7.24.0"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.24.0.tgz#c6a524aa93a4a05d66aaf31654258fae69d87d50" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.24.0.tgz#c6a524aa93a4a05d66aaf31654258fae69d87d50"
@ -1626,10 +1633,10 @@
resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.2.1.tgz#16308cea045f0fc777b6ff20a9f25474dd8293d2" resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.2.1.tgz#16308cea045f0fc777b6ff20a9f25474dd8293d2"
integrity sha512-9TANp6GPoMtYzQdt54kfAyMmz1+osLlXdg2ENroU7zzrtflTLrrC/lgrIfaSe+Wu0b89GKccT7vxXA0MoAIO+Q== integrity sha512-9TANp6GPoMtYzQdt54kfAyMmz1+osLlXdg2ENroU7zzrtflTLrrC/lgrIfaSe+Wu0b89GKccT7vxXA0MoAIO+Q==
"@frontend/kitui@^1.0.82": "@frontend/kitui@^1.0.86":
version "1.0.82" version "1.0.86"
resolved "https://penahub.gitlab.yandexcloud.net/api/v4/projects/21/packages/npm/@frontend/kitui/-/@frontend/kitui-1.0.82.tgz#696ab79a14357608c20bcdf47aadd5a77155f609" resolved "https://penahub.gitlab.yandexcloud.net/api/v4/projects/21/packages/npm/@frontend/kitui/-/@frontend/kitui-1.0.86.tgz#03a56b99403b62810134f3d7da01ea3fc8cc4f7f"
integrity sha1-aWq3mhQ1dgjCC830eq3Vp3FV9gk= integrity sha1-A6VrmUA7YoEBNPPX2gHqP8jMT38=
dependencies: dependencies:
immer "^10.0.2" immer "^10.0.2"
reconnecting-eventsource "^1.6.2" reconnecting-eventsource "^1.6.2"
@ -2203,6 +2210,15 @@
"@mui/utils" "^5.15.14" "@mui/utils" "^5.15.14"
prop-types "^15.8.1" prop-types "^15.8.1"
"@mui/private-theming@^5.16.6":
version "5.16.6"
resolved "https://registry.yarnpkg.com/@mui/private-theming/-/private-theming-5.16.6.tgz#547671e7ae3f86b68d1289a0b90af04dfcc1c8c9"
integrity sha512-rAk+Rh8Clg7Cd7shZhyt2HGTTE5wYKNSJ5sspf28Fqm/PZ69Er9o6KX25g03/FG2dfpg5GCwZh/xOojiTfm3hw==
dependencies:
"@babel/runtime" "^7.23.9"
"@mui/utils" "^5.16.6"
prop-types "^15.8.1"
"@mui/styled-engine@^5.15.14": "@mui/styled-engine@^5.15.14":
version "5.15.14" version "5.15.14"
resolved "https://registry.yarnpkg.com/@mui/styled-engine/-/styled-engine-5.15.14.tgz#168b154c4327fa4ccc1933a498331d53f61c0de2" resolved "https://registry.yarnpkg.com/@mui/styled-engine/-/styled-engine-5.15.14.tgz#168b154c4327fa4ccc1933a498331d53f61c0de2"
@ -2213,6 +2229,16 @@
csstype "^3.1.3" csstype "^3.1.3"
prop-types "^15.8.1" prop-types "^15.8.1"
"@mui/styled-engine@^5.16.6":
version "5.16.6"
resolved "https://registry.yarnpkg.com/@mui/styled-engine/-/styled-engine-5.16.6.tgz#60110c106dd482dfdb7e2aa94fd6490a0a3f8852"
integrity sha512-zaThmS67ZmtHSWToTiHslbI8jwrmITcN93LQaR2lKArbvS7Z3iLkwRoiikNWutx9MBs8Q6okKvbZq1RQYB3v7g==
dependencies:
"@babel/runtime" "^7.23.9"
"@emotion/cache" "^11.11.0"
csstype "^3.1.3"
prop-types "^15.8.1"
"@mui/system@^5.15.15": "@mui/system@^5.15.15":
version "5.15.15" version "5.15.15"
resolved "https://registry.yarnpkg.com/@mui/system/-/system-5.15.15.tgz#658771b200ce3c4a0f28e58169f02e5e718d1c53" resolved "https://registry.yarnpkg.com/@mui/system/-/system-5.15.15.tgz#658771b200ce3c4a0f28e58169f02e5e718d1c53"
@ -2227,11 +2253,30 @@
csstype "^3.1.3" csstype "^3.1.3"
prop-types "^15.8.1" prop-types "^15.8.1"
"@mui/system@^5.16.5":
version "5.16.7"
resolved "https://registry.yarnpkg.com/@mui/system/-/system-5.16.7.tgz#4583ca5bf3b38942e02c15a1e622ba869ac51393"
integrity sha512-Jncvs/r/d/itkxh7O7opOunTqbbSSzMTHzZkNLM+FjAOg+cYAZHrPDlYe1ZGKUYORwwb2XexlWnpZp0kZ4AHuA==
dependencies:
"@babel/runtime" "^7.23.9"
"@mui/private-theming" "^5.16.6"
"@mui/styled-engine" "^5.16.6"
"@mui/types" "^7.2.15"
"@mui/utils" "^5.16.6"
clsx "^2.1.0"
csstype "^3.1.3"
prop-types "^15.8.1"
"@mui/types@^7.2.14": "@mui/types@^7.2.14":
version "7.2.14" version "7.2.14"
resolved "https://registry.yarnpkg.com/@mui/types/-/types-7.2.14.tgz#8a02ac129b70f3d82f2f9b76ded2c8d48e3fc8c9" resolved "https://registry.yarnpkg.com/@mui/types/-/types-7.2.14.tgz#8a02ac129b70f3d82f2f9b76ded2c8d48e3fc8c9"
integrity sha512-MZsBZ4q4HfzBsywtXgM1Ksj6HDThtiwmOKUXH1pKYISI9gAVXCNHNpo7TlGoGrBaYWZTdNoirIN7JsQcQUjmQQ== integrity sha512-MZsBZ4q4HfzBsywtXgM1Ksj6HDThtiwmOKUXH1pKYISI9gAVXCNHNpo7TlGoGrBaYWZTdNoirIN7JsQcQUjmQQ==
"@mui/types@^7.2.15":
version "7.2.15"
resolved "https://registry.yarnpkg.com/@mui/types/-/types-7.2.15.tgz#dadd232fe9a70be0d526630675dff3b110f30b53"
integrity sha512-nbo7yPhtKJkdf9kcVOF8JZHPZTmqXjJ/tI0bdWgHg5tp9AnIN4Y7f7wm9T+0SyGYJk76+GYZ8Q5XaTYAsUHN0Q==
"@mui/utils@^5.15.14": "@mui/utils@^5.15.14":
version "5.15.14" version "5.15.14"
resolved "https://registry.yarnpkg.com/@mui/utils/-/utils-5.15.14.tgz#e414d7efd5db00bfdc875273a40c0a89112ade3a" resolved "https://registry.yarnpkg.com/@mui/utils/-/utils-5.15.14.tgz#e414d7efd5db00bfdc875273a40c0a89112ade3a"
@ -2242,6 +2287,31 @@
prop-types "^15.8.1" prop-types "^15.8.1"
react-is "^18.2.0" react-is "^18.2.0"
"@mui/utils@^5.16.5", "@mui/utils@^5.16.6":
version "5.16.6"
resolved "https://registry.yarnpkg.com/@mui/utils/-/utils-5.16.6.tgz#905875bbc58d3dcc24531c3314a6807aba22a711"
integrity sha512-tWiQqlhxAt3KENNiSRL+DIn9H5xNVK6Jjf70x3PnfQPz1MPBdh7yyIcAyVBT9xiw7hP3SomRhPR7hzBMBCjqEA==
dependencies:
"@babel/runtime" "^7.23.9"
"@mui/types" "^7.2.15"
"@types/prop-types" "^15.7.12"
clsx "^2.1.1"
prop-types "^15.8.1"
react-is "^18.3.1"
"@mui/x-date-pickers@^7.13.0":
version "7.13.0"
resolved "https://registry.yarnpkg.com/@mui/x-date-pickers/-/x-date-pickers-7.13.0.tgz#1afe20dc7ee30c9c1f91c232f3c61f94d2b8427b"
integrity sha512-cmpAfkzOjUgL4I8WenU4elm1QJO8vWpGmIPCezT3Q9wFjGL1QApQhJ5gMZ+X4tM6Gha9AhIWNQX5eXHKbSoyFQ==
dependencies:
"@babel/runtime" "^7.25.0"
"@mui/system" "^5.16.5"
"@mui/utils" "^5.16.5"
"@types/react-transition-group" "^4.4.10"
clsx "^2.1.1"
prop-types "^15.8.1"
react-transition-group "^4.4.5"
"@nicolo-ribaudo/eslint-scope-5-internals@5.1.1-v1": "@nicolo-ribaudo/eslint-scope-5-internals@5.1.1-v1":
version "5.1.1-v1" version "5.1.1-v1"
resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz#dbf733a965ca47b1973177dc0bb6c889edcfb129" resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz#dbf733a965ca47b1973177dc0bb6c889edcfb129"
@ -2873,7 +2943,7 @@
resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.3.tgz#3e51a17e291d01d17d3fc61422015a933af7a08f" resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.3.tgz#3e51a17e291d01d17d3fc61422015a933af7a08f"
integrity sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA== integrity sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==
"@types/prop-types@*", "@types/prop-types@^15.7.11": "@types/prop-types@*", "@types/prop-types@^15.7.11", "@types/prop-types@^15.7.12":
version "15.7.12" version "15.7.12"
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.12.tgz#12bb1e2be27293c1406acb6af1c3f3a1481d98c6" resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.12.tgz#12bb1e2be27293c1406acb6af1c3f3a1481d98c6"
integrity sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q== integrity sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==
@ -4449,6 +4519,11 @@ clsx@^2.0.0, clsx@^2.1.0:
resolved "https://registry.yarnpkg.com/clsx/-/clsx-2.1.0.tgz#e851283bcb5c80ee7608db18487433f7b23f77cb" resolved "https://registry.yarnpkg.com/clsx/-/clsx-2.1.0.tgz#e851283bcb5c80ee7608db18487433f7b23f77cb"
integrity sha512-m3iNNWpd9rl3jvvcBnu70ylMdrXt8Vlq4HYadnU5fwcOtvkSQWPmj7amUcDT2qYI7risszBjI5AUIUox9D16pg== integrity sha512-m3iNNWpd9rl3jvvcBnu70ylMdrXt8Vlq4HYadnU5fwcOtvkSQWPmj7amUcDT2qYI7risszBjI5AUIUox9D16pg==
clsx@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/clsx/-/clsx-2.1.1.tgz#eed397c9fd8bd882bfb18deab7102049a2f32999"
integrity sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==
co@^4.6.0: co@^4.6.0:
version "4.6.0" version "4.6.0"
resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184"
@ -8912,6 +8987,11 @@ mlly@^1.2.0, mlly@^1.4.2:
pkg-types "^1.0.3" pkg-types "^1.0.3"
ufo "^1.3.2" ufo "^1.3.2"
moment@^2.30.1:
version "2.30.1"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.30.1.tgz#f8c91c07b7a786e30c59926df530b4eac96974ae"
integrity sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==
ms@2.0.0: ms@2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
@ -10329,6 +10409,11 @@ react-is@^18.0.0, react-is@^18.2.0:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b"
integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==
react-is@^18.3.1:
version "18.3.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e"
integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==
react-pdf@^7.1.2: react-pdf@^7.1.2:
version "7.7.1" version "7.7.1"
resolved "https://registry.yarnpkg.com/react-pdf/-/react-pdf-7.7.1.tgz#8f5c4716a8ca65a0889825ef01e3a37956291334" resolved "https://registry.yarnpkg.com/react-pdf/-/react-pdf-7.7.1.tgz#8f5c4716a8ca65a0889825ef01e3a37956291334"
@ -11786,6 +11871,13 @@ tr46@~0.0.3:
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==
transliteration@^2.3.5:
version "2.3.5"
resolved "https://registry.yarnpkg.com/transliteration/-/transliteration-2.3.5.tgz#8f92309575f69e4a8a525dab4ff705ebcf961c45"
integrity sha512-HAGI4Lq4Q9dZ3Utu2phaWgtm3vB6PkLUFqWAScg/UW+1eZ/Tg6Exo4oC0/3VUol/w4BlefLhUUSVBr/9/ZGQOw==
dependencies:
yargs "^17.5.1"
tryer@^1.0.1: tryer@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/tryer/-/tryer-1.0.1.tgz#f2c85406800b9b0f74c9f7465b81eaad241252f8" resolved "https://registry.yarnpkg.com/tryer/-/tryer-1.0.1.tgz#f2c85406800b9b0f74c9f7465b81eaad241252f8"
@ -12825,7 +12917,7 @@ yargs@^16.2.0:
y18n "^5.0.5" y18n "^5.0.5"
yargs-parser "^20.2.2" yargs-parser "^20.2.2"
yargs@^17.3.1: yargs@^17.3.1, yargs@^17.5.1:
version "17.7.2" version "17.7.2"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269"
integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==