Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MWPW-158777 returning proper response in case of error #2916

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions libs/martech/martech.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,26 +121,23 @@ export const getTargetPersonalization = async () => {
window.lana.log(`target response time: ${responseTime}`, { tags: 'martech', errorType: 'i' });
}, { once: true });

let manifests = [];
let propositions = [];
let targetManifests = [];
let targetPropositions = [];
const response = await waitForEventOrTimeout(ALLOY_SEND_EVENT, timeout);
if (response.error) {
window.lana.log('target response time: ad blocker', { tags: 'martech', errorType: 'i' });
return [];
return { targetManifests, targetPropositions };
}
if (response.timeout) {
waitForEventOrTimeout(ALLOY_SEND_EVENT, 5100 - timeout)
.then(() => sendTargetResponseAnalytics(true, responseStart, timeout));
} else {
sendTargetResponseAnalytics(false, responseStart, timeout);
manifests = handleAlloyResponse(response.result);
propositions = response.result?.propositions || [];
targetManifests = handleAlloyResponse(response.result);
targetPropositions = response.result?.propositions || [];
}

return {
targetManifests: manifests,
targetPropositions: propositions,
};
return { targetManifests, targetPropositions };
};

const setupEntitlementCallback = () => {
Expand Down
Loading