Add LATAM currencies/prices to plan and group settings/scripts (#13661)

* Add LATAM currencies to plan-prices generator script

* Add LATAM prices to web configs

* Add LATAM currencies to group plan price formatting

* Use toLocaleString to format currencies for LATAM regions

GitOrigin-RevId: ce672043bef16298c87efa007eac23b004be8205
This commit is contained in:
Thomas 2023-07-11 10:36:41 +02:00 committed by Copybot
parent b750948e00
commit 8efac32c8a
4 changed files with 629 additions and 3 deletions

View file

@ -24,6 +24,29 @@
"price_in_cents": 755000
}
},
"BRL": {
"2": {
"price_in_cents": 139800
},
"3": {
"price_in_cents": 209700
},
"4": {
"price_in_cents": 279600
},
"5": {
"price_in_cents": 349500
},
"10": {
"price_in_cents": 389000
},
"20": {
"price_in_cents": 718000
},
"50": {
"price_in_cents": 1645000
}
},
"CAD": {
"2": {
"price_in_cents": 62800
@ -70,6 +93,52 @@
"price_in_cents": 655000
}
},
"CLP": {
"2": {
"price_in_cents": 24498600
},
"3": {
"price_in_cents": 36747900
},
"4": {
"price_in_cents": 48997200
},
"5": {
"price_in_cents": 61246500
},
"10": {
"price_in_cents": 68246000
},
"20": {
"price_in_cents": 125992000
},
"50": {
"price_in_cents": 288730000
}
},
"COP": {
"2": {
"price_in_cents": 80626000
},
"3": {
"price_in_cents": 120939000
},
"4": {
"price_in_cents": 161252000
},
"5": {
"price_in_cents": 201565000
},
"10": {
"price_in_cents": 224601000
},
"20": {
"price_in_cents": 414648000
},
"50": {
"price_in_cents": 950235000
}
},
"DKK": {
"2": {
"price_in_cents": 333000
@ -162,6 +231,29 @@
"price_in_cents": 15835000
}
},
"MXN": {
"2": {
"price_in_cents": 615800
},
"3": {
"price_in_cents": 923700
},
"4": {
"price_in_cents": 1231600
},
"5": {
"price_in_cents": 1539500
},
"10": {
"price_in_cents": 1715000
},
"20": {
"price_in_cents": 3166000
},
"50": {
"price_in_cents": 7255000
}
},
"NOK": {
"2": {
"price_in_cents": 401600
@ -276,6 +368,29 @@
"50": {
"price_in_cents": 655000
}
},
"PEN": {
"2": {
"price_in_cents": 102000
},
"3": {
"price_in_cents": 153000
},
"4": {
"price_in_cents": 204000
},
"5": {
"price_in_cents": 255000
},
"10": {
"price_in_cents": 284000
},
"20": {
"price_in_cents": 524000
},
"50": {
"price_in_cents": 1200000
}
}
},
"collaborator": {
@ -302,6 +417,29 @@
"price_in_cents": 390000
}
},
"BRL": {
"2": {
"price_in_cents": 69800
},
"3": {
"price_in_cents": 104700
},
"4": {
"price_in_cents": 139600
},
"5": {
"price_in_cents": 174500
},
"10": {
"price_in_cents": 194000
},
"20": {
"price_in_cents": 358000
},
"50": {
"price_in_cents": 820000
}
},
"CAD": {
"2": {
"price_in_cents": 32000
@ -348,6 +486,52 @@
"price_in_cents": 325000
}
},
"CLP": {
"2": {
"price_in_cents": 12318600
},
"3": {
"price_in_cents": 18477900
},
"4": {
"price_in_cents": 24637200
},
"5": {
"price_in_cents": 30796500
},
"10": {
"price_in_cents": 34316000
},
"20": {
"price_in_cents": 63352000
},
"50": {
"price_in_cents": 145180000
}
},
"COP": {
"2": {
"price_in_cents": 40026000
},
"3": {
"price_in_cents": 60039000
},
"4": {
"price_in_cents": 80052000
},
"5": {
"price_in_cents": 100065000
},
"10": {
"price_in_cents": 111501000
},
"20": {
"price_in_cents": 205848000
},
"50": {
"price_in_cents": 471735000
}
},
"DKK": {
"2": {
"price_in_cents": 167800
@ -440,6 +624,29 @@
"price_in_cents": 7585000
}
},
"MXN": {
"2": {
"price_in_cents": 307800
},
"3": {
"price_in_cents": 461700
},
"4": {
"price_in_cents": 615600
},
"5": {
"price_in_cents": 769500
},
"10": {
"price_in_cents": 857000
},
"20": {
"price_in_cents": 1582000
},
"50": {
"price_in_cents": 3625000
}
},
"NOK": {
"2": {
"price_in_cents": 202800
@ -554,6 +761,29 @@
"50": {
"price_in_cents": 325000
}
},
"PEN": {
"2": {
"price_in_cents": 51600
},
"3": {
"price_in_cents": 77400
},
"4": {
"price_in_cents": 103200
},
"5": {
"price_in_cents": 129000
},
"10": {
"price_in_cents": 143000
},
"20": {
"price_in_cents": 264000
},
"50": {
"price_in_cents": 605000
}
}
}
},
@ -582,6 +812,29 @@
"price_in_cents": 1260000
}
},
"BRL": {
"2": {
"price_in_cents": 139800
},
"3": {
"price_in_cents": 209700
},
"4": {
"price_in_cents": 279600
},
"5": {
"price_in_cents": 349500
},
"10": {
"price_in_cents": 649000
},
"20": {
"price_in_cents": 1198000
},
"50": {
"price_in_cents": 2745000
}
},
"CAD": {
"2": {
"price_in_cents": 62800
@ -628,6 +881,52 @@
"price_in_cents": 1095000
}
},
"CLP": {
"2": {
"price_in_cents": 24498600
},
"3": {
"price_in_cents": 36747900
},
"4": {
"price_in_cents": 48997200
},
"5": {
"price_in_cents": 61246500
},
"10": {
"price_in_cents": 113743000
},
"20": {
"price_in_cents": 209988000
},
"50": {
"price_in_cents": 481220000
}
},
"COP": {
"2": {
"price_in_cents": 80626000
},
"3": {
"price_in_cents": 120939000
},
"4": {
"price_in_cents": 161252000
},
"5": {
"price_in_cents": 201565000
},
"10": {
"price_in_cents": 374335000
},
"20": {
"price_in_cents": 691080000
},
"50": {
"price_in_cents": 1583725000
}
},
"DKK": {
"2": {
"price_in_cents": 333000
@ -720,6 +1019,29 @@
"price_in_cents": 26395000
}
},
"MXN": {
"2": {
"price_in_cents": 615800
},
"3": {
"price_in_cents": 923700
},
"4": {
"price_in_cents": 1231600
},
"5": {
"price_in_cents": 1539500
},
"10": {
"price_in_cents": 2859000
},
"20": {
"price_in_cents": 5278000
},
"50": {
"price_in_cents": 12095000
}
},
"NOK": {
"2": {
"price_in_cents": 401600
@ -834,6 +1156,29 @@
"50": {
"price_in_cents": 1095000
}
},
"PEN": {
"2": {
"price_in_cents": 102000
},
"3": {
"price_in_cents": 153000
},
"4": {
"price_in_cents": 204000
},
"5": {
"price_in_cents": 255000
},
"10": {
"price_in_cents": 473000
},
"20": {
"price_in_cents": 874000
},
"50": {
"price_in_cents": 2000000
}
}
},
"collaborator": {
@ -860,6 +1205,29 @@
"price_in_cents": 655000
}
},
"BRL": {
"2": {
"price_in_cents": 69800
},
"3": {
"price_in_cents": 104700
},
"4": {
"price_in_cents": 139600
},
"5": {
"price_in_cents": 174500
},
"10": {
"price_in_cents": 324000
},
"20": {
"price_in_cents": 598000
},
"50": {
"price_in_cents": 1370000
}
},
"CAD": {
"2": {
"price_in_cents": 32000
@ -906,6 +1274,52 @@
"price_in_cents": 545000
}
},
"CLP": {
"2": {
"price_in_cents": 12318600
},
"3": {
"price_in_cents": 18477900
},
"4": {
"price_in_cents": 24637200
},
"5": {
"price_in_cents": 30796500
},
"10": {
"price_in_cents": 57193000
},
"20": {
"price_in_cents": 105588000
},
"50": {
"price_in_cents": 241970000
}
},
"COP": {
"2": {
"price_in_cents": 40026000
},
"3": {
"price_in_cents": 60039000
},
"4": {
"price_in_cents": 80052000
},
"5": {
"price_in_cents": 100065000
},
"10": {
"price_in_cents": 185835000
},
"20": {
"price_in_cents": 343080000
},
"50": {
"price_in_cents": 786225000
}
},
"DKK": {
"2": {
"price_in_cents": 167800
@ -998,6 +1412,29 @@
"price_in_cents": 12645000
}
},
"MXN": {
"2": {
"price_in_cents": 307800
},
"3": {
"price_in_cents": 461700
},
"4": {
"price_in_cents": 615600
},
"5": {
"price_in_cents": 769500
},
"10": {
"price_in_cents": 1429000
},
"20": {
"price_in_cents": 2638000
},
"50": {
"price_in_cents": 6045000
}
},
"NOK": {
"2": {
"price_in_cents": 202800
@ -1112,6 +1549,29 @@
"50": {
"price_in_cents": 545000
}
},
"PEN": {
"2": {
"price_in_cents": 51600
},
"3": {
"price_in_cents": 77400
},
"4": {
"price_in_cents": 103200
},
"5": {
"price_in_cents": 129000
},
"10": {
"price_in_cents": 239000
},
"20": {
"price_in_cents": 442000
},
"50": {
"price_in_cents": 1010000
}
}
}
}

