@tesouro/embedded-components-react 0.5.225 → 0.5.227
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/README.md +21 -21
- package/dist/index.d.ts +23 -2
- package/dist/index.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +23 -2
- package/dist/lib/ReceivablesWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/index3.js +41 -39
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index12.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index2.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index3.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index4.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index9.js +150 -147
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/data-access/dist/index5.js +46 -51
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index7.js +130 -128
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index18.js +31 -32
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index19.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index2.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index21.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index22.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index3.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index4.js +36 -37
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-upload/data-access/dist/index2.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-upload/feature/dist/index4.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/data-access/dist/index2.js +6 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/data-access/dist/index3.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/data-access/dist/index4.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/data-access/dist/index5.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/data-access/dist/index6.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/data-access/dist/index7.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/data-access/dist/index8.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index13.js +154 -150
- package/dist/libs/tesouro-embedded-components-react/cards-widget/create-card/data-access/dist/index7.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/cards-widget/data-access/dist/index2.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/cards-widget/data-access/dist/index3.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index9.js +151 -149
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/data-access/dist/index2.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/data-access/dist/index3.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index15.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index17.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index18.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index19.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index2.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index3.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index4.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index5.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index6.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index8.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index9.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index24.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index27.js +89 -87
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index5.js +133 -130
- package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index8.js +36 -34
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js +50 -36
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index12.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index3.js +40 -39
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +51 -32
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +20 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +17 -202
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +220 -31
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +32 -145
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +126 -44
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +145 -117
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js +46 -58
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +113 -87
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js +58 -116
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +98 -225
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index24.js +111 -27
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index25.js +225 -462
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index26.js +34 -41
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index27.js +627 -34
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index28.js +39 -77
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index29.js +34 -112
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index30.js +75 -310
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index31.js +124 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index32.js +324 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index6.js +20 -15
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js +56 -53
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +33 -29
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +184 -162
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +1 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +78 -69
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/data-access/dist/index4.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index9.js +209 -207
- package/dist/libs/tesouro-embedded-components-react/remote-check-capture/data-access/dist/index4.js +10 -5
- package/dist/libs/tesouro-embedded-components-react/remote-check-capture/data-access/dist/index5.js +10 -5
- package/dist/libs/tesouro-embedded-components-react/remote-check-capture/data-access/dist/index6.js +11 -6
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index2.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index3.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/settings-widget/profile/data-access/dist/index2.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index12.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index13.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index14.js +30 -28
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index17.js +28 -26
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index18.js +37 -34
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index21.js +28 -26
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index22.js +37 -34
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index17.js +294 -292
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index5.js +58 -58
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/data-access/dist/lib/approvalPoliciesApi.js +47 -48
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index3.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index5.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index7.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/CounterpartSelector.js +7 -6
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index15.js +20 -19
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +40 -39
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/EmbedApiContext.js +14 -13
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/allPages.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/applicationStatusQueryOptions.js +16 -15
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js +7 -5
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/debit-card/useAllDebitCardsQuery.js +7 -5
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/disclosures/useDisclosuresQuery.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/external-bank-account/useAllExternalBankAccountsQuery.js +7 -5
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/merchant-category-group/useAllMerchantCategoryGroupsQuery.js +28 -29
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/organizationStatus.js +10 -0
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js +26 -27
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/reference-data/usePaymentTermsQuery.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +210 -199
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +60 -52
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/role/useAllOrganizationRolesQuery.js +31 -32
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/role/useRolePermissionsQueries.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/useCurrentUserQuery.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/useGetUserDataQuery.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/useMailboxAddress.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/useMyEntityQuery.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js +33 -34
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/withAuthEpoch.js +33 -22
- package/dist/libs/tesouro-embedded-components-react/shared/expense-requirements/data-access/dist/index3.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/RootWidgetProvider.js +43 -32
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetProvider.js +138 -127
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/deriveOrganizationStatus.js +6 -0
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/useWidgetFetch.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index10.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index2.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index3.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index4.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index9.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/data-access/dist/index6.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index6.js +60 -58
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ import "../../../shared/data-access/dist/index.js";
|
|
|
9
9
|
import { useQuery as r } from "@tanstack/react-query";
|
|
10
10
|
//#region ../../libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index9.js
|
|
11
11
|
function i({ transactionId: i, enabled: a } = {}) {
|
|
12
|
-
let { client: o, organizationId: s, widgetToken: c, authEpoch: l,
|
|
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
15
|
path: { transaction_id: i ?? "" }
|
|
@@ -17,7 +17,7 @@ function i({ transactionId: i, enabled: a } = {}) {
|
|
|
17
17
|
return r({
|
|
18
18
|
...t(f, {
|
|
19
19
|
authEpoch: l,
|
|
20
|
-
|
|
20
|
+
organizationStatus: u
|
|
21
21
|
}),
|
|
22
22
|
enabled: d
|
|
23
23
|
});
|
|
@@ -3,15 +3,17 @@
|
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
5
|
import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { isOrganizationOnItsWay as t } from "../../../shared/data-access/dist/lib/organizationStatus.js";
|
|
7
|
+
import { useEmbedApi as n } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
8
|
+
import { Scope as r } from "../../../shared/data-access/dist/lib/scopes.js";
|
|
9
|
+
import { useAllOrganizationRolesQuery as i } from "../../../shared/data-access/dist/lib/role/useAllOrganizationRolesQuery.js";
|
|
8
10
|
import "../../../shared/data-access/dist/index.js";
|
|
9
|
-
import { EmbeddedToaster as
|
|
10
|
-
import { ErrorState as
|
|
11
|
+
import { EmbeddedToaster as a } from "../../../shared/ui/dist/lib/EmbeddedToaster.js";
|
|
12
|
+
import { ErrorState as o } from "../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
|
|
11
13
|
import "../../../shared/ui/dist/index.js";
|
|
12
|
-
import { useAnalyticsTrack as
|
|
13
|
-
import { WidgetProvider as
|
|
14
|
-
import { useWidgetConfig as
|
|
14
|
+
import { useAnalyticsTrack as s } from "../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
15
|
+
import { WidgetProvider as c } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
|
|
16
|
+
import { useWidgetConfig as ee, useWidgetLoading as te } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
15
17
|
import "../../../shared/feature/dist/index.js";
|
|
16
18
|
import { AmountConditionType as l, ApprovalOutcomeType as u } from "../../ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/types.js";
|
|
17
19
|
import { ApprovalRuleToastLabels as d } from "../../ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/labels.js";
|
|
@@ -22,26 +24,26 @@ import { ExpenseApprovalPoliciesAnalyticsEvent as g, WIDGET_NAME as _ } from "./
|
|
|
22
24
|
import { useApprovalPolicies as v } from "./index24.js";
|
|
23
25
|
import { expenseApprovalPoliciesTestIds as y } from "./index26.js";
|
|
24
26
|
import { useEffect as b, useMemo as x, useState as S } from "react";
|
|
25
|
-
import { Fragment as C, jsx as w, jsxs as
|
|
27
|
+
import { Fragment as C, jsx as w, jsxs as ne } from "react/jsx-runtime";
|
|
26
28
|
//#region ../../libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index27.js
|
|
27
|
-
var
|
|
29
|
+
var T = {
|
|
28
30
|
minAmount: "",
|
|
29
31
|
maxAmount: "",
|
|
30
32
|
outcome: u.AutoApprove,
|
|
31
33
|
approvers: []
|
|
32
34
|
};
|
|
33
|
-
function
|
|
35
|
+
function E(e, t) {
|
|
34
36
|
let n = (e ?? "").trim().toLowerCase();
|
|
35
37
|
return n === t || n === `embedded:${t}`;
|
|
36
38
|
}
|
|
37
|
-
function
|
|
39
|
+
function D(e, t) {
|
|
38
40
|
return (e ?? "").toLowerCase().split(":").map((e) => e.trim()).filter(Boolean).some((e) => e === t);
|
|
39
41
|
}
|
|
40
|
-
function
|
|
41
|
-
return
|
|
42
|
+
function O(e) {
|
|
43
|
+
return E(e, "cfo") || E(e, "finance_admin") || E(e, "finance-admin");
|
|
42
44
|
}
|
|
43
|
-
function
|
|
44
|
-
let t = e.find((e) => e.isSystemRole === !0 &&
|
|
45
|
+
function k(e) {
|
|
46
|
+
let t = e.find((e) => e.isSystemRole === !0 && E(e.key, "admin")), n = e.find((e) => e.isSystemRole === !0 && O(e.key)), r = e.filter((e) => e.isSystemRole === !0 && e !== t && e !== n && !D(e.key, "employee") && !D(e.key, "bookkeeper")).map((e) => ({
|
|
45
47
|
id: e.id,
|
|
46
48
|
label: e.name
|
|
47
49
|
})), i = e.filter((e) => !e.isSystemRole && e.status?.toLowerCase() === "active").map((e) => ({
|
|
@@ -68,16 +70,16 @@ function A(e) {
|
|
|
68
70
|
...i
|
|
69
71
|
];
|
|
70
72
|
}
|
|
71
|
-
function
|
|
73
|
+
function A(e) {
|
|
72
74
|
let t = e.minAmount.trim() !== "", n = e.maxAmount.trim() !== "";
|
|
73
75
|
return t && n ? l.InRange : t ? l.GreaterThanOrEqual : n ? l.LessThan : l.All;
|
|
74
76
|
}
|
|
75
|
-
function
|
|
77
|
+
function j(e) {
|
|
76
78
|
return [e.conditionType === l.LessThan || e.conditionType === l.All ? 0 : e.minAmount ?? 0, e.conditionType === l.GreaterThanOrEqual || e.conditionType === l.All ? Infinity : e.maxAmount ?? 0];
|
|
77
79
|
}
|
|
78
|
-
function
|
|
80
|
+
function M(e) {
|
|
79
81
|
if (e.length === 0) return !1;
|
|
80
|
-
let t = e.map(
|
|
82
|
+
let t = e.map(j).sort((e, t) => e[0] - t[0]);
|
|
81
83
|
if (t[0][0] > 0) return !1;
|
|
82
84
|
let n = 0;
|
|
83
85
|
for (let [e, r] of t) {
|
|
@@ -86,9 +88,9 @@ function N(e) {
|
|
|
86
88
|
}
|
|
87
89
|
return n === Infinity;
|
|
88
90
|
}
|
|
89
|
-
function
|
|
91
|
+
function N(e) {
|
|
90
92
|
if (e.length === 0) return [];
|
|
91
|
-
let t = e.map(
|
|
93
|
+
let t = e.map(j).sort((e, t) => e[0] - t[0]), n = [], r = 0;
|
|
92
94
|
for (let [e, i] of t) e > r && n.push({
|
|
93
95
|
from: r,
|
|
94
96
|
to: e
|
|
@@ -98,23 +100,23 @@ function P(e) {
|
|
|
98
100
|
to: null
|
|
99
101
|
}), n;
|
|
100
102
|
}
|
|
101
|
-
function
|
|
102
|
-
let t = Number(e.minAmount) || 0, n = Number(e.maxAmount) || 0, r =
|
|
103
|
+
function P(e) {
|
|
104
|
+
let t = Number(e.minAmount) || 0, n = Number(e.maxAmount) || 0, r = A(e);
|
|
103
105
|
return [r === l.LessThan || r === l.All ? 0 : t, r === l.GreaterThanOrEqual || r === l.All ? Infinity : n];
|
|
104
106
|
}
|
|
105
|
-
function
|
|
106
|
-
let [r, i] =
|
|
107
|
+
function F(e, t, n) {
|
|
108
|
+
let [r, i] = P(e);
|
|
107
109
|
return t.filter((e) => e.id !== n).some((e) => {
|
|
108
|
-
let [t, n] =
|
|
110
|
+
let [t, n] = j(e);
|
|
109
111
|
return r < n && t < i;
|
|
110
112
|
});
|
|
111
113
|
}
|
|
112
|
-
function
|
|
114
|
+
function I(e, t, n) {
|
|
113
115
|
let r = {}, i = e.minAmount.trim() !== "", a = e.maxAmount.trim() !== "", o = Number(e.minAmount.trim()), s = Number(e.maxAmount.trim());
|
|
114
|
-
return i && (!Number.isFinite(o) || o < 0) && (r.minAmount = h.InvalidMinAmount), a && (!Number.isFinite(s) || s <= 0) && (r.maxAmount = h.InvalidMaxAmount), i && a && !r.minAmount && !r.maxAmount && o >= s && (r.maxAmount = h.MaxLessThanOrEqualToMin), e.outcome === u.RequireApproval && e.approvers.length === 0 && (r.approvers = h.ApproversRequired), !r.minAmount && !r.maxAmount &&
|
|
116
|
+
return i && (!Number.isFinite(o) || o < 0) && (r.minAmount = h.InvalidMinAmount), a && (!Number.isFinite(s) || s <= 0) && (r.maxAmount = h.InvalidMaxAmount), i && a && !r.minAmount && !r.maxAmount && o >= s && (r.maxAmount = h.MaxLessThanOrEqualToMin), e.outcome === u.RequireApproval && e.approvers.length === 0 && (r.approvers = h.ApproversRequired), !r.minAmount && !r.maxAmount && F(e, t, n) && (a ? r.maxAmount = h.ConflictsWithAnotherRule : r.minAmount = h.ConflictsWithAnotherRule), r;
|
|
115
117
|
}
|
|
116
|
-
function
|
|
117
|
-
let n =
|
|
118
|
+
function L(e, t) {
|
|
119
|
+
let n = A(t);
|
|
118
120
|
return {
|
|
119
121
|
id: e,
|
|
120
122
|
conditionType: n,
|
|
@@ -124,7 +126,7 @@ function R(e, t) {
|
|
|
124
126
|
approvers: t.outcome === u.RequireApproval ? t.approvers : []
|
|
125
127
|
};
|
|
126
128
|
}
|
|
127
|
-
function
|
|
129
|
+
function R(e) {
|
|
128
130
|
return {
|
|
129
131
|
minAmount: e.minAmount == null ? "" : String(e.minAmount),
|
|
130
132
|
maxAmount: e.maxAmount == null ? "" : String(e.maxAmount),
|
|
@@ -132,73 +134,73 @@ function z(e) {
|
|
|
132
134
|
approvers: e.approvers
|
|
133
135
|
};
|
|
134
136
|
}
|
|
135
|
-
function
|
|
136
|
-
let
|
|
137
|
+
function z() {
|
|
138
|
+
let c = s();
|
|
137
139
|
b(() => {
|
|
138
|
-
|
|
139
|
-
}, [
|
|
140
|
-
let { initResponse: l } =
|
|
141
|
-
let e =
|
|
140
|
+
c(g.Mounted);
|
|
141
|
+
}, [c]);
|
|
142
|
+
let { initResponse: l } = ee(), u = te(), h = t(n().organizationStatus), _ = l?.scopes?.includes(r.RoleReadOrg) ?? !1, { data: D, isResolving: A, isError: j } = i({ enabled: _ }), P = x(() => k(D?.data ?? []), [D]), F = x(() => {
|
|
143
|
+
let e = D?.data ?? [], t = e.find((e) => e.isSystemRole === !0 && E(e.key, "admin")), n = e.find((e) => e.isSystemRole === !0 && O(e.key)), r = { reporting_manager: p.ReportingManagerLabel };
|
|
142
144
|
t && (r[t.id] = p.AdminLabel), n && (r[n.id] = p.CfoLabel);
|
|
143
145
|
for (let t of e) r[t.id] || (r[t.id] = t.name);
|
|
144
146
|
return r;
|
|
145
|
-
}, [
|
|
147
|
+
}, [D]), { rules: z, isLoading: B, hasLoaded: re, saveStatus: V, createRule: ie, updateRule: H, deleteRule: U } = v(F), [W, G] = S(!1), [K, q] = S(T), [J, Y] = S(null), [X, Z] = S(null);
|
|
146
148
|
b(() => {
|
|
147
149
|
V === "success" && e.success(d.Saved), V === "error" && e.error(d.FailedToSave);
|
|
148
150
|
}, [V]);
|
|
149
|
-
let
|
|
150
|
-
|
|
151
|
-
}, se = () => {
|
|
152
|
-
W(!1);
|
|
153
|
-
}, $ = async () => {
|
|
154
|
-
let e = L(G, I);
|
|
155
|
-
if (Object.keys(e).length > 0) return;
|
|
156
|
-
let t = crypto.randomUUID();
|
|
157
|
-
await ee(R(t, G)) && (W(!1), K(E));
|
|
158
|
-
}, ce = (e) => {
|
|
159
|
-
K(e);
|
|
160
|
-
}, le = (e) => {
|
|
161
|
-
let t = I.find((t) => t.id === e);
|
|
162
|
-
t && (W(!1), K(E), J(e), X(z(t)));
|
|
151
|
+
let Q = B || u && !l || h && !re, ae = M(z), oe = N(z), $ = Q || A || V === "saving", se = W ? I(K, z) : {}, ce = X && J ? I(X, z, J) : {}, le = () => {
|
|
152
|
+
G(!0), q(T);
|
|
163
153
|
}, ue = () => {
|
|
164
|
-
|
|
154
|
+
G(!1);
|
|
165
155
|
}, de = async () => {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
156
|
+
let e = I(K, z);
|
|
157
|
+
if (Object.keys(e).length > 0) return;
|
|
158
|
+
let t = crypto.randomUUID();
|
|
159
|
+
await ie(L(t, K)) && (G(!1), q(T));
|
|
169
160
|
}, fe = (e) => {
|
|
170
|
-
|
|
171
|
-
}, pe =
|
|
172
|
-
|
|
161
|
+
q(e);
|
|
162
|
+
}, pe = (e) => {
|
|
163
|
+
let t = z.find((t) => t.id === e);
|
|
164
|
+
t && (G(!1), q(T), Y(e), Z(R(t)));
|
|
165
|
+
}, me = () => {
|
|
166
|
+
Y(null), Z(null);
|
|
167
|
+
}, he = async () => {
|
|
168
|
+
if (!J || !X) return;
|
|
169
|
+
let e = I(X, z, J);
|
|
170
|
+
Object.keys(e).length > 0 || await H(J, L(J, X)) && (Y(null), Z(null));
|
|
171
|
+
}, ge = (e) => {
|
|
172
|
+
Z(e);
|
|
173
|
+
}, _e = async (e) => {
|
|
174
|
+
await U(e), J === e && (Y(null), Z(null));
|
|
173
175
|
};
|
|
174
|
-
return l !== void 0 && !
|
|
176
|
+
return l !== void 0 && !_ ? /* @__PURE__ */ w(o, {
|
|
175
177
|
title: m.MissingRolePermissionTitle,
|
|
176
178
|
description: m.MissingRolePermissionDescription
|
|
177
|
-
}) : j ? /* @__PURE__ */ w(
|
|
179
|
+
}) : j ? /* @__PURE__ */ w(o, {
|
|
178
180
|
title: m.RolesUnavailableTitle,
|
|
179
181
|
description: m.RolesUnavailableDescription
|
|
180
|
-
}) : /* @__PURE__ */
|
|
181
|
-
rules:
|
|
182
|
-
isBusy:
|
|
183
|
-
isLoading:
|
|
184
|
-
isAddingRule:
|
|
185
|
-
newRuleFormValues:
|
|
186
|
-
newRuleValidationErrors:
|
|
187
|
-
editingRuleId:
|
|
188
|
-
editingRuleFormValues:
|
|
189
|
-
editingRuleValidationErrors:
|
|
190
|
-
approverOptions:
|
|
191
|
-
allExpensesAreCovered:
|
|
192
|
-
gapIntervals:
|
|
193
|
-
onAddRuleClick:
|
|
194
|
-
onCancelAddRule:
|
|
195
|
-
onSaveNewRule: () => void
|
|
196
|
-
onNewRuleFormChange:
|
|
197
|
-
onEditRule:
|
|
198
|
-
onCancelEditRule:
|
|
199
|
-
onSaveEditRule: () => void
|
|
200
|
-
onEditRuleFormChange:
|
|
201
|
-
onDeleteRule: (e) => void
|
|
182
|
+
}) : /* @__PURE__ */ ne(C, { children: [/* @__PURE__ */ w(a, {}), /* @__PURE__ */ w(f, {
|
|
183
|
+
rules: z,
|
|
184
|
+
isBusy: $,
|
|
185
|
+
isLoading: Q,
|
|
186
|
+
isAddingRule: W,
|
|
187
|
+
newRuleFormValues: K,
|
|
188
|
+
newRuleValidationErrors: se,
|
|
189
|
+
editingRuleId: J,
|
|
190
|
+
editingRuleFormValues: X,
|
|
191
|
+
editingRuleValidationErrors: ce,
|
|
192
|
+
approverOptions: $ ? [] : P,
|
|
193
|
+
allExpensesAreCovered: ae,
|
|
194
|
+
gapIntervals: oe,
|
|
195
|
+
onAddRuleClick: le,
|
|
196
|
+
onCancelAddRule: ue,
|
|
197
|
+
onSaveNewRule: () => void de(),
|
|
198
|
+
onNewRuleFormChange: fe,
|
|
199
|
+
onEditRule: pe,
|
|
200
|
+
onCancelEditRule: me,
|
|
201
|
+
onSaveEditRule: () => void he(),
|
|
202
|
+
onEditRuleFormChange: ge,
|
|
203
|
+
onDeleteRule: (e) => void _e(e),
|
|
202
204
|
testIds: {
|
|
203
205
|
ruleCard: { root: y.ruleCard },
|
|
204
206
|
ruleForm: {
|
|
@@ -210,14 +212,14 @@ function B() {
|
|
|
210
212
|
}
|
|
211
213
|
})] });
|
|
212
214
|
}
|
|
213
|
-
function
|
|
214
|
-
return /* @__PURE__ */ w(
|
|
215
|
+
function B({ token: e, orgId: t, widgetToken: n, organizationId: r, ...i } = {}) {
|
|
216
|
+
return /* @__PURE__ */ w(c, {
|
|
215
217
|
...i,
|
|
216
218
|
widgetName: _,
|
|
217
219
|
widgetToken: n === void 0 ? e : n,
|
|
218
220
|
organizationId: r === void 0 ? t : r,
|
|
219
|
-
children: /* @__PURE__ */ w(
|
|
221
|
+
children: /* @__PURE__ */ w(z, {})
|
|
220
222
|
});
|
|
221
223
|
}
|
|
222
224
|
//#endregion
|
|
223
|
-
export {
|
|
225
|
+
export { B as ExpenseApprovalPoliciesWidget, B as default, k as buildApproverOptions, E as isEmbeddedSystemRoleKey, D as roleKeyHasSegment };
|