Skip to content

Commit

Permalink
Merge pull request #18 from vuestorefront-community/dev
Browse files Browse the repository at this point in the history
chore: release version 1.1.1
  • Loading branch information
odranoelBR authored Feb 15, 2022
2 parents d9a2ca3 + 5c4bf1f commit c6dc8e9
Show file tree
Hide file tree
Showing 19 changed files with 50 additions and 35 deletions.
2 changes: 1 addition & 1 deletion packages/api-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue-storefront/odoo-api",
"version": "1.1.0",
"version": "1.1.1",
"private": false,
"sideEffects": false,
"server": "server/index.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/composables/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue-storefront/odoo",
"version": "1.1.0",
"version": "1.1.1",
"private": false,
"sideEffects": false,
"main": "lib/index.cjs.js",
Expand All @@ -19,7 +19,7 @@
"dependencies": {
"@nuxtjs/composition-api": "0.31.0",
"@vue-storefront/core": "2.5.4",
"@vue-storefront/odoo-api": "1.1.0"
"@vue-storefront/odoo-api": "1.1.1"
},
"peerDependencies": {
"@vue/composition-api": "1.2.4"
Expand Down
4 changes: 1 addition & 3 deletions packages/composables/src/composables/getters/cartGetters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ export const getCartItemName = (orderLine: OrderLine): string =>
orderLine?.product.displayName || 'Product\'s name';

export const getCartItemImage = (orderLine: OrderLine): string => {
const { $config } = useContext();

return `${$config.baseURL}${orderLine?.product?.image?.replace('/', '')}`;
return orderLine?.product?.image || '';
};

export const getCartItemPrice = (orderLine: OrderLine): AgnosticPrice => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const getGrouped = (
const formatedAttribute = searchData?.data?.attributes.map((attribute) => ({
id: String(attribute.id),
label: attribute.name,
type: attribute.displayType,
count: 0,
options: attribute.values.map((value) => ({
type: '',
Expand Down
10 changes: 3 additions & 7 deletions packages/composables/src/composables/getters/productGetters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import {
Attribute
} from '@vue-storefront/odoo-api';

import { useContext } from '@nuxtjs/composition-api';

type ProductFilters = any;

export const getProductName = (product: Product): string =>
Expand All @@ -37,12 +35,11 @@ export const getProductGallery = (
): AgnosticMediaGalleryItem[] => {
const images: AgnosticMediaGalleryItem[] = [];

const { $config } = useContext();
const normal = `${$config.baseURL}${product?.realProduct?.product?.image?.replace('/', '') || product?.image?.replace('/', '') || ''}`;
const normal = product?.realProduct?.product?.image || product?.image || '';
const big = normal;

images.push({
small: `${$config.baseURL}${product?.smallImage?.replace('/', '') || ''}`,
small: `${product?.smallImage?.replace('/', '') || ''}`,
big,
normal
});
Expand All @@ -51,9 +48,8 @@ export const getProductGallery = (
};

export const getProductCoverImage = (product: Product): string => {
const { $config } = useContext();

return `${$config.baseURL}${product.image?.replace('/', '')}`;
return product?.image || '';
};

export const getProductSku = (product: Product): string => product.sku;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ export const getWishlistItemName = (wishlistItem: WishlistItem): string =>

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const getWishlistItemImage = (wishlistItem: WishlistItem): string => {
const { $config } = useContext();

return `${$config.baseURL}${wishlistItem?.product?.image?.replace('/', '')}`;
return wishlistItem?.product?.image || '';
};

// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const attributesFormatedForCategory = [
id: '2',
label: 'Color',
count: 0,
type: 'color',
options: [
{ type: '', id: '2-3', value: 3, label: 'White', metadata: '2-3' },
{ type: '', id: '2-4', value: 4, label: 'Black', metadata: '2-4' },
Expand All @@ -35,6 +36,7 @@ export const attributesFormatedForCategory = [
id: '4',
label: 'Size',
count: 0,
type: 'select',
options: [
{ type: '', id: '4-8', value: 8, label: 'One Size', metadata: '4-8' },
{ type: '', id: '4-9', value: 9, label: '5', metadata: '4-9' },
Expand Down Expand Up @@ -71,6 +73,7 @@ export const attributesFormatedForCategory = [
id: '5',
label: 'Material',
count: 0,
type: 'radio',
options: [
{ type: '', id: '5-37', value: 37, label: 'Cotton', metadata: '5-37' }
]
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/components/CartSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
data-cy="collected-product-cart-sidebar"
v-for="product in products"
:key="cartGetters.getItemSku(product)"
:image="cartGetters.getItemImage(product)"
:image="$image(cartGetters.getItemImage(product))"
:title="cartGetters.getItemName(product)"
:regular-price="
$n(cartGetters.getItemPrice(product).regular, 'currency')
Expand Down
6 changes: 3 additions & 3 deletions packages/theme/components/WishlistSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<SfCollectedProduct
v-for="product in products"
:key="wishlistGetters.getItemSku(product)"
:image="wishlistGetters.getItemImage(product)"
:image="$image(wishlistGetters.getItemImage(product))"
:title="wishlistGetters.getItemName(product)"
:regular-price="
$n(wishlistGetters.getItemPrice(product).regular, 'currency')
Expand All @@ -40,8 +40,8 @@
"
:stock="99999"
:link="localePath(getLocalPathFromWishListItem(product))"
image-width="180"
image-height="200"
:image-width="180"
:image-height="200"
@click:remove="removeItem({ product })"
class="collected-product"
>
Expand Down
7 changes: 4 additions & 3 deletions packages/theme/composables/useUiHelpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable camelcase */
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck

import { useRoute, useRouter } from '@nuxtjs/composition-api';
import { Category } from '@vue-storefront/odoo-api/server';
Expand All @@ -20,17 +21,17 @@ const useUiHelpers = (): any => {
if (!queryParamsNotFilters.includes(filterKey)) {
console.log(query);

// filters.push(query[filterKey]);
filters.push(query[filterKey]);
}
});

filters = filters.map((filter) => filter.split(',')).flat();
}

const pageSize = 10;
// query.itemsPerPage ? parseInt(query.itemsPerPage) : 10;
query.itemsPerPage ? parseInt(query.itemsPerPage) : 10;
const sort = '1' as any;
// query?.sort?.split(',') || [];
query?.sort?.split(',') || [];
const page = query?.page || 1;
const categoryId = parseInt(params.slug_3) || parseInt(params.slug_2);

Expand Down
5 changes: 2 additions & 3 deletions packages/theme/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default {
'Apply': 'Apply',
'Back to homepage': 'Back to homepage',
'Billing address': 'Billing address',
'Billing': 'Billing',
'Brand': 'Brand',
'Cancel': 'Cancel',
'Categories': 'Categories',
Expand Down Expand Up @@ -89,7 +88,6 @@ export default {
'Privacy': 'Privacy',
'Product suggestions': 'Product suggestions',
'Product': 'Product',
'Product description': 'Product description',
'Products found': 'Products found',
'Products': 'Products',
'Purchase terms': 'Purchase terms',
Expand All @@ -113,7 +111,7 @@ export default {
'Set up newsletter': 'Set up your newsletter and we will send you information about new products and trends from the sections you selected every week.',
'Share your look': 'Share your look',
'Shipping address': 'Shipping address',
'Shipping Details': 'Shipping Details',
'Shipping details': 'Shipping details',
'Shipping method': 'Shipping method',
'Shipping': 'Shipping',
'Show on page': 'Show on page',
Expand Down Expand Up @@ -141,6 +139,7 @@ export default {
'You haven’t searched for items yet': 'You haven’t searched for items yet.',
'Your bag is empty': 'Your bag is empty',
'Your current email address is': 'Your current email address is',
'Product description': 'Product description',
'Sorry, we didnt find what youre looking for': 'Sorry, we didn\'t find what you\'re looking for.',
'Enter your email to receive instructions on how to reset your password': 'Enter your email to receive instructions on how to reset your password',
'Enter your email to receive instructions on how to reset your password': 'Enter your email to receive instructions on how to reset your password',
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/middleware.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const odooBaseUrl = process.env.BASE_URL || 'https://vsfdemo.labs.odoogap.com';
const odooBaseUrl = process.env.BACKEND_BASE_URL || process.env.BASE_URL || 'https://vsfdemo.labs.odoogap.com/';
const graphqlBaseUrl = `${odooBaseUrl}graphql/vsf`;

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default {
}
},
loading: { color: '#fff' },
plugins: [],
plugins: ['~/plugins/getImage.ts'],
serverMiddleware: [
// Server-side redirects
'~/serverMiddleware/redirects'
Expand Down
4 changes: 2 additions & 2 deletions packages/theme/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue-storefront/odoo-theme",
"version": "1.1.0",
"version": "1.1.1",
"private": true,
"scripts": {
"build": "nuxt build -m --dotenv .env_production",
Expand All @@ -25,7 +25,7 @@
"@vue-storefront/middleware": "2.5.4",
"@vue-storefront/nuxt": "2.5.4",
"@vue-storefront/nuxt-theme": "2.5.4",
"@vue-storefront/odoo": "1.1.0",
"@vue-storefront/odoo": "1.1.1",
"cookie-universal-nuxt": "^2.1.3",
"core-js": "^2.6.5",
"nuxt": "2.15.6",
Expand Down
4 changes: 2 additions & 2 deletions packages/theme/pages/Category.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
:imageWidth="216"
:imageHeight="288"
:title="productGetters.getName(product)"
:image="productGetters.getCoverImage(product)"
:image="$image(productGetters.getCoverImage(product))"
:nuxtImgConfig="{ fit: 'cover' }"
image-tag="nuxt-img"
:regular-price="
Expand Down Expand Up @@ -202,7 +202,7 @@
image-tag="nuxt-img"
:title="productGetters.getName(product)"
:description="productGetters.getDescription(product)"
:image="productGetters.getCoverImage(product)"
:image="$image(productGetters.getCoverImage(product))"
:regular-price="
$n(productGetters.getPrice(product).regular, 'currency')
"
Expand Down
6 changes: 3 additions & 3 deletions packages/theme/pages/Product.vue
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,9 @@ export default {
const productGallery = computed(() =>
productGetters.getGallery(product.value).map((img) => ({
mobile: { url: img.small },
desktop: { url: img.normal },
big: { url: img.big },
mobile: { url: root.$image(img.small) },
desktop: { url: root.$image(img.normal) },
big: { url: root.$image(img.big) },
alt: product.value.name || 'alt'
}))
);
Expand Down
7 changes: 7 additions & 0 deletions packages/theme/plugins/getImage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
export default ({ app }, inject) => {
const getImage = (imagePath: string) => {
return `${app.$config.baseURL}${imagePath?.replace('/', '')}`;
};
inject('image', getImage);
};
Loading

0 comments on commit c6dc8e9

Please sign in to comment.