-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for multi-catalog and multi-view See merge request engineering/sm/discovery-connectors/discovery-connector-sdk!6
- Loading branch information
Showing
53 changed files
with
460 additions
and
277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 12 additions & 22 deletions
34
packages/frontend/vanilla-js/src/listeners/autosuggest/form-element.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 14 additions & 23 deletions
37
packages/frontend/vanilla-js/src/listeners/autosuggest/suggestion-term-element.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
packages/frontend/vanilla-js/src/listeners/pixel-events/add-to-cart.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
declare const window: any; | ||
|
||
export function addCartClickAddEventListener() { | ||
document.addEventListener( | ||
'brCartClickAdd', | ||
(event: CustomEvent) => { | ||
event.stopImmediatePropagation(); | ||
const { prod_id, sku } = event.detail; | ||
(window.BrTrk || {})?.getTracker()?.logEvent('cart', 'click-add', { | ||
prod_id, | ||
sku, | ||
}); | ||
} | ||
); | ||
} | ||
|
||
export function addCartWidgetAddEventListener() { | ||
document.addEventListener('brCartWidgetAdd', (event: CustomEvent) => { | ||
event.stopImmediatePropagation(); | ||
const { wrid, wid, wty, item_id, wq, sku } = event.detail; | ||
const eventData = { | ||
wrid, | ||
wid, | ||
wty, | ||
item_id, | ||
sku, | ||
...(wq ? { wq } : {}), | ||
}; | ||
|
||
(window.BrTrk || {})?.getTracker()?.logEvent( | ||
'cart', | ||
'widget-add', | ||
eventData | ||
); | ||
}); | ||
} | ||
|
6 changes: 6 additions & 0 deletions
6
packages/frontend/vanilla-js/src/listeners/pixel-events/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export * from './add-to-cart'; | ||
export * from './quickview'; | ||
export * from './search'; | ||
export * from './suggest'; | ||
export * from './widget-click'; | ||
export * from './widget-view'; |
17 changes: 17 additions & 0 deletions
17
packages/frontend/vanilla-js/src/listeners/pixel-events/quickview.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
declare const window: any; | ||
|
||
export function addProductQuickviewEventListener() { | ||
document.addEventListener( | ||
'brProductQuickview', | ||
(event: CustomEvent) => { | ||
event.stopImmediatePropagation(); | ||
const { prod_id, prod_name, sku } = event.detail; | ||
(window.BrTrk || {})?.getTracker()?.logEvent('product', 'quickview', { | ||
prod_id, | ||
prod_name, | ||
sku, | ||
}); | ||
} | ||
); | ||
} |
14 changes: 14 additions & 0 deletions
14
packages/frontend/vanilla-js/src/listeners/pixel-events/search.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
declare const window: any; | ||
|
||
export function addSearchSubmitEventListener() { | ||
document.addEventListener('brSuggestSubmit', (event: CustomEvent) => { | ||
event.stopImmediatePropagation(); | ||
const searchData = { | ||
q: event.detail.q, | ||
}; | ||
|
||
(window.BrTrk || {}) | ||
?.getTracker() | ||
?.logEvent('suggest', 'submit', searchData, {}, true); | ||
}); | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/frontend/vanilla-js/src/listeners/pixel-events/suggest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
declare const window: any; | ||
|
||
export function addSuggestClickEventListener() { | ||
document.addEventListener('brSuggestClick', (event: CustomEvent) => { | ||
event.stopImmediatePropagation(); | ||
const { aq, q } = event.detail; | ||
|
||
const suggestionData = { | ||
aq, | ||
q, | ||
}; | ||
|
||
(window.BrTrk || {}) | ||
?.getTracker() | ||
?.logEvent('suggest', 'click', suggestionData, {}, true); | ||
}); | ||
} |
21 changes: 21 additions & 0 deletions
21
packages/frontend/vanilla-js/src/listeners/pixel-events/widget-click.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
declare const window: any; | ||
|
||
export function addWidgetClickEventListener() { | ||
document.addEventListener('brWidgetClick', (event: CustomEvent) => { | ||
event.stopImmediatePropagation(); | ||
const { wrid, wid, wty, item_id, wq } = event.detail; | ||
const eventData = { | ||
wrid, | ||
wid, | ||
wty, | ||
item_id, | ||
...(wq ? { wq } : {}), | ||
}; | ||
|
||
(window.BrTrk || {})?.getTracker()?.logEvent( | ||
'widget', | ||
'widget-click', | ||
eventData | ||
); | ||
}); | ||
} |
Oops, something went wrong.