@tesouro/embedded-components-react 0.5.3 → 0.5.5

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.
Files changed (91) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/lib/BillPayWidget.js +1 -1
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +13 -13
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +70 -5
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +37 -64
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +110 -38
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +73 -104
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +7 -87
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +21 -7
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +22 -17
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +63 -23
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +2 -66
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +81 -2
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +3 -78
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +5 -4
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +4 -5
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +32 -3
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +39 -30
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +166 -37
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +39 -164
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +1 -48
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +50 -1
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +11 -45
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +8 -13
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +14 -8
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +59 -7
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +8 -64
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +24 -8
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +139 -18
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +16 -139
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +4 -24
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +41 -4
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +14 -39
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +8 -16
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +91 -8
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +86 -80
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +3 -97
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +49 -3
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +135 -47
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +33 -135
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +186 -33
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +75 -186
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +21 -75
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +25 -14
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +232 -22
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +210 -223
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +103 -202
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +13 -121
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +47 -12
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +31 -47
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +198 -27
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +31 -198
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +234 -31
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +19 -240
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +24 -25
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +427 -19
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +4 -433
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +38 -4
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +220 -35
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +3 -224
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +4 -3
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +44 -2
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +1 -46
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +8 -1
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +10 -6
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +57 -21
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +110 -10
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +3 -112
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +127 -3
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +8 -124
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +7 -8
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +46 -8
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +18 -43
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +28 -20
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +82 -27
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +47 -83
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +5 -58
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +250 -47
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +101 -239
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +202 -107
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +3 -209
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +8 -4
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +113 -6
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js +1 -115
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index87.js +24 -0
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +4 -5
  87. package/dist/libs/tesouro-embedded-components-react/remote-check-capture/data-access/dist/index5.js +1 -0
  88. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  89. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  90. package/package.json +1 -1
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js +0 -25
@@ -1,44 +1,19 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { hasAnyScope as t } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
7
- import { Scope as n } from "../../../shared/data-access/dist/lib/scopes.js";
8
- import "../../../shared/data-access/dist/index.js";
9
- import "../../../shared/ui/dist/index.js";
10
- import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
- import "../../../shared/feature/dist/index.js";
12
- import { useDeletePayableMutation as i } from "../../data-access/dist/index13.js";
13
- import "../../data-access/dist/index.js";
14
- import { useState as a } from "react";
15
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js
16
- function o({ payableId: o, status: s, enabled: c = !0, labels: l, onDeleted: u }) {
17
- let { initResponse: d } = r(), f = i(), [p, m] = a(!1), h = t(d?.scopes, [n.PayableWriteOrg]), g = !!(c && o && s === "draft" && h), _ = g ? [{
18
- id: "deleteDraft",
19
- label: l.menuItem,
20
- destructive: !0,
21
- onSelect: () => m(!0)
22
- }] : [], v = p && g;
2
+ var e = 1e4;
3
+ function t(e) {
4
+ return typeof e == "number" && Number.isFinite(e) ? e : 0;
5
+ }
6
+ function n(e) {
7
+ let n = t(e), r = Math.round(Number(Math.abs(n).toFixed(6)));
8
+ return n < 0 ? -r || 0 : r;
9
+ }
10
+ function r({ quantity: r, unitPrice: i, tax: a }) {
11
+ let o = n(t(r) * t(i)), s = n(o * t(a) / e);
23
12
  return {
24
- menuItems: _,
25
- dialog: {
26
- open: v,
27
- copy: v ? l.dialog : void 0,
28
- isPending: f.isPending,
29
- onCancel: () => {
30
- f.isPending || m(!1);
31
- },
32
- onConfirm: () => {
33
- !g || !o || f.isPending || f.mutate({ path: { payable_id: o } }, {
34
- onError: () => e.error(l.error),
35
- onSuccess: () => {
36
- m(!1), u();
37
- }
38
- });
39
- }
40
- }
13
+ subtotal: o,
14
+ taxAmount: s,
15
+ total: o + s
41
16
  };
42
17
  }
43
18
  //#endregion
44
- export { o as useDraftDelete };
19
+ export { e as TAX_RATE_SCALE, r as calculateLineItemTotals, n as roundToMinorUnits };
@@ -1,19 +1,11 @@
1
+ import { calculateLineItemTotals as e } from "./index39.js";
1
2
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js
2
- var e = 1e4;
3
- function t(e) {
4
- return typeof e == "number" && Number.isFinite(e) ? e : 0;
5
- }
6
- function n(e) {
7
- let n = t(e), r = Math.round(Number(Math.abs(n).toFixed(6)));
8
- return n < 0 ? -r || 0 : r;
9
- }
10
- function r({ quantity: r, unitPrice: i, tax: a }) {
11
- let o = n(t(r) * t(i)), s = n(o * t(a) / e);
12
- return {
13
- subtotal: o,
14
- taxAmount: s,
15
- total: o + s
16
- };
3
+ function t(t) {
4
+ if (typeof t.subtotal == "number") return t.subtotal;
5
+ if (typeof t.quantity == "number" && typeof t.unit_price == "number") return e({
6
+ quantity: t.quantity,
7
+ unitPrice: t.unit_price
8
+ }).subtotal;
17
9
  }
18
10
  //#endregion
19
- export { e as TAX_RATE_SCALE, r as calculateLineItemTotals, n as roundToMinorUnits };
11
+ export { t as resolveLineItemAmountMinorUnits };
@@ -1,11 +1,94 @@
1
- import { calculateLineItemTotals as e } from "./index40.js";
1
+ import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
2
+ import { derivePayableStatus as t } from "./index7.js";
3
+ import { resolveVendor as n, resolveVendorName as r } from "./index8.js";
4
+ import { formatBillMoney as i } from "./index2.js";
5
+ import { resolveLineItemAmountMinorUnits as a } from "./index40.js";
2
6
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js
3
- function t(t) {
4
- if (typeof t.subtotal == "number") return t.subtotal;
5
- if (typeof t.quantity == "number" && typeof t.unit_price == "number") return e({
6
- quantity: t.quantity,
7
- unitPrice: t.unit_price
8
- }).subtotal;
7
+ function o({ payable: o, lineItems: c, ledgerAccounts: l, labels: u, hasScheduledPayment: d, now: f, rejection: p }) {
8
+ let m = o.currency, h = (e) => i(e, m), g = t({
9
+ apiStatus: o.status,
10
+ dueDate: o.due_date,
11
+ scheduledPaymentDate: o.scheduled_payment_date,
12
+ hasScheduledPayment: d,
13
+ now: f
14
+ }), _ = n(o), v = r(o), y = e(o.issued_at) || u.notProvided, b = e(o.due_date) || u.notProvided, x = [{
15
+ label: u.vendorRow,
16
+ value: v || u.notProvided,
17
+ secondaryValue: _?.email ?? void 0
18
+ }], S = _?.bank_account?.account_number;
19
+ S && x.push({
20
+ label: u.bankAccountRow,
21
+ value: u.bankAccountValue(S.slice(-4))
22
+ });
23
+ let C = [
24
+ {
25
+ label: u.invoiceNumberRow,
26
+ value: o.document_id || u.notProvided
27
+ },
28
+ {
29
+ label: u.issueDateRow,
30
+ value: y
31
+ },
32
+ {
33
+ label: u.dueDateRow,
34
+ value: b
35
+ },
36
+ {
37
+ label: u.poNumberRow,
38
+ value: u.notProvided
39
+ }
40
+ ], w = new Map(l.map((e) => [e.id, [e.nominal_code, e.name].filter(Boolean).join(" — ")])), T = c.map((e) => {
41
+ let t = h(e.unit_price);
42
+ return {
43
+ id: e.id,
44
+ description: e.name ?? e.description ?? "",
45
+ glCodeLabel: (e.ledger_account_id ? w.get(e.ledger_account_id) : void 0) || u.glCodeMissing,
46
+ quantityLabel: e.quantity != null && t ? u.quantityValue(String(e.quantity), t) : "",
47
+ amountLabel: h(a(e)) ?? ""
48
+ };
49
+ }), E = [
50
+ {
51
+ label: u.subtotalRow,
52
+ value: o.subtotal
53
+ },
54
+ {
55
+ label: u.discountsRow,
56
+ value: o.discount
57
+ },
58
+ {
59
+ label: u.taxRow,
60
+ value: o.tax_amount
61
+ }
62
+ ].map(({ label: e, value: t }) => ({
63
+ label: e,
64
+ value: h(t)
65
+ })).filter((e) => !!e.value), D = h(o.total_amount);
66
+ D && E.push({
67
+ label: u.totalRow,
68
+ value: D,
69
+ emphasis: !0
70
+ });
71
+ let O = s(o);
72
+ return {
73
+ title: v,
74
+ subtitle: u.subtitle,
75
+ status: g.status,
76
+ statusTone: g.tone,
77
+ amountDueLabel: h(o.amount_due) ?? h(o.total_amount) ?? "",
78
+ amountPaidLabel: O ? h(o.amount_paid) : void 0,
79
+ paidOnLabel: O ? u.paidOnLabel(O) : void 0,
80
+ invoiceDateLabel: y,
81
+ dueDateLabel: b,
82
+ dueDateTone: g.isOverdue ? "danger" : "default",
83
+ payToItems: x,
84
+ invoiceItems: C,
85
+ lineItems: T,
86
+ totals: E,
87
+ rejection: p
88
+ };
89
+ }
90
+ function s(t) {
91
+ return t.status === "paid" && t.paid_at ? e(t.paid_at.slice(0, 10)) : void 0;
9
92
  }
10
93
  //#endregion
11
- export { t as resolveLineItemAmountMinorUnits };
94
+ export { s as getPaidAtLabel, o as mapPayableToBillDetails };
@@ -1,94 +1,100 @@
1
1
  import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
2
- import { derivePayableStatus as t } from "./index8.js";
3
- import { resolveVendor as n, resolveVendorName as r } from "./index9.js";
4
- import { formatBillMoney as i } from "./index2.js";
5
- import { resolveLineItemAmountMinorUnits as a } from "./index41.js";
2
+ import { derivePayableStatus as t } from "./index7.js";
3
+ import { resolveVendor as n } from "./index8.js";
4
+ import { resolveAmountDueMinorUnits as r } from "./index20.js";
5
+ import { maskAccountNumber as i } from "./index22.js";
6
+ import { formatBillMoney as a } from "./index2.js";
7
+ import { resolveLineItemAmountMinorUnits as o } from "./index40.js";
8
+ import { getPaidAtLabel as s } from "./index41.js";
6
9
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js
7
- function o({ payable: o, lineItems: c, ledgerAccounts: l, labels: u, hasScheduledPayment: d, now: f, rejection: p }) {
8
- let m = o.currency, h = (e) => i(e, m), g = t({
9
- apiStatus: o.status,
10
- dueDate: o.due_date,
11
- scheduledPaymentDate: o.scheduled_payment_date,
12
- hasScheduledPayment: d,
13
- now: f
14
- }), _ = n(o), v = r(o), y = e(o.issued_at) || u.notProvided, b = e(o.due_date) || u.notProvided, x = [{
15
- label: u.vendorRow,
16
- value: v || u.notProvided,
17
- secondaryValue: _?.email ?? void 0
18
- }], S = _?.bank_account?.account_number;
19
- S && x.push({
20
- label: u.bankAccountRow,
21
- value: u.bankAccountValue(S.slice(-4))
22
- });
23
- let C = [
24
- {
25
- label: u.invoiceNumberRow,
26
- value: o.document_id || u.notProvided
27
- },
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 : S?.bank_account, 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 = [
28
17
  {
29
- label: u.issueDateRow,
30
- value: y
18
+ label: h.subtotalRow,
19
+ minorUnits: c.subtotal
31
20
  },
32
21
  {
33
- label: u.dueDateRow,
34
- value: b
22
+ label: h.discountRow,
23
+ minorUnits: c.discount
35
24
  },
36
25
  {
37
- label: u.poNumberRow,
38
- value: u.notProvided
26
+ label: h.taxRow,
27
+ minorUnits: c.tax_amount
39
28
  }
40
- ], w = new Map(l.map((e) => [e.id, [e.nominal_code, e.name].filter(Boolean).join(" — ")])), T = c.map((e) => {
41
- let t = h(e.unit_price);
42
- return {
43
- id: e.id,
44
- description: e.name ?? e.description ?? "",
45
- glCodeLabel: (e.ledger_account_id ? w.get(e.ledger_account_id) : void 0) || u.glCodeMissing,
46
- quantityLabel: e.quantity != null && t ? u.quantityValue(String(e.quantity), t) : "",
47
- amountLabel: h(a(e)) ?? ""
48
- };
49
- }), E = [
50
- {
51
- label: u.subtotalRow,
52
- value: o.subtotal
53
- },
54
- {
55
- label: u.discountsRow,
56
- value: o.discount
57
- },
58
- {
59
- label: u.taxRow,
60
- value: o.tax_amount
61
- }
62
- ].map(({ label: e, value: t }) => ({
63
- label: e,
64
- value: h(t)
65
- })).filter((e) => !!e.value), D = h(o.total_amount);
66
- D && E.push({
67
- label: u.totalRow,
68
- value: D,
29
+ ].map((e) => ({
30
+ label: e.label,
31
+ value: a(e.minorUnits, b)
32
+ })).filter((e) => !!e.value), A = a(c.total_amount, b);
33
+ A && k.push({
34
+ label: h.totalRow,
35
+ value: A,
69
36
  emphasis: !0
70
37
  });
71
- let O = s(o);
38
+ let j = s(c);
72
39
  return {
73
- title: v,
74
- subtitle: u.subtitle,
75
- status: g.status,
76
- statusTone: g.tone,
77
- amountDueLabel: h(o.amount_due) ?? h(o.total_amount) ?? "",
78
- amountPaidLabel: O ? h(o.amount_paid) : void 0,
79
- paidOnLabel: O ? u.paidOnLabel(O) : void 0,
80
- invoiceDateLabel: y,
81
- dueDateLabel: b,
82
- dueDateTone: g.isOverdue ? "danger" : "default",
83
- payToItems: x,
84
- invoiceItems: C,
85
- lineItems: T,
86
- totals: E,
87
- rejection: p
40
+ amountDue: a(r(c), b) ?? "",
41
+ amountPaid: j ? a(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,
48
+ payTo: {
49
+ name: S?.name || h.notProvided,
50
+ email: S?.email ?? "",
51
+ methodLabel: T ? h.paymentInstructionsValue(w?.slice(-4) ?? "") : h.paymentInstructionsNotSet,
52
+ fields: T ? [
53
+ {
54
+ label: h.accountHolderFieldLabel,
55
+ value: C?.account_holder_name ?? ""
56
+ },
57
+ {
58
+ label: h.routingNumberFieldLabel,
59
+ value: C?.routing_number ?? ""
60
+ },
61
+ {
62
+ label: h.accountNumberFieldLabel,
63
+ value: w ?? "",
64
+ maskedValue: i(w ?? void 0)
65
+ }
66
+ ] : []
67
+ },
68
+ invoiceFields: [
69
+ {
70
+ label: h.invoiceDateRow,
71
+ value: E
72
+ },
73
+ {
74
+ label: h.dueDateRow,
75
+ value: D
76
+ },
77
+ {
78
+ label: h.invoiceNumberRow,
79
+ value: c.document_id || h.notProvided
80
+ }
81
+ ],
82
+ lineItems: l.map((e) => {
83
+ let t = a(e.unit_price, b);
84
+ return {
85
+ id: e.id,
86
+ description: e.name ?? e.description ?? "",
87
+ glCodeLabel: e.ledger_account_id ? O.get(e.ledger_account_id) ?? (d ? h.glCodeMissing : h.glCodeUnavailable) : h.glCodeMissing,
88
+ qtyPriceLabel: e.quantity != null && t ? h.qtyPriceValue(String(e.quantity), t) : "",
89
+ amount: a(o(e), b) ?? ""
90
+ };
91
+ }),
92
+ amountRows: k,
93
+ approvalPolicy: m,
94
+ paymentHistory: p,
95
+ history: f,
96
+ rejection: _
88
97
  };
89
98
  }
90
- function s(t) {
91
- return t.status === "paid" && t.paid_at ? e(t.paid_at.slice(0, 10)) : void 0;
92
- }
93
99
  //#endregion
94
- export { s as getPaidAtLabel, o as mapPayableToBillDetails };
100
+ export { c as buildBillDetailView };
@@ -1,100 +1,6 @@
1
- import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
2
- import { derivePayableStatus as t } from "./index8.js";
3
- import { resolveVendor as n } from "./index9.js";
4
- import { resolveAmountDueMinorUnits as r } from "./index21.js";
5
- import { maskAccountNumber as i } from "./index23.js";
6
- import { formatBillMoney as a } from "./index2.js";
7
- import { resolveLineItemAmountMinorUnits as o } from "./index41.js";
8
- import { getPaidAtLabel as s } from "./index42.js";
9
1
  //#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 : S?.bank_account, 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 = [
17
- {
18
- label: h.subtotalRow,
19
- minorUnits: c.subtotal
20
- },
21
- {
22
- label: h.discountRow,
23
- minorUnits: c.discount
24
- },
25
- {
26
- label: h.taxRow,
27
- minorUnits: c.tax_amount
28
- }
29
- ].map((e) => ({
30
- label: e.label,
31
- value: a(e.minorUnits, b)
32
- })).filter((e) => !!e.value), A = a(c.total_amount, b);
33
- A && k.push({
34
- label: h.totalRow,
35
- value: A,
36
- emphasis: !0
37
- });
38
- let j = s(c);
39
- return {
40
- amountDue: a(r(c), b) ?? "",
41
- amountPaid: j ? a(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,
48
- payTo: {
49
- name: S?.name || h.notProvided,
50
- email: S?.email ?? "",
51
- methodLabel: T ? h.paymentInstructionsValue(w?.slice(-4) ?? "") : h.paymentInstructionsNotSet,
52
- fields: T ? [
53
- {
54
- label: h.accountHolderFieldLabel,
55
- value: C?.account_holder_name ?? ""
56
- },
57
- {
58
- label: h.routingNumberFieldLabel,
59
- value: C?.routing_number ?? ""
60
- },
61
- {
62
- label: h.accountNumberFieldLabel,
63
- value: w ?? "",
64
- maskedValue: i(w ?? void 0)
65
- }
66
- ] : []
67
- },
68
- invoiceFields: [
69
- {
70
- label: h.invoiceDateRow,
71
- value: E
72
- },
73
- {
74
- label: h.dueDateRow,
75
- value: D
76
- },
77
- {
78
- label: h.invoiceNumberRow,
79
- value: c.document_id || h.notProvided
80
- }
81
- ],
82
- lineItems: l.map((e) => {
83
- let t = a(e.unit_price, b);
84
- return {
85
- id: e.id,
86
- description: e.name ?? e.description ?? "",
87
- glCodeLabel: e.ledger_account_id ? O.get(e.ledger_account_id) ?? (d ? h.glCodeMissing : h.glCodeUnavailable) : h.glCodeMissing,
88
- qtyPriceLabel: e.quantity != null && t ? h.qtyPriceValue(String(e.quantity), t) : "",
89
- amount: a(o(e), b) ?? ""
90
- };
91
- }),
92
- amountRows: k,
93
- approvalPolicy: m,
94
- paymentHistory: p,
95
- history: f,
96
- rejection: _
97
- };
2
+ function e({ isUnsavedPromptOpen: e, isLocked: t, isDirty: n }) {
3
+ return e ? "dismiss-prompt" : !t && n ? "prompt" : "close";
98
4
  }
99
5
  //#endregion
100
- export { c as buildBillDetailView };
6
+ export { e as resolveEditorDismissal };
@@ -1,6 +1,52 @@
1
+ import { derivePayableStatus as e } from "./index7.js";
2
+ import { BILL_STATUS_BADGE_LABELS_EN as t } from "../../ui/dist/index17.js";
3
+ import "../../ui/dist/index.js";
1
4
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js
2
- function e({ isUnsavedPromptOpen: e, isLocked: t, isDirty: n }) {
3
- return e ? "dismiss-prompt" : !t && n ? "prompt" : "close";
5
+ var n = /* @__PURE__ */ new Set([
6
+ "credit_note_linked",
7
+ "credit_note_unlinked",
8
+ "line_item_added",
9
+ "line_item_updated",
10
+ "line_item_removed",
11
+ "deleted"
12
+ ]);
13
+ function r(n, r, i) {
14
+ switch (n) {
15
+ case "payable_created": return r?.source_of_payable_data === "ocr" ? i.billUploaded : i.billAdded;
16
+ case "payable_updated": return i.billUpdated;
17
+ case "file_attached": return i.attachmentAdded;
18
+ case "submitted_for_approval": return i.submittedForApproval;
19
+ case "approval_requested": return i.approvalRequested;
20
+ case "approval_action": {
21
+ let e = r?.action, t = r?.reject_reason;
22
+ return e === "approve" ? i.approved : e === "reject" ? typeof t == "string" && t ? i.rejectedWithReason(t) : i.rejected : void 0;
23
+ }
24
+ case "auto_approved": return i.autoApproved;
25
+ case "reopened": return i.reopened;
26
+ case "marked_as_paid": return i.markedAsPaid;
27
+ case "marked_as_partially_paid": return i.markedAsPartiallyPaid;
28
+ case "payment_reverted": return i.paymentReverted;
29
+ case "status_changed": {
30
+ let n = r?.new_status;
31
+ if (typeof n != "string") return;
32
+ let a = e({ apiStatus: n }).status;
33
+ return i.statusChanged(t[a] ?? t.unknown);
34
+ }
35
+ default: return;
36
+ }
37
+ }
38
+ function i(e, t, i) {
39
+ let a = new Map(t.map((e) => [e.id, e.name]));
40
+ return e.filter((e) => !n.has(e.event_type)).map((e) => {
41
+ let t = r(e.event_type, e.event_data, i);
42
+ if (!t) return;
43
+ let n = e.entity_user_id ? a.get(e.entity_user_id) : void 0;
44
+ return {
45
+ id: e.id,
46
+ dateLabel: i.dateLabel(e.timestamp),
47
+ description: n ? i.byActor(t, n) : t
48
+ };
49
+ }).filter((e) => !!e);
4
50
  }
5
51
  //#endregion
6
- export { e as resolveEditorDismissal };
52
+ export { i as buildBillHistory };