@tesouro/embedded-components-react 0.11.101 → 0.11.104
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/index.css +21 -17
- package/dist/index.d.ts +10 -6
- package/dist/lib/CardDetailsWidget.d.ts +6 -4
- package/dist/lib/CreditCardsWidget.d.ts +6 -4
- package/dist/lib/DebitCardsWidget.d.ts +6 -4
- package/dist/lib/SettingsWidget.d.ts +2 -1
- package/dist/lib/WidgetSuite.d.ts +8 -5
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardDetailsPanel.js +199 -168
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/labels.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsList.js +44 -43
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js +56 -52
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index3.js +68 -63
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index3.js +9 -9
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index4.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index6.js +25 -284
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index7.js +291 -0
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index.js +3 -3
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index3.js +28 -17
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index5.js +21 -34
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index6.js +71 -78
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index7.js +71 -77
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index8.js +43 -49
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index2.js +8 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index3.js +98 -91
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/lib/ExpenseSettingsTabs/ExpenseSettingsTabs.js +24 -21
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/lib/SettingsWidget/SettingsWidget.js +14 -8
- package/dist/libs/tesouro-embedded-components-react/settings-widget/help/ui/shadcn/dist/index3.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index10.js +87 -81
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index3.js +63 -44
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index6.js +9 -6
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index17.js +302 -276
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index.js +10 -10
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index12.js +36 -36
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index17.js +27 -13
- package/dist/libs/tesouro-embedded-components-react/settings-widget/ui/dist/lib/SettingsWidgetUi/SettingsSectionContent.js +22 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/ui/dist/lib/SettingsWidgetUi/SettingsWidgetUi.js +6 -7
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/ApprovalPoliciesSettings.js +39 -37
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index.js +9 -9
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index11.js +39 -35
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index16.js +59 -61
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index4.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index6.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index7.js +3 -3
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +114 -103
- 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/util/dist/index.js +12 -12
- package/dist/packages/shared-ui-shadcn/dist/index.js +18 -15
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// ../../libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index3.js
|
|
2
2
|
var e = {
|
|
3
3
|
Title: "Expense approvals",
|
|
4
|
-
Description: "
|
|
4
|
+
Description: "Set who needs to approve expenses.",
|
|
5
5
|
TabApprovals: "Approvals",
|
|
6
6
|
TabRequirements: "Requirements",
|
|
7
7
|
AllExpensesCoveredTitle: "All expense amounts are covered",
|
|
@@ -11,22 +11,32 @@ var e = {
|
|
|
11
11
|
LoadingRules: "Loading approval rules"
|
|
12
12
|
}, t = {
|
|
13
13
|
Outcome: "Approval outcome",
|
|
14
|
-
ForExpenses: "
|
|
15
|
-
ExpensesBold: "
|
|
16
|
-
GreaterThanOrEqualTo: "
|
|
17
|
-
AndLessThan: "and
|
|
18
|
-
MinimumPlaceholder: "0",
|
|
14
|
+
ForExpenses: "If the",
|
|
15
|
+
ExpensesBold: "amount is",
|
|
16
|
+
GreaterThanOrEqualTo: "between",
|
|
17
|
+
AndLessThan: "and",
|
|
18
|
+
MinimumPlaceholder: "0.00",
|
|
19
19
|
MaximumPlaceholder: "No limit",
|
|
20
20
|
AutoApprove: "Auto-approve",
|
|
21
21
|
RequireApproval: "Require approval",
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
ThenRequireApproval: "Then require approval…",
|
|
23
|
+
RequireApprovalCaption: "A company admin can approve before the manager has acted.",
|
|
24
|
+
RequireApprovalFrom: "From",
|
|
25
|
+
ChooseApprovers: "Select approvers",
|
|
25
26
|
ApproverSeparator: "or",
|
|
26
27
|
DeleteRule: "Delete rule",
|
|
27
28
|
Cancel: "Cancel",
|
|
28
29
|
Save: "Save"
|
|
29
30
|
}, n = {
|
|
31
|
+
TitleAll: "All expenses",
|
|
32
|
+
TitleUpTo: "Expenses up to {upper}",
|
|
33
|
+
TitleFrom: "Expenses {lower} and above",
|
|
34
|
+
TitleRange: "Expenses between {lower} and {upper}",
|
|
35
|
+
SentenceAll: "For any amount, require approval from…",
|
|
36
|
+
SentenceUpTo: "If the amount is up to {upper}, then require approval from…",
|
|
37
|
+
SentenceFrom: "If the amount is {lower} or more, then require approval from…",
|
|
38
|
+
SentenceRange: "If the amount is between {lower} and {upper}, then require approval from…",
|
|
39
|
+
SentenceAutoApprove: "Automatically approve expenses in this range.",
|
|
30
40
|
For: "For",
|
|
31
41
|
All: "all",
|
|
32
42
|
Expenses: "expenses",
|
|
@@ -36,11 +46,10 @@ var e = {
|
|
|
36
46
|
RequireApprovalFrom: "Require approval from",
|
|
37
47
|
AutoApprove: "Auto-approve",
|
|
38
48
|
ApproverSeparator: "or",
|
|
39
|
-
DeleteRuleAriaLabel: "Delete rule",
|
|
40
49
|
EditRuleAriaLabel: "Edit rule"
|
|
41
50
|
}, r = {
|
|
42
51
|
Title: "No approval rules configured",
|
|
43
|
-
Body: "
|
|
52
|
+
Body: "Company admin approval is required when no rule covers an expense amount.",
|
|
44
53
|
AddRule: "Add rule",
|
|
45
54
|
LearnMore: "Learn more about expense approvals ↗"
|
|
46
55
|
}, i = {
|
|
@@ -48,11 +57,13 @@ var e = {
|
|
|
48
57
|
FailedToSave: "Failed to save.",
|
|
49
58
|
ConflictsWithAnotherRule: "This conflicts with another rule."
|
|
50
59
|
}, a = {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
Title: "No rules cover the following expense amount ranges",
|
|
61
|
+
Footer: "When no rule covers an expense amount, company admin approval is required.",
|
|
62
|
+
Prefix: "Company admin approval",
|
|
63
|
+
Default: "is required",
|
|
64
|
+
AfterDefault: "for expenses",
|
|
65
|
+
Suffix: ".",
|
|
66
|
+
Above: "at or above",
|
|
67
|
+
RangeSeparator: "to"
|
|
57
68
|
};
|
|
58
69
|
export { n as ApprovalRuleCardLabels, t as ApprovalRuleFormLabels, i as ApprovalRuleToastLabels, r as EmptyApprovalRulesLabels, e as ExpenseApprovalsPageLabels, a as GapCalloutLabels };
|
|
@@ -1,42 +1,29 @@
|
|
|
1
|
-
import { Button as e
|
|
1
|
+
import { Button as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { NoPolicyBanner as t } from "../../../../shared/approval-policy/ui/dist/index5.js";
|
|
3
|
+
import "../../../../shared/approval-policy/ui/dist/index.js";
|
|
2
4
|
import { EmptyApprovalRulesLabels as n } from "./index3.js";
|
|
3
5
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
-
import { ShieldCheck as a } from "lucide-react";
|
|
5
6
|
// ../../libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index5.js
|
|
6
|
-
var
|
|
7
|
-
let
|
|
7
|
+
var a = ({ onAddRule: a, labels: o, onLearnMore: s }) => {
|
|
8
|
+
let c = {
|
|
8
9
|
...n,
|
|
9
|
-
...
|
|
10
|
+
...o
|
|
10
11
|
};
|
|
11
12
|
return /* @__PURE__ */ i("div", {
|
|
12
|
-
className: "ttw:flex ttw:flex-col ttw:items-center ttw:
|
|
13
|
-
children: [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
]
|
|
13
|
+
className: "ttw:flex ttw:w-full ttw:flex-col ttw:items-center ttw:gap-4",
|
|
14
|
+
children: [/* @__PURE__ */ r(t, {
|
|
15
|
+
onCreateRule: a,
|
|
16
|
+
labels: {
|
|
17
|
+
Title: c.Title,
|
|
18
|
+
Body: c.Body,
|
|
19
|
+
CreateRule: c.AddRule
|
|
20
|
+
}
|
|
21
|
+
}), s && /* @__PURE__ */ r(e, {
|
|
22
|
+
variant: "link",
|
|
23
|
+
className: "ttw:text-muted-foreground",
|
|
24
|
+
onClick: s,
|
|
25
|
+
children: c.LearnMore
|
|
26
|
+
})]
|
|
40
27
|
});
|
|
41
28
|
};
|
|
42
|
-
export {
|
|
29
|
+
export { a as EmptyApprovalRules };
|
|
@@ -1,116 +1,109 @@
|
|
|
1
|
-
import { Badge as e, Button as t,
|
|
2
|
-
import { PolicyCardFrame as
|
|
1
|
+
import { Badge as e, Button as t, Typography as n } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { PolicyCardFrame as r } from "../../../../shared/approval-policy/ui/dist/index17.js";
|
|
3
3
|
import "../../../../shared/approval-policy/ui/dist/index.js";
|
|
4
|
-
import { AmountConditionType as
|
|
5
|
-
import { ApprovalRuleCardLabels as
|
|
6
|
-
import { formatAmount as
|
|
7
|
-
import { Fragment as
|
|
8
|
-
import { Trash2 as m } from "lucide-react";
|
|
4
|
+
import { AmountConditionType as i, ApprovalOutcomeType as a } from "./index2.js";
|
|
5
|
+
import { ApprovalRuleCardLabels as o } from "./index3.js";
|
|
6
|
+
import { formatAmount as s } from "./index4.js";
|
|
7
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
9
8
|
// ../../libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index6.js
|
|
10
|
-
function
|
|
11
|
-
let
|
|
9
|
+
function d({ conditionType: e, minAmount: t, maxAmount: n, labels: r }) {
|
|
10
|
+
let a = (e) => /* @__PURE__ */ l("strong", { children: s(e) });
|
|
12
11
|
switch (e) {
|
|
13
|
-
case
|
|
12
|
+
case i.LessThan: return /* @__PURE__ */ u(c, { children: [
|
|
14
13
|
r.For,
|
|
15
14
|
" ",
|
|
16
|
-
/* @__PURE__ */
|
|
15
|
+
/* @__PURE__ */ l("strong", { children: r.Expenses }),
|
|
17
16
|
" ",
|
|
18
17
|
r.LessThan,
|
|
19
18
|
" ",
|
|
20
|
-
|
|
19
|
+
a(n ?? 0)
|
|
21
20
|
] });
|
|
22
|
-
case
|
|
21
|
+
case i.InRange: return /* @__PURE__ */ u(c, { children: [
|
|
23
22
|
r.For,
|
|
24
23
|
" ",
|
|
25
|
-
/* @__PURE__ */
|
|
24
|
+
/* @__PURE__ */ l("strong", { children: r.Expenses }),
|
|
26
25
|
" ",
|
|
27
26
|
r.GreaterThanOrEqual,
|
|
28
27
|
" ",
|
|
29
|
-
|
|
28
|
+
a(t ?? 0),
|
|
30
29
|
" ",
|
|
31
30
|
r.AndLessThan,
|
|
32
31
|
" ",
|
|
33
|
-
|
|
32
|
+
a(n ?? 0)
|
|
34
33
|
] });
|
|
35
|
-
case
|
|
34
|
+
case i.GreaterThanOrEqual: return /* @__PURE__ */ u(c, { children: [
|
|
36
35
|
r.For,
|
|
37
36
|
" ",
|
|
38
|
-
/* @__PURE__ */
|
|
37
|
+
/* @__PURE__ */ l("strong", { children: r.Expenses }),
|
|
39
38
|
" ",
|
|
40
39
|
r.GreaterThanOrEqual,
|
|
41
40
|
" ",
|
|
42
|
-
|
|
41
|
+
a(t ?? 0)
|
|
43
42
|
] });
|
|
44
|
-
default: return /* @__PURE__ */
|
|
43
|
+
default: return /* @__PURE__ */ u(c, { children: [
|
|
45
44
|
r.For,
|
|
46
45
|
" ",
|
|
47
46
|
r.All,
|
|
48
47
|
" ",
|
|
49
|
-
/* @__PURE__ */
|
|
48
|
+
/* @__PURE__ */ l("strong", { children: r.Expenses })
|
|
50
49
|
] });
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
|
-
var
|
|
54
|
-
let
|
|
55
|
-
...
|
|
56
|
-
...
|
|
52
|
+
var f = ({ rule: i, labels: s, onEdit: c, disabled: f, testIds: p }) => {
|
|
53
|
+
let m = {
|
|
54
|
+
...o,
|
|
55
|
+
...s
|
|
57
56
|
};
|
|
58
|
-
return /* @__PURE__ */
|
|
59
|
-
"data-testid":
|
|
60
|
-
children: [
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}), /* @__PURE__ */ p("div", {
|
|
71
|
-
className: "ttw:flex ttw:gap-1",
|
|
72
|
-
children: [/* @__PURE__ */ f(i, { children: /* @__PURE__ */ p(n, { children: [/* @__PURE__ */ f(a, {
|
|
73
|
-
asChild: !0,
|
|
74
|
-
children: /* @__PURE__ */ f(t, {
|
|
75
|
-
variant: "ghost",
|
|
76
|
-
size: "icon-sm",
|
|
77
|
-
onClick: () => g(s.id),
|
|
78
|
-
"aria-label": y.DeleteRuleAriaLabel,
|
|
79
|
-
className: "ttw:text-destructive ttw:hover:text-destructive",
|
|
80
|
-
disabled: _,
|
|
81
|
-
children: /* @__PURE__ */ f(m, {})
|
|
57
|
+
return /* @__PURE__ */ u(r, {
|
|
58
|
+
"data-testid": p?.root,
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ u("div", {
|
|
61
|
+
className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-4",
|
|
62
|
+
children: [/* @__PURE__ */ l(n, {
|
|
63
|
+
variant: "body1",
|
|
64
|
+
children: i.title ?? /* @__PURE__ */ l(d, {
|
|
65
|
+
labels: m,
|
|
66
|
+
conditionType: i.conditionType,
|
|
67
|
+
minAmount: i.minAmount,
|
|
68
|
+
maxAmount: i.maxAmount
|
|
82
69
|
})
|
|
83
|
-
}), /* @__PURE__ */
|
|
70
|
+
}), /* @__PURE__ */ l(t, {
|
|
84
71
|
variant: "ghost",
|
|
85
|
-
onClick: () =>
|
|
72
|
+
onClick: () => c(i.id),
|
|
86
73
|
className: "ttw:text-muted-foreground ttw:hover:text-foreground",
|
|
87
|
-
disabled:
|
|
88
|
-
children:
|
|
74
|
+
disabled: f,
|
|
75
|
+
children: m.EditRuleAriaLabel
|
|
89
76
|
})]
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
className: "ttw:
|
|
99
|
-
children:
|
|
100
|
-
})
|
|
101
|
-
className: "ttw:flex ttw:
|
|
102
|
-
children:
|
|
103
|
-
className: "ttw:
|
|
104
|
-
children:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
children:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
77
|
+
}),
|
|
78
|
+
i.sentence ? /* @__PURE__ */ l(n, {
|
|
79
|
+
variant: "body2",
|
|
80
|
+
color: "muted",
|
|
81
|
+
children: i.sentence
|
|
82
|
+
}) : null,
|
|
83
|
+
i.outcome === a.AutoApprove ? /* @__PURE__ */ l(e, {
|
|
84
|
+
tone: "success",
|
|
85
|
+
className: "ttw:self-start",
|
|
86
|
+
children: m.AutoApprove
|
|
87
|
+
}) : /* @__PURE__ */ u("div", {
|
|
88
|
+
className: "ttw:flex ttw:items-center ttw:gap-1",
|
|
89
|
+
children: [i.sentence ? null : /* @__PURE__ */ l("span", {
|
|
90
|
+
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
91
|
+
children: m.RequireApprovalFrom
|
|
92
|
+
}), /* @__PURE__ */ l("div", {
|
|
93
|
+
className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:gap-1",
|
|
94
|
+
children: i.approvers.map((t, n) => /* @__PURE__ */ u("div", {
|
|
95
|
+
className: "ttw:flex ttw:items-center ttw:gap-1",
|
|
96
|
+
children: [n > 0 ? /* @__PURE__ */ l("span", {
|
|
97
|
+
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
98
|
+
children: m.ApproverSeparator
|
|
99
|
+
}) : null, /* @__PURE__ */ l(e, {
|
|
100
|
+
variant: "secondary",
|
|
101
|
+
children: t.label
|
|
102
|
+
})]
|
|
103
|
+
}, t.id))
|
|
104
|
+
})]
|
|
105
|
+
})
|
|
106
|
+
]
|
|
114
107
|
});
|
|
115
108
|
};
|
|
116
|
-
export {
|
|
109
|
+
export { f as ApprovalRuleCard };
|
|
@@ -1,38 +1,39 @@
|
|
|
1
|
-
import { Button as e, Combobox as t, FieldError as n, Label as r, RadioGroup as i, RadioGroupItem as a } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
-
import { AmountConditionBuilder as
|
|
1
|
+
import { Button as e, Combobox as t, FieldError as n, Label as r, RadioGroup as i, RadioGroupItem as a, Typography as o } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { AmountConditionBuilder as s } from "../../../../shared/approval-policy/ui/dist/index3.js";
|
|
3
|
+
import { PolicyCardFrame as c } from "../../../../shared/approval-policy/ui/dist/index17.js";
|
|
3
4
|
import "../../../../shared/approval-policy/ui/dist/index.js";
|
|
4
|
-
import { ApprovalOutcomeType as
|
|
5
|
-
import { ApprovalRuleFormLabels as
|
|
6
|
-
import { useEffect as
|
|
7
|
-
import { jsx as
|
|
8
|
-
import {
|
|
5
|
+
import { ApprovalOutcomeType as l } from "./index2.js";
|
|
6
|
+
import { ApprovalRuleFormLabels as u } from "./index3.js";
|
|
7
|
+
import { useEffect as d, useId as f, useRef as p, useState as m } from "react";
|
|
8
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
9
|
+
import { Trash2 as _ } from "lucide-react";
|
|
9
10
|
// ../../libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index7.js
|
|
10
11
|
var v = ({ values: v, approverOptions: y, validationErrors: b, labels: x, isEditing: S, disabled: C, onValuesChange: w, onSave: T, onCancel: E, onDelete: D, testIds: O }) => {
|
|
11
12
|
let k = {
|
|
12
|
-
...
|
|
13
|
+
...u,
|
|
13
14
|
...x
|
|
14
15
|
}, A = (e) => w({
|
|
15
16
|
...v,
|
|
16
17
|
...e
|
|
17
|
-
}), j =
|
|
18
|
-
|
|
18
|
+
}), j = p(null), [M, N] = m(0);
|
|
19
|
+
d(() => {
|
|
19
20
|
M && j.current?.querySelector("[aria-invalid=\"true\"]")?.focus();
|
|
20
21
|
}, [M]);
|
|
21
22
|
let P = () => {
|
|
22
23
|
T(), N((e) => e + 1);
|
|
23
|
-
}, F =
|
|
24
|
+
}, F = f(), I = f(), L = f(), R = y.map((e) => ({
|
|
24
25
|
value: e.id,
|
|
25
26
|
label: e.label
|
|
26
27
|
})), z = new Set(R.map((e) => e.value)), B = [...R, ...v.approvers.filter((e) => !z.has(e.id)).map((e) => ({
|
|
27
28
|
value: e.id,
|
|
28
29
|
label: e.label
|
|
29
30
|
}))], V = new Map([...v.approvers.map((e) => [e.id, e]), ...y.map((e) => [e.id, e])]);
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ g(c, {
|
|
31
32
|
ref: j,
|
|
32
33
|
"data-testid": O?.root,
|
|
33
|
-
className: "ttw:border
|
|
34
|
+
className: "ttw:border-primary",
|
|
34
35
|
children: [
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
+
/* @__PURE__ */ h(s, {
|
|
36
37
|
value: {
|
|
37
38
|
lower: v.minAmount,
|
|
38
39
|
upper: v.maxAmount
|
|
@@ -46,16 +47,6 @@ var v = ({ values: v, approverOptions: y, validationErrors: b, labels: x, isEdit
|
|
|
46
47
|
upper: b.maxAmount
|
|
47
48
|
},
|
|
48
49
|
disabled: C,
|
|
49
|
-
lead: /* @__PURE__ */ m("span", {
|
|
50
|
-
className: "ttw:font-normal",
|
|
51
|
-
children: [
|
|
52
|
-
k.ForExpenses,
|
|
53
|
-
" ",
|
|
54
|
-
/* @__PURE__ */ p("strong", { children: k.ExpensesBold }),
|
|
55
|
-
" ",
|
|
56
|
-
k.GreaterThanOrEqualTo
|
|
57
|
-
]
|
|
58
|
-
}),
|
|
59
50
|
labels: {
|
|
60
51
|
IfAmountIsBetween: `${k.ForExpenses} ${k.ExpensesBold} ${k.GreaterThanOrEqualTo}`,
|
|
61
52
|
And: k.AndLessThan,
|
|
@@ -67,103 +58,106 @@ var v = ({ values: v, approverOptions: y, validationErrors: b, labels: x, isEdit
|
|
|
67
58
|
upperInput: O?.maxAmountInput
|
|
68
59
|
}
|
|
69
60
|
}),
|
|
70
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ g(i, {
|
|
71
62
|
"aria-label": k.Outcome,
|
|
72
63
|
"aria-required": "true",
|
|
73
64
|
className: "ttw:gap-2",
|
|
74
65
|
value: v.outcome,
|
|
75
66
|
disabled: C,
|
|
76
67
|
onValueChange: (e) => {
|
|
77
|
-
e ===
|
|
68
|
+
e === l.AutoApprove ? A({
|
|
78
69
|
outcome: e,
|
|
79
70
|
approvers: []
|
|
80
|
-
}) : e ===
|
|
71
|
+
}) : e === l.RequireApproval && A({ outcome: e });
|
|
81
72
|
},
|
|
82
|
-
children: [/* @__PURE__ */
|
|
73
|
+
children: [/* @__PURE__ */ g("div", {
|
|
83
74
|
className: "ttw:flex ttw:items-center ttw:gap-2",
|
|
84
|
-
children: [/* @__PURE__ */
|
|
75
|
+
children: [/* @__PURE__ */ h(a, {
|
|
85
76
|
id: `${F}-auto`,
|
|
86
|
-
value:
|
|
87
|
-
}), /* @__PURE__ */
|
|
77
|
+
value: l.AutoApprove
|
|
78
|
+
}), /* @__PURE__ */ h(r, {
|
|
88
79
|
htmlFor: `${F}-auto`,
|
|
89
|
-
className: "ttw:cursor-pointer
|
|
90
|
-
children:
|
|
91
|
-
"aria-hidden": "true",
|
|
92
|
-
className: "ttw:size-4 ttw:shrink-0"
|
|
93
|
-
}), k.AutoApprove]
|
|
80
|
+
className: "ttw:cursor-pointer",
|
|
81
|
+
children: k.AutoApprove
|
|
94
82
|
})]
|
|
95
|
-
}), /* @__PURE__ */
|
|
83
|
+
}), /* @__PURE__ */ g("div", {
|
|
96
84
|
className: "ttw:flex ttw:items-start ttw:gap-2",
|
|
97
|
-
children: [/* @__PURE__ */
|
|
85
|
+
children: [/* @__PURE__ */ h(a, {
|
|
98
86
|
id: `${F}-required`,
|
|
99
|
-
value:
|
|
87
|
+
value: l.RequireApproval,
|
|
100
88
|
className: "ttw:mt-0.5"
|
|
101
|
-
}), /* @__PURE__ */
|
|
89
|
+
}), /* @__PURE__ */ g("div", {
|
|
102
90
|
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
103
|
-
children: [/* @__PURE__ */
|
|
91
|
+
children: [/* @__PURE__ */ h(r, {
|
|
104
92
|
htmlFor: `${F}-required`,
|
|
105
93
|
className: "ttw:cursor-pointer",
|
|
106
|
-
children:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}), k.RequireApproval]
|
|
110
|
-
}), /* @__PURE__ */ p("span", {
|
|
111
|
-
className: "ttw:pl-6 ttw:text-xs ttw:text-muted-foreground",
|
|
94
|
+
children: k.RequireApproval
|
|
95
|
+
}), /* @__PURE__ */ h("span", {
|
|
96
|
+
className: "ttw:text-xs ttw:text-muted-foreground",
|
|
112
97
|
children: k.RequireApprovalCaption
|
|
113
98
|
})]
|
|
114
99
|
})]
|
|
115
100
|
})]
|
|
116
101
|
}),
|
|
117
|
-
v.outcome ===
|
|
118
|
-
className: "ttw:flex ttw:flex-col ttw:gap-
|
|
102
|
+
v.outcome === l.RequireApproval ? /* @__PURE__ */ g("div", {
|
|
103
|
+
className: "ttw:flex ttw:flex-col ttw:gap-4",
|
|
119
104
|
children: [
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
children: k.
|
|
105
|
+
/* @__PURE__ */ h(o, {
|
|
106
|
+
variant: "body2",
|
|
107
|
+
color: "muted",
|
|
108
|
+
children: k.ThenRequireApproval
|
|
124
109
|
}),
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
items:
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
110
|
+
/* @__PURE__ */ g("div", {
|
|
111
|
+
className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:gap-4",
|
|
112
|
+
children: [/* @__PURE__ */ h(r, {
|
|
113
|
+
htmlFor: I,
|
|
114
|
+
children: k.RequireApprovalFrom
|
|
115
|
+
}), /* @__PURE__ */ h("div", {
|
|
116
|
+
className: "ttw:min-w-0 ttw:flex-1",
|
|
117
|
+
children: /* @__PURE__ */ h(t, {
|
|
118
|
+
items: B,
|
|
119
|
+
value: v.approvers.map((e) => e.id),
|
|
120
|
+
onValueChange: (e) => {
|
|
121
|
+
A({ approvers: (Array.isArray(e) ? e : [e]).flatMap((e) => {
|
|
122
|
+
let t = V.get(e);
|
|
123
|
+
return t ? [t] : [];
|
|
124
|
+
}) });
|
|
125
|
+
},
|
|
126
|
+
multiple: !0,
|
|
127
|
+
multipleSeparator: k.ApproverSeparator,
|
|
128
|
+
labels: { placeholder: k.ChooseApprovers },
|
|
129
|
+
disabled: C,
|
|
130
|
+
inputId: I,
|
|
131
|
+
required: !0,
|
|
132
|
+
invalid: !!b.approvers,
|
|
133
|
+
describedBy: b.approvers ? L : void 0
|
|
134
|
+
})
|
|
135
|
+
})]
|
|
142
136
|
}),
|
|
143
|
-
b.approvers ? /* @__PURE__ */
|
|
137
|
+
b.approvers ? /* @__PURE__ */ h(n, {
|
|
144
138
|
id: L,
|
|
145
139
|
children: b.approvers
|
|
146
140
|
}) : null
|
|
147
141
|
]
|
|
148
142
|
}) : null,
|
|
149
|
-
/* @__PURE__ */
|
|
143
|
+
/* @__PURE__ */ g("div", {
|
|
150
144
|
className: "ttw:mt-2 ttw:flex ttw:items-center ttw:justify-between",
|
|
151
|
-
children: [/* @__PURE__ */
|
|
145
|
+
children: [/* @__PURE__ */ h("div", { children: S && D ? /* @__PURE__ */ g(e, {
|
|
152
146
|
variant: "ghost",
|
|
153
147
|
size: "sm",
|
|
154
148
|
className: "ttw:text-destructive ttw:hover:text-destructive",
|
|
155
149
|
onClick: D,
|
|
156
150
|
disabled: C,
|
|
157
|
-
children: [/* @__PURE__ */
|
|
158
|
-
}) : null }), /* @__PURE__ */
|
|
151
|
+
children: [/* @__PURE__ */ h(_, {}), k.DeleteRule]
|
|
152
|
+
}) : null }), /* @__PURE__ */ g("div", {
|
|
159
153
|
className: "ttw:flex ttw:gap-2",
|
|
160
|
-
children: [/* @__PURE__ */
|
|
154
|
+
children: [/* @__PURE__ */ h(e, {
|
|
161
155
|
variant: "ghost",
|
|
162
156
|
size: "sm",
|
|
163
157
|
onClick: E,
|
|
164
158
|
disabled: C,
|
|
165
159
|
children: k.Cancel
|
|
166
|
-
}), /* @__PURE__ */
|
|
160
|
+
}), /* @__PURE__ */ h(e, {
|
|
167
161
|
size: "sm",
|
|
168
162
|
onClick: P,
|
|
169
163
|
disabled: C,
|