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.d.cts CHANGED
@@ -326,8 +326,14 @@ interface BusinessDetailViewProps {
326
326
  onNavigateToAccounts: () => void;
327
327
  onNavigateToCounterparty: () => void;
328
328
  onAddAccount: () => void;
329
+ onUBOClick: (customerId: string) => void;
330
+ onDocumentUpload: (file: File, metadata: {
331
+ name: string;
332
+ description: string;
333
+ type: string;
334
+ }) => Promise<void>;
329
335
  }
330
- declare const BusinessDetailView: ({ business, businessProfile, identityVerification, businessUBOs, businessDocuments, businessAccounts, currentStatus, isEditingProfile, onStatusChange, onProfileDataChange, onToggleProfileEdit, onNavigateToAccounts, onNavigateToCounterparty, onAddAccount }: 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;
331
337
 
332
338
  interface BusinessFilters {
333
339
  name: string;
package/dist/index.d.ts CHANGED
@@ -326,8 +326,14 @@ interface BusinessDetailViewProps {
326
326
  onNavigateToAccounts: () => void;
327
327
  onNavigateToCounterparty: () => void;
328
328
  onAddAccount: () => void;
329
+ onUBOClick: (customerId: string) => void;
330
+ onDocumentUpload: (file: File, metadata: {
331
+ name: string;
332
+ description: string;
333
+ type: string;
334
+ }) => Promise<void>;
329
335
  }
330
- declare const BusinessDetailView: ({ business, businessProfile, identityVerification, businessUBOs, businessDocuments, businessAccounts, currentStatus, isEditingProfile, onStatusChange, onProfileDataChange, onToggleProfileEdit, onNavigateToAccounts, onNavigateToCounterparty, onAddAccount }: 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;
331
337
 
332
338
  interface BusinessFilters {
333
339
  name: string;
package/dist/index.js CHANGED
@@ -4256,7 +4256,7 @@ var PageLayout = React15.forwardRef(
4256
4256
  }
4257
4257
  );
4258
4258
  PageLayout.displayName = "PageLayout";
4259
- var UBOCard = ({ ubos }) => {
4259
+ var UBOCard = ({ ubos, onUBOClick }) => {
4260
4260
  const columns3 = [
4261
4261
  {
4262
4262
  key: "name",
@@ -4264,10 +4264,10 @@ var UBOCard = ({ ubos }) => {
4264
4264
  sortable: true,
4265
4265
  width: "40%",
4266
4266
  render: (value, row) => /* @__PURE__ */ jsx(
4267
- Link,
4267
+ "button",
4268
4268
  {
4269
- to: `/customer/${row.customerId}`,
4270
- className: "text-primary hover:underline font-medium",
4269
+ onClick: () => onUBOClick(row.customerId),
4270
+ className: "text-primary hover:underline font-medium text-left",
4271
4271
  children: value
4272
4272
  }
4273
4273
  )
@@ -4307,7 +4307,7 @@ var UBOCard = ({ ubos }) => {
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);
@@ -4628,7 +4640,9 @@ var BusinessDetailView = ({
4628
4640
  onToggleProfileEdit,
4629
4641
  onNavigateToAccounts,
4630
4642
  onNavigateToCounterparty,
4631
- onAddAccount
4643
+ onAddAccount,
4644
+ onUBOClick,
4645
+ onDocumentUpload
4632
4646
  }) => {
4633
4647
  return /* @__PURE__ */ jsx(
4634
4648
  PageLayout,
@@ -4681,7 +4695,7 @@ var BusinessDetailView = ({
4681
4695
  onDataChange: onProfileDataChange
4682
4696
  }
4683
4697
  ),
4684
- /* @__PURE__ */ jsx(UBOCard, { ubos: businessUBOs }),
4698
+ /* @__PURE__ */ jsx(UBOCard, { ubos: businessUBOs, onUBOClick }),
4685
4699
  /* @__PURE__ */ jsxs(Card, { children: [
4686
4700
  /* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-4", children: [
4687
4701
  /* @__PURE__ */ jsx(CardTitle, { children: "External Accounts" }),
@@ -4701,7 +4715,14 @@ var BusinessDetailView = ({
4701
4715
  }
4702
4716
  ) })
4703
4717
  ] }),
4704
- /* @__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
+ )
4705
4726
  ] }),
4706
4727
  /* @__PURE__ */ jsx("div", { className: "lg:w-64", children: /* @__PURE__ */ jsx(BusinessStatusCard, { isEditing: false, onToggleEdit: () => {
4707
4728
  } }) })
@@ -10363,7 +10384,7 @@ var BusinessDetail = () => {
10363
10384
  const business = mockBusinessesList.find((b) => b.id === id);
10364
10385
  const identityVerification = id ? mockIdentityVerifications[id] : void 0;
10365
10386
  const businessUBOs = id ? mockBusinessUBOs[id] || [] : [];
10366
- const businessDocuments = id ? mockBusinessDocuments[id] || [] : [];
10387
+ const initialDocuments = id ? mockBusinessDocuments[id] || [] : [];
10367
10388
  const businessAccounts = id ? mockBusinessAccounts[id] || [] : [];
10368
10389
  const initialProfile = id ? mockBusinessProfiles[id] : void 0;
10369
10390
  const [currentStatus, setCurrentStatus] = useState(business?.status || "active");
@@ -10371,6 +10392,7 @@ var BusinessDetail = () => {
10371
10392
  const [businessProfile, setBusinessProfile] = useState(
10372
10393
  initialProfile
10373
10394
  );
10395
+ const [businessDocuments, setBusinessDocuments] = useState(initialDocuments);
10374
10396
  const handleStatusChange = (newStatus) => {
10375
10397
  setCurrentStatus(newStatus);
10376
10398
  };
@@ -10390,6 +10412,23 @@ var BusinessDetail = () => {
10390
10412
  const handleAddAccount = () => {
10391
10413
  console.log("Add account clicked");
10392
10414
  };
10415
+ const handleUBOClick = (customerId) => {
10416
+ navigate(`/customer/${customerId}`);
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
+ };
10393
10432
  if (!business) {
10394
10433
  return /* @__PURE__ */ jsx("div", { className: "container mx-auto px-4 py-8", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
10395
10434
  /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold mb-2", children: "Business Not Found" }),
@@ -10412,7 +10451,9 @@ var BusinessDetail = () => {
10412
10451
  onToggleProfileEdit: handleToggleProfileEdit,
10413
10452
  onNavigateToAccounts: handleNavigateToAccounts,
10414
10453
  onNavigateToCounterparty: handleNavigateToCounterparty,
10415
- onAddAccount: handleAddAccount
10454
+ onAddAccount: handleAddAccount,
10455
+ onUBOClick: handleUBOClick,
10456
+ onDocumentUpload: handleDocumentUpload
10416
10457
  }
10417
10458
  );
10418
10459
  };