@tesouro/embedded-components-react 0.3.23 → 0.3.25

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 (85) hide show
  1. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +10 -10
  2. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +2 -2
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +2 -2
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +1 -1
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +17 -12
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +1 -0
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +2 -0
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +47 -38
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +108 -93
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +14 -6
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +1 -1
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +1 -0
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +8 -4
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +1 -1
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +1 -1
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +1 -1
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +1 -1
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +1 -0
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +1 -1
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +2 -2
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +33 -30
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +0 -1
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +2 -40
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index23.js +23 -266
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +46 -6
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +273 -45
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +5 -18
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index29.js +45 -282
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index31.js +19 -13
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index32.js +273 -107
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index34.js +13 -9
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index35.js +113 -92
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index37.js +9 -10
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index38.js +95 -54
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index40.js +9 -50
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index41.js +53 -137
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index43.js +52 -2
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index44.js +138 -37
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +2 -5
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index47.js +37 -88
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index49.js +5 -2
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +88 -12
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index52.js +2 -77
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index53.js +11 -253
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index54.js +2 -13
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index55.js +82 -0
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index56.js +264 -8
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index57.js +9 -45
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index58.js +0 -1
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index59.js +7 -36
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +47 -10
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index61.js +2 -201
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index62.js +39 -3
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index63.js +3 -7
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index64.js +188 -301
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index65.js +3 -10
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index66.js +12 -4
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index67.js +317 -81
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index68.js +10 -0
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index69.js +8 -2
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index70.js +91 -16
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index72.js +1 -1
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +14 -3
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +109 -26
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index76.js +3 -3
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index77.js +26 -30
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index79.js +4 -9
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index80.js +30 -102
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +9 -14
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +85 -104
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index85.js +10 -11
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index86.js +123 -8
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index87.js +2 -170
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index88.js +18 -2
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index89.js +7 -11
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +163 -82
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +1 -1
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index92.js +14 -0
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index93.js +108 -0
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index94.js +2 -0
  81. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +2 -2
  82. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +27 -27
  83. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  84. package/package.json +1 -1
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index71.js +0 -113
@@ -4,7 +4,7 @@
4
4
  "use client";
5
5
  import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
6
  import { organizationHeaders as t } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
7
- import { deleteFilesId as n, deletePayablesId as r, patchPayablesId as i, postPayables as a, postPayablesIdApprovePaymentOperation as o, postPayablesIdAttachFile as s, postPayablesIdCancel as c, postPayablesIdMarkAsPaid as l, postPayablesIdReject as u, postPayablesIdReopen as d, postPayablesIdSubmitForApproval as f, postPayablesIdValidate as p, postPayablesUploadFromFile as m, postPaymentRecordsIdCancel as h } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
7
+ import { deletePayablesId as n, deletePayablesIdFile as r, patchPayablesId as i, postPayables as a, postPayablesIdApprovePaymentOperation as o, postPayablesIdAttachFile as s, postPayablesIdCancel as c, postPayablesIdMarkAsPaid as l, postPayablesIdReject as u, postPayablesIdReopen as d, postPayablesIdSubmitForApproval as f, postPayablesIdValidate as p, postPayablesUploadFromFile as m, postPaymentRecordsIdCancel as h } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
8
8
  import "../../../shared/data-access/dist/index.js";
9
9
  import { invalidateDeletedPayableQueries as g, invalidatePayableQueries as _, reconcileCancelledPaymentQueries as v } from "./index4.js";
10
10
  import { useMutation as y } from "@tanstack/react-query";
@@ -52,11 +52,11 @@ function x() {
52
52
  });
53
53
  }
