@tesouro/embedded-components-react 0.2.327 → 0.2.328

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 (133) hide show
  1. package/dist/index.css +3 -0
  2. package/dist/index.d.ts +59 -59
  3. package/dist/index.js +1 -1
  4. package/dist/lib/BillPayWidget.js +1 -1
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +10 -10
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +119 -33
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index4.js +50 -21
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index5.js +39 -17
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index8.js +1 -1
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index9.js +17 -12
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +10 -10
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +2 -2
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +45 -17
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +4 -21
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +9 -24
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +42 -9
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +25 -50
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +49 -5
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +91 -63
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +20 -49
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +52 -7
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +5 -35
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +67 -113
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +46 -53
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +80 -205
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +32 -192
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +117 -62
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +54 -45
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +205 -31
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +184 -143
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +63 -33
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +46 -100
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +32 -7
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +146 -182
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +38 -4
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +102 -24
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +10 -80
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +200 -78
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +2 -1
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +27 -2
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +78 -41
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +132 -1
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +3 -53
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +2 -9
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +43 -16
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +1 -8
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +50 -77
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +8 -145
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +18 -5
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +6 -6
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +78 -7
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +138 -75
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +2 -0
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +6 -6
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +7 -113
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +85 -1
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +2 -24
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +8 -0
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +115 -0
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +1 -0
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +25 -0
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +2 -2
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +33 -25
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index12.js +13 -12
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +58 -13
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index14.js +2 -24
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index15.js +22 -2
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +23 -31
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index17.js +1 -262
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +15 -2
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index19.js +23 -6
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index20.js +2 -49
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +41 -1
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +271 -20
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index23.js +2 -286
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +9 -2
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +47 -14
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +2 -120
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +22 -2
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +284 -8
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index29.js +2 -96
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index30.js +16 -2
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index31.js +118 -11
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index32.js +1 -57
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index33.js +10 -2
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index34.js +93 -51
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index35.js +1 -138
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index36.js +12 -1
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index37.js +56 -5
  90. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index38.js +2 -44
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index39.js +53 -1
  92. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index40.js +137 -2
  93. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index41.js +2 -16
  94. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index42.js +7 -2
  95. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index43.js +42 -59
  96. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index44.js +2 -238
  97. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index45.js +2 -202
  98. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +61 -8
  99. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index47.js +2 -8
  100. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index48.js +2 -91
  101. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index49.js +16 -0
  102. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +1 -1
  103. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index51.js +67 -4
  104. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index52.js +248 -25
  105. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index53.js +204 -2
  106. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index54.js +6 -3
  107. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index55.js +6 -32
  108. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index56.js +93 -2
  109. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index58.js +1 -105
  110. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index59.js +7 -2
  111. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +28 -16
  112. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index61.js +2 -10
  113. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index62.js +4 -167
  114. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index63.js +34 -2
  115. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index64.js +2 -14
  116. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index65.js +10 -87
  117. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index66.js +105 -1
  118. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index67.js +2 -0
  119. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index68.js +18 -0
  120. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index69.js +10 -0
  121. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index70.js +170 -0
  122. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index71.js +2 -0
  123. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index72.js +14 -0
  124. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +89 -0
  125. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +2 -0
  126. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/data-access/dist/lib/approvalPoliciesApi.js +20 -20
  127. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/index.js +4 -4
  128. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +21 -21
  129. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +142 -102
  130. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  131. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js +1 -1
  132. package/package.json +1 -1
  133. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index57.js +0 -12
@@ -1,52 +1,23 @@
1
- import { BILL_STATUS_BADGE_LABELS_EN as e } from "../../ui/dist/index13.js";
2
- import "../../ui/dist/index.js";
3
- import { derivePayableStatus as t } from "./index16.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 { formatCalendarDate as n } from "../../../shared/util/dist/lib/formatCalendarDate.js";
9
+ import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
+ import "../../../shared/feature/dist/index.js";
11
+ import { usePayablePaymentRecordsQuery as i } from "../../data-access/dist/index8.js";
12
+ import "../../data-access/dist/index.js";
4
13
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.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;
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 = t({ apiStatus: n }).status;
33
- return i.statusChanged(e[a] ?? e.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);
14
+ function a({ payableId: a, scheduledPaymentDate: o, enabled: s = !0 }) {
15
+ let { initResponse: c } = r(), l = e(c?.scopes, [t.PaymentRecordReadOrg]), u = i(s ? a : void 0, { enabled: s && l }), d = u.paymentRecords.find((e) => e.status === "created" || e.status === "processing"), f = d?.planned_payment_date ?? o;
16
+ return {
17
+ hasScheduledPayment: !!o || !!d,
18
+ isResolving: u.isResolving,
19
+ scheduledDateLabel: f ? n(f) : void 0
20
+ };
50
21
  }
