Procházet zdrojové kódy

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
Domagoj Kriskovic před 1 rokem
rodič
revize
b99a81cb25

+ 8 - 0
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),
       }
     })

+ 1 - 1
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": "",

+ 4 - 1
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<string, { annual: string; monthly: string }>
+  'ol-addonPrices': Record<
+    string,
+    { annual: string; monthly: string; annualDividedByTwelve: string }
+  >
   'ol-allInReconfirmNotificationPeriods': UserEmailData[]
   'ol-allowedExperiments': string[]
   'ol-allowedImageNames': AllowedImageName[]

+ 1 - 0
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",

+ 2 - 0
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))