aboutsummaryrefslogtreecommitdiff
path: root/packages/anastasis-webui
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2021-11-12 14:50:09 -0300
committerSebastian <sebasjm@gmail.com>2021-11-12 14:50:09 -0300
commit50b9f2167cb4acfae2158bc3c7e1f7173064195d (patch)
tree2bda935bcadd3ab478f37643e306e529308fcca3 /packages/anastasis-webui
parentd6beefe6e0ccd2d37178404d50afe36faadcad50 (diff)
fix #7075
Diffstat (limited to 'packages/anastasis-webui')
-rw-r--r--packages/anastasis-webui/package.json4
-rw-r--r--packages/anastasis-webui/preact.config.js45
-rw-r--r--packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx2
-rw-r--r--packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.stories.tsx4
-rw-r--r--packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.tsx2
-rw-r--r--packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSolve.tsx2
-rw-r--r--packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.stories.tsx2
-rw-r--r--packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.tsx2
-rw-r--r--packages/anastasis-webui/src/template.html5
9 files changed, 54 insertions, 14 deletions
diff --git a/packages/anastasis-webui/package.json b/packages/anastasis-webui/package.json
index 7a92afd43..d35b6ba27 100644
--- a/packages/anastasis-webui/package.json
+++ b/packages/anastasis-webui/package.json
@@ -4,7 +4,7 @@
"version": "0.0.0",
"license": "MIT",
"scripts": {
- "build": "preact build --no-sw --no-esm",
+ "build": "preact build --no-sw --no-esm --no-inline-css",
"serve": "sirv build --port ${PORT:=8080} --cors --single",
"dev": "preact watch --port ${PORT:=8080} --no-sw --no-esm",
"lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
@@ -71,4 +71,4 @@
"<rootDir>/tests/__mocks__/setupTests.ts"
]
}
-}
+} \ No newline at end of file
diff --git a/packages/anastasis-webui/preact.config.js b/packages/anastasis-webui/preact.config.js
new file mode 100644
index 000000000..8d6da1911
--- /dev/null
+++ b/packages/anastasis-webui/preact.config.js
@@ -0,0 +1,45 @@
+/*
+ This file is part of GNU Taler
+ (C) 2021 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/>
+ */
+
+/**
+*
+* @author Sebastian Javier Marchano (sebasjm)
+*/
+
+import { DefinePlugin } from 'webpack';
+
+import pack from './package.json';
+import * as cp from 'child_process';
+
+const commitHash = cp.execSync('git rev-parse --short HEAD').toString();
+
+export default {
+ webpack(config, env, helpers) {
+ // add __VERSION__ to be use in the html
+ config.plugins.push(
+ new DefinePlugin({
+ 'process.env.__VERSION__': JSON.stringify(env.isProd ? pack.version : `dev-${commitHash}`),
+ }),
+ );
+ const crittersWrapper = helpers.getPluginsByName(config, 'Critters')
+ if (crittersWrapper && crittersWrapper.length > 0) {
+ const [{ index }] = crittersWrapper
+ config.plugins.splice(index, 1)
+ }
+
+ }
+}
+
diff --git a/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx b/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx
index 3fe088c4f..6d4ffbf88 100644
--- a/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx
@@ -12,7 +12,7 @@ export function SecretEditorScreen(): VNode {
const [secretFile, _setSecretFile] = useState<FileTypeContent | undefined>(
undefined,
);
- function setSecretFile(v) {
+ function setSecretFile(v: FileTypeContent | undefined): void {
setSecretValue(""); // reset secret value when uploading a file
_setSecretFile(v);
}
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 6a8a2a347..729fa8a1b 100644
--- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.stories.tsx
+++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.stories.tsx
@@ -45,7 +45,7 @@ export const WithoutFeedback = createExample(
challenges: [
{
cost: "USD:1",
- instructions: "does P equals NP?",
+ instructions: "Email to me@domain.com",
type: "question",
uuid: "uuid-1",
},
@@ -67,7 +67,7 @@ export const PaymentFeedback = createExample(
challenges: [
{
cost: "USD:1",
- instructions: "does P equals NP?",
+ instructions: "Email to me@domain.com",
type: "question",
uuid: "uuid-1",
},
diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.tsx
index 89017aa6f..e50c3bb20 100644
--- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.tsx
+++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodEmailSolve.tsx
@@ -9,7 +9,7 @@ import { SolveOverviewFeedbackDisplay } from "../SolveScreen";
import { AuthMethodSolveProps } from "./index";
export function AuthMethodEmailSolve({ id }: AuthMethodSolveProps): VNode {
- const [answer, setAnswer] = useState("");
+ const [answer, setAnswer] = useState("A-");
const [expanded, setExpanded] = useState(false);
const reducer = useAnastasisContext();
diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSolve.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSolve.tsx
index bc56b9f2c..1bbbbfc03 100644
--- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSolve.tsx
+++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodPostSolve.tsx
@@ -9,7 +9,7 @@ import { SolveOverviewFeedbackDisplay } from "../SolveScreen";
import { AuthMethodSolveProps } from "./index";
export function AuthMethodPostSolve({ id }: AuthMethodSolveProps): VNode {
- const [answer, setAnswer] = useState("");
+ const [answer, setAnswer] = useState("A-");
const reducer = useAnastasisContext();
if (!reducer) {
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 3dc3adb2b..e8961cccf 100644
--- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.stories.tsx
+++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.stories.tsx
@@ -45,7 +45,7 @@ export const WithoutFeedback = createExample(
challenges: [
{
cost: "USD:1",
- instructions: "does P equals NP?",
+ instructions: "SMS to +54 11 2233 4455",
type: "question",
uuid: "uuid-1",
},
diff --git a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.tsx b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.tsx
index 218e8c858..3370c76d0 100644
--- a/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.tsx
+++ b/packages/anastasis-webui/src/pages/home/authMethod/AuthMethodSmsSolve.tsx
@@ -9,7 +9,7 @@ import { SolveOverviewFeedbackDisplay } from "../SolveScreen";
import { AuthMethodSolveProps } from "./index";
export function AuthMethodSmsSolve({ id }: AuthMethodSolveProps): VNode {
- const [answer, setAnswer] = useState("");
+ const [answer, setAnswer] = useState("A-");
const [expanded, setExpanded] = useState(false);
const reducer = useAnastasisContext();
diff --git a/packages/anastasis-webui/src/template.html b/packages/anastasis-webui/src/template.html
index 2a216916e..8ae2fe104 100644
--- a/packages/anastasis-webui/src/template.html
+++ b/packages/anastasis-webui/src/template.html
@@ -38,11 +38,6 @@
name="theme-color"
content="<%= htmlWebpackPlugin.options.manifest.theme_color %>"
/>
- <% } %> <% for (const index in htmlWebpackPlugin.files.css) { %> <% const
- file = htmlWebpackPlugin.files.css[index] %>
- <style data-href="<%= file %>">
- <%= compilation.assets[file.substr(htmlWebpackPlugin.files.publicPath.length)].source() %>
- </style>
<% } %>
</head>
<body>