Skip to content

Commit

Permalink
Merge branch 'main' into websdk
Browse files Browse the repository at this point in the history
  • Loading branch information
vtsaplin committed Apr 4, 2024
2 parents cd3a7ed + a26d765 commit db99cd5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions solutions/scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,21 @@ async function findProductVariant(cachedResponse, variant) {
* @param variant The product variant
* @returns {Promise<*>}
*/
export async function fetchProduct(code = 'av', variant = '1u-1y') {
export async function fetchProduct(code = 'av', variant = '1u-1y', pid = null) {
const data = new FormData();
// extract pid from url
if (!pid) {
const url = new URL(window.location.href);
// eslint-disable-next-line no-param-reassign
pid = url.searchParams.get('pid');
}

data.append('data', JSON.stringify({
ev: 1,
product_id: code,
config: {
extra_params: {
pid: null,
pid,
},
},
}));
Expand Down

0 comments on commit db99cd5

Please sign in to comment.