@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
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
// ../../libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index9.js
|
|
2
2
|
var e = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
createTitle: "Add group",
|
|
4
|
+
editTitle: "Edit group",
|
|
5
|
+
description: "Name the group and assign members.",
|
|
6
|
+
nameLabel: "Name",
|
|
7
|
+
namePlaceholder: "Enter a name",
|
|
8
|
+
nameRequired: "Name is required.",
|
|
9
|
+
membersLabel: "Members",
|
|
10
|
+
membersSearchPlaceholder: "Search members",
|
|
11
|
+
membersEmptyMessage: "No members found.",
|
|
12
|
+
cancelButton: "Cancel",
|
|
13
|
+
saveButton: "Save",
|
|
14
|
+
deleteButton: "Delete",
|
|
15
|
+
close: "Close"
|
|
16
|
+
};
|
|
17
|
+
export { e as DEFAULT_GROUP_ADMIN_DRAWER_LABELS };
|
|
@@ -14,7 +14,7 @@ function c({ labels: c, sections: l, selectedSectionId: u, onSectionChange: d })
|
|
|
14
14
|
...c
|
|
15
15
|
};
|
|
16
16
|
return /* @__PURE__ */ s("section", {
|
|
17
|
-
className: "ttw:w-full ttw:
|
|
17
|
+
className: "ttw:flex ttw:w-full ttw:flex-col ttw:gap-4",
|
|
18
18
|
children: [f.description ? /* @__PURE__ */ o("div", {
|
|
19
19
|
className: "ttw:min-w-0",
|
|
20
20
|
children: /* @__PURE__ */ o("p", {
|
|
@@ -27,7 +27,7 @@ function c({ labels: c, sections: l, selectedSectionId: u, onSectionChange: d })
|
|
|
27
27
|
className: "ttw:w-full",
|
|
28
28
|
children: /* @__PURE__ */ s("div", {
|
|
29
29
|
"data-slot": "settings-widget-layout",
|
|
30
|
-
className: "ttw:flex ttw:w-full ttw:flex-wrap ttw:gap-
|
|
30
|
+
className: "ttw:flex ttw:w-full ttw:flex-wrap ttw:gap-6",
|
|
31
31
|
children: [/* @__PURE__ */ o("div", {
|
|
32
32
|
"data-slot": "settings-widget-nav",
|
|
33
33
|
className: "ttw:flex ttw:basis-56 ttw:grow-0 ttw:shrink-0 ttw:flex-col ttw:gap-4",
|
|
@@ -7,11 +7,11 @@ import { ErrorState as t } from "../../../../ui/dist/lib/ErrorState/ErrorState.j
|
|
|
7
7
|
import "../../../../ui/dist/index.js";
|
|
8
8
|
import { ApprovalPoliciesSettingsDefaultLabels as n } from "./labels.js";
|
|
9
9
|
import { approvalPolicyTestIds as r } from "./testIds.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { ApprovalPoliciesList as s } from "../../../ui/dist/index20.js";
|
|
10
|
+
import { ApprovalPoliciesHeader as i } from "../../../ui/dist/index11.js";
|
|
11
|
+
import { DeleteRuleDialog as a } from "../../../ui/dist/index19.js";
|
|
12
|
+
import { ApprovalPoliciesList as o } from "../../../ui/dist/index21.js";
|
|
14
13
|
import "../../../ui/dist/index.js";
|
|
14
|
+
import { useApprovalPolicyRules as s } from "./useApprovalPolicyRules.js";
|
|
15
15
|
import { useMemo as c } from "react";
|
|
16
16
|
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
17
17
|
// ../../libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/ApprovalPoliciesSettings.js
|
|
@@ -19,14 +19,14 @@ function d({ labels: d, componentLabels: f, headingComponent: p = "h3", showHead
|
|
|
19
19
|
let h = c(() => ({
|
|
20
20
|
...n,
|
|
21
21
|
...d
|
|
22
|
-
}), [d]), g =
|
|
22
|
+
}), [d]), g = s({
|
|
23
23
|
labels: h,
|
|
24
24
|
componentLabels: f
|
|
25
25
|
});
|
|
26
26
|
return /* @__PURE__ */ u("div", {
|
|
27
27
|
className: "ttw:flex ttw:flex-col ttw:gap-6",
|
|
28
28
|
children: [
|
|
29
|
-
/* @__PURE__ */ l(
|
|
29
|
+
/* @__PURE__ */ l(i, {
|
|
30
30
|
labels: f?.header,
|
|
31
31
|
headingComponent: p,
|
|
32
32
|
showTitle: m,
|
|
@@ -43,7 +43,7 @@ function d({ labels: d, componentLabels: f, headingComponent: p = "h3", showHead
|
|
|
43
43
|
description: h.loadErrorDescription,
|
|
44
44
|
retryLabel: h.loadErrorRetry,
|
|
45
45
|
onRetry: g.onRetry
|
|
46
|
-
}) : /* @__PURE__ */ l(
|
|
46
|
+
}) : /* @__PURE__ */ l(o, {
|
|
47
47
|
items: g.items,
|
|
48
48
|
editingId: g.editingId,
|
|
49
49
|
onAddRule: g.onAddRule,
|
|
@@ -68,8 +68,9 @@ function d({ labels: d, componentLabels: f, headingComponent: p = "h3", showHead
|
|
|
68
68
|
gapCoverageAlert: { root: r.gapCoverageAlert }
|
|
69
69
|
}
|
|
70
70
|
}),
|
|
71
|
-
/* @__PURE__ */ l(
|
|
71
|
+
/* @__PURE__ */ l(a, {
|
|
72
72
|
open: g.deleteDialog.open,
|
|
73
|
+
details: g.deleteDialog.details,
|
|
73
74
|
onOpenChange: g.deleteDialog.onOpenChange,
|
|
74
75
|
onConfirm: g.deleteDialog.onConfirm,
|
|
75
76
|
onCancel: g.deleteDialog.onCancel,
|
|
@@ -12,22 +12,25 @@ import { nextPolicyPriority as a } from "../../../util/dist/lib/policyPriority.j
|
|
|
12
12
|
import { buildApprovalPolicyScript as ee, parseApprovalPolicyScript as o } from "../../../util/dist/lib/policyScript.js";
|
|
13
13
|
import { buildApprovalPolicyTrigger as te, parseApprovalPolicyTrigger as s } from "../../../util/dist/lib/policyTrigger.js";
|
|
14
14
|
import { validatePolicyDraft as ne } from "../../../util/dist/lib/validatePolicyDraft.js";
|
|
15
|
-
import { buildPolicySentence as re, buildPolicyTitle as c, buildUnlistedPoliciesHeading as ie, gapId as ae, lockUnavailableApprovers as oe, toAmountConditionErrors as
|
|
16
|
-
import { useApproverOptions as
|
|
17
|
-
import { approvalPolicyTestIds as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
15
|
+
import { buildPolicySentence as re, buildPolicyTitle as c, buildUnlistedPoliciesHeading as ie, gapId as ae, lockUnavailableApprovers as oe, toAmountConditionErrors as se, toAmountConditionValue as l, toApproverErrors as ce, toApproverGroupRefs as le, toApproverSteps as ue, toGapRanges as de } from "./policyViewModel.js";
|
|
16
|
+
import { useApproverOptions as fe } from "./useApproverOptions.js";
|
|
17
|
+
import { approvalPolicyTestIds as u } from "./testIds.js";
|
|
18
|
+
import { PolicyCardDefaultLabels as pe } from "../../../ui/dist/index15.js";
|
|
19
|
+
import { DeleteRuleDialogDefaultLabels as me } from "../../../ui/dist/index18.js";
|
|
20
|
+
import "../../../ui/dist/index.js";
|
|
21
|
+
import { ApprovalPolicyObjectType as he } from "../../../data-access/dist/lib/queryKeys.js";
|
|
22
|
+
import { useDeleteApprovalPoliciesIdMutation as ge, useGetApprovalPoliciesQuery as d, usePatchApprovalPoliciesIdMutation as f, usePostApprovalPoliciesMutation as p } from "../../../data-access/dist/lib/approvalPoliciesApi.js";
|
|
20
23
|
import "../../../data-access/dist/index.js";
|
|
21
24
|
import { useCallback as m, useEffect as h, useMemo as g, useRef as _, useState as v } from "react";
|
|
22
25
|
// ../../libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/useApprovalPolicyRules.js
|
|
23
|
-
var y = "draft",
|
|
26
|
+
var y = "draft", _e = {
|
|
24
27
|
lower: "",
|
|
25
28
|
upper: ""
|
|
26
29
|
}, b = {
|
|
27
30
|
lower: !1,
|
|
28
31
|
upper: !1
|
|
29
32
|
};
|
|
30
|
-
function
|
|
33
|
+
function ve(e) {
|
|
31
34
|
return e.map((e) => {
|
|
32
35
|
let t = s(e.trigger), n = o(e.script), r = t.currency === void 0 || t.currency === "USD", i = e.status === "active", a = t.hasKnownAmountBounds && r;
|
|
33
36
|
return {
|
|
@@ -42,18 +45,18 @@ function ge(e) {
|
|
|
42
45
|
};
|
|
43
46
|
});
|
|
44
47
|
}
|
|
45
|
-
function
|
|
48
|
+
function ye(e) {
|
|
46
49
|
return [...e].sort((e, t) => (e.condition.min ?? 0) - (t.condition.min ?? 0));
|
|
47
50
|
}
|
|
48
|
-
function
|
|
49
|
-
let y =
|
|
50
|
-
|
|
51
|
+
function x({ labels: o, componentLabels: s }) {
|
|
52
|
+
let y = d(), x = p(), S = f(), C = ge(), w = fe(), { organizationId: T, organizationStatus: E } = r(), [D, O] = v(null), [k, A] = v(null), j = n(E), M = _(T);
|
|
53
|
+
T && T !== M.current && (M.current = T, O(null), A(null)), E === t.None && (D || k) && (O(null), A(null));
|
|
51
54
|
let N = _(0), P = m(() => (N.current += 1, {
|
|
52
55
|
id: `group-new-${N.current}`,
|
|
53
56
|
selectedItems: []
|
|
54
|
-
}), []), F = g(() =>
|
|
57
|
+
}), []), F = g(() => ve(y.data?.data ?? []), [y.data]), I = g(() => w.isResolving ? [] : ye(F.flatMap((e) => {
|
|
55
58
|
if (!e.isRepresentable) return [];
|
|
56
|
-
let t =
|
|
59
|
+
let t = ue(e.groups, w.lookup);
|
|
57
60
|
return t === void 0 ? [] : [{
|
|
58
61
|
id: e.id,
|
|
59
62
|
priority: e.priority,
|
|
@@ -62,22 +65,22 @@ function S({ labels: o, componentLabels: s }) {
|
|
|
62
65
|
}];
|
|
63
66
|
})), [
|
|
64
67
|
F,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
]), L =
|
|
68
|
+
w.isResolving,
|
|
69
|
+
w.lookup
|
|
70
|
+
]), L = D ? D.policyId ?? "draft" : null, R = j || y.isResolving || w.isResolving, z = D?.policyId != null && D.policyId !== k && !!T && !R && !I.some((e) => e.id === D.policyId);
|
|
68
71
|
h(() => {
|
|
69
|
-
z && (
|
|
72
|
+
z && (O(null), e.error(o.approverUnavailable));
|
|
70
73
|
}, [z, o.approverUnavailable]);
|
|
71
74
|
let B = g(() => new Set(I.map((e) => e.id)), [I]), V = g(() => R ? [] : F.filter((e) => !B.has(e.id)), [
|
|
72
75
|
R,
|
|
73
76
|
F,
|
|
74
77
|
B
|
|
75
78
|
]), H = g(() => {
|
|
76
|
-
if (!
|
|
77
|
-
let e = (e) => e.id !==
|
|
79
|
+
if (!D) return;
|
|
80
|
+
let e = (e) => e.id !== D.policyId;
|
|
78
81
|
return ne({
|
|
79
|
-
amount:
|
|
80
|
-
groups:
|
|
82
|
+
amount: D.amount,
|
|
83
|
+
groups: D.steps.map((e) => ({
|
|
81
84
|
id: e.id,
|
|
82
85
|
approverIds: e.selectedItems.map((e) => e.id)
|
|
83
86
|
})),
|
|
@@ -85,15 +88,15 @@ function S({ labels: o, componentLabels: s }) {
|
|
|
85
88
|
unlistedConditions: V.filter((t) => t.hasKnownCondition && e(t)).map((e) => e.condition)
|
|
86
89
|
});
|
|
87
90
|
}, [
|
|
88
|
-
|
|
91
|
+
D,
|
|
89
92
|
I,
|
|
90
93
|
V
|
|
91
|
-
]), U = g(() => i(F.filter((e) => e.coversNow).map((e) => e.condition)), [F]), W = g(() => F.filter((e) => e.hasKnownCondition).map((e) => e.condition), [F]), G = g(() => F.length === 0 ? [] :
|
|
94
|
+
]), U = g(() => i(F.filter((e) => e.coversNow).map((e) => e.condition)), [F]), W = g(() => F.filter((e) => e.hasKnownCondition).map((e) => e.condition), [F]), G = g(() => F.length === 0 ? [] : de(U, o, W), [
|
|
92
95
|
F.length,
|
|
93
96
|
U,
|
|
94
97
|
o,
|
|
95
98
|
W
|
|
96
|
-
]),
|
|
99
|
+
]), be = g(() => i(W), [W]), xe = !R && F.length > 0 && be.length === 0 ? I.length === 0 ? o.addRuleFullyCoveredUnlisted : o.addRuleFullyCovered : void 0, [K, Se] = v(0), q = _(null);
|
|
97
100
|
h(() => {
|
|
98
101
|
K !== 0 && q.current?.scrollIntoView({
|
|
99
102
|
behavior: globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth",
|
|
@@ -101,17 +104,17 @@ function S({ labels: o, componentLabels: s }) {
|
|
|
101
104
|
});
|
|
102
105
|
}, [K]);
|
|
103
106
|
let J = m((e) => {
|
|
104
|
-
|
|
107
|
+
O({
|
|
105
108
|
policyId: null,
|
|
106
109
|
amount: e,
|
|
107
110
|
steps: [P()],
|
|
108
111
|
touchedAmount: b
|
|
109
|
-
}),
|
|
110
|
-
}, [P]),
|
|
111
|
-
J(
|
|
112
|
-
}, [J]),
|
|
112
|
+
}), Se((e) => e + 1);
|
|
113
|
+
}, [P]), Ce = m(() => {
|
|
114
|
+
J(_e);
|
|
115
|
+
}, [J]), Y = m((e) => {
|
|
113
116
|
let t = U.find((t) => ae(t) === e);
|
|
114
|
-
t && G.find((t) => t.id === e)?.blockedReason === void 0 && J(
|
|
117
|
+
t && G.find((t) => t.id === e)?.blockedReason === void 0 && J(l({
|
|
115
118
|
type: "between",
|
|
116
119
|
min: t.min,
|
|
117
120
|
max: t.max
|
|
@@ -120,97 +123,92 @@ function S({ labels: o, componentLabels: s }) {
|
|
|
120
123
|
U,
|
|
121
124
|
G,
|
|
122
125
|
J
|
|
123
|
-
]),
|
|
124
|
-
|
|
125
|
-
}, []),
|
|
126
|
-
if (!
|
|
127
|
-
|
|
126
|
+
]), X = m(() => {
|
|
127
|
+
O(null);
|
|
128
|
+
}, []), Z = x.isPending || S.isPending || C.isPending, Q = m(async () => {
|
|
129
|
+
if (!D || !H) return;
|
|
130
|
+
if (!H.isValid) {
|
|
131
|
+
O((e) => e && {
|
|
132
|
+
...e,
|
|
133
|
+
touchedAmount: {
|
|
134
|
+
lower: !0,
|
|
135
|
+
upper: !0
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
let t = H.condition, n = le(D.steps, w.lookup);
|
|
128
141
|
if (!n) {
|
|
129
142
|
e.error(o.approverUnavailable);
|
|
130
143
|
return;
|
|
131
144
|
}
|
|
132
145
|
let r = te(t), i = ee(n), s = c(t, o);
|
|
133
146
|
try {
|
|
134
|
-
|
|
135
|
-
object_type:
|
|
147
|
+
D.policyId === null ? await x.mutateAsync({ body: {
|
|
148
|
+
object_type: he.Payable,
|
|
136
149
|
name: s,
|
|
137
150
|
trigger: r,
|
|
138
151
|
script: i,
|
|
139
152
|
priority: a(F.map((e) => e.priority))
|
|
140
|
-
} }) : await
|
|
141
|
-
path: { approval_policy_id:
|
|
153
|
+
} }) : await S.mutateAsync({
|
|
154
|
+
path: { approval_policy_id: D.policyId },
|
|
142
155
|
body: {
|
|
143
156
|
name: s,
|
|
144
157
|
trigger: r,
|
|
145
158
|
script: i
|
|
146
159
|
}
|
|
147
|
-
}),
|
|
160
|
+
}), O(null), e.success(o.ruleSaved);
|
|
148
161
|
} catch {
|
|
149
162
|
e.error(o.ruleSaveFailed);
|
|
150
163
|
}
|
|
151
164
|
}, [
|
|
152
|
-
|
|
165
|
+
D,
|
|
153
166
|
H,
|
|
154
|
-
|
|
167
|
+
w.lookup,
|
|
155
168
|
o,
|
|
156
169
|
F,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
]),
|
|
160
|
-
if (
|
|
161
|
-
await
|
|
170
|
+
x,
|
|
171
|
+
S
|
|
172
|
+
]), we = m(async () => {
|
|
173
|
+
if (k && T) try {
|
|
174
|
+
await C.mutateAsync({ path: { approval_policy_id: k } }), A(null), O(null), e.success(o.ruleDeleted);
|
|
162
175
|
} catch {
|
|
163
|
-
|
|
176
|
+
e.error(o.ruleDeleteFailed);
|
|
164
177
|
}
|
|
165
178
|
}, [
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
179
|
+
k,
|
|
180
|
+
T,
|
|
181
|
+
C,
|
|
169
182
|
o
|
|
170
|
-
]),
|
|
171
|
-
if (!
|
|
172
|
-
let e =
|
|
183
|
+
]), Te = R || Z || !T, $ = g(() => {
|
|
184
|
+
if (!D || !H || Z) return;
|
|
185
|
+
let e = se(H.amountErrors, o);
|
|
173
186
|
if (e) return {
|
|
174
|
-
lower:
|
|
175
|
-
upper:
|
|
187
|
+
lower: D.touchedAmount.lower ? e.lower : void 0,
|
|
188
|
+
upper: D.touchedAmount.upper ? e.upper : void 0
|
|
176
189
|
};
|
|
177
190
|
}, [
|
|
178
|
-
|
|
191
|
+
D,
|
|
179
192
|
H,
|
|
180
|
-
|
|
193
|
+
Z,
|
|
181
194
|
o
|
|
182
|
-
])
|
|
183
|
-
if (!H || H.isValid) return;
|
|
184
|
-
let e = se(H.groupErrors, o), t = l(H.amountErrors, o), n = [
|
|
185
|
-
...Object.values(e?.steps ?? {}),
|
|
186
|
-
t?.lower,
|
|
187
|
-
t?.upper
|
|
188
|
-
].filter((e) => !!e), r = [...new Set(n)];
|
|
189
|
-
return r.length > 0 ? r : void 0;
|
|
190
|
-
}, [H, o]);
|
|
195
|
+
]);
|
|
191
196
|
return {
|
|
192
197
|
items: g(() => {
|
|
193
198
|
let e = {
|
|
194
|
-
onAmountConditionChange: (e) =>
|
|
199
|
+
onAmountConditionChange: (e) => O((t) => t && {
|
|
195
200
|
...t,
|
|
196
201
|
amount: e
|
|
197
202
|
}),
|
|
198
|
-
|
|
199
|
-
...t,
|
|
200
|
-
touchedAmount: {
|
|
201
|
-
...t.touchedAmount,
|
|
202
|
-
[e]: !0
|
|
203
|
-
}
|
|
204
|
-
}),
|
|
205
|
-
onApproverStepsChange: (e) => k((t) => t && {
|
|
203
|
+
onApproverStepsChange: (e) => O((t) => t && {
|
|
206
204
|
...t,
|
|
207
205
|
steps: e
|
|
208
206
|
}),
|
|
209
|
-
onAddApproverStep: () =>
|
|
207
|
+
onAddApproverStep: () => O((e) => e && {
|
|
210
208
|
...e,
|
|
211
209
|
steps: [...e.steps, P()]
|
|
212
210
|
}),
|
|
213
|
-
onRemoveApproverStep: (e) =>
|
|
211
|
+
onRemoveApproverStep: (e) => O((t) => t && {
|
|
214
212
|
...t,
|
|
215
213
|
steps: t.steps.filter((t) => t.id !== e)
|
|
216
214
|
})
|
|
@@ -219,95 +217,111 @@ function S({ labels: o, componentLabels: s }) {
|
|
|
219
217
|
title: c(n, o),
|
|
220
218
|
sentence: re(n, o),
|
|
221
219
|
approverSteps: r.map((e) => oe(e, {
|
|
222
|
-
lookup:
|
|
220
|
+
lookup: w.lookup,
|
|
223
221
|
labels: o,
|
|
224
222
|
usedByOtherSteps: i ? new Set(r.filter((t) => t.id !== e.id).flatMap((e) => e.selectedItems.map((e) => e.id))) : void 0
|
|
225
223
|
})),
|
|
226
224
|
addApproverStepDisabled: r.some((e) => e.selectedItems.length === 0),
|
|
227
|
-
approverOptions:
|
|
228
|
-
amountCondition:
|
|
229
|
-
amountConditionErrors: i ?
|
|
225
|
+
approverOptions: w.options,
|
|
226
|
+
amountCondition: l(n),
|
|
227
|
+
amountConditionErrors: i ? $ : void 0,
|
|
230
228
|
onEdit: () => {
|
|
231
|
-
|
|
229
|
+
O({
|
|
232
230
|
policyId: t,
|
|
233
|
-
amount:
|
|
231
|
+
amount: l(n),
|
|
234
232
|
steps: r,
|
|
235
233
|
touchedAmount: b
|
|
236
234
|
});
|
|
237
235
|
},
|
|
238
|
-
onCancel:
|
|
239
|
-
onSave: () => void
|
|
236
|
+
onCancel: X,
|
|
237
|
+
onSave: () => void Q(),
|
|
240
238
|
onDelete: a,
|
|
241
|
-
|
|
242
|
-
saveDisabledReasons: i ? $ : void 0,
|
|
239
|
+
approverErrors: i && D?.touchedAmount.lower && H ? ce(H.groupErrors, o) : void 0,
|
|
243
240
|
labels: s?.policyCard,
|
|
244
241
|
testIds: {
|
|
245
242
|
amountConditionBuilder: {
|
|
246
|
-
root:
|
|
247
|
-
lowerInput:
|
|
248
|
-
upperInput:
|
|
243
|
+
root: u.amountConditionBuilder,
|
|
244
|
+
lowerInput: u.amountConditionLowerInput,
|
|
245
|
+
upperInput: u.amountConditionUpperInput
|
|
249
246
|
},
|
|
250
247
|
approverGroupsBuilder: {
|
|
251
|
-
root:
|
|
252
|
-
loading:
|
|
253
|
-
error:
|
|
254
|
-
description:
|
|
255
|
-
empty:
|
|
256
|
-
addStepButton:
|
|
248
|
+
root: u.approverGroupsBuilder,
|
|
249
|
+
loading: u.approverGroupsLoading,
|
|
250
|
+
error: u.approverGroupsError,
|
|
251
|
+
description: u.approverGroupsDescription,
|
|
252
|
+
empty: u.approverGroupsEmpty,
|
|
253
|
+
addStepButton: u.approverGroupsAddStep
|
|
257
254
|
}
|
|
258
255
|
},
|
|
259
256
|
...e
|
|
260
257
|
}), n = I.map((e) => {
|
|
261
|
-
let n = L === e.id, r = t(e.id, e.condition, n &&
|
|
262
|
-
return n &&
|
|
258
|
+
let n = L === e.id, r = t(e.id, e.condition, n && D ? D.steps : e.steps, n, () => A(e.id));
|
|
259
|
+
return n && D ? {
|
|
263
260
|
...r,
|
|
264
|
-
amountCondition:
|
|
261
|
+
amountCondition: D.amount
|
|
265
262
|
} : r;
|
|
266
263
|
});
|
|
267
|
-
return
|
|
268
|
-
...t("draft", { type: "between" },
|
|
269
|
-
amountCondition:
|
|
264
|
+
return D?.policyId === null && n.unshift({
|
|
265
|
+
...t("draft", { type: "between" }, D.steps, !0, void 0),
|
|
266
|
+
amountCondition: D.amount,
|
|
270
267
|
ref: q
|
|
271
268
|
}), n;
|
|
272
269
|
}, [
|
|
273
270
|
I,
|
|
274
|
-
|
|
271
|
+
D,
|
|
275
272
|
L,
|
|
276
|
-
Q,
|
|
277
273
|
$,
|
|
278
274
|
H,
|
|
279
275
|
o,
|
|
280
276
|
s?.policyCard,
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
277
|
+
w.options,
|
|
278
|
+
w.lookup,
|
|
279
|
+
X,
|
|
284
280
|
P,
|
|
285
|
-
|
|
281
|
+
Q
|
|
286
282
|
]),
|
|
287
283
|
editingId: L,
|
|
288
284
|
gaps: G,
|
|
289
285
|
unlistedPoliciesHeading: ie(V.length, o),
|
|
290
286
|
unlistedPoliciesBlockAmounts: V.some((e) => e.hasKnownCondition),
|
|
291
287
|
unlistedPoliciesStillApply: V.some((e) => e.isActive),
|
|
292
|
-
onAddRule:
|
|
293
|
-
addRuleDisabledReason:
|
|
294
|
-
onSelectGap:
|
|
295
|
-
isBusy:
|
|
288
|
+
onAddRule: Ce,
|
|
289
|
+
addRuleDisabledReason: xe,
|
|
290
|
+
onSelectGap: Y,
|
|
291
|
+
isBusy: Te,
|
|
296
292
|
isLoading: R,
|
|
297
|
-
isError: y.isError ||
|
|
293
|
+
isError: y.isError || w.isError,
|
|
298
294
|
onRetry: () => {
|
|
299
|
-
y.refetch(),
|
|
295
|
+
y.refetch(), w.refetch();
|
|
300
296
|
},
|
|
301
297
|
deleteDialog: {
|
|
302
|
-
open:
|
|
303
|
-
|
|
304
|
-
|
|
298
|
+
open: k !== null,
|
|
299
|
+
details: (() => {
|
|
300
|
+
let e = I.find((e) => e.id === k);
|
|
301
|
+
if (!e) return;
|
|
302
|
+
let t = {
|
|
303
|
+
...me,
|
|
304
|
+
...s?.deleteDialog
|
|
305
|
+
}, n = {
|
|
306
|
+
...pe,
|
|
307
|
+
...s?.policyCard
|
|
308
|
+
};
|
|
309
|
+
return [{
|
|
310
|
+
label: t.Range,
|
|
311
|
+
value: c(e.condition, o)
|
|
312
|
+
}, {
|
|
313
|
+
label: t.Approvers,
|
|
314
|
+
value: e.steps.map((e) => e.selectedItems.map((e) => e.label).join(` ${n.ApproverConnector} `)).join(` ${n.GroupConnector} `)
|
|
315
|
+
}];
|
|
316
|
+
})(),
|
|
317
|
+
isDeleting: C.isPending,
|
|
318
|
+
confirmDisabled: !T,
|
|
305
319
|
onOpenChange: (e) => {
|
|
306
|
-
e ||
|
|
320
|
+
e || A(null);
|
|
307
321
|
},
|
|
308
|
-
onConfirm: () => void
|
|
309
|
-
onCancel: () =>
|
|
322
|
+
onConfirm: () => void we(),
|
|
323
|
+
onCancel: () => A(null)
|
|
310
324
|
}
|
|
311
325
|
};
|
|
312
326
|
}
|
|
313
|
-
export { y as DRAFT_POLICY_ID,
|
|
327
|
+
export { y as DRAFT_POLICY_ID, x as useApprovalPolicyRules };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./index2.js";
|
|
2
|
-
import "./index3.js";
|
|
2
|
+
import { AmountConditionBuilder as e } from "./index3.js";
|
|
3
3
|
import "./index4.js";
|
|
4
4
|
import "./index5.js";
|
|
5
5
|
import "./index6.js";
|
|
@@ -7,13 +7,14 @@ import "./index7.js";
|
|
|
7
7
|
import "./index8.js";
|
|
8
8
|
import "./index9.js";
|
|
9
9
|
import "./index10.js";
|
|
10
|
-
import { ApprovalPoliciesHeader as
|
|
10
|
+
import { ApprovalPoliciesHeader as t } from "./index11.js";
|
|
11
11
|
import "./index13.js";
|
|
12
12
|
import "./index14.js";
|
|
13
|
-
import "./index15.js";
|
|
13
|
+
import { PolicyCardDefaultLabels as n } from "./index15.js";
|
|
14
14
|
import "./index16.js";
|
|
15
|
-
import "./index17.js";
|
|
16
|
-
import {
|
|
17
|
-
import "./index19.js";
|
|
18
|
-
import
|
|
19
|
-
|
|
15
|
+
import { PolicyCardFrame as r } from "./index17.js";
|
|
16
|
+
import { DeleteRuleDialogDefaultLabels as i } from "./index18.js";
|
|
17
|
+
import { DeleteRuleDialog as a } from "./index19.js";
|
|
18
|
+
import "./index20.js";
|
|
19
|
+
import { ApprovalPoliciesList as o } from "./index21.js";
|
|
20
|
+
export { e as AmountConditionBuilder, t as ApprovalPoliciesHeader, o as ApprovalPoliciesList, a as DeleteRuleDialog, i as DeleteRuleDialogDefaultLabels, n as PolicyCardDefaultLabels, r as PolicyCardFrame };
|
package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index11.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { Button as e,
|
|
2
|
-
import { ApprovalPoliciesHeaderDefaultLabels as
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { Plus as u } from "lucide-react";
|
|
1
|
+
import { Button as e, Heading as t, Tooltip as n, TooltipContent as r, TooltipProvider as i, TooltipTrigger as a, Typography as o } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { ApprovalPoliciesHeaderDefaultLabels as s } from "./index10.js";
|
|
3
|
+
import { useMemo as c } from "react";
|
|
4
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
6
5
|
// ../../libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index11.js
|
|
7
6
|
var d = ({ onAddRule: d, addRuleDisabled: f, addRuleDisabledReason: p, labels: m, headingComponent: h = "h2", showTitle: g = !0, testIds: _ }) => {
|
|
8
|
-
let v =
|
|
9
|
-
...
|
|
7
|
+
let v = c(() => ({
|
|
8
|
+
...s,
|
|
10
9
|
...m
|
|
11
10
|
}), [m]), y = d ? /* @__PURE__ */ l(e, {
|
|
12
11
|
type: "button",
|
|
@@ -16,30 +15,30 @@ var d = ({ onAddRule: d, addRuleDisabled: f, addRuleDisabledReason: p, labels: m
|
|
|
16
15
|
disabled: f,
|
|
17
16
|
"data-testid": _?.addRuleButton,
|
|
18
17
|
className: "ttw:shrink-0",
|
|
19
|
-
children:
|
|
18
|
+
children: v.AddRule
|
|
20
19
|
}) : null;
|
|
21
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ u("div", {
|
|
22
21
|
className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-4",
|
|
23
|
-
children: [/* @__PURE__ */
|
|
22
|
+
children: [/* @__PURE__ */ u("div", {
|
|
24
23
|
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
25
|
-
children: [g ? /* @__PURE__ */
|
|
26
|
-
variant: "
|
|
27
|
-
|
|
24
|
+
children: [g ? /* @__PURE__ */ l(t, {
|
|
25
|
+
variant: "section",
|
|
26
|
+
level: Number(h.slice(1)),
|
|
28
27
|
children: v.Title
|
|
29
|
-
}) : null, /* @__PURE__ */
|
|
28
|
+
}) : null, /* @__PURE__ */ l(o, {
|
|
30
29
|
variant: "body2",
|
|
31
30
|
color: "muted",
|
|
32
31
|
children: v.Description
|
|
33
32
|
})]
|
|
34
|
-
}), y && f && p ? /* @__PURE__ */
|
|
33
|
+
}), y && f && p ? /* @__PURE__ */ l(i, { children: /* @__PURE__ */ u(n, { children: [/* @__PURE__ */ l(a, {
|
|
35
34
|
asChild: !0,
|
|
36
|
-
children: /* @__PURE__ */
|
|
35
|
+
children: /* @__PURE__ */ l("span", {
|
|
37
36
|
tabIndex: 0,
|
|
38
37
|
className: "ttw:inline-flex ttw:shrink-0 ttw:cursor-not-allowed ttw:rounded-md",
|
|
39
38
|
"data-testid": _?.addRuleBlocked,
|
|
40
39
|
children: y
|
|
41
40
|
})
|
|
42
|
-
}), /* @__PURE__ */
|
|
41
|
+
}), /* @__PURE__ */ l(r, {
|
|
43
42
|
side: "top",
|
|
44
43
|
children: p
|
|
45
44
|
})] }) }) : y]
|