import { Result , Tagging , TaggingInfo } from '@empathyco/x-types' ; import { toKebabCase } from '../utils/string' ; /**
 * Creates a  {@link @empathyco/x-types#Result | results} stub.
 *
 *  param amount returns internal export function getResultsStub ( amount = 4 ) { return Array . from < number , Result > ( { length : amount } , ( _ , index ) => createResultStub ( `Product ${ index + 1 }` ) ) ; } param name param result returns export function createResultStub ( name , result ? ) { const kebabCaseName = toKebabCase ( name ) ; return { id : kebabCaseName , modelName : 'Result' , type : 'Product' , isWishlisted : false , identifier : { value : kebabCaseName } , images : [ ] , name , price : { hasDiscount : false , originalValue : 10 , value : 10 } , rating : { value : 5 } , tagging : getResultTagging ( kebabCaseName ) , url : `/products/${ kebabCaseName }` , ... result } ; } /**
 * Function to create a  {@link @empathyco/x-types#Tagging | result tagging} mocked object
 * based on result id.
 *
 *  param productId returns internal function getResultTagging ( productId ) { return { click : getTaggingByAction ( 'click' , { productId } ) , add2cart : getTaggingByAction ( 'add2cart' , { productId } ) , checkout : getTaggingByAction ( 'checkout' , { productId } ) } ; } /**
 * Creates a  {@link @empathyco/x-types#TaggingInfo | tagging info} mocked object.
 *
 *  param action param params returns internal function getTaggingByAction ( action , params ) { return { url : `https://api.empathy.co/track/${ action }` , params : { lang : 'es' , ... params } } ; }