feat(core-flows,dashboard): add fixes to allow only outbound or inbound claims (#8590)

what:

- allows completing claim with only inbound items
- allows completing claim with only outbound items
- validates against creating claims when an active change order is present
This commit is contained in:
Riqwan Thamir
2024-08-14 21:09:05 +00:00
committed by GitHub
parent a45ff1c147
commit 4cb28531e5
12 changed files with 579 additions and 293 deletions
@@ -252,13 +252,17 @@ export const confirmClaimRequestWorkflow = createWorkflow(
}
)
updateReturnsStep([
{
id: returnId,
status: ReturnStatus.REQUESTED,
requested_at: new Date(),
},
])
when({ returnId }, ({ returnId }) => {
return !!returnId
}).then(() => {
updateReturnsStep([
{
id: returnId,
status: ReturnStatus.REQUESTED,
requested_at: new Date(),
},
])
})
const claimId = transform({ createClaimItems }, ({ createClaimItems }) => {
return createClaimItems?.[0]?.claim_id
@@ -329,9 +333,12 @@ export const confirmClaimRequestWorkflow = createWorkflow(
reserveInventoryStep(formatedInventoryItems)
})
when({ returnShippingMethod }, ({ returnShippingMethod }) => {
return !!returnShippingMethod
}).then(() => {
when(
{ returnShippingMethod, returnId },
({ returnShippingMethod, returnId }) => {
return !!returnShippingMethod && !!returnId
}
).then(() => {
const returnShippingOption = useRemoteQueryStep({
entry_point: "shipping_options",
fields: [