@tesouro/embedded-components-react 0.5.0 → 0.5.2

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 (55) 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 +10 -9
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +14 -88
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +8 -96
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +91 -3
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +96 -48
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +3 -137
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +49 -35
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +129 -180
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +32 -74
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +186 -21
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +70 -226
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +22 -219
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +221 -109
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +220 -13
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +119 -46
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +13 -32
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +43 -198
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +29 -32
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +186 -222
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +37 -19
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +229 -420
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +21 -4
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +429 -34
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +4 -224
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +38 -3
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +222 -2
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +3 -46
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +4 -1
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +44 -6
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +1 -12
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +6 -110
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +12 -3
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +109 -124
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +3 -11
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +124 -7
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +8 -45
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +8 -21
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +45 -28
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +20 -83
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +28 -47
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +76 -243
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +48 -113
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +239 -196
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +115 -4
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +207 -5
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +3 -114
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +8 -1
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js +106 -16
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index87.js +1 -0
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js +25 -0
  53. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  54. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  55. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import { RefreshingRootWidgetProvider as _ } from "./libs/tesouro-embedded-compo
14
14
  import { useDisclosuresAcceptanceSurface as v, useOwnWidgetConfig as y, useRefetchWidget as b, useWidgetConfig as x, useWidgetError as S, useWidgetInitStaleForToken as C, useWidgetLoading as w } from "./libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/hooks.js";
15
15
  import { BankAccountsWidget as T } from "./libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index8.js";
16
16
  import { CounterpartsWidget as E } from "./libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js";
17
- import { BillPayWidget as D } from "./libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js";
17
+ import { BillPayWidget as D } from "./libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js";
18
18
  import { CardDetailsWidget as O } from "./libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index13.js";
19
19
  import { CreditCardsWidget as k } from "./libs/tesouro-embedded-components-react/cards-widget/feature/dist/index10.js";
20
20
  import { DebitCardsWidget as A } from "./libs/tesouro-embedded-components-react/cards-widget/feature/dist/index11.js";
@@ -1,3 +1,3 @@
1
- import { BillPayWidget as e } from "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js";
1
+ import { BillPayWidget as e } from "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js";
2
2
  import "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js";
3
3
  export { e as BillPayWidget };
@@ -10,22 +10,23 @@ import "./index15.js";
10
10
  import "./index27.js";
11
11
  import "./index28.js";
12
12
  import "./index40.js";
13
- import "./index46.js";
14
- import "./index55.js";
13
+ import "./index42.js";
14
+ import "./index48.js";
15
15
  import "./index57.js";
16
16
  import "./index59.js";
17
- import "./index60.js";
18
17
  import "./index61.js";
19
18
  import "./index62.js";
20
19
  import "./index63.js";
21
- import "./index67.js";
22
- import "./index68.js";
20
+ import "./index64.js";
21
+ import "./index65.js";
23
22
  import "./index69.js";
24
23
  import "./index70.js";
25
24
  import "./index71.js";
26
- import "./index74.js";
27
- import "./index80.js";
28
- import "./index81.js";
25
+ import "./index72.js";
26
+ import "./index73.js";
27
+ import "./index76.js";
29
28
  import "./index82.js";
30
- import { BillPayWidget as e } from "./index86.js";
29
+ import "./index83.js";
30
+ import "./index84.js";
31
+ import { BillPayWidget as e } from "./index88.js";
31
32
  export { e as BillPayWidget };
