@tesouro/embedded-components-react 0.2.318 → 0.2.319

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 (135) hide show
  1. package/README.md +5 -4
  2. package/dist/index.css +9 -0
  3. package/dist/index.d.ts +4 -1
  4. package/dist/index.js +1 -1
  5. package/dist/lib/BillPayWidget.d.ts +4 -1
  6. package/dist/lib/BillPayWidget.js +1 -1
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +10 -7
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +170 -32
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index11.js +13 -32
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index12.js +30 -0
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index13.js +50 -0
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index14.js +36 -0
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index3.js +11 -8
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index4.js +33 -16
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index5.js +47 -2
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index6.js +18 -63
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js +40 -131
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index8.js +48 -11
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index9.js +30 -20
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +18 -16
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +29 -97
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +1 -9
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +13 -109
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +24 -4
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +30 -21
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +19 -46
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +49 -76
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +4 -45
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +73 -3
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +50 -2
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +4 -50
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +7 -43
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +38 -1
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +115 -31
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +56 -8
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +206 -16
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +195 -5
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +58 -64
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +46 -139
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +34 -5
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +155 -6
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +3 -60
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +36 -7
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +92 -73
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +9 -3
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +191 -6
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +4 -114
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +26 -1
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +78 -21
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +92 -0
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +3 -0
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +4 -0
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js +5 -206
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +45 -0
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +1 -0
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +53 -0
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +11 -0
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +18 -0
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +8 -0
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +79 -0
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +148 -0
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +5 -0
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +8 -0
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +3 -197
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +9 -0
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +85 -0
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +3 -0
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +8 -0
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +115 -0
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +1 -0
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +25 -0
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +30 -41
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +38 -30
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +20 -151
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +158 -31
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +29 -17
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index12.js +13 -7
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +13 -47
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index14.js +24 -2
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index15.js +2 -22
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +31 -283
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index17.js +261 -1
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +2 -16
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index19.js +7 -118
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index20.js +49 -2
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +2 -10
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +20 -94
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index23.js +286 -2
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +1 -12
  90. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +14 -56
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +120 -2
  92. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +1 -19
  93. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +8 -157
  94. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index29.js +96 -2
  95. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index30.js +2 -7
  96. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index31.js +11 -42
  97. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index32.js +57 -1
  98. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index33.js +2 -14
  99. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index34.js +50 -20
  100. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index35.js +138 -1
  101. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index36.js +1 -54
  102. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index37.js +5 -227
  103. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index38.js +37 -188
  104. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index39.js +2 -10
  105. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index40.js +55 -5
  106. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index41.js +229 -84
  107. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index42.js +195 -0
  108. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index43.js +10 -2
  109. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index44.js +4 -3
  110. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index45.js +88 -25
  111. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index47.js +2 -14
  112. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index48.js +5 -87
  113. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index49.js +30 -2
  114. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +2 -0
  115. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index51.js +7 -0
  116. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index52.js +34 -0
  117. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index53.js +2 -0
  118. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index54.js +12 -0
  119. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index55.js +106 -0
  120. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index56.js +2 -0
  121. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index57.js +18 -0
  122. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index58.js +10 -0
  123. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index59.js +170 -0
  124. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +2 -0
  125. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index61.js +14 -0
  126. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index62.js +89 -0
  127. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index63.js +2 -0
  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/@tanstack/react-query.gen.js +189 -156
  130. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +157 -97
  131. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/index.js +10 -10
  132. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  133. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js +1 -1
  134. package/package.json +1 -1
  135. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +0 -2
@@ -2,117 +2,21 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { useLedgerAccountsQuery as e } from "../../../shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js";
5
+ import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
6
+ import { useCurrentUserQuery as t } from "../../../shared/data-access/dist/lib/useCurrentUserQuery.js";
7
+ import { Scope as n } from "../../../shared/data-access/dist/lib/scopes.js";
6
8
  import "../../../shared/data-access/dist/index.js";
