braid-ui 1.0.33 → 1.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -4288,7 +4288,7 @@ var PageLayout = React15__namespace.forwardRef(
4288
4288
  }
4289
4289
  );
4290
4290
  PageLayout.displayName = "PageLayout";
4291
- var UBOCard = ({ ubos }) => {
4291
+ var UBOCard = ({ ubos, onUBOClick }) => {
4292
4292
  const columns3 = [
4293
4293
  {
4294
4294
  key: "name",
@@ -4296,10 +4296,10 @@ var UBOCard = ({ ubos }) => {
4296
4296
  sortable: true,
4297
4297
  width: "40%",
4298
4298
  render: (value, row) => /* @__PURE__ */ jsxRuntime.jsx(
4299
- reactRouterDom.Link,
4299
+ "button",
4300
4300
  {
4301
- to: `/customer/${row.customerId}`,
4302
- className: "text-primary hover:underline font-medium",
4301
+ onClick: () => onUBOClick(row.customerId),
4302
+ className: "text-primary hover:underline font-medium text-left",
4303
4303
  children: value
4304
4304
  }
4305
4305
  )
@@ -4339,7 +4339,7 @@ var UBOCard = ({ ubos }) => {
4339
4339
  ) })
4340
4340
  ] });
4341
4341
  };
4342
- var BusinessDocuments = ({ businessId, documents }) => {
4342
+ var BusinessDocuments = ({ businessId, documents, onDocumentUpload }) => {
4343
4343
  const [isUploading, setIsUploading] = React15.useState(false);
4344
4344
  const [showUploadDialog, setShowUploadDialog] = React15.useState(false);
4345
4345
  const [selectedFile, setSelectedFile] = React15.useState(null);
@@ -4352,7 +4352,7 @@ var BusinessDocuments = ({ businessId, documents }) => {
4352
4352
  setSelectedFile(file);
4353
4353
  setDocumentName(file.name);
4354
4354
  };
4355
- const handleUploadSubmit = () => {
4355
+ const handleUploadSubmit = async () => {
4356
4356
  if (!selectedFile || !documentName || !documentType) {
4357
4357
  toast({
4358
4358
  title: "Missing Information",
@@ -4362,15 +4362,27 @@ var BusinessDocuments = ({ businessId, documents }) => {
4362
4362
  return;
4363
4363
  }
4364
4364
  setIsUploading(true);
4365
- setTimeout(() => {
4365
+ try {
4366
+ await onDocumentUpload(selectedFile, {
4367
+ name: documentName,
4368
+ description,
4369
+ type: documentType
4370
+ });
4366
4371
  toast({
4367
4372
  title: "Upload Successful",
4368
4373
  description: `${documentName} uploaded successfully`
4369
4374
  });
4370
- setIsUploading(false);
4371
4375
  setShowUploadDialog(false);
4372
4376
  resetForm();
4373
- }, 1e3);
4377
+ } catch (error) {
4378
+ toast({
4379
+ title: "Upload Failed",
4380
+ description: "Failed to upload document. Please try again.",
4381
+ variant: "destructive"
4382
+ });
4383
+ } finally {
4384
+ setIsUploading(false);
4385
+ }
4374
4386
  };
4375
4387
  const resetForm = () => {
4376
4388
  setSelectedFile(null);
@@ -4660,7 +4672,9 @@ var BusinessDetailView = ({
4660
4672
  onToggleProfileEdit,
4661
4673
  onNavigateToAccounts,
4662
4674
  onNavigateToCounterparty,
4663
- onAddAccount
4675
+ onAddAccount,
4676
+ onUBOClick,
4677
+ onDocumentUpload
4664
4678
  }) => {
4665
4679
  return /* @__PURE__ */ jsxRuntime.jsx(
4666
4680
  PageLayout,
@@ -4713,7 +4727,7 @@ var BusinessDetailView = ({
4713
4727
  onDataChange: onProfileDataChange
4714
4728
  }
4715
4729
  ),
4716
- /* @__PURE__ */ jsxRuntime.jsx(UBOCard, { ubos: businessUBOs }),
4730
+ /* @__PURE__ */ jsxRuntime.jsx(UBOCard, { ubos: businessUBOs, onUBOClick }),
4717
4731
  /* @__PURE__ */ jsxRuntime.jsxs(Card, { children: [
4718
4732
  /* @__PURE__ */ jsxRuntime.jsxs(CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-4", children: [
4719
4733
  /* @__PURE__ */ jsxRuntime.jsx(CardTitle, { children: "External Accounts" }),
@@ -4733,7 +4747,14 @@ var BusinessDetailView = ({
4733
4747
  }
4734
4748
  ) })
4735
4749
  ] }),
4736
- /* @__PURE__ */ jsxRuntime.jsx(BusinessDocuments, { businessId: business.id, documents: businessDocuments })
4750
+ /* @__PURE__ */ jsxRuntime.jsx(
4751
+ BusinessDocuments,
4752
+ {
4753
+ businessId: business.id,
4754
+ documents: businessDocuments,
4755
+ onDocumentUpload
4756
+ }
4757
+ )
4737
4758
  ] }),
4738
4759
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lg:w-64", children: /* @__PURE__ */ jsxRuntime.jsx(BusinessStatusCard, { isEditing: false, onToggleEdit: () => {
4739
4760
  } }) })
