Skip to content

Commit 226ba52

Browse files
committed
refactor: Remove redundant client side attr token propagation
1 parent 35baa3c commit 226ba52

3 files changed

Lines changed: 4 additions & 16 deletions

File tree

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
export const NUM_OF_PRODUCTS = 6;
22
export const EVENT_TYPE = 'detail-page-view';
33
export const SERVICE_CONFIG_ID = 'others-you-may-like-ctr-serving-config';
4-
export const RECOM_TOKEN_PARAM = 'attributionToken';

assets/js/theme/product/recommendations/recommendations-carousel.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* eslint-disable indent */
2-
import { addQueryParams } from './utils';
3-
import { RECOM_TOKEN_PARAM, NUM_OF_PRODUCTS } from './constants';
2+
import { NUM_OF_PRODUCTS } from './constants';
43

54
function renderPrice(node, themeSettings) {
65
const { price, retailPrice } = node.prices || { price: {} };
@@ -25,10 +24,10 @@ function renderRestrictToLogin() {
2524
}
2625

2726
function renderCard(node, options) {
28-
const { themeSettings, attributionToken } = options;
27+
const { themeSettings } = options;
2928
const categories = node.categories.edges.map(({ node: cNode }) => cNode.name).join(',');
30-
const productUrl = addQueryParams(node.path, { [RECOM_TOKEN_PARAM]: attributionToken });
31-
const addToCartUrl = addQueryParams(node.addToCartUrl, { [RECOM_TOKEN_PARAM]: attributionToken });
29+
const productUrl = node.path;
30+
const addToCartUrl = node.addToCartUrl;
3231

3332
return `<div class="productCarousel-slide">
3433
<article

assets/js/theme/product/recommendations/utils.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
export function addQueryParams(url, params = {}) {
2-
const keys = Object.keys(params);
3-
if (!keys.length) return url;
4-
const newParams = keys
5-
.reduce((acc, key) =>
6-
acc.concat([`${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`]), [])
7-
.join('&');
8-
return (url || '').indexOf('?') === -1 ? `${url}?${newParams}` : `${url}&${newParams}`;
9-
}
10-
111
export function getSizeFromThemeSettings(setting) {
122
const size = (setting || '').split('x');
133
return {

0 commit comments

Comments
 (0)