/*
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 { ExchangeTosStatus } from "@gnu-taler/taler-util";
import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact";
import { CheckboxOutlined } from "../../components/CheckboxOutlined.js";
import { ExchangeXmlTos } from "../../components/ExchangeToS.js";
import {
Input,
LinkSuccess,
TermsOfServiceStyle,
WarningBox
} from "../../components/styled/index.js";
import { Button } from "../../mui/Button.js";
import { State } from "./index.js";
import { SelectList } from "../SelectList.js";
export function ShowButtonsAcceptedTosView({
termsAccepted,
showingTermsOfService,
children,
}: State.ShowButtonsAccepted): VNode {
const { i18n } = useTranslationContext();
return (
{showingTermsOfService.button.onClick !== undefined && (
Show terms of service
{termsAccepted.button.onClick !== undefined && (
I accept the exchange terms of service
}
onToggle={termsAccepted.button.onClick}
/>
)}
)}
{children}
);
}
export function ShowButtonsNonAcceptedTosView({
showingTermsOfService,
terms,
}: State.ShowButtonsNotAccepted): VNode {
const { i18n } = useTranslationContext();
// const ableToReviewTermsOfService =
// showingTermsOfService.button.onClick !== undefined;
// if (!ableToReviewTermsOfService) {
// return (
//
// {terms.status === ExchangeTosStatus.Pending && (
//
//
//
// Exchange doesn't have terms of service
//
//
//
// )}
//
// );
// }
return (
{/* {terms.status === ExchangeTosStatus.NotFound && (
Exchange doesn't have terms of service
)} */}
);
}
export function ShowTosContentView({
termsAccepted,
showingTermsOfService,
terms,
tosLang,
}: State.ShowContent): VNode {
const { i18n } = useTranslationContext();
const ableToReviewTermsOfService =
termsAccepted.button.onClick !== undefined;
return (
{!terms.content && (
The exchange replied with a empty terms of service
)}
{terms.content && (
{terms.content.type === "xml" &&
(!terms.content.document ? (
No terms of service. The exchange replied with a empty
document
) : (
))}
{terms.content.type === "plain" &&
(!terms.content.content ? (
No terms of service. The exchange replied with a empty text
) : (
{terms.content.content}
))}
{terms.content.type === "html" && (
)}
{terms.content.type === "pdf" && (
Download Terms of Service
)}
)}
{showingTermsOfService && ableToReviewTermsOfService && (
Hide terms of service
)}
{termsAccepted.button.onClick && terms.status !== ExchangeTosStatus.Accepted && (
I accept the exchange terms of service
}
onToggle={termsAccepted.button.onClick}
/>
)}
);
}