From 61a52f79fa507384c04c05a133c2a4e14b7bbb92 Mon Sep 17 00:00:00 2001 From: Heitor Ramon Ribeiro Date: Fri, 7 May 2021 14:31:35 -0300 Subject: [PATCH 1/2] refactor: upsell and related products listing and product labeling (#44) * refactor(api-client): updated upsell and related products query * refactor(composeables): added html decoder for magento data * refactor(theme): fixed ProfileUpdateForm.vue modal not closing * refactor(api-client): removed fragments from related products and upsell --- .../relatedProductQuery.graphql | 60 +- .../upsellProduct/upsellProductsQuery.graphql | 60 +- packages/api-client/src/types/GraphQL.ts | 532 +++++++++++++++++- .../composables/getters/categoryGetters.ts | 3 +- .../src/composables/getters/productGetters.ts | 3 +- .../composables/src/helpers/htmlDecoder.ts | 9 + .../MyAccount/ProfileUpdateForm.vue | 2 + 7 files changed, 643 insertions(+), 26 deletions(-) create mode 100644 packages/composables/src/helpers/htmlDecoder.ts diff --git a/packages/api-client/src/api/relatedProduct/relatedProductQuery.graphql b/packages/api-client/src/api/relatedProduct/relatedProductQuery.graphql index 0957224ba..691e6c692 100644 --- a/packages/api-client/src/api/relatedProduct/relatedProductQuery.graphql +++ b/packages/api-client/src/api/relatedProduct/relatedProductQuery.graphql @@ -1,10 +1,60 @@ -#import "../../fragments/productFragment.graphql" - -query relatedProduct($search: String = "", $filter: ProductAttributeFilterInput, $pageSize: Int = 20, $currentPage: Int = 1, $sort: ProductAttributeSortInput) { - products(search: $search, filter: $filter, sort: $sort, pageSize: $pageSize, currentPage: $currentPage) { +query relatedProduct( + $search: String = "" + $filter: ProductAttributeFilterInput + $pageSize: Int = 20 + $currentPage: Int = 1 + $sort: ProductAttributeSortInput +) { + products( + search: $search + filter: $filter + sort: $sort + pageSize: $pageSize + currentPage: $currentPage + ) { items { related_products { - ...ProductData + uid + __typename + sku + name + new + stock_status + only_x_left_in_stock + rating_summary + sale + thumbnail { + url + position + disabled + label + } + price_range { + minimum_price { + final_price { + currency + value + } + regular_price { + currency + value + } + } + } + url_key + url_rewrites { + url + } + categories { + uid + name + url_suffix + url_path + breadcrumbs { + category_name + category_url_path + } + } } uid } diff --git a/packages/api-client/src/api/upsellProduct/upsellProductsQuery.graphql b/packages/api-client/src/api/upsellProduct/upsellProductsQuery.graphql index db1b12284..16c70ca2c 100644 --- a/packages/api-client/src/api/upsellProduct/upsellProductsQuery.graphql +++ b/packages/api-client/src/api/upsellProduct/upsellProductsQuery.graphql @@ -1,10 +1,60 @@ -#import "../../fragments/productFragment.graphql" - -query upsellProducts($search: String = "", $filter: ProductAttributeFilterInput, $pageSize: Int = 20, $currentPage: Int = 1, $sort: ProductAttributeSortInput) { - products(search: $search, filter: $filter, sort: $sort, pageSize: $pageSize, currentPage: $currentPage) { +query upsellProducts( + $search: String = "" + $filter: ProductAttributeFilterInput + $pageSize: Int = 20 + $currentPage: Int = 1 + $sort: ProductAttributeSortInput +) { + products( + search: $search + filter: $filter + sort: $sort + pageSize: $pageSize + currentPage: $currentPage + ){ items { upsell_products { - ...ProductData + uid + __typename + sku + name + new + stock_status + only_x_left_in_stock + rating_summary + sale + thumbnail { + url + position + disabled + label + } + price_range { + minimum_price { + final_price { + currency + value + } + regular_price { + currency + value + } + } + } + url_key + url_rewrites { + url + } + categories { + uid + name + url_suffix + url_path + breadcrumbs { + category_name + category_url_path + } + } } uid } diff --git a/packages/api-client/src/types/GraphQL.ts b/packages/api-client/src/types/GraphQL.ts index 9fc65882c..8f4e450fa 100644 --- a/packages/api-client/src/types/GraphQL.ts +++ b/packages/api-client/src/types/GraphQL.ts @@ -6868,11 +6868,11 @@ export type ConfigurableProductDetailQuery = { products?: Maybe<{ items?: Maybe< ) | Pick | Pick | Pick | Pick>>> }> }; export type CreateCustomerMutationVariables = Exact<{ - input: CustomerInput; + input: CustomerCreateInput; }>; -export type CreateCustomerMutation = { createCustomer?: Maybe<{ customer: CustomerDataFragment }> }; +export type CreateCustomerMutation = { createCustomerV2?: Maybe<{ customer: CustomerDataFragment }> }; export type CreateCustomerAddressMutationVariables = Exact<{ input: CustomerAddressInput; @@ -7114,22 +7114,274 @@ export type RelatedProductQueryVariables = Exact<{ export type RelatedProductQuery = { products?: Maybe<{ items?: Maybe - & { related_products?: Maybe>> } + & { related_products?: Maybe + & ProductThumbnailData_BundleProduct_Fragment + & ProductPriceRangeData_BundleProduct_Fragment + & ProductUrlFragmentData_BundleProduct_Fragment + & ProductCategoriesData_BundleProduct_Fragment + ) | ( + { __typename: 'ConfigurableProduct' } + & Pick + & ProductThumbnailData_ConfigurableProduct_Fragment + & ProductPriceRangeData_ConfigurableProduct_Fragment + & ProductUrlFragmentData_ConfigurableProduct_Fragment + & ProductCategoriesData_ConfigurableProduct_Fragment + ) | ( + { __typename: 'DownloadableProduct' } + & Pick + & ProductThumbnailData_DownloadableProduct_Fragment + & ProductPriceRangeData_DownloadableProduct_Fragment + & ProductUrlFragmentData_DownloadableProduct_Fragment + & ProductCategoriesData_DownloadableProduct_Fragment + ) | ( + { __typename: 'GroupedProduct' } + & Pick + & ProductThumbnailData_GroupedProduct_Fragment + & ProductPriceRangeData_GroupedProduct_Fragment + & ProductUrlFragmentData_GroupedProduct_Fragment + & ProductCategoriesData_GroupedProduct_Fragment + ) | ( + { __typename: 'SimpleProduct' } + & Pick + & ProductThumbnailData_SimpleProduct_Fragment + & ProductPriceRangeData_SimpleProduct_Fragment + & ProductUrlFragmentData_SimpleProduct_Fragment + & ProductCategoriesData_SimpleProduct_Fragment + ) | ( + { __typename: 'VirtualProduct' } + & Pick + & ProductThumbnailData_VirtualProduct_Fragment + & ProductPriceRangeData_VirtualProduct_Fragment + & ProductUrlFragmentData_VirtualProduct_Fragment + & ProductCategoriesData_VirtualProduct_Fragment + )>>> } ) | ( Pick - & { related_products?: Maybe>> } + & { related_products?: Maybe + & ProductThumbnailData_BundleProduct_Fragment + & ProductPriceRangeData_BundleProduct_Fragment + & ProductUrlFragmentData_BundleProduct_Fragment + & ProductCategoriesData_BundleProduct_Fragment + ) | ( + { __typename: 'ConfigurableProduct' } + & Pick + & ProductThumbnailData_ConfigurableProduct_Fragment + & ProductPriceRangeData_ConfigurableProduct_Fragment + & ProductUrlFragmentData_ConfigurableProduct_Fragment + & ProductCategoriesData_ConfigurableProduct_Fragment + ) | ( + { __typename: 'DownloadableProduct' } + & Pick + & ProductThumbnailData_DownloadableProduct_Fragment + & ProductPriceRangeData_DownloadableProduct_Fragment + & ProductUrlFragmentData_DownloadableProduct_Fragment + & ProductCategoriesData_DownloadableProduct_Fragment + ) | ( + { __typename: 'GroupedProduct' } + & Pick + & ProductThumbnailData_GroupedProduct_Fragment + & ProductPriceRangeData_GroupedProduct_Fragment + & ProductUrlFragmentData_GroupedProduct_Fragment + & ProductCategoriesData_GroupedProduct_Fragment + ) | ( + { __typename: 'SimpleProduct' } + & Pick + & ProductThumbnailData_SimpleProduct_Fragment + & ProductPriceRangeData_SimpleProduct_Fragment + & ProductUrlFragmentData_SimpleProduct_Fragment + & ProductCategoriesData_SimpleProduct_Fragment + ) | ( + { __typename: 'VirtualProduct' } + & Pick + & ProductThumbnailData_VirtualProduct_Fragment + & ProductPriceRangeData_VirtualProduct_Fragment + & ProductUrlFragmentData_VirtualProduct_Fragment + & ProductCategoriesData_VirtualProduct_Fragment + )>>> } ) | ( Pick - & { related_products?: Maybe>> } + & { related_products?: Maybe + & ProductThumbnailData_BundleProduct_Fragment + & ProductPriceRangeData_BundleProduct_Fragment + & ProductUrlFragmentData_BundleProduct_Fragment + & ProductCategoriesData_BundleProduct_Fragment + ) | ( + { __typename: 'ConfigurableProduct' } + & Pick + & ProductThumbnailData_ConfigurableProduct_Fragment + & ProductPriceRangeData_ConfigurableProduct_Fragment + & ProductUrlFragmentData_ConfigurableProduct_Fragment + & ProductCategoriesData_ConfigurableProduct_Fragment + ) | ( + { __typename: 'DownloadableProduct' } + & Pick + & ProductThumbnailData_DownloadableProduct_Fragment + & ProductPriceRangeData_DownloadableProduct_Fragment + & ProductUrlFragmentData_DownloadableProduct_Fragment + & ProductCategoriesData_DownloadableProduct_Fragment + ) | ( + { __typename: 'GroupedProduct' } + & Pick + & ProductThumbnailData_GroupedProduct_Fragment + & ProductPriceRangeData_GroupedProduct_Fragment + & ProductUrlFragmentData_GroupedProduct_Fragment + & ProductCategoriesData_GroupedProduct_Fragment + ) | ( + { __typename: 'SimpleProduct' } + & Pick + & ProductThumbnailData_SimpleProduct_Fragment + & ProductPriceRangeData_SimpleProduct_Fragment + & ProductUrlFragmentData_SimpleProduct_Fragment + & ProductCategoriesData_SimpleProduct_Fragment + ) | ( + { __typename: 'VirtualProduct' } + & Pick + & ProductThumbnailData_VirtualProduct_Fragment + & ProductPriceRangeData_VirtualProduct_Fragment + & ProductUrlFragmentData_VirtualProduct_Fragment + & ProductCategoriesData_VirtualProduct_Fragment + )>>> } ) | ( Pick - & { related_products?: Maybe>> } + & { related_products?: Maybe + & ProductThumbnailData_BundleProduct_Fragment + & ProductPriceRangeData_BundleProduct_Fragment + & ProductUrlFragmentData_BundleProduct_Fragment + & ProductCategoriesData_BundleProduct_Fragment + ) | ( + { __typename: 'ConfigurableProduct' } + & Pick + & ProductThumbnailData_ConfigurableProduct_Fragment + & ProductPriceRangeData_ConfigurableProduct_Fragment + & ProductUrlFragmentData_ConfigurableProduct_Fragment + & ProductCategoriesData_ConfigurableProduct_Fragment + ) | ( + { __typename: 'DownloadableProduct' } + & Pick + & ProductThumbnailData_DownloadableProduct_Fragment + & ProductPriceRangeData_DownloadableProduct_Fragment + & ProductUrlFragmentData_DownloadableProduct_Fragment + & ProductCategoriesData_DownloadableProduct_Fragment + ) | ( + { __typename: 'GroupedProduct' } + & Pick + & ProductThumbnailData_GroupedProduct_Fragment + & ProductPriceRangeData_GroupedProduct_Fragment + & ProductUrlFragmentData_GroupedProduct_Fragment + & ProductCategoriesData_GroupedProduct_Fragment + ) | ( + { __typename: 'SimpleProduct' } + & Pick + & ProductThumbnailData_SimpleProduct_Fragment + & ProductPriceRangeData_SimpleProduct_Fragment + & ProductUrlFragmentData_SimpleProduct_Fragment + & ProductCategoriesData_SimpleProduct_Fragment + ) | ( + { __typename: 'VirtualProduct' } + & Pick + & ProductThumbnailData_VirtualProduct_Fragment + & ProductPriceRangeData_VirtualProduct_Fragment + & ProductUrlFragmentData_VirtualProduct_Fragment + & ProductCategoriesData_VirtualProduct_Fragment + )>>> } ) | ( Pick - & { related_products?: Maybe>> } + & { related_products?: Maybe + & ProductThumbnailData_BundleProduct_Fragment + & ProductPriceRangeData_BundleProduct_Fragment + & ProductUrlFragmentData_BundleProduct_Fragment + & ProductCategoriesData_BundleProduct_Fragment + ) | ( + { __typename: 'ConfigurableProduct' } + & Pick + & ProductThumbnailData_ConfigurableProduct_Fragment + & ProductPriceRangeData_ConfigurableProduct_Fragment + & ProductUrlFragmentData_ConfigurableProduct_Fragment + & ProductCategoriesData_ConfigurableProduct_Fragment + ) | ( + { __typename: 'DownloadableProduct' } + & Pick + & ProductThumbnailData_DownloadableProduct_Fragment + & ProductPriceRangeData_DownloadableProduct_Fragment + & ProductUrlFragmentData_DownloadableProduct_Fragment + & ProductCategoriesData_DownloadableProduct_Fragment + ) | ( + { __typename: 'GroupedProduct' } + & Pick + & ProductThumbnailData_GroupedProduct_Fragment + & ProductPriceRangeData_GroupedProduct_Fragment + & ProductUrlFragmentData_GroupedProduct_Fragment + & ProductCategoriesData_GroupedProduct_Fragment + ) | ( + { __typename: 'SimpleProduct' } + & Pick + & ProductThumbnailData_SimpleProduct_Fragment + & ProductPriceRangeData_SimpleProduct_Fragment + & ProductUrlFragmentData_SimpleProduct_Fragment + & ProductCategoriesData_SimpleProduct_Fragment + ) | ( + { __typename: 'VirtualProduct' } + & Pick + & ProductThumbnailData_VirtualProduct_Fragment + & ProductPriceRangeData_VirtualProduct_Fragment + & ProductUrlFragmentData_VirtualProduct_Fragment + & ProductCategoriesData_VirtualProduct_Fragment + )>>> } ) | ( Pick - & { related_products?: Maybe>> } + & { related_products?: Maybe + & ProductThumbnailData_BundleProduct_Fragment + & ProductPriceRangeData_BundleProduct_Fragment + & ProductUrlFragmentData_BundleProduct_Fragment + & ProductCategoriesData_BundleProduct_Fragment + ) | ( + { __typename: 'ConfigurableProduct' } + & Pick + & ProductThumbnailData_ConfigurableProduct_Fragment + & ProductPriceRangeData_ConfigurableProduct_Fragment + & ProductUrlFragmentData_ConfigurableProduct_Fragment + & ProductCategoriesData_ConfigurableProduct_Fragment + ) | ( + { __typename: 'DownloadableProduct' } + & Pick + & ProductThumbnailData_DownloadableProduct_Fragment + & ProductPriceRangeData_DownloadableProduct_Fragment + & ProductUrlFragmentData_DownloadableProduct_Fragment + & ProductCategoriesData_DownloadableProduct_Fragment + ) | ( + { __typename: 'GroupedProduct' } + & Pick + & ProductThumbnailData_GroupedProduct_Fragment + & ProductPriceRangeData_GroupedProduct_Fragment + & ProductUrlFragmentData_GroupedProduct_Fragment + & ProductCategoriesData_GroupedProduct_Fragment + ) | ( + { __typename: 'SimpleProduct' } + & Pick + & ProductThumbnailData_SimpleProduct_Fragment + & ProductPriceRangeData_SimpleProduct_Fragment + & ProductUrlFragmentData_SimpleProduct_Fragment + & ProductCategoriesData_SimpleProduct_Fragment + ) | ( + { __typename: 'VirtualProduct' } + & Pick + & ProductThumbnailData_VirtualProduct_Fragment + & ProductPriceRangeData_VirtualProduct_Fragment + & ProductUrlFragmentData_VirtualProduct_Fragment + & ProductCategoriesData_VirtualProduct_Fragment + )>>> } )>>> }> }; export type RemoveCouponFromCartMutationVariables = Exact<{ @@ -7236,22 +7488,274 @@ export type UpsellProductsQueryVariables = Exact<{ export type UpsellProductsQuery = { products?: Maybe<{ items?: Maybe - & { upsell_products?: Maybe>> } + & { upsell_products?: Maybe + & ProductThumbnailData_BundleProduct_Fragment + & ProductPriceRangeData_BundleProduct_Fragment + & ProductUrlFragmentData_BundleProduct_Fragment + & ProductCategoriesData_BundleProduct_Fragment + ) | ( + { __typename: 'ConfigurableProduct' } + & Pick + & ProductThumbnailData_ConfigurableProduct_Fragment + & ProductPriceRangeData_ConfigurableProduct_Fragment + & ProductUrlFragmentData_ConfigurableProduct_Fragment + & ProductCategoriesData_ConfigurableProduct_Fragment + ) | ( + { __typename: 'DownloadableProduct' } + & Pick + & ProductThumbnailData_DownloadableProduct_Fragment + & ProductPriceRangeData_DownloadableProduct_Fragment + & ProductUrlFragmentData_DownloadableProduct_Fragment + & ProductCategoriesData_DownloadableProduct_Fragment + ) | ( + { __typename: 'GroupedProduct' } + & Pick + & ProductThumbnailData_GroupedProduct_Fragment + & ProductPriceRangeData_GroupedProduct_Fragment + & ProductUrlFragmentData_GroupedProduct_Fragment + & ProductCategoriesData_GroupedProduct_Fragment + ) | ( + { __typename: 'SimpleProduct' } + & Pick + & ProductThumbnailData_SimpleProduct_Fragment + & ProductPriceRangeData_SimpleProduct_Fragment + & ProductUrlFragmentData_SimpleProduct_Fragment + & ProductCategoriesData_SimpleProduct_Fragment + ) | ( + { __typename: 'VirtualProduct' } + & Pick + & ProductThumbnailData_VirtualProduct_Fragment + & ProductPriceRangeData_VirtualProduct_Fragment + & ProductUrlFragmentData_VirtualProduct_Fragment + & ProductCategoriesData_VirtualProduct_Fragment + )>>> } ) | ( Pick - & { upsell_products?: Maybe>> } + & { upsell_products?: Maybe + & ProductThumbnailData_BundleProduct_Fragment + & ProductPriceRangeData_BundleProduct_Fragment + & ProductUrlFragmentData_BundleProduct_Fragment + & ProductCategoriesData_BundleProduct_Fragment + ) | ( + { __typename: 'ConfigurableProduct' } + & Pick + & ProductThumbnailData_ConfigurableProduct_Fragment + & ProductPriceRangeData_ConfigurableProduct_Fragment + & ProductUrlFragmentData_ConfigurableProduct_Fragment + & ProductCategoriesData_ConfigurableProduct_Fragment + ) | ( + { __typename: 'DownloadableProduct' } + & Pick + & ProductThumbnailData_DownloadableProduct_Fragment + & ProductPriceRangeData_DownloadableProduct_Fragment + & ProductUrlFragmentData_DownloadableProduct_Fragment + & ProductCategoriesData_DownloadableProduct_Fragment + ) | ( + { __typename: 'GroupedProduct' } + & Pick + & ProductThumbnailData_GroupedProduct_Fragment + & ProductPriceRangeData_GroupedProduct_Fragment + & ProductUrlFragmentData_GroupedProduct_Fragment + & ProductCategoriesData_GroupedProduct_Fragment + ) | ( + { __typename: 'SimpleProduct' } + & Pick + & ProductThumbnailData_SimpleProduct_Fragment + & ProductPriceRangeData_SimpleProduct_Fragment + & ProductUrlFragmentData_SimpleProduct_Fragment + & ProductCategoriesData_SimpleProduct_Fragment + ) | ( + { __typename: 'VirtualProduct' } + & Pick + & ProductThumbnailData_VirtualProduct_Fragment + & ProductPriceRangeData_VirtualProduct_Fragment + & ProductUrlFragmentData_VirtualProduct_Fragment + & ProductCategoriesData_VirtualProduct_Fragment + )>>> } ) | ( Pick - & { upsell_products?: Maybe>> } + & { upsell_products?: Maybe + & ProductThumbnailData_BundleProduct_Fragment + & ProductPriceRangeData_BundleProduct_Fragment + & ProductUrlFragmentData_BundleProduct_Fragment + & ProductCategoriesData_BundleProduct_Fragment + ) | ( + { __typename: 'ConfigurableProduct' } + & Pick + & ProductThumbnailData_ConfigurableProduct_Fragment + & ProductPriceRangeData_ConfigurableProduct_Fragment + & ProductUrlFragmentData_ConfigurableProduct_Fragment + & ProductCategoriesData_ConfigurableProduct_Fragment + ) | ( + { __typename: 'DownloadableProduct' } + & Pick + & ProductThumbnailData_DownloadableProduct_Fragment + & ProductPriceRangeData_DownloadableProduct_Fragment + & ProductUrlFragmentData_DownloadableProduct_Fragment + & ProductCategoriesData_DownloadableProduct_Fragment + ) | ( + { __typename: 'GroupedProduct' } + & Pick + & ProductThumbnailData_GroupedProduct_Fragment + & ProductPriceRangeData_GroupedProduct_Fragment + & ProductUrlFragmentData_GroupedProduct_Fragment + & ProductCategoriesData_GroupedProduct_Fragment + ) | ( + { __typename: 'SimpleProduct' } + & Pick + & ProductThumbnailData_SimpleProduct_Fragment + & ProductPriceRangeData_SimpleProduct_Fragment + & ProductUrlFragmentData_SimpleProduct_Fragment + & ProductCategoriesData_SimpleProduct_Fragment + ) | ( + { __typename: 'VirtualProduct' } + & Pick + & ProductThumbnailData_VirtualProduct_Fragment + & ProductPriceRangeData_VirtualProduct_Fragment + & ProductUrlFragmentData_VirtualProduct_Fragment + & ProductCategoriesData_VirtualProduct_Fragment + )>>> } ) | ( Pick - & { upsell_products?: Maybe>> } + & { upsell_products?: Maybe + & ProductThumbnailData_BundleProduct_Fragment + & ProductPriceRangeData_BundleProduct_Fragment + & ProductUrlFragmentData_BundleProduct_Fragment + & ProductCategoriesData_BundleProduct_Fragment + ) | ( + { __typename: 'ConfigurableProduct' } + & Pick + & ProductThumbnailData_ConfigurableProduct_Fragment + & ProductPriceRangeData_ConfigurableProduct_Fragment + & ProductUrlFragmentData_ConfigurableProduct_Fragment + & ProductCategoriesData_ConfigurableProduct_Fragment + ) | ( + { __typename: 'DownloadableProduct' } + & Pick + & ProductThumbnailData_DownloadableProduct_Fragment + & ProductPriceRangeData_DownloadableProduct_Fragment + & ProductUrlFragmentData_DownloadableProduct_Fragment + & ProductCategoriesData_DownloadableProduct_Fragment + ) | ( + { __typename: 'GroupedProduct' } + & Pick + & ProductThumbnailData_GroupedProduct_Fragment + & ProductPriceRangeData_GroupedProduct_Fragment + & ProductUrlFragmentData_GroupedProduct_Fragment + & ProductCategoriesData_GroupedProduct_Fragment + ) | ( + { __typename: 'SimpleProduct' } + & Pick + & ProductThumbnailData_SimpleProduct_Fragment + & ProductPriceRangeData_SimpleProduct_Fragment + & ProductUrlFragmentData_SimpleProduct_Fragment + & ProductCategoriesData_SimpleProduct_Fragment + ) | ( + { __typename: 'VirtualProduct' } + & Pick + & ProductThumbnailData_VirtualProduct_Fragment + & ProductPriceRangeData_VirtualProduct_Fragment + & ProductUrlFragmentData_VirtualProduct_Fragment + & ProductCategoriesData_VirtualProduct_Fragment + )>>> } ) | ( Pick - & { upsell_products?: Maybe>> } + & { upsell_products?: Maybe + & ProductThumbnailData_BundleProduct_Fragment + & ProductPriceRangeData_BundleProduct_Fragment + & ProductUrlFragmentData_BundleProduct_Fragment + & ProductCategoriesData_BundleProduct_Fragment + ) | ( + { __typename: 'ConfigurableProduct' } + & Pick + & ProductThumbnailData_ConfigurableProduct_Fragment + & ProductPriceRangeData_ConfigurableProduct_Fragment + & ProductUrlFragmentData_ConfigurableProduct_Fragment + & ProductCategoriesData_ConfigurableProduct_Fragment + ) | ( + { __typename: 'DownloadableProduct' } + & Pick + & ProductThumbnailData_DownloadableProduct_Fragment + & ProductPriceRangeData_DownloadableProduct_Fragment + & ProductUrlFragmentData_DownloadableProduct_Fragment + & ProductCategoriesData_DownloadableProduct_Fragment + ) | ( + { __typename: 'GroupedProduct' } + & Pick + & ProductThumbnailData_GroupedProduct_Fragment + & ProductPriceRangeData_GroupedProduct_Fragment + & ProductUrlFragmentData_GroupedProduct_Fragment + & ProductCategoriesData_GroupedProduct_Fragment + ) | ( + { __typename: 'SimpleProduct' } + & Pick + & ProductThumbnailData_SimpleProduct_Fragment + & ProductPriceRangeData_SimpleProduct_Fragment + & ProductUrlFragmentData_SimpleProduct_Fragment + & ProductCategoriesData_SimpleProduct_Fragment + ) | ( + { __typename: 'VirtualProduct' } + & Pick + & ProductThumbnailData_VirtualProduct_Fragment + & ProductPriceRangeData_VirtualProduct_Fragment + & ProductUrlFragmentData_VirtualProduct_Fragment + & ProductCategoriesData_VirtualProduct_Fragment + )>>> } ) | ( Pick - & { upsell_products?: Maybe>> } + & { upsell_products?: Maybe + & ProductThumbnailData_BundleProduct_Fragment + & ProductPriceRangeData_BundleProduct_Fragment + & ProductUrlFragmentData_BundleProduct_Fragment + & ProductCategoriesData_BundleProduct_Fragment + ) | ( + { __typename: 'ConfigurableProduct' } + & Pick + & ProductThumbnailData_ConfigurableProduct_Fragment + & ProductPriceRangeData_ConfigurableProduct_Fragment + & ProductUrlFragmentData_ConfigurableProduct_Fragment + & ProductCategoriesData_ConfigurableProduct_Fragment + ) | ( + { __typename: 'DownloadableProduct' } + & Pick + & ProductThumbnailData_DownloadableProduct_Fragment + & ProductPriceRangeData_DownloadableProduct_Fragment + & ProductUrlFragmentData_DownloadableProduct_Fragment + & ProductCategoriesData_DownloadableProduct_Fragment + ) | ( + { __typename: 'GroupedProduct' } + & Pick + & ProductThumbnailData_GroupedProduct_Fragment + & ProductPriceRangeData_GroupedProduct_Fragment + & ProductUrlFragmentData_GroupedProduct_Fragment + & ProductCategoriesData_GroupedProduct_Fragment + ) | ( + { __typename: 'SimpleProduct' } + & Pick + & ProductThumbnailData_SimpleProduct_Fragment + & ProductPriceRangeData_SimpleProduct_Fragment + & ProductUrlFragmentData_SimpleProduct_Fragment + & ProductCategoriesData_SimpleProduct_Fragment + ) | ( + { __typename: 'VirtualProduct' } + & Pick + & ProductThumbnailData_VirtualProduct_Fragment + & ProductPriceRangeData_VirtualProduct_Fragment + & ProductUrlFragmentData_VirtualProduct_Fragment + & ProductCategoriesData_VirtualProduct_Fragment + )>>> } )>>> }> }; export type UrlResloverQueryVariables = Exact<{ diff --git a/packages/composables/src/composables/getters/categoryGetters.ts b/packages/composables/src/composables/getters/categoryGetters.ts index 9ccb5ee1b..57b820f29 100644 --- a/packages/composables/src/composables/getters/categoryGetters.ts +++ b/packages/composables/src/composables/getters/categoryGetters.ts @@ -1,8 +1,9 @@ import { CategoryGetters, AgnosticCategoryTree, AgnosticBreadcrumb } from '@vue-storefront/core'; import { Category } from '@vue-storefront/magento-api'; +import { htmlDecode } from '../../helpers/htmlDecoder'; const buildTree = (rootCategory: Category, currentCategory: string, withProducts = false): AgnosticCategoryTree => ({ - label: rootCategory.name, + label: htmlDecode(rootCategory.name), slug: `/${rootCategory.url_path}${rootCategory.url_suffix || ''}`, items: Array.isArray(rootCategory.children) && rootCategory.children.length ? rootCategory .children diff --git a/packages/composables/src/composables/getters/productGetters.ts b/packages/composables/src/composables/getters/productGetters.ts index ae6fa75ef..2d24dd6dd 100644 --- a/packages/composables/src/composables/getters/productGetters.ts +++ b/packages/composables/src/composables/getters/productGetters.ts @@ -11,6 +11,7 @@ import { } from '@vue-storefront/magento-api'; import categoryGetters from './categoryGetters'; +import { htmlDecode } from '../../helpers/htmlDecoder'; type ProductVariantFilters = any; @@ -19,7 +20,7 @@ export const getProductName = (product: Product): string => { return ''; } - return product.name; + return htmlDecode(product.name); }; export const getProductSlug = (product: Product, category?: Category): string => { diff --git a/packages/composables/src/helpers/htmlDecoder.ts b/packages/composables/src/helpers/htmlDecoder.ts new file mode 100644 index 000000000..33d77b1d4 --- /dev/null +++ b/packages/composables/src/helpers/htmlDecoder.ts @@ -0,0 +1,9 @@ +export function htmlDecode(input) { + try { + const domParser = new DOMParser(); + const doc = domParser.parseFromString(input, 'text/html'); + return doc.documentElement.textContent; + } catch { + return input; + } +} diff --git a/packages/theme/components/MyAccount/ProfileUpdateForm.vue b/packages/theme/components/MyAccount/ProfileUpdateForm.vue index c1dc1c39b..919c623f3 100644 --- a/packages/theme/components/MyAccount/ProfileUpdateForm.vue +++ b/packages/theme/components/MyAccount/ProfileUpdateForm.vue @@ -54,6 +54,7 @@ :title="$t('Attention!')" cross persistent + @close="requirePassword = false" > {{ $t('Please type your current password to change your email address.') }} Date: Fri, 7 May 2021 14:32:41 -0300 Subject: [PATCH 2/2] chore: release version 1.0.0-beta.4.1 --- packages/api-client/package.json | 2 +- packages/composables/package.json | 4 ++-- packages/theme/package.json | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/api-client/package.json b/packages/api-client/package.json index 8b805d89b..2da54b222 100644 --- a/packages/api-client/package.json +++ b/packages/api-client/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/magento-api", - "version": "1.0.0-beta.4", + "version": "1.0.0-beta.4.1", "sideEffects": false, "license": "MIT", "server": "server/index.js", diff --git a/packages/composables/package.json b/packages/composables/package.json index 6350f778b..383c3bc7e 100644 --- a/packages/composables/package.json +++ b/packages/composables/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/magento", - "version": "1.0.0-beta.4", + "version": "1.0.0-beta.4.1", "license": "MIT", "sideEffects": false, "main": "lib/index.cjs.js", @@ -24,7 +24,7 @@ "access": "public" }, "dependencies": { - "@vue-storefront/magento-api": "^1.0.0-beta.4", + "@vue-storefront/magento-api": "^1.0.0-beta.4.1", "@vue-storefront/core": "^2.3.1", "vue": "^2.6.x" }, diff --git a/packages/theme/package.json b/packages/theme/package.json index 8e6355f06..f9557374d 100644 --- a/packages/theme/package.json +++ b/packages/theme/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/magento-theme", - "version": "1.0.0-beta.4", + "version": "1.0.0-beta.4.1", "private": true, "license": "MIT", "scripts": { @@ -24,7 +24,7 @@ "@nuxtjs/style-resources": "^1.0.0", "@storefront-ui/vue": "^0.10.5", "@vue-storefront/core": "^2.3.1", - "@vue-storefront/magento": "^1.0.0-beta.4", + "@vue-storefront/magento": "^1.0.0-beta.4.1", "@vue-storefront/middleware": "^2.3.1", "@vue-storefront/nuxt": "^2.3.1", "@vue-storefront/nuxt-theme": "^2.3.1",