@tesouro/embedded-components-react 0.5.280 → 0.5.281

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 (52) hide show
  1. package/dist/index.css +8 -0
  2. package/dist/index.d.ts +2 -2
  3. package/dist/lib/BankAccountOnboardingWidget.d.ts +2 -2
  4. package/dist/lib/WidgetSuite.d.ts +2 -2
  5. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/labels.js +2 -2
  6. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index30.js +1 -1
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index18.js +1 -0
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index.js +6 -6
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index13.js +8 -8
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index14.js +7 -28
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index15.js +8 -160
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index16.js +20 -13
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index17.js +148 -27
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index18.js +21 -96
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index19.js +37 -79
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index20.js +98 -3
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index21.js +83 -54
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index22.js +3 -113
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index23.js +54 -184
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index24.js +108 -75
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index25.js +181 -29
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index26.js +74 -83
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js +27 -412
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index28.js +88 -12
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index29.js +413 -77
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index30.js +13 -80
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index31.js +77 -226
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +78 -41
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js +216 -234
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index34.js +44 -23
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js +233 -611
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js +25 -4
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index37.js +647 -39
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index38.js +4 -243
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index39.js +42 -3
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index40.js +250 -3
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index41.js +2 -66
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index42.js +5 -1
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index43.js +67 -0
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index44.js +1 -0
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index12.js +11 -11
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index15.js +47 -47
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/lib/invalidatePayableQueries/invalidatePayableQueries.js +2 -2
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/lib/invalidatePayableQueries/reconcileCancelledPaymentQueries.js +19 -19
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidgetNative/BillsTab.js +1 -1
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/data-access/dist/index4.js +15 -15
  47. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/zod.gen.js +2 -0
  48. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js +1 -0
  49. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  50. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/OnboardingShell.js +1 -1
  51. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/labels.js +2 -2
  52. package/package.json +1 -1
@@ -1,101 +1,26 @@
1
- import { formatCalendarDate as e } from "../../../../shared/util/dist/lib/formatCalendarDate.js";
2
- import { derivePayableStatus as t } from "../../../util/dist/lib/derivePayableStatus.js";
3
- import { formatBillMoney as n } from "../../../util/dist/lib/formatBillMoney.js";
4
- import { resolveLineItemAmountMinorUnits as r } from "../../../util/dist/lib/resolveLineItemAmount.js";
5
- import { resolveLineItemQuantity as i } from "../../../util/dist/lib/resolveLineItemQuantity.js";
6
- import { resolveVendor as a, resolveVendorName as o } from "../../../util/dist/lib/resolveVendor.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { hasAnyScope as e } from "../../../../shared/data-access/dist/lib/hasAnyScope.js";
6
+ import { Scope as t } from "../../../../shared/data-access/dist/lib/scopes.js";
7
+ import "../../../../shared/data-access/dist/index.js";
8
+ import { useWidgetConfig as n } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
9
+ import "../../../../shared/feature/dist/index.js";
10
+ import { isLiveScheduledPaymentRecord as r } from "../../../util/dist/lib/isLiveScheduledPaymentRecord.js";
11
+ import { usePayablePaymentRecordsQuery as i } from "../../data-access/dist/index18.js";
12
+ import "../../data-access/dist/index.js";
7
13
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index18.js
8
- function s(e) {
9
- return e.total_amount ?? e.amount_due ?? void 0;
10
- }
11
- function c(e) {
12
- return typeof e == "string" ? e : "";
13
- }
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) => n(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 = a(l), C = o(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))
29
- });
30
- let O = [
31
- {
32
- label: p.invoiceNumberRow,
33
- value: l.document_id || p.notProvided
34
- },
35
- {
36
- label: p.issueDateRow,
37
- value: w
38
- },
39
- {
40
- label: p.dueDateRow,
41
- value: T
42
- },
43
- {
44
- label: p.poNumberRow,
45
- value: c(l.purchase_order_number) || p.notProvided
46
- }
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(i(e));
49
- return {
50
- id: e.id,
51
- description: e.name ?? e.description ?? "",
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(r(e)) ?? ""
55
- };
56
- }), j = [
57
- {
58
- label: p.subtotalRow,
59
- value: l.subtotal
60
- },
61
- {
62
- label: p.discountsRow,
63
- value: l.discount
64
- },
65
- {
66
- label: p.taxRow,
67
- value: l.tax_amount
68
- }
69
- ].map(({ label: e, value: t }) => ({
70
- label: e,
71
- value: b(t)
72
- })).filter((e) => !!e.value), M = b(s(l));
73
- M && j.push({
74
- label: p.totalRow,
75
- value: M,
76
- emphasis: !0
77
- });
78
- let N = u(l);
14
+ function a({ payableId: a, scheduledPaymentDate: o, enabled: s = !0 }) {
15
+ let { initResponse: c } = n(), l = e(c?.scopes, [t.PaymentRecordReadOrg]), u = i(s ? a : void 0, { enabled: s && l }), d = u.paymentRecords.find(r), f = !!d || !!o, p = d?.planned_payment_date ?? (f ? o : void 0);
79
16
  return {
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
17
+ hasScheduledPayment: f,
18
+ paymentRecords: u.paymentRecords,
19
+ isError: u.isError,
20
+ isResolving: u.isResolving,
21
+ scheduledDate: p ?? void 0,
22
+ scheduledPaymentIntentId: d?.payment_intent_id ?? void 0
95
23
  };
96
24
  }
