Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14,007 changes: 14,007 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"@medusajs/types": "2.10.3",
"@medusajs/ui-preset": "2.10.3",
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
"@types/lodash": "^4.17.20",
"@types/node": "^20.11.15",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
Expand Down
18 changes: 9 additions & 9 deletions src/components/forms/metadata-form/metadata-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ import { KeyboundForm } from "../../utilities/keybound-form"
import { useDocumentDirection } from "../../../hooks/use-document-direction"

type MetaDataSubmitHook<TRes> = (
params: { metadata?: Record<string, any> | null },
callbacks: { onSuccess: () => void; onError: (error: FetchError) => void }
params: { metadata?: Record<string, unknown> | null },
callbacks: { onSuccess: () => void; onError: (error: FetchError | string) => void }
) => Promise<TRes>

type MetadataFormProps<TRes> = {
metadata?: Record<string, any> | null
metadata?: Record<string, unknown> | null
hook: MetaDataSubmitHook<TRes>
isPending: boolean
isMutating: boolean
Expand Down Expand Up @@ -101,7 +101,7 @@ const InnerForm = <TRes,>({
handleSuccess()
},
onError: (error) => {
toast.error(error.message)
toast.error(error instanceof FetchError ? error.message : error)
},
}
)
Expand Down Expand Up @@ -331,7 +331,7 @@ const PlaceholderInner = () => {
const EDITABLE_TYPES = ["string", "number", "boolean"]

function getDefaultValues(
metadata?: Record<string, any> | null
metadata?: Record<string, unknown> | null
): z.infer<typeof MetadataFieldSchema>[] {
if (!metadata || !Object.keys(metadata).length) {
return [
Expand Down Expand Up @@ -368,8 +368,8 @@ function getDefaultValues(

function parseValues(
values: z.infer<typeof MetadataSchema>,
original?: Record<string, any> | null
): Record<string, any> | null {
original?: Record<string, unknown> | null
): Record<string, unknown> | null {
const metadata = values.metadata

const isEmpty =
Expand All @@ -380,7 +380,7 @@ function parseValues(
return null
}

const update: Record<string, any> = {}
const update: Record<string, unknown> = {}

// First, handle removed keys from original
if (original) {
Expand Down Expand Up @@ -427,7 +427,7 @@ function parseValues(
return update
}

function getHasUneditableRows(metadata?: Record<string, any> | null) {
function getHasUneditableRows(metadata?: Record<string, unknown> | null) {
if (!metadata) {
return false
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, ReactNode } from "react"
import { useState } from "react"
import { Container, Button } from "@medusajs/ui"
import { useTranslation } from "react-i18next"
import { DataTable } from "../../data-table"
Expand Down Expand Up @@ -175,7 +175,6 @@ export function ConfigurableDataTable<TData>({
</Button>
<SaveViewDropdown
isDefaultView={activeView?.is_system_default || !activeView}
currentViewId={activeView?.id}
currentViewName={activeView?.name}
onSaveAsDefault={handleSaveAsDefault}
onUpdateExisting={handleUpdateExisting}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useTranslation } from "react-i18next"

interface SaveViewDropdownProps {
isDefaultView: boolean
currentViewId?: string
currentViewName?: string
onSaveAsDefault: () => void
onUpdateExisting: () => void
Expand All @@ -14,7 +13,6 @@ interface SaveViewDropdownProps {

export const SaveViewDropdown: React.FC<SaveViewDropdownProps> = ({
isDefaultView,
currentViewId,
currentViewName,
onSaveAsDefault,
onUpdateExisting,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import React, { useState, useEffect } from "react"
import React from "react"
import {
DropdownMenu,
Button,
toast,
usePrompt,
} from "@medusajs/ui"
import {
Plus,
CloudArrowUp,
SquarePlusMicro,
SquaresPlus,
} from "@medusajs/icons"

interface SaveViewDropdownProps {
Expand Down Expand Up @@ -78,7 +76,7 @@ export const SaveViewDropdown: React.FC<SaveViewDropdownProps> = ({
)}
{onSaveAsNew && (
<DropdownMenu.Item onClick={onSaveAsNew}>
<SquarePlusMicro className="h-4 w-4" />
<SquaresPlus className="h-4 w-4" />
Save as new view
</DropdownMenu.Item>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/table/view-selector/view-pills.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState, useRef } from "react"
import React, { useEffect, useState } from "react"
import {
Badge,
usePrompt,
Expand Down
5 changes: 0 additions & 5 deletions src/components/table/view-selector/view-selector.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import React, { useEffect, useState } from "react"
import {
Select,
Button,
Tooltip,
DropdownMenu,
Badge,
usePrompt,
toast,
} from "@medusajs/ui"
import {
Eye,
EyeSlash,
Plus,
Trash,
PencilSquare,
Expand Down Expand Up @@ -40,7 +36,6 @@ export const ViewSelector: React.FC<ViewSelectorProps> = ({
listViews,
activeView,
setActiveView,
isDefaultViewActive,
} = useViewConfigurations(entity)

const [saveDialogOpen, setSaveDialogOpen] = useState(false)
Expand Down
5 changes: 5 additions & 0 deletions src/dashboard-app/routes/get-route.map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1857,6 +1857,11 @@ export function getRouteMap({
"../../routes/tax-regions/tax-region-tax-rate-edit"
),
},
{
path: "metadata/edit",
lazy: () =>
import("../../routes/tax-regions/tax-region-metadata"),
},
],
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/api/customers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const useUpdateCustomer = (
options?: UseMutationOptions<
{ customer: HttpTypes.AdminCustomer },
FetchError,
HttpTypes.AdminUpdateCustomer
HttpTypes.AdminUpdateCustomer & { email?: string }
>
) => {
return useMutation({
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/api/feature-flags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ export const useFeatureFlags = () => {
return response.feature_flags
},
staleTime: 5 * 60 * 1000, // Cache for 5 minutes
cacheTime: 10 * 60 * 1000, // Keep in cache for 10 minutes
gcTime: 10 * 60 * 1000, // Keep in cache for 10 minutes
})
}
7 changes: 5 additions & 2 deletions src/hooks/api/price-preferences.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const usePricePreference = (
) => {
const { data, ...rest } = useQuery({
queryFn: () => sdk.admin.pricePreference.retrieve(id, query),
queryKey: pricePreferencesQueryKeys.detail(),
queryKey: pricePreferencesQueryKeys.detail(id),
...options,
})

Expand Down Expand Up @@ -71,7 +71,10 @@ export const useUpsertPricePreference = (
return useMutation({
mutationFn: (payload) => {
if (id) {
return sdk.admin.pricePreference.update(id, payload, query)
return sdk.admin.pricePreference.update(id, {
...payload,
attribute: payload.attribute ?? undefined,
}, query)
}
return sdk.admin.pricePreference.create(payload, query)
},
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/api/products.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export const useProduct = (
};

export const useProducts = (
query?: HttpTypes.AdminProductListParams,
query?: HttpTypes.AdminProductListParams & { tag_id?: string },
options?: Omit<
UseQueryOptions<
HttpTypes.AdminProductListResponse,
Expand Down
3 changes: 1 addition & 2 deletions src/hooks/table/columns/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ export * from "./use-product-tag-table-columns"
export * from "./use-product-type-table-columns"
export * from "./use-refund-reason-table-columns"
export * from "./use-region-table-columns"
export * from "./use-return-reason-table-columns"
export * from "./use-tax-rates-table-columns"
export * from "./use-return-reason-table-columns"
55 changes: 0 additions & 55 deletions src/hooks/table/columns/use-tax-rates-table-columns.tsx

This file was deleted.

8 changes: 5 additions & 3 deletions src/hooks/table/filters/use-customer-table-filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@ export const useCustomerTableFilters = (
)

let filters: Filter[] = []

if (customer_groups && !isGroupsExcluded) {
const customerGroupFilter: Filter = {
key: "groups",
label: t("customers.groups.label"),
type: "select",
multiple: true,
options: customer_groups.map((s) => ({
label: s.name,
options: customer_groups
.filter((s) => s?.name)
.map((s) => ({
label: s.name as string,
value: s.id,
})),
}
Expand Down
Loading