Skip to content

Commit

Permalink
fix: conflict resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
justyna-13 committed Jan 4, 2021
2 parents 014c92a + d40c163 commit 0cccfa8
Show file tree
Hide file tree
Showing 174 changed files with 4,140 additions and 2,535 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ jobs:
needs: validate_core
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
integration:
# - about-you
Expand Down
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.0.12-lc.16"
"@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.0.12-lc.16"
"@vue-storefront/boilerplate-api": "0.0.1",
"@vue-storefront/core": "^2.1.1-rc.1"
},
"files": [
"lib/**/*"
Expand Down
8 changes: 6 additions & 2 deletions packages/boilerplate/composables/src/getters/cartGetters.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CartGetters, AgnosticPrice, AgnosticTotals, AgnosticCoupon } from '@vue-storefront/core';
import { CartGetters, AgnosticPrice, AgnosticTotals, AgnosticCoupon, AgnosticDiscount } from '@vue-storefront/core';
import { Cart, LineItem } from '@vue-storefront/boilerplate-api/src/types';

// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down Expand Up @@ -65,6 +65,9 @@ export const getFormattedPrice = (price: number) => String(price);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const getCoupons = (cart: Cart): AgnosticCoupon[] => [];

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const getDiscounts = (cart: Cart): AgnosticDiscount[] => [];

const cartGetters: CartGetters<Cart, LineItem> = {
getTotals: getCartTotals,
getShippingPrice: getCartShippingPrice,
Expand All @@ -77,7 +80,8 @@ const cartGetters: CartGetters<Cart, LineItem> = {
getItemSku: getCartItemSku,
getFormattedPrice: getFormattedPrice,
getTotalItems: getCartTotalItems,
getCoupons
getCoupons,
getDiscounts
};

export default cartGetters;
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);

0 comments on commit 0cccfa8

Please sign in to comment.