File tree Expand file tree Collapse file tree
assets/js/theme/product/recommendations Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11export const NUM_OF_PRODUCTS = 6 ;
22export const EVENT_TYPE = 'detail-page-view' ;
33export const SERVICE_CONFIG_ID = 'others-you-may-like-ctr-serving-config' ;
4- export const RECOM_TOKEN_PARAM = 'attributionToken' ;
Original file line number Diff line number Diff line change 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
54function renderPrice ( node , themeSettings ) {
65 const { price, retailPrice } = node . prices || { price : { } } ;
@@ -25,10 +24,10 @@ function renderRestrictToLogin() {
2524}
2625
2726function 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
Original file line number Diff line number Diff line change 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-
111export function getSizeFromThemeSettings ( setting ) {
122 const size = ( setting || '' ) . split ( 'x' ) ;
133 return {
You can’t perform that action at this time.
0 commit comments