@layerfi/components 0.1.62 → 0.1.64

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/esm/index.js CHANGED
@@ -4927,9 +4927,6 @@ var ActionableList = ({
4927
4927
  )));
4928
4928
  };
4929
4929
 
4930
- // src/components/BankTransactionMobileList/constants.ts
4931
- var PersonalCategories = ["PERSONAL_INCOME", "PERSONAL_EXPENSES"];
4932
-
4933
4930
  // src/components/BankTransactionMobileList/utils.ts
4934
4931
  var mapCategoryToOption = (category) => ({
4935
4932
  label: category.display_name,
@@ -4976,7 +4973,7 @@ var getAssignedValue = (bankTransaction) => {
4976
4973
  if (bankTransaction.categorization_status === "MATCHED" /* MATCHED */ || bankTransaction?.categorization_status === "SPLIT" /* SPLIT */) {
4977
4974
  return;
4978
4975
  }
4979
- if (bankTransaction.category && !PersonalCategories.includes(bankTransaction.category.display_name)) {
4976
+ if (bankTransaction.category && bankTransaction.category.type != "Exclusion") {
4980
4977
  return mapCategoryToOption(bankTransaction.category);
4981
4978
  }
4982
4979
  if (hasSuggestions(bankTransaction.categorization_flow)) {
@@ -4992,7 +4989,9 @@ var BusinessCategories = ({
4992
4989
  selectedId
4993
4990
  }) => {
4994
4991
  const { categories } = useLayerContext();
4995
- const categoryOptions = flattenCategories(categories);
4992
+ const categoryOptions = flattenCategories(
4993
+ categories.filter((category) => category.type != "ExclusionNested")
4994
+ );
4996
4995
  const [optionsToShow, setOptionsToShow] = useState11(categoryOptions);
4997
4996
  const [selectedGroup, setSelectedGroup] = useState11();
4998
4997
  const onCategorySelect = (v) => {
@@ -5156,15 +5155,15 @@ var Option2 = (props) => {
5156
5155
  ...props,
5157
5156
  className: `Layer__select__option-menu-content ${props.className}`
5158
5157
  },
5159
- /* @__PURE__ */ React71.createElement("div", { className: "Layer__select__option-menu--name" }, /* @__PURE__ */ React71.createElement("div", null, props.data.payload.display_name), props.data.payload.description && /* @__PURE__ */ React71.createElement(Tooltip, null, /* @__PURE__ */ React71.createElement(TooltipTrigger, null, /* @__PURE__ */ React71.createElement(InfoIcon_default, null)), /* @__PURE__ */ React71.createElement(TooltipContent, { className: "Layer__actionable-list__tooltip-content" }, /* @__PURE__ */ React71.createElement(
5158
+ /* @__PURE__ */ React71.createElement("div", { className: "Layer__select__option-menu--name" }, props.isSelected ? /* @__PURE__ */ React71.createElement("span", { className: "Layer__select__option-menu-content-check" }, /* @__PURE__ */ React71.createElement(Check_default, { size: 16 })) : /* @__PURE__ */ React71.createElement("span", { className: "Layer__select__option-menu-content-check" }, /* @__PURE__ */ React71.createElement("div", { style: { width: 16, height: 16 } })), /* @__PURE__ */ React71.createElement("div", null, props.data.payload.display_name)),
5159
+ props.data.payload.description && /* @__PURE__ */ React71.createElement("div", { className: "Layer__select__option-menu--tooltip" }, /* @__PURE__ */ React71.createElement(Tooltip, null, /* @__PURE__ */ React71.createElement(TooltipTrigger, null, /* @__PURE__ */ React71.createElement(InfoIcon_default, null)), /* @__PURE__ */ React71.createElement(TooltipContent, { className: "Layer__actionable-list__tooltip-content" }, /* @__PURE__ */ React71.createElement(
5160
5160
  Text,
5161
5161
  {
5162
5162
  className: "Layer__actionable-list__content-description",
5163
5163
  size: "sm" /* sm */
5164
5164
  },
5165
5165
  props.data.payload.description
5166
- )))),
5167
- props.isSelected ? /* @__PURE__ */ React71.createElement("span", { className: "Layer__select__option-menu-content-check" }, /* @__PURE__ */ React71.createElement(Check_default, { size: 16 })) : null
5166
+ ))))
5168
5167
  );
5169
5168
  };
5170
5169
  var allCategoriesDivider = [
@@ -5271,7 +5270,8 @@ var CategorySelect = ({
5271
5270
  },
5272
5271
  components: { DropdownIndicator, GroupHeading, Option: Option2 },
5273
5272
  isDisabled: disabled,
5274
- isOptionDisabled: (option) => option.disabled ?? false
5273
+ isOptionDisabled: (option) => option.disabled ?? false,
5274
+ isOptionSelected: (option) => selected?.payload.display_name == option.payload.display_name
5275
5275
  }
5276
5276
  );
5277
5277
  };
@@ -7227,12 +7227,21 @@ var BusinessForm = ({ bankTransaction }) => {
7227
7227
 
7228
7228
  // src/components/BankTransactionMobileList/PersonalForm.tsx
7229
7229
  import React94, { useEffect as useEffect15, useState as useState18 } from "react";
7230
+
7231
+ // src/components/BankTransactionMobileList/constants.ts
7232
+ var PersonalCategories = /* @__PURE__ */ ((PersonalCategories2) => {
7233
+ PersonalCategories2["INCOME"] = "PERSONAL_INFLOWS";
7234
+ PersonalCategories2["EXPENSES"] = "PERSONAL_EXPENSES";
7235
+ return PersonalCategories2;
7236
+ })(PersonalCategories || {});
7237
+
7238
+ // src/components/BankTransactionMobileList/PersonalForm.tsx
7230
7239
  var isAlreadyAssigned = (bankTransaction) => {
7231
7240
  if (bankTransaction.categorization_status === "MATCHED" /* MATCHED */ || bankTransaction?.categorization_status === "SPLIT" /* SPLIT */) {
7232
7241
  return false;
7233
7242
  }
7234
7243
  return Boolean(
7235
- bankTransaction.category && PersonalCategories.includes(bankTransaction.category.display_name)
7244
+ bankTransaction.category && Object.values(PersonalCategories).includes(bankTransaction.category.display_name)
7236
7245
  );
7237
7246
  };
7238
7247
  var PersonalForm = ({ bankTransaction }) => {
@@ -7249,8 +7258,8 @@ var PersonalForm = ({ bankTransaction }) => {
7249
7258
  {
7250
7259
  type: "Category",
7251
7260
  category: {
7252
- type: "StableName",
7253
- stable_name: isCredit(bankTransaction) ? "PERSONAL_INCOME" : "PERSONAL_EXPENSES"
7261
+ type: "Exclusion",
7262
+ exclusion_type: isCredit(bankTransaction) ? "PERSONAL_INFLOWS" /* INCOME */ : "PERSONAL_EXPENSES" /* EXPENSES */
7254
7263
  }
7255
7264
  },
7256
7265
  true
@@ -7618,7 +7627,7 @@ var BankTransactionMobileListItem = ({
7618
7627
  const itemRef = useRef11(null);
7619
7628
  const [removeAnim, setRemoveAnim] = useState23(false);
7620
7629
  const [purpose, setPurpose] = useState23(
7621
- bankTransaction.category ? bankTransaction.categorization_status === "SPLIT" /* SPLIT */ ? "more" /* more */ : "business" /* business */ : hasMatch(bankTransaction) ? "more" /* more */ : "business" /* business */
7630
+ bankTransaction.category ? bankTransaction.category.type === "Exclusion" ? "personal" /* personal */ : bankTransaction.categorization_status === "SPLIT" /* SPLIT */ ? "more" /* more */ : "business" /* business */ : hasMatch(bankTransaction) ? "more" /* more */ : "business" /* business */
7622
7631
  );
7623
7632
  const [open, setOpen] = useState23(isFirstItem);
7624
7633
  const [showComponent, setShowComponent] = useState23(!initialLoad);