@tesouro/embedded-components-react 0.11.71 → 0.11.73
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 +1 -0
- package/dist/index.css +35 -192
- package/dist/index.d.ts +75 -71
- package/dist/lib/SettingsWidget.d.ts +5 -1
- package/dist/lib/WidgetSuite.d.ts +4 -0
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index3.js +8 -7
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index4.js +4 -1
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index6.js +196 -131
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index3.js +11 -1
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index4.js +5 -3
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index5.js +38 -32
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index6.js +103 -75
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index7.js +140 -168
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index8.js +97 -87
- package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/feature/dist/index7.js +11 -7
- package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/feature/dist/index8.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index2.js +3 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index3.js +134 -177
- package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index4.js +110 -176
- package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index5.js +28 -38
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/lib/ExpenseSettingsTabs/ExpenseSettingsTabs.js +13 -10
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/lib/SettingsWidget/SettingsWidget.js +28 -24
- package/dist/libs/tesouro-embedded-components-react/settings-widget/help/ui/shadcn/dist/index3.js +35 -31
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index10.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index7.js +1 -5
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index8.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index11.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index12.js +22 -36
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index16.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index17.js +54 -60
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index20.js +75 -60
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index3.js +42 -27
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index6.js +89 -82
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index9.js +39 -38
- package/dist/libs/tesouro-embedded-components-react/settings-widget/profile/feature/dist/index4.js +32 -32
- package/dist/libs/tesouro-embedded-components-react/settings-widget/profile/ui/dist/index2.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/profile/ui/dist/index3.js +56 -71
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index10.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index12.js +86 -66
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index13.js +51 -51
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index15.js +146 -132
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index17.js +95 -99
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index3.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index4.js +8 -27
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index5.js +69 -72
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index6.js +51 -51
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index.js +9 -11
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index10.js +83 -298
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index11.js +13 -13
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index12.js +122 -75
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index13.js +41 -15
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index14.js +7 -131
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index15.js +147 -48
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index16.js +240 -11
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index17.js +15 -173
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index2.js +38 -10
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index3.js +5 -46
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index4.js +52 -45
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index5.js +101 -25
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index6.js +40 -98
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index7.js +415 -40
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index8.js +261 -332
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index9.js +15 -8
- package/dist/libs/tesouro-embedded-components-react/settings-widget/ui/dist/lib/SettingsWidgetUi/SettingsWidgetUi.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/ApprovalPoliciesSettings.js +9 -8
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/useApprovalPolicyRules.js +136 -122
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index.js +9 -8
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index11.js +16 -17
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index12.js +99 -100
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index16.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index17.js +8 -8
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index18.js +10 -55
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index19.js +34 -8
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index20.js +8 -84
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index21.js +86 -0
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index3.js +13 -13
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index5.js +17 -18
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index7.js +33 -42
- 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/ui/dist/index.js +24 -24
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/FileDropZone/FileDropZone.js +62 -0
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/LoadingRegion/LoadingRegion.js +1 -0
- package/dist/packages/shared-ui-shadcn/dist/index.js +2302 -2284
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index18.js +0 -291
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index19.js +0 -22
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/avatarSwatch.js +0 -26
|
@@ -744,6 +744,10 @@ interface SettingsWidgetProps extends WidgetProviderProps {
|
|
|
744
744
|
* falls back to a plain, unlinked sentence when unset, for the same reason
|
|
745
745
|
* {@link SettingsWidgetProps.helpContactUrl} does. */
|
|
746
746
|
profileContactUrl?: string;
|
|
747
|
+
/** Forwarded to the embedded Profile section's {@link ProfileWidget} —
|
|
748
|
+
* whether it paints its decorative header band, a soft wash of the theme's
|
|
749
|
+
* primary color. Defaults to `true`; pass `false` to drop it. */
|
|
750
|
+
showProfileHeader?: boolean;
|
|
747
751
|
/** The section to show. Leave unset to let the widget own the selection;
|
|
748
752
|
* supply it (with {@link SettingsWidgetProps.onSelectedSectionChange}) to
|
|
749
753
|
* drive navigation from a route, a search param, or host state. A section
|
|
@@ -771,7 +775,7 @@ interface SettingsWidgetProps extends WidgetProviderProps {
|
|
|
771
775
|
invoiceContent?: ReactNode;
|
|
772
776
|
legalContent?: ReactNode;
|
|
773
777
|
}
|
|
774
|
-
declare function SettingsWidget({ labels, featureLabels, acceptInviteRedirectUri, teamInitialView, helpContactUrl, helpFaq, profileContactUrl, selectedSection, defaultSelectedSection, onSelectedSectionChange, additionalSections, profileContent, teamContent, billPayContent, helpContent, expenseContent, accountingContent, invoiceContent, legalContent, ...widgetProviderProps }: SettingsWidgetProps): React.JSX.Element;
|
|
778
|
+
declare function SettingsWidget({ labels, featureLabels, acceptInviteRedirectUri, teamInitialView, helpContactUrl, helpFaq, profileContactUrl, showProfileHeader, selectedSection, defaultSelectedSection, onSelectedSectionChange, additionalSections, profileContent, teamContent, billPayContent, helpContent, expenseContent, accountingContent, invoiceContent, legalContent, ...widgetProviderProps }: SettingsWidgetProps): React.JSX.Element;
|
|
775
779
|
|
|
776
780
|
export { HELP_FAQ_EN, SettingsSection, SettingsWidget };
|
|
777
781
|
export type { HelpFaqAnswer, HelpFaqBullet, HelpFaqBulletType, HelpFaqItem, HelpFaqSection, SettingsWidgetAdditionalSection, FeatureLabels as SettingsWidgetFeatureLabels, Labels as SettingsWidgetLabels, SettingsWidgetProps, SettingsWidgetSection, SettingsWidgetSectionId };
|
|
@@ -2960,6 +2960,10 @@ interface SettingsWidgetProps extends WidgetProviderProps {
|
|
|
2960
2960
|
* falls back to a plain, unlinked sentence when unset, for the same reason
|
|
2961
2961
|
* {@link SettingsWidgetProps.helpContactUrl} does. */
|
|
2962
2962
|
profileContactUrl?: string;
|
|
2963
|
+
/** Forwarded to the embedded Profile section's {@link ProfileWidget} —
|
|
2964
|
+
* whether it paints its decorative header band, a soft wash of the theme's
|
|
2965
|
+
* primary color. Defaults to `true`; pass `false` to drop it. */
|
|
2966
|
+
showProfileHeader?: boolean;
|
|
2963
2967
|
/** The section to show. Leave unset to let the widget own the selection;
|
|
2964
2968
|
* supply it (with {@link SettingsWidgetProps.onSelectedSectionChange}) to
|
|
2965
2969
|
* drive navigation from a route, a search param, or host state. A section
|
|
@@ -234,18 +234,19 @@ function b(t = {}) {
|
|
|
234
234
|
return v("error"), !1;
|
|
235
235
|
}
|
|
236
236
|
}, [p, C.mutateAsync]), k = c(async (e) => {
|
|
237
|
-
if (p)
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
237
|
+
if (!p) return !1;
|
|
238
|
+
b.current && clearTimeout(b.current), v("saving");
|
|
239
|
+
try {
|
|
240
|
+
return await w.mutateAsync({ path: { approval_policy_id: e } }), v("success"), E(), !0;
|
|
241
|
+
} catch {
|
|
242
|
+
return v("error"), !1;
|
|
244
243
|
}
|
|
245
244
|
}, [p, w.mutateAsync]);
|
|
246
245
|
return {
|
|
247
246
|
rules: T,
|
|
248
247
|
isLoading: x.isFetching,
|
|
248
|
+
isError: x.isError,
|
|
249
|
+
refetch: x.refetch,
|
|
249
250
|
hasLoaded: x.data !== void 0,
|
|
250
251
|
saveStatus: _,
|
|
251
252
|
createRule: D,
|
|
@@ -15,7 +15,10 @@ var e = {
|
|
|
15
15
|
}, n = {
|
|
16
16
|
MissingRolePermissionTitle: "Approval policies unavailable",
|
|
17
17
|
MissingRolePermissionDescription: "Your access token is missing the permissions required to manage approval policies. Contact your administrator to update your access.",
|
|
18
|
+
Retry: "Try again",
|
|
19
|
+
PoliciesUnavailableTitle: "Approval policies unavailable",
|
|
20
|
+
PoliciesUnavailableDescription: "Approval policies could not be loaded. Please try again.",
|
|
18
21
|
RolesUnavailableTitle: "Roles unavailable",
|
|
19
|
-
RolesUnavailableDescription: "Approver roles could not be loaded.
|
|
22
|
+
RolesUnavailableDescription: "Approver roles could not be loaded. Please try again."
|
|
20
23
|
};
|
|
21
24
|
export { e as ApproverOptionLabels, n as PermissionErrorLabels, t as ValidationErrorLabels };
|
|
@@ -13,73 +13,77 @@ import { ErrorState as o } from "../../../../shared/ui/dist/lib/ErrorState/Error
|
|
|
13
13
|
import "../../../../shared/ui/dist/index.js";
|
|
14
14
|
import { useAnalyticsTrack as s } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
15
15
|
import { WidgetProvider as c } from "../../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
|
|
16
|
-
import { useWidgetConfig as
|
|
16
|
+
import { useWidgetConfig as ee, useWidgetLoading as te } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
17
17
|
import "../../../../shared/feature/dist/index.js";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
18
|
+
import { DeleteRuleDialogDefaultLabels as ne } from "../../../../shared/approval-policy/ui/dist/index18.js";
|
|
19
|
+
import { DeleteRuleDialog as re } from "../../../../shared/approval-policy/ui/dist/index19.js";
|
|
20
|
+
import "../../../../shared/approval-policy/ui/dist/index.js";
|
|
21
|
+
import { ApproverOptionLabels as l, PermissionErrorLabels as ie, ValidationErrorLabels as u } from "./index4.js";
|
|
22
|
+
import { ExpenseApprovalPoliciesAnalyticsEvent as ae, WIDGET_NAME as d } from "./index2.js";
|
|
23
|
+
import { AmountConditionType as f, ApprovalOutcomeType as p } from "../../ui/dist/index2.js";
|
|
24
|
+
import { ApprovalRuleCardLabels as oe, ApprovalRuleToastLabels as se } from "../../ui/dist/index3.js";
|
|
25
|
+
import { formatAmount as m } from "../../ui/dist/index4.js";
|
|
26
|
+
import { ExpenseApprovalsPage as ce } from "../../ui/dist/index8.js";
|
|
23
27
|
import "../../ui/dist/index.js";
|
|
24
|
-
import { useApprovalPolicies as
|
|
25
|
-
import { expenseApprovalPoliciesTestIds as
|
|
26
|
-
import { useEffect as
|
|
27
|
-
import { Fragment as
|
|
28
|
+
import { useApprovalPolicies as le } from "./index3.js";
|
|
29
|
+
import { expenseApprovalPoliciesTestIds as h } from "./index5.js";
|
|
30
|
+
import { useEffect as g, useMemo as _, useRef as ue, useState as v } from "react";
|
|
31
|
+
import { Fragment as de, jsx as y, jsxs as fe } from "react/jsx-runtime";
|
|
28
32
|
// ../../libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index6.js
|
|
29
|
-
var
|
|
33
|
+
var b = {
|
|
30
34
|
minAmount: "",
|
|
31
35
|
maxAmount: "",
|
|
32
|
-
outcome:
|
|
36
|
+
outcome: p.AutoApprove,
|
|
33
37
|
approvers: []
|
|
34
38
|
};
|
|
35
|
-
function
|
|
39
|
+
function x(e, t) {
|
|
36
40
|
let n = (e ?? "").trim().toLowerCase();
|
|
37
41
|
return n === t || n === `embedded:${t}`;
|
|
38
42
|
}
|
|
39
|
-
function
|
|
43
|
+
function S(e, t) {
|
|
40
44
|
return (e ?? "").toLowerCase().split(":").map((e) => e.trim()).filter(Boolean).some((e) => e === t);
|
|
41
45
|
}
|
|
42
|
-
function
|
|
43
|
-
return
|
|
46
|
+
function C(e) {
|
|
47
|
+
return x(e, "cfo") || x(e, "finance_admin") || x(e, "finance-admin");
|
|
44
48
|
}
|
|
45
|
-
function
|
|
46
|
-
let
|
|
49
|
+
function w(e, t = l) {
|
|
50
|
+
let n = e.find((e) => e.isSystemRole === !0 && x(e.key, "admin")), r = e.find((e) => e.isSystemRole === !0 && C(e.key)), i = e.filter((e) => e.isSystemRole === !0 && e !== n && e !== r && !S(e.key, "employee") && !S(e.key, "bookkeeper")).map((e) => ({
|
|
47
51
|
id: e.id,
|
|
48
52
|
label: e.name
|
|
49
|
-
})),
|
|
53
|
+
})), a = e.filter((e) => !e.isSystemRole && e.status?.toLowerCase() === "active").map((e) => ({
|
|
50
54
|
id: e.id,
|
|
51
55
|
label: e.name
|
|
52
56
|
}));
|
|
53
57
|
return [
|
|
54
|
-
...
|
|
55
|
-
id:
|
|
56
|
-
label:
|
|
57
|
-
sublabel:
|
|
58
|
+
...n ? [{
|
|
59
|
+
id: n.id,
|
|
60
|
+
label: t.AdminLabel,
|
|
61
|
+
sublabel: t.AdminSublabel
|
|
58
62
|
}] : [],
|
|
59
63
|
{
|
|
60
64
|
id: "reporting_manager",
|
|
61
|
-
label:
|
|
62
|
-
sublabel:
|
|
65
|
+
label: t.ReportingManagerLabel,
|
|
66
|
+
sublabel: t.ReportingManagerSublabel
|
|
63
67
|
},
|
|
64
|
-
...
|
|
65
|
-
id:
|
|
66
|
-
label:
|
|
67
|
-
sublabel:
|
|
68
|
+
...r ? [{
|
|
69
|
+
id: r.id,
|
|
70
|
+
label: t.CfoLabel,
|
|
71
|
+
sublabel: t.CfoSublabel
|
|
68
72
|
}] : [],
|
|
69
|
-
...
|
|
70
|
-
...
|
|
73
|
+
...i,
|
|
74
|
+
...a
|
|
71
75
|
];
|
|
72
76
|
}
|
|
73
|
-
function
|
|
77
|
+
function T(e) {
|
|
74
78
|
let t = e.minAmount.trim() !== "", n = e.maxAmount.trim() !== "";
|
|
75
|
-
return t && n ?
|
|
79
|
+
return t && n ? f.InRange : t ? f.GreaterThanOrEqual : n ? f.LessThan : f.All;
|
|
76
80
|
}
|
|
77
|
-
function
|
|
78
|
-
return [e.conditionType ===
|
|
81
|
+
function E(e) {
|
|
82
|
+
return [e.conditionType === f.LessThan || e.conditionType === f.All ? 0 : e.minAmount ?? 0, e.conditionType === f.GreaterThanOrEqual || e.conditionType === f.All ? Infinity : e.maxAmount ?? 0];
|
|
79
83
|
}
|
|
80
|
-
function
|
|
84
|
+
function pe(e) {
|
|
81
85
|
if (e.length === 0) return !1;
|
|
82
|
-
let t = e.map(
|
|
86
|
+
let t = e.map(E).sort((e, t) => e[0] - t[0]);
|
|
83
87
|
if (t[0][0] > 0) return !1;
|
|
84
88
|
let n = 0;
|
|
85
89
|
for (let [e, r] of t) {
|
|
@@ -88,9 +92,9 @@ function M(e) {
|
|
|
88
92
|
}
|
|
89
93
|
return n === Infinity;
|
|
90
94
|
}
|
|
91
|
-
function
|
|
95
|
+
function me(e) {
|
|
92
96
|
if (e.length === 0) return [];
|
|
93
|
-
let t = e.map(
|
|
97
|
+
let t = e.map(E).sort((e, t) => e[0] - t[0]), n = [], r = 0;
|
|
94
98
|
for (let [e, i] of t) e > r && n.push({
|
|
95
99
|
from: r,
|
|
96
100
|
to: e
|
|
@@ -100,33 +104,33 @@ function N(e) {
|
|
|
100
104
|
to: null
|
|
101
105
|
}), n;
|
|
102
106
|
}
|
|
103
|
-
function
|
|
104
|
-
let t = Number(e.minAmount) || 0, n = Number(e.maxAmount) || 0, r =
|
|
105
|
-
return [r ===
|
|
107
|
+
function D(e) {
|
|
108
|
+
let t = Number(e.minAmount) || 0, n = Number(e.maxAmount) || 0, r = T(e);
|
|
109
|
+
return [r === f.LessThan || r === f.All ? 0 : t, r === f.GreaterThanOrEqual || r === f.All ? Infinity : n];
|
|
106
110
|
}
|
|
107
|
-
function
|
|
108
|
-
let [r, i] =
|
|
111
|
+
function O(e, t, n) {
|
|
112
|
+
let [r, i] = D(e);
|
|
109
113
|
return t.filter((e) => e.id !== n).some((e) => {
|
|
110
|
-
let [t, n] =
|
|
114
|
+
let [t, n] = E(e);
|
|
111
115
|
return r < n && t < i;
|
|
112
116
|
});
|
|
113
117
|
}
|
|
114
|
-
function
|
|
115
|
-
let
|
|
116
|
-
return
|
|
118
|
+
function k(e, t, n, r = u) {
|
|
119
|
+
let i = {}, a = e.minAmount.trim() !== "", o = e.maxAmount.trim() !== "", s = Number(e.minAmount.trim()), c = Number(e.maxAmount.trim());
|
|
120
|
+
return a && (!Number.isFinite(s) || s < 0) && (i.minAmount = r.InvalidMinAmount), o && (!Number.isFinite(c) || c <= 0) && (i.maxAmount = r.InvalidMaxAmount), a && o && !i.minAmount && !i.maxAmount && s >= c && (i.maxAmount = r.MaxLessThanOrEqualToMin), e.outcome === p.RequireApproval && e.approvers.length === 0 && (i.approvers = r.ApproversRequired), !i.minAmount && !i.maxAmount && O(e, t, n) && (o ? i.maxAmount = r.ConflictsWithAnotherRule : i.minAmount = r.ConflictsWithAnotherRule), i;
|
|
117
121
|
}
|
|
118
|
-
function
|
|
119
|
-
let n =
|
|
122
|
+
function A(e, t) {
|
|
123
|
+
let n = T(t);
|
|
120
124
|
return {
|
|
121
125
|
id: e,
|
|
122
126
|
conditionType: n,
|
|
123
|
-
minAmount: n ===
|
|
124
|
-
maxAmount: n ===
|
|
127
|
+
minAmount: n === f.InRange || n === f.GreaterThanOrEqual ? Number(t.minAmount) : void 0,
|
|
128
|
+
maxAmount: n === f.LessThan || n === f.InRange ? Number(t.maxAmount) : void 0,
|
|
125
129
|
outcome: t.outcome,
|
|
126
|
-
approvers: t.outcome ===
|
|
130
|
+
approvers: t.outcome === p.RequireApproval ? t.approvers : []
|
|
127
131
|
};
|
|
128
132
|
}
|
|
129
|
-
function
|
|
133
|
+
function he(e) {
|
|
130
134
|
return {
|
|
131
135
|
minAmount: e.minAmount == null ? "" : String(e.minAmount),
|
|
132
136
|
maxAmount: e.maxAmount == null ? "" : String(e.maxAmount),
|
|
@@ -134,91 +138,152 @@ function R(e) {
|
|
|
134
138
|
approvers: e.approvers
|
|
135
139
|
};
|
|
136
140
|
}
|
|
137
|
-
function
|
|
138
|
-
let
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}, [
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
141
|
+
function j({ headerActionContainer: c, labels: d }) {
|
|
142
|
+
let S = _(() => ({
|
|
143
|
+
...l,
|
|
144
|
+
...d?.approvers
|
|
145
|
+
}), [d?.approvers]), T = _(() => ({
|
|
146
|
+
...u,
|
|
147
|
+
...d?.validation
|
|
148
|
+
}), [d?.validation]), E = _(() => ({
|
|
149
|
+
...ie,
|
|
150
|
+
...d?.errors
|
|
151
|
+
}), [d?.errors]), D = _(() => ({
|
|
152
|
+
...se,
|
|
153
|
+
...d?.toast
|
|
154
|
+
}), [d?.toast]), O = s();
|
|
155
|
+
g(() => {
|
|
156
|
+
O(ae.Mounted);
|
|
157
|
+
}, [O]);
|
|
158
|
+
let { initResponse: j } = ee(), M = te(), ge = t(n().organizationStatus), N = j?.scopes?.includes(r.RoleReadOrg) ?? !1, { data: P, isResolving: _e, isError: ve, refetch: ye } = i({ enabled: N }), be = _(() => w(P?.data ?? [], S), [P, S]), xe = _(() => {
|
|
159
|
+
let e = P?.data ?? [], t = e.find((e) => e.isSystemRole === !0 && x(e.key, "admin")), n = e.find((e) => e.isSystemRole === !0 && C(e.key)), r = { reporting_manager: S.ReportingManagerLabel };
|
|
160
|
+
t && (r[t.id] = S.AdminLabel), n && (r[n.id] = S.CfoLabel);
|
|
145
161
|
for (let t of e) r[t.id] || (r[t.id] = t.name);
|
|
146
162
|
return r;
|
|
147
|
-
}, [
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}, [
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
},
|
|
154
|
-
|
|
155
|
-
},
|
|
156
|
-
|
|
163
|
+
}, [P, S]), { rules: F, isLoading: I, isError: Se, refetch: Ce, hasLoaded: L, saveStatus: R, createRule: we, updateRule: Te, deleteRule: Ee } = le(xe), [z, B] = v(!1), [V, H] = v(null), [U, W] = v(!1), [G, K] = v(b), [q, J] = v(null), [Y, X] = v(null), Z = ue(D);
|
|
164
|
+
g(() => {
|
|
165
|
+
Z.current = D;
|
|
166
|
+
}, [D]), g(() => {
|
|
167
|
+
R === "success" && e.success(Z.current.Saved), R === "error" && e.error(Z.current.FailedToSave);
|
|
168
|
+
}, [R]);
|
|
169
|
+
let Q = I || M && !j || ge && !L, De = pe(F), Oe = me(F), $ = Q || _e || R === "saving", ke = U && z ? k(G, F, void 0, T) : {}, Ae = Y && q && z ? k(Y, F, q, T) : {}, je = () => {
|
|
170
|
+
B(!1), W(!0), K(b);
|
|
171
|
+
}, Me = () => {
|
|
172
|
+
B(!1), W(!1);
|
|
173
|
+
}, Ne = async () => {
|
|
174
|
+
B(!0);
|
|
175
|
+
let e = k(G, F, void 0, T);
|
|
157
176
|
if (Object.keys(e).length > 0) return;
|
|
158
177
|
let t = crypto.randomUUID();
|
|
159
|
-
await
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
t
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
178
|
+
await we(A(t, G)) && (W(!1), K(b));
|
|
179
|
+
}, Pe = (e) => {
|
|
180
|
+
K(e);
|
|
181
|
+
}, Fe = (e) => {
|
|
182
|
+
B(!1);
|
|
183
|
+
let t = F.find((t) => t.id === e);
|
|
184
|
+
t && (W(!1), K(b), J(e), X(he(t)));
|
|
185
|
+
}, Ie = () => {
|
|
186
|
+
B(!1), J(null), X(null);
|
|
187
|
+
}, Le = async () => {
|
|
188
|
+
if (B(!0), !q || !Y) return;
|
|
189
|
+
let e = k(Y, F, q, T);
|
|
190
|
+
Object.keys(e).length > 0 || await Te(q, A(q, Y)) && (J(null), X(null));
|
|
191
|
+
}, Re = (e) => {
|
|
192
|
+
X(e);
|
|
193
|
+
}, ze = (() => {
|
|
194
|
+
let e = F.find((e) => e.id === V);
|
|
195
|
+
if (!e) return;
|
|
196
|
+
let t = {
|
|
197
|
+
...ne,
|
|
198
|
+
...d?.deleteDialog
|
|
199
|
+
}, n = {
|
|
200
|
+
...oe,
|
|
201
|
+
...d?.ruleCard
|
|
202
|
+
}, r = `${n.For} ${n.Expenses}`, i = `${n.For} ${n.All} ${n.Expenses}`;
|
|
203
|
+
e.conditionType === f.LessThan && (i = `${r} ${n.LessThan} ${m(e.maxAmount ?? 0)}`), e.conditionType === f.GreaterThanOrEqual && (i = `${r} ${n.GreaterThanOrEqual} ${m(e.minAmount ?? 0)}`), e.conditionType === f.InRange && (i = `${r} ${n.GreaterThanOrEqual} ${m(e.minAmount ?? 0)} ${n.AndLessThan} ${m(e.maxAmount ?? 0)}`);
|
|
204
|
+
let a = e.outcome === p.AutoApprove ? n.AutoApprove : `${n.RequireApprovalFrom} ${e.approvers.map((e) => e.label).join(` ${n.ApproverSeparator} `)}`;
|
|
205
|
+
return [{
|
|
206
|
+
label: t.Range,
|
|
207
|
+
value: i
|
|
208
|
+
}, {
|
|
209
|
+
label: t.Outcome,
|
|
210
|
+
value: a
|
|
211
|
+
}];
|
|
212
|
+
})(), Be = async () => {
|
|
213
|
+
V && await Ee(V) && (q === V && (J(null), X(null)), H(null));
|
|
175
214
|
};
|
|
176
|
-
return
|
|
177
|
-
title:
|
|
178
|
-
description:
|
|
179
|
-
}) :
|
|
180
|
-
title:
|
|
181
|
-
description:
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
215
|
+
return j !== void 0 && !N ? /* @__PURE__ */ y(o, {
|
|
216
|
+
title: E.MissingRolePermissionTitle,
|
|
217
|
+
description: E.MissingRolePermissionDescription
|
|
218
|
+
}) : ve ? /* @__PURE__ */ y(o, {
|
|
219
|
+
title: E.RolesUnavailableTitle,
|
|
220
|
+
description: E.RolesUnavailableDescription,
|
|
221
|
+
retryLabel: E.Retry,
|
|
222
|
+
onRetry: () => void ye()
|
|
223
|
+
}) : Se && !I && !L ? /* @__PURE__ */ y(o, {
|
|
224
|
+
title: E.PoliciesUnavailableTitle,
|
|
225
|
+
description: E.PoliciesUnavailableDescription,
|
|
226
|
+
retryLabel: E.Retry,
|
|
227
|
+
onRetry: () => void Ce()
|
|
228
|
+
}) : /* @__PURE__ */ fe(de, { children: [
|
|
229
|
+
/* @__PURE__ */ y(a, {}),
|
|
230
|
+
/* @__PURE__ */ y(ce, {
|
|
231
|
+
rules: F,
|
|
232
|
+
labels: d,
|
|
233
|
+
isBusy: $,
|
|
234
|
+
isLoading: Q,
|
|
235
|
+
isAddingRule: U,
|
|
236
|
+
newRuleFormValues: G,
|
|
237
|
+
newRuleValidationErrors: ke,
|
|
238
|
+
editingRuleId: q,
|
|
239
|
+
editingRuleFormValues: Y,
|
|
240
|
+
editingRuleValidationErrors: Ae,
|
|
241
|
+
approverOptions: $ ? [] : be,
|
|
242
|
+
allExpensesAreCovered: De,
|
|
243
|
+
gapIntervals: Oe,
|
|
244
|
+
onAddRuleClick: je,
|
|
245
|
+
headerActionContainer: c,
|
|
246
|
+
onCancelAddRule: Me,
|
|
247
|
+
onSaveNewRule: () => void Ne(),
|
|
248
|
+
onNewRuleFormChange: Pe,
|
|
249
|
+
onEditRule: Fe,
|
|
250
|
+
onCancelEditRule: Ie,
|
|
251
|
+
onSaveEditRule: () => void Le(),
|
|
252
|
+
onEditRuleFormChange: Re,
|
|
253
|
+
onDeleteRule: H,
|
|
254
|
+
testIds: {
|
|
255
|
+
ruleCard: { root: h.ruleCard },
|
|
256
|
+
ruleForm: {
|
|
257
|
+
root: h.ruleForm,
|
|
258
|
+
saveButton: h.ruleFormSaveButton,
|
|
259
|
+
minAmountInput: h.ruleFormMinAmountInput,
|
|
260
|
+
maxAmountInput: h.ruleFormMaxAmountInput
|
|
261
|
+
}
|
|
211
262
|
}
|
|
212
|
-
}
|
|
213
|
-
|
|
263
|
+
}),
|
|
264
|
+
/* @__PURE__ */ y(re, {
|
|
265
|
+
labels: d?.deleteDialog,
|
|
266
|
+
details: ze,
|
|
267
|
+
open: V !== null,
|
|
268
|
+
onOpenChange: (e) => {
|
|
269
|
+
e || H(null);
|
|
270
|
+
},
|
|
271
|
+
onCancel: () => H(null),
|
|
272
|
+
onConfirm: () => void Be(),
|
|
273
|
+
isDeleting: R === "saving"
|
|
274
|
+
})
|
|
275
|
+
] });
|
|
214
276
|
}
|
|
215
|
-
function
|
|
216
|
-
return /* @__PURE__ */
|
|
217
|
-
...
|
|
218
|
-
widgetName:
|
|
277
|
+
function M({ token: e, orgId: t, widgetToken: n, organizationId: r, headerActionContainer: i, labels: a, ...o } = {}) {
|
|
278
|
+
return /* @__PURE__ */ y(c, {
|
|
279
|
+
...o,
|
|
280
|
+
widgetName: d,
|
|
219
281
|
widgetToken: n === void 0 ? e : n,
|
|
220
282
|
organizationId: r === void 0 ? t : r,
|
|
221
|
-
children: /* @__PURE__ */
|
|
283
|
+
children: /* @__PURE__ */ y(j, {
|
|
284
|
+
headerActionContainer: i,
|
|
285
|
+
labels: a
|
|
286
|
+
})
|
|
222
287
|
});
|
|
223
288
|
}
|
|
224
|
-
export {
|
|
289
|
+
export { M as ExpenseApprovalPoliciesWidget, M as default, w as buildApproverOptions, x as isEmbeddedSystemRoleKey, S as roleKeyHasSegment };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AmountConditionType as e, ApprovalOutcomeType as t } from "./index2.js";
|
|
2
|
-
import {
|
|
3
|
-
import "./index4.js";
|
|
2
|
+
import { ApprovalRuleCardLabels as n, ApprovalRuleToastLabels as r } from "./index3.js";
|
|
3
|
+
import { formatAmount as i } from "./index4.js";
|
|
4
4
|
import "./index5.js";
|
|
5
5
|
import "./index6.js";
|
|
6
6
|
import "./index7.js";
|
|
7
|
-
import { ExpenseApprovalsPage as
|
|
8
|
-
export { e as AmountConditionType, t as ApprovalOutcomeType, n as
|
|
7
|
+
import { ExpenseApprovalsPage as a } from "./index8.js";
|
|
8
|
+
export { e as AmountConditionType, t as ApprovalOutcomeType, n as ApprovalRuleCardLabels, r as ApprovalRuleToastLabels, a as ExpenseApprovalsPage, i as formatAmount };
|
|
@@ -10,6 +10,7 @@ var e = {
|
|
|
10
10
|
CreateAnotherRule: "Create another rule",
|
|
11
11
|
LoadingRules: "Loading approval rules"
|
|
12
12
|
}, t = {
|
|
13
|
+
Outcome: "Approval outcome",
|
|
13
14
|
ForExpenses: "For",
|
|
14
15
|
ExpensesBold: "expenses",
|
|
15
16
|
GreaterThanOrEqualTo: "greater than or equal to",
|
|
@@ -26,8 +27,15 @@ var e = {
|
|
|
26
27
|
Cancel: "Cancel",
|
|
27
28
|
Save: "Save"
|
|
28
29
|
}, n = {
|
|
30
|
+
For: "For",
|
|
31
|
+
All: "all",
|
|
32
|
+
Expenses: "expenses",
|
|
33
|
+
LessThan: "less than",
|
|
34
|
+
GreaterThanOrEqual: "greater than or equal to",
|
|
35
|
+
AndLessThan: "and less than",
|
|
29
36
|
RequireApprovalFrom: "Require approval from",
|
|
30
37
|
AutoApprove: "Auto-approve",
|
|
38
|
+
ApproverSeparator: "or",
|
|
31
39
|
DeleteRuleAriaLabel: "Delete rule",
|
|
32
40
|
EditRuleAriaLabel: "Edit rule"
|
|
33
41
|
}, r = {
|
|
@@ -40,7 +48,9 @@ var e = {
|
|
|
40
48
|
FailedToSave: "Failed to save.",
|
|
41
49
|
ConflictsWithAnotherRule: "This conflicts with another rule."
|
|
42
50
|
}, a = {
|
|
43
|
-
Prefix: "The
|
|
51
|
+
Prefix: "The",
|
|
52
|
+
Default: "system default",
|
|
53
|
+
AfterDefault: "will apply to transactions",
|
|
44
54
|
Suffix: ", requiring approval from a company admin.",
|
|
45
55
|
Above: "above",
|
|
46
56
|
RangeSeparator: "–"
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// ../../libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index4.js
|
|
2
2
|
function e(e) {
|
|
3
|
-
return
|
|
4
|
-
|
|
3
|
+
return new Intl.NumberFormat("en-US", {
|
|
4
|
+
style: "currency",
|
|
5
|
+
currency: "USD",
|
|
6
|
+
minimumFractionDigits: 2,
|
|
5
7
|
maximumFractionDigits: 2
|
|
6
|
-
})
|
|
8
|
+
}).format(e);
|
|
7
9
|
}
|
|
8
10
|
export { e as formatAmount };
|
|
@@ -1,36 +1,42 @@
|
|
|
1
1
|
import { Button as e, Typography as t } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
2
|
import { EmptyApprovalRulesLabels as n } from "./index3.js";
|
|
3
3
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
-
import {
|
|
4
|
+
import { ShieldCheck as a } from "lucide-react";
|
|
5
5
|
// ../../libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index5.js
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
6
|
+
var o = ({ onAddRule: o, labels: s, onLearnMore: c }) => {
|
|
7
|
+
let l = {
|
|
8
|
+
...n,
|
|
9
|
+
...s
|
|
10
|
+
};
|
|
11
|
+
return /* @__PURE__ */ i("div", {
|
|
12
|
+
className: "ttw:flex ttw:flex-col ttw:items-center ttw:py-12 ttw:gap-4 ttw:w-full ttw:max-w-[600px] ttw:mx-auto",
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ r("div", {
|
|
15
|
+
className: "ttw:w-12 ttw:h-12 ttw:rounded-full ttw:bg-muted ttw:flex ttw:items-center ttw:justify-center ttw:text-muted-foreground",
|
|
16
|
+
children: /* @__PURE__ */ r(a, { size: 20 })
|
|
17
|
+
}),
|
|
18
|
+
/* @__PURE__ */ r(t, {
|
|
19
|
+
variant: "h6",
|
|
20
|
+
children: l.Title
|
|
21
|
+
}),
|
|
22
|
+
/* @__PURE__ */ r(t, {
|
|
23
|
+
variant: "body2",
|
|
24
|
+
color: "muted",
|
|
25
|
+
className: "ttw:text-center",
|
|
26
|
+
children: l.Body
|
|
27
|
+
}),
|
|
28
|
+
/* @__PURE__ */ r(e, {
|
|
29
|
+
onClick: o,
|
|
30
|
+
className: "ttw:mt-1",
|
|
31
|
+
children: l.AddRule
|
|
32
|
+
}),
|
|
33
|
+
c && /* @__PURE__ */ r(e, {
|
|
34
|
+
variant: "link",
|
|
35
|
+
className: "ttw:text-muted-foreground",
|
|
36
|
+
onClick: c,
|
|
37
|
+
children: l.LearnMore
|
|
38
|
+
})
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
export { o as EmptyApprovalRules };
|