7
- import { BILL_CREATE_SCREEN_LABELS_EN as t } from "./index2.js";
8
- import { useAllPayableLineItemsQuery as n } from "../../data-access/dist/index6.js";
9
- import { usePayableQuery as r } from "../../data-access/dist/index10.js";
9
+ import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
+ import "../../../shared/feature/dist/index.js";
11
+ import { usePayableApprovalRequestsQuery as i } from "../../data-access/dist/index5.js";
10
12
  import "../../data-access/dist/index.js";
11
- import { useBillCreateController as i } from "./index8.js";
12
- import { useBillForm as a } from "./index10.js";
13
- import { BillCreateScreen as o } from "../../ui/dist/index28.js";
14
- import { ExtractionNotice as s } from "../../ui/dist/index45.js";
15
- import "../../ui/dist/index.js";
16
- import { SourceDocumentContainer as c } from "./index3.js";
17
- import { useVendorSectionProps as l } from "./index5.js";
18
- import { billCreateTestIds as u } from "./index11.js";
19
- import { useCallback as d, useEffect as f, useMemo as p, useState as m } from "react";
20
- import { jsx as h } from "react/jsx-runtime";
21
13
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js
22
- function g({ open: g, onOpenChange: _, payableId: v, readOnly: y, copy: b }) {
23
- let x = {
24
- ...t,
25
- ...b
26
- }, [S, C] = m(), [w, T] = m(!1), [E, D] = m(!1), [O, k] = m(), A = v ?? O, j = r(A, { pollWhileOcrProcessing: !0 }), M = n(A), N = e(), P = j.data, F = a({
27
- payable: P,
28
- lineItems: M.lineItems
29
- }), I = P?.counterpart_id;
30
- f(() => {
31
- w || I && (C(I), T(!0));
32
- }, [w, I]);
33
- let L = d((e) => {
34
- T(!0), C(e);
35
- }, []), R = l({
36
- payableId: A,
37
- counterpartId: S,
38
- payableCounterpartId: I,
39
- onCounterpartChange: L,
40
- requiredError: F.errors?.vendor
41
- }), z = i({
42
- payableId: v,
43
- form: F,
44
- counterpartId: S,
45
- clearCounterpart: !!(A && w) && !S,
46
- prepareVendorForSave: R.savePaymentInstructions,
47
- onPayableCreated: k,
48
- onSaved: k,
49
- onDraftSaved: () => _(!1),
50
- onFinalized: () => _(!1)
51
- }), B = !!(z.isSavingDraft || z.isFinalizing), V = p(() => (N.data?.data ?? []).map((e) => ({
52
- value: e.id,
53
- label: [e.nominal_code, e.name].filter(Boolean).join(" — ")
54
- })), [N.data]), H = P?.source_of_payable_data === "ocr", U = P?.counterpart_raw_data?.name, W = d(() => {
55
- let e = F.isDirty || R.hasUnsavedVendorChanges;
56
- !y && e && !window.confirm(x.discardConfirm) || _(!1);
57
- }, [
58
- x.discardConfirm,
59
- F.isDirty,
60
- _,
61
- y,
62
- R.hasUnsavedVendorChanges
63
- ]), G = d((e) => {
64
- if (!B) return e ? _(!0) : W();
65
- }, [
66
- W,
67
- B,
68
- _
69
- ]);
70
- return /* @__PURE__ */ h(o, {
71
- open: g,
72
- onOpenChange: G,
73
- title: y ? x.readOnlyTitle : H && U ? x.extractedTitle(U) : x.newTitle,
74
- notice: H && !E ? /* @__PURE__ */ h(s, { onDismiss: () => D(!0) }) : void 0,
75
- vendor: {
76
- ...R,
77
- testId: u.vendorSection
78
- },
79
- values: F.values,
80
- errors: F.errors,
81
- onChange: F.onChange,
82
- lineItems: {
83
- items: F.lineItemRows,
84
- glCodeOptions: V,
85
- discount: F.discount,
86
- onDiscountChange: F.onDiscountChange,
87
- tax: F.tax,
88
- onTaxChange: F.onTaxChange,
89
- total: F.total,
90
- onTotalChange: F.onTotalChange,
91
- onAddLineItem: F.onAddLineItem,
92
- errors: F.lineItemErrors,
93
- testId: u.lineItems
94
- },
95
- documentPanel: /* @__PURE__ */ h(c, {
96
- payableId: A,
97
- readOnly: y,
98
- isDocumentPending: !!A && !P?.file && (j.isLoading || P?.ocr_status === "processing"),
99
- file: P?.file ? {
100
- id: P.file.id,
101
- name: P.file.name,
102
- url: P.file.url,
103
- mimetype: P.file.mimetype
104
- } : void 0
105
- }),
106
- readOnly: y,
107
- isLineItemsLoading: M.isResolving,
108
- isSaving: B,
109
- isSavingDraft: z.isSavingDraft,
110
- isFinalizing: z.isFinalizing,
111
- onCancel: W,
112
- onSaveDraft: z.saveDraft,
113
- onFinalize: z.finalize,
114
- testId: u.dialog
115
- });
14
+ function a({ payableId: a, status: o }) {
15
+ let { initResponse: s } = r(), c = e(s?.scopes, [n.ApprovalRequestReadOrg]), l = o === "approve_in_progress" && c, u = i(a, { enabled: l }), d = t({ enabled: l }), f = d.data?.id, p = f ? u.data?.data.find((e) => e.status === "waiting" && (e.user_ids ?? []).includes(f) && !(e.approved_by ?? []).includes(f)) : void 0;
16
+ return {
17
+ id: e(s?.scopes, [n.ApprovalRequestUpdateOrg]) ? p?.id : void 0,
18
+ isLoading: u.isLoading || d.isLoading
19
+ };
116
20
  }
117
21
  //#endregion
118
- export { g as BillCreateDialog, g as default };
22
+ export { a as useCurrentApprovalRequestId };
@@ -1,4 +1,24 @@
1
- import "./index2.js";
2
- import "./index8.js";
3
- import "./index10.js";
4
- import "./index12.js";
1
+ import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
2
+ import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
3
+ import "../../../shared/data-access/dist/index.js";
4
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js
5
+ function n({ status: n, scopes: r, canRejectApprovalRequest: i, hasScheduledPayment: a, labels: o }) {
6
+ let s = e(r, [t.PayablePayOrg]), c = e(r, [t.BankAccountReadOrg]), l = e(r, [t.PaymentRailAch]), u = [];
7
+ n === "approve_in_progress" && i && u.push({
8
+ id: "reject",
9
+ label: o.reject,
10
+ variant: "ghost"
11
+ });
12
+ let d = (n === "waiting_to_be_paid" || n === "partially_paid") && s && !a, f = n === "waiting_to_be_paid" && s && c && l && !a;
13
+ return d && u.push({
14
+ id: "markAsPaid",
15
+ label: o.markAsPaid,
16
+ variant: "outline"
17
+ }), f && u.push({
18
+ id: "payBill",
19
+ label: o.payBill,
20
+ variant: "default"
21
+ }), u;
22
+ }
23
+ //#endregion
24
+ export { n as getBillDetailActions };
@@ -1,23 +1,32 @@
1
- import { BILL_DETAILS_SHEET_LABELS_EN as e } from "../../ui/dist/index36.js";
2
- import "../../ui/dist/index.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 "../../../shared/ui/dist/index.js";
7
+ import { useWidgetConfig as t } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
8
+ import "../../../shared/feature/dist/index.js";
9
+ import { useRejectPayableApprovalRequestMutation as n } from "../../data-access/dist/index5.js";
10
+ import { useMarkPayableAsPaidMutation as r } from "../../data-access/dist/index10.js";
11
+ import "../../data-access/dist/index.js";
12
+ import { getBillDetailActions as i } from "./index13.js";
3
13
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js
4
- var t = {
5
- subtitle: "Accounts payable",
6
- vendorRow: "Vendor",
7
- bankAccountRow: "ACH bank account",
8
- bankAccountValue: (e) => `Account ending in ${e}`,
9
- invoiceNumberRow: "Number",
10
- issueDateRow: "Issue date",
11
- dueDateRow: "Due date",
12
- poNumberRow: "PO number",
13
- notProvided: "Not provided",
14
- glCodeMissing: "GL code not specified",
15
- quantityValue: (e, t) => `${e} x ${t}`,
16
- subtotalRow: "Subtotal",
17
- discountsRow: "Discounts",
18
- taxRow: "Tax",
19
- totalRow: "Total",
20
- sheet: e
21
- };
14
+ function a({ payableId: a, status: o, currentApprovalRequestId: s, hasScheduledPayment: c, isScheduledPaymentUnknown: l, labels: u, onPayBillSelect: d }) {
15
+ let { initResponse: f } = t(), p = r(), m = n(), h = p.isPending || m.isPending;
16
+ return { actions: (a && o ? i({
17
+ status: o,
18
+ scopes: f?.scopes,
19
+ canRejectApprovalRequest: !!s,
20
+ hasScheduledPayment: c || l,
21
+ labels: u
22
+ }) : []).map((t) => ({
23
+ ...t,
24
+ disabled: h,
25
+ loading: t.id === "markAsPaid" && p.isPending || t.id === "reject" && m.isPending,
26
+ onSelect: () => {
27
+ h || !a || (t.id === "payBill" && d(), t.id === "markAsPaid" && p.mutate({ path: { payable_id: a } }, { onError: () => e.error(u.actionError) }), t.id === "reject" && s && m.mutate({ path: { approval_request_id: s } }, { onError: () => e.error(u.actionError) }));
28
+ }
29
+ })) };
30
+ }
22
31
  //#endregion
23
- export { t as BILL_DETAILS_LABELS_EN };
32
+ export { a as usePayableDetailActions };
@@ -1,50 +1,23 @@
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";
1
13
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js
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(n, r, i = /* @__PURE__ */ new Date()) {
13
- if (e.has(n) && r && t(r, i)) return {
14
- status: "overdue",
15
- tone: "danger"
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
16
20
  };
17
- switch (n) {
18
- case "draft": return {
19
- status: "draft",
20
- tone: "neutral"
21
- };
22
- case "new":
23
- case "approve_in_progress": return {
24
- status: "pending_approval",
25
- tone: "warning"
26
- };
27
- case "waiting_to_be_paid": return {
28
- status: "ready_to_pay",
29
- tone: "info"
30
- };
31
- case "partially_paid": return {
32
- status: "partially_paid",
33
- tone: "success"
34
- };
35
- case "paid": return {
36
- status: "paid",
37
- tone: "success"
38
- };
39
- case "canceled": return {
40
- status: "canceled",
41
- tone: "neutral"
42
- };
43
- case "rejected": return {
44
- status: "rejected",
45
- tone: "danger"
46
- };
47
- }
48
21
  }
49
22
  //#endregion
50
- export { n as derivePayableStatus };
23
+ export { a as useScheduledPayment };
@@ -1,81 +1,54 @@
1
- import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
2
- import { formatMoneyExact as t } from "../../../shared/util/dist/lib/formatMoneyExact.js";
3
- import "../../data-access/dist/index.js";
4
- import { derivePayableStatus as n } from "./index15.js";
5
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js
6
- function r(e, n) {
7
- if (typeof e == "number") return t(e / 100, { currencyCode: n });
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;
8
11
  }
9
- function i({ payable: t, lineItems: i, ledgerAccounts: a, labels: o }) {
10
- let s = t.currency ?? "USD", c = n(t.status, t.due_date), l = t.counterpart ?? t.counterpart_raw_data, u = l?.name ?? "", d = e(t.issued_at) || o.notProvided, f = e(t.due_date) || o.notProvided, p = [{
11
- label: o.vendorRow,
12
- value: u || o.notProvided,
13
- secondaryValue: l?.email ?? void 0
14
- }], m = l?.bank_account?.account_number;
15
- m && p.push({
16
- label: o.bankAccountRow,
17
- value: o.bankAccountValue(m.slice(-4))
18
- });
19
- let h = [
20
- {
21
- label: o.invoiceNumberRow,
22
- value: t.document_id || o.notProvided
23
- },
24
- {
25
- label: o.issueDateRow,
26
- value: d
27
- },
28
- {
29
- label: o.dueDateRow,
30
- value: f
31
- },
32
- {
33
- label: o.poNumberRow,
34
- value: o.notProvided
35
- }
36
- ], g = new Map(a.map((e) => [e.id, [e.nominal_code, e.name].filter(Boolean).join(" — ")])), _ = i.map((e) => {
37
- let t = r(e.unit_price, s);
38
- return {
39
- id: e.id,
40
- description: e.name ?? e.description ?? "",
41
- glCodeLabel: (e.ledger_account_id ? g.get(e.ledger_account_id) : void 0) || o.glCodeMissing,
42
- quantityLabel: e.quantity != null && t ? o.quantityValue(String(e.quantity), t) : "",
43
- amountLabel: r(e.subtotal, s) ?? ""
44
- };
45
- }), v = [
46
- {
47
- label: o.subtotalRow,
48
- value: t.subtotal
49
- },
50
- {
51
- label: o.discountsRow,
52
- value: t.discount
53
- },
54
- {
55
- label: o.taxRow,
56
- value: t.tax_amount
57
- }
58
- ].map(({ label: e, value: t }) => ({
59
- label: e,
60
- value: r(t, s)
61
- })).filter((e) => !!e.value), y = r(t.total_amount, s);
62
- return y && v.push({
63
- label: o.totalRow,
64
- value: y,
65
- emphasis: !0
66
- }), {
67
- title: u,
68
- subtitle: o.subtitle,
69
- status: c.status,
70
- statusTone: c.tone,
71
- amountDueLabel: r(t.amount_due, s) ?? r(t.total_amount, s) ?? "",
72
- invoiceDateLabel: d,
73
- dueDateLabel: f,
74
- payToItems: p,
75
- invoiceItems: h,
76
- lineItems: _,
77
- totals: v
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: "info"
16
+ };
17
+ if (e.has(n) && r && t(r, a)) return {
18
+ status: "overdue",
19
+ tone: "danger"
78
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: "neutral"
46
+ };
47
+ case "rejected": return {
48
+ status: "rejected",
49
+ tone: "danger"
50
+ };
51
+ }
79
52
  }
