@tesouro/embedded-components-react 0.11.220 → 0.11.222

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.
Files changed (36) hide show
  1. package/README.md +4 -3
  2. package/dist/fixtures/index.d.ts +135 -112
  3. package/dist/index.css +6 -5
  4. package/dist/index.d.ts +6 -5
  5. package/dist/lib/BillPayWidget.d.ts +4 -3
  6. package/dist/lib/ReceivablesWidget.d.ts +2 -2
  7. package/dist/lib/WidgetSuite.d.ts +1 -1
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillPayWidget.js +61 -51
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +6 -6
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index14.js +48 -37
  11. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/cardExpenseTypes.js +3 -0
  12. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/queryKeys.js +13 -13
  13. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/useExpenseHistoryQuery.js +2 -2
  14. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/useExpenseTransactionsCountQuery.js +18 -16
  15. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/useGetTransactionQuery.js +2 -2
  16. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/useGetTransactionsQuery.js +17 -13
  17. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/useTransactionReviewMutations.js +6 -6
  18. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/useTransactionValidationsQuery.js +1 -1
  19. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/ExpenseManagementWidget/mapTransactionRow.js +2 -2
  20. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/ExpenseManagementWidget/useExpensesTransactions.js +2 -2
  21. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/ExpenseManagementWidget/useExpensesTransactionsFilter.js +1 -1
  22. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/mocks/expenseManagement.js +13 -13
  23. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/feature/dist/index2.js +1 -1
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +105 -97
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +21 -21
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +42 -35
  27. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/mocks/settings.js +2 -2
  28. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +3 -3
  29. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +118 -118
  30. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +174 -174
  31. package/dist/libs/tesouro-embedded-components-react/shared/data-access-mocks/dist/lib/fixtures.js +2 -1
  32. package/dist/libs/tesouro-embedded-components-react/shared/expense-requirements/data-access/dist/index2.js +1 -1
  33. package/dist/libs/tesouro-embedded-components-react/shared/expense-requirements/data-access/dist/index3.js +1 -1
  34. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetProvider.js +119 -119
  35. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  36. package/package.json +1 -1
@@ -4,55 +4,66 @@
4
4
  "use client";
5
5
  import { Button as e, Tabs as t, TabsContent as n, TabsList as r, TabsTrigger as i, Tooltip as a, TooltipContent as o, TooltipProvider as s, TooltipTrigger as c } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
6
  import { DEFAULT_LABELS as l } from "./index13.js";
