@tesouro/embedded-components-react 0.11.70 → 0.11.72

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.
Files changed (97) hide show
  1. package/README.md +1 -0
  2. package/dist/index.css +41 -192
  3. package/dist/index.d.ts +93 -73
  4. package/dist/lib/SettingsWidget.d.ts +5 -1
  5. package/dist/lib/WidgetSuite.d.ts +22 -2
  6. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index3.js +8 -7
  7. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index4.js +4 -1
  8. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index6.js +196 -131
  9. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index.js +4 -4
  10. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index3.js +11 -1
  11. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index4.js +5 -3
  12. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index5.js +38 -32
  13. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index6.js +103 -75
  14. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index7.js +140 -168
  15. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index8.js +97 -87
  16. package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/feature/dist/index7.js +11 -7
  17. package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/feature/dist/index8.js +0 -1
  18. package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index2.js +3 -1
  19. package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index3.js +134 -177
  20. package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index4.js +110 -176
  21. package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index5.js +28 -38
  22. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/lib/ExpenseSettingsTabs/ExpenseSettingsTabs.js +13 -10
  23. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/lib/SettingsWidget/SettingsWidget.js +28 -24
  24. package/dist/libs/tesouro-embedded-components-react/settings-widget/help/ui/shadcn/dist/index3.js +35 -31
  25. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index10.js +2 -0
  26. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index7.js +1 -5
  27. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index8.js +3 -0
  28. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index11.js +2 -1
  29. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index12.js +22 -36
  30. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index16.js +1 -1
  31. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index17.js +54 -60
  32. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index20.js +75 -60
  33. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index3.js +42 -27
  34. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index6.js +89 -82
  35. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index9.js +39 -38
  36. package/dist/libs/tesouro-embedded-components-react/settings-widget/profile/feature/dist/index4.js +32 -32
  37. package/dist/libs/tesouro-embedded-components-react/settings-widget/profile/ui/dist/index2.js +1 -1
  38. package/dist/libs/tesouro-embedded-components-react/settings-widget/profile/ui/dist/index3.js +56 -71
  39. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index10.js +3 -0
  40. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index12.js +86 -66
  41. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index13.js +51 -51
  42. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index15.js +146 -132
  43. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index17.js +95 -99
  44. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index3.js +1 -0
  45. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index4.js +8 -27
  46. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index5.js +69 -72
  47. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index6.js +51 -51
  48. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index.js +9 -11
  49. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index10.js +83 -298
  50. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index11.js +13 -13
  51. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index12.js +122 -75
  52. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index13.js +41 -15
  53. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index14.js +7 -131
  54. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index15.js +147 -48
  55. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index16.js +240 -11
  56. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index17.js +15 -173
  57. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index2.js +38 -10
  58. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index3.js +5 -46
  59. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index4.js +52 -45
  60. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index5.js +101 -25
  61. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index6.js +40 -98
  62. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index7.js +415 -40
  63. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index8.js +261 -332
  64. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index9.js +15 -8
  65. package/dist/libs/tesouro-embedded-components-react/settings-widget/ui/dist/lib/SettingsWidgetUi/SettingsWidgetUi.js +2 -2
  66. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/ApprovalPoliciesSettings.js +9 -8
  67. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/useApprovalPolicyRules.js +136 -122
  68. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index.js +9 -8
  69. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index11.js +16 -17
  70. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index12.js +99 -100
  71. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index16.js +1 -1
  72. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index17.js +8 -8
  73. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index18.js +10 -55
  74. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index19.js +34 -8
  75. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index20.js +8 -84
  76. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index21.js +86 -0
  77. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index3.js +13 -13
  78. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index5.js +17 -18
  79. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index7.js +33 -42
  80. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  81. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/index.js +24 -24
  82. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/FileDropZone/FileDropZone.js +62 -0
  83. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/LoadingRegion/LoadingRegion.js +1 -0
  84. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/WidgetSuiteProvider.js +12 -4
  85. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/labels.js +9 -0
  86. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/BillPaySection.js +12 -9
  87. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/CardsSection.js +25 -23
  88. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/DashboardQuickActions.js +74 -0
  89. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/DashboardSection.js +20 -16
  90. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/InvoicingSection.js +15 -9
  91. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/SettingsSection.js +15 -8
  92. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/TransfersSection.js +23 -21
  93. package/dist/packages/shared-ui-shadcn/dist/index.js +2336 -2274
  94. package/package.json +1 -1
  95. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index18.js +0 -291
  96. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index19.js +0 -22
  97. 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