97
- function u(t) {
98
- return t.status === "paid" && t.paid_at ? e(t.paid_at.slice(0, 10)) : void 0;
99
- }
100
25
  //#endregion
101
- export { u as getPaidAtLabel, l as mapPayableToBillDetails, s as resolveInvoiceTotalMinorUnits };
26
+ export { a as useScheduledPayment };
@@ -1,86 +1,44 @@
1
- import { formatCalendarDate as e } from "../../../../shared/util/dist/lib/formatCalendarDate.js";
2
- import { derivePayableStatus as t } from "../../../util/dist/lib/derivePayableStatus.js";
3
- import { formatBillMoney as n } from "../../../util/dist/lib/formatBillMoney.js";
4
- import { resolveAmountDueMinorUnits as r } from "../../../util/dist/lib/resolveAmountDue.js";
5
- import { resolveLineItemAmountMinorUnits as i } from "../../../util/dist/lib/resolveLineItemAmount.js";
6
- import { resolveLineItemQuantity as a } from "../../../util/dist/lib/resolveLineItemQuantity.js";
7
- import { resolveVendor as o } from "../../../util/dist/lib/resolveVendor.js";
8
- import { getPaidAtLabel as s, resolveInvoiceTotalMinorUnits as c } from "./index18.js";
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/index10.js";
13
+ import "../../data-access/dist/index.js";
14
+ import { useState as a } from "react";
9
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index19.js
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 = o(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
- {
18
- label: g.subtotalRow,
19
- minorUnits: l.subtotal
20
- },
21
- {
22
- label: g.discountRow,
23
- minorUnits: l.discount
24
- },
25
- {
26
- label: g.taxRow,
27
- minorUnits: l.tax_amount
28
- }
29
- ].map((e) => ({
30
- label: e.label,
31
- value: n(e.minorUnits, x)
32
- })).filter((e) => !!e.value), j = n(c(l), x);
33
- j && A.push({
34
- label: g.totalRow,
35
- value: j,
36
- emphasis: !0
37
- });
38
- let M = s(l);
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;
39
23
  return {
40
- amountDue: n(r(l), x) ?? "",
41
- amountPaid: M ? n(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
- payTo: {
49
- name: C?.name || g.notProvided,
50
- email: C?.email ?? "",
51
- methodLabel: E ? g.paymentInstructionsValue(T?.slice(-4) ?? "") : g.paymentInstructionsNotSet,
52
- hasPaymentInstructions: E
53
- },
54
- invoiceFields: [
55
- {
56
- label: g.invoiceDateRow,
57
- value: D
58
- },
59
- {
60
- label: g.dueDateRow,
61
- value: O
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);
62
31
  },
63
- {
64
- label: g.invoiceNumberRow,
65
- value: l.document_id || g.notProvided
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
+ });
66
39
  }
67
- ],
68
- lineItems: u.map((e) => {
69
- let t = n(e.unit_price, x), r = String(a(e));
70
- return {
71
- id: e.id,
72
- description: e.name ?? e.description ?? "",
73
- glCodeLabel: e.ledger_account_id ? k.get(e.ledger_account_id) ?? (f ? g.glCodeMissing : g.glCodeUnavailable) : g.glCodeMissing,
74
- qtyPriceLabel: t ? g.qtyPriceValue(r, t) : g.qtyOnlyValue(r),
75
- amount: n(i(e), x) ?? ""
76
- };
77
- }),
78
- amountRows: A,
79
- approvalPolicy: h,
80
- paymentHistory: m,
81
- history: p,
82
- rejection: v
40
+ }
83
41
  };
84
42
  }
