Skip to content
This repository has been archived by the owner on Jun 2, 2022. It is now read-only.

Commit

Permalink
feat: Add session query and run session query after change postal code (
Browse files Browse the repository at this point in the history
#392)

* Add session mutation and mutate session after change postal code

* Update CHANGELOG.md

Co-authored-by: Larícia Mota <[email protected]>

Co-authored-by: Larícia Mota <[email protected]>
  • Loading branch information
igorbrasileiro and lariciamota authored Mar 28, 2022
1 parent 7caced1 commit a9d42e4
Show file tree
Hide file tree
Showing 7 changed files with 164 additions and 144 deletions.
250 changes: 117 additions & 133 deletions @generated/graphql/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,12 @@ export type IStoreSelectedFacet = {
value: Scalars['String']
}

export type IStoreSession = {
channel: InputMaybe<Scalars['String']>
country: InputMaybe<Scalars['String']>
postalCode: InputMaybe<Scalars['String']>
}

export type IntQueryOperatorInput = {
eq: InputMaybe<Scalars['Int']>
gt: InputMaybe<Scalars['Int']>
Expand Down Expand Up @@ -800,9 +806,14 @@ export type InternalFilterInput = {
}

export type Mutation = {
updateSession: StoreSession
validateCart: Maybe<StoreCart>
}

export type MutationUpdateSessionArgs = {
session: IStoreSession
}

export type MutationValidateCartArgs = {
cart: IStoreCart
}
Expand Down Expand Up @@ -3521,6 +3532,12 @@ export type StoreSeoFilterInput = {
titleTemplate: InputMaybe<StringQueryOperatorInput>
}

export type StoreSession = {
channel: Maybe<Scalars['String']>
country: Maybe<Scalars['String']>
postalCode: Maybe<Scalars['String']>
}

export type StoreSort =
| 'discount_desc'
| 'name_asc'
Expand All @@ -3542,6 +3559,22 @@ export type StringQueryOperatorInput = {
regex: InputMaybe<Scalars['String']>
}

export type StoreCollectionQueryVariables = Exact<{ [key: string]: never }>

export type StoreCollectionQuery = {
allStoreCollection: {
edges: Array<{ node: { slug: string; seo: { title: string } } }>
}
}

export type UpdateSessionMutationMutationVariables = Exact<{
session: IStoreSession
}>

export type UpdateSessionMutationMutation = {
updateSession: { channel: string | null }
}

export type ProductSummary_ProductFragment = {
slug: string
sku: string
Expand Down Expand Up @@ -3647,30 +3680,16 @@ export type ProductGalleryQueryQuery = {
}
}

export type StoreCollectionQueryVariables = Exact<{ [key: string]: never }>

export type StoreCollectionQuery = {
allStoreCollection: {
edges: Array<{ node: { slug: string; seo: { title: string } } }>
}
}

export type HomePageQueryQueryVariables = Exact<{ [key: string]: never }>

export type HomePageQueryQuery = {
site:
| {
siteMetadata:
| {
title: string | null | undefined
description: string | null | undefined
titleTemplate: string | null | undefined
}
| null
| undefined
}
| null
| undefined
site: {
siteMetadata: {
title: string | null
description: string | null
titleTemplate: string | null
} | null
} | null
allStoreProduct: {
nodes: Array<{
slug: string
Expand Down Expand Up @@ -3698,53 +3717,34 @@ export type HomePageQueryQuery = {
export type SearchPageQueryQueryVariables = Exact<{ [key: string]: never }>

export type SearchPageQueryQuery = {
site:
| {
siteMetadata:
| {
titleTemplate: string | null | undefined
title: string | null | undefined
description: string | null | undefined
}
| null
| undefined
}
| null
| undefined
site: {
siteMetadata: {
titleTemplate: string | null
title: string | null
description: string | null
} | null
} | null
}

export type CollectionPageQueryQueryVariables = Exact<{
id: Scalars['String']
}>

export type CollectionPageQueryQuery = {
site:
| {
siteMetadata:
| {
titleTemplate: string | null | undefined
title: string | null | undefined
description: string | null | undefined
}
| null
| undefined
}
| null
| undefined
collection:
| {
seo: { title: string; description: string }
breadcrumbList: {
itemListElement: Array<{
item: string
name: string
position: number
}>
}
meta: { selectedFacets: Array<{ key: string; value: string }> }
}
| null
| undefined
site: {
siteMetadata: {
titleTemplate: string | null
title: string | null
description: string | null
} | null
} | null
collection: {
seo: { title: string; description: string }
breadcrumbList: {
itemListElement: Array<{ item: string; name: string; position: number }>
}
meta: { selectedFacets: Array<{ key: string; value: string }> }
} | null
allStoreProduct: {
nodes: Array<{
slug: string
Expand Down Expand Up @@ -3774,56 +3774,43 @@ export type ProductPageQueryQueryVariables = Exact<{
}>

export type ProductPageQueryQuery = {
site:
| {
siteMetadata:
| {
title: string | null | undefined
description: string | null | undefined
titleTemplate: string | null | undefined
siteUrl: string | null | undefined
}
| null
| undefined
}
| null
| undefined
product:
| {
slug: string
sku: string
gtin: string
name: string
description: string
id: string
seo: { title: string; description: string }
brand: { name: string }
breadcrumbList: {
itemListElement: Array<{
item: string
name: string
position: number
}>
}
image: Array<{ url: string; alternateName: string }>
offers: {
lowPrice: number
highPrice: number
priceCurrency: string
offers: Array<{
availability: string
price: number
priceValidUntil: string
priceCurrency: string
itemCondition: string
listPrice: number
seller: { identifier: string }
}>
}
isVariantOf: { productGroupID: string; name: string }
}
| null
| undefined
site: {
siteMetadata: {
title: string | null
description: string | null
titleTemplate: string | null
siteUrl: string | null
} | null
} | null
product: {
slug: string
sku: string
gtin: string
name: string
description: string
id: string
seo: { title: string; description: string }
brand: { name: string }
breadcrumbList: {
itemListElement: Array<{ item: string; name: string; position: number }>
}
image: Array<{ url: string; alternateName: string }>
offers: {
lowPrice: number
highPrice: number
priceCurrency: string
offers: Array<{
availability: string
price: number
priceValidUntil: string
priceCurrency: string
itemCondition: string
listPrice: number
seller: { identifier: string }
}>
}
isVariantOf: { productGroupID: string; name: string }
} | null
allStoreProduct: {
nodes: Array<{
slug: string
Expand Down Expand Up @@ -3853,29 +3840,26 @@ export type ValidateCartMutationMutationVariables = Exact<{
}>

export type ValidateCartMutationMutation = {
validateCart:
| {
order: {
orderNumber: string
acceptedOffer: Array<{
quantity: number
price: number
listPrice: number
seller: { identifier: string }
itemOffered: {
sku: string
name: string
gtin: string
image: Array<{ url: string; alternateName: string }>
brand: { name: string }
isVariantOf: { productGroupID: string; name: string }
}
}>
validateCart: {
order: {
orderNumber: string
acceptedOffer: Array<{
quantity: number
price: number
listPrice: number
seller: { identifier: string }
itemOffered: {
sku: string
name: string
gtin: string
image: Array<{ url: string; alternateName: string }>
brand: { name: string }
isVariantOf: { productGroupID: string; name: string }
}
messages: Array<{ text: string; status: StoreStatus }>
}
| null
| undefined
}>
}
messages: Array<{ text: string; status: StoreStatus }>
} | null
}

export type CartMessageFragment = { text: string; status: StoreStatus }
Expand Down
3 changes: 2 additions & 1 deletion @generated/graphql/persisted.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"ProductGalleryQuery": "query ProductGalleryQuery($first: Int!, $after: String!, $sort: StoreSort!, $term: String!, $selectedFacets: [IStoreSelectedFacet!]!) {\n search(\n first: $first\n after: $after\n sort: $sort\n term: $term\n selectedFacets: $selectedFacets\n ) {\n products {\n pageInfo {\n totalCount\n }\n edges {\n node {\n id: productID\n slug\n sku\n brand {\n brandName: name\n name\n }\n name\n gtin\n isVariantOf {\n productGroupID\n name\n }\n image {\n url\n alternateName\n }\n offers {\n lowPrice\n offers {\n availability\n price\n listPrice\n quantity\n seller {\n identifier\n }\n }\n }\n }\n }\n }\n facets {\n key\n label\n type\n values {\n label\n value\n selected\n quantity\n }\n }\n }\n}\n",
"StoreCollection": "query StoreCollection {\n allStoreCollection(filter: {type: {eq: Department}}) {\n edges {\n node {\n slug\n seo {\n title\n }\n }\n }\n }\n}\n",
"UpdateSessionMutation": "mutation UpdateSessionMutation($session: IStoreSession!) {\n updateSession(session: $session) {\n channel\n }\n}\n",
"ProductGalleryQuery": "query ProductGalleryQuery($first: Int!, $after: String!, $sort: StoreSort!, $term: String!, $selectedFacets: [IStoreSelectedFacet!]!) {\n search(\n first: $first\n after: $after\n sort: $sort\n term: $term\n selectedFacets: $selectedFacets\n ) {\n products {\n pageInfo {\n totalCount\n }\n edges {\n node {\n id: productID\n slug\n sku\n brand {\n brandName: name\n name\n }\n name\n gtin\n isVariantOf {\n productGroupID\n name\n }\n image {\n url\n alternateName\n }\n offers {\n lowPrice\n offers {\n availability\n price\n listPrice\n quantity\n seller {\n identifier\n }\n }\n }\n }\n }\n }\n facets {\n key\n label\n type\n values {\n label\n value\n selected\n quantity\n }\n }\n }\n}\n",
"HomePageQuery": "query HomePageQuery {\n site {\n siteMetadata {\n title\n description\n titleTemplate\n }\n }\n allStoreProduct(limit: 14) {\n nodes {\n id: productID\n slug\n sku\n brand {\n brandName: name\n name\n }\n name\n gtin\n isVariantOf {\n productGroupID\n name\n }\n image {\n url\n alternateName\n }\n offers {\n lowPrice\n offers {\n availability\n price\n listPrice\n quantity\n seller {\n identifier\n }\n }\n }\n }\n }\n}\n",
"SearchPageQuery": "query SearchPageQuery {\n site {\n siteMetadata {\n titleTemplate\n title\n description\n }\n }\n}\n",
"CollectionPageQuery": "query CollectionPageQuery($id: String!) {\n site {\n siteMetadata {\n titleTemplate\n title\n description\n }\n }\n collection: storeCollection(id: {eq: $id}) {\n seo {\n title\n description\n }\n breadcrumbList {\n itemListElement {\n item\n name\n position\n }\n }\n meta {\n selectedFacets {\n key\n value\n }\n }\n }\n allStoreProduct(limit: 5) {\n nodes {\n id: productID\n slug\n sku\n brand {\n brandName: name\n name\n }\n name\n gtin\n isVariantOf {\n productGroupID\n name\n }\n image {\n url\n alternateName\n }\n offers {\n lowPrice\n offers {\n availability\n price\n listPrice\n quantity\n seller {\n identifier\n }\n }\n }\n }\n }\n}\n",
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `SearchHistory` component.
- `Badge` interactive variation.
- New folder `styles/global` containing all global styles.
- Session mutation when the user enters a new postal code.

### Changed

Expand Down
Loading

0 comments on commit a9d42e4

Please sign in to comment.