|
| 1 | +diff --git a/packages/components/containers/unleash/UnleashFlagProvider.tsx b/packages/components/containers/unleash/UnleashFlagProvider.tsx |
| 2 | +index 1531d1450b..a8a8d44677 100644 |
| 3 | +--- a/packages/components/containers/unleash/UnleashFlagProvider.tsx |
| 4 | ++++ b/packages/components/containers/unleash/UnleashFlagProvider.tsx |
| 5 | +@@ -3,20 +3,21 @@ import { ReactNode } from 'react'; |
| 6 | + import FlagProvider from '@unleash/proxy-client-react'; |
| 7 | + import { IConfig } from 'unleash-proxy-client'; |
| 8 | + |
| 9 | +-import { Api } from '@proton/shared/lib/interfaces'; |
| 10 | ++import { Api, ProtonConfig } from '@proton/shared/lib/interfaces'; |
| 11 | + |
| 12 | + import useApi from '../../hooks/useApi'; |
| 13 | ++import { useConfig } from '@proton/components/hooks'; |
| 14 | + |
| 15 | + // Just something dummy to have a valid domain because the library does new URL |
| 16 | + const prefix = 'https://proton.me/'; |
| 17 | + const url = new URL(prefix); |
| 18 | + |
| 19 | + const customFetch = |
| 20 | +- (api: Api): typeof window.fetch => |
| 21 | ++ (api: Api, {API_URL}: ProtonConfig): typeof window.fetch => |
| 22 | + (url, config) => { |
| 23 | + if (typeof url === 'string') { |
| 24 | + return api({ |
| 25 | +- url: `feature/v2/frontend${url.replace(prefix, '')}`, |
| 26 | ++ url: `${API_URL}/feature/v2/frontend${url.replace(prefix, '')}`, |
| 27 | + headers: config?.headers, |
| 28 | + silence: true, |
| 29 | + output: 'raw', |
| 30 | +@@ -30,6 +31,7 @@ interface Props { |
| 31 | + } |
| 32 | + |
| 33 | + const UnleashFlagProvider = ({ children }: Props) => { |
| 34 | ++ const config = useConfig(); |
| 35 | + const api = useApi(); |
| 36 | + const unleashConfig: IConfig = { |
| 37 | + url, |
| 38 | +@@ -37,7 +39,7 @@ const UnleashFlagProvider = ({ children }: Props) => { |
| 39 | + appName: '-', // set by the server |
| 40 | + refreshInterval: 600, // refreshInterval in seconds, 10 mins |
| 41 | + disableMetrics: true, |
| 42 | +- fetch: customFetch(api), |
| 43 | ++ fetch: customFetch(api, config), |
| 44 | + }; |
| 45 | + |
| 46 | + return <FlagProvider config={unleashConfig}>{children}</FlagProvider>; |
| 47 | + |
| 48 | +diff --git a/packages/pack/scripts/validate.sh b/packages/pack/scripts/validate.sh |
| 49 | +index 1a2ea64..bae388c 100755 |
| 50 | +--- a/packages/pack/scripts/validate.sh |
| 51 | ++++ b/packages/pack/scripts/validate.sh |
| 52 | +@@ -58,7 +58,7 @@ function main { |
| 53 | + fi; |
| 54 | + |
| 55 | + if [ "$hasSourceMap" -eq 0 ]; then |
| 56 | +- hasError=true; |
| 57 | ++ #hasError=true; |
| 58 | + echo "[error] no SourceMaps found inside the directory: $OUTPUT_DIR"; |
| 59 | + fi; |
| 60 | + |
| 61 | +diff --git a/packages/pack/bin/protonPack.js b/packages/pack/bin/protonPack.js |
| 62 | +index 55715b89d..c87879ad4 100755 |
| 63 | +--- a/packages/pack/bin/protonPack.js |
| 64 | ++++ b/packages/pack/bin/protonPack.js |
| 65 | +@@ -81,7 +81,7 @@ addGlobalOptions(program.command('build').description('create an optimized produ |
| 66 | + const outputPath = path.resolve('./dist'); |
| 67 | + await commandWithLog(`rm -rf ${outputPath}`); |
| 68 | + await commandWithLog( |
| 69 | +- `${require.resolve('webpack-cli/bin/cli.js')} --progress --output-path=${outputPath} ${webpackArgs}`, |
| 70 | ++ `${require.resolve('webpack-cli/bin/cli.js')} --output-path=${outputPath} ${webpackArgs}`, |
| 71 | + { |
| 72 | + stdio: 'inherit', |
| 73 | + } |
| 74 | + |
| 75 | +diff --git a/packages/shared/lib/helpers/browser.ts b/packages/shared/lib/helpers/browser.ts |
| 76 | +index 9aaa78a28..f3d24b47c 100644 |
| 77 | +--- a/packages/shared/lib/helpers/browser.ts |
| 78 | ++++ b/packages/shared/lib/helpers/browser.ts |
| 79 | +@@ -1,6 +1,21 @@ |
| 80 | + import UAParser from 'ua-parser-js'; |
| 81 | + |
| 82 | + const uaParser = new UAParser(); |
| 83 | ++{ |
| 84 | ++ const platform = String(navigator.platform); |
| 85 | ++ const userAgents = { |
| 86 | ++ linux: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36", |
| 87 | ++ windows: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36", |
| 88 | ++ macos: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36" |
| 89 | ++ } as const; |
| 90 | ++ uaParser.setUA( |
| 91 | ++ platform.startsWith("Linux") |
| 92 | ++ ? userAgents.linux |
| 93 | ++ : platform.startsWith("Win") |
| 94 | ++ ? userAgents.windows |
| 95 | ++ : userAgents.macos |
| 96 | ++ ); |
| 97 | ++} |
| 98 | + const ua = uaParser.getResult(); |
| 99 | + |
| 100 | + export const hasModulesSupport = () => { |
| 101 | +@@ -89,20 +104,10 @@ export const requireDirectAction = () => isSafari() || isFirefox() || isEdge(); |
| 102 | + * @links { https://mathiasbynens.github.io/rel-noopener/} |
| 103 | + */ |
| 104 | + export const openNewTab = (url: string) => { |
| 105 | +- if (isIE11()) { |
| 106 | +- const otherWindow = window.open(); |
| 107 | +- if (!otherWindow) { |
| 108 | +- return; |
| 109 | +- } |
| 110 | +- otherWindow.opener = null; |
| 111 | +- otherWindow.location.href = url; |
| 112 | +- return; |
| 113 | +- } |
| 114 | +- const anchor = document.createElement('a'); |
| 115 | +- |
| 116 | +- anchor.setAttribute('rel', 'noreferrer nofollow noopener'); |
| 117 | +- anchor.setAttribute('target', '_blank'); |
| 118 | +- anchor.href = url; |
| 119 | +- |
| 120 | +- return anchor.click(); |
| 121 | ++ window.dispatchEvent( |
| 122 | ++ new CustomEvent( |
| 123 | ++ "electron-mail:packages/shared/lib/helpers/browser.ts:openNewTab", |
| 124 | ++ {detail: {url}}, |
| 125 | ++ ), |
| 126 | ++ ); |
| 127 | + }; |
| 128 | + |
| 129 | +diff --git a/packages/components/components/link/SettingsLink.tsx b/packages/components/components/link/SettingsLink.tsx |
| 130 | +index 5081c4003..cde37c0cb 100644 |
| 131 | +--- a/packages/components/components/link/SettingsLink.tsx |
| 132 | ++++ b/packages/components/components/link/SettingsLink.tsx |
| 133 | +@@ -48,7 +48,7 @@ const SettingsLink = ({ path, app, children, ...rest }: Props, ref: Ref<HTMLAnch |
| 134 | + ref={ref} |
| 135 | + toApp={APPS.PROTONACCOUNT} |
| 136 | + // If going to settings for the same app |
| 137 | +- target={canOpenInSameTab(APP_NAME, settingsApp, toSettingsForApp) ? '_self' : '_blank'} |
| 138 | ++ target={canOpenInSameTab(APP_NAME, settingsApp, toSettingsForApp) || app === APPS.PROTONVPN_SETTINGS ? '_self' : '_blank'} |
| 139 | + {...rest} |
| 140 | + > |
| 141 | + {children} |
| 142 | + |
| 143 | +diff --git a/packages/components/helpers/earlyAccessDesynchronization.ts b/packages/components/helpers/earlyAccessDesynchronization.ts |
| 144 | +index 36bd0c712..c2fb3681c 100644 |
| 145 | +--- a/packages/components/helpers/earlyAccessDesynchronization.ts |
| 146 | ++++ b/packages/components/helpers/earlyAccessDesynchronization.ts |
| 147 | +@@ -42,6 +42,7 @@ export const handleEarlyAccessDesynchronization = ({ |
| 148 | + earlyAccessScope: Feature<Environment> | undefined; |
| 149 | + appName: APP_NAMES; |
| 150 | + }) => { |
| 151 | ++ return; |
| 152 | + if (doesNotSupportEarlyAccessVersion()) { |
| 153 | + return; |
| 154 | + } |
| 155 | + |
| 156 | +diff --git a/applications/mail/src/app/components/list/banners/auto-delete/variations/AutoDeleteFreeBanner.tsx b/applications/mail/src/app/components/list/banners/auto-delete/variations/AutoDeleteFreeBanner.tsx |
| 157 | +index 24c56ef6fe..a6046b391c 100644 |
| 158 | +--- a/applications/mail/src/app/components/list/banners/auto-delete/variations/AutoDeleteFreeBanner.tsx |
| 159 | ++++ b/applications/mail/src/app/components/list/banners/auto-delete/variations/AutoDeleteFreeBanner.tsx |
| 160 | +@@ -7,6 +7,10 @@ import { AutoDeleteUpsellModal, useModalState } from '@proton/components/compone |
| 161 | + import { PromotionBanner } from '@proton/components/containers'; |
| 162 | + |
| 163 | + const AutoDeleteFreeBanner = () => { |
| 164 | ++ if (___ELECTRON_MAIL_PROTON_SUPPRESS_UPSELL_ADS_PLACEHOLDER___) { |
| 165 | ++ return null; |
| 166 | ++ } |
| 167 | ++ |
| 168 | + const [upsellModalProps, toggleUpsellModal, renderUpsellModal] = useModalState(); |
| 169 | + |
| 170 | + return ( |
| 171 | + |
| 172 | +diff --git a/applications/mail/src/app/hooks/useShowUpsellBanner.ts b/applications/mail/src/app/hooks/useShowUpsellBanner.ts |
| 173 | +index b82b7ae976..0907c85ec6 100644 |
| 174 | +--- a/applications/mail/src/app/hooks/useShowUpsellBanner.ts |
| 175 | ++++ b/applications/mail/src/app/hooks/useShowUpsellBanner.ts |
| 176 | +@@ -33,12 +33,14 @@ const useShowUpsellBanner = (labelID: string) => { |
| 177 | + - No other banner is shown in the message list |
| 178 | + - If a value is found in the localStorage that should trigger a new display |
| 179 | + */ |
| 180 | ++ /* <electron-mail-mark> */ |
| 181 | + const canDisplayUpsellBanner = |
| 182 | + user.isFree && |
| 183 | + Date.now() > threeDaysAfterCreationDate && |
| 184 | + isInbox && |
| 185 | + needToShowUpsellBanner.current && |
| 186 | + showAgain; |
| 187 | ++ /* </electron-mail-mark> */ |
| 188 | + |
| 189 | + const handleDismissBanner = () => { |
| 190 | + // Set the ref to false so that we hide the banner and update the localStorage value |
| 191 | +@@ -71,6 +73,10 @@ const useShowUpsellBanner = (labelID: string) => { |
| 192 | + } |
| 193 | + }, []); |
| 194 | + |
| 195 | ++ if (___ELECTRON_MAIL_PROTON_SUPPRESS_UPSELL_ADS_PLACEHOLDER___) { |
| 196 | ++ return { canDisplayUpsellBanner: false, needToShowUpsellBanner, handleDismissBanner }; |
| 197 | ++ } |
| 198 | ++ |
| 199 | + return { canDisplayUpsellBanner, needToShowUpsellBanner, handleDismissBanner }; |
| 200 | + }; |
| 201 | + |
| 202 | +diff --git a/packages/components/containers/heading/PrivateHeader.tsx b/packages/components/containers/heading/PrivateHeader.tsx |
| 203 | +index a7d2452313..73ad8a6828 100644 |
| 204 | +--- a/packages/components/containers/heading/PrivateHeader.tsx |
| 205 | ++++ b/packages/components/containers/heading/PrivateHeader.tsx |
| 206 | +@@ -49,7 +49,10 @@ const PrivateHeader = ({ |
| 207 | + |
| 208 | + <TopNavbar> |
| 209 | + <TopNavbarList> |
| 210 | +- {upsellButton !== undefined ? upsellButton : !hideUpsellButton && <TopNavbarUpsell app={app} />} |
| 211 | ++ {___ELECTRON_MAIL_PROTON_SUPPRESS_UPSELL_ADS_PLACEHOLDER___ |
| 212 | ++ ? null |
| 213 | ++ : (upsellButton !== undefined ? upsellButton : !hideUpsellButton && <TopNavbarUpsell app={app} />) |
| 214 | ++ } |
| 215 | + {feedbackButton ? <TopNavbarListItem noShrink>{feedbackButton}</TopNavbarListItem> : null} |
| 216 | + {settingsButton ? ( |
| 217 | + <TopNavbarListItem noShrink className="no-mobile"> |
| 218 | + |
| 219 | +diff --git a/packages/components/containers/api/ApiProvider.js b/packages/components/containers/api/ApiProvider.js |
| 220 | +index 3d1b81941c..6ac2f748fa 100644 |
| 221 | +--- a/packages/components/containers/api/ApiProvider.js |
| 222 | ++++ b/packages/components/containers/api/ApiProvider.js |
| 223 | +@@ -120,7 +120,9 @@ const ApiProvider = ({ config, onLogout, children, UID, noErrorState }) => { |
| 224 | + error.cancel = true; |
| 225 | + reject(error); |
| 226 | + }} |
| 227 | +- /> |
| 228 | ++ />, |
| 229 | ++ // trying to force single instance, see https://github.com/vladimiry/ElectronMail/issues/621#issuecomment-1627389416 |
| 230 | ++ "HumanVerificationModal_ID", |
| 231 | + ); |
| 232 | + }); |
| 233 | + }; |
0 commit comments