braid-ui 1.0.42 → 1.0.44

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
@@ -4015,6 +4015,21 @@ var statusConfig = {
4015
4015
  variant: "secondary",
4016
4016
  label: "Cancelled",
4017
4017
  icon: lucideReact.XCircle
4018
+ },
4019
+ DELETED: {
4020
+ variant: "inactive",
4021
+ label: "Deleted",
4022
+ icon: lucideReact.XCircle
4023
+ },
4024
+ NEEDS_OFAC: {
4025
+ variant: "pending",
4026
+ label: "Needs OFAC",
4027
+ icon: lucideReact.AlertTriangle
4028
+ },
4029
+ PENDING_UNBLOCK: {
4030
+ variant: "pending",
4031
+ label: "Pending Unblock",
4032
+ icon: lucideReact.Clock
4018
4033
  }
4019
4034
  };
4020
4035
  var StatusBadge = ({ status, className }) => {
@@ -6173,10 +6188,12 @@ var CounterpartyDetailView = ({
6173
6188
  counterpartyType,
6174
6189
  currentStatus,
6175
6190
  isEditingProfile,
6191
+ counterpartyProfileData,
6176
6192
  mockPaymentMethods: mockPaymentMethods2,
6177
6193
  documents,
6178
6194
  onStatusChange,
6179
6195
  onToggleProfileEdit,
6196
+ onProfileDataChange,
6180
6197
  onAddPaymentMethod,
6181
6198
  onAddDocument,
6182
6199
  onEntityClick
@@ -6221,9 +6238,10 @@ var CounterpartyDetailView = ({
6221
6238
  value: currentStatus,
6222
6239
  options: [
6223
6240
  { value: "ACTIVE", label: "Active" },
6224
- { value: "INACTIVE", label: "Inactive" },
6225
- { value: "PENDING", label: "Pending" },
6226
- { value: "SUSPENDED", label: "Suspended" }
6241
+ { value: "BLOCKED", label: "Blocked" },
6242
+ { value: "DELETED", label: "Deleted" },
6243
+ { value: "NEEDS_OFAC", label: "Needs OFAC" },
6244
+ { value: "PENDING_UNBLOCK", label: "Pending Unblock" }
6227
6245
  ],
6228
6246
  onChange: onStatusChange,
6229
6247
  renderValue: (value) => /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { status: value }),
@@ -6238,8 +6256,10 @@ var CounterpartyDetailView = ({
6238
6256
  /* @__PURE__ */ jsxRuntime.jsx(
6239
6257
  CounterpartyProfileCard,
6240
6258
  {
6259
+ data: counterpartyProfileData,
6241
6260
  isEditing: isEditingProfile,
6242
6261
  onToggleEdit: onToggleProfileEdit,
6262
+ onDataChange: onProfileDataChange,
6243
6263
  onEntityClick
6244
6264
  }
6245
6265
  ),
@@ -6971,20 +6991,18 @@ var Label = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @
6971
6991
  }
6972
6992
  ));
6973
6993
  Label.displayName = LabelPrimitive__namespace.Root.displayName;
6974
- var CounterpartyBasicInfo = ({ onDataChange }) => {
6975
- const [formData, setFormData] = React15.useState({
6976
- name: "",
6977
- type: "business",
6978
- email: "",
6979
- phone: "",
6980
- dateOfBirth: "",
6981
- idNumber: "",
6982
- idType: "product_id",
6983
- idValue: ""
6984
- });
6985
- const handleInputChange = (field, value) => {
6986
- const updatedData = { ...formData, [field]: value };
6987
- setFormData(updatedData);
6994
+ var CounterpartyBasicInfo = ({ value = {
6995
+ name: "",
6996
+ type: "business",
6997
+ email: "",
6998
+ phone: "",
6999
+ dateOfBirth: "",
7000
+ idNumber: "",
7001
+ idType: "product_id",
7002
+ idValue: ""
7003
+ }, onDataChange }) => {
7004
+ const handleInputChange = (field, newValue) => {
7005
+ const updatedData = { ...value, [field]: newValue };
6988
7006
  onDataChange?.(updatedData);
6989
7007
  };
6990
7008
  const handleTypeChange = (type) => {
@@ -6996,7 +7014,7 @@ var CounterpartyBasicInfo = ({ onDataChange }) => {
6996
7014
  EnhancedInput,
6997
7015
  {
6998
7016
  label: "Counterparty Name",
6999
- value: formData.name,
7017
+ value: value.name,
7000
7018
  onChange: (e) => handleInputChange("name", e.target.value),
7001
7019
  placeholder: "Enter counterparty name",
7002
7020
  required: true
@@ -7012,7 +7030,7 @@ var CounterpartyBasicInfo = ({ onDataChange }) => {
7012
7030
  type: "radio",
7013
7031
  name: "counterpartyType",
7014
7032
  value: "business",
7015
- checked: formData.type === "business",
7033
+ checked: value.type === "business",
7016
7034
  onChange: () => handleTypeChange("business"),
7017
7035
  className: "w-4 h-4 text-primary border-border focus:ring-primary focus:ring-2"
7018
7036
  }
@@ -7026,7 +7044,7 @@ var CounterpartyBasicInfo = ({ onDataChange }) => {
7026
7044
  type: "radio",
7027
7045
  name: "counterpartyType",
7028
7046
  value: "individual",
7029
- checked: formData.type === "individual",
7047
+ checked: value.type === "individual",
7030
7048
  onChange: () => handleTypeChange("individual"),
7031
7049
  className: "w-4 h-4 text-primary border-border focus:ring-primary focus:ring-2"
7032
7050
  }
@@ -7039,8 +7057,8 @@ var CounterpartyBasicInfo = ({ onDataChange }) => {
7039
7057
  EnhancedSelect,
7040
7058
  {
7041
7059
  label: "Associated with",
7042
- value: formData.idType,
7043
- onValueChange: (value) => handleInputChange("idType", value),
7060
+ value: value.idType,
7061
+ onValueChange: (val) => handleInputChange("idType", val),
7044
7062
  options: [
7045
7063
  { value: "product_id", label: "Product ID" },
7046
7064
  { value: "business_id", label: "Business ID" },
@@ -7052,10 +7070,10 @@ var CounterpartyBasicInfo = ({ onDataChange }) => {
7052
7070
  /* @__PURE__ */ jsxRuntime.jsx(
7053
7071
  EnhancedInput,
7054
7072
  {
7055
- label: formData.idType === "product_id" ? "Product ID" : formData.idType === "business_id" ? "Business ID" : formData.idType === "individual_id" ? "Individual ID" : "Account Number",
7056
- value: formData.idValue,
7073
+ label: value.idType === "product_id" ? "Product ID" : value.idType === "business_id" ? "Business ID" : value.idType === "individual_id" ? "Individual ID" : "Account Number",
7074
+ value: value.idValue,
7057
7075
  onChange: (e) => handleInputChange("idValue", e.target.value),
7058
- placeholder: `Enter ${formData.idType === "product_id" ? "product ID" : formData.idType === "business_id" ? "business ID" : formData.idType === "individual_id" ? "individual ID" : "account number"}`,
7076
+ placeholder: `Enter ${value.idType === "product_id" ? "product ID" : value.idType === "business_id" ? "business ID" : value.idType === "individual_id" ? "individual ID" : "account number"}`,
7059
7077
  required: true
7060
7078
  }
7061
7079
  )
@@ -7066,7 +7084,7 @@ var CounterpartyBasicInfo = ({ onDataChange }) => {
7066
7084
  {
7067
7085
  label: "Email",
7068
7086
  type: "email",
7069
- value: formData.email,
7087
+ value: value.email,
7070
7088
  onChange: (e) => handleInputChange("email", e.target.value),
7071
7089
  placeholder: "Enter email address"
7072
7090
  }
@@ -7076,7 +7094,7 @@ var CounterpartyBasicInfo = ({ onDataChange }) => {
7076
7094
  {
7077
7095
  label: "Phone Number",
7078
7096
  type: "tel",
7079
- value: formData.phone,
7097
+ value: value.phone,
7080
7098
  onChange: (e) => handleInputChange("phone", e.target.value),
7081
7099
  placeholder: "Enter phone number"
7082
7100
  }
@@ -7086,7 +7104,7 @@ var CounterpartyBasicInfo = ({ onDataChange }) => {
7086
7104
  {
7087
7105
  label: "Date of Birth",
7088
7106
  type: "date",
7089
- value: formData.dateOfBirth,
7107
+ value: value.dateOfBirth,
7090
7108
  onChange: (e) => handleInputChange("dateOfBirth", e.target.value),
7091
7109
  placeholder: "Select date of birth"
7092
7110
  }
@@ -7095,7 +7113,7 @@ var CounterpartyBasicInfo = ({ onDataChange }) => {
7095
7113
  EnhancedInput,
7096
7114
  {
7097
7115
  label: "ID Number",
7098
- value: formData.idNumber,
7116
+ value: value.idNumber,
7099
7117
  onChange: (e) => handleInputChange("idNumber", e.target.value),
7100
7118
  placeholder: "Enter ID number"
7101
7119
  }
@@ -11573,6 +11591,60 @@ var CounterpartyDetail = () => {
11573
11591
  const counterpartyDocuments = id ? mockBusinessDocuments[id] || [] : [];
11574
11592
  const [currentStatus, setCurrentStatus] = React15.useState(counterparty?.status || "ACTIVE");
11575
11593
  const [isEditingProfile, setIsEditingProfile] = React15.useState(false);
11594
+ const getInitialProfileData = () => {
11595
+ if (!counterparty) {
11596
+ return {
11597
+ idType: "product_id",
11598
+ idValue: "",
11599
+ email: "",
11600
+ phone: "",
11601
+ dateOfBirth: "",
11602
+ idNumber: "",
11603
+ address: {
11604
+ line1: "",
11605
+ line2: "",
11606
+ city: "",
11607
+ state: "",
11608
+ postalCode: "",
11609
+ countryCode: "US",
11610
+ type: ""
11611
+ }
11612
+ };
11613
+ }
11614
+ let idType = "product_id";
11615
+ let idValue = "";
11616
+ if (counterparty.productId) {
11617
+ idType = "product_id";
11618
+ idValue = counterparty.productId;
11619
+ } else if (counterparty.businessId) {
11620
+ idType = "business_id";
11621
+ idValue = counterparty.businessId;
11622
+ } else if (counterparty.individualId) {
11623
+ idType = "individual_id";
11624
+ idValue = counterparty.individualId;
11625
+ } else if (counterparty.accountNumber) {
11626
+ idType = "account_number";
11627
+ idValue = counterparty.accountNumber;
11628
+ }
11629
+ return {
11630
+ idType,
11631
+ idValue,
11632
+ email: "",
11633
+ phone: "",
11634
+ dateOfBirth: "",
11635
+ idNumber: "",
11636
+ address: {
11637
+ line1: "",
11638
+ line2: "",
11639
+ city: "",
11640
+ state: "",
11641
+ postalCode: "",
11642
+ countryCode: "US",
11643
+ type: ""
11644
+ }
11645
+ };
11646
+ };
11647
+ const [counterpartyProfileData, setCounterpartyProfileData] = React15.useState(getInitialProfileData());
11576
11648
  const handleEntityClick = (entityType, entityId) => {
11577
11649
  switch (entityType) {
11578
11650
  case "business_id":
@@ -11592,6 +11664,9 @@ var CounterpartyDetail = () => {
11592
11664
  const handleToggleProfileEdit = () => {
11593
11665
  setIsEditingProfile(!isEditingProfile);
11594
11666
  };
11667
+ const handleProfileDataChange = (newData) => {
11668
+ setCounterpartyProfileData(newData);
11669
+ };
11595
11670
  const handleAddPaymentMethod = () => {
11596
11671
  console.log("Add payment method");
11597
11672
  };
@@ -11611,10 +11686,12 @@ var CounterpartyDetail = () => {
11611
11686
  counterpartyType: counterparty.type,
11612
11687
  currentStatus,
11613
11688
  isEditingProfile,
11689
+ counterpartyProfileData,
11614
11690
  mockPaymentMethods,
11615
11691
  documents: counterpartyDocuments,
11616
11692
  onStatusChange: handleStatusChange,
11617
11693
  onToggleProfileEdit: handleToggleProfileEdit,
11694
+ onProfileDataChange: handleProfileDataChange,
11618
11695
  onAddPaymentMethod: handleAddPaymentMethod,
11619
11696
  onAddDocument: handleAddDocument,
11620
11697
  onEntityClick: handleEntityClick
@@ -11623,6 +11700,7 @@ var CounterpartyDetail = () => {
11623
11700
  };
11624
11701
  var CounterpartyDetail_default = CounterpartyDetail;
11625
11702
  var CreateCounterpartyView = ({
11703
+ counterpartyData,
11626
11704
  paymentMethods,
11627
11705
  onPaymentMethodsChange,
11628
11706
  onBasicInfoChange,
@@ -11641,7 +11719,7 @@ var CreateCounterpartyView = ({
11641
11719
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
11642
11720
  /* @__PURE__ */ jsxRuntime.jsxs(Card, { children: [
11643
11721
  /* @__PURE__ */ jsxRuntime.jsx(CardHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(CardTitle, { children: "Basic Information" }) }),
11644
- /* @__PURE__ */ jsxRuntime.jsx(CardContent, { children: /* @__PURE__ */ jsxRuntime.jsx(CounterpartyBasicInfo, { onDataChange: onBasicInfoChange }) })
11722
+ /* @__PURE__ */ jsxRuntime.jsx(CardContent, { children: /* @__PURE__ */ jsxRuntime.jsx(CounterpartyBasicInfo, { value: counterpartyData, onDataChange: onBasicInfoChange }) })
11645
11723
  ] }),
11646
11724
  /* @__PURE__ */ jsxRuntime.jsxs(Card, { children: [
11647
11725
  /* @__PURE__ */ jsxRuntime.jsx(CardHeader, { children: /* @__PURE__ */ jsxRuntime.jsxs(CardTitle, { children: [
@@ -11671,7 +11749,16 @@ var CreateCounterpartyView = ({
11671
11749
  };
11672
11750
  var CreateCounterparty = () => {
11673
11751
  const navigate = reactRouterDom.useNavigate();
11674
- const [counterpartyData, setCounterpartyData] = React15.useState(null);
11752
+ const [counterpartyData, setCounterpartyData] = React15.useState({
11753
+ name: "",
11754
+ type: "business",
11755
+ email: "",
11756
+ phone: "",
11757
+ dateOfBirth: "",
11758
+ idNumber: "",
11759
+ idType: "product_id",
11760
+ idValue: ""
11761
+ });
11675
11762
  const [paymentMethods, setPaymentMethods] = React15.useState([]);
11676
11763
  const handlePaymentMethodsChange = (methods) => {
11677
11764
  setPaymentMethods(methods);
@@ -11718,6 +11805,7 @@ var CreateCounterparty = () => {
11718
11805
  return /* @__PURE__ */ jsxRuntime.jsx(
11719
11806
  CreateCounterpartyView,
11720
11807
  {
11808
+ counterpartyData,
11721
11809
  paymentMethods,
11722
11810
  onPaymentMethodsChange: handlePaymentMethodsChange,
11723
11811
  onBasicInfoChange: handleBasicInfoChange,