Skip to content

Commit

Permalink
Revert "PID in metadata (#467)"
Browse files Browse the repository at this point in the history
This reverts commit 6da0704.
  • Loading branch information
vradulescu-bd authored Apr 18, 2024
1 parent 6da0704 commit 03a5a7f
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions solutions/scripts/utils/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { getMetadata } from './aem.js';

const cacheResponse = new Map();
const FETCH_URL = 'https://www.bitdefender.com.au/site/Store/ajax';

Expand Down Expand Up @@ -52,24 +50,19 @@ async function findProductVariant(cachedResponse, variant) {
*/
export async function fetchProduct(code = 'av', variant = '1u-1y', pid = null) {
const data = new FormData();
let pidFromUrl;
let pidFromMetadata;
// extract pid from url
if (!pid) {
const url = new URL(window.location.href);
pidFromUrl = url.searchParams.get('pid');
}

if (!pidFromUrl) {
pidFromMetadata = getMetadata('pid');
// 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: pidFromUrl || pidFromMetadata,
pid,
},
},
}));
Expand Down

0 comments on commit 03a5a7f

Please sign in to comment.