Skip to content

Commit

Permalink
Merge branch 'develop' into chore/workflow-sdk-cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien2p authored Nov 18, 2024
2 parents 0521aea + f5c580a commit 7cd21d3
Show file tree
Hide file tree
Showing 453 changed files with 178,757 additions and 167,580 deletions.
5 changes: 5 additions & 0 deletions .changeset/beige-rockets-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---

fix(dashboard): Add missing inventory_item.list.\* widgets
5 changes: 5 additions & 0 deletions .changeset/big-horses-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---

fix(dashboard): Ensure Breadcrumbs don't display stale data
5 changes: 5 additions & 0 deletions .changeset/gentle-dancers-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/medusa": patch
---

fix: do not update the .env.template file with the database name
5 changes: 5 additions & 0 deletions .changeset/good-yaks-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/auth-google": patch
---

feature: Add email to google provider-identity metadata
5 changes: 5 additions & 0 deletions .changeset/honest-chefs-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/core-flows": patch
---

Order edit quantity diff
6 changes: 6 additions & 0 deletions .changeset/mean-rice-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@medusajs/admin-shared": patch
"@medusajs/dashboard": patch
---

fix(admin-shared,dashboard): Add missing Injection Zones and remove unused zones"
8 changes: 8 additions & 0 deletions .changeset/orange-donkeys-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@medusajs/event-bus-local": patch
"@medusajs/event-bus-redis": patch
"@medusajs/orchestration": patch
"@medusajs/utils": patch
---

Improve event bus error handling
28 changes: 28 additions & 0 deletions .changeset/proud-pigs-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
"@medusajs/api-key": patch
"@medusajs/auth": patch
"@medusajs/cart": patch
"@medusajs/currency": patch
"@medusajs/file": patch
"@medusajs/fulfillment": patch
"@medusajs/index": patch
"@medusajs/inventory": patch
"@medusajs/locking": patch
"@medusajs/notification": patch
"@medusajs/order": patch
"@medusajs/payment": patch
"@medusajs/pricing": patch
"@medusajs/product": patch
"@medusajs/promotion": patch
"@medusajs/region": patch
"@medusajs/sales-channel": patch
"@medusajs/stock-location": patch
"@medusajs/store": patch
"@medusajs/tax": patch
"@medusajs/user": patch
"@medusajs/workflow-engine-inmemory": patch
"@medusajs/workflow-engine-redis": patch
"@medusajs/locking-postgres": patch
---

Fix/mikro orm cli wrapper
5 changes: 5 additions & 0 deletions .changeset/rich-pumpkins-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/file-local": patch
---

Throw error from local file provider
5 changes: 5 additions & 0 deletions .changeset/rude-cooks-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---

fix(dashboard): Fix active nav link styling for built-in routes
6 changes: 6 additions & 0 deletions .changeset/thirty-lamps-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@medusajs/core-flows": patch
"@medusajs/medusa": patch
---

Create Order before payment capture
3 changes: 2 additions & 1 deletion .github/workflows/docs-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
run: yarn build
env:
NEXT_PUBLIC_BASE_URL: "http://localhost:3000"
NEXT_PUBLIC_BASE_PATH: /api
NEXT_PUBLIC_DOCS_URL: "https://medusa-docs.vercel.app"
NEXT_PUBLIC_UI_URL: "https://docs-ui.vercel.app"
# TODO change once we have actual URLs
Expand Down Expand Up @@ -317,7 +318,7 @@ jobs:
- name: Get Directories to Scan
if: ${{ steps.pr-files.outputs.files_lt_threshold == 'true' }}
working-directory: www/vale
run: ./get-files.sh api-reference app/_mdx
run: ./get-files.sh api-reference markdown
id: directories

