Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a1e05c3
fix: customer group type mismatches
sylwia-werner Oct 17, 2025
a06405c
fix: collections and customer group type mismatches
sylwia-werner Oct 17, 2025
c5a20a1
fix: reservation type mismatches
sylwia-werner Oct 17, 2025
1e7f33b
fix: sales channel id type mismatch
sylwia-werner Oct 17, 2025
530860c
fix: stock location type mismatches
sylwia-werner Oct 19, 2025
0af8c58
fix: tax region type mismatches
sylwia-werner Oct 19, 2025
c8f84e7
fix: controller render props union type mismatch
sylwia-werner Oct 19, 2025
9e8af22
fix: price list type mismatches
sylwia-werner Oct 20, 2025
f99de95
fix: promotions type mismatches
sylwia-werner Oct 20, 2025
8657618
Merge branch 'fix/mm2-1209/fix-ts-errors' into fix/mm2-1280/typescrip…
sylwia-werner Oct 20, 2025
2c6703b
Merge branch 'fix/mm2-1209/fix-ts-errors' into fix/mm2-1280/typescrip…
sylwia-werner Oct 22, 2025
4e04c0e
fix: products type mismatches
sylwia-werner Oct 23, 2025
9c6ec4a
Merge branch 'fix/mm2-1209/fix-ts-errors' into fix/mm2-1280/typescrip…
sylwia-werner Oct 26, 2025
9719ac8
Merge branch 'fix/mm2-1280/typescript-errors-pt-2' into fix/mm2-1318/…
sylwia-werner Oct 26, 2025
35addae
fix: PR fixes
sylwia-werner Oct 28, 2025
a837146
fix: PR fixes
sylwia-werner Oct 29, 2025
cb3741e
fix: PR fixes
sylwia-werner Oct 29, 2025
a18176d
fix: PR fixes
sylwia-werner Nov 3, 2025
65db38e
fix: PR fixes
sylwia-werner Nov 3, 2025
93499c3
fix: PR fixes
sylwia-werner Nov 3, 2025
30c8dee
Merge branch 'test' into fix/mm2-1280/typescript-errors-pt-2
sylwia-werner Nov 3, 2025
a758438
Merge branch 'fix/mm2-1209/fix-ts-errors' into fix/mm2-1280/typescrip…
sylwia-werner Nov 3, 2025
540958d
Merge branch 'fix/mm2-1280/typescript-errors-pt-2' into fix/mm2-1318/…
sylwia-werner Nov 3, 2025
dea7923
fix: PR conflicts, move types from extended-product to products
sylwia-werner Nov 3, 2025
06ba9cf
Merge branch 'test' into fix/mm2-1318/typescript-errors-pt-3
sylwia-werner Nov 3, 2025
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
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"i18n:validate": "node ./scripts/i18n/validate-translation.js",
"i18n:schema": "node ./scripts/i18n/generate-schema.js",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"format": "prettier --write ."
"format": "prettier --write .",
"typecheck": "tsc --noEmit"
},
"main": "dist/app.js",
"module": "dist/app.mjs",
Expand Down Expand Up @@ -84,6 +85,7 @@
"@medusajs/admin-vite-plugin": "^2.5.0",
"@medusajs/types": "^2.5.0",
"@medusajs/ui-preset": "^2.5.0",
"@types/lodash": "^4.17.20",
"@types/node": "^20.11.15",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useTranslation } from "react-i18next"

import { PlaceholderCell } from "../../common/placeholder-cell"
import { HttpTypes } from "@medusajs/types"
import { ExtendedAdminProductVariant } from "../../../../../types/products"

type VariantCellProps = {
variants?: HttpTypes.AdminProductVariant[] | null
variants?: ExtendedAdminProductVariant[] | null
}

