@layerfi/components 0.1.88-alpha.1 → 0.1.88-alpha.2

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.
@@ -119,7 +119,7 @@ var import_react16 = require("react");
119
119
  var import_react14 = require("react");
120
120
 
121
121
  // package.json
122
- var version = "0.1.88-alpha.1";
122
+ var version = "0.1.88-alpha.2";
123
123
 
124
124
  // src/models/APIError.ts
125
125
  var APIError = class _APIError extends Error {
@@ -9173,7 +9173,7 @@ var ExpandedBankTransactionRow = (0, import_react59.forwardRef)(
9173
9173
  showReceiptUploads,
9174
9174
  showTooltips
9175
9175
  }, ref) => {
9176
- var _a, _b, _c, _d, _e, _f, _g;
9176
+ var _a, _b, _c, _d, _e, _f;
9177
9177
  const {
9178
9178
  categorize: categorizeBankTransaction2,
9179
9179
  match: matchBankTransaction2
@@ -9194,9 +9194,9 @@ var ExpandedBankTransactionRow = (0, import_react59.forwardRef)(
9194
9194
  const { businessId } = useLayerContext();
9195
9195
  const { apiUrl } = useEnvironment();
9196
9196
  const { data: auth } = useAuth();
9197
- const defaultCategory = bankTransaction.category || hasSuggestions(bankTransaction.categorization_flow) && ((_e = (_d = bankTransaction.categorization_flow) == null ? void 0 : _d.suggestions) == null ? void 0 : _e[0]);
9197
+ const defaultCategory = bankTransaction.category ? bankTransaction.category : hasSuggestions(bankTransaction.categorization_flow) ? (_d = bankTransaction.categorization_flow) == null ? void 0 : _d.suggestions.at(0) : void 0;
9198
9198
  const [rowState, updateRowState] = (0, import_react59.useState)({
9199
- splits: ((_f = bankTransaction.category) == null ? void 0 : _f.entries) ? (_g = bankTransaction.category) == null ? void 0 : _g.entries.map((c) => {
9199
+ splits: ((_e = bankTransaction.category) == null ? void 0 : _e.entries) ? (_f = bankTransaction.category) == null ? void 0 : _f.entries.map((c) => {
9200
9200
  return c.type === "ExclusionSplitEntry" && c.category.type === "ExclusionNested" ? {
9201
9201
  amount: c.amount || 0,
9202
9202
  inputValue: centsToDollars(c.amount),
@@ -9210,7 +9210,7 @@ var ExpandedBankTransactionRow = (0, import_react59.forwardRef)(
9210
9210
  {
9211
9211
  amount: bankTransaction.amount,
9212
9212
  inputValue: centsToDollars(bankTransaction.amount),
9213
- category: mapCategoryToOption2(defaultCategory)
9213
+ category: defaultCategory ? mapCategoryToOption2(defaultCategory) : void 0
9214
9214
  }
9215
9215
  ],
9216
9216
  description: "",
@@ -9223,7 +9223,7 @@ var ExpandedBankTransactionRow = (0, import_react59.forwardRef)(
9223
9223
  {
9224
9224
  amount: 0,
9225
9225
  inputValue: "0.00",
9226
- category: mapCategoryToOption2(defaultCategory)
9226
+ category: defaultCategory ? mapCategoryToOption2(defaultCategory) : void 0
9227
9227
  }
9228
9228
  ]
9229
9229
  }));
@@ -9679,7 +9679,7 @@ var getDefaultSelectedCategory = (bankTransaction) => {
9679
9679
  if ((_a = bankTransaction.suggested_matches) == null ? void 0 : _a[0]) {
9680
9680
  return mapSuggestedMatchToOption((_b = bankTransaction.suggested_matches) == null ? void 0 : _b[0]);
9681
9681
  }
9682
- if (hasSuggestions(bankTransaction.categorization_flow)) {
9682
+ if (hasSuggestions(bankTransaction.categorization_flow) && bankTransaction.categorization_flow.suggestions.length > 0) {
9683
9683
  return mapCategoryToOption2(
9684
9684
  bankTransaction.categorization_flow.suggestions[0]
9685
9685
  );
@@ -61,7 +61,7 @@ import { useState as useState8 } from "react";
61
61
  import { useReducer, useEffect as useEffect4 } from "react";
62
62
 
63
63
  // package.json
64
- var version = "0.1.88-alpha.1";
64
+ var version = "0.1.88-alpha.2";
65
65
 
66
66
  // src/models/APIError.ts
67
67
  var APIError = class _APIError extends Error {
@@ -9177,7 +9177,7 @@ var ExpandedBankTransactionRow = forwardRef10(
9177
9177
  showReceiptUploads,
9178
9178
  showTooltips
9179
9179
  }, ref) => {
9180
- var _a, _b, _c, _d, _e, _f, _g;
9180
+ var _a, _b, _c, _d, _e, _f;
9181
9181
  const {
9182
9182
  categorize: categorizeBankTransaction2,
9183
9183
  match: matchBankTransaction2
@@ -9198,9 +9198,9 @@ var ExpandedBankTransactionRow = forwardRef10(
9198
9198
  const { businessId } = useLayerContext();
9199
9199
  const { apiUrl } = useEnvironment();
9200
9200
  const { data: auth } = useAuth();
9201
- const defaultCategory = bankTransaction.category || hasSuggestions(bankTransaction.categorization_flow) && ((_e = (_d = bankTransaction.categorization_flow) == null ? void 0 : _d.suggestions) == null ? void 0 : _e[0]);
9201
+ const defaultCategory = bankTransaction.category ? bankTransaction.category : hasSuggestions(bankTransaction.categorization_flow) ? (_d = bankTransaction.categorization_flow) == null ? void 0 : _d.suggestions.at(0) : void 0;
9202
9202
  const [rowState, updateRowState] = useState22({
9203
- splits: ((_f = bankTransaction.category) == null ? void 0 : _f.entries) ? (_g = bankTransaction.category) == null ? void 0 : _g.entries.map((c) => {
9203
+ splits: ((_e = bankTransaction.category) == null ? void 0 : _e.entries) ? (_f = bankTransaction.category) == null ? void 0 : _f.entries.map((c) => {
9204
9204
  return c.type === "ExclusionSplitEntry" && c.category.type === "ExclusionNested" ? {
9205
9205
  amount: c.amount || 0,
9206
9206
  inputValue: centsToDollars(c.amount),
@@ -9214,7 +9214,7 @@ var ExpandedBankTransactionRow = forwardRef10(
9214
9214
  {
9215
9215
  amount: bankTransaction.amount,
9216
9216
  inputValue: centsToDollars(bankTransaction.amount),
9217
- category: mapCategoryToOption2(defaultCategory)
9217
+ category: defaultCategory ? mapCategoryToOption2(defaultCategory) : void 0
9218
9218
  }
9219
9219
  ],
9220
9220
  description: "",
@@ -9227,7 +9227,7 @@ var ExpandedBankTransactionRow = forwardRef10(
9227
9227
  {
9228
9228
  amount: 0,
9229
9229
  inputValue: "0.00",
9230
- category: mapCategoryToOption2(defaultCategory)
9230
+ category: defaultCategory ? mapCategoryToOption2(defaultCategory) : void 0
9231
9231
  }
9232
9232
  ]
9233
9233
  }));
@@ -9683,7 +9683,7 @@ var getDefaultSelectedCategory = (bankTransaction) => {
9683
9683
  if ((_a = bankTransaction.suggested_matches) == null ? void 0 : _a[0]) {
9684
9684
  return mapSuggestedMatchToOption((_b = bankTransaction.suggested_matches) == null ? void 0 : _b[0]);
9685
9685
  }
9686
- if (hasSuggestions(bankTransaction.categorization_flow)) {
9686
+ if (hasSuggestions(bankTransaction.categorization_flow) && bankTransaction.categorization_flow.suggestions.length > 0) {
9687
9687
  return mapCategoryToOption2(
9688
9688
  bankTransaction.categorization_flow.suggestions[0]
9689
9689
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@layerfi/components",
3
- "version": "0.1.88-alpha.1",
3
+ "version": "0.1.88-alpha.2",
4
4
  "description": "Layer React Components",
5
5
  "main": "dist/cjs/index.cjs",
6
6
  "module": "dist/esm/index.mjs",