51
22
  //#endregion
52
- export { i as buildBillHistory };
23
+ export { a as useScheduledPayment };
@@ -1,9 +1,54 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js
2
- var e = {
3
- payBill: "Pay bill",
4
- markAsPaid: "Mark as paid",
5
- reject: "Reject",
6
- actionError: "Couldn't update this bill. Try again."
7
- }, t = (e) => `Payment scheduled for ${e}`;
2
+ var e = /* @__PURE__ */ new Set([
3
+ "new",
4
+ "approve_in_progress",
5
+ "waiting_to_be_paid",
6
+ "partially_paid"
7
+ ]);
8
+ function t(e, t) {
9
+ let n = /* @__PURE__ */ new Date(`${e.slice(0, 10)}T00:00:00Z`), r = Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate());
10
+ return n.getTime() < r;
11
+ }
12
+ function n({ apiStatus: n, dueDate: r, scheduledPaymentDate: i, now: a = /* @__PURE__ */ new Date() }) {
13
+ if (e.has(n) && i) return {
14
+ status: "scheduled",
15
+ tone: "accent"
16
+ };
17
+ if (e.has(n) && r && t(r, a)) return {
18
+ status: "overdue",
19
+ tone: "danger"
20
+ };
21
+ switch (n) {
22
+ case "draft": return {
23
+ status: "draft",
24
+ tone: "neutral"
25
+ };
26
+ case "new":
27
+ case "approve_in_progress": return {
28
+ status: "pending_approval",
29
+ tone: "warning"
30
+ };
31
+ case "waiting_to_be_paid": return {
32
+ status: "ready_to_pay",
33
+ tone: "info"
34
+ };
35
+ case "partially_paid": return {
36
+ status: "partially_paid",
37
+ tone: "success"
38
+ };
39
+ case "paid": return {
40
+ status: "paid",
41
+ tone: "success"
42
+ };
43
+ case "canceled": return {
44
+ status: "canceled",
45
+ tone: "muted"
46
+ };
47
+ case "rejected": return {
48
+ status: "rejected",
49
+ tone: "danger"
50
+ };
51
+ }
52
+ }
8
53
  //#endregion
