@@ -31,14 +31,19 @@ async function fetchProductFromSearch(
3131 switch ( field ) {
3232 case 'id' :
3333 return search . productById ( value , vtexSegment , salesChannel )
34+
3435 case 'slug' :
3536 return search . product ( value , vtexSegment , salesChannel )
37+
3638 case 'ean' :
3739 return search . productByEan ( value , vtexSegment , salesChannel )
40+
3841 case 'reference' :
3942 return search . productByReference ( value , vtexSegment , salesChannel )
43+
4044 case 'sku' :
4145 return search . productBySku ( value , vtexSegment , salesChannel )
46+
4247 default :
4348 throw new Error ( `Unsupported product identifier field: ${ field } ` )
4449 }
@@ -75,13 +80,13 @@ async function fetchProductFromIntsch(
7580 * Builds vtex segment token for product fetching
7681 */
7782
78- export function buildVtexSegment (
83+ export function buildVtexSegment (
7984 vtexSegment ?: SegmentData ,
8085 tradePolicy ?: number ,
8186 regionId ?: string | null
8287) : string {
8388 const cookie = {
84- regionId : regionId ,
89+ regionId,
8590 channel : tradePolicy ,
8691 utm_campaign : vtexSegment ?. utm_campaign || '' ,
8792 utm_source : vtexSegment ?. utm_source || '' ,
@@ -111,7 +116,7 @@ export async function fetchProduct(
111116 COMPARISON_SAMPLE_RATE ,
112117 ctx . vtex . logger ,
113118 {
114- logPrefix : 'Product Fetching Comparison ' ,
119+ logPrefix : 'Product Details ' ,
115120 args : {
116121 identifier : args . identifier ,
117122 salesChannel : args . salesChannel ,
@@ -148,7 +153,7 @@ export async function resolveProduct(
148153 throw new Error ( 'No product identifier provided' )
149154 }
150155
151- let cookie : SegmentData | undefined = ctx . vtex . segment
156+ const cookie : SegmentData | undefined = ctx . vtex . segment
152157 const salesChannel = rawArgs . salesChannel || cookie ?. channel || 1
153158
154159 const vtexSegment =
0 commit comments