1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-22 16:29:09 +01:00

Fix safari freezing when clicking premium option (#4560)

- Fixes #2267

Co-authored-by: Jason Ng <jng@bitwarden.com>
This commit is contained in:
Alex Brazier 2023-07-24 16:12:52 +01:00 committed by GitHub
parent 092d8a013e
commit 1a6573ba96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,11 @@ export class PremiumComponent extends BasePremiumComponent {
// Support old price string. Can be removed in future once all translations are properly updated.
const thePrice = this.currencyPipe.transform(this.price, "$");
this.priceString = i18nService.t("premiumPrice", thePrice);
// Safari extension crashes due to $1 appearing in the price string ($10.00). Escape the $ to fix.
const formattedPrice = this.platformUtilsService.isSafari()
? thePrice.replace("$", "$$$")
: thePrice;
this.priceString = i18nService.t("premiumPrice", formattedPrice);
if (this.priceString.indexOf("%price%") > -1) {
this.priceString = this.priceString.replace("%price%", thePrice);
}