80
53
  //#endregion
81
- export { i as mapPayableToBillDetails };
54
+ export { n as derivePayableStatus };
@@ -1,49 +1,8 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { useAllLedgerAccountsQuery as e } from "../../../shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js";
6
- import "../../../shared/data-access/dist/index.js";
7
- import { useAllPayableLineItemsQuery as t } from "../../data-access/dist/index6.js";
8
- import { usePayableQuery as n } from "../../data-access/dist/index10.js";
1
+ import { formatMoneyExact as e } from "../../../shared/util/dist/lib/formatMoneyExact.js";
9
2
  import "../../data-access/dist/index.js";
10
- import { BillDetailsSheet as r } from "../../ui/dist/index37.js";
11
- import "../../ui/dist/index.js";
12
- import { BILL_DETAILS_LABELS_EN as i } from "./index14.js";
13
- import { mapPayableToBillDetails as a } from "./index16.js";
14
- import { useMemo as o } from "react";
15
- import { jsx as s } from "react/jsx-runtime";
16
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js
17
- function c({ open: c, onOpenChange: l, payableId: u, onClose: d, onExpand: f, testId: p, labels: m }) {
18
- let h = o(() => ({
19
- ...i,
20
- ...m,
21
- sheet: {
22
- ...i.sheet,
23
- ...m?.sheet
24
- }
25
- }), [m]), g = n(u), _ = t(u), v = e(), y = g.data, b = o(() => y ? a({
26
- payable: y,
27
- lineItems: _.lineItems,
28
- ledgerAccounts: v.data?.data ?? [],
29
- labels: h
30
- }) : void 0, [
31
- y,
32
- _.lineItems,
33
- v.data,
34
- h
35
- ]), x = g.isLoading || _.isResolving || v.isResolving, S = g.isError || _.isError || v.isError;
36
- return /* @__PURE__ */ s(r, {
37
- open: c,
38
- onOpenChange: l,
39
- details: b,
40
- isLoading: x,
41
- isError: S,
42
- onClose: d,
43
- onExpand: f,
44
- testId: p,
45
- labels: h.sheet
46
- });
4
+ function t(t, n) {
5
+ if (typeof t == "number") return e(t / 100, { currencyCode: n ?? "USD" });
47
6
  }
48
7
  //#endregion
49
- export { c as BillDetailsContainer, c as default };
8
+ export { t as formatBillMoney };
@@ -1,3 +1,73 @@
1
- import "./index14.js";
2
- import "./index16.js";
3
- import "./index17.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 "./index16.js";
5
+ import { formatBillMoney as i } from "./index17.js";
6
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js
7
+ function a({ payable: a, lineItems: o, glCodeOptions: s, history: c, labels: l }) {
8
+ let u = a.currency, d = r({
9
+ apiStatus: a.status,
10
+ dueDate: a.due_date,
11
+ scheduledPaymentDate: a.scheduled_payment_date
12
+ }), f = n(a), p = f?.bank_account?.account_number, m = e(a.issued_at) || l.notProvided, h = e(a.due_date) || l.notProvided, g = new Map(s.map((e) => [e.value, e.label])), _ = [
13
+ {
14
+ label: l.subtotalRow,
15
+ minorUnits: a.subtotal
16
+ },
17
+ {
18
+ label: l.discountRow,
19
+ minorUnits: a.discount
20
+ },
21
+ {
22
+ label: l.taxRow,
23
+ minorUnits: a.tax_amount
24
+ }
25
+ ].map((e) => ({
26
+ label: e.label,
27
+ value: i(e.minorUnits, u)
28
+ })).filter((e) => !!e.value), v = i(a.total_amount, u);
29
+ return v && _.push({
30
+ label: l.totalRow,
31
+ value: v,
32
+ emphasis: !0
33
+ }), {
34
+ amountDue: i(t(a), u) ?? "",
35
+ invoiceDateLabel: m,
36
+ dueDateLabel: h,
37
+ status: d.status,
38
+ statusTone: d.tone,
39
+ payTo: {
40
+ name: f?.name || l.notProvided,
41
+ email: f?.email ?? void 0,
42
+ paymentInstructionsLabel: p ? l.paymentInstructionsValue(p.slice(-4)) : void 0
43
+ },
44
+ invoiceFields: [
45
+ {
46
+ label: l.invoiceDateRow,
47
+ value: m
48
+ },
49
+ {
50
+ label: l.dueDateRow,
51
+ value: h
52
+ },
53
+ {
54
+ label: l.invoiceNumberRow,
55
+ value: a.document_id || l.notProvided
56
+ }
57
+ ],
58
+ lineItems: o.map((e) => {
59
+ let t = i(e.unit_price, u);
60
+ return {
61
+ id: e.id,
62
+ description: e.name ?? e.description ?? "",
63
+ glCodeLabel: (e.ledger_account_id ? g.get(e.ledger_account_id) : void 0) || l.glCodeMissing,
64
+ qtyPriceLabel: e.quantity != null && t ? l.qtyPriceValue(String(e.quantity), t) : "",
65
+ amount: i(e.subtotal, u) ?? ""
66
+ };
67
+ }),
68
+ amountRows: _,
69
+ history: c
70
+ };
71
+ }
72
+ //#endregion
73
+ export { a as buildBillDetailView };
@@ -1,4 +1,52 @@
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
4
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js
2
- var e = { Mounted: "bill_pay_widget.mounted" }, t = "bill_pay_widget";
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);
50
+ }
3
51
  //#endregion