9
- export { e as BILL_DETAIL_ACTIONS_LABELS_EN, t as SCHEDULED_SUMMARY_LABEL_EN };
54
+ export { n as derivePayableStatus };
@@ -1,38 +1,8 @@
1
- import { jsx as e, jsxs as t } from "react/jsx-runtime";
1
+ import { formatMoneyExact as e } from "../../../shared/util/dist/lib/formatMoneyExact.js";
2
+ import "../../data-access/dist/index.js";
2
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js
3
- var n = {
4
- previewUnavailable: "Preview not available for this file type.",
5
- openFile: "Open file"
6
- };
7
- function r(r, i = {}) {
8
- if (r.mimetype === "application/pdf") return /* @__PURE__ */ e("iframe", {
9
- src: `${r.url}#toolbar=0&navpanes=0`,
10
- title: r.name,
11
- referrerPolicy: "no-referrer",
12
- className: "ttw:h-full ttw:w-full ttw:border-0"
13
- });
14
- if (r.mimetype.startsWith("image/")) return /* @__PURE__ */ e("img", {
15
- src: r.url,
16
- alt: r.name,
17
- className: "ttw:max-h-full ttw:max-w-full ttw:object-contain"
18
- });
19
- let a = {
20
- ...n,
21
- ...i
22
- };
23
- return /* @__PURE__ */ t("div", {
24
- className: "ttw:flex ttw:h-full ttw:w-full ttw:flex-col ttw:items-center ttw:justify-center ttw:gap-2 ttw:p-4 ttw:text-center",
25
- children: [/* @__PURE__ */ e("p", {
26
- className: "ttw:text-sm ttw:text-muted-foreground",
27
- children: a.previewUnavailable
28
- }), /* @__PURE__ */ e("a", {
29
- href: r.url,
30
- target: "_blank",
31
- rel: "noreferrer",
32
- className: "ttw:text-sm ttw:font-medium ttw:text-primary ttw:underline ttw:underline-offset-2",
33
- children: a.openFile
34
- })]
35
- });
4
+ function t(t, n) {
5
+ if (typeof t == "number") return e(t / 100, { currencyCode: n ?? "USD" });
36
6
  }
37
7
  //#endregion
38
- export { n as SOURCE_DOCUMENT_PREVIEW_LABELS_EN, r as createSourceDocumentPreview };
8
+ export { t as formatBillMoney };
@@ -1,120 +1,74 @@
1
- import { PAY_BILL_FLOW_LABELS_EN as e, mergePayBillFlowLabels as t } from "./index7.js";
2
- import { BILL_DETAIL_ACTIONS_LABELS_EN as n, SCHEDULED_SUMMARY_LABEL_EN as r } from "./index20.js";
3
- import { SOURCE_DOCUMENT_PREVIEW_LABELS_EN as i } from "./index21.js";
1
+ import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
2
+ import { resolveAmountDueMinorUnits as t } from "./index2.js";
3
+ import { resolveVendor as n } from "./index3.js";
4
+ import { derivePayableStatus as r } from "./index20.js";
5
+ import { formatBillMoney as i } from "./index21.js";
4
6
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js
5
- var a = {
6
- unmappedValidationError: (e, t) => `${e}: ${t}`,
7
- unknownValidationField: "(unknown field)",
8
- requiredField: "This field is required.",
9
- saveFailed: "We could not save this bill. Try again.",
10
- finalizeFailed: "We could not submit this bill. Try again.",
11
- draftSaved: "Bill saved as a draft.",
12
- billFinalized: "Bill submitted for approval.",
13
- unreadableMoney: "Enter a valid amount.",
14
- unusableQuantity: "Enter a quantity greater than 0.",
15
- lineItemsNeedAttention: "Check the highlighted line items before saving.",
16
- totalsNeedAttention: "Enter valid amounts for discount, tax, and total."
17
- }, o = {
18
- achMethod: "via ACH bank transfer",
19
- noMethod: "No payment method on file",
20
- accountHolder: "Account holder",
21
- routingNumber: "Routing number",
22
- accountNumber: "Account number",
23
- paymentMethodLoading: "Loading payment method...",
24
- paymentMethodUnavailable: "We could not load payment methods. Try again.",
25
- searchFailed: "We could not load vendors. Try again.",
26
- vendorDetailsFailed: "We could not load this vendor. Try again."
27
- }, s = {
28
- attachFailed: "We could not attach that file. Try again.",
29
- saveBeforeAttaching: "Save this bill before attaching a document.",
30
- noDocument: "No document attached to this bill.",
31
- preview: i
32
- }, c = {
33
- notProvided: "Not provided",
34
- paymentInstructionsValue: (e) => `Account ending in ${e}`,
35
- invoiceDateRow: "Invoice date",
36
- dueDateRow: "Due date",
37
- invoiceNumberRow: "Invoice number",
38
- glCodeMissing: "GL code not specified",
39
- qtyPriceValue: (e, t) => `${e} x ${t}`,
40
- subtotalRow: "Subtotal",
41
- taxRow: "Tax",
42
- discountRow: "Discounts",
43
- totalRow: "Total",
44
- paymentInstructionsSaveError: "Couldn't save payment instructions. Try again."
45
- }, l = {
46
- dateLabel: (e) => new Date(e).toLocaleString("en-US", {
47
- month: "short",
48
- day: "numeric",
49
- year: "numeric",
50
- hour: "numeric",
51
- minute: "2-digit"
52
- }),
53
- byActor: (e, t) => `${e} by ${t}`,
54
- billAdded: "Bill added",
55
- billUploaded: "Bill uploaded",
56
- billUpdated: "Bill updated",
57
- attachmentAdded: "Attachment added",
58
- submittedForApproval: "Submitted for approval",
59
- approvalRequested: "Approval requested",
60
- approved: "Approved",
61
- autoApproved: "Approved automatically",
62
- rejected: "Rejected",
63
- rejectedWithReason: (e) => `Rejected: ${e}`,
64
- reopened: "Reopened",
65
- markedAsPaid: "Marked as paid",
66
- markedAsPartiallyPaid: "Marked as partially paid",
67
- paymentReverted: "Payment reverted",
68
- statusChanged: (e) => `Status changed to ${e}`
69
- }, u = {
70
- newTitle: "New bill",
71
- extractedTitle: (e) => `Bill from ${e}`,
72
- viewTitle: (e) => `Bill from ${e}`,
73
- readOnlyTitle: "Bill details",
74
- addedOn: (e) => `Added on ${e}`,
75
- discardConfirm: "Discard your changes to this bill?",
76
- scheduledSummary: r,
77
- actions: n,
78
- detail: c,
79
- history: l,
80
- payBill: e
81
- };
82
- function d(e) {
83
- return {
84
- ...u,
85
- ...e,
86
- actions: {
87
- ...u.actions,
88
- ...e?.actions
7
+ function a({ payable: a, lineItems: o, glCodeOptions: s, history: c, approvalPolicy: l, labels: u }) {
8
+ let d = a.currency, f = r({
9
+ apiStatus: a.status,
10
+ dueDate: a.due_date,
11
+ scheduledPaymentDate: a.scheduled_payment_date
12
+ }), p = n(a), m = p?.bank_account?.account_number, h = e(a.issued_at) || u.notProvided, g = e(a.due_date) || u.notProvided, _ = new Map(s.map((e) => [e.value, e.label])), v = [
13
+ {
14
+ label: u.subtotalRow,
15
+ minorUnits: a.subtotal
89
16
  },
90
- detail: {
91
- ...u.detail,
92
- ...e?.detail
17
+ {
18
+ label: u.discountRow,
19
+ minorUnits: a.discount
93
20
  },
94
- history: {
95
- ...u.history,
96
- ...e?.history
21
+ {
22
+ label: u.taxRow,
23
+ minorUnits: a.tax_amount
24
+ }
25
+ ].map((e) => ({
26
+ label: e.label,
27
+ value: i(e.minorUnits, d)
28
+ })).filter((e) => !!e.value), y = i(a.total_amount, d);
29
+ return y && v.push({
30
+ label: u.totalRow,
31
+ value: y,
32
+ emphasis: !0
33
+ }), {
34
+ amountDue: i(t(a), d) ?? "",
35
+ invoiceDateLabel: h,
36
+ dueDateLabel: g,
37
+ status: f.status,
38
+ statusTone: f.tone,
39
+ payTo: {
40
+ name: p?.name || u.notProvided,
41
+ email: p?.email ?? void 0,
42
+ paymentInstructionsLabel: m ? u.paymentInstructionsValue(m.slice(-4)) : void 0
97
43
  },
98
- payBill: t(e?.payBill)
44
+ invoiceFields: [
45
+ {
46
+ label: u.invoiceDateRow,
47
+ value: h
48
+ },
49
+ {
50
+ label: u.dueDateRow,
51
+ value: g
52
+ },
53
+ {
54
+ label: u.invoiceNumberRow,
55
+ value: a.document_id || u.notProvided
56
+ }
57
+ ],
58
+ lineItems: o.map((e) => {
59
+ let t = i(e.unit_price, d);
60
+ return {
61
+ id: e.id,
62
+ description: e.name ?? e.description ?? "",
63
+ glCodeLabel: (e.ledger_account_id ? _.get(e.ledger_account_id) : void 0) || u.glCodeMissing,
64
+ qtyPriceLabel: e.quantity != null && t ? u.qtyPriceValue(String(e.quantity), t) : "",
65
+ amount: i(e.subtotal, d) ?? ""
66
+ };
67
+ }),
68
+ amountRows: v,
69
+ approvalPolicy: l,
70
+ history: c
99
71
  };
100
72
  }
101
- var f = {
102
- createTitle: "New vendor",
103
- editTitle: "Edit vendor",
104
- close: "Close the vendor form",
105
- nameLabel: "Name",
106
- addAddress: "Add address (optional)",
107
- paymentMethodsHeading: "Accepted payment methods",
108
- paymentMethodsDescription: "How and where will the money be sent. Don't have these yet? No problem. You can save this vendor and add their payment details later — you just won't be able to send payments until you do.",
109
- achTitle: "ACH bank transfer",
110
- achDescription: "Fast, direct deposit to the vendor's bank. Arrives in 1–3 business days.",
111
- addBankAccount: "Add bank account",
112
- accountHolderNameLabel: "Account holder name",
113
- routingNumberLabel: "Routing number",
114
- accountNumberLabel: "Account number",
115
- achHelp: "Ask your vendor for this — it's usually on their invoice, W-9, or a payment instructions email they send you.",
116
- cancel: "Cancel",
117
- save: "Save vendor"
118
- };
119
73
  //#endregion
120
- export { a as BILL_CREATE_MESSAGE_LABELS_EN, u as BILL_CREATE_SCREEN_LABELS_EN, c as BILL_DETAIL_VIEW_LABELS_EN, l as BILL_HISTORY_LABELS_EN, s as SOURCE_DOCUMENT_CONTAINER_LABELS_EN, f as VENDOR_INLINE_FORM_LABELS_EN, o as VENDOR_SECTION_PROPS_LABELS_EN, d as mergeBillCreateScreenCopy };
74
+ export { a as buildBillDetailView };
@@ -1,59 +1,52 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { SourceDocumentPanel as e } from "../../ui/dist/index65.js";
1
+ import { BILL_STATUS_BADGE_LABELS_EN as e } from "../../ui/dist/index18.js";
6
2
  import "../../ui/dist/index.js";
7
- import { useAttachPayableFileMutation as t, useDeletePayableFileMutation as n } from "../../data-access/dist/index10.js";
8
- import "../../data-access/dist/index.js";
9
- import { createSourceDocumentPreview as r } from "./index21.js";
10
- import { SOURCE_DOCUMENT_CONTAINER_LABELS_EN as i } from "./index22.js";
11
- import { jsx as a } from "react/jsx-runtime";
3
+ import { derivePayableStatus as t } from "./index20.js";
12
4
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js
13
- function o({ payableId: o, file: s, isDocumentPending: c, pendingFileName: l, readOnly: u, labels: d }) {
14
- let f = {
15
- ...i,
16
- ...d,
17
- preview: {
18
- ...i.preview,
19
- ...d?.preview
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;
20
23
  }
21
- }, p = t(), m = n();
22
- if (!s && (c || p.isPending)) return /* @__PURE__ */ a(e, {
23
- mode: "loading",
24
- fileName: l
25
- });
26
- if (!s && u) return /* @__PURE__ */ a("div", {
27
- className: "ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4 ttw:text-sm ttw:text-muted-foreground",
28
- children: f.noDocument
29
- });
30
- if (!s && !o) return /* @__PURE__ */ a("div", {
31
- className: "ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4 ttw:text-sm ttw:text-muted-foreground",
32
- children: f.saveBeforeAttaching
33
- });
34
- if (!s) return /* @__PURE__ */ a(e, {
35
- mode: "upload",
36
- uploadStatus: p.isPending ? "uploading" : "idle",
37
- uploadErrorMessage: p.isError ? f.attachFailed : void 0,
38
- onFilesSelected: (e) => {
39
- let [t] = e;
40
- !t || !o || p.mutate({
41
- path: { payable_id: o },
42
- file: t
43
- });
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 = t({ apiStatus: n }).status;
33
+ return i.statusChanged(e[a] ?? e.unknown);
44
34
  }
45
- });
46
- let h = r(s, f.preview);
47
- return /* @__PURE__ */ a(e, {
48
- mode: "document",
49
- fileName: s.name,
50
- preview: h,
51
- onDownload: () => window.open(s.url, "_blank", "noopener,noreferrer"),
52
- onDelete: o && !u ? () => m.mutate({
53
- path: { file_id: s.id },
54
- payableId: o
55
- }) : void 0
56
- });
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);
57
50
  }
58
51
  //#endregion
59
- export { o as SourceDocumentContainer, o as default };
52
+ export { i as buildBillHistory };