@tesouro/embedded-components-react 0.5.45 → 0.5.46
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 +7 -5
- package/dist/index.d.ts +54 -24
- package/dist/lib/BankAccountOnboardingWidget.d.ts +15 -1
- package/dist/lib/BillPayWidget.d.ts +16 -1
- package/dist/lib/SettingsWidget.d.ts +1 -0
- package/dist/lib/WidgetSuite.d.ts +1 -0
- package/dist/lib/monite-sdk.d.ts +2 -0
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index10.js +12 -8
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index22.js +233 -211
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +12 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +3 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +7 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +387 -387
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +119 -113
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +1 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +55 -70
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index87.js +9 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index52.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index53.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index64.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +163 -151
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index6.js +77 -77
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/ExpenseApprovalsPage.js +17 -10
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/labels.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index9.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index382.js +10 -4
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index394.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index616.js +23 -23
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index3.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js +13 -4
- package/dist/libs/tesouro-embedded-components-react/settings-widget/help/ui/shadcn/dist/index3.js +27 -29
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/ApprovalPoliciesSettings.js +29 -28
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index11.js +13 -13
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index6.js
CHANGED
|
@@ -11,13 +11,13 @@ import { ErrorState as i } from "../../../shared/ui/dist/lib/ErrorState/ErrorSta
|
|
|
11
11
|
import "../../../shared/ui/dist/index.js";
|
|
12
12
|
import { useAnalyticsTrack as a } from "../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
13
13
|
import { WidgetProvider as o } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
|
|
14
|
-
import { useWidgetConfig as s } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
14
|
+
import { useWidgetConfig as s, useWidgetLoading as c } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
15
15
|
import "../../../shared/feature/dist/index.js";
|
|
16
|
-
import { ApproverOptionLabels as
|
|
17
|
-
import { ExpenseApprovalPoliciesAnalyticsEvent as
|
|
18
|
-
import { AmountConditionType as
|
|
19
|
-
import { ApprovalRuleToastLabels as
|
|
20
|
-
import { ExpenseApprovalsPage as
|
|
16
|
+
import { ApproverOptionLabels as l, PermissionErrorLabels as u, ValidationErrorLabels as d } from "./index4.js";
|
|
17
|
+
import { ExpenseApprovalPoliciesAnalyticsEvent as f, WIDGET_NAME as p } from "./index2.js";
|
|
18
|
+
import { AmountConditionType as m, ApprovalOutcomeType as h } from "../../ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/types.js";
|
|
19
|
+
import { ApprovalRuleToastLabels as g } from "../../ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/labels.js";
|
|
20
|
+
import { ExpenseApprovalsPage as ee } from "../../ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/ExpenseApprovalsPage.js";
|
|
21
21
|
import "../../ui/dist/index.js";
|
|
22
22
|
import { useApprovalPolicies as _ } from "./index3.js";
|
|
23
23
|
import { expenseApprovalPoliciesTestIds as v } from "./index5.js";
|
|
@@ -27,7 +27,7 @@ import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
|
27
27
|
var T = {
|
|
28
28
|
minAmount: "",
|
|
29
29
|
maxAmount: "",
|
|
30
|
-
outcome:
|
|
30
|
+
outcome: h.AutoApprove,
|
|
31
31
|
approvers: []
|
|
32
32
|
};
|
|
33
33
|
function E(e, t) {
|
|
@@ -51,18 +51,18 @@ function k(e) {
|
|
|
51
51
|
return [
|
|
52
52
|
...t ? [{
|
|
53
53
|
id: t.id,
|
|
54
|
-
label:
|
|
55
|
-
sublabel:
|
|
54
|
+
label: l.AdminLabel,
|
|
55
|
+
sublabel: l.AdminSublabel
|
|
56
56
|
}] : [],
|
|
57
57
|
{
|
|
58
58
|
id: "reporting_manager",
|
|
59
|
-
label:
|
|
60
|
-
sublabel:
|
|
59
|
+
label: l.ReportingManagerLabel,
|
|
60
|
+
sublabel: l.ReportingManagerSublabel
|
|
61
61
|
},
|
|
62
62
|
...n ? [{
|
|
63
63
|
id: n.id,
|
|
64
|
-
label:
|
|
65
|
-
sublabel:
|
|
64
|
+
label: l.CfoLabel,
|
|
65
|
+
sublabel: l.CfoSublabel
|
|
66
66
|
}] : [],
|
|
67
67
|
...r,
|
|
68
68
|
...i
|
|
@@ -70,12 +70,12 @@ function k(e) {
|
|
|
70
70
|
}
|
|
71
71
|
function A(e) {
|
|
72
72
|
let t = e.minAmount.trim() !== "", n = e.maxAmount.trim() !== "";
|
|
73
|
-
return t && n ?
|
|
73
|
+
return t && n ? m.InRange : t ? m.GreaterThanOrEqual : n ? m.LessThan : m.All;
|
|
74
74
|
}
|
|
75
75
|
function j(e) {
|
|
76
|
-
return [e.conditionType ===
|
|
76
|
+
return [e.conditionType === m.LessThan || e.conditionType === m.All ? 0 : e.minAmount ?? 0, e.conditionType === m.GreaterThanOrEqual || e.conditionType === m.All ? Infinity : e.maxAmount ?? 0];
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function te(e) {
|
|
79
79
|
if (e.length === 0) return !1;
|
|
80
80
|
let t = e.map(j).sort((e, t) => e[0] - t[0]);
|
|
81
81
|
if (t[0][0] > 0) return !1;
|
|
@@ -86,7 +86,7 @@ function M(e) {
|
|
|
86
86
|
}
|
|
87
87
|
return n === Infinity;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function M(e) {
|
|
90
90
|
if (e.length === 0) return [];
|
|
91
91
|
let t = e.map(j).sort((e, t) => e[0] - t[0]), n = [], r = 0;
|
|
92
92
|
for (let [e, i] of t) e > r && n.push({
|
|
@@ -98,33 +98,33 @@ function N(e) {
|
|
|
98
98
|
to: null
|
|
99
99
|
}), n;
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function N(e) {
|
|
102
102
|
let t = Number(e.minAmount) || 0, n = Number(e.maxAmount) || 0, r = A(e);
|
|
103
|
-
return [r ===
|
|
103
|
+
return [r === m.LessThan || r === m.All ? 0 : t, r === m.GreaterThanOrEqual || r === m.All ? Infinity : n];
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
let [r, i] =
|
|
105
|
+
function P(e, t, n) {
|
|
106
|
+
let [r, i] = N(e);
|
|
107
107
|
return t.filter((e) => e.id !== n).some((e) => {
|
|
108
108
|
let [t, n] = j(e);
|
|
109
109
|
return r < n && t < i;
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function F(e, t, n) {
|
|
113
113
|
let r = {}, i = e.minAmount.trim() !== "", a = e.maxAmount.trim() !== "", o = Number(e.minAmount.trim()), s = Number(e.maxAmount.trim());
|
|
114
|
-
return i && (!Number.isFinite(o) || o < 0) && (r.minAmount =
|
|
114
|
+
return i && (!Number.isFinite(o) || o < 0) && (r.minAmount = d.InvalidMinAmount), a && (!Number.isFinite(s) || s <= 0) && (r.maxAmount = d.InvalidMaxAmount), i && a && !r.minAmount && !r.maxAmount && o >= s && (r.maxAmount = d.MaxLessThanOrEqualToMin), e.outcome === h.RequireApproval && e.approvers.length === 0 && (r.approvers = d.ApproversRequired), !r.minAmount && !r.maxAmount && P(e, t, n) && (a ? r.maxAmount = d.ConflictsWithAnotherRule : r.minAmount = d.ConflictsWithAnotherRule), r;
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function I(e, t) {
|
|
117
117
|
let n = A(t);
|
|
118
118
|
return {
|
|
119
119
|
id: e,
|
|
120
120
|
conditionType: n,
|
|
121
|
-
minAmount: n ===
|
|
122
|
-
maxAmount: n ===
|
|
121
|
+
minAmount: n === m.InRange || n === m.GreaterThanOrEqual ? Number(t.minAmount) : void 0,
|
|
122
|
+
maxAmount: n === m.LessThan || n === m.InRange ? Number(t.maxAmount) : void 0,
|
|
123
123
|
outcome: t.outcome,
|
|
124
|
-
approvers: t.outcome ===
|
|
124
|
+
approvers: t.outcome === h.RequireApproval ? t.approvers : []
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function L(e) {
|
|
128
128
|
return {
|
|
129
129
|
minAmount: e.minAmount == null ? "" : String(e.minAmount),
|
|
130
130
|
maxAmount: e.maxAmount == null ? "" : String(e.maxAmount),
|
|
@@ -132,73 +132,73 @@ function R(e) {
|
|
|
132
132
|
approvers: e.approvers
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function R() {
|
|
136
136
|
let o = a();
|
|
137
137
|
y(() => {
|
|
138
|
-
o(
|
|
138
|
+
o(f.Mounted);
|
|
139
139
|
}, [o]);
|
|
140
|
-
let { initResponse:
|
|
141
|
-
let e =
|
|
142
|
-
t && (r[t.id] =
|
|
140
|
+
let { initResponse: d } = s(), p = c(), m = d?.scopes?.includes(t.RoleReadOrg) ?? !1, { data: h, isResolving: D, isError: A } = n({ enabled: m }), j = b(() => k(h?.data ?? []), [h]), N = b(() => {
|
|
141
|
+
let e = h?.data ?? [], t = e.find((e) => e.isSystemRole === !0 && E(e.key, "admin")), n = e.find((e) => e.isSystemRole === !0 && O(e.key)), r = { reporting_manager: l.ReportingManagerLabel };
|
|
142
|
+
t && (r[t.id] = l.AdminLabel), n && (r[n.id] = l.CfoLabel);
|
|
143
143
|
for (let t of e) r[t.id] || (r[t.id] = t.name);
|
|
144
144
|
return r;
|
|
145
|
-
}, [
|
|
145
|
+
}, [h]), { rules: P, isLoading: R, saveStatus: z, createRule: B, updateRule: V, deleteRule: H } = _(N), [U, W] = x(!1), [G, K] = x(T), [q, J] = x(null), [Y, X] = x(null);
|
|
146
146
|
y(() => {
|
|
147
|
-
z === "success" && e.success(
|
|
147
|
+
z === "success" && e.success(g.Saved), z === "error" && e.error(g.FailedToSave);
|
|
148
148
|
}, [z]);
|
|
149
|
-
let Z =
|
|
149
|
+
let Z = R || p && !d, ne = te(P), re = M(P), Q = Z || D || z === "saving", $ = U ? F(G, P) : {}, ie = Y && q ? F(Y, P, q) : {}, ae = () => {
|
|
150
150
|
W(!0), K(T);
|
|
151
|
-
},
|
|
151
|
+
}, oe = () => {
|
|
152
152
|
W(!1);
|
|
153
|
-
},
|
|
154
|
-
let e =
|
|
153
|
+
}, se = async () => {
|
|
154
|
+
let e = F(G, P);
|
|
155
155
|
if (Object.keys(e).length > 0) return;
|
|
156
156
|
let t = crypto.randomUUID();
|
|
157
|
-
await B(
|
|
158
|
-
},
|
|
157
|
+
await B(I(t, G)) && (W(!1), K(T));
|
|
158
|
+
}, ce = (e) => {
|
|
159
159
|
K(e);
|
|
160
|
-
},
|
|
160
|
+
}, le = (e) => {
|
|
161
161
|
let t = P.find((t) => t.id === e);
|
|
162
|
-
t && (W(!1), K(T), J(e), X(
|
|
163
|
-
},
|
|
162
|
+
t && (W(!1), K(T), J(e), X(L(t)));
|
|
163
|
+
}, ue = () => {
|
|
164
164
|
J(null), X(null);
|
|
165
|
-
},
|
|
165
|
+
}, de = async () => {
|
|
166
166
|
if (!q || !Y) return;
|
|
167
|
-
let e =
|
|
168
|
-
Object.keys(e).length > 0 || await V(q,
|
|
169
|
-
},
|
|
167
|
+
let e = F(Y, P, q);
|
|
168
|
+
Object.keys(e).length > 0 || await V(q, I(q, Y)) && (J(null), X(null));
|
|
169
|
+
}, fe = (e) => {
|
|
170
170
|
X(e);
|
|
171
|
-
},
|
|
171
|
+
}, pe = async (e) => {
|
|
172
172
|
await H(e), q === e && (J(null), X(null));
|
|
173
173
|
};
|
|
174
|
-
return
|
|
175
|
-
title:
|
|
176
|
-
description:
|
|
177
|
-
}) :
|
|
178
|
-
title:
|
|
179
|
-
description:
|
|
180
|
-
}) : /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(r, {}), /* @__PURE__ */ C(
|
|
174
|
+
return d !== void 0 && !m ? /* @__PURE__ */ C(i, {
|
|
175
|
+
title: u.MissingRolePermissionTitle,
|
|
176
|
+
description: u.MissingRolePermissionDescription
|
|
177
|
+
}) : A ? /* @__PURE__ */ C(i, {
|
|
178
|
+
title: u.RolesUnavailableTitle,
|
|
179
|
+
description: u.RolesUnavailableDescription
|
|
180
|
+
}) : /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(r, {}), /* @__PURE__ */ C(ee, {
|
|
181
181
|
rules: P,
|
|
182
|
-
isBusy:
|
|
183
|
-
isLoading:
|
|
182
|
+
isBusy: Q,
|
|
183
|
+
isLoading: Z,
|
|
184
184
|
isAddingRule: U,
|
|
185
185
|
newRuleFormValues: G,
|
|
186
|
-
newRuleValidationErrors:
|
|
186
|
+
newRuleValidationErrors: $,
|
|
187
187
|
editingRuleId: q,
|
|
188
188
|
editingRuleFormValues: Y,
|
|
189
|
-
editingRuleValidationErrors:
|
|
190
|
-
approverOptions:
|
|
191
|
-
allExpensesAreCovered:
|
|
192
|
-
gapIntervals:
|
|
193
|
-
onAddRuleClick:
|
|
194
|
-
onCancelAddRule:
|
|
195
|
-
onSaveNewRule: () => void
|
|
196
|
-
onNewRuleFormChange:
|
|
197
|
-
onEditRule:
|
|
198
|
-
onCancelEditRule:
|
|
199
|
-
onSaveEditRule: () => void
|
|
200
|
-
onEditRuleFormChange:
|
|
201
|
-
onDeleteRule: (e) => void
|
|
189
|
+
editingRuleValidationErrors: ie,
|
|
190
|
+
approverOptions: Q ? [] : j,
|
|
191
|
+
allExpensesAreCovered: ne,
|
|
192
|
+
gapIntervals: re,
|
|
193
|
+
onAddRuleClick: ae,
|
|
194
|
+
onCancelAddRule: oe,
|
|
195
|
+
onSaveNewRule: () => void se(),
|
|
196
|
+
onNewRuleFormChange: ce,
|
|
197
|
+
onEditRule: le,
|
|
198
|
+
onCancelEditRule: ue,
|
|
199
|
+
onSaveEditRule: () => void de(),
|
|
200
|
+
onEditRuleFormChange: fe,
|
|
201
|
+
onDeleteRule: (e) => void pe(e),
|
|
202
202
|
testIds: {
|
|
203
203
|
ruleCard: { root: v.ruleCard },
|
|
204
204
|
ruleForm: {
|
|
@@ -210,9 +210,9 @@ function z() {
|
|
|
210
210
|
}
|
|
211
211
|
})] });
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function z({ token: e, orgId: t, widgetToken: n, organizationId: r, baseUrl: i, configClient: a, gatewayRouting: s, linkComponent: c, implementation: l, uiFramework: u, errorFallback: d, onError: f, disclosuresAcceptance: m, providerLabels: h } = {}) {
|
|
214
214
|
return /* @__PURE__ */ C(o, {
|
|
215
|
-
widgetName:
|
|
215
|
+
widgetName: p,
|
|
216
216
|
baseUrl: i,
|
|
217
217
|
widgetToken: n ?? e,
|
|
218
218
|
organizationId: r ?? t,
|
|
@@ -222,11 +222,11 @@ function B({ token: e, orgId: t, widgetToken: n, organizationId: r, baseUrl: i,
|
|
|
222
222
|
implementation: l,
|
|
223
223
|
uiFramework: u,
|
|
224
224
|
errorFallback: d,
|
|
225
|
-
onError:
|
|
225
|
+
onError: f,
|
|
226
226
|
disclosuresAcceptance: m,
|
|
227
227
|
providerLabels: h,
|
|
228
|
-
children: /* @__PURE__ */ C(
|
|
228
|
+
children: /* @__PURE__ */ C(R, {})
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
231
|
//#endregion
|
|
232
|
-
export {
|
|
232
|
+
export { z as ExpenseApprovalPoliciesWidget, z as default, k as buildApproverOptions, E as isEmbeddedSystemRoleKey, D as roleKeyHasSegment };
|
|
@@ -14,16 +14,23 @@ var h = ({ rules: i, isBusy: h, isLoading: g, isAddingRule: _, newRuleFormValues
|
|
|
14
14
|
let L = i.length > 0, R = !w && !_ && !b;
|
|
15
15
|
return /* @__PURE__ */ l("div", {
|
|
16
16
|
className: "ttw:flex ttw:flex-col ttw:gap-3",
|
|
17
|
-
children: g && !L && !_ && !b ? /* @__PURE__ */
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
children: g && !L && !_ && !b ? /* @__PURE__ */ u("div", {
|
|
18
|
+
role: "status",
|
|
19
|
+
className: "ttw:flex ttw:flex-col ttw:gap-3",
|
|
20
|
+
children: [/* @__PURE__ */ l("span", {
|
|
21
|
+
className: "ttw:sr-only",
|
|
22
|
+
children: n.LoadingRules
|
|
23
|
+
}), Array.from({ length: 2 }).map((e, n) => /* @__PURE__ */ u("div", {
|
|
24
|
+
className: "ttw:border ttw:border-border ttw:rounded-lg ttw:p-4 ttw:flex ttw:flex-col ttw:gap-3",
|
|
25
|
+
children: [/* @__PURE__ */ u("div", {
|
|
26
|
+
className: "ttw:flex ttw:items-center ttw:justify-between",
|
|
27
|
+
children: [/* @__PURE__ */ l(t, { className: "ttw:h-4 ttw:w-64" }), /* @__PURE__ */ u("div", {
|
|
28
|
+
className: "ttw:flex ttw:gap-1",
|
|
29
|
+
children: [/* @__PURE__ */ l(t, { className: "ttw:h-8 ttw:w-8" }), /* @__PURE__ */ l(t, { className: "ttw:h-8 ttw:w-8" })]
|
|
30
|
+
})]
|
|
31
|
+
}), /* @__PURE__ */ l(t, { className: "ttw:h-6 ttw:w-32" })]
|
|
32
|
+
}, n))]
|
|
33
|
+
}) : !L && !_ ? /* @__PURE__ */ l(a, {
|
|
27
34
|
onAddRule: E,
|
|
28
35
|
onLearnMore: F
|
|
29
36
|
}) : /* @__PURE__ */ u(c, { children: [
|
|
@@ -7,7 +7,8 @@ var e = {
|
|
|
7
7
|
AllExpensesCoveredTitle: "All expense amounts are covered",
|
|
8
8
|
AllExpensesCoveredBody: "Edit one of your previously configured rules first if you need to make room for a new rule.",
|
|
9
9
|
AddRule: "Add rule",
|
|
10
|
-
CreateAnotherRule: "Create another rule"
|
|
10
|
+
CreateAnotherRule: "Create another rule",
|
|
11
|
+
LoadingRules: "Loading approval rules"
|
|
11
12
|
}, t = {
|
|
12
13
|
ForExpenses: "For",
|
|
13
14
|
ExpensesBold: "expenses",
|
|
@@ -50,7 +50,7 @@ var u = (e) => o(e, "yyyy-MM-dd"), d = (e, t, n, r) => {
|
|
|
50
50
|
ledger_account_id: t.ledger_account_id
|
|
51
51
|
}))
|
|
52
52
|
};
|
|
53
|
-
}, f = ({ discount: e, invoiceNumber: t, counterpart: n, counterpartBankAccount: r, invoiceDate: i, dueDate: a, currency: o, tags: s, counterpartAddressId: c }, l) => ({
|
|
53
|
+
}, f = ({ discount: e, invoiceNumber: t, counterpart: n, counterpartBankAccount: r, invoiceDate: i, dueDate: a, currency: o, tags: s, counterpartAddressId: c }, l, d) => ({
|
|
54
54
|
document_id: t,
|
|
55
55
|
discount: e && o ? l(e, o) ?? 0 : 0,
|
|
56
56
|
counterpart_id: n || void 0,
|
|
@@ -59,7 +59,10 @@ var u = (e) => o(e, "yyyy-MM-dd"), d = (e, t, n, r) => {
|
|
|
59
59
|
due_date: a instanceof Date ? u(a) : void 0,
|
|
60
60
|
currency: o,
|
|
61
61
|
tag_ids: s.map((e) => e.id),
|
|
62
|
-
counterpart_address_id: c
|
|
62
|
+
counterpart_address_id: c,
|
|
63
|
+
subtotal: o ? l(d.subtotal, o) ?? 0 : void 0,
|
|
64
|
+
tax_amount: o ? l(d.taxes, o) ?? 0 : void 0,
|
|
65
|
+
total_amount: o ? l(d.total + (e ?? 0), o) ?? 0 : void 0
|
|
63
66
|
}), p = (e, t) => {
|
|
64
67
|
let n = e * t;
|
|
65
68
|
return parseFloat(n.toFixed(2));
|
|
@@ -88,13 +91,16 @@ var u = (e) => o(e, "yyyy-MM-dd"), d = (e, t, n, r) => {
|
|
|
88
91
|
total: i - (t ?? 0)
|
|
89
92
|
};
|
|
90
93
|
}, _ = (e, t, n, r) => {
|
|
91
|
-
let { name: i, quantity: o, price: s, tax: c, ledger_account_id: l } = t, u = r?.allowLedgerUpdate ? a(l, r?.previous) : l, d = {
|
|
94
|
+
let { name: i, quantity: o, price: s, tax: c, ledger_account_id: l } = t, u = r?.allowLedgerUpdate ? a(l, r?.previous) : l, d = p(s, o), f = m(d, c || 0), h = f - d, g = {
|
|
92
95
|
name: i,
|
|
93
96
|
quantity: o,
|
|
94
97
|
tax: v(c),
|
|
98
|
+
subtotal: n(d, e) ?? 0,
|
|
99
|
+
tax_amount: n(h, e) ?? 0,
|
|
100
|
+
total: n(f, e) ?? 0,
|
|
95
101
|
unit_price: n(s, e) ?? 0
|
|
96
102
|
};
|
|
97
|
-
return u !== void 0 && (
|
|
103
|
+
return u !== void 0 && (g.ledger_account_id = u), g;
|
|
98
104
|
};
|
|
99
105
|
function v(e) {
|
|
100
106
|
return t(e);
|
|
@@ -122,7 +122,7 @@ var S = ({ ref: e, ...t }) => /* @__PURE__ */ l(r, { children: /* @__PURE__ */ l
|
|
|
122
122
|
...e,
|
|
123
123
|
currency: e.currency,
|
|
124
124
|
counterpartAddressId: me(tt.data?.data, $, e.counterpart)
|
|
125
|
-
}, n = pe(t, j);
|
|
125
|
+
}, n = pe(t, j, K);
|
|
126
126
|
r ? S && S(r.id, n, e.lineItems, Xe) : C && C(n, e.lineItems);
|
|
127
127
|
}),
|
|
128
128
|
children: /* @__PURE__ */ u(p, {
|
|
@@ -16,54 +16,54 @@ import { useState as _ } from "react";
|
|
|
16
16
|
import { Fragment as v, jsx as y, jsxs as b } from "@emotion/react/jsx-runtime";
|
|
17
17
|
import { useLingui as x } from "@lingui/react";
|
|
18
18
|
//#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index616.js
|
|
19
|
-
var S = (e) => /* @__PURE__ */ y(u, { children: /* @__PURE__ */ y(C, { ...e }) }), C = ({ isDialog: u,
|
|
20
|
-
let
|
|
21
|
-
if (!
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
},
|
|
19
|
+
var S = (e) => /* @__PURE__ */ y(u, { children: /* @__PURE__ */ y(C, { ...e }) }), C = ({ isDialog: u, showHeader: S = !0, isOpen: C, handleCloseDialog: w }) => {
|
|
20
|
+
let T = c(), { shouldShowChangesModal: E, handleShowModal: D } = d(), { i18n: O } = x(), [k, A] = _(!1), j = T.has(e.OrganizationSettingsWriteOrg), { data: M } = t(), N = M?.id ?? "", { data: P, isLoading: F } = f(N, j), { data: I, isLoading: L } = p(N, j), R = F || L;
|
|
21
|
+
if (!j) return null;
|
|
22
|
+
let z = () => {
|
|
23
|
+
E ? A(!0) : w?.();
|
|
24
|
+
}, B = /* @__PURE__ */ b("div", {
|
|
25
25
|
className: "ttw:flex ttw:flex-col ttw:gap-6 ttw:w-full ttw:max-w-163",
|
|
26
26
|
children: [
|
|
27
27
|
/* @__PURE__ */ y(m, {}),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
entityId:
|
|
31
|
-
entitySettings:
|
|
32
|
-
nextNumbers:
|
|
28
|
+
R && /* @__PURE__ */ y(s, {}),
|
|
29
|
+
P && I && /* @__PURE__ */ y(h, {
|
|
30
|
+
entityId: N,
|
|
31
|
+
entitySettings: P,
|
|
32
|
+
nextNumbers: I,
|
|
33
33
|
isDialog: u
|
|
34
34
|
})
|
|
35
35
|
]
|
|
36
36
|
});
|
|
37
37
|
return /* @__PURE__ */ b(v, { children: [u ? /* @__PURE__ */ y(n, {
|
|
38
|
-
open: !!
|
|
39
|
-
onOpenChange: (e) => !e &&
|
|
38
|
+
open: !!C,
|
|
39
|
+
onOpenChange: (e) => !e && z(),
|
|
40
40
|
children: /* @__PURE__ */ b(r, {
|
|
41
41
|
className: "ttw:flex ttw:flex-col ttw:gap-6 ttw:p-6 ttw:overflow-auto",
|
|
42
42
|
children: [/* @__PURE__ */ b(a, {
|
|
43
43
|
className: "ttw:p-0",
|
|
44
44
|
children: [/* @__PURE__ */ y(o, {
|
|
45
45
|
className: "ttw:text-2xl ttw:font-semibold ttw:leading-8 ttw:text-text",
|
|
46
|
-
children:
|
|
46
|
+
children: O._("Edit invoice settings")
|
|
47
47
|
}), /* @__PURE__ */ y(i, {
|
|
48
48
|
className: "ttw:sr-only",
|
|
49
|
-
children:
|
|
49
|
+
children: O._("Manage invoice settings including logo, and document configuration")
|
|
50
50
|
})]
|
|
51
|
-
}),
|
|
51
|
+
}), B]
|
|
52
52
|
})
|
|
53
|
-
}) : /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(l, {
|
|
53
|
+
}) : /* @__PURE__ */ b(v, { children: [S ? /* @__PURE__ */ y(l, {
|
|
54
54
|
className: "-Header",
|
|
55
55
|
titleVariant: "h3",
|
|
56
|
-
title: /* @__PURE__ */ y(v, { children:
|
|
57
|
-
}), /* @__PURE__ */ y("div", {
|
|
56
|
+
title: /* @__PURE__ */ y(v, { children: O._("Invoices") })
|
|
57
|
+
}) : null, /* @__PURE__ */ y("div", {
|
|
58
58
|
className: "ttw:rounded-xl ttw:border ttw:border-border ttw:bg-card ttw:p-6",
|
|
59
|
-
children:
|
|
59
|
+
children: B
|
|
60
60
|
})] }), /* @__PURE__ */ y(g, {
|
|
61
|
-
open:
|
|
61
|
+
open: k,
|
|
62
62
|
onClose: () => {
|
|
63
|
-
|
|
63
|
+
A(!1);
|
|
64
64
|
},
|
|
65
65
|
onContinue: () => {
|
|
66
|
-
|
|
66
|
+
A(!1), D(!1), u && w && w();
|
|
67
67
|
}
|
|
68
68
|
})] });
|
|
69
69
|
};
|
|
@@ -8,7 +8,8 @@ import "../../../shared/data-access/dist/index.js";
|
|
|
8
8
|
import { useAnalyticsTrack as n } from "../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
9
9
|
import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
10
10
|
import "../../../shared/feature/dist/index.js";
|
|
11
|
-
import {
|
|
11
|
+
import { ApprovalPoliciesSettings as i } from "../../../shared/approval-policy/feature/dist/lib/ApprovalPoliciesSettings.js";
|
|
12
|
+
import "../../../shared/approval-policy/feature/dist/index.js";
|
|
12
13
|
import { TemplateSettings as a } from "../../../monite-sdk/dist/index616.js";
|
|
13
14
|
import "../../../monite-sdk/dist/index.js";
|
|
14
15
|
import { MoniteRegionProvider as o } from "../../../shared/monite-wrapper/feature/dist/lib/MoniteRegionProvider.js";
|
|
@@ -39,7 +40,12 @@ var C = {
|
|
|
39
40
|
[c.Profile]: [],
|
|
40
41
|
[c.Team]: [t.UserReadOrg],
|
|
41
42
|
[c.Invoice]: [t.OrganizationSettingsWriteOrg],
|
|
42
|
-
[c.BillPay]: [
|
|
43
|
+
[c.BillPay]: [
|
|
44
|
+
t.ApprovalPolicyWriteOrg,
|
|
45
|
+
t.PayableWriteOrg,
|
|
46
|
+
t.RoleReadOrg,
|
|
47
|
+
t.UserReadOrg
|
|
48
|
+
],
|
|
43
49
|
[c.Accounting]: [t.AccountingConfigReadOrg],
|
|
44
50
|
[c.Tags]: [t.AccountingConfigReadOrg],
|
|
45
51
|
[c.Expense]: [t.ApprovalPolicyWriteOrg, t.ExpenseWriteOrg],
|
|
@@ -68,7 +74,7 @@ function w({ labels: t, featureLabels: o, acceptInviteRedirectUri: d, helpContac
|
|
|
68
74
|
{
|
|
69
75
|
id: c.Invoice,
|
|
70
76
|
label: B.invoiceSection,
|
|
71
|
-
content: R ?? /* @__PURE__ */ x(a, {})
|
|
77
|
+
content: R ?? /* @__PURE__ */ x(a, { showHeader: !1 })
|
|
72
78
|
},
|
|
73
79
|
{
|
|
74
80
|
id: c.Expense,
|
|
@@ -81,7 +87,10 @@ function w({ labels: t, featureLabels: o, acceptInviteRedirectUri: d, helpContac
|
|
|
81
87
|
{
|
|
82
88
|
id: c.BillPay,
|
|
83
89
|
label: B.billPaySection,
|
|
84
|
-
content: N ?? /* @__PURE__ */ x(i, {
|
|
90
|
+
content: N ?? /* @__PURE__ */ x(i, {
|
|
91
|
+
showHeaderTitle: !1,
|
|
92
|
+
componentLabels: { header: { Description: B.billPayDescription } }
|
|
93
|
+
})
|
|
85
94
|
},
|
|
86
95
|
{
|
|
87
96
|
id: c.Accounting,
|
package/dist/libs/tesouro-embedded-components-react/settings-widget/help/ui/shadcn/dist/index3.js
CHANGED
|
@@ -1,55 +1,53 @@
|
|
|
1
1
|
import { Accordion as e, AccordionContent as t, AccordionItem as n, AccordionTrigger as r } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
-
import {
|
|
3
|
-
import "../../../../../shared/ui/dist/index.js";
|
|
4
|
-
import { HELP_WIDGET_LABELS_EN as a } from "../../contract/dist/index2.js";
|
|
2
|
+
import { HELP_WIDGET_LABELS_EN as i } from "../../contract/dist/index2.js";
|
|
5
3
|
import "../../contract/dist/index.js";
|
|
6
|
-
import { AnswerBlocks as
|
|
7
|
-
import {
|
|
4
|
+
import { AnswerBlocks as a } from "./index2.js";
|
|
5
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
8
6
|
//#region ../../libs/tesouro-embedded-components-react/settings-widget/help/ui/shadcn/dist/index3.js
|
|
9
|
-
var
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
...
|
|
13
|
-
...
|
|
7
|
+
var c = "ttw:rounded-xl ttw:border ttw:border-border ttw:bg-card ttw:p-6";
|
|
8
|
+
function l({ faq: l, bankName: u, contactUrl: d, labels: f }) {
|
|
9
|
+
let p = {
|
|
10
|
+
...i,
|
|
11
|
+
...f
|
|
14
12
|
};
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
className:
|
|
17
|
-
children: /* @__PURE__ */
|
|
13
|
+
return /* @__PURE__ */ o("div", {
|
|
14
|
+
className: c,
|
|
15
|
+
children: /* @__PURE__ */ s("div", {
|
|
18
16
|
className: "ttw:space-y-8",
|
|
19
|
-
children: [
|
|
17
|
+
children: [l.map((i) => /* @__PURE__ */ s("section", { children: [/* @__PURE__ */ o("h3", {
|
|
20
18
|
className: "ttw:mb-2 ttw:text-lg ttw:font-semibold ttw:text-primary",
|
|
21
19
|
children: i.title
|
|
22
|
-
}), /* @__PURE__ */
|
|
20
|
+
}), /* @__PURE__ */ o(e, {
|
|
23
21
|
type: "single",
|
|
24
22
|
collapsible: !0,
|
|
25
23
|
className: "ttw:w-full ttw:space-y-3",
|
|
26
|
-
children: i.items.map((e,
|
|
27
|
-
value: `${i.title}-${
|
|
24
|
+
children: i.items.map((e, c) => /* @__PURE__ */ s(n, {
|
|
25
|
+
value: `${i.title}-${c}`,
|
|
28
26
|
className: "ttw:rounded-lg ttw:border ttw:border-border ttw:px-4 ttw:last:border-b",
|
|
29
|
-
children: [/* @__PURE__ */
|
|
30
|
-
}, `${i.title}-${
|
|
31
|
-
})] }, i.title)),
|
|
27
|
+
children: [/* @__PURE__ */ o(r, { children: e.question }), /* @__PURE__ */ o(t, { children: /* @__PURE__ */ o(a, { answers: e.answers }) })]
|
|
28
|
+
}, `${i.title}-${c}`))
|
|
29
|
+
})] }, i.title)), d && u && /* @__PURE__ */ s("section", { children: [/* @__PURE__ */ o("h3", {
|
|
32
30
|
className: "ttw:mb-1 ttw:text-lg ttw:font-semibold ttw:text-primary",
|
|
33
|
-
children:
|
|
34
|
-
}), /* @__PURE__ */
|
|
31
|
+
children: p.contactUsTitle
|
|
32
|
+
}), /* @__PURE__ */ s("p", {
|
|
35
33
|
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
36
34
|
children: [
|
|
37
|
-
|
|
35
|
+
p.contactUsBody,
|
|
38
36
|
" ",
|
|
39
|
-
|
|
37
|
+
u,
|
|
40
38
|
" ",
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
href:
|
|
39
|
+
/* @__PURE__ */ o("a", {
|
|
40
|
+
href: d,
|
|
43
41
|
target: "_blank",
|
|
44
42
|
rel: "noopener noreferrer",
|
|
45
43
|
className: "ttw:font-medium ttw:text-primary ttw:underline",
|
|
46
|
-
children:
|
|
44
|
+
children: p.contactUsLinkText
|
|
47
45
|
}),
|
|
48
46
|
"."
|
|
49
47
|
]
|
|
50
48
|
})] })]
|
|
51
49
|
})
|
|
52
|
-
})
|
|
50
|
+
});
|
|
53
51
|
}
|
|
54
52
|
//#endregion
|
|
55
|
-
export {
|
|
53
|
+
export { l as HelpWidgetShadcn, l as default };
|