4
- export { e as BillPayWidgetAnalyticsEvent, t as WIDGET_NAME };
52
+ export { i as buildBillHistory };
@@ -1,52 +1,6 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js
2
- var e = {
3
- unmappedValidationError: (e, t) => `${e}: ${t}`,
4
- unknownValidationField: "(unknown field)",
5
- requiredField: "This field is required.",
6
- saveFailed: "We could not save this bill. Try again.",
7
- finalizeFailed: "We could not submit this bill. Try again.",
8
- draftSaved: "Bill saved as a draft.",
9
- billFinalized: "Bill submitted for approval.",
10
- unreadableMoney: "Enter a valid amount.",
11
- unusableQuantity: "Enter a quantity greater than 0.",
12
- lineItemsNeedAttention: "Check the highlighted line items before saving.",
13
- totalsNeedAttention: "Enter valid amounts for discount, tax, and total."
14
- }, t = {
15
- achMethod: "via ACH bank transfer",
16
- noMethod: "No payment method on file",
17
- accountHolder: "Account holder",
18
- routingNumber: "Routing number",
19
- accountNumber: "Account number",
20
- paymentMethodLoading: "Loading payment method...",
21
- paymentMethodUnavailable: "We could not load payment methods. Try again.",
22
- searchFailed: "We could not load vendors. Try again.",
23
- vendorDetailsFailed: "We could not load this vendor. Try again."
24
- }, n = {
25
- attachFailed: "We could not attach that file. Try again.",
26
- saveBeforeAttaching: "Save this bill before attaching a document.",
27
- noDocument: "No document attached to this bill."
28
- }, r = {
29
- newTitle: "New bill",
30
- extractedTitle: (e) => `Bill from ${e}`,
31
- readOnlyTitle: "Bill details",
32
- discardConfirm: "Discard your changes to this bill?"
33
- }, i = {
34
- createTitle: "New vendor",
35
- editTitle: "Edit vendor",
36
- close: "Close the vendor form",
37
- nameLabel: "Name",
38
- addAddress: "Add address (optional)",
39
- paymentMethodsHeading: "Accepted payment methods",
40
- 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.",
41
- achTitle: "ACH bank transfer",
42
- achDescription: "Fast, direct deposit to the vendor's bank. Arrives in 1–3 business days.",
43
- addBankAccount: "Add bank account",
44
- accountHolderNameLabel: "Account holder name",
45
- routingNumberLabel: "Routing number",
46
- accountNumberLabel: "Account number",
47
- achHelp: "Ask your vendor for this — it's usually on their invoice, W-9, or a payment instructions email they send you.",
48
- cancel: "Cancel",
49
- save: "Save vendor"
50
- };
2
+ function e(e) {
3
+ return e?.amount_due ?? e?.total_amount ?? void 0;
4
+ }
51
5
  //#endregion
52
- export { e as BILL_CREATE_MESSAGE_LABELS_EN, r as BILL_CREATE_SCREEN_LABELS_EN, n as SOURCE_DOCUMENT_CONTAINER_LABELS_EN, i as VENDOR_INLINE_FORM_LABELS_EN, t as VENDOR_SECTION_PROPS_LABELS_EN };
6
+ export { e as resolveAmountDueMinorUnits };