fix(dashboard): Allow float values for product prices (#9859)

This commit is contained in:
Kasper Fabricius Kristensen
2024-11-04 09:04:29 +01:00
committed by GitHub
parent 7b51204ef3
commit a0034a0fef
3 changed files with 29 additions and 7 deletions
@@ -80,10 +80,13 @@ export const ProductCreateForm = ({
return {}
}
return regions.reduce((acc, reg) => {
acc[reg.id] = reg.currency_code
return acc
}, {} as Record<string, string>)
return regions.reduce(
(acc, reg) => {
acc[reg.id] = reg.currency_code
return acc
},
{} as Record<string, string>
)
}, [regions])
/**
@@ -1,6 +1,6 @@
import { z } from "zod"
import { i18n } from "../../../components/utilities/i18n/i18n.tsx"
import { optionalInt } from "../../../lib/validation.ts"
import { optionalFloat, optionalInt } from "../../../lib/validation.ts"
import { decorateVariantsWithDefaultValues } from "./utils.ts"
export const MediaSchema = z.object({
@@ -32,7 +32,7 @@ const ProductCreateVariantSchema = z.object({
inventory_kit: z.boolean().optional(),
options: z.record(z.string(), z.string()),
variant_rank: z.number(),
prices: z.record(z.string(), optionalInt).optional(),
prices: z.record(z.string(), optionalFloat).optional(),
inventory: z
.array(
z.object({