/* This file is part of GNU Taler (C) 2019 Taler Systems SA 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, VNode } from "preact" import { useState } from "preact/hooks" import { JSXInternal } from "preact/src/jsx" import { h } from 'preact'; export function ExchangeXmlTos({ doc }: { doc: Document }) { const termsNode = doc.querySelector('[ids=terms-of-service]') if (!termsNode) { return
not found
} return {Array.from(termsNode.children).map(renderChild)} } function renderChild(child: Element): VNode { const children = Array.from(child.children) switch (child.nodeName) { case 'title': return
{child.textContent}
case '#text': return case 'paragraph': return

{child.textContent}

case 'section': { return {children.map(renderChild)} } case 'bullet_list': { return } case 'enumerated_list': { return
    {children.map(renderChild)}
} case 'list_item': { return
  • {children.map(renderChild)}
  • } case 'block_quote': { return
    {children.map(renderChild)}
    } default: return
    unknown tag {child.nodeName}
    } } function AnchorWithOpenState(props: JSXInternal.HTMLAttributes) { const [open, setOpen] = useState(false) function doClick(e: JSXInternal.TargetedMouseEvent) { setOpen(!open); e.stopPropagation(); e.preventDefault(); } return }