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-17 11:01:00 +00:00
committed by Copybot
parent b750948e00
commit 8efac32c8a
4 changed files with 629 additions and 3 deletions
+43
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']