@@ -7,11 +7,20 @@ import {
77}  from  '../../commons/compatibility-layer' 
88import  {  getWorkspaceSearchParamsFromStorage  }  from  '../../routes/workspaceSearchParams' 
99import  { 
10-   buildVtexSegment , 
10+   fetchAutocompleteSuggestions , 
11+   fetchCorrection , 
12+   fetchSearchSuggestions , 
13+   fetchTopSearches , 
14+ }  from  '../../services/autocomplete' 
15+ import  {  fetchBanners  }  from  '../../services/banners' 
16+ import  { 
1117  ProductArgs , 
1218  ProductIdentifier , 
19+   buildVtexSegment , 
1320  resolveProduct , 
1421}  from  '../../services/product' 
22+ import  {  fetchAppSettings  }  from  '../../services/settings' 
23+ import  {  AdvertisementOptions ,  FacetsInput ,  ProductSearchInput ,  ProductsInput ,  SegmentData ,  SuggestionProductsArgs  }  from  '../../typings/Search' 
1524import  {  shouldTranslateToTenantLocale  }  from  '../../utils/i18n' 
1625import  {  resolvers  as  assemblyOptionResolvers  }  from  './assemblyOption' 
1726import  {  resolvers  as  autocompleteResolvers  }  from  './autocomplete' 
@@ -39,14 +48,6 @@ import {
3948  getShippingOptionsFromSelectedFacets , 
4049  validMapAndQuery , 
4150}  from  './utils' 
42- import  { 
43-   fetchAutocompleteSuggestions , 
44-   fetchTopSearches , 
45-   fetchSearchSuggestions , 
46-   fetchCorrection , 
47- }  from  '../../services/autocomplete' 
48- import  {  fetchBanners  }  from  '../../services/banners' 
49- import  {  AdvertisementOptions ,  FacetsInput ,  ProductSearchInput ,  ProductsInput ,  SegmentData ,  SuggestionProductsArgs  }  from  '../../typings/Search' 
5051
5152enum  CrossSellingInput  { 
5253  view  =  'view' , 
@@ -597,6 +598,8 @@ export const queries = {
597598    if  ( identifier  ==  null  ||  type  ==  null )  { 
598599      throw  new  UserInputError ( 'Wrong input provided' ) 
599600    } 
601+ 
602+   const  {  shouldUseNewPDPEndpoint }  =  await  fetchAppSettings ( ctx ) 
600603    const  searchType  =  inputToSearchCrossSelling [ type ] 
601604    let  productId  =  identifier . value 
602605    if  ( identifier . field  !==  'id' )  { 
@@ -607,10 +610,15 @@ export const queries = {
607610    const  groupByProduct  = 
608611      groupBy  ===  CrossSellingGroupByInput . PRODUCT  ? true  : false 
609612
613+     if  ( shouldUseNewPDPEndpoint )  { 
614+       ctx . translated  =  true 
615+     } 
616+ 
610617    const  products  =  await  ctx . clients . search . crossSelling ( 
611618      productId , 
612619      searchType , 
613-       groupByProduct 
620+       groupByProduct , 
621+       shouldUseNewPDPEndpoint  ? ctx . vtex . locale  : undefined 
614622    ) 
615623
616624    searchFirstElements ( products ,  0 ,  ctx . clients . search ) 
0 commit comments