fix: refactored currency code data to remove duplication problem (#32242)

## Description
we are refactoring the data used for currency input widget such that
there are no duplicate entries and also add missing general entries.
[Internal conversation
ref](https://theappsmith.slack.com/archives/C025SE88KNE/p1711612283549969)

Fixes #31806
This commit is contained in:
Somangshu Goswami 2024-03-29 16:12:23 +05:30 committed by GitHub
parent c92dc4775e
commit d7e6584d47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 649 deletions

View File

@ -63,7 +63,7 @@ describe(
_.deployMode.DeployApp();
cy.get(".bp3-button.select-button").click({ force: true });
cy.get(".menu-item-text").first().click({ force: true });
cy.get(".t--widget-textwidget").should("contain", "USD:AS:USD");
cy.get(".t--widget-textwidget").should("contain", "USD:US:USD");
cy.get(".t--input-currency-change").should("contain", "$");
cy.get(".bp3-button.select-button").click({ force: true });
cy.get(".menu-item-text").last().click({ force: true });

View File

@ -44,10 +44,10 @@ describe(
}
[
//[input, {{CurrencyInput1.text}}:{{CurrencyInput1.value}}:{{CurrencyInput1.isValid}}:{{typeof CurrencyInput1.text}}:{{typeof CurrencyInput1.value}}:{{CurrencyInput1.countryCode}}:{{CurrencyInput1.currencyCode}}]
["100", "100:100:true:string:number:AS:USD"],
["1000", "1,000:1000:true:string:number:AS:USD"],
["100.22", "10,022:10022:true:string:number:AS:USD"],
["1000.22", "100,022:100022:true:string:number:AS:USD"],
["100", "100:100:true:string:number:US:USD"],
["1000", "1,000:1000:true:string:number:US:USD"],
["100.22", "10,022:10022:true:string:number:US:USD"],
["1000.22", "100,022:100022:true:string:number:US:USD"],
].forEach((d) => {
enterAndTest(d[0], d[1]);
});
@ -57,10 +57,10 @@ describe(
[
//[input, {{CurrencyInput1.text}}:{{CurrencyInput1.value}}:{{CurrencyInput1.isValid}}:{{typeof CurrencyInput1.text}}:{{typeof CurrencyInput1.value}}:{{CurrencyInput1.countryCode}}:{{CurrencyInput1.currencyCode}}]
["100", "100:100:true:string:number:AS:USD"],
["1000", "1,000:1000:true:string:number:AS:USD"],
["100.22", "100.2:100.2:true:string:number:AS:USD"],
["1000.22", "1,000.2:1000.2:true:string:number:AS:USD"],
["100", "100:100:true:string:number:US:USD"],
["1000", "1,000:1000:true:string:number:US:USD"],
["100.22", "100.2:100.2:true:string:number:US:USD"],
["1000.22", "1,000.2:1000.2:true:string:number:US:USD"],
].forEach((d) => {
enterAndTest(d[0], d[1]);
});
@ -70,10 +70,10 @@ describe(
[
//[input, {{CurrencyInput1.text}}:{{CurrencyInput1.value}}:{{CurrencyInput1.isValid}}:{{typeof CurrencyInput1.text}}:{{typeof CurrencyInput1.value}}:{{CurrencyInput1.countryCode}}:{{CurrencyInput1.currencyCode}}]
["100", "100:100:true:string:number:AS:USD"],
["1000", "1,000:1000:true:string:number:AS:USD"],
["100.22", "100.22:100.22:true:string:number:AS:USD"],
["1000.22", "1,000.22:1000.22:true:string:number:AS:USD"],
["100", "100:100:true:string:number:US:USD"],
["1000", "1,000:1000:true:string:number:US:USD"],
["100.22", "100.22:100.22:true:string:number:US:USD"],
["1000.22", "1,000.22:1000.22:true:string:number:US:USD"],
].forEach((d) => {
enterAndTest(d[0], d[1]);
});

View File

@ -10,14 +10,6 @@ export interface CurrencyOptionProps {
}
export const CurrencyTypeOptions = [
{
code: "AD",
currency: "EUR",
currency_name: "Euro",
label: "Andorra",
phone: "376",
symbol_native: "€",
},
{
code: "AE",
currency: "AED",
@ -58,22 +50,6 @@ export const CurrencyTypeOptions = [
phone: "54",
symbol_native: "$",
},
{
code: "AS",
currency: "USD",
currency_name: "US Dollar",
label: "American Samoa",
phone: "1-684",
symbol_native: "$",
},
{
code: "AT",
currency: "EUR",
currency_name: "Euro",
label: "Austria",
phone: "43",
symbol_native: "€",
},
{
code: "AU",
currency: "AUD",
@ -82,14 +58,6 @@ export const CurrencyTypeOptions = [
phone: "61",
symbol_native: "$",
},
{
code: "AX",
currency: "EUR",
currency_name: "Euro",
label: "Alland Islands",
phone: "358",
symbol_native: "€",
},
{
code: "AZ",
currency: "AZN",
@ -114,22 +82,6 @@ export const CurrencyTypeOptions = [
phone: "880",
symbol_native: "৳",
},
{
code: "BE",
currency: "EUR",
currency_name: "Euro",
label: "Belgium",
phone: "32",
symbol_native: "€",
},
{
code: "BF",
currency: "XOF",
currency_name: "CFA Franc BCEAO",
label: "Burkina Faso",
phone: "226",
symbol_native: "CFA",
},
{
code: "BG",
currency: "BGN",
@ -154,22 +106,6 @@ export const CurrencyTypeOptions = [
phone: "257",
symbol_native: "FBu",
},
{
code: "BJ",
currency: "XOF",
currency_name: "CFA Franc BCEAO",
label: "Benin",
phone: "229",
symbol_native: "CFA",
},
{
code: "BL",
currency: "EUR",
currency_name: "Euro",
label: "Saint Barthelemy",
phone: "590",
symbol_native: "€",
},
{
code: "BN",
currency: "BND",
@ -234,14 +170,6 @@ export const CurrencyTypeOptions = [
phone: "1",
symbol_native: "$",
},
{
code: "CC",
currency: "AUD",
currency_name: "Australian Dollar",
label: "Cocos (Keeling) Islands",
phone: "61",
symbol_native: "$",
},
{
code: "CD",
currency: "CDF",
@ -258,14 +186,6 @@ export const CurrencyTypeOptions = [
phone: "236",
symbol_native: "FCFA",
},
{
code: "CG",
currency: "XAF",
currency_name: "CFA Franc BEAC",
label: "Congo, Republic of the",
phone: "242",
symbol_native: "FCFA",
},
{
code: "CH",
currency: "CHF",
@ -274,22 +194,6 @@ export const CurrencyTypeOptions = [
phone: "41",
symbol_native: "CHF",
},
{
code: "CI",
currency: "XOF",
currency_name: "CFA Franc BCEAO",
label: "Cote d'Ivoire",
phone: "225",
symbol_native: "CFA",
},
{
code: "CK",
currency: "NZD",
currency_name: "New Zealand Dollar",
label: "Cook Islands",
phone: "682",
symbol_native: "$",
},
{
code: "CL",
currency: "CLP",
@ -298,14 +202,6 @@ export const CurrencyTypeOptions = [
phone: "56",
symbol_native: "$",
},
{
code: "CM",
currency: "XAF",
currency_name: "CFA Franc BEAC",
label: "Cameroon",
phone: "237",
symbol_native: "FCFA",
},
{
code: "CN",
currency: "CNY",
@ -338,22 +234,6 @@ export const CurrencyTypeOptions = [
phone: "238",
symbol_native: "CV$",
},
{
code: "CX",
currency: "AUD",
currency_name: "Australian Dollar",
label: "Christmas Island",
phone: "61",
symbol_native: "$",
},
{
code: "CY",
currency: "EUR",
currency_name: "Euro",
label: "Cyprus",
phone: "357",
symbol_native: "€",
},
{
code: "CZ",
currency: "CZK",
@ -362,14 +242,6 @@ export const CurrencyTypeOptions = [
phone: "420",
symbol_native: "Kč",
},
{
code: "DE",
currency: "EUR",
currency_name: "Euro",
label: "Germany",
phone: "49",
symbol_native: "€",
},
{
code: "DJ",
currency: "DJF",
@ -402,22 +274,6 @@ export const CurrencyTypeOptions = [
phone: "213",
symbol_native: "د.ج.",
},
{
code: "EC",
currency: "USD",
currency_name: "US Dollar",
label: "Ecuador",
phone: "593",
symbol_native: "$",
},
{
code: "EE",
currency: "EUR",
currency_name: "Euro",
label: "Estonia",
phone: "372",
symbol_native: "€",
},
{
code: "EG",
currency: "EGP",
@ -426,14 +282,6 @@ export const CurrencyTypeOptions = [
phone: "20",
symbol_native: "ج.م.",
},
{
code: "EH",
currency: "MAD",
currency_name: "Moroccan Dirham",
label: "Western Sahara",
phone: "212",
symbol_native: "د.م.",
},
{
code: "ER",
currency: "ERN",
@ -443,11 +291,11 @@ export const CurrencyTypeOptions = [
symbol_native: "Nfk",
},
{
code: "ES",
code: "EU",
currency: "EUR",
currency_name: "Euro",
label: "Spain",
phone: "34",
label: "European Union",
phone: "",
symbol_native: "€",
},
{
@ -458,46 +306,6 @@ export const CurrencyTypeOptions = [
phone: "251",
symbol_native: "Br",
},
{
code: "FI",
currency: "EUR",
currency_name: "Euro",
label: "Finland",
phone: "358",
symbol_native: "€",
},
{
code: "FM",
currency: "USD",
currency_name: "US Dollar",
label: "Micronesia, Federated States of",
phone: "691",
symbol_native: "$",
},
{
code: "FO",
currency: "DKK",
currency_name: "Danish Krone",
label: "Faroe Islands",
phone: "298",
symbol_native: "kr",
},
{
code: "FR",
currency: "EUR",
currency_name: "Euro",
label: "France",
phone: "33",
symbol_native: "€",
},
{
code: "GA",
currency: "XAF",
currency_name: "CFA Franc BEAC",
label: "Gabon",
phone: "241",
symbol_native: "FCFA",
},
{
code: "GB",
currency: "GBP",
@ -514,22 +322,6 @@ export const CurrencyTypeOptions = [
phone: "995",
symbol_native: "GEL",
},
{
code: "GF",
currency: "EUR",
currency_name: "Euro",
label: "French Guiana",
phone: "594",
symbol_native: "€",
},
{
code: "GG",
currency: "GBP",
currency_name: "British Pound Sterling",
label: "Guernsey",
phone: "44",
symbol_native: "£",
},
{
code: "GH",
currency: "GHS",
@ -538,14 +330,6 @@ export const CurrencyTypeOptions = [
phone: "233",
symbol_native: "GH₵",
},
{
code: "GL",
currency: "DKK",
currency_name: "Danish Krone",
label: "Greenland",
phone: "299",
symbol_native: "kr",
},
{
code: "GN",
currency: "GNF",
@ -554,38 +338,6 @@ export const CurrencyTypeOptions = [
phone: "224",
symbol_native: "FG",
},
{
code: "GP",
currency: "EUR",
currency_name: "Euro",
label: "Guadeloupe",
phone: "590",
symbol_native: "€",
},
{
code: "GQ",
currency: "XAF",
currency_name: "CFA Franc BEAC",
label: "Equatorial Guinea",
phone: "240",
symbol_native: "FCFA",
},
{
code: "GR",
currency: "EUR",
currency_name: "Euro",
label: "Greece",
phone: "30",
symbol_native: "€",
},
{
code: "GS",
currency: "GBP",
currency_name: "British Pound Sterling",
label: "South Georgia and the South Sandwich Islands",
phone: "500",
symbol_native: "£",
},
{
code: "GT",
currency: "GTQ",
@ -594,22 +346,6 @@ export const CurrencyTypeOptions = [
phone: "502",
symbol_native: "Q",
},
{
code: "GU",
currency: "USD",
currency_name: "US Dollar",
label: "Guam",
phone: "1-671",
symbol_native: "$",
},
{
code: "GW",
currency: "XOF",
currency_name: "CFA Franc BCEAO",
label: "Guinea-Bissau",
phone: "245",
symbol_native: "CFA",
},
{
code: "HK",
currency: "HKD",
@ -618,14 +354,6 @@ export const CurrencyTypeOptions = [
phone: "852",
symbol_native: "$",
},
{
code: "HM",
currency: "AUD",
currency_name: "Australian Dollar",
label: "Heard Island and McDonald Islands",
phone: "672",
symbol_native: "$",
},
{
code: "HN",
currency: "HNL",
@ -658,14 +386,6 @@ export const CurrencyTypeOptions = [
phone: "62",
symbol_native: "Rp",
},
{
code: "IE",
currency: "EUR",
currency_name: "Euro",
label: "Ireland",
phone: "353",
symbol_native: "€",
},
{
code: "IL",
currency: "ILS",
@ -674,14 +394,6 @@ export const CurrencyTypeOptions = [
phone: "972",
symbol_native: "₪",
},
{
code: "IM",
currency: "GBP",
currency_name: "British Pound Sterling",
label: "Isle of Man",
phone: "44",
symbol_native: "£",
},
{
code: "IN",
currency: "INR",
@ -690,14 +402,6 @@ export const CurrencyTypeOptions = [
phone: "91",
symbol_native: "₹",
},
{
code: "IO",
currency: "USD",
currency_name: "US Dollar",
label: "British Indian Ocean Territory",
phone: "246",
symbol_native: "$",
},
{
code: "IQ",
currency: "IQD",
@ -722,22 +426,6 @@ export const CurrencyTypeOptions = [
phone: "354",
symbol_native: "kr",
},
{
code: "IT",
currency: "EUR",
currency_name: "Euro",
label: "Italy",
phone: "39",
symbol_native: "€",
},
{
code: "JE",
currency: "GBP",
currency_name: "British Pound Sterling",
label: "Jersey",
phone: "44",
symbol_native: "£",
},
{
code: "JM",
currency: "JMD",
@ -778,14 +466,6 @@ export const CurrencyTypeOptions = [
phone: "855",
symbol_native: "៛",
},
{
code: "KI",
currency: "AUD",
currency_name: "Australian Dollar",
label: "Kiribati",
phone: "686",
symbol_native: "$",
},
{
code: "KM",
currency: "KMF",
@ -826,14 +506,6 @@ export const CurrencyTypeOptions = [
phone: "961",
symbol_native: "ل.ل.",
},
{
code: "LI",
currency: "CHF",
currency_name: "Swiss Franc",
label: "Liechtenstein",
phone: "423",
symbol_native: "CHF",
},
{
code: "LK",
currency: "LKR",
@ -850,22 +522,6 @@ export const CurrencyTypeOptions = [
phone: "370",
symbol_native: "Lt",
},
{
code: "LU",
currency: "EUR",
currency_name: "Euro",
label: "Luxembourg",
phone: "352",
symbol_native: "€",
},
{
code: "LV",
currency: "EUR",
currency_name: "Euro",
label: "Latvia",
phone: "371",
symbol_native: "€",
},
{
code: "LY",
currency: "LYD",
@ -882,14 +538,6 @@ export const CurrencyTypeOptions = [
phone: "212",
symbol_native: "د.م.",
},
{
code: "MC",
currency: "EUR",
currency_name: "Euro",
label: "Monaco",
phone: "377",
symbol_native: "€",
},
{
code: "MD",
currency: "MDL",
@ -898,22 +546,6 @@ export const CurrencyTypeOptions = [
phone: "373",
symbol_native: "MDL",
},
{
code: "ME",
currency: "EUR",
currency_name: "Euro",
label: "Montenegro",
phone: "382",
symbol_native: "€",
},
{
code: "MF",
currency: "EUR",
currency_name: "Euro",
label: "Saint Martin (French part)",
phone: "590",
symbol_native: "€",
},
{
code: "MG",
currency: "MGA",
@ -922,14 +554,6 @@ export const CurrencyTypeOptions = [
phone: "261",
symbol_native: "MGA",
},
{
code: "MH",
currency: "USD",
currency_name: "US Dollar",
label: "Marshall Islands",
phone: "692",
symbol_native: "$",
},
{
code: "MK",
currency: "MKD",
@ -938,14 +562,6 @@ export const CurrencyTypeOptions = [
phone: "389",
symbol_native: "MKD",
},
{
code: "ML",
currency: "XOF",
currency_name: "CFA Franc BCEAO",
label: "Mali",
phone: "223",
symbol_native: "CFA",
},
{
code: "MM",
currency: "MMK",
@ -962,30 +578,6 @@ export const CurrencyTypeOptions = [
phone: "853",
symbol_native: "MOP$",
},
{
code: "MP",
currency: "USD",
currency_name: "US Dollar",
label: "Northern Mariana Islands",
phone: "1-670",
symbol_native: "$",
},
{
code: "MQ",
currency: "EUR",
currency_name: "Euro",
label: "Martinique",
phone: "596",
symbol_native: "€",
},
{
code: "MT",
currency: "EUR",
currency_name: "Euro",
label: "Malta",
phone: "356",
symbol_native: "€",
},
{
code: "MU",
currency: "MUR",
@ -1026,22 +618,6 @@ export const CurrencyTypeOptions = [
phone: "264",
symbol_native: "N$",
},
{
code: "NE",
currency: "XOF",
currency_name: "CFA Franc BCEAO",
label: "Niger",
phone: "227",
symbol_native: "CFA",
},
{
code: "NF",
currency: "AUD",
currency_name: "Australian Dollar",
label: "Norfolk Island",
phone: "672",
symbol_native: "$",
},
{
code: "NG",
currency: "NGN",
@ -1058,14 +634,6 @@ export const CurrencyTypeOptions = [
phone: "505",
symbol_native: "C$",
},
{
code: "NL",
currency: "EUR",
currency_name: "Euro",
label: "Netherlands",
phone: "31",
symbol_native: "€",
},
{
code: "NO",
currency: "NOK",
@ -1082,22 +650,6 @@ export const CurrencyTypeOptions = [
phone: "977",
symbol_native: "नेरू",
},
{
code: "NR",
currency: "AUD",
currency_name: "Australian Dollar",
label: "Nauru",
phone: "674",
symbol_native: "$",
},
{
code: "NU",
currency: "NZD",
currency_name: "New Zealand Dollar",
label: "Niue",
phone: "683",
symbol_native: "$",
},
{
code: "NZ",
currency: "NZD",
@ -1154,54 +706,6 @@ export const CurrencyTypeOptions = [
phone: "48",
symbol_native: "zł",
},
{
code: "PM",
currency: "EUR",
currency_name: "Euro",
label: "Saint Pierre and Miquelon",
phone: "508",
symbol_native: "€",
},
{
code: "PN",
currency: "NZD",
currency_name: "New Zealand Dollar",
label: "Pitcairn",
phone: "870",
symbol_native: "$",
},
{
code: "PR",
currency: "USD",
currency_name: "US Dollar",
label: "Puerto Rico",
phone: "1",
symbol_native: "$",
},
{
code: "PS",
currency: "ILS",
currency_name: "Israeli New Sheqel",
label: "Palestine, State of",
phone: "970",
symbol_native: "₪",
},
{
code: "PT",
currency: "EUR",
currency_name: "Euro",
label: "Portugal",
phone: "351",
symbol_native: "€",
},
{
code: "PW",
currency: "USD",
currency_name: "US Dollar",
label: "Palau",
phone: "680",
symbol_native: "$",
},
{
code: "PY",
currency: "PYG",
@ -1218,14 +722,6 @@ export const CurrencyTypeOptions = [
phone: "974",
symbol_native: "ر.ق.",
},
{
code: "RE",
currency: "EUR",
currency_name: "Euro",
label: "Reunion",
phone: "262",
symbol_native: "€",
},
{
code: "RO",
currency: "RON",
@ -1248,7 +744,7 @@ export const CurrencyTypeOptions = [
currency_name: "Russian Ruble",
label: "Russian Federation",
phone: "7",
symbol_native: "руб.",
symbol_native: "",
},
{
code: "RW",
@ -1290,14 +786,6 @@ export const CurrencyTypeOptions = [
phone: "65",
symbol_native: "$",
},
{
code: "SI",
currency: "EUR",
currency_name: "Euro",
label: "Slovenia",
phone: "386",
symbol_native: "€",
},
{
code: "SJ",
currency: "NOK",
@ -1306,22 +794,6 @@ export const CurrencyTypeOptions = [
phone: "47",
symbol_native: "kr",
},
{
code: "SK",
currency: "EUR",
currency_name: "Euro",
label: "Slovakia",
phone: "421",
symbol_native: "€",
},
{
code: "SM",
currency: "EUR",
currency_name: "Euro",
label: "San Marino",
phone: "378",
symbol_native: "€",
},
{
code: "SN",
currency: "XOF",
@ -1338,14 +810,6 @@ export const CurrencyTypeOptions = [
phone: "252",
symbol_native: "Ssh",
},
{
code: "SV",
currency: "USD",
currency_name: "US Dollar",
label: "El Salvador",
phone: "503",
symbol_native: "$",
},
{
code: "SY",
currency: "SYP",
@ -1354,38 +818,6 @@ export const CurrencyTypeOptions = [
phone: "963",
symbol_native: "ل.س.",
},
{
code: "TC",
currency: "USD",
currency_name: "US Dollar",
label: "Turks and Caicos Islands",
phone: "1-649",
symbol_native: "$",
},
{
code: "TD",
currency: "XAF",
currency_name: "CFA Franc BEAC",
label: "Chad",
phone: "235",
symbol_native: "FCFA",
},
{
code: "TF",
currency: "EUR",
currency_name: "Euro",
label: "French Southern Territories",
phone: "262",
symbol_native: "€",
},
{
code: "TG",
currency: "XOF",
currency_name: "CFA Franc BCEAO",
label: "Togo",
phone: "228",
symbol_native: "CFA",
},
{
code: "TH",
currency: "THB",
@ -1394,22 +826,6 @@ export const CurrencyTypeOptions = [
phone: "66",
symbol_native: "฿",
},
{
code: "TK",
currency: "NZD",
currency_name: "New Zealand Dollar",
label: "Tokelau",
phone: "690",
symbol_native: "$",
},
{
code: "TL",
currency: "USD",
currency_name: "US Dollar",
label: "Timor-Leste",
phone: "670",
symbol_native: "$",
},
{
code: "TN",
currency: "TND",
@ -1442,14 +858,6 @@ export const CurrencyTypeOptions = [
phone: "1-868",
symbol_native: "$",
},
{
code: "TV",
currency: "AUD",
currency_name: "Australian Dollar",
label: "Tuvalu",
phone: "688",
symbol_native: "$",
},
{
code: "TW",
currency: "TWD",
@ -1506,14 +914,6 @@ export const CurrencyTypeOptions = [
phone: "998",
symbol_native: "UZS",
},
{
code: "VA",
currency: "EUR",
currency_name: "Euro",
label: "Holy See (Vatican City State)",
phone: "379",
symbol_native: "€",
},
{
code: "VE",
currency: "VEF",
@ -1522,22 +922,6 @@ export const CurrencyTypeOptions = [
phone: "58",
symbol_native: "Bs.F.",
},
{
code: "VG",
currency: "USD",
currency_name: "US Dollar",
label: "British Virgin Islands",
phone: "1-284",
symbol_native: "$",
},
{
code: "VI",
currency: "USD",
currency_name: "US Dollar",
label: "US Virgin Islands",
phone: "1-340",
symbol_native: "$",
},
{
code: "VN",
currency: "VND",
@ -1554,14 +938,6 @@ export const CurrencyTypeOptions = [
phone: "678",
symbol_native: "VT",
},
{
code: "XK",
currency: "EUR",
currency_name: "Euro",
label: "Kosovo",
phone: "383",
symbol_native: "€",
},
{
code: "YE",
currency: "YER",
@ -1570,14 +946,6 @@ export const CurrencyTypeOptions = [
phone: "967",
symbol_native: "ر.ي.",
},
{
code: "YT",
currency: "EUR",
currency_name: "Euro",
label: "Mayotte",
phone: "262",
symbol_native: "€",
},
{
code: "ZA",
currency: "ZAR",