eslint
This commit is contained in:
parent
e2a987a182
commit
e96358c555
@ -21,9 +21,7 @@
|
||||
|
||||
import { ComponentChildren, h, VNode } from "preact";
|
||||
import { useLayoutEffect, useRef } from "preact/hooks";
|
||||
// import { LoadingModal } from "../modal";
|
||||
import { useAsync } from "../hooks/async";
|
||||
// import { Translate } from "../../i18n";
|
||||
import { useAsync } from "../hooks/async.js";
|
||||
|
||||
type Props = {
|
||||
children: ComponentChildren;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { FunctionalComponent, h } from "preact";
|
||||
import { TranslationProvider } from "../context/translation";
|
||||
import AnastasisClient from "../pages/home";
|
||||
import { TranslationProvider } from "../context/translation.js";
|
||||
import AnastasisClient from "../pages/home/index.js";
|
||||
|
||||
const App: FunctionalComponent = () => {
|
||||
return (
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { format, subYears } from "date-fns";
|
||||
import { h, VNode } from "preact";
|
||||
import { useLayoutEffect, useRef, useState } from "preact/hooks";
|
||||
import { DatePicker } from "../picker/DatePicker";
|
||||
import { DatePicker } from "../picker/DatePicker.js";
|
||||
|
||||
export interface DateInputProps {
|
||||
label: string;
|
||||
|
@ -21,7 +21,7 @@
|
||||
import { h, VNode } from "preact";
|
||||
import { useLayoutEffect, useRef, useState } from "preact/hooks";
|
||||
import emptyImage from "../../assets/empty.png";
|
||||
import { TextInputProps } from "./TextInput";
|
||||
import { TextInputProps } from "./TextInput.js";
|
||||
|
||||
const MAX_IMAGE_UPLOAD_SIZE = 1024 * 1024;
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
import { h, VNode } from "preact";
|
||||
import { useState } from "preact/hooks";
|
||||
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";
|
||||
|
||||
type LangsNames = {
|
||||
|
@ -20,8 +20,6 @@
|
||||
*/
|
||||
|
||||
import { h, VNode } from "preact";
|
||||
import logo from "../../assets/logo.jpeg";
|
||||
import { LangSelector } from "./LangSelector";
|
||||
|
||||
interface Props {
|
||||
onMobileMenu: () => void;
|
||||
|
@ -19,11 +19,10 @@
|
||||
* @author Sebastian Javier Marchano (sebasjm)
|
||||
*/
|
||||
|
||||
import { Fragment, h, VNode } from "preact";
|
||||
import { BackupStates, RecoveryStates } from "@gnu-taler/anastasis-core";
|
||||
import { useAnastasisContext } from "../../context/anastasis";
|
||||
import { Translate } from "../../i18n";
|
||||
import { LangSelector } from "./LangSelector";
|
||||
import { Fragment, h, VNode } from "preact";
|
||||
import { useAnastasisContext } from "../../context/anastasis.js";
|
||||
import { Translate } from "../../i18n/index.js";
|
||||
|
||||
interface Props {
|
||||
mobile?: boolean;
|
||||
|
@ -17,8 +17,8 @@
|
||||
import { ComponentChildren, Fragment, h, VNode } from "preact";
|
||||
import Match from "preact-router/match";
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { NavigationBar } from "./NavigationBar";
|
||||
import { Sidebar } from "./SideBar";
|
||||
import { NavigationBar } from "./NavigationBar.js";
|
||||
import { Sidebar } from "./SideBar.js";
|
||||
|
||||
interface MenuProps {
|
||||
title: string;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
import { h, FunctionalComponent } from "preact";
|
||||
import { useState } from "preact/hooks";
|
||||
import { DurationPicker as TestedComponent } from "./DurationPicker";
|
||||
import { DurationPicker as TestedComponent } from "./DurationPicker.js";
|
||||
|
||||
export default {
|
||||
title: "Components/Picker/Duration",
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
import { createContext, h, VNode } from "preact";
|
||||
import { useContext } from "preact/hooks";
|
||||
import { AnastasisReducerApi } from "../hooks/use-anastasis-reducer";
|
||||
import { AnastasisReducerApi } from "../hooks/use-anastasis-reducer.js";
|
||||
|
||||
const initial = undefined;
|
||||
|
||||
|
@ -21,9 +21,9 @@
|
||||
|
||||
import { createContext, h, VNode } from "preact";
|
||||
import { useContext, useEffect } from "preact/hooks";
|
||||
import { useLang } from "../hooks";
|
||||
import { useLang } from "../hooks/index.js";
|
||||
import * as jedLib from "jed";
|
||||
import { strings } from "../i18n/strings";
|
||||
import { strings } from "../i18n/strings.js";
|
||||
|
||||
interface Type {
|
||||
lang: string;
|
||||
|
@ -19,7 +19,7 @@
|
||||
* @author Sebastian Javier Marchano (sebasjm)
|
||||
*/
|
||||
import { useCallback, useEffect, useRef, useState } from "preact/hooks";
|
||||
// import { cancelPendingRequest } from "./backend";
|
||||
// import { cancelPendingRequest } from "./backend.js";
|
||||
|
||||
export interface Options {
|
||||
slowTolerance: number;
|
||||
|
@ -323,7 +323,9 @@ export function useAnastasisReducer(): AnastasisReducerApi {
|
||||
},
|
||||
});
|
||||
},
|
||||
async discoverMore(): Promise<void> {},
|
||||
async discoverMore(): Promise<void> {
|
||||
return;
|
||||
},
|
||||
async startRecover() {
|
||||
let s: ReducerState;
|
||||
if (remoteReducer) {
|
||||
@ -403,7 +405,7 @@ export function useAnastasisReducer(): AnastasisReducerApi {
|
||||
}
|
||||
|
||||
class ReducerTxImpl implements ReducerTransactionHandle {
|
||||
constructor(public transactionState: ReducerState) {}
|
||||
constructor(public transactionState: ReducerState) { }
|
||||
async transition(action: string, args: any): Promise<ReducerState> {
|
||||
let s: ReducerState;
|
||||
if (remoteReducer) {
|
||||
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
import { ComponentChild, ComponentChildren, h, Fragment, VNode } from "preact";
|
||||
|
||||
import { useTranslationContext } from "../context/translation";
|
||||
import { useTranslationContext } from "../context/translation.js";
|
||||
|
||||
export function useTranslator() {
|
||||
const ctx = useTranslationContext();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import App from "./components/app";
|
||||
import App from "./components/app.js";
|
||||
import "./scss/main.scss";
|
||||
|
||||
export default App;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { setupI18n } from "@gnu-taler/taler-util";
|
||||
import { h, render } from "preact";
|
||||
import App from "./components/app";
|
||||
import App from "./components/app.js";
|
||||
|
||||
function main(): void {
|
||||
try {
|
||||
|
@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
import { ReducerState } from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../utils";
|
||||
import { AddingProviderScreen as TestedComponent } from "./AddingProviderScreen";
|
||||
import { createExample, reducerStatesExample } from "../../utils/index.js";
|
||||
import { AddingProviderScreen as TestedComponent } from "./AddingProviderScreen.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/ManageProvider",
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { AuthenticationProviderStatusOk } from "@gnu-taler/anastasis-core";
|
||||
import { h, VNode } from "preact";
|
||||
import { useEffect, useRef, useState } from "preact/hooks";
|
||||
import { TextInput } from "../../components/fields/TextInput";
|
||||
import { useAnastasisContext } from "../../context/anastasis";
|
||||
import { authMethods, KnownAuthMethods } from "./authMethod";
|
||||
import { AnastasisClientFrame } from "./index";
|
||||
import { TextInput } from "../../components/fields/TextInput.js";
|
||||
import { useAnastasisContext } from "../../context/anastasis.js";
|
||||
import { authMethods, KnownAuthMethods } from "./authMethod/index.js";
|
||||
import { AnastasisClientFrame } from "./index.js";
|
||||
|
||||
interface Props {
|
||||
providerType?: KnownAuthMethods;
|
||||
|
@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
import { ReducerState } from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../utils";
|
||||
import { AttributeEntryScreen as TestedComponent } from "./AttributeEntryScreen";
|
||||
import { createExample, reducerStatesExample } from "../../utils/index.js";
|
||||
import { AttributeEntryScreen as TestedComponent } from "./AttributeEntryScreen.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/PersonalInformation",
|
||||
|
@ -2,12 +2,12 @@ import { UserAttributeSpec, validators } from "@gnu-taler/anastasis-core";
|
||||
import { isAfter, parse } from "date-fns";
|
||||
import { h, VNode } from "preact";
|
||||
import { useState } from "preact/hooks";
|
||||
import { DateInput } from "../../components/fields/DateInput";
|
||||
import { PhoneNumberInput } from "../../components/fields/NumberInput";
|
||||
import { TextInput } from "../../components/fields/TextInput";
|
||||
import { useAnastasisContext } from "../../context/anastasis";
|
||||
import { ConfirmModal } from "./ConfirmModal";
|
||||
import { AnastasisClientFrame, withProcessLabel } from "./index";
|
||||
import { DateInput } from "../../components/fields/DateInput.js";
|
||||
import { PhoneNumberInput } from "../../components/fields/NumberInput.js";
|
||||
import { TextInput } from "../../components/fields/TextInput.js";
|
||||
import { useAnastasisContext } from "../../context/anastasis.js";
|
||||
import { ConfirmModal } from "./ConfirmModal.js";
|
||||
import { AnastasisClientFrame, withProcessLabel } from "./index.js";
|
||||
|
||||
export function AttributeEntryScreen(): VNode {
|
||||
const reducer = useAnastasisContext();
|
||||
@ -177,7 +177,8 @@ function AttributeEntryField(props: AttributeEntryFieldProps): VNode {
|
||||
)}
|
||||
{props.spec.name === "full_name" && (
|
||||
<div>
|
||||
If possible, use "LASTNAME, Firstname(s)" without abbreviations.
|
||||
If possible, use "LASTNAME, Firstname(s)" without
|
||||
abbreviations.
|
||||
</div>
|
||||
)}
|
||||
<div class="block">
|
||||
|
@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
import { ReducerState } from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../utils";
|
||||
import { AuthenticationEditorScreen as TestedComponent } from "./AuthenticationEditorScreen";
|
||||
import { createExample, reducerStatesExample } from "../../utils/index.js";
|
||||
import { AuthenticationEditorScreen as TestedComponent } from "./AuthenticationEditorScreen.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/backup/AuthorizationMethod",
|
||||
|
@ -1,17 +1,17 @@
|
||||
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 { useAnastasisContext } from "../../context/anastasis";
|
||||
import { AddingProviderScreen } from "./AddingProviderScreen";
|
||||
import { useAnastasisContext } from "../../context/anastasis.js";
|
||||
import { AddingProviderScreen } from "./AddingProviderScreen.js";
|
||||
import {
|
||||
authMethods,
|
||||
AuthMethodSetupProps,
|
||||
AuthMethodWithRemove,
|
||||
isKnownAuthMethods,
|
||||
KnownAuthMethods,
|
||||
} from "./authMethod";
|
||||
import { ConfirmModal } from "./ConfirmModal";
|
||||
import { AnastasisClientFrame } from "./index";
|
||||
} from "./authMethod/index.js";
|
||||
import { ConfirmModal } from "./ConfirmModal.js";
|
||||
import { AnastasisClientFrame } from "./index.js";
|
||||
|
||||
const getKeys = Object.keys as <T extends object>(obj: T) => Array<keyof T>;
|
||||
|
||||
@ -226,7 +226,8 @@ export function AuthenticationEditorScreen(): VNode {
|
||||
</p>
|
||||
{authAvailableSet.size > 0 && (
|
||||
<p class="block">
|
||||
We couldn't find provider for some of the authentication methods.
|
||||
We couldn't find provider for some of the authentication
|
||||
methods.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
import { ReducerState } from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../utils";
|
||||
import { BackupFinishedScreen as TestedComponent } from "./BackupFinishedScreen";
|
||||
import { createExample, reducerStatesExample } from "../../utils/index.js";
|
||||
import { BackupFinishedScreen as TestedComponent } from "./BackupFinishedScreen.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/backup/Finished",
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { AuthenticationProviderStatusOk } from "@gnu-taler/anastasis-core";
|
||||
import { format } from "date-fns";
|
||||
import { h, VNode } from "preact";
|
||||
import { useAnastasisContext } from "../../context/anastasis";
|
||||
import { AnastasisClientFrame } from "./index";
|
||||
import { useAnastasisContext } from "../../context/anastasis.js";
|
||||
import { AnastasisClientFrame } from "./index.js";
|
||||
|
||||
export function BackupFinishedScreen(): VNode {
|
||||
const reducer = useAnastasisContext();
|
||||
|
@ -24,8 +24,8 @@ import {
|
||||
RecoveryStates,
|
||||
ReducerState,
|
||||
} from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../utils";
|
||||
import { ChallengeOverviewScreen as TestedComponent } from "./ChallengeOverviewScreen";
|
||||
import { createExample, reducerStatesExample } from "../../utils/index.js";
|
||||
import { ChallengeOverviewScreen as TestedComponent } from "./ChallengeOverviewScreen.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/recovery/SolveChallenge/Overview",
|
||||
|
@ -3,10 +3,10 @@ import {
|
||||
ChallengeFeedbackStatus,
|
||||
} from "@gnu-taler/anastasis-core";
|
||||
import { h, VNode } from "preact";
|
||||
import { useAnastasisContext } from "../../context/anastasis";
|
||||
import { AnastasisClientFrame } from "./index";
|
||||
import { authMethods, KnownAuthMethods } from "./authMethod";
|
||||
import { AsyncButton } from "../../components/AsyncButton";
|
||||
import { AsyncButton } from "../../components/AsyncButton.js";
|
||||
import { useAnastasisContext } from "../../context/anastasis.js";
|
||||
import { authMethods, KnownAuthMethods } from "./authMethod/index.js";
|
||||
import { AnastasisClientFrame } from "./index.js";
|
||||
|
||||
function OverviewFeedbackDisplay(props: { feedback?: ChallengeFeedback }) {
|
||||
const { feedback } = props;
|
||||
@ -29,15 +29,15 @@ function OverviewFeedbackDisplay(props: { feedback?: ChallengeFeedback }) {
|
||||
case ChallengeFeedbackStatus.Unsupported:
|
||||
return (
|
||||
<div class="block has-text-danger">
|
||||
This client doesn't support solving this type of challenge. Use
|
||||
This client doesn't support solving this type of challenge. Use
|
||||
another version or contact the provider.
|
||||
</div>
|
||||
);
|
||||
case ChallengeFeedbackStatus.TruthUnknown:
|
||||
return (
|
||||
<div class="block has-text-danger">
|
||||
Provider doesn't recognize the challenge of the policy. Contact the
|
||||
provider for further information.
|
||||
Provider doesn't recognize the challenge of the policy. Contact
|
||||
the provider for further information.
|
||||
</div>
|
||||
);
|
||||
default:
|
||||
@ -253,7 +253,7 @@ export function ChallengeOverviewScreen(): VNode {
|
||||
Policy #{policy_index + 1}: {policyName}
|
||||
</h3>
|
||||
{policy.challenges.length === 0 && (
|
||||
<p>This policy doesn't have any challenges.</p>
|
||||
<p>This policy doesn't have any challenges.</p>
|
||||
)}
|
||||
{policy.challenges.length === 1 && (
|
||||
<p>This policy has one challenge.</p>
|
||||
|
@ -19,8 +19,8 @@
|
||||
* @author Sebastian Javier Marchano (sebasjm)
|
||||
*/
|
||||
|
||||
import { createExample, reducerStatesExample } from "../../utils";
|
||||
import { ChallengePayingScreen as TestedComponent } from "./ChallengePayingScreen";
|
||||
import { createExample, reducerStatesExample } from "../../utils/index.js";
|
||||
import { ChallengePayingScreen as TestedComponent } from "./ChallengePayingScreen.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/recovery/__ChallengePaying",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { h, VNode } from "preact";
|
||||
import { useAnastasisContext } from "../../context/anastasis";
|
||||
import { AnastasisClientFrame } from "./index";
|
||||
import { useAnastasisContext } from "../../context/anastasis.js";
|
||||
import { AnastasisClientFrame } from "./index.js";
|
||||
|
||||
export function ChallengePayingScreen(): VNode {
|
||||
const reducer = useAnastasisContext();
|
||||
|
@ -1,7 +1,5 @@
|
||||
import { differenceInBusinessDays } from "date-fns";
|
||||
import { ComponentChildren, h, VNode } from "preact";
|
||||
import { useLayoutEffect, useRef } from "preact/hooks";
|
||||
import { AsyncButton } from "../../components/AsyncButton";
|
||||
import { AsyncButton } from "../../components/AsyncButton.js";
|
||||
|
||||
export interface ConfirmModelProps {
|
||||
active?: boolean;
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
/*
|
||||
This file is part of GNU Taler
|
||||
(C) 2021 Taler Systems S.A.
|
||||
@ -21,8 +20,8 @@
|
||||
*/
|
||||
|
||||
import { ReducerState } from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../utils";
|
||||
import { ContinentSelectionScreen as TestedComponent } from "./ContinentSelectionScreen";
|
||||
import { createExample, reducerStatesExample } from "../../utils/index.js";
|
||||
import { ContinentSelectionScreen as TestedComponent } from "./ContinentSelectionScreen.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/Location",
|
||||
|
@ -1,9 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
import { BackupStates, RecoveryStates } from "@gnu-taler/anastasis-core";
|
||||
import { h, VNode } from "preact";
|
||||
import { useState } from "preact/hooks";
|
||||
import { useAnastasisContext } from "../../context/anastasis";
|
||||
import { AnastasisClientFrame, withProcessLabel } from "./index";
|
||||
import { useAnastasisContext } from "../../context/anastasis.js";
|
||||
import { AnastasisClientFrame, withProcessLabel } from "./index.js";
|
||||
|
||||
export function ContinentSelectionScreen(): VNode {
|
||||
const reducer = useAnastasisContext();
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
/*
|
||||
This file is part of GNU Taler
|
||||
(C) 2021 Taler Systems S.A.
|
||||
@ -21,8 +20,8 @@
|
||||
*/
|
||||
|
||||
import { ReducerState } from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../utils";
|
||||
import { EditPoliciesScreen as TestedComponent } from "./EditPoliciesScreen";
|
||||
import { createExample, reducerStatesExample } from "../../utils/index.js";
|
||||
import { EditPoliciesScreen as TestedComponent } from "./EditPoliciesScreen.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/backup/ReviewPolicies/EditPolicies",
|
||||
|
@ -1,10 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
import { AuthMethod, Policy } from "@gnu-taler/anastasis-core";
|
||||
import { h, VNode } from "preact";
|
||||
import { useState } from "preact/hooks";
|
||||
import { useAnastasisContext } from "../../context/anastasis";
|
||||
import { authMethods, KnownAuthMethods } from "./authMethod";
|
||||
import { AnastasisClientFrame } from "./index";
|
||||
import { useAnastasisContext } from "../../context/anastasis.js";
|
||||
import { authMethods, KnownAuthMethods } from "./authMethod/index.js";
|
||||
import { AnastasisClientFrame } from "./index.js";
|
||||
|
||||
export interface ProviderInfo {
|
||||
url: string;
|
||||
|
@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
import { ReducerState } from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../utils";
|
||||
import { PoliciesPayingScreen as TestedComponent } from "./PoliciesPayingScreen";
|
||||
import { createExample, reducerStatesExample } from "../../utils/index.js";
|
||||
import { PoliciesPayingScreen as TestedComponent } from "./PoliciesPayingScreen.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/backup/__PoliciesPaying",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { h, VNode } from "preact";
|
||||
import { useAnastasisContext } from "../../context/anastasis";
|
||||
import { AnastasisClientFrame } from "./index";
|
||||
import { useAnastasisContext } from "../../context/anastasis.js";
|
||||
import { AnastasisClientFrame } from "./index.js";
|
||||
|
||||
export function PoliciesPayingScreen(): VNode {
|
||||
const reducer = useAnastasisContext();
|
||||
|
@ -19,10 +19,10 @@
|
||||
* @author Sebastian Javier Marchano (sebasjm)
|
||||
*/
|
||||
|
||||
import { encodeCrock, stringToBytes } from "@gnu-taler/taler-util";
|
||||
import { ReducerState } from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../utils";
|
||||
import { RecoveryFinishedScreen as TestedComponent } from "./RecoveryFinishedScreen";
|
||||
import { encodeCrock, stringToBytes } from "@gnu-taler/taler-util";
|
||||
import { createExample, reducerStatesExample } from "../../utils/index.js";
|
||||
import { RecoveryFinishedScreen as TestedComponent } from "./RecoveryFinishedScreen.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/recovery/Finished",
|
||||
|
@ -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 { useEffect, useState } from "preact/hooks";
|
||||
import { stringToBytes } from "qrcode-generator";
|
||||
import { QR } from "../../components/QR";
|
||||
import { useAnastasisContext } from "../../context/anastasis";
|
||||
import { AnastasisClientFrame } from "./index";
|
||||
import { QR } from "../../components/QR.js";
|
||||
import { useAnastasisContext } from "../../context/anastasis.js";
|
||||
import { AnastasisClientFrame } from "./index.js";
|
||||
|
||||
export function RecoveryFinishedScreen(): VNode {
|
||||
const reducer = useAnastasisContext();
|
||||
|
@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
import { ReducerState } from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../utils";
|
||||
import { ReviewPoliciesScreen as TestedComponent } from "./ReviewPoliciesScreen";
|
||||
import { createExample, reducerStatesExample } from "../../utils/index.js";
|
||||
import { ReviewPoliciesScreen as TestedComponent } from "./ReviewPoliciesScreen.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/backup/ReviewPolicies",
|
||||
|
@ -1,12 +1,10 @@
|
||||
import { AuthenticationProviderStatusOk } from "@gnu-taler/anastasis-core";
|
||||
import { h, VNode } from "preact";
|
||||
import { useState } from "preact/hooks";
|
||||
import { AsyncButton } from "../../components/AsyncButton";
|
||||
import { useAnastasisContext } from "../../context/anastasis";
|
||||
import { authMethods, KnownAuthMethods } from "./authMethod";
|
||||
import { ConfirmModal } from "./ConfirmModal";
|
||||
import { EditPoliciesScreen } from "./EditPoliciesScreen";
|
||||
import { AnastasisClientFrame } from "./index";
|
||||
import { useAnastasisContext } from "../../context/anastasis.js";
|
||||
import { authMethods, KnownAuthMethods } from "./authMethod/index.js";
|
||||
import { EditPoliciesScreen } from "./EditPoliciesScreen.js";
|
||||
import { AnastasisClientFrame } from "./index.js";
|
||||
|
||||
export function ReviewPoliciesScreen(): VNode {
|
||||
const [editingPolicy, setEditingPolicy] = useState<number | undefined>();
|
||||
|
@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
import { ReducerState } from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../utils";
|
||||
import { SecretEditorScreen as TestedComponent } from "./SecretEditorScreen";
|
||||
import { createExample, reducerStatesExample } from "../../utils/index.js";
|
||||
import { SecretEditorScreen as TestedComponent } from "./SecretEditorScreen.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/backup/SecretInput",
|
||||
|
@ -1,10 +1,13 @@
|
||||
import { encodeCrock, stringToBytes } from "@gnu-taler/taler-util";
|
||||
import { h, VNode } from "preact";
|
||||
import { useState } from "preact/hooks";
|
||||
import { useAnastasisContext } from "../../context/anastasis";
|
||||
import { AnastasisClientFrame } from "./index";
|
||||
import { TextInput } from "../../components/fields/TextInput";
|
||||
import { FileInput, FileTypeContent } from "../../components/fields/FileInput";
|
||||
import {
|
||||
FileInput,
|
||||
FileTypeContent,
|
||||
} 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 {
|
||||
const reducer = useAnastasisContext();
|
||||
|
@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
import { ReducerState } from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../utils";
|
||||
import { SecretSelectionScreen as TestedComponent } from "./SecretSelectionScreen";
|
||||
import { createExample, reducerStatesExample } from "../../utils/index.js";
|
||||
import { SecretSelectionScreen as TestedComponent } from "./SecretSelectionScreen.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/recovery/SecretSelection",
|
||||
|
@ -1,15 +1,14 @@
|
||||
import {
|
||||
AuthenticationProviderStatus,
|
||||
AuthenticationProviderStatusOk,
|
||||
PolicyMetaInfo,
|
||||
} from "@gnu-taler/anastasis-core";
|
||||
import { h, VNode } from "preact";
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { AsyncButton } from "../../components/AsyncButton";
|
||||
import { PhoneNumberInput } from "../../components/fields/NumberInput";
|
||||
import { useAnastasisContext } from "../../context/anastasis";
|
||||
import { AddingProviderScreen } from "./AddingProviderScreen";
|
||||
import { AnastasisClientFrame } from "./index";
|
||||
import { AsyncButton } from "../../components/AsyncButton.js";
|
||||
import { PhoneNumberInput } from "../../components/fields/NumberInput.js";
|
||||
import { useAnastasisContext } from "../../context/anastasis.js";
|
||||
import { AddingProviderScreen } from "./AddingProviderScreen.js";
|
||||
import { AnastasisClientFrame } from "./index.js";
|
||||
|
||||
export function SecretSelectionScreen(): VNode {
|
||||
const [selectingVersion, setSelectingVersion] = useState<boolean>(false);
|
||||
@ -67,7 +66,7 @@ export function SecretSelectionScreen(): VNode {
|
||||
<ChooseAnotherProviderScreen
|
||||
providers={provs}
|
||||
selected=""
|
||||
onChange={(newProv) => () => {}}
|
||||
onChange={() => null}
|
||||
></ChooseAnotherProviderScreen>
|
||||
);
|
||||
}
|
||||
@ -78,8 +77,8 @@ export function SecretSelectionScreen(): VNode {
|
||||
hideNext="Please select version to recover"
|
||||
>
|
||||
<p>Found versions:</p>
|
||||
{policies.map((version) => (
|
||||
<div>
|
||||
{policies.map((version, i) => (
|
||||
<div key={i}>
|
||||
{version.policy_hash} / {version.secret_name}
|
||||
<button
|
||||
onClick={async () => {
|
||||
@ -184,7 +183,7 @@ export function OldSecretSelectionScreen(): VNode {
|
||||
</div>
|
||||
<div class="buttons is-right">
|
||||
<button class="button" onClick={(e) => setSelectingVersion(true)}>
|
||||
Change secret's version
|
||||
Change secret's version
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
import { ReducerState } from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../utils";
|
||||
import { SolveScreen as TestedComponent } from "./SolveScreen";
|
||||
import { createExample, reducerStatesExample } from "../../utils/index.js";
|
||||
import { SolveScreen as TestedComponent } from "./SolveScreen.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/recovery/SolveChallenge/Solve",
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { h, VNode } from "preact";
|
||||
import { AnastasisClientFrame } from ".";
|
||||
import {
|
||||
ChallengeFeedback,
|
||||
ChallengeFeedbackStatus,
|
||||
} from "@gnu-taler/anastasis-core";
|
||||
import { Notifications } from "../../components/Notifications";
|
||||
import { useAnastasisContext } from "../../context/anastasis";
|
||||
import { authMethods, KnownAuthMethods } from "./authMethod";
|
||||
import { h, VNode } from "preact";
|
||||
import { Notifications } from "../../components/Notifications.js";
|
||||
import { useAnastasisContext } from "../../context/anastasis.js";
|
||||
import { authMethods, KnownAuthMethods } from "./authMethod/index.js";
|
||||
import { AnastasisClientFrame } from "./index.js";
|
||||
|
||||
export function SolveOverviewFeedbackDisplay(props: {
|
||||
feedback?: ChallengeFeedback;
|
||||
|
@ -19,8 +19,8 @@
|
||||
* @author Sebastian Javier Marchano (sebasjm)
|
||||
*/
|
||||
|
||||
import { createExample, reducerStatesExample } from "../../utils";
|
||||
import { StartScreen as TestedComponent } from "./StartScreen";
|
||||
import { createExample, reducerStatesExample } from "../../utils/index.js";
|
||||
import { StartScreen as TestedComponent } from "./StartScreen.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/Start",
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { h, VNode } from "preact";
|
||||
import { FileInput } from "../../components/fields/FileInput";
|
||||
import { FileButton } from "../../components/FlieButton";
|
||||
import { useAnastasisContext } from "../../context/anastasis";
|
||||
import { AnastasisClientFrame } from "./index";
|
||||
import { FileButton } from "../../components/FlieButton.js";
|
||||
import { useAnastasisContext } from "../../context/anastasis.js";
|
||||
import { AnastasisClientFrame } from "./index.js";
|
||||
|
||||
export function StartScreen(): VNode {
|
||||
const reducer = useAnastasisContext();
|
||||
|
@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
import { ReducerState } from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../utils";
|
||||
import { TruthsPayingScreen as TestedComponent } from "./TruthsPayingScreen";
|
||||
import { createExample, reducerStatesExample } from "../../utils/index.js";
|
||||
import { TruthsPayingScreen as TestedComponent } from "./TruthsPayingScreen.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/backup/__TruthsPaying",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { h, VNode } from "preact";
|
||||
import { useAnastasisContext } from "../../context/anastasis";
|
||||
import { AnastasisClientFrame } from "./index";
|
||||
import { useAnastasisContext } from "../../context/anastasis.js";
|
||||
import { AnastasisClientFrame } from "./index.js";
|
||||
|
||||
export function TruthsPayingScreen(): VNode {
|
||||
const reducer = useAnastasisContext();
|
||||
|
@ -19,8 +19,8 @@
|
||||
* @author Sebastian Javier Marchano (sebasjm)
|
||||
*/
|
||||
|
||||
import { createExample, reducerStatesExample } from "../../../utils";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";
|
||||
import { createExample, reducerStatesExample } from "../../../utils/index.js";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/backup/AuthorizationMethod/AuthMethods/email",
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { encodeCrock, stringToBytes } from "@gnu-taler/taler-util";
|
||||
import { h, VNode } from "preact";
|
||||
import { useState } from "preact/hooks";
|
||||
import { EmailInput } from "../../../components/fields/EmailInput";
|
||||
import { AnastasisClientFrame } from "../index";
|
||||
import { AuthMethodSetupProps } from "./index";
|
||||
import { EmailInput } from "../../../components/fields/EmailInput.js";
|
||||
import { AnastasisClientFrame } from "../index.js";
|
||||
import { AuthMethodSetupProps } from "./index.js";
|
||||
|
||||
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({
|
||||
cancel,
|
||||
|
@ -23,8 +23,8 @@ import {
|
||||
ChallengeFeedbackStatus,
|
||||
ReducerState,
|
||||
} from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../../utils";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";
|
||||
import { createExample, reducerStatesExample } from "../../../utils/index.js";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/recovery/SolveChallenge/AuthMethods/email",
|
||||
|
@ -20,14 +20,14 @@
|
||||
import { ChallengeInfo } from "@gnu-taler/anastasis-core";
|
||||
import { h, VNode } from "preact";
|
||||
import { useState } from "preact/hooks";
|
||||
import { AsyncButton } from "../../../components/AsyncButton";
|
||||
import { TextInput } from "../../../components/fields/TextInput";
|
||||
import { useAnastasisContext } from "../../../context/anastasis";
|
||||
import { useTranslator } from "../../../i18n";
|
||||
import { AnastasisClientFrame } from "../index";
|
||||
import { SolveOverviewFeedbackDisplay } from "../SolveScreen";
|
||||
import { shouldHideConfirm } from "./helpers";
|
||||
import { AuthMethodSolveProps } from "./index";
|
||||
import { AsyncButton } from "../../../components/AsyncButton.js";
|
||||
import { TextInput } from "../../../components/fields/TextInput.js";
|
||||
import { useAnastasisContext } from "../../../context/anastasis.js";
|
||||
import { useTranslator } from "../../../i18n/index.js";
|
||||
import { AnastasisClientFrame } from "../index.js";
|
||||
import { SolveOverviewFeedbackDisplay } from "../SolveScreen.js";
|
||||
import { shouldHideConfirm } from "./helpers.js";
|
||||
import { AuthMethodSolveProps } from "./index.js";
|
||||
|
||||
export function AuthMethodEmailSolve({ id }: AuthMethodSolveProps): VNode {
|
||||
const [answer, _setAnswer] = useState("A-");
|
||||
@ -131,15 +131,16 @@ export function AuthMethodEmailSolve({ id }: AuthMethodSolveProps): VNode {
|
||||
<AnastasisClientFrame hideNav title="Email challenge">
|
||||
<SolveOverviewFeedbackDisplay feedback={feedback} />
|
||||
<p>
|
||||
An email has been sent to "<b>{selectedChallenge.instructions}</b>". The
|
||||
message has and identification code and recovery code that starts with "
|
||||
<b>A-</b>". Wait the message to arrive and the enter the recovery code
|
||||
below.
|
||||
An email has been sent to "<b>{selectedChallenge.instructions}</b>
|
||||
". The message has and identification code and recovery code that
|
||||
starts with "
|
||||
<b>A-</b>". Wait the message to arrive and the enter the recovery
|
||||
code below.
|
||||
</p>
|
||||
{!expanded ? (
|
||||
<p>
|
||||
The identification code in the email should start with "
|
||||
{selectedUuid.substring(0, 10)}"
|
||||
The identification code in the email should start with "
|
||||
{selectedUuid.substring(0, 10)}"
|
||||
<span
|
||||
class="icon has-tooltip-top"
|
||||
data-tooltip="click to expand"
|
||||
@ -150,7 +151,7 @@ export function AuthMethodEmailSolve({ id }: AuthMethodSolveProps): VNode {
|
||||
</p>
|
||||
) : (
|
||||
<p>
|
||||
The identification code in the email is "{selectedUuid}"
|
||||
The identification code in the email is "{selectedUuid}"
|
||||
<span
|
||||
class="icon has-tooltip-top"
|
||||
data-tooltip="click to show less code"
|
||||
|
@ -19,8 +19,8 @@
|
||||
* @author Sebastian Javier Marchano (sebasjm)
|
||||
*/
|
||||
|
||||
import { createExample, reducerStatesExample } from "../../../utils";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";
|
||||
import { createExample, reducerStatesExample } from "../../../utils/index.js";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/backup/AuthorizationMethod/AuthMethods/IBAN",
|
||||
|
@ -5,9 +5,9 @@ import {
|
||||
} from "@gnu-taler/taler-util";
|
||||
import { h, VNode } from "preact";
|
||||
import { useState } from "preact/hooks";
|
||||
import { AuthMethodSetupProps } from ".";
|
||||
import { TextInput } from "../../../components/fields/TextInput";
|
||||
import { AnastasisClientFrame } from "../index";
|
||||
import { TextInput } from "../../../components/fields/TextInput.js";
|
||||
import { AnastasisClientFrame } from "../index.js";
|
||||
import { AuthMethodSetupProps } from "./index.js";
|
||||
|
||||
export function AuthMethodIbanSetup({
|
||||
addAuthMethod,
|
||||
|
@ -19,12 +19,9 @@
|
||||
* @author Sebastian Javier Marchano (sebasjm)
|
||||
*/
|
||||
|
||||
import {
|
||||
ChallengeFeedbackStatus,
|
||||
ReducerState,
|
||||
} from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../../utils";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";
|
||||
import { ReducerState } from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../../utils/index.js";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/recovery/SolveChallenge/AuthMethods/Iban",
|
||||
|
@ -1,15 +1,12 @@
|
||||
import {
|
||||
ChallengeFeedbackStatus,
|
||||
ChallengeInfo,
|
||||
} from "@gnu-taler/anastasis-core";
|
||||
import { ChallengeInfo } from "@gnu-taler/anastasis-core";
|
||||
import { h, VNode } from "preact";
|
||||
import { useState } from "preact/hooks";
|
||||
import { AsyncButton } from "../../../components/AsyncButton";
|
||||
import { useAnastasisContext } from "../../../context/anastasis";
|
||||
import { AnastasisClientFrame } from "../index";
|
||||
import { SolveOverviewFeedbackDisplay } from "../SolveScreen";
|
||||
import { shouldHideConfirm } from "./helpers";
|
||||
import { AuthMethodSolveProps } from "./index";
|
||||
import { AsyncButton } from "../../../components/AsyncButton.js";
|
||||
import { useAnastasisContext } from "../../../context/anastasis.js";
|
||||
import { AnastasisClientFrame } from "../index.js";
|
||||
import { SolveOverviewFeedbackDisplay } from "../SolveScreen.js";
|
||||
import { shouldHideConfirm } from "./helpers.js";
|
||||
import { AuthMethodSolveProps } from "./index.js";
|
||||
|
||||
export function AuthMethodIbanSolve({ id }: AuthMethodSolveProps): VNode {
|
||||
const [answer, setAnswer] = useState("");
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
/*
|
||||
This file is part of GNU Taler
|
||||
(C) 2021 Taler Systems S.A.
|
||||
@ -20,8 +19,8 @@
|
||||
* @author Sebastian Javier Marchano (sebasjm)
|
||||
*/
|
||||
|
||||
import { createExample, reducerStatesExample } from "../../../utils";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";
|
||||
import { createExample, reducerStatesExample } from "../../../utils/index.js";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/backup/AuthorizationMethod/AuthMethods/Post",
|
||||
|
@ -5,9 +5,9 @@ import {
|
||||
} from "@gnu-taler/taler-util";
|
||||
import { h, VNode } from "preact";
|
||||
import { useState } from "preact/hooks";
|
||||
import { AnastasisClientFrame } from "..";
|
||||
import { TextInput } from "../../../components/fields/TextInput";
|
||||
import { AuthMethodSetupProps } from "./index";
|
||||
import { TextInput } from "../../../components/fields/TextInput.js";
|
||||
import { AnastasisClientFrame } from "../index.js";
|
||||
import { AuthMethodSetupProps } from "./index.js";
|
||||
|
||||
export function AuthMethodPostSetup({
|
||||
addAuthMethod,
|
||||
|
@ -19,12 +19,9 @@
|
||||
* @author Sebastian Javier Marchano (sebasjm)
|
||||
*/
|
||||
|
||||
import {
|
||||
ChallengeFeedbackStatus,
|
||||
ReducerState,
|
||||
} from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../../utils";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";
|
||||
import { ReducerState } from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../../utils/index.js";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/recovery/SolveChallenge/AuthMethods/post",
|
||||
|
@ -1,17 +1,14 @@
|
||||
import {
|
||||
ChallengeFeedbackStatus,
|
||||
ChallengeInfo,
|
||||
} from "@gnu-taler/anastasis-core";
|
||||
import { ChallengeInfo } from "@gnu-taler/anastasis-core";
|
||||
import { h, VNode } from "preact";
|
||||
import { useState } from "preact/hooks";
|
||||
import { AsyncButton } from "../../../components/AsyncButton";
|
||||
import { TextInput } from "../../../components/fields/TextInput";
|
||||
import { useAnastasisContext } from "../../../context/anastasis";
|
||||
import { useTranslator } from "../../../i18n";
|
||||
import { AnastasisClientFrame } from "../index";
|
||||
import { SolveOverviewFeedbackDisplay } from "../SolveScreen";
|
||||
import { shouldHideConfirm } from "./helpers";
|
||||
import { AuthMethodSolveProps } from "./index";
|
||||
import { AsyncButton } from "../../../components/AsyncButton.js";
|
||||
import { TextInput } from "../../../components/fields/TextInput.js";
|
||||
import { useAnastasisContext } from "../../../context/anastasis.js";
|
||||
import { useTranslator } from "../../../i18n/index.js";
|
||||
import { AnastasisClientFrame } from "../index.js";
|
||||
import { SolveOverviewFeedbackDisplay } from "../SolveScreen.js";
|
||||
import { shouldHideConfirm } from "./helpers.js";
|
||||
import { AuthMethodSolveProps } from "./index.js";
|
||||
|
||||
export function AuthMethodPostSolve({ id }: AuthMethodSolveProps): VNode {
|
||||
const [answer, _setAnswer] = useState("A-");
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
/*
|
||||
This file is part of GNU Taler
|
||||
(C) 2021 Taler Systems S.A.
|
||||
@ -20,8 +19,8 @@
|
||||
* @author Sebastian Javier Marchano (sebasjm)
|
||||
*/
|
||||
|
||||
import { createExample, reducerStatesExample } from "../../../utils";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";
|
||||
import { createExample, reducerStatesExample } from "../../../utils/index.js";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/backup/AuthorizationMethod/AuthMethods/Question",
|
||||
|
@ -1,9 +1,9 @@
|
||||
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 { AuthMethodSetupProps } from "./index";
|
||||
import { AnastasisClientFrame } from "../index";
|
||||
import { TextInput } from "../../../components/fields/TextInput";
|
||||
import { TextInput } from "../../../components/fields/TextInput.js";
|
||||
import { AnastasisClientFrame } from "../index.js";
|
||||
import { AuthMethodSetupProps } from "./index.js";
|
||||
|
||||
export function AuthMethodQuestionSetup({
|
||||
cancel,
|
||||
|
@ -24,8 +24,8 @@ import {
|
||||
ChallengeFeedbackStatus,
|
||||
ReducerState,
|
||||
} from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../../utils";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";
|
||||
import { createExample, reducerStatesExample } from "../../../utils/index.js";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/recovery/SolveChallenge/AuthMethods/question",
|
||||
|
@ -1,16 +1,13 @@
|
||||
import {
|
||||
ChallengeFeedbackStatus,
|
||||
ChallengeInfo,
|
||||
} from "@gnu-taler/anastasis-core";
|
||||
import { ChallengeInfo } from "@gnu-taler/anastasis-core";
|
||||
import { h, VNode } from "preact";
|
||||
import { useState } from "preact/hooks";
|
||||
import { AsyncButton } from "../../../components/AsyncButton";
|
||||
import { TextInput } from "../../../components/fields/TextInput";
|
||||
import { useAnastasisContext } from "../../../context/anastasis";
|
||||
import { AnastasisClientFrame } from "../index";
|
||||
import { SolveOverviewFeedbackDisplay } from "../SolveScreen";
|
||||
import { shouldHideConfirm } from "./helpers";
|
||||
import { AuthMethodSolveProps } from "./index";
|
||||
import { AsyncButton } from "../../../components/AsyncButton.js";
|
||||
import { TextInput } from "../../../components/fields/TextInput.js";
|
||||
import { useAnastasisContext } from "../../../context/anastasis.js";
|
||||
import { AnastasisClientFrame } from "../index.js";
|
||||
import { SolveOverviewFeedbackDisplay } from "../SolveScreen.js";
|
||||
import { shouldHideConfirm } from "./helpers.js";
|
||||
import { AuthMethodSolveProps } from "./index.js";
|
||||
|
||||
export function AuthMethodQuestionSolve({ id }: AuthMethodSolveProps): VNode {
|
||||
const [answer, setAnswer] = useState("");
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
/*
|
||||
This file is part of GNU Taler
|
||||
(C) 2021 Taler Systems S.A.
|
||||
@ -20,8 +19,8 @@
|
||||
* @author Sebastian Javier Marchano (sebasjm)
|
||||
*/
|
||||
|
||||
import { createExample, reducerStatesExample } from "../../../utils";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";
|
||||
import { createExample, reducerStatesExample } from "../../../utils/index.js";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/backup/AuthorizationMethod/AuthMethods/Sms",
|
||||
|
@ -1,9 +1,9 @@
|
||||
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 { AuthMethodSetupProps } from ".";
|
||||
import { PhoneNumberInput } from "../../../components/fields/NumberInput";
|
||||
import { AnastasisClientFrame } from "../index";
|
||||
import { PhoneNumberInput } from "../../../components/fields/NumberInput.js";
|
||||
import { AnastasisClientFrame } from "../index.js";
|
||||
import { AuthMethodSetupProps } from "./index.js";
|
||||
|
||||
const REGEX_JUST_NUMBERS = /^\+[0-9 ]*$/;
|
||||
|
||||
|
@ -19,12 +19,9 @@
|
||||
* @author Sebastian Javier Marchano (sebasjm)
|
||||
*/
|
||||
|
||||
import {
|
||||
ChallengeFeedbackStatus,
|
||||
ReducerState,
|
||||
} from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../../utils";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";
|
||||
import { ReducerState } from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../../utils/index.js";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/recovery/SolveChallenge/AuthMethods/sms",
|
||||
|
@ -1,17 +1,14 @@
|
||||
import {
|
||||
ChallengeFeedbackStatus,
|
||||
ChallengeInfo,
|
||||
} from "@gnu-taler/anastasis-core";
|
||||
import { ChallengeInfo } from "@gnu-taler/anastasis-core";
|
||||
import { h, VNode } from "preact";
|
||||
import { useState } from "preact/hooks";
|
||||
import { AsyncButton } from "../../../components/AsyncButton";
|
||||
import { TextInput } from "../../../components/fields/TextInput";
|
||||
import { useAnastasisContext } from "../../../context/anastasis";
|
||||
import { useTranslator } from "../../../i18n";
|
||||
import { AnastasisClientFrame } from "../index";
|
||||
import { SolveOverviewFeedbackDisplay } from "../SolveScreen";
|
||||
import { shouldHideConfirm } from "./helpers";
|
||||
import { AuthMethodSolveProps } from "./index";
|
||||
import { AsyncButton } from "../../../components/AsyncButton.js";
|
||||
import { TextInput } from "../../../components/fields/TextInput.js";
|
||||
import { useAnastasisContext } from "../../../context/anastasis.js";
|
||||
import { useTranslator } from "../../../i18n/index.js";
|
||||
import { AnastasisClientFrame } from "../index.js";
|
||||
import { SolveOverviewFeedbackDisplay } from "../SolveScreen.js";
|
||||
import { shouldHideConfirm } from "./helpers.js";
|
||||
import { AuthMethodSolveProps } from "./index.js";
|
||||
|
||||
export function AuthMethodSmsSolve({ id }: AuthMethodSolveProps): VNode {
|
||||
const [answer, _setAnswer] = useState("A-");
|
||||
@ -115,15 +112,16 @@ export function AuthMethodSmsSolve({ id }: AuthMethodSolveProps): VNode {
|
||||
<AnastasisClientFrame hideNav title="SMS Challenge">
|
||||
<SolveOverviewFeedbackDisplay feedback={feedback} />
|
||||
<p>
|
||||
An sms has been sent to "<b>{selectedChallenge.instructions}</b>". The
|
||||
message has and identification code and recovery code that starts with "
|
||||
<b>A-</b>". Wait the message to arrive and the enter the recovery code
|
||||
below.
|
||||
An sms has been sent to "<b>{selectedChallenge.instructions}</b>
|
||||
". The message has and identification code and recovery code that
|
||||
starts with "
|
||||
<b>A-</b>". Wait the message to arrive and the enter the recovery
|
||||
code below.
|
||||
</p>
|
||||
{!expanded ? (
|
||||
<p>
|
||||
The identification code in the SMS should start with "
|
||||
{selectedUuid.substring(0, 10)}"
|
||||
The identification code in the SMS should start with "
|
||||
{selectedUuid.substring(0, 10)}"
|
||||
<span
|
||||
class="icon has-tooltip-top"
|
||||
data-tooltip="click to expand"
|
||||
@ -134,7 +132,7 @@ export function AuthMethodSmsSolve({ id }: AuthMethodSolveProps): VNode {
|
||||
</p>
|
||||
) : (
|
||||
<p>
|
||||
The identification code in the SMS is "{selectedUuid}"
|
||||
The identification code in the SMS is "{selectedUuid}"
|
||||
<span
|
||||
class="icon has-tooltip-top"
|
||||
data-tooltip="click to show less code"
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
/*
|
||||
This file is part of GNU Taler
|
||||
(C) 2021 Taler Systems S.A.
|
||||
@ -20,8 +19,8 @@
|
||||
* @author Sebastian Javier Marchano (sebasjm)
|
||||
*/
|
||||
|
||||
import { createExample, reducerStatesExample } from "../../../utils";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";
|
||||
import { createExample, reducerStatesExample } from "../../../utils/index.js";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/backup/AuthorizationMethod/AuthMethods/TOTP",
|
||||
|
@ -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 { useMemo, useState } from "preact/hooks";
|
||||
import { AuthMethodSetupProps } from "./index";
|
||||
import { AnastasisClientFrame } from "../index";
|
||||
import { TextInput } from "../../../components/fields/TextInput";
|
||||
import { QR } from "../../../components/QR";
|
||||
import { base32enc, computeTOTPandCheck } from "./totp";
|
||||
import { TextInput } from "../../../components/fields/TextInput.js";
|
||||
import { QR } from "../../../components/QR.js";
|
||||
import { AnastasisClientFrame } from "../index.js";
|
||||
import { AuthMethodSetupProps } from "./index.js";
|
||||
import { base32enc, computeTOTPandCheck } from "./totp.js";
|
||||
|
||||
/**
|
||||
* This is hard-coded in the protocol for TOTP auth.
|
||||
@ -69,8 +69,8 @@ export function AuthMethodTotpSetup({
|
||||
bind={[test, setTest]}
|
||||
/>
|
||||
<div>
|
||||
We note that Google's implementation of TOTP is incomplete and will not
|
||||
work. We recommend using FreeOTP+.
|
||||
We note that Google's implementation of TOTP is incomplete and will
|
||||
not work. We recommend using FreeOTP+.
|
||||
</div>
|
||||
|
||||
{configured.length > 0 && (
|
||||
|
@ -19,12 +19,9 @@
|
||||
* @author Sebastian Javier Marchano (sebasjm)
|
||||
*/
|
||||
|
||||
import {
|
||||
ChallengeFeedbackStatus,
|
||||
ReducerState,
|
||||
} from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../../utils";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";
|
||||
import { ReducerState } from "@gnu-taler/anastasis-core";
|
||||
import { createExample, reducerStatesExample } from "../../../utils/index.js";
|
||||
import { authMethods as TestedComponent, KnownAuthMethods } from "./index.js";
|
||||
|
||||
export default {
|
||||
title: "Pages/recovery/SolveChallenge/AuthMethods/totp",
|
||||
|
@ -1,16 +1,13 @@
|
||||
import {
|
||||
ChallengeFeedbackStatus,
|
||||
ChallengeInfo,
|
||||
} from "@gnu-taler/anastasis-core";
|
||||
import { ChallengeInfo } from "@gnu-taler/anastasis-core";
|
||||
import { h, VNode } from "preact";
|
||||
import { useState } from "preact/hooks";
|
||||
import { AsyncButton } from "../../../components/AsyncButton";
|
||||
import { TextInput } from "../../../components/fields/TextInput";
|
||||
import { useAnastasisContext } from "../../../context/anastasis";
|
||||
import { AnastasisClientFrame } from "../index";
|
||||
import { SolveOverviewFeedbackDisplay } from "../SolveScreen";
|
||||
import { shouldHideConfirm } from "./helpers";
|
||||
import { AuthMethodSolveProps } from "./index";
|
||||
import { AsyncButton } from "../../../components/AsyncButton.js";
|
||||
import { TextInput } from "../../../components/fields/TextInput.js";
|
||||
import { useAnastasisContext } from "../../../context/anastasis.js";
|
||||
import { AnastasisClientFrame } from "../index.js";
|
||||
import { SolveOverviewFeedbackDisplay } from "../SolveScreen.js";
|
||||
import { shouldHideConfirm } from "./helpers.js";
|
||||
import { AuthMethodSolveProps } from "./index.js";
|
||||
|
||||
export function AuthMethodTotpSolve(props: AuthMethodSolveProps): VNode {
|
||||
const [answerCode, setAnswerCode] = useState("");
|
||||
|
@ -3,18 +3,18 @@ import { h, VNode } from "preact";
|
||||
import postalIcon from "../../../assets/icons/auth_method/postal.svg";
|
||||
import questionIcon from "../../../assets/icons/auth_method/question.svg";
|
||||
import smsIcon from "../../../assets/icons/auth_method/sms.svg";
|
||||
import { AuthMethodEmailSetup as EmailSetup } from "./AuthMethodEmailSetup";
|
||||
import { AuthMethodEmailSolve as EmailSolve } from "./AuthMethodEmailSolve";
|
||||
import { AuthMethodIbanSetup as IbanSetup } from "./AuthMethodIbanSetup";
|
||||
import { AuthMethodIbanSolve as IbanSolve } from "./AuthMethodIbanSolve";
|
||||
import { AuthMethodPostSetup as PostalSetup } from "./AuthMethodPostSetup";
|
||||
import { AuthMethodPostSolve as PostalSolve } from "./AuthMethodPostSolve";
|
||||
import { AuthMethodQuestionSetup as QuestionSetup } from "./AuthMethodQuestionSetup";
|
||||
import { AuthMethodQuestionSolve as QuestionSolve } from "./AuthMethodQuestionSolve";
|
||||
import { AuthMethodSmsSetup as SmsSetup } from "./AuthMethodSmsSetup";
|
||||
import { AuthMethodSmsSolve as SmsSolve } from "./AuthMethodSmsSolve";
|
||||
import { AuthMethodTotpSetup as TotpSetup } from "./AuthMethodTotpSetup";
|
||||
import { AuthMethodTotpSolve as TotpSolve } from "./AuthMethodTotpSolve";
|
||||
import { AuthMethodEmailSetup as EmailSetup } from "./AuthMethodEmailSetup.js";
|
||||
import { AuthMethodEmailSolve as EmailSolve } from "./AuthMethodEmailSolve.js";
|
||||
import { AuthMethodIbanSetup as IbanSetup } from "./AuthMethodIbanSetup.js";
|
||||
import { AuthMethodIbanSolve as IbanSolve } from "./AuthMethodIbanSolve.js";
|
||||
import { AuthMethodPostSetup as PostalSetup } from "./AuthMethodPostSetup.js";
|
||||
import { AuthMethodPostSolve as PostalSolve } from "./AuthMethodPostSolve.js";
|
||||
import { AuthMethodQuestionSetup as QuestionSetup } from "./AuthMethodQuestionSetup.js";
|
||||
import { AuthMethodQuestionSolve as QuestionSolve } from "./AuthMethodQuestionSolve.js";
|
||||
import { AuthMethodSmsSetup as SmsSetup } from "./AuthMethodSmsSetup.js";
|
||||
import { AuthMethodSmsSolve as SmsSolve } from "./AuthMethodSmsSolve.js";
|
||||
import { AuthMethodTotpSetup as TotpSetup } from "./AuthMethodTotpSetup.js";
|
||||
import { AuthMethodTotpSolve as TotpSolve } from "./AuthMethodTotpSolve.js";
|
||||
|
||||
export type AuthMethodWithRemove = AuthMethod & { remove: () => void };
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
import jssha from "jssha";
|
||||
|
||||
const SEARCH_RANGE = 16;
|
||||
|
@ -19,34 +19,34 @@
|
||||
* @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 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 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 a24 from "./StartScreen.stories.js";
|
||||
import * as a26 from "./TruthsPayingScreen.stories.js";
|
||||
|
||||
export default [
|
||||
a1,
|
||||
|
@ -7,31 +7,31 @@ import {
|
||||
VNode,
|
||||
} from "preact";
|
||||
import { useCallback, useEffect, useErrorBoundary } from "preact/hooks";
|
||||
import { AsyncButton } from "../../components/AsyncButton";
|
||||
import { Menu } from "../../components/menu";
|
||||
import { Notifications } from "../../components/Notifications";
|
||||
import { AsyncButton } from "../../components/AsyncButton.js";
|
||||
import { Menu } from "../../components/menu/index.js";
|
||||
import { Notifications } from "../../components/Notifications.js";
|
||||
import {
|
||||
AnastasisProvider,
|
||||
useAnastasisContext,
|
||||
} from "../../context/anastasis";
|
||||
} from "../../context/anastasis.js";
|
||||
import {
|
||||
AnastasisReducerApi,
|
||||
useAnastasisReducer,
|
||||
} from "../../hooks/use-anastasis-reducer";
|
||||
import { AttributeEntryScreen } from "./AttributeEntryScreen";
|
||||
import { AuthenticationEditorScreen } from "./AuthenticationEditorScreen";
|
||||
import { BackupFinishedScreen } from "./BackupFinishedScreen";
|
||||
import { ChallengeOverviewScreen } from "./ChallengeOverviewScreen";
|
||||
import { ChallengePayingScreen } from "./ChallengePayingScreen";
|
||||
import { ContinentSelectionScreen } from "./ContinentSelectionScreen";
|
||||
import { PoliciesPayingScreen } from "./PoliciesPayingScreen";
|
||||
import { RecoveryFinishedScreen } from "./RecoveryFinishedScreen";
|
||||
import { ReviewPoliciesScreen } from "./ReviewPoliciesScreen";
|
||||
import { SecretEditorScreen } from "./SecretEditorScreen";
|
||||
import { SecretSelectionScreen } from "./SecretSelectionScreen";
|
||||
import { SolveScreen } from "./SolveScreen";
|
||||
import { StartScreen } from "./StartScreen";
|
||||
import { TruthsPayingScreen } from "./TruthsPayingScreen";
|
||||
} from "../../hooks/use-anastasis-reducer.js";
|
||||
import { AttributeEntryScreen } from "./AttributeEntryScreen.js";
|
||||
import { AuthenticationEditorScreen } from "./AuthenticationEditorScreen.js";
|
||||
import { BackupFinishedScreen } from "./BackupFinishedScreen.js";
|
||||
import { ChallengeOverviewScreen } from "./ChallengeOverviewScreen.js";
|
||||
import { ChallengePayingScreen } from "./ChallengePayingScreen.js";
|
||||
import { ContinentSelectionScreen } from "./ContinentSelectionScreen.js";
|
||||
import { PoliciesPayingScreen } from "./PoliciesPayingScreen.js";
|
||||
import { RecoveryFinishedScreen } from "./RecoveryFinishedScreen.js";
|
||||
import { ReviewPoliciesScreen } from "./ReviewPoliciesScreen.js";
|
||||
import { SecretEditorScreen } from "./SecretEditorScreen.js";
|
||||
import { SecretSelectionScreen } from "./SecretSelectionScreen.js";
|
||||
import { SolveScreen } from "./SolveScreen.js";
|
||||
import { StartScreen } from "./StartScreen.js";
|
||||
import { TruthsPayingScreen } from "./TruthsPayingScreen.js";
|
||||
|
||||
function isBackup(reducer: AnastasisReducerApi): boolean {
|
||||
return reducer.currentReducerState?.reducer_type === "backup";
|
||||
@ -96,13 +96,12 @@ let currentHistoryId = 0;
|
||||
|
||||
export function AnastasisClientFrame(props: AnastasisClientFrameProps): VNode {
|
||||
const reducer = useAnastasisContext();
|
||||
if (!reducer) {
|
||||
return <p>Fatal: Reducer must be in context.</p>;
|
||||
}
|
||||
|
||||
const doBack = async (): Promise<void> => {
|
||||
if (props.onBack) {
|
||||
await props.onBack();
|
||||
} else {
|
||||
if (!reducer) return;
|
||||
await reducer.back();
|
||||
}
|
||||
};
|
||||
@ -125,6 +124,7 @@ export function AnastasisClientFrame(props: AnastasisClientFrameProps): VNode {
|
||||
if (props.onNext) {
|
||||
await props.onNext();
|
||||
} else {
|
||||
if (!reducer) return;
|
||||
await reducer.transition("next", {});
|
||||
}
|
||||
};
|
||||
@ -146,7 +146,6 @@ export function AnastasisClientFrame(props: AnastasisClientFrameProps): VNode {
|
||||
// reducer
|
||||
return false;
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
window.addEventListener("popstate", browserOnBackButton);
|
||||
|
||||
@ -154,6 +153,9 @@ export function AnastasisClientFrame(props: AnastasisClientFrameProps): VNode {
|
||||
window.removeEventListener("popstate", browserOnBackButton);
|
||||
};
|
||||
}, []);
|
||||
if (!reducer) {
|
||||
return <p>Fatal: Reducer must be in context.</p>;
|
||||
}
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
|
Loading…
Reference in New Issue
Block a user