Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
feat: add forms for google places and resend integrations
Brad Barbin4947e0e391ce
diff --git a/apps/carbon/app/config/timezones.ts b/apps/carbon/app/config/timezones.tsdeleted file mode 100644index 65e4d295f1..0000000000--- a/apps/carbon/app/config/timezones.ts+++ /dev/null@@ -1,2902 +0,0 @@-import type { GroupBase, OptionBase } from "@carbon/react";--export interface TimeZoneSelection extends OptionBase {- label: string;- value: string;-}--export const timezonesGroupedByCountry: GroupBase<TimeZoneSelection>[] = [- {- label: "Afghanistan",- options: [- {- value: "Asia/Kabul",- label: "Kabul",- },- ],- },- {- label: "Albania",- options: [- {- value: "Europe/Tirane",- label: "Tirane",- },- ],- },- {- label: "Algeria",- options: [- {- value: "Africa/Algiers",- label: "Algiers",- },- ],- },- {- label: "Andorra",- options: [- {- value: "Europe/Andorra",- label: "Andorra",- },- ],- },- {- label: "Angola",- options: [- {- value: "Africa/Lagos",- label: "Lagos",- },- ],- },- {- label: "Anguilla",- options: [- {- value: "America/Port_of_Spain",- label: "Port of Spain",- },- ],- },- {- label: "Antarctica",- options: [- {- value: "Pacific/Auckland",- label: "Auckland",- },- {- value: "Antarctica/Davis",- label: "Davis",- },- {- value: "Antarctica/DumontDUrville",- label: "DumontDUrville",- },- {- value: "Antarctica/Mawson",- label: "Mawson",- },- {- value: "Antarctica/Palmer",- label: "Palmer",- },- {- value: "Antarctica/Rothera",- label: "Rothera",- },- {- value: "Antarctica/Syowa",- label: "Syowa",- },- {- value: "Antarctica/Troll",- label: "Troll",- },- {- value: "Antarctica/Vostok",- label: "Vostok",- },- ],- },- {- label: "Antigua & Barbuda",- options: [- {- value: "America/Port_of_Spain",- label: "Port of Spain",- },- ],- },- {- label: "Argentina",- options: [- {- value: "America/Argentina/Buenos_Aires",- label: "Buenos Aires",- },- {- value: "America/Argentina/Catamarca",- label: "Catamarca",- },- {- value: "America/Argentina/Cordoba",- label: "Cordoba",- },- {- value: "America/Argentina/Jujuy",- label: "Jujuy",- },- {- value: "America/Argentina/La_Rioja",- label: "La Rioja",- },- {- value: "America/Argentina/Mendoza",- label: "Mendoza",- },- {- value: "America/Argentina/Rio_Gallegos",- label: "Rio Gallegos",- },- {- value: "America/Argentina/Salta",- label: "Salta",- },- {- value: "America/Argentina/San_Juan",- label: "San Juan",- },- {- value: "America/Argentina/San_Luis",- label: "San Luis",- },- {- value: "America/Argentina/Tucuman",- label: "Tucuman",- },- {- value: "America/Argentina/Ushuaia",- label: "Ushuaia",- },- ],- },- {- label: "Armenia",- options: [- {- value: "Asia/Yerevan",- label: "Yerevan",- },- ],- },- {- label: "Aruba",- options: [- {- value: "America/Curacao",- label: "Curacao",- },- ],- },- {- label: "Australia",- options: [- {- value: "Australia/Adelaide",- label: "Adelaide",- },- {- value: "Australia/Brisbane",- label: "Brisbane",- },- {- value: "Australia/Broken_Hill",- label: "Broken Hill",- },- {- value: "Australia/Currie",- label: "Currie",- },- {- value: "Australia/Darwin",- label: "Darwin",- },- {- value: "Australia/Eucla",- label: "Eucla",- },- {- value: "Australia/Hobart",- label: "Hobart",- },- {- value: "Australia/Lindeman",- label: "Lindeman",- },- {- value: "Australia/Lord_Howe",- label: "Lord Howe",- },- {- value: "Antarctica/Macquarie",- label: "Macquarie",- },- {- value: "Australia/Melbourne",- label: "Melbourne",- },- {- value: "Australia/Perth",- label: "Perth",- },- {- value: "Australia/Sydney",- label: "Sydney",- },- ],- },- {- label: "Austria",- options: [- {- value: "Europe/Vienna",- label: "Vienna",- },- ],- },- {- label: "Azerbaijan",- options: [- {- value: "Asia/Baku",- label: "Baku",- },- ],- },- {- label: "Bahamas",- options: [- {- value: "America/Nassau",- label: "Nassau",- },- ],- },- {- label: "Bahrain",- options: [- {- value: "Asia/Qatar",- label: "Qatar",- },- ],- },- {- label: "Bangladesh",- options: [- {- value: "Asia/Dhaka",- label: "Dhaka",- },- ],- },- {- label: "Barbados",- options: [- {- value: "America/Barbados",- label: "Barbados",- },- ],- },- {- label: "Belarus",- options: [- {- value: "Europe/Minsk",- label: "Minsk",- },- ],- },- {- label: "Belgium",- options: [- {- value: "Europe/Brussels",- label: "Brussels",- },- ],- },- {- label: "Belize",- options: [- {- value: "America/Belize",- label: "Belize",- },- ],- },- {- label: "Benin",- options: [- {- value: "Africa/Lagos",- label: "Lagos",- },- ],- },- {- label: "Bermuda",- options: [- {- value: "Atlantic/Bermuda",- label: "Bermuda",- },- ],- },- {- label: "Bhutan",- options: [- {- value: "Asia/Thimphu",- label: "Thimphu",- },- ],- },- {- label: "Bolivia",- options: [- {- value: "America/La_Paz",- label: "La Paz",- },- ],- },- {- label: "Bosnia & Herzegovina",- options: [- {- value: "Europe/Belgrade",- label: "Belgrade",- },- ],- },- {- label: "Botswana",- options: [- {- value: "Africa/Maputo",- label: "Maputo",- },- ],- },- {- label: "Brazil",- options: [- {- value: "America/Araguaina",- label: "Araguaina",- },- {- value: "America/Bahia",- label: "Bahia",- },- {- value: "America/Belem",- label: "Belem",- },- {- value: "America/Boa_Vista",- label: "Boa Vista",- },- {- value: "America/Campo_Grande",- label: "Campo Grande",- },- {- value: "America/Cuiaba",- label: "Cuiaba",- },- {- value: "America/Eirunepe",- label: "Eirunepe",- },- {- value: "America/Fortaleza",- label: "Fortaleza",- },- {- value: "America/Maceio",- label: "Maceio",- },- {- value: "America/Manaus",- label: "Manaus",- },- {- value: "America/Noronha",- label: "Noronha",- },- {- value: "America/Porto_Velho",- label: "Porto Velho",- },- {- value: "America/Recife",- label: "Recife",- },- {- value: "America/Rio_Branco",- label: "Rio Branco",- },- {- value: "America/Santarem",- label: "Santarem",- },- {- value: "America/Sao_Paulo",- label: "Sao Paulo",- },- ],- },- {- label: "Britain (UK)",- options: [- {- value: "Europe/London",- label: "London",- },- ],- },- {- label: "British Indian Ocean Territory",- options: [- {- value: "Indian/Chagos",- label: "Chagos",- },- ],- },- {- label: "Brunei",- options: [- {- value: "Asia/Brunei",- label: "Brunei",- },- ],- },- {- label: "Bulgaria",- options: [- {- value: "Europe/Sofia",- label: "Sofia",- },- ],- },- {- label: "Burkina Faso",- options: [- {- value: "Africa/Abidjan",- label: "Abidjan",- },- ],- },- {- label: "Burundi",- options: [- {- value: "Africa/Maputo",- label: "Maputo",- },- ],- },- {- label: "Cambodia",- options: [- {- value: "Asia/Bangkok",- label: "Bangkok",- },- ],- },- {- label: "Cameroon",- options: [- {- value: "Africa/Lagos",- label: "Lagos",- },- ],- },- {- label: "Canada",- options: [- {- value: "America/Atikokan",- label: "Atikokan",- },- {- value: "America/Blanc-Sablon",- label: "Blanc-Sablon",- },- {- value: "America/Cambridge_Bay",- label: "Cambridge Bay",- },- {- value: "America/Creston",- label: "Creston",- },- {- value: "America/Dawson",- label: "Dawson",- },- {- value: "America/Dawson_Creek",- label: "Dawson Creek",- },- {- value: "America/Edmonton",- label: "Edmonton",- },- {- value: "America/Glace_Bay",- label: "Glace Bay",- },- {- value: "America/Goose_Bay",- label: "Goose Bay",- },- {- value: "America/Halifax",- label: "Halifax",- },- {- value: "America/Inuvik",- label: "Inuvik",- },- {- value: "America/Iqaluit",- label: "Iqaluit",- },- {- value: "America/Moncton",- label: "Moncton",- },- {- value: "America/Nipigon",- label: "Nipigon",- },- {- value: "America/Pangnirtung",- label: "Pangnirtung",- },- {- value: "America/Rainy_River",- label: "Rainy River",- },- {- value: "America/Rankin_Inlet",- label: "Rankin Inlet",- },- {- value: "America/Regina",- label: "Regina",- },- {- value: "America/Resolute",- label: "Resolute",- },- {- value: "America/St_Johns",- label: "St Johns",- },- {- value: "America/Swift_Current",- label: "Swift Current",- },- {- value: "America/Thunder_Bay",- label: "Thunder Bay",- },- {- value: "America/Toronto",- label: "Toronto",- },- {- value: "America/Vancouver",- label: "Vancouver",- },- {- value: "America/Whitehorse",- label: "Whitehorse",- },- {- value: "America/Winnipeg",- label: "Winnipeg",- },- {- value: "America/Yellowknife",- label: "Yellowknife",- },- ],- },- {- label: "Cape Verde",- options: [- {- value: "Atlantic/Cape_Verde",- label: "Cape Verde",- },- ],- },- {- label: "Caribbean NL",- options: [- {- value: "America/Curacao",- label: "Curacao",- },- ],- },- {- label: "Cayman Islands",- options: [- {- value: "America/Panama",- label: "Panama",- },- ],- },- {- label: "Central African Rep.",- options: [- {- value: "Africa/Lagos",- label: "Lagos",- },- ],- },- {- label: "Chad",- options: [- {- value: "Africa/Ndjamena",- label: "Ndjamena",- },- ],- },- {- label: "Chile",- options: [- {- value: "Pacific/Easter",- label: "Easter",- },- {- value: "America/Santiago",- label: "Santiago",- },- ],- },- {- label: "China",- options: [- {- value: "Asia/Shanghai",- label: "Shanghai",- },- {- value: "Asia/Urumqi",- label: "Urumqi",- },- ],- },- {- label: "Christmas Island",- options: [- {- value: "Indian/Christmas",- label: "Christmas",- },- ],- },- {- label: "Cocos (Keeling) Islands",- options: [- {- value: "Indian/Cocos",- label: "Cocos",- },- ],- },- {- label: "Colombia",- options: [- {- value: "America/Bogota",- label: "Bogota",- },- ],- },- {- label: "Comoros",- options: [- {- value: "Africa/Nairobi",- label: "Nairobi",- },- ],- },- {- label: "Congo (Dem. Rep.)",- options: [- {- value: "Africa/Lagos",- label: "Lagos",- },- {- value: "Africa/Maputo",- label: "Maputo",- },- ],- },- {- label: "Congo (Rep.)",- options: [- {- value: "Africa/Lagos",- label: "Lagos",- },- ],- },- {- label: "Cook Islands",- options: [- {- value: "Pacific/Rarotonga",- label: "Rarotonga",- },- ],- },- {- label: "Costa Rica",- options: [- {- value: "America/Costa_Rica",- label: "Costa Rica",- },- ],- },- {- label: "Croatia",- options: [- {- value: "Europe/Belgrade",- label: "Belgrade",- },- ],- },- {- label: "Cuba",- options: [- {- value: "America/Havana",- label: "Havana",- },- ],- },- {- label: "Curaçao",- options: [- {- value: "America/Curacao",- label: "Curacao",- },- ],- },- {- label: "Cyprus",- options: [- {- value: "Asia/Nicosia",- label: "Nicosia",- },- ],- },- {- label: "Czech Republic",- options: [- {- value: "Europe/Prague",- label: "Prague",- },- ],- },- {- label: "Côte d'Ivoire",- options: [- {- value: "Africa/Abidjan",- label: "Abidjan",- },- ],- },- {- label: "Denmark",- options: [- {- value: "Europe/Copenhagen",- label: "Copenhagen",- },- ],- },- {- label: "Djibouti",- options: [- {- value: "Africa/Nairobi",- label: "Nairobi",- },- ],- },- {- label: "Dominica",- options: [- {- value: "America/Port_of_Spain",- label: "Port of Spain",- },- ],- },- {- label: "Dominican Republic",- options: [- {- value: "America/Santo_Domingo",- label: "Santo Domingo",- },- ],- },- {- label: "East Timor",- options: [- {- value: "Asia/Dili",- label: "Dili",- },- ],- },- {- label: "Ecuador",- options: [- {- value: "Pacific/Galapagos",- label: "Galapagos",- },- {- value: "America/Guayaquil",- label: "Guayaquil",- },- ],- },- {- label: "Egypt",- options: [- {- value: "Africa/Cairo",- label: "Cairo",- },- ],- },- {- label: "El Salvador",- options: [- {- value: "America/El_Salvador",- label: "El Salvador",- },- ],- },- {- label: "Equatorial Guinea",- options: [- {- value: "Africa/Lagos",- label: "Lagos",- },- ],- },- {- label: "Eritrea",- options: [- {- value: "Africa/Nairobi",- label: "Nairobi",- },- ],- },- {- label: "Estonia",- options: [- {- value: "Europe/Tallinn",- label: "Tallinn",- },- ],- },- {- label: "Ethiopia",- options: [- {- value: "Africa/Nairobi",- label: "Nairobi",- },- ],- },- {- label: "Falkland Islands",- options: [- {- value: "Atlantic/Stanley",- label: "Stanley",- },- ],- },- {- label: "Faroe Islands",- options: [- {- value: "Atlantic/Faroe",- label: "Faroe",- },- ],- },- {- label: "Fiji",- options: [- {- value: "Pacific/Fiji",- label: "Fiji",- },- ],- },- {- label: "Finland",- options: [- {- value: "Europe/Helsinki",- label: "Helsinki",- },- ],- },- {- label: "France",- options: [- {- value: "Europe/Paris",- label: "Paris",- },- ],- },- {- label: "French Guiana",- options: [- {- value: "America/Cayenne",- label: "Cayenne",- },- ],- },- {- label: "French Polynesia",- options: [- {- value: "Pacific/Gambier",- label: "Gambier",- },- {- value: "Pacific/Marquesas",- label: "Marquesas",- },- {- value: "Pacific/Tahiti",- label: "Tahiti",- },- ],- },- {- label: "French Southern & Antarctic Lands",- options: [- {- value: "Indian/Kerguelen",- label: "Kerguelen",- },- {- value: "Indian/Reunion",- label: "Reunion",- },- ],- },- {- label: "Gabon",- options: [- {- value: "Africa/Lagos",- label: "Lagos",- },- ],- },- {- label: "Gambia",- options: [- {- value: "Africa/Abidjan",- label: "Abidjan",- },- ],- },- {- label: "Georgia",- options: [- {- value: "Asia/Tbilisi",- label: "Tbilisi",- },- ],- },- {- label: "Germany",- options: [- {- value: "Europe/Berlin",- label: "Berlin",- },- {- value: "Europe/Zurich",- label: "Zurich",- },- ],- },- {- label: "Ghana",- options: [- {- value: "Africa/Accra",- label: "Accra",- },- ],- },- {- label: "Gibraltar",- options: [- {- value: "Europe/Gibraltar",- label: "Gibraltar",- },- ],- },- {- label: "Greece",- options: [- {- value: "Europe/Athens",- label: "Athens",- },- ],- },- {- label: "Greenland",- options: [- {- value: "America/Danmarkshavn",- label: "Danmarkshavn",- },- {- value: "America/Godthab",- label: "Godthab",- },- {- value: "America/Scoresbysund",- label: "Scoresbysund",- },- {- value: "America/Thule",- label: "Thule",- },- ],- },- {- label: "Grenada",- options: [- {- value: "America/Port_of_Spain",- label: "Port of Spain",- },- ],- },- {- label: "Guadeloupe",- options: [- {- value: "America/Port_of_Spain",- label: "Port of Spain",- },- ],- },- {- label: "Guam",- options: [- {- value: "Pacific/Guam",- label: "Guam",- },- ],- },- {- label: "Guatemala",- options: [- {- value: "America/Guatemala",- label: "Guatemala",- },- ],- },- {- label: "Guernsey",- options: [- {- value: "Europe/London",- label: "London",- },- ],- },- {- label: "Guinea",- options: [- {- value: "Africa/Abidjan",- label: "Abidjan",- },- ],- },- {- label: "Guinea-Bissau",- options: [- {- value: "Africa/Bissau",- label: "Bissau",- },- ],- },- {- label: "Guyana",- options: [- {- value: "America/Guyana",- label: "Guyana",- },- ],- },- {- label: "Haiti",- options: [- {- value: "America/Port-au-Prince",- label: "Port-au-Prince",- },- ],- },- {- label: "Honduras",- options: [- {- value: "America/Tegucigalpa",- label: "Tegucigalpa",- },- ],- },- {- label: "Hong Kong",- options: [- {- value: "Asia/Hong_Kong",- label: "Hong Kong",- },- ],- },- {- label: "Hungary",- options: [- {- value: "Europe/Budapest",- label: "Budapest",- },- ],- },- {- label: "Iceland",- options: [- {- value: "Atlantic/Reykjavik",- label: "Reykjavik",- },- ],- },- {- label: "India",- options: [- {- value: "Asia/Kolkata",- label: "Kolkata",- },- ],- },- {- label: "Indonesia",- options: [- {- value: "Asia/Jakarta",- label: "Jakarta",- },- {- value: "Asia/Jayapura",- label: "Jayapura",- },- {- value: "Asia/Makassar",- label: "Makassar",- },- {- value: "Asia/Pontianak",- label: "Pontianak",- },- ],- },- {- label: "Iran",- options: [- {- value: "Asia/Tehran",- label: "Tehran",- },- ],- },- {- label: "Iraq",- options: [- {- value: "Asia/Baghdad",- label: "Baghdad",- },- ],- },- {- label: "Ireland",- options: [- {- value: "Europe/Dublin",- label: "Dublin",- },- ],- },- {- label: "Isle of Man",- options: [- {- value: "Europe/London",- label: "London",- },- ],- },- {- label: "Israel",- options: [- {- value: "Asia/Jerusalem",- label: "Jerusalem",- },- ],- },- {- label: "Italy",- options: [- {- value: "Europe/Rome",- label: "Rome",- },- ],- },- {- label: "Jamaica",- options: [- {- value: "America/Jamaica",- label: "Jamaica",- },- ],- },- {- label: "Japan",- options: [- {- value: "Asia/Tokyo",- label: "Tokyo",- },- ],- },- {- label: "Jersey",- options: [- {- value: "Europe/London",- label: "London",- },- ],- },- {- label: "Jordan",- options: [- {- value: "Asia/Amman",- label: "Amman",- },- ],- },- {- label: "Kazakhstan",- options: [- {- value: "Asia/Almaty",- label: "Almaty",- },- {- value: "Asia/Aqtau",- label: "Aqtau",- },- {- value: "Asia/Aqtobe",- label: "Aqtobe",- },- {- value: "Asia/Oral",- label: "Oral",- },- {- value: "Asia/Qyzylorda",- label: "Qyzylorda",- },- ],- },- {- label: "Kenya",- options: [- {- value: "Africa/Nairobi",- label: "Nairobi",- },- ],- },- {- label: "Kiribati",- options: [- {- value: "Pacific/Enderbury",- label: "Enderbury",- },- {- value: "Pacific/Kiritimati",- label: "Kiritimati",- },- {- value: "Pacific/Tarawa",- label: "Tarawa",- },- ],- },- {- label: "Korea (North)",- options: [- {- value: "Asia/Pyongyang",- label: "Pyongyang",- },- ],- },- {- label: "Korea (South)",- options: [- {- value: "Asia/Seoul",- label: "Seoul",- },- ],- },- {- label: "Kuwait",- options: [- {- value: "Asia/Riyadh",- label: "Riyadh",- },- ],- },- {- label: "Kyrgyzstan",- options: [- {- value: "Asia/Bishkek",- label: "Bishkek",- },- ],- },- {- label: "Laos",- options: [- {- value: "Asia/Bangkok",- label: "Bangkok",- },- ],- },- {- label: "Latvia",- options: [- {- value: "Europe/Riga",- label: "Riga",- },- ],- },- {- label: "Lebanon",- options: [- {- value: "Asia/Beirut",- label: "Beirut",- },- ],- },- {- label: "Lesotho",- options: [- {- value: "Africa/Johannesburg",- label: "Johannesburg",- },- ],- },- {- label: "Liberia",- options: [- {- value: "Africa/Monrovia",- label: "Monrovia",- },- ],- },- {- label: "Libya",- options: [- {- value: "Africa/Tripoli",- label: "Tripoli",- },- ],- },- {- label: "Liechtenstein",- options: [- {- value: "Europe/Zurich",- label: "Zurich",- },- ],- },- {- label: "Lithuania",- options: [- {- value: "Europe/Vilnius",- label: "Vilnius",- },- ],- },- {- label: "Luxembourg",- options: [- {- value: "Europe/Luxembourg",- label: "Luxembourg",- },- ],- },- {- label: "Macau",- options: [- {- value: "Asia/Macau",- label: "Macau",- },- ],- },- {- label: "Macedonia",- options: [- {- value: "Europe/Belgrade",- label: "Belgrade",- },- ],- },- {- label: "Madagascar",- options: [- {- value: "Africa/Nairobi",- label: "Nairobi",- },- ],- },- {- label: "Malawi",- options: [- {- value: "Africa/Maputo",- label: "Maputo",- },- ],- },- {- label: "Malaysia",- options: [- {- value: "Asia/Kuala_Lumpur",- label: "Kuala Lumpur",- },- {- value: "Asia/Kuching",- label: "Kuching",- },- ],- },- {- label: "Maldives",- options: [- {- value: "Indian/Maldives",- label: "Maldives",- },- ],- },- {- label: "Mali",- options: [- {- value: "Africa/Abidjan",- label: "Abidjan",- },- ],- },- {- label: "Malta",- options: [- {- value: "Europe/Malta",- label: "Malta",- },- ],- },- {- label: "Marshall Islands",- options: [- {- value: "Pacific/Kwajalein",- label: "Kwajalein",- },- {- value: "Pacific/Majuro",- label: "Majuro",- },- ],- },- {- label: "Martinique",- options: [- {- value: "America/Martinique",- label: "Martinique",- },- ],- },- {- label: "Mauritania",- options: [- {- value: "Africa/Abidjan",- label: "Abidjan",- },- ],- },- {- label: "Mauritius",- options: [- {- value: "Indian/Mauritius",- label: "Mauritius",- },- ],- },- {- label: "Mayotte",- options: [- {- value: "Africa/Nairobi",- label: "Nairobi",- },- ],- },- {- label: "Mexico",- options: [- {- value: "America/Bahia_Banderas",- label: "Bahia Banderas",- },- {- value: "America/Cancun",- label: "Cancun",- },- {- value: "America/Chihuahua",- label: "Chihuahua",- },- {- value: "America/Hermosillo",- label: "Hermosillo",- },- {- value: "America/Matamoros",- label: "Matamoros",- },- {- value: "America/Mazatlan",- label: "Mazatlan",- },- {- value: "America/Merida",- label: "Merida",- },- {- value: "America/Mexico_City",- label: "Mexico City",- },- {- value: "America/Monterrey",- label: "Monterrey",- },- {- value: "America/Ojinaga",- label: "Ojinaga",- },- {- value: "America/Tijuana",- label: "Tijuana",- },- ],- },- {- label: "Micronesia",- options: [- {- value: "Pacific/Chuuk",- label: "Chuuk",- },- {- value: "Pacific/Kosrae",- label: "Kosrae",- },- {- value: "Pacific/Pohnpei",- label: "Pohnpei",- },- ],- },- {- label: "Moldova",- options: [- {- value: "Europe/Chisinau",- label: "Chisinau",- },- ],- },- {- label: "Monaco",- options: [- {- value: "Europe/Monaco",- label: "Monaco",- },- ],- },- {- label: "Mongolia",- options: [- {- value: "Asia/Choibalsan",- label: "Choibalsan",- },- {- value: "Asia/Hovd",- label: "Hovd",- },- {- value: "Asia/Ulaanbaatar",- label: "Ulaanbaatar",- },- ],- },- {- label: "Montenegro",- options: [- {- value: "Europe/Belgrade",- label: "Belgrade",- },- ],- },- {- label: "Montserrat",- options: [- {- value: "America/Port_of_Spain",- label: "Port of Spain",- },- ],- },- {- label: "Morocco",- options: [- {- value: "Africa/Casablanca",- label: "Casablanca",- },- ],- },- {- label: "Mozambique",- options: [- {- value: "Africa/Maputo",- label: "Maputo",- },- ],- },- {- label: "Myanmar (Burma)",- options: [],- },- {- label: "Namibia",- options: [- {- value: "Africa/Windhoek",- label: "Windhoek",- },- ],- },- {- label: "Nauru",- options: [- {- value: "Pacific/Nauru",- label: "Nauru",- },- ],- },- {- label: "Nepal",- options: [- {- value: "Asia/Kathmandu",- label: "Kathmandu",- },- ],- },- {- label: "Netherlands",- options: [- {- value: "Europe/Amsterdam",- label: "Amsterdam",- },- ],- },- {- label: "New Caledonia",- options: [- {- value: "Pacific/Noumea",- label: "Noumea",- },- ],- },- {- label: "New Zealand",- options: [- {- value: "Pacific/Auckland",- label: "Auckland",- },- {- value: "Pacific/Chatham",- label: "Chatham",- },- ],- },- {- label: "Nicaragua",- options: [- {- value: "America/Managua",- label: "Managua",- },- ],- },- {- label: "Niger",- options: [- {- value: "Africa/Lagos",- label: "Lagos",- },- ],- },- {- label: "Nigeria",- options: [- {- value: "Africa/Lagos",- label: "Lagos",- },- ],- },- {- label: "Niue",- options: [- {- value: "Pacific/Niue",- label: "Niue",- },- ],- },- {- label: "Norfolk Island",- options: [- {- value: "Pacific/Norfolk",- label: "Norfolk",- },- ],- },- {- label: "Northern Mariana Islands",- options: [- {- value: "Pacific/Guam",- label: "Guam",- },- ],- },- {- label: "Norway",- options: [- {- value: "Europe/Oslo",- label: "Oslo",- },- ],- },- {- label: "Oman",- options: [- {- value: "Asia/Dubai",- label: "Dubai",- },- ],- },- {- label: "Pakistan",- options: [- {- value: "Asia/Karachi",- label: "Karachi",- },- ],- },- {- label: "Palau",- options: [- {- value: "Pacific/Palau",- label: "Palau",- },- ],- },- {- label: "Palestine",- options: [- {- value: "Asia/Gaza",- label: "Gaza",- },- {- value: "Asia/Hebron",- label: "Hebron",- },- ],- },- {- label: "Panama",- options: [- {- value: "America/Panama",- label: "Panama",- },- ],- },- {- label: "Papua New Guinea",- options: [- {- value: "Pacific/Bougainville",- label: "Bougainville",- },- {- value: "Pacific/Port_Moresby",- label: "Port Moresby",- },- ],- },- {- label: "Paraguay",- options: [- {- value: "America/Asuncion",- label: "Asuncion",- },- ],- },- {- label: "Peru",- options: [- {- value: "America/Lima",- label: "Lima",- },- ],- },- {- label: "Philippines",- options: [- {- value: "Asia/Manila",- label: "Manila",- },- ],- },- {- label: "Pitcairn",- options: [- {- value: "Pacific/Pitcairn",- label: "Pitcairn",- },- ],- },- {- label: "Poland",- options: [- {- value: "Europe/Warsaw",- label: "Warsaw",- },- ],- },- {- label: "Portugal",- options: [- {- value: "Atlantic/Azores",- label: "Azores",- },- {- value: "Europe/Lisbon",- label: "Lisbon",- },- {- value: "Atlantic/Madeira",- label: "Madeira",- },- ],- },- {- label: "Puerto Rico",- options: [- {- value: "America/Puerto_Rico",- label: "Puerto Rico",- },- ],- },- {- label: "Qatar",- options: [- {- value: "Asia/Qatar",- label: "Qatar",- },- ],- },- {- label: "Romania",- options: [- {- value: "Europe/Bucharest",- label: "Bucharest",- },- ],- },- {- label: "Russia",- options: [- {- value: "Asia/Anadyr",- label: "Anadyr",- },- {- value: "Asia/Chita",- label: "Chita",- },- {- value: "Asia/Irkutsk",- label: "Irkutsk",- },- {- value: "Europe/Kaliningrad",- label: "Kaliningrad",- },- {- value: "Asia/Kamchatka",- label: "Kamchatka",- },- {- value: "Asia/Khandyga",- label: "Khandyga",- },- {- value: "Asia/Krasnoyarsk",- label: "Krasnoyarsk",- },- {- value: "Asia/Magadan",- label: "Magadan",- },- {- value: "Europe/Moscow",- label: "Moscow",- },- {- value: "Asia/Novokuznetsk",- label: "Novokuznetsk",- },- {- value: "Asia/Novosibirsk",- label: "Novosibirsk",- },- {- value: "Asia/Omsk",- label: "Omsk",- },- {- value: "Asia/Sakhalin",- label: "Sakhalin",- },- {- value: "Europe/Samara",- label: "Samara",- },- {- value: "Europe/Simferopol",- label: "Simferopol",- },- {- value: "Asia/Srednekolymsk",- label: "Srednekolymsk",- },- {- value: "Asia/Ust-Nera",- label: "Ust-Nera",- },- {- value: "Asia/Vladivostok",- label: "Vladivostok",- },- {- value: "Europe/Volgograd",- label: "Volgograd",- },- {- value: "Asia/Yakutsk",- label: "Yakutsk",- },- {- value: "Asia/Yekaterinburg",- label: "Yekaterinburg",- },- ],- },- {- label: "Rwanda",- options: [- {- value: "Africa/Maputo",- label: "Maputo",- },- ],- },- {- label: "Réunion",- options: [- {- value: "Indian/Reunion",- label: "Reunion",- },- ],- },- {- label: "Samoa (American)",- options: [- {- value: "Pacific/Pago_Pago",- label: "Pago Pago",- },- ],- },- {- label: "Samoa (western)",- options: [- {- value: "Pacific/Apia",- label: "Apia",- },- ],- },- {- label: "San Marino",- options: [- {- value: "Europe/Rome",- label: "Rome",- },- ],- },- {- label: "Sao Tome & Principe",- options: [- {- value: "Africa/Sao_Tome",- label: "Sao Tome",- },- ],- },- {- label: "Saudi Arabia",- options: [- {- value: "Asia/Riyadh",- label: "Riyadh",- },- ],- },- {- label: "Senegal",- options: [- {- value: "Africa/Abidjan",- label: "Abidjan",- },- ],- },- {- label: "Serbia",- options: [- {- value: "Europe/Belgrade",- label: "Belgrade",- },- ],- },- {- label: "Seychelles",- options: [- {- value: "Indian/Mahe",- label: "Mahe",- },- ],- },- {- label: "Sierra Leone",- options: [- {- value: "Africa/Abidjan",- label: "Abidjan",- },- ],- },- {- label: "Singapore",- options: [- {- value: "Asia/Singapore",- label: "Singapore",- },- ],- },- {- label: "Slovakia",- options: [- {- value: "Europe/Prague",- label: "Prague",- },- ],- },- {- label: "Slovenia",- options: [- {- value: "Europe/Belgrade",- label: "Belgrade",- },- ],- },- {- label: "Solomon Islands",- options: [- {- value: "Pacific/Guadalcanal",- label: "Guadalcanal",- },- ],- },- {- label: "Somalia",- options: [- {- value: "Africa/Nairobi",- label: "Nairobi",- },- ],- },- {- label: "South Africa",- options: [- {- value: "Africa/Johannesburg",- label: "Johannesburg",- },- ],- },- {- label: "South Georgia & the South Sandwich Islands",- options: [- {- value: "Atlantic/South_Georgia",- label: "South Georgia",- },- ],- },- {- label: "South Sudan",- options: [- {- value: "Africa/Juba",- label: "Juba",- },- ],- },- {- label: "Spain",- options: [- {- value: "Atlantic/Canary",- label: "Canary",- },- {- value: "Africa/Ceuta",- label: "Ceuta",- },- {- value: "Europe/Madrid",- label: "Madrid",- },- ],- },- {- label: "Sri Lanka",- options: [- {- value: "Asia/Colombo",- label: "Colombo",- },- ],- },- {- label: "St Barthelemy",- options: [- {- value: "America/Port_of_Spain",- label: "Port of Spain",- },- ],- },- {- label: "St Helena",- options: [- {- value: "Africa/Abidjan",- label: "Abidjan",- },- ],- },- {- label: "St Kitts & Nevis",- options: [- {- value: "America/Port_of_Spain",- label: "Port of Spain",- },- ],- },- {- label: "St Lucia",- options: [- {- value: "America/Port_of_Spain",- label: "Port of Spain",- },- ],- },- {- label: "St Maarten (Dutch)",- options: [- {- value: "America/Curacao",- label: "Curacao",- },- ],- },- {- label: "St Martin (French)",- options: [- {- value: "America/Port_of_Spain",- label: "Port of Spain",- },- ],- },- {- label: "St Pierre & Miquelon",- options: [- {- value: "America/Miquelon",- label: "Miquelon",- },- ],- },- {- label: "St Vincent",- options: [- {- value: "America/Port_of_Spain",- label: "Port of Spain",- },- ],- },- {- label: "Sudan",- options: [- {- value: "Africa/Khartoum",- label: "Khartoum",- },- ],- },- {- label: "Suriname",- options: [- {- value: "America/Paramaribo",- label: "Paramaribo",- },- ],- },- {- label: "Svalbard & Jan Mayen",- options: [- {- value: "Europe/Oslo",- label: "Oslo",- },- ],- },- {- label: "Swaziland",- options: [- {- value: "Africa/Johannesburg",- label: "Johannesburg",- },- ],- },- {- label: "Sweden",- options: [- {- value: "Europe/Stockholm",- label: "Stockholm",- },- ],- },- {- label: "Switzerland",- options: [- {- value: "Europe/Zurich",- label: "Zurich",- },- ],- },- {- label: "Syria",- options: [- {- value: "Asia/Damascus",- label: "Damascus",- },- ],- },- {- label: "Taiwan",- options: [- {- value: "Asia/Taipei",- label: "Taipei",- },- ],- },- {- label: "Tajikistan",- options: [- {- value: "Asia/Dushanbe",- label: "Dushanbe",- },- ],- },- {- label: "Tanzania",- options: [- {- value: "Africa/Nairobi",- label: "Nairobi",- },- ],- },- {- label: "Thailand",- options: [- {- value: "Asia/Bangkok",- label: "Bangkok",- },- ],- },- {- label: "Togo",- options: [- {- value: "Africa/Abidjan",- label: "Abidjan",- },- ],- },- {- label: "Tokelau",- options: [- {- value: "Pacific/Fakaofo",- label: "Fakaofo",- },- ],- },- {- label: "Tonga",- options: [- {- value: "Pacific/Tongatapu",- label: "Tongatapu",- },- ],- },- {- label: "Trinidad & Tobago",- options: [- {- value: "America/Port_of_Spain",- label: "Port of Spain",- },- ],- },- {- label: "Tunisia",- options: [- {- value: "Africa/Tunis",- label: "Tunis",- },- ],- },- {- options: [- {- value: "Europe/Istanbul",- label: "Istanbul",- },- ],- },- {- label: "Turkmenistan",- options: [- {- value: "Asia/Ashgabat",- label: "Ashgabat",- },- ],- },- {- label: "Turks & Caicos Is",- options: [- {- value: "America/Grand_Turk",- label: "Grand Turk",- },- ],- },- {- label: "Tuvalu",- options: [- {- value: "Pacific/Funafuti",- label: "Funafuti",- },- ],- },- {- label: "US minor outlying islands",- options: [- {- value: "Pacific/Honolulu",- label: "Hawaii",- },- {- value: "Pacific/Pago_Pago",- label: "Pago Pago",- },- {- value: "Pacific/Wake",- label: "Wake",- },- ],- },- {- label: "Uganda",- options: [- {- value: "Africa/Nairobi",- label: "Nairobi",- },- ],- },- {- label: "Ukraine",- options: [- {- value: "Europe/Kiev",- label: "Kiev",- },- {- value: "Europe/Uzhgorod",- label: "Uzhgorod",- },- {- value: "Europe/Zaporozhye",- label: "Zaporozhye",- },- ],- },- {- label: "United Arab Emirates",- options: [- {- value: "Asia/Dubai",- label: "Dubai",- },- ],- },- {- label: "United States",- options: [- {- value: "America/Adak",- label: "Adak",- },- {- value: "America/Anchorage",- label: "Alaska",- },- {- value: "America/North_Dakota/Beulah",- label: "Beulah",- },- {- value: "America/Boise",- label: "Boise",- },- {- value: "America/North_Dakota/Center",- label: "Center",- },- {- value: "America/Chicago",- label: "Central",- },- {- value: "America/Detroit",- label: "Detroit",- },- {- value: "America/New_York",- label: "Eastern",- },- {- value: "Pacific/Honolulu",- label: "Hawaii",- },- {- value: "America/Indiana/Indianapolis",- label: "Indianapolis",- },- {- value: "America/Juneau",- label: "Juneau",- },- {- value: "America/Indiana/Knox",- label: "Knox",- },- {- value: "America/Kentucky/Louisville",- label: "Louisville",- },- {- value: "America/Indiana/Marengo",- label: "Marengo",- },- {- value: "America/Menominee",- label: "Menominee",- },- {- value: "America/Metlakatla",- label: "Metlakatla",- },- {- value: "America/Kentucky/Monticello",- label: "Monticello",- },- {- value: "America/Denver",- label: "Mountain",- },- {- value: "America/Phoenix",- label: "Mountain - Arizona",- },- {- value: "America/North_Dakota/New_Salem",- label: "New Salem",- },- {- value: "America/Nome",- label: "Nome",- },- {- value: "America/Los_Angeles",- label: "Pacific",- },- {- value: "America/Indiana/Petersburg",- label: "Petersburg",- },- {- value: "America/Sitka",- label: "Sitka",- },- {- value: "America/Indiana/Tell_City",- label: "Tell City",- },- {- value: "America/Indiana/Vevay",- label: "Vevay",- },- {- value: "America/Indiana/Vincennes",- label: "Vincennes",- },- {- value: "America/Indiana/Winamac",- label: "Winamac",- },- {- value: "America/Yakutat",- label: "Yakutat",- },- ],- },- {- label: "Uruguay",- options: [- {- value: "America/Montevideo",- label: "Montevideo",- },- ],- },- {- label: "Uzbekistan",- options: [- {- value: "Asia/Samarkand",- label: "Samarkand",- },- {- value: "Asia/Tashkent",- label: "Tashkent",- },- ],- },- {- label: "Vanuatu",- options: [- {- value: "Pacific/Efate",- label: "Efate",- },- ],- },- {- label: "Vatican City",- options: [- {- value: "Europe/Rome",- label: "Rome",- },- ],- },- {- label: "Venezuela",- options: [- {- value: "America/Caracas",- label: "Caracas",- },- ],- },- {- label: "Vietnam",- options: [- {- value: "Asia/Bangkok",- label: "Bangkok",- },- {- value: "Asia/Ho_Chi_Minh",- label: "Ho Chi Minh",- },- ],- },- {- label: "Virgin Islands (UK)",- options: [- {- value: "America/Port_of_Spain",- label: "Port of Spain",- },- ],- },- {- label: "Virgin Islands (US)",- options: [- {- value: "America/Port_of_Spain",- label: "Port of Spain",- },- ],- },- {- label: "Wallis & Futuna",- options: [- {- value: "Pacific/Wallis",- label: "Wallis",- },- ],- },- {- label: "Western Sahara",- options: [- {- value: "Africa/El_Aaiun",- label: "El Aaiun",- },- ],- },- {- label: "Yemen",- options: [- {- value: "Asia/Riyadh",- label: "Riyadh",- },- ],- },- {- label: "Zambia",- options: [- {- value: "Africa/Maputo",- label: "Maputo",- },- ],- },- {- label: "Zimbabwe",- options: [- {- value: "Africa/Maputo",- label: "Maputo",- },- ],- },- {- label: "Åland Islands",- options: [- {- value: "Europe/Helsinki",- label: "Helsinki",- },- ],- },-];diff --git a/apps/carbon/app/jobs/update-exchange-rates.server.ts b/apps/carbon/app/jobs/update-exchange-rates.server.tsindex 3b930ec53f..99258c874c 100644--- a/apps/carbon/app/jobs/update-exchange-rates.server.ts+++ b/apps/carbon/app/jobs/update-exchange-rates.server.ts@@ -3,7 +3,7 @@ import { getExchangeRatesClient } from "~/lib/exchange-rates.server";import { getSupabaseServiceRole } from "~/lib/supabase";import { triggerClient } from "~/lib/trigger.server";import type { CurrencyCode } from "~/modules/accounting";-import { exchangeRatesMetadata } from "~/modules/settings";+import { exchangeRatesIntegration } from "~/modules/settings";const supabaseClient = getSupabaseServiceRole();@@ -21,7 +21,7 @@ export const job = triggerClient.defineJob({.eq("id", "exchange-rates-v1").maybeSingle();- const integrationMetadata = exchangeRatesMetadata.safeParse(+ const integrationMetadata = exchangeRatesIntegration.safeParse(integration?.data?.metadata);diff --git a/apps/carbon/app/modules/settings/integrations.models.ts b/apps/carbon/app/modules/settings/integrations.models.tsindex 9f4f4282c6..a1e988b2ab 100644--- a/apps/carbon/app/modules/settings/integrations.models.ts+++ b/apps/carbon/app/modules/settings/integrations.models.ts@@ -6,23 +6,48 @@ export const integration = z.object({active: zfd.checkbox(),});-export const exchangeRatesMetadata = z.object({+export const apiKey = z.object({apiKey: z.string(),});-export const exchangeRatesIntegration = integration- .merge(exchangeRatesMetadata)- .refine(- (data) => {- if (data.active) {- return data.apiKey.length > 0;- }- return true;- },- {- message: "API key is required when integration is active",- path: ["apiKey"],+export const exchangeRatesIntegration = integration.merge(apiKey).refine(+ (data) => {+ if (data.active) {+ return data.apiKey.length > 0;}- );-+ return true;+ },+ {+ message: "API key is required when integration is active",+ path: ["apiKey"],+ }+);export const exchangeRatesFormValidator = withZod(exchangeRatesIntegration);++export const googlePlacesIntegration = integration.merge(apiKey).refine(+ (data) => {+ if (data.active) {+ return data.apiKey.length > 0;+ }+ return true;+ },+ {+ message: "API key is required when integration is active",+ path: ["apiKey"],+ }+);+export const googlePlacesFormValidator = withZod(googlePlacesIntegration);++export const resendIntegration = integration.merge(apiKey).refine(+ (data) => {+ if (data.active) {+ return data.apiKey.length > 0;+ }+ return true;+ },+ {+ message: "API key is required when integration is active",+ path: ["apiKey"],+ }+);+export const resendFormValidator = withZod(resendIntegration);diff --git a/apps/carbon/app/modules/settings/settings.service.ts b/apps/carbon/app/modules/settings/settings.service.tsindex ec2d824e65..dce426dea1 100644--- a/apps/carbon/app/modules/settings/settings.service.ts+++ b/apps/carbon/app/modules/settings/settings.service.ts@@ -59,7 +59,11 @@ export async function getIntegration(}export async function getIntegrations(client: SupabaseClient<Database>) {- return client.from("integration").select("*").eq("visible", true);+ return client+ .from("integration")+ .select("*")+ .eq("visible", true)+ .order("title");}export async function getNextSequence(diff --git a/apps/carbon/app/modules/settings/ui/Integrations/GooglePlacesForm.tsx b/apps/carbon/app/modules/settings/ui/Integrations/GooglePlacesForm.tsxnew file mode 100644index 0000000000..d0403b38ce--- /dev/null+++ b/apps/carbon/app/modules/settings/ui/Integrations/GooglePlacesForm.tsx@@ -0,0 +1,73 @@+import {+ Button,+ Drawer,+ DrawerBody,+ DrawerContent,+ DrawerDescription,+ DrawerFooter,+ DrawerHeader,+ DrawerTitle,+ HStack,+ VStack,+} from "@carbon/react";+import { ValidatedForm } from "remix-validated-form";+import { Boolean, Input, Submit } from "~/components/Form";+import { usePermissions } from "~/hooks";+import { resendFormValidator } from "~/modules/settings";+import type { TypeOfValidator } from "~/types/validators";+import { path } from "~/utils/path";++type GooglePlacesFormProps = {+ initialValues: TypeOfValidator<typeof resendFormValidator>;+ onClose: () => void;+};++const GooglePlacesForm = ({+ initialValues,+ onClose,+}: GooglePlacesFormProps) => {+ const permissions = usePermissions();+ const isDisabled = !permissions.can("update", "settings");++ return (+ <Drawer+ open+ onOpenChange={(open) => {+ if (!open) onClose();+ }}+ >+ <DrawerContent>+ <ValidatedForm+ validator={resendFormValidator}+ method="post"+ action={path.to.integration("google-places-v2")}+ defaultValues={initialValues}+ className="flex flex-col h-full"+ >+ <DrawerHeader>+ <DrawerTitle>Google Places</DrawerTitle>+ <DrawerDescription>+ Autocomplete addresses with Google Places API+ </DrawerDescription>+ </DrawerHeader>+ <DrawerBody>+ <VStack spacing={4}>+ <Boolean name="active" label="Active" />+ <Input name="apiKey" label="API Key" />+ </VStack>+ </DrawerBody>+ <DrawerFooter>+ <HStack>+ <Submit isDisabled={isDisabled}>Save</Submit>+ <Button size="md" variant="solid" onClick={onClose}>+ Cancel+ </Button>+ </HStack>+ </DrawerFooter>+ </ValidatedForm>+ </DrawerContent>+ </Drawer>+ );+};++export default GooglePlacesForm;diff --git a/apps/carbon/app/modules/settings/ui/Integrations/ResendForm.tsx b/apps/carbon/app/modules/settings/ui/Integrations/ResendForm.tsxnew file mode 100644index 0000000000..df060d30e6--- /dev/null+++ b/apps/carbon/app/modules/settings/ui/Integrations/ResendForm.tsx@@ -0,0 +1,70 @@+import {+ Button,+ Drawer,+ DrawerBody,+ DrawerContent,+ DrawerDescription,+ DrawerFooter,+ DrawerHeader,+ DrawerTitle,+ HStack,+ VStack,+} from "@carbon/react";+import { ValidatedForm } from "remix-validated-form";+import { Boolean, Input, Submit } from "~/components/Form";+import { usePermissions } from "~/hooks";+import { resendFormValidator } from "~/modules/settings";+import type { TypeOfValidator } from "~/types/validators";+import { path } from "~/utils/path";++type ResendFormProps = {+ initialValues: TypeOfValidator<typeof resendFormValidator>;+ onClose: () => void;+};++const ResendForm = ({ initialValues, onClose }: ResendFormProps) => {+ const permissions = usePermissions();+ const isDisabled = !permissions.can("update", "settings");++ return (+ <Drawer+ open+ onOpenChange={(open) => {+ if (!open) onClose();+ }}+ >+ <DrawerContent>+ <ValidatedForm+ validator={resendFormValidator}+ method="post"+ action={path.to.integration("resend")}+ defaultValues={initialValues}+ className="flex flex-col h-full"+ >+ <DrawerHeader>+ <DrawerTitle>Resend</DrawerTitle>+ <DrawerDescription>+ Sends transactional emails with Resend API+ </DrawerDescription>+ </DrawerHeader>+ <DrawerBody>+ <VStack spacing={4}>+ <Boolean name="active" label="Active" />+ <Input name="apiKey" label="API Key" />+ </VStack>+ </DrawerBody>+ <DrawerFooter>+ <HStack>+ <Submit isDisabled={isDisabled}>Save</Submit>+ <Button size="md" variant="solid" onClick={onClose}>+ Cancel+ </Button>+ </HStack>+ </DrawerFooter>+ </ValidatedForm>+ </DrawerContent>+ </Drawer>+ );+};++export default ResendForm;diff --git a/apps/carbon/app/modules/settings/ui/Integrations/index.ts b/apps/carbon/app/modules/settings/ui/Integrations/index.tsindex 7f7340cbff..7b6d21c56e 100644--- a/apps/carbon/app/modules/settings/ui/Integrations/index.ts+++ b/apps/carbon/app/modules/settings/ui/Integrations/index.ts@@ -1,4 +1,6 @@import ExchangeRatesForm from "./ExchangeRatesForm";+import GooglePlacesForm from "./GooglePlacesForm";import IntegrationsList from "./IntegrationsList";+import ResendForm from "./ResendForm";-export { ExchangeRatesForm, IntegrationsList };+export { ExchangeRatesForm, GooglePlacesForm, IntegrationsList, ResendForm };diff --git a/apps/carbon/app/routes/x+/settings+/integrations.exchange-rates-v1.tsx b/apps/carbon/app/routes/x+/settings+/integrations.exchange-rates-v1.tsxindex cd18469d59..49c5f949f2 100644--- a/apps/carbon/app/routes/x+/settings+/integrations.exchange-rates-v1.tsx+++ b/apps/carbon/app/routes/x+/settings+/integrations.exchange-rates-v1.tsx@@ -3,12 +3,12 @@ import { json, redirect } from "@remix-run/node";import { useLoaderData, useNavigate } from "@remix-run/react";import { validationError } from "remix-validated-form";import {+ ExchangeRatesForm,+ apiKey,exchangeRatesFormValidator,- exchangeRatesMetadata,getIntegration,updateIntegration,} from "~/modules/settings";-import ExchangeRatesForm from "~/modules/settings/ui/Integrations/ExchangeRatesForm";import { requirePermissions } from "~/services/auth";import { flash } from "~/services/session";import { assertIsPost } from "~/utils/http";@@ -36,9 +36,7 @@ export async function loader({ request }: LoaderFunctionArgs) {);}- const validIntegration = exchangeRatesMetadata.safeParse(- integration.data?.metadata- );+ const validIntegration = apiKey.safeParse(integration.data?.metadata);return json({integration: validIntegration.successdiff --git a/apps/carbon/app/routes/x+/settings+/integrations.google-places-v2.tsx b/apps/carbon/app/routes/x+/settings+/integrations.google-places-v2.tsxnew file mode 100644index 0000000000..5d7a689652--- /dev/null+++ b/apps/carbon/app/routes/x+/settings+/integrations.google-places-v2.tsx@@ -0,0 +1,104 @@+import type { ActionFunctionArgs, LoaderFunctionArgs } from "@remix-run/node";+import { json, redirect } from "@remix-run/node";+import { useLoaderData, useNavigate } from "@remix-run/react";+import { validationError } from "remix-validated-form";+import {+ GooglePlacesForm,+ apiKey,+ getIntegration,+ googlePlacesFormValidator,+ updateIntegration,+} from "~/modules/settings";+import { requirePermissions } from "~/services/auth";+import { flash } from "~/services/session";+import { assertIsPost } from "~/utils/http";+import { path } from "~/utils/path";+import { error, success } from "~/utils/result";++const defaultValue = {+ apiKey: "",+ active: false,+};++export async function loader({ request }: LoaderFunctionArgs) {+ const { client } = await requirePermissions(request, {+ update: "settings",+ });++ const integration = await getIntegration(client, "google-places-v2");+ if (integration.error) {+ return redirect(+ path.to.integrations,+ await flash(+ request,+ error(integration.error, "Failed to load Google Places integration")+ )+ );+ }++ console.log({ integration });++ const validIntegration = apiKey.safeParse(integration.data?.metadata);++ return json({+ integration: validIntegration.success+ ? {+ active: integration.data?.active,+ ...validIntegration.data,+ }+ : defaultValue,+ });+}++export async function action({ request, params }: ActionFunctionArgs) {+ assertIsPost(request);+ const { client, userId } = await requirePermissions(request, {+ update: "settings",+ });++ const validation = await googlePlacesFormValidator.validate(+ await request.formData()+ );++ if (validation.error) {+ return validationError(validation.error);+ }++ const { active, ...data } = validation.data;++ const update = await updateIntegration(client, {+ id: "google-places-v2",+ active,+ metadata: {+ ...data,+ },+ updatedBy: userId,+ });+ if (update.error) {+ return redirect(+ path.to.integrations,+ await flash(+ request,+ error(update.error, "Failed to update Google Places integration")+ )+ );+ }++ return redirect(+ path.to.integrations,+ await flash(request, success("Updated Google Places integration"))+ );+}++export default function GooglePlacesIntegrationRoute() {+ const { integration } = useLoaderData<typeof loader>();++ const navigate = useNavigate();++ return (+ <GooglePlacesForm+ initialValues={integration}+ onClose={() => navigate(path.to.integrations)}+ />+ );+}diff --git a/apps/carbon/app/routes/x+/settings+/integrations.resend.tsx b/apps/carbon/app/routes/x+/settings+/integrations.resend.tsxnew file mode 100644index 0000000000..3d3e0ced2d--- /dev/null+++ b/apps/carbon/app/routes/x+/settings+/integrations.resend.tsx@@ -0,0 +1,102 @@+import type { ActionFunctionArgs, LoaderFunctionArgs } from "@remix-run/node";+import { json, redirect } from "@remix-run/node";+import { useLoaderData, useNavigate } from "@remix-run/react";+import { validationError } from "remix-validated-form";+import {+ ResendForm,+ apiKey,+ getIntegration,+ resendFormValidator,+ updateIntegration,+} from "~/modules/settings";+import { requirePermissions } from "~/services/auth";+import { flash } from "~/services/session";+import { assertIsPost } from "~/utils/http";+import { path } from "~/utils/path";+import { error, success } from "~/utils/result";++const defaultValue = {+ apiKey: "",+ active: false,+};++export async function loader({ request }: LoaderFunctionArgs) {+ const { client } = await requirePermissions(request, {+ update: "settings",+ });++ const integration = await getIntegration(client, "resend");+ if (integration.error) {+ return redirect(+ path.to.integrations,+ await flash(+ request,+ error(integration.error, "Failed to load Resend integration")+ )+ );+ }++ const validIntegration = apiKey.safeParse(integration.data?.metadata);++ return json({+ integration: validIntegration.success+ ? {+ active: integration.data?.active,+ ...validIntegration.data,+ }+ : defaultValue,+ });+}++export async function action({ request, params }: ActionFunctionArgs) {+ assertIsPost(request);+ const { client, userId } = await requirePermissions(request, {+ update: "settings",+ });++ const validation = await resendFormValidator.validate(+ await request.formData()+ );++ if (validation.error) {+ return validationError(validation.error);+ }++ const { active, ...data } = validation.data;++ const update = await updateIntegration(client, {+ id: "resend",+ active,+ metadata: {+ ...data,+ },+ updatedBy: userId,+ });+ if (update.error) {+ return redirect(+ path.to.integrations,+ await flash(+ request,+ error(update.error, "Failed to update Resend integration")+ )+ );+ }++ return redirect(+ path.to.integrations,+ await flash(request, success("Updated Resend integration"))+ );+}++export default function ResendIntegrationRoute() {+ const { integration } = useLoaderData<typeof loader>();++ const navigate = useNavigate();++ return (+ <ResendForm+ initialValues={integration}+ onClose={() => navigate(path.to.integrations)}+ />+ );+}diff --git a/packages/database/src/types.ts b/packages/database/src/types.tsindex 2fecf5b837..5f965f567f 100644--- a/packages/database/src/types.ts+++ b/packages/database/src/types.ts@@ -9891,13 +9891,13 @@ export interface Database {Relationships: [{foreignKeyName: "address_countryCode_fkey";- columns: ["supplierCountryCode"];+ columns: ["customerCountryCode"];referencedRelation: "country";referencedColumns: ["id"];},{foreignKeyName: "address_countryCode_fkey";- columns: ["customerCountryCode"];+ columns: ["supplierCountryCode"];referencedRelation: "country";referencedColumns: ["id"];}diff --git a/packages/database/supabase/migrations/20240119095150_integrations.sql b/packages/database/supabase/migrations/20240119095150_integrations.sqlindex fdad488eeb..ef23b9ab0d 100644--- a/packages/database/supabase/migrations/20240119095150_integrations.sql+++ b/packages/database/supabase/migrations/20240119095150_integrations.sql@@ -37,9 +37,41 @@ CREATE POLICY "Employees with settings_update can update integrations." ON "inteINSERT INTO "integration" ("id", "title", "description", "logoPath", "jsonschema")VALUES ('exchange-rates-v1',- 'Update Exchange Rates',+ 'Exchange Rates','Pulls currency rates from exchange rates API','/integrations/exchange-rates.png',+ '{+ "type": "object",+ "properties": {+ "apiKey": {+ "type": "string"+ }+ },+ "required": [+ "apiKey"+ ]+ }'::json),+ (+ 'resend',+ 'Resend Emails',+ 'Sends Transactional Emails with Resend API',+ '/integrations/resend.png',+ '{+ "type": "object",+ "properties": {+ "apiKey": {+ "type": "string"+ }+ },+ "required": [+ "apiKey"+ ]+ }'::json),+ (+ 'google-places-v2',+ 'Google Places',+ 'Autocomplete addresses with Google Places API',+ '/integrations/google-places.png','{"type": "object","properties": {diff --git a/packages/react/src/Avatar.tsx b/packages/react/src/Avatar.tsxindex c4ef0c6b9c..245eea9426 100644--- a/packages/react/src/Avatar.tsx+++ b/packages/react/src/Avatar.tsx@@ -14,7 +14,6 @@ import {createContext,forwardRef,useContext,- useEffect,useState,} from "react";@@ -54,13 +53,9 @@ const Avatar = forwardRef<HTMLSpanElement, AvatarProps>(({ className, name, src, size, children, ...props }, ref) => {const isGroup = !!useAvatarGroupContext()?.limit;const avatarInitials = getInitials(name ?? "");- const [_src, setSrc] = useState(src);+ const [error, setError] = useState(false);- useEffect(() => {- setSrc(src);- }, [src]);-- return _src ? (+ return src && !error ? (<imgclassName={cn(avatarVariants({ size, isGroup }),@@ -68,8 +63,8 @@ const Avatar = forwardRef<HTMLSpanElement, AvatarProps>(className)}alt={name ?? "avatar"}- src={_src}- onError={() => setSrc(undefined)}+ src={src}+ onError={() => setError(true)}/>) : (<spandiff --git a/packages/react/src/Textarea.tsx b/packages/react/src/Textarea.tsxindex 08f9f7c015..8f18ebee73 100644--- a/packages/react/src/Textarea.tsx+++ b/packages/react/src/Textarea.tsx@@ -10,7 +10,7 @@ const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(return (<textareaclassName={cn(- "flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 read-only:bg-muted read-only:cursor-not-allowed",+ "flex min-h-[2lh] max-h-[10lh] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 read-only:bg-muted read-only:cursor-not-allowed ",className)}ref={ref}