@tesouro/embedded-components-react 0.5.53 → 0.5.55

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.
@@ -6,93 +6,96 @@ import { resolveLineItemAmountMinorUnits as a } from "./index40.js";
6
6
  import { resolveLineItemQuantity as o } from "./index41.js";
7
7
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js
8
8
  function s(e) {
9
+ return typeof e.total_amount == "number" ? e.total_amount - (e.discount ?? 0) : e.amount_due ?? void 0;
10
+ }
11
+ function c(e) {
9
12
  return typeof e == "string" ? e : "";
10
13
  }
11
- function c({ payable: c, lineItems: u, ledgerAccounts: d, labels: f, hasScheduledPayment: p, now: m, rejection: h, achInstructions: g, achInstructionsReadable: _ = !1 }) {
12
- let v = c.currency, y = (e) => i(e, v), b = t({
13
- apiStatus: c.status,
14
- dueDate: c.due_date,
15
- scheduledPaymentDate: c.scheduled_payment_date,
16
- hasScheduledPayment: p,
17
- now: m
18
- }), x = n(c), S = r(c), C = e(c.issued_at) || f.notProvided, w = e(c.due_date) || f.notProvided, T = [{
19
- label: f.vendorRow,
20
- value: S || f.notProvided,
21
- secondaryValue: x?.email ?? void 0
22
- }], E = _ ? g?.account_number : void 0;
23
- E && T.push({
24
- label: f.bankAccountRow,
25
- value: f.bankAccountValue(E.slice(-4))
14
+ function l({ payable: l, lineItems: d, ledgerAccounts: f, labels: p, hasScheduledPayment: m, now: h, rejection: g, achInstructions: _, achInstructionsReadable: v = !1 }) {
15
+ let y = l.currency, b = (e) => i(e, y), x = t({
16
+ apiStatus: l.status,
17
+ dueDate: l.due_date,
18
+ scheduledPaymentDate: l.scheduled_payment_date,
19
+ hasScheduledPayment: m,
20
+ now: h
21
+ }), S = n(l), C = r(l), w = e(l.issued_at) || p.notProvided, T = e(l.due_date) || p.notProvided, E = [{
22
+ label: p.vendorRow,
23
+ value: C || p.notProvided,
24
+ secondaryValue: S?.email ?? void 0
25
+ }], D = v ? _?.account_number : void 0;
26
+ D && E.push({
27
+ label: p.bankAccountRow,
28
+ value: p.bankAccountValue(D.slice(-4))
26
29
  });
27
- let D = [
30
+ let O = [
28
31
  {
29
- label: f.invoiceNumberRow,
30
- value: c.document_id || f.notProvided
32
+ label: p.invoiceNumberRow,
33
+ value: l.document_id || p.notProvided
31
34
  },
32
35
  {
33
- label: f.issueDateRow,
34
- value: C
36
+ label: p.issueDateRow,
37
+ value: w
35
38
  },
36
39
  {
37
- label: f.dueDateRow,
38
- value: w
40
+ label: p.dueDateRow,
41
+ value: T
39
42
  },
40
43
  {
41
- label: f.poNumberRow,
42
- value: s(c.purchase_order_number) || f.notProvided
44
+ label: p.poNumberRow,
45
+ value: c(l.purchase_order_number) || p.notProvided
43
46
  }
44
- ], O = new Map(d.map((e) => [e.id, [e.nominal_code, e.name].filter(Boolean).join(" — ")])), k = u.map((e) => {
45
- let t = y(e.unit_price), n = String(o(e));
47
+ ], k = new Map(f.map((e) => [e.id, [e.nominal_code, e.name].filter(Boolean).join(" — ")])), A = d.map((e) => {
48
+ let t = b(e.unit_price), n = String(o(e));
46
49
  return {
47
50
  id: e.id,
48
51
  description: e.name ?? e.description ?? "",
49
- glCodeLabel: (e.ledger_account_id ? O.get(e.ledger_account_id) : void 0) || f.glCodeMissing,
50
- quantityLabel: t ? f.quantityValue(n, t) : f.quantityOnlyValue(n),
51
- amountLabel: y(a(e)) ?? ""
52
+ glCodeLabel: (e.ledger_account_id ? k.get(e.ledger_account_id) : void 0) || p.glCodeMissing,
53
+ quantityLabel: t ? p.quantityValue(n, t) : p.quantityOnlyValue(n),
54
+ amountLabel: b(a(e)) ?? ""
52
55
  };
53
- }), A = [
56
+ }), j = [
54
57
  {
55
- label: f.subtotalRow,
56
- value: c.subtotal
58
+ label: p.subtotalRow,
59
+ value: l.subtotal
57
60
  },
58
61
  {
59
- label: f.discountsRow,
60
- value: c.discount
62
+ label: p.discountsRow,
63
+ value: l.discount
61
64
  },
62
65
  {
63
- label: f.taxRow,
64
- value: c.tax_amount
66
+ label: p.taxRow,
67
+ value: l.tax_amount
65
68
  }
66
69
  ].map(({ label: e, value: t }) => ({
67
70
  label: e,
68
- value: y(t)
69
- })).filter((e) => !!e.value), j = y(c.total_amount);
70
- j && A.push({
71
- label: f.totalRow,
72
- value: j,
71
+ value: b(t)
72
+ })).filter((e) => !!e.value), M = b(s(l));
73
+ M && j.push({
74
+ label: p.totalRow,
75
+ value: M,
73
76
  emphasis: !0
74
77
  });
75
- let M = l(c);
78
+ let N = u(l);
76
79
  return {
77
- title: S,
78
- subtitle: f.subtitle,
79
- status: b.status,
80
- statusTone: b.tone,
81
- amountDueLabel: y(c.amount_due) ?? y(c.total_amount) ?? "",
82
- amountPaidLabel: M ? y(c.amount_paid) : void 0,
83
- paidOnLabel: M ? f.paidOnLabel(M) : void 0,
84
- invoiceDateLabel: C,
85
- dueDateLabel: w,
86
- dueDateTone: b.isOverdue ? "danger" : "default",
87
- payToItems: T,
88
- invoiceItems: D,
89
- lineItems: k,
90
- totals: A,
91
- rejection: h
80
+ title: C,
81
+ subtitle: p.subtitle,
82
+ status: x.status,
83
+ statusTone: x.tone,
84
+ amountDueLabel: b(l.amount_due) ?? b(l.total_amount) ?? "",
85
+ amountPaidLabel: N ? b(l.amount_paid) : void 0,
86
+ paidOnLabel: N ? p.paidOnLabel(N) : void 0,
87
+ invoiceDateLabel: w,
88
+ dueDateLabel: T,
89
+ dueDateTone: x.isOverdue ? "danger" : "default",
90
+ payToItems: E,
91
+ invoiceItems: O,
92
+ lineItems: A,
93
+ totals: j,
94
+ rejection: g
92
95
  };
93
96
  }
94
- function l(t) {
97
+ function u(t) {
95
98
  return t.status === "paid" && t.paid_at ? e(t.paid_at.slice(0, 10)) : void 0;
96
99
  }
97
100
  //#endregion
98
- export { l as getPaidAtLabel, c as mapPayableToBillDetails };
101
+ export { u as getPaidAtLabel, l as mapPayableToBillDetails, s as resolveInvoiceTotalMinorUnits };
@@ -5,82 +5,82 @@ import { resolveAmountDueMinorUnits as r } from "./index21.js";
5
5
  import { formatBillMoney as i } from "./index2.js";
6
6
  import { resolveLineItemAmountMinorUnits as a } from "./index40.js";
7
7
  import { resolveLineItemQuantity as o } from "./index41.js";
8
- import { getPaidAtLabel as s } from "./index42.js";
8
+ import { getPaidAtLabel as s, resolveInvoiceTotalMinorUnits as c } from "./index42.js";
9
9
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js
10
- function c({ payable: c, lineItems: l, glCodeOptions: u, glCodeRosterAvailable: d = !0, history: f, paymentHistory: p, approvalPolicy: m, labels: h, hasScheduledPayment: g, rejection: _, payableAchInstructions: v, payableAchInstructionsReadable: y = !1 }) {
11
- let b = c.currency, x = t({
12
- apiStatus: c.status,
13
- dueDate: c.due_date,
14
- scheduledPaymentDate: c.scheduled_payment_date,
15
- hasScheduledPayment: g
16
- }), S = n(c), C = y ? v : void 0, w = C?.account_number, T = !!(C?.account_holder_name && C.routing_number && C.account_number), E = e(c.issued_at) || h.notProvided, D = e(c.due_date) || h.notProvided, O = new Map(u.map((e) => [e.value, e.label])), k = [
10
+ function l({ payable: l, lineItems: u, glCodeOptions: d, glCodeRosterAvailable: f = !0, history: p, paymentHistory: m, approvalPolicy: h, labels: g, hasScheduledPayment: _, rejection: v, payableAchInstructions: y, payableAchInstructionsReadable: b = !1 }) {
11
+ let x = l.currency, S = t({
12
+ apiStatus: l.status,
13
+ dueDate: l.due_date,
14
+ scheduledPaymentDate: l.scheduled_payment_date,
15
+ hasScheduledPayment: _
16
+ }), C = n(l), w = b ? y : void 0, T = w?.account_number, E = !!(w?.account_holder_name && w.routing_number && w.account_number), D = e(l.issued_at) || g.notProvided, O = e(l.due_date) || g.notProvided, k = new Map(d.map((e) => [e.value, e.label])), A = [
17
17
  {
18
- label: h.subtotalRow,
19
- minorUnits: c.subtotal
18
+ label: g.subtotalRow,
19
+ minorUnits: l.subtotal
20
20
  },
21
21
  {
22
- label: h.discountRow,
23
- minorUnits: c.discount
22
+ label: g.discountRow,
23
+ minorUnits: l.discount
24
24
  },
25
25
  {
26
- label: h.taxRow,
27
- minorUnits: c.tax_amount
26
+ label: g.taxRow,
27
+ minorUnits: l.tax_amount
28
28
  }
29
29
  ].map((e) => ({
30
30
  label: e.label,
31
- value: i(e.minorUnits, b)
32
- })).filter((e) => !!e.value), A = i(c.total_amount, b);
33
- A && k.push({
34
- label: h.totalRow,
35
- value: A,
31
+ value: i(e.minorUnits, x)
32
+ })).filter((e) => !!e.value), j = i(c(l), x);
33
+ j && A.push({
34
+ label: g.totalRow,
35
+ value: j,
36
36
  emphasis: !0
37
37
  });
38
- let j = s(c);
38
+ let M = s(l);
39
39
  return {
40
- amountDue: i(r(c), b) ?? "",
41
- amountPaid: j ? i(c.amount_paid, b) : void 0,
42
- paidOnLabel: j ? h.paidOnLabel(j) : void 0,
43
- invoiceDateLabel: E,
44
- dueDateLabel: D,
45
- dueDateTone: x.isOverdue ? "danger" : "default",
46
- status: x.status,
47
- statusTone: x.tone,
40
+ amountDue: i(r(l), x) ?? "",
41
+ amountPaid: M ? i(l.amount_paid, x) : void 0,
42
+ paidOnLabel: M ? g.paidOnLabel(M) : void 0,
43
+ invoiceDateLabel: D,
44
+ dueDateLabel: O,
45
+ dueDateTone: S.isOverdue ? "danger" : "default",
46
+ status: S.status,
47
+ statusTone: S.tone,
48
48
  payTo: {
49
- name: S?.name || h.notProvided,
50
- email: S?.email ?? "",
51
- methodLabel: T ? h.paymentInstructionsValue(w?.slice(-4) ?? "") : h.paymentInstructionsNotSet,
52
- hasPaymentInstructions: T
49
+ name: C?.name || g.notProvided,
50
+ email: C?.email ?? "",
51
+ methodLabel: E ? g.paymentInstructionsValue(T?.slice(-4) ?? "") : g.paymentInstructionsNotSet,
52
+ hasPaymentInstructions: E
53
53
  },
54
54
  invoiceFields: [
55
55
  {
56
- label: h.invoiceDateRow,
57
- value: E
56
+ label: g.invoiceDateRow,
57
+ value: D
58
58
  },
59
59
  {
60
- label: h.dueDateRow,
61
- value: D
60
+ label: g.dueDateRow,
61
+ value: O
62
62
  },
63
63
  {
64
- label: h.invoiceNumberRow,
65
- value: c.document_id || h.notProvided
64
+ label: g.invoiceNumberRow,
65
+ value: l.document_id || g.notProvided
66
66
  }
67
67
  ],
68
- lineItems: l.map((e) => {
69
- let t = i(e.unit_price, b), n = String(o(e));
68
+ lineItems: u.map((e) => {
69
+ let t = i(e.unit_price, x), n = String(o(e));
70
70
  return {
71
71
  id: e.id,
72
72
  description: e.name ?? e.description ?? "",
73
- glCodeLabel: e.ledger_account_id ? O.get(e.ledger_account_id) ?? (d ? h.glCodeMissing : h.glCodeUnavailable) : h.glCodeMissing,
74
- qtyPriceLabel: t ? h.qtyPriceValue(n, t) : h.qtyOnlyValue(n),
75
- amount: i(a(e), b) ?? ""
73
+ glCodeLabel: e.ledger_account_id ? k.get(e.ledger_account_id) ?? (f ? g.glCodeMissing : g.glCodeUnavailable) : g.glCodeMissing,
74
+ qtyPriceLabel: t ? g.qtyPriceValue(n, t) : g.qtyOnlyValue(n),
75
+ amount: i(a(e), x) ?? ""
76
76
  };
77
77
  }),
78
- amountRows: k,
79
- approvalPolicy: m,
80
- paymentHistory: p,
81
- history: f,
82
- rejection: _
78
+ amountRows: A,
79
+ approvalPolicy: h,
80
+ paymentHistory: m,
81
+ history: p,
82
+ rejection: v
83
83
  };
84
84
  }
85
85
  //#endregion
86
- export { c as buildBillDetailView };
86
+ export { l as buildBillDetailView };