Skip to content

Commit

Permalink
TW-1544 Resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
keshan3262 committed Oct 11, 2024
2 parents 7ddbba2 + d6f30f8 commit 3239ec4
Show file tree
Hide file tree
Showing 16 changed files with 178 additions and 129 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,6 @@
"follow-redirects": "^1.15.4"
},
"optionalDependencies": {
"@temple-wallet/extension-ads": "8.1.1"
"@temple-wallet/extension-ads": "9.0.0-dev.2"
}
}
6 changes: 1 addition & 5 deletions public/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -690,10 +690,6 @@
"message": "Tezos Mainnet",
"description": "Mainnet = main network"
},
"marigoldMainnet": {
"message": "Marigold Mainnet",
"description": "Mainnet = main network"
},
"templeWalletOptions": {
"message": "Temple Wallet | Options"
},
Expand Down Expand Up @@ -1192,7 +1188,7 @@
"message": "Earn"
},
"delegationPointsHead2": {
"message": "on your Tezos annualy from\nBaking & Stake rewards"
"message": "on your Tezos annually from\nBaking & Stake rewards"
},
"delegationPoint1": {
"message": "First reward in Tezos will be paid approximately in 36 days."
Expand Down
4 changes: 0 additions & 4 deletions public/_locales/en_GB/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,6 @@
"message": "Tezos Mainnet",
"description": "Mainnet = main network"
},
"marigoldMainnet": {
"message": "Marigold Mainnet",
"description": "Mainnet = main network"
},
"templeWalletOptions": {
"message": "Temple Wallet | Options"
},
Expand Down
4 changes: 0 additions & 4 deletions public/_locales/fr/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,6 @@
"message": "Mainnet Tezos",
"description": "Mainnet = main network"
},
"marigoldMainnet": {
"message": "Mainnet Marigold",
"description": "Mainnet = main network"
},
"templeWalletOptions": {
"message": "Portefeuille Temple | Options"
},
Expand Down
4 changes: 0 additions & 4 deletions public/_locales/pt/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,6 @@
"message": "Tezos Mainnet",
"description": "Mainnet = main network"
},
"marigoldMainnet": {
"message": "Marigold Mainnet",
"description": "Mainnet = main network"
},
"templeWalletOptions": {
"message": "Carteira Temple | Opções"
},
Expand Down
4 changes: 0 additions & 4 deletions public/_locales/tr/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,6 @@
"message": "Tezos Mainnet",
"description": "Mainnet = main network"
},
"marigoldMainnet": {
"message": "Marigold Mainnet",
"description": "Mainnet = main network"
},
"templeWalletOptions": {
"message": "Temple Wallet | Seçenekler"
},
Expand Down
4 changes: 0 additions & 4 deletions public/_locales/uk/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,6 @@
"message": "Tezos Mainnet",
"description": "Mainnet = main network"
},
"marigoldMainnet": {
"message": "Marigold Mainnet",
"description": "Mainnet = main network"
},
"templeWalletOptions": {
"message": "Temple Wallet | Налаштування"
},
Expand Down
4 changes: 0 additions & 4 deletions public/_locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,6 @@
"message": "Tezos主网",
"description": "Mainnet = main network"
},
"marigoldMainnet": {
"message": "Marigold主网",
"description": "Mainnet = main network"
},
"templeWalletOptions": {
"message": "Temple钱包 | 选项"
},
Expand Down
4 changes: 0 additions & 4 deletions public/_locales/zh_TW/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,6 @@
"message": "Tezos 主網路",
"description": "Mainnet = main network"
},
"marigoldMainnet": {
"message": "Marigold 主網路",
"description": "Mainnet = main network"
},
"templeWalletOptions": {
"message": "Temple 錢包 | 選項"
},
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/Staking/MyStake.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export const MyStakeTab = memo<Props>(({ accountPkh, network, cannotDelegate })
className="h-10"
onClick={finalizeUnstake}
>
Unstake
Finalize
</FormSubmitButton>
</>
) : requestsAreLoading ? (
Expand Down
15 changes: 10 additions & 5 deletions src/content-scripts/replace-ads/ads-rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import { importExtensionAdsModule } from 'lib/ads/import-extension-ads-module';
import { ALL_ADS_RULES_STORAGE_KEY, ADS_RULES_UPDATE_INTERVAL } from 'lib/constants';
import { fetchFromStorage } from 'lib/storage';

export const getRulesFromContentScript = memoizee(
async (location: Location) => {
export const getRulesFromStorage = memoizee(
async (locationOrHref: Location | string) => {
try {
const { transformRawRules } = await importExtensionAdsModule();
const rulesStored = await fetchFromStorage(ALL_ADS_RULES_STORAGE_KEY);

if (!rulesStored) throw new Error('No rules for ads found');

return transformRawRules(location, rulesStored);
return transformRawRules(locationOrHref, rulesStored);
} catch (error) {
console.error(error);

Expand All @@ -22,11 +22,16 @@ export const getRulesFromContentScript = memoizee(
providersSelectors: [],
providersNegativeSelectors: [],
elementsToHideOrRemoveRules: [],
blacklistedHypelabCampaignsSlugs: [],
timestamp: 0
};
}
},
{ maxAge: ADS_RULES_UPDATE_INTERVAL, normalizer: ([location]) => location.href, promise: true }
{
maxAge: ADS_RULES_UPDATE_INTERVAL,
normalizer: ([locationOrHref]) => (typeof locationOrHref === 'string' ? locationOrHref : locationOrHref.href),
promise: true
}
);

export const clearRulesCache = () => getRulesFromContentScript.clear();
export const clearRulesCache = () => getRulesFromStorage.clear();
19 changes: 17 additions & 2 deletions src/content-scripts/replace-ads/ads-stack.iframe.ts
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));
2 changes: 1 addition & 1 deletion src/content-scripts/replace-ads/index.ts
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';
Loading

0 comments on commit 3239ec4

Please sign in to comment.