Skip to content

Commit

Permalink
Adding additionalInfo to the product query (#654)
Browse files Browse the repository at this point in the history
#### What problem is this solving?
For the KitchenAid store they need a new field on the search query named
additional info, this comes from the pricing API and will help them
creating a new component to the store.

#### How to test it?
[Workspace](https://rfonseca--vtexspain.myvtex.com/admin/graphql-ide)

#### How does this PR make you feel? [:link:](http://giphy.com/)

![](https://media.giphy.com/media/pWO49XP9L7TxbgQVib/giphy.gif)

---------

Co-authored-by: Maira Bello <maira.bello@vtex.com.br>
  • Loading branch information
RodrigoTadeuF and mairatma authored Aug 3, 2023
1 parent 2f705d8 commit 1aea033
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Added
- `additionalInfo` to `product` query.

## [2.166.1] - 2023-08-03

### Fixed
Expand Down
9 changes: 9 additions & 0 deletions graphql/types/Product.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,11 @@ type GeneralValueTeaser {
value: String
}

type AdditionalInfo {
key: String
value: String
}

type Teaser {
name: String
generalValues: [GeneralValueTeaser]
Expand All @@ -281,6 +286,10 @@ type Discount {
Discount name
"""
name: String
"""
Additional Info
"""
additionalInfo: [AdditionalInfo]
}

type DeliverySlaSamples {
Expand Down
2 changes: 1 addition & 1 deletion node/resolvers/profile/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export async function saveAddress(
currentProfile,
context
)

return currentAddresses.find(
(address: Address) => address.addressName === newId
) as Address
Expand Down
4 changes: 4 additions & 0 deletions node/typings/Checkout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@ interface RatesAndBenefitsData {
name: string
featured: boolean
description: string
additionalInfo?: {
key: string
value: string
}
}>
teaser: Array<{
featured: boolean
Expand Down
10 changes: 9 additions & 1 deletion node/utils/simulation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ export const orderFormItemToSeller = (

const [logisticsInfo] = orderFormItem.logisticsInfo

const sellingPrice = orderFormItem.priceDefinition?.calculatedSellingPrice ?? orderFormItem.sellingPrice
const sellingPrice =
orderFormItem.priceDefinition?.calculatedSellingPrice ??
orderFormItem.sellingPrice

const { price } = orderFormItem

Expand Down Expand Up @@ -161,6 +163,12 @@ const getDiscountHighLights = (ratesAndBenefitsData: RatesAndBenefitsData) => {
.map((rateAndBenefitsIdentifier: any) => ({
'<Name>k__BackingField': rateAndBenefitsIdentifier.name,
...rateAndBenefitsIdentifier,
additionalInfo: Object.keys(
rateAndBenefitsIdentifier.additionalInfo ?? {}
).map((objectKey: string) => ({
key: objectKey,
value: rateAndBenefitsIdentifier.additionalInfo[objectKey],
})),
}))
}

Expand Down

0 comments on commit 1aea033

Please sign in to comment.