The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Fix tax ids not using the right code particular for european countries
Joshen Lim0afc21daf52d
diff --git a/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.constants.ts b/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.constants.tsindex a965405e546..90a4d22f0b3 100644--- a/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.constants.ts+++ b/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.constants.ts@@ -19,7 +19,7 @@ export const TAX_IDS: TaxId[] = [},{name: 'AT VAT',- code: 'at_vat',+ code: 'eu_vat',country: 'Austria',placeholder: 'ATU12345678',},@@ -37,13 +37,13 @@ export const TAX_IDS: TaxId[] = [},{name: 'BE VAT',- code: 'be_vat',+ code: 'eu_vat',country: 'Belgium',placeholder: 'BE0123456789',},{name: 'BG VAT',- code: 'bg_vat',+ code: 'eu_vat',country: 'Bulgaria',placeholder: 'BG0123456789',},@@ -115,25 +115,25 @@ export const TAX_IDS: TaxId[] = [},{name: 'CZ VAT',- code: 'cz_vat',+ code: 'eu_vat',country: 'Czech Republic',placeholder: 'CZ1234567890',},{name: 'DE VAT',- code: 'de_vat',+ code: 'eu_vat',country: 'Germany',placeholder: 'DE123456789',},{name: 'DK VAT',- code: 'dk_vat',+ code: 'eu_vat',country: 'Denmark',placeholder: 'DK12345678',},{name: 'EE VAT',- code: 'ee_vat',+ code: 'eu_vat',country: 'Estonia',placeholder: 'EE123456789',},@@ -145,25 +145,25 @@ export const TAX_IDS: TaxId[] = [},{name: 'ES VAT',- code: 'es_vat',+ code: 'eu_vat',country: 'Spain',placeholder: 'ESA1234567Z',},{name: 'FI VAT',- code: 'fi_vat',+ code: 'eu_vat',country: 'Finland',placeholder: 'FI12345678',},{name: 'FR VAT',- code: 'fr_vat',+ code: 'eu_vat',country: 'France',placeholder: 'FRAB123456789',},{name: 'GB VAT',- code: 'gb_vat',+ code: 'eu_vat',country: 'United Kingdom',placeholder: 'GB123456789',},@@ -175,7 +175,7 @@ export const TAX_IDS: TaxId[] = [},{name: 'GR VAT',- code: 'gr_vat',+ code: 'eu_vat',country: 'Greece',placeholder: 'EL123456789',},@@ -193,7 +193,7 @@ export const TAX_IDS: TaxId[] = [},{name: 'HU VAT',- code: 'hu_vat',+ code: 'eu_vat',country: 'Hungary',placeholder: 'HU12345678912',},@@ -205,7 +205,7 @@ export const TAX_IDS: TaxId[] = [},{name: 'IE VAT',- code: 'ie_vat',+ code: 'eu_vat',country: 'Ireland',placeholder: 'IE12345678AB',},@@ -229,7 +229,7 @@ export const TAX_IDS: TaxId[] = [},{name: 'IT VAT',- code: 'it_vat',+ code: 'eu_vat',country: 'Italy',placeholder: 'IT12345678912',},@@ -259,25 +259,25 @@ export const TAX_IDS: TaxId[] = [},{name: 'LT VAT',- code: 'lt_vat',+ code: 'eu_vat',country: 'Lithuania',placeholder: 'LT123456789123',},{name: 'LU VAT',- code: 'lu_vat',+ code: 'eu_vat',country: 'Luxembourg',placeholder: 'LU12345678',},{name: 'LV VAT',- code: 'lv_vat',+ code: 'eu_vat',country: 'Latvia',placeholder: 'LV12345678912',},{name: 'MT VAT',- code: 'mt_vat',+ code: 'eu_vat',country: 'Malta',placeholder: 'MT12345678',},@@ -307,7 +307,7 @@ export const TAX_IDS: TaxId[] = [},{name: 'NL VAT',- code: 'nl_vat',+ code: 'eu_vat',country: 'Netherlands',placeholder: 'NL123456789B12',},@@ -325,19 +325,19 @@ export const TAX_IDS: TaxId[] = [},{name: 'PL VAT',- code: 'pl_vat',+ code: 'eu_vat',country: 'Poland',placeholder: 'PL1234567890',},{name: 'PT VAT',- code: 'pt_vat',+ code: 'eu_vat',country: 'Portugal',placeholder: 'PT123456789',},{name: 'RO VAT',- code: 'ro_vat',+ code: 'eu_vat',country: 'Romania',placeholder: 'RO1234567891',},@@ -379,13 +379,13 @@ export const TAX_IDS: TaxId[] = [},{name: 'SI VAT',- code: 'si_vat',+ code: 'eu_vat',country: 'Slovenia',placeholder: 'SI12345678',},{name: 'SK VAT',- code: 'sk_vat',+ code: 'eu_vat',country: 'Slovakia',placeholder: 'SK1234567891',},diff --git a/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.tsx b/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.tsxindex 01b64c8b07a..b5ae426da70 100644--- a/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.tsx+++ b/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.tsx@@ -1,6 +1,6 @@import { FC, useEffect, useState } from 'react'import { isEqual } from 'lodash'-import { Input, Button, IconLoader, IconPlus, Select, IconX } from '@supabase/ui'+import { Input, Button, IconPlus, Select, IconX } from '@supabase/ui'import { useStore } from 'hooks'import { uuidv4 } from 'lib/helpers'@@ -26,7 +26,15 @@ const TaxID: FC<Props> = ({ loading, taxIds, onTaxIdsUpdated }) => {const [errors, setErrors] = useState<string[]>([])const [taxIdValues, setTaxIdValues] = useState(taxIds)const formattedTaxIds = taxIds.map((taxId: any) => {- return { id: taxId.id, type: taxId.type, value: taxId.value }+ return {+ id: taxId.id,+ type: taxId.type,+ value: taxId.value,+ name:+ taxId.type === 'eu_vat'+ ? `${taxId.country} VAT`+ : TAX_IDS.find((option) => option.code === taxId.type)?.name ?? '',+ }})useEffect(() => {@@ -43,7 +51,12 @@ const TaxID: FC<Props> = ({ loading, taxIds, onTaxIdsUpdated }) => {const onUpdateTaxId = (id: string, key: string, value: string) => {const updatedTaxIds = taxIdValues.map((taxId: any) => {if (taxId.id === id) {- return { ...taxId, [key]: value }+ if (key === 'name') {+ const selectedTaxIdOption = TAX_IDS.find((option) => option.name === value)+ return { ...taxId, [key]: value, type: selectedTaxIdOption?.code }+ } else {+ return { ...taxId, [key]: value }+ }}return taxId})@@ -51,7 +64,7 @@ const TaxID: FC<Props> = ({ loading, taxIds, onTaxIdsUpdated }) => {}const onAddNewTaxId = () => {- const newTaxId = { id: uuidv4(), type: 'ae_trn', value: '' }+ const newTaxId = { id: uuidv4(), type: TAX_IDS[0].code, value: '', name: TAX_IDS[0].name }const updatedTaxIds = taxIdValues.concat([newTaxId])setTaxIdValues(updatedTaxIds)}@@ -156,24 +169,22 @@ const TaxID: FC<Props> = ({ loading, taxIds, onTaxIdsUpdated }) => {{taxIdValues.length >= 1 ? (<div className="w-full space-y-2">{taxIdValues.map((taxId: any, idx: number) => {- const placeholder =- TAX_IDS.find((taxIdOption) => taxId.type === taxIdOption.code)?.placeholder ??- ''+ const selectedTaxId = TAX_IDS.find((option) => option.name === taxId.name)return (<div key={`tax-id-${idx}`} className="flex items-center space-x-2"><Select- value={taxId.type}- onChange={(e: any) => onUpdateTaxId(taxId.id, 'type', e.target.value)}+ value={selectedTaxId?.name}+ onChange={(e: any) => onUpdateTaxId(taxId.id, 'name', e.target.value)}>- {TAX_IDS.map((taxIdOption) => (- <Select.Option key={taxIdOption.code} value={taxIdOption.code}>- {taxIdOption.name}+ {TAX_IDS.map((option) => (+ <Select.Option key={option.name} value={option.name}>+ {option.name}</Select.Option>))}</Select><Inputvalue={taxId.value}- placeholder={placeholder}+ placeholder={selectedTaxId?.placeholder ?? ''}onChange={(e: any) => onUpdateTaxId(taxId.id, 'value', e.target.value)}/><Button