@tesouro/embedded-components-react 0.4.22 → 0.4.23

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 (58) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/lib/BillPayWidget.js +1 -1
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +8 -8
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +24 -24
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +45 -44
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +3 -49
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +47 -119
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +119 -33
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +33 -186
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +186 -75
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +75 -21
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +22 -232
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +223 -210
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +202 -103
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +121 -13
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +12 -47
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +47 -31
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +27 -198
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +198 -30
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +30 -234
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +240 -19
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +19 -414
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +427 -4
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +4 -38
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +34 -210
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +221 -3
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +3 -4
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +2 -44
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +46 -1
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +1 -8
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +6 -10
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +10 -110
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +112 -3
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +3 -127
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +124 -8
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +8 -7
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +8 -46
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +43 -18
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +20 -28
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +27 -82
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +83 -47
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +47 -250
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +239 -101
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +107 -202
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +209 -3
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +4 -8
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +6 -113
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +115 -1
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +0 -24
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +25 -0
  51. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +1 -1
  52. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/client.config.js +2 -2
  53. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/finopsApiVersion.js +4 -0
  54. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  55. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  56. package/package.json +33 -1
  57. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/api-version.js +0 -3
  58. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/api-version.json.js +0 -4
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/index84.js";
17
+ import { BillPayWidget as E } from "./libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js";
18
18
  import { CardDetailsWidget as D } from "./libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index13.js";
19
19
  import { CreditCardsWidget as O } from "./libs/tesouro-embedded-components-react/cards-widget/feature/dist/index10.js";
20
20
  import { DebitCardsWidget as k } from "./libs/tesouro-embedded-components-react/cards-widget/feature/dist/index11.js";
@@ -1,3 +1,3 @@
1
- import { BillPayWidget as e } from "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js";
1
+ import { BillPayWidget as e } from "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js";
2
2
  import "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js";
3
3
  export { e as BillPayWidget };
@@ -10,22 +10,22 @@ import "./index14.js";
10
10
  import "./index26.js";
11
11
  import "./index27.js";
12
12
  import "./index39.js";
13
- import "./index44.js";
14
- import "./index53.js";
15
- import "./index55.js";
16
- import "./index57.js";
13
+ import "./index45.js";
14
+ import "./index54.js";
15
+ import "./index56.js";
17
16
  import "./index58.js";
18
17
  import "./index59.js";
19
18
  import "./index60.js";
20
19
  import "./index61.js";
21
- import "./index65.js";
20
+ import "./index62.js";
22
21
  import "./index66.js";
23
22
  import "./index67.js";
24
23
  import "./index68.js";
25
24
  import "./index69.js";
26
- import "./index72.js";
27
- import "./index78.js";
25
+ import "./index70.js";
26
+ import "./index73.js";
28
27
  import "./index79.js";
29
28
  import "./index80.js";
30
- import { BillPayWidget as e } from "./index84.js";
29
+ import "./index81.js";
30
+ import { BillPayWidget as e } from "./index85.js";
31
31
  export { e as BillPayWidget };
