forked from vuestorefront/magento2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/1.0.0-beta.11'
- Loading branch information
Showing
106 changed files
with
4,406 additions
and
2,884 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
**/node_modules/**/* | ||
**/lib/* | ||
packages/composables/nuxt/plugin.js | ||
packages/composables/nuxt/plugin.js | ||
packages/api-client/types/GraphQL.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,19 @@ | ||
import { FetchResult } from '@apollo/client'; | ||
import { | ||
CreateCustomerMutation, | ||
CreateCustomerMutationVariables, | ||
CustomerCreateInput, | ||
CustomerDataFragment as Customer, | ||
} from '../../types/GraphQL'; | ||
import mutation from './mutation.graphql'; | ||
import { Context } from '../../types/context'; | ||
|
||
export default async ( | ||
context: Context, | ||
input: CustomerCreateInput, | ||
): Promise<Customer> => { | ||
const response = await context | ||
.client | ||
.mutate<CreateCustomerMutation, CreateCustomerMutationVariables>({ | ||
mutation, | ||
variables: { input }, | ||
fetchPolicy: 'no-cache', | ||
}); | ||
|
||
const { data } = response; | ||
|
||
return data?.createCustomerV2?.customer; | ||
}; | ||
): Promise<FetchResult<CreateCustomerMutation>> => context | ||
.client | ||
.mutate<CreateCustomerMutation, CreateCustomerMutationVariables>({ | ||
mutation, | ||
variables: { input }, | ||
fetchPolicy: 'no-cache', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { FetchResult } from '@apollo/client'; | ||
import { CreateProductReviewMutation, CreateProductReviewMutationVariables } from '../../types/GraphQL'; | ||
import mutation from './mutation.graphql'; | ||
import { Context } from '../../types/context'; | ||
|
||
export default async ({ client }: Context, input: CreateProductReviewMutationVariables): Promise<FetchResult<CreateProductReviewMutation>> => client | ||
.mutate<CreateProductReviewMutation, { input: CreateProductReviewMutationVariables }>({ | ||
mutation, | ||
variables: { | ||
input, | ||
}, | ||
}); |
15 changes: 15 additions & 0 deletions
15
packages/api-client/src/api/createProductReview/mutation.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
mutation createProductReview($input: CreateProductReviewInput!) { | ||
createProductReview(input: $input){ | ||
review { | ||
average_rating | ||
ratings_breakdown { | ||
name | ||
value | ||
} | ||
nickname | ||
summary | ||
text | ||
created_at | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ | |
query customer { | ||
customer { | ||
...CustomerData | ||
is_subscribed | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
packages/api-client/src/api/customerProductReview/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { ApolloQueryResult } from 'apollo-client'; | ||
import { CustomQuery } from '@vue-storefront/core'; | ||
import { | ||
CustomerProductReviewQuery, | ||
CustomerProductReviewQueryVariables, | ||
} from '../../types/GraphQL'; | ||
import reviewQuery from './query.graphql'; | ||
import { Context } from '../../types/context'; | ||
|
||
export type CustomerProductReviewParams = { | ||
pageSize: number; | ||
currentPage: number; | ||
}; | ||
|
||
export default async ( | ||
context: Context, | ||
searchParams?: CustomerProductReviewParams, | ||
customQuery?: CustomQuery, | ||
): Promise<ApolloQueryResult<CustomerProductReviewQuery>> => { | ||
const defaultParams = { | ||
pageSize: 20, | ||
currentPage: 1, | ||
...searchParams, | ||
}; | ||
|
||
const variables: CustomerProductReviewParams = { | ||
pageSize: defaultParams.pageSize, | ||
currentPage: defaultParams.currentPage, | ||
}; | ||
|
||
const { reviews } = context.extendQuery( | ||
customQuery, { | ||
reviews: { | ||
query: reviewQuery, | ||
variables, | ||
}, | ||
}, | ||
); | ||
|
||
return context.client.query<CustomerProductReviewQuery, CustomerProductReviewQueryVariables>({ | ||
query: reviews.query, | ||
variables: reviews.variables, | ||
fetchPolicy: 'no-cache', | ||
}); | ||
}; |
26 changes: 26 additions & 0 deletions
26
packages/api-client/src/api/customerProductReview/query.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
query customerProductReview($pageSize: Int = 20, $currentPage: Int = 1) { | ||
customer { | ||
reviews(pageSize: $pageSize, currentPage: $currentPage) { | ||
items { | ||
average_rating | ||
ratings_breakdown { | ||
name | ||
value | ||
} | ||
nickname | ||
summary | ||
text | ||
created_at | ||
product { | ||
name | ||
uid | ||
} | ||
} | ||
page_info { | ||
current_page | ||
page_size | ||
total_pages | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/api-client/src/api/productReviewRatingsMetadata/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ApolloQueryResult } from 'apollo-client'; | ||
import { ProductReviewRatingsMetadataQuery } from '../../types/GraphQL'; | ||
import query from './query.graphql'; | ||
import { Context } from '../../types/context'; | ||
|
||
export default async ({ client }: Context): Promise<ApolloQueryResult<ProductReviewRatingsMetadataQuery>> => client | ||
.query<ProductReviewRatingsMetadataQuery>({ | ||
query, | ||
fetchPolicy: 'no-cache', | ||
}); |
12 changes: 12 additions & 0 deletions
12
packages/api-client/src/api/productReviewRatingsMetadata/query.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
query productReviewRatingsMetadata{ | ||
productReviewRatingsMetadata { | ||
items { | ||
id | ||
name | ||
values { | ||
value_id | ||
value | ||
} | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
packages/api-client/src/api/subscribeEmailToNewsletter/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { FetchResult } from '@apollo/client'; | ||
import mutation from './mutation.graphql'; | ||
import { | ||
SubscribeEmailToNewsletterMutation, SubscribeEmailToNewsletterMutationVariables, | ||
} from '../../types/GraphQL'; | ||
import { Context } from '../../types/context'; | ||
|
||
export default async ( | ||
{ client }: Context, | ||
{ email }: SubscribeEmailToNewsletterMutationVariables, | ||
): Promise<FetchResult<SubscribeEmailToNewsletterMutation>> => client | ||
.mutate< | ||
SubscribeEmailToNewsletterMutation, | ||
SubscribeEmailToNewsletterMutationVariables>({ | ||
mutation, | ||
variables: { | ||
email, | ||
}, | ||
}); |
5 changes: 5 additions & 0 deletions
5
packages/api-client/src/api/subscribeEmailToNewsletter/mutation.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
mutation subscribeEmailToNewsletter($email: String!){ | ||
subscribeEmailToNewsletter(email: $email) { | ||
status | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,17 @@ | ||
import { FetchResult } from '@apollo/client'; | ||
import mutation from './mutation.graphql'; | ||
import { | ||
CustomerDataFragment as Customer, | ||
CustomerUpdateInput, | ||
UpdateCustomerMutation, | ||
UpdateCustomerMutationVariables, | ||
} from '../../types/GraphQL'; | ||
import { Context } from '../../types/context'; | ||
|
||
export default async ({ client }: Context, input: CustomerUpdateInput): Promise<Customer> => { | ||
const { data } = await client | ||
.mutate< | ||
UpdateCustomerMutation, | ||
UpdateCustomerMutationVariables>({ | ||
mutation, | ||
variables: { input }, | ||
fetchPolicy: 'no-cache', | ||
}); | ||
|
||
return data?.updateCustomerV2?.customer; | ||
}; | ||
export default async ({ client }: Context, input: CustomerUpdateInput): Promise<FetchResult<UpdateCustomerMutation>> => client | ||
.mutate< | ||
UpdateCustomerMutation, | ||
UpdateCustomerMutationVariables>({ | ||
mutation, | ||
variables: { input }, | ||
fetchPolicy: 'no-cache', | ||
}); |
Oops, something went wrong.