Skip to content

Commit

Permalink
Merge branch 'develop' into chore/workflow-log-on-error-display
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien2p authored Nov 15, 2024
2 parents c026c9d + dea86d8 commit bb10bb2
Show file tree
Hide file tree
Showing 30 changed files with 951 additions and 568 deletions.
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
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"
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
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useProductVariant } from "../../../hooks/api/products"

import { TwoColumnPageSkeleton } from "../../../components/common/skeleton"
import { TwoColumnPage } from "../../../components/layout/pages"
import { useDashboardExtension } from "../../../extensions"
import { VariantGeneralSection } from "./components/variant-general-section"
import {
InventorySectionPlaceholder,
Expand All @@ -28,6 +29,8 @@ export const ProductVariantDetail = () => {
}
)

const { getWidgets } = useDashboardExtension()

if (isLoading || !variant) {
return (
<TwoColumnPageSkeleton
Expand All @@ -49,12 +52,11 @@ export const ProductVariantDetail = () => {
hasOutlet
showJSON
showMetadata
// TODO: Add widgets zones for variant detail page
widgets={{
after: [],
before: [],
sideAfter: [],
sideBefore: [],
after: getWidgets("product_variant.details.after"),
before: getWidgets("product_variant.details.before"),
sideAfter: getWidgets("product_variant.details.side.after"),
sideBefore: getWidgets("product_variant.details.side.before"),
}}
>
<TwoColumnPage.Main>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ export type ConfirmClaimRequestWorkflowInput = {
confirmed_by?: string
}

function getUpdateReturnData({ returnId }: { returnId: string }) {
return transform({ returnId }, ({ returnId }) => {
return [
{
id: returnId,
status: ReturnStatus.REQUESTED,
requested_at: new Date(),
},
]
})
}

/**
* This step validates that a requested claim can be confirmed.
*/
Expand Down Expand Up @@ -306,13 +318,8 @@ export const confirmClaimRequestWorkflow = createWorkflow(
when({ returnId }, ({ returnId }) => {
return !!returnId
}).then(() => {
updateReturnsStep([
{
id: returnId,
status: ReturnStatus.REQUESTED,
requested_at: new Date(),
},
])
const updateReturnDate = getUpdateReturnData({ returnId })
updateReturnsStep(updateReturnDate)
})

const claimId = transform(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,18 @@ function extractShippingOption({ orderPreview, orderExchange, returnId }) {
}
}

function getUpdateReturnData({ returnId }: { returnId: string }) {
return transform({ returnId }, ({ returnId }) => {
return [
{
id: returnId,
status: ReturnStatus.REQUESTED,
requested_at: new Date(),
},
]
})
}

export const confirmExchangeRequestWorkflowId = "confirm-exchange-request"
/**
* This workflow confirms an exchange request.
Expand Down Expand Up @@ -294,13 +306,8 @@ export const confirmExchangeRequestWorkflow = createWorkflow(
when({ returnId }, ({ returnId }) => {
return !!returnId
}).then(() => {
updateReturnsStep([
{
id: returnId,
status: ReturnStatus.REQUESTED,
requested_at: new Date(),
},
])
const updateReturnData = getUpdateReturnData({ returnId })
updateReturnsStep(updateReturnData)
})

const exchangeId = transform(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
WorkflowResponse,
createStep,
createWorkflow,
transform,
} from "@medusajs/framework/workflows-sdk"
import { useRemoteQueryStep } from "../../../common"
import { previewOrderChangeStep } from "../../steps"
Expand All @@ -23,6 +24,25 @@ export type OrderEditRequestWorkflowInput = {
requested_by?: string
}

function getOrderChangesData({
input,
orderChange,
}: {
input: { requested_by?: string }
orderChange: { id: string }
}) {
return transform({ input, orderChange }, ({ input, orderChange }) => {
return [
{
id: orderChange.id,
status: OrderChangeStatus.REQUESTED,
requested_at: new Date(),
requested_by: input.requested_by,
},
]
})
}

/**
* This step validates that a order edit can be requested.
*/
Expand Down Expand Up @@ -74,14 +94,8 @@ export const requestOrderEditRequestWorkflow = createWorkflow(
orderChange,
})

updateOrderChangesStep([
{
id: orderChange.id,
status: OrderChangeStatus.REQUESTED,
requested_at: new Date(),
requested_by: input.requested_by,
},
])
const updateOrderChangesData = getOrderChangesData({ input, orderChange })
updateOrderChangesStep(updateOrderChangesData)

createOrUpdateOrderPaymentCollectionWorkflow.runAsStep({
input: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,18 @@ function extractReturnShippingOptionId({ orderPreview, orderReturn }) {
return returnShippingMethod.shipping_option_id
}

function getUpdateReturnData({ orderReturn }: { orderReturn: { id: string } }) {
return transform({ orderReturn }, ({ orderReturn }) => {
return [
{
id: orderReturn.id,
status: ReturnStatus.REQUESTED,
requested_at: new Date(),
},
]
})
}

export const confirmReturnRequestWorkflowId = "confirm-return-request"
/**
* This workflow confirms a return request.
Expand Down Expand Up @@ -277,14 +289,10 @@ export const confirmReturnRequestWorkflow = createWorkflow(
createRemoteLinkStep(link)
})

const updateReturnData = getUpdateReturnData({ orderReturn })

parallelize(
updateReturnsStep([
{
id: orderReturn.id,
status: ReturnStatus.REQUESTED,
requested_at: new Date(),
},
]),
updateReturnsStep(updateReturnData),
confirmOrderChanges({
changes: [orderChange],
orderId: order.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export class GoogleAuthService extends AbstractAuthModuleProvider {
const entity_id = payload.sub
const userMetadata = {
name: payload.name,
email: payload.email,
picture: payload.picture,
given_name: payload.given_name,
family_name: payload.family_name,
Expand Down
Loading

0 comments on commit bb10bb2

Please sign in to comment.