85
43
  //#endregion
86
- export { l as buildBillDetailView };
44
+ export { o as useDraftDelete };
@@ -1,6 +1,101 @@
1
+ import { formatCalendarDate as e } from "../../../../shared/util/dist/lib/formatCalendarDate.js";
2
+ import { derivePayableStatus as t } from "../../../util/dist/lib/derivePayableStatus.js";
3
+ import { formatBillMoney as n } from "../../../util/dist/lib/formatBillMoney.js";
4
+ import { resolveLineItemAmountMinorUnits as r } from "../../../util/dist/lib/resolveLineItemAmount.js";
5
+ import { resolveLineItemQuantity as i } from "../../../util/dist/lib/resolveLineItemQuantity.js";
6
+ import { resolveVendor as a, resolveVendorName as o } from "../../../util/dist/lib/resolveVendor.js";
1
7
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index20.js
2
- function e({ isUnsavedPromptOpen: e, isLocked: t, isDirty: n }) {
3
- return e ? "dismiss-prompt" : !t && n ? "prompt" : "close";
8
+ function s(e) {
9
+ return e.total_amount ?? e.amount_due ?? void 0;
10
+ }
11
+ function c(e) {
12
+ return typeof e == "string" ? e : "";
13
+ }
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) => n(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 = a(l), C = o(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))
29
+ });
30
+ let O = [
31
+ {
32
+ label: p.invoiceNumberRow,
33
+ value: l.document_id || p.notProvided
34
+ },
35
+ {
36
+ label: p.issueDateRow,
37
+ value: w
38
+ },
39
+ {
40
+ label: p.dueDateRow,
41
+ value: T
42
+ },
43
+ {
44
+ label: p.poNumberRow,
45
+ value: c(l.purchase_order_number) || p.notProvided
46
+ }
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(i(e));
49
+ return {
50
+ id: e.id,
51
+ description: e.name ?? e.description ?? "",
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(r(e)) ?? ""
55
+ };
56
+ }), j = [
57
+ {
58
+ label: p.subtotalRow,
59
+ value: l.subtotal
60
+ },
61
+ {
62
+ label: p.discountsRow,
63
+ value: l.discount
64
+ },
65
+ {
66
+ label: p.taxRow,
67
+ value: l.tax_amount
68
+ }
69
+ ].map(({ label: e, value: t }) => ({
70
+ label: e,
71
+ value: b(t)
72
+ })).filter((e) => !!e.value), M = b(s(l));
73
+ M && j.push({
74
+ label: p.totalRow,
75
+ value: M,
76
+ emphasis: !0
77
+ });
78
+ let N = u(l);
79
+ return {
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
95
+ };
96
+ }
97
+ function u(t) {
98
+ return t.status === "paid" && t.paid_at ? e(t.paid_at.slice(0, 10)) : void 0;
4
99
  }
5
100
  //#endregion
6
- export { e as resolveEditorDismissal };
101
+ export { u as getPaidAtLabel, l as mapPayableToBillDetails, s as resolveInvoiceTotalMinorUnits };
@@ -1,57 +1,86 @@
1
1
  import { formatCalendarDate as e } from "../../../../shared/util/dist/lib/formatCalendarDate.js";
