@tesouro/embedded-components-react 0.4.18 → 0.4.20
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 +11 -0
- package/dist/index.d.ts +4 -1
- package/dist/lib/ReceivablesWidget.d.ts +4 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +23 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +49 -50
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +254 -250
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +71 -65
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +5 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +3 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +11 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index12.js +1 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +1 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +3 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index17.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index29.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index30.js +142 -137
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index47.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index49.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index61.js +52 -47
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js +89 -86
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index7.js +59 -57
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/index.js +1 -0
- 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/feature/dist/lib/user/useOrganizationUserNames.js +6 -0
- package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/amountOutputToMajorUnits.js +14 -6
- package/package.json +1 -1
|
@@ -49,85 +49,85 @@ function D({ heading: e, children: t }) {
|
|
|
49
49
|
}), /* @__PURE__ */ x(r, { children: t })]
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
function O({ open: n, onOpenChange: r, details: i, actions:
|
|
53
|
-
let
|
|
52
|
+
function O({ open: n, onOpenChange: r, details: i, actions: C = _, approvalPolicy: O, showApprovalOverrideNotice: k, paymentHistory: A, paymentHistoryError: j, paymentHistoryLoading: M, isLoading: N, isError: P, notice: F, onClose: I, onExpand: L, testId: R, labels: z }) {
|
|
53
|
+
let B = {
|
|
54
54
|
...y,
|
|
55
|
-
...
|
|
55
|
+
...z,
|
|
56
56
|
statusBadge: {
|
|
57
57
|
...y.statusBadge,
|
|
58
|
-
...
|
|
58
|
+
...z?.statusBadge
|
|
59
59
|
},
|
|
60
60
|
approvalPolicy: {
|
|
61
61
|
...y.approvalPolicy,
|
|
62
|
-
...
|
|
62
|
+
...z?.approvalPolicy
|
|
63
63
|
},
|
|
64
64
|
dueDate: {
|
|
65
65
|
...y.dueDate,
|
|
66
|
-
...
|
|
66
|
+
...z?.dueDate
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
return /* @__PURE__ */ x(a, {
|
|
70
70
|
open: n,
|
|
71
|
-
onOpenChange: (e) => e ? r(e) :
|
|
71
|
+
onOpenChange: (e) => e ? r(e) : I(),
|
|
72
72
|
children: /* @__PURE__ */ S(o, {
|
|
73
73
|
showCloseButton: !1,
|
|
74
74
|
className: "ttw:w-150 ttw:gap-0 ttw:overflow-y-auto ttw:sm:max-w-150",
|
|
75
|
-
"data-testid":
|
|
75
|
+
"data-testid": R,
|
|
76
76
|
children: [/* @__PURE__ */ S(c, {
|
|
77
77
|
className: "ttw:flex ttw:flex-row ttw:items-start ttw:justify-between ttw:gap-3",
|
|
78
78
|
children: [/* @__PURE__ */ S("div", {
|
|
79
79
|
className: "ttw:flex ttw:flex-col ttw:gap-0.5",
|
|
80
80
|
children: [
|
|
81
81
|
/* @__PURE__ */ x(l, {
|
|
82
|
-
className:
|
|
83
|
-
children:
|
|
82
|
+
className: N ? "ttw:sr-only" : "ttw:text-xl ttw:font-semibold",
|
|
83
|
+
children: P ? B.errorTitle : N ? B.loadingTitle : i?.title
|
|
84
84
|
}),
|
|
85
|
-
|
|
85
|
+
N ? /* @__PURE__ */ S("div", {
|
|
86
86
|
"aria-hidden": !0,
|
|
87
87
|
className: "ttw:flex ttw:flex-col ttw:gap-2 ttw:py-1",
|
|
88
88
|
children: [/* @__PURE__ */ x(u, { className: "ttw:h-6 ttw:w-48" }), /* @__PURE__ */ x(u, { className: "ttw:h-4 ttw:w-28" })]
|
|
89
89
|
}) : null,
|
|
90
|
-
i && !
|
|
90
|
+
i && !N && !P ? /* @__PURE__ */ x("p", {
|
|
91
91
|
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
92
92
|
children: i.subtitle
|
|
93
93
|
}) : null,
|
|
94
94
|
/* @__PURE__ */ x(s, {
|
|
95
95
|
className: "ttw:sr-only",
|
|
96
|
-
children:
|
|
96
|
+
children: B.hiddenDescription
|
|
97
97
|
})
|
|
98
98
|
]
|
|
99
99
|
}), /* @__PURE__ */ S("div", {
|
|
100
100
|
className: "ttw:flex ttw:items-center ttw:gap-1",
|
|
101
101
|
children: [
|
|
102
|
-
|
|
102
|
+
L ? /* @__PURE__ */ x(t, {
|
|
103
103
|
type: "button",
|
|
104
104
|
variant: "ghost",
|
|
105
105
|
size: "icon",
|
|
106
|
-
"aria-label":
|
|
107
|
-
onClick:
|
|
106
|
+
"aria-label": B.expandButton,
|
|
107
|
+
onClick: L,
|
|
108
108
|
children: /* @__PURE__ */ x(w, { className: "ttw:size-4" })
|
|
109
109
|
}) : null,
|
|
110
|
-
i && !
|
|
111
|
-
actions:
|
|
112
|
-
triggerLabel:
|
|
110
|
+
i && !N && !P ? /* @__PURE__ */ x(v, {
|
|
111
|
+
actions: C.menu,
|
|
112
|
+
triggerLabel: B.overflowMenuTrigger,
|
|
113
113
|
placement: "header"
|
|
114
114
|
}) : null,
|
|
115
115
|
/* @__PURE__ */ x(t, {
|
|
116
116
|
type: "button",
|
|
117
117
|
variant: "ghost",
|
|
118
118
|
size: "icon",
|
|
119
|
-
"aria-label":
|
|
120
|
-
onClick:
|
|
119
|
+
"aria-label": B.closeButton,
|
|
120
|
+
onClick: I,
|
|
121
121
|
children: /* @__PURE__ */ x(T, { className: "ttw:size-4" })
|
|
122
122
|
})
|
|
123
123
|
]
|
|
124
124
|
})]
|
|
125
125
|
}), /* @__PURE__ */ x("div", {
|
|
126
126
|
className: "ttw:flex ttw:flex-col ttw:gap-6 ttw:px-6 ttw:pb-6",
|
|
127
|
-
children:
|
|
127
|
+
children: P ? /* @__PURE__ */ x("p", {
|
|
128
128
|
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
129
|
-
children:
|
|
130
|
-
}) :
|
|
129
|
+
children: B.errorDescription
|
|
130
|
+
}) : N ? /* @__PURE__ */ S("div", {
|
|
131
131
|
className: "ttw:flex ttw:flex-col ttw:gap-6",
|
|
132
132
|
children: [/* @__PURE__ */ x(u, { className: "ttw:h-32 ttw:w-full" }), /* @__PURE__ */ S("div", {
|
|
133
133
|
className: "ttw:flex ttw:flex-col ttw:gap-2",
|
|
@@ -138,7 +138,7 @@ function O({ open: n, onOpenChange: r, details: i, actions: d = _, approvalPolic
|
|
|
138
138
|
]
|
|
139
139
|
})]
|
|
140
140
|
}) : i ? /* @__PURE__ */ S(b, { children: [
|
|
141
|
-
|
|
141
|
+
F,
|
|
142
142
|
/* @__PURE__ */ S("section", {
|
|
143
143
|
className: "ttw:flex ttw:flex-col ttw:gap-3 ttw:rounded-lg ttw:bg-muted/50 ttw:p-4",
|
|
144
144
|
children: [
|
|
@@ -150,7 +150,7 @@ function O({ open: n, onOpenChange: r, details: i, actions: d = _, approvalPolic
|
|
|
150
150
|
className: "ttw:flex ttw:flex-col",
|
|
151
151
|
children: [/* @__PURE__ */ x("span", {
|
|
152
152
|
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
153
|
-
children:
|
|
153
|
+
children: B.amountDueHeading
|
|
154
154
|
}), /* @__PURE__ */ x("span", {
|
|
155
155
|
className: "ttw:text-3xl ttw:font-semibold",
|
|
156
156
|
children: i.amountDueLabel
|
|
@@ -159,7 +159,7 @@ function O({ open: n, onOpenChange: r, details: i, actions: d = _, approvalPolic
|
|
|
159
159
|
className: "ttw:flex ttw:flex-col",
|
|
160
160
|
children: [/* @__PURE__ */ x("span", {
|
|
161
161
|
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
162
|
-
children:
|
|
162
|
+
children: B.amountPaidHeading
|
|
163
163
|
}), /* @__PURE__ */ x("span", {
|
|
164
164
|
className: "ttw:text-3xl ttw:font-semibold ttw:text-emerald-600",
|
|
165
165
|
children: i.amountPaidLabel
|
|
@@ -167,7 +167,7 @@ function O({ open: n, onOpenChange: r, details: i, actions: d = _, approvalPolic
|
|
|
167
167
|
})]
|
|
168
168
|
}) : /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x("span", {
|
|
169
169
|
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
170
|
-
children:
|
|
170
|
+
children: B.amountDueHeading
|
|
171
171
|
}), /* @__PURE__ */ x("span", {
|
|
172
172
|
className: "ttw:text-3xl ttw:font-semibold",
|
|
173
173
|
children: i.amountDueLabel
|
|
@@ -178,7 +178,7 @@ function O({ open: n, onOpenChange: r, details: i, actions: d = _, approvalPolic
|
|
|
178
178
|
}) : /* @__PURE__ */ x(p, {
|
|
179
179
|
status: i.status,
|
|
180
180
|
tone: i.statusTone,
|
|
181
|
-
labels:
|
|
181
|
+
labels: B.statusBadge
|
|
182
182
|
}) })]
|
|
183
183
|
}),
|
|
184
184
|
/* @__PURE__ */ S("div", {
|
|
@@ -187,7 +187,7 @@ function O({ open: n, onOpenChange: r, details: i, actions: d = _, approvalPolic
|
|
|
187
187
|
className: "ttw:flex ttw:flex-col",
|
|
188
188
|
children: [/* @__PURE__ */ x("span", {
|
|
189
189
|
className: "ttw:text-xs ttw:text-muted-foreground",
|
|
190
|
-
children:
|
|
190
|
+
children: B.invoiceDateLabel
|
|
191
191
|
}), /* @__PURE__ */ x("span", {
|
|
192
192
|
className: "ttw:text-sm ttw:font-medium",
|
|
193
193
|
children: i.invoiceDateLabel
|
|
@@ -196,34 +196,39 @@ function O({ open: n, onOpenChange: r, details: i, actions: d = _, approvalPolic
|
|
|
196
196
|
className: "ttw:flex ttw:flex-col",
|
|
197
197
|
children: [/* @__PURE__ */ x("span", {
|
|
198
198
|
className: "ttw:text-xs ttw:text-muted-foreground",
|
|
199
|
-
children:
|
|
199
|
+
children: B.dueDateLabel
|
|
200
200
|
}), /* @__PURE__ */ x(m, {
|
|
201
201
|
className: "ttw:text-sm ttw:font-medium",
|
|
202
202
|
value: i.dueDateLabel,
|
|
203
203
|
tone: i.dueDateTone,
|
|
204
|
-
labels:
|
|
204
|
+
labels: B.dueDate
|
|
205
205
|
})]
|
|
206
206
|
})]
|
|
207
207
|
}),
|
|
208
|
-
|
|
208
|
+
k ? /* @__PURE__ */ x(d, {
|
|
209
|
+
variant: "caption",
|
|
210
|
+
color: "muted",
|
|
211
|
+
children: B.approvalOverrideNotice
|
|
212
|
+
}) : null,
|
|
213
|
+
C.row.length ? /* @__PURE__ */ x("div", {
|
|
209
214
|
className: "ttw:flex ttw:items-center ttw:gap-2",
|
|
210
|
-
children: /* @__PURE__ */ x(g, { actions:
|
|
215
|
+
children: /* @__PURE__ */ x(g, { actions: C.row })
|
|
211
216
|
}) : null
|
|
212
217
|
]
|
|
213
218
|
}),
|
|
214
219
|
/* @__PURE__ */ x(D, {
|
|
215
|
-
heading: i.paidOnLabel ?
|
|
220
|
+
heading: i.paidOnLabel ? B.payToHeadingPaid : B.payToHeading,
|
|
216
221
|
children: /* @__PURE__ */ x(E, { items: i.payToItems })
|
|
217
222
|
}),
|
|
218
|
-
|
|
219
|
-
heading:
|
|
220
|
-
children:
|
|
223
|
+
A?.length || j || M ? /* @__PURE__ */ x(D, {
|
|
224
|
+
heading: B.paymentHistoryHeading,
|
|
225
|
+
children: j ? /* @__PURE__ */ x("p", {
|
|
221
226
|
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
222
|
-
children:
|
|
223
|
-
}) :
|
|
227
|
+
children: B.paymentHistoryErrorDescription
|
|
228
|
+
}) : M ? /* @__PURE__ */ x(u, { className: "ttw:h-9 ttw:w-full" }) : /* @__PURE__ */ x(h, { records: A ?? [] })
|
|
224
229
|
}) : null,
|
|
225
230
|
/* @__PURE__ */ x(D, {
|
|
226
|
-
heading:
|
|
231
|
+
heading: B.invoiceDetailsHeading,
|
|
227
232
|
children: /* @__PURE__ */ S("div", {
|
|
228
233
|
className: "ttw:flex ttw:flex-col ttw:gap-4",
|
|
229
234
|
children: [
|
|
@@ -235,15 +240,15 @@ function O({ open: n, onOpenChange: r, details: i, actions: d = _, approvalPolic
|
|
|
235
240
|
children: [
|
|
236
241
|
/* @__PURE__ */ x("th", {
|
|
237
242
|
className: "ttw:px-3 ttw:py-2 ttw:text-left ttw:font-normal",
|
|
238
|
-
children:
|
|
243
|
+
children: B.lineItemsHeading
|
|
239
244
|
}),
|
|
240
245
|
/* @__PURE__ */ x("th", {
|
|
241
246
|
className: "ttw:px-3 ttw:py-2 ttw:text-right ttw:font-normal",
|
|
242
|
-
children:
|
|
247
|
+
children: B.lineItemsQuantityHeading
|
|
243
248
|
}),
|
|
244
249
|
/* @__PURE__ */ x("th", {
|
|
245
250
|
className: "ttw:px-3 ttw:py-2 ttw:text-right ttw:font-normal",
|
|
246
|
-
children:
|
|
251
|
+
children: B.lineItemsAmountHeading
|
|
247
252
|
})
|
|
248
253
|
]
|
|
249
254
|
}) }), /* @__PURE__ */ x("tbody", { children: i.lineItems.map((e) => /* @__PURE__ */ S("tr", {
|
|
@@ -283,9 +288,9 @@ function O({ open: n, onOpenChange: r, details: i, actions: d = _, approvalPolic
|
|
|
283
288
|
]
|
|
284
289
|
})
|
|
285
290
|
}),
|
|
286
|
-
|
|
287
|
-
view:
|
|
288
|
-
labels:
|
|
291
|
+
O ? /* @__PURE__ */ x(f, {
|
|
292
|
+
view: O,
|
|
293
|
+
labels: B.approvalPolicy
|
|
289
294
|
}) : null
|
|
290
295
|
] }) : null
|
|
291
296
|
})]
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
+
import { minorExponentForCurrency as e } from "../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
|
|
1
2
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js
|
|
2
|
-
var
|
|
3
|
+
var t = /^(\d{4})-(\d{2})-(\d{2})$/, n = {
|
|
3
4
|
to: "",
|
|
4
5
|
cc: "",
|
|
5
6
|
bcc: "",
|
|
6
7
|
subject: "",
|
|
7
8
|
body: ""
|
|
8
|
-
},
|
|
9
|
+
}, r = {
|
|
9
10
|
mode: "full",
|
|
10
11
|
amountPaid: "",
|
|
11
12
|
paidAt: "",
|
|
12
13
|
comment: ""
|
|
13
14
|
};
|
|
14
|
-
function
|
|
15
|
+
function i() {
|
|
15
16
|
return {
|
|
16
17
|
id: typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(16).slice(2)}`,
|
|
17
18
|
productId: "",
|
|
18
19
|
quantity: "1"
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
+
function a() {
|
|
22
23
|
return {
|
|
23
24
|
type: "invoice",
|
|
24
25
|
customerId: "",
|
|
@@ -27,16 +28,16 @@ function i() {
|
|
|
27
28
|
dueDate: "",
|
|
28
29
|
memo: "",
|
|
29
30
|
paymentTermsId: "",
|
|
30
|
-
lineItems: [
|
|
31
|
+
lineItems: [i()]
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
+
function o(e) {
|
|
34
35
|
return e === "quotes" ? "quote" : e === "credit_notes" ? "credit_note" : "invoice";
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function s(e) {
|
|
37
38
|
return e === "quote" ? "quotes" : e === "credit_note" ? "credit_notes" : "invoices";
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
+
function c(e) {
|
|
40
41
|
return (e?.length ? e : [
|
|
41
42
|
"invoices",
|
|
42
43
|
"quotes",
|
|
@@ -47,44 +48,46 @@ function s(e) {
|
|
|
47
48
|
"credit_notes"
|
|
48
49
|
].includes(e) && n.indexOf(e) === t);
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function l({ defaultTab: e, enabledTabs: t }) {
|
|
51
52
|
return e && t.includes(e) ? e : t[0] ?? "invoices";
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
+
function u(e, t) {
|
|
54
55
|
if (!e) return t;
|
|
55
|
-
let n =
|
|
56
|
+
let n = d(e);
|
|
56
57
|
return Number.isNaN(n.getTime()) ? t : new Intl.DateTimeFormat(void 0, {
|
|
57
58
|
day: "numeric",
|
|
58
59
|
month: "short",
|
|
59
60
|
year: "numeric"
|
|
60
61
|
}).format(n);
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
-
let n =
|
|
64
|
-
if (!n) return new Date(
|
|
63
|
+
function d(e) {
|
|
64
|
+
let n = t.exec(e);
|
|
65
|
+
if (!n) return new Date(e);
|
|
65
66
|
let r = Number(n[1]), i = Number(n[2]) - 1, a = Number(n[3]), o = new Date(r, i, a);
|
|
66
67
|
return o.getFullYear() !== r || o.getMonth() !== i || o.getDate() !== a ? /* @__PURE__ */ new Date(NaN) : o;
|
|
67
68
|
}
|
|
68
|
-
function
|
|
69
|
-
return
|
|
70
|
-
currency:
|
|
69
|
+
function f({ amount: t, currency: n, fallback: r }) {
|
|
70
|
+
return t == null || !n ? r : new Intl.NumberFormat(void 0, {
|
|
71
|
+
currency: n,
|
|
71
72
|
style: "currency"
|
|
72
|
-
}).format(
|
|
73
|
+
}).format(t / 10 ** e(n));
|
|
73
74
|
}
|
|
74
|
-
function
|
|
75
|
-
let
|
|
76
|
-
if (Number.isFinite(
|
|
75
|
+
function p(t, n) {
|
|
76
|
+
let r = Number(t);
|
|
77
|
+
if (!Number.isFinite(r)) return;
|
|
78
|
+
let i = n ? e(n) : 2;
|
|
79
|
+
return Math.round(r * 10 ** i);
|
|
77
80
|
}
|
|
78
|
-
function
|
|
81
|
+
function m(e, t) {
|
|
79
82
|
return e.document_id || t.untitledDocument;
|
|
80
83
|
}
|
|
81
|
-
function
|
|
84
|
+
function h(e, t) {
|
|
82
85
|
return e === "quote" ? t.quoteType : e === "credit_note" ? t.creditNoteType : t.invoiceType;
|
|
83
86
|
}
|
|
84
|
-
function
|
|
87
|
+
function g(e) {
|
|
85
88
|
return e === "paid" || e === "accepted" || e === "issued" || e === "recurring" ? "success" : e === "draft" || e === "issuing" ? "neutral" : e === "overdue" || e === "partially_paid" ? "warning" : e === "failed" || e === "declined" || e === "expired" || e === "uncollectible" || e === "canceled" || e === "deleted" ? "danger" : "info";
|
|
86
89
|
}
|
|
87
|
-
function
|
|
90
|
+
function _(e) {
|
|
88
91
|
let t = e.status === "draft", n = e.status === "issued", r = e.type === "invoice", i = e.type === "quote", a = e.type === "credit_note", o = r && [
|
|
89
92
|
"issued",
|
|
90
93
|
"overdue",
|
|
@@ -114,48 +117,48 @@ function g(e) {
|
|
|
114
117
|
].includes(e.status) && !a
|
|
115
118
|
};
|
|
116
119
|
}
|
|
117
|
-
function
|
|
120
|
+
function v({ receivables: e, messages: t }) {
|
|
118
121
|
return e.map((e) => {
|
|
119
122
|
let n = e.type === "invoice" ? e.amount_due : void 0;
|
|
120
123
|
return {
|
|
121
124
|
id: e.id,
|
|
122
125
|
type: e.type,
|
|
123
|
-
documentLabel:
|
|
126
|
+
documentLabel: m(e, t),
|
|
124
127
|
customerLabel: e.counterpart_name || t.unknownCustomer,
|
|
125
128
|
status: e.status,
|
|
126
|
-
statusTone:
|
|
127
|
-
issueDateLabel:
|
|
128
|
-
dueDateLabel:
|
|
129
|
-
totalLabel:
|
|
129
|
+
statusTone: g(e.status),
|
|
130
|
+
issueDateLabel: u(e.issue_date, t.notAvailable),
|
|
131
|
+
dueDateLabel: u(e.type === "quote" ? e.expiry_date : e.due_date, t.notAvailable),
|
|
132
|
+
totalLabel: f({
|
|
130
133
|
amount: e.total_amount,
|
|
131
134
|
currency: e.currency,
|
|
132
135
|
fallback: t.notAvailable
|
|
133
136
|
}),
|
|
134
|
-
amountDueLabel:
|
|
137
|
+
amountDueLabel: f({
|
|
135
138
|
amount: n,
|
|
136
139
|
currency: e.currency,
|
|
137
140
|
fallback: t.notAvailable
|
|
138
141
|
}),
|
|
139
|
-
actions:
|
|
142
|
+
actions: _(e)
|
|
140
143
|
};
|
|
141
144
|
});
|
|
142
145
|
}
|
|
143
|
-
function
|
|
146
|
+
function y({ receivable: e, history: t, mails: n, pdfUrl: r, messages: i }) {
|
|
144
147
|
if (!e) return;
|
|
145
148
|
let a = e.type === "invoice" ? e.amount_due : void 0, o = e.type === "quote" ? e.expiry_date : e.due_date;
|
|
146
149
|
return {
|
|
147
150
|
id: e.id,
|
|
148
151
|
type: e.type,
|
|
149
|
-
title:
|
|
152
|
+
title: m(e, i),
|
|
150
153
|
customerLabel: e.counterpart_name || i.unknownCustomer,
|
|
151
154
|
status: e.status,
|
|
152
|
-
statusTone:
|
|
153
|
-
totalLabel:
|
|
155
|
+
statusTone: g(e.status),
|
|
156
|
+
totalLabel: f({
|
|
154
157
|
amount: e.total_amount,
|
|
155
158
|
currency: e.currency,
|
|
156
159
|
fallback: i.notAvailable
|
|
157
160
|
}),
|
|
158
|
-
amountDueLabel:
|
|
161
|
+
amountDueLabel: f({
|
|
159
162
|
amount: a,
|
|
160
163
|
currency: e.currency,
|
|
161
164
|
fallback: i.notAvailable
|
|
@@ -164,11 +167,11 @@ function v({ receivable: e, history: t, mails: n, pdfUrl: r, messages: i }) {
|
|
|
164
167
|
summaryItems: [
|
|
165
168
|
{
|
|
166
169
|
label: i.summaryDocumentType,
|
|
167
|
-
value:
|
|
170
|
+
value: h(e.type, i)
|
|
168
171
|
},
|
|
169
172
|
{
|
|
170
173
|
label: i.summaryDocumentNumber,
|
|
171
|
-
value:
|
|
174
|
+
value: m(e, i)
|
|
172
175
|
},
|
|
173
176
|
{
|
|
174
177
|
label: i.summaryCustomer,
|
|
@@ -176,23 +179,23 @@ function v({ receivable: e, history: t, mails: n, pdfUrl: r, messages: i }) {
|
|
|
176
179
|
},
|
|
177
180
|
{
|
|
178
181
|
label: i.summaryIssued,
|
|
179
|
-
value:
|
|
182
|
+
value: u(e.issue_date, i.notAvailable)
|
|
180
183
|
},
|
|
181
184
|
{
|
|
182
185
|
label: i.summaryDue,
|
|
183
|
-
value:
|
|
186
|
+
value: u(o, i.notAvailable)
|
|
184
187
|
},
|
|
185
188
|
{
|
|
186
189
|
label: i.summaryCreated,
|
|
187
|
-
value:
|
|
190
|
+
value: u(e.created_at, i.notAvailable)
|
|
188
191
|
},
|
|
189
192
|
{
|
|
190
193
|
label: i.summaryUpdated,
|
|
191
|
-
value:
|
|
194
|
+
value: u(e.updated_at, i.notAvailable)
|
|
192
195
|
},
|
|
193
196
|
{
|
|
194
197
|
label: i.summaryTotal,
|
|
195
|
-
value:
|
|
198
|
+
value: f({
|
|
196
199
|
amount: e.total_amount,
|
|
197
200
|
currency: e.currency,
|
|
198
201
|
fallback: i.notAvailable
|
|
@@ -200,7 +203,7 @@ function v({ receivable: e, history: t, mails: n, pdfUrl: r, messages: i }) {
|
|
|
200
203
|
},
|
|
201
204
|
{
|
|
202
205
|
label: i.summaryAmountDue,
|
|
203
|
-
value:
|
|
206
|
+
value: f({
|
|
204
207
|
amount: a,
|
|
205
208
|
currency: e.currency,
|
|
206
209
|
fallback: i.notAvailable
|
|
@@ -211,12 +214,12 @@ function v({ receivable: e, history: t, mails: n, pdfUrl: r, messages: i }) {
|
|
|
211
214
|
id: t.product.id || String(n),
|
|
212
215
|
name: t.product.name,
|
|
213
216
|
quantityLabel: String(t.quantity),
|
|
214
|
-
unitPriceLabel:
|
|
217
|
+
unitPriceLabel: f({
|
|
215
218
|
amount: t.product.price?.value,
|
|
216
219
|
currency: t.product.price?.currency || e.currency,
|
|
217
220
|
fallback: i.notAvailable
|
|
218
221
|
}),
|
|
219
|
-
totalLabel:
|
|
222
|
+
totalLabel: f({
|
|
220
223
|
amount: t.total_after_tax ?? t.total_before_tax,
|
|
221
224
|
currency: e.currency,
|
|
222
225
|
fallback: i.notAvailable
|
|
@@ -224,23 +227,23 @@ function v({ receivable: e, history: t, mails: n, pdfUrl: r, messages: i }) {
|
|
|
224
227
|
})),
|
|
225
228
|
activityItems: t.map((e) => ({
|
|
226
229
|
id: e.id,
|
|
227
|
-
title:
|
|
230
|
+
title: b(e.event_type, i),
|
|
228
231
|
description: e.event_type,
|
|
229
|
-
timestampLabel:
|
|
232
|
+
timestampLabel: u(e.timestamp, i.notAvailable)
|
|
230
233
|
})),
|
|
231
234
|
mailItems: n.map((e) => ({
|
|
232
235
|
id: e.id,
|
|
233
236
|
statusLabel: e.status,
|
|
234
|
-
recipientsLabel:
|
|
235
|
-
sentAtLabel:
|
|
237
|
+
recipientsLabel: x(e, i),
|
|
238
|
+
sentAtLabel: u(e.created_at, i.notAvailable)
|
|
236
239
|
})),
|
|
237
|
-
actions:
|
|
240
|
+
actions: _(e)
|
|
238
241
|
};
|
|
239
242
|
}
|
|
240
|
-
function
|
|
243
|
+
function b(e, t) {
|
|
241
244
|
return e === "status_changed" ? t.activityStatusChanged : e === "receivable_created" ? t.activityReceivableCreated : e === "receivable_updated" ? t.activityReceivableUpdated : e === "payment_received" ? t.activityPaymentReceived : e === "mail_sent" ? t.activityMailSent : t.activityUnknown;
|
|
242
245
|
}
|
|
243
|
-
function
|
|
246
|
+
function x(e, t) {
|
|
244
247
|
let n = [
|
|
245
248
|
...e.recipients?.to ?? [],
|
|
246
249
|
...e.recipients?.cc ?? [],
|
|
@@ -248,7 +251,7 @@ function b(e, t) {
|
|
|
248
251
|
].map((e) => e.email).filter(Boolean);
|
|
249
252
|
return n.length > 0 ? n.join(", ") : t.recipientsNone;
|
|
250
253
|
}
|
|
251
|
-
function
|
|
254
|
+
function S({ values: e, billingAddressId: t, messages: n }) {
|
|
252
255
|
let r = {};
|
|
253
256
|
e.customerId ? t || (r.customerId = n.customerAddressRequired) : r.customerId = n.customerRequired, e.currency || (r.currency = n.currencyRequired);
|
|
254
257
|
for (let t of e.lineItems) {
|
|
@@ -260,10 +263,10 @@ function x({ values: e, billingAddressId: t, messages: n }) {
|
|
|
260
263
|
}
|
|
261
264
|
return r;
|
|
262
265
|
}
|
|
263
|
-
function
|
|
266
|
+
function C(e) {
|
|
264
267
|
return Object.keys(e).length > 0;
|
|
265
268
|
}
|
|
266
|
-
function
|
|
269
|
+
function w({ values: e, billingAddressId: t }) {
|
|
267
270
|
let n = e.lineItems.map((e) => ({
|
|
268
271
|
product_id: e.productId,
|
|
269
272
|
quantity: Number(e.quantity)
|
|
@@ -285,25 +288,25 @@ function C({ values: e, billingAddressId: t }) {
|
|
|
285
288
|
type: "invoice"
|
|
286
289
|
};
|
|
287
290
|
}
|
|
288
|
-
function
|
|
289
|
-
let t = e.type === "quote" ? "quote" : "invoice", n = e.type === "invoice" ? e.payment_terms?.id ?? "" : "",
|
|
290
|
-
id:
|
|
291
|
+
function T(e) {
|
|
292
|
+
let t = e.type === "quote" ? "quote" : "invoice", n = e.type === "invoice" ? e.payment_terms?.id ?? "" : "", r = e.line_items.map((e) => ({
|
|
293
|
+
id: i().id,
|
|
291
294
|
productId: e.product.id || "",
|
|
292
295
|
quantity: String(e.quantity)
|
|
293
296
|
})).filter((e) => e.productId);
|
|
294
297
|
return {
|
|
295
|
-
...
|
|
298
|
+
...a(),
|
|
296
299
|
type: t,
|
|
297
300
|
customerId: e.counterpart_id,
|
|
298
301
|
currency: e.currency,
|
|
299
|
-
issueDate:
|
|
300
|
-
dueDate:
|
|
302
|
+
issueDate: O(e.issue_date),
|
|
303
|
+
dueDate: O(e.type === "quote" ? e.expiry_date : e.due_date),
|
|
301
304
|
memo: e.memo ?? "",
|
|
302
305
|
paymentTermsId: n,
|
|
303
|
-
lineItems:
|
|
306
|
+
lineItems: r.length > 0 ? r : [i()]
|
|
304
307
|
};
|
|
305
308
|
}
|
|
306
|
-
function
|
|
309
|
+
function E({ values: e, billingAddressId: t }) {
|
|
307
310
|
let n = {
|
|
308
311
|
counterpart_billing_address_id: t,
|
|
309
312
|
counterpart_id: e.customerId,
|
|
@@ -322,57 +325,57 @@ function T({ values: e, billingAddressId: t }) {
|
|
|
322
325
|
payment_terms: !e.paymentTermsId && e.dueDate ? { term_final: { end_date: e.dueDate } } : void 0
|
|
323
326
|
} };
|
|
324
327
|
}
|
|
325
|
-
function
|
|
328
|
+
function D(e) {
|
|
326
329
|
return { data: e.lineItems.map((e) => ({
|
|
327
330
|
product_id: e.productId,
|
|
328
331
|
quantity: Number(e.quantity)
|
|
329
332
|
})) };
|
|
330
333
|
}
|
|
331
|
-
function
|
|
334
|
+
function O(e) {
|
|
332
335
|
return e?.slice(0, 10) ?? "";
|
|
333
336
|
}
|
|
334
|
-
function
|
|
337
|
+
function k(e) {
|
|
335
338
|
return (e ?? []).map((e) => ({
|
|
336
339
|
value: e.id,
|
|
337
340
|
label: e.name
|
|
338
341
|
}));
|
|
339
342
|
}
|
|
340
|
-
function
|
|
343
|
+
function A(e, t) {
|
|
341
344
|
let n = {};
|
|
342
345
|
return e.to.trim() || (n.to = t.sendToRequired), e.subject.trim() || (n.subject = t.sendSubjectRequired), e.body.trim() || (n.body = t.sendBodyRequired), n;
|
|
343
346
|
}
|
|
344
|
-
function
|
|
347
|
+
function j(e) {
|
|
345
348
|
return Object.keys(e).length > 0;
|
|
346
349
|
}
|
|
347
|
-
function
|
|
350
|
+
function M(e) {
|
|
348
351
|
return e.split(",").map((e) => e.trim()).filter(Boolean);
|
|
349
352
|
}
|
|
350
|
-
function
|
|
351
|
-
let
|
|
353
|
+
function N(e, t, n) {
|
|
354
|
+
let r = {};
|
|
352
355
|
if (e.mode === "partial") {
|
|
353
|
-
let
|
|
354
|
-
(!
|
|
356
|
+
let i = p(e.amountPaid, n);
|
|
357
|
+
(!i || i <= 0) && (r.amountPaid = t.paymentAmountInvalid);
|
|
355
358
|
}
|
|
356
|
-
return
|
|
359
|
+
return r;
|
|
357
360
|
}
|
|
358
|
-
function
|
|
361
|
+
function P(e) {
|
|
359
362
|
return Object.keys(e).length > 0;
|
|
360
363
|
}
|
|
361
|
-
function
|
|
364
|
+
function F(e, t) {
|
|
362
365
|
return {
|
|
363
|
-
...
|
|
366
|
+
...n,
|
|
364
367
|
to: e?.counterpart_contact?.email ?? "",
|
|
365
|
-
subject: e?.document_id ? `${
|
|
366
|
-
body:
|
|
368
|
+
subject: e?.document_id ? `${t.sendSubjectDefault} ${e.document_id}` : t.sendSubjectDefault,
|
|
369
|
+
body: t.sendBodyDefault
|
|
367
370
|
};
|
|
368
371
|
}
|
|
369
|
-
function
|
|
372
|
+
function I() {
|
|
370
373
|
return {
|
|
371
|
-
...
|
|
374
|
+
...r,
|
|
372
375
|
paidAt: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)
|
|
373
376
|
};
|
|
374
377
|
}
|
|
375
|
-
function
|
|
378
|
+
function L() {
|
|
376
379
|
return [
|
|
377
380
|
"draft",
|
|
378
381
|
"issued",
|
|
@@ -392,4 +395,4 @@ function I() {
|
|
|
392
395
|
}));
|
|
393
396
|
}
|
|
394
397
|
//#endregion
|
|
395
|
-
export {
|
|
398
|
+
export { r as EMPTY_RECEIVABLE_PAYMENT_VALUES, n as EMPTY_RECEIVABLE_SEND_VALUES, _ as buildReceivableActions, y as buildReceivableDetailsView, v as buildReceivableRows, c as coerceEnabledTabs, a as createEmptyReceivableFormValues, i as createLineItem, I as defaultPaymentValues, F as defaultSendValues, u as formatDate, f as formatMoney, p as fromMajorUnits, m as getDocumentTitle, h as getDocumentTypeLabel, k as getPaymentTermOptions, g as getStatusTone, P as hasPaymentErrors, C as hasReceivableFormErrors, j as hasSendErrors, w as receivableFormValuesToCreatePayload, D as receivableFormValuesToLineItemsPayload, E as receivableFormValuesToUpdatePayload, T as receivableToFormValues, l as resolveInitialTab, M as splitEmailList, L as statusFilterOptions, s as tabForType, o as typeForTab, N as validatePaymentValues, S as validateReceivableForm, A as validateSendValues };
|