update to new web-utils imports

This commit is contained in:
Sebastian 2023-05-05 08:38:28 -03:00
parent e90991973c
commit b64bb455a2
No known key found for this signature in database
GPG Key ID: 173909D1A5F66069
104 changed files with 278 additions and 255 deletions

View File

@ -15,6 +15,13 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/ */
import { buildProd } from "@gnu-taler/web-util/lib/index.build" import { build } from "@gnu-taler/web-util/build";
await buildProd(["src/index.tsx"]) await build({
source: {
js: ["src/index.tsx"],
assets: ["src/index.html"],
},
destination: "./dist/prod",
css: "sass",
});

View File

@ -15,21 +15,26 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/ */
import { serve } from "@gnu-taler/web-util/lib/index.node"; import { serve } from "@gnu-taler/web-util/node";
import { initializeDev, getFilesInSource } from "@gnu-taler/web-util/lib/index.build" import { initializeDev, getFilesInDirectory } from "@gnu-taler/web-util/build";
const allTestFiles = getFilesInSource(/.test.tsx?$/); const allTestFiles = getFilesInDirectory("src", /.test.tsx?$/);
const devEntryPoints = ["src/stories.tsx", "src/index.tsx", ...allTestFiles]; const devEntryPoints = ["src/stories.tsx", "src/index.tsx", ...allTestFiles];
const buildDev = initializeDev(devEntryPoints) const build = initializeDev({
source: {
js: devEntryPoints,
assets: ["src/index.html"],
},
css: "sass",
destination: "./dist/dev",
});
await buildDev(); await build();
serve({ serve({
folder: './dist/dev', folder: "./dist/dev",
port: 8080, port: 8080,
source: './src', source: "./src",
insecure: true, onSourceUpdate: build,
development: true, });
onUpdate: buildDev
})

View File

