This commit is contained in:
Sebastian 2022-06-06 00:54:55 -03:00
parent e2a987a182
commit e96358c555
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1
77 changed files with 311 additions and 350 deletions

View File

@ -21,9 +21,7 @@
import { ComponentChildren, h, VNode } from "preact"; import { ComponentChildren, h, VNode } from "preact";
import { useLayoutEffect, useRef } from "preact/hooks"; import { useLayoutEffect, useRef } from "preact/hooks";
// import { LoadingModal } from "../modal"; import { useAsync } from "../hooks/async.js";
import { useAsync } from "../hooks/async";
// import { Translate } from "../../i18n";
type Props = { type Props = {
children: ComponentChildren; children: ComponentChildren;

View File

@ -1,6 +1,6 @@
import { FunctionalComponent, h } from "preact"; import { FunctionalComponent, h } from "preact";
import { TranslationProvider } from "../context/translation"; import { TranslationProvider } from "../context/translation.js";
import AnastasisClient from "../pages/home"; import AnastasisClient from "../pages/home/index.js";
const App: FunctionalComponent = () => { const App: FunctionalComponent = () => {
return ( return (

View File

@ -1,7 +1,7 @@
import { format, subYears } from "date-fns"; import { format, subYears } from "date-fns";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useLayoutEffect, useRef, useState } from "preact/hooks"; import { useLayoutEffect, useRef, useState } from "preact/hooks";
import { DatePicker } from "../picker/DatePicker"; import { DatePicker } from "../picker/DatePicker.js";
export interface DateInputProps { export interface DateInputProps {
label: string; label: string;

View File

@ -21,7 +21,7 @@
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useLayoutEffect, useRef, useState } from "preact/hooks"; import { useLayoutEffect, useRef, useState } from "preact/hooks";
import emptyImage from "../../assets/empty.png"; import emptyImage from "../../assets/empty.png";
import { TextInputProps } from "./TextInput"; import { TextInputProps } from "./TextInput.js";
const MAX_IMAGE_UPLOAD_SIZE = 1024 * 1024; const MAX_IMAGE_UPLOAD_SIZE = 1024 * 1024;

View File

@ -22,7 +22,7 @@
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import langIcon from "../../assets/icons/languageicon.svg"; import langIcon from "../../assets/icons/languageicon.svg";
import { useTranslationContext } from "../../context/translation"; import { useTranslationContext } from "../../context/translation.js";
import { strings as messages } from "../../i18n/strings.js"; import { strings as messages } from "../../i18n/strings.js";
type LangsNames = { type LangsNames = {

View File

@ -20,8 +20,6 @@
*/ */
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import logo from "../../assets/logo.jpeg";
import { LangSelector } from "./LangSelector";
interface Props { interface Props {
onMobileMenu: () => void; onMobileMenu: () => void;

View File

@ -19,11 +19,10 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { Fragment, h, VNode } from "preact";
import { BackupStates, RecoveryStates } from "@gnu-taler/anastasis-core"; import { BackupStates, RecoveryStates } from "@gnu-taler/anastasis-core";
import { useAnastasisContext } from "../../context/anastasis"; import { Fragment, h, VNode } from "preact";
import { Translate } from "../../i18n"; import { useAnastasisContext } from "../../context/anastasis.js";
import { LangSelector } from "./LangSelector"; import { Translate } from "../../i18n/index.js";
interface Props { interface Props {
mobile?: boolean; mobile?: boolean;

View File

@ -17,8 +17,8 @@
import { ComponentChildren, Fragment, h, VNode } from "preact"; import { ComponentChildren, Fragment, h, VNode } from "preact";
import Match from "preact-router/match"; import Match from "preact-router/match";
import { useEffect, useState } from "preact/hooks"; import { useEffect, useState } from "preact/hooks";
import { NavigationBar } from "./NavigationBar"; import { NavigationBar } from "./NavigationBar.js";
import { Sidebar } from "./SideBar"; import { Sidebar } from "./SideBar.js";
interface MenuProps { interface MenuProps {
title: string; title: string;

View File

@ -21,7 +21,7 @@
import { h, FunctionalComponent } from "preact"; import { h, FunctionalComponent } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { DurationPicker as TestedComponent } from "./DurationPicker"; import { DurationPicker as TestedComponent } from "./DurationPicker.js";
export default { export default {
title: "Components/Picker/Duration", title: "Components/Picker/Duration",

View File

@ -21,7 +21,7 @@
import { createContext, h, VNode } from "preact"; import { createContext, h, VNode } from "preact";
import { useContext } from "preact/hooks"; import { useContext } from "preact/hooks";
import { AnastasisReducerApi } from "../hooks/use-anastasis-reducer"; import { AnastasisReducerApi } from "../hooks/use-anastasis-reducer.js";
const initial = undefined; const initial = undefined;

View File

@ -21,9 +21,9 @@
import { createContext, h, VNode } from "preact"; import { createContext, h, VNode } from "preact";
import { useContext, useEffect } from "preact/hooks"; import { useContext, useEffect } from "preact/hooks";
import { useLang } from "../hooks"; import { useLang } from "../hooks/index.js";
import * as jedLib from "jed"; import * as jedLib from "jed";
import { strings } from "../i18n/strings"; import { strings } from "../i18n/strings.js";
interface Type { interface Type {
lang: string; lang: string;

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useCallback, useEffect, useRef, useState } from "preact/hooks"; import { useCallback, useEffect, useRef, useState } from "preact/hooks";
// import { cancelPendingRequest } from "./backend"; // import { cancelPendingRequest } from "./backend.js";
export interface Options { export interface Options {
slowTolerance: number; slowTolerance: number;

View File

@ -323,7 +323,9 @@ export function useAnastasisReducer(): AnastasisReducerApi {
}, },
}); });
}, },
async discoverMore(): Promise<void> {}, async discoverMore(): Promise<void> {
return;
},
async startRecover() { async startRecover() {
let s: ReducerState; let s: ReducerState;
if (remoteReducer) { if (remoteReducer) {
@ -403,7 +405,7 @@ export function useAnastasisReducer(): AnastasisReducerApi {
} }
class ReducerTxImpl implements ReducerTransactionHandle { class ReducerTxImpl implements ReducerTransactionHandle {
constructor(public transactionState: ReducerState) {} constructor(public transactionState: ReducerState) { }
async transition(action: string, args: any): Promise<ReducerState> { async transition(action: string, args: any): Promise<ReducerState> {
let s: ReducerState; let s: ReducerState;
if (remoteReducer) { if (remoteReducer) {

View File

@ -23,7 +23,7 @@
*/ */
import { ComponentChild, ComponentChildren, h, Fragment, VNode } from "preact"; import { ComponentChild, ComponentChildren, h, Fragment, VNode } from "preact";
import { useTranslationContext } from "../context/translation"; import { useTranslationContext } from "../context/translation.js";
export function useTranslator() { export function useTranslator() {
const ctx = useTranslationContext(); const ctx = useTranslationContext();

View File

@ -1,4 +1,4 @@
import App from "./components/app"; import App from "./components/app.js";
import "./scss/main.scss"; import "./scss/main.scss";
export default App; export default App;

View File

@ -1,6 +1,6 @@
import { setupI18n } from "@gnu-taler/taler-util"; import { setupI18n } from "@gnu-taler/taler-util";
import { h, render } from "preact"; import { h, render } from "preact";
import App from "./components/app"; import App from "./components/app.js";
function main(): void { function main(): void {
try { try {

View File

@ -20,8 +20,8 @@
*/ */
import { ReducerState } from "@gnu-taler/anastasis-core"; import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils"; import { createExample, reducerStatesExample } from "../../utils/index.js";
import { AddingProviderScreen as TestedComponent } from "./AddingProviderScreen"; import { AddingProviderScreen as TestedComponent } from "./AddingProviderScreen.js";
export default { export default {
title: "Pages/ManageProvider", title: "Pages/ManageProvider",

View File

@ -1,10 +1,10 @@
import { AuthenticationProviderStatusOk } from "@gnu-taler/anastasis-core"; import { AuthenticationProviderStatusOk } from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useEffect, useRef, useState } from "preact/hooks"; import { useEffect, useRef, useState } from "preact/hooks";
import { TextInput } from "../../components/fields/TextInput"; import { TextInput } from "../../components/fields/TextInput.js";
import { useAnastasisContext } from "../../context/anastasis"; import { useAnastasisContext } from "../../context/anastasis.js";
import { authMethods, KnownAuthMethods } from "./authMethod"; import { authMethods, KnownAuthMethods } from "./authMethod/index.js";
import { AnastasisClientFrame } from "./index"; import { AnastasisClientFrame } from "./index.js";
interface Props { interface Props {
providerType?: KnownAuthMethods; providerType?: KnownAuthMethods;

View File

@ -20,8 +20,8 @@
*/ */
import { ReducerState } from "@gnu-taler/anastasis-core"; import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils"; import { createExample, reducerStatesExample } from "../../utils/index.js";
import { AttributeEntryScreen as TestedComponent } from "./AttributeEntryScreen"; import { AttributeEntryScreen as TestedComponent } from "./AttributeEntryScreen.js";
export default { export default {
title: "Pages/PersonalInformation", title: "Pages/PersonalInformation",

View File

@ -2,12 +2,12 @@ import { UserAttributeSpec, validators } from "@gnu-taler/anastasis-core";
import { isAfter, parse } from "date-fns"; import { isAfter, parse } from "date-fns";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { DateInput } from "../../components/fields/DateInput"; import { DateInput } from "../../components/fields/DateInput.js";
import { PhoneNumberInput } from "../../components/fields/NumberInput"; import { PhoneNumberInput } from "../../components/fields/NumberInput.js";
import { TextInput } from "../../components/fields/TextInput"; import { TextInput } from "../../components/fields/TextInput.js";
import { useAnastasisContext } from "../../context/anastasis"; import { useAnastasisContext } from "../../context/anastasis.js";
import { ConfirmModal } from "./ConfirmModal"; import { ConfirmModal } from "./ConfirmModal.js";
import { AnastasisClientFrame, withProcessLabel } from "./index"; import { AnastasisClientFrame, withProcessLabel } from "./index.js";
export function AttributeEntryScreen(): VNode { export function AttributeEntryScreen(): VNode {
const reducer = useAnastasisContext(); const reducer = useAnastasisContext();
@ -177,7 +177,8 @@ function AttributeEntryField(props: AttributeEntryFieldProps): VNode {
)} )}
{props.spec.name === "full_name" && ( {props.spec.name === "full_name" && (
<div> <div>
If possible, use "LASTNAME, Firstname(s)" without abbreviations. If possible, use &quot;LASTNAME, Firstname(s)&quot; without
abbreviations.
</div> </div>
)} )}
<div class="block"> <div class="block">

View File

@ -20,8 +20,8 @@
*/ */
import { ReducerState } from "@gnu-taler/anastasis-core"; import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils"; import { createExample, reducerStatesExample } from "../../utils/index.js";
import { AuthenticationEditorScreen as TestedComponent } from "./AuthenticationEditorScreen"; import { AuthenticationEditorScreen as TestedComponent } from "./AuthenticationEditorScreen.js";
export default { export default {
title: "Pages/backup/AuthorizationMethod", title: "Pages/backup/AuthorizationMethod",

View File

@ -1,17 +1,17 @@
import { AuthMethod, ReducerStateBackup } from "@gnu-taler/anastasis-core"; import { AuthMethod, ReducerStateBackup } from "@gnu-taler/anastasis-core";
import { ComponentChildren, Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { useAnastasisContext } from "../../context/anastasis"; import { useAnastasisContext } from "../../context/anastasis.js";
import { AddingProviderScreen } from "./AddingProviderScreen"; import { AddingProviderScreen } from "./AddingProviderScreen.js";
import { import {
authMethods, authMethods,
AuthMethodSetupProps, AuthMethodSetupProps,
AuthMethodWithRemove, AuthMethodWithRemove,
isKnownAuthMethods, isKnownAuthMethods,
KnownAuthMethods, KnownAuthMethods,
} from "./authMethod"; } from "./authMethod/index.js";
import { ConfirmModal } from "./ConfirmModal"; import { ConfirmModal } from "./ConfirmModal.js";
import { AnastasisClientFrame } from "./index"; import { AnastasisClientFrame } from "./index.js";
const getKeys = Object.keys as <T extends object>(obj: T) => Array<keyof T>; const getKeys = Object.keys as <T extends object>(obj: T) => Array<keyof T>;
@ -226,7 +226,8 @@ export function AuthenticationEditorScreen(): VNode {
</p> </p>
{authAvailableSet.size > 0 && ( {authAvailableSet.size > 0 && (
<p class="block"> <p class="block">
We couldn't find provider for some of the authentication methods. We couldn&apos;t find provider for some of the authentication
methods.
</p> </p>
)} )}
</div> </div>

View File

@ -20,8 +20,8 @@
*/ */
import { ReducerState } from "@gnu-taler/anastasis-core"; import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils"; import { createExample, reducerStatesExample } from "../../utils/index.js";
import { BackupFinishedScreen as TestedComponent } from "./BackupFinishedScreen"; import { BackupFinishedScreen as TestedComponent } from "./BackupFinishedScreen.js";
export default { export default {
title: "Pages/backup/Finished", title: "Pages/backup/Finished",

View File

@ -1,8 +1,8 @@
import { AuthenticationProviderStatusOk } from "@gnu-taler/anastasis-core"; import { AuthenticationProviderStatusOk } from "@gnu-taler/anastasis-core";
import { format } from "date-fns"; import { format } from "date-fns";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useAnastasisContext } from "../../context/anastasis"; import { useAnastasisContext } from "../../context/anastasis.js";
import { AnastasisClientFrame } from "./index"; import { AnastasisClientFrame } from "./index.js";
export function BackupFinishedScreen(): VNode { export function BackupFinishedScreen(): VNode {
const reducer = useAnastasisContext(); const reducer = useAnastasisContext();

View File

@ -24,8 +24,8 @@ import {
RecoveryStates, RecoveryStates,
ReducerState, ReducerState,
} from "@gnu-taler/anastasis-core"; } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils"; import { createExample, reducerStatesExample } from "../../utils/index.js";
import { ChallengeOverviewScreen as TestedComponent } from "./ChallengeOverviewScreen"; import { ChallengeOverviewScreen as TestedComponent } from "./ChallengeOverviewScreen.js";
export default { export default {
title: "Pages/recovery/SolveChallenge/Overview", title: "Pages/recovery/SolveChallenge/Overview",

View File

@ -3,10 +3,10 @@ import {
ChallengeFeedbackStatus, ChallengeFeedbackStatus,
} from "@gnu-taler/anastasis-core"; } from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useAnastasisContext } from "../../context/anastasis"; import { AsyncButton } from "../../components/AsyncButton.js";
import { AnastasisClientFrame } from "./index"; import { useAnastasisContext } from "../../context/anastasis.js";
import { authMethods, KnownAuthMethods } from "./authMethod"; import { authMethods, KnownAuthMethods } from "./authMethod/index.js";
import { AsyncButton } from "../../components/AsyncButton"; import { AnastasisClientFrame } from "./index.js";
function OverviewFeedbackDisplay(props: { feedback?: ChallengeFeedback }) { function OverviewFeedbackDisplay(props: { feedback?: ChallengeFeedback }) {
const { feedback } = props; const { feedback } = props;
@ -29,15 +29,15 @@ function OverviewFeedbackDisplay(props: { feedback?: ChallengeFeedback }) {
case ChallengeFeedbackStatus.Unsupported: case ChallengeFeedbackStatus.Unsupported:
return ( return (
<div class="block has-text-danger"> <div class="block has-text-danger">
This client doesn't support solving this type of challenge. Use This client doesn&apos;t support solving this type of challenge. Use
another version or contact the provider. another version or contact the provider.
</div> </div>
); );
case ChallengeFeedbackStatus.TruthUnknown: case ChallengeFeedbackStatus.TruthUnknown:
return ( return (
<div class="block has-text-danger"> <div class="block has-text-danger">
Provider doesn't recognize the challenge of the policy. Contact the Provider doesn&apos;t recognize the challenge of the policy. Contact
provider for further information. the provider for further information.
</div> </div>
); );
default: default:
@ -253,7 +253,7 @@ export function ChallengeOverviewScreen(): VNode {
Policy #{policy_index + 1}: {policyName} Policy #{policy_index + 1}: {policyName}
</h3> </h3>
{policy.challenges.length === 0 && ( {policy.challenges.length === 0 && (
<p>This policy doesn't have any challenges.</p> <p>This policy doesn&apos;t have any challenges.</p>
)} )}
{policy.challenges.length === 1 && ( {policy.challenges.length === 1 && (
<p>This policy has one challenge.</p> <p>This policy has one challenge.</p>

View File

@ -19,8 +19,8 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { createExample, reducerStatesExample } from "../../utils"; import { createExample, reducerStatesExample } from "../../utils/index.js";
import { ChallengePayingScreen as TestedComponent } from "./ChallengePayingScreen"; import { ChallengePayingScreen as TestedComponent } from "./ChallengePayingScreen.js";
export default { export default {
title: "Pages/recovery/__ChallengePaying", title: "Pages/recovery/__ChallengePaying",

View File

@ -1,6 +1,6 @@
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useAnastasisContext } from "../../context/anastasis"; import { useAnastasisContext } from "../../context/anastasis.js";
import { AnastasisClientFrame } from "./index"; import { AnastasisClientFrame } from "./index.js";
export function ChallengePayingScreen(): VNode { export function ChallengePayingScreen(): VNode {
const reducer = useAnastasisContext(); const reducer = useAnastasisContext();

View File

@ -1,7 +1,5 @@
import { differenceInBusinessDays } from "date-fns";
import { ComponentChildren, h, VNode } from "preact"; import { ComponentChildren, h, VNode } from "preact";
import { useLayoutEffect, useRef } from "preact/hooks"; import { AsyncButton } from "../../components/AsyncButton.js";
import { AsyncButton } from "../../components/AsyncButton";
export interface ConfirmModelProps { export interface ConfirmModelProps {
active?: boolean; active?: boolean;

View File

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/camelcase */
/* /*
This file is part of GNU Taler This file is part of GNU Taler
(C) 2021 Taler Systems S.A. (C) 2021 Taler Systems S.A.
@ -21,8 +20,8 @@
*/ */
import { ReducerState } from "@gnu-taler/anastasis-core"; import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils"; import { createExample, reducerStatesExample } from "../../utils/index.js";
import { ContinentSelectionScreen as TestedComponent } from "./ContinentSelectionScreen"; import { ContinentSelectionScreen as TestedComponent } from "./ContinentSelectionScreen.js";
export default { export default {
title: "Pages/Location", title: "Pages/Location",

View File

@ -1,9 +1,7 @@
/* eslint-disable @typescript-eslint/camelcase */
import { BackupStates, RecoveryStates } from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { useAnastasisContext } from "../../context/anastasis"; import { useAnastasisContext } from "../../context/anastasis.js";
import { AnastasisClientFrame, withProcessLabel } from "./index"; import { AnastasisClientFrame, withProcessLabel } from "./index.js";
export function ContinentSelectionScreen(): VNode { export function ContinentSelectionScreen(): VNode {
const reducer = useAnastasisContext(); const reducer = useAnastasisContext();

View File

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/camelcase */
/* /*
This file is part of GNU Taler This file is part of GNU Taler
(C) 2021 Taler Systems S.A. (C) 2021 Taler Systems S.A.
@ -21,8 +20,8 @@
*/ */
import { ReducerState } from "@gnu-taler/anastasis-core"; import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils"; import { createExample, reducerStatesExample } from "../../utils/index.js";
import { EditPoliciesScreen as TestedComponent } from "./EditPoliciesScreen"; import { EditPoliciesScreen as TestedComponent } from "./EditPoliciesScreen.js";
export default { export default {
title: "Pages/backup/ReviewPolicies/EditPolicies", title: "Pages/backup/ReviewPolicies/EditPolicies",

View File

@ -1,10 +1,8 @@
/* eslint-disable @typescript-eslint/camelcase */
import { AuthMethod, Policy } from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { useAnastasisContext } from "../../context/anastasis"; import { useAnastasisContext } from "../../context/anastasis.js";
import { authMethods, KnownAuthMethods } from "./authMethod"; import { authMethods, KnownAuthMethods } from "./authMethod/index.js";
import { AnastasisClientFrame } from "./index"; import { AnastasisClientFrame } from "./index.js";
export interface ProviderInfo { export interface ProviderInfo {
url: string; url: string;

View File

@ -20,8 +20,8 @@
*/ */
import { ReducerState } from "@gnu-taler/anastasis-core"; import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils"; import { createExample, reducerStatesExample } from "../../utils/index.js";
import { PoliciesPayingScreen as TestedComponent } from "./PoliciesPayingScreen"; import { PoliciesPayingScreen as TestedComponent } from "./PoliciesPayingScreen.js";
export default { export default {
title: "Pages/backup/__PoliciesPaying", title: "Pages/backup/__PoliciesPaying",

View File

@ -1,6 +1,6 @@
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useAnastasisContext } from "../../context/anastasis"; import { useAnastasisContext } from "../../context/anastasis.js";
import { AnastasisClientFrame } from "./index"; import { AnastasisClientFrame } from "./index.js";
export function PoliciesPayingScreen(): VNode { export function PoliciesPayingScreen(): VNode {
const reducer = useAnastasisContext(); const reducer = useAnastasisContext();

View File

@ -19,10 +19,10 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { encodeCrock, stringToBytes } from "@gnu-taler/taler-util";
import { ReducerState } from "@gnu-taler/anastasis-core"; import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils"; import { encodeCrock, stringToBytes } from "@gnu-taler/taler-util";
import { RecoveryFinishedScreen as TestedComponent } from "./RecoveryFinishedScreen"; import { createExample, reducerStatesExample } from "../../utils/index.js";
import { RecoveryFinishedScreen as TestedComponent } from "./RecoveryFinishedScreen.js";
export default { export default {
title: "Pages/recovery/Finished", title: "Pages/recovery/Finished",

View File

@ -1,10 +1,9 @@
import { bytesToString, decodeCrock, encodeCrock } from "@gnu-taler/taler-util"; import { bytesToString, decodeCrock } from "@gnu-taler/taler-util";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useEffect, useState } from "preact/hooks"; import { useEffect, useState } from "preact/hooks";
import { stringToBytes } from "qrcode-generator"; import { QR } from "../../components/QR.js";
import { QR } from "../../components/QR"; import { useAnastasisContext } from "../../context/anastasis.js";
import { useAnastasisContext } from "../../context/anastasis"; import { AnastasisClientFrame } from "./index.js";
import { AnastasisClientFrame } from "./index";
export function RecoveryFinishedScreen(): VNode { export function RecoveryFinishedScreen(): VNode {
const reducer = useAnastasisContext(); const reducer = useAnastasisContext();

View File

@ -20,8 +20,8 @@
*/ */
import { ReducerState } from "@gnu-taler/anastasis-core"; import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils"; import { createExample, reducerStatesExample } from "../../utils/index.js";
import { ReviewPoliciesScreen as TestedComponent } from "./ReviewPoliciesScreen"; import { ReviewPoliciesScreen as TestedComponent } from "./ReviewPoliciesScreen.js";
export default { export default {
title: "Pages/backup/ReviewPolicies", title: "Pages/backup/ReviewPolicies",

View File

@ -1,12 +1,10 @@
import { AuthenticationProviderStatusOk } from "@gnu-taler/anastasis-core"; import { AuthenticationProviderStatusOk } from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { AsyncButton } from "../../components/AsyncButton"; import { useAnastasisContext } from "../../context/anastasis.js";
import { useAnastasisContext } from "../../context/anastasis"; import { authMethods, KnownAuthMethods } from "./authMethod/index.js";
import { authMethods, KnownAuthMethods } from "./authMethod"; import { EditPoliciesScreen } from "./EditPoliciesScreen.js";
import { ConfirmModal } from "./ConfirmModal"; import { AnastasisClientFrame } from "./index.js";
import { EditPoliciesScreen } from "./EditPoliciesScreen";
import { AnastasisClientFrame } from "./index";
export function ReviewPoliciesScreen(): VNode { export function ReviewPoliciesScreen(): VNode {
const [editingPolicy, setEditingPolicy] = useState<number | undefined>(); const [editingPolicy, setEditingPolicy] = useState<number | undefined>();

View File

@ -20,8 +20,8 @@
*/ */
import { ReducerState } from "@gnu-taler/anastasis-core"; import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils"; import { createExample, reducerStatesExample } from "../../utils/index.js";
import { SecretEditorScreen as TestedComponent } from "./SecretEditorScreen"; import { SecretEditorScreen as TestedComponent } from "./SecretEditorScreen.js";
export default { export default {
title: "Pages/backup/SecretInput", title: "Pages/backup/SecretInput",

View File

@ -1,10 +1,13 @@
import { encodeCrock, stringToBytes } from "@gnu-taler/taler-util"; import { encodeCrock, stringToBytes } from "@gnu-taler/taler-util";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { useAnastasisContext } from "../../context/anastasis"; import {
import { AnastasisClientFrame } from "./index"; FileInput,
import { TextInput } from "../../components/fields/TextInput"; FileTypeContent,
import { FileInput, FileTypeContent } from "../../components/fields/FileInput"; } from "../../components/fields/FileInput.js";
import { TextInput } from "../../components/fields/TextInput.js";
import { useAnastasisContext } from "../../context/anastasis.js";
import { AnastasisClientFrame } from "./index.js";
export function SecretEditorScreen(): VNode { export function SecretEditorScreen(): VNode {
const reducer = useAnastasisContext(); const reducer = useAnastasisContext();

View File

@ -20,8 +20,8 @@
*/ */
import { ReducerState } from "@gnu-taler/anastasis-core"; import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils"; import { createExample, reducerStatesExample } from "../../utils/index.js";
import { SecretSelectionScreen as TestedComponent } from "./SecretSelectionScreen"; import { SecretSelectionScreen as TestedComponent } from "./SecretSelectionScreen.js";
export default { export default {
title: "Pages/recovery/SecretSelection", title: "Pages/recovery/SecretSelection",

View File

@ -1,15 +1,14 @@
import { import {
AuthenticationProviderStatus, AuthenticationProviderStatus,
AuthenticationProviderStatusOk, AuthenticationProviderStatusOk,
PolicyMetaInfo,
} from "@gnu-taler/anastasis-core"; } from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useEffect, useState } from "preact/hooks"; import { useEffect, useState } from "preact/hooks";
import { AsyncButton } from "../../components/AsyncButton"; import { AsyncButton } from "../../components/AsyncButton.js";
import { PhoneNumberInput } from "../../components/fields/NumberInput"; import { PhoneNumberInput } from "../../components/fields/NumberInput.js";
import { useAnastasisContext } from "../../context/anastasis"; import { useAnastasisContext } from "../../context/anastasis.js";
import { AddingProviderScreen } from "./AddingProviderScreen"; import { AddingProviderScreen } from "./AddingProviderScreen.js";
import { AnastasisClientFrame } from "./index"; import { AnastasisClientFrame } from "./index.js";
export function SecretSelectionScreen(): VNode { export function SecretSelectionScreen(): VNode {
const [selectingVersion, setSelectingVersion] = useState<boolean>(false); const [selectingVersion, setSelectingVersion] = useState<boolean>(false);
@ -67,7 +66,7 @@ export function SecretSelectionScreen(): VNode {
<ChooseAnotherProviderScreen <ChooseAnotherProviderScreen
providers={provs} providers={provs}
selected="" selected=""
onChange={(newProv) => () => {}} onChange={() => null}
></ChooseAnotherProviderScreen> ></ChooseAnotherProviderScreen>
); );
} }
@ -78,8 +77,8 @@ export function SecretSelectionScreen(): VNode {
hideNext="Please select version to recover" hideNext="Please select version to recover"
> >
<p>Found versions:</p> <p>Found versions:</p>
{policies.map((version) => ( {policies.map((version, i) => (
<div> <div key={i}>
{version.policy_hash} / {version.secret_name} {version.policy_hash} / {version.secret_name}
<button <button
onClick={async () => { onClick={async () => {
@ -184,7 +183,7 @@ export function OldSecretSelectionScreen(): VNode {
</div> </div>
<div class="buttons is-right"> <div class="buttons is-right">
<button class="button" onClick={(e) => setSelectingVersion(true)}> <button class="button" onClick={(e) => setSelectingVersion(true)}>
Change secret's version Change secret&apos;s version
</button> </button>
</div> </div>
</div> </div>

View File

@ -20,8 +20,8 @@
*/ */
import { ReducerState } from "@gnu-taler/anastasis-core"; import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils"; import { createExample, reducerStatesExample } from "../../utils/index.js";
import { SolveScreen as TestedComponent } from "./SolveScreen"; import { SolveScreen as TestedComponent } from "./SolveScreen.js";
export default { export default {
title: "Pages/recovery/SolveChallenge/Solve", title: "Pages/recovery/SolveChallenge/Solve",

View File

@ -1,12 +1,12 @@
import { h, VNode } from "preact";
import { AnastasisClientFrame } from ".";
import { import {
ChallengeFeedback, ChallengeFeedback,
ChallengeFeedbackStatus, ChallengeFeedbackStatus,
} from "@gnu-taler/anastasis-core"; } from "@gnu-taler/anastasis-core";
import { Notifications } from "../../components/Notifications"; import { h, VNode } from "preact";
import { useAnastasisContext } from "../../context/anastasis"; import { Notifications } from "../../components/Notifications.js";
import { authMethods, KnownAuthMethods } from "./authMethod"; import { useAnastasisContext } from "../../context/anastasis.js";
import { authMethods, KnownAuthMethods } from "./authMethod/index.js";
import { AnastasisClientFrame } from "./index.js";
export function SolveOverviewFeedbackDisplay(props: { export function SolveOverviewFeedbackDisplay(props: {
feedback?: ChallengeFeedback; feedback?: ChallengeFeedback;

View File

@ -19,8 +19,8 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { createExample, reducerStatesExample } from "../../utils"; import { createExample, reducerStatesExample } from "../../utils/index.js";
import { StartScreen as TestedComponent } from "./StartScreen"; import { StartScreen as TestedComponent } from "./StartScreen.js";
export default { export default {
title: "Pages/Start", title: "Pages/Start",

View File

@ -1,8 +1,7 @@
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { FileInput } from "../../components/fields/FileInput"; import { FileButton } from "../../components/FlieButton.js";
import { FileButton } from "../../components/FlieButton"; import { useAnastasisContext } from "../../context/anastasis.js";
import { useAnastasisContext } from "../../context/anastasis"; import { AnastasisClientFrame } from "./index.js";
import { AnastasisClientFrame } from "./index";
export function StartScreen(): VNode { export function StartScreen(): VNode {
const reducer = useAnastasisContext(); const reducer = useAnastasisContext();

View File

@ -20,8 +20,8 @@
*/ */
import { ReducerState } from "@gnu-taler/anastasis-core"; import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils"; import { createExample, reducerStatesExample } from "../../utils/index.js";
import { TruthsPayingScreen as TestedComponent } from "./TruthsPayingScreen"; import { TruthsPayingScreen as TestedComponent } from "./TruthsPayingScreen.js";
export default { export default {
title: "Pages/backup/__TruthsPaying", title: "Pages/backup/__TruthsPaying",

View File

@ -1,6 +1,6 @@
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useAnastasisContext } from "../../context/anastasis"; import { useAnastasisContext } from "../../context/anastasis.js";
import { AnastasisClientFrame } from "./index"; import { AnastasisClientFrame } from "./index.js";
export function TruthsPayingScreen(): VNode { export function TruthsPayingScreen(): VNode {
const reducer = useAnastasisContext(); const reducer = useAnastasisContext();

View File

@ -19,8 +19,8 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { createExample, reducerStatesExample } from "../../../utils"; import { createExample, reducerStatesExample } from "../../../utils/index.js";
import { authMethods as TestedComponent, KnownAuthMethods } from "./index"; import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
export default { export default {
title: "Pages/backup/AuthorizationMethod/AuthMethods/email", title: "Pages/backup/AuthorizationMethod/AuthMethods/email",

View File

@ -1,12 +1,12 @@
import { encodeCrock, stringToBytes } from "@gnu-taler/taler-util"; import { encodeCrock, stringToBytes } from "@gnu-taler/taler-util";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { EmailInput } from "../../../components/fields/EmailInput"; import { EmailInput } from "../../../components/fields/EmailInput.js";
import { AnastasisClientFrame } from "../index"; import { AnastasisClientFrame } from "../index.js";
import { AuthMethodSetupProps } from "./index"; import { AuthMethodSetupProps } from "./index.js";
const EMAIL_PATTERN = const EMAIL_PATTERN =
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; /^(([^<>()[]\\.,;:\s@"]+(\.[^<>()[]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
export function AuthMethodEmailSetup({ export function AuthMethodEmailSetup({
cancel, cancel,

View File

@ -23,8 +23,8 @@ import {
ChallengeFeedbackStatus, ChallengeFeedbackStatus,
ReducerState, ReducerState,
} from "@gnu-taler/anastasis-core"; } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../../utils"; import { createExample, reducerStatesExample } from "../../../utils/index.js";
import { authMethods as TestedComponent, KnownAuthMethods } from "./index"; import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
export default { export default {
title: "Pages/recovery/SolveChallenge/AuthMethods/email", title: "Pages/recovery/SolveChallenge/AuthMethods/email",

View File

@ -20,14 +20,14 @@
import { ChallengeInfo } from "@gnu-taler/anastasis-core"; import { ChallengeInfo } from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { AsyncButton } from "../../../components/AsyncButton"; import { AsyncButton } from "../../../components/AsyncButton.js";
import { TextInput } from "../../../components/fields/TextInput"; import { TextInput } from "../../../components/fields/TextInput.js";
import { useAnastasisContext } from "../../../context/anastasis"; import { useAnastasisContext } from "../../../context/anastasis.js";
import { useTranslator } from "../../../i18n"; import { useTranslator } from "../../../i18n/index.js";
import { AnastasisClientFrame } from "../index"; import { AnastasisClientFrame } from "../index.js";
import { SolveOverviewFeedbackDisplay } from "../SolveScreen"; import { SolveOverviewFeedbackDisplay } from "../SolveScreen.js";
import { shouldHideConfirm } from "./helpers"; import { shouldHideConfirm } from "./helpers.js";
import { AuthMethodSolveProps } from "./index"; import { AuthMethodSolveProps } from "./index.js";
export function AuthMethodEmailSolve({ id }: AuthMethodSolveProps): VNode { export function AuthMethodEmailSolve({ id }: AuthMethodSolveProps): VNode {
const [answer, _setAnswer] = useState("A-"); const [answer, _setAnswer] = useState("A-");
@ -131,15 +131,16 @@ export function AuthMethodEmailSolve({ id }: AuthMethodSolveProps): VNode {
<AnastasisClientFrame hideNav title="Email challenge"> <AnastasisClientFrame hideNav title="Email challenge">
<SolveOverviewFeedbackDisplay feedback={feedback} /> <SolveOverviewFeedbackDisplay feedback={feedback} />
<p> <p>
An email has been sent to "<b>{selectedChallenge.instructions}</b>". The An email has been sent to &quot;<b>{selectedChallenge.instructions}</b>
message has and identification code and recovery code that starts with " &quot;. The message has and identification code and recovery code that
<b>A-</b>". Wait the message to arrive and the enter the recovery code starts with &quot;
below. <b>A-</b>&quot;. Wait the message to arrive and the enter the recovery
code below.
</p> </p>
{!expanded ? ( {!expanded ? (
<p> <p>
The identification code in the email should start with " The identification code in the email should start with &quot;
{selectedUuid.substring(0, 10)}" {selectedUuid.substring(0, 10)}&quot;
<span <span
class="icon has-tooltip-top" class="icon has-tooltip-top"
data-tooltip="click to expand" data-tooltip="click to expand"
@ -150,7 +151,7 @@ export function AuthMethodEmailSolve({ id }: AuthMethodSolveProps): VNode {
</p> </p>
) : ( ) : (
<p> <p>
The identification code in the email is "{selectedUuid}" The identification code in the email is &quot;{selectedUuid}&quot;
<span <span
class="icon has-tooltip-top" class="icon has-tooltip-top"
data-tooltip="click to show less code" data-tooltip="click to show less code"

View File

@ -19,8 +19,8 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { createExample, reducerStatesExample } from "../../../utils"; import { createExample, reducerStatesExample } from "../../../utils/index.js";
import { authMethods as TestedComponent, KnownAuthMethods } from "./index"; import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
export default { export default {
title: "Pages/backup/AuthorizationMethod/AuthMethods/IBAN", title: "Pages/backup/AuthorizationMethod/AuthMethods/IBAN",

View File

@ -5,9 +5,9 @@ import {
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { AuthMethodSetupProps } from "."; import { TextInput } from "../../../components/fields/TextInput.js";
import { TextInput } from "../../../components/fields/TextInput"; import { AnastasisClientFrame } from "../index.js";
import { AnastasisClientFrame } from "../index"; import { AuthMethodSetupProps } from "./index.js";
export function AuthMethodIbanSetup({ export function AuthMethodIbanSetup({
addAuthMethod, addAuthMethod,

View File

@ -19,12 +19,9 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { import { ReducerState } from "@gnu-taler/anastasis-core";
ChallengeFeedbackStatus, import { createExample, reducerStatesExample } from "../../../utils/index.js";
ReducerState, import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
} from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../../utils";
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";
export default { export default {
title: "Pages/recovery/SolveChallenge/AuthMethods/Iban", title: "Pages/recovery/SolveChallenge/AuthMethods/Iban",

View File

@ -1,15 +1,12 @@
import { import { ChallengeInfo } from "@gnu-taler/anastasis-core";
ChallengeFeedbackStatus,
ChallengeInfo,
} from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { AsyncButton } from "../../../components/AsyncButton"; import { AsyncButton } from "../../../components/AsyncButton.js";
import { useAnastasisContext } from "../../../context/anastasis"; import { useAnastasisContext } from "../../../context/anastasis.js";
import { AnastasisClientFrame } from "../index"; import { AnastasisClientFrame } from "../index.js";
import { SolveOverviewFeedbackDisplay } from "../SolveScreen"; import { SolveOverviewFeedbackDisplay } from "../SolveScreen.js";
import { shouldHideConfirm } from "./helpers"; import { shouldHideConfirm } from "./helpers.js";
import { AuthMethodSolveProps } from "./index"; import { AuthMethodSolveProps } from "./index.js";
export function AuthMethodIbanSolve({ id }: AuthMethodSolveProps): VNode { export function AuthMethodIbanSolve({ id }: AuthMethodSolveProps): VNode {
const [answer, setAnswer] = useState(""); const [answer, setAnswer] = useState("");

View File

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/camelcase */
/* /*
This file is part of GNU Taler This file is part of GNU Taler
(C) 2021 Taler Systems S.A. (C) 2021 Taler Systems S.A.
@ -20,8 +19,8 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { createExample, reducerStatesExample } from "../../../utils"; import { createExample, reducerStatesExample } from "../../../utils/index.js";
import { authMethods as TestedComponent, KnownAuthMethods } from "./index"; import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
export default { export default {
title: "Pages/backup/AuthorizationMethod/AuthMethods/Post", title: "Pages/backup/AuthorizationMethod/AuthMethods/Post",

View File

@ -5,9 +5,9 @@ import {
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { AnastasisClientFrame } from ".."; import { TextInput } from "../../../components/fields/TextInput.js";
import { TextInput } from "../../../components/fields/TextInput"; import { AnastasisClientFrame } from "../index.js";
import { AuthMethodSetupProps } from "./index"; import { AuthMethodSetupProps } from "./index.js";
export function AuthMethodPostSetup({ export function AuthMethodPostSetup({
addAuthMethod, addAuthMethod,

View File

@ -19,12 +19,9 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { import { ReducerState } from "@gnu-taler/anastasis-core";
ChallengeFeedbackStatus, import { createExample, reducerStatesExample } from "../../../utils/index.js";
ReducerState, import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
} from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../../utils";
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";
export default { export default {
title: "Pages/recovery/SolveChallenge/AuthMethods/post", title: "Pages/recovery/SolveChallenge/AuthMethods/post",

View File

@ -1,17 +1,14 @@
import { import { ChallengeInfo } from "@gnu-taler/anastasis-core";
ChallengeFeedbackStatus,
ChallengeInfo,
} from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { AsyncButton } from "../../../components/AsyncButton"; import { AsyncButton } from "../../../components/AsyncButton.js";
import { TextInput } from "../../../components/fields/TextInput"; import { TextInput } from "../../../components/fields/TextInput.js";
import { useAnastasisContext } from "../../../context/anastasis"; import { useAnastasisContext } from "../../../context/anastasis.js";
import { useTranslator } from "../../../i18n"; import { useTranslator } from "../../../i18n/index.js";
import { AnastasisClientFrame } from "../index"; import { AnastasisClientFrame } from "../index.js";
import { SolveOverviewFeedbackDisplay } from "../SolveScreen"; import { SolveOverviewFeedbackDisplay } from "../SolveScreen.js";
import { shouldHideConfirm } from "./helpers"; import { shouldHideConfirm } from "./helpers.js";
import { AuthMethodSolveProps } from "./index"; import { AuthMethodSolveProps } from "./index.js";
export function AuthMethodPostSolve({ id }: AuthMethodSolveProps): VNode { export function AuthMethodPostSolve({ id }: AuthMethodSolveProps): VNode {
const [answer, _setAnswer] = useState("A-"); const [answer, _setAnswer] = useState("A-");

View File

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/camelcase */
/* /*
This file is part of GNU Taler This file is part of GNU Taler
(C) 2021 Taler Systems S.A. (C) 2021 Taler Systems S.A.
@ -20,8 +19,8 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { createExample, reducerStatesExample } from "../../../utils"; import { createExample, reducerStatesExample } from "../../../utils/index.js";
import { authMethods as TestedComponent, KnownAuthMethods } from "./index"; import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
export default { export default {
title: "Pages/backup/AuthorizationMethod/AuthMethods/Question", title: "Pages/backup/AuthorizationMethod/AuthMethods/Question",

View File

@ -1,9 +1,9 @@
import { encodeCrock, stringToBytes } from "@gnu-taler/taler-util"; import { encodeCrock, stringToBytes } from "@gnu-taler/taler-util";
import { Fragment, h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { AuthMethodSetupProps } from "./index"; import { TextInput } from "../../../components/fields/TextInput.js";
import { AnastasisClientFrame } from "../index"; import { AnastasisClientFrame } from "../index.js";
import { TextInput } from "../../../components/fields/TextInput"; import { AuthMethodSetupProps } from "./index.js";
export function AuthMethodQuestionSetup({ export function AuthMethodQuestionSetup({
cancel, cancel,

View File

@ -24,8 +24,8 @@ import {
ChallengeFeedbackStatus, ChallengeFeedbackStatus,
ReducerState, ReducerState,
} from "@gnu-taler/anastasis-core"; } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../../utils"; import { createExample, reducerStatesExample } from "../../../utils/index.js";
import { authMethods as TestedComponent, KnownAuthMethods } from "./index"; import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
export default { export default {
title: "Pages/recovery/SolveChallenge/AuthMethods/question", title: "Pages/recovery/SolveChallenge/AuthMethods/question",

View File

@ -1,16 +1,13 @@
import { import { ChallengeInfo } from "@gnu-taler/anastasis-core";
ChallengeFeedbackStatus,
ChallengeInfo,
} from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { AsyncButton } from "../../../components/AsyncButton"; import { AsyncButton } from "../../../components/AsyncButton.js";
import { TextInput } from "../../../components/fields/TextInput"; import { TextInput } from "../../../components/fields/TextInput.js";
import { useAnastasisContext } from "../../../context/anastasis"; import { useAnastasisContext } from "../../../context/anastasis.js";
import { AnastasisClientFrame } from "../index"; import { AnastasisClientFrame } from "../index.js";
import { SolveOverviewFeedbackDisplay } from "../SolveScreen"; import { SolveOverviewFeedbackDisplay } from "../SolveScreen.js";
import { shouldHideConfirm } from "./helpers"; import { shouldHideConfirm } from "./helpers.js";
import { AuthMethodSolveProps } from "./index"; import { AuthMethodSolveProps } from "./index.js";
export function AuthMethodQuestionSolve({ id }: AuthMethodSolveProps): VNode { export function AuthMethodQuestionSolve({ id }: AuthMethodSolveProps): VNode {
const [answer, setAnswer] = useState(""); const [answer, setAnswer] = useState("");

View File

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/camelcase */
/* /*
This file is part of GNU Taler This file is part of GNU Taler
(C) 2021 Taler Systems S.A. (C) 2021 Taler Systems S.A.
@ -20,8 +19,8 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { createExample, reducerStatesExample } from "../../../utils"; import { createExample, reducerStatesExample } from "../../../utils/index.js";
import { authMethods as TestedComponent, KnownAuthMethods } from "./index"; import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
export default { export default {
title: "Pages/backup/AuthorizationMethod/AuthMethods/Sms", title: "Pages/backup/AuthorizationMethod/AuthMethods/Sms",

View File

@ -1,9 +1,9 @@
import { encodeCrock, stringToBytes } from "@gnu-taler/taler-util"; import { encodeCrock, stringToBytes } from "@gnu-taler/taler-util";
import { Fragment, h, VNode } from "preact"; import { h, VNode } from "preact";
import { useLayoutEffect, useRef, useState } from "preact/hooks"; import { useLayoutEffect, useRef, useState } from "preact/hooks";
import { AuthMethodSetupProps } from "."; import { PhoneNumberInput } from "../../../components/fields/NumberInput.js";
import { PhoneNumberInput } from "../../../components/fields/NumberInput"; import { AnastasisClientFrame } from "../index.js";
import { AnastasisClientFrame } from "../index"; import { AuthMethodSetupProps } from "./index.js";
const REGEX_JUST_NUMBERS = /^\+[0-9 ]*$/; const REGEX_JUST_NUMBERS = /^\+[0-9 ]*$/;

View File

@ -19,12 +19,9 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { import { ReducerState } from "@gnu-taler/anastasis-core";
ChallengeFeedbackStatus, import { createExample, reducerStatesExample } from "../../../utils/index.js";
ReducerState, import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
} from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../../utils";
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";
export default { export default {
title: "Pages/recovery/SolveChallenge/AuthMethods/sms", title: "Pages/recovery/SolveChallenge/AuthMethods/sms",

View File

@ -1,17 +1,14 @@
import { import { ChallengeInfo } from "@gnu-taler/anastasis-core";
ChallengeFeedbackStatus,
ChallengeInfo,
} from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { AsyncButton } from "../../../components/AsyncButton"; import { AsyncButton } from "../../../components/AsyncButton.js";
import { TextInput } from "../../../components/fields/TextInput"; import { TextInput } from "../../../components/fields/TextInput.js";
import { useAnastasisContext } from "../../../context/anastasis"; import { useAnastasisContext } from "../../../context/anastasis.js";
import { useTranslator } from "../../../i18n"; import { useTranslator } from "../../../i18n/index.js";
import { AnastasisClientFrame } from "../index"; import { AnastasisClientFrame } from "../index.js";
import { SolveOverviewFeedbackDisplay } from "../SolveScreen"; import { SolveOverviewFeedbackDisplay } from "../SolveScreen.js";
import { shouldHideConfirm } from "./helpers"; import { shouldHideConfirm } from "./helpers.js";
import { AuthMethodSolveProps } from "./index"; import { AuthMethodSolveProps } from "./index.js";
export function AuthMethodSmsSolve({ id }: AuthMethodSolveProps): VNode { export function AuthMethodSmsSolve({ id }: AuthMethodSolveProps): VNode {
const [answer, _setAnswer] = useState("A-"); const [answer, _setAnswer] = useState("A-");
@ -115,15 +112,16 @@ export function AuthMethodSmsSolve({ id }: AuthMethodSolveProps): VNode {
<AnastasisClientFrame hideNav title="SMS Challenge"> <AnastasisClientFrame hideNav title="SMS Challenge">
<SolveOverviewFeedbackDisplay feedback={feedback} /> <SolveOverviewFeedbackDisplay feedback={feedback} />
<p> <p>
An sms has been sent to "<b>{selectedChallenge.instructions}</b>". The An sms has been sent to &quot;<b>{selectedChallenge.instructions}</b>
message has and identification code and recovery code that starts with " &quot;. The message has and identification code and recovery code that
<b>A-</b>". Wait the message to arrive and the enter the recovery code starts with &quot;
below. <b>A-</b>&quot;. Wait the message to arrive and the enter the recovery
code below.
</p> </p>
{!expanded ? ( {!expanded ? (
<p> <p>
The identification code in the SMS should start with " The identification code in the SMS should start with &quot;
{selectedUuid.substring(0, 10)}" {selectedUuid.substring(0, 10)}&quot;
<span <span
class="icon has-tooltip-top" class="icon has-tooltip-top"
data-tooltip="click to expand" data-tooltip="click to expand"
@ -134,7 +132,7 @@ export function AuthMethodSmsSolve({ id }: AuthMethodSolveProps): VNode {
</p> </p>
) : ( ) : (
<p> <p>
The identification code in the SMS is "{selectedUuid}" The identification code in the SMS is &quot;{selectedUuid}&quot;
<span <span
class="icon has-tooltip-top" class="icon has-tooltip-top"
data-tooltip="click to show less code" data-tooltip="click to show less code"

View File

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/camelcase */
/* /*
This file is part of GNU Taler This file is part of GNU Taler
(C) 2021 Taler Systems S.A. (C) 2021 Taler Systems S.A.
@ -20,8 +19,8 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { createExample, reducerStatesExample } from "../../../utils"; import { createExample, reducerStatesExample } from "../../../utils/index.js";
import { authMethods as TestedComponent, KnownAuthMethods } from "./index"; import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
export default { export default {
title: "Pages/backup/AuthorizationMethod/AuthMethods/TOTP", title: "Pages/backup/AuthorizationMethod/AuthMethods/TOTP",

View File

@ -1,11 +1,11 @@
import { encodeCrock, stringToBytes } from "@gnu-taler/taler-util"; import { encodeCrock } from "@gnu-taler/taler-util";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useMemo, useState } from "preact/hooks"; import { useMemo, useState } from "preact/hooks";
import { AuthMethodSetupProps } from "./index"; import { TextInput } from "../../../components/fields/TextInput.js";
import { AnastasisClientFrame } from "../index"; import { QR } from "../../../components/QR.js";
import { TextInput } from "../../../components/fields/TextInput"; import { AnastasisClientFrame } from "../index.js";
import { QR } from "../../../components/QR"; import { AuthMethodSetupProps } from "./index.js";
import { base32enc, computeTOTPandCheck } from "./totp"; import { base32enc, computeTOTPandCheck } from "./totp.js";
/** /**
* This is hard-coded in the protocol for TOTP auth. * This is hard-coded in the protocol for TOTP auth.
@ -69,8 +69,8 @@ export function AuthMethodTotpSetup({
bind={[test, setTest]} bind={[test, setTest]}
/> />
<div> <div>
We note that Google's implementation of TOTP is incomplete and will not We note that Google&apos;s implementation of TOTP is incomplete and will
work. We recommend using FreeOTP+. not work. We recommend using FreeOTP+.
</div> </div>
{configured.length > 0 && ( {configured.length > 0 && (

View File

@ -19,12 +19,9 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { import { ReducerState } from "@gnu-taler/anastasis-core";
ChallengeFeedbackStatus, import { createExample, reducerStatesExample } from "../../../utils/index.js";
ReducerState, import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
} from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../../utils";
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";
export default { export default {
title: "Pages/recovery/SolveChallenge/AuthMethods/totp", title: "Pages/recovery/SolveChallenge/AuthMethods/totp",

View File

@ -1,16 +1,13 @@
import { import { ChallengeInfo } from "@gnu-taler/anastasis-core";
ChallengeFeedbackStatus,
ChallengeInfo,
} from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { AsyncButton } from "../../../components/AsyncButton"; import { AsyncButton } from "../../../components/AsyncButton.js";
import { TextInput } from "../../../components/fields/TextInput"; import { TextInput } from "../../../components/fields/TextInput.js";
import { useAnastasisContext } from "../../../context/anastasis"; import { useAnastasisContext } from "../../../context/anastasis.js";
import { AnastasisClientFrame } from "../index"; import { AnastasisClientFrame } from "../index.js";
import { SolveOverviewFeedbackDisplay } from "../SolveScreen"; import { SolveOverviewFeedbackDisplay } from "../SolveScreen.js";
import { shouldHideConfirm } from "./helpers"; import { shouldHideConfirm } from "./helpers.js";
import { AuthMethodSolveProps } from "./index"; import { AuthMethodSolveProps } from "./index.js";
export function AuthMethodTotpSolve(props: AuthMethodSolveProps): VNode { export function AuthMethodTotpSolve(props: AuthMethodSolveProps): VNode {
const [answerCode, setAnswerCode] = useState(""); const [answerCode, setAnswerCode] = useState("");

View File

@ -3,18 +3,18 @@ import { h, VNode } from "preact";
import postalIcon from "../../../assets/icons/auth_method/postal.svg"; import postalIcon from "../../../assets/icons/auth_method/postal.svg";
import questionIcon from "../../../assets/icons/auth_method/question.svg"; import questionIcon from "../../../assets/icons/auth_method/question.svg";
import smsIcon from "../../../assets/icons/auth_method/sms.svg"; import smsIcon from "../../../assets/icons/auth_method/sms.svg";
import { AuthMethodEmailSetup as EmailSetup } from "./AuthMethodEmailSetup"; import { AuthMethodEmailSetup as EmailSetup } from "./AuthMethodEmailSetup.js";
import { AuthMethodEmailSolve as EmailSolve } from "./AuthMethodEmailSolve"; import { AuthMethodEmailSolve as EmailSolve } from "./AuthMethodEmailSolve.js";
import { AuthMethodIbanSetup as IbanSetup } from "./AuthMethodIbanSetup"; import { AuthMethodIbanSetup as IbanSetup } from "./AuthMethodIbanSetup.js";
import { AuthMethodIbanSolve as IbanSolve } from "./AuthMethodIbanSolve"; import { AuthMethodIbanSolve as IbanSolve } from "./AuthMethodIbanSolve.js";
import { AuthMethodPostSetup as PostalSetup } from "./AuthMethodPostSetup"; import { AuthMethodPostSetup as PostalSetup } from "./AuthMethodPostSetup.js";
import { AuthMethodPostSolve as PostalSolve } from "./AuthMethodPostSolve"; import { AuthMethodPostSolve as PostalSolve } from "./AuthMethodPostSolve.js";
import { AuthMethodQuestionSetup as QuestionSetup } from "./AuthMethodQuestionSetup"; import { AuthMethodQuestionSetup as QuestionSetup } from "./AuthMethodQuestionSetup.js";
import { AuthMethodQuestionSolve as QuestionSolve } from "./AuthMethodQuestionSolve"; import { AuthMethodQuestionSolve as QuestionSolve } from "./AuthMethodQuestionSolve.js";
import { AuthMethodSmsSetup as SmsSetup } from "./AuthMethodSmsSetup"; import { AuthMethodSmsSetup as SmsSetup } from "./AuthMethodSmsSetup.js";
import { AuthMethodSmsSolve as SmsSolve } from "./AuthMethodSmsSolve"; import { AuthMethodSmsSolve as SmsSolve } from "./AuthMethodSmsSolve.js";
import { AuthMethodTotpSetup as TotpSetup } from "./AuthMethodTotpSetup"; import { AuthMethodTotpSetup as TotpSetup } from "./AuthMethodTotpSetup.js";
import { AuthMethodTotpSolve as TotpSolve } from "./AuthMethodTotpSolve"; import { AuthMethodTotpSolve as TotpSolve } from "./AuthMethodTotpSolve.js";
export type AuthMethodWithRemove = AuthMethod & { remove: () => void }; export type AuthMethodWithRemove = AuthMethod & { remove: () => void };

View File

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/camelcase */
import jssha from "jssha"; import jssha from "jssha";
const SEARCH_RANGE = 16; const SEARCH_RANGE = 16;

View File

@ -19,34 +19,34 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import * as a1 from "./RecoveryFinishedScreen.stories.js";
import * as a3 from "./ContinentSelectionScreen.stories.js";
import * as a4 from "./ReviewPoliciesScreen.stories.js";
import * as a5 from "./authMethod/AuthMethodSmsSolve.stories.js";
import * as a6 from "./authMethod/AuthMethodSmsSetup.stories.js";
import * as a7 from "./authMethod/AuthMethodPostSetup.stories.js";
import * as a8 from "./authMethod/AuthMethodEmailSetup.stories.js";
import * as a9 from "./authMethod/AuthMethodIbanSetup.stories.js";
import * as a10 from "./authMethod/AuthMethodQuestionSolve.stories.js";
import * as a11 from "./authMethod/AuthMethodIbanSolve.stories.js";
import * as a12 from "./authMethod/AuthMethodTotpSolve.stories.js";
import * as a13 from "./authMethod/AuthMethodPostSolve.stories.js";
import * as a14 from "./authMethod/AuthMethodTotpSetup.stories.js";
import * as a15 from "./authMethod/AuthMethodEmailSolve.stories.js";
import * as a16 from "./authMethod/AuthMethodQuestionSetup.stories.js";
import * as a17 from "./ChallengePayingScreen.stories.js";
import * as a18 from "./AuthenticationEditorScreen.stories.js";
import * as a19 from "./SecretSelectionScreen.stories.js";
import * as a20 from "./PoliciesPayingScreen.stories.js";
import * as a21 from "./BackupFinishedScreen.stories.js";
import * as a22 from "./SecretEditorScreen.stories.js";
import * as a23 from "./AddingProviderScreen.stories.js"; import * as a23 from "./AddingProviderScreen.stories.js";
import * as a24 from "./StartScreen.stories.js";
import * as a25 from "./ChallengeOverviewScreen.stories.js";
import * as a26 from "./TruthsPayingScreen.stories.js";
import * as a27 from "./EditPoliciesScreen.stories.js";
import * as a28 from "./AttributeEntryScreen.stories.js"; import * as a28 from "./AttributeEntryScreen.stories.js";
import * as a18 from "./AuthenticationEditorScreen.stories.js";
import * as a8 from "./authMethod/AuthMethodEmailSetup.stories.js";
import * as a15 from "./authMethod/AuthMethodEmailSolve.stories.js";
import * as a9 from "./authMethod/AuthMethodIbanSetup.stories.js";
import * as a11 from "./authMethod/AuthMethodIbanSolve.stories.js";
import * as a7 from "./authMethod/AuthMethodPostSetup.stories.js";
import * as a13 from "./authMethod/AuthMethodPostSolve.stories.js";
import * as a16 from "./authMethod/AuthMethodQuestionSetup.stories.js";
import * as a10 from "./authMethod/AuthMethodQuestionSolve.stories.js";
import * as a6 from "./authMethod/AuthMethodSmsSetup.stories.js";
import * as a5 from "./authMethod/AuthMethodSmsSolve.stories.js";
import * as a14 from "./authMethod/AuthMethodTotpSetup.stories.js";
import * as a12 from "./authMethod/AuthMethodTotpSolve.stories.js";
import * as a21 from "./BackupFinishedScreen.stories.js";
import * as a25 from "./ChallengeOverviewScreen.stories.js";
import * as a17 from "./ChallengePayingScreen.stories.js";
import * as a3 from "./ContinentSelectionScreen.stories.js";
import * as a27 from "./EditPoliciesScreen.stories.js";
import * as a20 from "./PoliciesPayingScreen.stories.js";
import * as a1 from "./RecoveryFinishedScreen.stories.js";
import * as a4 from "./ReviewPoliciesScreen.stories.js";
import * as a22 from "./SecretEditorScreen.stories.js";
import * as a19 from "./SecretSelectionScreen.stories.js";
import * as a29 from "./SolveScreen.stories.js"; import * as a29 from "./SolveScreen.stories.js";
import * as a24 from "./StartScreen.stories.js";
import * as a26 from "./TruthsPayingScreen.stories.js";
export default [ export default [
a1, a1,

View File

@ -7,31 +7,31 @@ import {
VNode, VNode,
} from "preact"; } from "preact";
import { useCallback, useEffect, useErrorBoundary } from "preact/hooks"; import { useCallback, useEffect, useErrorBoundary } from "preact/hooks";
import { AsyncButton } from "../../components/AsyncButton"; import { AsyncButton } from "../../components/AsyncButton.js";
import { Menu } from "../../components/menu"; import { Menu } from "../../components/menu/index.js";
import { Notifications } from "../../components/Notifications"; import { Notifications } from "../../components/Notifications.js";
import { import {
AnastasisProvider, AnastasisProvider,
useAnastasisContext, useAnastasisContext,
} from "../../context/anastasis"; } from "../../context/anastasis.js";
import { import {
AnastasisReducerApi, AnastasisReducerApi,
useAnastasisReducer, useAnastasisReducer,
} from "../../hooks/use-anastasis-reducer"; } from "../../hooks/use-anastasis-reducer.js";
import { AttributeEntryScreen } from "./AttributeEntryScreen"; import { AttributeEntryScreen } from "./AttributeEntryScreen.js";
import { AuthenticationEditorScreen } from "./AuthenticationEditorScreen"; import { AuthenticationEditorScreen } from "./AuthenticationEditorScreen.js";
import { BackupFinishedScreen } from "./BackupFinishedScreen"; import { BackupFinishedScreen } from "./BackupFinishedScreen.js";
import { ChallengeOverviewScreen } from "./ChallengeOverviewScreen"; import { ChallengeOverviewScreen } from "./ChallengeOverviewScreen.js";
import { ChallengePayingScreen } from "./ChallengePayingScreen"; import { ChallengePayingScreen } from "./ChallengePayingScreen.js";
import { ContinentSelectionScreen } from "./ContinentSelectionScreen"; import { ContinentSelectionScreen } from "./ContinentSelectionScreen.js";
import { PoliciesPayingScreen } from "./PoliciesPayingScreen"; import { PoliciesPayingScreen } from "./PoliciesPayingScreen.js";
import { RecoveryFinishedScreen } from "./RecoveryFinishedScreen"; import { RecoveryFinishedScreen } from "./RecoveryFinishedScreen.js";
import { ReviewPoliciesScreen } from "./ReviewPoliciesScreen"; import { ReviewPoliciesScreen } from "./ReviewPoliciesScreen.js";
import { SecretEditorScreen } from "./SecretEditorScreen"; import { SecretEditorScreen } from "./SecretEditorScreen.js";
import { SecretSelectionScreen } from "./SecretSelectionScreen"; import { SecretSelectionScreen } from "./SecretSelectionScreen.js";
import { SolveScreen } from "./SolveScreen"; import { SolveScreen } from "./SolveScreen.js";
import { StartScreen } from "./StartScreen"; import { StartScreen } from "./StartScreen.js";
import { TruthsPayingScreen } from "./TruthsPayingScreen"; import { TruthsPayingScreen } from "./TruthsPayingScreen.js";
function isBackup(reducer: AnastasisReducerApi): boolean { function isBackup(reducer: AnastasisReducerApi): boolean {
return reducer.currentReducerState?.reducer_type === "backup"; return reducer.currentReducerState?.reducer_type === "backup";
@ -96,13 +96,12 @@ let currentHistoryId = 0;
export function AnastasisClientFrame(props: AnastasisClientFrameProps): VNode { export function AnastasisClientFrame(props: AnastasisClientFrameProps): VNode {
const reducer = useAnastasisContext(); const reducer = useAnastasisContext();
if (!reducer) {
return <p>Fatal: Reducer must be in context.</p>;
}
const doBack = async (): Promise<void> => { const doBack = async (): Promise<void> => {
if (props.onBack) { if (props.onBack) {
await props.onBack(); await props.onBack();
} else { } else {
if (!reducer) return;
await reducer.back(); await reducer.back();
} }
}; };
@ -125,6 +124,7 @@ export function AnastasisClientFrame(props: AnastasisClientFrameProps): VNode {
if (props.onNext) { if (props.onNext) {
await props.onNext(); await props.onNext();
} else { } else {
if (!reducer) return;
await reducer.transition("next", {}); await reducer.transition("next", {});
} }
}; };
@ -146,7 +146,6 @@ export function AnastasisClientFrame(props: AnastasisClientFrameProps): VNode {
// reducer // reducer
return false; return false;
}, []); }, []);
useEffect(() => { useEffect(() => {
window.addEventListener("popstate", browserOnBackButton); window.addEventListener("popstate", browserOnBackButton);
@ -154,6 +153,9 @@ export function AnastasisClientFrame(props: AnastasisClientFrameProps): VNode {
window.removeEventListener("popstate", browserOnBackButton); window.removeEventListener("popstate", browserOnBackButton);
}; };
}, []); }, []);
if (!reducer) {
return <p>Fatal: Reducer must be in context.</p>;
}
return ( return (
<Fragment> <Fragment>