@@ -10,16 +10,16 @@ function c({ status: n, scopes: r, hasWaitingRequest: i, arePendingApproversUnkn
10
10
  let o = e(r, [t.PayableApproveOrg]);
11
11
  return !!(n === "approve_in_progress" && i && o && !a);
12
12
  }
13
- function l({ status: l, scopes: u, canDecideApprovalRequest: d, hasScheduledPayment: f, scheduledPaymentIntentId: p, hasWaitingRequest: m, arePendingApproversUnknown: h, labels: g }) {
14
- let _ = e(u, [t.PayablePayOrg]), v = e(u, [t.BankAccountReadOrg]), y = s(u), b = e(u, [t.PaymentRailAch]), x = e(u, [t.PayableWriteOrg]), S = _, C = [];
15
- l === "approve_in_progress" && d && (C.push({
13
+ function l({ status: l, scopes: u, canDecideApprovalRequest: d, hasScheduledPayment: f, scheduledPaymentIntentId: p, hasWaitingRequest: m, arePendingApproversUnknown: h, isPayabilityUnknown: g, labels: _ }) {
14
+ let v = e(u, [t.PayablePayOrg]), y = e(u, [t.BankAccountReadOrg]), b = s(u), x = e(u, [t.PaymentRailAch]), S = e(u, [t.PayableWriteOrg]), C = v, w = [];
15
+ l === "approve_in_progress" && d && (w.push({
16
16
  id: "approve",
17
- label: g.approve,
17
+ label: _.approve,
18
18
  variant: "default",
19
19
  surface: "row"
20
- }), C.push({
20
+ }), w.push({
21
21
  id: "reject",
22
- label: g.reject,
22
+ label: _.reject,
23
23
  variant: "ghost",
24
24
  surface: "row"
25
25
  })), c({
@@ -27,51 +27,51 @@ function l({ status: l, scopes: u, canDecideApprovalRequest: d, hasScheduledPaym
27
27
  scopes: u,
28
28
  hasWaitingRequest: m,
29
29
  arePendingApproversUnknown: h
30
- }) && (C.push({
30
+ }) && (w.push({
31
31
  id: "forceApprove",
32
- label: g.forceApprove,
32
+ label: _.forceApprove,
33
33
  variant: "ghost",
34
34
  surface: "menu",
35
35
  icon: o,
36
- sectionHeading: g.policyOverridesHeading
37
- }), C.push({
36
+ sectionHeading: _.policyOverridesHeading
37
+ }), w.push({
38
38
  id: "forceReject",
39
- label: g.forceReject,
39
+ label: _.forceReject,
40
40
  variant: "ghost",
41
41
  surface: "menu",
42
42
  icon: a,
43
- sectionHeading: g.policyOverridesHeading
43
+ sectionHeading: _.policyOverridesHeading
44
44
  }));
45
- let w = l === "waiting_to_be_paid" && _ && !f, T = l === "waiting_to_be_paid" && _ && v && y && b && !f;
46
- return w && C.push({
45
+ let T = l === "waiting_to_be_paid" && v && !f, E = l === "waiting_to_be_paid" && v && y && b && x && !f && !g;
46
+ return T && w.push({
47
47
  id: "markAsPaid",
48
- label: g.markAsPaid,
48
+ label: _.markAsPaid,
49
49
  variant: "outline",
50
50
  surface: "row"
51
- }), T && C.push({
51
+ }), E && w.push({
52
52
  id: "payBill",
53
- label: g.payBill,
53
+ label: _.payBill,
54
54
  variant: "default",
55
55
  surface: "row"
56
- }), l === "new" && x && C.push({
56
+ }), l === "new" && S && w.push({
57
57
  id: "cancel",
58
- label: g.cancel,
58
+ label: _.cancel,
59
59
  variant: "ghost",
60
60
  surface: "menu",
61
61
  icon: n
62
- }), (l === "rejected" || l === "waiting_to_be_paid" && !f) && x && C.push({
62
+ }), (l === "rejected" || l === "waiting_to_be_paid" && !f) && S && w.push({
63
63
  id: "reopen",
64
- label: g.reopen,
64
+ label: _.reopen,
65
65
  variant: "ghost",
66
66
  surface: "menu",
67
67
  icon: i
68
- }), l === "waiting_to_be_paid" && f && p && S && C.push({
68
+ }), l === "waiting_to_be_paid" && f && p && C && w.push({
69
69
  id: "cancelScheduledPayment",
70
- label: g.cancelScheduledPayment,
70
+ label: _.cancelScheduledPayment,
71
71
  variant: "ghost",
72
72
  surface: "menu",
73
73
  icon: r
74
- }), C;
74
+ }), w;
75
75
  }
76
76
  //#endregion
77
77
  export { c as canOverrideApprovalPolicy, s as canReadCounterpartBankAccounts, l as getBillDetailActions };
@@ -13,103 +13,104 @@ import { getBillDetailActions as l } from "./index19.js";
13
13
  import { useState as u } from "react";
14
14
  import { BanIcon as d, HandIcon as f } from "lucide-react";
15
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js
16
- function p({ payableId: d, status: f, currentApprovalRequestId: p, hasWaitingRequest: m, arePendingApproversUnknown: h, hasScheduledPayment: _, scheduledPaymentIntentId: b, isScheduledPaymentUnknown: x, labels: S, isMarkAsPaidPending: C, pendingApprovers: w, onPayBillSelect: T, onMarkAsPaidSelect: E, onActionSucceeded: D }) {
17
- let { initResponse: O } = t(), k = r(), A = n(), j = i(), M = a(), N = c(), P = o(), F = s(), I = C || k.isPending || A.isPending || j.isPending || M.isPending || N.isPending || P.isPending || F.isPending, [L, R] = u(), z = L && (L.id !== "cancelScheduledPayment" || L.scheduledPaymentIntentId === b) ? L : void 0, B = d && f ? l({
16
+ function p({ payableId: d, status: f, currentApprovalRequestId: p, hasWaitingRequest: m, arePendingApproversUnknown: h, hasScheduledPayment: _, scheduledPaymentIntentId: b, isScheduledPaymentUnknown: x, isPayabilityUnknown: 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 === b) ? R : void 0, V = d && f ? l({
18
18
  status: f,
19
- scopes: O?.scopes,
19
+ scopes: k?.scopes,
20
20
  canDecideApprovalRequest: !!p,
21
21
  hasWaitingRequest: m,
22
22
  arePendingApproversUnknown: h,
23
23
  hasScheduledPayment: _ || x,
24
24
  scheduledPaymentIntentId: b,
25
- labels: S
26
- }) : [], V = (t) => ({
27
- onError: () => e.error(S.actionError),
25
+ isPayabilityUnknown: S,
26
+ labels: C
27
+ }) : [], H = (t) => ({
28
+ onError: () => e.error(C.actionError),
28
29
  onSuccess: () => {
29
- e.success(S.actionSuccess[t]), D?.();
30
+ e.success(C.actionSuccess[t]), O?.();
30
31
  }
31
- }), H = {
32
+ }), U = {
32
33
  reject: {
33
- isPending: k.isPending,
34
- run: (e) => p && k.mutate({
34
+ isPending: A.isPending,
35
+ run: (e) => p && A.mutate({
35
36
  path: { approval_request_id: p },
36
37
  body: e ? { reject_reason: e } : void 0
37
- }, V("reject"))
38
+ }, H("reject"))
38
39
  },
39
40
  approve: {
40
- isPending: A.isPending,
41
- run: () => p && A.mutate({ path: { approval_request_id: p } }, V("approve"))
41
+ isPending: j.isPending,
42
+ run: () => p && j.mutate({ path: { approval_request_id: p } }, H("approve"))
42
43
  },
43
44
  cancel: {
44
- isPending: j.isPending,
45
- 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"))
46
47
  },
47
48
  cancelScheduledPayment: {
48
- isPending: M.isPending,
49
+ isPending: N.isPending,
49
50
  run: () => {
50
- let e = z?.scheduledPaymentIntentId;
51
- !d || !e || M.mutate({
51
+ let e = B?.scheduledPaymentIntentId;
52
+ !d || !e || N.mutate({
52
53
  path: { payment_intent_id: e },
53
54
  payableId: d
54
- }, V("cancelScheduledPayment"));
55
+ }, H("cancelScheduledPayment"));
55
56
  }
56
57
  },
57
58
  reopen: {
58
- isPending: N.isPending,
59
- 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"))
60
61
  },
61
62
  forceApprove: {
62
- isPending: P.isPending,
63
- 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"))
64
65
  },
65
66
  forceReject: {
66
- isPending: F.isPending,
67
- 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"))
68
69
  }
69
- }, U = B.map((e) => ({
70
+ }, W = V.map((e) => ({
70
71
  ...e,
71
- disabled: I,
72
- loading: e.id === "markAsPaid" ? C : H[e.id]?.isPending ?? !1,
72
+ disabled: L,
73
+ loading: e.id === "markAsPaid" ? w : U[e.id]?.isPending ?? !1,
73
74
  onSelect: () => {
74
- if (!(I || !d)) {
75
+ if (!(L || !d)) {
75
76
  if (e.id === "payBill") {
76
- T();
77
+ E();
77
78
  return;
78
79
  }
79
80
  if (e.id === "markAsPaid") {
80
- E();
81
+ D();
81
82
  return;
82
83
  }
83
84
  if (v(e.id)) {
84
- R({
85
+ z({
85
86
  id: e.id,
86
87
  scheduledPaymentIntentId: b
87
88
  });
88
89
  return;
89
90
  }
90
- H[e.id]?.run();
91
+ U[e.id]?.run();
91
92
  }
92
93
  }
93
94
  }));
94
95
  return {
95
- isActionPending: I,
96
+ isActionPending: L,
96
97
  actions: {
97
- row: U.filter((e) => e.surface === "row"),
98
- menu: U.filter((e) => e.surface === "menu")
98
+ row: W.filter((e) => e.surface === "row"),
99
+ menu: W.filter((e) => e.surface === "menu")
99
100
  },
100
101
  decisionDialog: {
101
- open: !!z,
102
- copy: z ? {
103
- ...S.decisionDialog[z.id],
104
- presentation: g(z.id),
105
- pendingApprovers: y(z.id) ? w ?? [] : void 0
102
+ open: !!B,
103
+ copy: B ? {
104
+ ...C.decisionDialog[B.id],
105
+ presentation: g(B.id),
106
+ pendingApprovers: y(B.id) ? T ?? [] : void 0
106
107
  } : void 0,
107
- isPending: z ? H[z.id]?.isPending ?? !1 : !1,
108
+ isPending: B ? U[B.id]?.isPending ?? !1 : !1,
108
109
  onCancel: () => {
109
- I || R(void 0);
110
+ L || z(void 0);
110
111
  },
111
112
  onConfirm: (e) => {
112
- !z || I || (H[z.id]?.run(e), R(void 0));
113
+ !B || L || (U[B.id]?.run(e), z(void 0));
113
114
  }
114
115
  }
115
116
  };
@@ -1,52 +1,6 @@
1
- import { derivePayableStatus as e } from "./index7.js";
2
- import { BILL_STATUS_BADGE_LABELS_EN as t } from "../../ui/dist/index17.js";
3
- import "../../ui/dist/index.js";
4
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js
5
- var n = /* @__PURE__ */ new Set([
6
- "credit_note_linked",
7
- "credit_note_unlinked",
8
- "line_item_added",
9
- "line_item_updated",
10
- "line_item_removed",
11
- "deleted"
12
- ]);
13
- function r(n, r, i) {
14
- switch (n) {
15
- case "payable_created": return r?.source_of_payable_data === "ocr" ? i.billUploaded : i.billAdded;
16
- case "payable_updated": return i.billUpdated;
17
- case "file_attached": return i.attachmentAdded;
18
- case "submitted_for_approval": return i.submittedForApproval;
19
- case "approval_requested": return i.approvalRequested;
20
- case "approval_action": {
21
- let e = r?.action, t = r?.reject_reason;
22
- return e === "approve" ? i.approved : e === "reject" ? typeof t == "string" && t ? i.rejectedWithReason(t) : i.rejected : void 0;
23
- }
24
- case "auto_approved": return i.autoApproved;
25
- case "reopened": return i.reopened;
26
- case "marked_as_paid": return i.markedAsPaid;
27
- case "marked_as_partially_paid": return i.markedAsPartiallyPaid;
28
- case "payment_reverted": return i.paymentReverted;
29
- case "status_changed": {
30
- let n = r?.new_status;
31
- if (typeof n != "string") return;
32
- let a = e({ apiStatus: n }).status;
33
- return i.statusChanged(t[a] ?? t.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);
2
+ function e({ isUnsavedPromptOpen: e, isLocked: t, isDirty: n }) {
3
+ return e ? "dismiss-prompt" : !t && n ? "prompt" : "close";
50
4
  }
51
5
  //#endregion
52
- export { i as buildBillHistory };
6
+ export { e as resolveEditorDismissal };
@@ -1,124 +1,52 @@
1
+ import { derivePayableStatus as e } from "./index7.js";
2
+ import { BILL_STATUS_BADGE_LABELS_EN as t } from "../../ui/dist/index17.js";
3
+ import "../../ui/dist/index.js";
1
4
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js
2
- var e = {
3
- payBill: "Pay bill",
4
- markAsPaid: "Mark as paid",
5
- reject: "Reject",
6
- approve: "Approve",
7
- cancel: "Cancel bill",
8
- cancelScheduledPayment: "Cancel scheduled payment",
9
- reopen: "Reopen bill",
10
- forceApprove: "Approve",
11
- forceReject: "Reject",
12
- policyOverridesHeading: "Policy overrides",
13
- decisionDialog: {
14
- reject: {
15
- title: "Reject this bill?",
16
- description: "The bill goes back as rejected and nobody else is asked to approve it.",
17
- confirmButton: "Reject bill",
18
- reason: {
19
- label: "Reason",
20
- placeholder: "Tell the submitter what needs to change",
21
- optionalHint: "Optional"
22
- }
23
- },
24
- cancel: {
25
- title: "Cancel this bill?",
26
- description: "Cancelling is permanent. The bill can't be reopened, edited, or paid afterwards.",
27
- confirmButton: "Cancel bill"
28
- },
29
- cancelScheduledPayment: {
30
- title: "Cancel this scheduled payment?",
31
- description: "The payment will not be sent. The bill stays ready to pay, so you can schedule it again for another date.",
32
- confirmButton: "Cancel payment"
33
- },
34
- forceApprove: {
35
- title: "Override approval policy?",
36
- description: "The below people haven't approved this bill yet. Approving now will bypass their required review. This will be recorded in the audit history and can't be undone.",
37
- confirmButton: "Override and approve"
38
- },
39
- forceReject: {
40
- title: "Override approval policy?",
41
- description: "The below people haven't approved this bill yet. Rejecting now will bypass their required review. This will be recorded in the audit history and can't be undone.",
42
- confirmButton: "Override and reject"
43
- },
44
- cancelButton: "Cancel"
45
- },
46
- actionError: "Couldn't update this bill. Try again.",
47
- actionSuccess: {
48
- approve: "Bill approved.",
49
- reject: "Bill rejected.",
50
- markAsPaid: "Bill marked as paid.",
51
- cancel: "Bill canceled.",
52
- cancelScheduledPayment: "Scheduled payment canceled.",
53
- reopen: "Bill reopened.",
54
- forceApprove: "Bill approved, overriding the approval policy.",
55
- forceReject: "Bill rejected, overriding the approval policy."
56
- }
57
- }, t = (e) => `Payment scheduled for ${e}`, n = [
58
- "reject",
59
- "cancel",
60
- "cancelScheduledPayment",
61
- "forceApprove",
62
- "forceReject"
63
- ];
64
- function r(e, t) {
65
- let n = e.reason ? {
66
- ...e.reason,
67
- ...t?.reason
68
- } : void 0, r = {
69
- ...e,
70
- ...t,
71
- reason: n
72
- };
73
- return n || delete r.reason, r;
74
- }
75
- function i(e, t) {
76
- let i = {
77
- ...e,
78
- ...t
79
- };
80
- for (let a of n) i[a] = r(e[a], t?.[a]);
81
- return i;
82
- }
83
- function a(t) {
84
- let n = e;
85
- return {
86
- ...n,
87
- ...t,
88
- decisionDialog: i(n.decisionDialog, t?.decisionDialog),
89
- actionSuccess: {
90
- ...n.actionSuccess,
91
- ...t?.actionSuccess
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;
92
23
  }
93
- };
94
- }
95
- var o = {
96
- paymentHistorySentLabel: "Payment sent",
97
- paymentHistoryScheduledLabel: "Payment scheduled",
98
- paymentHistoryCanceledLabel: "Payment canceled",
99
- paymentHistoryOtherLabel: "Payment",
100
- paymentHistoryMethodSuffix: (e, t) => `${e} via ${t}`,
101
- paymentHistoryOverpaidLabel: (e) => `+${e} overpaid`,
102
- paymentHistoryMarkedPaidExternalLabel: "Marked as paid manually",
103
- paymentHistoryMarkedPaidLabel: "Marked as paid",
104
- paymentHistoryPartiallyPaidExternalLabel: "Partial payment marked manually",
105
- paymentHistoryPartiallyPaidLabel: "Partial payment",
106
- paymentHistoryRevertedLabel: "Payment reverted",
107
- paymentHistoryMethodLabels: {
108
- ach: "ACH",
109
- us_ach: "ACH",
110
- wire: "Wire",
111
- check: "Check",
112
- paper_check: "Check",
113
- bank_account: "Bank transfer",
114
- card: "Card"
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 = e({ apiStatus: n }).status;
33
+ return i.statusChanged(t[a] ?? t.unknown);
34
+ }
35
+ default: return;
115
36
  }
116
- };
117
- function s(e) {
118
- return {
119
- ...o.paymentHistoryMethodLabels,
120
- ...e
121
- };
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);
122
50
  }
123
51
  //#endregion
124
- export { e as BILL_DETAIL_ACTIONS_LABELS_EN, o as PAYMENT_HISTORY_LABELS_EN, t as SCHEDULED_SUMMARY_LABEL_EN, a as mergeBillDetailActionsLabels, i as mergeDecisionDialogCopy, s as mergePaymentHistoryMethodLabels };
52
+ export { i as buildBillHistory };