taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 743bc448acaaf2a98ae0ea9bfd2a414231aeb5b9
parent d793d66b73a698a1a96238483c447fb5039015a9
Author: Sebastian <sebasjm@taler-systems.com>
Date:   Tue, 20 Jan 2026 16:06:21 -0300

fixing out of sync ProductPatchDetailRequest

Diffstat:
Mpackages/merchant-backoffice-ui/src/components/product/ProductForm.tsx | 2+-
Mpackages/merchant-backoffice-ui/src/hooks/preference.ts | 8+++++---
Mpackages/merchant-backoffice-ui/src/hooks/product.test.ts | 4++--
Mpackages/merchant-backoffice-ui/src/paths/admin/create/Create.stories.tsx | 2+-
Mpackages/merchant-backoffice-ui/src/paths/admin/create/stories.tsx | 2+-
Mpackages/merchant-backoffice-ui/src/paths/instance/accessTokens/create/CreatePage.tsx | 2+-
Mpackages/merchant-backoffice-ui/src/paths/instance/products/update/UpdatePage.tsx | 2+-
Mpackages/taler-util/src/types-taler-merchant.ts | 9++++++++-
8 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/packages/merchant-backoffice-ui/src/components/product/ProductForm.tsx b/packages/merchant-backoffice-ui/src/components/product/ProductForm.tsx @@ -49,7 +49,7 @@ import { InputSelector } from "../form/InputSelector.js"; const TALER_SCREEN_ID = 23; -type Entity = TalerMerchantApi.ProductDetailResponse & { +type Entity = TalerMerchantApi.ProductPatchDetailRequest & { product_id: string; }; diff --git a/packages/merchant-backoffice-ui/src/hooks/preference.ts b/packages/merchant-backoffice-ui/src/hooks/preference.ts @@ -23,6 +23,7 @@ import { codecForConstString, codecForEither, codecOptional, + codecOptionalDefault, } from "@gnu-taler/taler-util"; import { buildStorageKey, useLocalStorage } from "@gnu-taler/web-util/browser"; @@ -62,14 +63,14 @@ export interface Preferences { hideKycUntil: AbsoluteTime; hideMissingAccountUntil: AbsoluteTime; dateFormat: "ymd" | "dmy" | "mdy"; - persona?: MerchantPersona; + persona: MerchantPersona; } const defaultSettings: Preferences = { hideKycUntil: AbsoluteTime.never(), hideMissingAccountUntil: AbsoluteTime.never(), dateFormat: "ymd", - persona: undefined, + persona: "expert", }; export const codecForPreferences = (): Codec<Preferences> => @@ -86,7 +87,7 @@ export const codecForPreferences = (): Codec<Preferences> => ) .property( "persona", - codecOptional( + codecOptionalDefault( codecForEither( codecForConstString("developer"), codecForConstString("expert"), @@ -95,6 +96,7 @@ export const codecForPreferences = (): Codec<Preferences> => codecForConstString("digital-publishing"), codecForConstString("e-commerce"), ), + "expert" ), ) .build("Preferences"); diff --git a/packages/merchant-backoffice-ui/src/hooks/product.test.ts b/packages/merchant-backoffice-ui/src/hooks/product.test.ts @@ -173,7 +173,7 @@ describe("product api interaction with listing", () => { env.addRequestExpectation(API_UPDATE_PRODUCT_BY_ID("1234"), { request: { price: "ARS:13", - } as TalerMerchantApi.ProductAddDetailRequest, + } as TalerMerchantApi.ProductPatchDetailRequest, }); env.addRequestExpectation(API_LIST_PRODUCTS, { @@ -328,7 +328,7 @@ describe("product api interaction with details", () => { env.addRequestExpectation(API_UPDATE_PRODUCT_BY_ID("12"), { request: { description: "other description", - } as TalerMerchantApi.ProductAddDetailRequest, + } as TalerMerchantApi.ProductPatchDetailRequest, }); env.addRequestExpectation(API_GET_PRODUCT_BY_ID("12"), { diff --git a/packages/merchant-backoffice-ui/src/paths/admin/create/Create.stories.tsx b/packages/merchant-backoffice-ui/src/paths/admin/create/Create.stories.tsx @@ -45,7 +45,7 @@ function createExample<Props>( config: { currency: "ARS", version: "1", - default_persona: "developer", + default_persona: "expert", currencies: { ASD: { name: "testkudos", diff --git a/packages/merchant-backoffice-ui/src/paths/admin/create/stories.tsx b/packages/merchant-backoffice-ui/src/paths/admin/create/stories.tsx @@ -45,7 +45,7 @@ function createExample<Props>( config: { currency: "ARS", version: "1", - default_persona: "developer", + default_persona: "expert", currencies: { ASD: { name: "testkudos", diff --git a/packages/merchant-backoffice-ui/src/paths/instance/accessTokens/create/CreatePage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/accessTokens/create/CreatePage.tsx @@ -102,7 +102,7 @@ export function CreatePage({ onCreated, onBack }: Props): VNode { scope: !state.scope ? i18n.str`Required` : undefined, }); const [{ persona }] = usePreference(); - const scopeList = getAvailableForPersona(persona ?? "developer")[ + const scopeList = getAvailableForPersona(persona)[ UIElement.option_refreshableScopes ] ? ALL_VALID_TOKEN_SCOPE diff --git a/packages/merchant-backoffice-ui/src/paths/instance/products/update/UpdatePage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/products/update/UpdatePage.tsx @@ -53,7 +53,7 @@ interface Props { export function UpdatePage({ product, onBack, onConfirm }: Props): VNode { const { state: session, lib } = useSessionContext(); - const [form, setForm] = useState<TalerMerchantApi.ProductDetailResponse>(); + const [form, setForm] = useState<TalerMerchantApi.ProductPatchDetailRequest>(); const [notification, safeFunctionHandler] = useLocalNotificationBetter(); const update = safeFunctionHandler( diff --git a/packages/taler-util/src/types-taler-merchant.ts b/packages/taler-util/src/types-taler-merchant.ts @@ -2496,6 +2496,9 @@ export interface ProductPatchDetailRequest { // A value of -1 indicates "infinite" (i.e. for "electronic" books). total_stock: Integer; + // Number of units of the product that have already been sold. + total_sold: Integer; + // Number of units of the product that were lost (spoiled, stolen, etc.). total_lost?: Integer; @@ -2508,6 +2511,11 @@ export interface ProductPatchDetailRequest { // Minimum age buyer must have (in years). Default is 0. minimum_age?: Integer; + // Product group the product belongs to. 0 and missing both + // means default. + // Since **v25**. + product_group_id?: Integer; + // Money pot revenue on the product should be accounted in. // 0 and missing both mean no money pot (revenue accounted // in money pot of the overall order or not at all). @@ -5369,7 +5377,6 @@ export interface PotDetailResponse { pot_name: string; // Current total amount in the pot. pot_totals: AmountString[]; - } export const codecForPotDetailResponse = (): Codec<PotDetailResponse> =>