aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2024-08-27 11:30:47 -0300
committerSebastian <sebasjm@gmail.com>2024-08-27 11:31:09 -0300
commit874124d2e301ac4b5bf70937ac144bf3d371ecca (patch)
treec2cae4233d1067ef0b8be59cfffaeffaa81be091
parent1535f3ff2b221584283d290ae5c1bd1d7984c916 (diff)
downloadwallet-core-874124d2e301ac4b5bf70937ac144bf3d371ecca.tar.xz
show error with debug info
-rw-r--r--packages/aml-backoffice-ui/src/App.tsx2
-rw-r--r--packages/aml-backoffice-ui/src/ExchangeAmlFrame.tsx2
-rw-r--r--packages/aml-backoffice-ui/src/components/ErrorLoadingWithDebug.tsx24
-rw-r--r--packages/aml-backoffice-ui/src/hooks/preferences.ts7
-rw-r--r--packages/aml-backoffice-ui/src/pages/CaseDetails.tsx3
-rw-r--r--packages/aml-backoffice-ui/src/pages/Cases.tsx3
-rw-r--r--packages/kyc-ui/src/pages/Start.tsx1
7 files changed, 36 insertions, 6 deletions
diff --git a/packages/aml-backoffice-ui/src/App.tsx b/packages/aml-backoffice-ui/src/App.tsx
index e9be84441..0b66e0d26 100644
--- a/packages/aml-backoffice-ui/src/App.tsx
+++ b/packages/aml-backoffice-ui/src/App.tsx
@@ -111,7 +111,7 @@ function getInitialBackendBaseURL(
): string {
const overrideUrl =
typeof localStorage !== "undefined"
- ? localStorage.getItem("exchange-base-url")
+ ? localStorage.getItem("aml-base-url")
: undefined;
let result: string;
diff --git a/packages/aml-backoffice-ui/src/ExchangeAmlFrame.tsx b/packages/aml-backoffice-ui/src/ExchangeAmlFrame.tsx
index 78edf2899..7dc36e7f6 100644
--- a/packages/aml-backoffice-ui/src/ExchangeAmlFrame.tsx
+++ b/packages/aml-backoffice-ui/src/ExchangeAmlFrame.tsx
@@ -213,7 +213,7 @@ export function ExchangeAmlFrame({
</div>
<Footer
- testingUrlKey="exchange-base-url"
+ testingUrlKey="aml-base-url"
GIT_HASH={GIT_HASH}
VERSION={VERSION}
/>
diff --git a/packages/aml-backoffice-ui/src/components/ErrorLoadingWithDebug.tsx b/packages/aml-backoffice-ui/src/components/ErrorLoadingWithDebug.tsx
new file mode 100644
index 000000000..8679af050
--- /dev/null
+++ b/packages/aml-backoffice-ui/src/components/ErrorLoadingWithDebug.tsx
@@ -0,0 +1,24 @@
+/*
+ This file is part of GNU Taler
+ (C) 2022-2024 Taler Systems S.A.
+
+ GNU Taler is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+import { TalerError } from "@gnu-taler/taler-util";
+import { ErrorLoading } from "@gnu-taler/web-util/browser";
+import { VNode, h } from "preact";
+import { usePreferences } from "../hooks/preferences.js";
+
+export function ErrorLoadingWithDebug({ error }: { error: TalerError }): VNode {
+ const [pref] = usePreferences();
+ return <ErrorLoading error={error} showDetail={pref.showDebugInfo} />;
+}
diff --git a/packages/aml-backoffice-ui/src/hooks/preferences.ts b/packages/aml-backoffice-ui/src/hooks/preferences.ts
index 12e85d249..d329cdbb2 100644
--- a/packages/aml-backoffice-ui/src/hooks/preferences.ts
+++ b/packages/aml-backoffice-ui/src/hooks/preferences.ts
@@ -27,6 +27,7 @@ import {
} from "@gnu-taler/web-util/browser";
interface Preferences {
+ showDebugInfo: boolean;
allowInsecurePassword: boolean;
keepSessionAfterReload: boolean;
}
@@ -34,16 +35,18 @@ interface Preferences {
export const codecForPreferences = (): Codec<Preferences> =>
buildCodecForObject<Preferences>()
.property("allowInsecurePassword", (codecForBoolean()))
+ .property("showDebugInfo", codecForBoolean())
.property("keepSessionAfterReload", (codecForBoolean()))
.build("Preferences");
const defaultPreferences: Preferences = {
allowInsecurePassword: false,
+ showDebugInfo: false,
keepSessionAfterReload: false,
};
const PREFERENCES_KEY = buildStorageKey(
- "exchange-preferences",
+ "aml-preferences",
codecForPreferences(),
);
/**
@@ -69,6 +72,7 @@ export function usePreferences(): [
export function getAllBooleanPreferences(): Array<keyof Preferences> {
return [
+ "showDebugInfo",
"allowInsecurePassword",
"keepSessionAfterReload",
];
@@ -79,6 +83,7 @@ export function getLabelForPreferences(
i18n: ReturnType<typeof useTranslationContext>["i18n"],
): TranslatedString {
switch (k) {
+ case "showDebugInfo": return i18n.str`Show debug info`
case "allowInsecurePassword": return i18n.str`Allow Insecure password`
case "keepSessionAfterReload": return i18n.str`Keep session after reload`
}
diff --git a/packages/aml-backoffice-ui/src/pages/CaseDetails.tsx b/packages/aml-backoffice-ui/src/pages/CaseDetails.tsx
index 2fd95d2c6..d42e1f2c6 100644
--- a/packages/aml-backoffice-ui/src/pages/CaseDetails.tsx
+++ b/packages/aml-backoffice-ui/src/pages/CaseDetails.tsx
@@ -47,6 +47,7 @@ import { useUiFormsContext } from "../context/ui-forms.js";
import { preloadedForms } from "../forms/index.js";
import { useAccountInformation } from "../hooks/account.js";
import { ShowConsolidated } from "./ShowConsolidated.js";
+import { ErrorLoadingWithDebug } from "../components/ErrorLoadingWithDebug.js";
export type AmlEvent =
| AmlFormEvent
@@ -181,7 +182,7 @@ export function CaseDetails({ account }: { account: string }) {
return <Loading />;
}
if (details instanceof TalerError) {
- return <ErrorLoading error={details} />;
+ return <ErrorLoadingWithDebug error={details} />;
}
if (details.type === "fail") {
switch (details.case) {
diff --git a/packages/aml-backoffice-ui/src/pages/Cases.tsx b/packages/aml-backoffice-ui/src/pages/Cases.tsx
index 613e57493..e468d80ad 100644
--- a/packages/aml-backoffice-ui/src/pages/Cases.tsx
+++ b/packages/aml-backoffice-ui/src/pages/Cases.tsx
@@ -35,6 +35,7 @@ import { privatePages } from "../Routing.js";
import { FormErrors, RecursivePartial, useFormState } from "../hooks/form.js";
import { undefinedIfEmpty } from "./CreateAccount.js";
import { Officer } from "./Officer.js";
+import { ErrorLoadingWithDebug } from "../components/ErrorLoadingWithDebug.js";
type FormType = {
// state: TalerExchangeApi.AmlState;
@@ -203,7 +204,7 @@ export function Cases() {
return <Loading />;
}
if (list instanceof TalerError) {
- return <ErrorLoading error={list} />;
+ return <ErrorLoadingWithDebug error={list} />;
}
if (list.type === "fail") {
diff --git a/packages/kyc-ui/src/pages/Start.tsx b/packages/kyc-ui/src/pages/Start.tsx
index 7bdbbf80f..d30f8b840 100644
--- a/packages/kyc-ui/src/pages/Start.tsx
+++ b/packages/kyc-ui/src/pages/Start.tsx
@@ -34,7 +34,6 @@ import { useState } from "preact/hooks";
import { ErrorLoadingWithDebug } from "../components/ErrorLoadingWithDebug.js";
import { useKycInfo } from "../hooks/kyc.js";
import { FillForm } from "./FillForm.js";
-import { useSessionState } from "../hooks/session.js";
type Props = {
onLoggedOut: () => void;