fixing import to anastasis-core

This commit is contained in:
Sebastian 2022-01-24 14:39:27 -03:00
parent 882d6b3710
commit 2f291847b0
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1
43 changed files with 137 additions and 75 deletions

View File

@ -20,7 +20,7 @@
*/
import { Fragment, h, VNode } from "preact";
import { BackupStates, RecoveryStates } from "../../../../anastasis-core/lib";
import { BackupStates, RecoveryStates } from "@gnu-taler/anastasis-core";
import { useAnastasisContext } from "../../context/anastasis";
import { Translate } from "../../i18n";
import { LangSelector } from "./LangSelector";

View File

@ -6,7 +6,7 @@ import {
RecoveryStates,
reduceAction,
ReducerState,
} from "anastasis-core";
} from "@gnu-taler/anastasis-core";
import { useState } from "preact/hooks";
const reducerBaseUrl = "http://localhost:5000/";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
import { ReducerState } from "anastasis-core";
import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils";
import { AddingProviderScreen as TestedComponent } from "./AddingProviderScreen";

View File

@ -1,4 +1,4 @@
import { AuthenticationProviderStatusOk } from "anastasis-core";
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";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
import { ReducerState } from "anastasis-core";
import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils";
import { AttributeEntryScreen as TestedComponent } from "./AttributeEntryScreen";

View File