7
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
8
- import { SettingsIcon as f } from "lucide-react";
7
+ import { createPortal as u } from "react-dom";
8
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
9
+ import { SettingsIcon as p } from "lucide-react";
9
10
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index14.js
10
- function p({ labels: p, tabs: m, selectedTabId: h, onTabChange: g, onSettingsClick: _, actionContainerRef: v }) {
11
- let y = {
11
+ function m({ labels: e, headerStart: t, settingsContainerRef: n }) {
12
+ let r = {
12
13
  ...l,
13
- ...p
14
+ ...e
14
15
  };
15
- return /* @__PURE__ */ d("section", {
16
- className: "ttw:w-full ttw:space-y-5",
17
- children: [y.description ? /* @__PURE__ */ u("div", {
18
- className: "ttw:min-w-0",
19
- children: /* @__PURE__ */ u("p", {
16
+ return /* @__PURE__ */ f("div", {
17
+ className: "ttw:mb-5 ttw:hidden ttw:items-start ttw:justify-between ttw:gap-4 ttw:has-[>:not(:empty)]:flex",
18
+ children: [/* @__PURE__ */ f("div", {
19
+ className: "ttw:flex ttw:min-w-0 ttw:flex-col ttw:gap-2",
20
+ children: [t, r.description ? /* @__PURE__ */ d("p", {
20
21
  className: "ttw:text-sm ttw:text-muted-foreground",
21
- children: y.description
22
+ children: r.description
23
+ }) : null]
24
+ }), /* @__PURE__ */ d("div", {
25
+ ref: n,
26
+ className: "ttw:flex ttw:items-center"
27
+ })]
28
+ });
29
+ }
30
+ function h({ labels: m, tabs: h, selectedTabId: g, onTabChange: _, onSettingsClick: v, settingsContainer: y, actionContainerRef: b }) {
31
+ let x = {
32
+ ...l,
33
+ ...m
34
+ };
35
+ return /* @__PURE__ */ f("section", {
36
+ className: "ttw:w-full",
37
+ children: [v && y ? u(/* @__PURE__ */ d(s, { children: /* @__PURE__ */ f(a, { children: [/* @__PURE__ */ d(c, {
38
+ asChild: !0,
39
+ children: /* @__PURE__ */ d(e, {
40
+ type: "button",
41
+ variant: "ghost",
42
+ size: "icon",
43
+ "aria-label": x.settingsButton,
44
+ onClick: v,
45
+ children: /* @__PURE__ */ d(p, {
46
+ className: "ttw:size-5",
47
+ "aria-hidden": !0
48
+ })
22
49
  })
23
- }) : null, /* @__PURE__ */ d(t, {
24
- value: h,
25
- onValueChange: g,
50
+ }), /* @__PURE__ */ d(o, { children: x.settingsButton })] }) }), y) : null, /* @__PURE__ */ f(t, {
51
+ value: g,
52
+ onValueChange: _,
26
53
  className: "ttw:w-full",
27
- children: [/* @__PURE__ */ d("div", {
54
+ children: [/* @__PURE__ */ f("div", {
28
55
  className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-4",
29
- children: [/* @__PURE__ */ u(r, {
56
+ children: [/* @__PURE__ */ d(r, {
30
57
  variant: "underline",
31
- children: m.map((e) => /* @__PURE__ */ u(i, {
58
+ children: h.map((e) => /* @__PURE__ */ d(i, {
32
59
  value: e.id,
33
60
  children: e.label
34
61
  }, e.id))
35
62
  }), /* @__PURE__ */ d("div", {
36
- className: "ttw:flex ttw:items-center ttw:gap-2",
37
- children: [_ ? /* @__PURE__ */ u(s, { children: /* @__PURE__ */ d(a, { children: [/* @__PURE__ */ u(c, {
38
- asChild: !0,
39
- children: /* @__PURE__ */ u(e, {
40
- type: "button",
41
- variant: "ghost",
42
- size: "icon",
43
- "aria-label": y.settingsButton,
44
- onClick: _,
45
- children: /* @__PURE__ */ u(f, {
46
- className: "ttw:size-5",
47
- "aria-hidden": !0
48
- })
49
- })
50
- }), /* @__PURE__ */ u(o, { children: y.settingsButton })] }) }) : null, /* @__PURE__ */ u("div", {
51
- ref: v,
52
- className: "ttw:contents"
53
- })]
63
+ ref: b,
64
+ className: "ttw:flex ttw:items-center ttw:gap-2"
54
65
  })]
55
- }), m.map((e) => /* @__PURE__ */ u(n, {
66
+ }), h.map((e) => /* @__PURE__ */ d(n, {
56
67
  value: e.id,
57
68
  className: "ttw:mt-6",
58
69
  children: e.content
@@ -60,4 +71,4 @@ function p({ labels: p, tabs: m, selectedTabId: h, onTabChange: g, onSettingsCli
60
71
  })]
61
72
  });
62
73
  }
63
- export { p as BillPayWidgetUi };
74
+ export { m as BillPayWidgetHeaderUi, h as BillPayWidgetUi };
@@ -0,0 +1,3 @@
1
+ // ../../libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/cardExpenseTypes.js
2
+ var e = ["card"];
3
+ export { e as CARD_EXPENSE_TYPES };
@@ -1,35 +1,35 @@
1
- import { getAnalyticsReceiptsQueryKey as e, getAnalyticsTransactionsQueryKey as t, getReceiptsIdQueryKey as n, getReceiptsQueryKey as r, getTransactionsIdExpenseHistoryQueryKey as i, getTransactionsIdQueryKey as a, getTransactionsQueryKey as o } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
1
+ import { getAnalyticsExpensesQueryKey as e, getAnalyticsReceiptsQueryKey as t, getExpensesIdExpenseHistoryQueryKey as n, getExpensesIdQueryKey as r, getExpensesQueryKey as i, getReceiptsIdQueryKey as a, getReceiptsQueryKey as o } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
2
2
  import { organizationHeaders as s } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
3
3
  import "../../../../shared/data-access/dist/index.js";
4
4
  // ../../libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/queryKeys.js
5
5
  var c = {
6
6
  metric: "id",
7
7
  aggregation_function: "count"
8
- }, l = ({ client: e, organizationId: t }) => r({
8
+ }, l = ({ client: e, organizationId: t }) => o({
9
9
  client: e,
10
10
  headers: s(t)
11
- }), u = ({ client: e, organizationId: t }) => o({
11
+ }), u = ({ client: e, organizationId: t }) => i({
12
12
  client: e,
13
13
  headers: s(t)
14
- }), d = ({ client: t, organizationId: n }) => e({
15
- client: t,
14
+ }), d = ({ client: e, organizationId: n }) => t({
15
+ client: e,
16
16
  headers: s(n),
17
17
  query: c
18
- }), f = ({ client: e, organizationId: n }) => t({
19
- client: e,
18
+ }), f = ({ client: t, organizationId: n }) => e({
19
+ client: t,
20
20
  headers: s(n),
21
21
  query: c
22
- }), p = ({ client: e, organizationId: t, receiptId: r }) => n({
22
+ }), p = ({ client: e, organizationId: t, receiptId: n }) => a({
23
23
  client: e,
24
24
  headers: s(t),
25
- path: { receipt_id: r }
26
- }), m = ({ client: e, organizationId: t, transactionId: n }) => a({
25
+ path: { receipt_id: n }
26
+ }), m = ({ client: e, organizationId: t, transactionId: n }) => r({
27
27
  client: e,
28
28
  headers: s(t),
29
- path: { transaction_id: n }
30
- }), h = ({ client: e, organizationId: t, transactionId: n }) => i({
29
+ path: { expense_id: n }
30
+ }), h = ({ client: e, organizationId: t, transactionId: r }) => n({
31
31
  client: e,
32
32
  headers: s(t),
33
- path: { transaction_id: n }
33
+ path: { expense_id: r }
34
34
  });
35
35
  export { c as EXPENSE_COUNT_ANALYTICS, d as analyticsReceiptsInvalidationKey, f as analyticsTransactionsInvalidationKey, p as receiptsIdInvalidationKey, l as receiptsInvalidationKey, h as transactionsIdExpenseHistoryInvalidationKey, m as transactionsIdInvalidationKey, u as transactionsInvalidationKey };
@@ -2,7 +2,7 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { getTransactionsIdExpenseHistoryOptions as e } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
5
+ import { getExpensesIdExpenseHistoryOptions as e } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
6
6
  import { withAuthEpoch as t } from "../../../../shared/data-access/dist/lib/withAuthEpoch.js";
7
7
  import { useEmbedApi as n } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
8
  import { organizationHeaders as r } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
@@ -14,7 +14,7 @@ function o({ transactionId: o, enabled: s = !0 } = {}) {
14
14
  let { client: c, organizationId: l, widgetToken: u, authEpoch: d, organizationStatus: f } = n(), p = e({
15
15
  client: c,
16
16
  headers: r(l),
17
- path: { transaction_id: o ?? "" },
17
+ path: { expense_id: o ?? "" },
18
18
  query: {
19
19
  order: "desc",
20
20
  limit: a
@@ -2,31 +2,33 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { getAnalyticsTransactionsOptions as e } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
5
+ import { getAnalyticsExpensesOptions as e } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
6
6
  import { withAuthEpoch as t } from "../../../../shared/data-access/dist/lib/withAuthEpoch.js";
7
7
  import { useEmbedApi as n } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
8
  import "../../../../shared/data-access/dist/index.js";
9
- import { useQuery as r } from "@tanstack/react-query";
9
+ import { CARD_EXPENSE_TYPES as r } from "./cardExpenseTypes.js";
10
+ import { useQuery as i } from "@tanstack/react-query";
10
11
  // ../../libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/useExpenseTransactionsCountQuery.js
11
- function i({ enabled: i, ...a } = {}) {
12
- let { client: o, organizationId: s, widgetToken: c, authEpoch: l, organizationStatus: u } = n(), d = !!(s && c) && (i === !0 || i === void 0), f = e({
12
+ function a({ enabled: a, type__in: o = r, ...s } = {}) {
13
+ let { client: c, organizationId: l, widgetToken: u, authEpoch: d, organizationStatus: f } = n(), p = !!(l && u) && (a === !0 || a === void 0), m = e({
13
14
  query: {
14
- ...a,
15
+ ...s,
16
+ type__in: o,
15
17
  metric: "id",
16
18
  aggregation_function: "count"
17
19
  },
18
- client: o,
19
- headers: { "x-organization-id": s ?? "" }
20
- }), p = r({
21
- ...t(f, {
22
- authEpoch: l,
23
- organizationStatus: u
20
+ client: c,
21
+ headers: { "x-organization-id": l ?? "" }
22
+ }), h = i({
23
+ ...t(m, {
24
+ authEpoch: d,
25
+ organizationStatus: f
24
26
  }),
25
- enabled: d
26
- }), m = p.data?.data?.[0]?.metric_value;
27
+ enabled: p
28
+ }), g = h.data?.data?.[0]?.metric_value;
27
29
  return {
28
- ...p,
29
- count: m
30
+ ...h,
31
+ count: g
30
32
  };
31
33
  }
32
- export { i as useExpenseTransactionsCountQuery };
34
+ export { a as useExpenseTransactionsCountQuery };
@@ -2,7 +2,7 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { getTransactionsIdOptions as e } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
5
+ import { getExpensesIdOptions as e } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
6
6
  import { withAuthEpoch as t } from "../../../../shared/data-access/dist/lib/withAuthEpoch.js";
7
7
  import { useEmbedApi as n } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
8
  import "../../../../shared/data-access/dist/index.js";
@@ -12,7 +12,7 @@ function i({ transactionId: i, enabled: a } = {}) {
12
12
  let { client: o, organizationId: s, widgetToken: c, authEpoch: l, organizationStatus: u } = n(), d = !!(s && c && i) && (a === !0 || a === void 0), f = e({
13
13
  client: o,
14
14
  headers: { "x-organization-id": s ?? "" },
15
- path: { transaction_id: i ?? "" }
15
+ path: { expense_id: i ?? "" }
16
16
  });
17
17
  return r({
18
18
  ...t(f, {
@@ -2,24 +2,28 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { getTransactionsOptions as e } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
5
+ import { getExpensesOptions as e } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
6
6
  import { withAuthEpoch as t } from "../../../../shared/data-access/dist/lib/withAuthEpoch.js";
7
7
  import { useEmbedApi as n } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
8
  import "../../../../shared/data-access/dist/index.js";
9
- import { useQuery as r } from "@tanstack/react-query";
9
+ import { CARD_EXPENSE_TYPES as r } from "./cardExpenseTypes.js";
10
+ import { useQuery as i } from "@tanstack/react-query";
10
11
  // ../../libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/useGetTransactionsQuery.js
11
- function i({ enabled: i, ...a } = {}) {
12
- let { client: o, organizationId: s, widgetToken: c, authEpoch: l, organizationStatus: u } = n(), d = !!(s && c) && (i === !0 || i === void 0), f = e({
13
- query: a,
14
- client: o,
15
- headers: { "x-organization-id": s ?? "" }
12
+ function a({ enabled: a, type__in: o = r, ...s } = {}) {
13
+ let { client: c, organizationId: l, widgetToken: u, authEpoch: d, organizationStatus: f } = n(), p = !!(l && u) && (a === !0 || a === void 0), m = e({
14
+ query: {
15
+ ...s,
16
+ type__in: o
17
+ },
18
+ client: c,
19
+ headers: { "x-organization-id": l ?? "" }
16
20
  });
17
- return r({
18
- ...t(f, {
19
- authEpoch: l,
20
- organizationStatus: u
21
+ return i({
22
+ ...t(m, {
23
+ authEpoch: d,
24
+ organizationStatus: f
21
25
  }, { carryWithinOrg: !0 }),
22
- enabled: d
26
+ enabled: p
23
27
  });
24
28
  }
25
- export { i as useGetTransactionsQuery };
29
+ export { a as useGetTransactionsQuery };
@@ -2,7 +2,7 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { patchTransactionsId as e, postApprovalRequestsIdApprove as t, postApprovalRequestsIdReject as n, postTransactionsIdApprove as r, postTransactionsIdReject as i, postTransactionsIdReopen as a, postTransactionsIdSubmit as o } from "../../../../shared/data-access/dist/lib/rest/sdk.gen.js";
5
+ import { patchExpensesId as e, postApprovalRequestsIdApprove as t, postApprovalRequestsIdReject as n, postExpensesIdApprove as r, postExpensesIdReject as i, postExpensesIdReopen as a, postExpensesIdSubmit as o } from "../../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
6
  import { useEmbedApi as s } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
7
7
  import { organizationHeaders as c } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
8
8
  import "../../../../shared/data-access/dist/index.js";
@@ -16,7 +16,7 @@ function d() {
16
16
  let { data: i } = await r({
17
17
  client: e,
18
18
  headers: c(t),
19
- path: { transaction_id: n },
19
+ path: { expense_id: n },
20
20
  throwOnError: !0
21
21
  });
22
22
  return i;
@@ -37,7 +37,7 @@ function f() {
37
37
  let { data: a } = await i({
38
38
  client: e,
39
39
  headers: c(t),
40
- path: { transaction_id: n },
40
+ path: { expense_id: n },
41
41
  body: { reject_reason: r },
42
42
  throwOnError: !0
43
43
  });
@@ -59,7 +59,7 @@ function p() {
59
59
  let { data: i } = await o({
60
60
  client: e,
61
61
  headers: c(t),
62
- path: { transaction_id: n },
62
+ path: { expense_id: n },
63
63
  body: r ?? {},
64
64
  throwOnError: !0
65
65
  });
@@ -81,7 +81,7 @@ function m() {
81
81
  let { data: r } = await a({
82
82
  client: e,
83
83
  headers: c(t),
84
- path: { transaction_id: n },
84
+ path: { expense_id: n },
85
85
  throwOnError: !0
86
86
  });
87
87
  return r;
@@ -102,7 +102,7 @@ function h() {
102
102
  let { data: a } = await e({
103
103
  client: t,
104
104
  headers: c(n),
105
- path: { transaction_id: r },
105
+ path: { expense_id: r },
106
106
  body: i,
107
107
  throwOnError: !0
108
108
  });
@@ -2,7 +2,7 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { getTransactionsValidationsOptions as e } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
5
+ import { getExpensesValidationsOptions as e } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
6
6
  import { withAuthEpoch as t } from "../../../../shared/data-access/dist/lib/withAuthEpoch.js";
7
7
  import { useEmbedApi as n } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
8
  import "../../../../shared/data-access/dist/index.js";
@@ -5,14 +5,14 @@ import { EXPENSE_STATUS_BADGE_LABELS_EN as n, resolveExpenseStatusBadge as r, to
5
5
  // ../../libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/ExpenseManagementWidget/mapTransactionRow.js
6
6
  var a = "—", o = "Physical";
7
7
  function s(e) {
8
- return e.type === "refund" ? `Refund from ${e.merchant_name}` : e.type === "fee" ? `Fee from ${e.merchant_name}` : e.type === "cash_withdrawal" ? `Cash withdrawal from ${e.merchant_name}` : e.merchant_name;
8
+ return e.subtype === "refund" ? `Refund from ${e.merchant_name}` : e.subtype === "fee" ? `Fee from ${e.merchant_name}` : e.subtype === "cash_withdrawal" ? `Cash withdrawal from ${e.merchant_name}` : e.merchant_name;
9
9
  }
10
10
  function c(e) {
11
11
  let n = t(Math.abs((e.merchant_amount ?? 0) / 100), {
12
12
  currencyCode: e.merchant_currency,
13
13
  includeSpaceAfterCurrencySymbol: !1
14
14
  });
15
- return e.type === "refund" ? `+ ${n}` : n;
15
+ return e.subtype === "refund" ? `+ ${n}` : n;
16
16
  }
17
17
  function l(e) {
18
18
  return e ? e.type === "card" ? {
@@ -97,14 +97,14 @@ function d({ scope: d, cardholderByUserId: f, enabled: p = !0, statusBadgeLabels
97
97
  N();
98
98
  }), [F, N]), ye = a(F((e) => {
99
99
  j([e]);
100
- }), [F, j]), W = p && !h && (d === "team" || !!g), G = oe(d, g, ue), be = G.type__in ?? [...ae], K = b[0], q = K ? u[K.id] : void 0, xe = (q ? !K.desc : !1) == (q === "merchant_amount") ? "desc" : "asc", { data: J, isLoading: Se, isFetching: Ce, isError: we, refetch: Te } = n({
100
+ }), [F, j]), W = p && !h && (d === "team" || !!g), G = oe(d, g, ue), be = G.subtype__in ?? [...ae], K = b[0], q = K ? u[K.id] : void 0, xe = (q ? !K.desc : !1) == (q === "merchant_amount") ? "desc" : "asc", { data: J, isLoading: Se, isFetching: Ce, isError: we, refetch: Te } = n({
101
101
  enabled: W,
102
102
  limit: y,
103
103
  pagination_token: _,
104
104
  sort: q ?? re,
105
105
  order: xe,
106
106
  ...G,
107
- type__in: be
107
+ subtype__in: be
108
108
  }), Ee = o(() => {
109
109
  let e = [];
110
110
  for (let t of J?.data ?? []) t.department_id && !e.includes(t.department_id) && e.push(t.department_id);
@@ -86,7 +86,7 @@ function d() {
86
86
  function f() {
87
87
  let [f, p] = i(d), m = r(() => {
88
88
  let e = {};
89
- if (f.dateFrom && (e.started_at__gt = s(o(f.dateFrom), 1).toISOString()), f.dateTo && (e.started_at__lt = o(a(f.dateTo, 1)).toISOString()), f.paymentStatus.length && (e.payment_processing_status__in = f.paymentStatus), f.approvalStatus.length && (e.expense_status__in = f.approvalStatus), f.types.length && (e.type__in = f.types.flatMap((e) => e.split(","))), f.teamMemberIds.length && (e.entity_user_id__in = f.teamMemberIds), f.cardOnly && (e.payment_method__in = ["card"]), f.amountMode !== "any") {
89
+ if (f.dateFrom && (e.started_at__gt = s(o(f.dateFrom), 1).toISOString()), f.dateTo && (e.started_at__lt = o(a(f.dateTo, 1)).toISOString()), f.paymentStatus.length && (e.payment_processing_status__in = f.paymentStatus), f.approvalStatus.length && (e.expense_status__in = f.approvalStatus), f.types.length && (e.subtype__in = f.types.flatMap((e) => e.split(","))), f.teamMemberIds.length && (e.entity_user_id__in = f.teamMemberIds), f.cardOnly && (e.payment_method__in = ["card"]), f.amountMode !== "any") {
90
90
  let t = parseFloat(f.amountMin), n = parseFloat(f.amountMax);
91
91
  if (f.amountMode === "exact") {
92
92
  if (!Number.isNaN(t)) {
@@ -48,7 +48,7 @@ var D = (e) => `00000000-0000-4000-8000-000000000${String(400 + e).padStart(3, "
48
48
  }
49
49
  ], P = N[2]?.id ?? null, F = (e) => {
50
50
  let t = a.payment_method;
51
- return t.type === "card" ? {
51
+ return t?.type === "card" ? {
52
52
  ...t,
53
53
  details: {
54
54
  ...t.details,
@@ -288,7 +288,7 @@ function K(e) {
288
288
  let r = U(t, e);
289
289
  return r.length === 0 || n != null && r.includes(n);
290
290
  }, r = Math.abs(e.merchant_amount), i = t.get("amount__gt"), a = t.get("amount__lt"), o = t.get("created_at__gt"), s = t.get("created_at__lt"), c = t.get("merchant_name__icontains")?.toLowerCase(), l = W(t, "has_receipt"), u = W(t, "has_validation_errors");
291
- return n("entity_user_id__in", e.entity_user_id) && n("expense_status__in", e.expense_status) && n("type__in", e.type) && n("payment_processing_status__in", e.payment_processing_status) && n("payment_method__in", e.payment_method.type) && (l === void 0 || l === !!e.receipt_id) && (u === void 0 || u === k(e)) && (!c || e.merchant_name.toLowerCase().includes(c)) && (i === null || r > Number(i)) && (a === null || r < Number(a)) && (o === null || e.started_at > o) && (s === null || e.started_at < s);
291
+ return n("entity_user_id__in", e.entity_user_id) && n("expense_status__in", e.expense_status) && n("subtype__in", e.subtype) && n("payment_processing_status__in", e.payment_processing_status) && n("payment_method__in", e.payment_method?.type) && (l === void 0 || l === !!e.receipt_id) && (u === void 0 || u === k(e)) && (!c || e.merchant_name.toLowerCase().includes(c)) && (i === null || r > Number(i)) && (a === null || r < Number(a)) && (o === null || e.started_at > o) && (s === null || e.started_at < s);
292
292
  }, z = (e) => {
293
293
  let t = e.get("sort") === "merchant_amount" ? "merchant_amount" : "started_at", n = e.get("order") === "asc" ? 1 : -1;
294
294
  return I().filter((t) => L(t, e)).sort((e, r) => (e[t] < r[t] ? -1 : +(e[t] > r[t])) * n).map(A);
@@ -319,7 +319,7 @@ function K(e) {
319
319
  };
320
320
  return [
321
321
  K("/mailboxes", () => y({ data: [re] })),
322
- K("/transactions/validations", () => y(T)),
322
+ K("/expenses/validations", () => y(T)),
323
323
  K("/approval-policies", ({ query: e }) => y(S([t], e))),
324
324
  K("/ledger-accounts", ({ query: e }) => y(S(N, e))),
325
325
  K("/entity-users", ({ query: e }) => {
@@ -338,19 +338,19 @@ function K(e) {
338
338
  data: [l, u],
339
339
  nextPaginationToken: null
340
340
  }), m),
341
- K("/analytics/transactions", ({ query: e }) => Y(I().filter((t) => L(t, e)).length)),
341
+ K("/analytics/expenses", ({ query: e }) => Y(I().filter((t) => L(t, e)).length)),
342
342
  K("/analytics/receipts", ({ query: e }) => Y(X(e).length)),
343
- K("/transactions", ({ query: e }) => y(S(z(e), e))),
344
- K("/transactions/:id", (e, { id: t }) => {
343
+ K("/expenses", ({ query: e }) => y(S(z(e), e))),
344
+ K("/expenses/:id", (e, { id: t }) => {
345
345
  let n = j(t);
346
346
  return n ? y(A(n)) : q();
347
347
  }),
348
- K("/transactions/:id/expense-history", ({ query: e }, { id: t }) => y(S(c.get(t) ?? [], e))),
348
+ K("/expenses/:id/expense-history", ({ query: e }, { id: t }) => y(S(c.get(t) ?? [], e))),
349
349
  K("/approval-requests", ({ query: e }) => {
350
350
  let t = o.get(e.get("object_id") ?? "");
351
351
  return y(S(t ? [t] : [], e));
352
352
  }),
353
- V("PATCH", "/transactions/:id", (e, { id: t }) => {
353
+ V("PATCH", "/expenses/:id", (e, { id: t }) => {
354
354
  let n = g(e), r = j(t);
355
355
  if (!r) return q();
356
356
  let i = Object.fromEntries(Object.keys(n).map((e) => [e, "user"])), a = P(t, {
@@ -362,7 +362,7 @@ function K(e) {
362
362
  });
363
363
  return a && v(a, "expense_updated", { fields: Object.keys(n) }, O), a ? y(A(a)) : q();
364
364
  }),
365
- V("POST", "/transactions/:id/submit", (e, { id: n }) => {
365
+ V("POST", "/expenses/:id/submit", (e, { id: n }) => {
366
366
  let r = g(e), i = j(n);
367
367
  if (!i) return q();
368
368
  let a = Math.abs(i.merchant_amount) >= 1e4, s = P(n, {
@@ -377,18 +377,18 @@ function K(e) {
377
377
  no_receipt_reason: r.no_receipt_reason ?? null
378
378
  }, O), a ? (o.set(n, H(200 + o.size, s, "waiting")), v(s, "approval_requested", { approval_policy_name: t.name }, null)) : v(s, "auto_approved", {}, null), y(A(s))) : q();
379
379
  }),
380
- V("POST", "/transactions/:id/reopen", (e, { id: t }) => {
380
+ V("POST", "/expenses/:id/reopen", (e, { id: t }) => {
381
381
  let n = P(t, {
382
382
  expense_status: "new",
383
383
  reject_reason: null
384
384
  });
385
385
  return n && v(n, "reopened", {}, O), n ? y(A(n)) : q();
386
386
  }),
387
- V("POST", "/transactions/:id/approve", (e, { id: t }) => {
387
+ V("POST", "/expenses/:id/approve", (e, { id: t }) => {
388
388
  let n = j(t), r = n && J(n, "approved", "force");
389
389
  return r ? y(A(r)) : q();
390
390
  }),
391
- V("POST", "/transactions/:id/reject", (e, { id: t }) => {
391
+ V("POST", "/expenses/:id/reject", (e, { id: t }) => {
392
392
  let n = j(t), r = g(e)?.reject_reason, i = n && J(n, "rejected", "force", r);
393
393
  return i ? y(A(i)) : q();
394
394
  }),
@@ -429,7 +429,7 @@ var q = [
429
429
  e.ExpenseReadSelf,
430
430
  e.ExpenseWriteSelf,
431
431
  e.MailboxReadOrg
432
- ], J = ({ method: e, path: t }) => e === "GET" && (t === G("/transactions") || t.startsWith(G("/analytics/"))), Y = (e) => async (t) => {
432
+ ], J = ({ method: e, path: t }) => e === "GET" && (t === G("/expenses") || t.startsWith(G("/analytics/"))), Y = (e) => async (t) => {
433
433
  if (J(t)) {
434
434
  if (e === "failing") return b(500, "Internal Server Error", "Something went wrong.");
435
435
  await x(h);
@@ -152,7 +152,7 @@ function x({ preSelectedIds: t, onClose: m, targetTransactionId: h, onSingleTran
152
152
  if (I.length === 0 || !Y) return;
153
153
  let t = I, r = (e) => ({
154
154
  merchant: e.merchant_name,
155
- location: e.merchant_location,
155
+ location: e.merchant_location ?? "",
156
156
  date: n(e.started_at, { month: "long" }),
157
157
  time: ie(e.started_at),
158
158
  formattedAmount: p(e.amount, e.currency)