@tesouro/embedded-components-react 0.11.113 → 0.11.116
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +0 -5
- package/dist/index.d.ts +2532 -2527
- package/dist/lib/ReceivablesWidget.d.ts +7 -2
- package/dist/lib/WidgetSuite.d.ts +1131 -6
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/invoicesFilter.js +85 -50
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/invoicesFilterLabels.js +7 -2
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/InvoicingSection.js +2 -1
- package/dist/packages/shared-ui-shadcn/dist/index.js +9 -16
- package/package.json +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { InvoicesFilterField as e } from "../../../../ui/dist/index3.js";
|
|
2
2
|
import "../../../../ui/dist/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { formatMoney as t } from "./helpers.js";
|
|
4
|
+
import { INVOICES_DATE_PRESET_GROUPS as n } from "./datePresets.js";
|
|
5
|
+
import { addDays as r, format as i, formatISO as a, startOfDay as o } from "date-fns";
|
|
5
6
|
// ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/invoicesFilter.js
|
|
6
|
-
var
|
|
7
|
+
var s = [
|
|
7
8
|
"draft",
|
|
8
9
|
"issued",
|
|
9
10
|
"overdue",
|
|
@@ -12,32 +13,32 @@ var a = [
|
|
|
12
13
|
"uncollectible",
|
|
13
14
|
"canceled",
|
|
14
15
|
"recurring"
|
|
15
|
-
],
|
|
16
|
+
], c = [
|
|
16
17
|
"draft",
|
|
17
18
|
"issued",
|
|
18
19
|
"overdue",
|
|
19
20
|
"partially_paid",
|
|
20
21
|
"paid",
|
|
21
22
|
"uncollectible"
|
|
22
|
-
],
|
|
23
|
+
], l = [
|
|
23
24
|
e.DueDate,
|
|
24
25
|
e.CreatedAt,
|
|
25
26
|
e.IssueDate,
|
|
26
27
|
e.Status,
|
|
27
28
|
e.Amount,
|
|
28
29
|
e.Customer
|
|
29
|
-
],
|
|
30
|
+
], u = {
|
|
30
31
|
dueDate: "due_date",
|
|
31
32
|
createdAt: "created_at",
|
|
32
33
|
issueDate: "issue_date"
|
|
33
|
-
},
|
|
34
|
+
}, d = {
|
|
34
35
|
Status: "status",
|
|
35
36
|
Customer: "customer",
|
|
36
37
|
Counterpart: "counterpart",
|
|
37
38
|
Amount: "amount",
|
|
38
39
|
Search: "search"
|
|
39
|
-
},
|
|
40
|
-
function
|
|
40
|
+
}, f = "date_";
|
|
41
|
+
function p(e) {
|
|
41
42
|
return {
|
|
42
43
|
dateRanges: {},
|
|
43
44
|
statuses: [],
|
|
@@ -48,71 +49,105 @@ function d(e) {
|
|
|
48
49
|
customerId: e
|
|
49
50
|
};
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
+
function m(e) {
|
|
52
53
|
return !!(e?.from || e?.to || e?.preset);
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
+
function h(e) {
|
|
55
56
|
return Object.entries(e.dateRanges);
|
|
56
57
|
}
|
|
57
|
-
function
|
|
58
|
+
function g(e) {
|
|
58
59
|
let t = Number.parseFloat(e);
|
|
59
60
|
return Number.isNaN(t) ? void 0 : Math.round(t * 100);
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
+
function _(e) {
|
|
63
|
+
if (e.amountMode === "any") return {};
|
|
64
|
+
let t = g(e.amountMin);
|
|
65
|
+
return e.amountMode === "exact" ? {
|
|
66
|
+
min: t,
|
|
67
|
+
max: t
|
|
68
|
+
} : {
|
|
69
|
+
min: t,
|
|
70
|
+
max: g(e.amountMax)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function v(e) {
|
|
74
|
+
let { min: t, max: n } = _(e);
|
|
75
|
+
return t !== void 0 || n !== void 0;
|
|
76
|
+
}
|
|
77
|
+
function y(e) {
|
|
62
78
|
let t = {};
|
|
63
|
-
for (let [
|
|
64
|
-
let e =
|
|
65
|
-
e === "due_date" ? (
|
|
66
|
-
}
|
|
67
|
-
if (t.status__in = e.statuses.length > 0 ? e.statuses : o, e.customerName && (t.counterpart_name__icontains = e.customerName), e.customerId && (t.counterpart_id = e.customerId), e.amountMode !== "any") {
|
|
68
|
-
let n = m(e.amountMin), r = m(e.amountMax);
|
|
69
|
-
e.amountMode === "exact" ? n !== void 0 && (t.total_amount__gte = n, t.total_amount__lte = n) : (n !== void 0 && (t.total_amount__gte = n), r !== void 0 && (t.total_amount__lte = r));
|
|
79
|
+
for (let [n, i] of h(e)) {
|
|
80
|
+
let e = u[n];
|
|
81
|
+
e === "due_date" ? (i?.from && (t.due_date__gte = a(i.from, { representation: "date" })), i?.to && (t.due_date__lte = a(i.to, { representation: "date" }))) : (i?.from && (t[`${e}__gte`] = o(i.from).toISOString()), i?.to && (t[`${e}__lt`] = r(o(i.to), 1).toISOString()));
|
|
70
82
|
}
|
|
71
|
-
|
|
83
|
+
t.status__in = e.statuses.length > 0 ? e.statuses : c, e.customerName && (t.counterpart_name__icontains = e.customerName), e.customerId && (t.counterpart_id = e.customerId);
|
|
84
|
+
let { min: n, max: i } = _(e);
|
|
85
|
+
return n !== void 0 && (t.total_amount__gte = n), i !== void 0 && (t.total_amount__lte = i), t;
|
|
72
86
|
}
|
|
73
|
-
function
|
|
87
|
+
function b(e, t) {
|
|
74
88
|
return [
|
|
75
|
-
Object.values(e.dateRanges).some(
|
|
89
|
+
Object.values(e.dateRanges).some(m),
|
|
76
90
|
e.statuses.length > 0,
|
|
77
91
|
!!e.customerName,
|
|
78
92
|
!!e.customerId,
|
|
79
|
-
e
|
|
93
|
+
v(e),
|
|
80
94
|
!!t
|
|
81
95
|
].filter(Boolean).length;
|
|
82
96
|
}
|
|
83
|
-
|
|
97
|
+
var x = "MMM d, yyyy";
|
|
98
|
+
function S(e, t) {
|
|
99
|
+
if (e?.preset && e.preset in t.presets) return t.presets[e.preset];
|
|
100
|
+
let n = e?.from && i(e.from, x), r = e?.to && i(e.to, x);
|
|
101
|
+
if (n && r) return t.dateRange(n, r);
|
|
102
|
+
if (n) return t.dateFrom(n);
|
|
103
|
+
if (r) return t.dateTo(r);
|
|
104
|
+
}
|
|
105
|
+
var C = (e) => e === void 0 ? void 0 : t({
|
|
106
|
+
amount: e,
|
|
107
|
+
currency: "USD",
|
|
108
|
+
fallback: ""
|
|
109
|
+
});
|
|
110
|
+
function w(e, t) {
|
|
111
|
+
let n = _(e), r = C(n.min), i = C(n.max);
|
|
112
|
+
if (e.amountMode === "exact") return r;
|
|
113
|
+
if (r && i) return t.amountBetween(r, i);
|
|
114
|
+
if (r) return t.amountAtLeast(r);
|
|
115
|
+
if (i) return t.amountAtMost(i);
|
|
116
|
+
}
|
|
117
|
+
function T({ state: e, search: t, counterpartName: n, labels: r, statusLabels: i }) {
|
|
84
118
|
let a = [], o = new Map(Object.entries(i));
|
|
85
|
-
for (let [t, n] of
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
label: r.dateChip(r.dateFieldNames[t], e ?? r.customRange)
|
|
119
|
+
for (let [t, n] of h(e)) {
|
|
120
|
+
let e = S(n, r);
|
|
121
|
+
e && a.push({
|
|
122
|
+
key: `${f}${t}`,
|
|
123
|
+
label: r.dateChip(r.dateFieldNames[t], e)
|
|
91
124
|
});
|
|
92
125
|
}
|
|
93
126
|
if (e.statuses.length > 0) {
|
|
94
127
|
let [t, ...n] = e.statuses.map((e) => o.get(e) ?? e);
|
|
95
128
|
a.push({
|
|
96
|
-
key:
|
|
129
|
+
key: d.Status,
|
|
97
130
|
label: r.statusChip(n.length === 0 ? t : r.moreSelected(t, n.length))
|
|
98
131
|
});
|
|
99
132
|
}
|
|
100
|
-
|
|
101
|
-
key:
|
|
133
|
+
e.customerName && a.push({
|
|
134
|
+
key: d.Customer,
|
|
102
135
|
label: r.customerChip(e.customerName)
|
|
103
136
|
}), e.customerId && a.push({
|
|
104
|
-
key:
|
|
137
|
+
key: d.Counterpart,
|
|
105
138
|
label: r.customerChip(n || e.customerId)
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
|
|
139
|
+
});
|
|
140
|
+
let s = w(e, r);
|
|
141
|
+
return s && a.push({
|
|
142
|
+
key: d.Amount,
|
|
143
|
+
label: r.amountChip(s)
|
|
109
144
|
}), t && a.push({
|
|
110
|
-
key:
|
|
145
|
+
key: d.Search,
|
|
111
146
|
label: r.searchChip(t)
|
|
112
147
|
}), a;
|
|
113
148
|
}
|
|
114
|
-
function
|
|
115
|
-
if (t.startsWith(
|
|
149
|
+
function E(e, t) {
|
|
150
|
+
if (t.startsWith(f)) {
|
|
116
151
|
let n = t.slice(5), r = { ...e.dateRanges };
|
|
117
152
|
return delete r[n], {
|
|
118
153
|
...e,
|
|
@@ -120,19 +155,19 @@ function v(e, t) {
|
|
|
120
155
|
};
|
|
121
156
|
}
|
|
122
157
|
switch (t) {
|
|
123
|
-
case
|
|
158
|
+
case d.Status: return {
|
|
124
159
|
...e,
|
|
125
160
|
statuses: []
|
|
126
161
|
};
|
|
127
|
-
case
|
|
162
|
+
case d.Customer: return {
|
|
128
163
|
...e,
|
|
129
164
|
customerName: ""
|
|
130
165
|
};
|
|
131
|
-
case
|
|
166
|
+
case d.Counterpart: return {
|
|
132
167
|
...e,
|
|
133
168
|
customerId: void 0
|
|
134
169
|
};
|
|
135
|
-
case
|
|
170
|
+
case d.Amount: return {
|
|
136
171
|
...e,
|
|
137
172
|
amountMode: "any",
|
|
138
173
|
amountMin: "",
|
|
@@ -141,18 +176,18 @@ function v(e, t) {
|
|
|
141
176
|
default: return e;
|
|
142
177
|
}
|
|
143
178
|
}
|
|
144
|
-
function
|
|
145
|
-
return
|
|
179
|
+
function D(e, t) {
|
|
180
|
+
return s.map((n) => ({
|
|
146
181
|
value: n,
|
|
147
182
|
label: e[n],
|
|
148
183
|
description: t.statusDescriptions[n]
|
|
149
184
|
}));
|
|
150
185
|
}
|
|
151
|
-
function
|
|
152
|
-
return Object.entries(
|
|
186
|
+
function O(e) {
|
|
187
|
+
return Object.entries(n).map(([t, n]) => ({
|
|
153
188
|
value: t,
|
|
154
189
|
label: e.presets[t],
|
|
155
190
|
group: n === "current" ? e.presetGroupCurrent : e.presetGroupPast
|
|
156
191
|
}));
|
|
157
192
|
}
|
|
158
|
-
export {
|
|
193
|
+
export { l as INVOICES_FILTER_FIELDS, c as INVOICE_DEFAULT_STATUSES, s as INVOICE_FILTER_STATUSES, d as InvoicesFilterChipKey, O as buildInvoicesDatePresetOptions, T as buildInvoicesFilterChips, y as buildInvoicesFilterQuery, D as buildInvoicesStatusOptions, E as clearInvoicesFilter, b as countActiveInvoiceFilters, p as emptyInvoicesFilterState };
|
|
@@ -22,7 +22,9 @@ var t = {
|
|
|
22
22
|
createdAt: "Created on",
|
|
23
23
|
issueDate: "Issue date"
|
|
24
24
|
},
|
|
25
|
-
|
|
25
|
+
dateRange: (e, t) => `${e} - ${t}`,
|
|
26
|
+
dateFrom: (e) => `From ${e}`,
|
|
27
|
+
dateTo: (e) => `Until ${e}`,
|
|
26
28
|
statusDescriptions: {
|
|
27
29
|
draft: "Created but not yet sent",
|
|
28
30
|
overdue: "Past due date",
|
|
@@ -33,7 +35,10 @@ var t = {
|
|
|
33
35
|
statusChip: (e) => `Status: ${e}`,
|
|
34
36
|
moreSelected: (e, t) => `${e} + ${t} more`,
|
|
35
37
|
customerChip: (e) => `Customer: ${e}`,
|
|
36
|
-
amountChip:
|
|
38
|
+
amountChip: (e) => `Amount: ${e}`,
|
|
39
|
+
amountAtLeast: (e) => `${e} or more`,
|
|
40
|
+
amountAtMost: (e) => `${e} or less`,
|
|
41
|
+
amountBetween: (e, t) => `${e} - ${t}`,
|
|
37
42
|
searchChip: (e) => `Search: ${e}`
|
|
38
43
|
};
|
|
39
44
|
function n(e) {
|
package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
|
|
2
|
-
var e = "@tesouro/embedded-components-react", t = "0.11.
|
|
2
|
+
var e = "@tesouro/embedded-components-react", t = "0.11.116", n = "40d2b4ab6611b58bdceed06101c83e902941346f", r = Object.freeze({
|
|
3
3
|
library_name: e,
|
|
4
4
|
library_version: t,
|
|
5
5
|
library_sha: n
|
|
@@ -11,8 +11,9 @@ import "../../../../../../invoicing-widget/feature/dist/index.js";
|
|
|
11
11
|
import { jsx as i } from "react/jsx-runtime";
|
|
12
12
|
// ../../libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/InvoicingSection.js
|
|
13
13
|
function a({ renderTitle: n } = {}) {
|
|
14
|
-
let { arrivingFlow: a } = t();
|
|
14
|
+
let { arrivingFlow: a, labels: o } = t();
|
|
15
15
|
return /* @__PURE__ */ i(r, {
|
|
16
|
+
...o.sections.invoicing,
|
|
16
17
|
headerStart: n?.(),
|
|
17
18
|
...a === e.Invoicing && { initialView: "create" }
|
|
18
19
|
});
|
|
@@ -186,20 +186,10 @@ F("ellipsis", [
|
|
|
186
186
|
key: "1pcz8c"
|
|
187
187
|
}]
|
|
188
188
|
]);
|
|
189
|
-
var ue = F("
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}],
|
|
194
|
-
["path", {
|
|
195
|
-
d: "M6 12h12",
|
|
196
|
-
key: "8npq4p"
|
|
197
|
-
}],
|
|
198
|
-
["path", {
|
|
199
|
-
d: "M9 19h6",
|
|
200
|
-
key: "456am0"
|
|
201
|
-
}]
|
|
202
|
-
]), de = F("loader-circle", [["path", {
|
|
189
|
+
var ue = F("funnel", [["path", {
|
|
190
|
+
d: "M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",
|
|
191
|
+
key: "sc7q7i"
|
|
192
|
+
}]]), de = F("loader-circle", [["path", {
|
|
203
193
|
d: "M21 12a9 9 0 1 1-6.219-8.56",
|
|
204
194
|
key: "13zald"
|
|
205
195
|
}]]);
|
|
@@ -17435,9 +17425,12 @@ function OM({ activeCount: e, size: t = "sm", labels: n, className: r, ...i }) {
|
|
|
17435
17425
|
};
|
|
17436
17426
|
return /* @__PURE__ */ v("button", {
|
|
17437
17427
|
type: "button",
|
|
17438
|
-
className: Y(
|
|
17428
|
+
className: Y(Cv({
|
|
17429
|
+
variant: "ghost",
|
|
17430
|
+
size: t
|
|
17431
|
+
}), r),
|
|
17439
17432
|
...i,
|
|
17440
|
-
children: [/* @__PURE__ */ _(ue, {
|
|
17433
|
+
children: [/* @__PURE__ */ _(ue, { "aria-hidden": !0 }), /* @__PURE__ */ v("span", { children: [a.filters, e !== void 0 && e > 0 ? ` (${e})` : null] })]
|
|
17441
17434
|
});
|
|
17442
17435
|
}
|
|
17443
17436
|
var kM = {
|