Skip to content

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.

Bulk Import Contacts (#75)

Brad Barbin0af093d10266
diff --git a/apps/carbon/app/components/Form/CustomerContact.tsx b/apps/carbon/app/components/Form/CustomerContact.tsx
index 9a637bced7..4f13b8a343 100644
--- a/apps/carbon/app/components/Form/CustomerContact.tsx
+++ b/apps/carbon/app/components/Form/CustomerContact.tsx
@@ -42,7 +42,7 @@ const CustomerContact = (props: CustomerContactSelectProps) => {
() =>
customerContactsFetcher.data?.data?.map((c) => ({
value: c.id,
- label: `${c.contact?.firstName} ${c.contact?.lastName}`,
+ label: c.contact?.fullName ?? c.contact?.email ?? "Unknown",
})) ?? [],
[customerContactsFetcher.data]
diff --git a/apps/carbon/app/components/Form/SupplierContact.tsx b/apps/carbon/app/components/Form/SupplierContact.tsx
index b836bc9c51..1c41f85199 100644
--- a/apps/carbon/app/components/Form/SupplierContact.tsx
+++ b/apps/carbon/app/components/Form/SupplierContact.tsx
@@ -42,7 +42,7 @@ const SupplierContact = (props: SupplierContactSelectProps) => {
() =>
supplierContactsFetcher.data?.data?.map((c) => ({
value: c.id,
- label: `${c.contact?.firstName} ${c.contact?.lastName}`,
+ label: c.contact?.fullName ?? c.contact?.email ?? "Unknown",
})) ?? [],
[supplierContactsFetcher.data]
diff --git a/apps/carbon/app/components/ImportCSVModal/FieldMappings.tsx b/apps/carbon/app/components/ImportCSVModal/FieldMappings.tsx
index a091355ab4..b47a7349ec 100644
--- a/apps/carbon/app/components/ImportCSVModal/FieldMappings.tsx
+++ b/apps/carbon/app/components/ImportCSVModal/FieldMappings.tsx
@@ -81,7 +81,6 @@ export function FieldMapping({
fetcher.submit(
{
fileColumns,
- firstRows,
},
{
method: "POST",
diff --git a/apps/carbon/app/components/ImportCSVModal/UploadCSV.tsx b/apps/carbon/app/components/ImportCSVModal/UploadCSV.tsx
index 7aa29e6a0d..451fbf2408 100644
--- a/apps/carbon/app/components/ImportCSVModal/UploadCSV.tsx
+++ b/apps/carbon/app/components/ImportCSVModal/UploadCSV.tsx
@@ -35,13 +35,17 @@ export const UploadCSV = ({ table }: { table: keyof typeof importSchemas }) => {
setLoading(true);
});
- readLines(file, 100)
- .then((lines) => {
- const { data, meta } = Papa.parse(lines, {
- worker: false,
- skipEmptyLines: true,
- header: true,
- });
+ Papa.parse(file, {
+ header: true,
+ skipEmptyLines: true,
+ error: (error) => {
+ setError(error.message);
+ setFileColumns(null);
+ setFirstRows(null);
+ setLoading(false);
+ },
+ complete: (results) => {
+ const { data, meta } = results;
if (!data || data.length < 2) {
setError("CSV file must have at least 2 rows.");
@@ -62,13 +66,8 @@ export const UploadCSV = ({ table }: { table: keyof typeof importSchemas }) => {
setFileColumns(meta.fields);
setFirstRows(data as Record<string, string>[]);
setLoading(false);
- })
- .catch(() => {
- setError("Failed to read CSV file.");
- setFileColumns(null);
- setFirstRows(null);
- setLoading(false);
- });
+ },
+ });
};
const uploadFile = async (file: File) => {
@@ -136,7 +135,7 @@ export const UploadCSV = ({ table }: { table: keyof typeof importSchemas }) => {
<ModalTitle className="m-0 p-0">Upload CSV</ModalTitle>
</div>
<ModalDescription>
- {`Please upload a CSV file of your ${table} data`}
+ Please upload a CSV file of your data
</ModalDescription>
</ModalHeader>
<div
@@ -172,23 +171,3 @@ export const UploadCSV = ({ table }: { table: keyof typeof importSchemas }) => {
</>
);
};
-
-async function readLines(file: File, count = 100): Promise<string> {
- const reader = file.stream().getReader();
- const decoder = new TextDecoder("utf-8");
- let { value: chunk, done: readerDone } = await reader.read();
- let content = "";
- const result: string[] = [];
-
- while (!readerDone) {
- content += decoder.decode(chunk, { stream: true });
- const lines = content.split("\n");
- if (lines.length >= count) {
- reader.cancel();
- return lines.slice(0, count).join("\n");
- }
- ({ value: chunk, done: readerDone } = await reader.read());
- }
-
- return result.join("\n");
-}
diff --git a/apps/carbon/app/components/Layout/Navigation/CollapsibleSidebar.tsx b/apps/carbon/app/components/Layout/Navigation/CollapsibleSidebar.tsx
index 5b87a33298..2b447064ff 100644
--- a/apps/carbon/app/components/Layout/Navigation/CollapsibleSidebar.tsx
+++ b/apps/carbon/app/components/Layout/Navigation/CollapsibleSidebar.tsx
@@ -7,7 +7,7 @@ import {
} from "@carbon/react";
import { motion } from "framer-motion";
import { useMemo, type PropsWithChildren } from "react";
-import { LuArrowLeftFromLine, LuArrowRightFromLine } from "react-icons/lu";
+import { LuPanelLeftClose, LuPanelLeftOpen } from "react-icons/lu";
export const CollapsibleSidebar = ({
children,
@@ -43,12 +43,12 @@ export const CollapsibleSidebar = ({
onClick={sidebar.onToggle}
aria-label="Toggle sidebar"
variant="secondary"
- className="bg-popover inline-block border border-border border-l-0 absolute top-[calc(100vh-135px)] text-muted-foreground right-[-31px] left-auto rounded-l-none z-[3] hover:bg-popover p-0 shadow-none w-8 h-8"
+ className="bg-card inline-block border border-border border-l-0 absolute top-[calc(100vh-135px)] text-muted-foreground right-[-31px] left-auto rounded-l-none z-[3] hover:bg-card p-0 shadow-none w-8 h-8"
>
{sidebar.isOpen ? (
- <LuArrowLeftFromLine className="w-3 h-3 ml-1.5" />
+ <LuPanelLeftClose className="w-4 h-4 ml-1" />
) : (
- <LuArrowRightFromLine className="w-3 h-3 ml-1.5" />
+ <LuPanelLeftOpen className="w-4 h-4 ml-1" />
)}
</Button>
</TooltipTrigger>
diff --git a/apps/carbon/app/modules/purchasing/purchasing.service.ts b/apps/carbon/app/modules/purchasing/purchasing.service.ts
index 46aa80aa65..2494ee6b9e 100644
--- a/apps/carbon/app/modules/purchasing/purchasing.service.ts
+++ b/apps/carbon/app/modules/purchasing/purchasing.service.ts
@@ -283,7 +283,7 @@ export async function getSupplierContacts(
return client
.from("supplierContact")
.select(
- "*, contact(id, firstName, lastName, email, mobilePhone, homePhone, workPhone, fax, title, notes), user(id, active)"
+ "*, contact(id, fullName, firstName, lastName, email, mobilePhone, homePhone, workPhone, fax, title, notes), user(id, active)"
)
.eq("supplierId", supplierId);
}
diff --git a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierContactForm.tsx b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierContactForm.tsx
index ecb9551632..9f919f0d7b 100644
--- a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierContactForm.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierContactForm.tsx
@@ -92,9 +92,9 @@ const SupplierContactForm = ({
<Hidden name="type" value={type} />
<Hidden name="contactId" />
<VStack spacing={4}>
+ <Input name="email" label="Email" />
<Input name="firstName" label="First Name" />
<Input name="lastName" label="Last Name" />
- <Input name="email" label="Email" />
<Input name="title" label="Title" />
<PhoneInput name="mobilePhone" label="Mobile Phone" />
<PhoneInput name="homePhone" label="Home Phone" />
diff --git a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierContacts.tsx b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierContacts.tsx
index 753693d390..8e82a10e73 100644
--- a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierContacts.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierContacts.tsx
@@ -126,7 +126,11 @@ const SupplierContacts = ({ contacts }: SupplierContactsProps) => {
<ConfirmDelete
action={path.to.deleteSupplierContact(supplierId, selectedContact.id)}
isOpen={deleteContactModal.isOpen}
- name={`${selectedContact.contact?.firstName} ${selectedContact.contact?.lastName}`}
+ name={
+ selectedContact.contact?.fullName ??
+ selectedContact.contact?.email ??
+ "Unknown"
+ }
text="Are you sure you want to delete this contact?"
onCancel={deleteContactModal.onClose}
onSubmit={deleteContactModal.onClose}
diff --git a/apps/carbon/app/modules/purchasing/ui/Suppliers/SuppliersTable.tsx b/apps/carbon/app/modules/purchasing/ui/Suppliers/SuppliersTable.tsx
index 528aed112a..8c0be5afe7 100644
--- a/apps/carbon/app/modules/purchasing/ui/Suppliers/SuppliersTable.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/Suppliers/SuppliersTable.tsx
@@ -37,9 +37,11 @@ const SuppliersTable = memo(
accessorKey: "name",
header: "Name",
cell: ({ row }) => (
- <Hyperlink to={path.to.supplierDetails(row.original.id!)}>
- <SupplierAvatar supplierId={row.original.id!} />
- </Hyperlink>
+ <div className="max-w-[320px] truncate">
+ <Hyperlink to={path.to.supplierDetails(row.original.id!)}>
+ <SupplierAvatar supplierId={row.original.id!} />
+ </Hyperlink>
+ </div>
),
},
{
@@ -215,6 +217,10 @@ const SuppliersTable = memo(
table: "supplier",
label: "Suppliers",
},
+ {
+ table: "supplierContact",
+ label: "Contacts",
+ },
]}
primaryAction={
permissions.can("create", "purchasing") && (
diff --git a/apps/carbon/app/modules/resources/resources.service.ts b/apps/carbon/app/modules/resources/resources.service.ts
index ce1eb481d3..8bf7d36a66 100644
--- a/apps/carbon/app/modules/resources/resources.service.ts
+++ b/apps/carbon/app/modules/resources/resources.service.ts
@@ -153,7 +153,7 @@ export async function getContractors(
if (args?.search) {
query = query.or(
- `firstName.ilike.%${args.search}%,lastName.ilike.%${args.search}%`
+ `fullName.ilike.%${args.search}%,email.ilike.%${args.search}%`
);
}
diff --git a/apps/carbon/app/modules/resources/ui/Contractors/ContractorsTable.tsx b/apps/carbon/app/modules/resources/ui/Contractors/ContractorsTable.tsx
index 5559d84508..02414db5a6 100644
--- a/apps/carbon/app/modules/resources/ui/Contractors/ContractorsTable.tsx
+++ b/apps/carbon/app/modules/resources/ui/Contractors/ContractorsTable.tsx
@@ -34,14 +34,14 @@ const ContractorsTable = memo(
<HStack>
<Avatar
size="sm"
- name={`${row.original.firstName} ${row.original.lastName}`}
+ name={row.original.fullName ?? row.original.email ?? "Unknown"}
/>
<Hyperlink
to={`${path.to.contractor(
row.original.supplierContactId!
)}?${params.toString()}`}
>
- {row.original.firstName} {row.original.lastName}
+ {row.original.fullName ?? row.original.email ?? "Unknown"}
</Hyperlink>
</HStack>
),
diff --git a/apps/carbon/app/modules/sales/sales.service.ts b/apps/carbon/app/modules/sales/sales.service.ts
index de75139959..117178d322 100644
--- a/apps/carbon/app/modules/sales/sales.service.ts
+++ b/apps/carbon/app/modules/sales/sales.service.ts
@@ -224,7 +224,7 @@ export async function getCustomerContacts(
return client
.from("customerContact")
.select(
- "*, contact(id, firstName, lastName, email, mobilePhone, homePhone, workPhone, fax, title, notes), user(id, active)"
+ "*, contact(id, fullName, firstName, lastName, email, mobilePhone, homePhone, workPhone, fax, title, notes), user(id, active)"
)
.eq("customerId", customerId);
}
diff --git a/apps/carbon/app/modules/sales/ui/Customer/CustomerContactForm.tsx b/apps/carbon/app/modules/sales/ui/Customer/CustomerContactForm.tsx
index 02f09412b5..71ca3bdfc3 100644
--- a/apps/carbon/app/modules/sales/ui/Customer/CustomerContactForm.tsx
+++ b/apps/carbon/app/modules/sales/ui/Customer/CustomerContactForm.tsx
@@ -81,9 +81,9 @@ const CustomerContactForm = ({
<Hidden name="type" value={type} />
<Hidden name="contactId" />
<VStack spacing={4}>
+ <Input name="email" label="Email" />
<Input name="firstName" label="First Name" />
<Input name="lastName" label="Last Name" />
- <Input name="email" label="Email" />
<Input name="title" label="Title" />
<PhoneInput name="mobilePhone" label="Mobile Phone" />
<PhoneInput name="homePhone" label="Home Phone" />
diff --git a/apps/carbon/app/modules/sales/ui/Customer/CustomerContacts.tsx b/apps/carbon/app/modules/sales/ui/Customer/CustomerContacts.tsx
index 5edcfe9dc6..b986a1fff7 100644
--- a/apps/carbon/app/modules/sales/ui/Customer/CustomerContacts.tsx
+++ b/apps/carbon/app/modules/sales/ui/Customer/CustomerContacts.tsx
@@ -115,7 +115,9 @@ const CustomerContacts = ({ contacts }: CustomerContactsProps) => {
<ConfirmDelete
action={path.to.deleteCustomerContact(customerId, contact.id)}
isOpen={deleteContactModal.isOpen}
- name={`${contact?.contact?.firstName} ${contact?.contact?.lastName}`}
+ name={
+ contact?.contact?.fullName ?? contact?.contact?.email ?? "Unknown"
+ }
text="Are you sure you want to delete this contact?"
onCancel={deleteContactModal.onClose}
onSubmit={deleteContactModal.onClose}
diff --git a/apps/carbon/app/modules/sales/ui/Customers/CustomersTable.tsx b/apps/carbon/app/modules/sales/ui/Customers/CustomersTable.tsx
index 7159a96dfa..381d4ebf5b 100644
--- a/apps/carbon/app/modules/sales/ui/Customers/CustomersTable.tsx
+++ b/apps/carbon/app/modules/sales/ui/Customers/CustomersTable.tsx
@@ -37,9 +37,11 @@ const CustomersTable = memo(
accessorKey: "name",
header: "Name",
cell: ({ row }) => (
- <Hyperlink to={path.to.customerDetails(row.original.id!)}>
- <CustomerAvatar customerId={row.original.id!} />
- </Hyperlink>
+ <div className="max-w-[320px] truncate">
+ <Hyperlink to={path.to.customerDetails(row.original.id!)}>
+ <CustomerAvatar customerId={row.original.id!} />
+ </Hyperlink>
+ </div>
),
},
{
@@ -191,6 +193,10 @@ const CustomersTable = memo(
table: "customer",
label: "Customers",
},
+ {
+ table: "customerContact",
+ label: "Contacts",
+ },
]}
primaryAction={
permissions.can("create", "sales") && (
diff --git a/apps/carbon/app/modules/shared/imports.models.ts b/apps/carbon/app/modules/shared/imports.models.ts
index a9c320de08..48ba0de0fe 100644
--- a/apps/carbon/app/modules/shared/imports.models.ts
+++ b/apps/carbon/app/modules/shared/imports.models.ts
@@ -57,6 +57,63 @@ export const fieldMappings = {
type: "string",
},
},
+ customerContact: {
+ id: {
+ label: "External ID",
+ required: true,
+ type: "string",
+ },
+ companyId: {
+ label: "External Company ID",
+ required: true,
+ type: "string",
+ },
+ firstName: {
+ label: "First Name",
+ required: true,
+ type: "string",
+ },
+ lastName: {
+ label: "Last Name",
+ required: true,
+ type: "string",
+ },
+ email: {
+ label: "Email",
+ type: "string",
+ required: true,
+ },
+ title: {
+ label: "Title",
+ type: "string",
+ required: false,
+ },
+ mobilePhone: {
+ label: "Mobile Phone",
+ type: "string",
+ required: false,
+ },
+ workPhone: {
+ label: "Work Phone",
+ type: "string",
+ required: false,
+ },
+ homePhone: {
+ label: "Home Phone",
+ type: "string",
+ required: false,
+ },
+ fax: {
+ label: "Fax",
+ type: "string",
+ required: false,
+ },
+ notes: {
+ label: "Notes",
+ type: "string",
+ required: false,
+ },
+ },
supplier: {
id: {
label: "External ID",
@@ -89,7 +146,20 @@ export const fieldMappings = {
phone: {
label: "Phone",
required: false,
- type: "string",
+ type: "enum",
+ enumData: {
+ description: "The account manager of the customer",
+ fetcher: async (
+ client: SupabaseClient<Database>,
+ companyId: string
+ ) => {
+ return client
+ .from("employees")
+ .select("id, name, avatarUrl")
+ .eq("companyId", companyId)
+ .order("name");
+ },
+ },
},
fax: {
label: "Fax",
@@ -112,6 +182,63 @@ export const fieldMappings = {
type: "string",
},
},
+ supplierContact: {
+ id: {
+ label: "External ID",
+ required: true,
+ type: "string",
+ },
+ companyId: {
+ label: "External Company ID",
+ required: true,
+ type: "string",
+ },
+ firstName: {
+ label: "First Name",
+ required: true,
+ type: "string",
+ },
+ lastName: {
+ label: "Last Name",
+ required: true,
+ type: "string",
+ },
+ email: {
+ label: "Email",
+ type: "string",
+ required: true,
+ },
+ title: {
+ label: "Title",
+ type: "string",
+ required: false,
+ },
+ mobilePhone: {
+ label: "Mobile Phone",
+ type: "string",
+ required: false,
+ },
+ workPhone: {
+ label: "Work Phone",
+ type: "string",
+ required: false,
+ },
+ homePhone: {
+ label: "Home Phone",
+ type: "string",
+ required: false,
+ },
+ fax: {
+ label: "Fax",
+ type: "string",
+ required: false,
+ },
+ notes: {
+ label: "Notes",
+ type: "string",
+ required: false,
+ },
+ },
part: {
id: {
label: "External ID",
@@ -598,7 +725,9 @@ export const fieldMappings = {
export const importPermissions: Record<keyof typeof fieldMappings, string> = {
customer: "sales",
+ customerContact: "sales",
supplier: "purchasing",
+ supplierContact: "purchasing",
part: "parts",
material: "parts",
tool: "parts",
@@ -626,18 +755,9 @@ export const importSchemas: Record<
accountManagerId: z
.string()
.optional()
- .describe("The id of the account manager of the customer")
- .nullable(),
- phone: z
- .string()
- .optional()
- .describe("The phone number of the customer")
- .nullable(),
- fax: z
- .string()
- .optional()
- .describe("The fax number of the customer")
- .nullable(),
+ .describe("The id of the account manager of the customer"),
+ phone: z.string().optional().describe("The phone number of the customer"),
+ fax: z.string().optional().describe("The fax number of the customer"),
taxId: z
.string()
.optional()
@@ -656,6 +776,39 @@ export const importSchemas: Record<
.describe("The website url. Usually begins with http:// or https://")
.nullable(),
}),
+ customerContact: z.object({
+ id: z
+ .string()
+ .min(1, { message: "ID is required" })
+ .describe(
+ "The id of the customer contact, usually a number or set of alphanumeric characters."
+ ),
+ companyId: z
+ .string()
+ .min(1, { message: "Company ID is required" })
+ .describe("The id of the company the contact belongs to"),
+ firstName: z.string().describe("The first name of the customer contact"),
+ lastName: z.string().describe("The last name of the customer contact"),
+ email: z
+ .string()
+ .min(1, { message: "Email is required" })
+ .describe("The email of the customer contact"),
+ title: z.string().optional().describe("The title of the customer contact"),
+ mobilePhone: z
+ .string()
+ .optional()
+ .describe("The mobile phone of the customer contact"),
+ workPhone: z
+ .string()
+ .optional()
+ .describe("The work phone of the customer contact"),
+ homePhone: z
+ .string()
+ .optional()
+ .describe("The home phone of the customer contact"),
+ fax: z.string().optional().describe("The fax of the customer contact"),
+ notes: z.string().optional().describe("The notes of the customer contact"),
+ }),
supplier: z.object({
id: z
.string()
@@ -672,18 +825,9 @@ export const importSchemas: Record<
accountManagerId: z
.string()
.optional()
- .describe("The id of the account manager of the supplier")
- .nullable(),
- phone: z
- .string()
- .optional()
- .describe("The phone number of the supplier")
- .nullable(),
- fax: z
- .string()
- .optional()
- .describe("The fax number of the supplier")
- .nullable(),
+ .describe("The id of the account manager of the supplier"),
+ phone: z.string().optional().describe("The phone number of the supplier"),
+ fax: z.string().optional().describe("The fax number of the supplier"),
taxId: z
.string()
.optional()
@@ -702,6 +846,45 @@ export const importSchemas: Record<
.describe("The website url. Usually begins with http:// or https://")
.nullable(),
}),
+ supplierContact: z.object({
+ id: z
+ .string()
+ .min(1, { message: "ID is required" })
+ .describe(
+ "The id of the supplier contact, usually a number or set of alphanumeric characters."
+ ),
+ companyId: z
+ .string()
+ .min(1, { message: "Company ID is required" })
+ .describe("The id of the company the contact belongs to"),
+ firstName: z
+ .string()
+ .describe("The first name of the supplier contact")
+ .optional(),
+ lastName: z
+ .string()
+ .describe("The last name of the supplier contact")
+ .optional(),
+ email: z
+ .string()
+ .min(1, { message: "Email is required" })
+ .describe("The email of the supplier contact"),
+ title: z.string().optional().describe("The title of the supplier contact"),
+ mobilePhone: z
+ .string()
+ .optional()
+ .describe("The mobile phone of the supplier contact"),
+ workPhone: z
+ .string()
+ .optional()
+ .describe("The work phone of the supplier contact"),
+ homePhone: z
+ .string()
+ .optional()
+ .describe("The home phone of the supplier contact"),
+ fax: z.string().optional().describe("The fax of the supplier contact"),
+ notes: z.string().optional().describe("The notes of the supplier contact"),
+ }),
part: z.object({
id: z
.string()
diff --git a/apps/carbon/app/modules/users/ui/Customers/CustomerAccountsTable.tsx b/apps/carbon/app/modules/users/ui/Customers/CustomerAccountsTable.tsx
index dcb38500c6..24ccb85cdb 100644
--- a/apps/carbon/app/modules/users/ui/Customers/CustomerAccountsTable.tsx
+++ b/apps/carbon/app/modules/users/ui/Customers/CustomerAccountsTable.tsx
@@ -74,10 +74,9 @@ const CustomerAccountsTable = memo(
/>
<span>
- {
- // @ts-ignore
- `${row.original.user?.firstName} ${row.original.user?.lastName}`
- }
+ {row.original.user?.fullName ??
+ row.original.user?.email ??
+ "Unknown"}
</span>
</HStack>
),
diff --git a/apps/carbon/app/modules/users/ui/Suppliers/CreateSupplierModal/CreateSupplierModal.tsx b/apps/carbon/app/modules/users/ui/Suppliers/CreateSupplierModal/CreateSupplierModal.tsx
index bd2fbeae11..0b9502294a 100644
--- a/apps/carbon/app/modules/users/ui/Suppliers/CreateSupplierModal/CreateSupplierModal.tsx
+++ b/apps/carbon/app/modules/users/ui/Suppliers/CreateSupplierModal/CreateSupplierModal.tsx
@@ -145,8 +145,7 @@ const SupplierContact = ({
supplierContactFetcher.data?.data
? supplierContactFetcher.data?.data.map((c) => ({
value: c.id,
- // @ts-ignore
- label: `${c.contact?.firstName} ${c.contact?.lastName}`,
+ label: c.contact?.fullName ?? c.contact?.email ?? "Unknown",
}))
: [],
[supplierContactFetcher.data]
diff --git a/apps/carbon/app/routes/api+/ai+/csv+/$table.columns.tsx b/apps/carbon/app/routes/api+/ai+/csv+/$table.columns.tsx
index 0fba373464..17f2ebcdb5 100644
--- a/apps/carbon/app/routes/api+/ai+/csv+/$table.columns.tsx
+++ b/apps/carbon/app/routes/api+/ai+/csv+/$table.columns.tsx
@@ -30,7 +30,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
const { fileColumns } = result.data;
- const schema = importSchemas[table as keyof typeof importSchemas];
+ const schema = importSchemas[table as keyof typeof importSchemas].partial();
if (!schema) {
throw notFound("Table not found in the list of supported tables");
@@ -46,7 +46,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
...Object.keys(getZodSchemaFieldsShallow(schema)),
].join(", ")}) by providing the matching column name for each field.
- If you are not sure or there is no matching column.
+ If you are not sure or there is no matching column, please return "N/A".
Columns:
${fileColumns.join(",")}
@@ -56,7 +56,8 @@ export async function action({ request, params }: ActionFunctionArgs) {
return json(object);
} catch (error) {
- return json({});
+ console.error(error);
+ return json({} as Record<string, string>);
}
}
diff --git a/apps/carbon/app/routes/x+/resources+/contractors.delete.$supplierId.tsx b/apps/carbon/app/routes/x+/resources+/contractors.delete.$supplierId.tsx
index 12ef0defbe..b18081e8c7 100644
--- a/apps/carbon/app/routes/x+/resources+/contractors.delete.$supplierId.tsx
+++ b/apps/carbon/app/routes/x+/resources+/contractors.delete.$supplierId.tsx
@@ -75,9 +75,11 @@ export default function DeleteContractorRoute() {
return (
<ConfirmDelete
action={path.to.deleteContractor(contractor.supplierContactId)}
- name={`${contractor.firstName} ${contractor.lastName}`}
+ name={contractor.fullName ?? contractor.email ?? "Unknown"}
text={`Are you sure you want to delete the contractor:
- ${contractor.firstName} ${contractor.lastName}? This cannot be undone.`}
+ ${
+ contractor.fullName ?? contractor.email ?? "Unknown"
+ }? This cannot be undone.`}
onCancel={onCancel}
/>
);
diff --git a/apps/carbon/app/types/validators.ts b/apps/carbon/app/types/validators.ts
index 04dec703c0..fd8743498c 100644
--- a/apps/carbon/app/types/validators.ts
+++ b/apps/carbon/app/types/validators.ts
@@ -24,8 +24,8 @@ export const address = {
export const contact = {
contactId: z.string().optional(),
- firstName: z.string().min(1, "First name is required"),
- lastName: z.string().min(1, "Last name is required"),
+ firstName: zfd.text(z.string().optional()),
+ lastName: zfd.text(z.string().optional()),
title: zfd.text(z.string().optional()),
email: z
.string()
diff --git a/apps/carbon/package.json b/apps/carbon/package.json
index 069bd28d62..ee28962533 100644
--- a/apps/carbon/package.json
+++ b/apps/carbon/package.json
@@ -54,7 +54,7 @@
"localforage": "^1.10.0",
"lodash.debounce": "^4.0.8",
"lodash.words": "^4.2.0",
- "papaparse": "^5.4.1",
+ "papaparse": "5.3.2",
"nanoid": "5.0.4",
"nanostores": "^0.9.3",
"non.geist": "~1.0.3",
@@ -112,4 +112,4 @@
"types": "tsc"
},
"sideEffects": false
-}
\ No newline at end of file
+}
diff --git a/package-lock.json b/package-lock.json
index b22679bed1..c495d05e78 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -89,7 +89,7 @@
"nanostores": "^0.9.3",
"non.geist": "~1.0.3",
"nprogress": "0.2.0",
- "papaparse": "^5.4.1",
+ "papaparse": "5.3.2",
"performant-array-to-tree": "1.11.0",
"posthog-js": "^1.116.6",
"react": "^18.3.1",
@@ -353,7 +353,8 @@
},
"ci/node_modules/@supabase/functions-js": {
"version": "2.1.5",
- "license": "MIT",
+ "resolved": "https://registry.npmjs.org/@supabase/functions-js/-/functions-js-2.1.5.tgz",
+ "integrity": "sha512-BNzC5XhCzzCaggJ8s53DP+WeHHGT/NfTsx2wUSSGKR2/ikLFQTBCDzMvGz/PxYMqRko/LwncQtKXGOYp1PkPaw==",
"dependencies": {
"@supabase/node-fetch": "^2.6.14"
}
@@ -528,9 +529,9 @@
}
},
"node_modules/@ai-sdk/openai": {
- "version": "0.0.66",
- "resolved": "https://registry.npmjs.org/@ai-sdk/openai/-/openai-0.0.66.tgz",
- "integrity": "sha512-V4XeDnlNl5/AY3GB3ozJUjqnBLU5pK3DacKTbCNH3zH8/MggJoH6B8wRGdLUPVFMcsMz60mtvh4DC9JsIVFrKw==",
+ "version": "0.0.67",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/openai/-/openai-0.0.67.tgz",
+ "integrity": "sha512-LOvbQaKXuNdhlZ+Asinc4DGdh4v32wKTzFB8FIKvVYjPuXwMWAsK4ZjrS6sxwB37AjmyGLPTMVBUtwcHZdpk+A==",
"dependencies": {
"@ai-sdk/provider": "0.0.24",
"@ai-sdk/provider-utils": "1.0.20"
@@ -3102,9 +3103,9 @@
}
},
"node_modules/@jspm/core": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/@jspm/core/-/core-2.0.1.tgz",
- "integrity": "sha512-Lg3PnLp0QXpxwLIAuuJboLeRaIhrgJjeuh797QADg3xz8wGLugQOS5DpsE8A6i6Adgzf+bacllkKZG3J0tGfDw=="
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/@jspm/core/-/core-2.1.0.tgz",
+ "integrity": "sha512-3sRl+pkyFY/kLmHl0cgHiFp2xEqErA8N3ECjMs7serSUBmoJ70lBa0PG5t0IM6WJgdZNyyI0R8YFfi5wM8+mzg=="
},
"node_modules/@kwsites/file-exists": {
"version": "1.1.1",
@@ -5760,12 +5761,12 @@
"integrity": "sha512-A9+lCBZoaMJlVKcRBz2YByCG+Cp2t6nAnMnNba+XiWxnj6r4JUFqfsgwocMBZU9LPtdxC6wB56ySYpc7LQIoJg=="
},
"node_modules/@react-aria/breadcrumbs": {
- "version": "3.5.17",
- "resolved": "https://registry.npmjs.org/@react-aria/breadcrumbs/-/breadcrumbs-3.5.17.tgz",
- "integrity": "sha512-LJQ+u3TbPmtAWZ3/qC6VfLCzXiwVoB6GmI+HJ2pbjs6H9L8MoiLHsA4mgcz+P0rvx7SCs0Rhvy4JurV6R/R4xw==",
+ "version": "3.5.18",
+ "resolved": "https://registry.npmjs.org/@react-aria/breadcrumbs/-/breadcrumbs-3.5.18.tgz",
+ "integrity": "sha512-JRc6nAwQsjqsPw/3MlGwJcVo9ACZDbCOwWNNEnj8mR0fQopJO5xliq3qVzxDRZjdYrVUfTTyKXuepv/jMB1Y6Q==",
"dependencies": {
"@react-aria/i18n": "^3.12.3",
- "@react-aria/link": "^3.7.5",
+ "@react-aria/link": "^3.7.6",
"@react-aria/utils": "^3.25.3",
"@react-types/breadcrumbs": "^3.7.8",
"@react-types/shared": "^3.25.0",
@@ -5776,12 +5777,12 @@
}
},
"node_modules/@react-aria/button": {
- "version": "3.10.0",
- "resolved": "https://registry.npmjs.org/@react-aria/button/-/button-3.10.0.tgz",
- "integrity": "sha512-mhbn2tEsr991sjG6YMH6oN3ELWb4YvZZ8mnZHMNLa3l8T00PV0ClvQBsUndo6uSvuTHhpFzmMMkJFhYYUwCKlw==",
+ "version": "3.10.1",
+ "resolved": "https://registry.npmjs.org/@react-aria/button/-/button-3.10.1.tgz",
+ "integrity": "sha512-1vkRsjdvJrJleK73u7ClrW4Fw3mtr2hIs8M2yLZUpLoqHXnIYJwmeEMtzwyPFYKBc5jaHcGXw45any7Puy1aFA==",
"dependencies": {
- "@react-aria/focus": "^3.18.3",
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/focus": "^3.18.4",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/utils": "^3.25.3",
"@react-stately/toggle": "^3.7.8",
"@react-types/button": "^3.10.0",
@@ -5793,13 +5794,13 @@
}
},
"node_modules/@react-aria/calendar": {
- "version": "3.5.12",
- "resolved": "https://registry.npmjs.org/@react-aria/calendar/-/calendar-3.5.12.tgz",
- "integrity": "sha512-C8VRjRwEVPaGoCtjOlC0lb3mVSz4ajbal8jfvcbp7LOqCcmOVTUbiM7EPTy60EfZRanFNSp2D1ZstEZDU+cqsg==",
+ "version": "3.5.13",
+ "resolved": "https://registry.npmjs.org/@react-aria/calendar/-/calendar-3.5.13.tgz",
+ "integrity": "sha512-BJV5IwIH4UPDa6/HRTOBcM1wC+/6p823VrbocV9mr+rt5cCnuh+cqcCQKqUSEbfaTMPrmabjBuEaQIvqjLRYUA==",
"dependencies": {
"@internationalized/date": "^3.5.6",
"@react-aria/i18n": "^3.12.3",
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/live-announcer": "^3.4.0",
"@react-aria/utils": "^3.25.3",
"@react-stately/calendar": "^3.5.5",
@@ -5814,14 +5815,14 @@
}
},
"node_modules/@react-aria/checkbox": {
- "version": "3.14.7",
- "resolved": "https://registry.npmjs.org/@react-aria/checkbox/-/checkbox-3.14.7.tgz",
- "integrity": "sha512-aqVxXcr/8P7pQ7R34DlJX2SdBvWtHof9lLTVBY/9tgMplcKIoVBdlVUYPtqWxT3tGan+rruPQHbzTx8zJRFJyg==",
+ "version": "3.14.8",
+ "resolved": "https://registry.npmjs.org/@react-aria/checkbox/-/checkbox-3.14.8.tgz",
+ "integrity": "sha512-0qPJ3fiQQm7tiMHmIhR9iokr/MhhI2h6OWX/pDeIy/Gj63WSVk+Cka3NUhgMRGkguHKDZPKaFjK1oZQsXhCThQ==",
"dependencies": {
- "@react-aria/form": "^3.0.9",
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/form": "^3.0.10",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/label": "^3.7.12",
- "@react-aria/toggle": "^3.10.8",
+ "@react-aria/toggle": "^3.10.9",
"@react-aria/utils": "^3.25.3",
"@react-stately/checkbox": "^3.6.9",
"@react-stately/form": "^3.0.6",
@@ -5835,18 +5836,18 @@
}
},
"node_modules/@react-aria/color": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/@react-aria/color/-/color-3.0.0.tgz",
- "integrity": "sha512-IwHI4e2fUHUOZHRrL2MsxGZFp/RCR2cLjm39gT41jVSuH4zjxueUf96NDm6c7FD0mB5vfk0jo+KJMnShL1a2rg==",
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/@react-aria/color/-/color-3.0.1.tgz",
+ "integrity": "sha512-7hTCdXCU2/qpZuIrJcVr+s87C2MqHfi9Y461gMza5DjdUzlcy480UZ/iknbw82C0a+oVo08D/bnQctEjja05pw==",
"dependencies": {
"@react-aria/i18n": "^3.12.3",
- "@react-aria/interactions": "^3.22.3",
- "@react-aria/numberfield": "^3.11.7",
- "@react-aria/slider": "^3.7.12",
+ "@react-aria/interactions": "^3.22.4",
+ "@react-aria/numberfield": "^3.11.8",
+ "@react-aria/slider": "^3.7.13",
"@react-aria/spinbutton": "^3.6.9",
- "@react-aria/textfield": "^3.14.9",
+ "@react-aria/textfield": "^3.14.10",
"@react-aria/utils": "^3.25.3",
- "@react-aria/visually-hidden": "^3.8.16",
+ "@react-aria/visually-hidden": "^3.8.17",
"@react-stately/color": "^3.8.0",
"@react-stately/form": "^3.0.6",
"@react-types/color": "^3.0.0",
@@ -5859,17 +5860,17 @@
}
},
"node_modules/@react-aria/combobox": {
- "version": "3.10.4",
- "resolved": "https://registry.npmjs.org/@react-aria/combobox/-/combobox-3.10.4.tgz",
- "integrity": "sha512-jzLyRwpwH5SCfQl5giLSwLaw9EKlRiMG39kDZLRB4MQ1MN4sIdIP2TXBbdYcSLtYjduJm2JfRvs2ezI+QI+umA==",
+ "version": "3.10.5",
+ "resolved": "https://registry.npmjs.org/@react-aria/combobox/-/combobox-3.10.5.tgz",
+ "integrity": "sha512-1cjBJXWYuR0de+9IEU1MOer3H5FSlbrdaqlWo+M6vvMymBL2OjjwXiG3LY1mR65ZwHoTswXzt6/mujUKaxk5vw==",
"dependencies": {
"@react-aria/i18n": "^3.12.3",
- "@react-aria/listbox": "^3.13.4",
+ "@react-aria/listbox": "^3.13.5",
"@react-aria/live-announcer": "^3.4.0",
- "@react-aria/menu": "^3.15.4",
- "@react-aria/overlays": "^3.23.3",
- "@react-aria/selection": "^3.20.0",
- "@react-aria/textfield": "^3.14.9",
+ "@react-aria/menu": "^3.15.5",
+ "@react-aria/overlays": "^3.23.4",
+ "@react-aria/selection": "^3.20.1",
+ "@react-aria/textfield": "^3.14.10",
"@react-aria/utils": "^3.25.3",
"@react-stately/collections": "^3.11.0",
"@react-stately/combobox": "^3.10.0",
@@ -5885,17 +5886,17 @@
}
},
"node_modules/@react-aria/datepicker": {
- "version": "3.11.3",
- "resolved": "https://registry.npmjs.org/@react-aria/datepicker/-/datepicker-3.11.3.tgz",
- "integrity": "sha512-HwGxDctFry5ew3Cu7gWpUVodaCg//V6NCihSRjLvnW/TWG+UFLzTafxTqqm8eRbicT3DJlXCLOUPk8Ek0txW6A==",
+ "version": "3.11.4",
+ "resolved": "https://registry.npmjs.org/@react-aria/datepicker/-/datepicker-3.11.4.tgz",
+ "integrity": "sha512-TXe1TB/pSwrIQ5BIDr6NCAYjBaKgLN6cP5DlAihywHzqxbM6vO8GU6qbrZNSBrtfzZnrR/4z66Vlw6rhznLnqQ==",
"dependencies": {
"@internationalized/date": "^3.5.6",
"@internationalized/number": "^3.5.4",
"@internationalized/string": "^3.2.4",
- "@react-aria/focus": "^3.18.3",
- "@react-aria/form": "^3.0.9",
+ "@react-aria/focus": "^3.18.4",
+ "@react-aria/form": "^3.0.10",
"@react-aria/i18n": "^3.12.3",
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/label": "^3.7.12",
"@react-aria/spinbutton": "^3.6.9",
"@react-aria/utils": "^3.25.3",
@@ -5914,12 +5915,12 @@
}
},
"node_modules/@react-aria/dialog": {
- "version": "3.5.18",
- "resolved": "https://registry.npmjs.org/@react-aria/dialog/-/dialog-3.5.18.tgz",
- "integrity": "sha512-j0x0OwDZKyW2GqBZl2Dw/pHl0uSCzhHOg5jNeulkZC8xQa8COuksQf5NFzPmgRPnzqpbgvSzCSs41ymS8spmFg==",
+ "version": "3.5.19",
+ "resolved": "https://registry.npmjs.org/@react-aria/dialog/-/dialog-3.5.19.tgz",
+ "integrity": "sha512-I3AJWpAWCajj8Ama8qLQ18Tc37ODyk+Ym3haYEl5L4QnuFc0dU1sMJr15fppDGIxYjwvTTfctyhaSCz+S+wpkw==",
"dependencies": {
- "@react-aria/focus": "^3.18.3",
- "@react-aria/overlays": "^3.23.3",
+ "@react-aria/focus": "^3.18.4",
+ "@react-aria/overlays": "^3.23.4",
"@react-aria/utils": "^3.25.3",
"@react-types/dialog": "^3.5.13",
"@react-types/shared": "^3.25.0",
@@ -5931,15 +5932,15 @@
}
},
"node_modules/@react-aria/dnd": {
- "version": "3.7.3",
- "resolved": "https://registry.npmjs.org/@react-aria/dnd/-/dnd-3.7.3.tgz",
- "integrity": "sha512-SF7v1AzpXr4CSf98pSzjcSBCaezpP6rsSnSJTz0j2jrYfdQhX0MPA2lyxS+kgU1AEzkK19THQeHuj8hxQc0bVw==",
+ "version": "3.7.4",
+ "resolved": "https://registry.npmjs.org/@react-aria/dnd/-/dnd-3.7.4.tgz",
+ "integrity": "sha512-lRE8SVyK/MPbF6NiVXHoriOV0QulNKkSndyDr3TWPsLhH5GKQso5jSx8/5ogbDgRTzIsmIQldj/HlW238DCiSg==",
"dependencies": {
"@internationalized/string": "^3.2.4",
"@react-aria/i18n": "^3.12.3",
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/live-announcer": "^3.4.0",
- "@react-aria/overlays": "^3.23.3",
+ "@react-aria/overlays": "^3.23.4",
"@react-aria/utils": "^3.25.3",
"@react-stately/dnd": "^3.4.3",
"@react-types/button": "^3.10.0",
@@ -5952,11 +5953,11 @@
}
},
"node_modules/@react-aria/focus": {
- "version": "3.18.3",
- "resolved": "https://registry.npmjs.org/@react-aria/focus/-/focus-3.18.3.tgz",
- "integrity": "sha512-WKUElg+5zS0D3xlVn8MntNnkzJql2J6MuzAMP8Sv5WTgFDse/XGR842dsxPTIyKKdrWVCRegCuwa4m3n/GzgJw==",
+ "version": "3.18.4",
+ "resolved": "https://registry.npmjs.org/@react-aria/focus/-/focus-3.18.4.tgz",
+ "integrity": "sha512-91J35077w9UNaMK1cpMUEFRkNNz0uZjnSwiyBCFuRdaVuivO53wNC9XtWSDNDdcO5cGy87vfJRVAiyoCn/mjqA==",
"dependencies": {
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/utils": "^3.25.3",
"@react-types/shared": "^3.25.0",
"@swc/helpers": "^0.5.0",
@@ -5967,11 +5968,11 @@
}
},
"node_modules/@react-aria/form": {
- "version": "3.0.9",
- "resolved": "https://registry.npmjs.org/@react-aria/form/-/form-3.0.9.tgz",
- "integrity": "sha512-9M6IfC5t47G19c8roHWnkKd275BrECTzyTsc4rzf5OepJfHfG4evST6x+4gGOFYi8soC9XoQdJl4TRh/mft+gw==",
+ "version": "3.0.10",
+ "resolved": "https://registry.npmjs.org/@react-aria/form/-/form-3.0.10.tgz",
+ "integrity": "sha512-hWBrqEXxBxcpYTJv0telQKaiu2728EUFHta8/RGBqJ4+MhKKxI7+PnLoms78IuiK0MCYvukHfun1fuQvK+8jsg==",
"dependencies": {
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/utils": "^3.25.3",
"@react-stately/form": "^3.0.6",
"@react-types/shared": "^3.25.0",
@@ -5982,15 +5983,15 @@
}
},
"node_modules/@react-aria/grid": {
- "version": "3.10.4",
- "resolved": "https://registry.npmjs.org/@react-aria/grid/-/grid-3.10.4.tgz",
- "integrity": "sha512-3AjJ0hwRhOCIHThIZrGWrjAuKDpaZuBkODW3dvgLqtsNm3tL46DI6U9O3vfp8lNbrWMsXJgjRXwvXvdv0/gwCA==",
+ "version": "3.10.5",
+ "resolved": "https://registry.npmjs.org/@react-aria/grid/-/grid-3.10.5.tgz",
+ "integrity": "sha512-9sLa+rpLgRZk7VX+tvdSudn1tdVgolVzhDLGWd95yS4UtPVMihTMGBrRoByY57Wxvh1V+7Ptw8kc6tsRSotYKg==",
"dependencies": {
- "@react-aria/focus": "^3.18.3",
+ "@react-aria/focus": "^3.18.4",
"@react-aria/i18n": "^3.12.3",
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/live-announcer": "^3.4.0",
- "@react-aria/selection": "^3.20.0",
+ "@react-aria/selection": "^3.20.1",
"@react-aria/utils": "^3.25.3",
"@react-stately/collections": "^3.11.0",
"@react-stately/grid": "^3.9.3",
@@ -6006,15 +6007,15 @@
}
},
"node_modules/@react-aria/gridlist": {
- "version": "3.9.4",
- "resolved": "https://registry.npmjs.org/@react-aria/gridlist/-/gridlist-3.9.4.tgz",
- "integrity": "sha512-gGzS4ToSynn2KBycf9UCsWIJIbVl4RjoCjPF4NnukwzHmrXwbtZnlF0xsORQ5QxfqHH9UehTAHWFvOOHJSZZ2w==",
+ "version": "3.9.5",
+ "resolved": "https://registry.npmjs.org/@react-aria/gridlist/-/gridlist-3.9.5.tgz",
+ "integrity": "sha512-LM+3D0amZZ1qiyqWVG52j0YRWt2chdpx+WG80ryDKwHLDIq7uz1+KXyIfv8cFt/cZcl6+9Ft3kWALCAi6O4NLA==",
"dependencies": {
- "@react-aria/focus": "^3.18.3",
- "@react-aria/grid": "^3.10.4",
+ "@react-aria/focus": "^3.18.4",
+ "@react-aria/grid": "^3.10.5",
"@react-aria/i18n": "^3.12.3",
- "@react-aria/interactions": "^3.22.3",
- "@react-aria/selection": "^3.20.0",
+ "@react-aria/interactions": "^3.22.4",
+ "@react-aria/selection": "^3.20.1",
"@react-aria/utils": "^3.25.3",
"@react-stately/collections": "^3.11.0",
"@react-stately/list": "^3.11.0",
@@ -6046,9 +6047,9 @@
}
},
"node_modules/@react-aria/interactions": {
- "version": "3.22.3",
- "resolved": "https://registry.npmjs.org/@react-aria/interactions/-/interactions-3.22.3.tgz",
- "integrity": "sha512-RRUb/aG+P0IKTIWikY/SylB6bIbLZeztnZY2vbe7RAG5MgVaCgn5HQ45SI15GlTmhsFG8CnF6slJsUFJiNHpbQ==",
+ "version": "3.22.4",
+ "resolved": "https://registry.npmjs.org/@react-aria/interactions/-/interactions-3.22.4.tgz",
+ "integrity": "sha512-E0vsgtpItmknq/MJELqYJwib+YN18Qag8nroqwjk1qOnBa9ROIkUhWJerLi1qs5diXq9LHKehZDXRlwPvdEFww==",
"dependencies": {
"@react-aria/ssr": "^3.9.6",
"@react-aria/utils": "^3.25.3",
@@ -6073,12 +6074,12 @@
}
},
"node_modules/@react-aria/link": {
- "version": "3.7.5",
- "resolved": "https://registry.npmjs.org/@react-aria/link/-/link-3.7.5.tgz",
- "integrity": "sha512-j0F1BIdNoE7Tl+0KzzjbrmYuxt4aWAmDZDHvJKiYg71Jb1BAPz71eE1O1ybMoO04+OG/6HrRZTragfSQLAJ58A==",
+ "version": "3.7.6",
+ "resolved": "https://registry.npmjs.org/@react-aria/link/-/link-3.7.6.tgz",
+ "integrity": "sha512-8buJznRWoOud8ApygUAz7TsshXNs6HDGB6YOYEJxy0WTKILn0U5NUymw2PWC14+bWRPelHMKmi6vbFBrJWzSzQ==",
"dependencies": {
- "@react-aria/focus": "^3.18.3",
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/focus": "^3.18.4",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/utils": "^3.25.3",
"@react-types/link": "^3.5.8",
"@react-types/shared": "^3.25.0",
@@ -6089,13 +6090,13 @@
}
},
"node_modules/@react-aria/listbox": {
- "version": "3.13.4",
- "resolved": "https://registry.npmjs.org/@react-aria/listbox/-/listbox-3.13.4.tgz",
- "integrity": "sha512-2aG4jzlB+srYBeM9ap/BNZe0E04yMjY2dPGXcigkaSJt6/yYAHCygXuouf2MzvBfkdV4QWyHIIgWZmAXXl6reg==",
+ "version": "3.13.5",
+ "resolved": "https://registry.npmjs.org/@react-aria/listbox/-/listbox-3.13.5.tgz",
+ "integrity": "sha512-tn32L/PIELIPYfDWCJ3OBRvvb/jCEvIzs6IYs8xCISV5W4853Je/WnA8wumWnz07U9sODYFmHUx2ThO7Z7dH7Q==",
"dependencies": {
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/label": "^3.7.12",
- "@react-aria/selection": "^3.20.0",
+ "@react-aria/selection": "^3.20.1",
"@react-aria/utils": "^3.25.3",
"@react-stately/collections": "^3.11.0",
"@react-stately/list": "^3.11.0",
@@ -6117,15 +6118,15 @@
}
},
"node_modules/@react-aria/menu": {
- "version": "3.15.4",
- "resolved": "https://registry.npmjs.org/@react-aria/menu/-/menu-3.15.4.tgz",
- "integrity": "sha512-4wfq8Lb7AltgSzBHdtypiPOnsRm8hHv7PUuHhlq/VT9yAkEFk4Flc7vKVF6VSFqrnCfyCf66B5aeapjNInAONg==",
+ "version": "3.15.5",
+ "resolved": "https://registry.npmjs.org/@react-aria/menu/-/menu-3.15.5.tgz",
+ "integrity": "sha512-ygfS032hJSZCYYbMHnUSmUTVMaz99L9AUZ9kMa6g+k2X1t92K1gXfhYYkoClQD6+G0ch7zm0SwYFlUmRf9yOEA==",
"dependencies": {
- "@react-aria/focus": "^3.18.3",
+ "@react-aria/focus": "^3.18.4",
"@react-aria/i18n": "^3.12.3",
- "@react-aria/interactions": "^3.22.3",
- "@react-aria/overlays": "^3.23.3",
- "@react-aria/selection": "^3.20.0",
+ "@react-aria/interactions": "^3.22.4",
+ "@react-aria/overlays": "^3.23.4",
+ "@react-aria/selection": "^3.20.1",
"@react-aria/utils": "^3.25.3",
"@react-stately/collections": "^3.11.0",
"@react-stately/menu": "^3.8.3",
@@ -6155,14 +6156,14 @@
}
},
"node_modules/@react-aria/numberfield": {
- "version": "3.11.7",
- "resolved": "https://registry.npmjs.org/@react-aria/numberfield/-/numberfield-3.11.7.tgz",
- "integrity": "sha512-9bqg4sKqc5XLppHzJFRhgtkoeMu0N6Zg0AuVSiE/3CxE5Ad+y8tKpFEx9zh4o5BItyOWy18w5ZXnKjJGjd7waQ==",
+ "version": "3.11.8",
+ "resolved": "https://registry.npmjs.org/@react-aria/numberfield/-/numberfield-3.11.8.tgz",
+ "integrity": "sha512-CWRHbrjfpvEqBmtjwX8LjVds6+tMNneRlKF46ked5sZilfU2jIirufaucM36N4vX6N/W7nFR/rCbp2WCOU9p3Q==",
"dependencies": {
"@react-aria/i18n": "^3.12.3",
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/spinbutton": "^3.6.9",
- "@react-aria/textfield": "^3.14.9",
+ "@react-aria/textfield": "^3.14.10",
"@react-aria/utils": "^3.25.3",
"@react-stately/form": "^3.0.6",
"@react-stately/numberfield": "^3.9.7",
@@ -6177,16 +6178,16 @@
}
},
"node_modules/@react-aria/overlays": {
- "version": "3.23.3",
- "resolved": "https://registry.npmjs.org/@react-aria/overlays/-/overlays-3.23.3.tgz",
- "integrity": "sha512-vRW4DL466a27BBIP6dQqmmei4nX/nsur6DyF0Hmd46ygwOdvdA+5MwvXZUz9yUamB79UeS9BMQZuBVwhjoMwBQ==",
+ "version": "3.23.4",
+ "resolved": "https://registry.npmjs.org/@react-aria/overlays/-/overlays-3.23.4.tgz",
+ "integrity": "sha512-MZUW6SUlTWOwKuFTqUTxW5BnvdW3Y9cEwanWuz98NX3ST7JYe/3ZcZhb37/fGW4uoGHnQ9icEwVf0rbMrK2STg==",
"dependencies": {
- "@react-aria/focus": "^3.18.3",
+ "@react-aria/focus": "^3.18.4",
"@react-aria/i18n": "^3.12.3",
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/ssr": "^3.9.6",
"@react-aria/utils": "^3.25.3",
- "@react-aria/visually-hidden": "^3.8.16",
+ "@react-aria/visually-hidden": "^3.8.17",
"@react-stately/overlays": "^3.6.11",
"@react-types/button": "^3.10.0",
"@react-types/overlays": "^3.8.10",
@@ -6215,14 +6216,14 @@
}
},
"node_modules/@react-aria/radio": {
- "version": "3.10.8",
- "resolved": "https://registry.npmjs.org/@react-aria/radio/-/radio-3.10.8.tgz",
- "integrity": "sha512-/vKQhKqpoCB/VqHuc46OOU+31HFtg6svcYzHBbz0wN/DSVCygYeTfB/36kY7x2GWWkT0pCsB4OcHJ+/0G3EfkQ==",
+ "version": "3.10.9",
+ "resolved": "https://registry.npmjs.org/@react-aria/radio/-/radio-3.10.9.tgz",
+ "integrity": "sha512-XnU7zGTEku1mPvJweX4I3ifwEBtglEWYoO4CZGvA3eXj39X8iGwNZXUst1pdk2ykWUKbtwrmsWA6zG2OAGODYw==",
"dependencies": {
- "@react-aria/focus": "^3.18.3",
- "@react-aria/form": "^3.0.9",
+ "@react-aria/focus": "^3.18.4",
+ "@react-aria/form": "^3.0.10",
"@react-aria/i18n": "^3.12.3",
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/label": "^3.7.12",
"@react-aria/utils": "^3.25.3",
"@react-stately/radio": "^3.10.8",
@@ -6235,12 +6236,12 @@
}
},
"node_modules/@react-aria/searchfield": {
- "version": "3.7.9",
- "resolved": "https://registry.npmjs.org/@react-aria/searchfield/-/searchfield-3.7.9.tgz",
- "integrity": "sha512-EHODG7HDFthwG5tx4fh+WP2hjNOp/rPAqdNScKBAN73nEf0F/qQpIwmdZF0EycCOzGSM5hhihjm0yMtTFYuzOQ==",
+ "version": "3.7.10",
+ "resolved": "https://registry.npmjs.org/@react-aria/searchfield/-/searchfield-3.7.10.tgz",
+ "integrity": "sha512-1XTYh2dycedaK1tgpHAHcu8PTK1wG3dv53yLziu07JsBe9tX6O8jIFBhZK8SpfNnP8pEOI3PIlVEjaarLwgWzQ==",
"dependencies": {
"@react-aria/i18n": "^3.12.3",
- "@react-aria/textfield": "^3.14.9",
+ "@react-aria/textfield": "^3.14.10",
"@react-aria/utils": "^3.25.3",
"@react-stately/searchfield": "^3.5.7",
"@react-types/button": "^3.10.0",
@@ -6253,19 +6254,19 @@
}
},
"node_modules/@react-aria/select": {
- "version": "3.14.10",
- "resolved": "https://registry.npmjs.org/@react-aria/select/-/select-3.14.10.tgz",
- "integrity": "sha512-xHkAJqvfKgnH5mVYwZj3ME7/Q3wUzgUZDK/iVuXUs3cAYap8ybM2d/2zOGcqv1keZHBUzwp9QtaN//FYK13jIA==",
+ "version": "3.14.11",
+ "resolved": "https://registry.npmjs.org/@react-aria/select/-/select-3.14.11.tgz",
+ "integrity": "sha512-rX5U4JcPNV41lNEF1tAxNxqrGENnLGZL/D5Y+YNpqKSU5U09+hD3ovsflNkF/d+deb25zg45JRxumwOCQ+rfyw==",
"dependencies": {
- "@react-aria/form": "^3.0.9",
+ "@react-aria/form": "^3.0.10",
"@react-aria/i18n": "^3.12.3",
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/label": "^3.7.12",
- "@react-aria/listbox": "^3.13.4",
- "@react-aria/menu": "^3.15.4",
- "@react-aria/selection": "^3.20.0",
+ "@react-aria/listbox": "^3.13.5",
+ "@react-aria/menu": "^3.15.5",
+ "@react-aria/selection": "^3.20.1",
"@react-aria/utils": "^3.25.3",
- "@react-aria/visually-hidden": "^3.8.16",
+ "@react-aria/visually-hidden": "^3.8.17",
"@react-stately/select": "^3.6.8",
"@react-types/button": "^3.10.0",
"@react-types/select": "^3.9.7",
@@ -6278,13 +6279,13 @@
}
},
"node_modules/@react-aria/selection": {
- "version": "3.20.0",
- "resolved": "https://registry.npmjs.org/@react-aria/selection/-/selection-3.20.0.tgz",
- "integrity": "sha512-h3giMcXo4SMZRL5HrqZvOLNTsdh5jCXwLUx0wpj/2EF0tcYQL6WDfn1iJ+rHARkUIs7X70fUV8iwlbUySZy1xg==",
+ "version": "3.20.1",
+ "resolved": "https://registry.npmjs.org/@react-aria/selection/-/selection-3.20.1.tgz",
+ "integrity": "sha512-My0w8UC/7PAkz/1yZUjr2VRuzDZz1RrbgTqP36j5hsJx8RczDTjI4TmKtQNKG0ggaP4w83G2Og5JPTq3w3LMAw==",
"dependencies": {
- "@react-aria/focus": "^3.18.3",
+ "@react-aria/focus": "^3.18.4",
"@react-aria/i18n": "^3.12.3",
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/utils": "^3.25.3",
"@react-stately/selection": "^3.17.0",
"@react-types/shared": "^3.25.0",
@@ -6309,13 +6310,13 @@
}
},
"node_modules/@react-aria/slider": {
- "version": "3.7.12",
- "resolved": "https://registry.npmjs.org/@react-aria/slider/-/slider-3.7.12.tgz",
- "integrity": "sha512-yZWBGxDHBL5Gjjdnz+igdO7VfYND9iZsSqynadZthWtfy1jA+qBR25I+Soc0D9gkr/2/JUJkFgkllYF1RzWMUQ==",
+ "version": "3.7.13",
+ "resolved": "https://registry.npmjs.org/@react-aria/slider/-/slider-3.7.13.tgz",
+ "integrity": "sha512-yGlIpoOUKUoP0M3iI8ZHU001NASBOeZJSIQNfoS7HiqSR3bz+6BX7DRAM6B+CPHJleUtrdQ6JjO/8V8ZUV2kNQ==",
"dependencies": {
- "@react-aria/focus": "^3.18.3",
+ "@react-aria/focus": "^3.18.4",
"@react-aria/i18n": "^3.12.3",
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/label": "^3.7.12",
"@react-aria/utils": "^3.25.3",
"@react-stately/slider": "^3.5.8",
@@ -6359,11 +6360,11 @@
}
},
"node_modules/@react-aria/switch": {
- "version": "3.6.8",
- "resolved": "https://registry.npmjs.org/@react-aria/switch/-/switch-3.6.8.tgz",
- "integrity": "sha512-6Q0w7o+liB0ztKPL9UaRfX+hPPuy71AL3SuVCMK7RKfPqZwcmlwUDp2gr3j5fvs8gLev0r42XtEBqmGwkHTkEw==",
+ "version": "3.6.9",
+ "resolved": "https://registry.npmjs.org/@react-aria/switch/-/switch-3.6.9.tgz",
+ "integrity": "sha512-w7xIywpR6llm22DXYOObZ2Uqvsw+gNmxdJ86h8+YRtpSkFnPMhXtTMv3RXpEGYhPTt/YDIqfxiluF1E2IHGwIA==",
"dependencies": {
- "@react-aria/toggle": "^3.10.8",
+ "@react-aria/toggle": "^3.10.9",
"@react-stately/toggle": "^3.7.8",
"@react-types/shared": "^3.25.0",
"@react-types/switch": "^3.5.6",
@@ -6374,17 +6375,17 @@
}
},
"node_modules/@react-aria/table": {
- "version": "3.15.4",
- "resolved": "https://registry.npmjs.org/@react-aria/table/-/table-3.15.4.tgz",
- "integrity": "sha512-t4+vtUF63i6OrXmZ0AA/RmWyIt8cieUm7cSXhQMooAgUjkvVqTNkQQRsntVOb+UNI5KmiGSe4jB3H4GVXz2X9w==",
+ "version": "3.15.5",
+ "resolved": "https://registry.npmjs.org/@react-aria/table/-/table-3.15.5.tgz",
+ "integrity": "sha512-bdNZF0ZoNOfyOEIK/ctv0llacaCNk8mv+GGy8mwh5bZeJjd8KuDIpYQtZJYvf2YVvPYRWyXRhF0/B229m65f/g==",
"dependencies": {
- "@react-aria/focus": "^3.18.3",
- "@react-aria/grid": "^3.10.4",
+ "@react-aria/focus": "^3.18.4",
+ "@react-aria/grid": "^3.10.5",
"@react-aria/i18n": "^3.12.3",
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/live-announcer": "^3.4.0",
"@react-aria/utils": "^3.25.3",
- "@react-aria/visually-hidden": "^3.8.16",
+ "@react-aria/visually-hidden": "^3.8.17",
"@react-stately/collections": "^3.11.0",
"@react-stately/flags": "^3.0.4",
"@react-stately/table": "^3.12.3",
@@ -6400,13 +6401,13 @@
}
},
"node_modules/@react-aria/tabs": {
- "version": "3.9.6",
- "resolved": "https://registry.npmjs.org/@react-aria/tabs/-/tabs-3.9.6.tgz",
- "integrity": "sha512-iPQ2Im+srnSB06xIdVNHZZDJnZmUR0IG0MZAp6FXmbkCeLAd9tZQHgSFYwswBfgAStNnyFQHP5aSBJOJMRCACg==",
+ "version": "3.9.7",
+ "resolved": "https://registry.npmjs.org/@react-aria/tabs/-/tabs-3.9.7.tgz",
+ "integrity": "sha512-f78P2Y9ZCYtwOnteku9mPVIk21xSSREYWaQPtA9ebSgVbeR5ya6RpaX9ISc9cd0HEF3Av+hZYyS1pNXXWymv9g==",
"dependencies": {
- "@react-aria/focus": "^3.18.3",
+ "@react-aria/focus": "^3.18.4",
"@react-aria/i18n": "^3.12.3",
- "@react-aria/selection": "^3.20.0",
+ "@react-aria/selection": "^3.20.1",
"@react-aria/utils": "^3.25.3",
"@react-stately/tabs": "^3.6.10",
"@react-types/shared": "^3.25.0",
@@ -6419,15 +6420,15 @@
}
},
"node_modules/@react-aria/tag": {
- "version": "3.4.6",
- "resolved": "https://registry.npmjs.org/@react-aria/tag/-/tag-3.4.6.tgz",
- "integrity": "sha512-Uf1sPabwJx99diyXJTaVguiYozS49opjQxmK1PPbb87ipNN1YlSDVbP05IelVMbnbxXHudsRmzPOBmmblcj1GQ==",
+ "version": "3.4.7",
+ "resolved": "https://registry.npmjs.org/@react-aria/tag/-/tag-3.4.7.tgz",
+ "integrity": "sha512-hreVvphUeYUfMN6gjM3+WouN2P/WGuR0rGpOrFk2HEnGDPg3Ar0isfdAaciTSBOc26CDKNgrmzRguxCmKKuqgw==",
"dependencies": {
- "@react-aria/gridlist": "^3.9.4",
+ "@react-aria/gridlist": "^3.9.5",
"@react-aria/i18n": "^3.12.3",
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/label": "^3.7.12",
- "@react-aria/selection": "^3.20.0",
+ "@react-aria/selection": "^3.20.1",
"@react-aria/utils": "^3.25.3",
"@react-stately/list": "^3.11.0",
"@react-types/button": "^3.10.0",
@@ -6440,12 +6441,12 @@
}
},
"node_modules/@react-aria/textfield": {
- "version": "3.14.9",
- "resolved": "https://registry.npmjs.org/@react-aria/textfield/-/textfield-3.14.9.tgz",
- "integrity": "sha512-LPwZhthDVLyvnzXWco4eyYCD2pFmQ4Vw9ha9tb3QkZUIP6j8E52y76j0c59Nq7XYus3IHatVe7yYQk7kbo8Zrg==",
+ "version": "3.14.10",
+ "resolved": "https://registry.npmjs.org/@react-aria/textfield/-/textfield-3.14.10.tgz",
+ "integrity": "sha512-vG44FgxwfJUF2S6tRG+Sg646DDEgs0CO9RYniafEOHz8rwcNIH3lML7n8LAfzQa+BjBY28+UF0wmqEvd6VCzCQ==",
"dependencies": {
- "@react-aria/focus": "^3.18.3",
- "@react-aria/form": "^3.0.9",
+ "@react-aria/focus": "^3.18.4",
+ "@react-aria/form": "^3.0.10",
"@react-aria/label": "^3.7.12",
"@react-aria/utils": "^3.25.3",
"@react-stately/form": "^3.0.6",
@@ -6459,12 +6460,12 @@
}
},
"node_modules/@react-aria/toggle": {
- "version": "3.10.8",
- "resolved": "https://registry.npmjs.org/@react-aria/toggle/-/toggle-3.10.8.tgz",
- "integrity": "sha512-N6WTgE8ByMYY+ZygUUPGON2vW5NrxwU91H98+Nozl+Rq6ZYR2fD9i8oRtLtrYPxjU2HmaFwDyQdWvmMJZuDxig==",
+ "version": "3.10.9",
+ "resolved": "https://registry.npmjs.org/@react-aria/toggle/-/toggle-3.10.9.tgz",
+ "integrity": "sha512-dtfnyIU2/kcH9rFAiB48diSmaXDv45K7UCuTkMQLjbQa3QHC1oYNbleVN/VdGyAMBsIWtfl8L4uuPrAQmDV/bg==",
"dependencies": {
- "@react-aria/focus": "^3.18.3",
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/focus": "^3.18.4",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/utils": "^3.25.3",
"@react-stately/toggle": "^3.7.8",
"@react-types/checkbox": "^3.8.4",
@@ -6491,12 +6492,12 @@
}
},
"node_modules/@react-aria/tooltip": {
- "version": "3.7.8",
- "resolved": "https://registry.npmjs.org/@react-aria/tooltip/-/tooltip-3.7.8.tgz",
- "integrity": "sha512-dlWfS3w8E6dw5Xoist4cVX2GQE5oh3VQr88dRyLto7BAPLFrp3I+8c9mZCVUobLS/f5QcQzLkqw750s4ENCyiw==",
+ "version": "3.7.9",
+ "resolved": "https://registry.npmjs.org/@react-aria/tooltip/-/tooltip-3.7.9.tgz",
+ "integrity": "sha512-TqVJ7YqaP/enxNyA1QGr43w4nBZmOs6Hb/pROMS5afbX7gHgMVFn0lTRc6DC2cvcfgYc4WICs2QiQMniZt/E7A==",
"dependencies": {
- "@react-aria/focus": "^3.18.3",
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/focus": "^3.18.4",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/utils": "^3.25.3",
"@react-stately/tooltip": "^3.4.13",
"@react-types/shared": "^3.25.0",
@@ -6523,11 +6524,11 @@
}
},
"node_modules/@react-aria/visually-hidden": {
- "version": "3.8.16",
- "resolved": "https://registry.npmjs.org/@react-aria/visually-hidden/-/visually-hidden-3.8.16.tgz",
- "integrity": "sha512-3zThVIzEprez4A/GajOut6/JQ4WCu2ROHGZ1xH1+2GFjBJQaTfPBIjg6UIwaT7sgHRQIik8QidogLqXHbp81yA==",
+ "version": "3.8.17",
+ "resolved": "https://registry.npmjs.org/@react-aria/visually-hidden/-/visually-hidden-3.8.17.tgz",
+ "integrity": "sha512-WFgny1q2CbxxU6gu46TGQXf1DjsnuSk+RBDP4M7bm1mUVZzoCp7U7AtjNmsBrWg0NejxUdgD7+7jkHHCQ91qRA==",
"dependencies": {
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/utils": "^3.25.3",
"@react-types/shared": "^3.25.0",
"@swc/helpers": "^0.5.0"
@@ -8395,6 +8396,14 @@
"@supabase/node-fetch": "^2.6.14"
}
},
+ "node_modules/@supabase/gotrue-js": {
+ "version": "2.62.2",
+ "resolved": "https://registry.npmjs.org/@supabase/gotrue-js/-/gotrue-js-2.62.2.tgz",
+ "integrity": "sha512-AP6e6W9rQXFTEJ7sTTNYQrNf0LCcnt1hUW+RIgUK+Uh3jbWvcIST7wAlYyNZiMlS9+PYyymWQ+Ykz/rOYSO0+A==",
+ "dependencies": {
+ "@supabase/node-fetch": "^2.6.14"
+ }
+ },
"node_modules/@supabase/node-fetch": {
"version": "2.6.15",
"resolved": "https://registry.npmjs.org/@supabase/node-fetch/-/node-fetch-2.6.15.tgz",
@@ -14809,9 +14818,9 @@
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
},
"node_modules/electron-to-chromium": {
- "version": "1.5.36",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.36.tgz",
- "integrity": "sha512-HYTX8tKge/VNp6FGO+f/uVDmUkq+cEfcxYhKf15Akc4M5yxt5YmorwlAitKWjWhWQnKcDRBAQKXkhqqXMqcrjw=="
+ "version": "1.5.38",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.38.tgz",
+ "integrity": "sha512-VbeVexmZ1IFh+5EfrYz1I0HTzHVIlJa112UEWhciPyeOcKJGeTv6N8WnG4wsQB81DGCaVEGhpSb6o6a8WYFXXg=="
},
"node_modules/emittery": {
"version": "0.7.2",
@@ -16970,9 +16979,9 @@
}
},
"node_modules/framer-motion": {
- "version": "11.11.8",
- "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-11.11.8.tgz",
- "integrity": "sha512-mnGQNEoz99GtFXBBPw+Ag5K4FcfP5XrXxrxHz+iE4Lmg7W3sf2gKmGuvfkZCW/yIfcdv5vJd6KiSPETH1Pw68Q==",
+ "version": "11.11.9",
+ "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-11.11.9.tgz",
+ "integrity": "sha512-XpdZseuCrZehdHGuW22zZt3SF5g6AHJHJi7JwQIigOznW4Jg1n0oGPMJQheMaKLC+0rp5gxUKMRYI6ytd3q4RQ==",
"dependencies": {
"tslib": "^2.4.0"
},
@@ -20297,9 +20306,9 @@
}
},
"node_modules/jotai": {
- "version": "2.10.0",
- "resolved": "https://registry.npmjs.org/jotai/-/jotai-2.10.0.tgz",
- "integrity": "sha512-8W4u0aRlOIwGlLQ0sqfl/c6+eExl5D8lZgAUolirZLktyaj4WnxO/8a0HEPmtriQAB6X5LMhXzZVmw02X0P0qQ==",
+ "version": "2.10.1",
+ "resolved": "https://registry.npmjs.org/jotai/-/jotai-2.10.1.tgz",
+ "integrity": "sha512-4FycO+BOTl2auLyF2Chvi6KTDqdsdDDtpaL/WHQMs8f3KS1E3loiUShQzAzFA/sMU5cJ0hz/RT1xum9YbG/zaA==",
"engines": {
"node": ">=12.20.0"
},
@@ -24857,9 +24866,9 @@
"integrity": "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA=="
},
"node_modules/papaparse": {
- "version": "5.4.1",
- "resolved": "https://registry.npmjs.org/papaparse/-/papaparse-5.4.1.tgz",
- "integrity": "sha512-HipMsgJkZu8br23pW15uvo6sib6wne/4woLZPlFf3rpDyMe9ywEXUsuD7+6K9PRkJlVT51j/sCOYDKGGS3ZJrw=="
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/papaparse/-/papaparse-5.3.2.tgz",
+ "integrity": "sha512-6dNZu0Ki+gyV0eBsFKJhYr+MdQYAzFUGlBMNj3GNrmHxmz1lfRa24CjFObPXtjcetlOv5Ad299MhIK0znp3afw=="
},
"node_modules/parent-module": {
"version": "1.0.1",
@@ -25547,9 +25556,9 @@
}
},
"node_modules/posthog-js": {
- "version": "1.167.0",
- "resolved": "https://registry.npmjs.org/posthog-js/-/posthog-js-1.167.0.tgz",
- "integrity": "sha512-/zXQ6tuJgiF1d4mgg3UsAi/uoyg7UnfFNQtikuALmaE53xFExpcAKbMfHPG/f54QgTvLxSHyGL1kFl/1uspkGg==",
+ "version": "1.169.0",
+ "resolved": "https://registry.npmjs.org/posthog-js/-/posthog-js-1.169.0.tgz",
+ "integrity": "sha512-C0TiNv6ehbiy78F9gKZIqy3RbCRsWDSQDbQMi1YW2iuO4kDQUQwacmx2DKyaCwsH0/oN69FdBl99WoEJdjmxXg==",
"dependencies": {
"fflate": "^0.4.8",
"preact": "^10.19.3",
@@ -25579,9 +25588,9 @@
}
},
"node_modules/preact": {
- "version": "10.24.2",
- "resolved": "https://registry.npmjs.org/preact/-/preact-10.24.2.tgz",
- "integrity": "sha512-1cSoF0aCC8uaARATfrlz4VCBqE8LwZwRfLgkxJOQwAlQt6ayTmi0D9OF7nXid1POI5SZidFuG9CnlXbDfLqY/Q==",
+ "version": "10.24.3",
+ "resolved": "https://registry.npmjs.org/preact/-/preact-10.24.3.tgz",
+ "integrity": "sha512-Z2dPnBnMUfyQfSQ+GBdsGa16hz35YmLmtTLhM169uW944hYL6xzTYkJjC07j+Wosz733pMWx0fgON3JNw1jJQA==",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/preact"
@@ -26262,47 +26271,47 @@
}
},
"node_modules/react-aria": {
- "version": "3.35.0",
- "resolved": "https://registry.npmjs.org/react-aria/-/react-aria-3.35.0.tgz",
- "integrity": "sha512-cbbd3iIveLDRnpVrpc1iuz8OMlDdH6u8EjncW3MQuYOiEGaho9xcDtWMKiSEIZASEnd7LK4Rgm5iVPr2O+cssw==",
+ "version": "3.35.1",
+ "resolved": "https://registry.npmjs.org/react-aria/-/react-aria-3.35.1.tgz",
+ "integrity": "sha512-MQTvt0xbcKpnceKkYUtPMbaD9IQj2BXTrwk2vP/V7ph3EVhcyJTUdy1LXCqf8oR8bXE2BERUqp7rzJ+vYy5C+w==",
"dependencies": {
"@internationalized/string": "^3.2.4",
- "@react-aria/breadcrumbs": "^3.5.17",
- "@react-aria/button": "^3.10.0",
- "@react-aria/calendar": "^3.5.12",
- "@react-aria/checkbox": "^3.14.7",
- "@react-aria/color": "^3.0.0",
- "@react-aria/combobox": "^3.10.4",
- "@react-aria/datepicker": "^3.11.3",
- "@react-aria/dialog": "^3.5.18",
- "@react-aria/dnd": "^3.7.3",
- "@react-aria/focus": "^3.18.3",
- "@react-aria/gridlist": "^3.9.4",
+ "@react-aria/breadcrumbs": "^3.5.18",
+ "@react-aria/button": "^3.10.1",
+ "@react-aria/calendar": "^3.5.13",
+ "@react-aria/checkbox": "^3.14.8",
+ "@react-aria/color": "^3.0.1",
+ "@react-aria/combobox": "^3.10.5",
+ "@react-aria/datepicker": "^3.11.4",
+ "@react-aria/dialog": "^3.5.19",
+ "@react-aria/dnd": "^3.7.4",
+ "@react-aria/focus": "^3.18.4",
+ "@react-aria/gridlist": "^3.9.5",
"@react-aria/i18n": "^3.12.3",
- "@react-aria/interactions": "^3.22.3",
+ "@react-aria/interactions": "^3.22.4",
"@react-aria/label": "^3.7.12",
- "@react-aria/link": "^3.7.5",
- "@react-aria/listbox": "^3.13.4",
- "@react-aria/menu": "^3.15.4",
+ "@react-aria/link": "^3.7.6",
+ "@react-aria/listbox": "^3.13.5",
+ "@react-aria/menu": "^3.15.5",
"@react-aria/meter": "^3.4.17",
- "@react-aria/numberfield": "^3.11.7",
- "@react-aria/overlays": "^3.23.3",
+ "@react-aria/numberfield": "^3.11.8",
+ "@react-aria/overlays": "^3.23.4",
"@react-aria/progress": "^3.4.17",
- "@react-aria/radio": "^3.10.8",
- "@react-aria/searchfield": "^3.7.9",
- "@react-aria/select": "^3.14.10",
- "@react-aria/selection": "^3.20.0",
+ "@react-aria/radio": "^3.10.9",
+ "@react-aria/searchfield": "^3.7.10",
+ "@react-aria/select": "^3.14.11",
+ "@react-aria/selection": "^3.20.1",
"@react-aria/separator": "^3.4.3",
- "@react-aria/slider": "^3.7.12",
+ "@react-aria/slider": "^3.7.13",
"@react-aria/ssr": "^3.9.6",
- "@react-aria/switch": "^3.6.8",
- "@react-aria/table": "^3.15.4",
- "@react-aria/tabs": "^3.9.6",
- "@react-aria/tag": "^3.4.6",
- "@react-aria/textfield": "^3.14.9",
- "@react-aria/tooltip": "^3.7.8",
+ "@react-aria/switch": "^3.6.9",
+ "@react-aria/table": "^3.15.5",
+ "@react-aria/tabs": "^3.9.7",
+ "@react-aria/tag": "^3.4.7",
+ "@react-aria/textfield": "^3.14.10",
+ "@react-aria/tooltip": "^3.7.9",
"@react-aria/utils": "^3.25.3",
- "@react-aria/visually-hidden": "^3.8.16",
+ "@react-aria/visually-hidden": "^3.8.17",
"@react-types/shared": "^3.25.0"
},
"peerDependencies": {
@@ -26535,9 +26544,9 @@
}
},
"node_modules/react-pdf-tailwind/node_modules/tailwindcss": {
- "version": "3.4.13",
- "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.13.tgz",
- "integrity": "sha512-KqjHOJKogOUt5Bs752ykCeiwvi0fKVkr5oqsFNt/8px/tA8scFPIlkygsf6jXrfCqGHz7VflA6+yytWuM+XhFw==",
+ "version": "3.4.14",
+ "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.14.tgz",
+ "integrity": "sha512-IcSvOcTRcUtQQ7ILQL5quRDg7Xs93PdJEk1ZLbhhvJc7uj/OAhYOnruEiwnGgBvUtaUAJ8/mhSw1o8L2jCiENA==",
"dependencies": {
"@alloc/quick-lru": "^5.2.0",
"arg": "^5.0.2",
@@ -29135,12 +29144,16 @@
}
},
"node_modules/string.prototype.includes": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/string.prototype.includes/-/string.prototype.includes-2.0.0.tgz",
- "integrity": "sha512-E34CkBgyeqNDcrbU76cDjL5JLcVrtSdYq0MEh/B10r17pRP4ciHLwTgnuLV8Ay6cgEMLkcBkFCKyFZ43YldYzg==",
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/string.prototype.includes/-/string.prototype.includes-2.0.1.tgz",
+ "integrity": "sha512-o7+c9bW6zpAdJHTtujeePODAhkuicdAryFsfVKwA+wGw89wJ4GTY484WTucM9hLtDEOpOvI+aHnzqnC5lHp4Rg==",
"dependencies": {
- "define-properties": "^1.1.3",
- "es-abstract": "^1.17.5"
+ "call-bind": "^1.0.7",
+ "define-properties": "^1.2.1",
+ "es-abstract": "^1.23.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
}
},
"node_modules/string.prototype.matchall": {
@@ -29558,9 +29571,9 @@
"dev": true
},
"node_modules/tailwind-merge": {
- "version": "2.5.3",
- "resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-2.5.3.tgz",
- "integrity": "sha512-d9ZolCAIzom1nf/5p4LdD5zvjmgSxY0BGgdSvmXIoMYAiPdAW/dSpP7joCDYFY7r/HkEa2qmPtkgsu0xjQeQtw==",
+ "version": "2.5.4",
+ "resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-2.5.4.tgz",
+ "integrity": "sha512-0q8cfZHMu9nuYP/b5Shb7Y7Sh1B7Nnl5GqNr1U+n2p6+mybvRtayrQ+0042Z5byvTA8ihjlP8Odo8/VnHbZu4Q==",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/dcastil"
@@ -31162,9 +31175,9 @@
"dev": true
},
"node_modules/undici": {
- "version": "6.20.0",
- "resolved": "https://registry.npmjs.org/undici/-/undici-6.20.0.tgz",
- "integrity": "sha512-AITZfPuxubm31Sx0vr8bteSalEbs9wQb/BOBi9FPlD9Qpd6HxZ4Q0+hI742jBhkPb4RT2v5MQzaW5VhRVyj+9A==",
+ "version": "6.20.1",
+ "resolved": "https://registry.npmjs.org/undici/-/undici-6.20.1.tgz",
+ "integrity": "sha512-AjQF1QsmqfJys+LXfGTNum+qw4S88CojRInG/6t31W/1fk6G59s92bnAvGz5Cmur+kQv2SURXEvvudLmbrE8QA==",
"engines": {
"node": ">=18.17"
}
@@ -31759,9 +31772,9 @@
}
},
"node_modules/vite": {
- "version": "5.4.8",
- "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.8.tgz",
- "integrity": "sha512-FqrItQ4DT1NC4zCUqMB4c4AZORMKIa0m8/URVCZ77OZ/QSNeJ54bU1vrFADbDsuwfIPcgknRkmqakQcgnL4GiQ==",
+ "version": "5.4.9",
+ "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.9.tgz",
+ "integrity": "sha512-20OVpJHh0PAM0oSOELa5GaZNWeDjcAvQjGXy2Uyr+Tp+/D2/Hdz6NLgpJLsarPTA2QJ6v8mX2P1ZfbsSKvdMkg==",
"dependencies": {
"esbuild": "^0.21.3",
"postcss": "^8.4.43",
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 05e42ca86e..660efa5d35 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -2265,12 +2265,13 @@ export type Database = {
Row: {
companyId: string
email: string
+ externalId: Json | null
fax: string | null
- firstName: string
+ firstName: string | null
fullName: string | null
homePhone: string | null
id: string
- lastName: string
+ lastName: string | null
mobilePhone: string | null
notes: string | null
title: string | null
@@ -2279,12 +2280,13 @@ export type Database = {
Insert: {
companyId: string
email: string
+ externalId?: Json | null
fax?: string | null
- firstName: string
+ firstName?: string | null
fullName?: string | null
homePhone?: string | null
id?: string
- lastName: string
+ lastName?: string | null
mobilePhone?: string | null
notes?: string | null
title?: string | null
@@ -2293,12 +2295,13 @@ export type Database = {
Update: {
companyId?: string
email?: string
+ externalId?: Json | null
fax?: string | null
- firstName?: string
+ firstName?: string | null
fullName?: string | null
homePhone?: string | null
id?: string
- lastName?: string
+ lastName?: string | null
mobilePhone?: string | null
notes?: string | null
title?: string | null
@@ -3158,6 +3161,7 @@ export type Database = {
customerId: string
customerLocationId: string | null
customFields: Json | null
+ externalId: Json | null
id: string
userId: string | null
}
@@ -3166,6 +3170,7 @@ export type Database = {
customerId: string
customerLocationId?: string | null
customFields?: Json | null
+ externalId?: Json | null
id?: string
userId?: string | null
}
@@ -3174,6 +3179,7 @@ export type Database = {
customerId?: string
customerLocationId?: string | null
customFields?: Json | null
+ externalId?: Json | null
id?: string
userId?: string | null
}
@@ -19350,6 +19356,7 @@ export type Database = {
Row: {
contactId: string
customFields: Json | null
+ externalId: Json | null
id: string
supplierId: string
supplierLocationId: string | null
@@ -19358,6 +19365,7 @@ export type Database = {
Insert: {
contactId: string
customFields?: Json | null
+ externalId?: Json | null
id?: string
supplierId: string
supplierLocationId?: string | null
@@ -19366,6 +19374,7 @@ export type Database = {
Update: {
contactId?: string
customFields?: Json | null
+ externalId?: Json | null
id?: string
supplierId?: string
supplierLocationId?: string | null
@@ -22735,6 +22744,7 @@ export type Database = {
customFields: Json | null
email: string | null
firstName: string | null
+ fullName: string | null
hoursPerWeek: number | null
lastName: string | null
supplierContactId: string | null
diff --git a/packages/database/supabase/functions/import-csv/index.ts b/packages/database/supabase/functions/import-csv/index.ts
index 799817a877..75906b79dc 100644
--- a/packages/database/supabase/functions/import-csv/index.ts
+++ b/packages/database/supabase/functions/import-csv/index.ts
@@ -1,5 +1,6 @@
import { parse } from "https://deno.land/[email protected]/encoding/csv.ts";
import { serve } from "https://deno.land/[email protected]/http/server.ts";
+import { nanoid } from "https://deno.land/x/[email protected]/mod.ts";
import z from "https://deno.land/x/[email protected]/index.ts";
import { sql } from "https://esm.sh/[email protected]";
import { DB, getConnectionPool, getDatabaseClient } from "../lib/database.ts";
@@ -14,10 +15,12 @@ const importCsvValidator = z.object({
table: z.enum([
"consumable",
"customer",
+ "customerContact",
"fixture",
"material",
"part",
"supplier",
+ "supplierContact",
"tool",
]),
filePath: z.string(),
@@ -173,6 +176,12 @@ serve(async (req: Request) => {
}
}
+ console.log({
+ totalRecords: mappedRecords.length,
+ customerInserts: customerInserts.length,
+ customerUpdates: customerUpdates.length,
+ });
+
if (customerInserts.length > 0) {
await trx.insertInto(table).values(customerInserts).execute();
}
@@ -255,6 +264,12 @@ serve(async (req: Request) => {
}
}
+ console.log({
+ totalRecords: mappedRecords.length,
+ supplierInserts: supplierInserts.length,
+ supplierUpdates: supplierUpdates.length,
+ });
+
if (supplierInserts.length > 0) {
await trx.insertInto(table).values(supplierInserts).execute();
}
@@ -503,6 +518,14 @@ serve(async (req: Request) => {
}
}
+ console.log({
+ totalRecords: mappedRecords.length,
+ itemInserts: itemInserts.length,
+ itemUpdates: itemUpdates.length,
+ materialInserts: Object.keys(materialPartialInserts).length,
+ materialUpdates: materialUpdates.length,
+ });
+
if (itemUpdates.length > 0) {
for (const update of itemUpdates) {
await trx
@@ -526,6 +549,284 @@ serve(async (req: Request) => {
break;
}
+ case "customerContact": {
+ const currentContacts = await db
+ .selectFrom("contact")
+ .where("companyId", "=", companyId)
+ .select(["id", "externalId"])
+ .execute();
+
+ const currentCustomers = await db
+ .selectFrom("customer")
+ .where("companyId", "=", companyId)
+ .select(["id", "externalId"])
+ .execute();
+
+ const externalCustomerIdMap = new Map(
+ currentCustomers.reduce((acc, customer) => {
+ if (
+ customer.externalId &&
+ typeof customer.externalId === "object" &&
+ EXTERNAL_ID_KEY in customer.externalId
+ ) {
+ acc.set(customer.externalId[EXTERNAL_ID_KEY] as string, {
+ id: customer.id!,
+ externalId: customer.externalId as Record<string, string>,
+ });
+ }
+ return acc;
+ }, new Map<string, { id: string; externalId: Record<string, string> }>())
+ );
+
+ const externalContactIdMap = new Map(
+ currentContacts.reduce((acc, contact) => {
+ if (
+ contact.externalId &&
+ typeof contact.externalId === "object" &&
+ EXTERNAL_ID_KEY in contact.externalId
+ ) {
+ acc.set(contact.externalId[EXTERNAL_ID_KEY] as string, {
+ id: contact.id!,
+ externalId: contact.externalId as Record<string, string>,
+ });
+ }
+ return acc;
+ }, new Map<string, { id: string; externalId: Record<string, string> }>())
+ );
+
+ await db.transaction().execute(async (trx) => {
+ const contactInserts: Database["public"]["Tables"]["contact"]["Insert"][] =
+ [];
+ const contactUpdates: {
+ id: string;
+ data: Database["public"]["Tables"]["contact"]["Update"];
+ }[] = [];
+ const customerContactInserts: Database["public"]["Tables"]["customerContact"]["Insert"][] =
+ [];
+
+ const isContactValid = (
+ record: Record<string, string>
+ ): record is {
+ email: string;
+ } => {
+ return (
+ typeof record.email === "string" && record.email.trim() !== ""
+ );
+ };
+
+ for (const record of mappedRecords) {
+ const { id, companyId: customerId, ...contactData } = record;
+
+ if (externalContactIdMap.has(id)) {
+ const existingContact = externalContactIdMap.get(id)!;
+ if (isContactValid(contactData)) {
+ contactUpdates.push({
+ id: existingContact.id,
+ data: {
+ ...contactData,
+ externalId: {
+ ...existingContact.externalId,
+ },
+ },
+ });
+ }
+ } else if (
+ isContactValid(contactData) &&
+ externalCustomerIdMap.has(customerId)
+ ) {
+ const existingCustomer = externalCustomerIdMap.get(customerId)!;
+ const contactId = nanoid();
+ const newContact = {
+ id: contactId,
+ ...contactData,
+ companyId,
+ externalId: {
+ [EXTERNAL_ID_KEY]: id,
+ },
+ };
+ contactInserts.push(newContact);
+ customerContactInserts.push({
+ contactId,
+ customerId: existingCustomer.id,
+ customFields: {},
+ });
+ }
+ }
+
+ console.log({
+ totalRecords: mappedRecords.length,
+ contactInserts: contactInserts.length,
+ contactUpdates: contactUpdates.length,
+ customerContactInserts: customerContactInserts.length,
+ });
+
+ if (contactInserts.length > 0) {
+ await trx
+ .insertInto("contact")
+ .values(contactInserts)
+ .returning(["id"])
+ .execute();
+ }
+
+ if (contactUpdates.length > 0) {
+ for (const update of contactUpdates) {
+ await trx
+ .updateTable("contact")
+ .set(update.data)
+ .where("id", "=", update.id)
+ .execute();
+ }
+ }
+
+ if (customerContactInserts.length > 0) {
+ await trx
+ .insertInto("customerContact")
+ .values(customerContactInserts)
+ .execute();
+ }
+ });
+
+ break;
+ }
+ case "supplierContact": {
+ const currentContacts = await db
+ .selectFrom("contact")
+ .where("companyId", "=", companyId)
+ .select(["id", "externalId"])
+ .execute();
+
+ const currentSuppliers = await db
+ .selectFrom("supplier")
+ .where("companyId", "=", companyId)
+ .select(["id", "externalId"])
+ .execute();
+
+ const externalSupplierIdMap = new Map(
+ currentSuppliers.reduce((acc, supplier) => {
+ if (
+ supplier.externalId &&
+ typeof supplier.externalId === "object" &&
+ EXTERNAL_ID_KEY in supplier.externalId
+ ) {
+ acc.set(supplier.externalId[EXTERNAL_ID_KEY] as string, {
+ id: supplier.id!,
+ externalId: supplier.externalId as Record<string, string>,
+ });
+ }
+ return acc;
+ }, new Map<string, { id: string; externalId: Record<string, string> }>())
+ );
+
+ const externalContactIdMap = new Map(
+ currentContacts.reduce((acc, contact) => {
+ if (
+ contact.externalId &&
+ typeof contact.externalId === "object" &&
+ EXTERNAL_ID_KEY in contact.externalId
+ ) {
+ acc.set(contact.externalId[EXTERNAL_ID_KEY] as string, {
+ id: contact.id!,
+ externalId: contact.externalId as Record<string, string>,
+ });
+ }
+ return acc;
+ }, new Map<string, { id: string; externalId: Record<string, string> }>())
+ );
+
+ await db.transaction().execute(async (trx) => {
+ const contactInserts: Database["public"]["Tables"]["contact"]["Insert"][] =
+ [];
+ const contactUpdates: {
+ id: string;
+ data: Database["public"]["Tables"]["contact"]["Update"];
+ }[] = [];
+ const supplierContactInserts: Database["public"]["Tables"]["supplierContact"]["Insert"][] =
+ [];
+
+ const isContactValid = (
+ record: Record<string, string>
+ ): record is {
+ email: string;
+ } => {
+ return (
+ typeof record.email === "string" && record.email.trim() !== ""
+ );
+ };
+
+ for (const record of mappedRecords) {
+ const { id, companyId: supplierId, ...contactData } = record;
+
+ if (externalContactIdMap.has(id)) {
+ const existingContact = externalContactIdMap.get(id)!;
+ if (isContactValid(contactData)) {
+ contactUpdates.push({
+ id: existingContact.id,
+ data: {
+ ...contactData,
+ externalId: {
+ ...existingContact.externalId,
+ },
+ },
+ });
+ }
+ } else if (
+ isContactValid(contactData) &&
+ externalSupplierIdMap.has(supplierId)
+ ) {
+ const existingSupplier = externalSupplierIdMap.get(supplierId)!;
+ const contactId = nanoid();
+ const newContact = {
+ id: contactId,
+ ...contactData,
+ companyId,
+ externalId: {
+ [EXTERNAL_ID_KEY]: id,
+ },
+ };
+ contactInserts.push(newContact);
+ supplierContactInserts.push({
+ contactId,
+ supplierId: existingSupplier.id,
+ customFields: {},
+ });
+ }
+ }
+
+ console.log({
+ totalRecords: mappedRecords.length,
+ contactInserts: contactInserts.length,
+ contactUpdates: contactUpdates.length,
+ supplierContactInserts: supplierContactInserts.length,
+ });
+
+ if (contactInserts.length > 0) {
+ await trx
+ .insertInto("contact")
+ .values(contactInserts)
+ .returning(["id"])
+ .execute();
+ }
+
+ if (contactUpdates.length > 0) {
+ for (const update of contactUpdates) {
+ await trx
+ .updateTable("contact")
+ .set(update.data)
+ .where("id", "=", update.id)
+ .execute();
+ }
+ }
+
+ if (supplierContactInserts.length > 0) {
+ await trx
+ .insertInto("supplierContact")
+ .values(supplierContactInserts)
+ .execute();
+ }
+ });
+
+ break;
+ }
default: {
throw new Error(`Invalid table: ${table}`);
}
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 05e42ca86e..660efa5d35 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -2265,12 +2265,13 @@ export type Database = {
Row: {
companyId: string
email: string
+ externalId: Json | null
fax: string | null
- firstName: string
+ firstName: string | null
fullName: string | null
homePhone: string | null
id: string
- lastName: string
+ lastName: string | null
mobilePhone: string | null
notes: string | null
title: string | null
@@ -2279,12 +2280,13 @@ export type Database = {
Insert: {
companyId: string
email: string
+ externalId?: Json | null
fax?: string | null
- firstName: string
+ firstName?: string | null
fullName?: string | null
homePhone?: string | null
id?: string
- lastName: string
+ lastName?: string | null
mobilePhone?: string | null
notes?: string | null
title?: string | null
@@ -2293,12 +2295,13 @@ export type Database = {
Update: {
companyId?: string
email?: string
+ externalId?: Json | null
fax?: string | null
- firstName?: string
+ firstName?: string | null
fullName?: string | null
homePhone?: string | null
id?: string
- lastName?: string
+ lastName?: string | null
mobilePhone?: string | null
notes?: string | null
title?: string | null
@@ -3158,6 +3161,7 @@ export type Database = {
customerId: string
customerLocationId: string | null
customFields: Json | null
+ externalId: Json | null
id: string
userId: string | null
}
@@ -3166,6 +3170,7 @@ export type Database = {
customerId: string
customerLocationId?: string | null
customFields?: Json | null
+ externalId?: Json | null
id?: string
userId?: string | null
}
@@ -3174,6 +3179,7 @@ export type Database = {
customerId?: string
customerLocationId?: string | null
customFields?: Json | null
+ externalId?: Json | null
id?: string
userId?: string | null
}
@@ -19350,6 +19356,7 @@ export type Database = {
Row: {
contactId: string
customFields: Json | null
+ externalId: Json | null
id: string
supplierId: string
supplierLocationId: string | null
@@ -19358,6 +19365,7 @@ export type Database = {
Insert: {
contactId: string
customFields?: Json | null
+ externalId?: Json | null
id?: string
supplierId: string
supplierLocationId?: string | null
@@ -19366,6 +19374,7 @@ export type Database = {
Update: {
contactId?: string
customFields?: Json | null
+ externalId?: Json | null
id?: string
supplierId?: string
supplierLocationId?: string | null
@@ -22735,6 +22744,7 @@ export type Database = {
customFields: Json | null
email: string | null
firstName: string | null
+ fullName: string | null
hoursPerWeek: number | null
lastName: string | null
supplierContactId: string | null
diff --git a/packages/database/supabase/migrations/20241015022612_contact-import.sql b/packages/database/supabase/migrations/20241015022612_contact-import.sql
new file mode 100644
index 0000000000..23fa7d6ab0
--- /dev/null
+++ b/packages/database/supabase/migrations/20241015022612_contact-import.sql
@@ -0,0 +1,43 @@
+
+ALTER TABLE "contact" ADD COLUMN "externalId" JSONB;
+
+-- Make firstName and lastName nullable
+ALTER TABLE "contact" ALTER COLUMN "firstName" DROP NOT NULL;
+ALTER TABLE "contact" ALTER COLUMN "lastName" DROP NOT NULL;
+
+-- Update the fullName generation to use email if firstName or lastName is null
+ALTER TABLE "contact" DROP COLUMN "fullName";
+ALTER TABLE "contact" ADD COLUMN "fullName" TEXT GENERATED ALWAYS AS (
+ CASE
+ WHEN "firstName" IS NULL AND "lastName" IS NULL THEN "email"
+ WHEN "firstName" IS NULL THEN "lastName"
+ WHEN "lastName" IS NULL THEN "firstName"
+ ELSE "firstName" || ' ' || "lastName"
+ END
+) STORED;
+
+CREATE OR REPLACE VIEW "contractors" WITH (security_invoker = on) AS
+ SELECT
+ p.id AS "supplierContactId",
+ p."active",
+ p."hoursPerWeek",
+ p."companyId",
+ p."customFields",
+ s.id AS "supplierId",
+ s.name AS "supplierName",
+ c."fullName",
+ c."firstName",
+ c."lastName",
+ c."email",
+ array_agg(pa."abilityId") AS "abilityIds"
+ FROM "contractor" p
+ INNER JOIN "supplierContact" sc
+ ON sc.id = p.id
+ INNER JOIN "supplier" s
+ ON s.id = sc."supplierId"
+ INNER JOIN "contact" c
+ ON c.id = sc."contactId"
+ LEFT JOIN "contractorAbility" pa
+ ON pa."contractorId" = p.id
+ WHERE p."active" = true
+ GROUP BY p.id, p.active, p."hoursPerWeek", p."customFields", p."companyId", s.id, c.id, s.name, c."firstName", c."lastName", c."email";
\ No newline at end of file
diff --git a/packages/documents/src/email/PurchaseOrderEmail.tsx b/packages/documents/src/email/PurchaseOrderEmail.tsx
index 1d62700e8f..01d02886d8 100644
--- a/packages/documents/src/email/PurchaseOrderEmail.tsx
+++ b/packages/documents/src/email/PurchaseOrderEmail.tsx
@@ -88,8 +88,9 @@ const PurchaseOrderEmail = ({
</Section>
<Section>
<Text className="text-left text-sm font-medium text-gray-900 my-9">
- Hi {recipient.firstName}, please see the attached purchase order
- and let me know if you have any questions.
+ {recipient.firstName ? `Hi ${recipient.firstName},` : "Hi,"}
+ please see the attached purchase order and let me know if you
+ have any questions.
</Text>
</Section>
<Section className="bg-gray-50 rounded-lg text-xs">
diff --git a/packages/documents/src/email/QuoteEmail.tsx b/packages/documents/src/email/QuoteEmail.tsx
index 5d95ae4046..4ce95f0a1c 100644
--- a/packages/documents/src/email/QuoteEmail.tsx
+++ b/packages/documents/src/email/QuoteEmail.tsx
@@ -56,7 +56,9 @@ const QuoteEmail = ({ company, quote, recipient, sender }: QuoteEmailProps) => {
</Section>
<Section>
<Text className="mt-9 mb-10 text-left text-sm font-medium text-gray-900">
- Hi {recipient.firstName}, please see the attached quote.
+ {recipient.firstName ? `Hi ${recipient.firstName},` : "Hi,"}
+ please see the attached quote and let me know if you have any
+ questions.
</Text>
</Section>
<Section className="rounded-lg bg-gray-50 text-xs">
diff --git a/packages/documents/src/email/SalesOrderEmail.tsx b/packages/documents/src/email/SalesOrderEmail.tsx
index eda51464bc..6d841cf039 100644
--- a/packages/documents/src/email/SalesOrderEmail.tsx
+++ b/packages/documents/src/email/SalesOrderEmail.tsx
@@ -92,8 +92,9 @@ const SalesOrderEmail = ({
</Section>
<Section>
<Text className="text-left text-sm font-medium text-gray-900 my-9">
- Hi {recipient.firstName}, please see the attached sales order
- and let me know if you have any questions.
+ {recipient.firstName ? `Hi ${recipient.firstName},` : "Hi,"}
+ please see the attached sales order and let me know if you have
+ any questions.
</Text>
</Section>
<Section className="bg-gray-50 rounded-lg text-xs">
diff --git a/packages/react/src/Avatar.tsx b/packages/react/src/Avatar.tsx
index d5961d2135..969ec1637c 100644
--- a/packages/react/src/Avatar.tsx
+++ b/packages/react/src/Avatar.tsx
@@ -20,7 +20,7 @@ import {
import { cn } from "./utils/cn";
export const avatarVariants = cva(
- "flex flex-shrink-0 overflow-hidden rounded-full items-center justify-center text-white font-semibold",
+ "flex flex-shrink-0 overflow-hidden rounded-full items-center justify-center font-semibold",
{
variants: {
size: {
@@ -78,13 +78,16 @@ const Avatar = forwardRef<HTMLSpanElement, AvatarProps>(
"bg-muted-foreground",
className
)}
- style={name ? { background } : undefined}
+ style={name ? { background, color } : undefined}
{...props}
ref={ref}
>
<>
{avatarInitials ? (
- <span className="text-white" style={{ color }}>
+ <span
+ className="text-foreground"
+ style={name ? { color } : undefined}
+ >
{avatarInitials}
</span>
) : (
@@ -92,6 +95,7 @@ const Avatar = forwardRef<HTMLSpanElement, AvatarProps>(
viewBox="0 0 128 128"
className="h-full w-full text-muted"
role="img"
+ style={name ? { color } : undefined}
aria-label=" avatar"
>
<path