- name: Vale Linter
Expand Down
27 changes: 26 additions & 1 deletion integration-tests/http/__tests__/order-edits/order-edits.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
import {
ContainerRegistrationKeys,
Modules,
OrderChangeStatus,
RuleOperator,
} from "@medusajs/utils"
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
import {
adminHeaders,
createAdminUser,
Expand Down Expand Up @@ -418,6 +418,31 @@ medusaIntegrationTestRunner({
expect(result.summary.current_order_total).toEqual(124)
expect(result.summary.original_order_total).toEqual(60)

const updatedItem = result.items.find((i) => i.id === item.id)
expect(updatedItem.actions).toEqual([
expect.objectContaining({
details: expect.objectContaining({
quantity: 2,
unit_price: 25,
quantity_diff: 0,
}),
}),
expect.objectContaining({
details: expect.objectContaining({
quantity: 3,
unit_price: 25,
quantity_diff: 1,
}),
}),
expect.objectContaining({
details: expect.objectContaining({
quantity: 3,
unit_price: 30,
quantity_diff: 1,
}),
}),
])

// Remove the item by setting the quantity to 0
result = (
await api.post(
Expand Down
32 changes: 10 additions & 22 deletions packages/admin/admin-shared/src/extensions/widgets/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ const ORDER_INJECTION_ZONES = [
"order.list.after",
] as const

const DRAFT_ORDER_INJECTION_ZONES = [
"draft_order.list.before",
"draft_order.list.after",
"draft_order.details.side.before",
"draft_order.details.side.after",
"draft_order.details.before",
"draft_order.details.after",
] as const

const CUSTOMER_INJECTION_ZONES = [
"customer.details.before",
"customer.details.after",
Expand All @@ -39,6 +30,13 @@ const PRODUCT_INJECTION_ZONES = [
"product.details.side.after",
] as const

const PRODUCT_VARIANT_INJECTION_ZONES = [
"product_variant.details.before",
"product_variant.details.after",
"product_variant.details.side.before",
"product_variant.details.side.after",
] as const

const PRODUCT_COLLECTION_INJECTION_ZONES = [
"product_collection.details.before",
"product_collection.details.after",
Expand Down Expand Up @@ -96,15 +94,6 @@ const CAMPAIGN_INJECTION_ZONES = [
"campaign.list.after",
] as const

const GIFT_CARD_INJECTION_ZONES = [
"gift_card.details.before",
"gift_card.details.after",
"gift_card.list.before",
"gift_card.list.after",
"custom_gift_card.before",
"custom_gift_card.after",
] as const

const USER_INJECTION_ZONES = [
"user.details.before",
"user.details.after",
Expand Down Expand Up @@ -204,15 +193,16 @@ const INVENTORY_ITEM_INJECTION_ZONES = [
*/
export const INJECTION_ZONES = [
...ORDER_INJECTION_ZONES,
...DRAFT_ORDER_INJECTION_ZONES,
...CUSTOMER_INJECTION_ZONES,
...CUSTOMER_GROUP_INJECTION_ZONES,
...PRODUCT_INJECTION_ZONES,
...PRODUCT_VARIANT_INJECTION_ZONES,
...PRODUCT_COLLECTION_INJECTION_ZONES,
...PRODUCT_CATEGORY_INJECTION_ZONES,
...PRODUCT_TYPE_INJECTION_ZONES,
...PRODUCT_TAG_INJECTION_ZONES,
...PRICE_LIST_INJECTION_ZONES,
...PROMOTION_INJECTION_ZONES,
...GIFT_CARD_INJECTION_ZONES,
...USER_INJECTION_ZONES,
...STORE_INJECTION_ZONES,
...PROFILE_INJECTION_ZONES,
Expand All @@ -226,8 +216,6 @@ export const INJECTION_ZONES = [
...WORKFLOW_INJECTION_ZONES,
...CAMPAIGN_INJECTION_ZONES,
...TAX_INJECTION_ZONES,
...PRODUCT_TYPE_INJECTION_ZONES,
...PRODUCT_TAG_INJECTION_ZONES,
...RETURN_REASON_INJECTION_ZONES,
...INVENTORY_ITEM_INJECTION_ZONES,
] as const
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,27 @@ export const NavItem = ({

const navLinkClassNames = useCallback(
({
to,
isActive,
isNested = false,
isSetting = false,
}: {
to: string
isActive: boolean
isNested?: boolean
isSetting?: boolean
}) =>
clx(BASE_NAV_LINK_CLASSES, {
}) => {
if (["core", "setting"].includes(type)) {
isActive = pathname.startsWith(to)
}

return clx(BASE_NAV_LINK_CLASSES, {
[NESTED_NAV_LINK_CLASSES]: isNested,
[ACTIVE_NAV_LINK_CLASSES]: isActive,
[SETTING_NAV_LINK_CLASSES]: isSetting,
}),
[]
})
},
[type, pathname]
)

const isSetting = type === "setting"
Expand All @@ -130,11 +137,11 @@ export const NavItem = ({
}
: undefined
}
className={(props) =>
clx(navLinkClassNames({ ...props, isSetting }), {
className={({ isActive }) => {
return clx(navLinkClassNames({ isActive, isSetting, to }), {
"max-lg:hidden": !!items?.length,
})
}
}}
>
{type !== "setting" && (
<div className="flex size-6 items-center justify-center">
Expand Down Expand Up @@ -169,15 +176,16 @@ export const NavItem = ({
<NavLink
to={to}
end
className={(props) =>
clx(
className={({ isActive }) => {
return clx(
navLinkClassNames({
...props,
isNested: true,
to,
isActive,
isSetting,
isNested: true,
})
)
}
}}
>
<Text size="small" weight="plus" leading="compact">
{label}
Expand All @@ -192,15 +200,16 @@ export const NavItem = ({
<NavLink
to={item.to}
end
className={(props) =>
clx(
className={({ isActive }) => {
return clx(
navLinkClassNames({
...props,
isNested: true,
to: item.to,
isActive,
isSetting,
isNested: true,
})
)
}
}}
>
<Text size="small" weight="plus" leading="compact">
{item.label}
Expand Down
14 changes: 8 additions & 6 deletions packages/admin/dashboard/src/components/layout/shell/shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as Dialog from "@radix-ui/react-dialog"

import { SidebarLeft, TriangleRightMini, XMark } from "@medusajs/icons"
import { IconButton, clx } from "@medusajs/ui"
import { PropsWithChildren } from "react"
import { PropsWithChildren, ReactNode } from "react"
import { useTranslation } from "react-i18next"
import { Link, Outlet, UIMatch, useMatches } from "react-router-dom"

Expand Down Expand Up @@ -45,18 +45,20 @@ const Gutter = ({ children }: PropsWithChildren) => {
const Breadcrumbs = () => {
const matches = useMatches() as unknown as UIMatch<
unknown,
{ crumb?: (data?: unknown) => string }
{
breadcrumb?: (match?: UIMatch) => string | ReactNode
}
>[]

const crumbs = matches
.filter((match) => Boolean(match.handle?.crumb))
.filter((match) => match.handle?.breadcrumb)
.map((match) => {
const handle = match.handle

let label: string | null = null
let label: string | ReactNode | undefined = undefined

try {
label = handle.crumb!(match.data)
label = handle.breadcrumb?.(match)
} catch (error) {
// noop
}
Expand All @@ -70,7 +72,7 @@ const Breadcrumbs = () => {
path: match.pathname,
}
})
.filter(Boolean) as { label: string; path: string }[]
.filter(Boolean) as { label: string | ReactNode; path: string }[]

return (
<ol
Expand Down
17 changes: 13 additions & 4 deletions packages/admin/dashboard/src/hooks/api/products.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,12 @@ export const useProduct = (
id: string,
query?: Record<string, any>,
options?: Omit<
UseQueryOptions<any, FetchError, any, QueryKey>,
UseQueryOptions<
HttpTypes.AdminProductResponse,
FetchError,
HttpTypes.AdminProductResponse,
QueryKey
>,
"queryFn" | "queryKey"
>
) => {
Expand Down Expand Up @@ -302,9 +307,13 @@ export const useUpdateProduct = (
) => {
return useMutation({
mutationFn: (payload) => sdk.admin.product.update(id, payload),
onSuccess: (data, variables, context) => {
queryClient.invalidateQueries({ queryKey: productsQueryKeys.lists() })
queryClient.invalidateQueries({ queryKey: productsQueryKeys.detail(id) })
onSuccess: async (data, variables, context) => {
await queryClient.invalidateQueries({
queryKey: productsQueryKeys.lists(),
})
await queryClient.invalidateQueries({
queryKey: productsQueryKeys.detail(id),
})

options?.onSuccess?.(data, variables, context)
},
Expand Down
Loading

0 comments on commit 7cd21d3

Please sign in to comment.