Skip to content

Commit

Permalink
Merge branch 'main' into merx-1336-order-metadata-filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejewsky authored Jan 8, 2025
2 parents 13e61eb + 9b33a11 commit 5d98a74
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 77 deletions.
5 changes: 5 additions & 0 deletions .changeset/weak-apples-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Discounts no longer blocks the UI when the user has no permissions for managing channels.
22 changes: 1 addition & 21 deletions src/discounts/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,27 +229,7 @@ export const PromotionDetailsQuery = /* GraphQL */ `
name
description
channels {
id
isActive
name
slug
currencyCode
defaultCountry {
code
country
}
stockSettings {
allocationStrategy
}
hasOrders
orderSettings {
markAsPaidStrategy
deleteExpiredOrdersAfter
allowUnpaidOrders
}
paymentSettings {
defaultTransactionFlowStrategy
}
...PromotionRuleChannel
}
giftIds
rewardType
Expand Down
16 changes: 15 additions & 1 deletion src/fragments/discounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,27 @@ export const voucherDetailsFragment = gql`
}
`;

export const promotionRuleChannelFragment = gql`
fragment PromotionRuleChannel on Channel {
id
isActive
name
slug
currencyCode
defaultCountry {
code
country
}
}
`;

export const promotionRuleDetailsFragment = gql`
fragment PromotionRuleDetails on PromotionRule {
id
name
description
channels {
...ChannelDetails
...PromotionRuleChannel
}
giftIds
rewardType
Expand Down
87 changes: 40 additions & 47 deletions src/graphql/hooks.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,33 @@ export const ChannelErrorFragmentDoc = gql`
message
}
`;
export const WarehouseFragmentDoc = gql`
fragment Warehouse on Warehouse {
id
name
}
`;
export const ChannelDetailsFragmentDoc = gql`
fragment ChannelDetails on Channel {
...Channel
hasOrders
warehouses {
...Warehouse
}
orderSettings {
markAsPaidStrategy
deleteExpiredOrdersAfter
allowUnpaidOrders
}
paymentSettings {
defaultTransactionFlowStrategy
}
checkoutSettings {
automaticallyCompleteFullyPaidCheckouts
}
}
${ChannelFragmentDoc}
${WarehouseFragmentDoc}`;
export const CollectionFragmentDoc = gql`
fragment Collection on Collection {
id
Expand Down Expand Up @@ -635,40 +662,26 @@ export const VoucherDetailsFragmentDoc = gql`
${VoucherFragmentDoc}
${ChannelListingProductWithoutPricingFragmentDoc}
${PageInfoFragmentDoc}`;
export const WarehouseFragmentDoc = gql`
fragment Warehouse on Warehouse {
export const PromotionRuleChannelFragmentDoc = gql`
fragment PromotionRuleChannel on Channel {
id
isActive
name
}
`;
export const ChannelDetailsFragmentDoc = gql`
fragment ChannelDetails on Channel {
...Channel
hasOrders
warehouses {
...Warehouse
}
orderSettings {
markAsPaidStrategy
deleteExpiredOrdersAfter
allowUnpaidOrders
}
paymentSettings {
defaultTransactionFlowStrategy
}
checkoutSettings {
automaticallyCompleteFullyPaidCheckouts
slug
currencyCode
defaultCountry {
code
country
}
}
${ChannelFragmentDoc}
${WarehouseFragmentDoc}`;
`;
export const PromotionRuleDetailsFragmentDoc = gql`
fragment PromotionRuleDetails on PromotionRule {
id
name
description
channels {
...ChannelDetails
...PromotionRuleChannel
}
giftIds
rewardType
Expand All @@ -677,7 +690,7 @@ export const PromotionRuleDetailsFragmentDoc = gql`
cataloguePredicate
orderPredicate
}
${ChannelDetailsFragmentDoc}`;
${PromotionRuleChannelFragmentDoc}`;
export const PromotionDetailsFragmentDoc = gql`
fragment PromotionDetails on Promotion {
id
Expand Down Expand Up @@ -8665,27 +8678,7 @@ export const PromotionDetailsQueryDocument = gql`
name
description
channels {
id
isActive
name
slug
currencyCode
defaultCountry {
code
country
}
stockSettings {
allocationStrategy
}
hasOrders
orderSettings {
markAsPaidStrategy
deleteExpiredOrdersAfter
allowUnpaidOrders
}
paymentSettings {
defaultTransactionFlowStrategy
}
...PromotionRuleChannel
}
giftIds
rewardType
Expand All @@ -8696,7 +8689,7 @@ export const PromotionDetailsQueryDocument = gql`
}
}
}
`;
${PromotionRuleChannelFragmentDoc}`;

/**
* __usePromotionDetailsQueryQuery__
Expand Down
Loading

0 comments on commit 5d98a74

Please sign in to comment.