@tesouro/embedded-components-react 0.5.279 → 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 (153) hide show
  1. package/dist/index.css +8 -0
  2. package/dist/index.d.ts +23 -8
  3. package/dist/lib/BankAccountOnboardingWidget.d.ts +2 -2
  4. package/dist/lib/ReceivablesWidget.d.ts +21 -6
  5. package/dist/lib/WidgetSuite.d.ts +2 -2
  6. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/labels.js +2 -2
  7. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index30.js +1 -1
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index18.js +1 -0
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index.js +6 -6
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index13.js +8 -8
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index14.js +7 -28
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index15.js +8 -160
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index16.js +20 -13
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index17.js +148 -27
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index18.js +21 -96
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index19.js +37 -79
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index20.js +98 -3
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index21.js +83 -54
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index22.js +3 -113
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index23.js +54 -184
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index24.js +108 -75
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index25.js +181 -29
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index26.js +74 -83
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js +27 -412
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index28.js +88 -12
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index29.js +413 -77
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index30.js +13 -80
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index31.js +77 -226
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +78 -41
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js +216 -234
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index34.js +44 -23
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js +233 -611
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js +25 -4
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index37.js +647 -39
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index38.js +4 -243
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index39.js +42 -3
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index40.js +250 -3
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index41.js +2 -66
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index42.js +5 -1
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index43.js +67 -0
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index44.js +1 -0
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index12.js +11 -11
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index15.js +47 -47
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/lib/invalidatePayableQueries/invalidatePayableQueries.js +2 -2
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/lib/invalidatePayableQueries/reconcileCancelledPaymentQueries.js +19 -19
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidgetNative/BillsTab.js +1 -1
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/data-access/dist/index4.js +15 -15
  48. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +14 -13
  49. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js +24 -168
  50. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +173 -44
  51. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index12.js +42 -94
  52. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index13.js +91 -76
  53. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index14.js +67 -173
  54. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index15.js +186 -17
  55. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index16.js +27 -0
  56. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index3.js +11 -13
  57. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index4.js +42 -27
  58. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index5.js +28 -132
  59. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js +137 -16
  60. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index7.js +16 -62
  61. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index8.js +66 -28
  62. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index9.js +28 -34
  63. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivableAttachmentsSection.js +1 -1
  64. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivableCustomerSection.js +38 -0
  65. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +304 -287
  66. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/auditHistory/labels.js +1 -1
  67. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/customer.js +58 -0
  68. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +15 -15
  69. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +14 -6
  70. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentTerms.js +1 -1
  71. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/permissions.js +2 -1
  72. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/preview.js +62 -62
  73. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurrence.js +41 -35
  74. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/reminders.js +1 -1
  75. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/totals.js +21 -13
  76. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +124 -124
  77. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActionsModal.js +11 -11
  78. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableAttachmentUploads.js +13 -13
  79. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableBankAccount.js +1 -1
  80. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableCustomerPicker.js +109 -0
  81. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +6 -6
  82. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +520 -476
  83. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableIssuePreflight.js +10 -10
  84. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablePaymentRecord.js +6 -6
  85. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablePaymentTerms.js +1 -1
  86. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablePreview.js +1 -1
  87. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableRecurrence.js +92 -77
  88. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableReminders.js +11 -11
  89. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableStatusCards.js +1 -1
  90. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js +4 -4
  91. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +79 -75
  92. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useSendReceivableWithPaymentLink.js +3 -3
  93. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +26 -23
  94. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +9 -25
  95. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +26 -228
  96. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +227 -52
  97. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +50 -212
  98. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +193 -138
  99. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +157 -12
  100. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +10 -19
  101. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +23 -2
  102. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +2 -116
  103. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +118 -3
  104. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +3 -39
  105. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +209 -53
  106. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +2 -23
  107. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +36 -7
  108. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +53 -77
  109. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +17 -35
  110. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +8 -18
  111. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +73 -37
  112. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +36 -26
  113. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +17 -19
  114. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +39 -8
  115. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +26 -33
  116. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +20 -14
  117. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +8 -24
  118. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +34 -84
  119. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +14 -492
  120. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +28 -2
  121. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +79 -39
  122. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +490 -68
  123. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +2 -487
  124. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +41 -217
  125. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index43.js +70 -21
  126. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +440 -5
  127. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +224 -0
  128. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js +21 -263
  129. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +8 -2
  130. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index49.js +261 -24
  131. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index50.js +2 -237
  132. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +100 -3
  133. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index52.js +21 -242
  134. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index53.js +226 -82
  135. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index54.js +3 -60
  136. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index55.js +233 -178
  137. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index56.js +85 -37
  138. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index57.js +60 -0
  139. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index58.js +194 -0
  140. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index59.js +45 -0
  141. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +9 -9
  142. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/CounterpartSelector.js +2 -23
  143. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartSelector.js +2 -51
  144. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +8 -8
  145. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index15.js +4 -80
  146. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +10 -22
  147. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/zod.gen.js +2 -0
  148. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js +1 -0
  149. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  150. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/OnboardingShell.js +1 -1
  151. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/labels.js +2 -2
  152. package/package.json +1 -1
  153. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index48.js +0 -100
