braid-ui 1.0.40 → 1.0.41

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
@@ -391,13 +391,14 @@ interface CounterpartyDetailViewProps {
391
391
  currentStatus: string;
392
392
  isEditingProfile: boolean;
393
393
  mockPaymentMethods: PaymentMethodCardProps[];
394
- documentsTable: React.ReactNode;
394
+ documents: any[];
395
395
  onStatusChange: (newStatus: string) => void;
396
396
  onToggleProfileEdit: () => void;
397
397
  onAddPaymentMethod: () => void;
398
398
  onAddDocument: () => void;
399
+ onEntityClick?: (entityType: string, entityId: string) => void;
399
400
  }
400
- declare const CounterpartyDetailView: ({ counterpartyName, counterpartyType, currentStatus, isEditingProfile, mockPaymentMethods, documentsTable, onStatusChange, onToggleProfileEdit, onAddPaymentMethod, onAddDocument }: CounterpartyDetailViewProps) => react_jsx_runtime.JSX.Element;
401
+ declare const CounterpartyDetailView: ({ counterpartyName, counterpartyType, currentStatus, isEditingProfile, mockPaymentMethods, documents, onStatusChange, onToggleProfileEdit, onAddPaymentMethod, onAddDocument, onEntityClick }: CounterpartyDetailViewProps) => react_jsx_runtime.JSX.Element;
401
402
 
