@tesouro/embedded-components-react 0.3.44 → 0.3.47

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 (63) hide show
  1. package/dist/index.css +10 -0
  2. package/dist/index.js +1 -1
  3. package/dist/lib/BillPayWidget.js +1 -1
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +9 -9
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +42 -39
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +4 -41
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +40 -55
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +56 -5
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +5 -73
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +72 -48
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +47 -91
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +91 -33
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +33 -160
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +163 -75
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +75 -21
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +23 -210
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +198 -202
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +197 -88
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +105 -13
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +12 -46
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +47 -30
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +26 -182
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +187 -31
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +32 -98
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +102 -16
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +16 -301
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +322 -4
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +4 -33
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +31 -83
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +77 -159
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +167 -3
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +3 -4
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +2 -44
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +46 -1
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +1 -8
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +6 -9
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +9 -92
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +94 -3
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +3 -9
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +7 -20
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +14 -51
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +59 -3
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +3 -128
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +125 -8
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +8 -43
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +41 -18
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +20 -28
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +27 -82
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +83 -47
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +47 -250
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +240 -101
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +107 -204
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +211 -3
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +4 -8
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +6 -113
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +115 -1
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +0 -24
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +25 -0
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index44.js +28 -27
  60. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  61. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  62. package/dist/packages/shared-ui-shadcn/dist/index.js +113 -113
  63. package/package.json +1 -1
package/dist/index.css CHANGED
@@ -2244,6 +2244,9 @@
2244
2244
  .ttw\:border-input {
2245
2245
  border-color: var(--ttw-input);
2246
2246
  }
2247
+ .ttw\:border-muted {
2248
+ border-color: var(--ttw-muted);
2249
+ }
2247
2250
  .ttw\:border-neutral-200 {
2248
2251
  border-color: var(--ttw-color-neutral-200);
2249
2252
  }
@@ -5366,6 +5369,13 @@
5366
5369
  .ttw\:data-\[state\=closed\]\:animate-out[data-state="closed"] {
5367
5370
  animation: exit var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none);
5368
5371
  }