@@ -10395,7 +10416,7 @@ var BusinessDetail = () => {
10395
10416
  const business = mockBusinessesList.find((b) => b.id === id);
10396
10417
  const identityVerification = id ? mockIdentityVerifications[id] : void 0;
10397
10418
  const businessUBOs = id ? mockBusinessUBOs[id] || [] : [];
10398
- const businessDocuments = id ? mockBusinessDocuments[id] || [] : [];
10419
+ const initialDocuments = id ? mockBusinessDocuments[id] || [] : [];
10399
10420
  const businessAccounts = id ? mockBusinessAccounts[id] || [] : [];
10400
10421
  const initialProfile = id ? mockBusinessProfiles[id] : void 0;
10401
10422
  const [currentStatus, setCurrentStatus] = React15.useState(business?.status || "active");
@@ -10403,6 +10424,7 @@ var BusinessDetail = () => {
10403
10424
  const [businessProfile, setBusinessProfile] = React15.useState(
10404
10425
  initialProfile
10405
10426
  );
10427
+ const [businessDocuments, setBusinessDocuments] = React15.useState(initialDocuments);
10406
10428
  const handleStatusChange = (newStatus) => {
10407
10429
  setCurrentStatus(newStatus);
10408
10430
  };
@@ -10422,6 +10444,23 @@ var BusinessDetail = () => {
10422
10444
  const handleAddAccount = () => {
10423
10445
  console.log("Add account clicked");
10424
10446
  };
10447
+ const handleUBOClick = (customerId) => {
10448
+ navigate(`/customer/${customerId}`);
10449
+ };
10450
+ const handleDocumentUpload = async (file, metadata) => {
10451
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
10452
+ const newDocument = {
10453
+ id: `doc-${Date.now()}`,
10454
+ name: metadata.name,
10455
+ type: metadata.type,
10456
+ description: metadata.description,
10457
+ size: `${(file.size / 1024 / 1024).toFixed(2)} MB`,
10458
+ uploadedBy: "Current User",
10459
+ uploadedAt: (/* @__PURE__ */ new Date()).toISOString()
10460
+ };
10461
+ setBusinessDocuments((prev) => [...prev, newDocument]);
10462
+ console.log("Document uploaded:", { file, metadata, newDocument });
10463
+ };
10425
10464
  if (!business) {
10426
10465
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "container mx-auto px-4 py-8", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
10427
10466
  /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-bold mb-2", children: "Business Not Found" }),
@@ -10444,7 +10483,9 @@ var BusinessDetail = () => {
10444
10483
  onToggleProfileEdit: handleToggleProfileEdit,
10445
10484
  onNavigateToAccounts: handleNavigateToAccounts,
10446
10485
  onNavigateToCounterparty: handleNavigateToCounterparty,
10447
- onAddAccount: handleAddAccount
10486
+ onAddAccount: handleAddAccount,
10487
+ onUBOClick: handleUBOClick,
10488
+ onDocumentUpload: handleDocumentUpload
10448
10489
  }
10449
10490
  );
10450
10491
  };