Skip to content

Commit

Permalink
Merge branch 'master' into feat/user-directives
Browse files Browse the repository at this point in the history
  • Loading branch information
cdcs0128 authored Jan 31, 2024
2 parents b7be0e6 + 1ac3957 commit 9532f58
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [1.16.3] - 2024-01-22

## [1.16.2] - 2024-01-10

### Fixed

-Fix null pointer exception

### Fixed

- GA event error due to undefined selectedItem

## [1.16.1] - 2023-04-25
### Fixed
- Updated readme.md according to task LOC-10496.
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "wish-list",
"vendor": "vtex",
"version": "1.16.1",
"version": "1.16.3",
"title": "Wish List",
"description": "The Wishlist app is designed for B2C. It adds a heart icon to the Shelfs and Product Page, so the user can add it to the Wishlist, you can list all the Wishlisted items at /wishlist",
"categories": [],
Expand Down
13 changes: 9 additions & 4 deletions react/AddProductBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import React, {
} from 'react'
import { useMutation, useLazyQuery } from 'react-apollo'
import { defineMessages, useIntl } from 'react-intl'
import { ProductContext } from 'vtex.product-context'
import { useProduct } from 'vtex.product-context'
import { Button, ToastContext } from 'vtex.styleguide'
import { useRuntime, NoSSR } from 'vtex.render-runtime'
import { useCssHandles } from 'vtex.css-handles'
Expand Down Expand Up @@ -153,14 +153,17 @@ const AddBtn: FC<AddBtnProps> = ({ toastURL = '/account/#wishlist' }) => {
const { push } = usePixel()
const handles = useCssHandles(CSS_HANDLES)
const { showToast } = useContext(ToastContext)
const { selectedItem, product } = useContext(ProductContext) as any
const productContext = useProduct()
const { selectedItem, product } = productContext
const sessionResponse: any = useSessionResponse()
const [handleCheck, { data, loading, called }] = useLazyQuery(checkItem)

const [productId] = String(product?.productId).split('-')
const sku = product?.sku?.itemId
const sku = product?.items?.[0]?.itemId
wishListed = JSON.parse(localStore.getItem('wishlist_wishlisted')) ?? []

const productContextScoped = useProduct()

const toastMessage = (messsageKey: string, linkWishlist: string) => {
let action: any
if (messsageKey === 'notLogged') {
Expand Down Expand Up @@ -304,12 +307,14 @@ const AddBtn: FC<AddBtnProps> = ({ toastURL = '/account/#wishlist' }) => {
})
pixelEvent.event = 'removeToWishlist'
} else {
const { selectedItem: selectedItemScoped } = productContextScoped

addProduct({
variables: {
listItem: {
productId,
title: product.productName,
sku: selectedItem.itemId,
sku: selectedItemScoped.itemId,
},
shopperId,
name: defaultValues.LIST_NAME,
Expand Down
2 changes: 1 addition & 1 deletion react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@
"vtex.store-resources": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.store-resources",
"vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/[email protected]/public/@types/vtex.styleguide"
},
"version": "1.16.1"
"version": "1.16.3"
}

0 comments on commit 9532f58

Please sign in to comment.