diff options
Diffstat (limited to 'packages/aml-backoffice-ui/src/stories.tsx')
-rw-r--r-- | packages/aml-backoffice-ui/src/stories.tsx | 61 |
1 files changed, 38 insertions, 23 deletions
diff --git a/packages/aml-backoffice-ui/src/stories.tsx b/packages/aml-backoffice-ui/src/stories.tsx index 7685195e5..9a23d82fa 100644 --- a/packages/aml-backoffice-ui/src/stories.tsx +++ b/packages/aml-backoffice-ui/src/stories.tsx @@ -1,6 +1,6 @@ /* This file is part of GNU Taler - (C) 2022 Taler Systems S.A. + (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 @@ -21,43 +21,58 @@ import { strings } from "./i18n/strings.js"; import * as pages from "./pages/index.stories.js"; -// import * as components from "./components/index.examples.js"; -import { renderStories } from "@gnu-taler/web-util/browser"; +import { + ExchangeApiProviderTesting, + ExchangeContextType, + renderStories, +} from "@gnu-taler/web-util/browser"; +import { TalerExchangeApi } from "@gnu-taler/taler-util"; +import { ComponentChildren, FunctionComponent, VNode, h } from "preact"; import "./scss/main.css"; -import { h, ComponentChildren, FunctionComponent, VNode } from "preact"; -import { ExchangeApiContextTesting } from "./context/config.js"; function main(): void { renderStories( { pages }, { strings, - getWrapperForGroup + getWrapperForGroup, }, ); } function getWrapperForGroup(): FunctionComponent { return function All({ children }: { children?: ComponentChildren }): VNode { - return <ExchangeApiContextTesting - config={{ - currency: "ARS", - currency_specification: { - alt_unit_names: {}, - name: "ARS", - num_fractional_input_digits: 2, - num_fractional_normal_digits: 2, - num_fractional_trailing_zero_digits: 2 - }, - name: "taler-exchange", - supported_kyc_requirements: [], - version: "asd", - }}> - {children} - </ExchangeApiContextTesting> - } + const config: TalerExchangeApi.ExchangeVersionResponse = { + currency: "ARS", + currency_specification: { + alt_unit_names: {}, + name: "ARS", + num_fractional_input_digits: 2, + num_fractional_normal_digits: 2, + num_fractional_trailing_zero_digits: 2, + }, + name: "taler-exchange", + supported_kyc_requirements: [], + version: "asd", + }; + const value: ExchangeContextType = { + cancelRequest: () => null, + config, + url: new URL("/", "http://localhost"), + hints: [], + lib: { + exchange: undefined!, //FIXME: mock + }, + onActivity: () => null!, + }; + return ( + <ExchangeApiProviderTesting value={value}> + {children} + </ExchangeApiProviderTesting> + ); + }; } if (document.readyState === "loading") { |