@tesouro/embedded-components-react 0.5.251 → 0.5.254
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 +95 -79
- package/dist/lib/ReceivablesWidget.d.ts +25 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index24.js +4 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js +214 -209
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js +162 -145
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index14.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index15.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index31.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index33.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index34.js +3 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index37.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index48.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index49.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index5.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index17.js +32 -23
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index18.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index2.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index20.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index3.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidgetNative/BillPayWidgetNative.js +48 -48
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidgetNative/BillsTab.js +32 -24
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidgetNative/labels.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/ui/dist/index5.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/ui/dist/index6.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +19 -21
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index10.js +38 -51
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index12.js +12 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +11 -39
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index14.js +18 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index15.js +2 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +9 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index17.js +78 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index19.js +2 -78
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index20.js +29 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +4 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +26 -25
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index23.js +2 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +5 -28
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +34 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +2 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index6.js +16 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index7.js +54 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index8.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index9.js +2 -16
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js +16 -17
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +15 -11
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js +89 -88
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +55 -74
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +8 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentRecord.js +71 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +123 -164
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +40 -37
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablePaymentRecord.js +91 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js +83 -78
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +7 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/mocks/receivables.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +15 -8
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +206 -89
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +38 -38
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/packages/shared-ui-shadcn/dist/index.js +8 -7
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +0 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +0 -34
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +0 -2
|
@@ -13,13 +13,8 @@ var S = {
|
|
|
13
13
|
bcc: "",
|
|
14
14
|
subject: "",
|
|
15
15
|
body: ""
|
|
16
|
-
}, C = {
|
|
17
|
-
mode: "full",
|
|
18
|
-
amountPaid: "",
|
|
19
|
-
paidAt: "",
|
|
20
|
-
comment: ""
|
|
21
16
|
};
|
|
22
|
-
function
|
|
17
|
+
function C() {
|
|
23
18
|
return {
|
|
24
19
|
type: "invoice",
|
|
25
20
|
customerId: "",
|
|
@@ -43,13 +38,13 @@ function w() {
|
|
|
43
38
|
...p()
|
|
44
39
|
};
|
|
45
40
|
}
|
|
46
|
-
function
|
|
41
|
+
function w(e) {
|
|
47
42
|
return e === "quotes" ? "quote" : e === "credit_notes" ? "credit_note" : "invoice";
|
|
48
43
|
}
|
|
49
|
-
function
|
|
44
|
+
function T(e) {
|
|
50
45
|
return e === "quote" ? "quotes" : e === "credit_note" ? "credit_notes" : "invoices";
|
|
51
46
|
}
|
|
52
|
-
function
|
|
47
|
+
function E(e) {
|
|
53
48
|
return (e?.length ? e : [
|
|
54
49
|
"invoices",
|
|
55
50
|
"quotes",
|
|
@@ -60,10 +55,10 @@ function D(e) {
|
|
|
60
55
|
"credit_notes"
|
|
61
56
|
].includes(e) && n.indexOf(e) === t);
|
|
62
57
|
}
|
|
63
|
-
function
|
|
58
|
+
function D({ defaultTab: e, enabledTabs: t }) {
|
|
64
59
|
return e && t.includes(e) ? e : t[0] ?? "invoices";
|
|
65
60
|
}
|
|
66
|
-
function
|
|
61
|
+
function O(e, n) {
|
|
67
62
|
let r = t(e);
|
|
68
63
|
return r ? new Intl.DateTimeFormat(void 0, {
|
|
69
64
|
day: "numeric",
|
|
@@ -71,28 +66,28 @@ function k(e, n) {
|
|
|
71
66
|
year: "numeric"
|
|
72
67
|
}).format(r) : n;
|
|
73
68
|
}
|
|
74
|
-
function
|
|
69
|
+
function k({ amount: t, currency: n, fallback: r }) {
|
|
75
70
|
return t == null || !n ? r : new Intl.NumberFormat(void 0, {
|
|
76
71
|
currency: n,
|
|
77
72
|
style: "currency"
|
|
78
73
|
}).format(t / 10 ** e(n));
|
|
79
74
|
}
|
|
80
|
-
function
|
|
75
|
+
function A(t, n) {
|
|
81
76
|
let r = Number(t);
|
|
82
77
|
if (!Number.isFinite(r)) return;
|
|
83
78
|
let i = n ? e(n) : 2;
|
|
84
79
|
return Math.round(r * 10 ** i);
|
|
85
80
|
}
|
|
86
|
-
function
|
|
81
|
+
function j(e, t) {
|
|
87
82
|
return e.document_id || t.untitledDocument;
|
|
88
83
|
}
|
|
89
|
-
function
|
|
84
|
+
function M(e, t) {
|
|
90
85
|
return e === "quote" ? t.quoteType : e === "credit_note" ? t.creditNoteType : t.invoiceType;
|
|
91
86
|
}
|
|
92
|
-
function
|
|
87
|
+
function N(e) {
|
|
93
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";
|
|
94
89
|
}
|
|
95
|
-
function
|
|
90
|
+
function P(e) {
|
|
96
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 && [
|
|
97
92
|
"issued",
|
|
98
93
|
"overdue",
|
|
@@ -122,7 +117,7 @@ function F(e) {
|
|
|
122
117
|
].includes(e.status) && !a
|
|
123
118
|
};
|
|
124
119
|
}
|
|
125
|
-
function
|
|
120
|
+
function F(e, t, n) {
|
|
126
121
|
let r = e.counterpart_name || (e.counterpart_id ? t.names.get(e.counterpart_id) : void 0);
|
|
127
122
|
return r ? {
|
|
128
123
|
customerLabel: r,
|
|
@@ -135,43 +130,46 @@ function I(e, t, n) {
|
|
|
135
130
|
customerState: "missing"
|
|
136
131
|
};
|
|
137
132
|
}
|
|
138
|
-
var
|
|
133
|
+
var I = {
|
|
139
134
|
names: /* @__PURE__ */ new Map(),
|
|
140
135
|
isResolving: !1
|
|
141
136
|
};
|
|
142
|
-
function
|
|
137
|
+
function L({ receivables: e, messages: t, canRecordPayment: n, customerNames: r = I }) {
|
|
143
138
|
return e.map((e) => {
|
|
144
|
-
let
|
|
139
|
+
let i = e.type === "invoice" ? e.amount_due : void 0;
|
|
145
140
|
return {
|
|
146
141
|
id: e.id,
|
|
147
142
|
type: e.type,
|
|
148
|
-
documentLabel:
|
|
149
|
-
...
|
|
143
|
+
documentLabel: j(e, t),
|
|
144
|
+
...F(e, r, t),
|
|
150
145
|
status: e.status,
|
|
151
|
-
statusTone:
|
|
152
|
-
issueDateLabel:
|
|
153
|
-
dueDateLabel:
|
|
154
|
-
totalLabel:
|
|
146
|
+
statusTone: N(e.status),
|
|
147
|
+
issueDateLabel: O(e.issue_date, t.notAvailable),
|
|
148
|
+
dueDateLabel: O(e.type === "quote" ? e.expiry_date : e.due_date, t.notAvailable),
|
|
149
|
+
totalLabel: k({
|
|
155
150
|
amount: e.total_amount,
|
|
156
151
|
currency: e.currency,
|
|
157
152
|
fallback: t.notAvailable
|
|
158
153
|
}),
|
|
159
|
-
amountDueLabel:
|
|
160
|
-
amount:
|
|
154
|
+
amountDueLabel: k({
|
|
155
|
+
amount: i,
|
|
161
156
|
currency: e.currency,
|
|
162
157
|
fallback: t.notAvailable
|
|
163
158
|
}),
|
|
164
|
-
actions:
|
|
159
|
+
actions: {
|
|
160
|
+
...P(e),
|
|
161
|
+
...n ? {} : { recordPayment: !1 }
|
|
162
|
+
}
|
|
165
163
|
};
|
|
166
164
|
});
|
|
167
165
|
}
|
|
168
|
-
function
|
|
166
|
+
function R(e) {
|
|
169
167
|
if (e.memo || e.footer) return {
|
|
170
168
|
opening: e.memo || void 0,
|
|
171
169
|
closing: e.footer || void 0
|
|
172
170
|
};
|
|
173
171
|
}
|
|
174
|
-
function
|
|
172
|
+
function z({ values: e, counterpart: t, addresses: n }) {
|
|
175
173
|
let r = n?.length && t?.id === e.customerId ? t : void 0, i = e.billingAddressId || r?.default_billing_address_id || (n?.length === 1 ? n[0].id : ""), a = e.shippingAddressId || r?.default_shipping_address_id || "";
|
|
176
174
|
return {
|
|
177
175
|
billingAddressId: i,
|
|
@@ -179,7 +177,7 @@ function B({ values: e, counterpart: t, addresses: n }) {
|
|
|
179
177
|
shippingAddressId: a
|
|
180
178
|
};
|
|
181
179
|
}
|
|
182
|
-
function
|
|
180
|
+
function B({ values: e, billingAddressId: t, messages: n, willIssue: r = !1, hasStartedRecurrence: i = !1 }) {
|
|
183
181
|
let a = {};
|
|
184
182
|
e.customerId ? t || (a.customerId = n.customerAddressRequired) : a.customerId = n.customerRequired, e.currency || (a.currency = n.currencyRequired), r && !e.paymentTermsId && (a.paymentTermsId = n.paymentTermsRequired), r && !e.bankAccountId && (a.bankAccountId = n.bankAccountRequired);
|
|
185
183
|
let o = u(e.lineItems, {
|
|
@@ -191,24 +189,24 @@ function V({ values: e, billingAddressId: t, messages: n, willIssue: r = !1, has
|
|
|
191
189
|
let l = b(e, n);
|
|
192
190
|
return l && (a.discount = l), a;
|
|
193
191
|
}
|
|
194
|
-
function
|
|
192
|
+
function V(e) {
|
|
195
193
|
return Object.keys(e).length > 0;
|
|
196
194
|
}
|
|
197
|
-
function
|
|
198
|
-
return !
|
|
199
|
-
values:
|
|
195
|
+
function H(e, t) {
|
|
196
|
+
return !V(B({
|
|
197
|
+
values: G(e),
|
|
200
198
|
billingAddressId: e.type === "invoice" ? e.counterpart_billing_address?.id ?? void 0 : void 0,
|
|
201
199
|
messages: t,
|
|
202
200
|
willIssue: !0
|
|
203
201
|
}));
|
|
204
202
|
}
|
|
205
|
-
function
|
|
203
|
+
function U({ bankAccountId: e, bankAccountType: t }) {
|
|
206
204
|
return {
|
|
207
205
|
bank_account_id: e || void 0,
|
|
208
206
|
bank_account_type: e && t || void 0
|
|
209
207
|
};
|
|
210
208
|
}
|
|
211
|
-
function
|
|
209
|
+
function W({ values: e, billingAddressId: t, shippingAddressId: n, unitNamesById: i }) {
|
|
212
210
|
let o = e.lineItems.filter((e) => !r(e)).map((t) => a({
|
|
213
211
|
lineItem: t,
|
|
214
212
|
currency: e.currency,
|
|
@@ -223,7 +221,7 @@ function G({ values: e, billingAddressId: t, shippingAddressId: n, unitNamesById
|
|
|
223
221
|
memo: e.openingNote,
|
|
224
222
|
footer: e.closingNote,
|
|
225
223
|
discount: v(e) ?? void 0,
|
|
226
|
-
...
|
|
224
|
+
...U(e)
|
|
227
225
|
};
|
|
228
226
|
return e.type === "quote" ? {
|
|
229
227
|
...s,
|
|
@@ -238,19 +236,19 @@ function G({ values: e, billingAddressId: t, shippingAddressId: n, unitNamesById
|
|
|
238
236
|
type: "invoice"
|
|
239
237
|
};
|
|
240
238
|
}
|
|
241
|
-
function
|
|
239
|
+
function G(e, t) {
|
|
242
240
|
let r = e.type === "quote" ? "quote" : "invoice", i = l(e.line_items), a = e.type === "invoice" ? e : void 0, o = e.line_items.map((n) => s({
|
|
243
241
|
lineItem: n,
|
|
244
242
|
currency: e.currency,
|
|
245
243
|
units: t
|
|
246
244
|
}));
|
|
247
245
|
return {
|
|
248
|
-
...
|
|
246
|
+
...C(),
|
|
249
247
|
type: r,
|
|
250
248
|
customerId: e.counterpart_id,
|
|
251
249
|
currency: e.currency,
|
|
252
|
-
issueDate:
|
|
253
|
-
dueDate: e.type === "quote" ?
|
|
250
|
+
issueDate: X(e.issue_date),
|
|
251
|
+
dueDate: e.type === "quote" ? X(e.expiry_date) : "",
|
|
254
252
|
openingNote: e.memo ?? "",
|
|
255
253
|
closingNote: e.footer ?? "",
|
|
256
254
|
...e.type === "invoice" ? g(e.payment_terms) : {},
|
|
@@ -259,7 +257,7 @@ function K(e, t) {
|
|
|
259
257
|
...y(e.discount, e.currency),
|
|
260
258
|
lineItems: o.length > 0 ? o : [n(e.currency)],
|
|
261
259
|
bankAccountId: e.bank_account_id ?? "",
|
|
262
|
-
bankAccountType:
|
|
260
|
+
bankAccountType: K(e.bank_account_type),
|
|
263
261
|
billingAddressId: e.counterpart_billing_address?.id ?? "",
|
|
264
262
|
shippingAddressId: e.counterpart_shipping_address?.id ?? "",
|
|
265
263
|
paymentReminderId: a?.payment_reminder_id ?? "",
|
|
@@ -267,10 +265,10 @@ function K(e, t) {
|
|
|
267
265
|
attachments: f(e)
|
|
268
266
|
};
|
|
269
267
|
}
|
|
270
|
-
function
|
|
268
|
+
function K(e) {
|
|
271
269
|
return e === "BANK_DETAILS" || e === "INTERNAL" || e === "EXTERNAL" ? e : "";
|
|
272
270
|
}
|
|
273
|
-
function
|
|
271
|
+
function q({ values: e, billingAddressId: t, shippingAddressId: n, lineItemChanges: r }) {
|
|
274
272
|
let i = {
|
|
275
273
|
counterpart_billing_address_id: t,
|
|
276
274
|
counterpart_shipping_address_id: n || null,
|
|
@@ -280,7 +278,7 @@ function J({ values: e, billingAddressId: t, shippingAddressId: n, lineItemChang
|
|
|
280
278
|
memo: e.openingNote,
|
|
281
279
|
footer: e.closingNote,
|
|
282
280
|
discount: v(e),
|
|
283
|
-
...
|
|
281
|
+
...U(e)
|
|
284
282
|
};
|
|
285
283
|
return e.type === "quote" ? { quote: {
|
|
286
284
|
...i,
|
|
@@ -296,7 +294,7 @@ function J({ values: e, billingAddressId: t, shippingAddressId: n, lineItemChang
|
|
|
296
294
|
attachments: d(e.attachments) ?? null
|
|
297
295
|
} };
|
|
298
296
|
}
|
|
299
|
-
function
|
|
297
|
+
function J({ values: e, originalLineItems: t, originalCurrency: n, unitNamesById: a, units: c }) {
|
|
300
298
|
let u = l(t), d = i(e.taxRate, u), f = (e, t, n) => o({
|
|
301
299
|
lineItem: e,
|
|
302
300
|
currency: t,
|
|
@@ -322,7 +320,7 @@ function Y({ values: e, originalLineItems: t, originalCurrency: n, unitNamesById
|
|
|
322
320
|
...v.length ? { remove: v } : {}
|
|
323
321
|
};
|
|
324
322
|
}
|
|
325
|
-
function
|
|
323
|
+
function Y({ values: e, originalLineItems: t, changes: n }) {
|
|
326
324
|
let i = e.lineItems.filter((e) => !r(e)).map((e) => e.id);
|
|
327
325
|
if (!t) return { created: i };
|
|
328
326
|
let a = new Set(t.map((e) => e.id));
|
|
@@ -331,31 +329,20 @@ function X({ values: e, originalLineItems: t, changes: n }) {
|
|
|
331
329
|
replaced: n?.replace?.map((e) => e.id) ?? []
|
|
332
330
|
};
|
|
333
331
|
}
|
|
334
|
-
function
|
|
332
|
+
function X(e) {
|
|
335
333
|
return e?.slice(0, 10) ?? "";
|
|
336
334
|
}
|
|
337
|
-
function
|
|
335
|
+
function Z(e, t) {
|
|
338
336
|
let n = {};
|
|
339
337
|
return e.to.trim() || (n.to = t.sendToRequired), e.subject.trim() || (n.subject = t.sendSubjectRequired), e.body.trim() || (n.body = t.sendBodyRequired), n;
|
|
340
338
|
}
|
|
341
|
-
function
|
|
339
|
+
function Q(e) {
|
|
342
340
|
return Object.keys(e).length > 0;
|
|
343
341
|
}
|
|
344
|
-
function
|
|
342
|
+
function $(e) {
|
|
345
343
|
return e.split(",").map((e) => e.trim()).filter(Boolean);
|
|
346
344
|
}
|
|
347
|
-
function
|
|
348
|
-
let r = {};
|
|
349
|
-
if (e.mode === "partial") {
|
|
350
|
-
let i = j(e.amountPaid, n);
|
|
351
|
-
(!i || i <= 0) && (r.amountPaid = t.paymentAmountInvalid);
|
|
352
|
-
}
|
|
353
|
-
return r;
|
|
354
|
-
}
|
|
355
|
-
function ne(e) {
|
|
356
|
-
return Object.keys(e).length > 0;
|
|
357
|
-
}
|
|
358
|
-
function re(e, t) {
|
|
345
|
+
function ee(e, t) {
|
|
359
346
|
return {
|
|
360
347
|
...S,
|
|
361
348
|
to: e?.counterpart_contact?.email ?? "",
|
|
@@ -363,13 +350,7 @@ function re(e, t) {
|
|
|
363
350
|
body: t.sendBodyDefault
|
|
364
351
|
};
|
|
365
352
|
}
|
|
366
|
-
function
|
|
367
|
-
return {
|
|
368
|
-
...C,
|
|
369
|
-
paidAt: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
function ae(e = "all") {
|
|
353
|
+
function te(e = "all") {
|
|
373
354
|
let t = [
|
|
374
355
|
"draft",
|
|
375
356
|
"issued",
|
|
@@ -390,4 +371,4 @@ function ae(e = "all") {
|
|
|
390
371
|
}));
|
|
391
372
|
}
|
|
392
373
|
//#endregion
|
|
393
|
-
export {
|
|
374
|
+
export { S as EMPTY_RECEIVABLE_SEND_VALUES, P as buildReceivableActions, R as buildReceivableNotesView, L as buildReceivableRows, E as coerceEnabledTabs, C as createEmptyReceivableFormValues, n as createLineItem, ee as defaultSendValues, O as formatDate, k as formatMoney, A as fromMajorUnits, j as getDocumentTitle, M as getDocumentTypeLabel, N as getStatusTone, V as hasReceivableFormErrors, Q as hasSendErrors, H as isReceivableReadyToIssue, W as receivableFormValuesToCreatePayload, J as receivableFormValuesToLineItemChanges, q as receivableFormValuesToUpdatePayload, G as receivableToFormValues, z as resolveCounterpartAddresses, D as resolveInitialTab, $ as splitEmailList, te as statusFilterOptions, Y as submittedLineItemRows, T as tabForType, w as typeForTab, B as validateReceivableForm, Z as validateSendValues };
|
|
@@ -12,7 +12,14 @@ var e = {
|
|
|
12
12
|
sendToRequired: "Enter at least one recipient",
|
|
13
13
|
sendSubjectRequired: "Subject is required",
|
|
14
14
|
sendBodyRequired: "Message is required",
|
|
15
|
-
|
|
15
|
+
paymentRecordAmountRequired: "Amount is required",
|
|
16
|
+
paymentRecordAmountNegative: "Can't be a negative number",
|
|
17
|
+
paymentRecordAmountZero: "Amount must be greater than 0",
|
|
18
|
+
paymentRecordDateRequired: "Date is required",
|
|
19
|
+
paymentRecordTimeRequired: "Time is required",
|
|
20
|
+
paymentRecordFrom: "from {name}",
|
|
21
|
+
paymentRecordCreated: "Payment record was created",
|
|
22
|
+
paymentRecordCreateFailed: "Failed to create payment record: {errorMessage}",
|
|
16
23
|
genericError: "Something went wrong. Please try again.",
|
|
17
24
|
lineItemsLoading: "Please wait for invoice details to finish loading.",
|
|
18
25
|
paymentTermsCustomDatePlaceholder: "Mon DD, YYYY",
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { minorExponentForCurrency as e } from "../../../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
|
|
2
|
+
import { hasAnyScope as t } from "../../../../../shared/data-access/dist/lib/hasAnyScope.js";
|
|
3
|
+
import { Scope as n } from "../../../../../shared/data-access/dist/lib/scopes.js";
|
|
4
|
+
import "../../../../../shared/data-access/dist/index.js";
|
|
5
|
+
import { formatMoney as r, fromMajorUnits as i } from "./helpers.js";
|
|
6
|
+
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentRecord.js
|
|
7
|
+
var a = "—";
|
|
8
|
+
function o(e = /* @__PURE__ */ new Date()) {
|
|
9
|
+
let t = (e) => String(e).padStart(2, "0");
|
|
10
|
+
return {
|
|
11
|
+
amount: "0",
|
|
12
|
+
paymentDate: new Date(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate()),
|
|
13
|
+
paymentTime: `${t(e.getUTCHours())}:${t(e.getUTCMinutes())}`
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function s(t) {
|
|
17
|
+
return String(t.amount_due / 10 ** e(t.currency));
|
|
18
|
+
}
|
|
19
|
+
function c(e) {
|
|
20
|
+
return t(new Set(e ?? []), [n.PaymentRecordWriteOrg]);
|
|
21
|
+
}
|
|
22
|
+
function l(e, t, n) {
|
|
23
|
+
let r = {}, a = Number(e.amount);
|
|
24
|
+
return e.amount.trim() === "" || !Number.isFinite(a) ? r.amount = t.paymentRecordAmountRequired : a < 0 ? r.amount = t.paymentRecordAmountNegative : (i(e.amount, n) ?? 0) <= 0 && (r.amount = t.paymentRecordAmountZero), e.paymentDate || (r.paymentDate = t.paymentRecordDateRequired), e.paymentTime || (r.paymentTime = t.paymentRecordTimeRequired), r;
|
|
25
|
+
}
|
|
26
|
+
function u(e) {
|
|
27
|
+
return Object.keys(e).length > 0;
|
|
28
|
+
}
|
|
29
|
+
function d(e) {
|
|
30
|
+
let t = e.paymentDate ?? /* @__PURE__ */ new Date(), [n = 0, r = 0] = e.paymentTime.split(":").map(Number);
|
|
31
|
+
return new Date(Date.UTC(t.getFullYear(), t.getMonth(), t.getDate(), n, r));
|
|
32
|
+
}
|
|
33
|
+
function f({ invoice: e, values: t, entityUserId: n }) {
|
|
34
|
+
return {
|
|
35
|
+
amount: i(t.amount, e.currency) ?? 0,
|
|
36
|
+
currency: e.currency,
|
|
37
|
+
paid_at: d(t).toISOString(),
|
|
38
|
+
object: {
|
|
39
|
+
id: e.id,
|
|
40
|
+
type: "receivable"
|
|
41
|
+
},
|
|
42
|
+
payment_intent_id: e.id,
|
|
43
|
+
entity_user_id: n,
|
|
44
|
+
status: "succeeded"
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function p({ invoice: e, values: t, user: n, isUserLoading: o, messages: s }) {
|
|
48
|
+
let c = `${n?.first_name ?? ""} ${n?.last_name ?? ""}`.trim();
|
|
49
|
+
return {
|
|
50
|
+
amountLabel: r({
|
|
51
|
+
amount: i(t.amount, e.currency) ?? 0,
|
|
52
|
+
currency: e.currency,
|
|
53
|
+
fallback: a
|
|
54
|
+
}),
|
|
55
|
+
fromLabel: s.paymentRecordFrom.replace("{name}", e.counterpart_name ?? ""),
|
|
56
|
+
receivedLabel: t.paymentDate ? new Intl.DateTimeFormat(void 0, {
|
|
57
|
+
year: "numeric",
|
|
58
|
+
month: "short",
|
|
59
|
+
day: "2-digit",
|
|
60
|
+
hour: "2-digit",
|
|
61
|
+
minute: "2-digit",
|
|
62
|
+
timeZone: "UTC",
|
|
63
|
+
timeZoneName: "short"
|
|
64
|
+
}).format(d(t)) : a,
|
|
65
|
+
referenceLabel: e.id || a,
|
|
66
|
+
createdByLabel: c || a,
|
|
67
|
+
isCreatedByLoading: o
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { s as amountDueInputValue, f as buildPaymentRecordPayload, p as buildPaymentReviewView, c as canRecordPayments, o as defaultPaymentRecordValues, u as hasPaymentRecordErrors, d as paymentRecordPaidAt, l as validatePaymentRecordValues };
|