diff options
Diffstat (limited to 'packages')
4 files changed, 8 insertions, 10 deletions
diff --git a/packages/merchant-backoffice-ui/src/components/tokenfamily/TokenFamilyForm.tsx b/packages/merchant-backoffice-ui/src/components/tokenfamily/TokenFamilyForm.tsx index 3cb739aea..420466eaa 100644 --- a/packages/merchant-backoffice-ui/src/components/tokenfamily/TokenFamilyForm.tsx +++ b/packages/merchant-backoffice-ui/src/components/tokenfamily/TokenFamilyForm.tsx @@ -50,7 +50,7 @@ export function TokenFamilyForm({ onSubscribe, initial, alreadyExist }: Props) { name: "", description: "", description_i18n: {}, - kind: MerchantBackend.TokenFamilies.TokenFamilyKind.Discount, + kind: "discount", duration: { d_us: "forever" }, valid_after: { t_s: "never" }, valid_before: { t_s: "never" }, diff --git a/packages/merchant-backoffice-ui/src/declaration.d.ts b/packages/merchant-backoffice-ui/src/declaration.d.ts index 9808f8b66..15bde2305 100644 --- a/packages/merchant-backoffice-ui/src/declaration.d.ts +++ b/packages/merchant-backoffice-ui/src/declaration.d.ts @@ -1528,10 +1528,7 @@ export namespace MerchantBackend { namespace TokenFamilies { // Kind of the token family. - enum TokenFamilyKind { - Discount = "discount", - Subscription = "subscription", - } + type TokenFamilyKind = "discount" | "subscription"; // POST /private/tokenfamilies interface TokenFamilyAddDetail { diff --git a/packages/merchant-backoffice-ui/src/paths/instance/tokenfamilies/create/CreatePage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/tokenfamilies/create/CreatePage.tsx index 777066d20..7ae9bebe6 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/tokenfamilies/create/CreatePage.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/tokenfamilies/create/CreatePage.tsx @@ -25,7 +25,7 @@ import { AsyncButton } from "../../../../components/exception/AsyncButton.js"; import { MerchantBackend } from "../../../../declaration.js"; import { useListener } from "../../../../hooks/listener.js"; import { TokenFamilyForm } from "../../../../components/tokenfamily/TokenFamilyForm.js"; -import { Test } from "../../../../components/tokenfamily/Test.js"; +// import { Test } from "../../../../components/tokenfamily/Test.js"; type Entity = MerchantBackend.TokenFamilies.TokenFamilyAddDetail; @@ -50,9 +50,9 @@ export function CreatePage({ onCreate, onBack }: Props): VNode { <div class="columns"> <div class="column" /> <div class="column is-four-fifths"> - {/* <TokenFamilyCreateForm onSubscribe={addFormSubmitter} /> */} + <TokenFamilyForm onSubscribe={addFormSubmitter} /> - <Test /> + {/* <Test /> */} <div class="buttons is-right mt-5"> {onBack && ( diff --git a/packages/merchant-backoffice-ui/src/schemas/index.ts b/packages/merchant-backoffice-ui/src/schemas/index.ts index 1704b0555..5bcb68021 100644 --- a/packages/merchant-backoffice-ui/src/schemas/index.ts +++ b/packages/merchant-backoffice-ui/src/schemas/index.ts @@ -21,9 +21,10 @@ import { isAfter, isFuture } from "date-fns"; import * as yup from "yup"; -import { AMOUNT_REGEX, PAYTO_REGEX } from "../utils/constants.js"; +import { PAYTO_REGEX } from "../utils/constants.js"; import { Amounts } from "@gnu-taler/taler-util"; import { MerchantBackend } from "../declaration.js"; +// import { MerchantBackend } from "../declaration.js"; yup.setLocale({ mixed: { @@ -261,7 +262,7 @@ const durationSchema = yup.object().shape({ ) }).required(); -const tokenFamilyKindSchema = yup.mixed().oneOf(Object.values(MerchantBackend.TokenFamilies.TokenFamilyKind)).required(); +const tokenFamilyKindSchema = yup.mixed().oneOf<MerchantBackend.TokenFamilies.TokenFamilyKind>(["discount", "subscription"]).required(); export const TokenFamilyCreateSchema = yup.object().shape({ slug: yup.string().ensure().required(), |