@@ -3,42 +3,163 @@
3
3
  "use client";
4
4
  "use client";
5
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
6
  import "../../../../shared/ui/dist/index.js";
10
- import { useWidgetConfig as r } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
7
+ import { useWidgetConfig as t } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
8
  import "../../../../shared/feature/dist/index.js";
12
- import { useDeletePayableMutation as i } from "../../data-access/dist/index10.js";
9
+ import { useApprovePayableApprovalRequestMutation as n, useRejectPayableApprovalRequestMutation as r } from "../../data-access/dist/index2.js";
10
+ import { useCancelPayableMutation as i } from "../../data-access/dist/index6.js";
11
+ import { useCancelScheduledPaymentMutation as a } from "../../data-access/dist/index7.js";
12
+ import { useForceApprovePayableMutation as o } from "../../data-access/dist/index11.js";
13
+ import { useForceRejectPayableMutation as s } from "../../data-access/dist/index12.js";
14
+ import { useReopenPayableMutation as c } from "../../data-access/dist/index13.js";
13
15
  import "../../data-access/dist/index.js";
14
- import { useState as a } from "react";
16
+ import { getBillDetailActions as l } from "./index7.js";
17
+ import { useState as u } from "react";
18
+ import { BanIcon as d, HandIcon as f } from "lucide-react";
15
19
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index17.js
16
- function o({ payableId: o, status: s, enabled: c = !0, labels: l, onDeleted: u }) {
17
- let { initResponse: d } = r(), f = i(), [p, m] = a(!1), h = t(d?.scopes, [n.PayableWriteOrg]), g = !!(c && o && s === "draft" && h), _ = g ? [{
18
- id: "deleteDraft",
19
- label: l.menuItem,
20
- destructive: !0,
21
- onSelect: () => m(!0)
22
- }] : [], v = p && g;
20
+ function p({ payableId: d, status: f, currentApprovalRequestId: p, arePendingApproversUnknown: m, hasScheduledPayment: h, scheduledPaymentIntentId: g, isScheduledPaymentUnknown: v, isPayabilityUnknown: x, labels: S, isMarkAsPaidPending: C, hasApprovalPolicy: w = !0, hasWaitingRequest: T, pendingApprovers: E, onPayBillSelect: D, onMarkAsPaidSelect: O, onEditSelect: k, onActionSucceeded: A }) {
21
+ let { initResponse: j } = t(), M = r(), N = n(), P = i(), F = a(), I = c(), L = o(), R = s(), z = C || M.isPending || N.isPending || P.isPending || F.isPending || I.isPending || L.isPending || R.isPending, [B, V] = u(), H = B && (B.id !== "cancelScheduledPayment" || B.scheduledPaymentIntentId === g) ? B : void 0, U = d && f ? l({
22
+ status: f,
23
+ scopes: j?.scopes,
24
+ canDecideApprovalRequest: !!p,
25
+ arePendingApproversUnknown: m,
26
+ hasApprovalPolicy: w,
27
+ hasWaitingRequest: T,
28
+ hasScheduledPayment: h || v,
29
+ scheduledPaymentIntentId: g,
30
+ isPayabilityUnknown: x,
31
+ canEdit: !!k,
32
+ labels: S
33
+ }) : [], W = (t) => ({
34
+ onError: () => e.error(S.actionError),
35
+ onSuccess: () => {
36
+ let n = b(t) && !w ? `${t}NoApprovalPolicy` : t;
37
+ e.success(S.actionSuccess[n]), A?.(t);
38
+ }
39
+ }), G = {
40
+ reject: {
41
+ isPending: M.isPending,
42
+ run: (e) => p && M.mutate({
43
+ path: { approval_request_id: p },
44
+ body: e ? { reject_reason: e } : void 0
45
+ }, W("reject"))
46
+ },
47
+ approve: {
48
+ isPending: N.isPending,
49
+ run: () => p && N.mutate({ path: { approval_request_id: p } }, W("approve"))
50
+ },
51
+ cancel: {
52
+ isPending: P.isPending,
53
+ run: () => d && P.mutate({ path: { payable_id: d } }, W("cancel"))
54
+ },
55
+ cancelScheduledPayment: {
56
+ isPending: F.isPending,
57
+ run: () => {
58
+ let e = H?.scheduledPaymentIntentId;
59
+ d && e && F.mutate({
60
+ path: { payment_intent_id: e },
61
+ payableId: d
62
+ }, W("cancelScheduledPayment"));
63
+ }
64
+ },
65
+ reopen: {
66
+ isPending: I.isPending,
67
+ run: () => d && I.mutate({ path: { payable_id: d } }, W("reopen"))
68
+ },
69
+ forceApprove: {
70
+ isPending: L.isPending,
71
+ run: () => d && L.mutate({ path: { payable_id: d } }, W("forceApprove"))
72
+ },
73
+ forceReject: {
74
+ isPending: R.isPending,
75
+ run: () => d && R.mutate({ path: { payable_id: d } }, W("forceReject"))
76
+ }
77
+ }, K = U.map((e) => ({
78
+ ...e,
79
+ disabled: z,
80
+ loading: e.id === "markAsPaid" ? C : G[e.id]?.isPending ?? !1,
81
+ onSelect: () => {
82
+ if (!z && d) {
83
+ if (e.id === "payBill") {
84
+ D();
85
+ return;
86
+ }
87
+ if (e.id === "markAsPaid") {
88
+ O();
89
+ return;
90
+ }
91
+ if (e.id === "edit") {
92
+ k?.();
93
+ return;
94
+ }
95
+ if (y(e.id)) {
96
+ V({
97
+ id: e.id,
98
+ scheduledPaymentIntentId: g
99
+ });
100
+ return;
101
+ }
102
+ G[e.id]?.run();
103
+ }
104
+ }
105
+ }));
23
106
  return {
24
- menuItems: _,
25
- dialog: {
26
- open: v,
27
- copy: v ? l.dialog : void 0,
28
- isPending: f.isPending,
107
+ isActionPending: z,
108
+ actions: {
109
+ row: K.filter((e) => e.surface === "row"),
110
+ menu: K.filter((e) => e.surface === "menu")
111
+ },
112
+ decisionDialog: {
113
+ open: !!H,
114
+ copy: H ? {
115
+ ...S.decisionDialog[H.id],
116
+ ...b(H.id) && !w ? S.decisionDialog[H.id].noApprovalPolicy : void 0,
117
+ presentation: _(H.id),
118
+ pendingApprovers: b(H.id) ? E ?? [] : void 0
119
+ } : void 0,
120
+ isPending: H ? G[H.id]?.isPending ?? !1 : !1,
29
121
  onCancel: () => {
30
- f.isPending || m(!1);
122
+ z || V(void 0);
31
123
  },
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
- });
124
+ onConfirm: (e) => {
125
+ H && !z && (G[H.id]?.run(e), V(void 0));
39
126
  }
40
127
  }
41
128
  };
42
129
  }
130
+ var m = {
131
+ alignment: "center",
132
+ icon: f,
133
+ tone: "destructive",
134
+ actionWidth: "equal"
135
+ }, h = {
136
+ alignment: "center",
137
+ icon: d,
138
+ tone: "destructive",
139
+ actionWidth: "equal"
140
+ }, g = {
141
+ alignment: "center",
142
+ icon: d,
143
+ tone: "destructive",
144
+ actionWidth: "equal"
145
+ };
146
+ function _(e) {
147
+ if (b(e)) return m;
148
+ if (e === "reject") return h;
149
+ if (e === "cancel") return g;
150
+ }
151
+ var v = [
152
+ "reject",
153
+ "cancel",
154
+ "cancelScheduledPayment",
155
+ "forceApprove",
156
+ "forceReject"
157
+ ];
158
+ function y(e) {
159
+ return v.includes(e);
160
+ }
161
+ function b(e) {
162
+ return e === "forceApprove" || e === "forceReject";
163
+ }
43
164
  //#endregion
44
- export { o as useDraftDelete };
165
+ export { p as usePayableDetailActions };
@@ -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 };