Skip to content

Commit

Permalink
TW-1630 Resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
keshan3262 committed Jan 16, 2025
2 parents 7cdfabb + 4967106 commit 7497a90
Show file tree
Hide file tree
Showing 117 changed files with 2,461 additions and 1,324 deletions.
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"audit-deps": "node ./audit-deps.js"
},
"engines": {
"node": ">=18"
"node": ">=20"
},
"dependencies": {
"@apollo/client": "^3.7.2",
Expand All @@ -55,16 +55,16 @@
"@reduxjs/toolkit": "^1.8.5",
"@rnw-community/shared": "^0.48.0",
"@svgr/webpack": "^8",
"@taquito/ledger-signer": "20.0.0",
"@taquito/local-forging": "20.0.0",
"@taquito/michel-codec": "20.0.0",
"@taquito/michelson-encoder": "20.0.0",
"@taquito/rpc": "20.0.0",
"@taquito/signer": "20.0.0",
"@taquito/taquito": "20.0.0",
"@taquito/tzip12": "20.0.0",
"@taquito/tzip16": "20.0.0",
"@taquito/utils": "20.0.0",
"@taquito/ledger-signer": "20.1.0",
"@taquito/local-forging": "20.1.0",
"@taquito/michel-codec": "20.1.0",
"@taquito/michelson-encoder": "20.1.0",
"@taquito/rpc": "20.1.0",
"@taquito/signer": "20.1.0",
"@taquito/taquito": "20.1.0",
"@taquito/tzip12": "20.1.0",
"@taquito/tzip16": "20.1.0",
"@taquito/utils": "20.1.0",
"@temple-wallet/dapp": "5.0.2",
"@temple-wallet/jest-webextension-mock": "^5.0.0",
"@temple-wallet/save-remote-file-webpack-plugin": "^1.1.3",
Expand Down Expand Up @@ -106,7 +106,7 @@
"async-retry": "1.3.3",
"autoprefixer": "^10",
"axios": "^1.7.4",
"bignumber.js": "9.1.0",
"bignumber.js": "9.1.2",
"bip39": "3.0.4",
"bs58check": "2.1.2",
"buffer": "5.6.0",
Expand Down Expand Up @@ -225,17 +225,17 @@
"tslib": "^2.4.0",
"@types/react": "18.0.15",
"@types/react-dev-utils/@types/webpack-dev-server": "^4",
"@taquito/taquito": "20.0.0",
"@taquito/utils": "20.0.0",
"@taquito/beacon-wallet": "20.0.0",
"@taquito/contracts-library": "20.0.0",
"@taquito/tzip16": "20.0.0",
"bignumber.js": "9.1.0",
"@taquito/taquito": "20.1.0",
"@taquito/utils": "20.1.0",
"@taquito/beacon-wallet": "20.1.0",
"@taquito/contracts-library": "20.1.0",
"@taquito/tzip16": "20.1.0",
"bignumber.js": "9.1.2",
"graphql-request": "^6.1.0",
"json5": "^2.2.2",
"follow-redirects": "^1.15.4"
},
"optionalDependencies": {
"@temple-wallet/extension-ads": "9.0.0-dev.2"
"@temple-wallet/extension-ads": "10.0.1"
}
}
51 changes: 51 additions & 0 deletions public/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3557,15 +3557,66 @@
"selectedAccountCannotSignTx": { "message": "Selected account cannot sign transactions" },
"attributes": { "message": "Attributes" },
"properties": { "message": "Properties" },
"closePartnersPromotion": {
"message": "Are you sure you want to disable all ads?"
},
"closePartnersPromoConfirm": {
"message": "Pay attention: you can receive rewards in TKEY tokens for viewing ads in our wallet. If you disabled Ads, you can always activate it in the settings."
},
"earnTkeyRewards": {
"message": "Earn TKEY Rewards"
},
"earnRewardsWithAds": {
"message": "Earn Rewards with Ads"
},
"earnRewardsWithAdsDescription": {
"message": "By enabling this checkbox, you agree to share your wallet address and IP to receive ads and rewards in TKEY token."
},
"earnTkeyRewardsDescription": {
"message": "I agree to share my wallet address and IP to receive ads, referral links and rewards in TKEY token."
},
"dropdownNoItems": {
"message": "No items"
},
"earnings": {
"message": "Earnings"
},
"earningsInfoTooltip": {
"message": "Earnings are only an estimation of your daily and monthly activity, including ad views and interactions with referral links. At the end of each month, your RP (reward points) will be converted into TKEY and distributed to your Tezos address. The more RP you accumulate, the greater your rewards will be."
},
"ads": {
"message": "Ads"
},
"today": {
"message": "Today"
},
"activeFeatures": {
"message": "Active features"
},
"advertisingFeatureDescription": {
"message": "Get RP by viewing ads"
},
"advertisingFeatureTooltip": {
"message": "The advertising feature is used to display ads within Temple Wallet and on websites. To earn TKEY and enable ads, we request your permission to share your wallet address and IP, this information is used solely to serve you relevant ads and distribute rewards."
},
"referralLinksFeatureDescription": {
"message": "Get RP while use favorite websites"
},
"referralLinksFeatureTooltip": {
"message": "The referral links feature allows users to engage with affiliate offers from our partners. These offers will appear as links while you browse your favorite websites. To enable this feature, we request your permission to share your wallet address and IP address, this information is used solely to serve you relevant offers and distribute rewards."
},
"achievements": {
"message": "Achievements"
},
"lifetimeEarnings": {
"message": "Lifetime earnings"
},
"noEarningsFound": {
"message": "No earnings found"
},
"somethingWentWrong": {
"message": "Something went wrong"
},
"backupYourWallet": {
"message": "Backup your wallet"
},
Expand Down
2 changes: 2 additions & 0 deletions src/app/PageRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { ActivityPage } from './pages/Activity';
import { ChainSettings } from './pages/ChainSettings';
import { ImportWallet } from './pages/ImportWallet';
import { Market } from './pages/Market';
import { RewardsPage } from './pages/Rewards';
import { StakingPage } from './pages/Staking';

