Skip to content

Commit

Permalink
pushed fix, need to test
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhil-narayana-klevu committed Apr 30, 2024
1 parent 9cc8cb6 commit 26977b5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function sendRecommendationViewEvent(
eventData?: Partial<RecommendationViewEventMetaData> &
Pick<RecommendationViewEventMetaData, "logic" | "recsKey" | "title">,
override?: Partial<KlevuRecommendationsEventV2Data>,
isMobile?:boolean,
isMobile?: boolean
): KlevuFetchModifer {
return {
klevuModifierId: "sendMerchandisingViewEvent",
Expand All @@ -48,22 +48,20 @@ export function sendRecommendationViewEvent(
return res
}


if(kmcData.staticContent && kmcData.staticContent.length !== 0){
const resolution = isMobile?"mobile":"desktop";
if (kmcData.staticContent && kmcData.staticContent.length !== 0) {
const resolution = isMobile ? "mobile" : "desktop"
const image =
kmcData.staticContent[0].image.find(
(image) => image.resolution === resolution
) ?? kmcData.staticContent[0].image[0]
const bannerInfo = {
resolution,
resolution: resolution as "mobile" | "desktop",
index: 1,
banner_alt_tag: image.altTag,
banner_image_url: image.url,
content_type: "image",
content_type: "image" as const,
}


KlevuEvents.recommendationView({
recommendationMetadata: {
...kmcData.metadata,
Expand All @@ -80,16 +78,12 @@ export function sendRecommendationViewEvent(
})
}





return res
}

if (!eventData) {
throw new Error(
"Need to provider eventData parameter for custom view events"
"Need to provide eventData parameter for custom view events"
)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/klevu-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/klevu-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
"dependencies": {
"@floating-ui/dom": "^1.5.3",
"@klevu/core": "^5.2.0",
"@klevu/core": "file:../klevu-core",
"@stencil/core": "^4.4.0",
"axios": "^1.5.1",
"lit-html": "^2.8.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class KlevuRecommendations {
itemGroupId: this.itemGroupId,
...this.options,
},
sendRecommendationViewEvent({isMobile: this.#isMobile()})
sendRecommendationViewEvent(undefined, undefined, this.#isMobile())
)
)

Expand Down

0 comments on commit 26977b5

Please sign in to comment.