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.d.cts CHANGED
@@ -327,8 +327,13 @@ interface BusinessDetailViewProps {
327
327
  onNavigateToCounterparty: () => void;
328
328
  onAddAccount: () => void;
329
329
  onUBOClick: (customerId: string) => void;
330
+ onDocumentUpload: (file: File, metadata: {
331
+ name: string;
332
+ description: string;
333
+ type: string;
334
+ }) => Promise<void>;
330
335
  }
331
- declare const BusinessDetailView: ({ business, businessProfile, identityVerification, businessUBOs, businessDocuments, businessAccounts, currentStatus, isEditingProfile, onStatusChange, onProfileDataChange, onToggleProfileEdit, onNavigateToAccounts, onNavigateToCounterparty, onAddAccount, onUBOClick }: BusinessDetailViewProps) => react_jsx_runtime.JSX.Element;
336
+ declare const BusinessDetailView: ({ business, businessProfile, identityVerification, businessUBOs, businessDocuments, businessAccounts, currentStatus, isEditingProfile, onStatusChange, onProfileDataChange, onToggleProfileEdit, onNavigateToAccounts, onNavigateToCounterparty, onAddAccount, onUBOClick, onDocumentUpload }: BusinessDetailViewProps) => react_jsx_runtime.JSX.Element;
332
337
 
333
338
  interface BusinessFilters {
334
339
  name: string;
package/dist/index.d.ts CHANGED
@@ -327,8 +327,13 @@ interface BusinessDetailViewProps {
327
327
  onNavigateToCounterparty: () => void;
328
328
  onAddAccount: () => void;
329
329
  onUBOClick: (customerId: string) => void;
330
+ onDocumentUpload: (file: File, metadata: {
331
+ name: string;
332
+ description: string;
333
+ type: string;
334
+ }) => Promise<void>;
330
335
  }
331
- declare const BusinessDetailView: ({ business, businessProfile, identityVerification, businessUBOs, businessDocuments, businessAccounts, currentStatus, isEditingProfile, onStatusChange, onProfileDataChange, onToggleProfileEdit, onNavigateToAccounts, onNavigateToCounterparty, onAddAccount, onUBOClick }: BusinessDetailViewProps) => react_jsx_runtime.JSX.Element;
336
+ declare const BusinessDetailView: ({ business, businessProfile, identityVerification, businessUBOs, businessDocuments, businessAccounts, currentStatus, isEditingProfile, onStatusChange, onProfileDataChange, onToggleProfileEdit, onNavigateToAccounts, onNavigateToCounterparty, onAddAccount, onUBOClick, onDocumentUpload }: BusinessDetailViewProps) => react_jsx_runtime.JSX.Element;
332
337
 
333
338
  interface BusinessFilters {
334
339
  name: string;
package/dist/index.js CHANGED
@@ -4307,7 +4307,7 @@ var UBOCard = ({ ubos, onUBOClick }) => {
4307
4307
  ) })
4308
4308
  ] });
4309
4309
  };
