Skip to content

Commit

Permalink
refactor: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vtsaplin committed Feb 7, 2024
1 parent c604972 commit a68dc46
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions solutions/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export const DEFAULT_COUNTRY = 'au';

export const METADATA_ANAYTICS_TAGS = 'analytics-tags';


const targetPromise = (async () => {
const targetLocation = getMetadata('target-location');
const randomString = Math.random().toString(36).substring(7);
Expand All @@ -54,19 +53,14 @@ const targetPromise = (async () => {
}),
});
const payload = await resp.json();
console.log(JSON.stringify(payload.execute.mboxes, null, 2));
const mbox = payload.execute.mboxes.find((mbox) => mbox.name === targetLocation);

Check failure on line 56 in solutions/scripts/scripts.js

View workflow job for this annotation

GitHub Actions / linting

'mbox' is already declared in the upper scope on line 56 column 9
console.log(`Mbox: ${JSON.stringify(mbox, null, 2)}`);
const { audience } = mbox?.options[0].content || false;
console.log(`Audience: ${audience}`);
const { audience } = mbox?.options[0].content ?? { audience: 'default' };
console.log(`Resolved target audience: ${audience}`);

Check warning on line 58 in solutions/scripts/scripts.js

View workflow job for this annotation

GitHub Actions / linting

Unexpected console statement
return audience;
})();

const AUDIENCES = {
challenger1: () => targetPromise.then((audience) => {
console.log(audience === 'challenger1');
return audience === 'challenger1';
}),
challenger1: () => targetPromise.then((audience) => audience === 'challenger1'),
};

window.hlx.plugins.add('rum-conversion', {
Expand Down

0 comments on commit a68dc46

Please sign in to comment.