Bug 1754832 - Update PBM to support opening spotlight tab modal r=Mardak,mviar,fluent-reviewers,flod
Differential Revision: https://phabricator.services.mozilla.com/D140565
This commit is contained in:
@@ -87,6 +87,7 @@ async function renderPromo({
|
||||
promoHeader,
|
||||
promoImageLarge,
|
||||
promoImageSmall,
|
||||
promoButton = null,
|
||||
} = {}) {
|
||||
const container = document.querySelector(".promo");
|
||||
if (promoEnabled === false) {
|
||||
@@ -102,20 +103,22 @@ async function renderPromo({
|
||||
const promoImageSmallEl = document.querySelector(".promo-image-small img");
|
||||
const dismissBtn = document.querySelector("#dismiss-btn");
|
||||
|
||||
// Setup the private browsing VPN link.
|
||||
const vpnPromoUrl =
|
||||
promoLinkUrl || RPMGetFormatURLPref("browser.privatebrowsing.vpnpromourl");
|
||||
|
||||
if (promoLinkType === "button") {
|
||||
linkEl.classList.add("button");
|
||||
}
|
||||
|
||||
if (vpnPromoUrl) {
|
||||
linkEl.setAttribute("href", vpnPromoUrl);
|
||||
if (promoLinkUrl) {
|
||||
linkEl.setAttribute("href", promoLinkUrl);
|
||||
linkEl.setAttribute("target", "_blank");
|
||||
linkEl.addEventListener("click", () => {
|
||||
window.PrivateBrowsingRecordClick("promo_link");
|
||||
});
|
||||
} else if (promoButton?.action?.type === "SHOW_SPOTLIGHT") {
|
||||
linkEl.setAttribute("href", "#");
|
||||
linkEl.addEventListener("click", async () => {
|
||||
window.PrivateBrowsingRecordClick("promo_link");
|
||||
await RPMSendQuery("SpecialMessageActionDispatch", promoButton.action);
|
||||
});
|
||||
} else {
|
||||
// If the link is undefined, remove the promo completely
|
||||
container.remove();
|
||||
|
||||
Reference in New Issue
Block a user