{"version":3,"file":"index-258e718d.js","sources":["../../client/packages/data-source/products/index.ts"],"sourcesContent":["import axios from \"axios\";\nimport type {Product, ProductListItem, ProductFilterSortType} from \"@songfinch/types/types\";\n\n\nexport type FetchProductParams = {\n slug?: string;\n getWithParent?: boolean;\n}\n\nexport const fetchProduct = async (params: FetchProductParams): Promise => {\n const res = await axios.get(`/store/single_product/${params.slug}`, {\n params: {\n get_with_parent: params.getWithParent\n }\n });\n return res.data;\n};\n\ntype FetchProductsParams = {\n ids?: string[];\n full?: boolean;\n name?: string[];\n coupon?: string;\n story_id?: number;\n}\n\nexport const fetchProducts = async (params?: FetchProductsParams): Promise => {\n const res = await axios.get(\"/store/products\", {params});\n return res.data;\n};\n\nexport const fetchStoreProducts = async (params?: FetchProductParams): Promise => {\n const res = await axios.get(\"/store/index\", {params});\n return res.data.products;\n};\n\n// remove undefined from type when data is coming from backend\nexport const fetchProductFilters = async (): Promise => {\n const res = await axios.get(\"/store/filters\");\n return res.data;\n};\n"],"names":["fetchProduct","params","axios","fetchProducts","fetchStoreProducts","fetchProductFilters"],"mappings":"2oBASa,MAAAA,EAAe,MAAOC,IACnB,MAAMC,EAAM,IAAI,yBAAyBD,EAAO,IAAI,GAAI,CAChE,OAAQ,CACJ,gBAAiBA,EAAO,aAC5B,CAAA,CACH,GACU,KAWFE,EAAgB,MAAOF,IACpB,MAAMC,EAAM,IAAI,kBAAmB,CAAC,OAAAD,EAAO,GAC5C,KAGFG,EAAqB,MAAOH,IACzB,MAAMC,EAAM,IAAI,eAAgB,CAAC,OAAAD,EAAO,GACzC,KAAK,SAIPI,EAAsB,UACnB,MAAMH,EAAM,IAAI,gBAAgB,GACjC"}