feat(admin,admin-ui,medusa): Add Medusa Admin plugin (#3334)

This commit is contained in:
Kasper Fabricius Kristensen
2023-03-03 10:09:16 +01:00
committed by GitHub
parent d6b1ad1ccd
commit 40de54b010
928 changed files with 85441 additions and 384 deletions

View File

@@ -0,0 +1,22 @@
import { DeepMap } from "react-hook-form"
export const stringOrNull = (value: string) => {
return value === "" ? null : value
}
export const numberOrNull = (value: string) => {
const tmp = parseInt(value, 10)
return isNaN(tmp) ? null : tmp
}
export const checkForDirtyState = (
dirtyFields: DeepMap<Record<string, any>, true>,
otherValues: Record<string, boolean>
) => {
const otherDirtyState = otherValues
? Object.values(otherValues).some((v) => v)
: false
return !!Object.keys(dirtyFields).length || otherDirtyState
}