@tesouro/embedded-components-react 0.11.101 → 0.11.102
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/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
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { toast as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
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";
|
|
10
|
+
import "../../../../shared/data-access/dist/index.js";
|
|
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";
|
|
13
|
+
import "../../../../shared/ui/dist/index.js";
|
|
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";
|
|
17
|
+
import "../../../../shared/feature/dist/index.js";
|
|
18
|
+
import { parseAmountInputToMinorUnits as l } from "../../../../shared/approval-policy/util/dist/lib/amountInput.js";
|
|
19
|
+
import { DeleteRuleDialogDefaultLabels as ne } from "../../../../shared/approval-policy/ui/dist/index18.js";
|
|
20
|
+
import { DeleteRuleDialog as re } from "../../../../shared/approval-policy/ui/dist/index19.js";
|
|
21
|
+
import "../../../../shared/approval-policy/ui/dist/index.js";
|
|
22
|
+
import { ApproverOptionLabels as u, PermissionErrorLabels as ie, ValidationErrorLabels as d } from "./index4.js";
|
|
23
|
+
import { ExpenseApprovalPoliciesAnalyticsEvent as ae, WIDGET_NAME as f } from "./index2.js";
|
|
24
|
+
import { AmountConditionType as p, ApprovalOutcomeType as m } from "../../ui/dist/index2.js";
|
|
25
|
+
import { ApprovalRuleCardLabels as h, ApprovalRuleToastLabels as oe } from "../../ui/dist/index3.js";
|
|
26
|
+
import { ExpenseApprovalsPage as se } from "../../ui/dist/index8.js";
|
|
27
|
+
import "../../ui/dist/index.js";
|
|
28
|
+
import { useApprovalPolicies as ce } from "./index3.js";
|
|
29
|
+
import { expenseApprovalPoliciesTestIds as g } from "./index5.js";
|
|
30
|
+
import { maximumForSave as _, maximumInputForDisplay as v, ruleForDisplay as y } from "./index6.js";
|
|
31
|
+
import { useEffect as b, useMemo as x, useRef as le, useState as S } from "react";
|
|
32
|
+
import { Fragment as ue, jsx as C, jsxs as de } from "react/jsx-runtime";
|
|
33
|
+
// ../../libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index7.js
|
|
34
|
+
var w = {
|
|
35
|
+
minAmount: "",
|
|
36
|
+
maxAmount: "",
|
|
37
|
+
outcome: m.AutoApprove,
|
|
38
|
+
approvers: []
|
|
39
|
+
};
|
|
40
|
+
function T(e, t) {
|
|
41
|
+
let n = (e ?? "").trim().toLowerCase();
|
|
42
|
+
return n === t || n === `embedded:${t}`;
|
|
43
|
+
}
|
|
44
|
+
function E(e, t) {
|
|
45
|
+
return (e ?? "").toLowerCase().split(":").map((e) => e.trim()).filter(Boolean).some((e) => e === t);
|
|
46
|
+
}
|
|
47
|
+
function fe(e) {
|
|
48
|
+
return T(e, "cfo") || T(e, "finance_admin") || T(e, "finance-admin");
|
|
49
|
+
}
|
|
50
|
+
function pe(e, t = u) {
|
|
51
|
+
let n = e.find((e) => e.isSystemRole === !0 && T(e.key, "admin")), r = e.find((e) => e.isSystemRole === !0 && fe(e.key)), i = e.filter((e) => e.isSystemRole === !0 && e !== n && e !== r && !E(e.key, "employee") && !E(e.key, "bookkeeper")).map((e) => ({
|
|
52
|
+
id: e.id,
|
|
53
|
+
label: e.name
|
|
54
|
+
})), a = e.filter((e) => !e.isSystemRole && e.status?.toLowerCase() === "active").map((e) => ({
|
|
55
|
+
id: e.id,
|
|
56
|
+
label: e.name
|
|
57
|
+
}));
|
|
58
|
+
return [
|
|
59
|
+
...n ? [{
|
|
60
|
+
id: n.id,
|
|
61
|
+
label: t.AdminLabel,
|
|
62
|
+
sublabel: t.AdminSublabel
|
|
63
|
+
}] : [],
|
|
64
|
+
{
|
|
65
|
+
id: "reporting_manager",
|
|
66
|
+
label: t.ReportingManagerLabel,
|
|
67
|
+
sublabel: t.ReportingManagerSublabel
|
|
68
|
+
},
|
|
69
|
+
...r ? [{
|
|
70
|
+
id: r.id,
|
|
71
|
+
label: t.CfoLabel,
|
|
72
|
+
sublabel: t.CfoSublabel
|
|
73
|
+
}] : [],
|
|
74
|
+
...i,
|
|
75
|
+
...a
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
function D(e) {
|
|
79
|
+
let t = e.minAmount.trim() !== "", n = e.maxAmount.trim() !== "";
|
|
80
|
+
return t && n ? p.InRange : t ? p.GreaterThanOrEqual : n ? p.LessThan : p.All;
|
|
81
|
+
}
|
|
82
|
+
function O(e) {
|
|
83
|
+
return [e.conditionType === p.LessThan || e.conditionType === p.All ? 0 : Math.round((e.minAmount ?? 0) * 100), e.conditionType === p.GreaterThanOrEqual || e.conditionType === p.All ? Infinity : Math.round((e.maxAmount ?? 0) * 100)];
|
|
84
|
+
}
|
|
85
|
+
function me(e) {
|
|
86
|
+
if (e.length === 0) return !1;
|
|
87
|
+
let t = e.map(O).sort((e, t) => e[0] - t[0]);
|
|
88
|
+
if (t[0][0] > 0) return !1;
|
|
89
|
+
let n = 0;
|
|
90
|
+
for (let [e, r] of t) {
|
|
91
|
+
if (e > n) return !1;
|
|
92
|
+
n = Math.max(n, r);
|
|
93
|
+
}
|
|
94
|
+
return n === Infinity;
|
|
95
|
+
}
|
|
96
|
+
function he(e) {
|
|
97
|
+
if (e.length === 0) return [];
|
|
98
|
+
let t = e.map(O).sort((e, t) => e[0] - t[0]), n = [], r = 0;
|
|
99
|
+
for (let [e, i] of t) e > r && n.push({
|
|
100
|
+
from: r / 100,
|
|
101
|
+
to: (e - 1) / 100
|
|
102
|
+
}), r = Math.max(r, i);
|
|
103
|
+
return r !== Infinity && n.push({
|
|
104
|
+
from: r / 100,
|
|
105
|
+
to: null
|
|
106
|
+
}), n;
|
|
107
|
+
}
|
|
108
|
+
function k(e) {
|
|
109
|
+
let t = l(e.minAmount), n = l(e.maxAmount), r = t.status === "ok" ? t.minorUnits : 0, i = n.status === "ok" ? n.minorUnits + 1 : 0, a = D(e);
|
|
110
|
+
return [a === p.LessThan || a === p.All ? 0 : r, a === p.GreaterThanOrEqual || a === p.All ? Infinity : i];
|
|
111
|
+
}
|
|
112
|
+
function A(e, t, n) {
|
|
113
|
+
let [r, i] = k(e);
|
|
114
|
+
return t.filter((e) => e.id !== n).some((e) => {
|
|
115
|
+
let [t, n] = O(e);
|
|
116
|
+
return r < n && t < i;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
function j(e, t, n, r = d) {
|
|
120
|
+
let i = {}, a = e.minAmount.trim() !== "", o = e.maxAmount.trim() !== "", s = l(e.minAmount), c = l(e.maxAmount);
|
|
121
|
+
return a && s.status !== "ok" && (i.minAmount = r.InvalidMinAmount), o && (c.status !== "ok" || !Number.isSafeInteger(c.minorUnits + 1)) && (i.maxAmount = r.InvalidMaxAmount), a && o && !i.minAmount && !i.maxAmount && s.status === "ok" && c.status === "ok" && s.minorUnits > c.minorUnits && (i.maxAmount = r.MaxLessThanOrEqualToMin), e.outcome === m.RequireApproval && e.approvers.length === 0 && (i.approvers = r.ApproversRequired), !i.minAmount && !i.maxAmount && A(e, t, n) && (o ? i.maxAmount = r.ConflictsWithAnotherRule : i.minAmount = r.ConflictsWithAnotherRule), i;
|
|
122
|
+
}
|
|
123
|
+
function M(e, t) {
|
|
124
|
+
let n = D(t), r = l(t.minAmount);
|
|
125
|
+
return {
|
|
126
|
+
id: e,
|
|
127
|
+
conditionType: n,
|
|
128
|
+
minAmount: (n === p.InRange || n === p.GreaterThanOrEqual) && r.status === "ok" ? r.minorUnits / 100 : void 0,
|
|
129
|
+
maxAmount: n === p.LessThan || n === p.InRange ? _(t.maxAmount) : void 0,
|
|
130
|
+
outcome: t.outcome,
|
|
131
|
+
approvers: t.outcome === m.RequireApproval ? t.approvers : []
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function ge(e) {
|
|
135
|
+
return {
|
|
136
|
+
minAmount: e.minAmount == null ? "" : String(e.minAmount),
|
|
137
|
+
maxAmount: e.maxAmount == null ? "" : v(e.maxAmount),
|
|
138
|
+
outcome: e.outcome,
|
|
139
|
+
approvers: e.approvers
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function N({ headerActionContainer: c, labels: l }) {
|
|
143
|
+
let f = x(() => ({
|
|
144
|
+
...u,
|
|
145
|
+
...l?.approvers
|
|
146
|
+
}), [l?.approvers]), p = x(() => ({
|
|
147
|
+
...d,
|
|
148
|
+
...l?.validation
|
|
149
|
+
}), [l?.validation]), _ = x(() => ({
|
|
150
|
+
...ie,
|
|
151
|
+
...l?.errors
|
|
152
|
+
}), [l?.errors]), v = x(() => ({
|
|
153
|
+
...oe,
|
|
154
|
+
...l?.toast
|
|
155
|
+
}), [l?.toast]), E = s();
|
|
156
|
+
b(() => {
|
|
157
|
+
E(ae.Mounted);
|
|
158
|
+
}, [E]);
|
|
159
|
+
let { initResponse: D } = ee(), O = te(), k = t(n().organizationStatus), A = D?.scopes?.includes(r.RoleReadOrg) ?? !1, { data: N, isResolving: P, isError: _e, refetch: ve } = i({ enabled: A }), ye = x(() => pe(N?.data ?? [], f), [N, f]), be = x(() => {
|
|
160
|
+
let e = N?.data ?? [], t = e.find((e) => e.isSystemRole === !0 && T(e.key, "admin")), n = e.find((e) => e.isSystemRole === !0 && fe(e.key)), r = { reporting_manager: f.ReportingManagerLabel };
|
|
161
|
+
t && (r[t.id] = f.AdminLabel), n && (r[n.id] = f.CfoLabel);
|
|
162
|
+
for (let t of e) r[t.id] || (r[t.id] = t.name);
|
|
163
|
+
return r;
|
|
164
|
+
}, [N, f]), { rules: F, isLoading: I, isError: xe, refetch: Se, hasLoaded: L, saveStatus: R, createRule: Ce, updateRule: we, deleteRule: Te } = ce(be), [z, B] = S(!1), [V, H] = S(null), [U, W] = S(!1), [G, K] = S(w), [q, J] = S(null), [Y, X] = S(null), Z = le(v);
|
|
165
|
+
b(() => {
|
|
166
|
+
Z.current = v;
|
|
167
|
+
}, [v]), b(() => {
|
|
168
|
+
R === "success" && e.success(Z.current.Saved), R === "error" && e.error(Z.current.FailedToSave);
|
|
169
|
+
}, [R]);
|
|
170
|
+
let Q = I || O && !D || k && !L, Ee = me(F), De = he(F), $ = Q || P || R === "saving", Oe = U && z ? j(G, F, void 0, p) : {}, ke = Y && q && z ? j(Y, F, q, p) : {}, Ae = () => {
|
|
171
|
+
B(!1), W(!0), K(w);
|
|
172
|
+
}, je = () => {
|
|
173
|
+
B(!1), W(!1);
|
|
174
|
+
}, Me = async () => {
|
|
175
|
+
B(!0);
|
|
176
|
+
let e = j(G, F, void 0, p);
|
|
177
|
+
if (Object.keys(e).length > 0) return;
|
|
178
|
+
let t = crypto.randomUUID();
|
|
179
|
+
await Ce(M(t, G)) && (W(!1), K(w));
|
|
180
|
+
}, Ne = (e) => {
|
|
181
|
+
K(e);
|
|
182
|
+
}, Pe = (e) => {
|
|
183
|
+
B(!1);
|
|
184
|
+
let t = F.find((t) => t.id === e);
|
|
185
|
+
t && (W(!1), K(w), J(e), X(ge(t)));
|
|
186
|
+
}, Fe = () => {
|
|
187
|
+
B(!1), J(null), X(null);
|
|
188
|
+
}, Ie = async () => {
|
|
189
|
+
if (B(!0), !q || !Y) return;
|
|
190
|
+
let e = j(Y, F, q, p);
|
|
191
|
+
Object.keys(e).length > 0 || await we(q, M(q, Y)) && (J(null), X(null));
|
|
192
|
+
}, Le = (e) => {
|
|
193
|
+
X(e);
|
|
194
|
+
}, Re = (() => {
|
|
195
|
+
let e = F.find((e) => e.id === V);
|
|
196
|
+
if (!e) return;
|
|
197
|
+
let t = {
|
|
198
|
+
...ne,
|
|
199
|
+
...l?.deleteDialog
|
|
200
|
+
}, n = {
|
|
201
|
+
...h,
|
|
202
|
+
...l?.ruleCard
|
|
203
|
+
}, r = y(e, n).title ?? "", i = e.outcome === m.AutoApprove ? n.AutoApprove : `${n.RequireApprovalFrom} ${e.approvers.map((e) => e.label).join(` ${n.ApproverSeparator} `)}`;
|
|
204
|
+
return [{
|
|
205
|
+
label: t.Range,
|
|
206
|
+
value: r
|
|
207
|
+
}, {
|
|
208
|
+
label: t.Outcome,
|
|
209
|
+
value: i
|
|
210
|
+
}];
|
|
211
|
+
})(), ze = async () => {
|
|
212
|
+
V && await Te(V) && (q === V && (J(null), X(null)), H(null));
|
|
213
|
+
};
|
|
214
|
+
return D !== void 0 && !A ? /* @__PURE__ */ C(o, {
|
|
215
|
+
title: _.MissingRolePermissionTitle,
|
|
216
|
+
description: _.MissingRolePermissionDescription
|
|
217
|
+
}) : _e ? /* @__PURE__ */ C(o, {
|
|
218
|
+
title: _.RolesUnavailableTitle,
|
|
219
|
+
description: _.RolesUnavailableDescription,
|
|
220
|
+
retryLabel: _.Retry,
|
|
221
|
+
onRetry: () => void ve()
|
|
222
|
+
}) : xe && !I && !L ? /* @__PURE__ */ C(o, {
|
|
223
|
+
title: _.PoliciesUnavailableTitle,
|
|
224
|
+
description: _.PoliciesUnavailableDescription,
|
|
225
|
+
retryLabel: _.Retry,
|
|
226
|
+
onRetry: () => void Se()
|
|
227
|
+
}) : /* @__PURE__ */ de(ue, { children: [
|
|
228
|
+
/* @__PURE__ */ C(a, {}),
|
|
229
|
+
/* @__PURE__ */ C(se, {
|
|
230
|
+
rules: F.map((e) => y(e, {
|
|
231
|
+
...h,
|
|
232
|
+
...l?.ruleCard
|
|
233
|
+
})),
|
|
234
|
+
labels: l,
|
|
235
|
+
isBusy: $,
|
|
236
|
+
isLoading: Q,
|
|
237
|
+
isAddingRule: U,
|
|
238
|
+
newRuleFormValues: G,
|
|
239
|
+
newRuleValidationErrors: Oe,
|
|
240
|
+
editingRuleId: q,
|
|
241
|
+
editingRuleFormValues: Y,
|
|
242
|
+
editingRuleValidationErrors: ke,
|
|
243
|
+
approverOptions: $ ? [] : ye,
|
|
244
|
+
allExpensesAreCovered: Ee,
|
|
245
|
+
gapIntervals: De,
|
|
246
|
+
onAddRuleClick: Ae,
|
|
247
|
+
headerActionContainer: c,
|
|
248
|
+
onCancelAddRule: je,
|
|
249
|
+
onSaveNewRule: () => void Me(),
|
|
250
|
+
onNewRuleFormChange: Ne,
|
|
251
|
+
onEditRule: Pe,
|
|
252
|
+
onCancelEditRule: Fe,
|
|
253
|
+
onSaveEditRule: () => void Ie(),
|
|
254
|
+
onEditRuleFormChange: Le,
|
|
255
|
+
onDeleteRule: H,
|
|
256
|
+
testIds: {
|
|
257
|
+
ruleCard: { root: g.ruleCard },
|
|
258
|
+
ruleForm: {
|
|
259
|
+
root: g.ruleForm,
|
|
260
|
+
saveButton: g.ruleFormSaveButton,
|
|
261
|
+
minAmountInput: g.ruleFormMinAmountInput,
|
|
262
|
+
maxAmountInput: g.ruleFormMaxAmountInput
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}),
|
|
266
|
+
/* @__PURE__ */ C(re, {
|
|
267
|
+
labels: l?.deleteDialog,
|
|
268
|
+
details: Re,
|
|
269
|
+
open: V !== null,
|
|
270
|
+
onOpenChange: (e) => {
|
|
271
|
+
e || H(null);
|
|
272
|
+
},
|
|
273
|
+
onCancel: () => H(null),
|
|
274
|
+
onConfirm: () => void ze(),
|
|
275
|
+
isDeleting: R === "saving"
|
|
276
|
+
})
|
|
277
|
+
] });
|
|
278
|
+
}
|
|
279
|
+
function P({ token: e, orgId: t, widgetToken: n, organizationId: r, headerActionContainer: i, labels: a, ...o } = {}) {
|
|
280
|
+
return /* @__PURE__ */ C(c, {
|
|
281
|
+
...o,
|
|
282
|
+
widgetName: f,
|
|
283
|
+
widgetToken: n === void 0 ? e : n,
|
|
284
|
+
organizationId: r === void 0 ? t : r,
|
|
285
|
+
children: /* @__PURE__ */ C(N, {
|
|
286
|
+
headerActionContainer: i,
|
|
287
|
+
labels: a
|
|
288
|
+
})
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
export { P as ExpenseApprovalPoliciesWidget, P as default, pe as buildApproverOptions, T as isEmbeddedSystemRoleKey, E as roleKeyHasSegment };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AmountConditionType as e, ApprovalOutcomeType as t } from "./index2.js";
|
|
2
2
|
import { ApprovalRuleCardLabels as n, ApprovalRuleToastLabels as r } from "./index3.js";
|
|
3
|
-
import
|
|
3
|
+
import "./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 ApprovalRuleCardLabels, r as ApprovalRuleToastLabels,
|
|
7
|
+
import { ExpenseApprovalsPage as i } from "./index8.js";
|
|
8
|
+
export { e as AmountConditionType, t as ApprovalOutcomeType, n as ApprovalRuleCardLabels, r as ApprovalRuleToastLabels, i as ExpenseApprovalsPage };
|
|
@@ -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 };
|