54
54
  function S() {
55
- let { client: n, organizationId: i } = e();
55
+ let { client: r, organizationId: i } = e();
56
56
  return y({
57
57
  mutationFn: async ({ path: e }) => {
58
- await r({
59
- client: n,
58
+ await n({
59
+ client: r,
60
60
  headers: t(i),
61
61
  path: e,
62
62
  throwOnError: !0
@@ -64,7 +64,7 @@ function S() {
64
64
  },
65
65
  onSuccess: async (e, t) => {
66
66
  await g({
67
- client: n,
67
+ client: r,
68
68
  organizationId: i,
69
69
  payableId: t.path.payable_id
70
70
  });
@@ -126,11 +126,11 @@ function w() {
126
126
  });
127
127
  }
128
128
  function T() {
129
- let { client: r, organizationId: i } = e();
129
+ let { client: n, organizationId: i } = e();
130
130
  return y({
131
131
  mutationFn: async ({ path: e }) => {
132
- await n({
133
- client: r,
132
+ await r({
133
+ client: n,
134
134
  headers: t(i),
135
135
  path: e,
136
136
  throwOnError: !0
@@ -138,9 +138,9 @@ function T() {
138
138
  },
139
139
  onSuccess: async (e, t) => {
140
140
  await _({
141
- client: r,
141
+ client: n,
142
142
  organizationId: i,
143
- payableId: t.payableId
143
+ payableId: t.path.payable_id
144
144
  });
145
145
  }
146
146
  });
@@ -1,6 +1,6 @@
1
1
  import { SOURCE_ACCOUNT_LABELS_EN as e } from "./index10.js";
2
- import { REVIEW_TRANSACTION_DIALOG_LABELS_EN as t } from "../../ui/dist/index79.js";
3
- import { SCHEDULE_PAYMENT_DIALOG_LABELS_EN as n } from "../../ui/dist/index85.js";
2
+ import { REVIEW_TRANSACTION_DIALOG_LABELS_EN as t } from "../../ui/dist/index82.js";
3
+ import { SCHEDULE_PAYMENT_DIALOG_LABELS_EN as n } from "../../ui/dist/index88.js";
4
4
  import "../../ui/dist/index.js";
5
5
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js
6
6
  var r = {
@@ -5,8 +5,8 @@
5
5
  import { resolveAmountDueMinorUnits as e } from "./index6.js";
6
6
  import { resolveVendor as t } from "./index7.js";
7
7
  import { payBillFlowTestIds as n } from "./index8.js";
8
- import { ReviewTransactionDialog as r } from "../../ui/dist/index80.js";
9
- import { SchedulePaymentDialog as i } from "../../ui/dist/index87.js";
8
+ import { ReviewTransactionDialog as r } from "../../ui/dist/index83.js";
9
+ import { SchedulePaymentDialog as i } from "../../ui/dist/index90.js";
10
10
  import "../../ui/dist/index.js";
11
11
  import { usePayBillFlow as a } from "./index12.js";
12
12
  import { useImperativeHandle as o } from "react";
@@ -1,4 +1,4 @@
1
- import { MARK_AS_PAID_DIALOG_LABELS_EN as e } from "../../ui/dist/index82.js";
1
+ import { MARK_AS_PAID_DIALOG_LABELS_EN as e } from "../../ui/dist/index85.js";
2
2
  import "../../ui/dist/index.js";
3
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js
4
4
  var t = {
@@ -12,41 +12,46 @@ function t(e, t) {
12
12
  function n({ apiStatus: n, dueDate: r, scheduledPaymentDate: i, hasScheduledPayment: a = !!i, now: o = /* @__PURE__ */ new Date() }) {
13
13
  if (e.has(n) && a) return {
14
14
  status: "scheduled",
15
- tone: "accent"
16
- };
17
- if (e.has(n) && r && t(r, o)) return {
18
- status: "overdue",
19
- tone: "danger"
15
+ tone: "accent",
16
+ isOverdue: !1
20
17
  };
18
+ let s = !!(e.has(n) && r && t(r, o));
21
19
  switch (n) {
22
20
  case "draft": return {
23
21
  status: "draft",
24
- tone: "neutral"
22
+ tone: "neutral",
23
+ isOverdue: s
25
24
  };
26
25
  case "new":
27
26
  case "approve_in_progress": return {
28
27
  status: "pending_approval",
29
- tone: "warning"
28
+ tone: "warning",
29
+ isOverdue: s
30
30
  };
31
31
  case "waiting_to_be_paid": return {
32
32
  status: "ready_to_pay",
33
- tone: "info"
33
+ tone: "info",
34
+ isOverdue: s
34
35
  };
35
36
  case "partially_paid": return {
36
37
  status: "partially_paid",
37
- tone: "success"
38
+ tone: "success",
39
+ isOverdue: s
38
40
  };
39
41
  case "paid": return {
40
42
  status: "paid",
41
- tone: "success"
43
+ tone: "success",
44
+ isOverdue: s
42
45
  };
43
46
  case "canceled": return {
44
47
  status: "canceled",
45
- tone: "muted"
48
+ tone: "muted",
49
+ isOverdue: s
46
50
  };
47
51
  case "rejected": return {
48
52
  status: "rejected",
49
- tone: "danger"
53
+ tone: "danger",
54
+ isOverdue: s
50
55
  };
51
56
  }
52
57
  }
@@ -35,6 +35,7 @@ function a({ payable: a, lineItems: o, glCodeOptions: s, history: c, approvalPol
35
35
  amountDue: i(t(a), f) ?? "",
36
36
  invoiceDateLabel: g,
37
37
  dueDateLabel: _,
38
+ dueDateTone: p.isOverdue ? "danger" : "default",
38
39
  status: p.status,
39
40
  statusTone: p.tone,
40
41
  payTo: {
@@ -29,7 +29,9 @@ var l = {
29
29
  vendorDetailsFailed: "We could not load this vendor. Try again."
30
30
  }, d = {
31
31
  attachFailed: "We could not attach that file. Try again.",
32
+ deleteFailed: "We could not remove that document. Try again.",
32
33
  noDocument: "No document attached to this bill.",
34
+ pendingDeletionNotice: "This document will be removed when you save this bill.",
33
35
  preview: c
34
36
  }, f = {
35
37
  notProvided: "Not provided",
@@ -2,18 +2,18 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { SourceDocumentPanel as e } from "../../ui/dist/index90.js";
5
+ import { SourceDocumentPanel as e } from "../../ui/dist/index93.js";
6
6
  import "../../ui/dist/index.js";
7
- import { useAttachPayableFileMutation as t, useDeletePayableFileMutation as n } from "../../data-access/dist/index10.js";
7
+ import { useAttachPayableFileMutation as t } from "../../data-access/dist/index10.js";
8
8
  import "../../data-access/dist/index.js";
9
- import { createSourceDocumentPreview as r } from "./index30.js";
10
- import { SOURCE_DOCUMENT_CONTAINER_LABELS_EN as i } from "./index31.js";
11
- import { useEffect as a, useState as o } from "react";
12
- import { jsx as s } from "react/jsx-runtime";
9
+ import { createSourceDocumentPreview as n } from "./index30.js";
10
+ import { SOURCE_DOCUMENT_CONTAINER_LABELS_EN as r } from "./index31.js";
11
+ import { useEffect as i, useState as a } from "react";
12
+ import { jsx as o } from "react/jsx-runtime";
13
13
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js
14
- function c(e) {
15
- let [t, n] = o();
16
- return a(() => {
14
+ function s(e) {
15
+ let [t, n] = a();
16
+ return i(() => {
17
17
  if (!e) {
18
18
  n(void 0);
19
19
  return;
@@ -22,50 +22,59 @@ function c(e) {
22
22
  return n(t), () => URL.revokeObjectURL(t);
23
23
  }, [e]), t;
24
24
  }
25
- function l({ payableId: a, file: o, isDocumentPending: l, pendingFileName: u, readOnly: d, staging: f, labels: p }) {
26
- let { stagedFile: m, onFileStaged: h, onClearStagedFile: g, isSaving: _ } = f ?? {}, v = {
27
- ...i,
25
+ function c({ payableId: i, file: a, isDocumentPending: c, pendingFileName: l, readOnly: u, staging: d, deletion: f, labels: p }) {
26
+ let { stagedFile: m, onFileStaged: h, onClearStagedFile: g, isSaving: _ } = d ?? {}, { isPending: v, onRequest: y, onDetachNow: b, isDeleting: x, hasFailed: S } = f ?? {}, C = {
27
+ ...r,
28
28
  ...p,
29
29
  preview: {
30
- ...i.preview,
30
+ ...r.preview,
31
31
  ...p?.preview
32
32
  }
33
- }, y = t(), b = n(), x = c(m), S = !!(o || m);
34
- if (!S && (l || y.isPending)) return /* @__PURE__ */ s(e, {
33
+ }, w = t(), T = s(m), E = !!(a && !v || m);
34
+ if (!E && (c || w.isPending)) return /* @__PURE__ */ o(e, {
35
35
  mode: "loading",
36
- fileName: u
36
+ fileName: l
37
37
  });
38
- if (!S && d) return /* @__PURE__ */ s("div", {
38
+ if (!E && u) return /* @__PURE__ */ o("div", {
39
39
  className: "ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4 ttw:text-sm ttw:text-muted-foreground",
40
- children: v.noDocument
40
+ children: C.noDocument
41
41
  });
42
- if (!S) return /* @__PURE__ */ s(e, {
42
+ if (!E) return /* @__PURE__ */ o(e, {
43
43
  mode: "upload",
44
- uploadStatus: y.isPending ? "uploading" : "idle",
45
- uploadErrorMessage: y.isError ? v.attachFailed : void 0,
44
+ uploadStatus: w.isPending || x ? "uploading" : "idle",
45
+ uploadErrorMessage: w.isError ? C.attachFailed : S ? C.deleteFailed : void 0,
46
+ noticeMessage: v && !S ? C.pendingDeletionNotice : void 0,
46
47
  onFilesSelected: (e) => {
47
48
  let [t] = e;
48
- t && (a ? y.mutate({
49
- path: { payable_id: a },
50
- file: t
51
- }) : h?.(t));
49
+ if (t) {
50
+ if (i) {
51
+ let e = () => w.mutate({
52
+ path: { payable_id: i },
53
+ file: t
54
+ });
55
+ if (v && b) {
56
+ b().then(e, () => void 0);
57
+ return;
58
+ }
59
+ e();
60
+ } else h?.(t);
61
+ }
52
62
  }
53
63
  });
54
- let C = o?.name ?? m?.name ?? "", w = r(o || {
55
- name: C,
56
- url: x ?? "",
64
+ let D = a?.name ?? m?.name ?? "", O = n(a || {
65
+ name: D,
66
+ url: T ?? "",
57
67
  mimetype: m?.type ?? ""
58
- }, v.preview);
59
- return /* @__PURE__ */ s(e, {
68
+ }, C.preview);
69
+ return /* @__PURE__ */ o(e, {
60
70
  mode: "document",
61
- fileName: C,
62
- preview: w,
63
- onDownload: o ? () => window.open(o.url, "_blank", "noopener,noreferrer") : void 0,
64
- onDelete: d ? void 0 : o && a ? () => b.mutate({
65
- path: { file_id: o.id },
66
- payableId: a
67
- }) : _ ? void 0 : g
71
+ fileName: D,
72
+ preview: O,
73
+ isDeleting: x,
74
+ deleteErrorMessage: S ? C.deleteFailed : void 0,
75
+ onDownload: a ? () => window.open(a.url, "_blank", "noopener,noreferrer") : void 0,
76
+ onDelete: u ? void 0 : a && i ? y : _ ? void 0 : g
68
77
  });
69
78
  }
70
79
  //#endregion
71
- export { l as SourceDocumentContainer, l as default };
80
+ export { c as SourceDocumentContainer, c as default };
@@ -5,32 +5,32 @@
5
5
  import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
6
  import "../../../shared/ui/dist/index.js";
7
7
  import { useReplacePayableLineItemsMutation as t } from "../../data-access/dist/index7.js";
8
- import { useCreatePayableMutation as n, useSubmitPayableForApprovalMutation as r, useUpdatePayableMutation as i, useValidatePayableMutation as a } from "../../data-access/dist/index10.js";
8
+ import { useCreatePayableMutation as n, useDeletePayableFileMutation as r, useSubmitPayableForApprovalMutation as i, useUpdatePayableMutation as a, useValidatePayableMutation as o } from "../../data-access/dist/index10.js";
9
9
  import "../../data-access/dist/index.js";
10
- import { BILL_CREATE_MESSAGE_LABELS_EN as o } from "./index31.js";
11
- import { encodeFileToBase64 as s } from "./index37.js";
12
- import { mapBillFormToPayload as c, mapLineItemsToPayload as l } from "./index38.js";
13
- import { validateBillCompleteness as u, validateBillTotals as d, validateLineItems as f } from "./index39.js";
14
- import { useCallback as p, useRef as m, useState as h } from "react";
10
+ import { BILL_CREATE_MESSAGE_LABELS_EN as s } from "./index31.js";
11
+ import { encodeFileToBase64 as c } from "./index37.js";
12
+ import { mapBillFormToPayload as l, mapLineItemsToPayload as u } from "./index38.js";
13
+ import { validateBillCompleteness as d, validateBillTotals as f, validateLineItems as p } from "./index39.js";
14
+ import { useCallback as m, useRef as h, useState as g } from "react";
15
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js
16
- var g = {
16
+ var _ = {
17
17
  document_id: "invoiceNumber",
18
18
  issued_at: "invoiceDate",
19
19
  due_date: "dueDate",
20
20
  counterpart_id: "vendor"
21
21
  };
22
- function _(e) {
22
+ function v(e) {
23
23
  return e.type === "type_error.none.not_allowed" || e.msg === "none is not an allowed value";
24
24
  }
25
- function v(e, t = o) {
25
+ function y(e, t = s) {
26
26
  let n = {}, r = [];
27
27
  for (let i of e) {
28
- let e = i.loc[0] ?? t.unknownValidationField, a = g[e], o = _(i) ? t.requiredField : i.msg;
28
+ let e = i.loc[0] ?? t.unknownValidationField, a = _[e], o = v(i) ? t.requiredField : i.msg;
29
29
  a ? n[a] = o : r.push(t.unmappedValidationError(e, o));
30
30
  }
31
31
  return r.length && (n.form = r.join(" ")), n;
32
32
  }
33
- function y(e, t) {
33
+ function b(e, t) {
34
34
  if (!e && !t) return;
35
35
  let n = {}, r = /* @__PURE__ */ new Set([...Object.keys(e ?? {}), ...Object.keys(t ?? {})]);
36
36
  for (let i of r) n[i] = {
@@ -39,131 +39,146 @@ function y(e, t) {
39
39
  };
40
40
  return n;
41
41
  }
42
- function b({ payableId: g, form: _, counterpartId: b, clearCounterpart: x, prepareVendorForSave: S, onSaved: C, onPayableCreated: w, onDraftSaved: T, onFinalized: E, labels: D }) {
43
- let O = {
44
- ...o,
45
- ...D
46
- }, [k, A] = h(), j = g ?? k, [M, N] = h(), P = p(() => N(void 0), []), [F, I] = h(), L = m(!1), R = n(), z = i(), B = t(), V = a(), H = r(), U = p(() => {
47
- let t = f(_.lineItems, O), n = d(_.discount, _.tax, _.totalOverride, O);
48
- return _.setLineItemErrors(t), !t && !n || (t ? (_.setErrors(void 0), e.error(O.lineItemsNeedAttention)) : _.setErrors(n), !1);
49
- }, [_, O]), W = p(async (e) => {
50
- let t = !j && M ? {
51
- base64EncodedFile: await s(M),
52
- fileName: M.name
53
- } : void 0, n = c({
54
- values: _.values,
55
- counterpartId: b,
56
- clearCounterpart: x,
42
+ function x({ payableId: _, form: v, counterpartId: x, clearCounterpart: S, prepareVendorForSave: C, onSaved: w, onPayableCreated: T, onDraftSaved: E, onFinalized: D, labels: O }) {
43
+ let k = {
44
+ ...s,
45
+ ...O
46
+ }, [A, j] = g(), M = _ ?? A, [N, P] = g(), F = m(() => P(void 0), []), [I, L] = g(!1), R = m(() => L(!0), []), [z, B] = g(), V = h(!1), H = n(), U = r(), W = a(), G = t(), K = o(), q = i(), J = m(() => {
47
+ let t = p(v.lineItems, k), n = f(v.discount, v.tax, v.totalOverride, k);
48
+ return v.setLineItemErrors(t), !t && !n || (t ? (v.setErrors(void 0), e.error(k.lineItemsNeedAttention)) : v.setErrors(n), !1);
49
+ }, [v, k]), Y = m(async (e) => {
50
+ let t = !M && N ? {
51
+ base64EncodedFile: await c(N),
52
+ fileName: N.name
53
+ } : void 0, n = l({
54
+ values: v.values,
55
+ counterpartId: x,
56
+ clearCounterpart: S,
57
57
  counterpartBankAccountId: e,
58
- editedTotals: _.isTotalsDirty ? {
59
- discount: _.discount,
60
- tax: _.tax,
61
- total: _.totalOverride
58
+ editedTotals: v.isTotalsDirty ? {
59
+ discount: v.discount,
60
+ tax: v.tax,
61
+ total: v.totalOverride
62
62
  } : void 0,
63
63
  document: t
64
- }), r = j;
65
- if (r ? await z.mutateAsync({
64
+ }), r = M;
65
+ if (r ? await W.mutateAsync({
66
66
  path: { payable_id: r },
67
67
  body: n
68
- }) : (r = (await R.mutateAsync({ body: n }))?.id, r && (A(r), w?.(r), t && N(void 0))), !r) throw Error("Payable was created without an id");
69
- return await B.mutateAsync({
68
+ }) : (r = (await H.mutateAsync({ body: n }))?.id, r && (j(r), T?.(r), t && P(void 0))), !r) throw Error("Payable was created without an id");
69
+ if (I) {
70
+ try {
71
+ await U.mutateAsync({ path: { payable_id: r } });
72
+ } catch {}
73
+ L(!1);
74
+ }
75
+ return await G.mutateAsync({
70
76
  path: { payable_id: r },
71
- body: { data: l(_.lineItems) }
77
+ body: { data: u(v.lineItems) }
72
78
  }), r;
73
79
  }, [
74
- b,
75
80
  x,
76
- R,
77
- _.discount,
78
- _.isTotalsDirty,
79
- _.lineItems,
80
- _.tax,
81
- _.totalOverride,
82
- _.values,
83
- w,
84
- j,
85
- B,
81
+ S,
82
+ H,
83
+ U,
84
+ I,
85
+ v.discount,
86
+ v.isTotalsDirty,
87
+ v.lineItems,
88
+ v.tax,
89
+ v.totalOverride,
90
+ v.values,
91
+ T,
86
92
  M,
87
- z
88
- ]);
93
+ G,
94
+ N,
95
+ W
96
+ ]), X = m(async () => {
97
+ M && (await U.mutateAsync({ path: { payable_id: M } }), L(!1));
98
+ }, [U, M]);
89
99
  return {
90
- saveDraft: p(async () => {
91
- if (!L.current && U()) {
92
- L.current = !0, I("draft");
100
+ saveDraft: m(async () => {
101
+ if (!V.current && J()) {
102
+ V.current = !0, B("draft");
93
103
  try {
94
- let t = await S?.();
104
+ let t = await C?.();
95
105
  if (t && !t.ok) return;
96
- let n = await W(t?.counterpartBankAccountId);
97
- _.setErrors(void 0), C?.(n), T?.(n), e.success(O.draftSaved);
106
+ let n = await Y(t?.counterpartBankAccountId);
107
+ v.setErrors(void 0), w?.(n), E?.(n), e.success(k.draftSaved);
98
108
  } catch {
99
- _.setErrors({ form: O.saveFailed });
109
+ v.setErrors({ form: k.saveFailed });
100
110
  } finally {
101
- I(void 0), L.current = !1;
111
+ B(void 0), V.current = !1;
102
112
  }
103
113
  }
104
114
  }, [
105
- _,
106
- U,
107
- O.draftSaved,
108
- O.saveFailed,
109
- T,
115
+ v,
116
+ J,
117
+ k.draftSaved,
118
+ k.saveFailed,
119
+ E,
120
+ w,
110
121
  C,
111
- S,
112
- W
122
+ Y
113
123
  ]),
114
- finalize: p(async () => {
115
- if (L.current) return;
116
- let t = f(_.lineItems, O), n = d(_.discount, _.tax, _.totalOverride, O), { formErrors: r, lineItemErrors: i } = u(_.values, b, _.lineItems, O), a = y(i, t);
117
- _.setLineItemErrors(a);
124
+ finalize: m(async () => {
125
+ if (V.current) return;
126
+ let t = p(v.lineItems, k), n = f(v.discount, v.tax, v.totalOverride, k), { formErrors: r, lineItemErrors: i } = d(v.values, x, v.lineItems, k), a = b(i, t);
127
+ v.setLineItemErrors(a);
118
128
  let o = {
119
129
  ...r,
120
130
  ...n
121
131
  };
122
- if (_.setErrors(Object.keys(o).length ? o : void 0), t && e.error(O.lineItemsNeedAttention), !(a || Object.keys(o).length)) {
123
- L.current = !0, I("finalize");
132
+ if (v.setErrors(Object.keys(o).length ? o : void 0), t && e.error(k.lineItemsNeedAttention), !(a || Object.keys(o).length)) {
133
+ V.current = !0, B("finalize");
124
134
  try {
125
135
  let t;
126
136
  try {
127
- let e = await S?.();
137
+ let e = await C?.();
128
138
  if (e && !e.ok) return;
129
- t = await W(e?.counterpartBankAccountId);
139
+ t = await Y(e?.counterpartBankAccountId);
130
140
  } catch {
131
- _.setErrors({ form: O.saveFailed });
141
+ v.setErrors({ form: k.saveFailed });
132
142
  return;
133
143
  }
134
- C?.(t);
144
+ w?.(t);
135
145
  try {
136
- let n = await V.mutateAsync({ path: { payable_id: t } });
146
+ let n = await K.mutateAsync({ path: { payable_id: t } });
137
147
  if (n.validation_errors.length) {
138
- _.setErrors(v(n.validation_errors, O));
148
+ v.setErrors(y(n.validation_errors, k));
139
149
  return;
140
150
  }
141
- await H.mutateAsync({ path: { payable_id: t } }), _.setErrors(void 0), E?.(t), e.success(O.billFinalized);
151
+ await q.mutateAsync({ path: { payable_id: t } }), v.setErrors(void 0), D?.(t), e.success(k.billFinalized);
142
152
  } catch {
143
- _.setErrors({ form: O.finalizeFailed });
153
+ v.setErrors({ form: k.finalizeFailed });
144
154
  }
145
155
  } finally {
146
- I(void 0), L.current = !1;
156
+ B(void 0), V.current = !1;
147
157
  }
148
158
  }
149
159
  }, [
150
- b,
151
- _,
152
- O,
153
- E,
160
+ x,
161
+ v,
162
+ k,
163
+ D,
164
+ w,
154
165
  C,
155
- S,
156
- W,
157
- H,
158
- V
166
+ Y,
167
+ q,
168
+ K
159
169
  ]),
160
- payableId: j,
161
- isSavingDraft: F === "draft",
162
- isFinalizing: F === "finalize",
163
- stagedFile: M,
164
- stageFile: N,
165
- clearStagedFile: P
170
+ payableId: M,
171
+ isSavingDraft: z === "draft",
172
+ isFinalizing: z === "finalize",
173
+ stagedFile: N,
174
+ stageFile: P,
175
+ clearStagedFile: F,
176
+ isFileDeletionPending: I,
177
+ requestFileDeletion: R,
178
+ detachFileNow: X,
179
+ isDeletingFile: U.isPending,
180
+ hasFileDeletionFailed: U.isError
166
181
  };
167
182
  }
168
183
  //#endregion
169
- export { v as mapValidationErrorsToForm, b as useBillCreateController };
184
+ export { y as mapValidationErrorsToForm, x as useBillCreateController };
@@ -12,11 +12,11 @@ import { useWidgetConfig as re } from "../../../shared/feature/dist/lib/WidgetPr
12
12
  import "../../../shared/feature/dist/index.js";
13
13
  import { resolveAmountDueMinorUnits as ie } from "./index6.js";
14
14
  import { resolveVendor as ae } from "./index7.js";
15
- import { BillCreateScreen as oe } from "../../ui/dist/index41.js";
16
- import { BillDecisionDialog as n } from "../../ui/dist/index47.js";
17
- import { BillDuplicateNotice as se } from "../../ui/dist/index57.js";
18
- import { ExtractionNotice as ce } from "../../ui/dist/index74.js";
19
- import { MarkAsPaidDialog as le } from "../../ui/dist/index83.js";
15
+ import { BillCreateScreen as oe } from "../../ui/dist/index44.js";
16
+ import { BillDecisionDialog as n } from "../../ui/dist/index50.js";
17
+ import { BillDuplicateNotice as se } from "../../ui/dist/index60.js";
18
+ import { ExtractionNotice as ce } from "../../ui/dist/index77.js";
19
+ import { MarkAsPaidDialog as le } from "../../ui/dist/index86.js";
20
20
  import "../../ui/dist/index.js";
21
21
  import { usePayableHistoryQuery as ue } from "../../data-access/dist/index6.js";
22
22
  import { useAllPayableLineItemsQuery as de } from "../../data-access/dist/index7.js";
@@ -144,9 +144,10 @@ function u({ open: u, onOpenChange: d, payableId: f, readOnly: p = !1, copy: m,
144
144
  D,
145
145
  p
146
146
  ]), J = D?.source_of_payable_data === "ocr", Y = L?.name, X = p ? Y ? h.viewTitle(Y) : h.readOnlyTitle : J && Y ? h.extractedTitle(Y) : h.newTitle, Ve = p && D?.created_at ? h.addedOn(ne(D.created_at.slice(0, 10))) : void 0, Z = i(() => {
147
- let e = O.isDirty || A.hasUnsavedVendorChanges || !!j.stagedFile;
147
+ let e = O.isDirty || A.hasUnsavedVendorChanges || !!j.stagedFile || j.isFileDeletionPending;
148
148
  !p && e && !window.confirm(h.discardConfirm) || d(!1);
149
149
  }, [
150
+ j.isFileDeletionPending,
150
151
  j.stagedFile,
151
152
  h.discardConfirm,
152
153
  O.isDirty,
@@ -206,6 +207,13 @@ function u({ open: u, onOpenChange: d, payableId: f, readOnly: p = !1, copy: m,
206
207
  onFileStaged: j.stageFile,
207
208
  onClearStagedFile: j.clearStagedFile,
208
209
  isSaving: M
210
+ },
211
+ deletion: {
212
+ isPending: j.isFileDeletionPending,
213
+ onRequest: j.requestFileDeletion,
214
+ onDetachNow: j.detachFileNow,
215
+ isDeleting: j.isDeletingFile,
216
+ hasFailed: j.hasFileDeletionFailed
209
217
  }
210
218
  }),
211
219
  menuItems: U.menuItems,
@@ -1,4 +1,4 @@
1
- import { BILL_DETAILS_SHEET_LABELS_EN as e } from "../../ui/dist/index52.js";
1
+ import { BILL_DETAILS_SHEET_LABELS_EN as e } from "../../ui/dist/index55.js";
2
2
  import "../../ui/dist/index.js";
3
3
  import { MARK_AS_PAID_FLOW_LABELS_EN as t } from "./index2.js";
4
4
  import "./index5.js";
@@ -74,6 +74,7 @@ function a({ payable: a, lineItems: o, ledgerAccounts: s, labels: c, hasSchedule
74
74
  amountDueLabel: f(a.amount_due) ?? f(a.total_amount) ?? "",
75
75
  invoiceDateLabel: g,
76
76
  dueDateLabel: _,
77
+ dueDateTone: p.isOverdue ? "danger" : "default",
77
78
  payToItems: v,
78
79
  invoiceItems: b,
79
80
  lineItems: S,
@@ -6,10 +6,10 @@ import { useAllLedgerAccountsQuery as e } from "../../../shared/data-access/dist
6
6
  import "../../../shared/data-access/dist/index.js";
7
7
  import { resolveAmountDueMinorUnits as t } from "./index6.js";
8
8
  import { resolveVendor as n } from "./index7.js";
9
- import { BillDecisionDialog as r } from "../../ui/dist/index47.js";
10
- import { BillDetailsSheet as i } from "../../ui/dist/index53.js";
11
- import { BillDuplicateNotice as a } from "../../ui/dist/index57.js";
12
- import { MarkAsPaidDialog as o } from "../../ui/dist/index83.js";
9
+ import { BillDecisionDialog as r } from "../../ui/dist/index50.js";
10
+ import { BillDetailsSheet as i } from "../../ui/dist/index56.js";
11
+ import { BillDuplicateNotice as a } from "../../ui/dist/index60.js";
12
+ import { MarkAsPaidDialog as o } from "../../ui/dist/index86.js";
13
13
  import "../../ui/dist/index.js";
14
14
  import { useAllPayableLineItemsQuery as s } from "../../data-access/dist/index7.js";
15
15
  import { usePayableQuery as c } from "../../data-access/dist/index13.js";
@@ -46,6 +46,10 @@ function T({ open: T, onOpenChange: E, payableId: D, onClose: O, onExpand: k, te
46
46
  approvalPolicy: {
47
47
  ..._.sheet.approvalPolicy,
48
48
  ...j?.sheet?.approvalPolicy
49
+ },
50
+ dueDate: {
51
+ ..._.sheet.dueDate,
52
+ ...j?.sheet?.dueDate
49
53
  }
50
54
  },
51
55
  decisionDialog: f(_.decisionDialog, j?.decisionDialog),