Skip to content

Commit f4ce0ec

Browse files
committed
Private mode
1 parent ffccd65 commit f4ce0ec

32 files changed

+265
-50
lines changed

configs/app/app.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import * as cookies from 'lib/cookies';
2+
13
import { getEnvValue } from './utils';
24

35
const appPort = getEnvValue('NEXT_PUBLIC_APP_PORT');
@@ -13,6 +15,7 @@ const isDev = getEnvValue('NEXT_PUBLIC_APP_ENV') === 'development';
1315
const isReview = getEnvValue('NEXT_PUBLIC_APP_ENV') === 'review';
1416
const isPw = getEnvValue('NEXT_PUBLIC_APP_INSTANCE') === 'pw';
1517
const spriteHash = getEnvValue('NEXT_PUBLIC_ICON_SPRITE_HASH');
18+
const appProfile = cookies.get(cookies.NAMES.APP_PROFILE);
1619

1720
const app = Object.freeze({
1821
isDev,
@@ -24,6 +27,7 @@ const app = Object.freeze({
2427
baseUrl,
2528
useProxy: getEnvValue('NEXT_PUBLIC_USE_NEXT_JS_PROXY') === 'true',
2629
spriteHash,
30+
appProfile,
2731
});
2832

2933
export default app;

configs/app/features/account.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import type { Feature } from './types';
22

3+
import app from '../app';
34
import services from '../services';
45
import { getEnvValue } from '../utils';
56

67
const title = 'My account';
78

89
const config: Feature<{ isEnabled: true; recaptchaSiteKey: string }> = (() => {
9-
if (getEnvValue('NEXT_PUBLIC_IS_ACCOUNT_SUPPORTED') === 'true' && services.reCaptchaV2.siteKey) {
10+
11+
if (
12+
app.appProfile !== 'private' &&
13+
getEnvValue('NEXT_PUBLIC_IS_ACCOUNT_SUPPORTED') === 'true' &&
14+
services.reCaptchaV2.siteKey
15+
) {
1016
return Object.freeze({
1117
title,
1218
isEnabled: true,

configs/app/features/addressProfileAPI.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Feature } from './types';
22
import type { AddressProfileAPIConfig } from 'types/client/addressProfileAPIConfig';
33

4+
import app from '../app';
45
import { getEnvValue, parseEnvJson } from '../utils';
56

67
const value = parseEnvJson<AddressProfileAPIConfig>(getEnvValue('NEXT_PUBLIC_ADDRESS_USERNAME_TAG'));
@@ -24,7 +25,7 @@ const config: Feature<{
2425
tagBgColor?: string;
2526
tagTextColor?: string;
2627
}> = (() => {
27-
if (value && checkApiUrlTemplate(value.api_url_template)) {
28+
if (app.appProfile !== 'private' && value && checkApiUrlTemplate(value.api_url_template)) {
2829
return Object.freeze({
2930
title,
3031
isEnabled: true,

configs/app/features/addressVerification.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import type { Feature } from './types';
22

33
import apis from '../apis';
4+
import app from '../app';
45
import account from './account';
56
import verifiedTokens from './verifiedTokens';
67

78
const title = 'Address verification in "My account"';
89

910
const config: Feature<{}> = (() => {
10-
if (account.isEnabled && verifiedTokens.isEnabled && apis.admin) {
11+
if (app.appProfile !== 'private' && account.isEnabled && verifiedTokens.isEnabled && apis.admin) {
1112
return Object.freeze({
1213
title: 'Address verification in "My account"',
1314
isEnabled: true,

configs/app/features/adsBanner.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { AdButlerConfig } from 'types/client/adButlerConfig';
33
import { SUPPORTED_AD_BANNER_PROVIDERS } from 'types/client/adProviders';
44
import type { AdBannerProviders, AdBannerAdditionalProviders } from 'types/client/adProviders';
55

6+
import app from '../app';
67
import { getEnvValue, parseEnvJson } from '../utils';
78

89
const provider: AdBannerProviders = (() => {
@@ -42,6 +43,13 @@ type AdsBannerFeaturePayload = AdsBannerFeatureProviderPayload & {
4243
};
4344

4445
const config: Feature<AdsBannerFeaturePayload> = (() => {
46+
if (app.appProfile === 'private') {
47+
return Object.freeze({
48+
title,
49+
isEnabled: false,
50+
});
51+
}
52+
4553
if (provider === 'adbutler') {
4654
const desktopConfig = parseEnvJson<AdButlerConfig>(getEnvValue('NEXT_PUBLIC_AD_ADBUTLER_CONFIG_DESKTOP'));
4755
const mobileConfig = parseEnvJson<AdButlerConfig>(getEnvValue('NEXT_PUBLIC_AD_ADBUTLER_CONFIG_MOBILE'));

configs/app/features/adsText.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { Feature } from './types';
22
import { SUPPORTED_AD_TEXT_PROVIDERS } from 'types/client/adProviders';
33
import type { AdTextProviders } from 'types/client/adProviders';
44

5+
import app from '../app';
56
import { getEnvValue } from '../utils';
67

78
const provider: AdTextProviders = (() => {
@@ -12,7 +13,7 @@ const provider: AdTextProviders = (() => {
1213
const title = 'Text ads';
1314

1415
const config: Feature<{ provider: AdTextProviders }> = (() => {
15-
if (provider !== 'none') {
16+
if (app.appProfile !== 'private' && provider !== 'none') {
1617
return Object.freeze({
1718
title,
1819
isEnabled: true,

configs/app/features/blockchainInteraction.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Feature } from './types';
22

3+
import app from '../app';
34
import chain from '../chain';
45
import { getEnvValue } from '../utils';
56
import opSuperchain from './opSuperchain';
@@ -24,6 +25,7 @@ const config: Feature<{ walletConnect: { projectId: string } }> = (() => {
2425
const isOpSuperchain = opSuperchain.isEnabled;
2526

2627
if (
28+
app.appProfile !== 'private' &&
2729
(isSingleChain || isOpSuperchain) &&
2830
walletConnectProjectId
2931
) {
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
import type { Feature } from './types';
22
import type { DeFiDropdownItem } from 'types/client/deFiDropdown';
33

4+
import app from '../app';
45
import { getEnvValue, parseEnvJson } from '../utils';
56

67
const items = parseEnvJson<Array<DeFiDropdownItem>>(getEnvValue('NEXT_PUBLIC_DEFI_DROPDOWN_ITEMS')) || [];
78

89
const title = 'DeFi dropdown';
910

10-
const config: Feature<{ items: Array<DeFiDropdownItem> }> = items.length > 0 ?
11-
Object.freeze({
12-
title,
13-
isEnabled: true,
14-
items,
15-
}) :
16-
Object.freeze({
11+
const config: Feature<{ items: Array<DeFiDropdownItem> }> = (() => {
12+
if (app.appProfile !== 'private' && items.length > 0) {
13+
return Object.freeze({
14+
title,
15+
isEnabled: true,
16+
items,
17+
});
18+
}
19+
return Object.freeze({
1720
title,
1821
isEnabled: false,
1922
});
23+
})();
2024

2125
export default config;

configs/app/features/googleAnalytics.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import type { Feature } from './types';
22

3+
import app from '../app';
34
import { getEnvValue } from '../utils';
45

56
const propertyId = getEnvValue('NEXT_PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID');
67

78
const title = 'Google analytics';
89

910
const config: Feature<{ propertyId: string }> = (() => {
10-
if (propertyId) {
11+
if (app.appProfile !== 'private' && propertyId) {
1112
return Object.freeze({
1213
title,
1314
isEnabled: true,

configs/app/features/growthBook.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import type { Feature } from './types';
22

3+
import app from '../app';
34
import { getEnvValue } from '../utils';
45

56
const clientKey = getEnvValue('NEXT_PUBLIC_GROWTH_BOOK_CLIENT_KEY');
67

78
const title = 'GrowthBook feature flagging and A/B testing';
89

910
const config: Feature<{ clientKey: string }> = (() => {
10-
if (clientKey) {
11+
if (app.appProfile !== 'private' && clientKey) {
1112
return Object.freeze({
1213
title,
1314
isEnabled: true,

0 commit comments

Comments
 (0)