сценарии генерации урла на хаб
This commit is contained in:
parent
acfc9727ed
commit
0d0acfd7b9
@ -21,6 +21,7 @@ import { setUserAccount, setCustomerAccount } from "@/stores/user";
|
|||||||
import { quizApi } from "@api/quiz";
|
import { quizApi } from "@api/quiz";
|
||||||
import { setQuizes } from "@root/quizes/actions";
|
import { setQuizes } from "@root/quizes/actions";
|
||||||
import TooltipClickInfo from "@/ui_kit/Toolbars/TooltipClickInfo";
|
import TooltipClickInfo from "@/ui_kit/Toolbars/TooltipClickInfo";
|
||||||
|
import { generateHubWalletRequestURL } from "@/utils/generateHubWalletRequest";
|
||||||
|
|
||||||
const tariff = isTestServer ? "6844b8858258f5cc35791ef7" : "6851db40acfb4d3e5fcd9b19";
|
const tariff = isTestServer ? "6844b8858258f5cc35791ef7" : "6851db40acfb4d3e5fcd9b19";
|
||||||
export default function PersonalizationAI() {
|
export default function PersonalizationAI() {
|
||||||
@ -240,7 +241,15 @@ export default function PersonalizationAI() {
|
|||||||
//если денег не хватило
|
//если денег не хватило
|
||||||
if (payError?.includes("insufficient funds") || payError?.includes("Payment Required")) {
|
if (payError?.includes("insufficient funds") || payError?.includes("Payment Required")) {
|
||||||
var link = document.createElement("a");
|
var link = document.createElement("a");
|
||||||
link.href = `https://${isTestServer ? "s" : ""}hub.pena.digital/quizpayment?action=squizpay&dif=50000&data=${token}&userid=${userId}&from=AI&wayback=ai_${quiz?.backendId}`;
|
link.href = generateHubWalletRequestURL({
|
||||||
|
wayback: "edit",
|
||||||
|
action: "buy",
|
||||||
|
dif: "50000",
|
||||||
|
userid: userId,
|
||||||
|
additionalinformation: quiz?.backendId.toString(),
|
||||||
|
token
|
||||||
|
});
|
||||||
|
//link.href = `https://${isTestServer ? "s" : ""}hub.pena.digital/quizpayment?action=squizpay&dif=50000&data=${token}&userid=${userId}&from=AI&wayback=ai_${quiz?.backendId}`;
|
||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
link.click();
|
link.click();
|
||||||
return;
|
return;
|
||||||
@ -289,7 +298,7 @@ export default function PersonalizationAI() {
|
|||||||
lineHeight: "21.4px"
|
lineHeight: "21.4px"
|
||||||
}}>
|
}}>
|
||||||
Данный раздел позволяет вам создавать персонализированный опрос под каждую целевую аудиторию отдельно, наш AI перефразирует ваши вопросы согласно настройкам.
|
Данный раздел позволяет вам создавать персонализированный опрос под каждую целевую аудиторию отдельно, наш AI перефразирует ваши вопросы согласно настройкам.
|
||||||
<br/>Для этого нужно выбрать пол и возраст вашей аудитории и получите персональную ссылку с нужными настройками в списке ниже.
|
<br />Для этого нужно выбрать пол и возраст вашей аудитории и получите персональную ссылку с нужными настройками в списке ниже.
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography sx={{
|
<Typography sx={{
|
||||||
color: theme.palette.grey3.main, fontSize: "18px", maxWidth: 796, m: 0,
|
color: theme.palette.grey3.main, fontSize: "18px", maxWidth: 796, m: 0,
|
||||||
|
@ -28,6 +28,7 @@ import { useDiscounts } from '@utils/hooks/useDiscounts';
|
|||||||
import { PaymentConfirmationModal } from "./components/PaymentConfirmationModal";
|
import { PaymentConfirmationModal } from "./components/PaymentConfirmationModal";
|
||||||
import { TariffsHeader } from "./components/TariffsHeader";
|
import { TariffsHeader } from "./components/TariffsHeader";
|
||||||
import { inCart, outCart } from "./utils";
|
import { inCart, outCart } from "./utils";
|
||||||
|
import { generateHubWalletRequestURL } from "@/utils/generateHubWalletRequest";
|
||||||
|
|
||||||
const StepperText: Record<string, string> = {
|
const StepperText: Record<string, string> = {
|
||||||
day: "Тарифы на время",
|
day: "Тарифы на время",
|
||||||
@ -70,7 +71,6 @@ console.log(tariffs)
|
|||||||
setCash(cs, cc, cr);
|
setCash(cs, cc, cr);
|
||||||
}
|
}
|
||||||
}, [userWithWallet]);
|
}, [userWithWallet]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (cc) {
|
if (cc) {
|
||||||
setIsRequestCreate(true)
|
setIsRequestCreate(true)
|
||||||
@ -104,8 +104,14 @@ console.log(tariffs)
|
|||||||
if (payError?.includes("insufficient funds") || payError?.includes("Payment Required")) {
|
if (payError?.includes("insufficient funds") || payError?.includes("Payment Required")) {
|
||||||
let cashDif = Number(payError.split(":")[1]);
|
let cashDif = Number(payError.split(":")[1]);
|
||||||
var link = document.createElement("a");
|
var link = document.createElement("a");
|
||||||
link.href = `https://${isTestServer ? "s" : ""}hub.pena.digital/quizpayment?action=squizpay&dif=${cashDif}&data=${token}&userid=${userId}`;
|
link.href = generateHubWalletRequestURL({
|
||||||
if (cc) link.href = link.href + "&cc=true"//после покупки тарифа и возвращения будем знать что надо открыть модалку
|
action: cc ? "createquizcc" : "buy",
|
||||||
|
dif: cashDif.toString(),
|
||||||
|
userid: userId,
|
||||||
|
token
|
||||||
|
});
|
||||||
|
// link.href = `https://${isTestServer ? "s" : ""}hub.pena.digital/quizpayment?action=squizpay&dif=${cashDif}&data=${token}&userid=${userId}`;
|
||||||
|
// if (cc) link.href = link.href + "&cc=true"//после покупки тарифа и возвращения будем знать что надо открыть модалку
|
||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
link.click();
|
link.click();
|
||||||
return;
|
return;
|
||||||
|
24
src/utils/generateHubWalletRequest.ts
Normal file
24
src/utils/generateHubWalletRequest.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import { isTestServer } from "./hooks/useDomainDefine";
|
||||||
|
|
||||||
|
export const generateHubWalletRequestURL = ({
|
||||||
|
wayback,
|
||||||
|
action,
|
||||||
|
dif,
|
||||||
|
userid,
|
||||||
|
additionalinformation,
|
||||||
|
token
|
||||||
|
}:{
|
||||||
|
wayback?: string;
|
||||||
|
action: "topupwallet" | "createquizcc" | "buy";
|
||||||
|
dif: string;
|
||||||
|
userid: string;
|
||||||
|
additionalinformation?: string;
|
||||||
|
token: string;
|
||||||
|
}) => {
|
||||||
|
let currentDomain = window.location.host;
|
||||||
|
if (currentDomain === "localhost") currentDomain += ":3000";
|
||||||
|
let url = `https://${isTestServer ? "s" : ""}hub.pena.digital/payment?fromdomain=${currentDomain}&action=${action}&dif=${dif}&userid=${userid}&sec=${token}`;
|
||||||
|
if (additionalinformation) url += `&additionalinformation=${additionalinformation}`;
|
||||||
|
if (wayback) url += `&wayback=${wayback}`;
|
||||||
|
return url;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user