{"version":3,"file":"knowledge_change_plan-8d6d6135.js","sources":["../../../app/javascript/components/templates/knowledges/payment/TrialChangePlanView.tsx","../../../app/javascript/entries/reactEntries/knowledge_change_plan.ts"],"sourcesContent":["// @ts-nocheck\nimport React, { useEffect, useState } from \"react\";\nimport style from \"./TrialChangePlanView.module.scss\";\nimport PropTypes from \"prop-types\";\nimport { ChangePlanPriceList } from \"../../../common/Knowledges/Payment/ChangePlanPriceList\";\nimport { Modal } from \"react-bootstrap\";\nimport axios from \"axios\";\naxios.defaults.headers.common[\"X-Requested-With\"] = \"XMLHttpRequest\";\nimport { useTranslation } from \"react-i18next\";\n\nexport const TrialChangePlanView = (props) => {\n const { t, i18n } = useTranslation(\"translation\", { keyPrefix: \"TrialChangePlanView\" });\n const { knowledgeClientCode, learningQuantityInfo } = props;\n const [show, setShow] = useState(false);\n const [isDisabled, setIsDisabled] = useState(false);\n\n const handleShow = () => {\n setShow(true);\n };\n\n const handleClose = () => {\n setShow(false);\n };\n\n const createPlan = async (afterPlanInfo) => {\n setIsDisabled(true);\n await axios\n .post(\n `/${knowledgeClientCode}/settings/knowledge_stripe_subscriptions/checkout`,\n {\n knowledge_stripe_subscription: {\n learning_quantity_grade: afterPlanInfo.learning_quantity,\n llm_model: afterPlanInfo.plan,\n },\n },\n {\n headers: {\n \"X-CSRF-Token\": document.getElementsByName(\"csrf-token\")[0].content,\n \"Content-Type\": \"application/json\",\n },\n },\n )\n .then((res) => {\n window.location.href = res.data.redirect_url;\n })\n .catch(() => {})\n .finally(() => setIsDisabled(false));\n };\n\n useEffect(() => {\n i18n.changeLanguage(props.locale);\n }, []);\n\n return (\n <>\n
{t(\"usage\")}
\n