Bug 1765907 - PBM experiment message should override default promo message r=mviar
Differential Revision: https://phabricator.services.mozilla.com/D144871
This commit is contained in:
@@ -119,7 +119,14 @@ async function renderPromo({
|
||||
} else if (promoButton?.action?.type === "SHOW_SPOTLIGHT") {
|
||||
linkEl.addEventListener("click", async event => {
|
||||
event.preventDefault();
|
||||
window.PrivateBrowsingRecordClick("promo_link");
|
||||
// Record promo click telemetry and set metrics as allow for spotlight
|
||||
// modal opened on promo click if user is enrolled in an experiment
|
||||
let isExperiment = window.PrivateBrowsingRecordClick("promo_link");
|
||||
const promoButtonData = promoButton?.action?.data;
|
||||
if (promoButtonData?.content) {
|
||||
promoButtonData.content.metrics = isExperiment ? "allow" : "block";
|
||||
}
|
||||
|
||||
await RPMSendQuery("SpecialMessageActionDispatch", promoButton.action);
|
||||
});
|
||||
} else {
|
||||
@@ -238,14 +245,17 @@ async function handlePromoOnPreload(message) {
|
||||
async function setupFeatureConfig() {
|
||||
let config = null;
|
||||
let message = null;
|
||||
|
||||
try {
|
||||
config = window.PrivateBrowsingFeatureConfig();
|
||||
} catch (e) {}
|
||||
|
||||
if (!Object.keys(config).length) {
|
||||
let hideDefault = window.PrivateBrowsingShouldHideDefault();
|
||||
try {
|
||||
let response = await window.ASRouterMessage({
|
||||
type: "PBNEWTAB_MESSAGE_REQUEST",
|
||||
data: {},
|
||||
data: { hideDefault: !!hideDefault },
|
||||
});
|
||||
message = response?.message;
|
||||
config = message?.content;
|
||||
|
||||
Reference in New Issue
Block a user