@ -1,4 +1,4 @@
import { UserAttributeSpec, validators } from "anastasis-core";
import { UserAttributeSpec, validators } from "@gnu-taler/anastasis-core";
import { isAfter, parse } from "date-fns";
import { h, VNode } from "preact";
import { useState } from "preact/hooks";
@ -47,7 +47,7 @@ export function AttributeEntryScreen(): VNode {
errorMessage={error}
onConfirm={() => {
if (!hasErrors) {
setAskUserIfSure(true)
setAskUserIfSure(true);
}
}}
value={value}
@ -65,7 +65,7 @@ export function AttributeEntryScreen(): VNode {
<AnastasisClientFrame
title={withProcessLabel(reducer, "Who are you?")}
hideNext={hasErrors ? "Complete the form." : undefined}
onNext={async () => isBackup ? setAskUserIfSure(true) : doConfirm() }
onNext={async () => (isBackup ? setAskUserIfSure(true) : doConfirm())}
>
{askUserIfSure ? (
<ConfirmModal
@ -74,10 +74,10 @@ export function AttributeEntryScreen(): VNode {
description="The values in the form must be correct"
label="I am sure"
cancelLabel="Wait, I want to check"
onConfirm={() => doConfirm().then(() => setAskUserIfSure(false) )}
onConfirm={() => doConfirm().then(() => setAskUserIfSure(false))}
>
You personal information is used to define the location where your
secret will be safely stored. If you forget what you have entered or
You personal information is used to define the location where your
secret will be safely stored. If you forget what you have entered or
if there is a misspell you will be unable to recover your secret.
</ConfirmModal>
) : null}
@ -123,7 +123,7 @@ for (let i = 0; i < 100; i++) {
function AttributeEntryField(props: AttributeEntryFieldProps): VNode {
return (
<div>
{props.spec.type === "date" &&
{props.spec.type === "date" && (
<DateInput
grabFocus={props.isFirst}
label={props.spec.label}
@ -132,8 +132,8 @@ function AttributeEntryField(props: AttributeEntryFieldProps): VNode {
error={props.errorMessage}
bind={[props.value, props.setValue]}
/>
}
{props.spec.type === 'number' &&
)}
{props.spec.type === "number" && (
<PhoneNumberInput
grabFocus={props.isFirst}
label={props.spec.label}
@ -141,7 +141,7 @@ function AttributeEntryField(props: AttributeEntryFieldProps): VNode {
error={props.errorMessage}
bind={[props.value, props.setValue]}
/>
}
)}
{props.spec.type === "string" && (
<TextInput
grabFocus={props.isFirst}

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
import { ReducerState } from "anastasis-core";
import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils";
import { AuthenticationEditorScreen as TestedComponent } from "./AuthenticationEditorScreen";

View File

@ -1,4 +1,4 @@
import { AuthMethod, ReducerStateBackup } from "anastasis-core";
import { AuthMethod, ReducerStateBackup } from "@gnu-taler/anastasis-core";
import { ComponentChildren, Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks";
import { useAnastasisContext } from "../../context/anastasis";
@ -155,7 +155,10 @@ export function AuthenticationEditorScreen(): VNode {
</div>
);
}
const errors = configuredAuthMethods.length < 2 ? "There is not enough authentication methods." : undefined;
const errors =
configuredAuthMethods.length < 2
? "There is not enough authentication methods."
: undefined;
const handleNext = async () => {
const st = reducer.currentReducerState as ReducerStateBackup;
if ((st.authentication_methods ?? []).length <= 2) {
@ -243,4 +246,3 @@ function AuthMethodNotImplemented(props: AuthMethodSetupProps): VNode {
</AnastasisClientFrame>
);
}

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
import { ReducerState } from "anastasis-core";
import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils";
import { BackupFinishedScreen as TestedComponent } from "./BackupFinishedScreen";

View File

@ -1,4 +1,4 @@
import { AuthenticationProviderStatusOk } from "anastasis-core";
import { AuthenticationProviderStatusOk } from "@gnu-taler/anastasis-core";
import { format } from "date-fns";
import { h, VNode } from "preact";
import { useAnastasisContext } from "../../context/anastasis";
@ -16,7 +16,7 @@ export function BackupFinishedScreen(): VNode {
return <div>invalid state</div>;
}
const details = reducer.currentReducerState.success_details;
const providers = reducer.currentReducerState.authentication_providers ?? {}
const providers = reducer.currentReducerState.authentication_providers ?? {};
return (
<AnastasisClientFrame hideNav title="Backup success!">
@ -27,17 +27,19 @@ export function BackupFinishedScreen(): VNode {
<p>The backup is stored by the following providers:</p>
{Object.keys(details).map((url, i) => {
const sd = details[url];
const p = providers[url] as AuthenticationProviderStatusOk
const p = providers[url] as AuthenticationProviderStatusOk;
return (
<div key={i} class="box">
<a href={url} target="_blank" rel="noreferrer">{p.business_name}</a>
<a href={url} target="_blank" rel="noreferrer">
{p.business_name}
</a>
<p>
version {sd.policy_version}
{sd.policy_expiration.t_ms !== "never"
? ` expires at: ${format(
new Date(sd.policy_expiration.t_ms),
"dd-MM-yyyy",
)}`
new Date(sd.policy_expiration.t_ms),
"dd-MM-yyyy",
)}`
: " without expiration date"}
</p>
</div>

View File

@ -23,7 +23,7 @@ import {
ChallengeFeedbackStatus,
RecoveryStates,
ReducerState,
} from "anastasis-core";
} from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils";
import { ChallengeOverviewScreen as TestedComponent } from "./ChallengeOverviewScreen";

View File

@ -1,4 +1,7 @@
import { ChallengeFeedback, ChallengeFeedbackStatus } from "anastasis-core";
import {
ChallengeFeedback,
ChallengeFeedbackStatus,
} from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact";
import { useAnastasisContext } from "../../context/anastasis";
import { AnastasisClientFrame } from "./index";

View File

@ -20,7 +20,7 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
import { ReducerState } from "anastasis-core";
import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils";
import { ContinentSelectionScreen as TestedComponent } from "./ContinentSelectionScreen";

View File

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/camelcase */
import { BackupStates, RecoveryStates } from "anastasis-core";
import { BackupStates, RecoveryStates } from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact";
import { useState } from "preact/hooks";
import { useAnastasisContext } from "../../context/anastasis";

View File

@ -20,7 +20,7 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
import { ReducerState } from "anastasis-core";
import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils";
import { EditPoliciesScreen as TestedComponent } from "./EditPoliciesScreen";

View File

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/camelcase */
import { AuthMethod, Policy } from "anastasis-core";
import { AuthMethod, Policy } from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact";
import { useState } from "preact/hooks";
import { useAnastasisContext } from "../../context/anastasis";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
import { ReducerState } from "anastasis-core";
import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils";
import { PoliciesPayingScreen as TestedComponent } from "./PoliciesPayingScreen";

View File

@ -20,7 +20,7 @@
*/
import { encodeCrock, stringToBytes } from "@gnu-taler/taler-util";
import { ReducerState } from "anastasis-core";
import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils";
import { RecoveryFinishedScreen as TestedComponent } from "./RecoveryFinishedScreen";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
import { ReducerState } from "anastasis-core";
import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils";
import { ReviewPoliciesScreen as TestedComponent } from "./ReviewPoliciesScreen";

View File

@ -1,4 +1,4 @@
import { AuthenticationProviderStatusOk } from "anastasis-core";
import { AuthenticationProviderStatusOk } from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact";
import { useState } from "preact/hooks";
import { AsyncButton } from "../../components/AsyncButton";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
import { ReducerState } from "anastasis-core";
import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils";
import { SecretEditorScreen as TestedComponent } from "./SecretEditorScreen";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
import { ReducerState } from "anastasis-core";
import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils";
import { SecretSelectionScreen as TestedComponent } from "./SecretSelectionScreen";

View File

@ -1,4 +1,7 @@
import { AuthenticationProviderStatus, AuthenticationProviderStatusOk } from "anastasis-core";
import {
AuthenticationProviderStatus,
AuthenticationProviderStatusOk,
} from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact";
import { useState } from "preact/hooks";
import { AsyncButton } from "../../components/AsyncButton";
@ -68,15 +71,15 @@ export function SecretSelectionScreen(): VNode {
return <AddingProviderScreen onCancel={() => setManageProvider(false)} />;
}
const provierInfo = provs[recoveryDocument.provider_url] as AuthenticationProviderStatusOk
const provierInfo = provs[
recoveryDocument.provider_url
] as AuthenticationProviderStatusOk;
return (
<AnastasisClientFrame title="Recovery: Select secret">
<div class="columns">
<div class="column">
<div class="box" style={{ border: "2px solid green" }}>
<h1 class="subtitle">
{provierInfo.business_name}
</h1>
<h1 class="subtitle">{provierInfo.business_name}</h1>
<div class="block">
{currentVersion === 0 ? (
<p>Set to recover the latest version</p>
@ -135,11 +138,13 @@ function ChooseAnotherProviderScreen({
Choose a provider{" "}
</option>
{Object.keys(providers).map((url) => {
const p = providers[url]
if (!("methods" in p)) return null
return <option key={url} value={url}>
{p.business_name}
</option>
const p = providers[url];
if (!("methods" in p)) return null;
return (
<option key={url} value={url}>
{p.business_name}
</option>
);
})}
</select>
<div class="icon is-small is-left">
@ -169,7 +174,9 @@ function SelectOtherVersionProviderScreen({
const [otherVersion, setOtherVersion] = useState(
version > 0 ? String(version) : "",
);
const otherProviderInfo = providers[otherProvider] as AuthenticationProviderStatusOk
const otherProviderInfo = providers[
otherProvider
] as AuthenticationProviderStatusOk;
return (
<AnastasisClientFrame hideNav title="Recovery: Select secret">
@ -199,11 +206,13 @@ function SelectOtherVersionProviderScreen({
Choose a provider{" "}
</option>
{Object.keys(providers).map((url) => {
const p = providers[url]
if (!("methods" in p)) return null
return <option key={url} value={url}>
{p.business_name}
</option>
const p = providers[url];
if (!("methods" in p)) return null;
return (
<option key={url} value={url}>
{p.business_name}
</option>
);
})}
</select>
<div class="icon is-small is-left">

View File

@ -23,7 +23,7 @@ import {
ChallengeFeedbackStatus,
RecoveryStates,
ReducerState,
} from "anastasis-core";
} from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils";
import { SolveScreen as TestedComponent } from "./SolveScreen";

View File

@ -3,7 +3,7 @@ import { AnastasisClientFrame } from ".";
import {
ChallengeFeedback,
ChallengeFeedbackStatus,
} from "../../../../anastasis-core/lib";
} from "@gnu-taler/anastasis-core";
import { Notifications } from "../../components/Notifications";
import { useAnastasisContext } from "../../context/anastasis";
import { authMethods, KnownAuthMethods } from "./authMethod";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
import { ReducerState } from "anastasis-core";
import { ReducerState } from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../utils";
import { TruthsPayingScreen as TestedComponent } from "./TruthsPayingScreen";

View File

@ -19,7 +19,10 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
import { ChallengeFeedbackStatus, ReducerState } from "anastasis-core";
import {
ChallengeFeedbackStatus,
ReducerState,
} from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../../utils";
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";

View File

@ -1,4 +1,7 @@
import { ChallengeFeedbackStatus, ChallengeInfo } from "anastasis-core";
import {
ChallengeFeedbackStatus,
ChallengeInfo,
} from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact";
import { useState } from "preact/hooks";
import { AsyncButton } from "../../../components/AsyncButton";

View File

@ -19,7 +19,10 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
import { ChallengeFeedbackStatus, ReducerState } from "anastasis-core";
import {
ChallengeFeedbackStatus,
ReducerState,
} from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../../utils";
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";

View File

@ -1,4 +1,7 @@
import { ChallengeFeedbackStatus, ChallengeInfo } from "anastasis-core";
import {
ChallengeFeedbackStatus,
ChallengeInfo,
} from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact";
import { useState } from "preact/hooks";
import { AsyncButton } from "../../../components/AsyncButton";

View File

@ -19,7 +19,10 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
import { ChallengeFeedbackStatus, ReducerState } from "anastasis-core";
import {
ChallengeFeedbackStatus,
ReducerState,
} from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../../utils";
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";

View File

@ -1,4 +1,7 @@
import { ChallengeFeedbackStatus, ChallengeInfo } from "anastasis-core";
import {
ChallengeFeedbackStatus,
ChallengeInfo,
} from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact";
import { useState } from "preact/hooks";
import { AsyncButton } from "../../../components/AsyncButton";

View File

@ -19,7 +19,10 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
import { ChallengeFeedbackStatus, ReducerState } from "anastasis-core";
import {
ChallengeFeedbackStatus,
ReducerState,
} from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../../utils";
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";

View File

@ -1,4 +1,7 @@
import { ChallengeFeedbackStatus, ChallengeInfo } from "anastasis-core";
import {
ChallengeFeedbackStatus,
ChallengeInfo,
} from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact";
import { useState } from "preact/hooks";
import { AsyncButton } from "../../../components/AsyncButton";

View File

@ -19,7 +19,10 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
import { ChallengeFeedbackStatus, ReducerState } from "anastasis-core";
import {
ChallengeFeedbackStatus,
ReducerState,
} from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../../utils";
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";

View File

@ -1,4 +1,7 @@
import { ChallengeFeedbackStatus, ChallengeInfo } from "anastasis-core";
import {
ChallengeFeedbackStatus,
ChallengeInfo,
} from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact";
import { useState } from "preact/hooks";
import { AsyncButton } from "../../../components/AsyncButton";

View File

@ -19,7 +19,10 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
import { ChallengeFeedbackStatus, ReducerState } from "anastasis-core";
import {
ChallengeFeedbackStatus,
ReducerState,
} from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../../utils";
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";

View File

@ -1,4 +1,7 @@
import { ChallengeFeedbackStatus, ChallengeInfo } from "anastasis-core";
import {
ChallengeFeedbackStatus,
ChallengeInfo,
} from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact";
import { useState } from "preact/hooks";
import { AsyncButton } from "../../../components/AsyncButton";

View File

@ -19,7 +19,10 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
import { ChallengeFeedbackStatus, ReducerState } from "anastasis-core";
import {
ChallengeFeedbackStatus,
ReducerState,
} from "@gnu-taler/anastasis-core";
import { createExample, reducerStatesExample } from "../../../utils";
import { authMethods as TestedComponent, KnownAuthMethods } from "./index";

View File

@ -1,4 +1,7 @@
import { ChallengeFeedbackStatus, ChallengeInfo } from "anastasis-core";
import {
ChallengeFeedbackStatus,
ChallengeInfo,
} from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact";
import { useState } from "preact/hooks";
import { AsyncButton } from "../../../components/AsyncButton";

View File

@ -1,4 +1,4 @@
import { AuthMethod } from "anastasis-core";
import { AuthMethod } from "@gnu-taler/anastasis-core";
import { h, VNode } from "preact";
import postalIcon from "../../../assets/icons/auth_method/postal.svg";
import questionIcon from "../../../assets/icons/auth_method/question.svg";

View File

@ -1,4 +1,4 @@
import { BackupStates, RecoveryStates } from "anastasis-core";
import { BackupStates, RecoveryStates } from "@gnu-taler/anastasis-core";
import {
ComponentChildren,
Fragment,

View File

@ -1,5 +1,9 @@
/* eslint-disable @typescript-eslint/camelcase */
import { BackupStates, RecoveryStates, ReducerState } from "anastasis-core";
import {
BackupStates,
RecoveryStates,
ReducerState,
} from "@gnu-taler/anastasis-core";
import { FunctionalComponent, h, VNode } from "preact";
import { AnastasisProvider } from "../context/anastasis";