@tesouro/embedded-components-react 0.9.19 → 0.9.21

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.
@@ -3,31 +3,30 @@
3
3
  "use client";
4
4
  "use client";
5
5
  import { hasAnyScope as e } from "../../../../shared/data-access/dist/lib/hasAnyScope.js";
6
- import { useCurrentUserQuery as t } from "../../../../shared/data-access/dist/lib/useCurrentUserQuery.js";
7
- import { Scope as n } from "../../../../shared/data-access/dist/lib/scopes.js";
6
+ import { Scope as t } from "../../../../shared/data-access/dist/lib/scopes.js";
8
7
  import "../../../../shared/data-access/dist/index.js";
9
- import { useWidgetConfig as r } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
8
+ import { useWidgetConfig as n } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
9
  import "../../../../shared/feature/dist/index.js";
11
- import { usePayableApprovalRequestsQuery as i } from "../../data-access/dist/index2.js";
10
+ import { usePayableApprovalRequestsQuery as r } from "../../data-access/dist/index2.js";
12
11
  import "../../data-access/dist/index.js";
13
- import { currentApprovalRound as a } from "./index8.js";
14
- import { usePayableApprovalRoundStart as o } from "./index11.js";
12
+ import { currentApprovalRound as i } from "./index8.js";
13
+ import { usePayableApprovalRoundStart as a } from "./index11.js";
15
14
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index18.js
16
- function s({ payableId: s, status: c }) {
17
- let { initResponse: l } = r(), u = e(l?.scopes, [n.ApprovalRequestReadOrg]), d = c === "approve_in_progress" && u, { roundStartedAt: f } = o({
18
- payableId: s,
19
- enabled: d
20
- }), p = t({ enabled: d }), m = p.data?.id, h = (e) => e.caller_is_policy_approver ?? !!(m && e.user_ids.includes(m)), g = i(s, {
21
- enabled: d,
22
- hasAwaitedRequest: d ? (e) => a(e, f).some(h) : void 0,
23
- currentRoundStartedAt: f
24
- }), _ = d ? a(g.data?.data, f) : [], v = _.some(h), y = _.filter((e) => e.status === "waiting");
15
+ function o({ payableId: o, status: s }) {
16
+ let { initResponse: c } = n(), l = e(c?.scopes, [t.ApprovalRequestReadOrg]), u = s === "approve_in_progress" && l, { roundStartedAt: d } = a({
17
+ payableId: o,
18
+ enabled: u
19
+ }), f = c?.userId ?? void 0, p = (e) => e.caller_is_policy_approver ?? !!(f && e.user_ids.includes(f)), m = r(o, {
20
+ enabled: u,
21
+ hasAwaitedRequest: u ? (e) => i(e, d).some(p) : void 0,
22
+ currentRoundStartedAt: d
23
+ }), h = u ? i(m.data?.data, d) : [], g = h.some(p), _ = h.filter((e) => e.status === "waiting");
25
24
  return {
26
- id: y.filter(h).find((e) => !(m && (e.approved_by ?? []).includes(m)))?.id,
27
- isPolicyApprover: v,
28
- hasWaitingRequest: y.length > 0,
29
- isLoading: g.isLoading || p.isLoading
25
+ id: _.filter(p).find((e) => !(f && (e.approved_by ?? []).includes(f)))?.id,
26
+ isPolicyApprover: g,
27
+ hasWaitingRequest: _.length > 0,
28
+ isLoading: m.isLoading
30
29
  };
31
30
  }
32
31
  //#endregion
33
- export { s as useCurrentApprovalRequestId };
32
+ export { o as useCurrentApprovalRequestId };
@@ -15,7 +15,7 @@ function r({ counterpartId: r, billingAddressId: i, billingCountry: a, inlineCus
15
15
  counterpart_billing_address_id: i || void 0,
16
16
  counterpart_country: a,
17
17
  counterpart_type: d?.type ?? o,
18
- enabled: s && !!(d || o) && !(d && c) && !!(d || a)
18
+ enabled: s && !!(d || o) && !(d && c) && !!(i || a)
19
19
  }), p = !!f.data?.entity?.tax_id?.required, m = !!r && !d && (u.isLoading || u.isFetching);
20
20
  return {
21
21
  counterpart: d,
@@ -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.9.19", n = "e5b0e315b1696d214e7681ed5cc4042a3a098d79", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.9.21", n = "d0d0d781706d4852340ed5b5cbb73fbb65e2ef93", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.9.19",
3
+ "version": "0.9.21",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": [