Skip to content

Commit

Permalink
Merge branch 'release/1.0.0-beta.11'
Browse files Browse the repository at this point in the history
  • Loading branch information
bloodf committed Jun 7, 2021
2 parents 58b45cd + 8067bcc commit b299e83
Show file tree
Hide file tree
Showing 106 changed files with 4,406 additions and 2,884 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
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
2 changes: 1 addition & 1 deletion internals/eslint-import/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
],
"dependencies": {
"eslint-import-resolver-typescript": "^2.4.0",
"eslint-plugin-import": "2.23.3"
"eslint-plugin-import": "2.23.4"
},
"main": "index.js"
}
4 changes: 2 additions & 2 deletions internals/eslint-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"rules"
],
"dependencies": {
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0"
"@typescript-eslint/eslint-plugin": "^4.26.0",
"@typescript-eslint/parser": "^4.26.0"
},
"main": "index.js"
}
2 changes: 1 addition & 1 deletion internals/eslint-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"rules"
],
"dependencies": {
"eslint-plugin-vue": "^7.9.0"
"eslint-plugin-vue": "^7.10.0"
},
"main": "index.js"
}
2 changes: 1 addition & 1 deletion internals/eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-airbnb-typescript": "^12.3.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-unicorn": "32.0.1"
"eslint-plugin-unicorn": "33.0.1"
},
"main": "index.js"
}
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,37 +48,37 @@
"@types/graphql": "^14.5.0",
"@types/jest": "^26.0.23",
"@types/jsdom": "^16.2.10",
"@types/node": "^15.6.1",
"@types/node": "^15.12.1",
"@types/webpack": "^5.28.0",
"@typescript-eslint/parser": "^4.25.0",
"@typescript-eslint/parser": "^4.26.0",
"@vue/eslint-config-typescript": "^7.0.0",
"all-contributors-cli": "^6.20.0",
"babel-eslint": "^10.1.0",
"commitizen": "^4.2.4",
"consola": "^2.15.3",
"ejs": "^3.1.6",
"eslint": "7.27.0",
"execa": "^5.0.0",
"eslint": "7.28.0",
"execa": "^5.1.1",
"fs-extra": "^10.0.0",
"husky": "^6.0.0",
"jest": "^27.0.1",
"jest": "^27.0.4",
"jest-date-mock": "^1.0.8",
"jest-environment-jsdom-sixteen": "^2.0.0",
"jest-localstorage-mock": "^2.4.13",
"jest-localstorage-mock": "^2.4.14",
"jest-silent-reporter": "^0.5.0",
"jest-transform-stub": "^2.0.0",
"jest-watch-toggle-config": "^2.0.1",
"jest-watch-typeahead": "^0.6.3",
"jiti": "^1.9.2",
"jest-watch-typeahead": "^0.6.4",
"jiti": "^1.10.1",
"lerna": "^4.0.0",
"lint-staged": "^11.0.0",
"lodash": "^4.17.21",
"majestic": "^1.8.0",
"npm-check-updates": "^11.5.13",
"npm-check-updates": "^11.6.0",
"rimraf": "^3.0.2",
"rollup": "^2.50.1",
"rollup": "^2.51.0",
"rollup-plugin-typescript2": "^0.30.0",
"ts-jest": "^27.0.1",
"ts-jest": "^27.0.3",
"ts-node": "^10.0.0",
"tslib": "^2.2.0",
"typescript": "^4.3.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/api-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue-storefront/magento-api",
"version": "1.0.0-beta.10",
"version": "1.0.0-beta.11",
"sideEffects": false,
"homepage": "https://github.com/vuestorefront/magento2",
"bugs": {
Expand Down Expand Up @@ -48,7 +48,7 @@
"graphql-tools": "^7.0.5",
"jest-transform-graphql": "^2.1.0",
"node-fetch": "^2.6.1",
"rollup": "^2.50.1",
"rollup": "^2.51.0",
"typescript": "^4.3.2",
"webpack": "^4.46.0"
},
Expand Down
22 changes: 8 additions & 14 deletions packages/api-client/src/api/createCustomer/index.ts
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',
});
12 changes: 12 additions & 0 deletions packages/api-client/src/api/createProductReview/index.ts
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 packages/api-client/src/api/createProductReview/mutation.graphql
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
}
}
}
1 change: 1 addition & 0 deletions packages/api-client/src/api/customer/query.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
query customer {
customer {
...CustomerData
is_subscribed
}
}
45 changes: 45 additions & 0 deletions packages/api-client/src/api/customerProductReview/index.ts
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 packages/api-client/src/api/customerProductReview/query.graphql
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
}
}
}
}
3 changes: 1 addition & 2 deletions packages/api-client/src/api/getMenuCategory/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { CustomQuery } from '@vue-storefront/core';
import { ApolloQueryResult } from '@apollo/client';
import { Context } from '../../types/context';
import {
CategoryFilterInput,
Expand All @@ -17,7 +16,7 @@ export default async (
ids: params.ids,
name: params.name,
url_key: params.url_key,
} : { };
} : {};

const { categories } = context.extendQuery(customQuery,
{
Expand Down
4 changes: 4 additions & 0 deletions packages/api-client/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ export { default as country } from './country';
export { default as createCustomer } from './createCustomer';
export { default as createCustomerAddress } from './createCustomerAddress';
export { default as createEmptyCart } from './createEmptyCart';
export { default as createProductReview } from './createProductReview';
export { default as customer } from './customer';
export { default as customerCart } from './customerCart';
export { default as customerOrders } from './customerOrders';
export { default as customerProductReview } from './customerProductReview';
export { default as deleteCustomerAddress } from './deleteCustomerAddress';
export { default as generateCustomerToken } from './generateCustomerToken';
export { default as getAvailableCustomerPaymentMethods } from './getAvailableCustomerPaymentMethods';
Expand All @@ -26,6 +28,7 @@ export { default as mergeCarts } from './mergeCarts';
export { default as placeOrder } from './placeOrder';
export { default as productDetail } from './productDetail';
export { default as productReview } from './productReview';
export { default as productReviewRatingsMetadata } from './productReviewRatingsMetadata';
export { default as products } from './products';
export { default as relatedProduct } from './relatedProduct';
export { default as removeCouponFromCart } from './removeCouponFromCart';
Expand All @@ -43,3 +46,4 @@ export { default as updateCustomerAddress } from './updateCustomerAddress';
export { default as upsellProduct } from './upsellProduct';
export { default as urlResolver } from './urlResolver';
export { default as wishlist } from './wishlist';
export { default as subscribeEmailToNewsletter } from './subscribeEmailToNewsletter';
2 changes: 1 addition & 1 deletion packages/api-client/src/api/productReview/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default async (
customQuery, {
reviews: {
query: reviewQuery,
variables: defaultParams,
variables,
},
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ query productReview($search: String = "", $filter: ProductAttributeFilterInput,
name
value
}
product {
name
uid
}
nickname
summary
text
Expand Down
10 changes: 10 additions & 0 deletions packages/api-client/src/api/productReviewRatingsMetadata/index.ts
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',
});
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 packages/api-client/src/api/subscribeEmailToNewsletter/index.ts
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,
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mutation subscribeEmailToNewsletter($email: String!){
subscribeEmailToNewsletter(email: $email) {
status
}
}
22 changes: 9 additions & 13 deletions packages/api-client/src/api/updateCustomer/index.ts
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',
});
Loading

0 comments on commit b299e83

Please sign in to comment.