@ -23,7 +23,7 @@ import {
ErrorType, ErrorType,
TranslationProvider, TranslationProvider,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { route } from "preact-router"; import { route } from "preact-router";
import { useMemo } from "preact/hooks"; import { useMemo } from "preact/hooks";

View File

@ -18,10 +18,7 @@
* *
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { import { ErrorType, useTranslationContext } from "@gnu-taler/web-util/browser";
ErrorType,
useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser";
import { createHashHistory } from "history"; import { createHashHistory } from "history";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { Router, Route, route } from "preact-router"; import { Router, Route, route } from "preact-router";

View File

@ -23,7 +23,7 @@ import {
useTranslationContext, useTranslationContext,
HttpError, HttpError,
ErrorType, ErrorType,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { format } from "date-fns"; import { format } from "date-fns";
import { Fragment, FunctionComponent, h, VNode } from "preact"; import { Fragment, FunctionComponent, h, VNode } from "preact";
import { Route, route, Router } from "preact-router"; import { Route, route, Router } from "preact-router";

View File

@ -22,7 +22,7 @@
import { ComponentChildren, h } from "preact"; import { ComponentChildren, h } from "preact";
import { LoadingModal } from "../modal/index.js"; import { LoadingModal } from "../modal/index.js";
import { useAsync } from "../../hooks/async.js"; import { useAsync } from "../../hooks/async.js";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
type Props = { type Props = {
children: ComponentChildren; children: ComponentChildren;

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { useBackendContext } from "../../context/backend.js"; import { useBackendContext } from "../../context/backend.js";

View File

@ -18,7 +18,7 @@
* *
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { InputProps, useField } from "./useField.js"; import { InputProps, useField } from "./useField.js";

View File

@ -18,7 +18,7 @@
* *
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { format } from "date-fns"; import { format } from "date-fns";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";

View File

@ -18,7 +18,7 @@
* *
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { formatDuration, intervalToDuration } from "date-fns"; import { formatDuration, intervalToDuration } from "date-fns";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";

View File

@ -18,7 +18,7 @@
* *
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { ComponentChildren, h, VNode } from "preact"; import { ComponentChildren, h, VNode } from "preact";
import { useRef, useState } from "preact/hooks"; import { useRef, useState } from "preact/hooks";
import { MAX_IMAGE_SIZE as MAX_IMAGE_UPLOAD_SIZE } from "../../utils/constants.js"; import { MAX_IMAGE_SIZE as MAX_IMAGE_UPLOAD_SIZE } from "../../utils/constants.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { Fragment, h } from "preact"; import { Fragment, h } from "preact";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { Input } from "./Input.js"; import { Input } from "./Input.js";
export function InputLocation({ name }: { name: string }) { export function InputLocation({ name }: { name: string }) {

View File

@ -20,7 +20,7 @@
*/ */
import { h } from "preact"; import { h } from "preact";
import { tests } from "@gnu-taler/web-util/lib/index.browser"; import * as tests from "@gnu-taler/web-util/testing";
import { InputPaytoForm } from "./InputPaytoForm.js"; import { InputPaytoForm } from "./InputPaytoForm.js";
import { FormProvider } from "./FormProvider.js"; import { FormProvider } from "./FormProvider.js";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";

View File

@ -18,7 +18,7 @@
* *
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useCallback, useState } from "preact/hooks"; import { useCallback, useState } from "preact/hooks";
import { COUNTRY_TABLE } from "../../utils/constants.js"; import { COUNTRY_TABLE } from "../../utils/constants.js";

View File

@ -18,7 +18,7 @@
* *
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import emptyImage from "../../assets/empty.png"; import emptyImage from "../../assets/empty.png";

View File

@ -18,7 +18,7 @@
* *
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { InputProps, useField } from "./useField.js"; import { InputProps, useField } from "./useField.js";

View File

@ -18,7 +18,7 @@
* *
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, h } from "preact"; import { Fragment, h } from "preact";
import { useLayoutEffect, useState } from "preact/hooks"; import { useLayoutEffect, useState } from "preact/hooks";
import { MerchantBackend, Timestamp } from "../../declaration.js"; import { MerchantBackend, Timestamp } from "../../declaration.js";

View File

@ -18,7 +18,7 @@
* *
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useCallback, useState } from "preact/hooks"; import { useCallback, useState } from "preact/hooks";
import * as yup from "yup"; import * as yup from "yup";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useBackendContext } from "../../context/backend.js"; import { useBackendContext } from "../../context/backend.js";
import { Entity } from "../../paths/admin/create/CreatePage.js"; import { Entity } from "../../paths/admin/create/CreatePage.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import langIcon from "../../assets/icons/languageicon.svg"; import langIcon from "../../assets/icons/languageicon.svg";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useBackendContext } from "../../context/backend.js"; import { useBackendContext } from "../../context/backend.js";
import { useConfigContext } from "../../context/config.js"; import { useConfigContext } from "../../context/config.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { ComponentChildren, Fragment, h, VNode } from "preact"; import { ComponentChildren, Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { useInstanceContext } from "../../context/instance.js"; import { useInstanceContext } from "../../context/instance.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import "../../scss/DurationPicker.scss"; import "../../scss/DurationPicker.scss";

View File

@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License along with 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/> GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { MerchantBackend, WithId } from "../../declaration.js"; import { MerchantBackend, WithId } from "../../declaration.js";

View File

@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License along with 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/> GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useCallback, useEffect, useState } from "preact/hooks"; import { useCallback, useEffect, useState } from "preact/hooks";
import * as yup from "yup"; import * as yup from "yup";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h } from "preact"; import { h } from "preact";
import { useCallback, useEffect, useState } from "preact/hooks"; import { useCallback, useEffect, useState } from "preact/hooks";
import * as yup from "yup"; import * as yup from "yup";

View File

@ -16,7 +16,7 @@
import { Amounts } from "@gnu-taler/taler-util"; import { Amounts } from "@gnu-taler/taler-util";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import emptyImage from "../../assets/empty.png"; import emptyImage from "../../assets/empty.png";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { MerchantBackend } from "../../declaration.js"; import { MerchantBackend } from "../../declaration.js";
interface Props { interface Props {

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { tests } from "@gnu-taler/web-util/lib/index.browser"; import * as tests from "@gnu-taler/web-util/testing";
import { ComponentChildren, h, VNode } from "preact"; import { ComponentChildren, h, VNode } from "preact";
import { MerchantBackend } from "../declaration.js"; import { MerchantBackend } from "../declaration.js";
import { import {

View File

@ -30,8 +30,8 @@ import {
HttpResponseOk, HttpResponseOk,
RequestError, RequestError,
RequestOptions, RequestOptions,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { useApiContext } from "@gnu-taler/web-util/lib/index.browser"; import { useApiContext } from "@gnu-taler/web-util/browser";
export function useMatchMutate(): ( export function useMatchMutate(): (
re: RegExp, re: RegExp,

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { tests } from "@gnu-taler/web-util/lib/index.browser"; import * as tests from "@gnu-taler/web-util/testing";
import { expect } from "chai"; import { expect } from "chai";
import { MerchantBackend } from "../declaration.js"; import { MerchantBackend } from "../declaration.js";
import { import {

View File

@ -17,7 +17,7 @@ import {
HttpResponse, HttpResponse,
HttpResponseOk, HttpResponseOk,
RequestError, RequestError,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { useBackendContext } from "../context/backend.js"; import { useBackendContext } from "../context/backend.js";
import { MerchantBackend } from "../declaration.js"; import { MerchantBackend } from "../declaration.js";
import { import {

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { tests } from "@gnu-taler/web-util/lib/index.browser"; import * as tests from "@gnu-taler/web-util/testing";
import { expect } from "chai"; import { expect } from "chai";
import { MerchantBackend } from "../declaration.js"; import { MerchantBackend } from "../declaration.js";
import { useInstanceOrders, useOrderAPI, useOrderDetails } from "./order.js"; import { useInstanceOrders, useOrderAPI, useOrderDetails } from "./order.js";

View File

@ -18,7 +18,7 @@ import {
HttpResponseOk, HttpResponseOk,
HttpResponsePaginated, HttpResponsePaginated,
RequestError, RequestError,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { useEffect, useState } from "preact/hooks"; import { useEffect, useState } from "preact/hooks";
import { MerchantBackend } from "../declaration.js"; import { MerchantBackend } from "../declaration.js";
import { MAX_RESULT_SIZE, PAGE_SIZE } from "../utils/constants.js"; import { MAX_RESULT_SIZE, PAGE_SIZE } from "../utils/constants.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { tests } from "@gnu-taler/web-util/lib/index.browser"; import * as tests from "@gnu-taler/web-util/testing";
import { expect } from "chai"; import { expect } from "chai";
import { MerchantBackend } from "../declaration.js"; import { MerchantBackend } from "../declaration.js";
import { import {

View File

@ -17,7 +17,7 @@ import {
HttpResponse, HttpResponse,
HttpResponseOk, HttpResponseOk,
RequestError, RequestError,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { MerchantBackend, WithId } from "../declaration.js"; import { MerchantBackend, WithId } from "../declaration.js";
import { useBackendInstanceRequest, useMatchMutate } from "./backend.js"; import { useBackendInstanceRequest, useMatchMutate } from "./backend.js";

View File

@ -37,7 +37,7 @@ import {
API_GET_TIP_BY_ID, API_GET_TIP_BY_ID,
API_LIST_RESERVES, API_LIST_RESERVES,
} from "./urls.js"; } from "./urls.js";
import { tests } from "@gnu-taler/web-util/lib/index.browser"; import * as tests from "@gnu-taler/web-util/testing";
describe("reserve api interaction with listing", () => { describe("reserve api interaction with listing", () => {
it("should evict cache when creating a reserve", async () => { it("should evict cache when creating a reserve", async () => {

View File

@ -17,7 +17,7 @@ import {
HttpResponse, HttpResponse,
HttpResponseOk, HttpResponseOk,
RequestError, RequestError,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { MerchantBackend } from "../declaration.js"; import { MerchantBackend } from "../declaration.js";
import { useBackendInstanceRequest, useMatchMutate } from "./backend.js"; import { useBackendInstanceRequest, useMatchMutate } from "./backend.js";

View File

@ -18,7 +18,7 @@ import {
HttpResponseOk, HttpResponseOk,
HttpResponsePaginated, HttpResponsePaginated,
RequestError, RequestError,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { useEffect, useState } from "preact/hooks"; import { useEffect, useState } from "preact/hooks";
import { MerchantBackend } from "../declaration.js"; import { MerchantBackend } from "../declaration.js";
import { MAX_RESULT_SIZE, PAGE_SIZE } from "../utils/constants.js"; import { MAX_RESULT_SIZE, PAGE_SIZE } from "../utils/constants.js";

View File

@ -19,16 +19,13 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { MockEnvironment } from "@gnu-taler/web-util/lib/tests/mock"; import { MockEnvironment } from "@gnu-taler/web-util/testing";
import { ComponentChildren, FunctionalComponent, h, VNode } from "preact"; import { ComponentChildren, FunctionalComponent, h, VNode } from "preact";
import { SWRConfig } from "swr"; import { SWRConfig } from "swr";
import { ApiContextProvider } from "@gnu-taler/web-util/lib/index.browser"; import { ApiContextProvider } from "@gnu-taler/web-util/browser";
import { BackendContextProvider } from "../context/backend.js"; import { BackendContextProvider } from "../context/backend.js";
import { InstanceContextProvider } from "../context/instance.js"; import { InstanceContextProvider } from "../context/instance.js";
import { import { HttpResponseOk, RequestOptions } from "@gnu-taler/web-util/browser";
HttpResponseOk,
RequestOptions,
} from "@gnu-taler/web-util/lib/index.browser";
export class ApiMockEnvironment extends MockEnvironment { export class ApiMockEnvironment extends MockEnvironment {
constructor(debug = false) { constructor(debug = false) {

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { tests } from "@gnu-taler/web-util/lib/index.browser"; import * as tests from "@gnu-taler/web-util/testing";
import { expect } from "chai"; import { expect } from "chai";
import { MerchantBackend } from "../declaration.js"; import { MerchantBackend } from "../declaration.js";
import { API_INFORM_TRANSFERS, API_LIST_TRANSFERS } from "./urls.js"; import { API_INFORM_TRANSFERS, API_LIST_TRANSFERS } from "./urls.js";

View File

@ -18,7 +18,7 @@ import {
HttpResponseOk, HttpResponseOk,
HttpResponsePaginated, HttpResponsePaginated,
RequestError, RequestError,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { useEffect, useState } from "preact/hooks"; import { useEffect, useState } from "preact/hooks";
import { MerchantBackend } from "../declaration.js"; import { MerchantBackend } from "../declaration.js";
import { MAX_RESULT_SIZE, PAGE_SIZE } from "../utils/constants.js"; import { MAX_RESULT_SIZE, PAGE_SIZE } from "../utils/constants.js";

View File

@ -18,7 +18,7 @@
* *
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { Query } from "@gnu-taler/web-util/lib/tests/mock"; import { Query } from "@gnu-taler/web-util/testing";
import { MerchantBackend } from "../declaration.js"; import { MerchantBackend } from "../declaration.js";
//////////////////// ////////////////////
@ -86,7 +86,7 @@ export const API_LIST_TRANSFERS: Query<
export const API_INFORM_TRANSFERS: Query< export const API_INFORM_TRANSFERS: Query<
MerchantBackend.Transfers.TransferInformation, MerchantBackend.Transfers.TransferInformation,
MerchantBackend.Transfers.MerchantTrackTransferResponse {}
> = { > = {
method: "POST", method: "POST",
url: "http://backend/instances/default/private/transfers", url: "http://backend/instances/default/private/transfers",

View File

@ -18,7 +18,7 @@ import {
HttpResponseOk, HttpResponseOk,
HttpResponsePaginated, HttpResponsePaginated,
RequestError, RequestError,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { useEffect, useState } from "preact/hooks"; import { useEffect, useState } from "preact/hooks";
import { MerchantBackend } from "../declaration.js"; import { MerchantBackend } from "../declaration.js";
import { MAX_RESULT_SIZE, PAGE_SIZE } from "../utils/constants.js"; import { MAX_RESULT_SIZE, PAGE_SIZE } from "../utils/constants.js";

View File

@ -20,7 +20,7 @@
*/ */
import { Amounts } from "@gnu-taler/taler-util"; import { Amounts } from "@gnu-taler/taler-util";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { AsyncButton } from "../../../components/exception/AsyncButton.js"; import { AsyncButton } from "../../../components/exception/AsyncButton.js";

View File

@ -17,7 +17,7 @@
* *
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { NotificationCard } from "../../../components/menu/index.js"; import { NotificationCard } from "../../../components/menu/index.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { StateUpdater, useEffect, useState } from "preact/hooks"; import { StateUpdater, useEffect, useState } from "preact/hooks";
import { MerchantBackend } from "../../../declaration.js"; import { MerchantBackend } from "../../../declaration.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { MerchantBackend } from "../../../declaration.js"; import { MerchantBackend } from "../../../declaration.js";

View File

@ -23,7 +23,7 @@ import {
ErrorType, ErrorType,
HttpError, HttpError,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { Loading } from "../../../components/exception/loading.js"; import { Loading } from "../../../components/exception/loading.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { FormProvider } from "../../../components/form/FormProvider.js"; import { FormProvider } from "../../../components/form/FormProvider.js";
@ -36,14 +36,14 @@ interface Props {
function convert( function convert(
from: MerchantBackend.Instances.QueryInstancesResponse, from: MerchantBackend.Instances.QueryInstancesResponse,
): Entity { ): Entity {
const { accounts, ...rest } = from; const { accounts: allAccounts, ...rest } = from;
const payto_uris = accounts.filter((a) => a.active).map((a) => a.payto_uri); const accounts = allAccounts.filter((a) => a.active);
const defaults = { const defaults = {
default_wire_fee_amortization: 1, default_wire_fee_amortization: 1,
default_pay_delay: { d_us: 1000 * 60 * 60 * 1000 }, //one hour default_pay_delay: { d_us: 1000 * 60 * 60 * 1000 }, //one hour
default_wire_transfer_delay: { d_us: 1000 * 60 * 60 * 2 * 1000 }, //two hours default_wire_transfer_delay: { d_us: 1000 * 60 * 60 * 2 * 1000 }, //two hours
}; };
return { ...defaults, ...rest, payto_uris }; return { ...defaults, ...rest, accounts };
} }
export function DetailPage({ selected }: Props): VNode { export function DetailPage({ selected }: Props): VNode {
@ -75,7 +75,7 @@ export function DetailPage({ selected }: Props): VNode {
<FormProvider<Entity> object={value} valueHandler={valueHandler}> <FormProvider<Entity> object={value} valueHandler={valueHandler}>
<Input<Entity> name="name" readonly label={i18n.str`Name`} /> <Input<Entity> name="name" readonly label={i18n.str`Name`} />
<Input<Entity> <Input<Entity>
name="payto_uris" name="accounts"
readonly readonly
label={i18n.str`Account address`} label={i18n.str`Account address`}
/> />

View File

@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License along with 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/> GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/ */
import { ErrorType, HttpError } from "@gnu-taler/web-util/lib/index.browser"; import { ErrorType, HttpError } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { Loading } from "../../../components/exception/loading.js"; import { Loading } from "../../../components/exception/loading.js";

View File

@ -21,7 +21,7 @@
import { h, VNode, FunctionalComponent } from "preact"; import { h, VNode, FunctionalComponent } from "preact";
import { ListPage as TestedComponent } from "./ListPage.js"; import { ListPage as TestedComponent } from "./ListPage.js";
import { tests } from "@gnu-taler/web-util/lib/index.browser"; import * as tests from "@gnu-taler/web-util/testing";
import { MerchantBackend } from "../../../../declaration.js"; import { MerchantBackend } from "../../../../declaration.js";
export default { export default {

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { MerchantBackend } from "../../../../declaration.js"; import { MerchantBackend } from "../../../../declaration.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { ErrorType, HttpError } from "@gnu-taler/web-util/lib/index.browser"; import { ErrorType, HttpError } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { Loading } from "../../../../components/exception/loading.js"; import { Loading } from "../../../../components/exception/loading.js";
import { MerchantBackend } from "../../../../declaration.js"; import { MerchantBackend } from "../../../../declaration.js";

View File

@ -20,7 +20,7 @@
*/ */
import { Amounts } from "@gnu-taler/taler-util"; import { Amounts } from "@gnu-taler/taler-util";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { add, isAfter, isBefore, isFuture } from "date-fns"; import { add, isAfter, isBefore, isFuture } from "date-fns";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useEffect, useState } from "preact/hooks"; import { useEffect, useState } from "preact/hooks";

View File

@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License along with 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/> GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useEffect, useState } from "preact/hooks"; import { useEffect, useState } from "preact/hooks";
import { CreatedSuccessfully } from "../../../../components/notifications/CreatedSuccessfully.js"; import { CreatedSuccessfully } from "../../../../components/notifications/CreatedSuccessfully.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { ErrorType, HttpError } from "@gnu-taler/web-util/lib/index.browser"; import { ErrorType, HttpError } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { Loading } from "../../../../components/exception/loading.js"; import { Loading } from "../../../../components/exception/loading.js";

View File

@ -20,7 +20,7 @@
*/ */
import { AmountJson, Amounts } from "@gnu-taler/taler-util"; import { AmountJson, Amounts } from "@gnu-taler/taler-util";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { format } from "date-fns"; import { format } from "date-fns";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";

View File

@ -17,7 +17,7 @@ import {
useTranslationContext, useTranslationContext,
HttpError, HttpError,
ErrorType, ErrorType,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { Loading } from "../../../../components/exception/loading.js"; import { Loading } from "../../../../components/exception/loading.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { format } from "date-fns"; import { format } from "date-fns";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";

View File

@ -20,7 +20,7 @@
*/ */
import { Amounts } from "@gnu-taler/taler-util"; import { Amounts } from "@gnu-taler/taler-util";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { format } from "date-fns"; import { format } from "date-fns";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { StateUpdater, useState } from "preact/hooks"; import { StateUpdater, useState } from "preact/hooks";

View File

@ -23,7 +23,7 @@ import {
ErrorType, ErrorType,
HttpError, HttpError,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { Loading } from "../../../../components/exception/loading.js"; import { Loading } from "../../../../components/exception/loading.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { AsyncButton } from "../../../../components/exception/AsyncButton.js"; import { AsyncButton } from "../../../../components/exception/AsyncButton.js";
import { ProductForm } from "../../../../components/product/ProductForm.js"; import { ProductForm } from "../../../../components/product/ProductForm.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { NotificationCard } from "../../../../components/menu/index.js"; import { NotificationCard } from "../../../../components/menu/index.js";

View File

@ -20,7 +20,7 @@
*/ */
import { Amounts } from "@gnu-taler/taler-util"; import { Amounts } from "@gnu-taler/taler-util";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { format } from "date-fns"; import { format } from "date-fns";
import { ComponentChildren, Fragment, h, VNode } from "preact"; import { ComponentChildren, Fragment, h, VNode } from "preact";
import { StateUpdater, useState } from "preact/hooks"; import { StateUpdater, useState } from "preact/hooks";

View File

@ -23,7 +23,7 @@ import {
ErrorType, ErrorType,
HttpError, HttpError,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { Loading } from "../../../../components/exception/loading.js"; import { Loading } from "../../../../components/exception/loading.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { AsyncButton } from "../../../../components/exception/AsyncButton.js"; import { AsyncButton } from "../../../../components/exception/AsyncButton.js";
import { ProductForm } from "../../../../components/product/ProductForm.js"; import { ProductForm } from "../../../../components/product/ProductForm.js";

View File

@ -23,7 +23,7 @@ import {
ErrorType, ErrorType,
HttpError, HttpError,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { Loading } from "../../../../components/exception/loading.js"; import { Loading } from "../../../../components/exception/loading.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { StateUpdater, useEffect, useState } from "preact/hooks"; import { StateUpdater, useEffect, useState } from "preact/hooks";
import { AsyncButton } from "../../../../components/exception/AsyncButton.js"; import { AsyncButton } from "../../../../components/exception/AsyncButton.js";

View File

@ -21,7 +21,7 @@
import { h, VNode, FunctionalComponent } from "preact"; import { h, VNode, FunctionalComponent } from "preact";
import { CreatedSuccessfully as TestedComponent } from "./CreatedSuccessfully.js"; import { CreatedSuccessfully as TestedComponent } from "./CreatedSuccessfully.js";
import { tests } from "@gnu-taler/web-util/lib/index.browser"; import * as tests from "@gnu-taler/web-util/testing";
export default { export default {
title: "Pages/Reserve/CreatedSuccessfully", title: "Pages/Reserve/CreatedSuccessfully",

View File

@ -15,11 +15,11 @@
*/ */
import { parsePaytoUri, stringifyPaytoUri } from "@gnu-taler/taler-util"; import { parsePaytoUri, stringifyPaytoUri } from "@gnu-taler/taler-util";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, VNode, h } from "preact";
import { QR } from "../../../../components/exception/QR.js"; import { QR } from "../../../../components/exception/QR.js";
import { CreatedSuccessfully as Template } from "../../../../components/notifications/CreatedSuccessfully.js"; import { CreatedSuccessfully as Template } from "../../../../components/notifications/CreatedSuccessfully.js";
import { MerchantBackend } from "../../../../declaration.js"; import { MerchantBackend, WireAccount } from "../../../../declaration.js";
type Entity = { type Entity = {
request: MerchantBackend.Tips.ReserveCreateRequest; request: MerchantBackend.Tips.ReserveCreateRequest;
@ -41,20 +41,6 @@ export function CreatedSuccessfully({
onConfirm, onConfirm,
onCreateAnother, onCreateAnother,
}: Props): VNode { }: Props): VNode {
const accountsInfo = !entity.response.accounts
? []
: entity.response.accounts
.map((acc) => {
const p = parsePaytoUri(acc.payto_uri);
if (p) {
p.params["message"] = entity.response.reserve_pub;
p.params["amount"] = entity.request.initial_balance;
}
return p;
})
.filter(isNotUndefined);
const links = accountsInfo.map((a) => stringifyPaytoUri(a));
const { i18n } = useTranslationContext(); const { i18n } = useTranslationContext();
return ( return (
<Template onConfirm={onConfirm} onCreateAnother={onCreateAnother}> <Template onConfirm={onConfirm} onCreateAnother={onCreateAnother}>
@ -90,19 +76,57 @@ export function CreatedSuccessfully({
</div> </div>
</div> </div>
</div> </div>
{links.length === 0 ? ( <ShowAccountsOfReserveAsQRWithLink
accounts={entity.response.accounts ?? []}
message={entity.response.reserve_pub}
amount={entity.request.initial_balance}
/>
</Template>
);
}
export function ShowAccountsOfReserveAsQRWithLink({
accounts,
message,
amount,
}: {
accounts: WireAccount[];
message: string;
amount: string;
}): VNode {
const { i18n } = useTranslationContext();
const accountsInfo = !accounts
? []
: accounts
.map((acc) => {
const p = parsePaytoUri(acc.payto_uri);
if (p) {
p.params["message"] = message;
p.params["amount"] = amount;
}
return p;
})
.filter(isNotUndefined);
const links = accountsInfo.map((a) => stringifyPaytoUri(a));
if (links.length === 0) {
return (
<Fragment> <Fragment>
<p class="is-size-5"> <p class="is-size-5">
The response of the reserve creation have invalid accounts. List of The reserve have invalid accounts. List of invalid payto URIs below:
invalid payto URIs below:
</p> </p>
<ul> <ul>
{entity.response.accounts.map((a, idx) => { {accounts.map((a, idx) => {
return <li key={idx}>{a.payto_uri}</li>; return <li key={idx}>{a.payto_uri}</li>;
})} })}
</ul> </ul>
</Fragment> </Fragment>
) : links.length === 1 ? ( );
}
if (links.length === 1) {
return (
<Fragment> <Fragment>
<p class="is-size-5"> <p class="is-size-5">
<i18n.Translate> <i18n.Translate>
@ -127,7 +151,10 @@ export function CreatedSuccessfully({
</a> </a>
</pre> </pre>
</Fragment> </Fragment>
) : ( );
}
return (
<div> <div>
<p class="is-size-5"> <p class="is-size-5">
<i18n.Translate> <i18n.Translate>
@ -142,8 +169,8 @@ export function CreatedSuccessfully({
</p> </p>
<p class="is-size-5"> <p class="is-size-5">
<i18n.Translate> <i18n.Translate>
If your system supports RFC 8905, you can do this by clicking on If your system supports RFC 8905, you can do this by clicking on the
the URI below the QR code: URI below the QR code:
</i18n.Translate> </i18n.Translate>
</p> </p>
{links.map((link) => { {links.map((link) => {
@ -159,7 +186,5 @@ export function CreatedSuccessfully({
); );
})} })}
</div> </div>
)}
</Template>
); );
} }

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { NotificationCard } from "../../../../components/menu/index.js"; import { NotificationCard } from "../../../../components/menu/index.js";

View File

@ -24,7 +24,7 @@ import {
parsePaytoUri, parsePaytoUri,
stringifyPaytoUri, stringifyPaytoUri,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { format } from "date-fns"; import { format } from "date-fns";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
@ -38,6 +38,7 @@ import { SimpleModal } from "../../../../components/modal/index.js";
import { MerchantBackend } from "../../../../declaration.js"; import { MerchantBackend } from "../../../../declaration.js";
import { useTipDetails } from "../../../../hooks/reserves.js"; import { useTipDetails } from "../../../../hooks/reserves.js";
import { TipInfo } from "./TipInfo.js"; import { TipInfo } from "./TipInfo.js";
import { ShowAccountsOfReserveAsQRWithLink } from "../create/CreatedSuccessfully.js";
type Entity = MerchantBackend.Tips.ReserveDetail; type Entity = MerchantBackend.Tips.ReserveDetail;
type CT = MerchantBackend.ContractTerms; type CT = MerchantBackend.ContractTerms;
@ -53,13 +54,6 @@ export function DetailPage({ id, selected, onBack }: Props): VNode {
const didExchangeAckTransfer = Amounts.isNonZero( const didExchangeAckTransfer = Amounts.isNonZero(
Amounts.parseOrThrow(selected.exchange_initial_amount), Amounts.parseOrThrow(selected.exchange_initial_amount),
); );
const p = parsePaytoUri(selected.payto_uri);
if (p) {
p.params["message"] = id;
p.params["amount"] = selected.merchant_initial_amount;
}
const link = !p ? selected.payto_uri : stringifyPaytoUri(p);
return ( return (
<div class="columns"> <div class="columns">
@ -111,11 +105,6 @@ export function DetailPage({ id, selected, onBack }: Props): VNode {
/> />
</Fragment> </Fragment>
)} )}
<Input<Entity>
name="payto_uri"
label={i18n.str`Account address`}
readonly
/>
<Input name="id" label={i18n.str`Subject`} readonly /> <Input name="id" label={i18n.str`Subject`} readonly />
</FormProvider> </FormProvider>
@ -143,30 +132,13 @@ export function DetailPage({ id, selected, onBack }: Props): VNode {
</div> </div>
</div> </div>
</Fragment> </Fragment>
) : ( ) : selected.accounts ? (
<Fragment> <ShowAccountsOfReserveAsQRWithLink
<p class="is-size-5"> accounts={selected.accounts}
<i18n.Translate> amount={selected.merchant_initial_amount}
To complete the setup of the reserve, you must now initiate a message={id}
wire transfer using the given wire transfer subject and />
crediting the specified amount to the indicated account of the ) : undefined}
exchange.
</i18n.Translate>
</p>
<p class="is-size-5">
<i18n.Translate>
If your system supports RFC 8905, you can do this by opening
this URI:
</i18n.Translate>
</p>
<pre>
<a target="_blank" rel="noreferrer" href={link}>
{link}
</a>
</pre>
<QR text={link} />
</Fragment>
)}
<div class="buttons is-right mt-5"> <div class="buttons is-right mt-5">
<button class="button" onClick={onBack}> <button class="button" onClick={onBack}>

View File

@ -54,7 +54,14 @@ export const Funded = createExample(TestedComponent, {
}, },
merchant_initial_amount: "TESTKUDOS:10", merchant_initial_amount: "TESTKUDOS:10",
pickup_amount: "TESTKUDOS:10", pickup_amount: "TESTKUDOS:10",
accounts: [
{
payto_uri: "payto://x-taler-bank/bank.taler:8080/account", payto_uri: "payto://x-taler-bank/bank.taler:8080/account",
credit_restrictions: [],
debit_restrictions: [],
master_sig: "",
},
],
exchange_url: "http://exchange.taler/", exchange_url: "http://exchange.taler/",
}, },
}); });
@ -73,7 +80,14 @@ export const NotYetFunded = createExample(TestedComponent, {
}, },
merchant_initial_amount: "TESTKUDOS:10", merchant_initial_amount: "TESTKUDOS:10",
pickup_amount: "TESTKUDOS:10", pickup_amount: "TESTKUDOS:10",
accounts: [
{
payto_uri: "payto://x-taler-bank/bank.taler:8080/account", payto_uri: "payto://x-taler-bank/bank.taler:8080/account",
credit_restrictions: [],
debit_restrictions: [],
master_sig: "",
},
],
exchange_url: "http://exchange.taler/", exchange_url: "http://exchange.taler/",
}, },
}); });
@ -92,7 +106,14 @@ export const FundedWithEmptyTips = createExample(TestedComponent, {
}, },
merchant_initial_amount: "TESTKUDOS:10", merchant_initial_amount: "TESTKUDOS:10",
pickup_amount: "TESTKUDOS:10", pickup_amount: "TESTKUDOS:10",
accounts: [
{
payto_uri: "payto://x-taler-bank/bank.taler:8080/account", payto_uri: "payto://x-taler-bank/bank.taler:8080/account",
credit_restrictions: [],
debit_restrictions: [],
master_sig: "",
},
],
exchange_url: "http://exchange.taler/", exchange_url: "http://exchange.taler/",
tips: [ tips: [
{ {

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { ErrorType, HttpError } from "@gnu-taler/web-util/lib/index.browser"; import { ErrorType, HttpError } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { Loading } from "../../../../components/exception/loading.js"; import { Loading } from "../../../../components/exception/loading.js";
import { MerchantBackend } from "../../../../declaration.js"; import { MerchantBackend } from "../../../../declaration.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import * as yup from "yup"; import * as yup from "yup";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { format } from "date-fns"; import { format } from "date-fns";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { MerchantBackend, WithId } from "../../../../declaration.js"; import { MerchantBackend, WithId } from "../../../../declaration.js";

View File

@ -23,7 +23,7 @@ import {
ErrorType, ErrorType,
HttpError, HttpError,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { Loading } from "../../../../components/exception/loading.js"; import { Loading } from "../../../../components/exception/loading.js";

View File

@ -23,7 +23,7 @@ import {
Amounts, Amounts,
MerchantTemplateContractDetails, MerchantTemplateContractDetails,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { AsyncButton } from "../../../../components/exception/AsyncButton.js"; import { AsyncButton } from "../../../../components/exception/AsyncButton.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { NotificationCard } from "../../../../components/menu/index.js"; import { NotificationCard } from "../../../../components/menu/index.js";

View File

@ -21,7 +21,7 @@
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { MerchantBackend } from "../../../../declaration.js"; import { MerchantBackend } from "../../../../declaration.js";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { CardTable } from "./Table.js"; import { CardTable } from "./Table.js";
export interface Props { export interface Props {

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { StateUpdater, useState } from "preact/hooks"; import { StateUpdater, useState } from "preact/hooks";
import { MerchantBackend } from "../../../../declaration.js"; import { MerchantBackend } from "../../../../declaration.js";

View File

@ -23,7 +23,7 @@ import {
ErrorType, ErrorType,
HttpError, HttpError,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { Loading } from "../../../../components/exception/loading.js"; import { Loading } from "../../../../components/exception/loading.js";

View File

@ -20,7 +20,7 @@
*/ */
import { buildPayto, classifyTalerUri } from "@gnu-taler/taler-util"; import { buildPayto, classifyTalerUri } from "@gnu-taler/taler-util";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { AsyncButton } from "../../../../components/exception/AsyncButton.js"; import { AsyncButton } from "../../../../components/exception/AsyncButton.js";

View File

@ -23,7 +23,7 @@ import {
ErrorType, ErrorType,
HttpError, HttpError,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { Loading } from "../../../../components/exception/loading.js"; import { Loading } from "../../../../components/exception/loading.js";

View File

@ -23,7 +23,7 @@ import {
Amounts, Amounts,
MerchantTemplateContractDetails, MerchantTemplateContractDetails,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { AsyncButton } from "../../../../components/exception/AsyncButton.js"; import { AsyncButton } from "../../../../components/exception/AsyncButton.js";

View File

@ -23,7 +23,7 @@ import {
ErrorType, ErrorType,
HttpError, HttpError,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { Loading } from "../../../../components/exception/loading.js"; import { Loading } from "../../../../components/exception/loading.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { AsyncButton } from "../../../../components/exception/AsyncButton.js"; import { AsyncButton } from "../../../../components/exception/AsyncButton.js";

View File

@ -23,7 +23,7 @@ import {
ErrorType, ErrorType,
HttpError, HttpError,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { Loading } from "../../../../components/exception/loading.js"; import { Loading } from "../../../../components/exception/loading.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { AsyncButton } from "../../../../components/exception/AsyncButton.js"; import { AsyncButton } from "../../../../components/exception/AsyncButton.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { NotificationCard } from "../../../../components/menu/index.js"; import { NotificationCard } from "../../../../components/menu/index.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { FormProvider } from "../../../../components/form/FormProvider.js"; import { FormProvider } from "../../../../components/form/FormProvider.js";
import { InputSelector } from "../../../../components/form/InputSelector.js"; import { InputSelector } from "../../../../components/form/InputSelector.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { format } from "date-fns"; import { format } from "date-fns";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { StateUpdater, useState } from "preact/hooks"; import { StateUpdater, useState } from "preact/hooks";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { ErrorType, HttpError } from "@gnu-taler/web-util/lib/index.browser"; import { ErrorType, HttpError } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { Loading } from "../../../../components/exception/loading.js"; import { Loading } from "../../../../components/exception/loading.js";

View File

@ -20,7 +20,7 @@
*/ */
import { Amounts } from "@gnu-taler/taler-util"; import { Amounts } from "@gnu-taler/taler-util";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { AsyncButton } from "../../../components/exception/AsyncButton.js"; import { AsyncButton } from "../../../components/exception/AsyncButton.js";

View File

@ -18,7 +18,7 @@ import {
HttpError, HttpError,
HttpResponse, HttpResponse,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { Loading } from "../../../components/exception/loading.js"; import { Loading } from "../../../components/exception/loading.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { AsyncButton } from "../../../../components/exception/AsyncButton.js"; import { AsyncButton } from "../../../../components/exception/AsyncButton.js";

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { NotificationCard } from "../../../../components/menu/index.js"; import { NotificationCard } from "../../../../components/menu/index.js";

View File

@ -21,7 +21,7 @@
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { MerchantBackend } from "../../../../declaration.js"; import { MerchantBackend } from "../../../../declaration.js";
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { CardTable } from "./Table.js"; import { CardTable } from "./Table.js";
export interface Props { export interface Props {

View File

@ -19,7 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */
import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser"; import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact"; import { h, VNode } from "preact";
import { StateUpdater, useState } from "preact/hooks"; import { StateUpdater, useState } from "preact/hooks";
import { MerchantBackend } from "../../../../declaration.js"; import { MerchantBackend } from "../../../../declaration.js";

View File

@ -23,7 +23,7 @@ import {
ErrorType, ErrorType,
HttpError, HttpError,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { Loading } from "../../../../components/exception/loading.js"; import { Loading } from "../../../../components/exception/loading.js";

Some files were not shown because too many files have changed in this diff Show More