- success: "ttw:bg-[#ECFDF5] ttw:text-[#027A48]",
4
- info: "ttw:bg-[#EFF8FF] ttw:text-[#175CD3]",
5
- neutral: "ttw:bg-[#F2F4F7] ttw:text-[#344054]"
6
- }, t = "ttw:rounded ttw:border-transparent ttw:px-2 ttw:py-0.5 ttw:text-xs ttw:font-medium";
7
- function n(n) {
8
- return `${t} ${e[n]}`;
9
- }
10
- export { n as statusToneClassName };
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:space-y-5",
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-5",
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 { useApprovalPolicyRules as i } from "./useApprovalPolicyRules.js";
11
- import { ApprovalPoliciesHeader as a } from "../../../ui/dist/index11.js";
12
- import { DeleteRuleDialog as o } from "../../../ui/dist/index18.js";
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 = i({
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(a, {
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(s, {
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(o, {
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 l, toAmountConditionValue as u, toApproverErrors as se, toApproverGroupRefs as ce, toApproverSteps as le, toGapRanges as d } from "./policyViewModel.js";
16
- import { useApproverOptions as f } from "./useApproverOptions.js";
17
- import { approvalPolicyTestIds as p } from "./testIds.js";
18
- import { ApprovalPolicyObjectType as ue } from "../../../data-access/dist/lib/queryKeys.js";
19
- import { useDeleteApprovalPoliciesIdMutation as de, useGetApprovalPoliciesQuery as fe, usePatchApprovalPoliciesIdMutation as pe, usePostApprovalPoliciesMutation as me } from "../../../data-access/dist/lib/approvalPoliciesApi.js";
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", he = {
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 ge(e) {
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 x(e) {
48
+ function ye(e) {
46
49
  return [...e].sort((e, t) => (e.condition.min ?? 0) - (t.condition.min ?? 0));
47
50
  }
48
- function S({ labels: o, componentLabels: s }) {
49
- let y = fe(), S = me(), C = pe(), w = de(), T = f(), { organizationId: E, organizationStatus: D } = r(), [O, k] = v(null), [A, j] = v(null), _e = n(D), M = _(E);
50
- E && E !== M.current && (M.current = E, k(null), j(null)), D === t.None && (O || A) && (k(null), j(null));
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(() => ge(y.data?.data ?? []), [y.data]), I = g(() => T.isResolving ? [] : x(F.flatMap((e) => {
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 = le(e.groups, T.lookup);
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
- T.isResolving,
66
- T.lookup
67
- ]), L = O ? O.policyId ?? "draft" : null, R = _e || y.isResolving || T.isResolving, z = O?.policyId != null && O.policyId !== A && !!E && !R && !I.some((e) => e.id === O.policyId);
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 && (k(null), e.error(o.approverUnavailable));
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 (!O) return;
77
- let e = (e) => e.id !== O.policyId;
79
+ if (!D) return;
80
+ let e = (e) => e.id !== D.policyId;
78
81
  return ne({
79
- amount: O.amount,
80
- groups: O.steps.map((e) => ({
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
- O,
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 ? [] : d(U, o, W), [
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
- ]), ve = g(() => i(W), [W]), ye = !R && F.length > 0 && ve.length === 0 ? I.length === 0 ? o.addRuleFullyCoveredUnlisted : o.addRuleFullyCovered : void 0, [K, be] = v(0), q = _(null);
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
- k({
107
+ O({
105
108
  policyId: null,
106
109
  amount: e,
107
110
  steps: [P()],
108
111
  touchedAmount: b
109
- }), be((e) => e + 1);
110
- }, [P]), xe = m(() => {
111
- J(he);
112
- }, [J]), Se = m((e) => {
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(u({
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
- ]), Y = m(() => {
124
- k(null);
125
- }, []), X = S.isPending || C.isPending || w.isPending, Z = m(async () => {
126
- if (!O || !H || !H.isValid) return;
127
- let t = H.condition, n = ce(O.steps, T.lookup);
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
- O.policyId === null ? await S.mutateAsync({ body: {
135
- object_type: ue.Payable,
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 C.mutateAsync({
141
- path: { approval_policy_id: O.policyId },
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
- }), k(null), e.success(o.ruleSaved);
160
+ }), O(null), e.success(o.ruleSaved);
148
161
  } catch {
149
162
  e.error(o.ruleSaveFailed);
150
163
  }
151
164
  }, [
152
- O,
165
+ D,
153
166
  H,
154
- T.lookup,
167
+ w.lookup,
155
168
  o,
156
169
  F,
157
- S,
158
- C
159
- ]), Ce = m(async () => {
160
- if (A && E) try {
161
- await w.mutateAsync({ path: { approval_policy_id: A } }), j(null), k(null), e.success(o.ruleDeleted);
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
- j(null), e.error(o.ruleDeleteFailed);
176
+ e.error(o.ruleDeleteFailed);
164
177
  }
165
178
  }, [
166
- A,
167
- E,
168
- w,
179
+ k,
180
+ T,
181
+ C,
169
182
  o
170
- ]), we = R || X || !E, Q = g(() => {
171
- if (!O || !H || X) return;
172
- let e = l(H.amountErrors, o);
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: O.touchedAmount.lower ? e.lower : void 0,
175
- upper: O.touchedAmount.upper ? e.upper : void 0
187
+ lower: D.touchedAmount.lower ? e.lower : void 0,
188
+ upper: D.touchedAmount.upper ? e.upper : void 0
176
189
  };
177
190
  }, [
178
- O,
191
+ D,
179
192
  H,
180
- X,
193
+ Z,
181
194
  o
182
- ]), $ = g(() => {
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) => k((t) => t && {
199
+ onAmountConditionChange: (e) => O((t) => t && {
195
200
  ...t,
196
201
  amount: e
197
202
  }),
198
- onAmountFieldBlur: (e) => k((t) => t && {
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: () => k((e) => e && {
207
+ onAddApproverStep: () => O((e) => e && {
210
208
  ...e,
211
209
  steps: [...e.steps, P()]
212
210
  }),
213
- onRemoveApproverStep: (e) => k((t) => t && {
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: T.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: T.options,
228
- amountCondition: u(n),
229
- amountConditionErrors: i ? Q : void 0,
225
+ approverOptions: w.options,
226
+ amountCondition: l(n),
227
+ amountConditionErrors: i ? $ : void 0,
230
228
  onEdit: () => {
231
- k({
229
+ O({
232
230
  policyId: t,
233
- amount: u(n),
231
+ amount: l(n),
234
232
  steps: r,
235
233
  touchedAmount: b
236
234
  });
237
235
  },
238
- onCancel: Y,
239
- onSave: () => void Z(),
236
+ onCancel: X,
237
+ onSave: () => void Q(),
240
238
  onDelete: a,
241
- saveDisabled: i && H ? !H.isValid : !1,
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: p.amountConditionBuilder,
247
- lowerInput: p.amountConditionLowerInput,
248
- upperInput: p.amountConditionUpperInput
243
+ root: u.amountConditionBuilder,
244
+ lowerInput: u.amountConditionLowerInput,
245
+ upperInput: u.amountConditionUpperInput
249
246
  },
250
247
  approverGroupsBuilder: {
251
- root: p.approverGroupsBuilder,
252
- loading: p.approverGroupsLoading,
253
- error: p.approverGroupsError,
254
- description: p.approverGroupsDescription,
255
- empty: p.approverGroupsEmpty,
256
- addStepButton: p.approverGroupsAddStep
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 && O ? O.steps : e.steps, n, () => j(e.id));
262
- return n && O ? {
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: O.amount
261
+ amountCondition: D.amount
265
262
  } : r;
266
263
  });
267
- return O?.policyId === null && n.unshift({
268
- ...t("draft", { type: "between" }, O.steps, !0, void 0),
269
- amountCondition: O.amount,
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
- O,
271
+ D,
275
272
  L,
276
- Q,
277
273
  $,
278
274
  H,
279
275
  o,
280
276
  s?.policyCard,
281
- T.options,
282
- T.lookup,
283
- Y,
277
+ w.options,
278
+ w.lookup,
279
+ X,
284
280
  P,
285
- Z
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: xe,
293
- addRuleDisabledReason: ye,
294
- onSelectGap: Se,
295
- isBusy: we,
288
+ onAddRule: Ce,
289
+ addRuleDisabledReason: xe,
290
+ onSelectGap: Y,
291
+ isBusy: Te,
296
292
  isLoading: R,
297
- isError: y.isError || T.isError,
293
+ isError: y.isError || w.isError,
298
294
  onRetry: () => {
299
- y.refetch(), T.refetch();
295
+ y.refetch(), w.refetch();
300
296
  },
301
297
  deleteDialog: {
302
- open: A !== null,
303
- isDeleting: w.isPending,
304
- confirmDisabled: !E,
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 || j(null);
320
+ e || A(null);
307
321
  },
308
- onConfirm: () => void Ce(),
309
- onCancel: () => j(null)
322
+ onConfirm: () => void we(),
323
+ onCancel: () => A(null)
310
324
  }
311
325
  };
312
326
  }
313
- export { y as DRAFT_POLICY_ID, S as useApprovalPolicyRules };
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 e } from "./index11.js";
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 { DeleteRuleDialog as t } from "./index18.js";
17
- import "./index19.js";
18
- import { ApprovalPoliciesList as n } from "./index20.js";
19
- export { e as ApprovalPoliciesHeader, n as ApprovalPoliciesList, t as DeleteRuleDialog };
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 };
@@ -1,12 +1,11 @@
1
- import { Button as e, Tooltip as t, TooltipContent as n, TooltipProvider as r, TooltipTrigger as i, Typography as a } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { ApprovalPoliciesHeaderDefaultLabels as o } from "./index10.js";
3
- import { useMemo as s } from "react";
4
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
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 = s(() => ({
9
- ...o,
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: [/* @__PURE__ */ c(u, {}), v.AddRule]
18
+ children: v.AddRule
20
19
  }) : null;
21
- return /* @__PURE__ */ l("div", {
20
+ return /* @__PURE__ */ u("div", {
22
21
  className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-4",
23
- children: [/* @__PURE__ */ l("div", {
22
+ children: [/* @__PURE__ */ u("div", {
24
23
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
25
- children: [g ? /* @__PURE__ */ c(a, {
26
- variant: "h3",
27
- component: h,
24
+ children: [g ? /* @__PURE__ */ l(t, {
25
+ variant: "section",
26
+ level: Number(h.slice(1)),
28
27
  children: v.Title
29
- }) : null, /* @__PURE__ */ c(a, {
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__ */ c(r, { children: /* @__PURE__ */ l(t, { children: [/* @__PURE__ */ c(i, {
33
+ }), y && f && p ? /* @__PURE__ */ l(i, { children: /* @__PURE__ */ u(n, { children: [/* @__PURE__ */ l(a, {
35
34
  asChild: !0,
36
- children: /* @__PURE__ */ c("span", {
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__ */ c(n, {
41
+ }), /* @__PURE__ */ l(r, {
43
42
  side: "top",
44
43
  children: p
45
44
  })] }) }) : y]