2
- import { formatBillMoney as t } from "../../../util/dist/lib/formatBillMoney.js";
2
+ import { derivePayableStatus as t } from "../../../util/dist/lib/derivePayableStatus.js";
3
+ import { formatBillMoney as n } from "../../../util/dist/lib/formatBillMoney.js";
4
+ import { resolveAmountDueMinorUnits as r } from "../../../util/dist/lib/resolveAmountDue.js";
5
+ import { resolveLineItemAmountMinorUnits as i } from "../../../util/dist/lib/resolveLineItemAmount.js";
6
+ import { resolveLineItemQuantity as a } from "../../../util/dist/lib/resolveLineItemQuantity.js";
7
+ import { resolveVendor as o } from "../../../util/dist/lib/resolveVendor.js";
8
+ import { getPaidAtLabel as s, resolveInvoiceTotalMinorUnits as c } from "./index20.js";
3
9
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index21.js
4
- var n = {
5
- dateLabel: (e) => new Date(e).toLocaleDateString("en-US", {
6
- month: "short",
7
- day: "numeric",
8
- year: "numeric"
9
- }),
10
- timeLabel: (e) => new Date(e).toLocaleTimeString(void 0, {
11
- hour: "numeric",
12
- minute: "2-digit",
13
- timeZoneName: "short"
14
- }),
15
- byActor: (e, t) => `${e} by ${t}`,
16
- formatAmount: (e) => t(e) ?? "",
17
- billCreated: "Bill created",
18
- createdManually: "Data entered manually",
19
- createdFromUpload: "File uploaded and scanned automatically",
20
- billCreatedByEmail: "Bill created by email",
21
- sentFrom: (e) => `Sent from ${e}`,
22
- billDetailsUpdated: "Bill details updated",
23
- filledInFromFile: "Filled in from the attached file",
24
- submittedForReview: "Finalized and submitted for review",
25
- approvalRequested: "Approval requested",
26
- approved: "Approved",
27
- approvedAutomatically: "Auto-approved",
28
- rejected: "Rejected",
29
- policyOverrideApproved: "Policy override: Approved",
30
- policyOverrideRejected: "Policy override: Rejected",
31
- quotedReason: (e) => `"${e}"`,
32
- cancelled: "Cancelled",
33
- reopened: "Re-opened",
34
- paymentReleased: "Payment released",
35
- paid: (e) => `Paid ${e}`,
36
- paymentReverted: "Payment reverted",
37
- calendarDateLabel: (t) => e(t),
38
- paymentScheduled: "Payment scheduled",
39
- scheduledFor: (e) => `Scheduled for ${e}`,
40
- scheduledPaymentCancelled: "Scheduled payment cancelled",
41
- cancelledAsBillChanged: "The bill was changed",
42
- cancelledAsBillDeleted: "The bill was deleted",
43
- paymentFailed: "Payment failed",
44
- billMarkedAsFullyPaid: "Bill marked as fully paid",
45
- billMarkedAsPartiallyPaid: "Bill marked as partially paid",
46
- draftDeleted: "Draft deleted",
47
- fileAttached: "File attached",
48
- fileRemoved: "File removed",
49
- creditNoteLinked: "Credit note linked",
50
- creditNoteUnlinked: "Credit note unlinked",
51
- lineItemsUpdated: "Line items updated",
52
- lineItemAdded: "Line item added",
53
- lineItemUpdated: "Line item updated",
54
- lineItemRemoved: "Line item removed"
55
- };
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 = o(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
+ {
18
+ label: g.subtotalRow,
19
+ minorUnits: l.subtotal
20
+ },
21
+ {
22
+ label: g.discountRow,
23
+ minorUnits: l.discount
24
+ },
25
+ {
26
+ label: g.taxRow,
27
+ minorUnits: l.tax_amount
28
+ }
29
+ ].map((e) => ({
30
+ label: e.label,
31
+ value: n(e.minorUnits, x)
32
+ })).filter((e) => !!e.value), j = n(c(l), x);
33
+ j && A.push({
34
+ label: g.totalRow,
35
+ value: j,
36
+ emphasis: !0
37
+ });
38
+ let M = s(l);
39
+ return {
40
+ amountDue: n(r(l), x) ?? "",
41
+ amountPaid: M ? n(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
+ payTo: {
49
+ name: C?.name || g.notProvided,
50
+ email: C?.email ?? "",
51
+ methodLabel: E ? g.paymentInstructionsValue(T?.slice(-4) ?? "") : g.paymentInstructionsNotSet,
52
+ hasPaymentInstructions: E
53
+ },
54
+ invoiceFields: [
55
+ {
56
+ label: g.invoiceDateRow,
57
+ value: D
58
+ },
59
+ {
60
+ label: g.dueDateRow,
61
+ value: O
62
+ },
63
+ {
64
+ label: g.invoiceNumberRow,
65
+ value: l.document_id || g.notProvided
66
+ }
67
+ ],
68
+ lineItems: u.map((e) => {
69
+ let t = n(e.unit_price, x), r = String(a(e));
70
+ return {
71
+ id: e.id,
72
+ description: e.name ?? e.description ?? "",
73
+ glCodeLabel: e.ledger_account_id ? k.get(e.ledger_account_id) ?? (f ? g.glCodeMissing : g.glCodeUnavailable) : g.glCodeMissing,
74
+ qtyPriceLabel: t ? g.qtyPriceValue(r, t) : g.qtyOnlyValue(r),
75
+ amount: n(i(e), x) ?? ""
76
+ };
77
+ }),
78
+ amountRows: A,
79
+ approvalPolicy: h,
80
+ paymentHistory: m,
81
+ history: p,
82
+ rejection: v
83
+ };
84
+ }
56
85
  //#endregion
57
- export { n as PAYABLE_AUDIT_HISTORY_LABELS_EN };
86
+ export { l as buildBillDetailView };