4310
- var BusinessDocuments = ({ businessId, documents }) => {
4310
+ var BusinessDocuments = ({ businessId, documents, onDocumentUpload }) => {
4311
4311
  const [isUploading, setIsUploading] = useState(false);
4312
4312
  const [showUploadDialog, setShowUploadDialog] = useState(false);
4313
4313
  const [selectedFile, setSelectedFile] = useState(null);
@@ -4320,7 +4320,7 @@ var BusinessDocuments = ({ businessId, documents }) => {
4320
4320
  setSelectedFile(file);
4321
4321
  setDocumentName(file.name);
4322
4322
  };
4323
- const handleUploadSubmit = () => {
4323
+ const handleUploadSubmit = async () => {
4324
4324
  if (!selectedFile || !documentName || !documentType) {
4325
4325
  toast({
4326
4326
  title: "Missing Information",
@@ -4330,15 +4330,27 @@ var BusinessDocuments = ({ businessId, documents }) => {
4330
4330
  return;
4331
4331
  }
4332
4332
  setIsUploading(true);
4333
- setTimeout(() => {
4333
+ try {
4334
+ await onDocumentUpload(selectedFile, {
4335
+ name: documentName,
4336
+ description,
4337
+ type: documentType
4338
+ });
4334
4339
  toast({
4335
4340
  title: "Upload Successful",
4336
4341
  description: `${documentName} uploaded successfully`
4337
4342
  });
4338
- setIsUploading(false);
4339
4343
  setShowUploadDialog(false);
4340
4344
  resetForm();
4341
- }, 1e3);
4345
+ } catch (error) {
4346
+ toast({
4347
+ title: "Upload Failed",
4348
+ description: "Failed to upload document. Please try again.",
4349
+ variant: "destructive"
4350
+ });
4351
+ } finally {
4352
+ setIsUploading(false);
4353
+ }
4342
4354
  };
4343
4355
  const resetForm = () => {
4344
4356
  setSelectedFile(null);
@@ -4629,7 +4641,8 @@ var BusinessDetailView = ({
4629
4641
  onNavigateToAccounts,
4630
4642
  onNavigateToCounterparty,
4631
4643
  onAddAccount,
4632
- onUBOClick
4644
+ onUBOClick,
4645
+ onDocumentUpload
4633
4646
  }) => {
4634
4647
  return /* @__PURE__ */ jsx(
4635
4648
  PageLayout,
@@ -4702,7 +4715,14 @@ var BusinessDetailView = ({
4702
4715
  }
4703
4716
  ) })
4704
4717
  ] }),
4705
- /* @__PURE__ */ jsx(BusinessDocuments, { businessId: business.id, documents: businessDocuments })
4718
+ /* @__PURE__ */ jsx(
4719
+ BusinessDocuments,
4720
+ {
4721
+ businessId: business.id,
4722
+ documents: businessDocuments,
4723
+ onDocumentUpload
4724
+ }
4725
+ )
4706
4726
  ] }),
4707
4727
  /* @__PURE__ */ jsx("div", { className: "lg:w-64", children: /* @__PURE__ */ jsx(BusinessStatusCard, { isEditing: false, onToggleEdit: () => {
4708
4728
  } }) })
@@ -10364,7 +10384,7 @@ var BusinessDetail = () => {
10364
10384
  const business = mockBusinessesList.find((b) => b.id === id);
10365
10385
  const identityVerification = id ? mockIdentityVerifications[id] : void 0;
10366
10386
  const businessUBOs = id ? mockBusinessUBOs[id] || [] : [];
10367
- const businessDocuments = id ? mockBusinessDocuments[id] || [] : [];
10387
+ const initialDocuments = id ? mockBusinessDocuments[id] || [] : [];
10368
10388
  const businessAccounts = id ? mockBusinessAccounts[id] || [] : [];
10369
10389
  const initialProfile = id ? mockBusinessProfiles[id] : void 0;
10370
10390
  const [currentStatus, setCurrentStatus] = useState(business?.status || "active");
@@ -10372,6 +10392,7 @@ var BusinessDetail = () => {
10372
10392
  const [businessProfile, setBusinessProfile] = useState(
10373
10393
  initialProfile
10374
10394
  );
10395
+ const [businessDocuments, setBusinessDocuments] = useState(initialDocuments);
10375
10396
  const handleStatusChange = (newStatus) => {
10376
10397
  setCurrentStatus(newStatus);
10377
10398
  };
@@ -10394,6 +10415,20 @@ var BusinessDetail = () => {
10394
10415
  const handleUBOClick = (customerId) => {
10395
10416
  navigate(`/customer/${customerId}`);
10396
10417
  };
10418
+ const handleDocumentUpload = async (file, metadata) => {
10419
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
10420
+ const newDocument = {
10421
+ id: `doc-${Date.now()}`,
10422
+ name: metadata.name,
10423
+ type: metadata.type,
10424
+ description: metadata.description,
10425
+ size: `${(file.size / 1024 / 1024).toFixed(2)} MB`,
10426
+ uploadedBy: "Current User",
10427
+ uploadedAt: (/* @__PURE__ */ new Date()).toISOString()
10428
+ };
10429
+ setBusinessDocuments((prev) => [...prev, newDocument]);
10430
+ console.log("Document uploaded:", { file, metadata, newDocument });
10431
+ };
10397
10432
  if (!business) {
10398
10433
  return /* @__PURE__ */ jsx("div", { className: "container mx-auto px-4 py-8", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
10399
10434
  /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold mb-2", children: "Business Not Found" }),
@@ -10417,7 +10452,8 @@ var BusinessDetail = () => {
10417
10452
  onNavigateToAccounts: handleNavigateToAccounts,
10418
10453
  onNavigateToCounterparty: handleNavigateToCounterparty,
10419
10454
  onAddAccount: handleAddAccount,
10420
- onUBOClick: handleUBOClick
10455
+ onUBOClick: handleUBOClick,
10456
+ onDocumentUpload: handleDocumentUpload
10421
10457
  }
10422
10458
  );
10423
10459
  };