export const VariantCell = ({ variants }: VariantCellProps) => {
Expand Down
10 changes: 0 additions & 10 deletions src/hooks/api/collections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export const useCollections = (
>,
"queryFn" | "queryKey"
>,
id?: string
) => {
const { data, ...rest } = useQuery({
queryKey: collectionsQueryKeys.list(query),
Expand All @@ -67,15 +66,6 @@ export const useCollections = (
...options,
})

if (id) {
return {
...rest,
...data,
product_collections: data?.product_collections.find(
(item) => item.id === id
),
}
}
return { ...data, ...rest }
}

Expand Down
12 changes: 6 additions & 6 deletions src/hooks/api/customer-groups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { queryClient } from "../../lib/query-client"
import { queryKeysFactory } from "../../lib/query-key-factory"
import { customersQueryKeys } from "./customers"
import { filterCustomerGroups } from "../../routes/orders/common/customerGroupFiltering"
import { CustomerGroupListResponse } from "../../types/customer-group"

const CUSTOMER_GROUPS_QUERY_KEY = "customer_groups" as const
export const customerGroupsQueryKeys = queryKeysFactory(
Expand Down Expand Up @@ -50,9 +51,7 @@ export const useCustomerGroups = (
UseQueryOptions<
HttpTypes.AdminGetCustomerGroupsParams,
FetchError,
HttpTypes.AdminCustomerGroupListResponse & {
customer_group?: any
},
CustomerGroupListResponse,
QueryKey
>,
"queryFn" | "queryKey"
Expand All @@ -67,7 +66,7 @@ export const useCustomerGroups = (
queryKey: customerGroupsQueryKeys.list(query),
...options,
})

const filteredData = filterCustomerGroups(
data?.customer_groups,
filters,
Expand All @@ -79,10 +78,11 @@ export const useCustomerGroups = (
const count = customer_groups?.length || 0

return {
...data,
...rest,
count,
customer_groups,
...rest,
offset: data?.offset,
limit: data?.limit,
}
}

Expand Down
16 changes: 12 additions & 4 deletions src/hooks/api/price-lists.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import {
import { fetchQuery, sdk } from "../../lib/client"
import { queryClient } from "../../lib/query-client"
import { queryKeysFactory } from "../../lib/query-key-factory"
import {
ExtendedPriceList,
PriceListListResponse,
} from "../../types/price-list"
import { customerGroupsQueryKeys } from "./customer-groups"
import { productsQueryKeys } from "./products"

Expand Down Expand Up @@ -72,9 +76,9 @@ export const usePriceLists = (
query?: HttpTypes.AdminPriceListListParams,
options?: Omit<
UseQueryOptions<
HttpTypes.AdminPriceListListResponse,
PriceListListResponse,
FetchError,
any,
PriceListListResponse,
QueryKey
>,
"queryKey" | "queryFn"
Expand All @@ -90,8 +94,12 @@ export const usePriceLists = (
...options,
})

const price_lists = data?.price_lists?.filter((item: any) => item.price_list)
const count = price_lists?.length || 0
const price_lists: ExtendedPriceList[] = (data?.price_lists || [])
.filter((item) => item.price_list)
.map((item) => ({ ...item.price_list, id: item.price_list.id }))

const count = price_lists?.length

return { ...data, price_lists, count, ...rest }
}

Expand Down
31 changes: 20 additions & 11 deletions src/hooks/api/products.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import { queryClient } from "../../lib/query-client"
import { queryKeysFactory } from "../../lib/query-key-factory"
import { inventoryItemsQueryKeys } from "./inventory.tsx"
import productsImagesFormatter from "../../utils/products-images-formatter"
import {
ExtendedAdminProductResponse,
ExtendedAdminProductListResponse,
} from "../../types/products"

const PRODUCTS_QUERY_KEY = "products" as const
export const productsQueryKeys = queryKeysFactory(PRODUCTS_QUERY_KEY)
Expand Down Expand Up @@ -346,27 +350,32 @@ export const useProduct = (
query?: Record<string, any>,
options?: Omit<
UseQueryOptions<
HttpTypes.AdminProductResponse,
ExtendedAdminProductResponse,
FetchError,
HttpTypes.AdminProductResponse,
ExtendedAdminProductResponse,
QueryKey
>,
"queryFn" | "queryKey"
>
) => {
const { data, ...rest } = useQuery({
queryFn: () =>
fetchQuery(`/vendor/products/${id}`, {
queryFn: async () => {
const response = await fetchQuery(`/vendor/products/${id}`, {
method: "GET",
query: query as { [key: string]: string | number },
}),
queryKey: productsQueryKeys.detail(id),
})

return {
...response,
product: productsImagesFormatter(response.product),
}
},
queryKey: productsQueryKeys.detail(id, query),
...options,
})

return {
...data,
product: productsImagesFormatter(data?.product),
...rest,
}
}
Expand All @@ -375,17 +384,17 @@ export const useProducts = (
query?: HttpTypes.AdminProductListParams,
options?: Omit<
UseQueryOptions<
HttpTypes.AdminProductListResponse,
ExtendedAdminProductListResponse,
FetchError,
HttpTypes.AdminProductListResponse,
ExtendedAdminProductListResponse,
QueryKey
>,
"queryFn" | "queryKey"
>
) => {
const { data, ...rest } = useQuery({
queryFn: () =>
fetchQuery("/vendor/products", {
queryFn: () =>
fetchQuery("/vendor/products", {
method: "GET",
query: query as Record<string, string | number>,
}),
Expand Down
1 change: 0 additions & 1 deletion src/hooks/api/promotions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ export const usePromotionUpdateRules = (
)

const rulesIds = rules.map((rule: any) => rule.id)
console.log("rules", rulesIds)
await fetchQuery(`/vendor/promotions/${id}/${ruleType}/batch`, {
method: "POST",
body: { delete: rulesIds },
Expand Down
5 changes: 3 additions & 2 deletions src/hooks/api/stock-locations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { fetchQuery } from "../../lib/client"
import { queryClient } from "../../lib/query-client"
import { queryKeysFactory } from "../../lib/query-key-factory"
import { fulfillmentProvidersQueryKeys } from "./fulfillment-providers"
import { VendorExtendedAdminStockLocationResponse } from "../../types/stock-location"

const STOCK_LOCATIONS_QUERY_KEY = "stock_locations" as const
export const stockLocationsQueryKeys = queryKeysFactory(
Expand All @@ -25,7 +26,7 @@ export const useStockLocation = (
UseQueryOptions<
HttpTypes.AdminStockLocationResponse,
FetchError,
HttpTypes.AdminStockLocationResponse,
VendorExtendedAdminStockLocationResponse,
QueryKey
>,
"queryKey" | "queryFn"
Expand All @@ -40,7 +41,7 @@ export const useStockLocation = (
queryKey: stockLocationsQueryKeys.detail(id, query),
...options,
})

return { ...data, ...rest }
}

Expand Down
6 changes: 2 additions & 4 deletions src/hooks/table/columns/use-customer-group-table-columns.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { HttpTypes } from "@medusajs/types"
import { createColumnHelper } from "@tanstack/react-table"
import { useMemo } from "react"

Expand All @@ -6,7 +7,6 @@ import {
TextCell,
TextHeader,
} from "../../../components/table/table-cells/common/text-cell"
import { HttpTypes } from "@medusajs/types"

const columnHelper = createColumnHelper<HttpTypes.AdminCustomerGroup>()

Expand All @@ -20,9 +20,7 @@ export const useCustomerGroupTableColumns = () => {
cell: ({ row }) => {
return (
<TextCell
text={
row.original?.customer_group?.name || row.original?.name || "-"
}
text={row.original?.name || "-"}
/>
)
},
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/table/columns/use-product-table-columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import {
VariantCell,
VariantHeader,
} from "../../../components/table/table-cells/product/variant-cell"
import { HttpTypes } from "@medusajs/types"
import { ExtendedAdminProduct } from "../../../types/products"

const columnHelper = createColumnHelper<HttpTypes.AdminProduct>()
const columnHelper = createColumnHelper<ExtendedAdminProduct>()

export const useProductTableColumns = () => {
return useMemo(
Expand Down
1 change: 1 addition & 0 deletions src/hooks/table/filters/use-product-table-filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const excludeableFields = [
"categories",
"product_types",
"product_tags",
"sales_channel_id",
] as const

export const useProductTableFilters = (
Expand Down
15 changes: 8 additions & 7 deletions src/lib/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,26 @@ export const isSameAddress = (
export const getFormattedAddress = ({
address,
}: {
address?: HttpTypes.AdminOrderAddress | null
address?: HttpTypes.AdminOrderAddress | HttpTypes.AdminStockLocationAddress | null
}) => {
if (!address) {
return []
}

const {
first_name,
last_name,
company,
address_1,
address_2,
city,
postal_code,
province,
country,
country_code,
} = address

const first_name = 'first_name' in address ? address.first_name : undefined
const last_name = 'last_name' in address ? address.last_name : undefined
const country = 'country' in address ? address.country : undefined

const name = [first_name, last_name].filter(Boolean).join(" ")

const formattedAddress: string[] = []
Expand Down Expand Up @@ -75,10 +76,10 @@ export const getFormattedAddress = ({
if (country) {
formattedAddress.push(country.display_name!)
} else if (country_code) {
const country = getCountryByIso2(country_code)
const countryData = getCountryByIso2(country_code)

if (country) {
formattedAddress.push(country.display_name)
if (countryData) {
formattedAddress.push(countryData.display_name)
} else {
formattedAddress.push(country_code.toUpperCase())
}
Expand Down
3 changes: 2 additions & 1 deletion src/providers/router-provider/route-map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { TaxRegionDetailBreadcrumb } from "../../routes/tax-regions/tax-region-d
import { taxRegionLoader } from "../../routes/tax-regions/tax-region-detail/loader"
import { RouteExtensions } from "./route-extensions"
import { SettingsExtensions } from "./settings-extensions"
import { ExtendedAdminProductResponse } from "../../types/products"

export const RouteMap: RouteObject[] = [
{
Expand Down Expand Up @@ -262,7 +263,7 @@ export const RouteMap: RouteObject[] = [
loader,
handle: {
breadcrumb: (
match: UIMatch<HttpTypes.AdminProductResponse>
match: UIMatch<ExtendedAdminProductResponse>
) => <Breadcrumb {...match} />,
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const EditCampaignBudgetForm = ({
}
)
})

return (
<RouteDrawer.Form form={form}>
<KeyboundForm onSubmit={handleSubmit} className="flex flex-1 flex-col">
Expand Down Expand Up @@ -95,7 +95,7 @@ export const EditCampaignBudgetForm = ({
key="usage"
min={0}
{...field}
value={value}
value={value || undefined}
onChange={(e) => {
onChange(
e.target.value === ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
} from "../../../../../lib/data/currencies"
import { CampaignFormFields, WithNestedCampaign } from "../../../../../types/campaign"


type CreateCampaignFormFieldsProps<T extends CampaignFormFields | WithNestedCampaign> = {
form: UseFormReturn<T>
fieldScope?: string
Expand All @@ -29,6 +30,7 @@ export const CreateCampaignFormFields = <T extends CampaignFormFields | WithNest
form,
fieldScope = ""
}: CreateCampaignFormFieldsProps<T>) => {

const { t } = useTranslation()
const { store } = useStore()

Expand Down
Loading