mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 06:33:55 +01:00
Merge pull request #35836 from overleaf/rh-prices-split
[web] Update monthly plan prices for new subscriptions with split test GitOrigin-RevId: 42d0adaf68647adc93f4c05d5ddeefb356753db2
This commit is contained in:
+17
-6
@@ -21,6 +21,7 @@ import {
|
||||
import { Institution } from '../../../../../types/institution'
|
||||
import getMeta from '../../../utils/meta'
|
||||
import {
|
||||
formatPriceForDisplayData,
|
||||
loadDisplayPriceWithTaxPromise,
|
||||
loadGroupDisplayPriceWithTaxForRecurlyPromise,
|
||||
loadGroupDisplayPriceWithTaxForStripePromise,
|
||||
@@ -173,15 +174,25 @@ export function SubscriptionDashboardProvider({
|
||||
personalSubscription?.payment
|
||||
) {
|
||||
const { currency, taxRate } = personalSubscription.payment
|
||||
// Only Stripe subscriptions can be derived from the price version. Recurly only has one version of each price.
|
||||
const isStripe = Boolean(personalSubscription.service?.includes('stripe'))
|
||||
const fetchPlansDisplayPrices = async () => {
|
||||
for (const plan of plansWithoutDisplayPrice) {
|
||||
try {
|
||||
const priceData = await loadDisplayPriceWithTaxPromise(
|
||||
plan.planCode,
|
||||
currency,
|
||||
taxRate,
|
||||
i18n.language
|
||||
)
|
||||
const priceData =
|
||||
isStripe && plan.listPrice !== undefined
|
||||
? formatPriceForDisplayData(
|
||||
plan.listPrice,
|
||||
taxRate,
|
||||
currency,
|
||||
i18n.language
|
||||
)
|
||||
: await loadDisplayPriceWithTaxPromise(
|
||||
plan.planCode,
|
||||
currency,
|
||||
taxRate,
|
||||
i18n.language
|
||||
)
|
||||
if (priceData?.totalAsNumber !== undefined) {
|
||||
plan.displayPrice = formatCurrency(
|
||||
priceData.totalAsNumber,
|
||||
|
||||
Reference in New Issue
Block a user