402
403
  declare const achTransferSchema: z.ZodObject<{
403
404
  basicInfo: z.ZodObject<{
@@ -748,8 +749,9 @@ interface CounterpartyProfileCardProps {
748
749
  onToggleEdit?: () => void;
749
750
  hideActions?: boolean;
750
751
  className?: string;
752
+ onEntityClick?: (entityType: string, entityId: string) => void;
751
753
  }
752
- declare const CounterpartyProfileCard: ({ data, onDataChange, isEditing, onToggleEdit, hideActions, className }: CounterpartyProfileCardProps) => react_jsx_runtime.JSX.Element;
754
+ declare const CounterpartyProfileCard: ({ data, onDataChange, isEditing, onToggleEdit, hideActions, className, onEntityClick }: CounterpartyProfileCardProps) => react_jsx_runtime.JSX.Element;
753
755
 
754
756
  interface CounterpartyRecordsCardProps {
755
757
  isEditing?: boolean;
package/dist/index.d.ts CHANGED
@@ -391,13 +391,14 @@ interface CounterpartyDetailViewProps {
391
391
  currentStatus: string;
392
392
  isEditingProfile: boolean;
393
393
  mockPaymentMethods: PaymentMethodCardProps[];
394
- documentsTable: React.ReactNode;
394
+ documents: any[];
395
395
  onStatusChange: (newStatus: string) => void;
396
396
  onToggleProfileEdit: () => void;
397
397
  onAddPaymentMethod: () => void;
398
398
  onAddDocument: () => void;
399
+ onEntityClick?: (entityType: string, entityId: string) => void;
399
400
  }
400
- declare const CounterpartyDetailView: ({ counterpartyName, counterpartyType, currentStatus, isEditingProfile, mockPaymentMethods, documentsTable, onStatusChange, onToggleProfileEdit, onAddPaymentMethod, onAddDocument }: CounterpartyDetailViewProps) => react_jsx_runtime.JSX.Element;
401
+ declare const CounterpartyDetailView: ({ counterpartyName, counterpartyType, currentStatus, isEditingProfile, mockPaymentMethods, documents, onStatusChange, onToggleProfileEdit, onAddPaymentMethod, onAddDocument, onEntityClick }: CounterpartyDetailViewProps) => react_jsx_runtime.JSX.Element;
401
402
 
402
403
  declare const achTransferSchema: z.ZodObject<{
403
404
  basicInfo: z.ZodObject<{
@@ -748,8 +749,9 @@ interface CounterpartyProfileCardProps {
748
749
  onToggleEdit?: () => void;
749
750
  hideActions?: boolean;
750
751
  className?: string;
752
+ onEntityClick?: (entityType: string, entityId: string) => void;
751
753
  }
752
- declare const CounterpartyProfileCard: ({ data, onDataChange, isEditing, onToggleEdit, hideActions, className }: CounterpartyProfileCardProps) => react_jsx_runtime.JSX.Element;
754
+ declare const CounterpartyProfileCard: ({ data, onDataChange, isEditing, onToggleEdit, hideActions, className, onEntityClick }: CounterpartyProfileCardProps) => react_jsx_runtime.JSX.Element;
753
755
 
754
756
  interface CounterpartyRecordsCardProps {
755
757
  isEditing?: boolean;
package/dist/index.js CHANGED
@@ -5775,9 +5775,9 @@ var CounterpartyProfileCard = ({
5775
5775
  isEditing = false,
5776
5776
  onToggleEdit,
5777
5777
  hideActions = false,
5778
- className
5778
+ className,
5779
+ onEntityClick
5779
5780
  }) => {
5780
- const navigate = useNavigate();
5781
5781
  const form = useFormWithEditState({
5782
5782
  schema: counterpartyDetailSchema,
5783
5783
  defaultValues: { ...defaultCounterpartyDetail, ...data },
@@ -5900,20 +5900,6 @@ var CounterpartyProfileCard = ({
5900
5900
  ] }) });
5901
5901
  const formValues = form.watch();
5902
5902
  const idTypeLabel = formValues?.idType === "product_id" ? "Product ID" : formValues?.idType === "business_id" ? "Business ID" : formValues?.idType === "individual_id" ? "Individual ID" : "Account Number";
5903
- const getEntityLink = () => {
5904
- if (!formValues?.idValue) return null;
5905
- switch (formValues?.idType) {
5906
- case "business_id":
5907
- return `/business/${formValues.idValue}`;
5908
- case "individual_id":
5909
- return `/individual/${formValues.idValue}`;
5910
- case "account_number":
5911
- return `/account/${formValues.idValue}`;
5912
- default:
5913
- return null;
5914
- }
5915
- };
5916
- const entityLink = getEntityLink();
5917
5903
  const viewContent = /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
5918
5904
  /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
5919
5905
  /* @__PURE__ */ jsx(InfoField, { label: "Associated with", value: formValues?.idType === "product_id" ? "Product ID" : formValues?.idType === "business_id" ? "Business ID" : formValues?.idType === "individual_id" ? "Individual ID" : "Account Number", layout: "horizontal" }),
@@ -5921,12 +5907,12 @@ var CounterpartyProfileCard = ({
5921
5907
  InfoField,
5922
5908
  {
5923
5909
  label: idTypeLabel,
5924
- value: entityLink ? /* @__PURE__ */ jsx(
5910
+ value: formValues?.idValue && formValues?.idType && onEntityClick ? /* @__PURE__ */ jsx(
5925
5911
  "button",
5926
5912
  {
5927
5913
  onClick: (e) => {
5928
5914
  e.preventDefault();
5929
- navigate(entityLink);
5915
+ onEntityClick(formValues.idType, formValues.idValue);
5930
5916
  },
5931
5917
  className: "text-primary hover:underline font-medium text-left cursor-pointer",
5932
5918
  children: formValues?.idValue || "-"
@@ -6156,12 +6142,41 @@ var CounterpartyDetailView = ({
6156
6142
  currentStatus,
6157
6143
  isEditingProfile,
6158
6144
  mockPaymentMethods: mockPaymentMethods2,
6159
- documentsTable,
6145
+ documents,
6160
6146
  onStatusChange,
6161
6147
  onToggleProfileEdit,
6162
6148
  onAddPaymentMethod,
6163
- onAddDocument
6149
+ onAddDocument,
6150
+ onEntityClick
6164
6151
  }) => {
6152
+ const documentColumns = [
6153
+ {
6154
+ key: "name",
6155
+ title: "Document Name",
6156
+ sortable: true,
6157
+ width: "40%"
6158
+ },
6159
+ {
6160
+ key: "type",
6161
+ title: "Type",
6162
+ sortable: true,
6163
+ width: "20%"
6164
+ },
6165
+ {
6166
+ key: "uploadedDate",
6167
+ title: "Uploaded",
6168
+ sortable: true,
6169
+ width: "20%"
6170
+ },
6171
+ {
6172
+ key: "status",
6173
+ title: "Status",
6174
+ sortable: true,
6175
+ width: "20%",
6176
+ align: "right",
6177
+ render: (value) => /* @__PURE__ */ jsx("span", { className: "capitalize", children: value })
6178
+ }
6179
+ ];
6165
6180
  return /* @__PURE__ */ jsx(
6166
6181
  PageLayout,
6167
6182
  {
@@ -6192,7 +6207,8 @@ var CounterpartyDetailView = ({
6192
6207
  CounterpartyProfileCard,
6193
6208
  {
6194
6209
  isEditing: isEditingProfile,
6195
- onToggleEdit: onToggleProfileEdit
6210
+ onToggleEdit: onToggleProfileEdit,
6211
+ onEntityClick
6196
6212
  }
6197
6213
  ),
6198
6214
  /* @__PURE__ */ jsxs(Card, { children: [
@@ -6216,7 +6232,16 @@ var CounterpartyDetailView = ({
6216
6232
  "Document"
6217
6233
  ] })
6218
6234
  ] }),
6219
- /* @__PURE__ */ jsx(CardContent, { children: documentsTable })
6235
+ /* @__PURE__ */ jsx(CardContent, { children: documents.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2 py-4 text-sm text-muted-foreground", children: [
6236
+ /* @__PURE__ */ jsx(FileText, { className: "h-5 w-5 opacity-50" }),
6237
+ /* @__PURE__ */ jsx("p", { children: "No documents found" })
6238
+ ] }) : /* @__PURE__ */ jsx(
6239
+ DataTable,
6240
+ {
6241
+ columns: documentColumns,
6242
+ data: documents
6243
+ }
6244
+ ) })
6220
6245
  ] })
6221
6246
  ] }),
6222
6247
  /* @__PURE__ */ jsx("div", { className: "lg:w-64", children: /* @__PURE__ */ jsx(CounterpartyStatusCard, { isEditing: false, onToggleEdit: () => {
@@ -11509,39 +11534,24 @@ var mockPaymentMethods = [
11509
11534
  ];
11510
11535
  var CounterpartyDetail = () => {
11511
11536
  const { id } = useParams();
11512
- useNavigate();
11537
+ const navigate = useNavigate();
11513
11538
  const counterparty = mockCounterpartiesList.find((c) => c.id === id);
11514
11539
  const counterpartyDocuments = id ? mockBusinessDocuments[id] || [] : [];
11515
11540
  const [currentStatus, setCurrentStatus] = useState(counterparty?.status || "ACTIVE");
11516
11541
  const [isEditingProfile, setIsEditingProfile] = useState(false);
11517
- const documentColumns = [
11518
- {
11519
- key: "name",
11520
- title: "Document Name",
11521
- sortable: true,
11522
- width: "40%"
11523
- },
11524
- {
11525
- key: "type",
11526
- title: "Type",
11527
- sortable: true,
11528
- width: "20%"
11529
- },
11530
- {
11531
- key: "uploadedDate",
11532
- title: "Uploaded",
11533
- sortable: true,
11534
- width: "20%"
11535
- },
11536
- {
11537
- key: "status",
11538
- title: "Status",
11539
- sortable: true,
11540
- width: "20%",
11541
- align: "right",
11542
- render: (value) => /* @__PURE__ */ jsx("span", { className: "capitalize", children: value })
11542
+ const handleEntityClick = (entityType, entityId) => {
11543
+ switch (entityType) {
11544
+ case "business_id":
11545
+ navigate(`/business/${entityId}`);
11546
+ break;
11547
+ case "individual_id":
11548
+ navigate(`/individual/${entityId}`);
11549
+ break;
11550
+ case "account_number":
11551
+ navigate(`/account/${entityId}`);
11552
+ break;
11543
11553
  }
11544
- ];
11554
+ };
11545
11555
  const handleStatusChange = (newStatus) => {
11546
11556
  setCurrentStatus(newStatus);
11547
11557
  };
@@ -11554,21 +11564,6 @@ var CounterpartyDetail = () => {
11554
11564
  const handleAddDocument = () => {
11555
11565
  console.log("Add document");
11556
11566
  };
11557
- const documentsTable = useMemo(() => {
11558
- if (counterpartyDocuments.length === 0) {
11559
- return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2 py-4 text-sm text-muted-foreground", children: [
11560
- /* @__PURE__ */ jsx(FileText, { className: "h-5 w-5 opacity-50" }),
11561
- /* @__PURE__ */ jsx("p", { children: "No documents found" })
11562
- ] });
11563
- }
11564
- return /* @__PURE__ */ jsx(
11565
- DataTable,
11566
- {
11567
- columns: documentColumns,
11568
- data: counterpartyDocuments
11569
- }
11570
- );
11571
- }, [counterpartyDocuments, documentColumns]);
11572
11567
  if (!counterparty) {
11573
11568
  return /* @__PURE__ */ jsx("div", { className: "container mx-auto px-4 py-8", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
11574
11569
  /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold mb-2", children: "Counterparty Not Found" }),
@@ -11583,11 +11578,12 @@ var CounterpartyDetail = () => {
11583
11578
  currentStatus,
11584
11579
  isEditingProfile,
11585
11580
  mockPaymentMethods,
11586
- documentsTable,
11581
+ documents: counterpartyDocuments,
11587
11582
  onStatusChange: handleStatusChange,
11588
11583
  onToggleProfileEdit: handleToggleProfileEdit,
11589
11584
  onAddPaymentMethod: handleAddPaymentMethod,
11590
- onAddDocument: handleAddDocument
11585
+ onAddDocument: handleAddDocument,
11586
+ onEntityClick: handleEntityClick
11591
11587
  }
11592
11588
  );
11593
11589
  };