aboutsummaryrefslogtreecommitdiff
path: root/packages/anastasis-webui/src/pages/home/SolveScreen.stories.tsx
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2021-11-05 14:56:03 -0300
committerSebastian <sebasjm@gmail.com>2021-11-05 14:56:28 -0300
commita9d2a4654b414a01a53a0d79f1f90a5102564710 (patch)
treea5dc5c76ea7ffeaec101169699302a40e0c63131 /packages/anastasis-webui/src/pages/home/SolveScreen.stories.tsx
parentd43ab6af87f2729b37548336d42ffce0ed3c879e (diff)
downloadwallet-core-a9d2a4654b414a01a53a0d79f1f90a5102564710.tar.xz
feedback state rendering
Diffstat (limited to 'packages/anastasis-webui/src/pages/home/SolveScreen.stories.tsx')
-rw-r--r--packages/anastasis-webui/src/pages/home/SolveScreen.stories.tsx193
1 files changed, 186 insertions, 7 deletions
diff --git a/packages/anastasis-webui/src/pages/home/SolveScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/SolveScreen.stories.tsx
index cb6561b3f..05c4bfa42 100644
--- a/packages/anastasis-webui/src/pages/home/SolveScreen.stories.tsx
+++ b/packages/anastasis-webui/src/pages/home/SolveScreen.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,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
-import { ReducerState } from 'anastasis-core';
+import { ChallengeFeedbackStatus, ReducerState } from 'anastasis-core';
import { createExample, reducerStatesExample } from '../../utils';
import { SolveScreen as TestedComponent } from './SolveScreen';
@@ -50,7 +49,8 @@ export const NotSupportedChallenge = createExample(TestedComponent, {
}],
policies: [],
},
- selected_challenge_uuid: 'ASDASDSAD!1'
+ selected_challenge_uuid: 'ASDASDSAD!1',
+
} as ReducerState);
export const MismatchedChallengeId = createExample(TestedComponent, {
@@ -78,7 +78,8 @@ export const SmsChallenge = createExample(TestedComponent, {
}],
policies: [],
},
- selected_challenge_uuid: 'ASDASDSAD!1'
+ selected_challenge_uuid: 'ASDASDSAD!1',
+
} as ReducerState);
export const QuestionChallenge = createExample(TestedComponent, {
@@ -92,7 +93,8 @@ export const QuestionChallenge = createExample(TestedComponent, {
}],
policies: [],
},
- selected_challenge_uuid: 'ASDASDSAD!1'
+ selected_challenge_uuid: 'ASDASDSAD!1',
+
} as ReducerState);
export const EmailChallenge = createExample(TestedComponent, {
@@ -106,7 +108,8 @@ export const EmailChallenge = createExample(TestedComponent, {
}],
policies: [],
},
- selected_challenge_uuid: 'ASDASDSAD!1'
+ selected_challenge_uuid: 'ASDASDSAD!1',
+
} as ReducerState);
export const PostChallenge = createExample(TestedComponent, {
@@ -120,5 +123,181 @@ export const PostChallenge = createExample(TestedComponent, {
}],
policies: [],
},
- selected_challenge_uuid: 'ASDASDSAD!1'
+ selected_challenge_uuid: 'ASDASDSAD!1',
+
+} as ReducerState);
+
+
+export const QuestionChallengeMessageFeedback = createExample(TestedComponent, {
+ ...reducerStatesExample.challengeSolving,
+ recovery_information: {
+ challenges: [{
+ cost: 'USD:1',
+ instructions: 'does P equals NP?',
+ type: 'question',
+ uuid: 'ASDASDSAD!1'
+ }],
+ policies: [],
+ },
+ selected_challenge_uuid: 'ASDASDSAD!1',
+ challenge_feedback: {
+ 'ASDASDSAD!1': {
+ state: ChallengeFeedbackStatus.Message,
+ message: 'Challenge should be solved'
+ }
+ }
+
+} as ReducerState);
+
+export const QuestionChallengeServerFailureFeedback = createExample(TestedComponent, {
+ ...reducerStatesExample.challengeSolving,
+ recovery_information: {
+ challenges: [{
+ cost: 'USD:1',
+ instructions: 'does P equals NP?',
+ type: 'question',
+ uuid: 'ASDASDSAD!1'
+ }],
+ policies: [],
+ },
+ selected_challenge_uuid: 'ASDASDSAD!1',
+ challenge_feedback: {
+ 'ASDASDSAD!1': {
+ state: ChallengeFeedbackStatus.ServerFailure,
+ http_status: 500,
+ error_response: "Couldn't connect to mysql"
+ }
+ }
+
+} as ReducerState);
+
+export const QuestionChallengeRedirectFeedback = createExample(TestedComponent, {
+ ...reducerStatesExample.challengeSolving,
+ recovery_information: {
+ challenges: [{
+ cost: 'USD:1',
+ instructions: 'does P equals NP?',
+ type: 'question',
+ uuid: 'ASDASDSAD!1'
+ }],
+ policies: [],
+ },
+ selected_challenge_uuid: 'ASDASDSAD!1',
+ challenge_feedback: {
+ 'ASDASDSAD!1': {
+ state: ChallengeFeedbackStatus.Redirect,
+ http_status: 302,
+ redirect_url: 'http://video.taler.net'
+ }
+ }
+
+} as ReducerState);
+
+export const QuestionChallengeMessageRateLimitExceededFeedback = createExample(TestedComponent, {
+ ...reducerStatesExample.challengeSolving,
+ recovery_information: {
+ challenges: [{
+ cost: 'USD:1',
+ instructions: 'does P equals NP?',
+ type: 'question',
+ uuid: 'ASDASDSAD!1'
+ }],
+ policies: [],
+ },
+ selected_challenge_uuid: 'ASDASDSAD!1',
+ challenge_feedback: {
+ 'ASDASDSAD!1': {
+ state: ChallengeFeedbackStatus.RateLimitExceeded,
+ }
+ }
+
+} as ReducerState);
+
+export const QuestionChallengeUnsupportedFeedback = createExample(TestedComponent, {
+ ...reducerStatesExample.challengeSolving,
+ recovery_information: {
+ challenges: [{
+ cost: 'USD:1',
+ instructions: 'does P equals NP?',
+ type: 'question',
+ uuid: 'ASDASDSAD!1'
+ }],
+ policies: [],
+ },
+ selected_challenge_uuid: 'ASDASDSAD!1',
+ challenge_feedback: {
+ 'ASDASDSAD!1': {
+ state: ChallengeFeedbackStatus.Unsupported,
+ http_status: 500,
+ unsupported_method: 'Question'
+ }
+ }
+
} as ReducerState);
+
+export const QuestionChallengeTruthUnknownFeedback = createExample(TestedComponent, {
+ ...reducerStatesExample.challengeSolving,
+ recovery_information: {
+ challenges: [{
+ cost: 'USD:1',
+ instructions: 'does P equals NP?',
+ type: 'question',
+ uuid: 'ASDASDSAD!1'
+ }],
+ policies: [],
+ },
+ selected_challenge_uuid: 'ASDASDSAD!1',
+ challenge_feedback: {
+ 'ASDASDSAD!1': {
+ state: ChallengeFeedbackStatus.TruthUnknown,
+ }
+ }
+
+} as ReducerState);
+
+export const QuestionChallengeAuthIbanFeedback = createExample(TestedComponent, {
+ ...reducerStatesExample.challengeSolving,
+ recovery_information: {
+ challenges: [{
+ cost: 'USD:1',
+ instructions: 'does P equals NP?',
+ type: 'question',
+ uuid: 'ASDASDSAD!1'
+ }],
+ policies: [],
+ },
+ selected_challenge_uuid: 'ASDASDSAD!1',
+ challenge_feedback: {
+ 'ASDASDSAD!1': {
+ state: ChallengeFeedbackStatus.AuthIban,
+ challenge_amount: "EUR:1",
+ credit_iban: "DE12345789000",
+ business_name: "Data Loss Incorporated",
+ wire_transfer_subject: "Anastasis 987654321"
+ }
+ }
+
+} as ReducerState);
+
+export const QuestionChallengePaymentFeedback = createExample(TestedComponent, {
+ ...reducerStatesExample.challengeSolving,
+ recovery_information: {
+ challenges: [{
+ cost: 'USD:1',
+ instructions: 'does P equals NP?',
+ type: 'question',
+ uuid: 'ASDASDSAD!1'
+ }],
+ policies: [],
+ },
+ selected_challenge_uuid: 'ASDASDSAD!1',
+ challenge_feedback: {
+ 'ASDASDSAD!1': {
+ state: ChallengeFeedbackStatus.Payment,
+ taler_pay_uri : "taler://pay/...",
+ provider : "https://localhost:8080/",
+ payment_secret : "3P4561HAMHRRYEYD6CM6J7TS5VTD5SR2K2EXJDZEFSX92XKHR4KG"
+ }
+ }
+} as ReducerState);
+