interface RouteContext {
Expand Down Expand Up @@ -103,6 +104,7 @@ const ROUTE_MAP = Woozie.createMap<RouteContext>([
['/notifications', onlyReady(() => <Notifications />)],
['/notifications/:id', onlyReady(({ id }) => <NotificationsItem id={Number(id) ?? 0} />)],
['/account/:id', onlyReady(({ id }) => <AccountSettings id={id!} />)],
['/rewards', onlyReady(() => <RewardsPage />)],
['*', () => <Woozie.Redirect to="/" />]
]);

Expand Down
32 changes: 0 additions & 32 deletions src/app/hooks/use-load-partners-promo.ts

This file was deleted.

47 changes: 47 additions & 0 deletions src/app/hooks/use-partners-promotion-settings.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { ChangeEvent } from 'react';

import { useDispatch } from 'react-redux';

import { togglePartnersPromotionAction } from 'app/store/partners-promotion/actions';
import { useShouldShowPartnersPromoSelector } from 'app/store/partners-promotion/selectors';
import { t } from 'lib/i18n';
import { useConfirm } from 'lib/ui/dialog';

export const usePartnersPromotionSettings = () => {
const dispatch = useDispatch();
const confirm = useConfirm();

const isEnabled = useShouldShowPartnersPromoSelector();

const handleHidePromotion = async () => {
const confirmed = await confirm({
title: t('closePartnersPromotion'),
children: t('closePartnersPromoConfirm'),
confirmButtonText: t('disable')
});

if (confirmed) {
dispatch(togglePartnersPromotionAction(false));
}
};

const handleShowPromotion = async () => {
const confirmed = await confirm({
title: t('enablePartnersPromotionConfirm'),
children: t('enablePartnersPromotionDescriptionConfirm'),
confirmButtonText: t('enable')
});

if (confirmed) {
dispatch(togglePartnersPromotionAction(true));
}
};

const setEnabled = (toChecked: boolean, event?: ChangeEvent<HTMLInputElement>) => {
event?.preventDefault();

return toChecked ? handleShowPromotion() : handleHidePromotion();
};

return { isEnabled, setEnabled };
};
67 changes: 67 additions & 0 deletions src/app/hooks/use-referral-links-settings.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import React, { ChangeEvent, useCallback } from 'react';

import { useDispatch } from 'react-redux';

import { setAcceptedTermsVersionAction, setReferralLinksEnabledAction } from 'app/store/settings/actions';
import { useAcceptedTermsVersionSelector, useReferralLinksEnabledSelector } from 'app/store/settings/selectors';
import {
PRIVACY_POLICY_URL,
RECENT_TERMS_VERSION,
TERMS_OF_USE_URL,
TERMS_WITH_REFERRALS_VERSION
} from 'lib/constants';
import { t, T } from 'lib/i18n';
import { useConfirm } from 'lib/ui/dialog';

export const useReferralLinksSettings = () => {
const dispatch = useDispatch();
const enabled = useReferralLinksEnabledSelector();
const acceptedTermsVersion = useAcceptedTermsVersionSelector();
const confirm = useConfirm();

const setEnabled = useCallback(
async (toChecked: boolean, event?: ChangeEvent<HTMLInputElement>) => {
event?.preventDefault();

if (toChecked && acceptedTermsVersion < TERMS_WITH_REFERRALS_VERSION) {
const confirmed = await confirm({
title: <T id="confirmEnableReferralLinksTitle" />,
description: (
<T
id="confirmEnableReferralLinksDescription"
substitutions={[
<a
href={TERMS_OF_USE_URL}
target="_blank"
rel="noopener noreferrer"
className="underline text-secondary"
>
<T id="termsOfUsage" key="termsLink" />
</a>,
<a
href={PRIVACY_POLICY_URL}
target="_blank"
rel="noopener noreferrer"
className="underline text-secondary"
>
<T id="privacyPolicy" key="privacyPolicyLink" />
</a>
]}
/>
),
confirmButtonText: t('agreeAndContinue')
});

if (!confirmed) {
return;
}
}

dispatch(setAcceptedTermsVersionAction(RECENT_TERMS_VERSION));
dispatch(setReferralLinksEnabledAction(toChecked));
},
[acceptedTermsVersion, confirm, dispatch]
);

return { isEnabled: enabled, setEnabled };
};
18 changes: 14 additions & 4 deletions src/app/hooks/use-user-analytics-and-ads-settings.hook.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
import { useEffect, useRef } from 'react';

import { useShouldShowPartnersPromoSelector } from 'app/store/partners-promotion/selectors';
import { useAnalyticsEnabledSelector } from 'app/store/settings/selectors';
import { useReferralLinksEnabledSelector } from 'app/store/settings/selectors';
import { useAnalytics } from 'lib/analytics';
import { WEBSITES_ANALYTICS_ENABLED } from 'lib/constants';
import { REPLACE_REFERRALS_ENABLED, WEBSITES_ANALYTICS_ENABLED } from 'lib/constants';
import { AnalyticsEventCategory } from 'lib/temple/analytics-types';
import { usePassiveStorage } from 'lib/temple/front/storage';
import { useAccountAddressForTezos } from 'temple/front';

export const useUserAnalyticsAndAdsSettings = () => {
const { trackEvent } = useAnalytics();
const isAnalyticsEnabled = useAnalyticsEnabledSelector();
const isAdsEnabled = useShouldShowPartnersPromoSelector();
const isReferralLinksEnabled = useReferralLinksEnabledSelector();

const [, setIsWebsitesAnalyticsEnabled] = usePassiveStorage(WEBSITES_ANALYTICS_ENABLED);
const [, setIsReplaceReferralsEnabled] = usePassiveStorage(REPLACE_REFERRALS_ENABLED);

const prevAdsEnabledRef = useRef(isAdsEnabled);
const accountPkh = useAccountAddressForTezos();

useEffect(() => {
setIsWebsitesAnalyticsEnabled(isAdsEnabled);
setIsReplaceReferralsEnabled(isReferralLinksEnabled);

// It happens when the wallet is not ready although `registerWallet` promise has been resolved
if (typeof accountPkh !== 'string') {
Expand All @@ -30,5 +33,12 @@ export const useUserAnalyticsAndAdsSettings = () => {
}

prevAdsEnabledRef.current = isAdsEnabled;
}, [isAdsEnabled, setIsWebsitesAnalyticsEnabled, trackEvent, accountPkh, isAnalyticsEnabled]);
}, [
isAdsEnabled,
isReferralLinksEnabled,
setIsWebsitesAnalyticsEnabled,
setIsReplaceReferralsEnabled,
trackEvent,
accountPkh
]);
};
5 changes: 5 additions & 0 deletions src/app/icons/alert.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions src/app/icons/separator.svg

This file was deleted.

4 changes: 4 additions & 0 deletions src/app/icons/triangle-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7497a90

Please sign in to comment.