From b99a81cb25f0e31da49a63c69345fa0ef933cc53 Mon Sep 17 00:00:00 2001 From: Domagoj Kriskovic Date: Mon, 12 May 2025 12:14:37 +0200 Subject: [PATCH] Fix monthly price if billed annually for AI Assist (#25297) * Fix monthly price if billed annually for AI Assist * update script * show annual price * fix formatting GitOrigin-RevId: e50493fa2176e6c8acb476a01a393eb940a3f1a2 --- .../web/app/src/Features/Project/ProjectController.js | 8 ++++++++ services/web/frontend/extracted-translations.json | 2 +- services/web/frontend/js/utils/meta.ts | 5 ++++- services/web/locales/en.json | 1 + services/web/scripts/recurly/generate_addon_prices.mjs | 2 ++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/services/web/app/src/Features/Project/ProjectController.js b/services/web/app/src/Features/Project/ProjectController.js index 2d949a8753..f34e2522ec 100644 --- a/services/web/app/src/Features/Project/ProjectController.js +++ b/services/web/app/src/Features/Project/ProjectController.js @@ -949,9 +949,17 @@ const _ProjectController = { const annualPrice = Settings.localizedAddOnsPricing[currency][plan].annual const monthlyPrice = Settings.localizedAddOnsPricing[currency][plan].monthly + const annualDividedByTwelve = + Settings.localizedAddOnsPricing[currency][plan].annualDividedByTwelve plansData[plan] = { annual: formatCurrency(annualPrice, currency, locale, true), + annualDividedByTwelve: formatCurrency( + annualDividedByTwelve, + currency, + locale, + true + ), monthly: formatCurrency(monthlyPrice, currency, locale, true), } }) diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json index 608e758298..320db9714a 100644 --- a/services/web/frontend/extracted-translations.json +++ b/services/web/frontend/extracted-translations.json @@ -1203,7 +1203,7 @@ "pending_invite": "", "per_license": "", "per_month": "", - "per_month_billed_annually": "", + "per_month_x_annually": "", "percent_is_the_percentage_of_the_line_width": "", "permanently_disables_the_preview": "", "personal_library": "", diff --git a/services/web/frontend/js/utils/meta.ts b/services/web/frontend/js/utils/meta.ts index 6c7209a5bb..220cd0803f 100644 --- a/services/web/frontend/js/utils/meta.ts +++ b/services/web/frontend/js/utils/meta.ts @@ -55,7 +55,10 @@ import type { ScriptLogType } from '../../../modules/admin-panel/frontend/js/fea import { ActiveExperiment } from './labs-utils' export interface Meta { 'ol-ExposedSettings': ExposedSettings - 'ol-addonPrices': Record + 'ol-addonPrices': Record< + string, + { annual: string; monthly: string; annualDividedByTwelve: string } + > 'ol-allInReconfirmNotificationPeriods': UserEmailData[] 'ol-allowedExperiments': string[] 'ol-allowedImageNames': AllowedImageName[] diff --git a/services/web/locales/en.json b/services/web/locales/en.json index c2401427b7..779d61ecbf 100644 --- a/services/web/locales/en.json +++ b/services/web/locales/en.json @@ -1594,6 +1594,7 @@ "per_license": "per license", "per_month": "per month", "per_month_billed_annually": "per month, billed annually", + "per_month_x_annually": "per month, __price__ annually", "per_user_month": "per user / month", "per_user_year": "per user / year", "per_year": "per year", diff --git a/services/web/scripts/recurly/generate_addon_prices.mjs b/services/web/scripts/recurly/generate_addon_prices.mjs index 9885d46b06..37378e6baf 100644 --- a/services/web/scripts/recurly/generate_addon_prices.mjs +++ b/services/web/scripts/recurly/generate_addon_prices.mjs @@ -37,6 +37,8 @@ async function main() { localizedAddOnsPricing[currency] = { [ADD_ON_CODE]: {} } } localizedAddOnsPricing[currency][ADD_ON_CODE].annual = unitAmount + localizedAddOnsPricing[currency][ADD_ON_CODE].annualDividedByTwelve = + (unitAmount || 0) / 12 } console.log(JSON.stringify({ localizedAddOnsPricing }, null, 2))