diff --git a/packages/api-client/package.json b/packages/api-client/package.json index 2ab041ec..f2e88dff 100644 --- a/packages/api-client/package.json +++ b/packages/api-client/package.json @@ -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", diff --git a/packages/composables/package.json b/packages/composables/package.json index 21aa48e2..aa99122d 100644 --- a/packages/composables/package.json +++ b/packages/composables/package.json @@ -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", @@ -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" diff --git a/packages/composables/src/composables/getters/cartGetters.ts b/packages/composables/src/composables/getters/cartGetters.ts index 0953eb33..4ff1a6a9 100644 --- a/packages/composables/src/composables/getters/cartGetters.ts +++ b/packages/composables/src/composables/getters/cartGetters.ts @@ -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 => { diff --git a/packages/composables/src/composables/getters/facetGetters.ts b/packages/composables/src/composables/getters/facetGetters.ts index f481eaa4..ae4f5116 100644 --- a/packages/composables/src/composables/getters/facetGetters.ts +++ b/packages/composables/src/composables/getters/facetGetters.ts @@ -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: '', diff --git a/packages/composables/src/composables/getters/productGetters.ts b/packages/composables/src/composables/getters/productGetters.ts index db826f46..25c453ae 100644 --- a/packages/composables/src/composables/getters/productGetters.ts +++ b/packages/composables/src/composables/getters/productGetters.ts @@ -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 => @@ -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 }); @@ -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; diff --git a/packages/composables/src/composables/getters/wishlistGetters.ts b/packages/composables/src/composables/getters/wishlistGetters.ts index cf774c49..501f3181 100644 --- a/packages/composables/src/composables/getters/wishlistGetters.ts +++ b/packages/composables/src/composables/getters/wishlistGetters.ts @@ -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 diff --git a/packages/composables/test/jest/__tests__/__mocks__/productAttributesFormated.ts b/packages/composables/test/jest/__tests__/__mocks__/productAttributesFormated.ts index 8c39d354..8555dbbb 100644 --- a/packages/composables/test/jest/__tests__/__mocks__/productAttributesFormated.ts +++ b/packages/composables/test/jest/__tests__/__mocks__/productAttributesFormated.ts @@ -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' }, @@ -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' }, @@ -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' } ] diff --git a/packages/theme/components/CartSidebar.vue b/packages/theme/components/CartSidebar.vue index 4b0d2724..772118c8 100644 --- a/packages/theme/components/CartSidebar.vue +++ b/packages/theme/components/CartSidebar.vue @@ -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') diff --git a/packages/theme/components/WishlistSidebar.vue b/packages/theme/components/WishlistSidebar.vue index 11326288..f27ac0ab 100644 --- a/packages/theme/components/WishlistSidebar.vue +++ b/packages/theme/components/WishlistSidebar.vue @@ -29,7 +29,7 @@ diff --git a/packages/theme/composables/useUiHelpers/index.ts b/packages/theme/composables/useUiHelpers/index.ts index ad3ced61..027b0f0c 100644 --- a/packages/theme/composables/useUiHelpers/index.ts +++ b/packages/theme/composables/useUiHelpers/index.ts @@ -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'; @@ -20,7 +21,7 @@ const useUiHelpers = (): any => { if (!queryParamsNotFilters.includes(filterKey)) { console.log(query); - // filters.push(query[filterKey]); + filters.push(query[filterKey]); } }); @@ -28,9 +29,9 @@ const useUiHelpers = (): any => { } 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); diff --git a/packages/theme/lang/en.js b/packages/theme/lang/en.js index 04e9a566..abaa5df0 100644 --- a/packages/theme/lang/en.js +++ b/packages/theme/lang/en.js @@ -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', @@ -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', @@ -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', @@ -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', diff --git a/packages/theme/middleware.config.js b/packages/theme/middleware.config.js index c2d8b7e8..0db50ff7 100644 --- a/packages/theme/middleware.config.js +++ b/packages/theme/middleware.config.js @@ -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 = { diff --git a/packages/theme/nuxt.config.js b/packages/theme/nuxt.config.js index c31713a5..a0462159 100644 --- a/packages/theme/nuxt.config.js +++ b/packages/theme/nuxt.config.js @@ -56,7 +56,7 @@ export default { } }, loading: { color: '#fff' }, - plugins: [], + plugins: ['~/plugins/getImage.ts'], serverMiddleware: [ // Server-side redirects '~/serverMiddleware/redirects' diff --git a/packages/theme/package.json b/packages/theme/package.json index 5500f308..f9a35e3e 100644 --- a/packages/theme/package.json +++ b/packages/theme/package.json @@ -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", @@ -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", diff --git a/packages/theme/pages/Category.vue b/packages/theme/pages/Category.vue index 229204b3..973fc5e9 100644 --- a/packages/theme/pages/Category.vue +++ b/packages/theme/pages/Category.vue @@ -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=" @@ -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') " diff --git a/packages/theme/pages/Product.vue b/packages/theme/pages/Product.vue index 37c97732..49f6d04d 100644 --- a/packages/theme/pages/Product.vue +++ b/packages/theme/pages/Product.vue @@ -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' })) ); diff --git a/packages/theme/plugins/getImage.ts b/packages/theme/plugins/getImage.ts new file mode 100644 index 00000000..a433d41c --- /dev/null +++ b/packages/theme/plugins/getImage.ts @@ -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); +}; diff --git a/packages/theme/static/icons/empty-cart.svg b/packages/theme/static/icons/empty-cart.svg new file mode 100644 index 00000000..f01dac97 --- /dev/null +++ b/packages/theme/static/icons/empty-cart.svg @@ -0,0 +1 @@ + diff --git a/packages/theme/static/icons/google.svg b/packages/theme/static/icons/google.svg new file mode 100644 index 00000000..5736069e --- /dev/null +++ b/packages/theme/static/icons/google.svg @@ -0,0 +1,11 @@ + + + + + + + + + + +