@tesouro/embedded-components-react 0.11.221 → 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.
- package/dist/fixtures/index.d.ts +135 -112
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/cardExpenseTypes.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/queryKeys.js +13 -13
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/useExpenseHistoryQuery.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/useExpenseTransactionsCountQuery.js +18 -16
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/useGetTransactionQuery.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/useGetTransactionsQuery.js +17 -13
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/useTransactionReviewMutations.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/useTransactionValidationsQuery.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/ExpenseManagementWidget/mapTransactionRow.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/ExpenseManagementWidget/useExpensesTransactions.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/ExpenseManagementWidget/useExpensesTransactionsFilter.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/mocks/expenseManagement.js +13 -13
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/feature/dist/index2.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/mocks/settings.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +3 -3
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +118 -118
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +174 -174
- package/dist/libs/tesouro-embedded-components-react/shared/data-access-mocks/dist/lib/fixtures.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/shared/expense-requirements/data-access/dist/index2.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/expense-requirements/data-access/dist/index3.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
package/dist/fixtures/index.d.ts
CHANGED
|
@@ -2004,6 +2004,138 @@ type ExpenseReceiptUnlinkedEventData = {
|
|
|
2004
2004
|
*/
|
|
2005
2005
|
receipt_id: string;
|
|
2006
2006
|
};
|
|
2007
|
+
type ExpenseResponse = {
|
|
2008
|
+
/**
|
|
2009
|
+
* A unique system-generated ID assigned to this transaction.
|
|
2010
|
+
*/
|
|
2011
|
+
id: string;
|
|
2012
|
+
/**
|
|
2013
|
+
* The transaction amount in [minor units](https://docs.tesouro.com/finops/support/currencies#minor-units). Positive values for in-flow, negative values for out-flow.
|
|
2014
|
+
*/
|
|
2015
|
+
amount: number;
|
|
2016
|
+
/**
|
|
2017
|
+
* ID of the approval policy applied to this transaction, if any.
|
|
2018
|
+
*/
|
|
2019
|
+
applied_policy_id?: string | null;
|
|
2020
|
+
/**
|
|
2021
|
+
* ISO currency code.
|
|
2022
|
+
*/
|
|
2023
|
+
currency: CurrencyEnum;
|
|
2024
|
+
/**
|
|
2025
|
+
* ID of the department associated with this transaction.
|
|
2026
|
+
*/
|
|
2027
|
+
department_id?: string | null;
|
|
2028
|
+
/**
|
|
2029
|
+
* A human-readable description of the transaction.
|
|
2030
|
+
*/
|
|
2031
|
+
description?: string | null;
|
|
2032
|
+
/**
|
|
2033
|
+
* ID of the entity that owns this resource.
|
|
2034
|
+
*/
|
|
2035
|
+
entity_id: string;
|
|
2036
|
+
/**
|
|
2037
|
+
* ID of the entity user who owns the transaction. Must be an active or invited user of the organization. When omitted and the request is made as an entity user, the caller becomes the owner; an explicit null leaves the transaction unowned. A caller limited to their own transactions may only name themselves or one of their direct reportees, and becomes the owner when the field is null.
|
|
2038
|
+
*/
|
|
2039
|
+
entity_user_id?: string | null;
|
|
2040
|
+
/**
|
|
2041
|
+
* The current expense approval status of the transaction.
|
|
2042
|
+
*/
|
|
2043
|
+
expense_status: ExpenseStatusEnum;
|
|
2044
|
+
/**
|
|
2045
|
+
* External identifier for idempotency, if provided by the source system.
|
|
2046
|
+
*/
|
|
2047
|
+
external_id?: string | null;
|
|
2048
|
+
/**
|
|
2049
|
+
* Whether the transaction has missing required fields per the entity's TransactionValidation config. Always false when no config is set.
|
|
2050
|
+
*/
|
|
2051
|
+
has_validation_errors: boolean;
|
|
2052
|
+
/**
|
|
2053
|
+
* ID of the ledger account from the Accounting service.
|
|
2054
|
+
*/
|
|
2055
|
+
ledger_account_id?: string | null;
|
|
2056
|
+
/**
|
|
2057
|
+
* ID of the location associated with this transaction.
|
|
2058
|
+
*/
|
|
2059
|
+
location_id?: string | null;
|
|
2060
|
+
/**
|
|
2061
|
+
* Original merchant transaction amount in minor units.
|
|
2062
|
+
*/
|
|
2063
|
+
merchant_amount: number;
|
|
2064
|
+
/**
|
|
2065
|
+
* ISO currency code for the `merchant_amount`.
|
|
2066
|
+
*/
|
|
2067
|
+
merchant_currency: CurrencyEnum;
|
|
2068
|
+
/**
|
|
2069
|
+
* The merchant location. Always set on cards, optional on reimbursements.
|
|
2070
|
+
*/
|
|
2071
|
+
merchant_location?: string | null;
|
|
2072
|
+
/**
|
|
2073
|
+
* The merchant name.
|
|
2074
|
+
*/
|
|
2075
|
+
merchant_name: string;
|
|
2076
|
+
/**
|
|
2077
|
+
* Reason provided by the employee when submitting without a receipt (e.g. receipt was lost or unavailable). Set via the submit endpoint; bypasses the receipt_id required-field check.
|
|
2078
|
+
*/
|
|
2079
|
+
no_receipt_reason?: string | null;
|
|
2080
|
+
/**
|
|
2081
|
+
* When a reimbursement was paid out. Null until paid.
|
|
2082
|
+
*/
|
|
2083
|
+
paid_at?: string | null;
|
|
2084
|
+
/**
|
|
2085
|
+
* ID of the entity user who marked a reimbursement paid. Null until paid.
|
|
2086
|
+
*/
|
|
2087
|
+
paid_by_entity_user_id?: string | null;
|
|
2088
|
+
/**
|
|
2089
|
+
* Extensible key-value pairs for storing additional custom information for partner needs.
|
|
2090
|
+
*/
|
|
2091
|
+
partner_metadata?: {
|
|
2092
|
+
[key: string]: string;
|
|
2093
|
+
} | null;
|
|
2094
|
+
/**
|
|
2095
|
+
* How a card expense was paid. Always set on cards, null on reimbursements.
|
|
2096
|
+
*/
|
|
2097
|
+
payment_method?: TransactionPaymentMethod | null;
|
|
2098
|
+
/**
|
|
2099
|
+
* The current processing status of the transaction.
|
|
2100
|
+
*/
|
|
2101
|
+
payment_processing_status?: TransactionStatusEnum;
|
|
2102
|
+
/**
|
|
2103
|
+
* How a reimbursement was paid out. Null until paid.
|
|
2104
|
+
*/
|
|
2105
|
+
payout_method?: PayoutMethodEnum | null;
|
|
2106
|
+
/**
|
|
2107
|
+
* Whether a reimbursement has been paid out to the employee. Null on cards.
|
|
2108
|
+
*/
|
|
2109
|
+
payout_status?: PayoutStatusEnum | null;
|
|
2110
|
+
/**
|
|
2111
|
+
* URL of the attached receipt's file. Present when receipt_id is set and the receipt is reachable; null otherwise.
|
|
2112
|
+
*/
|
|
2113
|
+
receipt_file_url?: string | null;
|
|
2114
|
+
/**
|
|
2115
|
+
* ID of the related receipt from payables service, if any.
|
|
2116
|
+
*/
|
|
2117
|
+
receipt_id?: string | null;
|
|
2118
|
+
/**
|
|
2119
|
+
* Optional reason explaining why the transaction was rejected.
|
|
2120
|
+
*/
|
|
2121
|
+
reject_reason?: string | null;
|
|
2122
|
+
/**
|
|
2123
|
+
* Per-field source tracking. Each field indicates how its value was set: user, generated, or automatched.
|
|
2124
|
+
*/
|
|
2125
|
+
source_of_data?: SourceOfData | null;
|
|
2126
|
+
/**
|
|
2127
|
+
* Date and time when the transaction was initiated.
|
|
2128
|
+
*/
|
|
2129
|
+
started_at: string;
|
|
2130
|
+
/**
|
|
2131
|
+
* The kind of charge, such as a capture or a refund.
|
|
2132
|
+
*/
|
|
2133
|
+
subtype: ExpenseSubtypeEnum;
|
|
2134
|
+
/**
|
|
2135
|
+
* The kind of expense.
|
|
2136
|
+
*/
|
|
2137
|
+
type: ExpenseTypeEnum;
|
|
2138
|
+
};
|
|
2007
2139
|
type ExpenseStatusChangedEventData = {
|
|
2008
2140
|
approval_policy_id?: string | null;
|
|
2009
2141
|
approval_policy_name?: string | null;
|
|
@@ -2049,6 +2181,7 @@ type ExpenseSubmittedEventData = {
|
|
|
2049
2181
|
*/
|
|
2050
2182
|
old_status: ExpenseStatusEnum;
|
|
2051
2183
|
};
|
|
2184
|
+
type ExpenseSubtypeEnum = 'capture' | 'refund' | 'cash_withdrawal' | 'fee' | 'adjustment' | 'reversal' | 'out_of_pocket';
|
|
2052
2185
|
type ExpenseTypeEnum = 'card' | 'reimbursement';
|
|
2053
2186
|
type ExpenseUpdatedEventData = {
|
|
2054
2187
|
fields?: {
|
|
@@ -4596,117 +4729,7 @@ type TransactionRequiredFieldItem = {
|
|
|
4596
4729
|
amount_threshold?: number | null;
|
|
4597
4730
|
field: TransactionFieldsAllowedForValidate;
|
|
4598
4731
|
};
|
|
4599
|
-
type TransactionResponse = {
|
|
4600
|
-
/**
|
|
4601
|
-
* A unique system-generated ID assigned to this transaction.
|
|
4602
|
-
*/
|
|
4603
|
-
id: string;
|
|
4604
|
-
/**
|
|
4605
|
-
* The transaction amount in [minor units](https://docs.tesouro.com/finops/support/currencies#minor-units). Positive values for in-flow, negative values for out-flow.
|
|
4606
|
-
*/
|
|
4607
|
-
amount: number;
|
|
4608
|
-
/**
|
|
4609
|
-
* ID of the approval policy applied to this transaction, if any.
|
|
4610
|
-
*/
|
|
4611
|
-
applied_policy_id?: string | null;
|
|
4612
|
-
/**
|
|
4613
|
-
* ISO currency code.
|
|
4614
|
-
*/
|
|
4615
|
-
currency: CurrencyEnum;
|
|
4616
|
-
/**
|
|
4617
|
-
* ID of the department associated with this transaction.
|
|
4618
|
-
*/
|
|
4619
|
-
department_id?: string | null;
|
|
4620
|
-
/**
|
|
4621
|
-
* A human-readable description of the transaction.
|
|
4622
|
-
*/
|
|
4623
|
-
description?: string | null;
|
|
4624
|
-
/**
|
|
4625
|
-
* ID of the entity that owns this resource.
|
|
4626
|
-
*/
|
|
4627
|
-
entity_id: string;
|
|
4628
|
-
/**
|
|
4629
|
-
* ID of the entity user who owns the transaction. Must be an active or invited user of the organization. When omitted and the request is made as an entity user, the caller becomes the owner; an explicit null leaves the transaction unowned. A caller limited to their own transactions may only name themselves or one of their direct reportees, and becomes the owner when the field is null.
|
|
4630
|
-
*/
|
|
4631
|
-
entity_user_id?: string | null;
|
|
4632
|
-
/**
|
|
4633
|
-
* The current expense approval status of the transaction.
|
|
4634
|
-
*/
|
|
4635
|
-
expense_status: ExpenseStatusEnum;
|
|
4636
|
-
/**
|
|
4637
|
-
* External identifier for idempotency, if provided by the source system.
|
|
4638
|
-
*/
|
|
4639
|
-
external_id?: string | null;
|
|
4640
|
-
/**
|
|
4641
|
-
* Whether the transaction has missing required fields per the entity's TransactionValidation config. Always false when no config is set.
|
|
4642
|
-
*/
|
|
4643
|
-
has_validation_errors: boolean;
|
|
4644
|
-
/**
|
|
4645
|
-
* ID of the ledger account from the Accounting service.
|
|
4646
|
-
*/
|
|
4647
|
-
ledger_account_id?: string | null;
|
|
4648
|
-
/**
|
|
4649
|
-
* ID of the location associated with this transaction.
|
|
4650
|
-
*/
|
|
4651
|
-
location_id?: string | null;
|
|
4652
|
-
/**
|
|
4653
|
-
* Original merchant transaction amount in minor units.
|
|
4654
|
-
*/
|
|
4655
|
-
merchant_amount: number;
|
|
4656
|
-
/**
|
|
4657
|
-
* ISO currency code for the `merchant_amount`.
|
|
4658
|
-
*/
|
|
4659
|
-
merchant_currency: CurrencyEnum;
|
|
4660
|
-
/**
|
|
4661
|
-
* The merchant location.
|
|
4662
|
-
*/
|
|
4663
|
-
merchant_location: string;
|
|
4664
|
-
/**
|
|
4665
|
-
* The merchant name.
|
|
4666
|
-
*/
|
|
4667
|
-
merchant_name: string;
|
|
4668
|
-
/**
|
|
4669
|
-
* Reason provided by the employee when submitting without a receipt (e.g. receipt was lost or unavailable). Set via the submit endpoint; bypasses the receipt_id required-field check.
|
|
4670
|
-
*/
|
|
4671
|
-
no_receipt_reason?: string | null;
|
|
4672
|
-
/**
|
|
4673
|
-
* Extensible key-value pairs for storing additional custom information for partner needs.
|
|
4674
|
-
*/
|
|
4675
|
-
partner_metadata?: {
|
|
4676
|
-
[key: string]: string;
|
|
4677
|
-
} | null;
|
|
4678
|
-
payment_method: TransactionPaymentMethod;
|
|
4679
|
-
/**
|
|
4680
|
-
* The current processing status of the transaction.
|
|
4681
|
-
*/
|
|
4682
|
-
payment_processing_status?: TransactionStatusEnum;
|
|
4683
|
-
/**
|
|
4684
|
-
* URL of the attached receipt's file. Present when receipt_id is set and the receipt is reachable; null otherwise.
|
|
4685
|
-
*/
|
|
4686
|
-
receipt_file_url?: string | null;
|
|
4687
|
-
/**
|
|
4688
|
-
* ID of the related receipt from payables service, if any.
|
|
4689
|
-
*/
|
|
4690
|
-
receipt_id?: string | null;
|
|
4691
|
-
/**
|
|
4692
|
-
* Optional reason explaining why the transaction was rejected.
|
|
4693
|
-
*/
|
|
4694
|
-
reject_reason?: string | null;
|
|
4695
|
-
/**
|
|
4696
|
-
* Per-field source tracking. Each field indicates how its value was set: user, generated, or automatched.
|
|
4697
|
-
*/
|
|
4698
|
-
source_of_data?: SourceOfData | null;
|
|
4699
|
-
/**
|
|
4700
|
-
* Date and time when the transaction was initiated.
|
|
4701
|
-
*/
|
|
4702
|
-
started_at: string;
|
|
4703
|
-
/**
|
|
4704
|
-
* The nature of the transaction.
|
|
4705
|
-
*/
|
|
4706
|
-
type: TransactionTypeEnum;
|
|
4707
|
-
};
|
|
4708
4732
|
type TransactionStatusEnum = 'created' | 'processing' | 'succeeded' | 'declined' | 'refunded' | 'failed';
|
|
4709
|
-
type TransactionTypeEnum = 'capture' | 'refund' | 'cash_withdrawal' | 'fee' | 'adjustment' | 'reversal';
|
|
4710
4733
|
type TransactionValidationResponse = {
|
|
4711
4734
|
required_fields: Array<TransactionRequiredFieldItem>;
|
|
4712
4735
|
};
|
|
@@ -5074,7 +5097,7 @@ declare const A_DISCLOSURE_ACCEPTANCE: WidgetDisclosureAcceptance;
|
|
|
5074
5097
|
declare const A_RECEIPT: ReceiptResponseSchema;
|
|
5075
5098
|
/**
|
|
5076
5099
|
* The card transaction {@link A_RECEIPT} belongs to, as
|
|
5077
|
-
* `GET /finops/v1/
|
|
5100
|
+
* `GET /finops/v1/expenses` returns it.
|
|
5078
5101
|
*
|
|
5079
5102
|
* `amount` is **negative** because a purchase is an out-flow, which is how the
|
|
5080
5103
|
* API models it and what the seeded e2e expenses send. The picker's Amount
|
|
@@ -5084,7 +5107,7 @@ declare const A_RECEIPT: ReceiptResponseSchema;
|
|
|
5084
5107
|
* `merchant_name` matches the receipt's so a story's match reads as a plausible
|
|
5085
5108
|
* one, and `entity_user_id` matches for the same reason the receipt's does.
|
|
5086
5109
|
*/
|
|
5087
|
-
declare const A_TRANSACTION:
|
|
5110
|
+
declare const A_TRANSACTION: ExpenseResponse;
|
|
5088
5111
|
/**
|
|
5089
5112
|
* One expense approval policy, as `GET /finops/v1/approval-policies` returns it.
|
|
5090
5113
|
*
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import {
|
|
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 }) =>
|
|
8
|
+
}, l = ({ client: e, organizationId: t }) => o({
|
|
9
9
|
client: e,
|
|
10
10
|
headers: s(t)
|
|
11
|
-
}), u = ({ client: e, organizationId: t }) =>
|
|
11
|
+
}), u = ({ client: e, organizationId: t }) => i({
|
|
12
12
|
client: e,
|
|
13
13
|
headers: s(t)
|
|
14
|
-
}), d = ({ client:
|
|
15
|
-
client:
|
|
14
|
+
}), d = ({ client: e, organizationId: n }) => t({
|
|
15
|
+
client: e,
|
|
16
16
|
headers: s(n),
|
|
17
17
|
query: c
|
|
18
|
-
}), f = ({ client:
|
|
19
|
-
client:
|
|
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:
|
|
22
|
+
}), p = ({ client: e, organizationId: t, receiptId: n }) => a({
|
|
23
23
|
client: e,
|
|
24
24
|
headers: s(t),
|
|
25
|
-
path: { receipt_id:
|
|
26
|
-
}), m = ({ client: e, organizationId: t, transactionId: n }) =>
|
|
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: {
|
|
30
|
-
}), h = ({ client: e, organizationId: t, transactionId:
|
|
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: {
|
|
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 {
|
|
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: {
|
|
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 {
|
|
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 {
|
|
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
|
|
12
|
-
let { client:
|
|
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
|
-
...
|
|
15
|
+
...s,
|
|
16
|
+
type__in: o,
|
|
15
17
|
metric: "id",
|
|
16
18
|
aggregation_function: "count"
|
|
17
19
|
},
|
|
18
|
-
client:
|
|
19
|
-
headers: { "x-organization-id":
|
|
20
|
-
}),
|
|
21
|
-
...t(
|
|
22
|
-
authEpoch:
|
|
23
|
-
organizationStatus:
|
|
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:
|
|
26
|
-
}),
|
|
27
|
+
enabled: p
|
|
28
|
+
}), g = h.data?.data?.[0]?.metric_value;
|
|
27
29
|
return {
|
|
28
|
-
...
|
|
29
|
-
count:
|
|
30
|
+
...h,
|
|
31
|
+
count: g
|
|
30
32
|
};
|
|
31
33
|
}
|
|
32
|
-
export {
|
|
34
|
+
export { a as useExpenseTransactionsCountQuery };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
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: {
|
|
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 {
|
|
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 {
|
|
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
|
|
12
|
-
let { client:
|
|
13
|
-
query:
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
18
|
-
...t(
|
|
19
|
-
authEpoch:
|
|
20
|
-
organizationStatus:
|
|
21
|
+
return i({
|
|
22
|
+
...t(m, {
|
|
23
|
+
authEpoch: d,
|
|
24
|
+
organizationStatus: f
|
|
21
25
|
}, { carryWithinOrg: !0 }),
|
|
22
|
-
enabled:
|
|
26
|
+
enabled: p
|
|
23
27
|
});
|
|
24
28
|
}
|
|
25
|
-
export {
|
|
29
|
+
export { a as useGetTransactionsQuery };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
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: {
|
|
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: {
|
|
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: {
|
|
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: {
|
|
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: {
|
|
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 {
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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.
|
|
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)) {
|