@@ -1,93 +1,19 @@
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
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js
6
- function a({ payable: a, lineItems: s, ledgerAccounts: c, labels: l, hasScheduledPayment: u, now: d, rejection: f }) {
7
- let p = a.currency, m = (e) => i(e, p), h = t({
8
- apiStatus: a.status,
9
- dueDate: a.due_date,
10
- scheduledPaymentDate: a.scheduled_payment_date,
11
- hasScheduledPayment: u,
12
- now: d
13
- }), g = n(a), _ = r(a), v = e(a.issued_at) || l.notProvided, y = e(a.due_date) || l.notProvided, b = [{
14
- label: l.vendorRow,
15
- value: _ || l.notProvided,
16
- secondaryValue: g?.email ?? void 0
17
- }], x = g?.bank_account?.account_number;
18
- x && b.push({
19
- label: l.bankAccountRow,
20
- value: l.bankAccountValue(x.slice(-4))
21
- });
22
- let S = [
23
- {
24
- label: l.invoiceNumberRow,
25
- value: a.document_id || l.notProvided
26
- },
27
- {
28
- label: l.issueDateRow,
29
- value: v
30
- },
31
- {
32
- label: l.dueDateRow,
33
- value: y
34
- },
35
- {
36
- label: l.poNumberRow,
37
- value: l.notProvided
38
- }
39
- ], C = new Map(c.map((e) => [e.id, [e.nominal_code, e.name].filter(Boolean).join(" — ")])), w = s.map((e) => {
40
- let t = m(e.unit_price);
41
- return {
42
- id: e.id,
43
- description: e.name ?? e.description ?? "",
44
- glCodeLabel: (e.ledger_account_id ? C.get(e.ledger_account_id) : void 0) || l.glCodeMissing,
45
- quantityLabel: e.quantity != null && t ? l.quantityValue(String(e.quantity), t) : "",
46
- amountLabel: m(e.subtotal) ?? ""
47
- };
48
- }), T = [
49
- {
50
- label: l.subtotalRow,
51
- value: a.subtotal
52
- },
53
- {
54
- label: l.discountsRow,
55
- value: a.discount
56
- },
57
- {
58
- label: l.taxRow,
59
- value: a.tax_amount
60
- }
61
- ].map(({ label: e, value: t }) => ({
62
- label: e,
63
- value: m(t)
64
- })).filter((e) => !!e.value), E = m(a.total_amount);
65
- E && T.push({
66
- label: l.totalRow,
67
- value: E,
68
- emphasis: !0
69
- });
70
- let D = o(a);
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);
71
12
  return {
72
- title: _,
73
- subtitle: l.subtitle,
74
- status: h.status,
75
- statusTone: h.tone,
76
- amountDueLabel: m(a.amount_due) ?? m(a.total_amount) ?? "",
77
- amountPaidLabel: D ? m(a.amount_paid) : void 0,
78
- paidOnLabel: D ? l.paidOnLabel(D) : void 0,
79
- invoiceDateLabel: v,
80
- dueDateLabel: y,
81
- dueDateTone: h.isOverdue ? "danger" : "default",
82
- payToItems: b,
83
- invoiceItems: S,
84
- lineItems: w,
85
- totals: T,
86
- rejection: f
13
+ subtotal: o,
14
+ taxAmount: s,
15
+ total: o + s
87
16
  };
88
17
  }
89
- function o(t) {
90
- return t.status === "paid" && t.paid_at ? e(t.paid_at.slice(0, 10)) : void 0;
91
- }
92
18
  //#endregion
93
- export { o as getPaidAtLabel, a as mapPayableToBillDetails };
19
+ export { e as TAX_RATE_SCALE, r as calculateLineItemTotals, n as roundToMinorUnits };
@@ -1,99 +1,11 @@
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 { getPaidAtLabel as o } from "./index40.js";
1
+ import { calculateLineItemTotals as e } from "./index40.js";
8
2
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js
9
- function s({ payable: s, lineItems: c, glCodeOptions: l, glCodeRosterAvailable: u = !0, history: d, paymentHistory: f, approvalPolicy: p, labels: m, hasScheduledPayment: h, rejection: g, payableAchInstructions: _, payableAchInstructionsReadable: v = !1 }) {
10
- let y = s.currency, b = t({
11
- apiStatus: s.status,
12
- dueDate: s.due_date,
13
- scheduledPaymentDate: s.scheduled_payment_date,
14
- hasScheduledPayment: h
15
- }), x = n(s), S = v ? _ : x?.bank_account, C = S?.account_number, w = !!(S?.account_holder_name && S.routing_number && S.account_number), T = e(s.issued_at) || m.notProvided, E = e(s.due_date) || m.notProvided, D = new Map(l.map((e) => [e.value, e.label])), O = [
16
- {
17
- label: m.subtotalRow,
18
- minorUnits: s.subtotal
19
- },
20
- {
21
- label: m.discountRow,
22
- minorUnits: s.discount
23
- },
24
- {
25
- label: m.taxRow,
26
- minorUnits: s.tax_amount
27
- }
28
- ].map((e) => ({
29
- label: e.label,
30
- value: a(e.minorUnits, y)
31
- })).filter((e) => !!e.value), k = a(s.total_amount, y);
32
- k && O.push({
33
- label: m.totalRow,
34
- value: k,
35
- emphasis: !0
36
- });
37
- let A = o(s);
38
- return {
39
- amountDue: a(r(s), y) ?? "",
40
- amountPaid: A ? a(s.amount_paid, y) : void 0,
41
- paidOnLabel: A ? m.paidOnLabel(A) : void 0,
42
- invoiceDateLabel: T,
43
- dueDateLabel: E,
44
- dueDateTone: b.isOverdue ? "danger" : "default",
45
- status: b.status,
46
- statusTone: b.tone,
47
- payTo: {
48
- name: x?.name || m.notProvided,
49
- email: x?.email ?? "",
50
- methodLabel: w ? m.paymentInstructionsValue(C?.slice(-4) ?? "") : m.paymentInstructionsNotSet,
51
- fields: w ? [
52
- {
53
- label: m.accountHolderFieldLabel,
54
- value: S?.account_holder_name ?? ""
55
- },
56
- {
57
- label: m.routingNumberFieldLabel,
58
- value: S?.routing_number ?? ""
59
- },
60
- {
61
- label: m.accountNumberFieldLabel,
62
- value: C ?? "",
63
- maskedValue: i(C ?? void 0)
64
- }
65
- ] : []
66
- },
67
- invoiceFields: [
68
- {
69
- label: m.invoiceDateRow,
70
- value: T
71
- },
72
- {
73
- label: m.dueDateRow,
74
- value: E
75
- },
76
- {
77
- label: m.invoiceNumberRow,
78
- value: s.document_id || m.notProvided
79
- }
80
- ],
81
- lineItems: c.map((e) => {
82
- let t = a(e.unit_price, y);
83
- return {
84
- id: e.id,
85
- description: e.name ?? e.description ?? "",
86
- glCodeLabel: e.ledger_account_id ? D.get(e.ledger_account_id) ?? (u ? m.glCodeMissing : m.glCodeUnavailable) : m.glCodeMissing,
87
- qtyPriceLabel: e.quantity != null && t ? m.qtyPriceValue(String(e.quantity), t) : "",
88
- amount: a(e.subtotal, y) ?? ""
89
- };
90
- }),
91
- amountRows: O,
92
- approvalPolicy: p,
93
- paymentHistory: f,
94
- history: d,
95
- rejection: g
96
- };
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;
97
9
  }
