// @requirements REQ-PRODUCT-TERMS-ADAPTERS REQ-PRODUCT-REACT REQ-PRODUCT-MOBILE import {createElement as h} from 'react'; import {TermsAcceptanceProvider,TermsAcceptanceControl,useTermsAcceptanceSnapshot} from '@notabenda/core/react/terms'; function Agreement({dark}){ const state=useTermsAcceptanceSnapshot(); return h('main',{id:'main',className:'nb-document'},h('header',{className:'agreement-intro'},h('p',{className:'nb-eyebrow'},'Terms agreement · React'),h('h1',null,'Read before',h('br'),'you agree.'),h('p',null,'Review the linked version. Checking the box is a draft; recording waits for confirmation.')), h('div',{id:'terms-control'},h(TermsAcceptanceControl,{fallback:h('p',null,'Agreement controls require JavaScript. The terms linked below remain readable.')})), h('aside',{className:'agreement-context','aria-labelledby':'agreement-context-title'},h('p',{className:'nb-eyebrow'},'Your agreement'),h('h2',{id:'agreement-context-title'},'One version.',h('br'),'One explicit choice.'),h('p',null,'The record keeps the document version, the statement and the time the server received it.'),h('p',{'data-agreement-state':true},state.status==='recorded'?'Agreement recorded.':state.status==='submitting'?'Awaiting confirmation.':state.status==='error'?'Recording not confirmed.':state.status==='destroyed'||state.status==='retired'?'This agreement context is closed.':'No confirmed agreement this visit.'),state.status==='recorded'&&state.receipt?h('a',{href:'/demo/admin/agreements/record?id='+state.receipt.id},'Inspect this agreement ↗'):null,h('a',{href:'/demo/admin/agreements'},'View agreement records ↗'),h('a',{href:dark?'/agreement/react/':'/dark/agreement/react/'},dark?'Light appearance ↗':'Midnight appearance ↗'),h('a',{href:'/agreement/astro/'},'Astro navigation example ↗'),h('details',null,h('summary',null,'Follow the React integration'),h('p',null,'One host-owned controller supplies the provider, native control and snapshot hook. Mounting and rendering submit nothing. The application owns its operation and controller lifetime.'),h('a',{href:'/guide/terms#react'},'Integration guide ↗')))); } export function ReactAgreementApp({controller,dark=false}){return h(TermsAcceptanceProvider,{controller},h(Agreement,{dark}));}