@tesouro/embedded-components-react 0.3.16 → 0.3.18
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.d.ts +22 -1
- package/dist/index.js +10 -10
- package/dist/lib/AcceptDisclosuresWidget.d.ts +11 -1
- package/dist/lib/AcceptDisclosuresWidget.js +1 -1
- package/dist/lib/BalancesWidget.js +1 -1
- package/dist/lib/BankAccountOnboardingWidget.d.ts +21 -21
- package/dist/lib/BankAccountOnboardingWidget.js +1 -1
- package/dist/lib/CardsWidget.js +1 -1
- package/dist/lib/ExpenseApprovalPoliciesWidget.js +1 -1
- package/dist/lib/ExpenseManagementWidget.js +1 -1
- package/dist/lib/InsightsWidget.js +1 -1
- package/dist/lib/ReceiptMatchWidget.js +1 -1
- package/dist/lib/TransfersWidget.js +1 -1
- package/dist/lib/UploadReceiptWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index4.js +10 -140
- package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index5.js +152 -0
- package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/lib/AcceptDisclosuresWidget/AcceptDisclosuresWidget.js +19 -19
- package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/index4.js +10 -11
- package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/index5.js +15 -64
- package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/index6.js +75 -0
- package/dist/libs/tesouro-embedded-components-react/balances-widget/ui/dist/lib/BalancesWidget/BalancesWidget.js +16 -16
- package/dist/libs/tesouro-embedded-components-react/balances-widget/ui/dist/lib/BalancesWidget/SingleBalance/SingleBalance.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index10.js +109 -169
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index11.js +170 -63
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index12.js +73 -81
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index13.js +77 -101
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index14.js +110 -83
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index15.js +91 -7
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index16.js +7 -28
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index17.js +26 -320
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index18.js +341 -0
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index9.js +29 -100
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index11.js +3 -3
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index15.js +32 -32
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index16.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index18.js +14 -10
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index19.js +42 -42
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index2.js +80 -77
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index20.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index22.js +14 -10
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index23.js +16 -16
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index27.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index3.js +7 -6
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index5.js +23 -18
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +28 -28
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/index.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardDetailsHeader.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index.js +3 -3
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index3.js +4 -23
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index4.js +23 -24
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index5.js +24 -30
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index6.js +28 -55
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index7.js +54 -209
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index8.js +206 -81
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index9.js +95 -0
- package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardFaceSwatch.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsList.js +31 -30
- package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsListRow.js +11 -10
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index10.js +1 -255
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index11.js +253 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index12.js +2 -71
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index13.js +73 -0
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index5.js +7 -218
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index6.js +219 -79
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index7.js +89 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index8.js +2 -47
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index9.js +49 -1
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/ApprovalRuleCard.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/ApprovalRuleForm.js +32 -32
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/ExpenseApprovalsPage.js +11 -8
- package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index10.js +12 -14
- package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index11.js +21 -62
- package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index12.js +73 -0
- package/dist/libs/tesouro-embedded-components-react/insights-widget/ui/dist/lib/InsightsWidget/InsightsWidget.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/insights-widget/ui/dist/lib/InsightsWidget/SingleInsight/SingleInsight.js +10 -10
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index5.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/ApprovalPoliciesSettings.js +67 -46
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/testIds.js +26 -0
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/useApprovalPolicyRules.js +151 -135
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index11.js +11 -11
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index14.js +17 -17
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index16.js +17 -15
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index18.js +9 -9
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index20.js +16 -13
- 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 +11 -11
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index7.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index9.js +6 -6
- 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/lib/OnboardingShell/OnboardingShell.js +21 -20
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/OnboardingShellOverlayPortal.js +10 -10
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/OnboardingShellScrollRegion.js +17 -17
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index5.js +18 -99
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index6.js +116 -19
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index7.js +28 -0
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/ReviewTransferStep.js +9 -9
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/TransferMoneyModal.js +13 -11
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/TransferResultStep.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransfersWidget.js +19 -19
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
- package/package.json +1 -1
|
@@ -6,62 +6,83 @@ import { EmbeddedToaster as e } from "../../../../ui/dist/lib/EmbeddedToaster.js
|
|
|
6
6
|
import { ErrorState as t } from "../../../../ui/dist/lib/ErrorState/ErrorState.js";
|
|
7
7
|
import "../../../../ui/dist/index.js";
|
|
8
8
|
import { ApprovalPoliciesSettingsDefaultLabels as n } from "./labels.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
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";
|
|
13
14
|
import "../../../ui/dist/index.js";
|
|
14
|
-
import { useMemo as
|
|
15
|
-
import { jsx as
|
|
15
|
+
import { useMemo as c } from "react";
|
|
16
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
16
17
|
//#region ../../libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/ApprovalPoliciesSettings.js
|
|
17
|
-
function
|
|
18
|
-
let
|
|
18
|
+
function d({ labels: d, componentLabels: f, headingComponent: p = "h3" } = {}) {
|
|
19
|
+
let m = c(() => ({
|
|
19
20
|
...n,
|
|
20
|
-
...
|
|
21
|
-
}), [
|
|
22
|
-
labels:
|
|
23
|
-
componentLabels:
|
|
21
|
+
...d
|
|
22
|
+
}), [d]), h = i({
|
|
23
|
+
labels: m,
|
|
24
|
+
componentLabels: f
|
|
24
25
|
});
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ u("div", {
|
|
26
27
|
className: "ttw:flex ttw:flex-col ttw:gap-6",
|
|
27
28
|
children: [
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
labels:
|
|
30
|
-
headingComponent:
|
|
31
|
-
onAddRule:
|
|
32
|
-
addRuleDisabled:
|
|
33
|
-
addRuleDisabledReason:
|
|
29
|
+
/* @__PURE__ */ l(a, {
|
|
30
|
+
labels: f?.header,
|
|
31
|
+
headingComponent: p,
|
|
32
|
+
onAddRule: h.items.length > 0 && !h.isError ? h.onAddRule : void 0,
|
|
33
|
+
addRuleDisabled: h.isBusy || h.editingId !== null || h.addRuleDisabledReason !== void 0,
|
|
34
|
+
addRuleDisabledReason: h.addRuleDisabledReason,
|
|
35
|
+
testIds: {
|
|
36
|
+
addRuleButton: r.addRuleButton,
|
|
37
|
+
addRuleBlocked: r.addRuleBlocked
|
|
38
|
+
}
|
|
34
39
|
}),
|
|
35
|
-
|
|
36
|
-
title:
|
|
37
|
-
description:
|
|
38
|
-
retryLabel:
|
|
39
|
-
onRetry:
|
|
40
|
-
}) : /* @__PURE__ */
|
|
41
|
-
items:
|
|
42
|
-
editingId:
|
|
43
|
-
onAddRule:
|
|
44
|
-
gaps:
|
|
45
|
-
onSelectGap:
|
|
46
|
-
unlistedPoliciesHeading:
|
|
47
|
-
unlistedPoliciesBlockAmounts:
|
|
48
|
-
unlistedPoliciesStillApply:
|
|
49
|
-
createRuleDisabledReason:
|
|
50
|
-
isLoading:
|
|
51
|
-
disabled:
|
|
52
|
-
labels:
|
|
40
|
+
h.isError ? /* @__PURE__ */ l(t, {
|
|
41
|
+
title: m.loadErrorTitle,
|
|
42
|
+
description: m.loadErrorDescription,
|
|
43
|
+
retryLabel: m.loadErrorRetry,
|
|
44
|
+
onRetry: h.onRetry
|
|
45
|
+
}) : /* @__PURE__ */ l(s, {
|
|
46
|
+
items: h.items,
|
|
47
|
+
editingId: h.editingId,
|
|
48
|
+
onAddRule: h.onAddRule,
|
|
49
|
+
gaps: h.gaps,
|
|
50
|
+
onSelectGap: h.onSelectGap,
|
|
51
|
+
unlistedPoliciesHeading: h.unlistedPoliciesHeading,
|
|
52
|
+
unlistedPoliciesBlockAmounts: h.unlistedPoliciesBlockAmounts,
|
|
53
|
+
unlistedPoliciesStillApply: h.unlistedPoliciesStillApply,
|
|
54
|
+
createRuleDisabledReason: h.addRuleDisabledReason,
|
|
55
|
+
isLoading: h.isLoading,
|
|
56
|
+
disabled: h.isBusy,
|
|
57
|
+
labels: f?.list,
|
|
58
|
+
testIds: {
|
|
59
|
+
root: r.list,
|
|
60
|
+
loading: r.listLoading,
|
|
61
|
+
unlistedPoliciesNotice: { root: r.unlistedPoliciesNotice },
|
|
62
|
+
noPolicyBanner: {
|
|
63
|
+
root: r.noPolicyBanner,
|
|
64
|
+
createRuleButton: r.noPolicyBannerCreateRule,
|
|
65
|
+
createRuleBlocked: r.noPolicyBannerCreateRuleBlocked
|
|
66
|
+
},
|
|
67
|
+
gapCoverageAlert: { root: r.gapCoverageAlert }
|
|
68
|
+
}
|
|
53
69
|
}),
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
open:
|
|
56
|
-
onOpenChange:
|
|
57
|
-
onConfirm:
|
|
58
|
-
onCancel:
|
|
59
|
-
isDeleting:
|
|
60
|
-
labels:
|
|
70
|
+
/* @__PURE__ */ l(o, {
|
|
71
|
+
open: h.deleteDialog.open,
|
|
72
|
+
onOpenChange: h.deleteDialog.onOpenChange,
|
|
73
|
+
onConfirm: h.deleteDialog.onConfirm,
|
|
74
|
+
onCancel: h.deleteDialog.onCancel,
|
|
75
|
+
isDeleting: h.deleteDialog.isDeleting,
|
|
76
|
+
labels: f?.deleteDialog,
|
|
77
|
+
testIds: {
|
|
78
|
+
root: r.deleteDialog,
|
|
79
|
+
cancelButton: r.deleteDialogCancel,
|
|
80
|
+
confirmButton: r.deleteDialogConfirm
|
|
81
|
+
}
|
|
61
82
|
}),
|
|
62
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ l(e, {})
|
|
63
84
|
]
|
|
64
85
|
});
|
|
65
86
|
}
|
|
66
87
|
//#endregion
|
|
67
|
-
export {
|
|
88
|
+
export { d as ApprovalPoliciesSettings, d as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region ../../libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/testIds.js
|
|
2
|
+
var e = {
|
|
3
|
+
addRuleButton: "approval-policies-add-rule-button",
|
|
4
|
+
addRuleBlocked: "approval-policies-add-rule-blocked",
|
|
5
|
+
list: "approval-policies-list",
|
|
6
|
+
listLoading: "approval-policies-loading",
|
|
7
|
+
unlistedPoliciesNotice: "unlisted-policies-notice",
|
|
8
|
+
noPolicyBanner: "no-policy-banner",
|
|
9
|
+
noPolicyBannerCreateRule: "no-policy-banner-create-rule-button",
|
|
10
|
+
noPolicyBannerCreateRuleBlocked: "no-policy-banner-create-rule-blocked",
|
|
11
|
+
gapCoverageAlert: "gap-coverage-alert",
|
|
12
|
+
amountConditionBuilder: "amount-condition-builder",
|
|
13
|
+
amountConditionLowerInput: "amount-condition-lower-input",
|
|
14
|
+
amountConditionUpperInput: "amount-condition-upper-input",
|
|
15
|
+
approverGroupsBuilder: "approver-groups-builder",
|
|
16
|
+
approverGroupsLoading: "approver-groups-builder-loading",
|
|
17
|
+
approverGroupsError: "approver-groups-builder-error",
|
|
18
|
+
approverGroupsDescription: "approver-groups-builder-description",
|
|
19
|
+
approverGroupsEmpty: "approver-groups-builder-empty",
|
|
20
|
+
approverGroupsAddStep: "approver-groups-add-button",
|
|
21
|
+
deleteDialog: "delete-rule-dialog",
|
|
22
|
+
deleteDialogCancel: "delete-rule-dialog-cancel-button",
|
|
23
|
+
deleteDialogConfirm: "delete-rule-dialog-confirm-button"
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { e as approvalPolicyTestIds };
|
|
@@ -13,15 +13,16 @@ import { buildApprovalPolicyTrigger as o, parseApprovalPolicyTrigger as s } from
|
|
|
13
13
|
import { validatePolicyDraft as c } from "../../../util/dist/lib/validatePolicyDraft.js";
|
|
14
14
|
import { buildPolicySentence as l, buildPolicyTitle as u, buildUnlistedPoliciesHeading as ee, gapId as te, lockUnavailableApprovers as ne, toAmountConditionErrors as d, toAmountConditionValue as f, toApproverErrors as re, toApproverGroupRefs as ie, toApproverSteps as ae, toGapRanges as oe } from "./policyViewModel.js";
|
|
15
15
|
import { useApproverOptions as se } from "./useApproverOptions.js";
|
|
16
|
+
import { approvalPolicyTestIds as p } from "./testIds.js";
|
|
16
17
|
import { ApprovalPolicyObjectType as ce } from "../../../data-access/dist/lib/queryKeys.js";
|
|
17
18
|
import { useDeleteApprovalPoliciesIdMutation as le, useGetApprovalPoliciesQuery as ue, usePatchApprovalPoliciesIdMutation as de, usePostApprovalPoliciesMutation as fe } from "../../../data-access/dist/lib/approvalPoliciesApi.js";
|
|
18
19
|
import "../../../data-access/dist/index.js";
|
|
19
|
-
import { useCallback as
|
|
20
|
+
import { useCallback as m, useEffect as h, useMemo as g, useRef as _, useState as v } from "react";
|
|
20
21
|
//#region ../../libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/useApprovalPolicyRules.js
|
|
21
|
-
var
|
|
22
|
+
var y = "draft", pe = {
|
|
22
23
|
lower: "",
|
|
23
24
|
upper: ""
|
|
24
|
-
},
|
|
25
|
+
}, b = {
|
|
25
26
|
lower: !1,
|
|
26
27
|
upper: !1
|
|
27
28
|
};
|
|
@@ -43,15 +44,15 @@ function me(e) {
|
|
|
43
44
|
function he(e) {
|
|
44
45
|
return [...e].sort((e, t) => (e.condition.min ?? 0) - (t.condition.min ?? 0));
|
|
45
46
|
}
|
|
46
|
-
function
|
|
47
|
-
let
|
|
48
|
-
|
|
49
|
-
let
|
|
50
|
-
id: `group-new-${
|
|
47
|
+
function x({ labels: a, componentLabels: s }) {
|
|
48
|
+
let y = ue(), x = fe(), S = de(), C = le(), w = se(), { organizationId: T } = t(), [E, D] = v(null), [O, k] = v(null), A = _(T);
|
|
49
|
+
T && T !== A.current && (A.current = T, D(null), k(null));
|
|
50
|
+
let j = _(0), M = m(() => (j.current += 1, {
|
|
51
|
+
id: `group-new-${j.current}`,
|
|
51
52
|
selectedItems: []
|
|
52
|
-
}), []),
|
|
53
|
+
}), []), N = g(() => me(y.data?.data ?? []), [y.data]), P = g(() => w.isResolving ? [] : he(N.flatMap((e) => {
|
|
53
54
|
if (!e.isRepresentable) return [];
|
|
54
|
-
let t = ae(e.groups,
|
|
55
|
+
let t = ae(e.groups, w.lookup);
|
|
55
56
|
return t === void 0 ? [] : [{
|
|
56
57
|
id: e.id,
|
|
57
58
|
priority: e.priority,
|
|
@@ -59,166 +60,166 @@ function b({ labels: a, componentLabels: s }) {
|
|
|
59
60
|
steps: t
|
|
60
61
|
}];
|
|
61
62
|
})), [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
]),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}, [
|
|
69
|
-
let
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
]),
|
|
63
|
+
N,
|
|
64
|
+
w.isResolving,
|
|
65
|
+
w.lookup
|
|
66
|
+
]), F = E ? E.policyId ?? "draft" : null, I = !T && A.current != null || y.isResolving || w.isResolving, L = E?.policyId != null && E.policyId !== O && !I && !P.some((e) => e.id === E.policyId);
|
|
67
|
+
h(() => {
|
|
68
|
+
L && (D(null), e.error(a.approverUnavailable));
|
|
69
|
+
}, [L, a.approverUnavailable]);
|
|
70
|
+
let R = g(() => new Set(P.map((e) => e.id)), [P]), z = g(() => I ? [] : N.filter((e) => !R.has(e.id)), [
|
|
71
|
+
I,
|
|
72
|
+
N,
|
|
73
|
+
R
|
|
74
|
+
]), B = g(() => {
|
|
74
75
|
let e = /* @__PURE__ */ new Map();
|
|
75
|
-
for (let t of
|
|
76
|
+
for (let t of P) e.set(t.id, t.steps.flatMap((e) => e.selectedItems.map((e) => e.id)));
|
|
76
77
|
return e;
|
|
77
|
-
}, [
|
|
78
|
+
}, [P]), V = g(() => {
|
|
78
79
|
let e = /* @__PURE__ */ new Set();
|
|
79
|
-
for (let [t, n] of
|
|
80
|
+
for (let [t, n] of B) if (t !== E?.policyId) for (let t of n) e.add(t);
|
|
80
81
|
return e;
|
|
81
|
-
}, [
|
|
82
|
-
if (!
|
|
83
|
-
let e = (e) => e.id !==
|
|
82
|
+
}, [B, E?.policyId]), H = g(() => {
|
|
83
|
+
if (!E) return;
|
|
84
|
+
let e = (e) => e.id !== E.policyId;
|
|
84
85
|
return c({
|
|
85
|
-
amount:
|
|
86
|
-
groups:
|
|
86
|
+
amount: E.amount,
|
|
87
|
+
groups: E.steps.map((e) => ({
|
|
87
88
|
id: e.id,
|
|
88
89
|
approverIds: e.selectedItems.map((e) => e.id)
|
|
89
90
|
})),
|
|
90
|
-
otherConditions:
|
|
91
|
-
unlistedConditions:
|
|
92
|
-
approverIdsUsedByOtherRules: [...
|
|
91
|
+
otherConditions: P.filter(e).map((e) => e.condition),
|
|
92
|
+
unlistedConditions: z.filter((t) => t.hasKnownCondition && e(t)).map((e) => e.condition),
|
|
93
|
+
approverIdsUsedByOtherRules: [...V].filter((e) => !E.originalApproverIds.has(e))
|
|
93
94
|
});
|
|
94
95
|
}, [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
]),
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
E,
|
|
97
|
+
P,
|
|
98
|
+
z,
|
|
99
|
+
V
|
|
100
|
+
]), U = g(() => n(N.filter((e) => e.coversNow).map((e) => e.condition)), [N]), W = g(() => N.filter((e) => e.hasKnownCondition).map((e) => e.condition), [N]), G = g(() => N.length === 0 ? [] : oe(U, a, W), [
|
|
101
|
+
N.length,
|
|
102
|
+
U,
|
|
102
103
|
a,
|
|
103
|
-
|
|
104
|
-
]), ge =
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
W
|
|
105
|
+
]), ge = g(() => n(W), [W]), _e = !I && N.length > 0 && ge.length === 0 ? P.length === 0 ? a.addRuleFullyCoveredUnlisted : a.addRuleFullyCovered : void 0, [K, ve] = v(0), q = _(null);
|
|
106
|
+
h(() => {
|
|
107
|
+
K !== 0 && q.current?.scrollIntoView({
|
|
107
108
|
behavior: globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth",
|
|
108
109
|
block: "nearest"
|
|
109
110
|
});
|
|
110
|
-
}, [
|
|
111
|
-
let
|
|
112
|
-
|
|
111
|
+
}, [K]);
|
|
112
|
+
let J = m((e) => {
|
|
113
|
+
D({
|
|
113
114
|
policyId: null,
|
|
114
115
|
amount: e,
|
|
115
|
-
steps: [
|
|
116
|
+
steps: [M()],
|
|
116
117
|
originalApproverIds: /* @__PURE__ */ new Set(),
|
|
117
|
-
touchedAmount:
|
|
118
|
+
touchedAmount: b
|
|
118
119
|
}), ve((e) => e + 1);
|
|
119
|
-
}, [
|
|
120
|
-
|
|
121
|
-
}, [
|
|
122
|
-
let t =
|
|
123
|
-
t &&
|
|
120
|
+
}, [M]), ye = m(() => {
|
|
121
|
+
J(pe);
|
|
122
|
+
}, [J]), be = m((e) => {
|
|
123
|
+
let t = U.find((t) => te(t) === e);
|
|
124
|
+
t && G.find((t) => t.id === e)?.blockedReason === void 0 && J(f({
|
|
124
125
|
type: "between",
|
|
125
126
|
min: t.min,
|
|
126
127
|
max: t.max
|
|
127
128
|
}));
|
|
128
129
|
}, [
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
]), Y =
|
|
133
|
-
|
|
134
|
-
}, []), X =
|
|
135
|
-
if (!
|
|
136
|
-
let t =
|
|
130
|
+
U,
|
|
131
|
+
G,
|
|
132
|
+
J
|
|
133
|
+
]), Y = m(() => {
|
|
134
|
+
D(null);
|
|
135
|
+
}, []), X = x.isPending || S.isPending || C.isPending, Z = m(async () => {
|
|
136
|
+
if (!E || !H || !H.isValid) return;
|
|
137
|
+
let t = H.condition, n = ie(E.steps, w.lookup);
|
|
137
138
|
if (!n) {
|
|
138
139
|
e.error(a.approverUnavailable);
|
|
139
140
|
return;
|
|
140
141
|
}
|
|
141
142
|
let s = o(t), c = i(n), l = u(t, a);
|
|
142
143
|
try {
|
|
143
|
-
|
|
144
|
+
E.policyId === null ? await x.mutateAsync({ body: {
|
|
144
145
|
object_type: ce.Payable,
|
|
145
146
|
name: l,
|
|
146
147
|
trigger: s,
|
|
147
148
|
script: c,
|
|
148
|
-
priority: r(
|
|
149
|
-
} }) : await
|
|
150
|
-
path: { approval_policy_id:
|
|
149
|
+
priority: r(N.map((e) => e.priority))
|
|
150
|
+
} }) : await S.mutateAsync({
|
|
151
|
+
path: { approval_policy_id: E.policyId },
|
|
151
152
|
body: {
|
|
152
153
|
name: l,
|
|
153
154
|
trigger: s,
|
|
154
155
|
script: c
|
|
155
156
|
}
|
|
156
|
-
}),
|
|
157
|
+
}), D(null), e.success(a.ruleSaved);
|
|
157
158
|
} catch {
|
|
158
159
|
e.error(a.ruleSaveFailed);
|
|
159
160
|
}
|
|
160
161
|
}, [
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
E,
|
|
163
|
+
H,
|
|
164
|
+
w.lookup,
|
|
164
165
|
a,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
]),
|
|
169
|
-
if (
|
|
170
|
-
await
|
|
166
|
+
N,
|
|
167
|
+
x,
|
|
168
|
+
S
|
|
169
|
+
]), xe = m(async () => {
|
|
170
|
+
if (O) try {
|
|
171
|
+
await C.mutateAsync({ path: { approval_policy_id: O } }), k(null), D(null), e.success(a.ruleDeleted);
|
|
171
172
|
} catch {
|
|
172
|
-
|
|
173
|
+
k(null), e.error(a.ruleDeleteFailed);
|
|
173
174
|
}
|
|
174
175
|
}, [
|
|
175
|
-
|
|
176
|
-
|
|
176
|
+
O,
|
|
177
|
+
C,
|
|
177
178
|
a
|
|
178
|
-
]),
|
|
179
|
-
if (!
|
|
180
|
-
let e = d(
|
|
179
|
+
]), Se = I || X, Q = g(() => {
|
|
180
|
+
if (!E || !H || X) return;
|
|
181
|
+
let e = d(H.amountErrors, a);
|
|
181
182
|
if (e) return {
|
|
182
|
-
lower:
|
|
183
|
-
upper:
|
|
183
|
+
lower: E.touchedAmount.lower ? e.lower : void 0,
|
|
184
|
+
upper: E.touchedAmount.upper ? e.upper : void 0
|
|
184
185
|
};
|
|
185
186
|
}, [
|
|
186
|
-
|
|
187
|
-
|
|
187
|
+
E,
|
|
188
|
+
H,
|
|
188
189
|
X,
|
|
189
190
|
a
|
|
190
|
-
]), $ =
|
|
191
|
-
if (!
|
|
192
|
-
let e = re(
|
|
191
|
+
]), $ = g(() => {
|
|
192
|
+
if (!H || H.isValid) return;
|
|
193
|
+
let e = re(H.groupErrors, a), t = d(H.amountErrors, a), n = [
|
|
193
194
|
...Object.values(e?.steps ?? {}),
|
|
194
195
|
t?.lower,
|
|
195
196
|
t?.upper
|
|
196
197
|
].filter((e) => !!e), r = [...new Set(n)];
|
|
197
198
|
return r.length > 0 ? r : void 0;
|
|
198
|
-
}, [
|
|
199
|
+
}, [H, a]);
|
|
199
200
|
return {
|
|
200
|
-
items:
|
|
201
|
+
items: g(() => {
|
|
201
202
|
let e = {
|
|
202
|
-
onAmountConditionChange: (e) =>
|
|
203
|
+
onAmountConditionChange: (e) => D((t) => t && {
|
|
203
204
|
...t,
|
|
204
205
|
amount: e
|
|
205
206
|
}),
|
|
206
|
-
onAmountFieldBlur: (e) =>
|
|
207
|
+
onAmountFieldBlur: (e) => D((t) => t && {
|
|
207
208
|
...t,
|
|
208
209
|
touchedAmount: {
|
|
209
210
|
...t.touchedAmount,
|
|
210
211
|
[e]: !0
|
|
211
212
|
}
|
|
212
213
|
}),
|
|
213
|
-
onApproverStepsChange: (e) =>
|
|
214
|
+
onApproverStepsChange: (e) => D((t) => t && {
|
|
214
215
|
...t,
|
|
215
216
|
steps: e
|
|
216
217
|
}),
|
|
217
|
-
onAddApproverStep: () =>
|
|
218
|
+
onAddApproverStep: () => D((e) => e && {
|
|
218
219
|
...e,
|
|
219
|
-
steps: [...e.steps,
|
|
220
|
+
steps: [...e.steps, M()]
|
|
220
221
|
}),
|
|
221
|
-
onRemoveApproverStep: (e) =>
|
|
222
|
+
onRemoveApproverStep: (e) => D((t) => t && {
|
|
222
223
|
...t,
|
|
223
224
|
steps: t.steps.filter((t) => t.id !== e)
|
|
224
225
|
})
|
|
@@ -227,83 +228,98 @@ function b({ labels: a, componentLabels: s }) {
|
|
|
227
228
|
title: u(n, a),
|
|
228
229
|
sentence: l(n, a),
|
|
229
230
|
approverSteps: r.map((e) => ne(e, {
|
|
230
|
-
lookup:
|
|
231
|
+
lookup: w.lookup,
|
|
231
232
|
labels: a,
|
|
232
|
-
usedByOtherRules: i ?
|
|
233
|
+
usedByOtherRules: i ? V : void 0,
|
|
233
234
|
usedByOtherSteps: i ? new Set(r.filter((t) => t.id !== e.id).flatMap((e) => e.selectedItems.map((e) => e.id))) : void 0
|
|
234
235
|
})),
|
|
235
236
|
addApproverStepDisabled: r.some((e) => e.selectedItems.length === 0),
|
|
236
|
-
approverOptions:
|
|
237
|
+
approverOptions: w.options,
|
|
237
238
|
amountCondition: f(n),
|
|
238
239
|
amountConditionErrors: i ? Q : void 0,
|
|
239
240
|
onEdit: () => {
|
|
240
|
-
|
|
241
|
+
D({
|
|
241
242
|
policyId: t,
|
|
242
243
|
amount: f(n),
|
|
243
244
|
steps: r,
|
|
244
245
|
originalApproverIds: new Set(r.flatMap((e) => e.selectedItems.map((e) => e.id))),
|
|
245
|
-
touchedAmount:
|
|
246
|
+
touchedAmount: b
|
|
246
247
|
});
|
|
247
248
|
},
|
|
248
249
|
onCancel: Y,
|
|
249
250
|
onSave: () => void Z(),
|
|
250
251
|
onDelete: o,
|
|
251
|
-
saveDisabled: i &&
|
|
252
|
+
saveDisabled: i && H ? !H.isValid : !1,
|
|
252
253
|
saveDisabledReasons: i ? $ : void 0,
|
|
253
254
|
labels: s?.policyCard,
|
|
255
|
+
testIds: {
|
|
256
|
+
amountConditionBuilder: {
|
|
257
|
+
root: p.amountConditionBuilder,
|
|
258
|
+
lowerInput: p.amountConditionLowerInput,
|
|
259
|
+
upperInput: p.amountConditionUpperInput
|
|
260
|
+
},
|
|
261
|
+
approverGroupsBuilder: {
|
|
262
|
+
root: p.approverGroupsBuilder,
|
|
263
|
+
loading: p.approverGroupsLoading,
|
|
264
|
+
error: p.approverGroupsError,
|
|
265
|
+
description: p.approverGroupsDescription,
|
|
266
|
+
empty: p.approverGroupsEmpty,
|
|
267
|
+
addStepButton: p.approverGroupsAddStep
|
|
268
|
+
}
|
|
269
|
+
},
|
|
254
270
|
...e
|
|
255
|
-
}), n =
|
|
256
|
-
let n =
|
|
257
|
-
return n &&
|
|
271
|
+
}), n = P.map((e) => {
|
|
272
|
+
let n = F === e.id, r = t(e.id, e.condition, n && E ? E.steps : e.steps, n, () => k(e.id));
|
|
273
|
+
return n && E ? {
|
|
258
274
|
...r,
|
|
259
|
-
amountCondition:
|
|
275
|
+
amountCondition: E.amount
|
|
260
276
|
} : r;
|
|
261
277
|
});
|
|
262
|
-
return
|
|
263
|
-
...t("draft", { type: "between" },
|
|
264
|
-
amountCondition:
|
|
265
|
-
ref:
|
|
278
|
+
return E?.policyId === null && n.unshift({
|
|
279
|
+
...t("draft", { type: "between" }, E.steps, !0, void 0),
|
|
280
|
+
amountCondition: E.amount,
|
|
281
|
+
ref: q
|
|
266
282
|
}), n;
|
|
267
283
|
}, [
|
|
268
|
-
N,
|
|
269
|
-
T,
|
|
270
284
|
P,
|
|
285
|
+
E,
|
|
286
|
+
F,
|
|
271
287
|
Q,
|
|
272
288
|
$,
|
|
273
|
-
|
|
289
|
+
H,
|
|
274
290
|
a,
|
|
275
291
|
s?.policyCard,
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
292
|
+
w.options,
|
|
293
|
+
w.lookup,
|
|
294
|
+
V,
|
|
279
295
|
Y,
|
|
280
|
-
|
|
296
|
+
M,
|
|
281
297
|
Z
|
|
282
298
|
]),
|
|
283
|
-
editingId:
|
|
284
|
-
gaps:
|
|
285
|
-
unlistedPoliciesHeading: ee(
|
|
286
|
-
unlistedPoliciesBlockAmounts:
|
|
287
|
-
unlistedPoliciesStillApply:
|
|
288
|
-
onAddRule:
|
|
299
|
+
editingId: F,
|
|
300
|
+
gaps: G,
|
|
301
|
+
unlistedPoliciesHeading: ee(z.length, a),
|
|
302
|
+
unlistedPoliciesBlockAmounts: z.some((e) => e.hasKnownCondition),
|
|
303
|
+
unlistedPoliciesStillApply: z.some((e) => e.isActive),
|
|
304
|
+
onAddRule: ye,
|
|
289
305
|
addRuleDisabledReason: _e,
|
|
290
|
-
onSelectGap:
|
|
291
|
-
isBusy:
|
|
292
|
-
isLoading:
|
|
293
|
-
isError:
|
|
306
|
+
onSelectGap: be,
|
|
307
|
+
isBusy: Se,
|
|
308
|
+
isLoading: I,
|
|
309
|
+
isError: y.isError || w.isError,
|
|
294
310
|
onRetry: () => {
|
|
295
|
-
|
|
311
|
+
y.refetch(), w.refetch();
|
|
296
312
|
},
|
|
297
313
|
deleteDialog: {
|
|
298
|
-
open:
|
|
299
|
-
isDeleting:
|
|
314
|
+
open: O !== null,
|
|
315
|
+
isDeleting: C.isPending,
|
|
300
316
|
onOpenChange: (e) => {
|
|
301
|
-
e ||
|
|
317
|
+
e || k(null);
|
|
302
318
|
},
|
|
303
|
-
onConfirm: () => void
|
|
304
|
-
onCancel: () =>
|
|
319
|
+
onConfirm: () => void xe(),
|
|
320
|
+
onCancel: () => k(null)
|
|
305
321
|
}
|
|
306
322
|
};
|
|
307
323
|
}
|
|
308
324
|
//#endregion
|
|
309
|
-
export {
|
|
325
|
+
export { y as DRAFT_POLICY_ID, x as useApprovalPolicyRules };
|
package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index11.js
CHANGED
|
@@ -4,19 +4,19 @@ import { useMemo as s } from "react";
|
|
|
4
4
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
5
5
|
import { Plus as u } from "lucide-react";
|
|
6
6
|
//#region ../../libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index11.js
|
|
7
|
-
var d = ({ onAddRule: d, addRuleDisabled: f, addRuleDisabledReason: p, labels: m, headingComponent: h = "h2" }) => {
|
|
8
|
-
let
|
|
7
|
+
var d = ({ onAddRule: d, addRuleDisabled: f, addRuleDisabledReason: p, labels: m, headingComponent: h = "h2", testIds: g }) => {
|
|
8
|
+
let _ = s(() => ({
|
|
9
9
|
...o,
|
|
10
10
|
...m
|
|
11
|
-
}), [m]),
|
|
11
|
+
}), [m]), v = d ? /* @__PURE__ */ l(e, {
|
|
12
12
|
type: "button",
|
|
13
13
|
variant: "outline",
|
|
14
14
|
size: "sm",
|
|
15
15
|
onClick: d,
|
|
16
16
|
disabled: f,
|
|
17
|
-
"data-testid":
|
|
17
|
+
"data-testid": g?.addRuleButton,
|
|
18
18
|
className: "ttw:shrink-0",
|
|
19
|
-
children: [/* @__PURE__ */ c(u, {}),
|
|
19
|
+
children: [/* @__PURE__ */ c(u, {}), _.AddRule]
|
|
20
20
|
}) : null;
|
|
21
21
|
return /* @__PURE__ */ l("div", {
|
|
22
22
|
className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-4",
|
|
@@ -25,24 +25,24 @@ var d = ({ onAddRule: d, addRuleDisabled: f, addRuleDisabledReason: p, labels: m
|
|
|
25
25
|
children: [/* @__PURE__ */ c(a, {
|
|
26
26
|
variant: "h3",
|
|
27
27
|
component: h,
|
|
28
|
-
children:
|
|
28
|
+
children: _.Title
|
|
29
29
|
}), /* @__PURE__ */ c(a, {
|
|
30
30
|
variant: "body2",
|
|
31
31
|
color: "muted",
|
|
32
|
-
children:
|
|
32
|
+
children: _.Description
|
|
33
33
|
})]
|
|
34
|
-
}),
|
|
34
|
+
}), v && f && p ? /* @__PURE__ */ c(r, { children: /* @__PURE__ */ l(t, { children: [/* @__PURE__ */ c(i, {
|
|
35
35
|
asChild: !0,
|
|
36
36
|
children: /* @__PURE__ */ c("span", {
|
|
37
37
|
tabIndex: 0,
|
|
38
38
|
className: "ttw:inline-flex ttw:shrink-0 ttw:cursor-not-allowed ttw:rounded-md",
|
|
39
|
-
"data-testid":
|
|
40
|
-
children:
|
|
39
|
+
"data-testid": g?.addRuleBlocked,
|
|
40
|
+
children: v
|
|
41
41
|
})
|
|
42
42
|
}), /* @__PURE__ */ c(n, {
|
|
43
43
|
side: "top",
|
|
44
44
|
children: p
|
|
45
|
-
})] }) }) :
|
|
45
|
+
})] }) }) : v]
|
|
46
46
|
});
|
|
47
47
|
};
|
|
48
48
|
//#endregion
|