98
10
  //#endregion
99
- export { s as buildBillDetailView };
11
+ export { t as resolveLineItemAmountMinorUnits };
@@ -1,6 +1,94 @@
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";
1
6
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js
2
- function e({ isUnsavedPromptOpen: e, isLocked: t, isDirty: n }) {
3
- return e ? "dismiss-prompt" : !t && n ? "prompt" : "close";
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;
4
92
  }
5
93
  //#endregion
6
- export { e as resolveEditorDismissal };
94
+ export { s as getPaidAtLabel, o as mapPayableToBillDetails };
@@ -1,52 +1,100 @@
1
- import { derivePayableStatus as e } from "./index8.js";
2
- import { BILL_STATUS_BADGE_LABELS_EN as t } from "../../ui/dist/index17.js";
3
- import "../../ui/dist/index.js";
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";
4
9
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js
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;
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
23
28
  }
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);
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
+ };
50
98
  }
51
99
  //#endregion
52
- export { i as buildBillHistory };
100
+ export { c as buildBillDetailView };
@@ -1,140 +1,6 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js
2
- var e = {
3
- payBill: "Pay bill",
4
- markAsPaid: "Mark as paid",
5
- reject: "Reject",
6
- approve: "Approve",
7
- cancel: "Cancel bill",
8
- cancelScheduledPayment: "Cancel scheduled payment",
9
- reopen: "Reopen bill",
10
- forceApprove: "Approve",
11
- forceReject: "Reject",
12
- policyOverridesHeading: "Policy overrides",
13
- decisionDialog: {
14
- reject: {
15
- title: "Reject this bill?",
16
- description: "The bill goes back as rejected and nobody else is asked to approve it.",
17
- confirmButton: "Reject bill",
18
- reason: {
19
- label: "Reason",
20
- placeholder: "Tell the submitter what needs to change",
21
- optionalHint: "Optional"
22
- }
23
- },
24
- cancel: {
25
- title: "Cancel this bill?",
26
- description: "Cancelling is permanent. The bill can't be reopened, edited, or paid afterwards.",
27
- confirmButton: "Cancel bill"
28
- },
29
- cancelScheduledPayment: {
30
- title: "Cancel this scheduled payment?",
31
- description: "The payment will not be sent. The bill stays ready to pay, so you can schedule it again for another date.",
32
- confirmButton: "Cancel payment"
33
- },
34
- forceApprove: {
35
- title: "Override approval policy?",
36
- description: "The below people haven't approved this bill yet. Approving now will bypass their required review. This will be recorded in the audit history and can't be undone.",
37
- confirmButton: "Override and approve",
38
- noApprovalPolicy: {
39
- title: "Approve this bill?",
40
- description: "This bill has no approval policy applied. Approving now will be recorded in the audit history and can't be undone.",
41
- confirmButton: "Approve bill"
42
- }
43
- },
44
- forceReject: {
45
- title: "Override approval policy?",
46
- description: "The below people haven't approved this bill yet. Rejecting now will bypass their required review. This will be recorded in the audit history and can't be undone.",
47
- confirmButton: "Override and reject",
48
- noApprovalPolicy: {
49
- title: "Reject this bill?",
50
- description: "This bill has no approval policy applied. Rejecting now will be recorded in the audit history and can't be undone.",
51
- confirmButton: "Reject bill"
52
- }
53
- },
54
- cancelButton: "Cancel"
55
- },
56
- actionError: "Couldn't update this bill. Try again.",
57
- actionSuccess: {
58
- approve: "Bill approved.",
59
- reject: "Bill rejected.",
60
- markAsPaid: "Bill marked as paid.",
61
- cancel: "Bill canceled.",
62
- cancelScheduledPayment: "Scheduled payment canceled.",
63
- reopen: "Bill reopened.",
64
- forceApprove: "Bill approved, overriding the approval policy.",
65
- forceReject: "Bill rejected, overriding the approval policy.",
66
- forceApproveNoApprovalPolicy: "Bill approved.",
67
- forceRejectNoApprovalPolicy: "Bill rejected."
68
- }
69
- }, t = (e) => `Payment scheduled for ${e}`, n = [
70
- "reject",
71
- "cancel",
72
- "cancelScheduledPayment",
73
- "forceApprove",
74
- "forceReject"
75
- ];
76
- function r(e, t) {
77
- let n = e.reason ? {
78
- ...e.reason,
79
- ...t?.reason
80
- } : void 0, r = e.noApprovalPolicy ? {
81
- ...e.noApprovalPolicy,
82
- ...t?.noApprovalPolicy
83
- } : void 0, i = {
84
- ...e,
85
- ...t,
86
- reason: n,
87
- noApprovalPolicy: r
88
- };
89
- return n || delete i.reason, r || delete i.noApprovalPolicy, i;
90
- }
91
- function i(e, t) {
92
- let i = {
93
- ...e,
94
- ...t
95
- };
96
- for (let a of n) i[a] = r(e[a], t?.[a]);
97
- return i;
98
- }
99
- function a(t) {
100
- let n = e;
101
- return {
102
- ...n,
103
- ...t,
104
- decisionDialog: i(n.decisionDialog, t?.decisionDialog),
105
- actionSuccess: {
106
- ...n.actionSuccess,
107
- ...t?.actionSuccess
108
- }
109
- };
110
- }
111
- var o = {
112
- paymentHistorySentLabel: "Payment sent",
113
- paymentHistoryScheduledLabel: "Payment scheduled",
114
- paymentHistoryCanceledLabel: "Payment canceled",
115
- paymentHistoryOtherLabel: "Payment",
116
- paymentHistoryMethodSuffix: (e, t) => `${e} via ${t}`,
117
- paymentHistoryOverpaidLabel: (e) => `+${e} overpaid`,
118
- paymentHistoryMarkedPaidExternalLabel: "Marked as paid manually",
119
- paymentHistoryMarkedPaidLabel: "Marked as paid",
120
- paymentHistoryPartiallyPaidExternalLabel: "Partial payment marked manually",
121
- paymentHistoryPartiallyPaidLabel: "Partial payment",
122
- paymentHistoryRevertedLabel: "Payment reverted",
123
- paymentHistoryMethodLabels: {
124
- ach: "ACH",
125
- us_ach: "ACH",
126
- wire: "Wire",
127
- check: "Check",
128
- paper_check: "Check",
129
- bank_account: "Bank transfer",
130
- card: "Card"
131
- }
132
- };
133
- function s(e) {
134
- return {
135
- ...o.paymentHistoryMethodLabels,
136
- ...e
137
- };
2
+ function e({ isUnsavedPromptOpen: e, isLocked: t, isDirty: n }) {
3
+ return e ? "dismiss-prompt" : !t && n ? "prompt" : "close";
138
4
  }
139
5
  //#endregion
140
- export { e as BILL_DETAIL_ACTIONS_LABELS_EN, o as PAYMENT_HISTORY_LABELS_EN, t as SCHEDULED_SUMMARY_LABEL_EN, a as mergeBillDetailActionsLabels, i as mergeDecisionDialogCopy, s as mergePaymentHistoryMethodLabels };
6
+ export { e as resolveEditorDismissal };