@tesouro/embedded-components-react 0.5.94 → 0.5.95

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.
@@ -21,12 +21,10 @@ var t = {
21
21
  submittedForReview: "Finalized and submitted for review",
22
22
  approvalRequested: "Approval requested",
23
23
  approved: "Approved",
24
- approvedCount: (e, t) => `Approved (${e} of ${t})`,
25
24
  approvedAutomatically: "Approved automatically",
26
25
  rejected: "Rejected",
27
26
  policyOverrideApproved: "Policy override: Approved",
28
27
  policyOverrideRejected: "Policy override: Rejected",
29
- actorWithReason: (e, t) => `${e}: "${t}"`,
30
28
  quotedReason: (e) => `"${e}"`,
31
29
  cancelled: "Cancelled",
32
30
  reopened: "Re-opened for edit",
@@ -1,5 +1,5 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.5.94", n = "193cc3bf0332682b6699d5de97becdf5c008c1a2", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.5.95", n = "69ab276658b470febd2fd78bf87c47b630d6120f", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
@@ -13,62 +13,54 @@ function o(e) {
13
13
  function s(e, t) {
14
14
  return e === void 0 ? void 0 : t.paid(t.formatAmount(e));
15
15
  }
16
- function c(e, t, n) {
17
- return e && t ? n.actorWithReason(e, t) : t ? n.quotedReason(t) : e;
18
- }
19
- function l(t, a, o, s, l) {
20
- let u = a.action, d = a.approval_source === "force", f = e(t, s), p = i(a.reject_reason);
21
- if (n.has(u)) {
22
- let e = l.approved;
23
- return d ? e = l.policyOverrideApproved : o?.required && (e = l.approvedCount(o.approved, o.required)), {
24
- title: e,
25
- meta: c(f, p, l),
26
- actorInMeta: !0
27
- };
28
- }
29
- if (r.has(u)) return {
30
- title: d ? l.policyOverrideRejected : l.rejected,
31
- meta: c(f, p, l),
32
- actorInMeta: !0
16
+ function c(e, t) {
17
+ let a = e.action, o = e.approval_source === "force", s = i(e.reject_reason), c = s ? t.quotedReason(s) : void 0;
18
+ if (n.has(a)) return {
19
+ title: o ? t.policyOverrideApproved : t.approved,
20
+ meta: c
21
+ };
22
+ if (r.has(a)) return {
23
+ title: o ? t.policyOverrideRejected : t.rejected,
24
+ meta: c
33
25
  };
34
26
  }
35
- function u(e, t, n, r) {
36
- let c = e.event_data ?? {};
27
+ function l(e, t, n, r) {
28
+ let l = e.event_data ?? {};
37
29
  switch (e.event_type) {
38
30
  case "payable_created": return {
39
31
  title: t.billCreated,
40
- meta: a(c, t)
32
+ meta: a(l, t)
41
33
  };
42
34
  case "payable_updated": return { title: t.billDetailsUpdated };
43
35
  case "submitted_for_approval": return { title: t.submittedForReview };
44
36
  case "approval_requested": return {
45
37
  title: t.approvalRequested,
46
- meta: i(c.approval_policy_name)
38
+ meta: i(l.approval_policy_name)
47
39
  };
48
- case "approval_action": return l(e, c, n.approval, r, t);
40
+ case "approval_action": return c(l, t);
49
41
  case "auto_approved": return {
50
42
  title: t.approvedAutomatically,
51
- meta: i(c.approval_policy_name)
43
+ meta: i(l.approval_policy_name)
52
44
  };
53
- case "status_changed": return c.new_status === "canceled" ? { title: t.cancelled } : void 0;
45
+ case "status_changed": return l.new_status === "canceled" ? { title: t.cancelled } : void 0;
54
46
  case "reopened": return { title: t.reopened };
55
47
  case "marked_as_paid": return {
56
- title: o(c) ? t.paymentReleased : t.billMarkedAsFullyPaid,
48
+ title: o(l) ? t.paymentReleased : t.billMarkedAsFullyPaid,
57
49
  meta: s(n.paidIncrement, t)
58
50
  };
59
51
  case "marked_as_partially_paid": return {
60
- title: o(c) ? t.paymentReleased : t.billMarkedAsPartiallyPaid,
52
+ title: o(l) ? t.paymentReleased : t.billMarkedAsPartiallyPaid,
61
53
  meta: s(n.paidIncrement, t)
62
54
  };
63
55
  case "payment_reverted": return { title: t.paymentReverted };
64
56
  case "deleted": return { title: t.draftDeleted };
65
57
  case "file_attached": return {
66
58
  title: t.fileAttached,
67
- meta: i(c.file_name)
59
+ meta: i(l.file_name)
68
60
  };
69
61
  case "file_detached": return {
70
62
  title: t.fileRemoved,
71
- meta: i(c.file_name)
63
+ meta: i(l.file_name)
72
64
  };
73
65
  case "credit_note_linked": return { title: t.creditNoteLinked };
74
66
  case "credit_note_unlinked": return { title: t.creditNoteUnlinked };
@@ -87,55 +79,40 @@ function u(e, t, n, r) {
87
79
  default: return;
88
80
  }
89
81
  }
90
- function d(e) {
91
- let t = /* @__PURE__ */ new Map(), r = 0, i, a = 0, o = [...e].sort((e, t) => Date.parse(e.timestamp) - Date.parse(t.timestamp));
92
- for (let e of o) {
93
- let o = e.event_data ?? {};
82
+ function u(e) {
83
+ let t = /* @__PURE__ */ new Map(), n = 0, r = [...e].sort((e, t) => Date.parse(e.timestamp) - Date.parse(t.timestamp));
84
+ for (let e of r) {
85
+ let r = e.event_data ?? {};
94
86
  switch (e.event_type) {
95
- case "submitted_for_approval":
96
- r = 0, i = void 0;
97
- break;
98
- case "approval_requested": {
99
- r = 0;
100
- let e = o.required_approval_count;
101
- i = typeof e == "number" && e > 0 ? e : void 0;
102
- break;
103
- }
104
- case "approval_action":
105
- n.has(o.action) && o.approval_source !== "force" && (r += 1, t.set(e.id, { approval: {
106
- approved: r,
107
- required: i
108
- } }));
109
- break;
110
87
  case "marked_as_paid":
111
88
  case "marked_as_partially_paid":
112
89
  case "payment_reverted": {
113
- let n = o.amount_paid;
114
- if (typeof n != "number") break;
115
- let r = n - a;
116
- a = n, e.event_type !== "payment_reverted" && t.set(e.id, { paidIncrement: r > 0 ? r : n });
90
+ let i = r.amount_paid;
91
+ if (typeof i != "number") break;
92
+ let a = i - n;
93
+ n = i, e.event_type !== "payment_reverted" && t.set(e.id, { paidIncrement: a > 0 ? a : i });
117
94
  break;
118
95
  }
119
96
  }
120
97
  }
121
98
  return t;
122
99
  }
123
- function f(e, n, r) {
124
- let i = d(e);
100
+ function d(e, n, r) {
101
+ let i = u(e);
125
102
  return e.flatMap((e) => {
126
- let a = u(e, r, i.get(e.id) ?? {}, n);
103
+ let a = l(e, r, i.get(e.id) ?? {}, n);
127
104
  return a ? [{
128
105
  id: e.id,
129
106
  dateLabel: r.dateLabel(e.timestamp),
130
107
  timeLabel: r.timeLabel(e.timestamp),
131
- title: a.actorInMeta ? a.title : t(a.title, e, n, r),
108
+ title: t(a.title, e, n, r),
132
109
  meta: a.meta
133
110
  }] : [];
134
111
  });
135
112
  }
136
- function p(t, n, r) {
113
+ function f(t, n, r) {
137
114
  let i = new Set(n.map((e) => e.id));
138
115
  return t.some((t) => i.has(t.id) && t.recorded_by === "user" && !!t.entity_user_id && !e(t, r));
139
116
  }
140
117
  //#endregion
141
- export { f as buildPayableAuditHistory, p as hasUnattributedAuditRows };
118
+ export { d as buildPayableAuditHistory, f as hasUnattributedAuditRows };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.5.94",
3
+ "version": "0.5.95",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "packageDepSync": {