-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TW-1518: Ads replacement algorithm improvement (#1196)
* TW-1518 Implement blacklisting Hypelab campaigns * TW-1518 Fix a type error * TW-1518 Change the algorithm for picking ad type * TW-1518 Revert harmful changes * TW-1518 Restore using Persona 321x101 banner as one more fallback * TW-1518 Update @temple-wallet/extension-ads
- Loading branch information
1 parent
86ea1ff
commit 0be3314
Showing
7 changed files
with
176 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,28 @@ | ||
import { configureAds } from 'lib/ads/configure-ads'; | ||
import { importExtensionAdsModule } from 'lib/ads/import-extension-ads-module'; | ||
import { ADS_META_SEARCH_PARAM_NAME, ORIGIN_SEARCH_PARAM_NAME } from 'lib/constants'; | ||
import { ADS_META_SEARCH_PARAM_NAME, AD_CATEGORIES_PARAM_NAME, ORIGIN_SEARCH_PARAM_NAME } from 'lib/constants'; | ||
|
||
import { getRulesFromStorage } from './ads-rules'; | ||
|
||
const usp = new URLSearchParams(window.location.search); | ||
const id = usp.get('id'); | ||
const origin = usp.get(ORIGIN_SEARCH_PARAM_NAME) ?? window.location.href; | ||
const adsMetadataIds = usp.getAll(ADS_META_SEARCH_PARAM_NAME).map(value => JSON.parse(value)); | ||
const adCategories = usp.getAll(AD_CATEGORIES_PARAM_NAME); | ||
|
||
configureAds() | ||
.then(() => importExtensionAdsModule()) | ||
.then(({ renderAdsStack }) => renderAdsStack(id ?? '', adsMetadataIds, origin)) | ||
.then(async ({ renderAdsStack }) => ({ renderAdsStack, rules: await getRulesFromStorage(origin) })) | ||
.then(({ renderAdsStack, rules }) => { | ||
const { blacklistedHypelabCampaignsSlugs, permanentAdPlacesRules, adPlacesRules } = rules; | ||
|
||
renderAdsStack( | ||
id ?? '', | ||
adsMetadataIds, | ||
origin, | ||
permanentAdPlacesRules.length > 0 || adPlacesRules.length > 0, | ||
adCategories, | ||
blacklistedHypelabCampaignsSlugs | ||
); | ||
}) | ||
.catch(error => console.error(error)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { getRulesFromContentScript, clearRulesCache } from './ads-rules'; | ||
export { getRulesFromStorage as getRulesFromContentScript, clearRulesCache } from './ads-rules'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.