View file

@ -1,5 +1,13 @@
import getMeta from '../../../utils/meta'
const LOCALES = {
BRL: 'pt-BR',
MXN: 'es-MX',
COP: 'es-CO',
CLP: 'es-CL',
PEN: 'es-PE',
}
// plan: 'collaborator' or 'professional'
// the rest of available arguments can be seen in the groupPlans value
export function createLocalizedGroupPlanPrice({
@ -27,13 +35,33 @@ export function createLocalizedGroupPlanPrice({
const currencySymbol = currencySymbols[currency]
switch (currencySymbol) {
case 'Fr':
switch (currency) {
case 'BRL':
case 'MXN':
case 'COP':
case 'CLP':
case 'PEN':
// Test using toLocaleString to format currencies for new LATAM regions
return {
localizedPrice: price.toLocaleString(LOCALES[currency], {
style: 'currency',
currency,
minimumFractionDigits: 0,
}),
localizedPerUserPrice: perUserPrice.toLocaleString(LOCALES[currency], {
style: 'currency',
currency,
minimumFractionDigits: Number.isInteger(perUserPrice) ? 0 : null,
}),
}
case 'CHF':
return {
localizedPrice: `${currencySymbol} ${strPrice}`,
localizedPerUserPrice: `${currencySymbol} ${strPerUserPrice}`,
}
case 'kr':
case 'DKK':
case 'SEK':
case 'NOK':
return {
localizedPrice: `${strPrice} ${currencySymbol}`,
localizedPerUserPrice: `${strPerUserPrice} ${currencySymbol}`,

View file

@ -240,6 +240,101 @@ App.factory('MultiCurrencyPricing', function () {
annual: '₹9599',
},
},
BRL: {
symbol: 'R$',
student: {
monthly: 'R$ 23',
annual: 'R$ 229',
},
personal: {
monthly: 'R$ 35',
annual: 'R$ 329',
},
collaborator: {
monthly: 'R$ 55',
annual: 'R$ 499',
},
professional: {
monthly: 'R$ 109',
annual: 'R$ 999',
},
},
MXN: {
symbol: '$',
student: {
monthly: '$99',
annual: '$999',
},
personal: {
monthly: '$149',
annual: '$1,399',
},
collaborator: {
monthly: '$229',
annual: '$2,199',
},
professional: {
monthly: '$459',
annual: '$4,399',
},
},
COP: {
symbol: '$',
student: {
monthly: '$ 12.900',
annual: '$ 129.900',
},
personal: {
monthly: '$ 21.900',
annual: '$ 185.900',
},
collaborator: {
monthly: '$ 29.900',
annual: '$ 285.900',
},
professional: {
monthly: '$ 59.900',
annual: '$ 575.900',
},
},
CLP: {
symbol: '$',
student: {
monthly: '$3.990',
annual: '$38.990',
},
personal: {
monthly: '$6.190',
annual: '$56.990',
},
collaborator: {
monthly: '$9.190',
annual: '$87.990',
},
professional: {
monthly: '$18.990',
annual: '$174.990',
},
},
PEN: {
symbol: 'S/',
student: {
monthly: 'S/ 16',
annual: 'S/ 159',
},
personal: {
monthly: 'S/ 26',
annual: 'S/ 239',
},
collaborator: {
monthly: 'S/ 39',
annual: 'S/ 369',
},
professional: {
monthly: 'S/ 76',
annual: 'S/ 729',
},
},
},
}
})

View file

@ -110,9 +110,47 @@ const currencies = {
symbol: '₹',
placement: 'before',
},
BRL: {
code: 'BRL',
locale: 'pt-BR',
symbol: 'R$ ',
placement: 'before',
},
MXN: {
code: 'MXN',
locale: 'es-MX',
symbol: '$ ',
placement: 'before',
},
COP: {
code: 'COP',
locale: 'es-CO',
symbol: '$ ',
placement: 'before',
},
CLP: {
code: 'CLP',
locale: 'es-CL',
symbol: '$ ',
placement: 'before',
},
PEN: {
code: 'PEN',
locale: 'es-PE',
symbol: 'S/ ',
placement: 'before',
},
}
const buildCurrencyValue = (amount, currency) => {
// Test using toLocaleString to format currencies for new LATAM regions
if (currency.locale && currency.code) {
return amount.toLocaleString(currency.locale, {
style: 'currency',
currency: currency.code,
minimumFractionDigits: 0,
})
}
return currency.placement === 'before'
? `${currency.symbol}${amount}`
: `${amount}${currency.symbol}`
@ -177,17 +215,22 @@ function generateGroupPlans(workSheetJSON) {
const currencies = [
'AUD',
'BRL',
'CAD',
'CHF',
'CLP',
'COP',
'DKK',
'EUR',
'GBP',
'INR',
'MXN',
'NOK',
'NZD',
'SEK',
'SGD',
'USD',
'PEN',
]
const sizes = ['2', '3', '4', '5', '10', '20', '50']