Skip to content

Commit

Permalink
Merge remote-tracking branch 'vsf/next' into docs-next
Browse files Browse the repository at this point in the history
  • Loading branch information
filrak committed Jan 7, 2021
2 parents 2dba420 + a287cee commit d8bd197
Show file tree
Hide file tree
Showing 164 changed files with 3,206 additions and 1,970 deletions.
2 changes: 1 addition & 1 deletion packages/boilerplate/api-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"prepublish": "yarn build"
},
"dependencies": {
"@vue-storefront/core": "^2.1.0-rc.1"
"@vue-storefront/core": "^2.1.1-rc.1"
},
"files": [
"lib/**/*"
Expand Down
4 changes: 2 additions & 2 deletions packages/boilerplate/composables/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"prepublish": "yarn build"
},
"dependencies": {
"@vue-storefront/boilerplate-api": "^0.0.1",
"@vue-storefront/core": "^2.1.0-rc.1"
"@vue-storefront/boilerplate-api": "0.0.1",
"@vue-storefront/core": "^2.1.1-rc.1"
},
"files": [
"lib/**/*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Order, OrderItem } from '../types';
export const getDate = (order: any): string => order?.date || '123';

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const getId = (order: any): string => order?.id || '123';
export const getId = (order: any): string => order?.id || Math.floor(Math.random() * 100);

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const getStatus = (order: any): string => order?.status || 'Failed';
Expand Down
5 changes: 2 additions & 3 deletions packages/boilerplate/composables/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import useUser from './useUser';
import useUserBilling from './useUserBilling';
import useUserOrders from './useUserOrders';
import useUserShipping from './useUserShipping';
import { useWishlist, setWishlist } from './useWishlist';
import useWishlist from './useWishlist';
import { createApiClient } from '@vue-storefront/boilerplate-api';
import { integrationPluginFactory } from '@vue-storefront/core';

Expand All @@ -30,8 +30,7 @@ export {
useUserBilling,
useUserOrders,
useUserShipping,
useWishlist,
setWishlist
useWishlist
};

export * from './getters';
72 changes: 38 additions & 34 deletions packages/boilerplate/composables/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,43 @@
import { UseCategory, UseProduct } from '@vue-storefront/core';
export { UseCategory, UseProduct } from '@vue-storefront/core';

type Product = {}
type Category = {}
type User = {
export type ProductsResponse = {
data: Product[];
total: number;
};

export type OrdersResponse = {
data: any[];
total: number;
};

export type OrderSearchParams = Record<string, any>;

export type Category = {};

export type User = {
firstName?: string;
lastName?: string;
email?: string;
}
type UserAddress = {}
type Cart = {}
type CartItem = {}
type Coupon = {}
type Order = {}
type OrderItem = {}
type OrderSearchParams = {}
type Review = {};
type ShippingMethod = {}
type WishlistProduct = {}
type Wishlist = {}

export {
Cart,
CartItem,
Category,
Coupon,
Order,
OrderItem,
OrderSearchParams,
Product,
Review,
ShippingMethod,
User,
UserAddress,
Wishlist,
WishlistProduct,
UseCategory,
UseProduct
};

export type UserAddress = {};

export type Cart = {};

export type CartItem = {};

export type Coupon = {};

export type Order = {};

export type OrderItem = {};

export type Product = {};

export type Review = {};

export type ShippingMethod = {};

export type WishlistProduct = {};

export type Wishlist = {};
14 changes: 6 additions & 8 deletions packages/boilerplate/composables/src/useCart/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,31 @@ import { Cart, CartItem, Coupon, Product } from '../types';

const params: UseCartFactoryParams<Cart, CartItem, Product, Coupon> = {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
loadCart: async (context: Context, customQuery?: CustomQuery) => {
load: async (context: Context) => {
console.log('Mocked: loadCart');
return {};
},

// eslint-disable-next-line @typescript-eslint/no-unused-vars
addToCart: async (context: Context, { currentCart, product, quantity }, customQuery?: CustomQuery) => {
addItem: async (context: Context, { currentCart, product, quantity }, customQuery?: CustomQuery) => {
console.log('Mocked: addToCart');
return {};
},

// eslint-disable-next-line @typescript-eslint/no-unused-vars
removeFromCart: async (context: Context, { currentCart, product }, customQuery?: CustomQuery) => {
removeItem: async (context: Context, { currentCart, product }, customQuery?: CustomQuery) => {
console.log('Mocked: removeFromCart');
return {};
},

// eslint-disable-next-line @typescript-eslint/no-unused-vars
updateQuantity: async (context: Context, { currentCart, product, quantity }, customQuery?: CustomQuery) => {
updateItemQty: async (context: Context, { currentCart, product, quantity }, customQuery?: CustomQuery) => {
console.log('Mocked: updateQuantity');
return {};
},

// eslint-disable-next-line @typescript-eslint/no-unused-vars
clearCart: async (context: Context, { currentCart }) => {
clear: async (context: Context, { currentCart }) => {
console.log('Mocked: clearCart');
return {};
},
Expand All @@ -60,6 +60,4 @@ const params: UseCartFactoryParams<Cart, CartItem, Product, Coupon> = {
}
};

const { useCart } = useCartFactory<Cart, CartItem, Product, Coupon>(params);

export default useCart;
export default useCartFactory<Cart, CartItem, Product, Coupon>(params);
5 changes: 1 addition & 4 deletions packages/boilerplate/composables/src/useCategory/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
Context,
CustomQuery,
UseCategory,
useCategoryFactory,
UseCategoryFactoryParams
} from '@vue-storefront/core';
Expand All @@ -13,6 +12,4 @@ const params: UseCategoryFactoryParams<Category, any> = {
}
};

const useCategory: (id: string) => UseCategory<Category> = useCategoryFactory<Category, any>(params);

export default useCategory;
export default useCategoryFactory<Category, any>(params);
11 changes: 4 additions & 7 deletions packages/boilerplate/composables/src/useProduct/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@ import {
CustomQuery,
useProductFactory,
ProductsSearchParams,
ProductsSearchResult,
UseProductFactoryParams
} from '@vue-storefront/core';
import { UseProduct, Product } from '../types';
import { ProductsResponse } from '../types';

const params: UseProductFactoryParams<Product, any> = {
productsSearch: async (context: Context, params: ProductsSearchParams, customQuery?: CustomQuery): Promise<ProductsSearchResult<Product>> => {
const params: UseProductFactoryParams<ProductsResponse, any> = {
productsSearch: async (context: Context, params: ProductsSearchParams, customQuery?: CustomQuery): Promise<ProductsResponse> => {
return await context.$boilerplate.api.getProduct(params, customQuery);
}
};

const useProduct: (cacheId: string) => UseProduct<Product> = useProductFactory<Product, any>(params);

export default useProduct;
export default useProductFactory<ProductsResponse, any>(params);
5 changes: 1 addition & 4 deletions packages/boilerplate/composables/src/useReview/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
Context,
useReviewFactory,
UseReview,
UseReviewFactoryParams
} from '@vue-storefront/core';
import { Review } from '../types';
Expand All @@ -20,6 +19,4 @@ const params: UseReviewFactoryParams<any, any, any> = {
}
};

const useReview: (cacheId: string) => UseReview<Review, any, any> = useReviewFactory<Review, any, any>(params);

export default useReview;
export default useReviewFactory<Review, any, any>(params);
7 changes: 2 additions & 5 deletions packages/boilerplate/composables/src/useUser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import {
Context,
CustomQuery,
useUserFactory,
UseUserFactoryParams
} from '@vue-storefront/core';
Expand All @@ -12,7 +11,7 @@ import { User } from '../types';

const params: UseUserFactoryParams<User, any, any> = {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
loadUser: async (context: Context, customQuery?: CustomQuery) => {
load: async (context: Context) => {
console.log('Mocked: loadUser');
return {};
},
Expand Down Expand Up @@ -47,6 +46,4 @@ const params: UseUserFactoryParams<User, any, any> = {
}
};

const { useUser } = useUserFactory<User, any, any>(params);

export default useUser;
export default useUserFactory<User, any, any>(params);
6 changes: 2 additions & 4 deletions packages/boilerplate/composables/src/useUserBilling/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const params: UseUserBillingFactoryParams<any, any> = {
return Promise.resolve(billing);
},

setDefault: async (context: Context, params?) => {
setDefaultAddress: async (context: Context, params?) => {
console.log('Mocked: setDefault');
const isDefault = id => addresses[0].id === id;

Expand All @@ -134,6 +134,4 @@ const params: UseUserBillingFactoryParams<any, any> = {
}
};

const { useUserBilling } = useUserBillingFactory<any, any>(params);

export default useUserBilling;
export default useUserBillingFactory<any, any>(params);
13 changes: 5 additions & 8 deletions packages/boilerplate/composables/src/useUserOrders/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
import {
Context,
useUserOrdersFactory,
UseUserOrdersFactoryParams,
OrdersSearchResult
UseUserOrdersFactoryParams
} from '@vue-storefront/core';
import { Order, OrderSearchParams } from '../types';
import { OrdersResponse, OrderSearchParams } from '../types';

// @todo userOrders

const params: UseUserOrdersFactoryParams<Order, OrderSearchParams> = {
const params: UseUserOrdersFactoryParams<OrdersResponse, OrderSearchParams> = {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
searchOrders: async (context: Context, params: OrderSearchParams = {}): Promise<OrdersSearchResult<Order>> => {
searchOrders: async (context: Context, params: OrderSearchParams = {}): Promise<OrdersResponse> => {
console.log('Mocked: searchOrders');

return {
Expand All @@ -22,6 +21,4 @@ const params: UseUserOrdersFactoryParams<Order, OrderSearchParams> = {
}
};

const useUserOrders: () => any = useUserOrdersFactory<Order, OrderSearchParams>(params);

export default useUserOrders;
export default useUserOrdersFactory<OrdersResponse, OrderSearchParams>(params);
6 changes: 2 additions & 4 deletions packages/boilerplate/composables/src/useUserShipping/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const params: UseUserShippingFactoryParams<any, any> = {
return Promise.resolve(shipping);
},

setDefault: async (context: Context, params?) => {
setDefaultAddress: async (context: Context, params?) => {
console.log('Mocked: setDefault');
const isDefault = id => addresses[0].id === id;

Expand All @@ -134,6 +134,4 @@ const params: UseUserShippingFactoryParams<any, any> = {
}
};

const { useUserShipping } = useUserShippingFactory<any, any>(params);

export default useUserShipping;
export default useUserShippingFactory<any, any>(params);
12 changes: 5 additions & 7 deletions packages/boilerplate/composables/src/useWishlist/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@ export const wishlist: Ref<Wishlist> = ref(null);

const params: UseWishlistFactoryParams<Wishlist, WishlistProduct, Product> = {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
loadWishlist: async (context: Context) => {
load: async (context: Context) => {
console.log('Mocked: loadWishlist');
return {};
},

// eslint-disable-next-line @typescript-eslint/no-unused-vars
addToWishlist: async (context: Context, { currentWishlist, product }) => {
addItem: async (context: Context, { currentWishlist, product }) => {
console.log('Mocked: addToWishlist');
return {};
},

// eslint-disable-next-line @typescript-eslint/no-unused-vars
removeFromWishlist: async (context: Context, { currentWishlist, product }) => {
removeItem: async (context: Context, { currentWishlist, product }) => {
console.log('Mocked: removeFromWishlist');
return {};
},

// eslint-disable-next-line @typescript-eslint/no-unused-vars
clearWishlist: async (context: Context, { currentWishlist }) => {
clear: async (context: Context, { currentWishlist }) => {
console.log('Mocked: clearWishlist');
return {};
},
Expand All @@ -41,6 +41,4 @@ const params: UseWishlistFactoryParams<Wishlist, WishlistProduct, Product> = {
}
};

const {setWishlist, useWishlist } = useWishlistFactory<Wishlist, WishlistProduct, Product>(params);

export { setWishlist, useWishlist};
export default useWishlistFactory<Wishlist, WishlistProduct, Product>(params);
27 changes: 17 additions & 10 deletions packages/boilerplate/theme/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,29 @@ export default {
title: 'Vue Storefront',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport',
content: 'width=device-width, initial-scale=1' },
{ hid: 'description',
name: 'description',
content: process.env.npm_package_description || '' }
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
],
link: [
{ rel: 'icon',
type: 'image/x-icon',
href: '/favicon.ico'
}, {
},
{
rel: 'preconnect',
href: 'https://fonts.googleapis.com'
}, {
rel: 'preconnect',
href: 'https://fonts.gstatic.com'
href: 'https://fonts.gstatic.com',
crossorigin: 'crossorigin'
},
{
rel: 'preload',
href: 'https://fonts.googleapis.com/css?family=Raleway:300,400,400i,500,600,700|Roboto:300,300i,400,400i,500,700&display=swap',
as: 'style'
},
{
rel: 'stylesheet',
href: 'https://fonts.googleapis.com/css?family=Raleway:300,400,400i,500,600,700|Roboto:300,300i,400,400i,500,700&display=swap',
media: 'print',
onload: 'this.media=\'all\''
}
]
},
Expand Down
Loading

0 comments on commit d8bd197

Please sign in to comment.