/* This file is part of GNU Taler (C) 2022 Taler Systems S.A. GNU Taler is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Taler; see the file COPYING. If not, see */ import { Fragment, h, VNode } from "preact"; import { LoadingError } from "../../components/LoadingError.js"; import { useTranslationContext } from "../../context/translation.js"; import { TermsState } from "./utils.js"; import { State } from "./index.js"; import { CheckboxOutlined } from "../../components/CheckboxOutlined.js"; import { LinkSuccess, TermsOfService, WarningBox, WarningText, } from "../../components/styled/index.js"; import { ExchangeXmlTos } from "../../components/ExchangeToS.js"; import { ToggleHandler } from "../../mui/handlers.js"; import { Button } from "../../mui/Button.js"; export function LoadingUriView({ error }: State.LoadingUriError): VNode { const { i18n } = useTranslationContext(); return ( Could not load} error={error} /> ); } export function ErrorAcceptingView({ error }: State.ErrorAccepting): VNode { const { i18n } = useTranslationContext(); return ( Could not load} error={error} /> ); } export function ShowButtonsAcceptedTosView({ termsAccepted, showingTermsOfService, terms, }: State.ShowButtonsAccepted): VNode { const { i18n } = useTranslationContext(); const ableToReviewTermsOfService = showingTermsOfService.button.onClick !== undefined; return ( {ableToReviewTermsOfService && (
Show terms of service
)}
I accept the exchange terms of service } onToggle={termsAccepted.button.onClick} />
); } export function ShowButtonsNonAcceptedTosView({ termsAccepted, showingTermsOfService, terms, }: State.ShowButtonsNotAccepted): VNode { const { i18n } = useTranslationContext(); const ableToReviewTermsOfService = showingTermsOfService.button.onClick !== undefined; if (!ableToReviewTermsOfService) { return ( {terms.status === "notfound" && (
Exchange doesn't have terms of service
)}
); } return ( {terms.status === "notfound" && (
Exchange doesn't have terms of service
)} {terms.status === "new" && (
)} {terms.status === "changed" && (
)}
); } export function ShowTosContentView({ termsAccepted, showingTermsOfService, terms, }: State.ShowContent): VNode { const { i18n } = useTranslationContext(); const ableToReviewTermsOfService = showingTermsOfService.button.onClick !== undefined; return ( {terms.status !== "notfound" && !terms.content && (
The exchange reply with a empty terms of service
)} {terms.content && (
{terms.content.type === "xml" && ( )} {terms.content.type === "plain" && (
{terms.content.content}
)} {terms.content.type === "html" && (