5372
+ .ttw\:data-\[state\=closed\]\:border-b[data-state="closed"] {
5373
+ border-bottom-style: var(--tw-border-style);
5374
+ border-bottom-width: 1px;
5375
+ }
5376
+ .ttw\:data-\[state\=closed\]\:border-border[data-state="closed"] {
5377
+ border-color: var(--ttw-border);
5378
+ }
5369
5379
  .ttw\:data-\[state\=closed\]\:duration-300[data-state="closed"] {
5370
5380
  --tw-duration: 300ms;
5371
5381
  transition-duration: 300ms;
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import { RefreshingRootWidgetProvider as _ } from "./libs/tesouro-embedded-compo
14
14
  import { useDisclosuresAcceptanceSurface as v, useOwnWidgetConfig as y, useRefetchWidget as b, useWidgetConfig as x, useWidgetError as S, useWidgetLoading as C } from "./libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/hooks.js";
15
15
  import { BankAccountsWidget as w } from "./libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index8.js";
16
16
  import { CounterpartsWidget as T } from "./libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js";
17
- import { BillPayWidget as E } from "./libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js";
17
+ import { BillPayWidget as E } from "./libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js";
18
18
  import { CardDetailsWidget as D } from "./libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index6.js";
19
19
  import { CardFormatValue as O } from "./libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index3.js";
20
20
  import { CREATE_CARD_FEATURE_LABELS_EN as k, resolveCreateCardFeatureLabels as A } from "./libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index5.js";
@@ -1,3 +1,3 @@
1
- import { BillPayWidget as e } from "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js";
1
+ import { BillPayWidget as e } from "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js";
2
2
  import "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js";
3
3
  export { e as BillPayWidget };
@@ -1,16 +1,15 @@
1
1
  import "./index13.js";
2
2
  import "./index14.js";
3
- import "./index25.js";
4
- import "./index31.js";
5
- import "./index40.js";
6
- import "./index42.js";
7
- import "./index44.js";
3
+ import "./index26.js";
4
+ import "./index32.js";
5
+ import "./index41.js";
6
+ import "./index43.js";
8
7
  import "./index45.js";
9
8
  import "./index46.js";
10
9
  import "./index47.js";
11
10
  import "./index48.js";
12
11
  import "./index49.js";
13
- import "./index53.js";
12
+ import "./index50.js";
14
13
  import "./index54.js";
15
14
  import "./index55.js";
16
15
  import "./index56.js";
@@ -19,9 +18,10 @@ import "./index58.js";
19
18
  import "./index59.js";
20
19
  import "./index60.js";
21
20
  import "./index61.js";
22
- import "./index63.js";
23
- import "./index69.js";
21
+ import "./index62.js";
22
+ import "./index64.js";
24
23
  import "./index70.js";
25
24
  import "./index71.js";
26
- import { BillPayWidget as e } from "./index75.js";
25
+ import "./index72.js";
26
+ import { BillPayWidget as e } from "./index76.js";
27
27
  export { e as BillPayWidget };
@@ -13,10 +13,10 @@ import { getBillDetailActions as l } from "./index21.js";
13
13
  import { useState as u } from "react";
14
14
  import { HandIcon as d } from "lucide-react";
15
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js
16
- function f({ payableId: d, status: f, currentApprovalRequestId: m, isPolicyApprover: _, hasWaitingRequest: v, arePendingApproversUnknown: y, hasScheduledPayment: b, scheduledPaymentIntentId: x, isScheduledPaymentUnknown: S, labels: C, isMarkAsPaidPending: w, pendingApprovers: T, onPayBillSelect: E, onMarkAsPaidSelect: D }) {
17
- let { initResponse: O } = t(), k = r(), A = n(), j = i(), M = a(), N = c(), P = o(), F = s(), I = w || k.isPending || A.isPending || j.isPending || M.isPending || N.isPending || P.isPending || F.isPending, [L, R] = u(), z = L && (L.id !== "cancelScheduledPayment" || L.scheduledPaymentIntentId === x) ? L : void 0, B = d && f ? l({
16
+ function f({ payableId: d, status: f, currentApprovalRequestId: m, isPolicyApprover: _, hasWaitingRequest: v, arePendingApproversUnknown: y, hasScheduledPayment: b, scheduledPaymentIntentId: x, isScheduledPaymentUnknown: S, labels: C, isMarkAsPaidPending: w, pendingApprovers: T, onPayBillSelect: E, onMarkAsPaidSelect: D, onActionSucceeded: O }) {
17
+ let { initResponse: k } = t(), A = r(), j = n(), M = i(), N = a(), P = c(), F = o(), I = s(), L = w || A.isPending || j.isPending || M.isPending || N.isPending || P.isPending || F.isPending || I.isPending, [R, z] = u(), B = R && (R.id !== "cancelScheduledPayment" || R.scheduledPaymentIntentId === x) ? R : void 0, V = d && f ? l({
18
18
  status: f,
19
- scopes: O?.scopes,
19
+ scopes: k?.scopes,
20
20
  canDecideApprovalRequest: !!m,
21
21
  isPolicyApprover: _,
22
22
  hasWaitingRequest: v,
@@ -24,53 +24,55 @@ function f({ payableId: d, status: f, currentApprovalRequestId: m, isPolicyAppro
24
24
  hasScheduledPayment: b || S,
25
25
  scheduledPaymentIntentId: x,
26
26
  labels: C
27
- }) : [], V = (t) => ({
27
+ }) : [], H = (t) => ({
28
28
  onError: () => e.error(C.actionError),
29
- onSuccess: () => e.success(C.actionSuccess[t])
30
- }), H = {
29
+ onSuccess: () => {
30
+ e.success(C.actionSuccess[t]), O?.();
31
+ }
32
+ }), U = {
31
33
  reject: {
32
- isPending: k.isPending,
33
- run: (e) => m && k.mutate({
34
+ isPending: A.isPending,
35
+ run: (e) => m && A.mutate({
34
36
  path: { approval_request_id: m },
35
37
  body: e ? { reject_reason: e } : void 0
36
- }, V("reject"))
38
+ }, H("reject"))
37
39
  },
38
40
  approve: {
39
- isPending: A.isPending,
40
- run: () => m && A.mutate({ path: { approval_request_id: m } }, V("approve"))
41
+ isPending: j.isPending,
42
+ run: () => m && j.mutate({ path: { approval_request_id: m } }, H("approve"))
41
43
  },
42
44
  cancel: {
43
- isPending: j.isPending,
44
- run: () => d && j.mutate({ path: { payable_id: d } }, V("cancel"))
45
+ isPending: M.isPending,
46
+ run: () => d && M.mutate({ path: { payable_id: d } }, H("cancel"))
45
47
  },
46
48
  cancelScheduledPayment: {
47
- isPending: M.isPending,
49
+ isPending: N.isPending,
48
50
  run: () => {
49
- let e = z?.scheduledPaymentIntentId;
50
- !d || !e || M.mutate({
51
+ let e = B?.scheduledPaymentIntentId;
52
+ !d || !e || N.mutate({
51
53
  path: { payment_intent_id: e },
52
54
  payableId: d
53
- }, V("cancelScheduledPayment"));
55
+ }, H("cancelScheduledPayment"));
54
56
  }
55
57
  },
56
58
  reopen: {
57
- isPending: N.isPending,
58
- run: () => d && N.mutate({ path: { payable_id: d } }, V("reopen"))
59
+ isPending: P.isPending,
60
+ run: () => d && P.mutate({ path: { payable_id: d } }, H("reopen"))
59
61
  },
60
62
  forceApprove: {
61
- isPending: P.isPending,
62
- run: () => d && P.mutate({ path: { payable_id: d } }, V("forceApprove"))
63
+ isPending: F.isPending,
64
+ run: () => d && F.mutate({ path: { payable_id: d } }, H("forceApprove"))
63
65
  },
64
66
  forceReject: {
65
- isPending: F.isPending,
66
- run: () => d && F.mutate({ path: { payable_id: d } }, V("forceReject"))
67
+ isPending: I.isPending,
68
+ run: () => d && I.mutate({ path: { payable_id: d } }, H("forceReject"))
67
69
  }
68
- }, U = B.map((e) => ({
70
+ }, W = V.map((e) => ({
69
71
  ...e,
70
- disabled: I,
71
- loading: e.id === "markAsPaid" ? w : H[e.id]?.isPending ?? !1,
72
+ disabled: L,
73
+ loading: e.id === "markAsPaid" ? w : U[e.id]?.isPending ?? !1,
72
74
  onSelect: () => {
73
- if (!(I || !d)) {
75
+ if (!(L || !d)) {
74
76
  if (e.id === "payBill") {
75
77
  E();
76
78
  return;
@@ -80,34 +82,35 @@ function f({ payableId: d, status: f, currentApprovalRequestId: m, isPolicyAppro
80
82
  return;
81
83
  }
82
84
  if (h(e.id)) {
83
- R({
85
+ z({
84
86
  id: e.id,
85
87
  scheduledPaymentIntentId: x
86
88
  });
87
89
  return;
88
90
  }
89
- H[e.id]?.run();
91
+ U[e.id]?.run();
90
92
  }
91
93
  }
92
94
  }));
93
95
  return {
96
+ isActionPending: L,
94
97
  actions: {
95
- row: U.filter((e) => e.surface === "row"),
96
- menu: U.filter((e) => e.surface === "menu")
98
+ row: W.filter((e) => e.surface === "row"),
99
+ menu: W.filter((e) => e.surface === "menu")
97
100
  },
98
101
  decisionDialog: {
99
- open: !!z,
100
- copy: z ? {
101
- ...C.decisionDialog[z.id],
102
- presentation: g(z.id) ? p : void 0,
103
- pendingApprovers: g(z.id) ? T ?? [] : void 0
102
+ open: !!B,
103
+ copy: B ? {
104
+ ...C.decisionDialog[B.id],
105
+ presentation: g(B.id) ? p : void 0,
106
+ pendingApprovers: g(B.id) ? T ?? [] : void 0
104
107
  } : void 0,
105
- isPending: z ? H[z.id]?.isPending ?? !1 : !1,
108
+ isPending: B ? U[B.id]?.isPending ?? !1 : !1,
106
109
  onCancel: () => {
107
- I || R(void 0);
110
+ L || z(void 0);
108
111
  },
109
112
  onConfirm: (e) => {
110
- !z || I || (H[z.id]?.run(e), R(void 0));
113
+ !B || L || (U[B.id]?.run(e), z(void 0));
111
114
  }
112
115
  }
113
116
  };
@@ -1,44 +1,7 @@
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/index11.js";
13
- import "../../data-access/dist/index.js";
14
- import { useState as a } from "react";
15
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.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;
23
- return {
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);
31
- },
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
- });
39
- }
40
- }
41
- };
2
+ var e = /* @__PURE__ */ new Set(["draft", "new"]);
3
+ function t(t) {
4
+ return !!(t && e.has(t));
42
5
  }
43
6
  //#endregion
44
- export { o as useDraftDelete };
7
+ export { t as isEditablePayableStatus };
@@ -1,59 +1,44 @@
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/index11.js";
13
+ import "../../data-access/dist/index.js";
14
+ import { useState as a } from "react";
1
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.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({ apiStatus: n, dueDate: r, scheduledPaymentDate: i, hasScheduledPayment: a = !!i, now: o = /* @__PURE__ */ new Date() }) {
13
- if (e.has(n) && a) return {
14
- status: "scheduled",
15
- tone: "accent",
16
- isOverdue: !1
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;
23
+ return {
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);
31
+ },
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
+ });
39
+ }
40
+ }
17
41
  };
18
- let s = !!(e.has(n) && r && t(r, o));
19
- switch (n) {
20
- case "draft": return {
21
- status: "draft",
22
- tone: "neutral",
23
- isOverdue: s
24
- };
25
- case "new":
26
- case "approve_in_progress": return {
27
- status: "pending_approval",
28
- tone: "warning",
29
- isOverdue: s
30
- };
31
- case "waiting_to_be_paid": return {
32
- status: "ready_to_pay",
33
- tone: "info",
34
- isOverdue: s
35
- };
36
- case "partially_paid": return {
37
- status: "partially_paid",
38
- tone: "success",
39
- isOverdue: s
40
- };
41
- case "paid": return {
42
- status: "paid",
43
- tone: "success",
44
- isOverdue: s
45
- };
46
- case "canceled": return {
47
- status: "canceled",
48
- tone: "muted",
49
- isOverdue: s
50
- };
51
- case "rejected": return {
52
- status: "rejected",
53
- tone: "danger",
54
- isOverdue: s
55
- };
56
- }
57
42
  }
58
43
  //#endregion
59
- export { n as derivePayableStatus };
44
+ export { o as useDraftDelete };
@@ -1,8 +1,59 @@
1
- import { formatMoneyExact as e } from "../../../shared/util/dist/lib/formatMoneyExact.js";
2
- import "../../data-access/dist/index.js";
3
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js
4
- function t(t, n) {
5
- if (typeof t == "number") return e(t / 100, { currencyCode: n ?? "USD" });
2
+ var e = /* @__PURE__ */ new Set([
3
+ "new",
4
+ "approve_in_progress",
5
+ "waiting_to_be_paid",
6
+ "partially_paid"
7
+ ]);
8
+ function t(e, t) {
9
+ let n = /* @__PURE__ */ new Date(`${e.slice(0, 10)}T00:00:00Z`), r = Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate());
10
+ return n.getTime() < r;
11
+ }
12
+ function n({ apiStatus: n, dueDate: r, scheduledPaymentDate: i, hasScheduledPayment: a = !!i, now: o = /* @__PURE__ */ new Date() }) {
13
+ if (e.has(n) && a) return {
14
+ status: "scheduled",
15
+ tone: "accent",
16
+ isOverdue: !1
17
+ };
18
+ let s = !!(e.has(n) && r && t(r, o));
19
+ switch (n) {
20
+ case "draft": return {
21
+ status: "draft",
22
+ tone: "neutral",
23
+ isOverdue: s
24
+ };
25
+ case "new":
26
+ case "approve_in_progress": return {
27
+ status: "pending_approval",
28
+ tone: "warning",
29
+ isOverdue: s
30
+ };
31
+ case "waiting_to_be_paid": return {
32
+ status: "ready_to_pay",
33
+ tone: "info",
34
+ isOverdue: s
35
+ };
36
+ case "partially_paid": return {
37
+ status: "partially_paid",
38
+ tone: "success",
39
+ isOverdue: s
40
+ };
41
+ case "paid": return {
42
+ status: "paid",
43
+ tone: "success",
44
+ isOverdue: s
45
+ };
46
+ case "canceled": return {
47
+ status: "canceled",
48
+ tone: "muted",
49
+ isOverdue: s
50
+ };
51
+ case "rejected": return {
52
+ status: "rejected",
53
+ tone: "danger",
54
+ isOverdue: s
55
+ };
56
+ }
6
57
  }
7
58
  //#endregion
8
- export { t as formatBillMoney };
59
+ export { n as derivePayableStatus };
@@ -1,76 +1,8 @@
1
- import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
2
- import { resolveAmountDueMinorUnits as t } from "./index6.js";
3
- import { resolveVendor as n } from "./index7.js";
4
- import { derivePayableStatus as r } from "./index25.js";
5
- import { formatBillMoney as i } from "./index26.js";
1
+ import { formatMoneyExact as e } from "../../../shared/util/dist/lib/formatMoneyExact.js";
2
+ import "../../data-access/dist/index.js";
6
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js
7
- function a({ payable: a, lineItems: o, glCodeOptions: s, glCodeRosterAvailable: c = !0, history: l, approvalPolicy: u, labels: d, hasScheduledPayment: f }) {
8
- let p = a.currency, m = r({
9
- apiStatus: a.status,
10
- dueDate: a.due_date,
11
- scheduledPaymentDate: a.scheduled_payment_date,
12
- hasScheduledPayment: f
13
- }), h = n(a), g = h?.bank_account?.account_number, _ = e(a.issued_at) || d.notProvided, v = e(a.due_date) || d.notProvided, y = new Map(s.map((e) => [e.value, e.label])), b = [
14
- {
15
- label: d.subtotalRow,
16
- minorUnits: a.subtotal
17
- },
18
- {
19
- label: d.discountRow,
20
- minorUnits: a.discount
21
- },
22
- {
23
- label: d.taxRow,
24
- minorUnits: a.tax_amount
25
- }
26
- ].map((e) => ({
27
- label: e.label,
28
- value: i(e.minorUnits, p)
29
- })).filter((e) => !!e.value), x = i(a.total_amount, p);
30
- return x && b.push({
31
- label: d.totalRow,
32
- value: x,
33
- emphasis: !0
34
- }), {
35
- amountDue: i(t(a), p) ?? "",
36
- invoiceDateLabel: _,
37
- dueDateLabel: v,
38
- dueDateTone: m.isOverdue ? "danger" : "default",
39
- status: m.status,
40
- statusTone: m.tone,
41
- payTo: {
42
- name: h?.name || d.notProvided,
43
- email: h?.email ?? void 0,
44
- paymentInstructionsLabel: g ? d.paymentInstructionsValue(g.slice(-4)) : void 0
45
- },
46
- invoiceFields: [
47
- {
48
- label: d.invoiceDateRow,
49
- value: _
50
- },
51
- {
52
- label: d.dueDateRow,
53
- value: v
54
- },
55
- {
56
- label: d.invoiceNumberRow,
57
- value: a.document_id || d.notProvided
58
- }
59
- ],
60
- lineItems: o.map((e) => {
61
- let t = i(e.unit_price, p);
62
- return {
63
- id: e.id,
64
- description: e.name ?? e.description ?? "",
65
- glCodeLabel: e.ledger_account_id ? y.get(e.ledger_account_id) ?? (c ? d.glCodeMissing : d.glCodeUnavailable) : d.glCodeMissing,
66
- qtyPriceLabel: e.quantity != null && t ? d.qtyPriceValue(String(e.quantity), t) : "",
67
- amount: i(e.subtotal, p) ?? ""
68
- };
69
- }),
70
- amountRows: b,
71
- approvalPolicy: u,
72
- history: l
73
- };
4
+ function t(t, n) {
5
+ if (typeof t == "number") return e(t / 100, { currencyCode: n ?? "USD" });
74
6
  }
75
7
  //#endregion
76
- export { a as buildBillDetailView };
8
+ export { t as formatBillMoney };
@@ -1,52 +1,76 @@
1
- import { BILL_STATUS_BADGE_LABELS_EN as e } from "../../ui/dist/index18.js";
2
- import "../../ui/dist/index.js";
3
- import { derivePayableStatus as t } from "./index25.js";
1
+ import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
2
+ import { resolveAmountDueMinorUnits as t } from "./index6.js";
3
+ import { resolveVendor as n } from "./index7.js";
4
+ import { derivePayableStatus as r } from "./index26.js";
5
+ import { formatBillMoney as i } from "./index27.js";
4
6
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js
5
- var n = /* @__PURE__ */ new Set([
6
- "credit_note_linked",
7
- "credit_note_unlinked",
8
- "line_item_added",
9
- "line_item_updated",
10
- "line_item_removed",
11
- "deleted"
12
- ]);
13
- function r(n, r, i) {
14
- switch (n) {
15
- case "payable_created": return r?.source_of_payable_data === "ocr" ? i.billUploaded : i.billAdded;
16
- case "payable_updated": return i.billUpdated;
17
- case "file_attached": return i.attachmentAdded;
18
- case "submitted_for_approval": return i.submittedForApproval;
19
- case "approval_requested": return i.approvalRequested;
20
- case "approval_action": {
21
- let e = r?.action, t = r?.reject_reason;
22
- return e === "approve" ? i.approved : e === "reject" ? typeof t == "string" && t ? i.rejectedWithReason(t) : i.rejected : void 0;
7
+ function a({ payable: a, lineItems: o, glCodeOptions: s, glCodeRosterAvailable: c = !0, history: l, approvalPolicy: u, labels: d, hasScheduledPayment: f }) {
8
+ let p = a.currency, m = r({
9
+ apiStatus: a.status,
10
+ dueDate: a.due_date,
11
+ scheduledPaymentDate: a.scheduled_payment_date,
12
+ hasScheduledPayment: f
13
+ }), h = n(a), g = h?.bank_account?.account_number, _ = e(a.issued_at) || d.notProvided, v = e(a.due_date) || d.notProvided, y = new Map(s.map((e) => [e.value, e.label])), b = [
14
+ {
15
+ label: d.subtotalRow,
16
+ minorUnits: a.subtotal
17
+ },
18
+ {
19
+ label: d.discountRow,
20
+ minorUnits: a.discount
21
+ },
22
+ {
23
+ label: d.taxRow,
24
+ minorUnits: a.tax_amount
23
25
  }
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);
26
+ ].map((e) => ({
27
+ label: e.label,
28
+ value: i(e.minorUnits, p)
29
+ })).filter((e) => !!e.value), x = i(a.total_amount, p);
30
+ return x && b.push({
31
+ label: d.totalRow,
32
+ value: x,
33
+ emphasis: !0
34
+ }), {
35
+ amountDue: i(t(a), p) ?? "",
36
+ invoiceDateLabel: _,
37
+ dueDateLabel: v,
38
+ dueDateTone: m.isOverdue ? "danger" : "default",
39
+ status: m.status,
40
+ statusTone: m.tone,
41
+ payTo: {
42
+ name: h?.name || d.notProvided,
43
+ email: h?.email ?? void 0,
44
+ paymentInstructionsLabel: g ? d.paymentInstructionsValue(g.slice(-4)) : void 0
45
+ },
46
+ invoiceFields: [
47
+ {
48
+ label: d.invoiceDateRow,
49
+ value: _
50
+ },
51
+ {
52
+ label: d.dueDateRow,
53
+ value: v
54
+ },
55
+ {
56
+ label: d.invoiceNumberRow,
57
+ value: a.document_id || d.notProvided
58
+ }
59
+ ],
60
+ lineItems: o.map((e) => {
61
+ let t = i(e.unit_price, p);
62
+ return {
63
+ id: e.id,
64
+ description: e.name ?? e.description ?? "",
65
+ glCodeLabel: e.ledger_account_id ? y.get(e.ledger_account_id) ?? (c ? d.glCodeMissing : d.glCodeUnavailable) : d.glCodeMissing,
66
+ qtyPriceLabel: e.quantity != null && t ? d.qtyPriceValue(String(e.quantity), t) : "",
67
+ amount: i(e.subtotal, p) ?? ""
68
+ };
69
+ }),
70
+ amountRows: b,
71
+ approvalPolicy: u,
72
+ history: l
73
+ };
50
74
  }
51
75
  //#endregion
52
- export { i as buildBillHistory };
76
+ export { a as buildBillDetailView };