diff options
author | Sebastian <sebasjm@gmail.com> | 2022-06-06 00:54:55 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-06-06 00:54:55 -0300 |
commit | e96358c5554794903f451b77555382d3622a9ece (patch) | |
tree | 76e1ff5d8cc5f5f51710716422192389e6c07929 | |
parent | e2a987a18255aa95157ab8bf19a8f09f8833a472 (diff) |
eslint
77 files changed, 304 insertions, 343 deletions
diff --git a/packages/anastasis-webui/src/components/AsyncButton.tsx b/packages/anastasis-webui/src/components/AsyncButton.tsx index 8f855f29f..b2bb4c99a 100644 --- a/packages/anastasis-webui/src/components/AsyncButton.tsx +++ b/packages/anastasis-webui/src/components/AsyncButton.tsx @@ -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; diff --git a/packages/anastasis-webui/src/components/app.tsx b/packages/anastasis-webui/src/components/app.tsx index 4c6683c0c..aa341c514 100644 --- a/packages/anastasis-webui/src/components/app.tsx +++ b/packages/anastasis-webui/src/components/app.tsx @@ -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 ( diff --git a/packages/anastasis-webui/src/components/fields/DateInput.tsx b/packages/anastasis-webui/src/components/fields/DateInput.tsx index 28bb1ecbb..ba0294593 100644 --- a/packages/anastasis-webui/src/components/fields/DateInput.tsx +++ b/packages/anastasis-webui/src/components/fields/DateInput.tsx @@ -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; diff --git a/packages/anastasis-webui/src/components/fields/ImageInput.tsx b/packages/anastasis-webui/src/components/fields/ImageInput.tsx index 3f8cc58dd..70ad10ffc 100644 --- a/packages/anastasis-webui/src/components/fields/ImageInput.tsx +++ b/packages/anastasis-webui/src/components/fields/ImageInput.tsx @@ -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; diff --git a/packages/anastasis-webui/src/components/menu/LangSelector.tsx b/packages/anastasis-webui/src/components/menu/LangSelector.tsx index 3566f0c26..60500b4a8 100644 --- a/packages/anastasis-webui/src/components/menu/LangSelector.tsx +++ b/packages/anastasis-webui/src/components/menu/LangSelector.tsx @@ -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 = { diff --git a/packages/anastasis-webui/src/components/menu/NavigationBar.tsx b/packages/anastasis-webui/src/components/menu/NavigationBar.tsx index 650ebd991..8b2fb2025 100644 --- a/packages/anastasis-webui/src/components/menu/NavigationBar.tsx +++ b/packages/anastasis-webui/src/components/menu/NavigationBar.tsx @@ -20,8 +20,6 @@ */ import { h, VNode } from "preact"; -import logo from "../../assets/logo.jpeg"; -import { LangSelector } from "./LangSelector"; interface Props { onMobileMenu: () => void; diff --git a/packages/anastasis-webui/src/components/menu/SideBar.tsx b/packages/anastasis-webui/src/components/menu/SideBar.tsx index e265a817d..3174e8f73 100644 --- a/packages/anastasis-webui/src/components/menu/SideBar.tsx +++ b/packages/anastasis-webui/src/components/menu/SideBar.tsx @@ -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; diff --git a/packages/anastasis-webui/src/components/menu/index.tsx b/packages/anastasis-webui/src/components/menu/index.tsx index 99d0f7646..6c8292a0c 100644 --- a/packages/anastasis-webui/src/components/menu/index.tsx +++ b/packages/anastasis-webui/src/components/menu/index.tsx @@ -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; diff --git a/packages/anastasis-webui/src/components/picker/DurationPicker.stories.tsx b/packages/anastasis-webui/src/components/picker/DurationPicker.stories.tsx index 7f96cc15b..de68388a4 100644 --- a/packages/anastasis-webui/src/components/picker/DurationPicker.stories.tsx +++ b/packages/anastasis-webui/src/components/picker/DurationPicker.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/context/anastasis.ts b/packages/anastasis-webui/src/context/anastasis.ts index 40d25d144..65e402e4c 100644 --- a/packages/anastasis-webui/src/context/anastasis.ts +++ b/packages/anastasis-webui/src/context/anastasis.ts @@ -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; diff --git a/packages/anastasis-webui/src/context/translation.ts b/packages/anastasis-webui/src/context/translation.ts index a47864d75..c360604c4 100644 --- a/packages/anastasis-webui/src/context/translation.ts +++ b/packages/anastasis-webui/src/context/translation.ts @@ -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; diff --git a/packages/anastasis-webui/src/hooks/async.ts b/packages/anastasis-webui/src/hooks/async.ts index 5235e1e3e..f9c9f3b38 100644 --- a/packages/anastasis-webui/src/hooks/async.ts +++ b/packages/anastasis-webui/src/hooks/async.ts @@ -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; diff --git a/packages/anastasis-webui/src/hooks/use-anastasis-reducer.ts b/packages/anastasis-webui/src/hooks/use-anastasis-reducer.ts index 1b77db38f..cd00950e4 100644 --- a/packages/anastasis-webui/src/hooks/use-anastasis-reducer.ts +++ b/packages/anastasis-webui/src/hooks/use-anastasis-reducer.ts @@ -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) { diff --git a/packages/anastasis-webui/src/i18n/index.tsx b/packages/anastasis-webui/src/i18n/index.tsx index 6e2c4e79a..18f0d4ee1 100644 --- a/packages/anastasis-webui/src/i18n/index.tsx +++ b/packages/anastasis-webui/src/i18n/index.tsx @@ -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(); diff --git a/packages/anastasis-webui/src/index.ts b/packages/anastasis-webui/src/index.ts index 4bd7b28f3..8f547b270 100644 --- a/packages/anastasis-webui/src/index.ts +++ b/packages/anastasis-webui/src/index.ts @@ -1,4 +1,4 @@ -import App from "./components/app"; +import App from "./components/app.js"; import "./scss/main.scss"; export default App; diff --git a/packages/anastasis-webui/src/main.ts b/packages/anastasis-webui/src/main.ts index 8e76449c2..25c241f24 100644 --- a/packages/anastasis-webui/src/main.ts +++ b/packages/anastasis-webui/src/main.ts @@ -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 { diff --git a/packages/anastasis-webui/src/pages/home/AddingProviderScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/AddingProviderScreen.stories.tsx index 49cddc8b7..1944b53a2 100644 --- a/packages/anastasis-webui/src/pages/home/AddingProviderScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/AddingProviderScreen.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/AddingProviderScreen.tsx b/packages/anastasis-webui/src/pages/home/AddingProviderScreen.tsx index 3f3abdb54..276199e75 100644 --- a/packages/anastasis-webui/src/pages/home/AddingProviderScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/AddingProviderScreen.tsx @@ -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; diff --git a/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.stories.tsx index 85dd836a6..3790175cb 100644 --- a/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx b/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx index 257c28075..e26e537f3 100644 --- a/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/AttributeEntryScreen.tsx @@ -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"> diff --git a/packages/anastasis-webui/src/pages/home/AuthenticationEditorScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/AuthenticationEditorScreen.stories.tsx index 240809476..9b10d929f 100644 --- a/packages/anastasis-webui/src/pages/home/AuthenticationEditorScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/AuthenticationEditorScreen.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/AuthenticationEditorScreen.tsx b/packages/anastasis-webui/src/pages/home/AuthenticationEditorScreen.tsx index f0cf9b88c..3a1f58c8f 100644 --- a/packages/anastasis-webui/src/pages/home/AuthenticationEditorScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/AuthenticationEditorScreen.tsx @@ -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> diff --git a/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.stories.tsx index 1c6ae4b22..03d9c28c5 100644 --- a/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.tsx b/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.tsx index cbdfcdce7..820c97415 100644 --- a/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.tsx @@ -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(); diff --git a/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx index 579ff34bf..4f1e3930b 100644 --- a/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.tsx b/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.tsx index fdd2c0b36..85c2811ee 100644 --- a/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/ChallengeOverviewScreen.tsx @@ -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> diff --git a/packages/anastasis-webui/src/pages/home/ChallengePayingScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/ChallengePayingScreen.stories.tsx index 8c788e556..ed2f4cf82 100644 --- a/packages/anastasis-webui/src/pages/home/ChallengePayingScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/ChallengePayingScreen.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/ChallengePayingScreen.tsx b/packages/anastasis-webui/src/pages/home/ChallengePayingScreen.tsx index 2e14f44cf..418200185 100644 --- a/packages/anastasis-webui/src/pages/home/ChallengePayingScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/ChallengePayingScreen.tsx @@ -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(); diff --git a/packages/anastasis-webui/src/pages/home/ConfirmModal.tsx b/packages/anastasis-webui/src/pages/home/ConfirmModal.tsx index c1c08849f..8f98cad71 100644 --- a/packages/anastasis-webui/src/pages/home/ConfirmModal.tsx +++ b/packages/anastasis-webui/src/pages/home/ConfirmModal.tsx @@ -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; diff --git a/packages/anastasis-webui/src/pages/home/ContinentSelectionScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/ContinentSelectionScreen.stories.tsx index dc1526864..2f4af9425 100644 --- a/packages/anastasis-webui/src/pages/home/ContinentSelectionScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/ContinentSelectionScreen.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/ContinentSelectionScreen.tsx b/packages/anastasis-webui/src/pages/home/ContinentSelectionScreen.tsx index e5dbcd8fc..a552b8b4e 100644 --- a/packages/anastasis-webui/src/pages/home/ContinentSelectionScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/ContinentSelectionScreen.tsx @@ -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(); diff --git a/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.stories.tsx index ed669d1c9..e0d421ed8 100644 --- a/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.tsx b/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.tsx index a57f7b08b..60f774c5c 100644 --- a/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/EditPoliciesScreen.tsx @@ -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; diff --git a/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.stories.tsx index 42ef57f39..c293ebea2 100644 --- a/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.tsx b/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.tsx index 2b2096dab..8c0a9b564 100644 --- a/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/PoliciesPayingScreen.tsx @@ -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(); diff --git a/packages/anastasis-webui/src/pages/home/RecoveryFinishedScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/RecoveryFinishedScreen.stories.tsx index e005e7521..0aa568bcd 100644 --- a/packages/anastasis-webui/src/pages/home/RecoveryFinishedScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/RecoveryFinishedScreen.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/RecoveryFinishedScreen.tsx b/packages/anastasis-webui/src/pages/home/RecoveryFinishedScreen.tsx index 326a9a59d..274289b9a 100644 --- a/packages/anastasis-webui/src/pages/home/RecoveryFinishedScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/RecoveryFinishedScreen.tsx @@ -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(); diff --git a/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.stories.tsx index 3330f1679..8b3a3862a 100644 --- a/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.tsx b/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.tsx index 6c5958d8f..aff75d237 100644 --- a/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.tsx @@ -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>(); diff --git a/packages/anastasis-webui/src/pages/home/SecretEditorScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/SecretEditorScreen.stories.tsx index 310fd8700..7b90d5686 100644 --- a/packages/anastasis-webui/src/pages/home/SecretEditorScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/SecretEditorScreen.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx b/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx index 0931f4069..965043795 100644 --- a/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx @@ -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(); diff --git a/packages/anastasis-webui/src/pages/home/SecretSelectionScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/SecretSelectionScreen.stories.tsx index df9b38879..5aadb5884 100644 --- a/packages/anastasis-webui/src/pages/home/SecretSelectionScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/SecretSelectionScreen.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/SecretSelectionScreen.tsx b/packages/anastasis-webui/src/pages/home/SecretSelectionScreen.tsx index 2d1a51aa3..c90ced7c2 100644 --- a/packages/anastasis-webui/src/pages/home/SecretSelectionScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/SecretSelectionScreen.tsx @@ -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> diff --git a/packages/anastasis-webui/src/pages/home/SolveScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/SolveScreen.stories.tsx index df16aebf5..4d200cb5d 100644 --- a/packages/anastasis-webui/src/pages/home/SolveScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/SolveScreen.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/SolveScreen.tsx b/packages/anastasis-webui/src/pages/home/SolveScreen.tsx index 941bfb93b..1f06fe68f 100644 --- a/packages/anastasis-webui/src/pages/home/SolveScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/SolveScreen.tsx @@ -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; diff --git a/packages/anastasis-webui/src/pages/home/StartScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/StartScreen.stories.tsx index fcddaf87a..06b1e301b 100644 --- a/packages/anastasis-webui/src/pages/home/StartScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/StartScreen.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/StartScreen.tsx b/packages/anastasis-webui/src/pages/home/StartScreen.tsx index 628ae4a34..52792db4f 100644 --- a/packages/anastasis-webui/src/pages/home/StartScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/StartScreen.tsx @@ -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(); diff --git a/packages/anastasis-webui/src/pages/home/TruthsPayingScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/TruthsPayingScreen.stories.tsx index a7a85fc60..e6261dd5b 100644 --- a/packages/anastasis-webui/src/pages/home/TruthsPayingScreen.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/TruthsPayingScreen.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/TruthsPayingScreen.tsx b/packages/anastasis-webui/src/pages/home/TruthsPayingScreen.tsx index c6f8cbead..867bab736 100644 --- a/packages/anastasis-webui/src/pages/home/TruthsPayingScreen.tsx +++ b/packages/anastasis-webui/src/pages/home/TruthsPayingScreen.tsx @@ -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(); diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSetup.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSetup.stories.tsx index 080a7ab31..2650caa31 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSetup.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSetup.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSetup.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSetup.tsx index 80597ff8b..4cbc991c8 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSetup.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSetup.tsx @@ -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, diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.stories.tsx index 295a47c46..8f0f361a7 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.tsx index 2ec27b8fc..d4e034a37 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.tsx @@ -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" diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSetup.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSetup.stories.tsx index c521e18fd..28e873cc3 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSetup.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSetup.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSetup.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSetup.tsx index 501a40600..777bd6ff3 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSetup.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSetup.tsx @@ -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, diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSolve.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSolve.stories.tsx index de49f2563..0ee3e0863 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSolve.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSolve.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSolve.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSolve.tsx index 39788b538..38e948763 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSolve.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodIbanSolve.tsx @@ -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(""); diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSetup.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSetup.stories.tsx index 2977586ac..a5a66335c 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSetup.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSetup.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSetup.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSetup.tsx index 04e00500c..e1f466ae2 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSetup.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSetup.tsx @@ -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, diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSolve.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSolve.stories.tsx index d971205e9..949fa3cb2 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSolve.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSolve.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSolve.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSolve.tsx index 9766703b2..1674b79bc 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSolve.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSolve.tsx @@ -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-"); diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSetup.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSetup.stories.tsx index 991301cbf..addecdf57 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSetup.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSetup.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSetup.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSetup.tsx index d5e7bced3..8144636ff 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSetup.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSetup.tsx @@ -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, diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.stories.tsx index e36d66895..578d32701 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.tsx index bc0b67dcb..5e04cc481 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodQuestionSolve.tsx @@ -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(""); diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSetup.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSetup.stories.tsx index 3a44c7ad0..f001d7a9d 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSetup.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSetup.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSetup.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSetup.tsx index fd9e889cf..9ad11829e 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSetup.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSetup.tsx @@ -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 ]*$/; diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.stories.tsx index 496e413ae..dd57021c0 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.tsx index 041d9c124..a0b4297a6 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.tsx @@ -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" diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSetup.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSetup.stories.tsx index bc4628828..7bf4bc471 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSetup.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSetup.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSetup.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSetup.tsx index a191fb9e6..d282bc223 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSetup.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSetup.tsx @@ -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 && ( diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSolve.stories.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSolve.stories.tsx index 0fba7872f..6bfe8a01d 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSolve.stories.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSolve.stories.tsx @@ -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", diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSolve.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSolve.tsx index 6b98f8ece..cc70f9d56 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSolve.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodTotpSolve.tsx @@ -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(""); diff --git a/packages/anastasis-webui/src/pages/home/authMethod/index.tsx b/packages/anastasis-webui/src/pages/home/authMethod/index.tsx index a1ab9cd28..6a6298bc7 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/index.tsx +++ b/packages/anastasis-webui/src/pages/home/authMethod/index.tsx @@ -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 }; diff --git a/packages/anastasis-webui/src/pages/home/authMethod/totp.ts b/packages/anastasis-webui/src/pages/home/authMethod/totp.ts index c2288671c..9c26ddcad 100644 --- a/packages/anastasis-webui/src/pages/home/authMethod/totp.ts +++ b/packages/anastasis-webui/src/pages/home/authMethod/totp.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/camelcase */ import jssha from "jssha"; const SEARCH_RANGE = 16; diff --git a/packages/anastasis-webui/src/pages/home/index.storiesNo.tsx b/packages/anastasis-webui/src/pages/home/index.storiesNo.tsx index 5355b6c1a..b4e95e7d6 100644 --- a/packages/anastasis-webui/src/pages/home/index.storiesNo.tsx +++ b/packages/anastasis-webui/src/pages/home/index.storiesNo.tsx @@ -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 a23 from "./AddingProviderScreen.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 a10 from "./authMethod/AuthMethodQuestionSolve.stories.js"; import * as a11 from "./authMethod/AuthMethodIbanSolve.stories.js"; -import * as a12 from "./authMethod/AuthMethodTotpSolve.stories.js"; +import * as a7 from "./authMethod/AuthMethodPostSetup.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 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 a18 from "./AuthenticationEditorScreen.stories.js"; -import * as a19 from "./SecretSelectionScreen.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 a21 from "./BackupFinishedScreen.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 a23 from "./AddingProviderScreen.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 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 a29 from "./SolveScreen.stories.js"; export default [ a1, diff --git a/packages/anastasis-webui/src/pages/home/index.tsx b/packages/anastasis-webui/src/pages/home/index.tsx index 47b62c7e8..40e2fd87b 100644 --- a/packages/anastasis-webui/src/pages/home/index.tsx +++ b/packages/anastasis-webui/src/pages/home/index.tsx @@ -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> |