braid-ui 1.0.34 → 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
@@ -4339,7 +4339,7 @@ var UBOCard = ({ ubos, onUBOClick }) => {
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);
@@ -4661,7 +4673,8 @@ var BusinessDetailView = ({
4661
4673
  onNavigateToAccounts,
4662
4674
  onNavigateToCounterparty,
4663
4675
  onAddAccount,
4664
- onUBOClick
4676
+ onUBOClick,
4677
+ onDocumentUpload
4665
4678
  }) => {
4666
4679
  return /* @__PURE__ */ jsxRuntime.jsx(
4667
4680
  PageLayout,
@@ -4734,7 +4747,14 @@ var BusinessDetailView = ({
4734
4747
  }
4735
4748
  ) })
4736
4749
  ] }),
4737
- /* @__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
+ )
4738
4758
  ] }),
4739
4759
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lg:w-64", children: /* @__PURE__ */ jsxRuntime.jsx(BusinessStatusCard, { isEditing: false, onToggleEdit: () => {
4740
4760
  } }) })
@@ -10396,7 +10416,7 @@ var BusinessDetail = () => {
10396
10416
  const business = mockBusinessesList.find((b) => b.id === id);
10397
10417
  const identityVerification = id ? mockIdentityVerifications[id] : void 0;
10398
10418
  const businessUBOs = id ? mockBusinessUBOs[id] || [] : [];
10399
- const businessDocuments = id ? mockBusinessDocuments[id] || [] : [];
10419
+ const initialDocuments = id ? mockBusinessDocuments[id] || [] : [];
10400
10420
  const businessAccounts = id ? mockBusinessAccounts[id] || [] : [];
10401
10421
  const initialProfile = id ? mockBusinessProfiles[id] : void 0;
10402
10422
  const [currentStatus, setCurrentStatus] = React15.useState(business?.status || "active");
@@ -10404,6 +10424,7 @@ var BusinessDetail = () => {
10404
10424
  const [businessProfile, setBusinessProfile] = React15.useState(
10405
10425
  initialProfile
10406
10426
  );
10427
+ const [businessDocuments, setBusinessDocuments] = React15.useState(initialDocuments);
10407
10428
  const handleStatusChange = (newStatus) => {
10408
10429
  setCurrentStatus(newStatus);
10409
10430
  };
@@ -10426,6 +10447,20 @@ var BusinessDetail = () => {
10426
10447
  const handleUBOClick = (customerId) => {
10427
10448
  navigate(`/customer/${customerId}`);
10428
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
+ };
10429
10464
  if (!business) {
10430
10465
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "container mx-auto px-4 py-8", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
10431
10466
  /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-bold mb-2", children: "Business Not Found" }),
@@ -10449,7 +10484,8 @@ var BusinessDetail = () => {
10449
10484
  onNavigateToAccounts: handleNavigateToAccounts,
10450
10485
  onNavigateToCounterparty: handleNavigateToCounterparty,
10451
10486
  onAddAccount: handleAddAccount,
10452
- onUBOClick: handleUBOClick
10487
+ onUBOClick: handleUBOClick,
10488
+ onDocumentUpload: handleDocumentUpload
10453
10489
  }
10454
10490
  );
10455
10491
  };